aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-03-31 17:07:55 +0200
committerSimon Zeni <simon@bl4ckb0ne.ca>2021-10-01 09:21:50 -0600
commitea7357b70366588069c83f158e6a4eb2d3a702b3 (patch)
treedbbaf24db13ae7f070a10be1fd41268f93c5b2c4 /backend
parent833437d5921339f2862ccfb0493617630ea3937d (diff)
Require INVALID for implicit format modifiers
See [1] for the motivation. [1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/75
Diffstat (limited to 'backend')
-rw-r--r--backend/drm/drm.c18
-rw-r--r--backend/x11/backend.c1
2 files changed, 9 insertions, 10 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index abfd1c2f..4b92d767 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -118,9 +118,14 @@ static bool add_plane(struct wlr_drm_backend *drm,
p->id = drm_plane->plane_id;
p->props = *props;
- for (size_t j = 0; j < drm_plane->count_formats; ++j) {
- wlr_drm_format_set_add(&p->formats, drm_plane->formats[j],
- DRM_FORMAT_MOD_INVALID);
+ for (size_t i = 0; i < drm_plane->count_formats; ++i) {
+ // Force a LINEAR layout for the cursor if the driver doesn't support
+ // modifiers
+ uint64_t mod = DRM_FORMAT_MOD_INVALID;
+ if (type == DRM_PLANE_TYPE_CURSOR) {
+ mod = DRM_FORMAT_MOD_LINEAR;
+ }
+ wlr_drm_format_set_add(&p->formats, drm_plane->formats[i], mod);
}
if (p->props.in_formats && drm->addfb2_modifiers) {
@@ -150,13 +155,6 @@ static bool add_plane(struct wlr_drm_backend *drm,
}
drmModeFreePropertyBlob(blob);
- } else if (type == DRM_PLANE_TYPE_CURSOR) {
- // Force a LINEAR layout for the cursor if the driver doesn't support
- // modifiers
- for (size_t i = 0; i < p->formats.len; ++i) {
- wlr_drm_format_set_add(&p->formats, p->formats.formats[i]->format,
- DRM_FORMAT_MOD_LINEAR);
- }
}
switch (type) {
diff --git a/backend/x11/backend.c b/backend/x11/backend.c
index 9eaf5664..c15b92da 100644
--- a/backend/x11/backend.c
+++ b/backend/x11/backend.c
@@ -354,6 +354,7 @@ static bool query_formats(struct wlr_x11_backend *x11) {
}
if (x11->have_dri3) {
+ // X11 always supports implicit modifiers
wlr_drm_format_set_add(&x11->dri3_formats, format->drm,
DRM_FORMAT_MOD_INVALID);
if (!query_dri3_modifiers(x11, format)) {