panfrost: Don't force early-z with occlusion query

..even if there is no z/s enabled. Fixes
dEQP-GLES31.functional.fbo.no_attachments.* on Midgard.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11123>
This commit is contained in:
Alyssa Rosenzweig 2021-06-04 14:50:53 -04:00 committed by Marge Bot
parent e4592d5651
commit 0d4368b22a
2 changed files with 11 additions and 6 deletions

View file

@ -536,14 +536,16 @@ panfrost_prepare_fs_state(struct panfrost_context *ctx,
else
cfg.properties.midgard.work_register_count = fs->info.work_reg_count;
/* Workaround a hardware errata where early-z cannot be enabled
* when discarding even when the depth buffer is read-only, by
* lying to the hardware about the discard and setting the
* reads tilebuffer? flag to compensate */
/* Hardware quirks around early-zs forcing
* without a depth buffer. Note this breaks
* occlusion queries. */
bool has_oq = ctx->occlusion_query && ctx->active_queries;
bool force_ez_with_discard = !zsa->enabled && !has_oq;
cfg.properties.midgard.shader_reads_tilebuffer =
!zsa->enabled && fs->info.fs.can_discard;
force_ez_with_discard && fs->info.fs.can_discard;
cfg.properties.midgard.shader_contains_discard =
zsa->enabled && fs->info.fs.can_discard;
!force_ez_with_discard && fs->info.fs.can_discard;
}
if (dev->quirks & MIDGARD_SFBD && rt_count > 0) {

View file

@ -1699,6 +1699,7 @@ panfrost_set_active_query_state(struct pipe_context *pipe,
{
struct panfrost_context *ctx = pan_context(pipe);
ctx->active_queries = enable;
ctx->dirty_shader[PIPE_SHADER_FRAGMENT] |= PAN_DIRTY_STAGE_RENDERER;
}
static void
@ -1781,6 +1782,7 @@ panfrost_begin_query(struct pipe_context *pipe, struct pipe_query *q)
query->msaa = (ctx->pipe_framebuffer.samples > 1);
ctx->occlusion_query = query;
ctx->dirty_shader[PIPE_SHADER_FRAGMENT] |= PAN_DIRTY_STAGE_RENDERER;
break;
}
@ -1813,6 +1815,7 @@ panfrost_end_query(struct pipe_context *pipe, struct pipe_query *q)
case PIPE_QUERY_OCCLUSION_PREDICATE:
case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE:
ctx->occlusion_query = NULL;
ctx->dirty_shader[PIPE_SHADER_FRAGMENT] |= PAN_DIRTY_STAGE_RENDERER;
break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
query->end = ctx->prims_generated;