mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-09 23:30:13 +01:00
gallium: add the concept of batch queries
Some drivers (in particular radeon[si], but also freedreno judging from a quick grep) may want to expose performance counters that cannot be individually enabled or disabled. Allow such drivers to mark driver-specific queries as requiring a new type of batch query object that is used to start and stop a list of queries simultaneously. v3: adjust recently added nv50 queries v2: documentation for create_batch_query Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Tested-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
This commit is contained in:
parent
c235300bfc
commit
d61d4df02e
4 changed files with 42 additions and 6 deletions
|
|
@ -174,6 +174,7 @@ nv50_screen_get_driver_query_info(struct pipe_screen *pscreen,
|
|||
info->max_value.u64 = 0;
|
||||
info->type = PIPE_DRIVER_QUERY_TYPE_UINT64;
|
||||
info->group_id = -1;
|
||||
info->flags = 0;
|
||||
|
||||
return nv50_hw_get_driver_query_info(screen, id, info);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,6 +162,7 @@ nvc0_screen_get_driver_query_info(struct pipe_screen *pscreen,
|
|||
info->max_value.u64 = 0;
|
||||
info->type = PIPE_DRIVER_QUERY_TYPE_UINT64;
|
||||
info->group_id = -1;
|
||||
info->flags = 0;
|
||||
|
||||
#ifdef NOUVEAU_ENABLE_DRIVER_STATISTICS
|
||||
if (id < num_sw_queries)
|
||||
|
|
|
|||
|
|
@ -116,6 +116,25 @@ struct pipe_context {
|
|||
unsigned query_type,
|
||||
unsigned index );
|
||||
|
||||
/**
|
||||
* Create a query object that queries all given query types simultaneously.
|
||||
*
|
||||
* This can only be used for those query types for which
|
||||
* get_driver_query_info indicates that it must be used. Only one batch
|
||||
* query object may be active at a time.
|
||||
*
|
||||
* There may be additional constraints on which query types can be used
|
||||
* together, in particular those that are implied by
|
||||
* get_driver_query_group_info.
|
||||
*
|
||||
* \param num_queries the number of query types
|
||||
* \param query_types array of \p num_queries query types
|
||||
* \return a query object, or NULL on error.
|
||||
*/
|
||||
struct pipe_query *(*create_batch_query)( struct pipe_context *pipe,
|
||||
unsigned num_queries,
|
||||
unsigned *query_types );
|
||||
|
||||
void (*destroy_query)(struct pipe_context *pipe,
|
||||
struct pipe_query *q);
|
||||
|
||||
|
|
|
|||
|
|
@ -775,6 +775,16 @@ struct pipe_query_data_pipeline_statistics
|
|||
uint64_t cs_invocations; /**< Num compute shader invocations. */
|
||||
};
|
||||
|
||||
/**
|
||||
* For batch queries.
|
||||
*/
|
||||
union pipe_numeric_type_union
|
||||
{
|
||||
uint64_t u64;
|
||||
uint32_t u32;
|
||||
float f;
|
||||
};
|
||||
|
||||
/**
|
||||
* Query result (returned by pipe_context::get_query_result).
|
||||
*/
|
||||
|
|
@ -811,6 +821,9 @@ union pipe_query_result
|
|||
|
||||
/* PIPE_QUERY_PIPELINE_STATISTICS */
|
||||
struct pipe_query_data_pipeline_statistics pipeline_statistics;
|
||||
|
||||
/* batch queries */
|
||||
union pipe_numeric_type_union batch[0];
|
||||
};
|
||||
|
||||
union pipe_color_union
|
||||
|
|
@ -840,12 +853,13 @@ enum pipe_driver_query_result_type
|
|||
PIPE_DRIVER_QUERY_RESULT_TYPE_CUMULATIVE = 1,
|
||||
};
|
||||
|
||||
union pipe_numeric_type_union
|
||||
{
|
||||
uint64_t u64;
|
||||
uint32_t u32;
|
||||
float f;
|
||||
};
|
||||
/**
|
||||
* Some hardware requires some hardware-specific queries to be submitted
|
||||
* as batched queries. The corresponding query objects are created using
|
||||
* create_batch_query, and at most one such query may be active at
|
||||
* any time.
|
||||
*/
|
||||
#define PIPE_DRIVER_QUERY_FLAG_BATCH (1 << 0)
|
||||
|
||||
struct pipe_driver_query_info
|
||||
{
|
||||
|
|
@ -855,6 +869,7 @@ struct pipe_driver_query_info
|
|||
enum pipe_driver_query_type type;
|
||||
enum pipe_driver_query_result_type result_type;
|
||||
unsigned group_id;
|
||||
unsigned flags;
|
||||
};
|
||||
|
||||
struct pipe_driver_query_group_info
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue