freedreno: Fix detection of being in a blit for acc queries.
The batch might not have stage == FD_STAGE_BLIT set because fd_blitter_pipe_begin was sticking the stage on some random batch (or none at all) rather than the one that would be used in the meta operation. What we actually wanted to be looking at was set_active_query_state(), which is already called by util_blitter and whose state we just needed to track. Fixes piglit occlusion_query_meta_no_fragments. I haven't changed query_hw.c's stage handling to clean the rest up because I don't have a db410c/db820c at home to iterate over the piglit tests. Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4356> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4356>
This commit is contained in:
parent
57d54bcf99
commit
d0b3ccb060
|
@ -151,7 +151,7 @@ perfcntr_accumulate_result(struct fd_acc_query *aq, void *buf,
|
||||||
|
|
||||||
static const struct fd_acc_sample_provider perfcntr = {
|
static const struct fd_acc_sample_provider perfcntr = {
|
||||||
.query_type = FD_QUERY_FIRST_PERFCNTR,
|
.query_type = FD_QUERY_FIRST_PERFCNTR,
|
||||||
.active = FD_STAGE_ALL,
|
.always = true,
|
||||||
.resume = perfcntr_resume,
|
.resume = perfcntr_resume,
|
||||||
.pause = perfcntr_pause,
|
.pause = perfcntr_pause,
|
||||||
.result = perfcntr_accumulate_result,
|
.result = perfcntr_accumulate_result,
|
||||||
|
|
|
@ -134,7 +134,6 @@ occlusion_predicate_result(struct fd_acc_query *aq, void *buf,
|
||||||
|
|
||||||
static const struct fd_acc_sample_provider occlusion_counter = {
|
static const struct fd_acc_sample_provider occlusion_counter = {
|
||||||
.query_type = PIPE_QUERY_OCCLUSION_COUNTER,
|
.query_type = PIPE_QUERY_OCCLUSION_COUNTER,
|
||||||
.active = FD_STAGE_DRAW,
|
|
||||||
.size = sizeof(struct fd5_query_sample),
|
.size = sizeof(struct fd5_query_sample),
|
||||||
.resume = occlusion_resume,
|
.resume = occlusion_resume,
|
||||||
.pause = occlusion_pause,
|
.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 = {
|
static const struct fd_acc_sample_provider occlusion_predicate = {
|
||||||
.query_type = PIPE_QUERY_OCCLUSION_PREDICATE,
|
.query_type = PIPE_QUERY_OCCLUSION_PREDICATE,
|
||||||
.active = FD_STAGE_DRAW,
|
|
||||||
.size = sizeof(struct fd5_query_sample),
|
.size = sizeof(struct fd5_query_sample),
|
||||||
.resume = occlusion_resume,
|
.resume = occlusion_resume,
|
||||||
.pause = occlusion_pause,
|
.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 = {
|
static const struct fd_acc_sample_provider occlusion_predicate_conservative = {
|
||||||
.query_type = PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE,
|
.query_type = PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE,
|
||||||
.active = FD_STAGE_DRAW,
|
|
||||||
.size = sizeof(struct fd5_query_sample),
|
.size = sizeof(struct fd5_query_sample),
|
||||||
.resume = occlusion_resume,
|
.resume = occlusion_resume,
|
||||||
.pause = occlusion_pause,
|
.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 = {
|
static const struct fd_acc_sample_provider time_elapsed = {
|
||||||
.query_type = PIPE_QUERY_TIME_ELAPSED,
|
.query_type = PIPE_QUERY_TIME_ELAPSED,
|
||||||
.active = FD_STAGE_ALL,
|
.always = true,
|
||||||
.size = sizeof(struct fd5_query_sample),
|
.size = sizeof(struct fd5_query_sample),
|
||||||
.resume = timestamp_resume,
|
.resume = timestamp_resume,
|
||||||
.pause = timestamp_pause,
|
.pause = timestamp_pause,
|
||||||
|
@ -245,7 +242,7 @@ static const struct fd_acc_sample_provider time_elapsed = {
|
||||||
|
|
||||||
static const struct fd_acc_sample_provider timestamp = {
|
static const struct fd_acc_sample_provider timestamp = {
|
||||||
.query_type = PIPE_QUERY_TIMESTAMP,
|
.query_type = PIPE_QUERY_TIMESTAMP,
|
||||||
.active = FD_STAGE_ALL,
|
.always = true,
|
||||||
.size = sizeof(struct fd5_query_sample),
|
.size = sizeof(struct fd5_query_sample),
|
||||||
.resume = timestamp_resume,
|
.resume = timestamp_resume,
|
||||||
.pause = timestamp_pause,
|
.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 = {
|
static const struct fd_acc_sample_provider perfcntr = {
|
||||||
.query_type = FD_QUERY_FIRST_PERFCNTR,
|
.query_type = FD_QUERY_FIRST_PERFCNTR,
|
||||||
.active = FD_STAGE_ALL,
|
.always = true,
|
||||||
.resume = perfcntr_resume,
|
.resume = perfcntr_resume,
|
||||||
.pause = perfcntr_pause,
|
.pause = perfcntr_pause,
|
||||||
.result = perfcntr_accumulate_result,
|
.result = perfcntr_accumulate_result,
|
||||||
|
|
|
@ -134,7 +134,6 @@ occlusion_predicate_result(struct fd_acc_query *aq, void *buf,
|
||||||
|
|
||||||
static const struct fd_acc_sample_provider occlusion_counter = {
|
static const struct fd_acc_sample_provider occlusion_counter = {
|
||||||
.query_type = PIPE_QUERY_OCCLUSION_COUNTER,
|
.query_type = PIPE_QUERY_OCCLUSION_COUNTER,
|
||||||
.active = FD_STAGE_DRAW,
|
|
||||||
.size = sizeof(struct fd6_query_sample),
|
.size = sizeof(struct fd6_query_sample),
|
||||||
.resume = occlusion_resume,
|
.resume = occlusion_resume,
|
||||||
.pause = occlusion_pause,
|
.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 = {
|
static const struct fd_acc_sample_provider occlusion_predicate = {
|
||||||
.query_type = PIPE_QUERY_OCCLUSION_PREDICATE,
|
.query_type = PIPE_QUERY_OCCLUSION_PREDICATE,
|
||||||
.active = FD_STAGE_DRAW,
|
|
||||||
.size = sizeof(struct fd6_query_sample),
|
.size = sizeof(struct fd6_query_sample),
|
||||||
.resume = occlusion_resume,
|
.resume = occlusion_resume,
|
||||||
.pause = occlusion_pause,
|
.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 = {
|
static const struct fd_acc_sample_provider occlusion_predicate_conservative = {
|
||||||
.query_type = PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE,
|
.query_type = PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE,
|
||||||
.active = FD_STAGE_DRAW,
|
|
||||||
.size = sizeof(struct fd6_query_sample),
|
.size = sizeof(struct fd6_query_sample),
|
||||||
.resume = occlusion_resume,
|
.resume = occlusion_resume,
|
||||||
.pause = occlusion_pause,
|
.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 = {
|
static const struct fd_acc_sample_provider time_elapsed = {
|
||||||
.query_type = PIPE_QUERY_TIME_ELAPSED,
|
.query_type = PIPE_QUERY_TIME_ELAPSED,
|
||||||
.active = FD_STAGE_ALL,
|
.always = true,
|
||||||
.size = sizeof(struct fd6_query_sample),
|
.size = sizeof(struct fd6_query_sample),
|
||||||
.resume = timestamp_resume,
|
.resume = timestamp_resume,
|
||||||
.pause = time_elapsed_pause,
|
.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 = {
|
static const struct fd_acc_sample_provider timestamp = {
|
||||||
.query_type = PIPE_QUERY_TIMESTAMP,
|
.query_type = PIPE_QUERY_TIMESTAMP,
|
||||||
.active = FD_STAGE_ALL,
|
.always = true,
|
||||||
.size = sizeof(struct fd6_query_sample),
|
.size = sizeof(struct fd6_query_sample),
|
||||||
.resume = timestamp_resume,
|
.resume = timestamp_resume,
|
||||||
.pause = timestamp_pause,
|
.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 = {
|
static const struct fd_acc_sample_provider primitives_generated = {
|
||||||
.query_type = PIPE_QUERY_PRIMITIVES_GENERATED,
|
.query_type = PIPE_QUERY_PRIMITIVES_GENERATED,
|
||||||
.active = FD_STAGE_DRAW,
|
|
||||||
.size = sizeof(struct fd6_primitives_sample),
|
.size = sizeof(struct fd6_primitives_sample),
|
||||||
.resume = primitives_generated_resume,
|
.resume = primitives_generated_resume,
|
||||||
.pause = primitives_generated_pause,
|
.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 = {
|
static const struct fd_acc_sample_provider primitives_emitted = {
|
||||||
.query_type = PIPE_QUERY_PRIMITIVES_EMITTED,
|
.query_type = PIPE_QUERY_PRIMITIVES_EMITTED,
|
||||||
.active = FD_STAGE_DRAW,
|
|
||||||
.size = sizeof(struct fd6_primitives_sample),
|
.size = sizeof(struct fd6_primitives_sample),
|
||||||
.resume = primitives_emitted_resume,
|
.resume = primitives_emitted_resume,
|
||||||
.pause = primitives_emitted_pause,
|
.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 = {
|
static const struct fd_acc_sample_provider perfcntr = {
|
||||||
.query_type = FD_QUERY_FIRST_PERFCNTR,
|
.query_type = FD_QUERY_FIRST_PERFCNTR,
|
||||||
.active = FD_STAGE_ALL,
|
.always = true,
|
||||||
.resume = perfcntr_resume,
|
.resume = perfcntr_resume,
|
||||||
.pause = perfcntr_pause,
|
.pause = perfcntr_pause,
|
||||||
.result = perfcntr_accumulate_result,
|
.result = perfcntr_accumulate_result,
|
||||||
|
|
|
@ -120,8 +120,6 @@ fd_blitter_pipe_begin(struct fd_context *ctx, bool render_cond, bool discard,
|
||||||
static void
|
static void
|
||||||
fd_blitter_pipe_end(struct fd_context *ctx)
|
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;
|
ctx->in_discard_blit = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -367,6 +367,7 @@ fd_context_init(struct fd_context *ctx, struct pipe_screen *pscreen,
|
||||||
* set some state:
|
* set some state:
|
||||||
*/
|
*/
|
||||||
ctx->sample_mask = 0xffff;
|
ctx->sample_mask = 0xffff;
|
||||||
|
ctx->active_queries = true;
|
||||||
|
|
||||||
pctx = &ctx->base;
|
pctx = &ctx->base;
|
||||||
pctx->screen = pscreen;
|
pctx->screen = pscreen;
|
||||||
|
|
|
@ -207,6 +207,11 @@ struct fd_context {
|
||||||
*/
|
*/
|
||||||
bool update_active_queries;
|
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
|
/* table with PIPE_PRIM_MAX entries mapping PIPE_PRIM_x to
|
||||||
* DI_PT_x value to use for draw initiator. There are some
|
* DI_PT_x value to use for draw initiator. There are some
|
||||||
* slight differences between generation:
|
* 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;
|
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)
|
if (ctx->query_set_stage)
|
||||||
ctx->query_set_stage(batch, stage);
|
ctx->query_set_stage(batch, stage);
|
||||||
|
|
||||||
|
|
|
@ -176,8 +176,11 @@ fd_get_driver_query_group_info(struct pipe_screen *pscreen, unsigned index,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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
|
static enum pipe_driver_query_type
|
||||||
|
|
|
@ -32,13 +32,6 @@
|
||||||
#include "freedreno_resource.h"
|
#include "freedreno_resource.h"
|
||||||
#include "freedreno_util.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
|
static void
|
||||||
fd_acc_destroy_query(struct fd_context *ctx, struct fd_query *q)
|
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) {
|
LIST_FOR_EACH_ENTRY(aq, &ctx->acc_active_queries, node) {
|
||||||
bool batch_change = aq->batch != batch;
|
bool batch_change = aq->batch != batch;
|
||||||
bool was_active = aq->batch != NULL;
|
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))
|
if (was_active && (!now_active || batch_change))
|
||||||
fd_acc_query_pause(aq);
|
fd_acc_query_pause(aq);
|
||||||
|
|
|
@ -59,8 +59,8 @@ struct fd_acc_query;
|
||||||
struct fd_acc_sample_provider {
|
struct fd_acc_sample_provider {
|
||||||
unsigned query_type;
|
unsigned query_type;
|
||||||
|
|
||||||
/* stages applicable to the query type: */
|
/* Set if the provider should still count while !ctx->active_queries */
|
||||||
enum fd_render_stage active;
|
bool always;
|
||||||
|
|
||||||
unsigned size;
|
unsigned size;
|
||||||
|
|
||||||
|
|
|
@ -379,6 +379,15 @@ fd_hw_query_prepare_tile(struct fd_batch *batch, uint32_t n,
|
||||||
void
|
void
|
||||||
fd_hw_query_set_stage(struct fd_batch *batch, enum fd_render_stage stage)
|
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) {
|
if (stage != batch->stage) {
|
||||||
struct fd_hw_query *hq;
|
struct fd_hw_query *hq;
|
||||||
LIST_FOR_EACH_ENTRY(hq, &batch->ctx->hw_active_queries, list) {
|
LIST_FOR_EACH_ENTRY(hq, &batch->ctx->hw_active_queries, list) {
|
||||||
|
|
Loading…
Reference in New Issue