From 4c7a846dc89098149cab0da6c1ac7573eb8e465c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 14 Apr 2021 09:03:12 +0200 Subject: [PATCH] output/kms: Only add common modes for single mode connectors If there was only a single mode, add the common modes to provide options to select other resolutions than the built in default. This avoids issues where the connector listed multiple supported modes, but where the common modes added would exceed the possible bandwidth. We could probably make an attempt to filter out more modes from the common mode list to avoid these issues, but it's likely that the driver already lists suitable modes, meaning there is no point in adding the common modes. The common modes were initially added[0] to add modes to connectors with a single bundled mode, so we shouldn't regress the original bug fix. [0] https://bugzilla.gnome.org/show_bug.cgi?id=744544 Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1232 Part-of: --- src/backends/native/meta-output-kms.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/backends/native/meta-output-kms.c b/src/backends/native/meta-output-kms.c index 024344a3c..fa265bcad 100644 --- a/src/backends/native/meta-output-kms.c +++ b/src/backends/native/meta-output-kms.c @@ -245,11 +245,14 @@ init_output_modes (MetaOutputInfo *output_info, output_info->preferred_mode = output_info->modes[i]; } - /* Presume that if the output supports scaling, then we have - * a panel fitter capable of adjusting any mode to suit. - */ - if (connector_state->has_scaling) - add_common_modes (output_info, gpu_kms); + if (connector_state->has_scaling && + g_list_length (connector_state->modes) == 1) + { + meta_topic (META_DEBUG_KMS, "Adding common modes to connector %u on %s", + meta_kms_connector_get_id (kms_connector), + meta_gpu_kms_get_file_path (gpu_kms)); + add_common_modes (output_info, gpu_kms); + } if (!output_info->modes) {