[Mesa-dev] [PATCH 07/11] i965/miptree: Delete MIPTREE_LAYOUT_FOR_SCANOUT

Jason Ekstrand jason at jlekstrand.net
Wed Aug 2 20:35:32 UTC 2017


The flag hasn't affected actual surface layout for some time.  The only
purpose it served was to set bo->cache_coherent = false on the BO used
to create the miptree.  This is fairly silly because we can just set
that directly from the caller where it makes much more sense.
---
 src/mesa/drivers/dri/i965/brw_context.c       |  8 +++++++-
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 12 ++++++++----
 src/mesa/drivers/dri/i965/intel_mipmap_tree.h |  2 --
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index d0b22d4..c3c4d80 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -1518,12 +1518,18 @@ intel_process_dri2_buffer(struct brw_context *brw,
                                   drawable->h,
                                   1,
                                   buffer->pitch,
-                                  MIPTREE_LAYOUT_FOR_SCANOUT);
+                                  0);
    if (!mt) {
       brw_bo_unreference(bo);
       return;
    }
 
+   /* We got this BO from X11.  We cana't assume that we have coherent texture
+    * access because X may suddenly decide to use it for scan-out which would
+    * destroy coherency.
+    */
+   bo->cache_coherent = false;
+
    if (!intel_update_winsys_renderbuffer_miptree(brw, rb, mt,
                                                  drawable->w, drawable->h,
                                                  buffer->pitch)) {
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index d1cba46..910bb46 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -719,9 +719,6 @@ miptree_create(struct brw_context *brw,
 
    mt->etc_format = etc_format;
 
-   if (layout_flags & MIPTREE_LAYOUT_FOR_SCANOUT)
-      mt->bo->cache_coherent = false;
-
    if (!(layout_flags & MIPTREE_LAYOUT_DISABLE_AUX))
       intel_miptree_choose_aux_usage(brw, mt);
 
@@ -941,7 +938,7 @@ intel_miptree_create_for_dri_image(struct brw_context *brw,
     * used for scanout so we need to flag that appropriately.
     */
    const uint32_t mt_layout_flags =
-      is_winsys_image ? MIPTREE_LAYOUT_FOR_SCANOUT : MIPTREE_LAYOUT_DISABLE_AUX;
+      is_winsys_image ? 0 : MIPTREE_LAYOUT_DISABLE_AUX;
 
    /* Disable creation of the texture's aux buffers because the driver exposes
     * no EGL API to manage them. That is, there is no API for resolving the aux
@@ -974,6 +971,13 @@ 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.
+    */
+   if (is_winsys_image)
+      image->bo->cache_coherent = false;
+
    if (!intel_miptree_alloc_aux(brw, mt)) {
       intel_miptree_release(&mt);
       return NULL;
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
index 534ed6c..7636172 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
@@ -356,8 +356,6 @@ enum {
    MIPTREE_LAYOUT_TILING_NONE              = 1 << 6,
    MIPTREE_LAYOUT_TILING_ANY               = MIPTREE_LAYOUT_TILING_Y |
                                              MIPTREE_LAYOUT_TILING_NONE,
-
-   MIPTREE_LAYOUT_FOR_SCANOUT              = 1 << 7,
 };
 
 struct intel_mipmap_tree *intel_miptree_create(struct brw_context *brw,
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list