From f5a80f0d3c457f7e7c82959b6d02169fc4216277 Mon Sep 17 00:00:00 2001 From: Asahi Lina Date: Tue, 20 Dec 2022 21:02:11 +0900 Subject: [PATCH] screencast: Don't skip the last valid modifier Since modifiers are listed in preference order, the last one is usually the most general fallback. If we drop it, we risk winding up with no usable modifiers. On Apple GPUs with the Asahi driver, the received modifiers are usually compressed, twiddled, and linear. Dropping linear means we only request complex formats. But then gbm_bo_create_with_modifiers always requests a scanout-capable BO which cannot support complex formats, and we wind up with nothing. This breaks screencasting on these platforms. --- src/plugins/screencast/screencaststream.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/screencast/screencaststream.cpp b/src/plugins/screencast/screencaststream.cpp index f010d1177b..42651bcbb1 100644 --- a/src/plugins/screencast/screencaststream.cpp +++ b/src/plugins/screencast/screencaststream.cpp @@ -151,7 +151,7 @@ void ScreenCastStream::onStreamParamChanged(void *data, uint32_t id, const struc if (modifierProperty) { const struct spa_pod *modifierPod = &modifierProperty->value; - uint32_t modifiersCount = SPA_POD_CHOICE_N_VALUES(modifierPod) - 1; + uint32_t modifiersCount = SPA_POD_CHOICE_N_VALUES(modifierPod); uint64_t *modifiers = (uint64_t *)SPA_POD_CHOICE_VALUES(modifierPod); receivedModifiers = QVector(modifiers, modifiers + modifiersCount); }