mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-29 01:30:08 +01:00
venus: simplify ahb image creation
Those excessive asserts are only useful when bringing up Android. Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21379>
This commit is contained in:
parent
768017f72b
commit
ca96f94aee
4 changed files with 11 additions and 55 deletions
|
|
@ -1111,32 +1111,6 @@ vn_android_get_drm_format_modifier_info(
|
|||
return true;
|
||||
}
|
||||
|
||||
VkResult
|
||||
vn_android_image_from_ahb(struct vn_device *dev,
|
||||
const VkImageCreateInfo *create_info,
|
||||
const VkAllocationCallbacks *alloc,
|
||||
struct vn_image **out_img)
|
||||
{
|
||||
const VkExternalFormatANDROID *ext_info =
|
||||
vk_find_struct_const(create_info->pNext, EXTERNAL_FORMAT_ANDROID);
|
||||
|
||||
VkImageCreateInfo local_info;
|
||||
if (ext_info && ext_info->externalFormat) {
|
||||
assert(create_info->format == VK_FORMAT_UNDEFINED);
|
||||
assert(create_info->imageType == VK_IMAGE_TYPE_2D);
|
||||
assert(create_info->usage == VK_IMAGE_USAGE_SAMPLED_BIT);
|
||||
assert(create_info->tiling == VK_IMAGE_TILING_OPTIMAL);
|
||||
assert(!(create_info->flags & VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT));
|
||||
|
||||
local_info = *create_info;
|
||||
local_info.format =
|
||||
vn_android_drm_format_to_vk_format(ext_info->externalFormat);
|
||||
create_info = &local_info;
|
||||
}
|
||||
|
||||
return vn_image_create_deferred(dev, create_info, alloc, out_img);
|
||||
}
|
||||
|
||||
VkResult
|
||||
vn_android_device_import_ahb(struct vn_device *dev,
|
||||
struct vn_device_memory *mem,
|
||||
|
|
|
|||
|
|
@ -41,12 +41,6 @@ uint64_t
|
|||
vn_android_get_ahb_usage(const VkImageUsageFlags usage,
|
||||
const VkImageCreateFlags flags);
|
||||
|
||||
VkResult
|
||||
vn_android_image_from_ahb(struct vn_device *dev,
|
||||
const VkImageCreateInfo *create_info,
|
||||
const VkAllocationCallbacks *alloc,
|
||||
struct vn_image **out_img);
|
||||
|
||||
VkResult
|
||||
vn_android_device_import_ahb(struct vn_device *dev,
|
||||
struct vn_device_memory *mem,
|
||||
|
|
@ -108,15 +102,6 @@ vn_android_get_ahb_usage(UNUSED const VkImageUsageFlags usage,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline VkResult
|
||||
vn_android_image_from_ahb(UNUSED struct vn_device *dev,
|
||||
UNUSED const VkImageCreateInfo *create_info,
|
||||
UNUSED const VkAllocationCallbacks *alloc,
|
||||
UNUSED struct vn_image **out_img)
|
||||
{
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
static inline VkResult
|
||||
vn_android_device_import_ahb(UNUSED struct vn_device *dev,
|
||||
UNUSED struct vn_device_memory *mem,
|
||||
|
|
|
|||
|
|
@ -157,12 +157,15 @@ vn_image_deferred_info_init(struct vn_image *img,
|
|||
memcpy(&info->stencil, src, sizeof(info->stencil));
|
||||
pnext = &info->stencil;
|
||||
break;
|
||||
case VK_STRUCTURE_TYPE_EXTERNAL_FORMAT_ANDROID:
|
||||
/* we should have translated the external format */
|
||||
assert(create_info->format != VK_FORMAT_UNDEFINED);
|
||||
info->from_external_format =
|
||||
((const VkExternalFormatANDROID *)src)->externalFormat;
|
||||
break;
|
||||
case VK_STRUCTURE_TYPE_EXTERNAL_FORMAT_ANDROID: {
|
||||
const uint32_t drm_format =
|
||||
(uint32_t)((const VkExternalFormatANDROID *)src)->externalFormat;
|
||||
if (drm_format) {
|
||||
info->create.format =
|
||||
vn_android_drm_format_to_vk_format(drm_format);
|
||||
info->from_external_format = true;
|
||||
}
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -252,7 +255,7 @@ vn_image_init_deferred(struct vn_device *dev,
|
|||
return result;
|
||||
}
|
||||
|
||||
VkResult
|
||||
static VkResult
|
||||
vn_image_create_deferred(struct vn_device *dev,
|
||||
const VkImageCreateInfo *create_info,
|
||||
const VkAllocationCallbacks *alloc,
|
||||
|
|
@ -334,7 +337,7 @@ vn_CreateImage(VkDevice device,
|
|||
result =
|
||||
vn_android_image_from_anb(dev, pCreateInfo, anb_info, alloc, &img);
|
||||
} else if (ahb_info) {
|
||||
result = vn_android_image_from_ahb(dev, pCreateInfo, alloc, &img);
|
||||
result = vn_image_create_deferred(dev, pCreateInfo, alloc, &img);
|
||||
} else if (swapchain_info) {
|
||||
result = vn_wsi_create_image_from_swapchain(
|
||||
dev, pCreateInfo, swapchain_info, alloc, &img);
|
||||
|
|
|
|||
|
|
@ -108,10 +108,4 @@ vn_image_init_deferred(struct vn_device *dev,
|
|||
const VkImageCreateInfo *create_info,
|
||||
struct vn_image *img);
|
||||
|
||||
VkResult
|
||||
vn_image_create_deferred(struct vn_device *dev,
|
||||
const VkImageCreateInfo *create_info,
|
||||
const VkAllocationCallbacks *alloc,
|
||||
struct vn_image **out_img);
|
||||
|
||||
#endif /* VN_IMAGE_H */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue