gallium/u_threaded: implement INTEL_performance_query hooks

Fixes: 206495cac4 ("iris: Enable u_threaded_context")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4528

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9922>
This commit is contained in:
Marcin Ślusarz 2021-04-16 19:07:12 +02:00 committed by Marge Bot
parent a53d5753fd
commit e6aa5b96a8

View file

@ -2977,6 +2977,121 @@ tc_resource_commit(struct pipe_context *_pipe, struct pipe_resource *res,
return true; /* we don't care about the return value for this call */
}
static unsigned
tc_init_intel_perf_query_info(struct pipe_context *_pipe)
{
struct threaded_context *tc = threaded_context(_pipe);
struct pipe_context *pipe = tc->pipe;
return pipe->init_intel_perf_query_info(pipe);
}
static void
tc_get_intel_perf_query_info(struct pipe_context *_pipe,
unsigned query_index,
const char **name,
uint32_t *data_size,
uint32_t *n_counters,
uint32_t *n_active)
{
struct threaded_context *tc = threaded_context(_pipe);
struct pipe_context *pipe = tc->pipe;
pipe->get_intel_perf_query_info(pipe, query_index, name, data_size,
n_counters, n_active);
}
static void
tc_get_intel_perf_query_counter_info(struct pipe_context *_pipe,
unsigned query_index,
unsigned counter_index,
const char **name,
const char **desc,
uint32_t *offset,
uint32_t *data_size,
uint32_t *type_enum,
uint32_t *data_type_enum,
uint64_t *raw_max)
{
struct threaded_context *tc = threaded_context(_pipe);
struct pipe_context *pipe = tc->pipe;
pipe->get_intel_perf_query_counter_info(pipe, query_index, counter_index,
name, desc, offset, data_size, type_enum, data_type_enum, raw_max);
}
static struct pipe_query *
tc_new_intel_perf_query_obj(struct pipe_context *_pipe, unsigned query_index)
{
struct threaded_context *tc = threaded_context(_pipe);
struct pipe_context *pipe = tc->pipe;
return pipe->new_intel_perf_query_obj(pipe, query_index);
}
static bool
tc_begin_intel_perf_query(struct pipe_context *_pipe, struct pipe_query *q)
{
struct threaded_context *tc = threaded_context(_pipe);
struct pipe_context *pipe = tc->pipe;
tc_sync(tc);
return pipe->begin_intel_perf_query(pipe, q);
}
static void
tc_end_intel_perf_query(struct pipe_context *_pipe, struct pipe_query *q)
{
struct threaded_context *tc = threaded_context(_pipe);
struct pipe_context *pipe = tc->pipe;
tc_sync(tc);
pipe->end_intel_perf_query(pipe, q);
}
static void
tc_delete_intel_perf_query(struct pipe_context *_pipe, struct pipe_query *q)
{
struct threaded_context *tc = threaded_context(_pipe);
struct pipe_context *pipe = tc->pipe;
tc_sync(tc);
pipe->delete_intel_perf_query(pipe, q);
}
static void
tc_wait_intel_perf_query(struct pipe_context *_pipe, struct pipe_query *q)
{
struct threaded_context *tc = threaded_context(_pipe);
struct pipe_context *pipe = tc->pipe;
tc_sync(tc);
pipe->wait_intel_perf_query(pipe, q);
}
static bool
tc_is_intel_perf_query_ready(struct pipe_context *_pipe, struct pipe_query *q)
{
struct threaded_context *tc = threaded_context(_pipe);
struct pipe_context *pipe = tc->pipe;
tc_sync(tc);
return pipe->is_intel_perf_query_ready(pipe, q);
}
static void
tc_get_intel_perf_query_data(struct pipe_context *_pipe,
struct pipe_query *q,
size_t data_size,
uint32_t *data,
uint32_t *bytes_written)
{
struct threaded_context *tc = threaded_context(_pipe);
struct pipe_context *pipe = tc->pipe;
tc_sync(tc);
pipe->get_intel_perf_query_data(pipe, q, data_size, data, bytes_written);
}
/********************************************************************
* callback
@ -3259,6 +3374,16 @@ threaded_context_create(struct pipe_context *pipe,
CTX_INIT(delete_image_handle);
CTX_INIT(make_image_handle_resident);
CTX_INIT(set_frontend_noop);
CTX_INIT(init_intel_perf_query_info);
CTX_INIT(get_intel_perf_query_info);
CTX_INIT(get_intel_perf_query_counter_info);
CTX_INIT(new_intel_perf_query_obj);
CTX_INIT(begin_intel_perf_query);
CTX_INIT(end_intel_perf_query);
CTX_INIT(delete_intel_perf_query);
CTX_INIT(wait_intel_perf_query);
CTX_INIT(is_intel_perf_query_ready);
CTX_INIT(get_intel_perf_query_data);
#undef CTX_INIT
if (out)