[Mesa-dev] [PATCH 1/2] gallium/util: set correct usage flags in u_default_transfer_inline_write

Jose Fonseca jfonseca at vmware.com
Mon Feb 27 01:25:01 PST 2012


Looks good.

Jose

----- Original Message -----
> The DISCARD flags should improve performance in drivers which handle
> them.
> ---
>  src/gallium/auxiliary/util/u_transfer.c |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/util/u_transfer.c
> b/src/gallium/auxiliary/util/u_transfer.c
> index 7e72a59..1fa8d94 100644
> --- a/src/gallium/auxiliary/util/u_transfer.c
> +++ b/src/gallium/auxiliary/util/u_transfer.c
> @@ -21,6 +21,18 @@ void u_default_transfer_inline_write( struct
> pipe_context *pipe,
>     const uint8_t *src_data = data;
>     unsigned i;
>  
> +   assert(!(usage & PIPE_TRANSFER_READ));
> +
> +   /* the write flag is implicit by the nature of
> transfer_inline_write */
> +   usage |= PIPE_TRANSFER_WRITE;
> +
> +   /* transfer_inline_write implicitly discards the rewritten buffer
> range */
> +   if (box->x == 0 && box->width == resource->width0) {
> +      usage |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
> +   } else {
> +      usage |= PIPE_TRANSFER_DISCARD_RANGE;
> +   }
> +
>     transfer = pipe->get_transfer(pipe,
>                                   resource,
>                                   level,
> --
> 1.7.5.4
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 


More information about the mesa-dev mailing list