All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] drm/edid: drm_add_modes_noedid() should set lowest resolution as preferred
@ 2022-04-26 20:21 ` Douglas Anderson
  0 siblings, 0 replies; 24+ messages in thread
From: Douglas Anderson @ 2022-04-26 20:21 UTC (permalink / raw)
  To: dri-devel
  Cc: robdclark, linux-arm-msm, quic_abhinavk, quic_khsieh,
	quic_aravindh, swboyd, dmitry.baryshkov, quic_sbillaka,
	Douglas Anderson, Daniel Vetter, David Airlie, Maarten Lankhorst,
	Maxime Ripard, Thomas Zimmermann, linux-kernel

If we're unable to read the EDID for a display because it's corrupt /
bogus / invalid then we'll add a set of standard modes for the
display. When userspace looks at these modes it doesn't really have a
good concept for which mode to pick and it'll likely pick the highest
resolution one by default. That's probably not ideal because the modes
were purely guesses on the part of the Linux kernel.

Let's instead set 640x480 as the "preferred" mode when we have no EDID.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
---

 drivers/gpu/drm/drm_edid.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 7a8482b75071..64ccfff4167e 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -5839,6 +5839,15 @@ int drm_add_modes_noedid(struct drm_connector *connector,
 			continue;
 		mode = drm_mode_duplicate(dev, ptr);
 		if (mode) {
+			/*
+			 * The drm_dmt_modes array is sorted so that lower
+			 * resolutions come first. We'll set the lowest
+			 * resolution mode as preferred. We have no EDID so
+			 * we should prefer the lowest resolution mode as
+			 * the safest one.
+			 */
+			if (num_modes == 0)
+				mode->type |= DRM_MODE_TYPE_PREFERRED;
 			drm_mode_probed_add(connector, mode);
 			num_modes++;
 		}
-- 
2.36.0.rc2.479.g8af0fa9b8e-goog


^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2022-05-11  0:03 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-26 20:21 [RFC PATCH] drm/edid: drm_add_modes_noedid() should set lowest resolution as preferred Douglas Anderson
2022-04-26 20:21 ` Douglas Anderson
2022-04-26 20:45 ` Abhinav Kumar
2022-04-26 20:45   ` Abhinav Kumar
2022-04-26 20:52   ` Doug Anderson
2022-04-26 20:52     ` Doug Anderson
2022-04-26 21:21     ` Abhinav Kumar
2022-04-26 21:21       ` Abhinav Kumar
2022-04-27 21:20       ` Kuogee Hsieh
2022-04-27 21:20         ` Kuogee Hsieh
2022-05-05 15:44 ` Doug Anderson
2022-05-05 15:44   ` Doug Anderson
2022-05-06 11:16   ` Jani Nikula
2022-05-06 11:16     ` Jani Nikula
2022-05-06 16:33     ` Abhinav Kumar
2022-05-06 16:33       ` Abhinav Kumar
2022-05-10 20:53       ` Doug Anderson
2022-05-10 20:53         ` Doug Anderson
2022-05-10 21:33         ` Abhinav Kumar
2022-05-10 21:33           ` Abhinav Kumar
2022-05-10 21:41           ` Doug Anderson
2022-05-10 21:41             ` Doug Anderson
2022-05-11  0:03             ` Abhinav Kumar
2022-05-11  0:03               ` Abhinav Kumar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.