[v2,4/9] panfrost: Bail out early when new and current FB states are equal

Submitted by Boris Brezillon on Aug. 2, 2019, 5:18 p.m.

Details

Message ID 20190802171848.7805-5-boris.brezillon@collabora.com
State New
Headers show
Series "panfrost: Allocate the polygon lists on-demand" ( rev: 2 ) in Mesa

Not browsing as part of any series.

Commit Message

Boris Brezillon Aug. 2, 2019, 5:18 p.m.
If the current FB matches the new one there's nothing to be done in
panfrost_set_framebuffer_state(). By bailing out early in that case we
avoid emitting new FB descriptors (the old ones are still valid).

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
---
Changes in v2:
* Add Alyssa's R-b
---
 src/gallium/drivers/panfrost/pan_context.c | 4 ++++
 1 file changed, 4 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index a88e6a4607d5..65e6824a9b03 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -2365,6 +2365,10 @@  panfrost_set_framebuffer_state(struct pipe_context *pctx,
         bool is_scanout = panfrost_is_scanout(ctx);
         bool has_draws = job->last_job.gpu;
 
+        /* Bail out early when the current and new states are the same. */
+        if (util_framebuffer_state_equal(&ctx->pipe_framebuffer, fb))
+                return;
+
         if (!ctx->wallpaper_batch && (!is_scanout || has_draws)) {
                 panfrost_flush(pctx, NULL, PIPE_FLUSH_END_OF_FRAME);
         }