When creating a VkSurface for X11, we created the underlying VkImage by calling anv_image_create() and passing driver-private info to it. We can now accomplish the same thing without driver-private info, using VK_MESAX_external_image_dma_buf.
In anv_wsi.c, replace the combo of anv_image_create() + struct anv_image_create_info with anv_CreateImage() + VkExportImageDmaBufInfoMESAX No intended change in behavior. --- src/intel/vulkan/anv_wsi.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c index 4236ee14909..ba50155a868 100644 --- a/src/intel/vulkan/anv_wsi.c +++ b/src/intel/vulkan/anv_wsi.c @@ -155,11 +155,7 @@ x11_anv_wsi_image_create(VkDevice device_h, struct anv_image *image; VkResult result; - result = anv_image_create(anv_device_to_handle(device), - &(struct anv_image_create_info) { - .isl_tiling_flags = ISL_TILING_X_BIT, - .stride = 0, - .vk_info = + result = anv_CreateImage(anv_device_to_handle(device), &(VkImageCreateInfo) { .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, .imageType = VK_IMAGE_TYPE_2D, @@ -177,7 +173,18 @@ x11_anv_wsi_image_create(VkDevice device_h, .usage = (pCreateInfo->imageUsage | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT), .flags = 0, - }}, + .pNext = + &(VkExternalMemoryImageCreateInfoKHX) { + .sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_KHX, + .handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_MESAX, + .pNext = + &(VkExportImageDmaBufInfoMESAX) { + .sType = VK_STRUCTURE_TYPE_EXPORT_IMAGE_DMA_BUF_INFO_MESAX, + .drmFormatModifierCount = 1, + .pDrmFormatModifiers = (uint64_t[]) { + I915_FORMAT_MOD_X_TILED, + }, + }}}, NULL, &image_h); if (result != VK_SUCCESS) -- 2.12.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev