mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-07 23:50:11 +01:00
venus: support AHB external format for sampler YCbCr conversion
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org> Reviewed-by: Chia-I Wu <olvaffe@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10960>
This commit is contained in:
parent
78b30a0696
commit
47bf8be024
3 changed files with 30 additions and 1 deletions
|
|
@ -137,7 +137,7 @@ vn_android_ahb_format_from_vk_format(VkFormat format)
|
|||
}
|
||||
}
|
||||
|
||||
static VkFormat
|
||||
VkFormat
|
||||
vn_android_ahb_format_to_vk_format(uint32_t format)
|
||||
{
|
||||
switch (format) {
|
||||
|
|
|
|||
|
|
@ -81,6 +81,9 @@ vn_android_device_allocate_ahb(struct vn_device *dev,
|
|||
void
|
||||
vn_android_release_ahb(struct AHardwareBuffer *ahb);
|
||||
|
||||
VkFormat
|
||||
vn_android_ahb_format_to_vk_format(uint32_t format);
|
||||
|
||||
#else
|
||||
|
||||
static inline VkResult
|
||||
|
|
@ -160,6 +163,12 @@ vn_android_release_ahb(UNUSED struct AHardwareBuffer *ahb)
|
|||
return;
|
||||
}
|
||||
|
||||
static inline VkFormat
|
||||
vn_android_ahb_format_to_vk_format(UNUSED uint32_t format)
|
||||
{
|
||||
return VK_FORMAT_UNDEFINED;
|
||||
}
|
||||
|
||||
#endif /* ANDROID */
|
||||
|
||||
#endif /* VN_ANDROID_H */
|
||||
|
|
|
|||
|
|
@ -729,6 +729,26 @@ vn_CreateSamplerYcbcrConversion(
|
|||
struct vn_device *dev = vn_device_from_handle(device);
|
||||
const VkAllocationCallbacks *alloc =
|
||||
pAllocator ? pAllocator : &dev->base.base.alloc;
|
||||
const VkExternalFormatANDROID *ext_info =
|
||||
vk_find_struct_const(pCreateInfo->pNext, EXTERNAL_FORMAT_ANDROID);
|
||||
|
||||
VkSamplerYcbcrConversionCreateInfo local_info;
|
||||
if (ext_info && ext_info->externalFormat) {
|
||||
assert(pCreateInfo->format == VK_FORMAT_UNDEFINED);
|
||||
|
||||
VkFormat format =
|
||||
vn_android_ahb_format_to_vk_format(ext_info->externalFormat);
|
||||
if (format == VK_FORMAT_UNDEFINED)
|
||||
return vn_error(dev->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
local_info = *pCreateInfo;
|
||||
local_info.format = format;
|
||||
local_info.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
local_info.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
local_info.components.b = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
local_info.components.a = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
pCreateInfo = &local_info;
|
||||
}
|
||||
|
||||
struct vn_sampler_ycbcr_conversion *conv =
|
||||
vk_zalloc(alloc, sizeof(*conv), VN_DEFAULT_ALIGN,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue