summaryrefslogtreecommitdiffstats
path: root/src/vulkan/wsi/wsi_common_wayland.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vulkan/wsi/wsi_common_wayland.c')
-rw-r--r--src/vulkan/wsi/wsi_common_wayland.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index b93c3d7e0d7..c7c7da64979 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -556,8 +556,7 @@ VkResult wsi_create_wl_surface(const VkAllocationCallbacks *pAllocator,
}
struct wsi_wl_image {
- VkImage image;
- VkDeviceMemory memory;
+ struct wsi_image base;
struct wl_buffer * buffer;
bool busy;
};
@@ -603,7 +602,7 @@ wsi_wl_swapchain_get_images(struct wsi_swapchain *wsi_chain,
}
for (uint32_t i = 0; i < ret_count; i++)
- pSwapchainImages[i] = chain->images[i].image;
+ pSwapchainImages[i] = chain->images[i].base.image;
return result;
}
@@ -727,33 +726,25 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain,
{
VkDevice vk_device = chain->base.device;
VkResult result;
- int fd;
- uint32_t size;
- uint32_t row_pitch;
- uint32_t offset;
+
result = chain->base.image_fns->create_wsi_image(vk_device,
pCreateInfo,
pAllocator,
false,
false,
- &image->image,
- &image->memory,
- &size,
- &offset,
- &row_pitch,
- &fd);
+ &image->base);
if (result != VK_SUCCESS)
return result;
image->buffer = wl_drm_create_prime_buffer(chain->drm_wrapper,
- fd, /* name */
+ image->base.fd, /* name */
chain->extent.width,
chain->extent.height,
chain->drm_format,
- offset,
- row_pitch,
+ image->base.offset,
+ image->base.row_pitch,
0, 0, 0, 0 /* unused */);
- close(fd);
+ close(image->base.fd);
if (!image->buffer)
goto fail_image;
@@ -763,8 +754,7 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain,
return VK_SUCCESS;
fail_image:
- chain->base.image_fns->free_wsi_image(vk_device, pAllocator,
- image->image, image->memory);
+ chain->base.image_fns->free_wsi_image(vk_device, pAllocator, &image->base);
return result;
}
@@ -779,8 +769,7 @@ wsi_wl_swapchain_destroy(struct wsi_swapchain *wsi_chain,
if (chain->images[i].buffer) {
wl_buffer_destroy(chain->images[i].buffer);
chain->base.image_fns->free_wsi_image(chain->base.device, pAllocator,
- chain->images[i].image,
- chain->images[i].memory);
+ &chain->images[i].base);
}
}