[Mesa-dev] [PATCH 1/4] i965: Refactor Gen6+ SF attribute override code.

Martin Steigerwald Martin at lichtvoll.de
Sun Feb 3 03:07:52 PST 2013


Am Samstag, 2. Februar 2013 schrieb Kenneth Graunke:
> The next patch will benefit from easy access to the source attribute
> number and whether or not we're swizzling.  It doesn't want the final
> attr_override DWord form, however.
> 
> NOTE: This is a candidate for all stable branches.
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>

Tested-by: Martin Steigerwald <martin at lichtvoll.de>

Corruptions are still gone.

OpenGL version string: 3.0 Mesa 9.2-devel (git-8a4d952)

+ these four patches and the four patches for CopyTexSubImage BLORP y-tiled 
blits.

I will observe whether the GPU hangs have gone.

Thanks,
Martin

> ---
>  src/mesa/drivers/dri/i965/gen6_sf_state.c | 25 +++++++++++++------------
>  1 file changed, 13 insertions(+), 12 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c
> b/src/mesa/drivers/dri/i965/gen6_sf_state.c index c1bc252..bd7d461
> 100644
> --- a/src/mesa/drivers/dri/i965/gen6_sf_state.c
> +++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c
> @@ -56,7 +56,6 @@ uint32_t
>  get_attr_override(struct brw_vue_map *vue_map, int
> urb_entry_read_offset, int fs_attr, bool two_side_color)
>  {
> -   int attr_override, slot;
>     int vs_attr = _mesa_frag_attrib_to_vert_result(fs_attr);
>     if (vs_attr < 0 || vs_attr == VERT_RESULT_HPOS) {
>        /* These attributes will be overwritten by the fragment shader's
> @@ -67,7 +66,7 @@ get_attr_override(struct brw_vue_map *vue_map, int
> urb_entry_read_offset, }
> 
>     /* Find the VUE slot for this attribute. */
> -   slot = vue_map->vert_result_to_slot[vs_attr];
> +   int slot = vue_map->vert_result_to_slot[vs_attr];
> 
>     /* If there was only a back color written but not front, use back
>      * as the color instead of undefined
> @@ -89,23 +88,25 @@ get_attr_override(struct brw_vue_map *vue_map, int
> urb_entry_read_offset, * Each increment of urb_entry_read_offset
> represents a 256-bit value, so * it counts for two 128-bit VUE slots.
>      */
> -   attr_override = slot - 2 * urb_entry_read_offset;
> -   assert (attr_override >= 0 && attr_override < 32);
> +   int source_attr = slot - 2 * urb_entry_read_offset;
> +   assert(source_attr >= 0 && source_attr < 32);
> 
>     /* If we are doing two-sided color, and the VUE slot following this
> one * represents a back-facing color, then we need to instruct the SF
> unit to * do back-facing swizzling.
>      */
> -   if (two_side_color) {
> -      if (vue_map->slot_to_vert_result[slot] == VERT_RESULT_COL0 &&
> -          vue_map->slot_to_vert_result[slot+1] == VERT_RESULT_BFC0)
> -         attr_override |= (ATTRIBUTE_SWIZZLE_INPUTATTR_FACING <<
> ATTRIBUTE_SWIZZLE_SHIFT); -      else if
> (vue_map->slot_to_vert_result[slot] == VERT_RESULT_COL1 && -            
>   vue_map->slot_to_vert_result[slot+1] == VERT_RESULT_BFC1) -        
> attr_override |= (ATTRIBUTE_SWIZZLE_INPUTATTR_FACING <<
> ATTRIBUTE_SWIZZLE_SHIFT); +   bool swizzling = two_side_color &&
> +      ((vue_map->slot_to_vert_result[slot] == VERT_RESULT_COL0 &&
> +        vue_map->slot_to_vert_result[slot+1] == VERT_RESULT_BFC0) ||
> +       (vue_map->slot_to_vert_result[slot] == VERT_RESULT_COL1 &&
> +        vue_map->slot_to_vert_result[slot+1] == VERT_RESULT_BFC1));
> +
> +   if (swizzling) {
> +      return source_attr |
> +         (ATTRIBUTE_SWIZZLE_INPUTATTR_FACING <<
> ATTRIBUTE_SWIZZLE_SHIFT); }
> 
> -   return attr_override;
> +   return source_attr;
>  }
> 
>  static void


-- 
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA  B82F 991B EAAC A599 84C7


More information about the mesa-dev mailing list