summaryrefslogtreecommitdiffstats
path: root/src/amd
diff options
context:
space:
mode:
authorDaniel Stone <[email protected]>2017-07-20 11:51:48 +0100
committerJason Ekstrand <[email protected]>2017-12-04 10:04:19 -0800
commitc1163f7b1c3f56bb268f61205a67f019806ae785 (patch)
tree340277936ee22565d86fddae622a8efc266f7c42 /src/amd
parent2cbeb32555421ae302222e6e730b412c82742d74 (diff)
vulkan/wsi: Add a wsi_image structure
This is used to hold information about the allocated image, rather than an ever-growing function argument list. v2 (Jason Ekstrand): - Rename wsi_image_base to wsi_image Signed-off-by: Daniel Stone <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Reviewed-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r--src/amd/vulkan/radv_wsi.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c
index 98346cae062..f5f9a3fbeba 100644
--- a/src/amd/vulkan/radv_wsi.c
+++ b/src/amd/vulkan/radv_wsi.c
@@ -145,11 +145,7 @@ radv_wsi_image_create(VkDevice device_h,
const VkAllocationCallbacks* pAllocator,
bool needs_linear_copy,
bool linear,
- VkImage *image_p,
- VkDeviceMemory *memory_p,
- uint32_t *size,
- uint32_t *offset,
- uint32_t *row_pitch, int *fd_p)
+ struct wsi_image *wsi_image)
{
VkResult result = VK_SUCCESS;
struct radeon_surf *surface;
@@ -232,20 +228,22 @@ radv_wsi_image_create(VkDevice device_h,
RADV_FROM_HANDLE(radv_device_memory, memory, memory_h);
if (!radv_get_memory_fd(device, memory, &fd))
goto fail_alloc_memory;
- *fd_p = fd;
+ wsi_image->fd = fd;
}
surface = &image->surface;
- *image_p = image_h;
- *memory_p = memory_h;
- *size = image->size;
- *offset = image->offset;
-
+ wsi_image->image = image_h;
+ wsi_image->memory = memory_h;
+ wsi_image->size = image->size;
+ wsi_image->offset = image->offset;
if (device->physical_device->rad_info.chip_class >= GFX9)
- *row_pitch = surface->u.gfx9.surf_pitch * surface->bpe;
+ wsi_image->row_pitch =
+ surface->u.gfx9.surf_pitch * surface->bpe;
else
- *row_pitch = surface->u.legacy.level[0].nblk_x * surface->bpe;
+ wsi_image->row_pitch =
+ surface->u.legacy.level[0].nblk_x * surface->bpe;
+
return VK_SUCCESS;
fail_alloc_memory:
radv_FreeMemory(device_h, memory_h, pAllocator);
@@ -259,12 +257,11 @@ fail_create_image:
static void
radv_wsi_image_free(VkDevice device,
const VkAllocationCallbacks* pAllocator,
- VkImage image_h,
- VkDeviceMemory memory_h)
+ struct wsi_image *wsi_image)
{
- radv_DestroyImage(device, image_h, pAllocator);
+ radv_DestroyImage(device, wsi_image->image, pAllocator);
- radv_FreeMemory(device, memory_h, pAllocator);
+ radv_FreeMemory(device, wsi_image->memory, pAllocator);
}
static const struct wsi_image_fns radv_wsi_image_fns = {