mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-08 04:10:10 +01:00
gallium/u_threaded: offload begin/end_intel_perf_query
Fixes: 206495cac4 ("iris: Enable u_threaded_context")
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:
parent
e6aa5b96a8
commit
59bbf885e9
8 changed files with 59 additions and 26 deletions
|
|
@ -2997,6 +2997,7 @@ tc_get_intel_perf_query_info(struct pipe_context *_pipe,
|
|||
struct threaded_context *tc = threaded_context(_pipe);
|
||||
struct pipe_context *pipe = tc->pipe;
|
||||
|
||||
tc_sync(tc); /* n_active vs begin/end_intel_perf_query */
|
||||
pipe->get_intel_perf_query_info(pipe, query_index, name, data_size,
|
||||
n_counters, n_active);
|
||||
}
|
||||
|
|
@ -3029,24 +3030,35 @@ tc_new_intel_perf_query_obj(struct pipe_context *_pipe, unsigned query_index)
|
|||
return pipe->new_intel_perf_query_obj(pipe, query_index);
|
||||
}
|
||||
|
||||
static void
|
||||
tc_call_begin_intel_perf_query(struct pipe_context *pipe, union tc_payload *payload)
|
||||
{
|
||||
(void)pipe->begin_intel_perf_query(pipe, payload->query);
|
||||
}
|
||||
|
||||
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);
|
||||
tc_add_small_call(tc, TC_CALL_begin_intel_perf_query)->query = q;
|
||||
|
||||
/* assume success, begin failure can be signaled from get_intel_perf_query_data */
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
tc_call_end_intel_perf_query(struct pipe_context *pipe, union tc_payload *payload)
|
||||
{
|
||||
pipe->end_intel_perf_query(pipe, payload->query);
|
||||
}
|
||||
|
||||
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);
|
||||
tc_add_small_call(tc, TC_CALL_end_intel_perf_query)->query = q;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -3055,7 +3067,7 @@ 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);
|
||||
tc_sync(tc); /* flush potentially pending begin/end_intel_perf_queries */
|
||||
pipe->delete_intel_perf_query(pipe, q);
|
||||
}
|
||||
|
||||
|
|
@ -3065,7 +3077,7 @@ 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);
|
||||
tc_sync(tc); /* flush potentially pending begin/end_intel_perf_queries */
|
||||
pipe->wait_intel_perf_query(pipe, q);
|
||||
}
|
||||
|
||||
|
|
@ -3075,11 +3087,11 @@ 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);
|
||||
tc_sync(tc); /* flush potentially pending begin/end_intel_perf_queries */
|
||||
return pipe->is_intel_perf_query_ready(pipe, q);
|
||||
}
|
||||
|
||||
static void
|
||||
static bool
|
||||
tc_get_intel_perf_query_data(struct pipe_context *_pipe,
|
||||
struct pipe_query *q,
|
||||
size_t data_size,
|
||||
|
|
@ -3089,8 +3101,8 @@ tc_get_intel_perf_query_data(struct pipe_context *_pipe,
|
|||
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);
|
||||
tc_sync(tc); /* flush potentially pending begin/end_intel_perf_queries */
|
||||
return pipe->get_intel_perf_query_data(pipe, q, data_size, data, bytes_written);
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
|
|
|
|||
|
|
@ -78,3 +78,6 @@ CALL(delete_tcs_state)
|
|||
CALL(delete_tes_state)
|
||||
CALL(delete_vertex_elements_state)
|
||||
CALL(delete_sampler_state)
|
||||
|
||||
CALL(begin_intel_perf_query)
|
||||
CALL(end_intel_perf_query)
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
struct iris_perf_query {
|
||||
struct gl_perf_query_object base;
|
||||
struct intel_perf_query_object *query;
|
||||
bool begin_succeeded;
|
||||
};
|
||||
|
||||
static unsigned
|
||||
|
|
@ -107,7 +108,7 @@ iris_begin_perf_query(struct pipe_context *pipe, struct pipe_query *q)
|
|||
struct intel_perf_query_object *obj = perf_query->query;
|
||||
struct intel_perf_context *perf_ctx = ice->perf_ctx;
|
||||
|
||||
return intel_perf_begin_query(perf_ctx, obj);
|
||||
return (perf_query->begin_succeeded = intel_perf_begin_query(perf_ctx, obj));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -118,7 +119,8 @@ iris_end_perf_query(struct pipe_context *pipe, struct pipe_query *q)
|
|||
struct intel_perf_query_object *obj = perf_query->query;
|
||||
struct intel_perf_context *perf_ctx = ice->perf_ctx;
|
||||
|
||||
intel_perf_end_query(perf_ctx, obj);
|
||||
if (perf_query->begin_succeeded)
|
||||
intel_perf_end_query(perf_ctx, obj);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -188,7 +190,8 @@ iris_wait_perf_query(struct pipe_context *pipe, struct pipe_query *q)
|
|||
struct intel_perf_query_object *obj = perf_query->query;
|
||||
struct intel_perf_context *perf_ctx = ice->perf_ctx;
|
||||
|
||||
intel_perf_wait_query(perf_ctx, obj, &ice->batches[IRIS_BATCH_RENDER]);
|
||||
if (perf_query->begin_succeeded)
|
||||
intel_perf_wait_query(perf_ctx, obj, &ice->batches[IRIS_BATCH_RENDER]);
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
@ -201,12 +204,14 @@ iris_is_perf_query_ready(struct pipe_context *pipe, struct pipe_query *q)
|
|||
|
||||
if (perf_query->base.Ready)
|
||||
return true;
|
||||
if (!perf_query->begin_succeeded)
|
||||
return true;
|
||||
|
||||
return intel_perf_is_query_ready(perf_ctx, obj,
|
||||
&ice->batches[IRIS_BATCH_RENDER]);
|
||||
}
|
||||
|
||||
static void
|
||||
static bool
|
||||
iris_get_perf_query_data(struct pipe_context *pipe,
|
||||
struct pipe_query *q,
|
||||
size_t data_size,
|
||||
|
|
@ -218,8 +223,12 @@ iris_get_perf_query_data(struct pipe_context *pipe,
|
|||
struct intel_perf_query_object *obj = perf_query->query;
|
||||
struct intel_perf_context *perf_ctx = ice->perf_ctx;
|
||||
|
||||
intel_perf_get_query_data(perf_ctx, obj, &ice->batches[IRIS_BATCH_RENDER],
|
||||
data_size, data, bytes_written);
|
||||
if (perf_query->begin_succeeded) {
|
||||
intel_perf_get_query_data(perf_ctx, obj, &ice->batches[IRIS_BATCH_RENDER],
|
||||
data_size, data, bytes_written);
|
||||
}
|
||||
|
||||
return perf_query->begin_succeeded;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ struct pipe_context {
|
|||
|
||||
bool (*is_intel_perf_query_ready)(struct pipe_context *pipe, struct pipe_query *q);
|
||||
|
||||
void (*get_intel_perf_query_data)(struct pipe_context *pipe,
|
||||
bool (*get_intel_perf_query_data)(struct pipe_context *pipe,
|
||||
struct pipe_query *q,
|
||||
size_t data_size,
|
||||
uint32_t *data,
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ brw_is_perf_query_ready(struct gl_context *ctx,
|
|||
/**
|
||||
* Driver hook for glGetPerfQueryDataINTEL().
|
||||
*/
|
||||
static void
|
||||
static bool
|
||||
brw_get_perf_query_data(struct gl_context *ctx,
|
||||
struct gl_perf_query_object *o,
|
||||
GLsizei data_size,
|
||||
|
|
@ -325,6 +325,8 @@ brw_get_perf_query_data(struct gl_context *ctx,
|
|||
|
||||
intel_perf_get_query_data(brw->perf_ctx, obj, &brw->batch,
|
||||
data_size, data, bytes_written);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static struct gl_perf_query_object *
|
||||
|
|
|
|||
|
|
@ -951,7 +951,7 @@ struct dd_function_table {
|
|||
struct gl_perf_query_object *obj);
|
||||
bool (*IsPerfQueryReady)(struct gl_context *ctx,
|
||||
struct gl_perf_query_object *obj);
|
||||
void (*GetPerfQueryData)(struct gl_context *ctx,
|
||||
bool (*GetPerfQueryData)(struct gl_context *ctx,
|
||||
struct gl_perf_query_object *obj,
|
||||
GLsizei dataSize,
|
||||
GLuint *data,
|
||||
|
|
|
|||
|
|
@ -648,6 +648,13 @@ _mesa_GetPerfQueryDataINTEL(GLuint queryHandle, GLuint flags,
|
|||
}
|
||||
}
|
||||
|
||||
if (obj->Ready)
|
||||
ctx->Driver.GetPerfQueryData(ctx, obj, dataSize, data, bytesWritten);
|
||||
if (obj->Ready) {
|
||||
if (!ctx->Driver.GetPerfQueryData(ctx, obj, dataSize, data, bytesWritten)) {
|
||||
memset(data, 0, dataSize);
|
||||
*bytesWritten = 0;
|
||||
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glGetPerfQueryDataINTEL(deferred begin query failure)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ st_IsPerfQueryReady(struct gl_context *ctx, struct gl_perf_query_object *o)
|
|||
return pipe->is_intel_perf_query_ready(pipe, (struct pipe_query *)o);
|
||||
}
|
||||
|
||||
static void
|
||||
static bool
|
||||
st_GetPerfQueryData(struct gl_context *ctx,
|
||||
struct gl_perf_query_object *o,
|
||||
GLsizei data_size,
|
||||
|
|
@ -200,8 +200,8 @@ st_GetPerfQueryData(struct gl_context *ctx,
|
|||
*/
|
||||
assert(o->Ready);
|
||||
|
||||
pipe->get_intel_perf_query_data(pipe, (struct pipe_query *)o, data_size, data,
|
||||
bytes_written);
|
||||
return pipe->get_intel_perf_query_data(pipe, (struct pipe_query *)o,
|
||||
data_size, data, bytes_written);
|
||||
}
|
||||
|
||||
static struct gl_perf_query_object *
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue