From patchwork Thu Sep 28 00:00:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Navare, Manasi" X-Patchwork-Id: 9975071 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4DA31601D2 for ; Wed, 27 Sep 2017 23:56:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46D6B28F83 for ; Wed, 27 Sep 2017 23:56:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3AB3829000; Wed, 27 Sep 2017 23:56:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9751428F83 for ; Wed, 27 Sep 2017 23:56:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0B5306E7ED; Wed, 27 Sep 2017 23:56:58 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4B0556E7ED; Wed, 27 Sep 2017 23:56:57 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Sep 2017 16:56:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.42,447,1500966000"; d="scan'208"; a="1019235899" Received: from labuser-z97x-ud5h.jf.intel.com ([10.7.199.62]) by orsmga003.jf.intel.com with ESMTP; 27 Sep 2017 16:56:56 -0700 From: Manasi Navare To: intel-gfx@lists.freedesktop.org Date: Wed, 27 Sep 2017 17:00:33 -0700 Message-Id: <1506556833-2579-1-git-send-email-manasi.d.navare@intel.com> X-Mailer: git-send-email 2.1.4 Cc: Keith Packard , Daniel Vetter , dri-devel@lists.freedesktop.org Subject: [Intel-gfx] [PATCH] drm/dp: Do not prune the last mode on the connector X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP 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 on that connector and if so doesnt prune it. Cc: dri-devel@lists.freedesktop.org Cc: Keith Packard Cc: Jani Nikula Cc: Ville Syrjala Cc: Daniel Vetter Signed-off-by: Manasi Navare --- drivers/gpu/drm/drm_modes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index 4a3f68a..a9369eb 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_last(&mode->head, mode_list))) { list_del(&mode->head); if (verbose) { drm_mode_debug_printmodeline(mode);