Mesa (staging/18.2): freedreno: don't flush when new and old pfb is identical
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Oct 29 11:34:05 UTC 2018
Module: Mesa
Branch: staging/18.2
Commit: c4bb9bc069831843159d77a3920f59718874cfc6
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c4bb9bc069831843159d77a3920f59718874cfc6
Author: Rob Clark <robdclark at gmail.com>
Date: Sun Oct 28 10:45:06 2018 -0400
freedreno: don't flush when new and old pfb is identical
In the 'inorder' case (ie. FD_MESA_DEBUG=inorder, or old kernel), if the
u_blitter clear path is used (a3xx, a4xx, and some fallback cases on
newer gens), util_blitter_restore_fb_state() will set_framebuffer_state()
to something that is identical to the current fb state, which triggers
an unnecessary flush, and then eventually an assert:
(gdb) bt
#0 0x0000007fbf24a078 in kill () from /lib64/libc.so.6
#1 0x0000007fbe061278 in _debug_assert_fail (expr=0x7fbe93a820 "!batch->flushed", file=0x7fbe93a628 "../src/gallium/drivers/freedreno/freedreno_batch.c", line=491, function=0x7fbe93a990 <__func__.17380> "fd_batch_check_size") at ../src/gallium/auxiliary/util/u_debug.c:322
#2 0x0000007fbe1ccb8c in fd_batch_check_size (batch=0x55556d5a70) at ../src/gallium/drivers/freedreno/freedreno_batch.c:491
#3 0x0000007fbe1d0e08 in fd_clear (pctx=0x55555c61e0, buffers=5, color=0x55556e388c, depth=1, stencil=0) at ../src/gallium/drivers/freedreno/freedreno_draw.c:463
#4 0x0000007fbe57afa4 in st_Clear (ctx=0x55556e17b0, mask=18) at ../src/mesa/state_tracker/st_cb_clear.c:452
The assert was introduced in 4b847b38ae3, so from a functionality
standpoint this patch fixes that commit. But it should also avoid an
unnecessary flush in the 'inorder' case, fixing a performance bug.
Fixes: 4b847b38ae3 freedreno: make fd_batch a one-shot thing
Signed-off-by: Rob Clark <robdclark at gmail.com>
(cherry picked from commit a61952e7374c3d30cf05765245bf6f5d5fcbe900)
---
src/gallium/drivers/freedreno/freedreno_state.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/gallium/drivers/freedreno/freedreno_state.c b/src/gallium/drivers/freedreno/freedreno_state.c
index 8a2448d219..7d5ca25e68 100644
--- a/src/gallium/drivers/freedreno/freedreno_state.c
+++ b/src/gallium/drivers/freedreno/freedreno_state.c
@@ -213,6 +213,9 @@ fd_set_framebuffer_state(struct pipe_context *pctx,
cso = &ctx->batch->framebuffer;
+ if (util_framebuffer_state_equal(cso, framebuffer))
+ return;
+
util_copy_framebuffer_state(cso, framebuffer);
cso->samples = util_framebuffer_get_num_samples(cso);
More information about the mesa-commit
mailing list