|
|
6fc731 |
From cf16c0d16b42215f35dcede6163235ad5ec1734b Mon Sep 17 00:00:00 2001
|
|
|
6fc731 |
From: Mario Limonciello <mario.limonciello@amd.com>
|
|
|
6fc731 |
Date: Thu, 18 Aug 2022 13:36:20 -0500
|
|
|
6fc731 |
Subject: [PATCH] output/kms: Add more heuristics to decide when to offer
|
|
|
6fc731 |
fallback modes
|
|
|
6fc731 |
|
|
|
6fc731 |
If the panel is connected via eDP and supports more than one mode
|
|
|
6fc731 |
at different resolutions don't try to add more.
|
|
|
6fc731 |
|
|
|
6fc731 |
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2586>
|
|
|
6fc731 |
(cherry picked from commit 96aa0fb8536eca579ceb1b17d83e19cf9e3e9e81)
|
|
|
6fc731 |
---
|
|
|
6fc731 |
src/backends/native/meta-output-kms.c | 45 ++++++++++++++++++++++-----
|
|
|
6fc731 |
1 file changed, 38 insertions(+), 7 deletions(-)
|
|
|
6fc731 |
|
|
|
6fc731 |
diff --git a/src/backends/native/meta-output-kms.c b/src/backends/native/meta-output-kms.c
|
|
|
6fc731 |
index f3cc543c4d..44c25c5648 100644
|
|
|
6fc731 |
--- a/src/backends/native/meta-output-kms.c
|
|
|
6fc731 |
+++ b/src/backends/native/meta-output-kms.c
|
|
|
6fc731 |
@@ -505,6 +505,43 @@ compare_modes (const void *one,
|
|
|
6fc731 |
return g_strcmp0 (b->name, a->name);
|
|
|
6fc731 |
}
|
|
|
6fc731 |
|
|
|
6fc731 |
+static gboolean
|
|
|
6fc731 |
+are_all_modes_equally_sized (MetaOutput *output)
|
|
|
6fc731 |
+{
|
|
|
6fc731 |
+ MetaCrtcMode *base = output->modes[0];
|
|
|
6fc731 |
+ int i;
|
|
|
6fc731 |
+
|
|
|
6fc731 |
+ for (i = 1; i < output->n_modes; i++)
|
|
|
6fc731 |
+ {
|
|
|
6fc731 |
+ MetaCrtcMode *crtc_mode = output->modes[i];
|
|
|
6fc731 |
+
|
|
|
6fc731 |
+ if (base->width != crtc_mode->width ||
|
|
|
6fc731 |
+ base->height != crtc_mode->height)
|
|
|
6fc731 |
+ return FALSE;
|
|
|
6fc731 |
+ }
|
|
|
6fc731 |
+
|
|
|
6fc731 |
+ return TRUE;
|
|
|
6fc731 |
+}
|
|
|
6fc731 |
+
|
|
|
6fc731 |
+static void
|
|
|
6fc731 |
+maybe_add_fallback_modes (MetaOutput *output,
|
|
|
6fc731 |
+ MetaGpuKms *gpu_kms)
|
|
|
6fc731 |
+{
|
|
|
6fc731 |
+ MetaOutputKms *output_kms = output->driver_private;
|
|
|
6fc731 |
+
|
|
|
6fc731 |
+ if (!output_kms->has_scaling)
|
|
|
6fc731 |
+ return;
|
|
|
6fc731 |
+
|
|
|
6fc731 |
+ if (output->n_modes == 0)
|
|
|
6fc731 |
+ return;
|
|
|
6fc731 |
+
|
|
|
6fc731 |
+ if (output_kms->connector->connector_type == DRM_MODE_CONNECTOR_eDP &&
|
|
|
6fc731 |
+ !are_all_modes_equally_sized (output))
|
|
|
6fc731 |
+ return;
|
|
|
6fc731 |
+
|
|
|
6fc731 |
+ add_common_modes (output, gpu_kms);
|
|
|
6fc731 |
+}
|
|
|
6fc731 |
+
|
|
|
6fc731 |
static gboolean
|
|
|
6fc731 |
init_output_modes (MetaOutput *output,
|
|
|
6fc731 |
MetaGpuKms *gpu_kms,
|
|
|
6fc731 |
@@ -528,13 +565,7 @@ init_output_modes (MetaOutput *output,
|
|
|
6fc731 |
output->preferred_mode = output->modes[i];
|
|
|
6fc731 |
}
|
|
|
6fc731 |
|
|
|
6fc731 |
- /* FIXME: MSC feature bit? */
|
|
|
6fc731 |
- /* Presume that if the output supports scaling, then we have
|
|
|
6fc731 |
- * a panel fitter capable of adjusting any mode to suit.
|
|
|
6fc731 |
- */
|
|
|
6fc731 |
- if (output_kms->has_scaling)
|
|
|
6fc731 |
- add_common_modes (output, gpu_kms);
|
|
|
6fc731 |
-
|
|
|
6fc731 |
+ maybe_add_fallback_modes (output, gpu_kms);
|
|
|
6fc731 |
if (!output->modes)
|
|
|
6fc731 |
{
|
|
|
6fc731 |
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
|
|
6fc731 |
--
|
|
|
6fc731 |
2.37.1
|
|
|
6fc731 |
|