From 35dc99924aeebf754b01c2dc1a2ced765ec68ca5 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Thu, 28 Jul 2022 14:27:56 -0700 Subject: [PATCH] freedreno: Disable UBWC for frontbuffer rendering Note that glamor would still need to set this new GBM_BO_USE_FRONT_RENDERING flag. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6865 Signed-off-by: Rob Clark Part-of: --- src/gallium/drivers/freedreno/freedreno_resource.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c index 9da8b493754..f310081b8d9 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.c +++ b/src/gallium/drivers/freedreno/freedreno_resource.c @@ -1187,6 +1187,13 @@ get_best_layout(struct fd_screen *screen, struct pipe_resource *prsc, if (FD_DBG(NOUBWC)) ubwc_ok = false; + /* Disallow UBWC for front-buffer rendering. The GPU does not atomically + * write pixel and header data, nor does the display atomically read it. + * The result can be visual corruption (ie. moreso than normal tearing). + */ + if (tmpl->bind & PIPE_BIND_USE_FRONT_RENDERING) + ubwc_ok = false; + if (ubwc_ok && !implicit_modifiers && !drm_find_modifier(DRM_FORMAT_MOD_QCOM_COMPRESSED, modifiers, count)) { perf_debug("%" PRSC_FMT