[Mesa-stable] [PATCH 4/4] i965: Set tiling on BOs imported with modifiers

Jason Ekstrand jason at jlekstrand.net
Fri Jan 12 01:40:53 UTC 2018


We need this to ensure that GTT maps work on buffers we get from Vulkan
on the off chance that someone does a readpixels or something.  Soon, we
will be removing GTT maps from i965 entirely and this can be reverted.
None the less, it's needed for stable.

Cc: mesa-stable at lists.freedesktop.org
---
 src/mesa/drivers/dri/i965/intel_screen.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index b563bbf..b4a6ef5 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -1159,6 +1159,18 @@ intel_create_image_from_fds_common(__DRIscreen *dri_screen,
       intel_image_warn_if_unaligned(image, __func__);
    }
 
+   if (modifier != DRM_FORMAT_MOD_INVALID) {
+      /* If the image has a modifier, the tiling is ignored and the one from
+       * the modifier is used.  However, we still need to be able to use GTT
+       * maps at times so we need the modifier to be correct.  This function
+       * will assert-fail if BO is already marked as tiled and the tiling we
+       * try set is different from the one already set on the BO.
+       */
+      brw_bo_set_tiling(image->bo,
+                        isl_tiling_to_i915_tiling(mod_info->tiling),
+                        image->strides[0]);
+   }
+
    return image;
 }
 
-- 
2.5.0.400.gff86faf



More information about the mesa-stable mailing list