diff options
author | Simon Ser <contact@emersion.fr> | 2021-03-31 22:05:18 +0200 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2021-10-01 09:21:50 -0600 |
commit | d6be1d68b7d0542efa4dc2d19d57531484fe330a (patch) | |
tree | 2917571557558fd6c1cb74928b667a1829e0214e /backend/drm | |
parent | ea7357b70366588069c83f158e6a4eb2d3a702b3 (diff) |
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.
Diffstat (limited to 'backend/drm')
-rw-r--r-- | backend/drm/renderer.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c index 2d81ccd5..01100189 100644 --- a/backend/drm/renderer.c +++ b/backend/drm/renderer.c @@ -256,6 +256,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 && |