backends/native: Report correct Gamma support on the KMS properties path

The gamma property blob can be zero to indicate passthrough but Gamma is
still supported in that case.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2686
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2916>
This commit is contained in:
Sebastian Wick 2023-03-15 16:21:23 +01:00 committed by Marge Bot
parent 214a7d393b
commit 0ed2503140

View File

@ -125,14 +125,17 @@ read_crtc_gamma (MetaKmsCrtc *crtc,
if (!prop_lut->prop_id || !prop_size->prop_id)
return;
blob_id = prop_lut->value;
if (blob_id == 0)
return;
lut_size = prop_size->value;
if (lut_size <= 0)
return;
crtc_state->gamma.size = lut_size;
crtc_state->gamma.supported = TRUE;
blob_id = prop_lut->value;
if (blob_id == 0)
return;
fd = meta_kms_impl_device_get_fd (impl_device);
blob = drmModeGetPropertyBlob (fd, blob_id);
if (!blob)
@ -147,8 +150,6 @@ read_crtc_gamma (MetaKmsCrtc *crtc,
drm_lut = blob->data;
crtc_state->gamma.size = lut_size;
crtc_state->gamma.supported = TRUE;
crtc_state->gamma.value = meta_gamma_lut_new_sized (drm_lut_size);
for (i = 0; i < drm_lut_size; i++)