mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
anv: adopt wsi_common_get_memory
It's non-trivial to drop the private binding or transfer ownership to the bound memory. So we track the image in the device memory for dedicated allocation so that wsi image alias can find the original wsi image from the wsi memory. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36095>
This commit is contained in:
parent
5d4f59a3ed
commit
002235f64c
3 changed files with 7 additions and 12 deletions
|
|
@ -1553,6 +1553,7 @@ VkResult anv_AllocateMemory(
|
|||
struct anv_image *image = dedicated_info ?
|
||||
anv_image_from_handle(dedicated_info->image) :
|
||||
NULL;
|
||||
mem->dedicated_image = image;
|
||||
|
||||
if (device->info->ver >= 20 && image &&
|
||||
image->vk.tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT &&
|
||||
|
|
|
|||
|
|
@ -1985,14 +1985,6 @@ anv_image_finish(struct anv_image *image)
|
|||
vk_image_finish(&image->vk);
|
||||
}
|
||||
|
||||
static struct anv_image *
|
||||
anv_swapchain_get_image(VkSwapchainKHR swapchain,
|
||||
uint32_t index)
|
||||
{
|
||||
VkImage image = wsi_common_get_image(swapchain, index);
|
||||
return anv_image_from_handle(image);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
anv_image_init_from_create_info(struct anv_device *device,
|
||||
struct anv_image *image,
|
||||
|
|
@ -2706,12 +2698,11 @@ anv_bind_image_memory(struct anv_device *device,
|
|||
#ifndef VK_USE_PLATFORM_ANDROID_KHR
|
||||
const VkBindImageMemorySwapchainInfoKHR *swapchain_info =
|
||||
(const VkBindImageMemorySwapchainInfoKHR *) s;
|
||||
struct anv_image *swapchain_image =
|
||||
anv_swapchain_get_image(swapchain_info->swapchain,
|
||||
swapchain_info->imageIndex);
|
||||
mem = anv_device_memory_from_handle(wsi_common_get_memory(
|
||||
swapchain_info->swapchain, swapchain_info->imageIndex));
|
||||
struct anv_image *swapchain_image = mem->dedicated_image;
|
||||
assert(swapchain_image);
|
||||
assert(image->vk.aspects == swapchain_image->vk.aspects);
|
||||
assert(mem == NULL);
|
||||
|
||||
/* Remove the internally allocated private binding since we're going
|
||||
* to replace everything with BOs from the WSI image, we don't want
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ typedef uint32_t xcb_window_t;
|
|||
struct anv_batch;
|
||||
struct anv_buffer;
|
||||
struct anv_buffer_view;
|
||||
struct anv_image;
|
||||
struct anv_image_view;
|
||||
struct anv_instance;
|
||||
|
||||
|
|
@ -2802,6 +2803,8 @@ struct anv_device_memory {
|
|||
|
||||
/* The map, from the user PoV is map + map_delta */
|
||||
uint64_t map_delta;
|
||||
|
||||
struct anv_image *dedicated_image;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue