venus: refactor Android ANB tracking to avoid confusions with WSI
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

WSI used to track the similar for aliased wsi image creation, but later
got deprecated. So let's rename wsi.memory to wsi.anb_mem and drop
wsi.memory_owned to avoid confusions with common wsi related trackings.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39401>
This commit is contained in:
Yiwei Zhang 2026-01-19 20:54:24 -08:00 committed by Marge Bot
parent 849e3552e8
commit 481df22209
3 changed files with 7 additions and 10 deletions

View file

@ -344,8 +344,7 @@ vn_android_image_from_anb_internal(struct vn_device *dev,
}
/* Android WSI image owns the memory */
img->wsi.memory = vn_device_memory_from_handle(mem_handle);
img->wsi.memory_owned = true;
img->wsi.anb_mem = vn_device_memory_from_handle(mem_handle);
*out_img = img;
return VK_SUCCESS;
@ -372,7 +371,7 @@ vn_android_image_from_anb(struct vn_device *dev,
const VkBindImageMemoryInfo bind_info = {
.sType = VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO,
.image = vn_image_to_handle(img),
.memory = vn_device_memory_to_handle(img->wsi.memory),
.memory = vn_device_memory_to_handle(img->wsi.anb_mem),
};
result = vn_BindImageMemory2(vn_device_to_handle(dev), 1, &bind_info);
if (result != VK_SUCCESS) {
@ -399,8 +398,7 @@ vn_android_get_wsi_memory_from_bind_info(
if (result != VK_SUCCESS)
return NULL;
assert(img->wsi.memory_owned);
return img->wsi.memory;
return img->wsi.anb_mem;
}
VkResult

View file

@ -714,8 +714,9 @@ vn_DestroyImage(VkDevice device,
if (!img)
return;
if (img->wsi.memory && img->wsi.memory_owned) {
VkDeviceMemory mem_handle = vn_device_memory_to_handle(img->wsi.memory);
if (img->wsi.anb_mem) {
VkDeviceMemory mem_handle =
vn_device_memory_to_handle(img->wsi.anb_mem);
vn_FreeMemory(device, mem_handle, pAllocator);
}

View file

@ -64,13 +64,11 @@ struct vn_image {
struct {
bool is_prime_blit_src;
struct vn_device_memory *memory;
/* memory backing the prime blit dst buffer */
struct vn_device_memory *blit_mem;
/* For VK_ANDROID_native_buffer, the WSI image owns the memory. */
bool memory_owned;
struct vn_device_memory *anb_mem;
} wsi;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_image,