output/kms: Make set privacy screen caller handle the update

As with CRTC GAMMA_LUT, we're moving towards making the entity managing
KMS updates aware if there are any changes to be made, and whether KMS
updates are actually needed or not, and for privacy screen changes, this
means we need to communicate whether the privacy screen state is valid
or not. This allows the caller to create any needed MetaKmsUpdate.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2814>
This commit is contained in:
Jonas Ådahl 2022-10-19 11:00:05 +02:00
parent 589c833e5f
commit beb6903397
3 changed files with 22 additions and 12 deletions

View File

@ -1405,7 +1405,13 @@ meta_onscreen_native_prepare_frame (CoglOnscreen *onscreen,
meta_crtc_kms_set_gamma (crtc_kms, kms_update);
}
meta_output_kms_maybe_set_privacy_screen (output_kms, kms_device);
if (meta_output_kms_is_privacy_screen_invalid (output_kms))
{
MetaKmsUpdate *kms_update;
kms_update = meta_kms_ensure_pending_update (kms, kms_device);
meta_output_kms_set_privacy_screen (output_kms, kms_update);
}
}
void

View File

@ -176,23 +176,25 @@ meta_output_kms_set_privacy_screen_enabled (MetaOutput *output,
return TRUE;
}
void
meta_output_kms_maybe_set_privacy_screen (MetaOutputKms *output_kms,
MetaKmsDevice *kms_device)
gboolean
meta_output_kms_is_privacy_screen_invalid (MetaOutputKms *output_kms)
{
MetaKms *kms = meta_kms_device_get_kms (kms_device);
MetaKmsConnector *connector = meta_output_kms_get_kms_connector (output_kms);
MetaKmsUpdate *kms_update;
return !output_kms->is_privacy_screen_valid;
}
if (output_kms->is_privacy_screen_valid)
return;
void
meta_output_kms_set_privacy_screen (MetaOutputKms *output_kms,
MetaKmsUpdate *kms_update)
{
MetaKmsConnector *connector = meta_output_kms_get_kms_connector (output_kms);
g_return_if_fail (!output_kms->is_privacy_screen_valid);
output_kms->is_privacy_screen_valid = TRUE;
if (!meta_kms_connector_is_privacy_screen_supported (connector))
return;
kms_update = meta_kms_ensure_pending_update (kms, kms_device);
meta_kms_update_set_privacy_screen (kms_update, connector,
output_kms->is_privacy_screen_enabled);
}

View File

@ -43,8 +43,10 @@ void meta_output_kms_set_underscan (MetaOutputKms *output_kms,
void meta_output_kms_set_max_bpc (MetaOutputKms *output_kms,
MetaKmsUpdate *kms_update);
void meta_output_kms_maybe_set_privacy_screen (MetaOutputKms *output_kms,
MetaKmsDevice *kms_device);
gboolean meta_output_kms_is_privacy_screen_invalid (MetaOutputKms *output_kms);
void meta_output_kms_set_privacy_screen (MetaOutputKms *output_kms,
MetaKmsUpdate *kms_update);
gboolean meta_output_kms_can_clone (MetaOutputKms *output_kms,
MetaOutputKms *other_output_kms);