output/kms: Track in OutputInfo if the output is VRR capable

This includes checking the vrr_capable property on the connector as well
as the VRR_ENABLE property on any CRTC the connector might get assigned
to. Also takes into account when a GPU is tagged for broken VRR support.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3646>
This commit is contained in:
Sebastian Wick 2024-03-08 17:44:11 +01:00 committed by Marge Bot
parent 514a18fe0c
commit 91e3180985
2 changed files with 22 additions and 5 deletions

View File

@ -170,6 +170,8 @@ typedef struct _MetaOutputInfo
uint64_t supported_hdr_eotfs; uint64_t supported_hdr_eotfs;
uint64_t supported_rgb_ranges; uint64_t supported_rgb_ranges;
gboolean supports_vrr;
} MetaOutputInfo; } MetaOutputInfo;
gboolean gboolean

View File

@ -289,8 +289,7 @@ init_output_modes (MetaOutputInfo *output_info,
output_info->preferred_mode = NULL; output_info->preferred_mode = NULL;
add_vrr_modes = connector_state->vrr_capable && add_vrr_modes = output_info->supports_vrr;
!meta_gpu_kms_disable_vrr (gpu_kms);
if (add_vrr_modes) if (add_vrr_modes)
output_info->n_modes = g_list_length (connector_state->modes) * 2; output_info->n_modes = g_list_length (connector_state->modes) * 2;
@ -366,6 +365,7 @@ meta_output_kms_new (MetaGpuKms *gpu_kms,
MetaOutputKms *output_kms; MetaOutputKms *output_kms;
uint32_t drm_connector_type; uint32_t drm_connector_type;
const MetaKmsConnectorState *connector_state; const MetaKmsConnectorState *connector_state;
const MetaKmsCrtcState *crtc_state;
GArray *crtcs; GArray *crtcs;
GList *l; GList *l;
@ -394,8 +394,8 @@ meta_output_kms_new (MetaGpuKms *gpu_kms,
output_info->connector_type = output_info->connector_type =
meta_kms_connector_type_from_drm (drm_connector_type); meta_kms_connector_type_from_drm (drm_connector_type);
if (!init_output_modes (output_info, gpu_kms, kms_connector, error)) output_info->supports_vrr = connector_state->vrr_capable &&
return NULL; !meta_gpu_kms_disable_vrr (gpu_kms);
crtcs = g_array_new (FALSE, FALSE, sizeof (MetaCrtc *)); crtcs = g_array_new (FALSE, FALSE, sizeof (MetaCrtc *));
@ -407,8 +407,23 @@ meta_output_kms_new (MetaGpuKms *gpu_kms,
crtc_idx = meta_kms_crtc_get_idx (kms_crtc); crtc_idx = meta_kms_crtc_get_idx (kms_crtc);
if (connector_state->common_possible_crtcs & (1 << crtc_idx)) if (connector_state->common_possible_crtcs & (1 << crtc_idx))
{
g_array_append_val (crtcs, crtc_kms); g_array_append_val (crtcs, crtc_kms);
crtc_state = meta_kms_crtc_get_current_state (kms_crtc);
if (!crtc_state->vrr.supported)
{
meta_topic (META_DEBUG_KMS,
"Output is VRR capable, but a possible CRTC for the "
"output does not support VRR. Disabling support for "
"VRR on the output.");
output_info->supports_vrr = FALSE;
} }
}
}
if (!init_output_modes (output_info, gpu_kms, kms_connector, error))
return NULL;
output_info->n_possible_crtcs = crtcs->len; output_info->n_possible_crtcs = crtcs->len;
output_info->possible_crtcs = (MetaCrtc **) g_array_free (crtcs, FALSE); output_info->possible_crtcs = (MetaCrtc **) g_array_free (crtcs, FALSE);