[Mesa-dev] [RFC PATCH v1 26/30] RFC: anv: Support vkGetImageSubresourceLayout with modifiers

Chad Versace chadversary at chromium.org
Tue Nov 7 14:48:07 UTC 2017


Incremental implementation of VK_EXT_image_drm_format_modifier.
---
 src/intel/vulkan/anv_image.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index 8d434293124..ec6cdbc6168 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -757,9 +757,22 @@ void anv_GetImageSubresourceLayout(
 
    layout->offset = surface->offset;
    layout->rowPitch = surface->isl.row_pitch;
-   layout->depthPitch = isl_surf_get_array_pitch(&surface->isl);
-   layout->arrayPitch = isl_surf_get_array_pitch(&surface->isl);
    layout->size = surface->isl.size;
+
+   if (image->tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT &&
+       image->drm_format_mod != DRM_FORMAT_MOD_LINEAR) {
+      /* We currently support DRM format modifiers on tiled images only when
+       * the image is "simple".
+       */
+      assert(image->levels == 1);
+      assert(image->array_size == 1);
+      assert(image->samples == 1);
+      layout->depthPitch = 0;
+      layout->arrayPitch = 0;
+   } else {
+      layout->depthPitch = isl_surf_get_array_pitch(&surface->isl);
+      layout->arrayPitch = isl_surf_get_array_pitch(&surface->isl);
+   }
 }
 
 /**
-- 
2.13.0



More information about the mesa-dev mailing list