aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/freedreno/a2xx/fd2_query.c2
-rw-r--r--src/gallium/drivers/freedreno/a5xx/fd5_query.c9
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_query.c11
-rw-r--r--src/gallium/drivers/freedreno/freedreno_blitter.c2
-rw-r--r--src/gallium/drivers/freedreno/freedreno_context.c1
-rw-r--r--src/gallium/drivers/freedreno/freedreno_context.h14
-rw-r--r--src/gallium/drivers/freedreno/freedreno_query.c5
-rw-r--r--src/gallium/drivers/freedreno/freedreno_query_acc.c10
-rw-r--r--src/gallium/drivers/freedreno/freedreno_query_acc.h4
-rw-r--r--src/gallium/drivers/freedreno/freedreno_query_hw.c9
10 files changed, 30 insertions, 37 deletions
diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_query.c b/src/gallium/drivers/freedreno/a2xx/fd2_query.c
index b51903fcf97..5261a6911bb 100644
--- a/src/gallium/drivers/freedreno/a2xx/fd2_query.c
+++ b/src/gallium/drivers/freedreno/a2xx/fd2_query.c
@@ -151,7 +151,7 @@ perfcntr_accumulate_result(struct fd_acc_query *aq, void *buf,
static const struct fd_acc_sample_provider perfcntr = {
.query_type = FD_QUERY_FIRST_PERFCNTR,
- .active = FD_STAGE_ALL,
+ .always = true,
.resume = perfcntr_resume,
.pause = perfcntr_pause,
.result = perfcntr_accumulate_result,
diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_query.c b/src/gallium/drivers/freedreno/a5xx/fd5_query.c
index 6cf9e2d6140..ac11dbb86ee 100644
--- a/src/gallium/drivers/freedreno/a5xx/fd5_query.c
+++ b/src/gallium/drivers/freedreno/a5xx/fd5_query.c
@@ -134,7 +134,6 @@ occlusion_predicate_result(struct fd_acc_query *aq, void *buf,
static const struct fd_acc_sample_provider occlusion_counter = {
.query_type = PIPE_QUERY_OCCLUSION_COUNTER,
- .active = FD_STAGE_DRAW,
.size = sizeof(struct fd5_query_sample),
.resume = occlusion_resume,
.pause = occlusion_pause,
@@ -143,7 +142,6 @@ static const struct fd_acc_sample_provider occlusion_counter = {
static const struct fd_acc_sample_provider occlusion_predicate = {
.query_type = PIPE_QUERY_OCCLUSION_PREDICATE,
- .active = FD_STAGE_DRAW,
.size = sizeof(struct fd5_query_sample),
.resume = occlusion_resume,
.pause = occlusion_pause,
@@ -152,7 +150,6 @@ static const struct fd_acc_sample_provider occlusion_predicate = {
static const struct fd_acc_sample_provider occlusion_predicate_conservative = {
.query_type = PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE,
- .active = FD_STAGE_DRAW,
.size = sizeof(struct fd5_query_sample),
.resume = occlusion_resume,
.pause = occlusion_pause,
@@ -229,7 +226,7 @@ timestamp_accumulate_result(struct fd_acc_query *aq, void *buf,
static const struct fd_acc_sample_provider time_elapsed = {
.query_type = PIPE_QUERY_TIME_ELAPSED,
- .active = FD_STAGE_ALL,
+ .always = true,
.size = sizeof(struct fd5_query_sample),
.resume = timestamp_resume,
.pause = timestamp_pause,
@@ -245,7 +242,7 @@ static const struct fd_acc_sample_provider time_elapsed = {
static const struct fd_acc_sample_provider timestamp = {
.query_type = PIPE_QUERY_TIMESTAMP,
- .active = FD_STAGE_ALL,
+ .always = true,
.size = sizeof(struct fd5_query_sample),
.resume = timestamp_resume,
.pause = timestamp_pause,
@@ -366,7 +363,7 @@ perfcntr_accumulate_result(struct fd_acc_query *aq, void *buf,
static const struct fd_acc_sample_provider perfcntr = {
.query_type = FD_QUERY_FIRST_PERFCNTR,
- .active = FD_STAGE_ALL,
+ .always = true,
.resume = perfcntr_resume,
.pause = perfcntr_pause,
.result = perfcntr_accumulate_result,
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_query.c b/src/gallium/drivers/freedreno/a6xx/fd6_query.c
index 6354e037f39..90b93288d2a 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_query.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_query.c
@@ -134,7 +134,6 @@ occlusion_predicate_result(struct fd_acc_query *aq, void *buf,
static const struct fd_acc_sample_provider occlusion_counter = {
.query_type = PIPE_QUERY_OCCLUSION_COUNTER,
- .active = FD_STAGE_DRAW,
.size = sizeof(struct fd6_query_sample),
.resume = occlusion_resume,
.pause = occlusion_pause,
@@ -143,7 +142,6 @@ static const struct fd_acc_sample_provider occlusion_counter = {
static const struct fd_acc_sample_provider occlusion_predicate = {
.query_type = PIPE_QUERY_OCCLUSION_PREDICATE,
- .active = FD_STAGE_DRAW,
.size = sizeof(struct fd6_query_sample),
.resume = occlusion_resume,
.pause = occlusion_pause,
@@ -152,7 +150,6 @@ static const struct fd_acc_sample_provider occlusion_predicate = {
static const struct fd_acc_sample_provider occlusion_predicate_conservative = {
.query_type = PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE,
- .active = FD_STAGE_DRAW,
.size = sizeof(struct fd6_query_sample),
.resume = occlusion_resume,
.pause = occlusion_pause,
@@ -235,7 +232,7 @@ timestamp_accumulate_result(struct fd_acc_query *aq, void *buf,
static const struct fd_acc_sample_provider time_elapsed = {
.query_type = PIPE_QUERY_TIME_ELAPSED,
- .active = FD_STAGE_ALL,
+ .always = true,
.size = sizeof(struct fd6_query_sample),
.resume = timestamp_resume,
.pause = time_elapsed_pause,
@@ -251,7 +248,7 @@ static const struct fd_acc_sample_provider time_elapsed = {
static const struct fd_acc_sample_provider timestamp = {
.query_type = PIPE_QUERY_TIMESTAMP,
- .active = FD_STAGE_ALL,
+ .always = true,
.size = sizeof(struct fd6_query_sample),
.resume = timestamp_resume,
.pause = timestamp_pause,
@@ -377,7 +374,6 @@ primitives_generated_result(struct fd_acc_query *aq, void *buf,
static const struct fd_acc_sample_provider primitives_generated = {
.query_type = PIPE_QUERY_PRIMITIVES_GENERATED,
- .active = FD_STAGE_DRAW,
.size = sizeof(struct fd6_primitives_sample),
.resume = primitives_generated_resume,
.pause = primitives_generated_pause,
@@ -432,7 +428,6 @@ primitives_emitted_result(struct fd_acc_query *aq, void *buf,
static const struct fd_acc_sample_provider primitives_emitted = {
.query_type = PIPE_QUERY_PRIMITIVES_EMITTED,
- .active = FD_STAGE_DRAW,
.size = sizeof(struct fd6_primitives_sample),
.resume = primitives_emitted_resume,
.pause = primitives_emitted_pause,
@@ -553,7 +548,7 @@ perfcntr_accumulate_result(struct fd_acc_query *aq, void *buf,
static const struct fd_acc_sample_provider perfcntr = {
.query_type = FD_QUERY_FIRST_PERFCNTR,
- .active = FD_STAGE_ALL,
+ .always = true,
.resume = perfcntr_resume,
.pause = perfcntr_pause,
.result = perfcntr_accumulate_result,
diff --git a/src/gallium/drivers/freedreno/freedreno_blitter.c b/src/gallium/drivers/freedreno/freedreno_blitter.c
index 63906c3bba5..237e86f3a76 100644
--- a/src/gallium/drivers/freedreno/freedreno_blitter.c
+++ b/src/gallium/drivers/freedreno/freedreno_blitter.c
@@ -120,8 +120,6 @@ fd_blitter_pipe_begin(struct fd_context *ctx, bool render_cond, bool discard,
static void
fd_blitter_pipe_end(struct fd_context *ctx)
{
- if (ctx->batch)
- fd_batch_set_stage(ctx->batch, FD_STAGE_NULL);
ctx->in_discard_blit = false;
}
diff --git a/src/gallium/drivers/freedreno/freedreno_context.c b/src/gallium/drivers/freedreno/freedreno_context.c
index fc7ecff0e7d..bc2b1455c61 100644
--- a/src/gallium/drivers/freedreno/freedreno_context.c
+++ b/src/gallium/drivers/freedreno/freedreno_context.c
@@ -367,6 +367,7 @@ fd_context_init(struct fd_context *ctx, struct pipe_screen *pscreen,
* set some state:
*/
ctx->sample_mask = 0xffff;
+ ctx->active_queries = true;
pctx = &ctx->base;
pctx->screen = pscreen;
diff --git a/src/gallium/drivers/freedreno/freedreno_context.h b/src/gallium/drivers/freedreno/freedreno_context.h
index e2edf15daa9..f724d7b6840 100644
--- a/src/gallium/drivers/freedreno/freedreno_context.h
+++ b/src/gallium/drivers/freedreno/freedreno_context.h
@@ -207,6 +207,11 @@ struct fd_context {
*/
bool update_active_queries;
+ /* Current state of pctx->set_active_query_state() (i.e. "should drawing
+ * be counted against non-perfcounter queries")
+ */
+ bool active_queries;
+
/* table with PIPE_PRIM_MAX entries mapping PIPE_PRIM_x to
* DI_PT_x value to use for draw initiator. There are some
* slight differences between generation:
@@ -468,15 +473,6 @@ fd_batch_set_stage(struct fd_batch *batch, enum fd_render_stage stage)
{
struct fd_context *ctx = batch->ctx;
- /* special case: internal blits (like mipmap level generation)
- * go through normal draw path (via util_blitter_blit()).. but
- * we need to ignore the FD_STAGE_DRAW which will be set, so we
- * don't enable queries which should be paused during internal
- * blits:
- */
- if (batch->stage == FD_STAGE_BLIT && stage != FD_STAGE_NULL)
- stage = FD_STAGE_BLIT;
-
if (ctx->query_set_stage)
ctx->query_set_stage(batch, stage);
diff --git a/src/gallium/drivers/freedreno/freedreno_query.c b/src/gallium/drivers/freedreno/freedreno_query.c
index 1ac7e1cdd4b..010d01bc385 100644
--- a/src/gallium/drivers/freedreno/freedreno_query.c
+++ b/src/gallium/drivers/freedreno/freedreno_query.c
@@ -176,8 +176,11 @@ fd_get_driver_query_group_info(struct pipe_screen *pscreen, unsigned index,
}
static void
-fd_set_active_query_state(struct pipe_context *pipe, bool enable)
+fd_set_active_query_state(struct pipe_context *pctx, bool enable)
{
+ struct fd_context *ctx = fd_context(pctx);
+ ctx->active_queries = enable;
+ ctx->update_active_queries = true;
}
static enum pipe_driver_query_type
diff --git a/src/gallium/drivers/freedreno/freedreno_query_acc.c b/src/gallium/drivers/freedreno/freedreno_query_acc.c
index 3bcf9ac964e..46efe61aae9 100644
--- a/src/gallium/drivers/freedreno/freedreno_query_acc.c
+++ b/src/gallium/drivers/freedreno/freedreno_query_acc.c
@@ -32,13 +32,6 @@
#include "freedreno_resource.h"
#include "freedreno_util.h"
-
-static bool
-is_active(struct fd_acc_query *aq, enum fd_render_stage stage)
-{
- return !!(aq->provider->active & stage);
-}
-
static void
fd_acc_destroy_query(struct fd_context *ctx, struct fd_query *q)
{
@@ -245,7 +238,8 @@ fd_acc_query_set_stage(struct fd_batch *batch, enum fd_render_stage stage)
LIST_FOR_EACH_ENTRY(aq, &ctx->acc_active_queries, node) {
bool batch_change = aq->batch != batch;
bool was_active = aq->batch != NULL;
- bool now_active = is_active(aq, stage);
+ bool now_active = stage != FD_STAGE_NULL &&
+ (ctx->active_queries || aq->provider->always);
if (was_active && (!now_active || batch_change))
fd_acc_query_pause(aq);
diff --git a/src/gallium/drivers/freedreno/freedreno_query_acc.h b/src/gallium/drivers/freedreno/freedreno_query_acc.h
index 15d5b880eaf..2092aba4ff3 100644
--- a/src/gallium/drivers/freedreno/freedreno_query_acc.h
+++ b/src/gallium/drivers/freedreno/freedreno_query_acc.h
@@ -59,8 +59,8 @@ struct fd_acc_query;
struct fd_acc_sample_provider {
unsigned query_type;
- /* stages applicable to the query type: */
- enum fd_render_stage active;
+ /* Set if the provider should still count while !ctx->active_queries */
+ bool always;
unsigned size;
diff --git a/src/gallium/drivers/freedreno/freedreno_query_hw.c b/src/gallium/drivers/freedreno/freedreno_query_hw.c
index 8d44fd4a795..961e9c607d2 100644
--- a/src/gallium/drivers/freedreno/freedreno_query_hw.c
+++ b/src/gallium/drivers/freedreno/freedreno_query_hw.c
@@ -379,6 +379,15 @@ fd_hw_query_prepare_tile(struct fd_batch *batch, uint32_t n,
void
fd_hw_query_set_stage(struct fd_batch *batch, enum fd_render_stage stage)
{
+ /* special case: internal blits (like mipmap level generation)
+ * go through normal draw path (via util_blitter_blit()).. but
+ * we need to ignore the FD_STAGE_DRAW which will be set, so we
+ * don't enable queries which should be paused during internal
+ * blits:
+ */
+ if (batch->stage == FD_STAGE_BLIT && stage != FD_STAGE_NULL)
+ stage = FD_STAGE_BLIT;
+
if (stage != batch->stage) {
struct fd_hw_query *hq;
LIST_FOR_EACH_ENTRY(hq, &batch->ctx->hw_active_queries, list) {