aboutsummaryrefslogtreecommitdiff
path: root/backend/drm
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-04-23 16:05:16 +0200
committerKenny Levinsen <kl@kl.wtf>2021-04-26 23:12:53 +0200
commitf9f90b417366581b58d806956c9b2099417ed4b3 (patch)
tree15c13d04a75cf170a094cd30e820c7919fc6b890 /backend/drm
parent1a5530d14dec213376240215950b7a4c25b46261 (diff)
backend/drm: fail instead of stripping a modifier
We shouldn't strip a modifiers from buffers, because the will make the kernel re-interpret the data as LINEAR on most drivers, resulting in an incorrect output on screen.
Diffstat (limited to 'backend/drm')
-rw-r--r--backend/drm/util.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/backend/drm/util.c b/backend/drm/util.c
index 90b39de0..e8cf608f 100644
--- a/backend/drm/util.c
+++ b/backend/drm/util.c
@@ -228,6 +228,14 @@ uint32_t get_fb_for_bo(struct gbm_bo *bo, bool with_modifiers) {
wlr_log_errno(WLR_ERROR, "Unable to add DRM framebuffer");
}
} else {
+ if (gbm_bo_get_modifier(bo) != DRM_FORMAT_MOD_INVALID &&
+ gbm_bo_get_modifier(bo) != DRM_FORMAT_MOD_LINEAR) {
+ wlr_log(WLR_ERROR, "Failed to add DRM frame-buffer: "
+ "BO has modifier 0x%"PRIX64" but KMS doesn't support modifiers",
+ gbm_bo_get_modifier(bo));
+ return 0;
+ }
+
if (drmModeAddFB2(fd, width, height, format, handles, strides,
offsets, &id, 0)) {
wlr_log_errno(WLR_DEBUG,