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 <leandro.ribeiro@collabora.com>
dev
Leandro Ribeiro 4 years ago committed by Daniel Stone
parent 567cc92797
commit 98101e88cc
  1. 7
      libweston/backend-drm/kms.c

@ -482,11 +482,8 @@ drm_plane_populate_formats(struct drm_plane *plane, const drmModePlane *kplane,
goto out; goto out;
} }
if (fmt->modifiers.size == 0) { if (fmt->modifiers.size == 0)
ret = weston_drm_format_add_modifier(fmt, DRM_FORMAT_MOD_INVALID); weston_drm_format_array_remove_latest_format(&plane->formats);
if (ret < 0)
goto out;
}
} }
out: out:

Loading…
Cancel
Save