[Mesa-dev] [PATCH 2/2] gallium/util: add fast path for buffers in u_default_transfer_inline_write

Marek Olšák maraeo at gmail.com
Mon Feb 27 06:53:21 PST 2012


On Mon, Feb 27, 2012 at 10:32 AM, Jose Fonseca <jfonseca at vmware.com> wrote:
> ----- Original Message -----
>> ---
>>  src/gallium/auxiliary/util/u_transfer.c |   34
>>  ++++++++++++++++++------------
>>  1 files changed, 20 insertions(+), 14 deletions(-)
>>
>> diff --git a/src/gallium/auxiliary/util/u_transfer.c
>> b/src/gallium/auxiliary/util/u_transfer.c
>> index 1fa8d94..f1c2a09 100644
>> --- a/src/gallium/auxiliary/util/u_transfer.c
>> +++ b/src/gallium/auxiliary/util/u_transfer.c
>> @@ -18,8 +18,6 @@ void u_default_transfer_inline_write( struct
>> pipe_context *pipe,
>>  {
>>     struct pipe_transfer *transfer = NULL;
>>     uint8_t *map = NULL;
>> -   const uint8_t *src_data = data;
>> -   unsigned i;
>>
>>     assert(!(usage & PIPE_TRANSFER_READ));
>>
>> @@ -45,18 +43,26 @@ void u_default_transfer_inline_write( struct
>> pipe_context *pipe,
>>     if (map == NULL)
>>        goto out;
>>
>> -   for (i = 0; i < box->depth; i++) {
>> -      util_copy_rect(map,
>> -                     resource->format,
>> -                     transfer->stride, /* bytes */
>> -                     0, 0,
>> -                     box->width,
>> -                     box->height,
>> -                     src_data,
>> -                     stride,       /* bytes */
>> -                     0, 0);
>> -      map += transfer->layer_stride;
>> -      src_data += layer_stride;
>> +   if (resource->target == PIPE_BUFFER) {
>> +         memcpy(map, data, box->width);
>
> Not sure if it was email's fault, but indentation looks off.

I'll fix that.

>
> Please also these sanity checks:
>
>   assert(box->width == 1);
>   assert(box->depth == 1);

I guess you mean box->height. Anyway, will do.

Marek


More information about the mesa-dev mailing list