[Mesa-dev] [PATCH] radv: allow buffers to be shareable as well.

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Mon Jul 24 06:49:12 UTC 2017


On Mon, Jul 24, 2017 at 5:03 AM, Dave Airlie <airlied at gmail.com> wrote:
> 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;

Just always do false here and ignore the entire shareable thing?


>                         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
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list