[Mesa-dev] [PATCH] radv: allow buffers to be shareable as well.
Dave Airlie
airlied at gmail.com
Mon Jul 24 03:03:34 UTC 2017
From: Dave Airlie <airlied at redhat.com>
Buffers should report dedicated flags as well, so report the
same information for them as for images.
(alternately we can turn dedicated off for buffers maybe?)
Fixes CTS dEQP-VK.api.external.memory.opaque_fd.dedicated.buffer.info
Fixes: b70829708a (radv: Implement VK_KHR_external_memory)
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
src/amd/vulkan/radv_device.c | 5 ++++-
src/amd/vulkan/radv_private.h | 1 +
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 40b2f34..4b11a4f 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -2389,12 +2389,13 @@ void radv_GetBufferMemoryRequirements2KHR(
radv_GetBufferMemoryRequirements(device, pInfo->buffer,
&pMemoryRequirements->memoryRequirements);
+ RADV_FROM_HANDLE(radv_buffer, buffer, pInfo->buffer);
vk_foreach_struct(ext, pMemoryRequirements->pNext) {
switch (ext->sType) {
case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR: {
VkMemoryDedicatedRequirementsKHR *req =
(VkMemoryDedicatedRequirementsKHR *) ext;
- req->requiresDedicatedAllocation = false;
+ req->requiresDedicatedAllocation = buffer->shareable;
req->prefersDedicatedAllocation = req->requiresDedicatedAllocation;
break;
}
@@ -2878,6 +2879,8 @@ VkResult radv_CreateBuffer(
buffer->offset = 0;
buffer->flags = pCreateInfo->flags;
+ buffer->shareable = vk_find_struct_const(pCreateInfo->pNext,
+ EXTERNAL_MEMORY_BUFFER_CREATE_INFO_KHR) != NULL;
if (pCreateInfo->flags & VK_BUFFER_CREATE_SPARSE_BINDING_BIT) {
buffer->bo = device->ws->buffer_create(device->ws,
align64(buffer->size, 4096),
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index 8cd5ec0..ffb2490 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -637,6 +637,7 @@ struct radv_buffer {
VkBufferUsageFlags usage;
VkBufferCreateFlags flags;
+ bool shareable;
/* Set when bound */
struct radeon_winsys_bo * bo;
VkDeviceSize offset;
--
2.9.4
More information about the mesa-dev
mailing list