v3dv: adopt wsi_common_get_memory

v2: refactor back to the minimal change to avoid unused variable

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36035>
This commit is contained in:
Yiwei Zhang
2025-07-01 21:38:37 -07:00
committed by Marge Bot
parent ec71925268
commit 50e299b71c
3 changed files with 5 additions and 17 deletions
+4 -7
View File
@@ -2537,16 +2537,13 @@ v3dv_BindImageMemory2(VkDevice _device,
BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR);
if (swapchain_info && swapchain_info->swapchain) {
#if !DETECT_OS_ANDROID
struct v3dv_image *swapchain_image =
v3dv_wsi_get_image_from_swapchain(swapchain_info->swapchain,
swapchain_info->imageIndex);
/* Making the assumption that swapchain images are a single plane */
assert(swapchain_image->plane_count == 1);
VkDeviceMemory wsi_mem_handle = wsi_common_get_memory(
swapchain_info->swapchain, swapchain_info->imageIndex);
VkBindImageMemoryInfo swapchain_bind = {
.sType = VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO,
.image = pBindInfos[i].image,
.memory = v3dv_device_memory_to_handle(swapchain_image->planes[0].mem),
.memoryOffset = swapchain_image->planes[0].mem_offset,
.memory = wsi_mem_handle,
.memoryOffset = 0,
};
bind_image_memory(&swapchain_bind);
#endif
+1 -3
View File
@@ -115,7 +115,7 @@
} while (0)
struct v3dv_instance;
struct v3dv_image;
struct v3d_simulator_file;
/* Minimum required by the Vulkan 1.1 spec */
@@ -205,8 +205,6 @@ v3dv_device_lookup_bo(struct v3dv_physical_device *device, uint32_t handle)
VkResult v3dv_wsi_init(struct v3dv_physical_device *physical_device);
void v3dv_wsi_finish(struct v3dv_physical_device *physical_device);
struct v3dv_image *v3dv_wsi_get_image_from_swapchain(VkSwapchainKHR swapchain,
uint32_t index);
void v3dv_meta_clear_init(struct v3dv_device *device);
void v3dv_meta_clear_finish(struct v3dv_device *device);
-7
View File
@@ -128,10 +128,3 @@ v3dv_wsi_finish(struct v3dv_physical_device *physical_device)
wsi_device_finish(&physical_device->wsi_device,
&physical_device->vk.instance->alloc);
}
struct v3dv_image *
v3dv_wsi_get_image_from_swapchain(VkSwapchainKHR swapchain, uint32_t index)
{
VkImage image = wsi_common_get_image(swapchain, index);
return v3dv_image_from_handle(image);
}