[Mesa-dev] [PATCH 22/22] i965: Always mark scanout images as not cache-coherent

Chris Wilson chris at chris-wilson.co.uk
Sat Aug 5 09:40:14 UTC 2017


Ensure that any buffer allocated for a scanout image is kept out of the
CPU/LLC cache so as to avoid any visual glitch.

Cc: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/intel_screen.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 3666b65bb6..3e72ab14c8 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -693,6 +693,16 @@ intel_create_image_common(__DRIscreen *dri_screen,
    image->pitch = surf.row_pitch;
    image->modifier = modifier;
 
+   /* When a buffer is transformed into a framebuffer and mapped for use
+    * by scanout (i.e. any sprite plane, scanout, cursor, overlay etc),
+    * it is moved to UC - reads by the display engine are serviced directly
+    * from memory ignoring the CPU/LLC cache. If we leave pixels in the CPU
+    * cache due to mistaken use of WB, that causes screen corruption that
+    * randomly heals over time (due to eventual cache eviction).
+    */
+   if (use & (__DRI_IMAGE_USE_CURSOR | __DRI_IMAGE_USE_SCANOUT))
+      image->bo->cache_coherent = false;
+
    return image;
 }
 
-- 
2.13.3



More information about the mesa-dev mailing list