diff mbox

[v2] drm/dp: Do not prune the last mode on the connector

Message ID 1506560661-29186-1-git-send-email-manasi.d.navare@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Navare, Manasi Sept. 28, 2017, 1:04 a.m. UTC
Currently the drm_mode_prune_invalid() function will
prune all the modes if it finds that the mode-status
is not MODE_OK. But if it ends up pruning all modes
then there are no modes left for that connector which will
eventually result into a black screen as userspace sees no
modes from the kernel. This can happen pretty quickly in case of
eDP panel that has only mode that might get pruned.
This patch fixes this problem by checking if the mode being pruned
is the last mode(only mode) on that connector and if so doesnt prune it.

v2:
* Use correct macro from list.h (Keith Packard)

Cc: dri-devel@lists.freedesktop.org
Cc: Keith Packard <keithp@keithp.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
---
 drivers/gpu/drm/drm_modes.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index 4a3f68a..9dc38a4 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -1185,7 +1185,8 @@  void drm_mode_prune_invalid(struct drm_device *dev,
 	struct drm_display_mode *mode, *t;
 
 	list_for_each_entry_safe(mode, t, mode_list, head) {
-		if (mode->status != MODE_OK) {
+		if (mode->status != MODE_OK &&
+		    !list_is_singular(mode_list)) {
 			list_del(&mode->head);
 			if (verbose) {
 				drm_mode_debug_printmodeline(mode);