Mesa (main): anv: enable multi-planar support for drm format modifier
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jun 18 01:34:26 UTC 2021
Module: Mesa
Branch: main
Commit: 87f35032a664c6b93cde40777f5c587d3312d716
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=87f35032a664c6b93cde40777f5c587d3312d716
Author: Yiwei Zhang <zzyiwei at chromium.org>
Date: Wed Jun 9 22:23:24 2021 +0000
anv: enable multi-planar support for drm format modifier
This patch only enables the below VkFormat:
- VK_FORMAT_G8_B8R8_2PLANE_420_UNORM
This patch ensures the proper behavior of the below APIs:
- vkGetPhysicalDeviceFormatProperties2
- vkGetPhysicalDeviceImageFormatProperties2
- vkCreateImage
- vkGetImageSubresourceLayout
- vkGetImageDrmFormatModifierPropertiesEXT
- vkGetImageMemoryRequirements
- vkGetImageMemoryRequirements2
Signed-off-by: Yiwei Zhang <zzyiwei at chromium.org>
Reviewed-by: Chad Versace <chad at kiwitree.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11281>
---
src/intel/vulkan/anv_formats.c | 30 ++++++++++++++++++++++++------
src/intel/vulkan/anv_image.c | 4 ----
2 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c
index f053a28d926..709973e591b 100644
--- a/src/intel/vulkan/anv_formats.c
+++ b/src/intel/vulkan/anv_formats.c
@@ -725,16 +725,16 @@ anv_get_image_format_features(const struct intel_device_info *devinfo,
switch (isl_layout->colorspace) {
case ISL_COLORSPACE_LINEAR:
case ISL_COLORSPACE_SRGB:
- /* Each DRM_FORMAT in in the rgb/srgb space uses unorm (if the DRM
- * format name has no type suffix) or sfloat (if it has suffix F). No
- * format contains mixed types. (as of 2020-10-16)
+ /* Each DRM_FORMAT that we support uses unorm (if the DRM format name
+ * has no type suffix) or sfloat (if it has suffix F). No format
+ * contains mixed types. (as of 2021-06-14)
*/
if (isl_layout->uniform_channel_type != ISL_UNORM &&
isl_layout->uniform_channel_type != ISL_SFLOAT)
return 0;
break;
case ISL_COLORSPACE_YUV:
- anv_finishme("support YUV formats with DRM format modifiers");
+ anv_finishme("support YUV colorspace with DRM format modifiers");
return 0;
case ISL_COLORSPACE_NONE:
return 0;
@@ -754,8 +754,26 @@ anv_get_image_format_features(const struct intel_device_info *devinfo,
return 0;
if (anv_format->n_planes > 1) {
- anv_finishme("support multi-planar formats with DRM format modifiers");
- return 0;
+ /* For simplicity, keep DISJOINT disabled for multi-planar format. */
+ flags &= ~VK_FORMAT_FEATURE_DISJOINT_BIT;
+
+ /* VK_ANDROID_external_memory_android_hardware_buffer in Virtio-GPU
+ * Venus driver layers on top of VK_EXT_image_drm_format_modifier of
+ * the host Vulkan driver, and VK_FORMAT_G8_B8R8_2PLANE_420_UNORM is
+ * required to support camera/media interop in Android.
+ */
+ if (vk_format != VK_FORMAT_G8_B8R8_2PLANE_420_UNORM) {
+ anv_finishme("support more multi-planar formats with DRM modifiers");
+ return 0;
+ }
+
+ /* Currently there is no way to properly map memory planes to format
+ * planes and aux planes due to the lack of defined ABI for external
+ * multi-planar images.
+ */
+ if (isl_mod_info->aux_usage != ISL_AUX_USAGE_NONE) {
+ return 0;
+ }
}
if (isl_mod_info->aux_usage == ISL_AUX_USAGE_CCS_E &&
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index a2ebab3f794..4f6a6e077a4 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -974,10 +974,6 @@ check_drm_format_mod(const struct anv_device *device,
assert(image->array_size == 1);
assert(image->samples == 1);
- /* FINISHME: Support multi-planar formats with modifiers */
- assert(image->n_planes == 1);
- assert(image->aspects == VK_IMAGE_ASPECT_COLOR_BIT);
-
for (int i = 0; i < image->n_planes; ++i) {
const struct anv_image_plane *plane = &image->planes[i];
ASSERTED const struct anv_format_plane *plane_format =
More information about the mesa-commit
mailing list