From 98101e88ccc3df59b9a0384e65d8bd2de5ccc383 Mon Sep 17 00:00:00 2001 From: Leandro Ribeiro Date: Wed, 21 Apr 2021 11:46:35 -0300 Subject: [PATCH] backend-drm: ignore formats without modifiers from IN_FORMATS In commit "backend-drm: add DRM_FORMAT_MOD_INVALID to modifier sets when no modifiers are supported" we've changed the code that iterates through the IN_FORMATS blob property. Now it adds DRM_FORMAT_MOD_INVALID for formats exposed without modifiers. But the thing is that there shouldn't be formats in the IN_FORMATS blob exposed without modifiers, as the blob has been added after the introduction of the explicit modifiers API in the kernel. For now, there's nothing in the kernel to ensure this correct behavior. So instead of adding DRM_FORMAT_MOD_INVALID in this case, ignore these formats, as userspace can't do much in this case. In the future this may be fixed by the kernel. Or maybe the following MR in libdrm, which adds an iterator API for the IN_FORMATS blob: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/146 Signed-off-by: Leandro Ribeiro --- libweston/backend-drm/kms.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libweston/backend-drm/kms.c b/libweston/backend-drm/kms.c index b82c2189..fbc1e3f7 100644 --- a/libweston/backend-drm/kms.c +++ b/libweston/backend-drm/kms.c @@ -482,11 +482,8 @@ drm_plane_populate_formats(struct drm_plane *plane, const drmModePlane *kplane, goto out; } - if (fmt->modifiers.size == 0) { - ret = weston_drm_format_add_modifier(fmt, DRM_FORMAT_MOD_INVALID); - if (ret < 0) - goto out; - } + if (fmt->modifiers.size == 0) + weston_drm_format_array_remove_latest_format(&plane->formats); } out: