[Mesa-dev] [PATCH mesa 5/6] vulkan/wsi/display: pass image's DRM modifiers to the kernel
Eric Engestrom
eric.engestrom at intel.com
Wed Sep 26 15:38:09 UTC 2018
Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
---
src/vulkan/wsi/wsi_common_display.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c
index c24b58e8c240f43ac512..0b71932bfa0939039ae3 100644
--- a/src/vulkan/wsi/wsi_common_display.c
+++ b/src/vulkan/wsi/wsi_common_display.c
@@ -1082,10 +1082,14 @@ wsi_display_image_init(VkDevice device_h,
memset(image->buffer, 0, sizeof (image->buffer));
+ /* The kernel expect a modifier for each plane for historical
+ * reasons, but they all have to be the same */
+ uint64_t drm_modifier[4] = {};
for (unsigned int i = 0; i < image->base.num_planes; i++) {
int ret = drmPrimeFDToHandle(wsi->fd, image->base.fds[i],
&image->buffer[i]);
+ drm_modifier[i] = image->base.drm_modifier;
close(image->base.fds[i]);
image->base.fds[i] = -1;
if (ret < 0)
@@ -1096,14 +1100,23 @@ wsi_display_image_init(VkDevice device_h,
image->state = WSI_IMAGE_IDLE;
image->fb_id = 0;
- int ret = drmModeAddFB2(wsi->fd,
+ uint64_t *fb_modifiers = NULL;
+ uint32_t fb_flags = 0;
+ if (drm_modifier[0] != DRM_FORMAT_MOD_INVALID) {
+ fb_modifiers = drm_modifier;
+ fb_flags |= DRM_MODE_FB_MODIFIERS;
+ }
+
+ int ret = drmModeAddFB2WithModifiers(wsi->fd,
create_info->imageExtent.width,
create_info->imageExtent.height,
drm_format,
image->buffer,
image->base.row_pitches,
image->base.offsets,
- &image->fb_id, 0);
+ fb_modifiers,
+ &image->fb_id,
+ fb_flags);
if (ret)
goto fail_fb;
--
Cheers,
Eric
More information about the mesa-dev
mailing list