[Mesa-dev] [PATCH 2/3] panfrost: Draw the wallpaper when only depth/stencil bufs are cleared

Boris Brezillon boris.brezillon at collabora.com
Fri Sep 20 14:53:38 UTC 2019


When only the depth/stencil bufs are cleared, we should make sure the
color content is reloaded into the tile buffers if we want to preserve
their content.

Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
---
There might be a more optimal solution to do that (like not passing the
color bufs to the fragment job?), but this solution seems to fix a few
deqp tests.
---
 src/gallium/drivers/panfrost/pan_context.c |  2 +-
 src/gallium/drivers/panfrost/pan_job.c     | 16 ++++++++++++++--
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index b2f2a9da7a51..c99bf1b26ce7 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -1333,7 +1333,7 @@ panfrost_queue_draw(struct panfrost_context *ctx)
 
         if (rasterizer_discard)
                 panfrost_scoreboard_queue_vertex_job(batch, vertex, FALSE);
-        else if (ctx->wallpaper_batch)
+        else if (ctx->wallpaper_batch && batch->first_tiler.gpu)
                 panfrost_scoreboard_queue_fused_job_prepend(batch, vertex, tiler);
         else
                 panfrost_scoreboard_queue_fused_job(batch, vertex, tiler);
diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c
index 4ec2aa0565d7..a2df31f96f00 100644
--- a/src/gallium/drivers/panfrost/pan_job.c
+++ b/src/gallium/drivers/panfrost/pan_job.c
@@ -698,10 +698,23 @@ panfrost_batch_get_tiler_dummy(struct panfrost_batch *batch)
 static void
 panfrost_batch_draw_wallpaper(struct panfrost_batch *batch)
 {
+        /* Color 0 is cleared, no need to draw the wallpaper.
+         * TODO: MRT wallpapers.
+         */
+        if (batch->clear & PIPE_CLEAR_COLOR0)
+                return;
+
         /* Nothing to reload? TODO: MRT wallpapers */
         if (batch->key.cbufs[0] == NULL)
                 return;
 
+        /* No draw calls, and no clear on the depth/stencil bufs.
+         * Drawing the wallpaper would be useless.
+         */
+        if (!batch->last_tiler.gpu &&
+            !(batch->clear & PIPE_CLEAR_DEPTHSTENCIL))
+                return;
+
         /* Check if the buffer has any content on it worth preserving */
 
         struct pipe_surface *surf = batch->key.cbufs[0];
@@ -923,8 +936,7 @@ panfrost_batch_submit(struct panfrost_batch *batch)
                 goto out;
         }
 
-        if (!batch->clear && batch->last_tiler.gpu)
-                panfrost_batch_draw_wallpaper(batch);
+        panfrost_batch_draw_wallpaper(batch);
 
         panfrost_scoreboard_link_batch(batch);
 
-- 
2.21.0



More information about the mesa-dev mailing list