[Mesa-dev] [Bug 83445] eglSwapBuffers() crash on dri
https://bugs.freedesktop.org/show_bug.cgi?id=83445 --- Comment #3 from Tapani Pälli lem...@gmail.com --- Lionel, could you specify a minimal testcase for this? I'm not able to reproduce this using a small app (egl and gles2) that just calls eglSwapBuffers() few times (with or without glclear calls in between). -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 83445] eglSwapBuffers() crash on dri
https://bugs.freedesktop.org/show_bug.cgi?id=83445 --- Comment #4 from Tapani Pälli lem...@gmail.com --- (In reply to Tapani Pälli from comment #3) Lionel, could you specify a minimal testcase for this? I'm not able to reproduce this using a small app (egl and gles2) that just calls eglSwapBuffers() few times (with or without glclear calls in between). Oops, now I realized I'm using 'x11' platform and that is why my test works. Anyway, a small test case (for piglit) would be nice. I see that Wayland platform has identical behavior. -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] egl/drm: do not crash when swapping buffers without any rendering
Reviewed-by: Tapani Pälli tapani.pa...@intel.com (This is a fix for https://bugs.freedesktop.org/show_bug.cgi?id=83445) On 10/14/2014 12:48 PM, Lionel Landwerlin wrote: Signed-off-by: Lionel Landwerlin lionel.g.landwer...@intel.com --- src/egl/drivers/dri2/platform_drm.c | 8 1 file changed, 8 insertions(+) diff --git a/src/egl/drivers/dri2/platform_drm.c b/src/egl/drivers/dri2/platform_drm.c index 70bd7d4..f6b9c3a 100644 --- a/src/egl/drivers/dri2/platform_drm.c +++ b/src/egl/drivers/dri2/platform_drm.c @@ -418,6 +418,14 @@ dri2_drm_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw) for (i = 0; i ARRAY_SIZE(dri2_surf-color_buffers); i++) if (dri2_surf-color_buffers[i].age 0) dri2_surf-color_buffers[i].age++; + + /* Make sure we have a back buffer in case we're swapping without + * ever rendering. */ + if (get_back_bo(dri2_surf) 0) { +_eglError(EGL_BAD_ALLOC, dri2_swap_buffers); +return EGL_FALSE; + } + dri2_surf-current = dri2_surf-back; dri2_surf-current-age = 1; dri2_surf-back = NULL; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] st/va: refactored handleVASliceDataBufferType v2
From: Michael Varga michael.va...@amd.com This patch cleans the function handleVASliceDataBufferType() for better readability. v2 (chk): minor commit message changes Signed-off-by: Michael Varga michael.va...@amd.com Signed-off-by: Christian König christian.koe...@amd.com --- src/gallium/state_trackers/va/picture.c | 75 ++--- 1 file changed, 40 insertions(+), 35 deletions(-) diff --git a/src/gallium/state_trackers/va/picture.c b/src/gallium/state_trackers/va/picture.c index 57d1fb1..8775681 100644 --- a/src/gallium/state_trackers/va/picture.c +++ b/src/gallium/state_trackers/va/picture.c @@ -272,51 +272,56 @@ handleSliceParameterBuffer(vlVaContext *context, vlVaBuffer *buf) } } +static unsigned int +bufHasStartcode(vlVaBuffer *buf, unsigned int code, unsigned int bits) +{ + struct vl_vlc vlc = {0}; + int i; + + /* search the first 64 bytes for a startcode */ + vl_vlc_init(vlc, 1, (const void * const*)buf-data, buf-size); + for (i = 0; i 64 vl_vlc_bits_left(vlc) = bits; ++i) { + if (vl_vlc_peekbits(vlc, bits) == code) + return 1; + vl_vlc_eatbits(vlc, 8); + vl_vlc_fillbits(vlc); + } + + return 0; +} + static void handleVASliceDataBufferType(vlVaContext *context, vlVaBuffer *buf) { + enum pipe_video_format format; unsigned num_buffers = 0; void * const *buffers[2]; unsigned sizes[2]; - enum pipe_video_format format; + static const uint8_t start_code_h264[] = { 0x00, 0x00, 0x01 }; + static const uint8_t start_code_vc1[] = { 0x00, 0x00, 0x01, 0x0d }; format = u_reduce_video_profile(context-decoder-profile); - if (format == PIPE_VIDEO_FORMAT_MPEG4_AVC || - format == PIPE_VIDEO_FORMAT_VC1) { - struct vl_vlc vlc = {0}; - bool found = false; - int peek_bits, i; - - /* search the first 64 bytes for a startcode */ - vl_vlc_init(vlc, 1, (const void * const*)buf-data, buf-size); - peek_bits = (format == PIPE_VIDEO_FORMAT_MPEG4_AVC) ? 24 : 32; - for (i = 0; i 64 vl_vlc_bits_left(vlc) = peek_bits; ++i) { - uint32_t value = vl_vlc_peekbits(vlc, peek_bits); - if ((format == PIPE_VIDEO_FORMAT_MPEG4_AVC value == 0x01) || -(format == PIPE_VIDEO_FORMAT_VC1 (value == 0x010d || -value == 0x010c || value == 0x010b))) { -found = true; + switch (format) { + case PIPE_VIDEO_FORMAT_MPEG4_AVC: + if (bufHasStartcode(buf, 0x01, 24)) break; - } - vl_vlc_eatbits(vlc, 8); - vl_vlc_fillbits(vlc); - } - /* none found, ok add one manually */ - if (!found) { - static const uint8_t start_code_h264[] = { 0x00, 0x00, 0x01 }; - static const uint8_t start_code_vc1[] = { 0x00, 0x00, 0x01, 0x0d }; - - if (format == PIPE_VIDEO_FORMAT_MPEG4_AVC) { -buffers[num_buffers] = (void *const)start_code_h264; -sizes[num_buffers] = sizeof(start_code_h264); - } - else { -buffers[num_buffers] = (void *const)start_code_vc1; -sizes[num_buffers] = sizeof(start_code_vc1); - } - ++num_buffers; - } + + buffers[num_buffers] = (void *const)start_code_h264; + sizes[num_buffers++] = sizeof(start_code_h264); + break; + case PIPE_VIDEO_FORMAT_VC1: + if (bufHasStartcode(buf, 0x010d, 32) || + bufHasStartcode(buf, 0x010c, 32) || + bufHasStartcode(buf, 0x010b, 32)) + break; + + buffers[num_buffers] = (void *const)start_code_vc1; + sizes[num_buffers++] = sizeof(start_code_vc1); + break; + default: + break; } + buffers[num_buffers] = buf-data; sizes[num_buffers] = buf-size; ++num_buffers; -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 4/4] gallium: Enable ARB_clip_control for gallium drivers.
Hi, No gallium hardware driver implements clip_halfz, so this cannot be enabled yet. Marek On Wed, Oct 22, 2014 at 7:31 AM, mathias.froehl...@gmx.net wrote: From: Mathias Fröhlich mathias.froehl...@gmx.net Gallium should be prepared fine for ARB_clip_control. So enable this and mention it in the release notes. Signed-off-by: Mathias Froehlich mathias.froehl...@web.de --- docs/GL3.txt| 2 +- docs/relnotes/10.4.html | 1 + src/mesa/state_tracker/st_atom_rasterizer.c | 14 +- src/mesa/state_tracker/st_extensions.c | 1 + 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/GL3.txt b/docs/GL3.txt index 07d1d2c..2fe0da1 100644 --- a/docs/GL3.txt +++ b/docs/GL3.txt @@ -187,7 +187,7 @@ GL 4.4, GLSL 4.40: GL 4.5, GLSL 4.50: GL_ARB_ES3_1_compatibility not started - GL_ARB_clip_control not started + GL_ARB_clip_control DONE (gallium drivers) GL_ARB_conditional_render_inverted DONE (i965, nvc0, llvmpipe, softpipe) GL_ARB_cull_distance not started GL_ARB_derivative_controlDONE (i965, nv50, nvc0, r600) diff --git a/docs/relnotes/10.4.html b/docs/relnotes/10.4.html index 64cbfae..462eeb5 100644 --- a/docs/relnotes/10.4.html +++ b/docs/relnotes/10.4.html @@ -46,6 +46,7 @@ Note: some of the new features are only available with certain drivers. ul liGL_ARB_sample_shading on r600/li liGL_ARB_texture_view on nv50, nvc0/li +liGL_ARB_clip_control on gallium drivers/li /ul diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index a228538..050160d 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -71,6 +71,11 @@ static void update_raster_state( struct st_context *st ) { raster-front_ccw = (ctx-Polygon.FrontFace == GL_CCW); + /* _NEW_VIEWPORT */ + if (ctx-ClipControl.Origin == GL_UPPER_LEFT) { + raster-front_ccw ^= 1; + } + /* * Gallium's surfaces are Y=0=TOP orientation. OpenGL is the * opposite. Window system surfaces are Y=0=TOP. Mesa's FBOs @@ -234,6 +239,12 @@ static void update_raster_state( struct st_context *st ) raster-half_pixel_center = 1; if (st_fb_orientation(ctx-DrawBuffer) == Y_0_TOP) raster-bottom_edge_rule = 1; + /* _NEW_VIEWPORT */ + if (ctx-ClipControl.Origin == GL_UPPER_LEFT) + raster-bottom_edge_rule ^= 1; + + /* _NEW_VIEWPORT */ + raster-clip_halfz = (ctx-ClipControl.Depth == GL_ZERO_TO_ONE); /* ST_NEW_RASTERIZER */ raster-rasterizer_discard = ctx-RasterDiscard; @@ -265,7 +276,8 @@ const struct st_tracked_state st_update_rasterizer = { _NEW_PROGRAM | _NEW_SCISSOR | _NEW_FRAG_CLAMP | - _NEW_TRANSFORM), /* mesa state dependencies*/ + _NEW_TRANSFORM | + _NEW_VIEWPORT), /* mesa state dependencies*/ (ST_NEW_VERTEX_PROGRAM | ST_NEW_RASTERIZER), /* state tracker dependencies */ }, diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 5dd8278..e22347b 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -585,6 +585,7 @@ void st_init_extensions(struct pipe_screen *screen, * Extensions that are supported by all Gallium drivers: */ extensions-ARB_ES2_compatibility = GL_TRUE; + extensions-ARB_clip_control = GL_TRUE; extensions-ARB_draw_elements_base_vertex = GL_TRUE; extensions-ARB_explicit_attrib_location = GL_TRUE; extensions-ARB_explicit_uniform_location = GL_TRUE; -- 1.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] r300g: implement pipe_rasterizer_state::clip_halfz
From: Marek Olšák marek.ol...@amd.com --- src/gallium/drivers/r300/r300_context.h | 1 + src/gallium/drivers/r300/r300_emit.c| 1 + src/gallium/drivers/r300/r300_state.c | 7 +++ 3 files changed, 9 insertions(+) diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 92a35d5..4d2b153 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -580,6 +580,7 @@ struct r300_context { /* Whether two-sided color selection is enabled (AKA light_twoside). */ boolean two_sided_color; boolean flatshade; +boolean clip_halfz; /* Whether fast color clear is enabled. */ boolean cbzb_clear; /* Whether fragment shader needs to be validated. */ diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index b201334..b632963 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -1136,6 +1136,7 @@ void r300_emit_vs_state(struct r300_context* r300, unsigned size, void* state) R300_PVS_NUM_CNTLRS(pvs_num_controllers) | R300_PVS_NUM_FPUS(r300screen-caps.num_vert_fpus) | R300_PVS_VF_MAX_VTX_NUM(12) | +(r300-clip_halfz ? R300_DX_CLIP_SPACE_DEF : 0) | (r300screen-caps.is_r500 ? R500_TCL_STATE_OPTIMIZATION : 0)); /* Emit flow control instructions. Even if there are no fc instructions, diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index fd67e35..cfcc19d 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1390,6 +1390,7 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state) boolean last_two_sided_color = r300-two_sided_color; boolean last_msaa_enable = r300-msaa_enable; boolean last_flatshade = r300-flatshade; +boolean last_clip_halfz = r300-clip_halfz; if (r300-draw rs) { draw_set_rasterizer_state(r300-draw, rs-rs_draw, state); @@ -1401,12 +1402,14 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state) r300-two_sided_color = rs-rs.light_twoside; r300-msaa_enable = rs-rs.multisample; r300-flatshade = rs-rs.flatshade; +r300-clip_halfz = rs-rs.clip_halfz; } else { r300-polygon_offset_enabled = FALSE; r300-sprite_coord_enable = 0; r300-two_sided_color = FALSE; r300-msaa_enable = FALSE; r300-flatshade = FALSE; +r300-clip_halfz = FALSE; } UPDATE_STATE(state, r300-rs_state); @@ -1428,6 +1431,10 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state) r300-fs_status = FRAGMENT_SHADER_MAYBE_DIRTY; } } + +if (last_clip_halfz != r300-clip_halfz) { +r300_mark_atom_dirty(r300, r300-vs_state); +} } /* Free rasterizer state. */ -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] r600g: implement pipe_rasterizer_state::clip_halfz
From: Marek Olšák marek.ol...@amd.com --- src/gallium/drivers/r600/evergreen_state.c | 1 + src/gallium/drivers/r600/r600_state.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 78c1b68..f74dd91 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -476,6 +476,7 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx, S_028A0C_REPEAT_COUNT(state-line_stipple_factor) : 0; rs-pa_cl_clip_cntl = S_028810_PS_UCP_MODE(3) | + S_028810_DX_CLIP_SPACE_DEF(state-clip_halfz) | S_028810_ZCLIP_NEAR_DISABLE(!state-depth_clip) | S_028810_ZCLIP_FAR_DISABLE(!state-depth_clip) | S_028810_DX_LINEAR_ATTR_CLIP_ENA(1) | diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 1f933ef..8dc25da 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -461,6 +461,7 @@ static void *r600_create_rs_state(struct pipe_context *ctx, S_028A0C_REPEAT_COUNT(state-line_stipple_factor) : 0; rs-pa_cl_clip_cntl = S_028810_PS_UCP_MODE(3) | + S_028810_DX_CLIP_SPACE_DEF(state-clip_halfz) | S_028810_ZCLIP_NEAR_DISABLE(!state-depth_clip) | S_028810_ZCLIP_FAR_DISABLE(!state-depth_clip) | S_028810_DX_LINEAR_ATTR_CLIP_ENA(1); -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/3] radeonsi: implement pipe_rasterizer_state::clip_halfz
From: Marek Olšák marek.ol...@amd.com --- src/gallium/drivers/radeonsi/si_state.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index c845df1..16d8493 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -607,6 +607,7 @@ static void *si_create_rs_state(struct pipe_context *ctx, S_028814_POLYMODE_BACK_PTYPE(si_translate_fill(state-fill_back)); rs-pa_cl_clip_cntl = S_028810_PS_UCP_MODE(3) | + S_028810_DX_CLIP_SPACE_DEF(state-clip_halfz) | S_028810_ZCLIP_NEAR_DISABLE(!state-depth_clip) | S_028810_ZCLIP_FAR_DISABLE(!state-depth_clip) | S_028810_DX_RASTERIZATION_KILL(state-rasterizer_discard) | -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] radeonsi: implement pipe_rasterizer_state::clip_halfz
On 22.10.2014 18:02, Marek Olšák wrote: From: Marek Olšák marek.ol...@amd.com --- src/gallium/drivers/radeonsi/si_state.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index c845df1..16d8493 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -607,6 +607,7 @@ static void *si_create_rs_state(struct pipe_context *ctx, S_028814_POLYMODE_BACK_PTYPE(si_translate_fill(state-fill_back)); rs-pa_cl_clip_cntl = S_028810_PS_UCP_MODE(3) | + S_028810_DX_CLIP_SPACE_DEF(state-clip_halfz) | S_028810_ZCLIP_NEAR_DISABLE(!state-depth_clip) | S_028810_ZCLIP_FAR_DISABLE(!state-depth_clip) | S_028810_DX_RASTERIZATION_KILL(state-rasterizer_discard) | Reviewed-by: Michel Dänzer michel.daen...@amd.com The other two patches seem fine as well. -- Earthling Michel Dänzer| http://www.amd.com Libre software enthusiast |Mesa and X developer ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 4/4] gallium: Enable ARB_clip_control for gallium drivers.
Am 22.10.2014 um 07:31 schrieb mathias.froehl...@gmx.net: From: Mathias Fröhlich mathias.froehl...@gmx.net Gallium should be prepared fine for ARB_clip_control. So enable this and mention it in the release notes. Signed-off-by: Mathias Froehlich mathias.froehl...@web.de --- docs/GL3.txt| 2 +- docs/relnotes/10.4.html | 1 + src/mesa/state_tracker/st_atom_rasterizer.c | 14 +- src/mesa/state_tracker/st_extensions.c | 1 + 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/GL3.txt b/docs/GL3.txt index 07d1d2c..2fe0da1 100644 --- a/docs/GL3.txt +++ b/docs/GL3.txt @@ -187,7 +187,7 @@ GL 4.4, GLSL 4.40: GL 4.5, GLSL 4.50: GL_ARB_ES3_1_compatibility not started - GL_ARB_clip_control not started + GL_ARB_clip_control DONE (gallium drivers) GL_ARB_conditional_render_inverted DONE (i965, nvc0, llvmpipe, softpipe) GL_ARB_cull_distance not started GL_ARB_derivative_controlDONE (i965, nv50, nvc0, r600) diff --git a/docs/relnotes/10.4.html b/docs/relnotes/10.4.html index 64cbfae..462eeb5 100644 --- a/docs/relnotes/10.4.html +++ b/docs/relnotes/10.4.html @@ -46,6 +46,7 @@ Note: some of the new features are only available with certain drivers. ul liGL_ARB_sample_shading on r600/li liGL_ARB_texture_view on nv50, nvc0/li +liGL_ARB_clip_control on gallium drivers/li /ul diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index a228538..050160d 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -71,6 +71,11 @@ static void update_raster_state( struct st_context *st ) { raster-front_ccw = (ctx-Polygon.FrontFace == GL_CCW); + /* _NEW_VIEWPORT */ + if (ctx-ClipControl.Origin == GL_UPPER_LEFT) { + raster-front_ccw ^= 1; + } + /* * Gallium's surfaces are Y=0=TOP orientation. OpenGL is the * opposite. Window system surfaces are Y=0=TOP. Mesa's FBOs @@ -234,6 +239,12 @@ static void update_raster_state( struct st_context *st ) raster-half_pixel_center = 1; if (st_fb_orientation(ctx-DrawBuffer) == Y_0_TOP) raster-bottom_edge_rule = 1; + /* _NEW_VIEWPORT */ + if (ctx-ClipControl.Origin == GL_UPPER_LEFT) + raster-bottom_edge_rule ^= 1; + + /* _NEW_VIEWPORT */ + raster-clip_halfz = (ctx-ClipControl.Depth == GL_ZERO_TO_ONE); /* ST_NEW_RASTERIZER */ raster-rasterizer_discard = ctx-RasterDiscard; @@ -265,7 +276,8 @@ const struct st_tracked_state st_update_rasterizer = { _NEW_PROGRAM | _NEW_SCISSOR | _NEW_FRAG_CLAMP | - _NEW_TRANSFORM), /* mesa state dependencies*/ + _NEW_TRANSFORM | + _NEW_VIEWPORT), /* mesa state dependencies*/ (ST_NEW_VERTEX_PROGRAM | ST_NEW_RASTERIZER), /* state tracker dependencies */ }, diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 5dd8278..e22347b 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -585,6 +585,7 @@ void st_init_extensions(struct pipe_screen *screen, * Extensions that are supported by all Gallium drivers: */ extensions-ARB_ES2_compatibility = GL_TRUE; + extensions-ARB_clip_control = GL_TRUE; extensions-ARB_draw_elements_base_vertex = GL_TRUE; extensions-ARB_explicit_attrib_location = GL_TRUE; extensions-ARB_explicit_uniform_location = GL_TRUE; I agree with Marek this should have a cap bit if not all drivers support it (we got away without it as only some non-public state tracker used it which only got used with some drivers, but exposing this in GL is different). Roland ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/3] r300g: implement pipe_rasterizer_state::clip_halfz
On Wed, Oct 22, 2014 at 5:02 AM, Marek Olšák mar...@gmail.com wrote: From: Marek Olšák marek.ol...@amd.com For the series: Reviewed-by: Alex Deucher alexander.deuc...@amd.com --- src/gallium/drivers/r300/r300_context.h | 1 + src/gallium/drivers/r300/r300_emit.c| 1 + src/gallium/drivers/r300/r300_state.c | 7 +++ 3 files changed, 9 insertions(+) diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 92a35d5..4d2b153 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -580,6 +580,7 @@ struct r300_context { /* Whether two-sided color selection is enabled (AKA light_twoside). */ boolean two_sided_color; boolean flatshade; +boolean clip_halfz; /* Whether fast color clear is enabled. */ boolean cbzb_clear; /* Whether fragment shader needs to be validated. */ diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index b201334..b632963 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -1136,6 +1136,7 @@ void r300_emit_vs_state(struct r300_context* r300, unsigned size, void* state) R300_PVS_NUM_CNTLRS(pvs_num_controllers) | R300_PVS_NUM_FPUS(r300screen-caps.num_vert_fpus) | R300_PVS_VF_MAX_VTX_NUM(12) | +(r300-clip_halfz ? R300_DX_CLIP_SPACE_DEF : 0) | (r300screen-caps.is_r500 ? R500_TCL_STATE_OPTIMIZATION : 0)); /* Emit flow control instructions. Even if there are no fc instructions, diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index fd67e35..cfcc19d 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1390,6 +1390,7 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state) boolean last_two_sided_color = r300-two_sided_color; boolean last_msaa_enable = r300-msaa_enable; boolean last_flatshade = r300-flatshade; +boolean last_clip_halfz = r300-clip_halfz; if (r300-draw rs) { draw_set_rasterizer_state(r300-draw, rs-rs_draw, state); @@ -1401,12 +1402,14 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state) r300-two_sided_color = rs-rs.light_twoside; r300-msaa_enable = rs-rs.multisample; r300-flatshade = rs-rs.flatshade; +r300-clip_halfz = rs-rs.clip_halfz; } else { r300-polygon_offset_enabled = FALSE; r300-sprite_coord_enable = 0; r300-two_sided_color = FALSE; r300-msaa_enable = FALSE; r300-flatshade = FALSE; +r300-clip_halfz = FALSE; } UPDATE_STATE(state, r300-rs_state); @@ -1428,6 +1431,10 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state) r300-fs_status = FRAGMENT_SHADER_MAYBE_DIRTY; } } + +if (last_clip_halfz != r300-clip_halfz) { +r300_mark_atom_dirty(r300, r300-vs_state); +} } /* Free rasterizer state. */ -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [r600g] Is LLVM-compiler (--enable-r600-llvm-compiler) usable, now?
Hello Michel, subject say it all ;-) Second, we are now nearly on par with 3.16 on RV730 (AGP) with all your latest work, but I think about what we could get if we find the right commit between 3.16 (.4 here) and 3.17-rc1 (the transition from 3.16 to 3.17-next). I do not have 3.16.x around (it is not any longer in the openSUSE kernel current tree) but with latest 3.16.4 I was faster then with all 3.17.x and 3.18/3.19-next kernels. bisect do not work right or I couldn't revert the 'right' commit. WC helped on RV730 (AGP) with some apps, here: mesa-demos e.g. vsraytrace fsraytrace objview Any ideas? -Dieter ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 0/4] Implement clip control
Hi Chris, On Wednesday, October 22, 2014 18:54:08 Chris Forbes wrote: Do you have piglit tests to go with this? Yes, just posted onto the piglit list. Greetings Mathias ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 4/4] gallium: Enable ARB_clip_control for gallium drivers.
Hi, On Wednesday, October 22, 2014 16:49:26 Roland Scheidegger wrote: I agree with Marek this should have a cap bit if not all drivers support it (we got away without it as only some non-public state tracker used it which only got used with some drivers, but exposing this in GL is different). Sure. A new series with a new gallium capability is underway. Thanks! Mathias ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 5/5] gallium: Enable ARB_clip_control for gallium drivers.
From: Mathias Fröhlich mathias.froehl...@gmx.net Gallium should be prepared fine for ARB_clip_control. So enable this and mention it in the release notes. v2: Only enable for drivers announcing the freshly introduced PIPE_CAP_CLIP_HALFZ capability. Signed-off-by: Mathias Froehlich mathias.froehl...@web.de --- docs/GL3.txt| 2 +- docs/relnotes/10.4.html | 1 + src/mesa/state_tracker/st_atom_rasterizer.c | 14 +- src/mesa/state_tracker/st_extensions.c | 5 + 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/docs/GL3.txt b/docs/GL3.txt index 07d1d2c..35b7678 100644 --- a/docs/GL3.txt +++ b/docs/GL3.txt @@ -187,7 +187,7 @@ GL 4.4, GLSL 4.40: GL 4.5, GLSL 4.50: GL_ARB_ES3_1_compatibility not started - GL_ARB_clip_control not started + GL_ARB_clip_control DONE (llvmpipe, softpipe) GL_ARB_conditional_render_inverted DONE (i965, nvc0, llvmpipe, softpipe) GL_ARB_cull_distance not started GL_ARB_derivative_controlDONE (i965, nv50, nvc0, r600) diff --git a/docs/relnotes/10.4.html b/docs/relnotes/10.4.html index 64cbfae..4c7af47 100644 --- a/docs/relnotes/10.4.html +++ b/docs/relnotes/10.4.html @@ -46,6 +46,7 @@ Note: some of the new features are only available with certain drivers. ul liGL_ARB_sample_shading on r600/li liGL_ARB_texture_view on nv50, nvc0/li +liGL_ARB_clip_control on llvmpipe, softpipe/li /ul diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index dfa728b..31d7776 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -72,6 +72,11 @@ static void update_raster_state( struct st_context *st ) { raster-front_ccw = (ctx-Polygon.FrontFace == GL_CCW); + /* _NEW_VIEWPORT */ + if (ctx-ClipControl.Origin == GL_UPPER_LEFT) { + raster-front_ccw ^= 1; + } + /* * Gallium's surfaces are Y=0=TOP orientation. OpenGL is the * opposite. Window system surfaces are Y=0=TOP. Mesa's FBOs @@ -241,6 +246,12 @@ static void update_raster_state( struct st_context *st ) raster-half_pixel_center = 1; if (st_fb_orientation(ctx-DrawBuffer) == Y_0_TOP) raster-bottom_edge_rule = 1; + /* _NEW_VIEWPORT */ + if (ctx-ClipControl.Origin == GL_UPPER_LEFT) + raster-bottom_edge_rule ^= 1; + + /* _NEW_VIEWPORT */ + raster-clip_halfz = (ctx-ClipControl.Depth == GL_ZERO_TO_ONE); /* ST_NEW_RASTERIZER */ raster-rasterizer_discard = ctx-RasterDiscard; @@ -272,7 +283,8 @@ const struct st_tracked_state st_update_rasterizer = { _NEW_PROGRAM | _NEW_SCISSOR | _NEW_FRAG_CLAMP | - _NEW_TRANSFORM), /* mesa state dependencies*/ + _NEW_TRANSFORM | + _NEW_VIEWPORT), /* mesa state dependencies*/ (ST_NEW_VERTEX_PROGRAM | ST_NEW_RASTERIZER), /* state tracker dependencies */ }, diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 78bfe30..4a3f055 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -889,4 +889,9 @@ void st_init_extensions(struct pipe_screen *screen, PIPE_VIDEO_CAP_SUPPORTS_INTERLACED)) { extensions-NV_vdpau_interop = GL_TRUE; } + + /* ARB_clip_control */ + if (screen-get_param(screen, PIPE_CAP_CLIP_HALFZ)) { + extensions-ARB_clip_control = GL_TRUE; + } } -- 1.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/5] mesa: Implement ARB_clip_control.
From: Mathias Fröhlich mathias.froehl...@gmx.net Implement the mesa parts of ARB_clip_control. So far no driver enables this. Signed-off-by: Mathias Froehlich mathias.froehl...@web.de --- src/mapi/glapi/gen/ARB_clip_control.xml | 25 +++ src/mapi/glapi/gen/gl_API.xml | 4 +- src/mesa/main/dlist.c | 26 +++ src/mesa/main/extensions.c | 1 + src/mesa/main/get_hash_params.py| 2 + src/mesa/main/mtypes.h | 12 + src/mesa/main/polygon.c | 5 ++- src/mesa/main/tests/dispatch_sanity.cpp | 3 ++ src/mesa/main/viewport.c| 79 +++-- src/mesa/main/viewport.h| 3 ++ 10 files changed, 154 insertions(+), 6 deletions(-) create mode 100644 src/mapi/glapi/gen/ARB_clip_control.xml diff --git a/src/mapi/glapi/gen/ARB_clip_control.xml b/src/mapi/glapi/gen/ARB_clip_control.xml new file mode 100644 index 000..2973a31 --- /dev/null +++ b/src/mapi/glapi/gen/ARB_clip_control.xml @@ -0,0 +1,25 @@ +?xml version=1.0? +!DOCTYPE OpenGLAPI SYSTEM gl_API.dtd + +OpenGLAPI + +category name=GL_ARB_clip_control number=160 + +enum name=LOWER_LEFT value = 0x8CA1/ +enum name=UPPER_LEFT value = 0x8CA2/ + +enum name=NEGATIVE_ONE_TO_ONE value = 0x935E/ +enum name=ZERO_TO_ONE value = 0x935F/ + +enum name=CLIP_ORIGIN value = 0x935C/ +enum name=CLIP_DEPTH_MODE value = 0x935D/ + +function name=ClipControl offset=assign +param name=origin type=GLenum/ +param name=depth type=GLenum/ +glx rop=1340/ +/function + +/category + +/OpenGLAPI diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index 73f2f75..534e6a0 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -8364,7 +8364,9 @@ xi:include href=ARB_multi_bind.xml xmlns:xi=http://www.w3.org/2001/XInclude/ -!-- ARB extensions 148 - 160 -- +!-- ARB extensions 148 - 159 -- + +xi:include href=ARB_clip_control.xml xmlns:xi=http://www.w3.org/2001/XInclude/ category name=GL_ARB_conditional_render_inverted number=161 enum name=QUERY_WAIT_INVERTED value=0x8E17/ diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 5c7160d..4b7b060 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -398,6 +398,9 @@ typedef enum OPCODE_PROGRAM_UNIFORM_MATRIX34F, OPCODE_PROGRAM_UNIFORM_MATRIX43F, + /* GL_ARB_clip_control */ + OPCODE_CLIP_CONTROL, + /* GL_ARB_color_buffer_float */ OPCODE_CLAMP_COLOR, @@ -7208,6 +7211,22 @@ save_ProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, } static void GLAPIENTRY +save_ClipControl(GLenum origin, GLenum depth) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_CLIP_CONTROL, 2); + if (n) { + n[1].e = origin; + n[2].e = depth; + } + if (ctx-ExecuteFlag) { + CALL_ClipControl(ctx-Exec, (origin, depth)); + } +} + +static void GLAPIENTRY save_ClampColorARB(GLenum target, GLenum clamp) { GET_CURRENT_CONTEXT(ctx); @@ -8617,6 +8636,10 @@ execute_list(struct gl_context *ctx, GLuint list) get_pointer(n[5]))); break; + case OPCODE_CLIP_CONTROL: +CALL_ClipControl(ctx-Exec, (n[1].e, n[2].e)); +break; + case OPCODE_CLAMP_COLOR: CALL_ClampColor(ctx-Exec, (n[1].e, n[2].e)); break; @@ -9551,6 +9574,9 @@ _mesa_initialize_save_table(const struct gl_context *ctx) SET_TexParameterIiv(table, save_TexParameterIiv); SET_TexParameterIuiv(table, save_TexParameterIuiv); + /* GL_ARB_clip_control */ + SET_ClipControl(table, save_ClipControl); + /* GL_ARB_color_buffer_float */ SET_ClampColor(table, save_ClampColorARB); diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index f0e2f89..15d66a7 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -91,6 +91,7 @@ static const struct extension extension_table[] = { { GL_ARB_buffer_storage, o(ARB_buffer_storage), GL, 2013 }, { GL_ARB_clear_buffer_object, o(dummy_true), GL, 2012 }, { GL_ARB_clear_texture, o(ARB_clear_texture), GL, 2013 }, + { GL_ARB_clip_control,o(ARB_clip_control), GL, 2014 }, { GL_ARB_color_buffer_float, o(ARB_color_buffer_float), GL, 2004 }, { GL_ARB_compressed_texture_pixel_storage,o(dummy_true), GL, 2011 }, { GL_ARB_compute_shader, o(ARB_compute_shader), GL, 2012 }, diff --git
[Mesa-dev] [PATCH 4/5] gallium: introduce PIPE_CAP_CLIP_HALFZ.
From: Mathias Fröhlich mathias.froehl...@gmx.net In preparation of ARB_clip_control. Let the driver decide if it supports pipe_rasterizer_state::clip_halfz being set to true. Signed-off-by: Mathias Froehlich mathias.froehl...@web.de --- src/gallium/docs/source/screen.rst | 3 +++ src/gallium/drivers/freedreno/freedreno_screen.c | 1 + src/gallium/drivers/i915/i915_screen.c | 1 + src/gallium/drivers/ilo/ilo_screen.c | 1 + src/gallium/drivers/llvmpipe/lp_screen.c | 2 ++ src/gallium/drivers/nouveau/nv30/nv30_screen.c | 1 + src/gallium/drivers/nouveau/nv50/nv50_screen.c | 1 + src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 1 + src/gallium/drivers/r300/r300_screen.c | 1 + src/gallium/drivers/r600/r600_pipe.c | 1 + src/gallium/drivers/radeonsi/si_pipe.c | 1 + src/gallium/drivers/softpipe/sp_screen.c | 2 ++ src/gallium/drivers/svga/svga_screen.c | 1 + src/gallium/drivers/vc4/vc4_screen.c | 1 + src/gallium/include/pipe/p_defines.h | 1 + 15 files changed, 19 insertions(+) diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index 88d7e49..e711ad4 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -230,6 +230,9 @@ The integer capabilities: different than the underlying resource's, as permitted by ARB_texture_view. For example a 2d array texture may be reinterpreted as a cube (array) texture and vice-versa. +* ``PIPE_CAP_CLIP_HALFZ``: Whether the driver supports the + pipe_rasterizer_state::clip_halfz being set to true. This is required + for enabling ARB_clip_control. .. _pipe_capf: diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index 90156b4..7a3cd95 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -226,6 +226,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE: case PIPE_CAP_CONDITIONAL_RENDER_INVERTED: case PIPE_CAP_SAMPLER_VIEW_TARGET: + case PIPE_CAP_CLIP_HALFZ: return 0; case PIPE_CAP_MAX_VIEWPORTS: diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index 2a6e751..062f1a6 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -225,6 +225,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap) case PIPE_CAP_TEXTURE_GATHER_OFFSETS: case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION: case PIPE_CAP_CONDITIONAL_RENDER_INVERTED: + case PIPE_CAP_CLIP_HALFZ: return 0; case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS: diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c index 48c3dea..4e931fb 100644 --- a/src/gallium/drivers/ilo/ilo_screen.c +++ b/src/gallium/drivers/ilo/ilo_screen.c @@ -446,6 +446,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE: case PIPE_CAP_CONDITIONAL_RENDER_INVERTED: case PIPE_CAP_SAMPLER_VIEW_TARGET: + case PIPE_CAP_CLIP_HALFZ: return 0; case PIPE_CAP_VENDOR_ID: diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index a264f99..df47e53 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -277,6 +277,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) } case PIPE_CAP_UMA: return 0; + case PIPE_CAP_CLIP_HALFZ: + return 1; } /* should only get here on unhandled cases */ debug_printf(Unexpected PIPE_CAP %d query\n, param); diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c index 700b9bb..2b65f8c 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c @@ -156,6 +156,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE: case PIPE_CAP_CONDITIONAL_RENDER_INVERTED: case PIPE_CAP_SAMPLER_VIEW_TARGET: + case PIPE_CAP_CLIP_HALFZ: return 0; case PIPE_CAP_VENDOR_ID: diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c index d26a438..4ee5980 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c @@ -204,6 +204,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_COMPUTE: case PIPE_CAP_DRAW_INDIRECT: case PIPE_CAP_CONDITIONAL_RENDER_INVERTED: + case PIPE_CAP_CLIP_HALFZ: return 0; case PIPE_CAP_VENDOR_ID: diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
[Mesa-dev] [PATCH 3/5] mesa: Handle clip control in meta operations.
From: Mathias Fröhlich mathias.froehl...@gmx.net Restore clip control to the default state if MESA_META_VIEWPORT or MESA_META_DEPTH_TEST is requested. Signed-off-by: Mathias Froehlich mathias.froehl...@web.de --- src/mesa/drivers/common/meta.c | 13 + src/mesa/drivers/common/meta.h | 4 2 files changed, 17 insertions(+) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 7a8e627..119f327 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -494,6 +494,13 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) _mesa_set_enable(ctx, GL_DITHER, GL_TRUE); } + if (state MESA_META_CLIP_CONTROL) { + save-ClipControl = ctx-ClipControl; + if (ctx-ClipControl.Origin != GL_LOWER_LEFT || + ctx-ClipControl.Depth != GL_NEGATIVE_ONE_TO_ONE) + _mesa_ClipControl(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE); + } + if (state MESA_META_COLOR_MASK) { memcpy(save-ColorMask, ctx-Color.ColorMask, sizeof(ctx-Color.ColorMask)); @@ -856,6 +863,12 @@ _mesa_meta_end(struct gl_context *ctx) if (state MESA_META_DITHER) _mesa_set_enable(ctx, GL_DITHER, save-DitherFlag); + if (state MESA_META_CLIP_CONTROL) { + if (ctx-ClipControl.Origin != save-ClipControl.Origin || + ctx-ClipControl.Depth != save-ClipControl.Depth) + _mesa_ClipControl(save-ClipControl.Origin, save-ClipControl.Depth); + } + if (state MESA_META_COLOR_MASK) { GLuint i; for (i = 0; i ctx-Const.MaxDrawBuffers; i++) { diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index 2c9517b..08514ad 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -60,6 +60,7 @@ #define MESA_META_OCCLUSION_QUERY 0x40 #define MESA_META_DRAW_BUFFERS 0x80 #define MESA_META_DITHER 0x100 +#define MESA_META_CLIP_CONTROL(MESA_META_VIEWPORT|MESA_META_DEPTH_TEST) /**\}*/ /** @@ -88,6 +89,9 @@ struct save_state /** MESA_META_DITHER */ GLboolean DitherFlag; + /** MESA_META_CLIP_CONTROL */ + struct gl_clip_control ClipControl; + /** MESA_META_COLOR_MASK */ GLubyte ColorMask[MAX_DRAW_BUFFERS][4]; -- 1.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 0/5] Implement clip control v2
From: Mathias Fröhlich mathias.froehl...@gmx.net Hi, The next approach to bring decent depth buffer precision to mesa. The patch series implements ARB_clip_control in mesa and enables the extension for the gallium drivers. v2: Only enable on those gallium drivers that already support clip_halfz. Please review. Greetings Mathias Mathias Fröhlich (5): mesa: Refactor viewport transform computation. mesa: Implement ARB_clip_control. mesa: Handle clip control in meta operations. gallium: introduce PIPE_CAP_CLIP_HALFZ. gallium: Enable ARB_clip_control for gallium drivers. docs/GL3.txt | 2 +- docs/relnotes/10.4.html | 1 + src/gallium/docs/source/screen.rst | 3 + src/gallium/drivers/freedreno/freedreno_screen.c | 1 + src/gallium/drivers/i915/i915_screen.c | 1 + src/gallium/drivers/ilo/ilo_screen.c | 1 + src/gallium/drivers/llvmpipe/lp_screen.c | 2 + src/gallium/drivers/nouveau/nv30/nv30_screen.c | 1 + src/gallium/drivers/nouveau/nv50/nv50_screen.c | 1 + src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 1 + src/gallium/drivers/r300/r300_screen.c | 1 + src/gallium/drivers/r600/r600_pipe.c | 1 + src/gallium/drivers/radeonsi/si_pipe.c | 1 + src/gallium/drivers/softpipe/sp_screen.c | 2 + src/gallium/drivers/svga/svga_screen.c | 1 + src/gallium/drivers/vc4/vc4_screen.c | 1 + src/gallium/include/pipe/p_defines.h | 1 + src/mapi/glapi/gen/ARB_clip_control.xml | 25 + src/mapi/glapi/gen/gl_API.xml| 4 +- src/mesa/drivers/common/meta.c | 13 +++ src/mesa/drivers/common/meta.h | 4 + src/mesa/drivers/dri/i915/i915_state.c | 26 ++--- src/mesa/main/dlist.c| 26 + src/mesa/main/extensions.c | 1 + src/mesa/main/get_hash_params.py | 2 + src/mesa/main/mtypes.h | 12 +++ src/mesa/main/polygon.c | 5 +- src/mesa/main/state.c| 9 +- src/mesa/main/tests/dispatch_sanity.cpp | 3 + src/mesa/main/viewport.c | 118 --- src/mesa/main/viewport.h | 6 ++ src/mesa/math/m_matrix.c | 17 ++-- src/mesa/math/m_matrix.h | 4 +- src/mesa/state_tracker/st_atom_rasterizer.c | 14 ++- src/mesa/state_tracker/st_atom_viewport.c| 23 ++--- src/mesa/state_tracker/st_extensions.c | 5 + 36 files changed, 274 insertions(+), 65 deletions(-) create mode 100644 src/mapi/glapi/gen/ARB_clip_control.xml -- 1.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/5] mesa: Refactor viewport transform computation.
From: Mathias Fröhlich mathias.froehl...@gmx.net This is for preparation of ARB_clip_control. Signed-off-by: Mathias Froehlich mathias.froehl...@web.de --- src/mesa/drivers/dri/i915/i915_state.c| 26 ++--- src/mesa/main/state.c | 9 +++--- src/mesa/main/viewport.c | 47 --- src/mesa/main/viewport.h | 3 ++ src/mesa/math/m_matrix.c | 17 ++- src/mesa/math/m_matrix.h | 4 +-- src/mesa/state_tracker/st_atom_viewport.c | 23 +++ 7 files changed, 68 insertions(+), 61 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c index f31b271..f9aecba 100644 --- a/src/mesa/drivers/dri/i915/i915_state.c +++ b/src/mesa/drivers/dri/i915/i915_state.c @@ -34,6 +34,7 @@ #include main/dd.h #include main/state.h #include main/stencil.h +#include main/viewport.h #include tnl/tnl.h #include tnl/t_context.h @@ -401,26 +402,17 @@ void intelCalcViewport(struct gl_context * ctx) { struct intel_context *intel = intel_context(ctx); + double scale[3], translate[3]; + + _mesa_get_viewport_xform(ctx, 0, scale, translate); if (_mesa_is_winsys_fbo(ctx-DrawBuffer)) { - _math_matrix_viewport(intel-ViewportMatrix, - ctx-ViewportArray[0].X, - ctx-DrawBuffer-Height - ctx-ViewportArray[0].Y, - ctx-ViewportArray[0].Width, - -ctx-ViewportArray[0].Height, - ctx-ViewportArray[0].Near, - ctx-ViewportArray[0].Far, - 1.0); - } else { - _math_matrix_viewport(intel-ViewportMatrix, - ctx-ViewportArray[0].X, - ctx-ViewportArray[0].Y, - ctx-ViewportArray[0].Width, - ctx-ViewportArray[0].Height, - ctx-ViewportArray[0].Near, - ctx-ViewportArray[0].Far, - 1.0); + scale[1] = -scale[1]; + translate[1] = ctx-DrawBuffer-Height - translate[1]; } + + _math_matrix_viewport(intel-ViewportMatrix, + scale, translate, 1.0); } diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 80287c4..3dbbfaa 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -51,6 +51,7 @@ #include texobj.h #include texstate.h #include varray.h +#include viewport.h #include blend.h @@ -281,11 +282,11 @@ update_viewport_matrix(struct gl_context *ctx) * NOTE: RasterPos uses this. */ for (i = 0; i ctx-Const.MaxViewports; i++) { + double scale[3], translate[3]; + + _mesa_get_viewport_xform(ctx, i, scale, translate); _math_matrix_viewport(ctx-ViewportArray[i]._WindowMap, -ctx-ViewportArray[i].X, ctx-ViewportArray[i].Y, -ctx-ViewportArray[i].Width, ctx-ViewportArray[i].Height, -ctx-ViewportArray[i].Near, ctx-ViewportArray[i].Far, -depthMax); +scale, translate, depthMax); } } diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c index 222ae30..89766cf 100644 --- a/src/mesa/main/viewport.c +++ b/src/mesa/main/viewport.c @@ -39,6 +39,8 @@ set_viewport_no_notify(struct gl_context *ctx, unsigned idx, GLfloat x, GLfloat y, GLfloat width, GLfloat height) { + double scale[3], translate[3]; + /* clamp width and height to the implementation dependent range */ width = MIN2(width, (GLfloat) ctx-Const.MaxViewportWidth); height = MIN2(height, (GLfloat) ctx-Const.MaxViewportHeight); @@ -75,14 +77,9 @@ set_viewport_no_notify(struct gl_context *ctx, unsigned idx, * the WindowMap matrix being up to date in the driver's Viewport * and DepthRange functions. */ + _mesa_get_viewport_xform(ctx, idx, scale, translate); _math_matrix_viewport(ctx-ViewportArray[idx]._WindowMap, - ctx-ViewportArray[idx].X, - ctx-ViewportArray[idx].Y, - ctx-ViewportArray[idx].Width, - ctx-ViewportArray[idx].Height, - ctx-ViewportArray[idx].Near, - ctx-ViewportArray[idx].Far, - ctx-DrawBuffer-_DepthMaxF); + scale, translate, ctx-DrawBuffer-_DepthMaxF); #endif } @@ -248,6 +245,8 @@ static void set_depth_range_no_notify(struct gl_context *ctx, unsigned idx, GLclampd nearval, GLclampd farval) { + double scale[3], translate[3]; + if (ctx-ViewportArray[idx].Near == nearval ctx-ViewportArray[idx].Far == farval) return; @@ -261,14 +260,9 @@
Re: [Mesa-dev] [PATCH 5/5] gallium: Enable ARB_clip_control for gallium drivers.
On Wed, Oct 22, 2014 at 1:13 PM, mathias.froehl...@gmx.net wrote: From: Mathias Fröhlich mathias.froehl...@gmx.net Gallium should be prepared fine for ARB_clip_control. So enable this and mention it in the release notes. v2: Only enable for drivers announcing the freshly introduced PIPE_CAP_CLIP_HALFZ capability. Signed-off-by: Mathias Froehlich mathias.froehl...@web.de --- docs/GL3.txt| 2 +- docs/relnotes/10.4.html | 1 + src/mesa/state_tracker/st_atom_rasterizer.c | 14 +- src/mesa/state_tracker/st_extensions.c | 5 + 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/docs/GL3.txt b/docs/GL3.txt index 07d1d2c..35b7678 100644 --- a/docs/GL3.txt +++ b/docs/GL3.txt @@ -187,7 +187,7 @@ GL 4.4, GLSL 4.40: GL 4.5, GLSL 4.50: GL_ARB_ES3_1_compatibility not started - GL_ARB_clip_control not started + GL_ARB_clip_control DONE (llvmpipe, softpipe) GL_ARB_conditional_render_inverted DONE (i965, nvc0, llvmpipe, softpipe) GL_ARB_cull_distance not started GL_ARB_derivative_controlDONE (i965, nv50, nvc0, r600) diff --git a/docs/relnotes/10.4.html b/docs/relnotes/10.4.html index 64cbfae..4c7af47 100644 --- a/docs/relnotes/10.4.html +++ b/docs/relnotes/10.4.html @@ -46,6 +46,7 @@ Note: some of the new features are only available with certain drivers. ul liGL_ARB_sample_shading on r600/li liGL_ARB_texture_view on nv50, nvc0/li +liGL_ARB_clip_control on llvmpipe, softpipe/li /ul diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index dfa728b..31d7776 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -72,6 +72,11 @@ static void update_raster_state( struct st_context *st ) { raster-front_ccw = (ctx-Polygon.FrontFace == GL_CCW); + /* _NEW_VIEWPORT */ + if (ctx-ClipControl.Origin == GL_UPPER_LEFT) { + raster-front_ccw ^= 1; + } + /* * Gallium's surfaces are Y=0=TOP orientation. OpenGL is the * opposite. Window system surfaces are Y=0=TOP. Mesa's FBOs @@ -241,6 +246,12 @@ static void update_raster_state( struct st_context *st ) raster-half_pixel_center = 1; if (st_fb_orientation(ctx-DrawBuffer) == Y_0_TOP) raster-bottom_edge_rule = 1; + /* _NEW_VIEWPORT */ + if (ctx-ClipControl.Origin == GL_UPPER_LEFT) + raster-bottom_edge_rule ^= 1; + + /* _NEW_VIEWPORT */ + raster-clip_halfz = (ctx-ClipControl.Depth == GL_ZERO_TO_ONE); /* ST_NEW_RASTERIZER */ raster-rasterizer_discard = ctx-RasterDiscard; @@ -272,7 +283,8 @@ const struct st_tracked_state st_update_rasterizer = { _NEW_PROGRAM | _NEW_SCISSOR | _NEW_FRAG_CLAMP | - _NEW_TRANSFORM), /* mesa state dependencies*/ + _NEW_TRANSFORM | + _NEW_VIEWPORT), /* mesa state dependencies*/ (ST_NEW_VERTEX_PROGRAM | ST_NEW_RASTERIZER), /* state tracker dependencies */ }, diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 78bfe30..4a3f055 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -889,4 +889,9 @@ void st_init_extensions(struct pipe_screen *screen, PIPE_VIDEO_CAP_SUPPORTS_INTERLACED)) { extensions-NV_vdpau_interop = GL_TRUE; } + + /* ARB_clip_control */ + if (screen-get_param(screen, PIPE_CAP_CLIP_HALFZ)) { + extensions-ARB_clip_control = GL_TRUE; + } Take a look at the giant array of structs above this function... it lets you set extensions based on caps in a more integrated fashion. } -- 1.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [r600g] Is LLVM-compiler (--enable-r600-llvm-compiler) usable, now?
On Wed, Oct 22, 2014 at 12:49 PM, Dieter Nützel die...@nuetzel-hh.de wrote: Hello Michel, subject say it all ;-) The llvm support for r600g is for compute (OpenCL). The fact that is it somewhat usable for graphics is mainly for testing purposes. There are no plans to expand it to handle additional graphics features, although any interested parties are welcome to contribute to improving it. IIRC, even when you enable it, it currently only gets applied to compute shaders. Second, we are now nearly on par with 3.16 on RV730 (AGP) with all your latest work, but I think about what we could get if we find the right commit between 3.16 (.4 here) and 3.17-rc1 (the transition from 3.16 to 3.17-next). I do not have 3.16.x around (it is not any longer in the openSUSE kernel current tree) but with latest 3.16.4 I was faster then with all 3.17.x and 3.18/3.19-next kernels. bisect do not work right or I couldn't revert the 'right' commit. WC helped on RV730 (AGP) with some apps, here: How are you doing the bisection? If it's purely a performance issue it should be pretty straight forward. mesa-demos e.g. vsraytrace fsraytrace objview Any ideas? Can you provide some additional detail? It would probably be easier to track this in a bug report. Alex ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [RFC] egl: Add DRI3 support to the EGL backend.
Hi, This patch introduced DRI3 support to the EGL backend. Patch is on top of current master. With the patch you can observe reduced CPU stress when many glViewport calls are made. Notice that the DRI3 extension is only exposed if the DRI3 interface is found working too instead of just existing. So you need to enable DRI3 from all three; Mesa, X driver and X server, to get the benefit. Regards, Joonas PS. Will be traveling over the weekend, so will react to comments on Monday. From c945e777e0aaf77a5ec450cdec1cf4db89ef0c8d Mon Sep 17 00:00:00 2001 From: Joonas Lahtinen joonas.lahti...@linux.intel.com Date: Wed, 22 Oct 2014 21:05:31 +0300 Subject: [PATCH] egl: Add DRI3 support to the EGL backend. DRI3 support is needed to avoid excess buffer invalidations, because the XCB interface doesn't supply that information through DRI2. Signed-off-by: Daniel van der Wath danielx.j.van.der.w...@intel.com Signed-off-by: Joonas Lahtinen joonas.lahti...@linux.intel.com --- configure.ac|4 + include/GL/internal/dri_interface.h |8 + src/egl/drivers/dri2/egl_dri2.c |9 + src/egl/drivers/dri2/egl_dri2.h | 39 +++- src/egl/drivers/dri2/platform_x11.c | 340 ++- src/egl/main/Makefile.am|4 + src/mesa/drivers/dri/common/dri_util.c |2 + src/mesa/drivers/dri/common/dri_util.h |1 + src/mesa/drivers/dri/i965/brw_context.c | 12 +- 9 files changed, 406 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index 0ed9325..308fddf 100644 --- a/configure.ac +++ b/configure.ac @@ -43,6 +43,7 @@ VDPAU_REQUIRED=0.4.1 WAYLAND_REQUIRED=1.2.0 XCB_REQUIRED=1.9.3 XCBDRI2_REQUIRED=1.8 +XCBDRI3_REQUIRED=1.8 XCBGLX_REQUIRED=1.8.1 XSHMFENCE_REQUIRED=1.1 XVMC_REQUIRED=1.0.6 @@ -1557,6 +1558,9 @@ for plat in $egl_platforms; do x11) PKG_CHECK_MODULES([XCB_DRI2], [x11-xcb xcb xcb-dri2 = $XCBDRI2_REQUIRED xcb-xfixes]) + if test x$enable_dri3 = xyes; then + PKG_CHECK_MODULES([XCB_DRI3], [xcb-dri3 = $XCBDRI3_REQUIRED xcb-present]) + fi ;; drm) diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h index 8c5ceb9..3bd9d18 100644 --- a/include/GL/internal/dri_interface.h +++ b/include/GL/internal/dri_interface.h @@ -83,6 +83,7 @@ typedef struct __DRIswrastExtensionRec __DRIswrastExtension; typedef struct __DRIbufferRec __DRIbuffer; typedef struct __DRIdri2ExtensionRec __DRIdri2Extension; typedef struct __DRIdri2LoaderExtensionRec __DRIdri2LoaderExtension; +typedef struct __DRIdri3ExtensionRec __DRIdri3Extension; typedef struct __DRI2flushExtensionRec __DRI2flushExtension; typedef struct __DRI2throttleExtensionRec __DRI2throttleExtension; @@ -999,6 +1000,13 @@ struct __DRIdri2ExtensionRec { __DRIcreateNewScreen2FunccreateNewScreen2; }; +#define __DRI_DRI3 DRI_DRI3 +#define __DRI_DRI3_VERSION 1 + +struct __DRIdri3ExtensionRec { + __DRIextension base; +}; + /** * This extension provides functionality to enable various EGLImage diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 20a7243..6024cb3 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -55,6 +55,12 @@ const __DRIuseInvalidateExtension use_invalidate = { .base = { __DRI_USE_INVALIDATE, 1 } }; +#ifdef HAVE_DRI3 +const __DRIdri3Extension dri3_extension = { + .base = { __DRI_DRI3, 1 } +}; +#endif + EGLint dri2_to_egl_attribute_map[] = { 0, EGL_BUFFER_SIZE,/* __DRI_ATTRIB_BUFFER_SIZE */ @@ -600,6 +606,9 @@ dri2_create_screen(_EGLDisplay *disp) if (strcmp(extensions[i]-name, __DRI2_CONFIG_QUERY) == 0) { dri2_dpy-config = (__DRI2configQueryExtension *) extensions[i]; } + if (strcmp(extensions[i]-name, __DRI_DRI3) == 0) { +dri2_dpy-dri3 = (__DRIdri3Extension *) extensions[i]; + } } } else { assert(dri2_dpy-swrast); diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h index 52f05fb..d8713df 100644 --- a/src/egl/drivers/dri2/egl_dri2.h +++ b/src/egl/drivers/dri2/egl_dri2.h @@ -35,6 +35,11 @@ #include X11/Xlib-xcb.h #endif +#ifdef HAVE_DRI3 +#include xcb/dri3.h +#include xcb/present.h +#endif + #ifdef HAVE_WAYLAND_PLATFORM #include wayland-client.h #include wayland-egl-priv.h @@ -74,6 +79,7 @@ #include eglimage.h #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) +#define DRI2_EGL_SURFACE_NUM_BUFFERS 5 struct wl_buffer; @@ -150,12 +156,17 @@ struct dri2_egl_display int dri2_major; int dri2_minor; +#ifdef HAVE_DRI3 + int dri3_major; + int dri3_minor; +#endif __DRIscreen *dri_screen; int
Re: [Mesa-dev] [PATCH v2 1/1] clover: Require libelf
On 21/10/14 16:59, Jan Vesely wrote: v2: test for libelf once, check in both radeon and clover CC: Tom Stellard t...@stellard.net CC: Emil Velikov emil.l.veli...@gmail.com CC: Francisco Jerez curroje...@riseup.net Signed-off-by: Jan Vesely jan.ves...@rutgers.edu Reviewed-by: Emil Velikov emil.l.veli...@gmail.com Afaics you don't have commit access to the repo, so I'll be pushing this patch within a few hours. Thanks Emil --- configure.ac | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 0ed9325..93b25a2 100644 --- a/configure.ac +++ b/configure.ac @@ -1465,6 +1465,7 @@ AC_ARG_WITH([clang-libdir], [CLANG_LIBDIR='']) PKG_CHECK_EXISTS([libclc], [have_libclc=yes], [have_libclc=no]) +AC_CHECK_LIB([elf], [elf_memory], [have_libelf=yes;ELF_LIB=-lelf]) if test x$enable_opencl = xyes; then if test -z $with_gallium_drivers; then @@ -1495,6 +1496,10 @@ if test x$enable_opencl = xyes; then else OPENCL_LIBNAME=OpenCL fi + +if test x$have_libelf != xyes; then + AC_MSG_ERROR([Clover requires libelf]) +fi fi AM_CONDITIONAL(HAVE_CLOVER, test x$enable_opencl = xyes) AM_CONDITIONAL(HAVE_CLOVER_ICD, test x$enable_opencl_icd = xyes) @@ -1870,8 +1875,9 @@ radeon_llvm_check() { fi LLVM_COMPONENTS=${LLVM_COMPONENTS} r600 bitreader ipo NEED_RADEON_LLVM=yes -AC_CHECK_LIB([elf], [elf_memory], [ELF_LIB=-lelf], - [AC_MSG_ERROR([$1 requires libelf when using LLVM])]) +if test x$have_libelf != xyes; then + AC_MSG_ERROR([$1 requires libelf when using llvm]) +fi } dnl Duplicates in GALLIUM_DRIVERS_DIRS are removed by sorting it after this block ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 1/1] clover: Require libelf
On Wed, 2014-10-22 at 19:16 +0100, Emil Velikov wrote: On 21/10/14 16:59, Jan Vesely wrote: v2: test for libelf once, check in both radeon and clover CC: Tom Stellard t...@stellard.net CC: Emil Velikov emil.l.veli...@gmail.com CC: Francisco Jerez curroje...@riseup.net Signed-off-by: Jan Vesely jan.ves...@rutgers.edu Reviewed-by: Emil Velikov emil.l.veli...@gmail.com Afaics you don't have commit access to the repo, so I'll be pushing this patch within a few hours. thank you Thanks Emil --- configure.ac | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 0ed9325..93b25a2 100644 --- a/configure.ac +++ b/configure.ac @@ -1465,6 +1465,7 @@ AC_ARG_WITH([clang-libdir], [CLANG_LIBDIR='']) PKG_CHECK_EXISTS([libclc], [have_libclc=yes], [have_libclc=no]) +AC_CHECK_LIB([elf], [elf_memory], [have_libelf=yes;ELF_LIB=-lelf]) if test x$enable_opencl = xyes; then if test -z $with_gallium_drivers; then @@ -1495,6 +1496,10 @@ if test x$enable_opencl = xyes; then else OPENCL_LIBNAME=OpenCL fi + +if test x$have_libelf != xyes; then + AC_MSG_ERROR([Clover requires libelf]) +fi fi AM_CONDITIONAL(HAVE_CLOVER, test x$enable_opencl = xyes) AM_CONDITIONAL(HAVE_CLOVER_ICD, test x$enable_opencl_icd = xyes) @@ -1870,8 +1875,9 @@ radeon_llvm_check() { fi LLVM_COMPONENTS=${LLVM_COMPONENTS} r600 bitreader ipo NEED_RADEON_LLVM=yes -AC_CHECK_LIB([elf], [elf_memory], [ELF_LIB=-lelf], - [AC_MSG_ERROR([$1 requires libelf when using LLVM])]) +if test x$have_libelf != xyes; then + AC_MSG_ERROR([$1 requires libelf when using llvm]) +fi } dnl Duplicates in GALLIUM_DRIVERS_DIRS are removed by sorting it after this block -- Jan Vesely jan.ves...@rutgers.edu signature.asc Description: This is a digitally signed message part ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] gallivm, llvmpipe, clover: Bump required LLVM version to 3.3.
From: José Fonseca jfons...@vmware.com We'll need to update gallivm for the interface changes in LLVM 3.6, and the fewer the number of older LLVM versions we support the less hairy that will be. As consequence HAVE_AVX define can disappear. (Note HAVE_AVX means whether LLVM version is supported or not. Runtime support for AVX is always checked and enforced independently.) Verified llvmpipe builds and runs with with LLVM 3.3, 3.4, and 3.5. --- configure.ac | 2 +- scons/llvm.py | 16 ++ src/gallium/auxiliary/gallivm/lp_bld.h | 4 +-- src/gallium/auxiliary/gallivm/lp_bld_debug.cpp | 6 +--- src/gallium/auxiliary/gallivm/lp_bld_init.c| 37 ++ src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 30 ++ src/gallium/drivers/llvmpipe/lp_screen.c | 6 src/gallium/drivers/llvmpipe/lp_state_fs.c | 8 - .../state_trackers/clover/llvm/invocation.cpp | 36 + 9 files changed, 11 insertions(+), 134 deletions(-) diff --git a/configure.ac b/configure.ac index 0ed9325..09a71b7 100644 --- a/configure.ac +++ b/configure.ac @@ -1714,7 +1714,7 @@ if test x$enable_gallium_llvm = xyes; then fi LLVM_REQUIRED_VERSION_MAJOR=3 -LLVM_REQUIRED_VERSION_MINOR=1 +LLVM_REQUIRED_VERSION_MINOR=3 if test $LLVM_VERSION_INT -lt ${LLVM_REQUIRED_VERSION_MAJOR}0${LLVM_REQUIRED_VERSION_MINOR}; then AC_MSG_ERROR([LLVM $LLVM_REQUIRED_VERSION_MAJOR.$LLVM_REQUIRED_VERSION_MINOR or newer is required]) fi diff --git a/scons/llvm.py b/scons/llvm.py index 288a080..1e312f9 100644 --- a/scons/llvm.py +++ b/scons/llvm.py @@ -37,7 +37,7 @@ import SCons.Errors import SCons.Util -required_llvm_version = '3.1' +required_llvm_version = '3.3' def generate(env): @@ -98,7 +98,7 @@ def generate(env): 'HAVE_STDINT_H', ]) env.Prepend(LIBPATH = [os.path.join(llvm_dir, 'lib')]) -if llvm_version = distutils.version.LooseVersion('3.2'): +if True: # 3.2 env.Prepend(LIBS = [ 'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser', @@ -110,18 +110,6 @@ def generate(env): 'LLVMAnalysis', 'LLVMTarget', 'LLVMMC', 'LLVMCore', 'LLVMSupport', 'LLVMRuntimeDyld', 'LLVMObject' ]) -else: -# 3.1 -env.Prepend(LIBS = [ -'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser', -'LLVMX86CodeGen', 'LLVMX86Desc', 'LLVMSelectionDAG', -'LLVMAsmPrinter', 'LLVMMCParser', 'LLVMX86AsmPrinter', -'LLVMX86Utils', 'LLVMX86Info', 'LLVMMCJIT', 'LLVMJIT', -'LLVMExecutionEngine', 'LLVMCodeGen', 'LLVMScalarOpts', -'LLVMInstCombine', 'LLVMTransformUtils', 'LLVMipa', -'LLVMAnalysis', 'LLVMTarget', 'LLVMMC', 'LLVMCore', -'LLVMSupport' -]) env.Append(LIBS = [ 'imagehlp', 'psapi', diff --git a/src/gallium/auxiliary/gallivm/lp_bld.h b/src/gallium/auxiliary/gallivm/lp_bld.h index a01c216..7ba925c 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld.h +++ b/src/gallium/auxiliary/gallivm/lp_bld.h @@ -53,8 +53,8 @@ #ifndef HAVE_LLVM #error HAVE_LLVM should be set with LLVM's version number, e.g. (0x0207 for 2.7) #endif -#if HAVE_LLVM 0x301 -#error LLVM 3.1 or newer required +#if HAVE_LLVM 0x303 +#error LLVM 3.3 or newer required #endif diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp index b6b52c8..bad65c2 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp @@ -43,11 +43,7 @@ #include llvm/Support/Host.h -#if HAVE_LLVM = 0x0303 #include llvm/IR/Module.h -#else -#include llvm/Module.h -#endif #include llvm/MC/MCDisassembler.h #include llvm/MC/MCAsmInfo.h @@ -57,7 +53,7 @@ #if HAVE_LLVM = 0x0305 #define OwningPtr std::unique_ptr -#elif HAVE_LLVM = 0x0303 +#else #include llvm/ADT/OwningPtr.h #endif diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c index 8d7a0b6..b82cb77 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_init.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c @@ -45,35 +45,13 @@ /* Only MCJIT is available as of LLVM SVN r216982 */ #if HAVE_LLVM = 0x0306 - -#define USE_MCJIT 1 -#define HAVE_AVX 1 - -#else - -/** - * AVX is supported in: - * - standard JIT from LLVM 3.2 onwards - * - MC-JIT from LLVM 3.1 - * - MC-JIT supports limited OSes (MacOSX and Linux) - * - standard JIT in LLVM 3.1, with backports - */ -#if defined(PIPE_ARCH_PPC_64) || defined(PIPE_ARCH_S390) || defined(PIPE_ARCH_ARM) || defined(PIPE_ARCH_AARCH64) # define USE_MCJIT 1 -# define HAVE_AVX 0 -#elif
[Mesa-dev] [PATCH 2/3] gallivm: Fix white-space.
From: José Fonseca jfons...@vmware.com Replace tabs with spaces. --- src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index ab3b3c9..a1d2940 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -132,7 +132,7 @@ lp_set_load_alignment(LLVMValueRef Inst, extern C void lp_set_store_alignment(LLVMValueRef Inst, - unsigned Align) + unsigned Align) { llvm::unwrapllvm::StoreInst(Inst)-setAlignment(Align); } @@ -322,14 +322,14 @@ class ShaderMemoryManager : public DelegatingJITMemoryManager { * Deallocate things as previously requested and * free shared manager when no longer used. */ -Vec::iterator i; + Vec::iterator i; -assert(TheMM); -for ( i = FunctionBody.begin(); i != FunctionBody.end(); ++i ) - TheMM-deallocateFunctionBody(*i); + assert(TheMM); + for ( i = FunctionBody.begin(); i != FunctionBody.end(); ++i ) +TheMM-deallocateFunctionBody(*i); #if HAVE_LLVM 0x0304 -for ( i = ExceptionTable.begin(); i != ExceptionTable.end(); ++i ) - TheMM-deallocateExceptionTable(*i); + for ( i = ExceptionTable.begin(); i != ExceptionTable.end(); ++i ) +TheMM-deallocateExceptionTable(*i); #endif } }; -- 1.9.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/3] gallivm: Properly update for removal of JITMemoryManager in LLVM 3.6.
From: José Fonseca jfons...@vmware.com JITMemoryManager was removed in LLVM 3.6, and replaced by its base class RTDyldMemoryManager. This change fixes our JIT memory managers specializations to derive from RTDyldMemoryManager in LLVM 3.6 instead of JITMemoryManager. This enables llvmpipe to run with LLVM 3.6. However, lp_free_generated_code is basically a no-op because there are not enough hook points in RTDyldMemoryManager to track and free the code of a module. In other words, with MCJIT, code once created, stays forever allocated until process destruction. This is not speicfic to LLVM 3.6 -- it will happen whenever MCJIT is used regardless of version. --- src/gallium/auxiliary/gallivm/lp_bld_init.c | 11 - src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 68 --- 2 files changed, 41 insertions(+), 38 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c index b82cb77..23a7c45 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_init.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c @@ -293,13 +293,9 @@ init_gallivm_state(struct gallivm_state *gallivm, const char *name, if (!gallivm-builder) goto fail; -#if HAVE_LLVM 0x0306 gallivm-memorymgr = lp_get_default_memory_manager(); if (!gallivm-memorymgr) goto fail; -#else - gallivm-memorymgr = 0; -#endif /* FIXME: MC-JIT only allows compiling one module at a time, and it must be * complete when MC-JIT is created. So defer the MC-JIT engine creation for @@ -364,13 +360,6 @@ lp_build_init(void) if (gallivm_initialized) return TRUE; - /* XXX: Remove this once lp_bld_misc.cpp has been adapted to the removal -* of JITMemoryManager -*/ -#if HAVE_LLVM = 0x0306 - return FALSE; -#endif - #ifdef DEBUG gallivm_debug = debug_get_option_gallivm_debug(); #endif diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index a1d2940..776af47 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -57,6 +57,8 @@ #include llvm/ADT/Triple.h #if HAVE_LLVM 0x0306 #include llvm/ExecutionEngine/JITMemoryManager.h +#else +#include llvm/ExecutionEngine/SectionMemoryManager.h #endif #include llvm/Support/CommandLine.h #include llvm/Support/Host.h @@ -137,19 +139,26 @@ lp_set_store_alignment(LLVMValueRef Inst, llvm::unwrapllvm::StoreInst(Inst)-setAlignment(Align); } + #if HAVE_LLVM 0x0306 +typedef llvm::JITMemoryManager BaseMemoryManager; +#else +typedef llvm::RTDyldMemoryManager BaseMemoryManager; +#endif + /* * Delegating is tedious but the default manager class is hidden in an * anonymous namespace in LLVM, so we cannot just derive from it to change * its behavior. */ -class DelegatingJITMemoryManager : public llvm::JITMemoryManager { +class DelegatingJITMemoryManager : public BaseMemoryManager { protected: - virtual llvm::JITMemoryManager *mgr() const = 0; + virtual BaseMemoryManager *mgr() const = 0; public: +#if HAVE_LLVM 0x0306 /* * From JITMemoryManager */ @@ -233,6 +242,7 @@ class DelegatingJITMemoryManager : public llvm::JITMemoryManager { virtual unsigned GetNumStubSlabs() { return mgr()-GetNumStubSlabs(); } +#endif /* * From RTDyldMemoryManager @@ -306,14 +316,14 @@ class DelegatingJITMemoryManager : public llvm::JITMemoryManager { */ class ShaderMemoryManager : public DelegatingJITMemoryManager { - llvm::JITMemoryManager *TheMM; + BaseMemoryManager *TheMM; struct GeneratedCode { typedef std::vectorvoid * Vec; Vec FunctionBody, ExceptionTable; - llvm::JITMemoryManager *TheMM; + BaseMemoryManager *TheMM; - GeneratedCode(llvm::JITMemoryManager *MM) { + GeneratedCode(BaseMemoryManager *MM) { TheMM = MM; } @@ -322,6 +332,7 @@ class ShaderMemoryManager : public DelegatingJITMemoryManager { * Deallocate things as previously requested and * free shared manager when no longer used. */ +#if HAVE_LLVM 0x0306 Vec::iterator i; assert(TheMM); @@ -330,19 +341,20 @@ class ShaderMemoryManager : public DelegatingJITMemoryManager { #if HAVE_LLVM 0x0304 for ( i = ExceptionTable.begin(); i != ExceptionTable.end(); ++i ) TheMM-deallocateExceptionTable(*i); -#endif +#endif /* HAVE_LLVM 0x0304 */ +#endif /* HAVE_LLVM 0x0306 */ } }; GeneratedCode *code; - llvm::JITMemoryManager *mgr() const { + BaseMemoryManager *mgr() const { return TheMM; } public: - ShaderMemoryManager(llvm::JITMemoryManager* MM) { + ShaderMemoryManager(BaseMemoryManager* MM) { TheMM = MM; code = new GeneratedCode(MM); } @@ -375,7 +387,6 @@ class ShaderMemoryManager : public DelegatingJITMemoryManager {
Re: [Mesa-dev] [PATCH 4/5] gallium: introduce PIPE_CAP_CLIP_HALFZ.
I've just committed r300g, r600g, and radeonsi support. You can set the value to 1 for those drivers. Marek On Wed, Oct 22, 2014 at 7:13 PM, mathias.froehl...@gmx.net wrote: From: Mathias Fröhlich mathias.froehl...@gmx.net In preparation of ARB_clip_control. Let the driver decide if it supports pipe_rasterizer_state::clip_halfz being set to true. Signed-off-by: Mathias Froehlich mathias.froehl...@web.de --- src/gallium/docs/source/screen.rst | 3 +++ src/gallium/drivers/freedreno/freedreno_screen.c | 1 + src/gallium/drivers/i915/i915_screen.c | 1 + src/gallium/drivers/ilo/ilo_screen.c | 1 + src/gallium/drivers/llvmpipe/lp_screen.c | 2 ++ src/gallium/drivers/nouveau/nv30/nv30_screen.c | 1 + src/gallium/drivers/nouveau/nv50/nv50_screen.c | 1 + src/gallium/drivers/nouveau/nvc0/nvc0_screen.c | 1 + src/gallium/drivers/r300/r300_screen.c | 1 + src/gallium/drivers/r600/r600_pipe.c | 1 + src/gallium/drivers/radeonsi/si_pipe.c | 1 + src/gallium/drivers/softpipe/sp_screen.c | 2 ++ src/gallium/drivers/svga/svga_screen.c | 1 + src/gallium/drivers/vc4/vc4_screen.c | 1 + src/gallium/include/pipe/p_defines.h | 1 + 15 files changed, 19 insertions(+) diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index 88d7e49..e711ad4 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -230,6 +230,9 @@ The integer capabilities: different than the underlying resource's, as permitted by ARB_texture_view. For example a 2d array texture may be reinterpreted as a cube (array) texture and vice-versa. +* ``PIPE_CAP_CLIP_HALFZ``: Whether the driver supports the + pipe_rasterizer_state::clip_halfz being set to true. This is required + for enabling ARB_clip_control. .. _pipe_capf: diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index 90156b4..7a3cd95 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -226,6 +226,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE: case PIPE_CAP_CONDITIONAL_RENDER_INVERTED: case PIPE_CAP_SAMPLER_VIEW_TARGET: + case PIPE_CAP_CLIP_HALFZ: return 0; case PIPE_CAP_MAX_VIEWPORTS: diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index 2a6e751..062f1a6 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -225,6 +225,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap) case PIPE_CAP_TEXTURE_GATHER_OFFSETS: case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION: case PIPE_CAP_CONDITIONAL_RENDER_INVERTED: + case PIPE_CAP_CLIP_HALFZ: return 0; case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS: diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c index 48c3dea..4e931fb 100644 --- a/src/gallium/drivers/ilo/ilo_screen.c +++ b/src/gallium/drivers/ilo/ilo_screen.c @@ -446,6 +446,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE: case PIPE_CAP_CONDITIONAL_RENDER_INVERTED: case PIPE_CAP_SAMPLER_VIEW_TARGET: + case PIPE_CAP_CLIP_HALFZ: return 0; case PIPE_CAP_VENDOR_ID: diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index a264f99..df47e53 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -277,6 +277,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) } case PIPE_CAP_UMA: return 0; + case PIPE_CAP_CLIP_HALFZ: + return 1; } /* should only get here on unhandled cases */ debug_printf(Unexpected PIPE_CAP %d query\n, param); diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c index 700b9bb..2b65f8c 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c @@ -156,6 +156,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE: case PIPE_CAP_CONDITIONAL_RENDER_INVERTED: case PIPE_CAP_SAMPLER_VIEW_TARGET: + case PIPE_CAP_CLIP_HALFZ: return 0; case PIPE_CAP_VENDOR_ID: diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c index d26a438..4ee5980 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c @@ -204,6 +204,7 @@ nv50_screen_get_param(struct pipe_screen
[Mesa-dev] New stable-branch 10.3 candidate pushed
Hello list, It's time for the second 10.3 stable candidate. Currently we have - 19 queued - 12 nominated (outstanding) - and 0 rejected patches Take a look at section Mesa stable queue for more information. Note: earlier mesa testing was against ancient piglit (3457f015314), the following testing is against a636a3610d7. Section Piglit update contains the stats during the update process. Fixes - gallium swrast -- Tests: - glsl-fs-frontfacing-not (fail pass) Fixes - classic i965(snb) - Tests: - GLX_OML_sync_control/timing -divisor 1 (fail pass) - GLX_OML_sync_control/timing -waitformsc -divisor 1 (warn pass) Regressions - classic i965(snb) --- Tests: - GLX_OML_sync_control/timing -divisor 2 (pass warn) - GLX_OML_sync_control/timing -msc-delta 1 (pass warn) Due to the minor severity of the two regressions, I do not plan to revert any patches. Testing reports/general approval Any testing reports (or general approval of the state of the branch) will be greatly appreciated. Trivial merge conflicts --- Here are the commits where I manually merged conflicts, (so these might merit additional review): commit c759d1b6bfbc15b044ef3f7cd590b6647c3670df Author: Michel Dänzer michel.daen...@amd.com winsys/radeon: Use separate caching buffer manager for each set of flags (cherry picked from commit 3ede67a4c6d77892296ffc5568ddf3accaa1af99) As usual the plan is to have the next stable (10.3.2) released this Friday, so if you have any questions or comments that you would like to share before the release, please go ahead. Cheers, Emil Piglit update - Piglit results (3457f015314 vs a636a3610d7), tested against mesa 10.3.1. classic swrast == - 10 fixes - 1 regressions - 3 disabled - 10 enabled, of which 7 pass gallium swrast == - 12 fixes - 1 regressions - 4 disabled - 6309 enabled, of which 6299 pass classic i965(snb) = - 2 fixes - 0 regressions - 288 disabled - 6322 enabled, of which 6312 pass Mesa stable queue - Nominated (12) == Anuj Phogat (4): glsl: Fix crash due to negative array index glsl: Use signed array index in update_max_array_access() glsl: No compile error for out of bounds array index glsl: Don't abort if array index is out of bounds Kenneth Graunke (1): i965: Fix an off-by-1 error in the draw upload code's size calculation. Mauro Rossi (2): gallium/nouveau: fully build the driver under android gallium/nouveau: use std::isfinite in c++ sources Tapani Pälli (2): glsl: fix uniform location count used for glsl types mesa: check that uniform exists in glUniform* functions Tom Stellard (2): radeonsi: Program RASTER_CONFIG for harvested GPUs v4 R600/SI: radeonsi: Program RASTER_CONFIG for harvested GPUs v3 Tomasz Figa (1): glsl: Fix no return value for non-void function Queued (19) === Brian Paul (3): mesa: fix spurious wglGetProcAddress / GL_INVALID_OPERATION error st/wgl: add WINAPI qualifiers on wgl function typedefs glsl: fix several use-after-free bugs Daniel Manjarres (1): glx: Fix glxUseXFont for glxWindow and glxPixmaps Dave Airlie (1): mesa: fix GetTexImage for 1D array depth textures Emil Velikov (1): docs: Add sha256 sums for the 10.3.1 release Ilia Mirkin (4): gm107/ir: add dnz emission for fmul gk110/ir: add dnz flag emission for fmul/fmad nouveau: 3d textures are unsupported, limit 3d levels to 1 st/gbm: fix order of arguments passed to is_format_supported Kenneth Graunke (3): i965: Add a BRW_MOCS_PTE #define. i965: Use BDW_MOCS_PTE for renderbuffers. i965: Fix register write checks. Marek Olšák (2): st/mesa: use pipe_sampler_view_release for releasing sampler views glsl_to_tgsi: fix the value of gl_FrontFacing with native integers Michel Dänzer (4): radeonsi: Clear sampler view flags when binding a buffer r600g,radeonsi: Always use GTT again for PIPE_USAGE_STREAM buffers winsys/radeon: Use separate caching buffer manager for each set of flags r600g: Drop references to destroyed blend state signature.asc Description: OpenPGP digital signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Mesa-stable] [PATCH 1/4] glsl: Fix crash due to negative array index
Hi Anuj, Afaics the series is yet to land on master, this I've not pulled it for the stable branch. Is the lack of review holding it back ? Gents can anyone take a look at/review the series ? Thanks Emil On 22/09/14 23:57, Anuj Phogat wrote: Currently Mesa crashes with a shader like this: [fragmnet shader] float[5] array; int idx = -2; void main() { gl_FragColor = vec4(0.0, 1.0, 0.0, array[idx]); } Cc: mesa-sta...@lists.freedesktop.org Signed-off-by: Anuj Phogat anuj.pho...@gmail.com --- src/glsl/opt_array_splitting.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/glsl/opt_array_splitting.cpp b/src/glsl/opt_array_splitting.cpp index ebb076b..9e73f3c 100644 --- a/src/glsl/opt_array_splitting.cpp +++ b/src/glsl/opt_array_splitting.cpp @@ -295,7 +295,7 @@ ir_array_splitting_visitor::split_deref(ir_dereference **deref) ir_constant *constant = deref_array-array_index-as_constant(); assert(constant); - if (constant-value.i[0] (int)entry-size) { + if (constant-value.i[0] = 0 constant-value.i[0] (int)entry-size) { *deref = new(entry-mem_ctx) ir_dereference_variable(entry-components[constant-value.i[0]]); } else { ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Mesa-stable] [PATCH 1/4] glsl: Fix crash due to negative array index
Patches 1 2 are: Reviewed-by: Chris Forbes chr...@ijw.co.nz I'm not convinced about patch 3. From the GLSL 4.50 spec, section 4.1.9 Arrays p31 (p37 of the PDF): It is a compile-time error to declare an array with a size, and then later (in the same shader) index the same array with an integral constant expression greater than or equal to the declared size. -- Chris On Thu, Oct 23, 2014 at 8:33 AM, Emil Velikov emil.l.veli...@gmail.com wrote: Hi Anuj, Afaics the series is yet to land on master, this I've not pulled it for the stable branch. Is the lack of review holding it back ? Gents can anyone take a look at/review the series ? Thanks Emil On 22/09/14 23:57, Anuj Phogat wrote: Currently Mesa crashes with a shader like this: [fragmnet shader] float[5] array; int idx = -2; void main() { gl_FragColor = vec4(0.0, 1.0, 0.0, array[idx]); } Cc: mesa-sta...@lists.freedesktop.org Signed-off-by: Anuj Phogat anuj.pho...@gmail.com --- src/glsl/opt_array_splitting.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/glsl/opt_array_splitting.cpp b/src/glsl/opt_array_splitting.cpp index ebb076b..9e73f3c 100644 --- a/src/glsl/opt_array_splitting.cpp +++ b/src/glsl/opt_array_splitting.cpp @@ -295,7 +295,7 @@ ir_array_splitting_visitor::split_deref(ir_dereference **deref) ir_constant *constant = deref_array-array_index-as_constant(); assert(constant); - if (constant-value.i[0] (int)entry-size) { + if (constant-value.i[0] = 0 constant-value.i[0] (int)entry-size) { *deref = new(entry-mem_ctx) ir_dereference_variable(entry-components[constant-value.i[0]]); } else { ___ mesa-stable mailing list mesa-sta...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-stable ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/4] u_blitter: create basic fs shaders in util_blitter_cache_all_shaders()
We need to create all fs shaders in this function. --- src/gallium/auxiliary/util/u_blitter.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index abcacff..830d82f 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -1012,7 +1012,8 @@ void *blitter_get_fs_texfetch_stencil(struct blitter_context_priv *ctx, void util_blitter_cache_all_shaders(struct blitter_context *blitter) { struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; - struct pipe_screen *screen = blitter-pipe-screen; + struct pipe_context *pipe = blitter-pipe; + struct pipe_screen *screen = pipe-screen; unsigned samples, j, f, target, max_samples; boolean has_arraytex, has_cubearraytex; @@ -1073,6 +1074,16 @@ void util_blitter_cache_all_shaders(struct blitter_context *blitter) } } + ctx-fs_empty = util_make_empty_fragment_shader(pipe); + + ctx-fs_write_one_cbuf = + util_make_fragment_passthrough_shader(pipe, TGSI_SEMANTIC_GENERIC, +TGSI_INTERPOLATE_CONSTANT, FALSE); + + ctx-fs_write_all_cbufs = + util_make_fragment_passthrough_shader(pipe, TGSI_SEMANTIC_GENERIC, +TGSI_INTERPOLATE_CONSTANT, TRUE); + ctx-cached_all_shaders = TRUE; } -- 1.7.10.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/4] u_blitter: use ctx-bind_fs_state(), not pipe-bind_fs_state()
Consistently use the function pointer we saved earlier. --- src/gallium/auxiliary/util/u_blitter.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 830d82f..ea9094e 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -361,7 +361,7 @@ static void bind_fs_empty(struct blitter_context_priv *ctx) ctx-fs_empty = util_make_empty_fragment_shader(pipe); } - pipe-bind_fs_state(pipe, ctx-fs_empty); + ctx-bind_fs_state(pipe, ctx-fs_empty); } static void bind_fs_write_one_cbuf(struct blitter_context_priv *ctx) @@ -375,7 +375,7 @@ static void bind_fs_write_one_cbuf(struct blitter_context_priv *ctx) TGSI_INTERPOLATE_CONSTANT, FALSE); } - pipe-bind_fs_state(pipe, ctx-fs_write_one_cbuf); + ctx-bind_fs_state(pipe, ctx-fs_write_one_cbuf); } static void bind_fs_write_all_cbufs(struct blitter_context_priv *ctx) @@ -389,7 +389,7 @@ static void bind_fs_write_all_cbufs(struct blitter_context_priv *ctx) TGSI_INTERPOLATE_CONSTANT, TRUE); } - pipe-bind_fs_state(pipe, ctx-fs_write_all_cbufs); + ctx-bind_fs_state(pipe, ctx-fs_write_all_cbufs); } void util_blitter_destroy(struct blitter_context *blitter) -- 1.7.10.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/4] u_blitter: do error checking assertions for shader caching
If the user calls util_blitter_cache_all_shaders() set a flag and assert that we never try to create any new fragment shaders after that point. If the assertions fails, it means we missed generating some shader in util_blitter_cache_all_shaders(). --- src/gallium/auxiliary/util/u_blitter.c | 51 +++- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index f3fe949..abcacff 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -134,6 +134,7 @@ struct blitter_context_priv boolean has_stream_out; boolean has_stencil_export; boolean has_texture_multisample; + boolean cached_all_shaders; /* The Draw module overrides these functions. * Always create the blitter before Draw. */ @@ -356,6 +357,7 @@ static void bind_fs_empty(struct blitter_context_priv *ctx) struct pipe_context *pipe = ctx-base.pipe; if (!ctx-fs_empty) { + assert(!ctx-cached_all_shaders); ctx-fs_empty = util_make_empty_fragment_shader(pipe); } @@ -367,6 +369,7 @@ static void bind_fs_write_one_cbuf(struct blitter_context_priv *ctx) struct pipe_context *pipe = ctx-base.pipe; if (!ctx-fs_write_one_cbuf) { + assert(!ctx-cached_all_shaders); ctx-fs_write_one_cbuf = util_make_fragment_passthrough_shader(pipe, TGSI_SEMANTIC_GENERIC, TGSI_INTERPOLATE_CONSTANT, FALSE); @@ -380,6 +383,7 @@ static void bind_fs_write_all_cbufs(struct blitter_context_priv *ctx) struct pipe_context *pipe = ctx-base.pipe; if (!ctx-fs_write_all_cbufs) { + assert(!ctx-cached_all_shaders); ctx-fs_write_all_cbufs = util_make_fragment_passthrough_shader(pipe, TGSI_SEMANTIC_GENERIC, TGSI_INTERPOLATE_CONSTANT, TRUE); @@ -850,6 +854,7 @@ static void *blitter_get_fs_texfetch_col(struct blitter_context_priv *ctx, shader = ctx-fs_resolve[target][index][filter]; if (!*shader) { +assert(!ctx-cached_all_shaders); if (filter == PIPE_TEX_FILTER_LINEAR) { *shader = util_make_fs_msaa_resolve_bilinear(pipe, tgsi_tex, src_nr_samples, @@ -870,6 +875,7 @@ static void *blitter_get_fs_texfetch_col(struct blitter_context_priv *ctx, /* Create the fragment shader on-demand. */ if (!*shader) { +assert(!ctx-cached_all_shaders); *shader = util_make_fs_blit_msaa_color(pipe, tgsi_tex); } } @@ -880,6 +886,7 @@ static void *blitter_get_fs_texfetch_col(struct blitter_context_priv *ctx, /* Create the fragment shader on-demand. */ if (!*shader) { + assert(!ctx-cached_all_shaders); *shader = util_make_fragment_tex_shader(pipe, tgsi_tex, TGSI_INTERPOLATE_LINEAR); } @@ -902,11 +909,10 @@ void *blitter_get_fs_texfetch_depth(struct blitter_context_priv *ctx, /* Create the fragment shader on-demand. */ if (!*shader) { - unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(target, - nr_samples); - - *shader = -util_make_fs_blit_msaa_depth(pipe, tgsi_tex); + unsigned tgsi_tex; + assert(!ctx-cached_all_shaders); + tgsi_tex = util_pipe_tex_to_tgsi_tex(target, nr_samples); + *shader = util_make_fs_blit_msaa_depth(pipe, tgsi_tex); } return *shader; @@ -915,8 +921,9 @@ void *blitter_get_fs_texfetch_depth(struct blitter_context_priv *ctx, /* Create the fragment shader on-demand. */ if (!*shader) { - unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(target, 0); - + unsigned tgsi_tex; + assert(!ctx-cached_all_shaders); + tgsi_tex = util_pipe_tex_to_tgsi_tex(target, 0); *shader = util_make_fragment_tex_shader_writedepth(pipe, tgsi_tex, TGSI_INTERPOLATE_LINEAR); @@ -940,11 +947,10 @@ void *blitter_get_fs_texfetch_depthstencil(struct blitter_context_priv *ctx, /* Create the fragment shader on-demand. */ if (!*shader) { - unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(target, - nr_samples); - - *shader = -util_make_fs_blit_msaa_depthstencil(pipe, tgsi_tex); + unsigned tgsi_tex; + assert(!ctx-cached_all_shaders); + tgsi_tex = util_pipe_tex_to_tgsi_tex(target, nr_samples); + *shader = util_make_fs_blit_msaa_depthstencil(pipe, tgsi_tex); } return *shader; @@ -953,8 +959,9 @@ void *blitter_get_fs_texfetch_depthstencil(struct blitter_context_priv *ctx, /* Create the fragment
Re: [Mesa-dev] [PATCH 3/5] mesa: Handle clip control in meta operations.
On 10/22/2014 11:13 AM, mathias.froehl...@gmx.net wrote: From: Mathias Fröhlich mathias.froehl...@gmx.net Restore clip control to the default state if MESA_META_VIEWPORT or MESA_META_DEPTH_TEST is requested. Signed-off-by: Mathias Froehlich mathias.froehl...@web.de --- src/mesa/drivers/common/meta.c | 13 + src/mesa/drivers/common/meta.h | 4 2 files changed, 17 insertions(+) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 7a8e627..119f327 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -494,6 +494,13 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) _mesa_set_enable(ctx, GL_DITHER, GL_TRUE); } + if (state MESA_META_CLIP_CONTROL) { + save-ClipControl = ctx-ClipControl; + if (ctx-ClipControl.Origin != GL_LOWER_LEFT || + ctx-ClipControl.Depth != GL_NEGATIVE_ONE_TO_ONE) + _mesa_ClipControl(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE); + } + This might actually get rolled into the MESA_META_TRANSFORM group. if (state MESA_META_COLOR_MASK) { memcpy(save-ColorMask, ctx-Color.ColorMask, sizeof(ctx-Color.ColorMask)); @@ -856,6 +863,12 @@ _mesa_meta_end(struct gl_context *ctx) if (state MESA_META_DITHER) _mesa_set_enable(ctx, GL_DITHER, save-DitherFlag); + if (state MESA_META_CLIP_CONTROL) { + if (ctx-ClipControl.Origin != save-ClipControl.Origin || + ctx-ClipControl.Depth != save-ClipControl.Depth) + _mesa_ClipControl(save-ClipControl.Origin, save-ClipControl.Depth); + } + if (state MESA_META_COLOR_MASK) { GLuint i; for (i = 0; i ctx-Const.MaxDrawBuffers; i++) { diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index 2c9517b..08514ad 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -60,6 +60,7 @@ #define MESA_META_OCCLUSION_QUERY 0x40 #define MESA_META_DRAW_BUFFERS 0x80 #define MESA_META_DITHER 0x100 +#define MESA_META_CLIP_CONTROL(MESA_META_VIEWPORT|MESA_META_DEPTH_TEST) /**\}*/ /** @@ -88,6 +89,9 @@ struct save_state /** MESA_META_DITHER */ GLboolean DitherFlag; + /** MESA_META_CLIP_CONTROL */ + struct gl_clip_control ClipControl; + /** MESA_META_COLOR_MASK */ GLubyte ColorMask[MAX_DRAW_BUFFERS][4]; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/5] mesa: Refactor viewport transform computation.
Nice clean-up. Minor comments below. On 10/22/2014 11:13 AM, mathias.froehl...@gmx.net wrote: From: Mathias Fröhlich mathias.froehl...@gmx.net This is for preparation of ARB_clip_control. Signed-off-by: Mathias Froehlich mathias.froehl...@web.de --- src/mesa/drivers/dri/i915/i915_state.c| 26 ++--- src/mesa/main/state.c | 9 +++--- src/mesa/main/viewport.c | 47 --- src/mesa/main/viewport.h | 3 ++ src/mesa/math/m_matrix.c | 17 ++- src/mesa/math/m_matrix.h | 4 +-- src/mesa/state_tracker/st_atom_viewport.c | 23 +++ 7 files changed, 68 insertions(+), 61 deletions(-) diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c index f31b271..f9aecba 100644 --- a/src/mesa/drivers/dri/i915/i915_state.c +++ b/src/mesa/drivers/dri/i915/i915_state.c @@ -34,6 +34,7 @@ #include main/dd.h #include main/state.h #include main/stencil.h +#include main/viewport.h #include tnl/tnl.h #include tnl/t_context.h @@ -401,26 +402,17 @@ void intelCalcViewport(struct gl_context * ctx) { struct intel_context *intel = intel_context(ctx); + double scale[3], translate[3]; + + _mesa_get_viewport_xform(ctx, 0, scale, translate); if (_mesa_is_winsys_fbo(ctx-DrawBuffer)) { - _math_matrix_viewport(intel-ViewportMatrix, - ctx-ViewportArray[0].X, - ctx-DrawBuffer-Height - ctx-ViewportArray[0].Y, - ctx-ViewportArray[0].Width, - -ctx-ViewportArray[0].Height, - ctx-ViewportArray[0].Near, - ctx-ViewportArray[0].Far, - 1.0); - } else { - _math_matrix_viewport(intel-ViewportMatrix, - ctx-ViewportArray[0].X, - ctx-ViewportArray[0].Y, - ctx-ViewportArray[0].Width, - ctx-ViewportArray[0].Height, - ctx-ViewportArray[0].Near, - ctx-ViewportArray[0].Far, - 1.0); + scale[1] = -scale[1]; + translate[1] = ctx-DrawBuffer-Height - translate[1]; } + + _math_matrix_viewport(intel-ViewportMatrix, + scale, translate, 1.0); } diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 80287c4..3dbbfaa 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -51,6 +51,7 @@ #include texobj.h #include texstate.h #include varray.h +#include viewport.h #include blend.h @@ -281,11 +282,11 @@ update_viewport_matrix(struct gl_context *ctx) * NOTE: RasterPos uses this. */ for (i = 0; i ctx-Const.MaxViewports; i++) { + double scale[3], translate[3]; + + _mesa_get_viewport_xform(ctx, i, scale, translate); _math_matrix_viewport(ctx-ViewportArray[i]._WindowMap, -ctx-ViewportArray[i].X, ctx-ViewportArray[i].Y, -ctx-ViewportArray[i].Width, ctx-ViewportArray[i].Height, -ctx-ViewportArray[i].Near, ctx-ViewportArray[i].Far, -depthMax); +scale, translate, depthMax); } } diff --git a/src/mesa/main/viewport.c b/src/mesa/main/viewport.c index 222ae30..89766cf 100644 --- a/src/mesa/main/viewport.c +++ b/src/mesa/main/viewport.c @@ -39,6 +39,8 @@ set_viewport_no_notify(struct gl_context *ctx, unsigned idx, GLfloat x, GLfloat y, GLfloat width, GLfloat height) { + double scale[3], translate[3]; + /* clamp width and height to the implementation dependent range */ width = MIN2(width, (GLfloat) ctx-Const.MaxViewportWidth); height = MIN2(height, (GLfloat) ctx-Const.MaxViewportHeight); @@ -75,14 +77,9 @@ set_viewport_no_notify(struct gl_context *ctx, unsigned idx, * the WindowMap matrix being up to date in the driver's Viewport * and DepthRange functions. */ + _mesa_get_viewport_xform(ctx, idx, scale, translate); _math_matrix_viewport(ctx-ViewportArray[idx]._WindowMap, - ctx-ViewportArray[idx].X, - ctx-ViewportArray[idx].Y, - ctx-ViewportArray[idx].Width, - ctx-ViewportArray[idx].Height, - ctx-ViewportArray[idx].Near, - ctx-ViewportArray[idx].Far, - ctx-DrawBuffer-_DepthMaxF); + scale, translate, ctx-DrawBuffer-_DepthMaxF); #endif } @@ -248,6 +245,8 @@ static void set_depth_range_no_notify(struct gl_context *ctx, unsigned idx, GLclampd nearval, GLclampd farval) { + double scale[3], translate[3]; + if
Re: [Mesa-dev] [PATCH 2/5] mesa: Implement ARB_clip_control.
On 10/22/2014 11:13 AM, mathias.froehl...@gmx.net wrote: From: Mathias Fröhlich mathias.froehl...@gmx.net Implement the mesa parts of ARB_clip_control. So far no driver enables this. Signed-off-by: Mathias Froehlich mathias.froehl...@web.de --- src/mapi/glapi/gen/ARB_clip_control.xml | 25 +++ src/mapi/glapi/gen/gl_API.xml | 4 +- src/mesa/main/dlist.c | 26 +++ src/mesa/main/extensions.c | 1 + src/mesa/main/get_hash_params.py| 2 + src/mesa/main/mtypes.h | 12 + src/mesa/main/polygon.c | 5 ++- src/mesa/main/tests/dispatch_sanity.cpp | 3 ++ src/mesa/main/viewport.c| 79 +++-- src/mesa/main/viewport.h| 3 ++ 10 files changed, 154 insertions(+), 6 deletions(-) create mode 100644 src/mapi/glapi/gen/ARB_clip_control.xml diff --git a/src/mapi/glapi/gen/ARB_clip_control.xml b/src/mapi/glapi/gen/ARB_clip_control.xml new file mode 100644 index 000..2973a31 --- /dev/null +++ b/src/mapi/glapi/gen/ARB_clip_control.xml @@ -0,0 +1,25 @@ +?xml version=1.0? +!DOCTYPE OpenGLAPI SYSTEM gl_API.dtd + +OpenGLAPI + +category name=GL_ARB_clip_control number=160 + +enum name=LOWER_LEFT value = 0x8CA1/ +enum name=UPPER_LEFT value = 0x8CA2/ + +enum name=NEGATIVE_ONE_TO_ONE value = 0x935E/ +enum name=ZERO_TO_ONE value = 0x935F/ + +enum name=CLIP_ORIGIN value = 0x935C/ +enum name=CLIP_DEPTH_MODE value = 0x935D/ + +function name=ClipControl offset=assign +param name=origin type=GLenum/ +param name=depth type=GLenum/ +glx rop=1340/ +/function + +/category + +/OpenGLAPI diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml index 73f2f75..534e6a0 100644 --- a/src/mapi/glapi/gen/gl_API.xml +++ b/src/mapi/glapi/gen/gl_API.xml @@ -8364,7 +8364,9 @@ xi:include href=ARB_multi_bind.xml xmlns:xi=http://www.w3.org/2001/XInclude/ -!-- ARB extensions 148 - 160 -- +!-- ARB extensions 148 - 159 -- + +xi:include href=ARB_clip_control.xml xmlns:xi=http://www.w3.org/2001/XInclude/ category name=GL_ARB_conditional_render_inverted number=161 enum name=QUERY_WAIT_INVERTED value=0x8E17/ diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 5c7160d..4b7b060 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -398,6 +398,9 @@ typedef enum OPCODE_PROGRAM_UNIFORM_MATRIX34F, OPCODE_PROGRAM_UNIFORM_MATRIX43F, + /* GL_ARB_clip_control */ + OPCODE_CLIP_CONTROL, + /* GL_ARB_color_buffer_float */ OPCODE_CLAMP_COLOR, @@ -7208,6 +7211,22 @@ save_ProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, } static void GLAPIENTRY +save_ClipControl(GLenum origin, GLenum depth) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_CLIP_CONTROL, 2); + if (n) { + n[1].e = origin; + n[2].e = depth; + } + if (ctx-ExecuteFlag) { + CALL_ClipControl(ctx-Exec, (origin, depth)); + } +} + +static void GLAPIENTRY save_ClampColorARB(GLenum target, GLenum clamp) { GET_CURRENT_CONTEXT(ctx); @@ -8617,6 +8636,10 @@ execute_list(struct gl_context *ctx, GLuint list) get_pointer(n[5]))); break; + case OPCODE_CLIP_CONTROL: +CALL_ClipControl(ctx-Exec, (n[1].e, n[2].e)); +break; + case OPCODE_CLAMP_COLOR: CALL_ClampColor(ctx-Exec, (n[1].e, n[2].e)); break; @@ -9551,6 +9574,9 @@ _mesa_initialize_save_table(const struct gl_context *ctx) SET_TexParameterIiv(table, save_TexParameterIiv); SET_TexParameterIuiv(table, save_TexParameterIuiv); + /* GL_ARB_clip_control */ + SET_ClipControl(table, save_ClipControl); + /* GL_ARB_color_buffer_float */ SET_ClampColor(table, save_ClampColorARB); diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index f0e2f89..15d66a7 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -91,6 +91,7 @@ static const struct extension extension_table[] = { { GL_ARB_buffer_storage, o(ARB_buffer_storage), GL, 2013 }, { GL_ARB_clear_buffer_object, o(dummy_true), GL, 2012 }, { GL_ARB_clear_texture, o(ARB_clear_texture), GL, 2013 }, + { GL_ARB_clip_control,o(ARB_clip_control), GL, 2014 }, { GL_ARB_color_buffer_float, o(ARB_color_buffer_float), GL, 2004 }, { GL_ARB_compressed_texture_pixel_storage,o(dummy_true), GL, 2011 }, { GL_ARB_compute_shader,
[Mesa-dev] Mesa 10.4 release plan strawman
Hi all, I was wondering earlier how far are we until the 10.4 release and it hit me... there isn't much left. So in order to stick with the original three month release schedule here is my proposal. November 14th 2014 - Feature freeze/Release candidate 1 November 21st 2014 - Release candidate 2 November 28th 2014 - Release candidate 3 December 5th 2014 - Release candidate 4/Mesa 10.4.0 This gives us roughly three weeks to get new features in, and another four weeks to get all the serious bugs sorted out. Does this sound reasonable to you guys ? If anyone has something special in mind (can we get this earlier to align with XXX, can we push it back to get feature YYY) please speak up. Thanks Emil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] gallivm: Properly update for removal of JITMemoryManager in LLVM 3.6.
Am 22.10.2014 um 21:11 schrieb jfons...@vmware.com: From: José Fonseca jfons...@vmware.com JITMemoryManager was removed in LLVM 3.6, and replaced by its base class RTDyldMemoryManager. This change fixes our JIT memory managers specializations to derive from RTDyldMemoryManager in LLVM 3.6 instead of JITMemoryManager. This enables llvmpipe to run with LLVM 3.6. However, lp_free_generated_code is basically a no-op because there are not enough hook points in RTDyldMemoryManager to track and free the code of a module. In other words, with MCJIT, code once created, stays forever allocated until process destruction. This is not speicfic to LLVM 3.6 -- specific it will happen whenever MCJIT is used regardless of version. I thought we could use the old memory manager even when using mcjit (before 3.6)? In any case looks like something which needs fixing later. Otherwise the series looks good to me. Roland --- src/gallium/auxiliary/gallivm/lp_bld_init.c | 11 - src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 68 --- 2 files changed, 41 insertions(+), 38 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c index b82cb77..23a7c45 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_init.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c @@ -293,13 +293,9 @@ init_gallivm_state(struct gallivm_state *gallivm, const char *name, if (!gallivm-builder) goto fail; -#if HAVE_LLVM 0x0306 gallivm-memorymgr = lp_get_default_memory_manager(); if (!gallivm-memorymgr) goto fail; -#else - gallivm-memorymgr = 0; -#endif /* FIXME: MC-JIT only allows compiling one module at a time, and it must be * complete when MC-JIT is created. So defer the MC-JIT engine creation for @@ -364,13 +360,6 @@ lp_build_init(void) if (gallivm_initialized) return TRUE; - /* XXX: Remove this once lp_bld_misc.cpp has been adapted to the removal -* of JITMemoryManager -*/ -#if HAVE_LLVM = 0x0306 - return FALSE; -#endif - #ifdef DEBUG gallivm_debug = debug_get_option_gallivm_debug(); #endif diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index a1d2940..776af47 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -57,6 +57,8 @@ #include llvm/ADT/Triple.h #if HAVE_LLVM 0x0306 #include llvm/ExecutionEngine/JITMemoryManager.h +#else +#include llvm/ExecutionEngine/SectionMemoryManager.h #endif #include llvm/Support/CommandLine.h #include llvm/Support/Host.h @@ -137,19 +139,26 @@ lp_set_store_alignment(LLVMValueRef Inst, llvm::unwrapllvm::StoreInst(Inst)-setAlignment(Align); } + #if HAVE_LLVM 0x0306 +typedef llvm::JITMemoryManager BaseMemoryManager; +#else +typedef llvm::RTDyldMemoryManager BaseMemoryManager; +#endif + /* * Delegating is tedious but the default manager class is hidden in an * anonymous namespace in LLVM, so we cannot just derive from it to change * its behavior. */ -class DelegatingJITMemoryManager : public llvm::JITMemoryManager { +class DelegatingJITMemoryManager : public BaseMemoryManager { protected: - virtual llvm::JITMemoryManager *mgr() const = 0; + virtual BaseMemoryManager *mgr() const = 0; public: +#if HAVE_LLVM 0x0306 /* * From JITMemoryManager */ @@ -233,6 +242,7 @@ class DelegatingJITMemoryManager : public llvm::JITMemoryManager { virtual unsigned GetNumStubSlabs() { return mgr()-GetNumStubSlabs(); } +#endif /* * From RTDyldMemoryManager @@ -306,14 +316,14 @@ class DelegatingJITMemoryManager : public llvm::JITMemoryManager { */ class ShaderMemoryManager : public DelegatingJITMemoryManager { - llvm::JITMemoryManager *TheMM; + BaseMemoryManager *TheMM; struct GeneratedCode { typedef std::vectorvoid * Vec; Vec FunctionBody, ExceptionTable; - llvm::JITMemoryManager *TheMM; + BaseMemoryManager *TheMM; - GeneratedCode(llvm::JITMemoryManager *MM) { + GeneratedCode(BaseMemoryManager *MM) { TheMM = MM; } @@ -322,6 +332,7 @@ class ShaderMemoryManager : public DelegatingJITMemoryManager { * Deallocate things as previously requested and * free shared manager when no longer used. */ +#if HAVE_LLVM 0x0306 Vec::iterator i; assert(TheMM); @@ -330,19 +341,20 @@ class ShaderMemoryManager : public DelegatingJITMemoryManager { #if HAVE_LLVM 0x0304 for ( i = ExceptionTable.begin(); i != ExceptionTable.end(); ++i ) TheMM-deallocateExceptionTable(*i); -#endif +#endif /* HAVE_LLVM 0x0304 */ +#endif /* HAVE_LLVM 0x0306 */ } };
Re: [Mesa-dev] [PATCH 3/4] u_blitter: use ctx-bind_fs_state(), not pipe-bind_fs_state()
For patches 1-3: Reviewed-by: Marek Olšák marek.ol...@amd.com Patch 4 seems to be missing on the mailing list. Marek On Wed, Oct 22, 2014 at 11:16 PM, Brian Paul bri...@vmware.com wrote: Consistently use the function pointer we saved earlier. --- src/gallium/auxiliary/util/u_blitter.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 830d82f..ea9094e 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -361,7 +361,7 @@ static void bind_fs_empty(struct blitter_context_priv *ctx) ctx-fs_empty = util_make_empty_fragment_shader(pipe); } - pipe-bind_fs_state(pipe, ctx-fs_empty); + ctx-bind_fs_state(pipe, ctx-fs_empty); } static void bind_fs_write_one_cbuf(struct blitter_context_priv *ctx) @@ -375,7 +375,7 @@ static void bind_fs_write_one_cbuf(struct blitter_context_priv *ctx) TGSI_INTERPOLATE_CONSTANT, FALSE); } - pipe-bind_fs_state(pipe, ctx-fs_write_one_cbuf); + ctx-bind_fs_state(pipe, ctx-fs_write_one_cbuf); } static void bind_fs_write_all_cbufs(struct blitter_context_priv *ctx) @@ -389,7 +389,7 @@ static void bind_fs_write_all_cbufs(struct blitter_context_priv *ctx) TGSI_INTERPOLATE_CONSTANT, TRUE); } - pipe-bind_fs_state(pipe, ctx-fs_write_all_cbufs); + ctx-bind_fs_state(pipe, ctx-fs_write_all_cbufs); } void util_blitter_destroy(struct blitter_context *blitter) -- 1.7.10.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] i965: Add #defines for Broadwell HiZ workarounds in CACHE_MODE_1.
This patch adds macros needed for the HiZ PMA stall optimization. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/mesa/drivers/dri/i965/intel_reg.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/mesa/drivers/dri/i965/intel_reg.h b/src/mesa/drivers/dri/i965/intel_reg.h index 45b82ad..5ac0180 100644 --- a/src/mesa/drivers/dri/i965/intel_reg.h +++ b/src/mesa/drivers/dri/i965/intel_reg.h @@ -138,3 +138,9 @@ #define GEN7_3DPRIM_INSTANCE_COUNT 0x2438 #define GEN7_3DPRIM_START_INSTANCE 0x243C #define GEN7_3DPRIM_BASE_VERTEX 0x2440 + +#define GEN7_CACHE_MODE_1 0x7004 +# define GEN8_HIZ_NP_PMA_FIX_ENABLE(1 11) +# define GEN8_HIZ_NP_EARLY_Z_FAILS_DISABLE (1 13) +# define GEN8_HIZ_PMA_MASK_BITS \ + ((GEN8_HIZ_NP_PMA_FIX_ENABLE | GEN8_HIZ_NP_EARLY_Z_FAILS_DISABLE) 16) -- 2.1.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] i965: Implement the PMA stall fix.
Certain non-promoted depth cases typically incur stalls. In very specific cases, we can enable a workaround which improves performance. Improves performance in GLBenchmark 2.7 TRex by 1.17762% +/- 0.448765% (n=75) at 1280x720 on Broadwell GT3. Haswell has this feature as well, but we can't currently write registers from userspace batches (and we'd incur additional software batch scanning overhead as well), so we haven't enabled it. Broadwell allows us to write CACHE_MODE_1. Backporters beware: the formula and flushing incantation differs between Haswell and Broadwell. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/mesa/drivers/dri/i965/brw_context.h | 1 + src/mesa/drivers/dri/i965/brw_state.h| 1 + src/mesa/drivers/dri/i965/brw_state_upload.c | 6 + src/mesa/drivers/dri/i965/gen8_depth_state.c | 170 +++ 4 files changed, 178 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 45d72d2..7877aa1 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1079,6 +1079,7 @@ struct brw_context GLuint NewGLState; struct { struct brw_state_flags dirty; + uint32_t pma_stall_bits; } state; struct brw_cache cache; diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index 2efe56e..209fab1 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -137,6 +137,7 @@ extern const struct brw_tracked_state gen8_disable_stages; extern const struct brw_tracked_state gen8_gs_state; extern const struct brw_tracked_state gen8_index_buffer; extern const struct brw_tracked_state gen8_multisample_state; +extern const struct brw_tracked_state gen8_pma_fix; extern const struct brw_tracked_state gen8_ps_blend; extern const struct brw_tracked_state gen8_ps_extra; extern const struct brw_tracked_state gen8_ps_state; diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index a691319..efa870c 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -333,6 +333,7 @@ static const struct brw_tracked_state *gen8_atoms[] = gen8_vertices, haswell_cut_index, + gen8_pma_fix, }; static void @@ -390,6 +391,11 @@ void brw_init_state( struct brw_context *brw ) brw-state.dirty.mesa = ~0; brw-state.dirty.brw = ~0ull; + /* ~0 is a nonsensical value which won't match anything we program, so +* the programming will take effect on the first time around. +*/ + brw-state.pma_stall_bits = ~0; + /* Make sure that brw-state.dirty.brw has enough bits to hold all possible * dirty flags. */ diff --git a/src/mesa/drivers/dri/i965/gen8_depth_state.c b/src/mesa/drivers/dri/i965/gen8_depth_state.c index 7c3bfe0..4284a62 100644 --- a/src/mesa/drivers/dri/i965/gen8_depth_state.c +++ b/src/mesa/drivers/dri/i965/gen8_depth_state.c @@ -28,6 +28,7 @@ #include brw_context.h #include brw_state.h #include brw_defines.h +#include brw_wm.h /** * Helper function to emit depth related command packets. @@ -210,6 +211,172 @@ gen8_emit_depth_stencil_hiz(struct brw_context *brw, } /** + * Should we set the PMA FIX ENABLE bit? + * + * To avoid unnecessary depth related stalls, we need to set this bit. + * However, there is a very complicated formula which governs when it + * is legal to do so. This function computes that. + * + * See the documenation for the CACHE_MODE_1 register, bit 11. + */ +static bool +pma_fix_enable(const struct brw_context *brw) +{ + const struct gl_context *ctx = brw-ctx; + /* BRW_NEW_FRAGMENT_PROGRAM */ + const struct gl_fragment_program *fp = brw-fragment_program; + /* _NEW_BUFFERS */ + struct intel_renderbuffer *depth_irb = + intel_get_renderbuffer(ctx-DrawBuffer, BUFFER_DEPTH); + + /* 3DSTATE_WM::ForceThreadDispatch is never used. */ + const bool wm_force_thread_dispatch = false; + + /* 3DSTATE_RASTER::ForceSampleCount is never used. */ + const bool raster_force_sample_count_nonzero = false; + + /* _NEW_BUFFERS: +* 3DSTATE_DEPTH_BUFFER::SURFACE_TYPE != NULL +* 3DSTATE_DEPTH_BUFFER::HIZ Enable +*/ + const bool hiz_enabled = depth_irb intel_renderbuffer_has_hiz(depth_irb); + + /* 3DSTATE_WM::Early Depth/Stencil Control != EDSC_PREPS (2). +* We always leave this set to EDSC_NORMAL (0). +*/ + const bool edsc_not_preps = true; + + /* 3DSTATE_PS_EXTRA::PixelShaderValid is always true. */ + const bool pixel_shader_valid = true; + + /* !(3DSTATE_WM_HZ_OP::DepthBufferClear || +* 3DSTATE_WM_HZ_OP::DepthBufferResolve || +* 3DSTATE_WM_HZ_OP::Hierarchical Depth Buffer Resolve Enable || +* 3DSTATE_WM_HZ_OP::StencilBufferClear) +* +* HiZ operations are done outside of the normal state upload, so they're +* definitely not happening
[Mesa-dev] [PATCH 3/3] i965: Re-enable Z16 on Gen8+.
Improves performance in GLBenchmark 2.7 TRex by 3.9% +/- 0.336383% (n=80) at 1280x720 on Broadwell GT3. Together with the previous patch, it improves performance by 5.42738% +/- 0.541971% (n=10) at 1920x1080. Note that without the PMA stall fix, this would instead decrease performance by 22%. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/mesa/drivers/dri/i965/brw_surface_formats.c | 4 1 file changed, 4 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_surface_formats.c b/src/mesa/drivers/dri/i965/brw_surface_formats.c index 5407ef6..ce6f88c 100644 --- a/src/mesa/drivers/dri/i965/brw_surface_formats.c +++ b/src/mesa/drivers/dri/i965/brw_surface_formats.c @@ -619,6 +619,8 @@ brw_init_surface_formats(struct brw_context *brw) brw-format_supported_as_render_target[MESA_FORMAT_S_UINT8] = true; brw-format_supported_as_render_target[MESA_FORMAT_Z_FLOAT32] = true; brw-format_supported_as_render_target[MESA_FORMAT_Z32_FLOAT_S8X24_UINT] = true; + if (brw-gen = 8) + brw-format_supported_as_render_target[MESA_FORMAT_Z_UNORM16] = true; /* We remap depth formats to a supported texturing format in * translate_tex_format(). @@ -639,6 +641,8 @@ brw_init_surface_formats(struct brw_context *brw) * Other speculation is that we may be hitting increased fragment shader * execution from GL_LEQUAL/GL_EQUAL depth tests at reduced precision. */ + if (brw-gen = 8) + ctx-TextureFormatSupported[MESA_FORMAT_Z_UNORM16] = true; /* On hardware that lacks support for ETC1, we map ETC1 to RGBX * during glCompressedTexImage2D(). See intel_mipmap_tree::wraps_etc1. -- 2.1.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Mesa-stable] [PATCH 1/4] glsl: Fix crash due to negative array index
On Wed, Oct 22, 2014 at 1:40 PM, Chris Forbes chr...@ijw.co.nz wrote: Patches 1 2 are: Reviewed-by: Chris Forbes chr...@ijw.co.nz I'm not convinced about patch 3. From the GLSL 4.50 spec, section 4.1.9 Arrays p31 (p37 of the PDF): It is a compile-time error to declare an array with a size, and then later (in the same shader) index the same array with an integral constant expression greater than or equal to the declared size. Right. We need the compile error in case of index represented by a constant expression. I'll drop patches 3 and 4. Compilation happens successfully in case of index represented by a non-constant expression. I will also modify few test cases accordingly in following piglit patch: [PATCH] Add shader tests for out of bounds array index -- Chris On Thu, Oct 23, 2014 at 8:33 AM, Emil Velikov emil.l.veli...@gmail.com wrote: Hi Anuj, Afaics the series is yet to land on master, this I've not pulled it for the stable branch. Is the lack of review holding it back ? Gents can anyone take a look at/review the series ? Thanks Emil On 22/09/14 23:57, Anuj Phogat wrote: Currently Mesa crashes with a shader like this: [fragmnet shader] float[5] array; int idx = -2; void main() { gl_FragColor = vec4(0.0, 1.0, 0.0, array[idx]); } Cc: mesa-sta...@lists.freedesktop.org Signed-off-by: Anuj Phogat anuj.pho...@gmail.com --- src/glsl/opt_array_splitting.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/glsl/opt_array_splitting.cpp b/src/glsl/opt_array_splitting.cpp index ebb076b..9e73f3c 100644 --- a/src/glsl/opt_array_splitting.cpp +++ b/src/glsl/opt_array_splitting.cpp @@ -295,7 +295,7 @@ ir_array_splitting_visitor::split_deref(ir_dereference **deref) ir_constant *constant = deref_array-array_index-as_constant(); assert(constant); - if (constant-value.i[0] (int)entry-size) { + if (constant-value.i[0] = 0 constant-value.i[0] (int)entry-size) { *deref = new(entry-mem_ctx) ir_dereference_variable(entry-components[constant-value.i[0]]); } else { ___ mesa-stable mailing list mesa-sta...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-stable ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] gallivm: Properly update for removal of JITMemoryManager in LLVM 3.6.
thought we could use the old memory manager even when using mcjit (before 3.6)? Not really. Even when we passed a JITMemoryManager to MCJIT, it would only use the methods of the base class RTDyldMemoryManager, As I said, this series doesn't cause any regression per se: it makes MCJIT on 3.6 as good (and as broken) as on earlier versions. I still can't recommend MCJIT for any memory constrained environments. Indeed this needs be fixing (for all LLVM versions), and it will require a considerable rewrite of our memory manager, as MCJIT-RTDyldMemoryManager don't provide hooks as rich as old JIT-JITMemoryManager did. Jose From: Roland Scheidegger Sent: 22 October 2014 23:21 To: Jose Fonseca; mesa-dev@lists.freedesktop.org Subject: Re: [PATCH 3/3] gallivm: Properly update for removal of JITMemoryManager in LLVM 3.6. Am 22.10.2014 um 21:11 schrieb jfons...@vmware.com: From: José Fonseca jfons...@vmware.com JITMemoryManager was removed in LLVM 3.6, and replaced by its base class RTDyldMemoryManager. This change fixes our JIT memory managers specializations to derive from RTDyldMemoryManager in LLVM 3.6 instead of JITMemoryManager. This enables llvmpipe to run with LLVM 3.6. However, lp_free_generated_code is basically a no-op because there are not enough hook points in RTDyldMemoryManager to track and free the code of a module. In other words, with MCJIT, code once created, stays forever allocated until process destruction. This is not speicfic to LLVM 3.6 -- specific it will happen whenever MCJIT is used regardless of version. I thought we could use the old memory manager even when using mcjit (before 3.6)? In any case looks like something which needs fixing later. Otherwise the series looks good to me. Roland --- src/gallium/auxiliary/gallivm/lp_bld_init.c | 11 - src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 68 --- 2 files changed, 41 insertions(+), 38 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c index b82cb77..23a7c45 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_init.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c @@ -293,13 +293,9 @@ init_gallivm_state(struct gallivm_state *gallivm, const char *name, if (!gallivm-builder) goto fail; -#if HAVE_LLVM 0x0306 gallivm-memorymgr = lp_get_default_memory_manager(); if (!gallivm-memorymgr) goto fail; -#else - gallivm-memorymgr = 0; -#endif /* FIXME: MC-JIT only allows compiling one module at a time, and it must be * complete when MC-JIT is created. So defer the MC-JIT engine creation for @@ -364,13 +360,6 @@ lp_build_init(void) if (gallivm_initialized) return TRUE; - /* XXX: Remove this once lp_bld_misc.cpp has been adapted to the removal -* of JITMemoryManager -*/ -#if HAVE_LLVM = 0x0306 - return FALSE; -#endif - #ifdef DEBUG gallivm_debug = debug_get_option_gallivm_debug(); #endif diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index a1d2940..776af47 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -57,6 +57,8 @@ #include llvm/ADT/Triple.h #if HAVE_LLVM 0x0306 #include llvm/ExecutionEngine/JITMemoryManager.h +#else +#include llvm/ExecutionEngine/SectionMemoryManager.h #endif #include llvm/Support/CommandLine.h #include llvm/Support/Host.h @@ -137,19 +139,26 @@ lp_set_store_alignment(LLVMValueRef Inst, llvm::unwrapllvm::StoreInst(Inst)-setAlignment(Align); } + #if HAVE_LLVM 0x0306 +typedef llvm::JITMemoryManager BaseMemoryManager; +#else +typedef llvm::RTDyldMemoryManager BaseMemoryManager; +#endif + /* * Delegating is tedious but the default manager class is hidden in an * anonymous namespace in LLVM, so we cannot just derive from it to change * its behavior. */ -class DelegatingJITMemoryManager : public llvm::JITMemoryManager { +class DelegatingJITMemoryManager : public BaseMemoryManager { protected: - virtual llvm::JITMemoryManager *mgr() const = 0; + virtual BaseMemoryManager *mgr() const = 0; public: +#if HAVE_LLVM 0x0306 /* * From JITMemoryManager */ @@ -233,6 +242,7 @@ class DelegatingJITMemoryManager : public llvm::JITMemoryManager { virtual unsigned GetNumStubSlabs() { return mgr()-GetNumStubSlabs(); } +#endif /* * From RTDyldMemoryManager @@ -306,14 +316,14 @@ class DelegatingJITMemoryManager : public llvm::JITMemoryManager { */ class ShaderMemoryManager : public DelegatingJITMemoryManager { - llvm::JITMemoryManager *TheMM; + BaseMemoryManager *TheMM; struct GeneratedCode { typedef std::vectorvoid * Vec; Vec FunctionBody, ExceptionTable; -
Re: [Mesa-dev] [PATCH 3/4] u_blitter: use ctx-bind_fs_state(), not pipe-bind_fs_state()
On 10/22/2014 04:31 PM, Marek Olšák wrote: For patches 1-3: Reviewed-by: Marek Olšák marek.ol...@amd.com Patch 4 seems to be missing on the mailing list. Yeah, I don't know what happened to it. But 4/4 only adds a comment on util_blitter_cache_all_shaders() so not a big deal. -Brian Marek On Wed, Oct 22, 2014 at 11:16 PM, Brian Paul bri...@vmware.com wrote: Consistently use the function pointer we saved earlier. --- src/gallium/auxiliary/util/u_blitter.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 830d82f..ea9094e 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -361,7 +361,7 @@ static void bind_fs_empty(struct blitter_context_priv *ctx) ctx-fs_empty = util_make_empty_fragment_shader(pipe); } - pipe-bind_fs_state(pipe, ctx-fs_empty); + ctx-bind_fs_state(pipe, ctx-fs_empty); } static void bind_fs_write_one_cbuf(struct blitter_context_priv *ctx) @@ -375,7 +375,7 @@ static void bind_fs_write_one_cbuf(struct blitter_context_priv *ctx) TGSI_INTERPOLATE_CONSTANT, FALSE); } - pipe-bind_fs_state(pipe, ctx-fs_write_one_cbuf); + ctx-bind_fs_state(pipe, ctx-fs_write_one_cbuf); } static void bind_fs_write_all_cbufs(struct blitter_context_priv *ctx) @@ -389,7 +389,7 @@ static void bind_fs_write_all_cbufs(struct blitter_context_priv *ctx) TGSI_INTERPOLATE_CONSTANT, TRUE); } - pipe-bind_fs_state(pipe, ctx-fs_write_all_cbufs); + ctx-bind_fs_state(pipe, ctx-fs_write_all_cbufs); } void util_blitter_destroy(struct blitter_context *blitter) -- 1.7.10.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/mesa-devk=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0Ar=lGQMzzTgII0I7jefp2FHq7WtZ%2BTLs8wadB%2BiIj9xpBY%3D%0Am=mDky4a9NWRTJROpiD%2BUxwvg6%2FZ2gsPQE2rAlghPH%2BkY%3D%0As=cccfe3cee5bca8a44cc9ff1e4c88bd3d55a433b57ab55087f88c701285d95537 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Mesa-users] Texture coordinates are all zero
OK, I reproduced the issue with a piglit shader_runner test. It looks like the writes to float, vec2 or vec3 outputs is sometimes lost (but always works for vec4). I've posted a set of tests to the piglit list. I'm cc'ing the mesa-dev list so hopefully one of the GLSL people can take a look. -Brian On 10/22/2014 06:34 PM, Brian Paul wrote: In your vertex shader, try removing this code: if( !lightingEnabled ) { return; } It looks like the early return from main() is causing us to skip writing the value to the UV varying/output. I'll see if I can repro this with a small piglit test. -Brian On 10/21/2014 10:16 PM, Jason Anderssen wrote: Hi Brian, The previous trace was my first attempt, and even though it reproduced on windows, I tested it on linux, and it only gave a black screen, so here is a second attempt, and I also tested it on linux as well, with identical results to the windows replay using apitrace. (I might of only allowed it to record a single frame, and I think this is what caused the issue.) Sorry for the previous trace. Anyhow, on a good note, it reproduces in Windows and Linux builds of mesa, so I hope you can tell me what I am doing wrong. Thanks again for your help and patience. Cheers Jason On 22/10/2014 12:10 pm, Jason Anderssen janders...@exactal.com wrote: Hi Brian, I worked out what you mean by apitrace, attached is the trace for you. Switching between Mesa3d-llvm build to the windows default opengl32.dll shows 2 different results, Mesa is completely blue, where as using the system you have green and blue strips (which is what I would expect). The version is 10.2.9 I hope this helps. Cheers Jason On 22/10/2014 10:20 am, Jason Anderssen janders...@exactal.com wrote: Hi Brian, Thank you for your response. I am kind of new to Mesa, so please forgive my ignorance:-) Do I build it with this export (soft pipe)? What kind of apitrace do you mean, a trace of all the calls via codeXL ?, or is there a special tool that Mesa dev¹s use? Cheers and thank you in advance. Jason On 22/10/2014 9:15 am, Brian Paul bri...@vmware.com wrote: On 10/21/2014 03:28 PM, Jason Anderssen wrote: Hi all, In Mesa 3D (Windows software llvm) all our texture coordinates are coming through as zero. Our same code works fine with ATI, NVIDIA, and even Angle (which I know uses Direct3D under the covers, but it is an OpenGL ES compliant wrapper). To verify this, I simply in the shader checked if the texcoord.s is 0.5 and color green, else blue, and sure enough half the image is green and half is blue with the other drivers, but with Mesa, it is entirely blue. (entirely same program and exe, just different opengl32.dll) Any ideas what could be causing this? Any help would be very appreciated. Can you make an apitrace of the problem? Have you tried with softpipe (export GALLIUM_DRIVER=softpipe)? -Brian Internet Email Confidentiality Footer: This email and any files transmitted with it contain privileged/confidential information intended for the addressee. Neither the confidentiality of nor any privilege in the email is waived, lost or destroyed by reason that it has been transmitted other than to the addressee. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message, and notify us immediately. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] New stable-branch 10.3 candidate pushed
On 23.10.2014 04:27, Emil Velikov wrote: Trivial merge conflicts --- Here are the commits where I manually merged conflicts, (so these might merit additional review): commit c759d1b6bfbc15b044ef3f7cd590b6647c3670df Author: Michel Dänzer michel.daen...@amd.com winsys/radeon: Use separate caching buffer manager for each set of flags (cherry picked from commit 3ede67a4c6d77892296ffc5568ddf3accaa1af99) Looks good, FWIW. -- Earthling Michel Dänzer| http://www.amd.com Libre software enthusiast |Mesa and X developer ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Mesa-users] Texture coordinates are all zero
Thanks Brian, Nice easy workaround for us. Cheers And thanks for your help. Jason Anderssen On 23/10/2014 11:02 am, Brian Paul bri...@vmware.com wrote: OK, I reproduced the issue with a piglit shader_runner test. It looks like the writes to float, vec2 or vec3 outputs is sometimes lost (but always works for vec4). I've posted a set of tests to the piglit list. I'm cc'ing the mesa-dev list so hopefully one of the GLSL people can take a look. -Brian On 10/22/2014 06:34 PM, Brian Paul wrote: In your vertex shader, try removing this code: if( !lightingEnabled ) { return; } It looks like the early return from main() is causing us to skip writing the value to the UV varying/output. I'll see if I can repro this with a small piglit test. -Brian On 10/21/2014 10:16 PM, Jason Anderssen wrote: Hi Brian, The previous trace was my first attempt, and even though it reproduced on windows, I tested it on linux, and it only gave a black screen, so here is a second attempt, and I also tested it on linux as well, with identical results to the windows replay using apitrace. (I might of only allowed it to record a single frame, and I think this is what caused the issue.) Sorry for the previous trace. Anyhow, on a good note, it reproduces in Windows and Linux builds of mesa, so I hope you can tell me what I am doing wrong. Thanks again for your help and patience. Cheers Jason On 22/10/2014 12:10 pm, Jason Anderssen janders...@exactal.com wrote: Hi Brian, I worked out what you mean by apitrace, attached is the trace for you. Switching between Mesa3d-llvm build to the windows default opengl32.dll shows 2 different results, Mesa is completely blue, where as using the system you have green and blue strips (which is what I would expect). The version is 10.2.9 I hope this helps. Cheers Jason On 22/10/2014 10:20 am, Jason Anderssen janders...@exactal.com wrote: Hi Brian, Thank you for your response. I am kind of new to Mesa, so please forgive my ignorance:-) Do I build it with this export (soft pipe)? What kind of apitrace do you mean, a trace of all the calls via codeXL ?, or is there a special tool that Mesa dev¹s use? Cheers and thank you in advance. Jason On 22/10/2014 9:15 am, Brian Paul bri...@vmware.com wrote: On 10/21/2014 03:28 PM, Jason Anderssen wrote: Hi all, In Mesa 3D (Windows software llvm) all our texture coordinates are coming through as zero. Our same code works fine with ATI, NVIDIA, and even Angle (which I know uses Direct3D under the covers, but it is an OpenGL ES compliant wrapper). To verify this, I simply in the shader checked if the texcoord.s is 0.5 and color green, else blue, and sure enough half the image is green and half is blue with the other drivers, but with Mesa, it is entirely blue. (entirely same program and exe, just different opengl32.dll) Any ideas what could be causing this? Any help would be very appreciated. Can you make an apitrace of the problem? Have you tried with softpipe (export GALLIUM_DRIVER=softpipe)? -Brian Internet Email Confidentiality Footer: This email and any files transmitted with it contain privileged/confidential information intended for the addressee. Neither the confidentiality of nor any privilege in the email is waived, lost or destroyed by reason that it has been transmitted other than to the addressee. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message, and notify us immediately. Internet Email Confidentiality Footer: This email and any files transmitted with it contain privileged/confidential information intended for the addressee. Neither the confidentiality of nor any privilege in the email is waived, lost or destroyed by reason that it has been transmitted other than to the addressee. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message, and notify us immediately. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [r600g] Is LLVM-compiler (--enable-r600-llvm-compiler) usable, now?
On 23.10.2014 02:24, Alex Deucher wrote: On Wed, Oct 22, 2014 at 12:49 PM, Dieter Nützel die...@nuetzel-hh.de wrote: subject say it all ;-) The llvm support for r600g is for compute (OpenCL). The fact that is it somewhat usable for graphics is mainly for testing purposes. There are no plans to expand it to handle additional graphics features, although any interested parties are welcome to contribute to improving it. IIRC, even when you enable it, it currently only gets applied to compute shaders. The LLVM compiler is used automatically for OpenCL, even without --enable-r600-llvm-compiler. That option allows using LLVM for graphics as well, but it's currently disabled by default at runtime, the user needs to explicitly enable it via the environment variable R600_DEBUG=llvm or R600_LLVM=1. Due to the limitations of that (no geometry shader support and other missing functionality, lots of bugs), I'd currently recommend against enabling it unless you want to work on fixing its problems. Second, we are now nearly on par with 3.16 on RV730 (AGP) with all your latest work, but I think about what we could get if we find the right commit between 3.16 (.4 here) and 3.17-rc1 (the transition from 3.16 to 3.17-next). I do not have 3.16.x around (it is not any longer in the openSUSE kernel current tree) but with latest 3.16.4 I was faster then with all 3.17.x and 3.18/3.19-next kernels. Faster doing what? WC helped on RV730 (AGP) with some apps, here: What exactly do you mean by 'WC helped'? CPU mappings of GTT have always used write-combining with AGP, so unless you disable AGP, the changes related to that shouldn't change anything. -- Earthling Michel Dänzer| http://www.amd.com Libre software enthusiast |Mesa and X developer ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 4/5] gallium: introduce PIPE_CAP_CLIP_HALFZ.
On 23.10.2014 02:13, mathias.froehl...@gmx.net wrote: From: Mathias Fröhlich mathias.froehl...@gmx.net In preparation of ARB_clip_control. Let the driver decide if it supports pipe_rasterizer_state::clip_halfz being set to true. Signed-off-by: Mathias Froehlich mathias.froehl...@web.de [...] diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c index 48c3dea..4e931fb 100644 --- a/src/gallium/drivers/ilo/ilo_screen.c +++ b/src/gallium/drivers/ilo/ilo_screen.c @@ -446,6 +446,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE: case PIPE_CAP_CONDITIONAL_RENDER_INVERTED: case PIPE_CAP_SAMPLER_VIEW_TARGET: + case PIPE_CAP_CLIP_HALFZ: return 0; ilo handles clip_halfz according to git grep: src/gallium/drivers/ilo/ilo_state_gen6.c: if (state-clip_halfz) diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index a6e7fc0..47126ef 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -227,6 +227,8 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) return 0; case PIPE_CAP_CONDITIONAL_RENDER_INVERTED: return 1; + case PIPE_CAP_CLIP_HALFZ: + return 1; Does softpipe really handle it though? Have you tested that? -- Earthling Michel Dänzer| http://www.amd.com Libre software enthusiast |Mesa and X developer ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH RFC] mesa: add SSE optimisation for glDrawElements
Makes use of SSE to speed up compute of min and max elements Callgrind cpu usage results from pts benchmarks: Openarena 0.8.8: 3.67% - 1.03% UrbanTerror: 2.36% - 0.81% Signed-off-by: Timothy Arceri t_arc...@yahoo.com.au --- src/mesa/Makefile.am | 3 +- src/mesa/main/sse_minmax.c| 75 +++ src/mesa/main/sse_minmax.h| 29 + src/mesa/vbo/vbo_exec_array.c | 8 + 4 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 src/mesa/main/sse_minmax.c create mode 100644 src/mesa/main/sse_minmax.h I almost wasn't going to bother sending this out since it uses SSE4.1 and its recommended to use glDrawRangeElements anyway. But since these games are still ofter used for benchmarking I thought I'd see if anyone is interested in this. I only optimised GL_UNSIGNED_INT as that was the only place these games were hitting but I guess it wouldn't hurt to optimse the other cases too. I think it would probably make sense too to just combine streaming-load-memcpy.c and sse_minmax.c into a single file something like sse_opt.c for example. As far a frame rates go I couldn't see any concrete improments on my Ivybridge machine. Maybe it would help more on a high end radeon card where cpu apparently is more of a concern?? Finally its seems to run fine but its only the second time I've tried these type of optimisations so let me know if there are any obvious mistakes or improvements. diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am index e71bccb..932db4f 100644 --- a/src/mesa/Makefile.am +++ b/src/mesa/Makefile.am @@ -151,7 +151,8 @@ libmesagallium_la_LIBADD = \ $(ARCH_LIBS) libmesa_sse41_la_SOURCES = \ - main/streaming-load-memcpy.c + main/streaming-load-memcpy.c \ + main/sse_minmax.c libmesa_sse41_la_CFLAGS = $(AM_CFLAGS) -msse4.1 pkgconfigdir = $(libdir)/pkgconfig diff --git a/src/mesa/main/sse_minmax.c b/src/mesa/main/sse_minmax.c new file mode 100644 index 000..1625407 --- /dev/null +++ b/src/mesa/main/sse_minmax.c @@ -0,0 +1,75 @@ +/* + * Copyright © 2014 Timothy Arceri + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the Software), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Author: + *Timothy Arceri t_arc...@yahoo.com.au + * + */ + +#ifdef __SSE4_1__ +#include main/glheader.h +#include main/sse_minmax.h +#include smmintrin.h + +void +sse_minmax(const GLuint *ui_indices, GLuint *min_index, GLuint *max_index, const GLuint count) +{ + GLuint i = 0; + GLuint max_ui = 0; + GLuint min_ui = ~0U; + GLuint max_arr[4] = {0}; + GLuint min_arr[4] = {0}; + GLuint vec_count; + __m128i max_ui4 = _mm_setzero_si128(); + __m128i min_ui4 = _mm_set1_epi32(~0U); + __m128i ui_indices4; + __m128i *ui_indices_ptr; + + if (count = 4) { + vec_count = count - (count % 4); + ui_indices_ptr = (__m128i*)ui_indices; + for (i = 0; i vec_count/4; i++) { + ui_indices4 = _mm_loadu_si128(ui_indices_ptr[i]); + max_ui4 = _mm_max_epu32(ui_indices4, max_ui4); + min_ui4 = _mm_min_epu32(ui_indices4, min_ui4); + } + + _mm_store_ps((float*)max_arr, _mm_castsi128_ps(max_ui4)); + _mm_store_ps((float*)min_arr, _mm_castsi128_ps(min_ui4)); + + for (i = 0; i 4; i++) { + if (max_arr[i] max_ui) max_ui = max_arr[i]; + if (min_arr[i] min_ui) min_ui = min_arr[i]; + } + i = vec_count; + } + + for (; i count; i++) { + if (ui_indices[i] max_ui) max_ui = ui_indices[i]; + if (ui_indices[i] min_ui) min_ui = ui_indices[i]; + } + + *min_index = min_ui; + *max_index = max_ui; +} + +#endif diff --git a/src/mesa/main/sse_minmax.h b/src/mesa/main/sse_minmax.h new file mode 100644 index 000..d14db26 --- /dev/null +++ b/src/mesa/main/sse_minmax.h @@ -0,0 +1,29 @@ +/* + * Copyright © 2014 Timothy Arceri + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software
Re: [Mesa-dev] [PATCH RFC] mesa: add SSE optimisation for glDrawElements
On Wed, Oct 22, 2014 at 9:02 PM, Timothy Arceri t_arc...@yahoo.com.au wrote: Makes use of SSE to speed up compute of min and max elements Callgrind cpu usage results from pts benchmarks: Openarena 0.8.8: 3.67% - 1.03% UrbanTerror: 2.36% - 0.81% Signed-off-by: Timothy Arceri t_arc...@yahoo.com.au --- src/mesa/Makefile.am | 3 +- src/mesa/main/sse_minmax.c| 75 +++ src/mesa/main/sse_minmax.h| 29 + src/mesa/vbo/vbo_exec_array.c | 8 + 4 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 src/mesa/main/sse_minmax.c create mode 100644 src/mesa/main/sse_minmax.h I almost wasn't going to bother sending this out since it uses SSE4.1 and its recommended to use glDrawRangeElements anyway. But since these games are still ofter used for benchmarking I thought I'd see if anyone is interested in this. I only optimised GL_UNSIGNED_INT as that was the only place these games were hitting but I guess it wouldn't hurt to optimse the other cases too. I think it's kind of neat! It might also be fun to try to do this with OpenMP. OpenMP 3.1 (supported since gcc-4.7) supports min/max reduction operators. I suppose doing that may allow this code to work on more than just SSE 4.1 (e.g., could also use AVX2). I think it would probably make sense too to just combine streaming-load-memcpy.c and sse_minmax.c into a single file something like sse_opt.c for example. I don't see any reason to do that. As far a frame rates go I couldn't see any concrete improments on my Ivybridge machine. Maybe it would help more on a high end radeon card where cpu apparently is more of a concern?? Finally its seems to run fine but its only the second time I've tried these type of optimisations so let me know if there are any obvious mistakes or improvements. Overall the patch looks pretty good. Some comments below. diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am index e71bccb..932db4f 100644 --- a/src/mesa/Makefile.am +++ b/src/mesa/Makefile.am @@ -151,7 +151,8 @@ libmesagallium_la_LIBADD = \ $(ARCH_LIBS) libmesa_sse41_la_SOURCES = \ - main/streaming-load-memcpy.c + main/streaming-load-memcpy.c \ + main/sse_minmax.c libmesa_sse41_la_CFLAGS = $(AM_CFLAGS) -msse4.1 pkgconfigdir = $(libdir)/pkgconfig diff --git a/src/mesa/main/sse_minmax.c b/src/mesa/main/sse_minmax.c new file mode 100644 index 000..1625407 --- /dev/null +++ b/src/mesa/main/sse_minmax.c @@ -0,0 +1,75 @@ +/* + * Copyright © 2014 Timothy Arceri + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the Software), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Author: + *Timothy Arceri t_arc...@yahoo.com.au + * + */ + +#ifdef __SSE4_1__ +#include main/glheader.h +#include main/sse_minmax.h +#include smmintrin.h + +void +sse_minmax(const GLuint *ui_indices, GLuint *min_index, GLuint *max_index, const GLuint count) +{ + GLuint i = 0; + GLuint max_ui = 0; + GLuint min_ui = ~0U; + GLuint max_arr[4] = {0}; + GLuint min_arr[4] = {0}; + GLuint vec_count; I probably wouldn't use GL* types here. + __m128i max_ui4 = _mm_setzero_si128(); + __m128i min_ui4 = _mm_set1_epi32(~0U); + __m128i ui_indices4; + __m128i *ui_indices_ptr; + + if (count = 4) { + vec_count = count - (count % 4); vec_count = count ~0x3; + ui_indices_ptr = (__m128i*)ui_indices; + for (i = 0; i vec_count/4; i++) { Spaces around operators. + ui_indices4 = _mm_loadu_si128(ui_indices_ptr[i]); + max_ui4 = _mm_max_epu32(ui_indices4, max_ui4); + min_ui4 = _mm_min_epu32(ui_indices4, min_ui4); + } + + _mm_store_ps((float*)max_arr, _mm_castsi128_ps(max_ui4)); + _mm_store_ps((float*)min_arr, _mm_castsi128_ps(min_ui4)); I think you just want to use _mm_store_si128() here. Do we have some guarantee that
Re: [Mesa-dev] [SOC Ideas] Find common patterns in real GLSL shaders
On Fri, 2014-10-17 at 11:12 +0530, Manasij Mukherjee wrote: Hi, I found the idea-page recently and am interested in tackling the problem labelled Find common patterns in real GLSL shaders. Can anyone point me to any previous work attempted on this if any? A few people have asked about this previously but not sure if anyone has started the work. Here is Ian's reply with some extra information from the last time someone asked about it. http://lists.freedesktop.org/archives/mesa-dev/2014-August/064790.html I am interested in this because I like compilers and OpenGL. And while I have have some practical experience with compilers (GSOC 14 [1] ), my experience with OpenGL is rather limited, but I do understand how the modern pipeline works and have written a simple C++ abstraction layer for OpenGL ([2]). Would it be possible to apply for X.Org Endless Vacation of Code programs at this time ? If so, whom do I contact ? Thanks Manasij Mukherjee [1] Proposal: http://www.google-melange.com/gsoc/proposal/public/google/gsoc2014/manasij7479/5629499534213120 Code Samples: http://www.google-melange.com/gsoc/project/details/google/gsoc2014/manasij7479/5741031244955648 [2] Simple OpenGL abstraction layer written by me while learning OpenGL. https://github.com/manasij7479/gl ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH RFC] mesa: add SSE optimisation for glDrawElements
On Wed, Oct 22, 2014 at 10:30 PM, Matt Turner matts...@gmail.com wrote: On Wed, Oct 22, 2014 at 9:02 PM, Timothy Arceri t_arc...@yahoo.com.au wrote: I almost wasn't going to bother sending this out since it uses SSE4.1 and its recommended to use glDrawRangeElements anyway. But since these games are still ofter used for benchmarking I thought I'd see if anyone is interested in this. I only optimised GL_UNSIGNED_INT as that was the only place these games were hitting but I guess it wouldn't hurt to optimse the other cases too. I think it's kind of neat! It might also be fun to try to do this with OpenMP. OpenMP 3.1 (supported since gcc-4.7) supports min/max reduction operators. I think all you'd need to do for that is to add this pragma immediately before the for loop in vbo_exec_array.c: #if _OPENMP ... (have to figure out the date for OMP 3.1) #pragma omp simd reduction(max:max_ui) reduction(min:min_ui). #endif and then change the inner loop to use ternary for min/max: max_ui = ui_indices[i] max_ui ? ui_indices[i] : max_ui; min_ui = ui_indices[i] min_ui ? ui_indices[i] : min_ui; I tested it with a little function and confirmed that it generates SSE4.1/AVX2 instructions (and even a bunch of SSE2 instructions when 4.1 isn't available!) depending on the -march= value I pass. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev