minigbm: Add FRONT_RENDERING flag
Add a flag to indicate that a buffer will be used for front-buffer (low-
latency) rendering. We need to avoid using framebuffer compression in
this case, as the compression data and pixel data can be transiently out
of sync, resulting in corrupted display.
BUG=b:168868719
TEST=None
Change-Id: I08e6444aba99a5f694d010372277de775bc56fd4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/2450927
Tested-by: Rob Clark <robdclark@chromium.org>
Auto-Submit: Rob Clark <robdclark@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Rob Clark <robdclark@chromium.org>
diff --git a/msm.c b/msm.c
index cdc915d..b057a63 100644
--- a/msm.c
+++ b/msm.c
@@ -223,7 +223,14 @@
struct format_metadata metadata;
uint64_t render_use_flags = BO_USE_RENDER_MASK | BO_USE_SCANOUT;
uint64_t texture_use_flags = BO_USE_TEXTURE_MASK | BO_USE_HW_VIDEO_DECODER;
- uint64_t sw_flags = (BO_USE_RENDERSCRIPT | BO_USE_SW_MASK | BO_USE_LINEAR);
+ /*
+ * NOTE: we actually could use tiled in the BO_USE_FRONT_RENDERING case,
+ * if we had a modifier for tiled-but-not-compressed. But we *cannot* use
+ * compressed in this case because the UBWC flags/meta data can be out of
+ * sync with pixel data while the GPU is writing a frame out to memory.
+ */
+ uint64_t sw_flags = (BO_USE_RENDERSCRIPT | BO_USE_SW_MASK |
+ BO_USE_LINEAR | BO_USE_FRONT_RENDERING);
drv_add_combinations(drv, render_target_formats, ARRAY_SIZE(render_target_formats),
&LINEAR_METADATA, render_use_flags);