[Mesa-dev] [PATCH 2/3] intel: Give the batch decoder a callback to ask about state size.
Lionel Landwerlin
lionel.g.landwerlin at intel.com
Wed May 2 15:57:06 UTC 2018
On 02/05/18 16:45, Kenneth Graunke wrote:
> On Wednesday, May 2, 2018 3:52:22 AM PDT Lionel Landwerlin wrote:
>> On 02/05/18 06:50, Kenneth Graunke wrote:
>>> Given an arbitrary batch, we don't always know what the size of certain
>>> things are, such as how many entries are in a binding table. But it's
>>> easy for the driver to track that information, so with a simple callback
>>> we can calculate this correctly for INTEL_DEBUG=bat.
>>> ---
>>> src/intel/common/gen_batch_decoder.c | 23 +++++++++++++++++++----
>>> src/intel/common/gen_decoder.h | 4 ++++
>>> src/intel/tools/aubinator.c | 2 +-
>>> src/intel/tools/aubinator_error_decode.c | 2 +-
>>> 4 files changed, 25 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/src/intel/common/gen_batch_decoder.c b/src/intel/common/gen_batch_decoder.c
>>> index c6b908758b2..37eac1ab2a1 100644
>>> --- a/src/intel/common/gen_batch_decoder.c
>>> +++ b/src/intel/common/gen_batch_decoder.c
>>> @@ -33,11 +33,13 @@ gen_batch_decode_ctx_init(struct gen_batch_decode_ctx *ctx,
>>> const char *xml_path,
>>> struct gen_batch_decode_bo (*get_bo)(void *,
>>> uint64_t),
>>> + unsigned (*get_state_size)(void *, uint32_t),
>>> void *user_data)
>>> {
>>> memset(ctx, 0, sizeof(*ctx));
>>>
>>> ctx->get_bo = get_bo;
>>> + ctx->get_state_size = get_state_size;
>>> ctx->user_data = user_data;
>>> ctx->fp = fp;
>>> ctx->flags = flags;
>>> @@ -103,6 +105,21 @@ ctx_get_bo(struct gen_batch_decode_ctx *ctx, uint64_t addr)
>>> return bo;
>>> }
>>>
>>> +static int
>>> +update_count(struct gen_batch_decode_ctx *ctx,
>>> + uint32_t offset_from_dsba,
>>> + unsigned element_dwords,
>>> + unsigned guess)
>>> +{
>>> + unsigned size = ctx->get_state_size(ctx->user_data, offset_from_dsba);
>> You probably want to get the fact that ctx->get_state_size might be NULL?
> Eep, yes...thanks! I'd done that at first, but botched it in a
> refactor...clearly I hadn't actually tested the aubinator tools...
>
> I've changed it to:
>
> - unsigned size = ctx->get_state_size(ctx->user_data, offset_from_dsba);
> + unsigned size = 0;
> +
> + if (ctx->get_state_size)
> + size = ctx->get_state_size(ctx->user_data, offset_from_dsba);
>
Thanks,
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
More information about the mesa-dev
mailing list