[Mesa-dev] i965 surface state tidying, part 1
Here's a bit of tidying I did to the i965 SURFACE_STATE code: - It unifies the code for constant buffers/UBOs, texture buffers, and shader time buffers. - It also unifies the texture/renderbuffer code on Gen7+. Both of these delete a /lot/ of complicated cut and pasted code. No performance regressions observed in OpenArena on Ivybridge. There are a few more things I'd like to do: - Port BLORP to use emit_image_surface_state(). - Unify texture/renderbuffers on Gen4-6. - Make emit_{buffer,image}_surface_state() vtable hooks. Then unify the Gen4-6 and Gen7+ variants of update_buffer_texture_surface, update_texture_surface, create_constant_surface, and update_renderbuffer_surface. I stopped before doing this because a bunch of these use tile offsets instead of LOD fields, and I thought that we were moving away from tile offsets on Gen4-6 and in BLORP. I can't remember where Chad and Eric were at with those endeavors. No regressions on Ivybridge. Patches 3-4 still need testing. Haswell also needs testing. These patches are available on the 'sstidy' branch of ~kwg/mesa. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/4] i965: Refactor Gen7+ SURFACE_STATE setup for buffer surfaces.
This was an embarassingly large amount of copy and pasted code, and it wasn't particularly simple code either. By factoring it out into a helper function, we consolidate the complexity. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/mesa/drivers/dri/i965/gen7_wm_surface_state.c | 144 +- 1 file changed, 58 insertions(+), 86 deletions(-) diff --git a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c index 37e3174..8413308 100644 --- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c @@ -224,6 +224,37 @@ gen7_check_surface_setup(uint32_t *surf, bool is_render_target) } } +static void +gen7_emit_buffer_surface_state(struct brw_context *brw, + uint32_t *out_offset, + drm_intel_bo *bo, + unsigned buffer_offset, + unsigned surface_format, + unsigned buffer_size, + unsigned pitch, + unsigned mocs) +{ + uint32_t *surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE, +8 * 4, 32, out_offset); + memset(surf, 0, 8 * 4); + + surf[0] = BRW_SURFACE_BUFFER BRW_SURFACE_TYPE_SHIFT | + surface_format BRW_SURFACE_FORMAT_SHIFT | + BRW_SURFACE_RC_READ_WRITE; + surf[1] = bo-offset + buffer_offset; /* reloc */ + surf[2] = SET_FIELD(buffer_size 0x7f, GEN7_SURFACE_WIDTH) | + SET_FIELD((buffer_size 7) 0x3fff, GEN7_SURFACE_HEIGHT); + surf[3] = SET_FIELD((buffer_size 21) 0x3f, BRW_SURFACE_DEPTH) | + (pitch - 1); + surf[4] = 0; + surf[5] = SET_FIELD(mocs, GEN7_SURFACE_MOCS); + + /* Emit relocation to surface contents */ + drm_intel_bo_emit_reloc(brw-batch.bo, *out_offset + 4, + bo, buffer_offset, I915_GEM_DOMAIN_SAMPLER, 0); + + gen7_check_surface_setup(surf, false /* is_render_target */); +} static void gen7_update_buffer_texture_surface(struct gl_context *ctx, @@ -237,39 +268,23 @@ gen7_update_buffer_texture_surface(struct gl_context *ctx, drm_intel_bo *bo = intel_obj ? intel_obj-buffer : NULL; gl_format format = tObj-_BufferObjectFormat; - uint32_t *surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE, -8 * 4, 32, surf_offset); - memset(surf, 0, 8 * 4); - uint32_t surface_format = brw_format_for_mesa_format(format); if (surface_format == 0 format != MESA_FORMAT_RGBA_FLOAT32) { _mesa_problem(NULL, bad format %s for texture buffer\n, _mesa_get_format_name(format)); } - surf[0] = BRW_SURFACE_BUFFER BRW_SURFACE_TYPE_SHIFT | - surface_format BRW_SURFACE_FORMAT_SHIFT | - BRW_SURFACE_RC_READ_WRITE; - - if (bo) { - surf[1] = bo-offset; /* reloc */ - - drm_intel_bo_emit_reloc(brw-batch.bo, - *surf_offset + 4, - bo, 0, - I915_GEM_DOMAIN_SAMPLER, 0); - - int texel_size = _mesa_get_format_bytes(format); - int w = intel_obj-Base.Size / texel_size; - - /* note that these differ from GEN6 */ - surf[2] = SET_FIELD(w 0x7f, GEN7_SURFACE_WIDTH) | /* bits 6:0 of size */ -SET_FIELD((w 7) 0x3fff, GEN7_SURFACE_HEIGHT); /* 20:7 */ - surf[3] = SET_FIELD((w 21) 0x3f, BRW_SURFACE_DEPTH) | /* bits 26:21 */ -(texel_size - 1); - } - - gen7_check_surface_setup(surf, false /* is_render_target */); + int texel_size = _mesa_get_format_bytes(format); + int w = intel_obj ? intel_obj-Base.Size / texel_size : 0; + + gen7_emit_buffer_surface_state(brw, + surf_offset, + bo, + 0, + surface_format, + w, + texel_size, + 0 /* mocs */); } static void @@ -371,38 +386,15 @@ gen7_create_constant_surface(struct brw_context *brw, { uint32_t stride = dword_pitch ? 4 : 16; uint32_t elements = ALIGN(size, stride) / stride; - const GLint w = elements - 1; - uint32_t *surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE, -8 * 4, 32, out_offset); - memset(surf, 0, 8 * 4); - - surf[0] = BRW_SURFACE_BUFFER BRW_SURFACE_TYPE_SHIFT | - BRW_SURFACEFORMAT_R32G32B32A32_FLOAT BRW_SURFACE_FORMAT_SHIFT | - BRW_SURFACE_RC_READ_WRITE; - - assert(bo); - surf[1] = bo-offset + offset; /* reloc */ - - /* note that these differ from GEN6 */ - surf[2] = SET_FIELD(w 0x7f, GEN7_SURFACE_WIDTH) | - SET_FIELD((w 7) 0x3fff, GEN7_SURFACE_HEIGHT); - surf[3] = SET_FIELD((w 21) 0x3f,
[Mesa-dev] [PATCH 2/4] i965: Share Gen7+ SURFACE_STATE setup for textures and renderbuffers.
The SURFACE_STATE entries for textures and renderbuffers share almost all of the same fields. Only a couple are specific to one or the other. Thus, it makes sense to have a single shared function that takes care of all the bit-shifting required to assemble the SURFACE_STATE structure. This removes a lot of complicated cut and pasted code. One change is that we now specify cube face enables for render targets, but as far as I can tell this is harmless. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/mesa/drivers/dri/i965/gen7_wm_surface_state.c | 210 ++ 1 file changed, 99 insertions(+), 111 deletions(-) diff --git a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c index 8413308..8f95abe 100644 --- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c @@ -257,6 +257,70 @@ gen7_emit_buffer_surface_state(struct brw_context *brw, } static void +gen7_emit_image_surface_state(struct brw_context *brw, + uint32_t *out_offset, + const struct intel_mipmap_tree *mt, + unsigned bo_offset, + unsigned surface_type, + unsigned surface_format, + bool is_array, + unsigned depth, + unsigned min_array_element, + unsigned rt_view_extent, + unsigned mocs, + unsigned mip_count, + int swizzle, + bool is_render_target) +{ + uint32_t *surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE, +8 * 4, 32, out_offset); + surf[0] = surface_type BRW_SURFACE_TYPE_SHIFT | + surface_format BRW_SURFACE_FORMAT_SHIFT | + gen7_surface_tiling_mode(mt-region-tiling) | + BRW_SURFACE_CUBEFACE_ENABLES | + (mt-align_h == 4 ? GEN7_SURFACE_VALIGN_4 : GEN7_SURFACE_VALIGN_2) | + (mt-align_w == 8 ? GEN7_SURFACE_HALIGN_8 : GEN7_SURFACE_HALIGN_4) | + (is_array ? GEN7_SURFACE_IS_ARRAY : 0) | + (mt-array_spacing_lod0 ? GEN7_SURFACE_ARYSPC_LOD0 + : GEN7_SURFACE_ARYSPC_FULL); + surf[1] = mt-region-bo-offset + bo_offset; /* reloc */ + surf[2] = SET_FIELD(mt-logical_width0 - 1, GEN7_SURFACE_WIDTH) | + SET_FIELD(mt-logical_height0 - 1, GEN7_SURFACE_HEIGHT); + surf[3] = SET_FIELD(depth - 1, BRW_SURFACE_DEPTH) | + (mt-region-pitch - 1); + surf[4] = min_array_element GEN7_SURFACE_MIN_ARRAY_ELEMENT_SHIFT | + rt_view_extent GEN7_SURFACE_RENDER_TARGET_VIEW_EXTENT_SHIFT | + gen7_surface_msaa_bits(mt-num_samples, mt-msaa_layout); + surf[5] = SET_FIELD(mocs, GEN7_SURFACE_MOCS) | mip_count; + + if (mt-mcs_mt) { + gen7_set_surface_mcs_info(brw, surf, *out_offset, mt-mcs_mt, true); + } else { + surf[6] = 0; + } + + surf[7] = mt-fast_clear_color_value; + + if (brw-is_haswell) { + surf[7] |= + SET_FIELD(swizzle_to_scs(GET_SWZ(swizzle, 0)), GEN7_SURFACE_SCS_R) | + SET_FIELD(swizzle_to_scs(GET_SWZ(swizzle, 1)), GEN7_SURFACE_SCS_G) | + SET_FIELD(swizzle_to_scs(GET_SWZ(swizzle, 2)), GEN7_SURFACE_SCS_B) | + SET_FIELD(swizzle_to_scs(GET_SWZ(swizzle, 3)), GEN7_SURFACE_SCS_A); + } + + uint32_t read_domain = + is_render_target ? I915_GEM_DOMAIN_RENDER : I915_GEM_DOMAIN_SAMPLER; + + /* Emit relocation to surface contents */ + drm_intel_bo_emit_reloc(brw-batch.bo, *out_offset + 4, + mt-region-bo, bo_offset, + read_domain, 0); + + gen7_check_surface_setup(surf, is_render_target); +} + +static void gen7_update_buffer_texture_surface(struct gl_context *ctx, unsigned unit, uint32_t *surf_offset) @@ -305,43 +369,14 @@ gen7_update_texture_surface(struct gl_context *ctx, return; } - uint32_t *surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE, -8 * 4, 32, surf_offset); - memset(surf, 0, 8 * 4); - - uint32_t tex_format = translate_tex_format(brw, + bool is_array = mt-logical_depth0 1 tObj-Target != GL_TEXTURE_3D; + unsigned mip_count = intelObj-_MaxLevel - intel_image-mt-first_level; + uint32_t brw_format = translate_tex_format(brw, mt-format, tObj-DepthMode, sampler-sRGBDecode); - surf[0] = translate_tex_target(tObj-Target) BRW_SURFACE_TYPE_SHIFT | - tex_format BRW_SURFACE_FORMAT_SHIFT | - gen7_surface_tiling_mode(mt-region-tiling) | -
[Mesa-dev] [PATCH 3/4] i965: Remove MIPLAYOUT_BELOW from Gen4-6 constant buffer surface state.
Specifying a miptree layout makes no sense for constant buffers. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 25db2e0..8d87786 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -318,7 +318,6 @@ brw_create_constant_surface(struct brw_context *brw, 6 * 4, 32, out_offset); surf[0] = (BRW_SURFACE_BUFFER BRW_SURFACE_TYPE_SHIFT | - BRW_SURFACE_MIPMAPLAYOUT_BELOW BRW_SURFACE_MIPLAYOUT_SHIFT | BRW_SURFACEFORMAT_R32G32B32A32_FLOAT BRW_SURFACE_FORMAT_SHIFT); if (brw-gen = 6) -- 1.8.3.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/4] i965: Refactor Gen4-6 SURFACE_STATE setup for buffer surfaces.
This was an embarassingly large amount of copy and pasted code, and it wasn't particularly simple code either. By factoring it out into a helper function, we consolidate the complexity. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 98 +--- 1 file changed, 37 insertions(+), 61 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index 8d87786..bbe7803 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -190,6 +190,36 @@ brw_get_texture_swizzle(const struct gl_context *ctx, swizzles[GET_SWZ(t-_Swizzle, 3)]); } +static void +gen4_emit_buffer_surface_state(struct brw_context *brw, + uint32_t *out_offset, + drm_intel_bo *bo, + unsigned buffer_offset, + unsigned surface_format, + unsigned buffer_size, + unsigned pitch) +{ + uint32_t *surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE, +6 * 4, 32, out_offset); + memset(surf, 0, 6 * 4); + + surf[0] = BRW_SURFACE_BUFFER BRW_SURFACE_TYPE_SHIFT | + surface_format BRW_SURFACE_FORMAT_SHIFT | + (brw-gen = 6 ? BRW_SURFACE_RC_READ_WRITE : 0); + surf[1] = bo-offset + buffer_offset; /* reloc */ + surf[2] = (buffer_size 0x7f) BRW_SURFACE_WIDTH_SHIFT | + ((buffer_size 7) 0x1fff) BRW_SURFACE_HEIGHT_SHIFT; + surf[3] = ((buffer_size 20) 0x7f) BRW_SURFACE_DEPTH_SHIFT | + (pitch - 1) BRW_SURFACE_PITCH_SHIFT; + + /* Emit relocation to surface contents. The 965 PRM, Volume 4, section +* 5.1.2 Data Cache says: the data cache does not exist as a separate +* physical cache. It is mapped in hardware to the sampler cache. +*/ + drm_intel_bo_emit_reloc(brw-batch.bo, *out_offset + 4, + bo, buffer_offset, + I915_GEM_DOMAIN_SAMPLER, 0); +} static void brw_update_buffer_texture_surface(struct gl_context *ctx, @@ -198,49 +228,22 @@ brw_update_buffer_texture_surface(struct gl_context *ctx, { struct brw_context *brw = brw_context(ctx); struct gl_texture_object *tObj = ctx-Texture.Unit[unit]._Current; - uint32_t *surf; struct intel_buffer_object *intel_obj = intel_buffer_object(tObj-BufferObject); drm_intel_bo *bo = intel_obj ? intel_obj-buffer : NULL; gl_format format = tObj-_BufferObjectFormat; uint32_t brw_format = brw_format_for_mesa_format(format); int texel_size = _mesa_get_format_bytes(format); + int w = intel_obj ? intel_obj-Base.Size / texel_size : 0; if (brw_format == 0 format != MESA_FORMAT_RGBA_FLOAT32) { _mesa_problem(NULL, bad format %s for texture buffer\n, _mesa_get_format_name(format)); } - surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE, - 6 * 4, 32, surf_offset); - - surf[0] = (BRW_SURFACE_BUFFER BRW_SURFACE_TYPE_SHIFT | - (brw_format_for_mesa_format(format) BRW_SURFACE_FORMAT_SHIFT)); - - if (brw-gen = 6) - surf[0] |= BRW_SURFACE_RC_READ_WRITE; - - if (bo) { - surf[1] = bo-offset; /* reloc */ - - /* Emit relocation to surface contents. */ - drm_intel_bo_emit_reloc(brw-batch.bo, - *surf_offset + 4, - bo, 0, I915_GEM_DOMAIN_SAMPLER, 0); - - int w = intel_obj-Base.Size / texel_size; - surf[2] = ((w 0x7f) BRW_SURFACE_WIDTH_SHIFT | -((w 7) 0x1fff) BRW_SURFACE_HEIGHT_SHIFT); - surf[3] = (((w 20) 0x7f) BRW_SURFACE_DEPTH_SHIFT | -(texel_size - 1) BRW_SURFACE_PITCH_SHIFT); - } else { - surf[1] = 0; - surf[2] = 0; - surf[3] = 0; - } - - surf[4] = 0; - surf[5] = 0; + gen4_emit_buffer_surface_state(brw, surf_offset, bo, 0, + brw_format, + w, texel_size); } static void @@ -311,37 +314,10 @@ brw_create_constant_surface(struct brw_context *brw, { uint32_t stride = dword_pitch ? 4 : 16; uint32_t elements = ALIGN(size, stride) / stride; - const GLint w = elements - 1; - uint32_t *surf; - - surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE, - 6 * 4, 32, out_offset); - - surf[0] = (BRW_SURFACE_BUFFER BRW_SURFACE_TYPE_SHIFT | - BRW_SURFACEFORMAT_R32G32B32A32_FLOAT BRW_SURFACE_FORMAT_SHIFT); - - if (brw-gen = 6) - surf[0] |= BRW_SURFACE_RC_READ_WRITE; - - surf[1] = bo-offset + offset; /* reloc */ - - surf[2] = ((w 0x7f) BRW_SURFACE_WIDTH_SHIFT | - ((w 7) 0x1fff) BRW_SURFACE_HEIGHT_SHIFT); - - surf[3] = (((w 20) 0x7f) BRW_SURFACE_DEPTH_SHIFT | -
[Mesa-dev] [Bug 69354] New: glxgears window displayed in a mess and showing error messages in terminal
https://bugs.freedesktop.org/show_bug.cgi?id=69354 Priority: medium Bug ID: 69354 Assignee: mesa-dev@lists.freedesktop.org Summary: glxgears window displayed in a mess and showing error messages in terminal Severity: major Classification: Unclassified OS: All Reporter: lonice...@gmail.com Hardware: x86-64 (AMD64) Status: NEW Version: 8.0 Component: Demos Product: Mesa Created attachment 85826 -- https://bugs.freedesktop.org/attachment.cgi?id=85826action=edit glxgears' window Hi all, When executing the glxgears, the following messages keep showing in the terminal: --- $ glxgears Running synchronized to the vertical refresh. The framerate should be approximately the same as the monitor refresh rate. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. radeon: The kernel rejected CS, see dmesg for more information. ... --- And the dmesg information: --- ... $ dmesg | tail -n100 [ 3570.279602] [drm:radeon_cs_ib_chunk] *ERROR* Invalid command stream ! [ 3570.301260] radeon :00:01.0: evergreen_surface_value_conv_check:329 cb invalid array mode 6 [ 3570.301278] radeon :00:01.0: evergreen_packet3_check:1958 invalid cmd stream 502 [ 3570.301284] [drm:radeon_cs_ib_chunk] *ERROR* Invalid command stream ! [ 3570.321936] radeon :00:01.0: evergreen_surface_value_conv_check:329 cb invalid array mode 6 [ 3570.321948] radeon :00:01.0: evergreen_packet3_check:1958 invalid cmd stream 502 [ 3570.321953] [drm:radeon_cs_ib_chunk] *ERROR* Invalid command stream ! [ 3570.326613] radeon :00:01.0: evergreen_surface_value_conv_check:329 cb invalid array mode 6 [ 3570.326632] radeon :00:01.0: evergreen_packet3_check:1958 invalid cmd stream 502 [ 3570.326642] [drm:radeon_cs_ib_chunk] *ERROR* Invalid command stream ! [ 3570.351269] radeon :00:01.0: evergreen_surface_value_conv_check:329 cb invalid array mode 6 [ 3570.351311] radeon :00:01.0: evergreen_packet3_check:1958 invalid cmd stream 502 [ 3570.351322] [drm:radeon_cs_ib_chunk] *ERROR* Invalid command stream ! [ 3570.360343] radeon :00:01.0: evergreen_surface_value_conv_check:329 cb invalid array mode 6 [ 3570.360362] radeon :00:01.0: evergreen_packet3_check:1958 invalid cmd stream 502 [ 3570.360372] [drm:radeon_cs_ib_chunk] *ERROR* Invalid command stream ! [ 3570.394906] radeon :00:01.0: evergreen_surface_value_conv_check:329 cb invalid array mode 6 [ 3570.394918] radeon :00:01.0: evergreen_packet3_check:1958 invalid cmd stream 502 [ 3570.394924] [drm:radeon_cs_ib_chunk] *ERROR* Invalid command stream ! [ 3570.410377] radeon :00:01.0: evergreen_surface_value_conv_check:329 cb invalid array mode 6 [ 3570.410397] radeon :00:01.0: evergreen_packet3_check:1958 invalid cmd stream 502 [ 3570.410407] [drm:radeon_cs_ib_chunk] *ERROR* Invalid command stream ! [ 3570.434464] radeon :00:01.0: evergreen_surface_value_conv_check:329 cb invalid array mode 6 [ 3570.434484] radeon :00:01.0: evergreen_packet3_check:1958 invalid cmd stream 502 [ 3570.434493] [drm:radeon_cs_ib_chunk] *ERROR* Invalid command stream ! [ 3570.443815] radeon :00:01.0: evergreen_surface_value_conv_check:329 cb invalid array mode 6 [ 3570.443833]
[Mesa-dev] [Bug 69354] glxgears window displayed in a mess and showing error messages in terminal
https://bugs.freedesktop.org/show_bug.cgi?id=69354 --- Comment #1 from Flos lonice...@gmail.com --- Created attachment 85827 -- https://bugs.freedesktop.org/attachment.cgi?id=85827action=edit all packages installed in my box -- 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 69354] glxgears window displayed in a mess and showing error messages in terminal
https://bugs.freedesktop.org/show_bug.cgi?id=69354 --- Comment #2 from j...@openbsd.org --- You need to set 'Option ColorTiling2D off' in the Device section of xorg.conf to use a recent version of xf86-video-ati with Mesa 9.0 -- 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] st/mesa: don't dereference stObj-pt if NULL
On 09/13/2013 08:15 PM, Dave Airlie wrote: It seems a user app can get us into this state, I trigger the fail running fbo-maxsize inside virgl, it fails to create the backing storage for the texture object, but then segfaults here when it should fail the completeness test. Signed-off-by: Dave Airlie airl...@redhat.com --- src/mesa/state_tracker/st_cb_fbo.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 77aaccd..09daded 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -505,6 +505,9 @@ st_validate_attachment(struct gl_context *ctx, if (!stObj) return GL_FALSE; + if (!stObj-pt) + return GL_FALSE; + format = stObj-pt-format; texFormat = att-Renderbuffer-TexImage-TexFormat; You could otherwise fold that into the previous check: if (!stObj || !stObj-pt) return; but either way is OK. Reviewed-by: Brian Paul bri...@vmware.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/mesa: don't dereference stObj-pt if NULL
On 09/14/2013 09:37 AM, Brian Paul wrote: On 09/13/2013 08:15 PM, Dave Airlie wrote: It seems a user app can get us into this state, I trigger the fail running fbo-maxsize inside virgl, it fails to create the backing storage for the texture object, but then segfaults here when it should fail the completeness test. Signed-off-by: Dave Airlie airl...@redhat.com --- src/mesa/state_tracker/st_cb_fbo.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 77aaccd..09daded 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -505,6 +505,9 @@ st_validate_attachment(struct gl_context *ctx, if (!stObj) return GL_FALSE; + if (!stObj-pt) + return GL_FALSE; + format = stObj-pt-format; texFormat = att-Renderbuffer-TexImage-TexFormat; You could otherwise fold that into the previous check: if (!stObj || !stObj-pt) return; but either way is OK. Reviewed-by: Brian Paul bri...@vmware.com Oh, and tag/cc for the 9.2 branch? -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] gallivm: some bits of seamless cube filtering implementation
On 09/13/2013 11:52 AM, srol...@vmware.com wrote: From: Roland Scheidegger srol...@vmware.com Simply adjust wrap mode to clamp_to_edge. This is all that's needed for a correct implementation for nearest filtering, and it's way better than using repeat wrap for instance for linear filtering (though obviously this doesn't actually do seamless filtering). v2: fix s/t wrap not r/s... --- src/gallium/auxiliary/gallivm/lp_bld_sample.c |1 + src/gallium/auxiliary/gallivm/lp_bld_sample.h |1 + src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c | 41 ++--- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 9b0a92c..c775382 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -155,6 +155,7 @@ lp_sampler_static_sampler_state(struct lp_static_sampler_state *state, state-wrap_r= sampler-wrap_r; state-min_img_filter= sampler-min_img_filter; state-mag_img_filter= sampler-mag_img_filter; + state-seamless_cube_map = sampler-seamless_cube_map; if (sampler-max_lod 0.0f) { state-min_mip_filter = sampler-min_mip_filter; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index e6b9f30..803a99e 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -114,6 +114,7 @@ struct lp_static_sampler_state unsigned lod_bias_non_zero:1; unsigned apply_min_lod:1; /** min_lod 0 ? */ unsigned apply_max_lod:1; /** max_lod last_level ? */ + unsigned seamless_cube_map:1; /* Hacks */ unsigned force_nearest_s:1; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 7e98919..355e97d 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -2123,8 +2123,21 @@ lp_build_sample_soa(struct gallivm_state *gallivm, debug_printf( .min_mip_filter = %u\n, derived_sampler_state.min_mip_filter); } - min_img_filter = static_sampler_state-min_img_filter; - mag_img_filter = static_sampler_state-mag_img_filter; + if ((static_texture_state-target == PIPE_TEXTURE_CUBE || +static_texture_state-target == PIPE_TEXTURE_CUBE_ARRAY) + static_sampler_state-seamless_cube_map) + { + /* + * Seamless filtering ignores wrap modes. + * Setting to CLAMP_TO_EDGE is correct for nearest filtering, for + * bilinear it's not correct but way better than using for instance repeat. + */ + derived_sampler_state.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + derived_sampler_state.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + } + + min_img_filter = derived_sampler_state.min_img_filter; + mag_img_filter = derived_sampler_state.mag_img_filter; /* @@ -2260,16 +2273,16 @@ lp_build_sample_soa(struct gallivm_state *gallivm, LLVMValueRef ilevel0 = NULL, ilevel1 = NULL; boolean use_aos = util_format_fits_8unorm(bld.format_desc) /* not sure this is strictly needed or simply impossible */ -static_sampler_state-compare_mode == PIPE_TEX_COMPARE_NONE -lp_is_simple_wrap_mode(static_sampler_state-wrap_s); +derived_sampler_state.compare_mode == PIPE_TEX_COMPARE_NONE +lp_is_simple_wrap_mode(derived_sampler_state.wrap_s); use_aos = bld.num_lods = num_quads || - static_sampler_state-min_img_filter == -static_sampler_state-mag_img_filter; + derived_sampler_state.min_img_filter == +derived_sampler_state.mag_img_filter; if (dims 1) { - use_aos = lp_is_simple_wrap_mode(static_sampler_state-wrap_t); + use_aos = lp_is_simple_wrap_mode(derived_sampler_state.wrap_t); if (dims 2) { -use_aos = lp_is_simple_wrap_mode(static_sampler_state-wrap_r); +use_aos = lp_is_simple_wrap_mode(derived_sampler_state.wrap_r); } } @@ -2278,12 +2291,12 @@ lp_build_sample_soa(struct gallivm_state *gallivm, debug_printf(%s: using floating point linear filtering for %s\n, __FUNCTION__, bld.format_desc-short_name); debug_printf( min_img %d mag_img %d mip %d wraps %d wrapt %d wrapr %d\n, - static_sampler_state-min_img_filter, - static_sampler_state-mag_img_filter, - static_sampler_state-min_mip_filter, - static_sampler_state-wrap_s, - static_sampler_state-wrap_t, - static_sampler_state-wrap_r); +
Re: [Mesa-dev] [PATCH] mesa: Check for valid debug label before memcpy.
On 09/13/2013 08:19 PM, Vinson Lee wrote: Fixes Dereference after null check reported by Coverity. Signed-off-by: Vinson Lee v...@freedesktop.org --- src/mesa/main/objectlabel.c | 18 +++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/objectlabel.c b/src/mesa/main/objectlabel.c index 90d9e09..79fd8c7 100644 --- a/src/mesa/main/objectlabel.c +++ b/src/mesa/main/objectlabel.c @@ -90,16 +90,28 @@ set_label(struct gl_context *ctx, char **labelPtr, const char *label, static void copy_label(char **labelPtr, char *label, int *length, int bufSize) { + /* From http://www.opengl.org/registry/specs/KHR/debug.txt: +* If length is NULL, no length is returned. The maximum number of +* characters that may be written into label, including the null +* terminator, is specified by bufSize. If no debug label was specified +* for the object then label will contain a null-terminated empty string, +* and zero will be returned in length. If label is NULL and length +* is non-NULL then no string will be returned and the length of the label +* will be returned in length. +*/ + int labelLen = 0; if (*labelPtr) labelLen = strlen(*labelPtr); if (label) { - if (bufSize = labelLen) - labelLen = bufSize-1; + if (*labelPtr) { + if (bufSize = labelLen) +labelLen = bufSize-1; - memcpy(label, *labelPtr, labelLen); + memcpy(label, *labelPtr, labelLen); + } label[labelLen] = '\0'; } I think copy_label() needs a bit of an overhaul. The source labelPtr doesn't need to be a pointer to a pointer and it should be const qualified. Plus the other parameter types should be fixed up. I'll post a new patch in a bit... -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] mesa: asst. clean-ups in copy_label()
This incorporates Vinson's change to check for a null src pointer as detected by coverity. Also, rename the function params to be src/dst, const-qualify src, and use GL types to match the calling functions. And add some more comments. --- src/mesa/main/objectlabel.c | 37 +++-- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/src/mesa/main/objectlabel.c b/src/mesa/main/objectlabel.c index 90d9e09..d9e42cf 100644 --- a/src/mesa/main/objectlabel.c +++ b/src/mesa/main/objectlabel.c @@ -86,21 +86,38 @@ set_label(struct gl_context *ctx, char **labelPtr, const char *label, /** * Helper for _mesa_GetObjectLabel() and _mesa_GetObjectPtrLabel(). + * \param src the src label (may be null) + * \param dst pointer to dest buffer (may be null) + * \param length returns length of label (may be null) + * \param bufsize size of dst buffer */ static void -copy_label(char **labelPtr, char *label, int *length, int bufSize) +copy_label(const GLchar *src, GLchar *dst, GLsizei *length, GLsizei bufSize) { int labelLen = 0; - if (*labelPtr) - labelLen = strlen(*labelPtr); + /* From http://www.opengl.org/registry/specs/KHR/debug.txt: +* If length is NULL, no length is returned. The maximum number of +* characters that may be written into label, including the null +* terminator, is specified by bufSize. If no debug label was specified +* for the object then label will contain a null-terminated empty string, +* and zero will be returned in length. If label is NULL and length +* is non-NULL then no string will be returned and the length of the label +* will be returned in length. +*/ - if (label) { - if (bufSize = labelLen) - labelLen = bufSize-1; + if (src) + labelLen = strlen(src); + + if (dst) { + if (src) { + if (bufSize = labelLen) +labelLen = bufSize - 1; + + memcpy(dst, src, labelLen); + } - memcpy(label, *labelPtr, labelLen); - label[labelLen] = '\0'; + dst[labelLen] = '\0'; } if (length) @@ -243,7 +260,7 @@ _mesa_GetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, if (!labelPtr) return; - copy_label(labelPtr, label, length, bufSize); + copy_label(*labelPtr, label, length, bufSize); } void GLAPIENTRY @@ -278,5 +295,5 @@ _mesa_GetObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length, labelPtr = syncObj-Label; - copy_label(labelPtr, label, length, bufSize); + copy_label(*labelPtr, label, length, bufSize); } -- 1.7.10.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] mesa: use caller string in error message in get_label_pointer()
--- src/mesa/main/objectlabel.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/objectlabel.c b/src/mesa/main/objectlabel.c index d9e42cf..bfe9ba2 100644 --- a/src/mesa/main/objectlabel.c +++ b/src/mesa/main/objectlabel.c @@ -224,7 +224,7 @@ get_label_pointer(struct gl_context *ctx, GLenum identifier, GLuint name, } if (NULL == labelPtr) { - _mesa_error(ctx, GL_INVALID_VALUE, glObjectLabel(name = %u), name); + _mesa_error(ctx, GL_INVALID_VALUE, %s(name = %u), caller, name); } return labelPtr; -- 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/3] mesa: add missing error checks in _mesa_GetObject[Ptr]Label()
--- src/mesa/main/objectlabel.c | 12 1 file changed, 12 insertions(+) diff --git a/src/mesa/main/objectlabel.c b/src/mesa/main/objectlabel.c index bfe9ba2..c373a46 100644 --- a/src/mesa/main/objectlabel.c +++ b/src/mesa/main/objectlabel.c @@ -256,6 +256,12 @@ _mesa_GetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, GET_CURRENT_CONTEXT(ctx); char **labelPtr; + if (bufSize = 0) { + _mesa_error(ctx, GL_INVALID_VALUE, glGetObjectLabel(bufSize = %d), + bufSize); + return; + } + labelPtr = get_label_pointer(ctx, identifier, name, glGetObjectLabel); if (!labelPtr) return; @@ -288,6 +294,12 @@ _mesa_GetObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length, char **labelPtr; struct gl_sync_object *const syncObj = (struct gl_sync_object *) ptr; + if (bufSize = 0) { + _mesa_error(ctx, GL_INVALID_VALUE, glGetObjectPtrLabel(bufSize = %d), + bufSize); + return; + } + if (!_mesa_validate_sync(ctx, syncObj)) { _mesa_error(ctx, GL_INVALID_VALUE, glGetObjectPtrLabel (not a valid sync object)); return; -- 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/2] mesa: minor fix-ups for _mesa_validate_sync()
Return bool instead of int. Const-qualify the syncObj. Add some comments. --- src/mesa/main/syncobj.c | 12 ++-- src/mesa/main/syncobj.h |5 +++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/syncobj.c b/src/mesa/main/syncobj.c index 987d4f5..27867a1 100644 --- a/src/mesa/main/syncobj.c +++ b/src/mesa/main/syncobj.c @@ -161,8 +161,16 @@ _mesa_free_sync_data(struct gl_context *ctx) } -int -_mesa_validate_sync(struct gl_context *ctx, struct gl_sync_object *syncObj) +/** + * Check if the given sync object is: + * - non-null + * - not in sync objects hash table + * - type is GL_SYNC_FENCE + * - not marked as deleted + */ +bool +_mesa_validate_sync(struct gl_context *ctx, +const struct gl_sync_object *syncObj) { return (syncObj != NULL) _mesa_set_search(ctx-Shared-SyncObjects, diff --git a/src/mesa/main/syncobj.h b/src/mesa/main/syncobj.h index 025a9b1..5d510e8 100644 --- a/src/mesa/main/syncobj.h +++ b/src/mesa/main/syncobj.h @@ -53,8 +53,9 @@ _mesa_ref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj); extern void _mesa_unref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj); -extern int -_mesa_validate_sync(struct gl_context *ctx, struct gl_sync_object *syncObj); +extern bool +_mesa_validate_sync(struct gl_context *ctx, +const struct gl_sync_object *syncObj); extern GLboolean GLAPIENTRY _mesa_IsSync(GLsync sync); -- 1.7.10.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] mesa: check for bufSize 0 in _mesa_GetSynciv()
The spec doesn't say GL_INVALID_VALUE should be raised for bufSize = 0. In any case, memcpy(len 0) will lead to a crash, so don't allow it. --- src/mesa/main/syncobj.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/syncobj.c b/src/mesa/main/syncobj.c index 27867a1..ad21f3b 100644 --- a/src/mesa/main/syncobj.c +++ b/src/mesa/main/syncobj.c @@ -418,7 +418,7 @@ _mesa_GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, return; } - if (size 0) { + if (size 0 bufSize 0) { const GLsizei copy_count = MIN2(size, bufSize); memcpy(values, v, sizeof(GLint) * copy_count); -- 1.7.10.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] gallium-bind-sampler-states branch
On 09/12/2013 09:06 PM, Chia-I Wu wrote: Hi Brian, On Fri, Sep 13, 2013 at 8:46 AM, Brian Paul bri...@vmware.com wrote: I just pushed a gallium-bind-sampler-states branch to my git repo at git://people.freedesktop.org/~brianp/mesa It replaces the four pipe_context::bind_fragment/vertex/geometry/compute_sampler_states() functions with a single bind_sampler_states() function: void (*bind_sampler_states)(struct pipe_context *, unsigned shader, unsigned start_slot, unsigned num_samplers, void **samplers); At this point start_slot is always zero (at least for non-compute shaders). And as the updated gallium docs explain, at some point calls to bind_sampler_states() will be used to updated sub-ranges, but that never happens currently. I've updated all the drivers, state trackers, utils, etc. I've tested the svga, llvmpipe and softpipe drivers. 'make check' and a texture subset of piglit pass w/out regressions. I'd appreciate it if other driver developers would test their favorite driver. For ilo, the new code does not follow the doc and unbinds samplers not in range. I think that's OK. The CSO module (used by the state tracker) currently always calls pipe_context::bind_sampler_states() with start=0 and count such that it sets/replaces all samplers, never a sub-range. That could/should change in the future. See single_sampler_done() in cso_context.c. Is it fine if I implement the new bind_sampler_states as a helper function on master branch, so that you hook it up to pipe_context::bind_sampler_states in your branch and remove the old ones? I'm not quite sure that I understand what you mean. Can you elaborate? -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 69354] glxgears window displayed in a mess and showing error messages in terminal
https://bugs.freedesktop.org/show_bug.cgi?id=69354 Fabio Pedretti fabio@libero.it changed: What|Removed |Added Attachment #85826|text/plain |image/png mime type|| -- 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] [PATCH] i965: Add some missing bits to {mesa, brw, cache}_bits[].
These data structures are used for debug output, so it wasn't hurting anything that there were missing bits. But it's good to keep things up to date. This patch also adds static asserts so that the {brw,cache}_bits[] arrays are the proper size, so that we don't forget to add to them in the future. Unfortunately there's no convenient way to assert that mesa_bits[] is the proper size. --- src/mesa/drivers/dri/i965/brw_context.h | 2 ++ src/mesa/drivers/dri/i965/brw_state_upload.c | 12 2 files changed, 14 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 108e98c..b697bec 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -780,6 +780,8 @@ enum shader_time_shader_type { #define CACHE_NEW_CC_VP (1BRW_CC_VP) #define CACHE_NEW_CC_UNIT(1BRW_CC_UNIT) #define CACHE_NEW_WM_PROG(1BRW_WM_PROG) +#define CACHE_NEW_BLORP_BLIT_PROG(1BRW_BLORP_BLIT_PROG) +#define CACHE_NEW_BLORP_CONST_COLOR_PROG (1BRW_BLORP_CONST_COLOR_PROG) #define CACHE_NEW_SAMPLER(1BRW_SAMPLER) #define CACHE_NEW_WM_UNIT(1BRW_WM_UNIT) #define CACHE_NEW_SF_PROG(1BRW_SF_PROG) diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index 8f21f06..d7fe319 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -359,6 +359,7 @@ static struct dirty_bit_map mesa_bits[] = { DEFINE_BIT(_NEW_ARRAY), DEFINE_BIT(_NEW_RENDERMODE), DEFINE_BIT(_NEW_BUFFERS), + DEFINE_BIT(_NEW_CURRENT_ATTRIB), DEFINE_BIT(_NEW_MULTISAMPLE), DEFINE_BIT(_NEW_TRACK_MATRIX), DEFINE_BIT(_NEW_PROGRAM), @@ -372,6 +373,7 @@ static struct dirty_bit_map mesa_bits[] = { static struct dirty_bit_map brw_bits[] = { DEFINE_BIT(BRW_NEW_URB_FENCE), DEFINE_BIT(BRW_NEW_FRAGMENT_PROGRAM), + DEFINE_BIT(BRW_NEW_GEOMETRY_PROGRAM), DEFINE_BIT(BRW_NEW_VERTEX_PROGRAM), DEFINE_BIT(BRW_NEW_CURBE_OFFSETS), DEFINE_BIT(BRW_NEW_REDUCED_PRIMITIVE), @@ -387,14 +389,18 @@ static struct dirty_bit_map brw_bits[] = { DEFINE_BIT(BRW_NEW_BATCH), DEFINE_BIT(BRW_NEW_INDEX_BUFFER), DEFINE_BIT(BRW_NEW_VS_CONSTBUF), + DEFINE_BIT(BRW_NEW_GS_CONSTBUF), DEFINE_BIT(BRW_NEW_PROGRAM_CACHE), DEFINE_BIT(BRW_NEW_STATE_BASE_ADDRESS), + DEFINE_BIT(BRW_NEW_VUE_MAP_VS), DEFINE_BIT(BRW_NEW_VUE_MAP_GEOM_OUT), DEFINE_BIT(BRW_NEW_TRANSFORM_FEEDBACK), DEFINE_BIT(BRW_NEW_RASTERIZER_DISCARD), + DEFINE_BIT(BRW_NEW_STATS_WM), DEFINE_BIT(BRW_NEW_UNIFORM_BUFFER), DEFINE_BIT(BRW_NEW_META_IN_PROGRESS), DEFINE_BIT(BRW_NEW_INTERPOLATION_MAP), + DEFINE_BIT(BRW_NEW_PUSH_CONSTANT_ALLOCATION), {0, 0, 0} }; @@ -402,6 +408,8 @@ static struct dirty_bit_map cache_bits[] = { DEFINE_BIT(CACHE_NEW_CC_VP), DEFINE_BIT(CACHE_NEW_CC_UNIT), DEFINE_BIT(CACHE_NEW_WM_PROG), + DEFINE_BIT(CACHE_NEW_BLORP_BLIT_PROG), + DEFINE_BIT(CACHE_NEW_BLORP_CONST_COLOR_PROG), DEFINE_BIT(CACHE_NEW_SAMPLER), DEFINE_BIT(CACHE_NEW_WM_UNIT), DEFINE_BIT(CACHE_NEW_SF_PROG), @@ -411,6 +419,7 @@ static struct dirty_bit_map cache_bits[] = { DEFINE_BIT(CACHE_NEW_VS_PROG), DEFINE_BIT(CACHE_NEW_FF_GS_UNIT), DEFINE_BIT(CACHE_NEW_FF_GS_PROG), + DEFINE_BIT(CACHE_NEW_GS_PROG), DEFINE_BIT(CACHE_NEW_CLIP_VP), DEFINE_BIT(CACHE_NEW_CLIP_UNIT), DEFINE_BIT(CACHE_NEW_CLIP_PROG), @@ -532,6 +541,9 @@ void brw_upload_state(struct brw_context *brw) } if (unlikely(INTEL_DEBUG DEBUG_STATE)) { + STATIC_ASSERT(ARRAY_SIZE(brw_bits) == BRW_NUM_STATE_BITS + 1); + STATIC_ASSERT(ARRAY_SIZE(cache_bits) == BRW_MAX_CACHE + 1); + brw_update_dirty_count(mesa_bits, state-mesa); brw_update_dirty_count(brw_bits, state-brw); brw_update_dirty_count(cache_bits, state-cache); -- 1.8.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] i965/gs: Implement basic gl_PrimitiveIDIn functionality.
If the geometry shader refers to the built-in variable gl_PrimitiveIDIn, we need to set a bit in 3DSTATE_GS to tell the hardware to dispatch primitive ID to r1, and we need to leave room for it when allocating registers. Note: this feature doesn't yet work properly when software primitive restart is in use (the primitive ID counter will incorrectly reset with each primitive restart, since software primitive restart works by performing multiple draw calls). I plan to address that in a future patch series. Fixes piglit test spec/glsl-1.50/execution/geometry/primitive-id-in. --- src/mesa/drivers/dri/i965/brw_context.h | 2 ++ src/mesa/drivers/dri/i965/brw_vec4_gs.c | 3 +++ src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp | 4 src/mesa/drivers/dri/i965/gen7_gs_state.c | 2 ++ 4 files changed, 11 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 108e98c..606611a 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -562,6 +562,8 @@ struct brw_gs_prog_data * Ignored if control_data_header_size is 0. */ unsigned control_data_format; + + bool include_primitive_id; }; /** Number of texture sampler units */ diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs.c b/src/mesa/drivers/dri/i965/brw_vec4_gs.c index f67ae2b..3e7faee 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_gs.c +++ b/src/mesa/drivers/dri/i965/brw_vec4_gs.c @@ -45,6 +45,9 @@ do_gs_prog(struct brw_context *brw, c.key = *key; c.gp = gp; + c.prog_data.include_primitive_id = + (gp-program.Base.InputsRead VARYING_BIT_PRIMITIVE_ID) != 0; + /* Allocate the references to the uniforms that will end up in the * prog_data associated with the compiled program, and which will be freed * by the state cache. diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp index 960f970..6053284 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp @@ -102,6 +102,10 @@ vec4_gs_visitor::setup_payload() */ reg++; + /* If the shader uses gl_PrimitiveIDIn, that goes in r1. */ + if (c-prog_data.include_primitive_id) + attribute_map[VARYING_SLOT_PRIMITIVE_ID] = reg++; + reg = setup_uniforms(reg); reg = setup_varying_inputs(reg, attribute_map); diff --git a/src/mesa/drivers/dri/i965/gen7_gs_state.c b/src/mesa/drivers/dri/i965/gen7_gs_state.c index 231e3c9..4f18485 100644 --- a/src/mesa/drivers/dri/i965/gen7_gs_state.c +++ b/src/mesa/drivers/dri/i965/gen7_gs_state.c @@ -111,6 +111,8 @@ upload_gs_state(struct brw_context *brw) GEN7_GS_CONTROL_DATA_HEADER_SIZE_SHIFT) | GEN7_GS_DISPATCH_MODE_DUAL_OBJECT | GEN6_GS_STATISTICS_ENABLE | + (brw-gs.prog_data-include_primitive_id ? + GEN7_GS_INCLUDE_PRIMITIVE_ID : 0) | GEN7_GS_ENABLE; if (brw-is_haswell) { -- 1.8.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] vdpau/decode: Check max width and max height.
--- src/gallium/state_trackers/vdpau/decode.c | 20 1 file changed, 20 insertions(+) diff --git a/src/gallium/state_trackers/vdpau/decode.c b/src/gallium/state_trackers/vdpau/decode.c index 47ca229..b144b83 100644 --- a/src/gallium/state_trackers/vdpau/decode.c +++ b/src/gallium/state_trackers/vdpau/decode.c @@ -51,6 +51,7 @@ vlVdpDecoderCreate(VdpDevice device, vlVdpDecoder *vldecoder; VdpStatus ret; bool supported; + uint32_t maxwidth, maxheight; if (!decoder) return VDP_STATUS_INVALID_POINTER; @@ -84,6 +85,25 @@ vlVdpDecoderCreate(VdpDevice device, return VDP_STATUS_INVALID_DECODER_PROFILE; } + maxwidth = screen-get_video_param + ( + screen, + templat.profile, + PIPE_VIDEO_ENTRYPOINT_BITSTREAM, + PIPE_VIDEO_CAP_MAX_WIDTH + ); + maxheight = screen-get_video_param + ( + screen, + templat.profile, + PIPE_VIDEO_ENTRYPOINT_BITSTREAM, + PIPE_VIDEO_CAP_MAX_HEIGHT + ); + if (width maxwidth || height maxheight) { + pipe_mutex_unlock(dev-mutex); + return VDP_STATUS_INVALID_SIZE; + } + vldecoder = CALLOC(1,sizeof(vlVdpDecoder)); if (!vldecoder) { pipe_mutex_unlock(dev-mutex); -- 1.8.3.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965/gs: Implement basic gl_PrimitiveIDIn functionality.
On 09/14/2013 10:33 AM, Paul Berry wrote: If the geometry shader refers to the built-in variable gl_PrimitiveIDIn, we need to set a bit in 3DSTATE_GS to tell the hardware to dispatch primitive ID to r1, and we need to leave room for it when allocating registers. Note: this feature doesn't yet work properly when software primitive restart is in use (the primitive ID counter will incorrectly reset with each primitive restart, since software primitive restart works by performing multiple draw calls). I plan to address that in a future patch series. Fixes piglit test spec/glsl-1.50/execution/geometry/primitive-id-in. Reviewed-by: Kenneth Graunke kenn...@whitecape.org ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/4] glsl: Keep track of location for interface block fields.
This patch adds a location element to struct glsl_struct_field, so that we can keep track of the gl_varying_slot associated with each built-in geometry shader input. In lower_named_interface_blocks, we use this value to populate the location field in the ir_variable that stores each geometry shader input. --- src/glsl/ast_to_hir.cpp | 1 + src/glsl/builtin_types.cpp| 74 +++ src/glsl/glsl_types.cpp | 2 + src/glsl/glsl_types.h | 9 src/glsl/lower_named_interface_blocks.cpp | 1 + 5 files changed, 50 insertions(+), 37 deletions(-) diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 2316cf8..c156009 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -4491,6 +4491,7 @@ ast_process_structure_or_interface_block(exec_list *instructions, } fields[i].type = field_type; fields[i].name = decl-identifier; + fields[i].location = -1; if (qual-flags.q.row_major || qual-flags.q.column_major) { if (!qual-flags.q.uniform) { diff --git a/src/glsl/builtin_types.cpp b/src/glsl/builtin_types.cpp index 722eda2..1a5e5a1 100644 --- a/src/glsl/builtin_types.cpp +++ b/src/glsl/builtin_types.cpp @@ -53,64 +53,64 @@ glsl_type::_struct_##NAME##_type; static const struct glsl_struct_field gl_DepthRangeParameters_fields[] = { - { glsl_type::float_type, near, false }, - { glsl_type::float_type, far, false }, - { glsl_type::float_type, diff, false }, + { glsl_type::float_type, near, false, -1 }, + { glsl_type::float_type, far, false, -1 }, + { glsl_type::float_type, diff, false, -1 }, }; static const struct glsl_struct_field gl_PointParameters_fields[] = { - { glsl_type::float_type, size, false }, - { glsl_type::float_type, sizeMin, false }, - { glsl_type::float_type, sizeMax, false }, - { glsl_type::float_type, fadeThresholdSize, false }, - { glsl_type::float_type, distanceConstantAttenuation, false }, - { glsl_type::float_type, distanceLinearAttenuation, false }, - { glsl_type::float_type, distanceQuadraticAttenuation, false }, + { glsl_type::float_type, size, false, -1 }, + { glsl_type::float_type, sizeMin, false, -1 }, + { glsl_type::float_type, sizeMax, false, -1 }, + { glsl_type::float_type, fadeThresholdSize, false, -1 }, + { glsl_type::float_type, distanceConstantAttenuation, false, -1 }, + { glsl_type::float_type, distanceLinearAttenuation, false, -1 }, + { glsl_type::float_type, distanceQuadraticAttenuation, false, -1 }, }; static const struct glsl_struct_field gl_MaterialParameters_fields[] = { - { glsl_type::vec4_type, emission, false }, - { glsl_type::vec4_type, ambient, false }, - { glsl_type::vec4_type, diffuse, false }, - { glsl_type::vec4_type, specular, false }, - { glsl_type::float_type, shininess, false }, + { glsl_type::vec4_type, emission, false, -1 }, + { glsl_type::vec4_type, ambient, false, -1 }, + { glsl_type::vec4_type, diffuse, false, -1 }, + { glsl_type::vec4_type, specular, false, -1 }, + { glsl_type::float_type, shininess, false, -1 }, }; static const struct glsl_struct_field gl_LightSourceParameters_fields[] = { - { glsl_type::vec4_type, ambient, false }, - { glsl_type::vec4_type, diffuse, false }, - { glsl_type::vec4_type, specular, false }, - { glsl_type::vec4_type, position, false }, - { glsl_type::vec4_type, halfVector, false }, - { glsl_type::vec3_type, spotDirection, false }, - { glsl_type::float_type, spotExponent, false }, - { glsl_type::float_type, spotCutoff, false }, - { glsl_type::float_type, spotCosCutoff, false }, - { glsl_type::float_type, constantAttenuation, false }, - { glsl_type::float_type, linearAttenuation, false }, - { glsl_type::float_type, quadraticAttenuation, false }, + { glsl_type::vec4_type, ambient, false, -1 }, + { glsl_type::vec4_type, diffuse, false, -1 }, + { glsl_type::vec4_type, specular, false, -1 }, + { glsl_type::vec4_type, position, false, -1 }, + { glsl_type::vec4_type, halfVector, false, -1 }, + { glsl_type::vec3_type, spotDirection, false, -1 }, + { glsl_type::float_type, spotExponent, false, -1 }, + { glsl_type::float_type, spotCutoff, false, -1 }, + { glsl_type::float_type, spotCosCutoff, false, -1 }, + { glsl_type::float_type, constantAttenuation, false, -1 }, + { glsl_type::float_type, linearAttenuation, false, -1 }, + { glsl_type::float_type, quadraticAttenuation, false, -1 }, }; static const struct glsl_struct_field gl_LightModelParameters_fields[] = { - { glsl_type::vec4_type, ambient, false }, + { glsl_type::vec4_type, ambient, false, -1 }, }; static const struct glsl_struct_field gl_LightModelProducts_fields[] = { - { glsl_type::vec4_type, sceneColor, false }, + { glsl_type::vec4_type, sceneColor, false, -1 }, }; static const struct glsl_struct_field gl_LightProducts_fields[] = { - {
[Mesa-dev] [PATCH 2/4] glsl/gs: add gl_in support to builtin_variables.cpp.
Previously, builtin_variables.cpp was written assuming that we supported ARB_geometry_shader4 style geometry shader inputs, meaning that each built-in varying input to a geometry was supplied via an array variable whose name ended in In, e.g. gl_PositionIn or gl_PointSizeIn. However, in GLSL 1.50 style geometry shaders, things work differently--built-in inputs are supplied to geometry shaders via a built-in interface block called gl_in, which contains all the built-in inputs using their usual names (e.g. the gl_Position input is supplied to the geometry shader as gl_in[i].gl_Position). This patch adds the necessary logic to builtin_variables.cpp to create the gl_in interface block and populate it accordingly for geometry shader inputs. The old ARB_geometry_shader4 style varyings are removed, though they can easily be added back in the future if we decide to support ARB_geometry_shader4. --- src/glsl/builtin_variables.cpp | 33 +++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp index 6a808c0..c6a8231 100644 --- a/src/glsl/builtin_variables.cpp +++ b/src/glsl/builtin_variables.cpp @@ -358,6 +358,17 @@ private: const glsl_type * const vec4_t; const glsl_type * const mat3_t; const glsl_type * const mat4_t; + + /** +* Array where the contents of the gl_PerVertex interface instance are +* accumulated. +*/ + glsl_struct_field per_vertex_fields[10]; + + /** +* Number of elements of per_vertex_fields which have been populated. +*/ + unsigned num_per_vertex_fields; }; @@ -368,7 +379,8 @@ builtin_variable_generator::builtin_variable_generator( bool_t(glsl_type::bool_type), int_t(glsl_type::int_type), float_t(glsl_type::float_type), vec2_t(glsl_type::vec2_type), vec3_t(glsl_type::vec3_type), vec4_t(glsl_type::vec4_type), - mat3_t(glsl_type::mat3_type), mat4_t(glsl_type::mat4_type) + mat3_t(glsl_type::mat3_type), mat4_t(glsl_type::mat4_type), + num_per_vertex_fields(0) { } @@ -756,7 +768,13 @@ builtin_variable_generator::add_varying(int slot, const glsl_type *type, { switch (state-target) { case geometry_shader: - add_input(slot, array(type, 0), name_as_gs_input); + assert(this-num_per_vertex_fields + ARRAY_SIZE(this-per_vertex_fields)); + this-per_vertex_fields[this-num_per_vertex_fields].type = type; + this-per_vertex_fields[this-num_per_vertex_fields].name = name; + this-per_vertex_fields[this-num_per_vertex_fields].row_major = false; + this-per_vertex_fields[this-num_per_vertex_fields].location = slot; + this-num_per_vertex_fields++; /* FALLTHROUGH */ case vertex_shader: add_output(slot, type, name); @@ -803,6 +821,17 @@ builtin_variable_generator::generate_varyings() ADD_VARYING(VARYING_SLOT_BFC1, vec4_t, gl_BackSecondaryColor); } } + + if (state-target == geometry_shader) { + const glsl_type *per_vertex_type = + glsl_type::get_interface_instance(this-per_vertex_fields, + this-num_per_vertex_fields, + GLSL_INTERFACE_PACKING_STD140, + gl_in); + ir_variable *var = add_variable(gl_in, array(per_vertex_type, 0), + ir_var_shader_in, 0); + var-interface_type = per_vertex_type; + } } -- 1.8.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/4] glsl/gs: handle gl_ClipDistance geometry input in lower_clip_distance.
From: Bryan Cain bryanca...@gmail.com This corresponds to the lowering of gl_ClipDistance to gl_ClipDistanceMESA for vertex and geometry shader outputs. Since this lowering pass occurs after lower_named_interface blocks, it deals with 2D arrays (gl_ClipDistance[vertex][clip_plane]) rather than 1D arrays in an interface block (gl_in[vertex].gl_ClipDistance[clip_plane]). v2 (Paul Berry stereotype...@gmail.com): Fix indexing order for gl_ClipDistance input lowering. Properly lower bulk assignment of gl_ClipDistance inputs. Rework for GLSL 1.50 style geometry shaders. --- src/glsl/lower_clip_distance.cpp | 223 +-- 1 file changed, 165 insertions(+), 58 deletions(-) diff --git a/src/glsl/lower_clip_distance.cpp b/src/glsl/lower_clip_distance.cpp index d6cf944..16eaef6 100644 --- a/src/glsl/lower_clip_distance.cpp +++ b/src/glsl/lower_clip_distance.cpp @@ -53,13 +53,16 @@ class lower_clip_distance_visitor : public ir_rvalue_visitor { public: lower_clip_distance_visitor() - : progress(false), old_clip_distance_var(NULL), -new_clip_distance_var(NULL) + : progress(false), old_clip_distance_1d_var(NULL), +old_clip_distance_2d_var(NULL), new_clip_distance_1d_var(NULL), +new_clip_distance_2d_var(NULL) { } virtual ir_visitor_status visit(ir_variable *); void create_indices(ir_rvalue*, ir_rvalue *, ir_rvalue *); + bool is_clip_distance_vec8(ir_rvalue *ir); + ir_rvalue *lower_clip_distance_vec8(ir_rvalue *ir); virtual ir_visitor_status visit_leave(ir_assignment *); void visit_new_assignment(ir_assignment *ir); virtual ir_visitor_status visit_leave(ir_call *); @@ -73,12 +76,14 @@ public: /** * Pointer to the declaration of gl_ClipDistance, if found. */ - ir_variable *old_clip_distance_var; + ir_variable *old_clip_distance_1d_var; + ir_variable *old_clip_distance_2d_var; /** * Pointer to the newly-created gl_ClipDistanceMESA variable. */ - ir_variable *new_clip_distance_var; + ir_variable *new_clip_distance_1d_var; + ir_variable *new_clip_distance_2d_var; }; @@ -89,30 +94,60 @@ public: ir_visitor_status lower_clip_distance_visitor::visit(ir_variable *ir) { - /* No point in looking for the declaration of gl_ClipDistance if -* we've already found it. -*/ - if (this-old_clip_distance_var) + if (!ir-name || strcmp(ir-name, gl_ClipDistance) != 0) return visit_continue; + assert (ir-type-is_array()); + + if (!ir-type-element_type()-is_array()) { + /* 1D gl_ClipDistance (used for vertex and geometry output, and fragment + * input). + */ + if (this-old_clip_distance_1d_var) + return visit_continue; - if (ir-name strcmp(ir-name, gl_ClipDistance) == 0) { this-progress = true; - this-old_clip_distance_var = ir; - assert (ir-type-is_array()); + this-old_clip_distance_1d_var = ir; assert (ir-type-element_type() == glsl_type::float_type); unsigned new_size = (ir-type-array_size() + 3) / 4; /* Clone the old var so that we inherit all of its properties */ - this-new_clip_distance_var = ir-clone(ralloc_parent(ir), NULL); + this-new_clip_distance_1d_var = ir-clone(ralloc_parent(ir), NULL); /* And change the properties that we need to change */ - this-new_clip_distance_var-name - = ralloc_strdup(this-new_clip_distance_var, gl_ClipDistanceMESA); - this-new_clip_distance_var-type + this-new_clip_distance_1d_var-name + = ralloc_strdup(this-new_clip_distance_1d_var, + gl_ClipDistanceMESA); + this-new_clip_distance_1d_var-type = glsl_type::get_array_instance(glsl_type::vec4_type, new_size); - this-new_clip_distance_var-max_array_access = ir-max_array_access / 4; + this-new_clip_distance_1d_var-max_array_access + = ir-max_array_access / 4; + + ir-replace_with(this-new_clip_distance_1d_var); + } else { + /* 2D gl_ClipDistance (used for geometry input). */ + assert(ir-mode == ir_var_shader_in); + if (this-old_clip_distance_2d_var) + return visit_continue; - ir-replace_with(this-new_clip_distance_var); + this-progress = true; + this-old_clip_distance_2d_var = ir; + assert (ir-type-element_type()-element_type() == glsl_type::float_type); + unsigned new_size = (ir-type-element_type()-array_size() + 3) / 4; + + /* Clone the old var so that we inherit all of its properties */ + this-new_clip_distance_2d_var = ir-clone(ralloc_parent(ir), NULL); + + /* And change the properties that we need to change */ + this-new_clip_distance_2d_var-name + = ralloc_strdup(this-new_clip_distance_2d_var, gl_ClipDistanceMESA); + this-new_clip_distance_2d_var-type = glsl_type::get_array_instance( + glsl_type::get_array_instance(glsl_type::vec4_type, +new_size), +
[Mesa-dev] [PATCH 4/4] i965/gs: Fixup gl_PointSize on entry to geometry shaders.
gl_PointSize is stored in the w component of VARYING_SLOT_PSIZ, but the geometry shader infrastructure assumes that it should look for all geometry shader inputs of type float in the x component. So when compiling a geomtery shader that uses a gl_PointSize input, fix it up during the shader prolog by moving the w component to the x component. This is similar to how we emit fixups and workarounds for vertex shader attributes. Fixes piglit test spec/glsl-1.50/execution/geometry/core-inputs. --- src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp | 17 + 1 file changed, 17 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp index 960f970..c0913f5 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_gs_visitor.cpp @@ -152,6 +152,23 @@ vec4_gs_visitor::emit_prolog() } } + /* If the geometry shader uses the gl_PointSize input, we need to fix it up +* to account for the fact that the vertex shader stored it in the w +* component of VARYING_SLOT_PSIZ. +*/ + if (c-gp-program.Base.InputsRead VARYING_BIT_PSIZ) { + this-current_annotation = swizzle gl_PointSize input; + for (int vertex = 0; vertex c-gp-program.VerticesIn; vertex++) { + dst_reg dst(ATTR, + BRW_VARYING_SLOT_COUNT * vertex + VARYING_SLOT_PSIZ); + dst.type = BRW_REGISTER_TYPE_F; + src_reg src(dst); + dst.writemask = WRITEMASK_X; + src.swizzle = BRW_SWIZZLE_; + emit(MOV(dst, src)); + } + } + this-current_annotation = NULL; } -- 1.8.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] i965/gs: Add new primitive types.
As part of its support for geometry shaders, GL 3.2 introduces four new primitive types: GL_LINES_ADJACENCY, GL_LINE_STRIP_ADJACENCY, GL_TRIANGLES_ADJACENCY, and GL_TRIANGLE_STRIP_ADJACENCY. --- src/mesa/drivers/dri/i965/brw_context.h | 2 +- src/mesa/drivers/dri/i965/brw_draw.c| 8 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 108e98c..47acfb1 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -1612,7 +1612,7 @@ gen7_emit_depth_stencil_hiz(struct brw_context *brw, uint32_t width, uint32_t height, uint32_t tile_x, uint32_t tile_y); -extern const GLuint prim_to_hw_prim[GL_POLYGON+1]; +extern const GLuint prim_to_hw_prim[GL_TRIANGLE_STRIP_ADJACENCY+1]; void brw_setup_vec4_key_clip_info(struct brw_context *brw, diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index 42f2685..549f9d0a 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -54,7 +54,7 @@ #define FILE_DEBUG_FLAG DEBUG_PRIMS -const GLuint prim_to_hw_prim[GL_POLYGON+1] = { +const GLuint prim_to_hw_prim[GL_TRIANGLE_STRIP_ADJACENCY+1] = { _3DPRIM_POINTLIST, _3DPRIM_LINELIST, _3DPRIM_LINELOOP, @@ -64,7 +64,11 @@ const GLuint prim_to_hw_prim[GL_POLYGON+1] = { _3DPRIM_TRIFAN, _3DPRIM_QUADLIST, _3DPRIM_QUADSTRIP, - _3DPRIM_POLYGON + _3DPRIM_POLYGON, + _3DPRIM_LINELIST_ADJ, + _3DPRIM_LINESTRIP_ADJ, + _3DPRIM_TRILIST_ADJ, + _3DPRIM_TRISTRIP_ADJ, }; -- 1.8.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] i965/gs: New gs primitive types are supported by HW primitive restart.
When we previously implemented primitive restart, we didn't add cases to brw_primitive_restart.c's can_cut_index_handle_prims() for the primitive types that are introduced with geometry shaders. It turns out that all of the new primitive types are supported by hardware primitive restart. --- src/mesa/drivers/dri/i965/brw_primitive_restart.c | 4 1 file changed, 4 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_primitive_restart.c b/src/mesa/drivers/dri/i965/brw_primitive_restart.c index bd48762..2ee6055 100644 --- a/src/mesa/drivers/dri/i965/brw_primitive_restart.c +++ b/src/mesa/drivers/dri/i965/brw_primitive_restart.c @@ -99,6 +99,10 @@ can_cut_index_handle_prims(struct gl_context *ctx, case GL_LINE_STRIP: case GL_TRIANGLES: case GL_TRIANGLE_STRIP: + case GL_LINES_ADJACENCY: + case GL_LINE_STRIP_ADJACENCY: + case GL_TRIANGLES_ADJACENCY: + case GL_TRIANGLE_STRIP_ADJACENCY: /* Cut index supports these primitive types */ break; default: -- 1.8.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] i965/gs: New gs primitive types are supported by HW primitive restart.
On 09/14/2013 01:59 PM, Paul Berry wrote: When we previously implemented primitive restart, we didn't add cases to brw_primitive_restart.c's can_cut_index_handle_prims() for the primitive types that are introduced with geometry shaders. It turns out that all of the new primitive types are supported by hardware primitive restart. --- src/mesa/drivers/dri/i965/brw_primitive_restart.c | 4 1 file changed, 4 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_primitive_restart.c b/src/mesa/drivers/dri/i965/brw_primitive_restart.c index bd48762..2ee6055 100644 --- a/src/mesa/drivers/dri/i965/brw_primitive_restart.c +++ b/src/mesa/drivers/dri/i965/brw_primitive_restart.c @@ -99,6 +99,10 @@ can_cut_index_handle_prims(struct gl_context *ctx, case GL_LINE_STRIP: case GL_TRIANGLES: case GL_TRIANGLE_STRIP: + case GL_LINES_ADJACENCY: + case GL_LINE_STRIP_ADJACENCY: + case GL_TRIANGLES_ADJACENCY: + case GL_TRIANGLE_STRIP_ADJACENCY: /* Cut index supports these primitive types */ break; default: Both of these are: Reviewed-by: Kenneth Graunke kenn...@whitecape.org (See the SNB PRM, Volume 2 Part 1, page 80.) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: Add some missing bits to {mesa, brw, cache}_bits[].
On 09/14/2013 10:29 AM, Paul Berry wrote: These data structures are used for debug output, so it wasn't hurting anything that there were missing bits. But it's good to keep things up to date. This patch also adds static asserts so that the {brw,cache}_bits[] arrays are the proper size, so that we don't forget to add to them in the future. Unfortunately there's no convenient way to assert that mesa_bits[] is the proper size. --- src/mesa/drivers/dri/i965/brw_context.h | 2 ++ src/mesa/drivers/dri/i965/brw_state_upload.c | 12 2 files changed, 14 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 108e98c..b697bec 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -780,6 +780,8 @@ enum shader_time_shader_type { #define CACHE_NEW_CC_VP (1BRW_CC_VP) #define CACHE_NEW_CC_UNIT(1BRW_CC_UNIT) #define CACHE_NEW_WM_PROG(1BRW_WM_PROG) +#define CACHE_NEW_BLORP_BLIT_PROG(1BRW_BLORP_BLIT_PROG) +#define CACHE_NEW_BLORP_CONST_COLOR_PROG (1BRW_BLORP_CONST_COLOR_PROG) #define CACHE_NEW_SAMPLER(1BRW_SAMPLER) #define CACHE_NEW_WM_UNIT(1BRW_WM_UNIT) #define CACHE_NEW_SF_PROG(1BRW_SF_PROG) diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index 8f21f06..d7fe319 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -359,6 +359,7 @@ static struct dirty_bit_map mesa_bits[] = { DEFINE_BIT(_NEW_ARRAY), DEFINE_BIT(_NEW_RENDERMODE), DEFINE_BIT(_NEW_BUFFERS), + DEFINE_BIT(_NEW_CURRENT_ATTRIB), DEFINE_BIT(_NEW_MULTISAMPLE), DEFINE_BIT(_NEW_TRACK_MATRIX), DEFINE_BIT(_NEW_PROGRAM), @@ -372,6 +373,7 @@ static struct dirty_bit_map mesa_bits[] = { static struct dirty_bit_map brw_bits[] = { DEFINE_BIT(BRW_NEW_URB_FENCE), DEFINE_BIT(BRW_NEW_FRAGMENT_PROGRAM), + DEFINE_BIT(BRW_NEW_GEOMETRY_PROGRAM), DEFINE_BIT(BRW_NEW_VERTEX_PROGRAM), DEFINE_BIT(BRW_NEW_CURBE_OFFSETS), DEFINE_BIT(BRW_NEW_REDUCED_PRIMITIVE), @@ -387,14 +389,18 @@ static struct dirty_bit_map brw_bits[] = { DEFINE_BIT(BRW_NEW_BATCH), DEFINE_BIT(BRW_NEW_INDEX_BUFFER), DEFINE_BIT(BRW_NEW_VS_CONSTBUF), + DEFINE_BIT(BRW_NEW_GS_CONSTBUF), DEFINE_BIT(BRW_NEW_PROGRAM_CACHE), DEFINE_BIT(BRW_NEW_STATE_BASE_ADDRESS), + DEFINE_BIT(BRW_NEW_VUE_MAP_VS), DEFINE_BIT(BRW_NEW_VUE_MAP_GEOM_OUT), DEFINE_BIT(BRW_NEW_TRANSFORM_FEEDBACK), DEFINE_BIT(BRW_NEW_RASTERIZER_DISCARD), + DEFINE_BIT(BRW_NEW_STATS_WM), DEFINE_BIT(BRW_NEW_UNIFORM_BUFFER), DEFINE_BIT(BRW_NEW_META_IN_PROGRESS), DEFINE_BIT(BRW_NEW_INTERPOLATION_MAP), + DEFINE_BIT(BRW_NEW_PUSH_CONSTANT_ALLOCATION), {0, 0, 0} }; @@ -402,6 +408,8 @@ static struct dirty_bit_map cache_bits[] = { DEFINE_BIT(CACHE_NEW_CC_VP), DEFINE_BIT(CACHE_NEW_CC_UNIT), DEFINE_BIT(CACHE_NEW_WM_PROG), + DEFINE_BIT(CACHE_NEW_BLORP_BLIT_PROG), + DEFINE_BIT(CACHE_NEW_BLORP_CONST_COLOR_PROG), DEFINE_BIT(CACHE_NEW_SAMPLER), DEFINE_BIT(CACHE_NEW_WM_UNIT), DEFINE_BIT(CACHE_NEW_SF_PROG), @@ -411,6 +419,7 @@ static struct dirty_bit_map cache_bits[] = { DEFINE_BIT(CACHE_NEW_VS_PROG), DEFINE_BIT(CACHE_NEW_FF_GS_UNIT), DEFINE_BIT(CACHE_NEW_FF_GS_PROG), + DEFINE_BIT(CACHE_NEW_GS_PROG), DEFINE_BIT(CACHE_NEW_CLIP_VP), DEFINE_BIT(CACHE_NEW_CLIP_UNIT), DEFINE_BIT(CACHE_NEW_CLIP_PROG), @@ -532,6 +541,9 @@ void brw_upload_state(struct brw_context *brw) } if (unlikely(INTEL_DEBUG DEBUG_STATE)) { + STATIC_ASSERT(ARRAY_SIZE(brw_bits) == BRW_NUM_STATE_BITS + 1); + STATIC_ASSERT(ARRAY_SIZE(cache_bits) == BRW_MAX_CACHE + 1); + brw_update_dirty_count(mesa_bits, state-mesa); brw_update_dirty_count(brw_bits, state-brw); brw_update_dirty_count(cache_bits, state-cache); I especially like the assertions. Reviewed-by: Kenneth Graunke kenn...@whitecape.org ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 69354] glxgears window displayed in a mess and showing error messages in terminal
https://bugs.freedesktop.org/show_bug.cgi?id=69354 Flos lonice...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #3 from Flos lonice...@gmail.com --- (In reply to comment #2) You need to set 'Option ColorTiling2D off' in the Device section of xorg.conf to use a recent version of xf86-video-ati with Mesa 9.0 Hi Jonathan, It works! Thank you very much for your help! Best regards, Flos -- 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