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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
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;
}
* set some state:
*/
ctx->sample_mask = 0xffff;
+ ctx->active_queries = true;
pctx = &ctx->base;
pctx->screen = pscreen;
*/
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:
{
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);
}
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
#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)
{
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);
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;
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) {