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
This commit is contained in:
Simon Ser 2021-12-01 08:49:48 +01:00 committed by Simon Zeni
parent 1bf9676e87
commit 0d32118a80
1 changed files with 7 additions and 0 deletions

View File

@ -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 =