mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-02 18:10:17 +01:00
radv/video: Support DRM format modifier tiling
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36192>
This commit is contained in:
parent
21573c3d2d
commit
566ea76d8e
2 changed files with 56 additions and 2 deletions
|
|
@ -830,9 +830,15 @@ radv_check_modifier_support(struct radv_physical_device *pdev, const VkPhysicalD
|
|||
!need_dcc_sign_reinterpret)
|
||||
return VK_ERROR_FORMAT_NOT_SUPPORTED;
|
||||
|
||||
const bool video = info->usage & (VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR | VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR);
|
||||
if (video && !ac_modifier_supports_video(&pdev->info, modifier))
|
||||
return VK_ERROR_FORMAT_NOT_SUPPORTED;
|
||||
|
||||
/* We can expand this as needed and implemented but there is not much demand
|
||||
* for more. */
|
||||
if (ac_modifier_has_dcc(modifier)) {
|
||||
* for more.
|
||||
* Video can't support array layers with swizzle modes that use slice index
|
||||
* for addressing. */
|
||||
if (ac_modifier_has_dcc(modifier) || video) {
|
||||
props->maxMipLevels = 1;
|
||||
props->maxArrayLayers = 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1128,6 +1128,22 @@ radv_GetPhysicalDeviceVideoFormatPropertiesKHR(VkPhysicalDevice physicalDevice,
|
|||
p->imageUsageFlags = pVideoFormatInfo->imageUsage;
|
||||
}
|
||||
|
||||
if (pVideoFormatInfo->imageUsage &
|
||||
(VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR | VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR)) {
|
||||
vk_outarray_append_typed(VkVideoFormatPropertiesKHR, &out, p)
|
||||
{
|
||||
p->format = VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16;
|
||||
p->componentMapping.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
p->componentMapping.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
p->componentMapping.b = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
p->componentMapping.a = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
p->imageCreateFlags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT | VK_IMAGE_CREATE_EXTENDED_USAGE_BIT;
|
||||
p->imageType = VK_IMAGE_TYPE_2D;
|
||||
p->imageTiling = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT;
|
||||
p->imageUsageFlags = pVideoFormatInfo->imageUsage;
|
||||
}
|
||||
}
|
||||
|
||||
if (pVideoFormatInfo->imageUsage & (VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR)) {
|
||||
need_8bit = false;
|
||||
need_10bit = false;
|
||||
|
|
@ -1151,6 +1167,22 @@ radv_GetPhysicalDeviceVideoFormatPropertiesKHR(VkPhysicalDevice physicalDevice,
|
|||
p->imageUsageFlags = pVideoFormatInfo->imageUsage;
|
||||
}
|
||||
|
||||
if (pVideoFormatInfo->imageUsage &
|
||||
(VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR | VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR)) {
|
||||
vk_outarray_append_typed(VkVideoFormatPropertiesKHR, &out, p)
|
||||
{
|
||||
p->format = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16;
|
||||
p->componentMapping.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
p->componentMapping.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
p->componentMapping.b = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
p->componentMapping.a = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
p->imageCreateFlags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT | VK_IMAGE_CREATE_EXTENDED_USAGE_BIT;
|
||||
p->imageType = VK_IMAGE_TYPE_2D;
|
||||
p->imageTiling = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT;
|
||||
p->imageUsageFlags = pVideoFormatInfo->imageUsage;
|
||||
}
|
||||
}
|
||||
|
||||
if (pVideoFormatInfo->imageUsage & (VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR))
|
||||
need_8bit = false;
|
||||
}
|
||||
|
|
@ -1171,6 +1203,22 @@ radv_GetPhysicalDeviceVideoFormatPropertiesKHR(VkPhysicalDevice physicalDevice,
|
|||
p->imageTiling = VK_IMAGE_TILING_OPTIMAL;
|
||||
p->imageUsageFlags = pVideoFormatInfo->imageUsage;
|
||||
}
|
||||
|
||||
if (pVideoFormatInfo->imageUsage &
|
||||
(VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR | VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR)) {
|
||||
vk_outarray_append_typed(VkVideoFormatPropertiesKHR, &out, p)
|
||||
{
|
||||
p->format = VK_FORMAT_G8_B8R8_2PLANE_420_UNORM;
|
||||
p->componentMapping.r = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
p->componentMapping.g = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
p->componentMapping.b = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
p->componentMapping.a = VK_COMPONENT_SWIZZLE_IDENTITY;
|
||||
p->imageCreateFlags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT | VK_IMAGE_CREATE_EXTENDED_USAGE_BIT;
|
||||
p->imageType = VK_IMAGE_TYPE_2D;
|
||||
p->imageTiling = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT;
|
||||
p->imageUsageFlags = pVideoFormatInfo->imageUsage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return vk_outarray_status(&out);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue