[Mesa-dev] [PATCH 09/13] gallium/radeon: subclass threaded_transfer
Marek Olšák
maraeo at gmail.com
Thu May 11 23:48:41 UTC 2017
On Thu, May 11, 2017 at 8:42 PM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> On 11.05.2017 00:45, Marek Olšák wrote:
>>
>> From: Marek Olšák <marek.olsak at amd.com>
>>
>> ---
>> src/gallium/drivers/radeon/r600_buffer_common.c | 22
>> ++++++++++-----------
>> src/gallium/drivers/radeon/r600_pipe_common.h | 2 +-
>> src/gallium/drivers/radeon/r600_texture.c | 26
>> ++++++++++++-------------
>> 3 files changed, 25 insertions(+), 25 deletions(-)
>>
>> diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c
>> b/src/gallium/drivers/radeon/r600_buffer_common.c
>> index b57632e..0c6fa66 100644
>> --- a/src/gallium/drivers/radeon/r600_buffer_common.c
>> +++ b/src/gallium/drivers/radeon/r600_buffer_common.c
>> @@ -293,30 +293,31 @@ static void *r600_buffer_get_transfer(struct
>> pipe_context *ctx,
>> unsigned offset)
>> {
>> struct r600_common_context *rctx = (struct
>> r600_common_context*)ctx;
>> struct r600_transfer *transfer;
>>
>> if (usage & TC_TRANSFER_MAP_THREADED_UNSYNC)
>> transfer = slab_alloc(&rctx->pool_transfers_unsync);
>> else
>> transfer = slab_alloc(&rctx->pool_transfers);
>>
>> - transfer->transfer.resource = NULL;
>> - pipe_resource_reference(&transfer->transfer.resource, resource);
>> - transfer->transfer.level = 0;
>> - transfer->transfer.usage = usage;
>> - transfer->transfer.box = *box;
>> - transfer->transfer.stride = 0;
>> - transfer->transfer.layer_stride = 0;
>> + transfer->b.b.resource = NULL;
>> + pipe_resource_reference(&transfer->b.b.resource, resource);
>> + transfer->b.b.level = 0;
>> + transfer->b.b.usage = usage;
>> + transfer->b.b.box = *box;
>> + transfer->b.b.stride = 0;
>> + transfer->b.b.layer_stride = 0;
>> + transfer->b.staging = NULL;
>> transfer->offset = offset;
>> transfer->staging = staging;
>> - *ptransfer = &transfer->transfer;
>> + *ptransfer = &transfer->b.b;
>> return data;
>> }
>>
>> static bool r600_can_dma_copy_buffer(struct r600_common_context *rctx,
>> unsigned dstx, unsigned srcx,
>> unsigned size)
>> {
>> bool dword_aligned = !(dstx % 4) && !(srcx % 4) && !(size % 4);
>>
>> return rctx->screen->has_cp_dma ||
>> (dword_aligned && (rctx->dma.cs ||
>> @@ -505,23 +506,22 @@ static void r600_buffer_flush_region(struct
>> pipe_context *ctx,
>> static void r600_buffer_transfer_unmap(struct pipe_context *ctx,
>> struct pipe_transfer *transfer)
>> {
>> struct r600_common_context *rctx = (struct
>> r600_common_context*)ctx;
>> struct r600_transfer *rtransfer = (struct r600_transfer*)transfer;
>>
>> if (transfer->usage & PIPE_TRANSFER_WRITE &&
>> !(transfer->usage & PIPE_TRANSFER_FLUSH_EXPLICIT))
>> r600_buffer_do_flush_region(ctx, transfer,
>> &transfer->box);
>>
>> - if (rtransfer->staging)
>> - r600_resource_reference(&rtransfer->staging, NULL);
>> -
>> + r600_resource_reference(&rtransfer->staging, NULL);
>> + pipe_resource_reference(&rtransfer->b.staging, NULL);
>
>
> Can we get here with rtransfer->b.staging != NULL? The way I understand it,
> those transfers will be completely handled in the threaded_context. In that
> case, it'd be better to replace this by an assert.
Your understanding is correct.
Marek
More information about the mesa-dev
mailing list