At least GC2000 seems to push some dirt from the PE color cache into the last bound render target when drawing depth only. Newer cores seem to behave properly and don't do this, but I have found no way to fix it on GC2000. Flushes and stalls don't seem to make any difference.
In order to stop the core from pushing the dirt into a precious real render target, plug in dummy buffer when rendering without a color buffer. Signed-off-by: Lucas Stach <l.st...@pengutronix.de> --- src/gallium/drivers/etnaviv/etnaviv_context.c | 13 +++++++++++++ src/gallium/drivers/etnaviv/etnaviv_context.h | 3 +++ src/gallium/drivers/etnaviv/etnaviv_state.c | 5 +++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c index 3038d210e109..1c305d82a0fc 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_context.c +++ b/src/gallium/drivers/etnaviv/etnaviv_context.c @@ -60,6 +60,9 @@ etna_context_destroy(struct pipe_context *pctx) { struct etna_context *ctx = etna_context(pctx); + if (ctx->dummy_rt) + etna_bo_del(ctx->dummy_rt); + if (ctx->primconvert) util_primconvert_destroy(ctx->primconvert); @@ -486,6 +489,16 @@ etna_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags) slab_create_child(&ctx->transfer_pool, &screen->transfer_pool); list_inithead(&ctx->active_hw_queries); + /* create dummy RT buffer, used when rendering with no color buffer */ + ctx->dummy_rt = etna_bo_new(ctx->screen->dev, 64 * 64 * 4, + DRM_ETNA_GEM_CACHE_WC); + if (!ctx->dummy_rt) + goto fail; + + ctx->dummy_rt_reloc.bo = ctx->dummy_rt; + ctx->dummy_rt_reloc.offset = 0; + ctx->dummy_rt_reloc.flags = ETNA_RELOC_READ | ETNA_RELOC_WRITE; + return pctx; fail: diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.h b/src/gallium/drivers/etnaviv/etnaviv_context.h index 584caa77080b..6ad9f3431e15 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_context.h +++ b/src/gallium/drivers/etnaviv/etnaviv_context.h @@ -190,6 +190,9 @@ struct etna_context { /* list of active hardware queries */ struct list_head active_hw_queries; + + struct etna_bo *dummy_rt; + struct etna_reloc dummy_rt_reloc; }; static inline struct etna_context * diff --git a/src/gallium/drivers/etnaviv/etnaviv_state.c b/src/gallium/drivers/etnaviv/etnaviv_state.c index 87ba10b0dc98..006bf3016812 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_state.c +++ b/src/gallium/drivers/etnaviv/etnaviv_state.c @@ -191,8 +191,9 @@ etna_set_framebuffer_state(struct pipe_context *pctx, cs->TS_COLOR_STATUS_BASE.bo = NULL; cs->TS_COLOR_SURFACE_BASE.bo = NULL; - for (int i = 0; i < ETNA_MAX_PIXELPIPES; i++) - cs->PE_PIPE_COLOR_ADDR[i].bo = NULL; + cs->PE_COLOR_ADDR = ctx->dummy_rt_reloc; + for (int i = 0; i < ctx->specs.pixel_pipes; i++) + cs->PE_PIPE_COLOR_ADDR[i] = ctx->dummy_rt_reloc; } if (sv->zsbuf != NULL) { -- 2.19.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev