struct si_screen;
struct si_context;
struct si_query;
+struct si_query_buffer;
struct si_query_hw;
-struct r600_resource;
+struct si_resource;
+
+#define SI_MAX_STREAMS 4
enum {
SI_QUERY_DRAW_CALLS = PIPE_QUERY_DRIVER_SPECIFIC,
SI_QUERY_GPIN_NUM_SE,
SI_QUERY_TIME_ELAPSED_SDMA,
SI_QUERY_TIME_ELAPSED_SDMA_SI, /* emulated, measured on the CPU */
+ SI_QUERY_PD_NUM_PRIMS_ACCEPTED,
+ SI_QUERY_PD_NUM_PRIMS_REJECTED,
+ SI_QUERY_PD_NUM_PRIMS_INELIGIBLE,
SI_QUERY_FIRST_PERFCOUNTER = PIPE_QUERY_DRIVER_SPECIFIC + 100,
};
};
struct si_query_ops {
- void (*destroy)(struct si_screen *, struct si_query *);
+ void (*destroy)(struct si_context *, struct si_query *);
bool (*begin)(struct si_context *, struct si_query *);
bool (*end)(struct si_context *, struct si_query *);
bool (*get_result)(struct si_context *,
struct si_query {
struct threaded_query b;
- struct si_query_ops *ops;
+ const struct si_query_ops *ops;
/* The PIPE_QUERY_xxx type of query */
unsigned type;
};
struct si_query_hw_ops {
- bool (*prepare_buffer)(struct si_screen *,
- struct si_query_hw *,
- struct r600_resource *);
+ bool (*prepare_buffer)(struct si_context *, struct si_query_buffer *);
void (*emit_start)(struct si_context *,
struct si_query_hw *,
- struct r600_resource *buffer, uint64_t va);
+ struct si_resource *buffer, uint64_t va);
void (*emit_stop)(struct si_context *,
struct si_query_hw *,
- struct r600_resource *buffer, uint64_t va);
+ struct si_resource *buffer, uint64_t va);
void (*clear_result)(struct si_query_hw *, union pipe_query_result *);
void (*add_result)(struct si_screen *screen,
struct si_query_hw *, void *buffer,
struct si_query_buffer {
/* The buffer where query results are stored. */
- struct r600_resource *buf;
- /* Offset of the next free result after current query data */
- unsigned results_end;
+ struct si_resource *buf;
/* If a query buffer is full, a new buffer is created and the old one
* is put in here. When we calculate the result, we sum up the samples
* from all buffers. */
struct si_query_buffer *previous;
+ /* Offset of the next free result after current query data */
+ unsigned results_end;
+ bool unprepared;
};
+void si_query_buffer_destroy(struct si_screen *sctx, struct si_query_buffer *buffer);
+void si_query_buffer_reset(struct si_context *sctx, struct si_query_buffer *buffer);
+bool si_query_buffer_alloc(struct si_context *sctx, struct si_query_buffer *buffer,
+ bool (*prepare_buffer)(struct si_context *, struct si_query_buffer*),
+ unsigned size);
+
+
struct si_query_hw {
struct si_query b;
struct si_query_hw_ops *ops;
unsigned stream;
/* Workaround via compute shader */
- struct r600_resource *workaround_buf;
+ struct si_resource *workaround_buf;
unsigned workaround_offset;
};
-bool si_query_hw_init(struct si_screen *sscreen,
- struct si_query_hw *query);
-void si_query_hw_destroy(struct si_screen *sscreen,
- struct si_query *rquery);
+void si_query_hw_destroy(struct si_context *sctx,
+ struct si_query *squery);
bool si_query_hw_begin(struct si_context *sctx,
- struct si_query *rquery);
+ struct si_query *squery);
bool si_query_hw_end(struct si_context *sctx,
- struct si_query *rquery);
+ struct si_query *squery);
bool si_query_hw_get_result(struct si_context *sctx,
- struct si_query *rquery,
+ struct si_query *squery,
bool wait,
union pipe_query_result *result);
void si_query_hw_suspend(struct si_context *sctx, struct si_query *query);
void si_query_hw_resume(struct si_context *sctx, struct si_query *query);
+/* Shader-based queries */
+struct pipe_query *gfx10_sh_query_create(struct si_screen *screen,
+ enum pipe_query_type query_type,
+ unsigned index);
+
+
/* Performance counters */
struct si_perfcounters {
unsigned num_groups;
unsigned index,
struct pipe_driver_query_group_info *info);
-void si_query_hw_reset_buffers(struct si_context *sctx,
- struct si_query_hw *query);
-
struct si_qbo_state {
void *saved_compute;
struct pipe_constant_buffer saved_const0;
struct pipe_shader_buffer saved_ssbo[3];
+ unsigned saved_ssbo_writable_mask;
};
#endif /* SI_QUERY_H */