aboutsummaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan/radv_wsi.c
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2017-02-26 23:52:08 +0000
committerDave Airlie <[email protected]>2017-02-27 00:22:51 +0000
commit15f47027ad624d3f2f3d5aac68ee540b912a7717 (patch)
tree9f6c63db8ce3622469957b34a2fbea107ea9ec7d /src/amd/vulkan/radv_wsi.c
parent35189d32797af4fd7759f4a88e7d8f1b3e6994c8 (diff)
radv: add support for NV_dedicated_allocation
This adds initial support for NV_dedicated_allocation, then uses it for the wsi image/memory allocation paths internally in the driver. Reviewed-by: Bas Nieuwenhuizen <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_wsi.c')
-rw-r--r--src/amd/vulkan/radv_wsi.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c
index 335a963e0b1..e43c6cfd410 100644
--- a/src/amd/vulkan/radv_wsi.c
+++ b/src/amd/vulkan/radv_wsi.c
@@ -148,12 +148,10 @@ radv_wsi_image_create(VkDevice device_h,
uint32_t *offset,
uint32_t *row_pitch, int *fd_p)
{
- struct radv_device *device = radv_device_from_handle(device_h);
VkResult result = VK_SUCCESS;
struct radeon_surf *surface;
VkImage image_h;
struct radv_image *image;
- bool bret;
int fd;
result = radv_image_create(device_h,
@@ -183,42 +181,42 @@ radv_wsi_image_create(VkDevice device_h,
return result;
image = radv_image_from_handle(image_h);
+
VkDeviceMemory memory_h;
- struct radv_device_memory *memory;
+
+ const VkDedicatedAllocationMemoryAllocateInfoNV ded_alloc = {
+ .sType = VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV,
+ .pNext = NULL,
+ .buffer = NULL,
+ .image = image_h
+ };
result = radv_AllocateMemory(device_h,
&(VkMemoryAllocateInfo) {
.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO,
- .allocationSize = image->size,
- .memoryTypeIndex = linear ? 1 : 0,
- },
+ .pNext = &ded_alloc,
+ .allocationSize = image->size,
+ .memoryTypeIndex = linear ? 1 : 0,
+ },
NULL /* XXX: pAllocator */,
&memory_h);
if (result != VK_SUCCESS)
goto fail_create_image;
- memory = radv_device_memory_from_handle(memory_h);
-
- radv_BindImageMemory(VK_NULL_HANDLE, image_h, memory_h, 0);
+ radv_BindImageMemory(device_h, image_h, memory_h, 0);
/*
* return the fd for the image in the no copy mode,
* or the fd for the linear image if a copy is required.
*/
if (!needs_linear_copy || (needs_linear_copy && linear)) {
- bret = device->ws->buffer_get_fd(device->ws,
- memory->bo, &fd);
- if (bret == false)
+ RADV_FROM_HANDLE(radv_device, device, 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;
}
- {
- struct radeon_bo_metadata metadata;
- radv_init_metadata(device, image, &metadata);
- device->ws->buffer_set_metadata(memory->bo, &metadata);
- }
-
surface = &image->surface;
*image_p = image_h;