diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 5d1e1251454..f1612c1e3c2 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -801,47 +801,6 @@ struct dd_function_table { GLint *bytesWritten); /*@}*/ - /** - * \name Performance Query objects - */ - /*@{*/ - unsigned (*InitPerfQueryInfo)(struct gl_context *ctx); - void (*GetPerfQueryInfo)(struct gl_context *ctx, - unsigned queryIndex, - const char **name, - GLuint *dataSize, - GLuint *numCounters, - GLuint *numActive); - void (*GetPerfCounterInfo)(struct gl_context *ctx, - unsigned queryIndex, - unsigned counterIndex, - const char **name, - const char **desc, - GLuint *offset, - GLuint *data_size, - GLuint *type_enum, - GLuint *data_type_enum, - GLuint64 *raw_max); - struct gl_perf_query_object * (*NewPerfQueryObject)(struct gl_context *ctx, - unsigned queryIndex); - void (*DeletePerfQuery)(struct gl_context *ctx, - struct gl_perf_query_object *obj); - bool (*BeginPerfQuery)(struct gl_context *ctx, - struct gl_perf_query_object *obj); - void (*EndPerfQuery)(struct gl_context *ctx, - struct gl_perf_query_object *obj); - void (*WaitPerfQuery)(struct gl_context *ctx, - struct gl_perf_query_object *obj); - bool (*IsPerfQueryReady)(struct gl_context *ctx, - struct gl_perf_query_object *obj); - bool (*GetPerfQueryData)(struct gl_context *ctx, - struct gl_perf_query_object *obj, - GLsizei dataSize, - GLuint *data, - GLuint *bytesWritten); - /*@}*/ - - /** * \name GREMEDY debug/marker functions */ diff --git a/src/mesa/main/performance_query.c b/src/mesa/main/performance_query.c index 6698d508e16..5f1b120f505 100644 --- a/src/mesa/main/performance_query.c +++ b/src/mesa/main/performance_query.c @@ -36,6 +36,8 @@ #include "performance_query.h" #include "util/ralloc.h" +#include "state_tracker/st_cb_perfquery.h" + void _mesa_init_performance_queries(struct gl_context *ctx) { @@ -54,7 +56,7 @@ free_performance_query(void *data, void *user) */ m->Active = false; m->Used = false; - ctx->Driver.DeletePerfQuery(ctx, m); + st_DeletePerfQuery(ctx, m); } void @@ -74,10 +76,7 @@ lookup_object(struct gl_context *ctx, GLuint id) static GLuint init_performance_query_info(struct gl_context *ctx) { - if (ctx->Driver.InitPerfQueryInfo) - return ctx->Driver.InitPerfQueryInfo(ctx); - else - return 0; + return st_InitPerfQueryInfo(ctx); } /* For INTEL_performance_query, query id 0 is reserved to be invalid. */ @@ -238,7 +237,7 @@ _mesa_GetPerfQueryIdByNameINTEL(char *queryName, GLuint *queryId) const GLchar *name; GLuint ignore; - ctx->Driver.GetPerfQueryInfo(ctx, i, &name, &ignore, &ignore, &ignore); + st_GetPerfQueryInfo(ctx, i, &name, &ignore, &ignore, &ignore); if (strcmp(name, queryName) == 0) { *queryId = index_to_queryid(i); @@ -278,11 +277,11 @@ _mesa_GetPerfQueryInfoINTEL(GLuint queryId, return; } - ctx->Driver.GetPerfQueryInfo(ctx, queryIndex, - &queryName, - &queryDataSize, - &queryNumCounters, - &queryNumActive); + st_GetPerfQueryInfo(ctx, queryIndex, + &queryName, + &queryDataSize, + &queryNumCounters, + &queryNumActive); output_clipped_string(name, nameLength, queryName); @@ -347,11 +346,11 @@ _mesa_GetPerfCounterInfoINTEL(GLuint queryId, GLuint counterId, return; } - ctx->Driver.GetPerfQueryInfo(ctx, queryIndex, - &queryName, - &queryDataSize, - &queryNumCounters, - &queryNumActive); + st_GetPerfQueryInfo(ctx, queryIndex, + &queryName, + &queryDataSize, + &queryNumCounters, + &queryNumActive); counterIndex = counterid_to_index(counterId); @@ -361,14 +360,14 @@ _mesa_GetPerfCounterInfoINTEL(GLuint queryId, GLuint counterId, return; } - ctx->Driver.GetPerfCounterInfo(ctx, queryIndex, counterIndex, - &counterName, - &counterDesc, - &counterOffset, - &counterDataSize, - &counterTypeEnum, - &counterDataTypeEnum, - &counterRawMax); + st_GetPerfCounterInfo(ctx, queryIndex, counterIndex, + &counterName, + &counterDesc, + &counterOffset, + &counterDataSize, + &counterTypeEnum, + &counterDataTypeEnum, + &counterRawMax); output_clipped_string(name, nameLength, counterName); output_clipped_string(desc, descLength, counterDesc); @@ -452,7 +451,7 @@ _mesa_CreatePerfQueryINTEL(GLuint queryId, GLuint *queryHandle) return; } - obj = ctx->Driver.NewPerfQueryObject(ctx, queryid_to_index(queryId)); + obj = st_NewPerfQueryObject(ctx, queryid_to_index(queryId)); if (obj == NULL) { _mesa_error_no_memory(__func__); return; @@ -493,12 +492,12 @@ _mesa_DeletePerfQueryINTEL(GLuint queryHandle) _mesa_EndPerfQueryINTEL(queryHandle); if (obj->Used && !obj->Ready) { - ctx->Driver.WaitPerfQuery(ctx, obj); + st_WaitPerfQuery(ctx, obj); obj->Ready = true; } _mesa_HashRemove(ctx->PerfQuery.Objects, queryHandle); - ctx->Driver.DeletePerfQuery(ctx, obj); + st_DeletePerfQuery(ctx, obj); } extern void GLAPIENTRY @@ -540,11 +539,11 @@ _mesa_BeginPerfQueryINTEL(GLuint queryHandle) * waiting for data on that object. */ if (obj->Used && !obj->Ready) { - ctx->Driver.WaitPerfQuery(ctx, obj); + st_WaitPerfQuery(ctx, obj); obj->Ready = true; } - if (ctx->Driver.BeginPerfQuery(ctx, obj)) { + if (st_BeginPerfQuery(ctx, obj)) { obj->Used = true; obj->Active = true; obj->Ready = false; @@ -580,7 +579,7 @@ _mesa_EndPerfQueryINTEL(GLuint queryHandle) return; } - ctx->Driver.EndPerfQuery(ctx, obj); + st_EndPerfQuery(ctx, obj); obj->Active = false; obj->Ready = false; @@ -637,19 +636,19 @@ _mesa_GetPerfQueryDataINTEL(GLuint queryHandle, GLuint flags, return; } - obj->Ready = ctx->Driver.IsPerfQueryReady(ctx, obj); + obj->Ready = st_IsPerfQueryReady(ctx, obj); if (!obj->Ready) { if (flags == GL_PERFQUERY_FLUSH_INTEL) { ctx->Driver.Flush(ctx, 0); } else if (flags == GL_PERFQUERY_WAIT_INTEL) { - ctx->Driver.WaitPerfQuery(ctx, obj); + st_WaitPerfQuery(ctx, obj); obj->Ready = true; } } if (obj->Ready) { - if (!ctx->Driver.GetPerfQueryData(ctx, obj, dataSize, data, bytesWritten)) { + if (!st_GetPerfQueryData(ctx, obj, dataSize, data, bytesWritten)) { memset(data, 0, dataSize); *bytesWritten = 0; diff --git a/src/mesa/state_tracker/st_cb_perfquery.c b/src/mesa/state_tracker/st_cb_perfquery.c index 5117bb60f3b..c57b99e2b95 100644 --- a/src/mesa/state_tracker/st_cb_perfquery.c +++ b/src/mesa/state_tracker/st_cb_perfquery.c @@ -49,7 +49,7 @@ st_have_perfquery(struct st_context *st) pipe->get_intel_perf_query_data; } -static unsigned +unsigned st_InitPerfQueryInfo(struct gl_context *ctx) { struct pipe_context *pipe = st_context(ctx)->pipe; @@ -57,7 +57,7 @@ st_InitPerfQueryInfo(struct gl_context *ctx) return pipe->init_intel_perf_query_info(pipe); } -static void +void st_GetPerfQueryInfo(struct gl_context *ctx, unsigned query_index, const char **name, @@ -100,7 +100,7 @@ pipe_counter_data_type_to_gl_type(enum pipe_perf_counter_data_type type) } } -static void +void st_GetPerfCounterInfo(struct gl_context *ctx, unsigned query_index, unsigned counter_index, @@ -123,7 +123,7 @@ st_GetPerfCounterInfo(struct gl_context *ctx, *data_type_enum = pipe_counter_data_type_to_gl_type(pipe_data_type_enum); } -static void +void st_DeletePerfQuery(struct gl_context *ctx, struct gl_perf_query_object *o) { struct pipe_context *pipe = st_context(ctx)->pipe; @@ -138,7 +138,7 @@ st_DeletePerfQuery(struct gl_context *ctx, struct gl_perf_query_object *o) pipe->delete_intel_perf_query(pipe, (struct pipe_query *)o); } -static bool +bool st_BeginPerfQuery(struct gl_context *ctx, struct gl_perf_query_object *o) { struct pipe_context *pipe = st_context(ctx)->pipe; @@ -155,7 +155,7 @@ st_BeginPerfQuery(struct gl_context *ctx, struct gl_perf_query_object *o) return pipe->begin_intel_perf_query(pipe, (struct pipe_query *)o); } -static void +void st_EndPerfQuery(struct gl_context *ctx, struct gl_perf_query_object *o) { struct pipe_context *pipe = st_context(ctx)->pipe; @@ -163,7 +163,7 @@ st_EndPerfQuery(struct gl_context *ctx, struct gl_perf_query_object *o) pipe->end_intel_perf_query(pipe, (struct pipe_query *)o); } -static void +void st_WaitPerfQuery(struct gl_context *ctx, struct gl_perf_query_object *o) { struct pipe_context *pipe = st_context(ctx)->pipe; @@ -173,7 +173,7 @@ st_WaitPerfQuery(struct gl_context *ctx, struct gl_perf_query_object *o) pipe->wait_intel_perf_query(pipe, (struct pipe_query *)o); } -static bool +bool st_IsPerfQueryReady(struct gl_context *ctx, struct gl_perf_query_object *o) { struct pipe_context *pipe = st_context(ctx)->pipe; @@ -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 bool +bool st_GetPerfQueryData(struct gl_context *ctx, struct gl_perf_query_object *o, GLsizei data_size, @@ -204,7 +204,7 @@ st_GetPerfQueryData(struct gl_context *ctx, data_size, data, bytes_written); } -static struct gl_perf_query_object * +struct gl_perf_query_object * st_NewPerfQueryObject(struct gl_context *ctx, unsigned query_index) { struct pipe_context *pipe = st_context(ctx)->pipe; @@ -214,17 +214,3 @@ st_NewPerfQueryObject(struct gl_context *ctx, unsigned query_index) return (struct gl_perf_query_object *)q; } - -void st_init_perfquery_functions(struct dd_function_table *functions) -{ - functions->InitPerfQueryInfo = st_InitPerfQueryInfo; - functions->GetPerfQueryInfo = st_GetPerfQueryInfo; - functions->GetPerfCounterInfo = st_GetPerfCounterInfo; - functions->NewPerfQueryObject = st_NewPerfQueryObject; - functions->DeletePerfQuery = st_DeletePerfQuery; - functions->BeginPerfQuery = st_BeginPerfQuery; - functions->EndPerfQuery = st_EndPerfQuery; - functions->WaitPerfQuery = st_WaitPerfQuery; - functions->IsPerfQueryReady = st_IsPerfQueryReady; - functions->GetPerfQueryData = st_GetPerfQueryData; -} diff --git a/src/mesa/state_tracker/st_cb_perfquery.h b/src/mesa/state_tracker/st_cb_perfquery.h index 1fbcd74f859..7a33fa42aa2 100644 --- a/src/mesa/state_tracker/st_cb_perfquery.h +++ b/src/mesa/state_tracker/st_cb_perfquery.h @@ -26,7 +26,37 @@ bool st_have_perfquery(struct st_context *st); -extern void -st_init_perfquery_functions(struct dd_function_table *functions); +unsigned st_InitPerfQueryInfo(struct gl_context *ctx); +void st_GetPerfQueryInfo(struct gl_context *ctx, + unsigned query_index, + const char **name, + GLuint *data_size, + GLuint *n_counters, + GLuint *n_active); + +void st_GetPerfCounterInfo(struct gl_context *ctx, + unsigned query_index, + unsigned counter_index, + const char **name, + const char **desc, + GLuint *offset, + GLuint *data_size, + GLuint *type_enum, + GLuint *data_type_enum, + GLuint64 *raw_max); + +void st_DeletePerfQuery(struct gl_context *ctx, struct gl_perf_query_object *o); +bool st_BeginPerfQuery(struct gl_context *ctx, struct gl_perf_query_object *o); +void st_EndPerfQuery(struct gl_context *ctx, struct gl_perf_query_object *o); +void st_WaitPerfQuery(struct gl_context *ctx, struct gl_perf_query_object *o); +bool st_IsPerfQueryReady(struct gl_context *ctx, struct gl_perf_query_object *o); +bool st_GetPerfQueryData(struct gl_context *ctx, + struct gl_perf_query_object *o, + GLsizei data_size, + GLuint *data, + GLuint *bytes_written); + +struct gl_perf_query_object * +st_NewPerfQueryObject(struct gl_context *ctx, unsigned query_index); #endif diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 948cd8ca993..353a604573e 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -945,7 +945,6 @@ st_init_driver_functions(struct pipe_screen *screen, st_init_fbo_functions(functions); st_init_msaa_functions(functions); st_init_perfmon_functions(functions); - st_init_perfquery_functions(functions); st_init_program_functions(functions); st_init_readpixels_functions(functions); st_init_texture_functions(functions);