From patchwork Wed Jun 1 09:34:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9146885 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 CD81160757 for ; Wed, 1 Jun 2016 09:34:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB1A426538 for ; Wed, 1 Jun 2016 09:34:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF70F26785; Wed, 1 Jun 2016 09:34:50 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE08826538 for ; Wed, 1 Jun 2016 09:34:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3AF0B6E8F6; Wed, 1 Jun 2016 09:34:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lb0-x242.google.com (mail-lb0-x242.google.com [IPv6:2a00:1450:4010:c04::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0C7476E931 for ; Wed, 1 Jun 2016 09:34:45 +0000 (UTC) Received: by mail-lb0-x242.google.com with SMTP id t6so97223lbv.1 for ; Wed, 01 Jun 2016 02:34:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8f/lX20SL1OxN+DmXUeuVh6hbv9XpZTyBwzD6nL+2hQ=; b=u0duvuR5OfPDSAQPD6BJhu01jOSCo25mE6PoQDq8T3+/hjqhl3rLs6u8FX51nOJH+A Ohn7Zl7Ad+k4czBjCIwoHqyj2ehNYAT15Qjp2EMewO8qpySAuTkj9fdb3UfBNL/zewIP gCJw48vJX+kiRIkWeG4yP63APheBScVbus9wevuiCKaaTLquBoPkcefvW4ril9iI+Sp5 o1L6nFmV9NMrz/L1BkDnsvl7O4ZsMOYO3xS7F3BHr8AQ7MoXUPZsiKuKaRTsAOXl49Ty eUWlFWP50+kDI/8kNd6Tk7JhGIiGBRQG+qIgWx9cBNqgXB+KxBVJu6Fl6S7MKVlWrDGL 97AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=8f/lX20SL1OxN+DmXUeuVh6hbv9XpZTyBwzD6nL+2hQ=; b=m+TG54HlagkRF+inIZJspKjo5uS/epzt47Z5uOox5mi/BaswfEkyy1P2ddAHaT4JyW 3uA6tHnFz167pQHhVaxxsgGvnqqPfOyfAKznhklZQTDiL9mYmNNl+8C9W2aPsDYUjw1Y 6QNdxL6q5lgG7q7Fa+J6VD7aXbIvbTf8yaPz9byv5oBGZ2fElxToTVGMDTr8M2b+qD4/ bcaBOov8c7MqU8C2LIzhAZ+kSZcgpCAwlM86zUCXv2+lUW6Sl7y2rIlJ+FVMIZjNmiUb lQSNTfuneWuaaC4Jgqxrik+2uvszdt+TErDufbyHs9JNq2Cy2WEMYz+qcPPa/1D2Ln6u OTFw== X-Gm-Message-State: ALyK8tIj2G0u1hAvXQLwOwIOMFah5Zb3y+M0u4Y52I9k07yP35wXgxqYj0AkZWtWZ7R3kw== X-Received: by 10.195.18.99 with SMTP id gl3mr2526720wjd.162.1464773682904; Wed, 01 Jun 2016 02:34:42 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id dd7sm44503376wjb.22.2016.06.01.02.34.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Jun 2016 02:34:41 -0700 (PDT) From: Chris Wilson To: dri-devel@lists.freedesktop.org Subject: [PATCH v3] drm: Only create a cmdline mode if no probed modes match Date: Wed, 1 Jun 2016 10:34:36 +0100 Message-Id: <1464773676-20152-1-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1429532795-3922-1-git-send-email-chris@chris-wilson.co.uk> References: <1429532795-3922-1-git-send-email-chris@chris-wilson.co.uk> MIME-Version: 1.0 Cc: Daniel Vetter , Jesse Barnes , stable@vger.kernel.org, =?UTF-8?q?Radek=20Dost=C3=A1l?= , Dave Airlie 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The intention of using video=: is primarily to select the user's preferred resolution at startup. Currently we always create a new mode irrespective of whether the monitor has a native mode at the desired resolution. This has the issue that we may then select the fake mode rather the native mode during fb_helper->inital_config() and so if the fake mode is invalid we then end up with a loss of signal. Oops. This invalid fake mode would also be exported to userspace, who potentially may make the same mistake. To avoid this issue, we filter out the added command line mode if we detect the desired resolution (and clock if specified) amongst the probed modes. This fixes the immediate problem of adding a duplicate mode, but perhaps more generically we should avoid adding a GTF mode if the monitor has an EDID that is not GTF-compatible, or similarly for CVT. Fixes regression from commit eaf99c749d43ae74ac7ffece5512f3c73f01dfd2 Author: Chris Wilson Date: Wed Aug 6 10:08:32 2014 +0200 drm: Perform cmdline mode parsing during connector initialisation that breaks HDMI output on BeagleBone Black with LG TV (model 19LS4R-ZA). v2: Explicitly delete our earlier cmdline mode v3: Mode pruning should now be sufficient to delete stale cmdline modes Reported-by: Radek Dostál Signed-off-by: Chris Wilson Cc: Radek Dostál Cc: Jesse Barnes Cc: Ville Syrjälä Cc: Daniel Vetter Cc: dri-devel@lists.freedesktop.org Cc: Julia Lemire Cc: Dave Airlie Cc: stable@vger.kernel.org --- drivers/gpu/drm/drm_probe_helper.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index 0329080d7f7c..a705ed12c062 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c @@ -82,13 +82,28 @@ drm_mode_validate_flag(const struct drm_display_mode *mode, static int drm_helper_probe_add_cmdline_mode(struct drm_connector *connector) { + struct drm_cmdline_mode *cmdline_mode; struct drm_display_mode *mode; - if (!connector->cmdline_mode.specified) + cmdline_mode = &connector->cmdline_mode; + if (!cmdline_mode->specified) return 0; + /* Only add a GTF mode if we find no matching probed modes */ + list_for_each_entry(mode, &connector->probed_modes, head) { + if (mode->hdisplay != cmdline_mode->xres || + mode->vdisplay != cmdline_mode->yres) + continue; + + if (cmdline_mode->refresh_specified && + mode->vrefresh != cmdline_mode->refresh) + continue; + + return 0; + } + mode = drm_mode_create_from_cmdline_mode(connector->dev, - &connector->cmdline_mode); + cmdline_mode); if (mode == NULL) return 0;