mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
crtc/kms: Make set gamma caller handle the update
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 GAMMA_LUT changes, this means we need to communicate whether the GAMMA_LUT 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:
parent
ee91655f7d
commit
589c833e5f
@ -368,9 +368,15 @@ generate_crtc_connector_list (MetaGpu *gpu,
|
||||
return connectors;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_crtc_kms_is_gamma_invalid (MetaCrtcKms *crtc_kms)
|
||||
{
|
||||
return !crtc_kms->is_gamma_valid;
|
||||
}
|
||||
|
||||
void
|
||||
meta_crtc_kms_maybe_set_gamma (MetaCrtcKms *crtc_kms,
|
||||
MetaKmsDevice *kms_device)
|
||||
meta_crtc_kms_set_gamma (MetaCrtcKms *crtc_kms,
|
||||
MetaKmsUpdate *kms_update)
|
||||
{
|
||||
MetaGpu *gpu = meta_crtc_get_gpu (META_CRTC (crtc_kms));
|
||||
MetaBackend *backend = meta_gpu_get_backend (gpu);
|
||||
@ -378,23 +384,16 @@ meta_crtc_kms_maybe_set_gamma (MetaCrtcKms *crtc_kms,
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
MetaMonitorManagerNative *monitor_manager_native =
|
||||
META_MONITOR_MANAGER_NATIVE (monitor_manager);
|
||||
MetaKms *kms = meta_kms_device_get_kms (kms_device);
|
||||
MetaKmsUpdate *kms_update;
|
||||
MetaKmsCrtcGamma *gamma;
|
||||
MetaKmsCrtc *kms_crtc = meta_crtc_kms_get_kms_crtc (crtc_kms);
|
||||
|
||||
if (crtc_kms->is_gamma_valid)
|
||||
return;
|
||||
|
||||
if (!meta_kms_crtc_has_gamma (kms_crtc))
|
||||
return;
|
||||
g_return_if_fail (!crtc_kms->is_gamma_valid);
|
||||
g_return_if_fail (meta_kms_crtc_has_gamma (kms_crtc));
|
||||
|
||||
gamma = meta_monitor_manager_native_get_cached_crtc_gamma (monitor_manager_native,
|
||||
crtc_kms);
|
||||
if (!gamma)
|
||||
return;
|
||||
g_return_if_fail (gamma);
|
||||
|
||||
kms_update = meta_kms_ensure_pending_update (kms, kms_device);
|
||||
meta_kms_update_set_crtc_gamma (kms_update,
|
||||
kms_crtc,
|
||||
gamma->size,
|
||||
@ -531,6 +530,7 @@ meta_crtc_kms_new (MetaGpuKms *gpu_kms,
|
||||
|
||||
crtc_kms->kms_crtc = kms_crtc;
|
||||
crtc_kms->primary_plane = primary_plane;
|
||||
crtc_kms->is_gamma_valid = TRUE;
|
||||
|
||||
if (!kms_crtc_crtc_kms_quark)
|
||||
{
|
||||
|
@ -74,8 +74,10 @@ meta_crtc_kms_supports_format (MetaCrtcKms *crtc_kms,
|
||||
|
||||
void meta_crtc_kms_invalidate_gamma (MetaCrtcKms *crtc_kms);
|
||||
|
||||
void meta_crtc_kms_maybe_set_gamma (MetaCrtcKms *crtc_kms,
|
||||
MetaKmsDevice *kms_device);
|
||||
gboolean meta_crtc_kms_is_gamma_invalid (MetaCrtcKms *crtc_kms);
|
||||
|
||||
void meta_crtc_kms_set_gamma (MetaCrtcKms *crtc_kms,
|
||||
MetaKmsUpdate *kms_update);
|
||||
|
||||
MetaCrtcKms * meta_crtc_kms_from_kms_crtc (MetaKmsCrtc *kms_crtc);
|
||||
|
||||
|
@ -1395,8 +1395,16 @@ meta_onscreen_native_prepare_frame (CoglOnscreen *onscreen,
|
||||
MetaOutputKms *output_kms = META_OUTPUT_KMS (onscreen_native->output);
|
||||
MetaKmsCrtc *kms_crtc = meta_crtc_kms_get_kms_crtc (crtc_kms);
|
||||
MetaKmsDevice *kms_device = meta_kms_crtc_get_device (kms_crtc);
|
||||
MetaKms *kms = meta_kms_device_get_kms (kms_device);
|
||||
|
||||
if (meta_crtc_kms_is_gamma_invalid (crtc_kms))
|
||||
{
|
||||
MetaKmsUpdate *kms_update;
|
||||
|
||||
kms_update = meta_kms_ensure_pending_update (kms, kms_device);
|
||||
meta_crtc_kms_set_gamma (crtc_kms, kms_update);
|
||||
}
|
||||
|
||||
meta_crtc_kms_maybe_set_gamma (crtc_kms, kms_device);
|
||||
meta_output_kms_maybe_set_privacy_screen (output_kms, kms_device);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user