i965: Set tiling on BOs imported with modifiers
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 12 Jan 2018 01:33:36 +0000 (17:33 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 22 Jan 2018 07:07:18 +0000 (23:07 -0800)
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.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
src/mesa/drivers/dri/i965/intel_screen.c

index 9dbda5142e5f23bfc75fbb484e8aaa4a793183b0..a4e34e9f2cf43907a75f31f9ebfea21e52807492 100644 (file)
@@ -1032,7 +1032,16 @@ intel_create_image_from_fds_common(__DRIscreen *dri_screen,
 
    image->planar_format = f;
 
-   image->bo = brw_bo_gem_create_from_prime(screen->bufmgr, fds[0]);
+   if (modifier != DRM_FORMAT_MOD_INVALID) {
+      const struct isl_drm_modifier_info *mod_info =
+         isl_drm_modifier_get_info(modifier);
+      uint32_t tiling = isl_tiling_to_i915_tiling(mod_info->tiling);
+      image->bo = brw_bo_gem_create_from_prime_tiled(screen->bufmgr, fds[0],
+                                                     tiling, strides[0]);
+   } else {
+      image->bo = brw_bo_gem_create_from_prime(screen->bufmgr, fds[0]);
+   }
+
    if (image->bo == NULL) {
       free(image);
       return NULL;