From 0e7464f0a93908cc31d05fb33611f3cd73a7be65 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Wed, 29 Apr 2015 08:41:34 +0100 Subject: mesa: Model INTEL perf query backend after query obj BE Instead of using the same backend interface as AMD_performance_monitor this defines a dedicated INTEL_performance_query interface that is modelled more on the ARB_query_buffer_object interface (considering the similarity of the extensions) with the addition of vfuncs for initializing and enumerating query and counter info. Compared to the previous backend, some notable differences are: - The backend is free to represent counters using whatever data structures are optimal/convenient since queries and counters are enumerated via an iterator api instead of declaring them using structures directly shared with the frontend. This is also done to help us support the full range of data and semantic types available with INTEL_performance_query which is awkward while using a structure shared with the AMD_performance_monitor backend since neither extension's types are a subset of the other. - The backend must support waiting for a query instead of the frontend simply using glFinish(). - Objects go through 'Active' and 'Ready' states consistent with the query object backend (hopefully making them more familiar). There is no 'Ended' state (which used to show that a query has ended at least once for a given object). There is a new 'Used' state, set when a query is first begun which implies that we are expecting to get results back for the object at some point. There's no equivalent to the 'EverBound' state since the spec doesn't require there to be a limbo state between generating IDs and associating them with an object on query Begin. The INTEL_performance_query and AMD_performance_monitor extensions are now completely orthogonal within Mesa main (though a driver could optionally choose to implement both extensions within a unified backend if that were convenient for the sake of sharing state/code). v2: (Samuel Pitoiset) - init PerfQuery.NumQueries in frontend - s/return_string/output_clipped_string/ - s/backed/backend/ typo - remove redundant *bytesWritten = 0 v3: - Add InitPerfQueryInfo for lazy probing of available queries v4: - Clean up some internal usage of GL typedefs (Ken) Signed-off-by: Robert Bragg Reviewed-by: Lionel Landwerlin Reviewed-by: Kenneth Graunke --- src/mesa/main/dd.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'src/mesa/main/dd.h') diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 7ebd084ca31..aba301cf22e 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -779,6 +779,47 @@ 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); + GLboolean (*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); + GLboolean (*IsPerfQueryReady)(struct gl_context *ctx, + struct gl_perf_query_object *obj); + void (*GetPerfQueryData)(struct gl_context *ctx, + struct gl_perf_query_object *obj, + GLsizei dataSize, + GLuint *data, + GLuint *bytesWritten); + /*@}*/ + + /** * \name GREMEDY debug/marker functions */ -- cgit v1.2.3