From patchwork Thu Sep 28 01:04:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Navare, Manasi" X-Patchwork-Id: 9975107 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 AC1DA6037F for ; Thu, 28 Sep 2017 01:00:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A553528555 for ; Thu, 28 Sep 2017 01:00:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A59629354; Thu, 28 Sep 2017 01:00:36 +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=unavailable 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 6C27928555 for ; Thu, 28 Sep 2017 01:00:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 08C186E08A; Thu, 28 Sep 2017 01:00:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id D6D896E08A; Thu, 28 Sep 2017 01:00:32 +0000 (UTC) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP; 27 Sep 2017 18:00:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.42,447,1500966000"; d="scan'208"; a="1176503967" Received: from labuser-z97x-ud5h.jf.intel.com ([10.7.199.62]) by orsmga001.jf.intel.com with ESMTP; 27 Sep 2017 18:00:30 -0700 From: Manasi Navare To: intel-gfx@lists.freedesktop.org Subject: [PATCH v2] drm/dp: Do not prune the last mode on the connector Date: Wed, 27 Sep 2017 18:04:21 -0700 Message-Id: <1506560661-29186-1-git-send-email-manasi.d.navare@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1506556833-2579-1-git-send-email-manasi.d.navare@intel.com> References: <1506556833-2579-1-git-send-email-manasi.d.navare@intel.com> Cc: Keith Packard , Daniel Vetter , Manasi Navare , dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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(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 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..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);