summaryrefslogtreecommitdiff
path: root/src/vulkan/wsi/wsi_common_drm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vulkan/wsi/wsi_common_drm.c')
-rw-r--r--src/vulkan/wsi/wsi_common_drm.c30
1 files changed, 7 insertions, 23 deletions
diff --git a/src/vulkan/wsi/wsi_common_drm.c b/src/vulkan/wsi/wsi_common_drm.c
index 3a212e1cb35..50a6a6c3e7c 100644
--- a/src/vulkan/wsi/wsi_common_drm.c
+++ b/src/vulkan/wsi/wsi_common_drm.c
@@ -136,6 +136,11 @@ get_modifier_props(const struct wsi_image_info *info, uint64_t modifier)
return NULL;
}
+static VkResult
+wsi_create_native_image_mem(const struct wsi_swapchain *chain,
+ const struct wsi_image_info *info,
+ struct wsi_image *image);
+
VkResult
wsi_configure_native_image(const struct wsi_swapchain *chain,
const VkSwapchainCreateInfoKHR *pCreateInfo,
@@ -270,6 +275,7 @@ wsi_configure_native_image(const struct wsi_swapchain *chain,
}
info->alloc_shm = alloc_shm;
+ info->create_mem = wsi_create_native_image_mem;
return VK_SUCCESS;
@@ -422,13 +428,8 @@ wsi_create_native_image(const struct wsi_swapchain *chain,
uint8_t *(alloc_shm)(struct wsi_image *image, unsigned size),
struct wsi_image *image)
{
- const struct wsi_device *wsi = chain->wsi;
VkResult result;
- memset(image, 0, sizeof(*image));
- for (int i = 0; i < ARRAY_SIZE(image->fds); i++)
- image->fds[i] = -1;
-
struct wsi_image_info info;
result = wsi_configure_native_image(chain, pCreateInfo,
num_modifier_lists,
@@ -437,27 +438,10 @@ wsi_create_native_image(const struct wsi_swapchain *chain,
if (result != VK_SUCCESS)
return result;
- result = wsi->CreateImage(chain->device, &info.create,
- &chain->alloc, &image->image);
- if (result != VK_SUCCESS)
- goto fail;
-
- result = wsi_create_native_image_mem(chain, &info, image);
- if (result != VK_SUCCESS)
- goto fail;
-
- result = wsi->BindImageMemory(chain->device, image->image,
- image->memory, 0);
- if (result != VK_SUCCESS)
- goto fail;
+ result = wsi_create_image(chain, &info, image);
wsi_destroy_image_info(chain, &info);
- return VK_SUCCESS;
-
-fail:
- wsi_destroy_image_info(chain, &info);
- wsi_destroy_image(chain, image);
return result;
}