Mesa (main): venus: use linear modifier for legacy common wsi path
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Apr 21 01:35:54 UTC 2022
Module: Mesa
Branch: main
Commit: 31727f114a909d2ec84a943de0340ba48c6a2915
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=31727f114a909d2ec84a943de0340ba48c6a2915
Author: Yiwei Zhang <zzyiwei at chromium.org>
Date: Sat Apr 16 21:33:05 2022 -0700
venus: use linear modifier for legacy common wsi path
Towards the renderer, venus better uses VK_EXT_image_drm_format_modifier
to force linear with tiling modifier and mod_linear. Doing so won't make
any difference on the mesa implementations we care about given we have
required VK_EXT_image_drm_format_modifier for wsi support.
A lucky side effect of this is to allow common wsi to work with host
implementations not supporting dma_buf export.
Signed-off-by: Yiwei Zhang <zzyiwei at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15993>
---
src/virtio/vulkan/vn_wsi.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/src/virtio/vulkan/vn_wsi.c b/src/virtio/vulkan/vn_wsi.c
index 7f0ed9dbc37..007af746f4e 100644
--- a/src/virtio/vulkan/vn_wsi.c
+++ b/src/virtio/vulkan/vn_wsi.c
@@ -10,6 +10,7 @@
#include "vn_wsi.h"
+#include "drm-uapi/drm_fourcc.h"
#include "vk_enum_to_str.h"
#include "wsi_common_entrypoints.h"
@@ -110,17 +111,29 @@ vn_wsi_create_image(struct vn_device *dev,
struct vn_image **out_img)
{
/* TODO This is the legacy path used by wsi_create_native_image when there
- * is no modifier support. Instead of forcing VK_IMAGE_TILING_LINEAR, we
- * should ask wsi to use wsi_create_prime_image instead.
+ * is no modifier support. Instead of forcing linear tiling, we should ask
+ * wsi to use wsi_create_prime_image instead.
*
* In fact, this is not enough when the image is truely used for scanout by
* the host compositor. There can be requirements we fail to meet. We
* should require modifier support at some point.
*/
+ const uint64_t modifier = DRM_FORMAT_MOD_LINEAR;
+ const VkImageDrmFormatModifierListCreateInfoEXT mod_list_info = {
+ .sType =
+ VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT,
+ .pNext = create_info->pNext,
+ .drmFormatModifierCount = 1,
+ .pDrmFormatModifiers = &modifier,
+ };
VkImageCreateInfo local_create_info;
if (wsi_info->scanout) {
+ assert(!vk_find_struct_const(
+ create_info->pNext, IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT));
+
local_create_info = *create_info;
- local_create_info.tiling = VK_IMAGE_TILING_LINEAR;
+ local_create_info.pNext = &mod_list_info;
+ local_create_info.tiling = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT;
create_info = &local_create_info;
if (VN_DEBUG(WSI))
More information about the mesa-commit
mailing list