From e163a7cf486bf85e982e0fbe9c7a6588b0afb657 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 31 Mar 2021 22:05:18 +0200 Subject: backend/drm: fail on explicit modifier in drmModeAddFB2 drmModeAddFB2 doesn't support explicit modifiers. Only accept INVALID which indicates an implicit modifier and LINEAR which may indicate that GBM_BO_USE_LINEAR has been used. --- backend/drm/renderer.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'backend/drm') diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c index 3d1a5fb2..bfc94a24 100644 --- a/backend/drm/renderer.c +++ b/backend/drm/renderer.c @@ -220,6 +220,13 @@ static uint32_t get_fb_for_bo(struct wlr_drm_backend *drm, wlr_log_errno(WLR_DEBUG, "drmModeAddFB2WithModifiers failed"); } } else { + if (dmabuf->modifier != DRM_FORMAT_MOD_INVALID && + dmabuf->modifier != DRM_FORMAT_MOD_LINEAR) { + wlr_log(WLR_ERROR, "Cannot import DRM framebuffer with explicit " + "modifier 0x%"PRIX64, dmabuf->modifier); + return 0; + } + int ret = drmModeAddFB2(drm->fd, dmabuf->width, dmabuf->height, dmabuf->format, handles, dmabuf->stride, dmabuf->offset, &id, 0); if (ret != 0 && dmabuf->format == DRM_FORMAT_ARGB8888 && -- cgit v1.2.3