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.
This commit is contained in:
Asahi Lina 2022-12-20 21:02:11 +09:00 committed by Aleix Pol Gonzalez
parent f37acaff54
commit f5a80f0d3c

View file

@ -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<uint64_t>(modifiers, modifiers + modifiersCount);
}