mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-18 14:40:40 +02:00
venus: use wsi_common_create_swapchain_image
We no longer need to do our own since the chain has the info stored for the common helper. Test: - dEQP-VK.wsi.*.swapchain.create.* - dEQP-VK.wsi.*.maintenance1.* Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35810>
This commit is contained in:
parent
646977348b
commit
0db7818b87
3 changed files with 3 additions and 79 deletions
|
|
@ -694,8 +694,9 @@ vn_CreateImage(VkDevice device,
|
|||
#if DETECT_OS_ANDROID
|
||||
result = vn_image_create_deferred(dev, pCreateInfo, alloc, &img);
|
||||
#else
|
||||
result = vn_wsi_create_image_from_swapchain(
|
||||
dev, pCreateInfo, swapchain_info, alloc, &img);
|
||||
result = wsi_common_create_swapchain_image(
|
||||
&dev->physical_device->wsi_device, pCreateInfo,
|
||||
swapchain_info->swapchain, (VkImage *)&img);
|
||||
#endif
|
||||
} else {
|
||||
struct vn_image_create_info local_info;
|
||||
|
|
|
|||
|
|
@ -162,64 +162,6 @@ vn_wsi_create_image(struct vn_device *dev,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
VkResult
|
||||
vn_wsi_create_image_from_swapchain(
|
||||
struct vn_device *dev,
|
||||
const VkImageCreateInfo *create_info,
|
||||
const VkImageSwapchainCreateInfoKHR *swapchain_info,
|
||||
const VkAllocationCallbacks *alloc,
|
||||
struct vn_image **out_img)
|
||||
{
|
||||
const struct vn_image *swapchain_img = vn_image_from_handle(
|
||||
wsi_common_get_image(swapchain_info->swapchain, 0));
|
||||
assert(swapchain_img->wsi.is_wsi);
|
||||
|
||||
/* must match what the common WSI and vn_wsi_create_image do */
|
||||
VkImageCreateInfo local_create_info = *create_info;
|
||||
|
||||
/* match external memory */
|
||||
const VkExternalMemoryImageCreateInfo local_external_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO,
|
||||
.pNext = local_create_info.pNext,
|
||||
.handleTypes =
|
||||
dev->physical_device->external_memory.renderer_handle_type,
|
||||
};
|
||||
local_create_info.pNext = &local_external_info;
|
||||
|
||||
/* match image tiling */
|
||||
local_create_info.tiling = swapchain_img->wsi.tiling_override;
|
||||
|
||||
VkImageDrmFormatModifierListCreateInfoEXT local_mod_info;
|
||||
if (local_create_info.tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT) {
|
||||
local_mod_info = (const VkImageDrmFormatModifierListCreateInfoEXT){
|
||||
.sType =
|
||||
VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT,
|
||||
.pNext = local_create_info.pNext,
|
||||
.drmFormatModifierCount = 1,
|
||||
.pDrmFormatModifiers = &swapchain_img->wsi.drm_format_modifier,
|
||||
};
|
||||
local_create_info.pNext = &local_mod_info;
|
||||
}
|
||||
|
||||
/* match image usage */
|
||||
if (swapchain_img->wsi.is_prime_blit_src)
|
||||
local_create_info.usage |= VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
|
||||
|
||||
create_info = &local_create_info;
|
||||
|
||||
struct vn_image *img;
|
||||
VkResult result = vn_image_create(dev, create_info, alloc, &img);
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
img->wsi.is_wsi = true;
|
||||
img->wsi.tiling_override = swapchain_img->wsi.tiling_override;
|
||||
img->wsi.drm_format_modifier = swapchain_img->wsi.drm_format_modifier;
|
||||
|
||||
*out_img = img;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
/* swapchain commands */
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -30,14 +30,6 @@ vn_wsi_create_image(struct vn_device *dev,
|
|||
const VkAllocationCallbacks *alloc,
|
||||
struct vn_image **out_img);
|
||||
|
||||
VkResult
|
||||
vn_wsi_create_image_from_swapchain(
|
||||
struct vn_device *dev,
|
||||
const VkImageCreateInfo *create_info,
|
||||
const VkImageSwapchainCreateInfoKHR *swapchain_info,
|
||||
const VkAllocationCallbacks *alloc,
|
||||
struct vn_image **out_img);
|
||||
|
||||
#else
|
||||
|
||||
static inline VkResult
|
||||
|
|
@ -61,17 +53,6 @@ vn_wsi_create_image(struct vn_device *dev,
|
|||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
static inline VkResult
|
||||
vn_wsi_create_image_from_swapchain(
|
||||
struct vn_device *dev,
|
||||
const VkImageCreateInfo *create_info,
|
||||
const VkImageSwapchainCreateInfoKHR *swapchain_info,
|
||||
const VkAllocationCallbacks *alloc,
|
||||
struct vn_image **out_img)
|
||||
{
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
#endif /* VN_USE_WSI_PLATFORM */
|
||||
|
||||
#endif /* VN_WSI_H */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue