Mesa (master): etnaviv: resolve tile status when flushing resource

Christian Gmeiner austriancoder at kemper.freedesktop.org
Fri Apr 14 22:15:41 UTC 2017


Module: Mesa
Branch: master
Commit: dda956340ce9f7d04866eb6909455f24fae94724
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=dda956340ce9f7d04866eb6909455f24fae94724

Author: Philipp Zabel <p.zabel at pengutronix.de>
Date:   Wed Apr 12 16:13:37 2017 +0200

etnaviv: resolve tile status when flushing resource

When passing render buffers from EGL clients to a wayland compositor,
the resource tile status must be resolved because otherwise the tile
status is lost in the transfer and cleared parts of the buffer will
contain old contents.

The same applies when sampling directly from a renderable resource.

lst: Add seqno tracking, to skip flush when not needed.

Fixes: aadcb5e94b35 ("etnaviv: enable TS, but disable autodisable")
Signed-off-by: Philipp Zabel <p.zabel at pengutronix.de>
Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner at gmail.com>

---

 src/gallium/drivers/etnaviv/etnaviv_clear_blit.c | 3 +++
 src/gallium/drivers/etnaviv/etnaviv_resource.h   | 8 ++++++++
 2 files changed, 11 insertions(+)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
index a089fed13c..528b57389d 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
@@ -597,6 +597,9 @@ etna_flush_resource(struct pipe_context *pctx, struct pipe_resource *prsc)
        etna_resource_older(etna_resource(rsc->scanout->prime), rsc)) {
       etna_copy_resource(pctx, rsc->scanout->prime, prsc, 0, 0);
       etna_resource(rsc->scanout->prime)->seqno = rsc->seqno;
+   } else if (etna_resource_needs_flush(rsc)) {
+      etna_copy_resource(pctx, prsc, prsc, 0, 0);
+      rsc->flush_seqno = rsc->seqno;
    }
 }
 
diff --git a/src/gallium/drivers/etnaviv/etnaviv_resource.h b/src/gallium/drivers/etnaviv/etnaviv_resource.h
index a6c6a78269..a8d42ee1a0 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_resource.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_resource.h
@@ -61,6 +61,7 @@ struct etna_resource {
    struct pipe_resource base;
    struct renderonly_scanout *scanout;
    uint32_t seqno;
+   uint32_t flush_seqno;
 
    /* only lod 0 used for non-texture buffers */
    /* Layout for surface (tiled, multitiled, split tiled, ...) */
@@ -97,6 +98,13 @@ etna_resource_older(struct etna_resource *a, struct etna_resource *b)
    return (int)(a->seqno - b->seqno) < 0;
 }
 
+/* returns TRUE if the resource needs a resolve to itself */
+static inline bool
+etna_resource_needs_flush(struct etna_resource *res)
+{
+   return (int)(res->seqno - res->flush_seqno) > 0;
+}
+
 /* is the resource only used on the sampler? */
 static inline bool
 etna_resource_sampler_only(const struct pipe_resource *pres)




More information about the mesa-commit mailing list