Require INVALID for implicit format modifiers

See [1] for the motivation.

[1]: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/75
This commit is contained in:
Simon Ser 2021-03-31 17:07:55 +02:00 committed by Simon Zeni
parent 833437d592
commit ea7357b703
6 changed files with 39 additions and 45 deletions

View file

@ -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) {