[Mesa-dev] [PATCH] trace: Fix trace_context_transfer_unmap methods.
Jose Fonseca
jfonseca at vmware.com
Mon Jun 4 20:05:25 UTC 2018
Right. The issue is that transfer_map/transfer_unmap, just by
themselves don't imply changing data. So the way trace driver works is
that it emits fake buffer_subdata/transfer_subdata when unmapping write
transfers. (Originally, it used pipe_transfer_inline method, before it
was rename/refactored.)
Another alternative would be to record transfer_map/unmap, and then emit
fake memcpy calls (this is how apitrace work, but not trace drive.r)
Jose
On 04/06/18 17:06, Roland Scheidegger wrote:
> Alright, this now has all the right bits buffer/texture_subdata would use.
> That said, I'm still a bit confused why this is necessary. Is that just
> so the dumped output looks like it's the same as if you called
> texture/buffer_subdata? Makes sense then, but in reality it still was a
> transfer.
>
> Reviewed-by: Roland Scheidegger <sroland at vmware.com>
>
>
> Am 04.06.2018 um 15:01 schrieb Jose Fonseca:
>> The emitted buffer_subdata/texture_subdata call didn't match the
>> respective signatures.
>>
>> v2: Actually emit buffer_subdata call.
>> ---
>> .../auxiliary/driver_trace/tr_context.c | 60 +++++++++++++------
>> 1 file changed, 42 insertions(+), 18 deletions(-)
>>
>> diff --git a/src/gallium/auxiliary/driver_trace/tr_context.c b/src/gallium/auxiliary/driver_trace/tr_context.c
>> index 6d918d42a38..dc091aee2e9 100644
>> --- a/src/gallium/auxiliary/driver_trace/tr_context.c
>> +++ b/src/gallium/auxiliary/driver_trace/tr_context.c
>> @@ -1430,35 +1430,59 @@ trace_context_transfer_unmap(struct pipe_context *_context,
>> */
>>
>> struct pipe_resource *resource = transfer->resource;
>> - unsigned level = transfer->level;
>> unsigned usage = transfer->usage;
>> const struct pipe_box *box = &transfer->box;
>> unsigned stride = transfer->stride;
>> unsigned layer_stride = transfer->layer_stride;
>>
>> - if (resource->target == PIPE_BUFFER)
>> + if (resource->target == PIPE_BUFFER) {
>> + unsigned offset = box->x;
>> + unsigned size = box->width;
>> +
>> trace_dump_call_begin("pipe_context", "buffer_subdata");
>> - else
>> +
>> + trace_dump_arg(ptr, context);
>> + trace_dump_arg(ptr, resource);
>> + trace_dump_arg(uint, usage);
>> + trace_dump_arg(uint, offset);
>> + trace_dump_arg(uint, size);
>> +
>> + trace_dump_arg_begin("data");
>> + trace_dump_box_bytes(tr_trans->map,
>> + resource,
>> + box,
>> + stride,
>> + layer_stride);
>> + trace_dump_arg_end();
>> +
>> + trace_dump_arg(uint, stride);
>> + trace_dump_arg(uint, layer_stride);
>> +
>> + trace_dump_call_end();
>> + } else {
>> + unsigned level = transfer->level;
>> +
>> trace_dump_call_begin("pipe_context", "texture_subdata");
>>
>> - trace_dump_arg(ptr, context);
>> - trace_dump_arg(ptr, resource);
>> - trace_dump_arg(uint, level);
>> - trace_dump_arg(uint, usage);
>> - trace_dump_arg(box, box);
>> + trace_dump_arg(ptr, context);
>> + trace_dump_arg(ptr, resource);
>> + trace_dump_arg(uint, level);
>> + trace_dump_arg(uint, usage);
>> + trace_dump_arg(box, box);
>>
>> - trace_dump_arg_begin("data");
>> - trace_dump_box_bytes(tr_trans->map,
>> - resource,
>> - box,
>> - stride,
>> - layer_stride);
>> - trace_dump_arg_end();
>> + trace_dump_arg_begin("data");
>> + trace_dump_box_bytes(tr_trans->map,
>> + resource,
>> + box,
>> + stride,
>> + layer_stride);
>> + trace_dump_arg_end();
>>
>> - trace_dump_arg(uint, stride);
>> - trace_dump_arg(uint, layer_stride);
>> + trace_dump_arg(uint, stride);
>> + trace_dump_arg(uint, layer_stride);
>>
>> - trace_dump_call_end();
>> + trace_dump_call_end();
>> + }
>>
>> tr_trans->map = NULL;
>> }
>>
>
More information about the mesa-dev
mailing list