[Mesa-dev] [PATCH 1/1] r600, compute: Use the BO format for RAT instead of hardwired R32_UINT

Jan Vesely jan.vesely at rutgers.edu
Fri Feb 5 00:11:05 UTC 2016


On Thu, 2016-02-04 at 15:56 -0500, Jan Vesely wrote:
> r600_compute_buffer_alloc_vram uses pipe_buffer_create, which sets
> format to
> PIPE_FORMAT_R8_UNORM

RFC:
Looks like more is needed to fix this. the code expects R32 format.
Do we change the one used in pipe_buffer_create?
or just remove the assertion?
or is there a way to convert the format (other than plain format =)

Jan

> Fixes assertion failure since
> 7dd31b81fee7fe40bd09cf3fbc324fcc32782479
> gallium/radeon: support PIPE_CAP_SURFACE_REINTERPRET_BLOCKS
> 
> while at it use rctx helper var where possible.
> 
> Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
> ---
>  src/gallium/drivers/r600/evergreen_compute.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/src/gallium/drivers/r600/evergreen_compute.c
> b/src/gallium/drivers/r600/evergreen_compute.c
> index d6e4501..010a92e 100644
> --- a/src/gallium/drivers/r600/evergreen_compute.c
> +++ b/src/gallium/drivers/r600/evergreen_compute.c
> @@ -117,23 +117,24 @@ static void evergreen_set_rat(
>  
>  	rctx = pipe->ctx;
>  
> -	COMPUTE_DBG(rctx->screen, "bind rat: %i \n", id);
> +	COMPUTE_DBG(rctx->screen, "bind rat: %i (format %u) \n", id,
> +	            bo->b.b.format);
>  
>  	/* Create the RAT surface */
>  	memset(&rat_templ, 0, sizeof(rat_templ));
> -	rat_templ.format = PIPE_FORMAT_R32_UINT;
> +	rat_templ.format = bo->b.b.format;
>  	rat_templ.u.tex.level = 0;
>  	rat_templ.u.tex.first_layer = 0;
>  	rat_templ.u.tex.last_layer = 0;
>  
>  	/* Add the RAT the list of color buffers */
> -	pipe->ctx->framebuffer.state.cbufs[id] = pipe->ctx-
> >b.b.create_surface(
> -		(struct pipe_context *)pipe->ctx,
> +	pipe->ctx->framebuffer.state.cbufs[id] = rctx-
> >b.b.create_surface(
> +		(struct pipe_context *)rctx,
>  		(struct pipe_resource *)bo, &rat_templ);
>  
>  	/* Update the number of color buffers */
>  	pipe->ctx->framebuffer.state.nr_cbufs =
> -		MAX2(id + 1, pipe->ctx->framebuffer.state.nr_cbufs);
> +		MAX2(id + 1, rctx->framebuffer.state.nr_cbufs);
>  
>  	/* Update the cb_target_mask
>  	 * XXX: I think this is a potential spot for bugs once we
> start doing
> @@ -141,7 +142,7 @@ static void evergreen_set_rat(
>  	 * of this driver. */
>  	pipe->ctx->compute_cb_target_mask |= (0xf << (id * 4));
>  
> -	surf = (struct r600_surface*)pipe->ctx-
> >framebuffer.state.cbufs[id];
> +	surf = (struct r600_surface*)rctx-
> >framebuffer.state.cbufs[id];
>  	evergreen_init_color_surface_rat(rctx, surf);
>  }
>  
-- 
Jan Vesely <jan.vesely at rutgers.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20160204/31e8d1e4/attachment-0001.sig>


More information about the mesa-dev mailing list