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

Chris Wilson chris at chris-wilson.co.uk
Thu Aug 3 08:47:43 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 ced80cb879..a61ba05892 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -697,6 +697,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