i965: Mark all EGLimages as non-coherent.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 16 Aug 2017 18:15:24 +0000 (11:15 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 18 Aug 2017 23:28:13 +0000 (16:28 -0700)
EGLimages are shared with external users, and we don't know what they're
going to do with them.  They might scan them out.  They might access
them in a way that doesn't work with our explicit clflushing.

It's safest to simply mark them non-coherent.

Chris Wilson caught this problem and wrote a similar (though less
aggressive) patch to solve it; the miptree code has since undergone
a lot of refactoring so I had to rewrite it.

Cc: "17.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
src/mesa/drivers/dri/i965/intel_mipmap_tree.c

index 237ab182712ab4186ffbab40ab0811f03b8179d0..dab60c4b0455d4b0a6238d14694752aadf3b7866 100644 (file)
@@ -1061,12 +1061,10 @@ intel_miptree_create_for_dri_image(struct brw_context *brw,
       }
    }
 
-   /* If this is a window-system image, then we can no longer assume it's
-    * cache-coherent because it may suddenly get scanned out which destroys
-    * coherency.
+   /* Don't assume coherency for imported EGLimages.  We don't know what
+    * external clients are going to do with it.  They may scan it out.
     */
-   if (is_winsys_image)
-      image->bo->cache_coherent = false;
+   image->bo->cache_coherent = false;
 
    return mt;
 }