aboutsummaryrefslogtreecommitdiff
path: root/backend/drm
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-03-31 17:07:55 +0200
committerSimon Zeni <simon@bl4ckb0ne.ca>2021-11-26 16:40:53 +0000
commitaffe9eda5708a8368dd96870ddf2442c5b637202 (patch)
tree6912c82e67d1ad0c709179735d541e1e102114ff /backend/drm
parentd78cb808b1b051eae443e368c0b88bc90258fd02 (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/drm')
-rw-r--r--backend/drm/drm.c18
-rw-r--r--backend/drm/renderer.c2
2 files changed, 9 insertions, 11 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 40506cd4..e22e0690 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/drm/renderer.c b/backend/drm/renderer.c
index 6c26558f..3d1a5fb2 100644
--- a/backend/drm/renderer.c
+++ b/backend/drm/renderer.c
@@ -149,7 +149,7 @@ struct wlr_drm_format *drm_plane_pick_render_format(
const struct wlr_drm_format_set *plane_formats = &plane->formats;
uint32_t fmt = DRM_FORMAT_ARGB8888;
- if (!wlr_drm_format_set_has(&plane->formats, fmt, DRM_FORMAT_MOD_INVALID)) {
+ if (!wlr_drm_format_set_get(&plane->formats, fmt)) {
const struct wlr_pixel_format_info *format_info =
drm_get_pixel_format_info(fmt);
assert(format_info != NULL &&