diff options
author | Simon Ser <contact@emersion.fr> | 2021-12-01 08:49:48 +0100 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2021-12-02 14:31:16 +0000 |
commit | 0d32118a8087061c17eac30e9b00ee527d6d3a4e (patch) | |
tree | 7365d237a02d7a33e42f7b4c311eef082555af4e | |
parent | 1bf9676e8781c281265267d71ad7c911516be023 (diff) | |
download | wlroots-0d32118a8087061c17eac30e9b00ee527d6d3a4e.tar.xz |
output: fix modifier stripping
DRM formats with an empty modifier list are invalid. Instead of
emptying the list, reduce it to { INVALID }.
Add a check to make sure the renderer and backend support implicit
modifiers, so that we don't fallback on e.g. Vulkan.
Closes: https://github.com/swaywm/sway/issues/6692
-rw-r--r-- | types/output/render.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/types/output/render.c b/types/output/render.c index 97c62a58..985b93a9 100644 --- a/types/output/render.c +++ b/types/output/render.c @@ -74,7 +74,14 @@ static bool output_create_swapchain(struct wlr_output *output, format->format, output->name); if (!allow_modifiers && (format->len != 1 || format->modifiers[0] != DRM_FORMAT_MOD_LINEAR)) { + if (!wlr_drm_format_has(format, DRM_FORMAT_MOD_INVALID)) { + wlr_log(WLR_DEBUG, "Implicit modifiers not supported"); + free(format); + return false; + } + format->len = 0; + wlr_drm_format_add(&format, DRM_FORMAT_MOD_INVALID); } struct wlr_swapchain *swapchain = |