[Mesa-dev] [PATCH 2/4] i965/Gen8: Set up layer constraints properly for renderbuffers

Kenneth Graunke kenneth at whitecape.org
Thu May 8 01:21:05 PDT 2014


On 05/07/2014 10:21 PM, Chris Forbes wrote:
> Fixing the same issues the previous commit does for Gen7.
> 
> Note that I can't test this one, since I don't have a Broadwell.
> 
> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
> ---
>  src/mesa/drivers/dri/i965/gen8_surface_state.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/gen8_surface_state.c b/src/mesa/drivers/dri/i965/gen8_surface_state.c
> index 564d275..6fd0ad4 100644
> --- a/src/mesa/drivers/dri/i965/gen8_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/gen8_surface_state.c
> @@ -275,8 +275,8 @@ gen8_update_renderbuffer_surface(struct brw_context *brw,
>     uint32_t format = 0;
>     uint32_t surf_type;
>     bool is_array = false;
> -   int depth = MAX2(rb->Depth, 1);
> -   int min_array_element;
> +   int depth = irb->layer_count;

This causes piles of GPU hangs when running Piglit.  One example is:
bin/copyteximage RECT -samples=4 -auto

The problem seems to be that irb->layer_count (and rb->Depth) are 0.
Since we program Depth and Render Target View Extent as (depth - 1) =
-1, and it's treated as an unsigned value, this results in the maximum
number of slices and a bunch of other random bits set.

I think you still need to use MAX2(irb->layer_count, 1) in all four patches.

With that fixed, this patch also fixes Piglit's
spec/ARB_texture_view/clear-into-view-layered on Broadwell.  Oddly, I
didn't see any depth fixes.

With the MAX2 put back in all four patches, the series would get:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

I haven't tested on pre-Gen8.

> +   int min_array_element = irb->mt_layer / MAX2(mt->num_samples, 1);
>  
>     GLenum gl_target =
>        rb->TexImage ? rb->TexImage->TexObject->Target : GL_TEXTURE_2D;
> @@ -296,20 +296,15 @@ gen8_update_renderbuffer_surface(struct brw_context *brw,
>        is_array = true;
>        depth *= 6;
>        break;
> +   case GL_TEXTURE_3D:
> +      depth = rb->Depth;
> +      /* fallthrough */
>     default:
>        surf_type = translate_tex_target(gl_target);
>        is_array = _mesa_tex_target_is_array(gl_target);
>        break;
>     }
>  
> -   if (layered) {
> -      min_array_element = 0;
> -   } else if (mt->num_samples > 1) {
> -      min_array_element = irb->mt_layer / mt->num_samples;
> -   } else {
> -      min_array_element = irb->mt_layer;
> -   }
> -
>     /* _NEW_BUFFERS */
>     mesa_format rb_format = _mesa_get_render_format(ctx, intel_rb_format(irb));
>     assert(brw_render_target_supported(brw, rb));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140508/cafaa1dd/attachment.sig>


More information about the mesa-dev mailing list