From patchwork Wed Jan 8 04:25:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shirish S X-Patchwork-Id: 3456791 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 50FB8C02DC for ; Thu, 9 Jan 2014 00:14:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 789A3201CD for ; Thu, 9 Jan 2014 00:14:40 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2D972201D5 for ; Thu, 9 Jan 2014 00:14:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4E6A7105A6F; Wed, 8 Jan 2014 16:14:35 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by gabe.freedesktop.org (Postfix) with ESMTP id F1BDDFACFC for ; Tue, 7 Jan 2014 20:23:49 -0800 (PST) Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MZ200CB7EVO0UB0@mailout4.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 08 Jan 2014 13:23:48 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.125]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id 86.11.14803.4D2DCC25; Wed, 08 Jan 2014 13:23:48 +0900 (KST) X-AuditID: cbfee691-b7efc6d0000039d3-ee-52ccd2d442fc Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id C2.7B.29263.3D2DCC25; Wed, 08 Jan 2014 13:23:47 +0900 (KST) Received: from chrome-server.sisodomain.com ([107.108.73.106]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MZ2008DZEVHES40@mmp2.samsung.com>; Wed, 08 Jan 2014 13:23:47 +0900 (KST) From: Shirish S To: dri-devel@lists.freedesktop.org, airlied@redhat.com, ajax@redhat.com Subject: [PATCH] drm: edid: enable probing and listing of non rb modes Date: Wed, 08 Jan 2014 09:55:51 +0530 Message-id: <1389155151-15952-2-git-send-email-s.shirish@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-reply-to: <1389155151-15952-1-git-send-email-s.shirish@samsung.com> References: <1389155151-15952-1-git-send-email-s.shirish@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNLMWRmVeSWpSXmKPExsWyRsSkVvfKpTNBBp2LOSyu3lrAZLHg2Som i4UP7zJbXPn6ns1i2uyNjBZNOw6yWXz/t5DJgd1jdsNFFo+93xaweMw7Gehxv/s4k8f7fVfZ PPq2rGIMYIvisklJzcksSy3St0vgyvh5+DxzwTalivWXfzM3MP6S6mLk5JAQMJH41X6NGcIW k7hwbz0biC0ksJRR4v1jA5ialuUbgeJcQPHpjBLrGjYxQzi9TBIbPm4F62YTUJe4OHk1mC0i 4CHR39/KAmIzC5RIHDu2DSwuLOAmsXDVNVYQm0VAVWLXgS9MIDavgKtEx6VjrBDbFCW6n00A u4ITqP7f4vOsEBe5Svw+vQPsCgmBeewSU7cuZ4IYJCDxbfIhoGUcQAlZiU0HoL6RlDi44gbL BEbhBYwMqxhFUwuSC4qT0otM9YoTc4tL89L1kvNzNzECA/70v2cTdzDeP2B9iDEZaNxEZinR 5HxgxOSVxBsamxlZmJqYGhuZW5qRJqwkzpv+KClISCA9sSQ1OzW1ILUovqg0J7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KrEUZyQaajEXFScCAOFcb8Ls AgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Mailman-Approved-At: Wed, 08 Jan 2014 16:14:14 -0800 Cc: daniel.vetter@ffwll.ch, shirish@chromium.org, Shirish S X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The current solution checks for the existing RB mode, if available in the edid block returns by adding it, but does not populate the connector with the modes of same resolution but which are non-rb modes. As a result the probing and listing of non-rb modes can't be made, in case the rb mode's pixel clock is not supported but non-rb mode is supported. This patch changes the drm_mode_std mode selection to collect all the supported modes and not just one mode. Signed-off-by: Shirish S --- drivers/gpu/drm/drm_edid.c | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 8835dcd..ba865f1 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -1592,12 +1592,13 @@ bad_std_timing(u8 a, u8 b) * Take the standard timing params (in this case width, aspect, and refresh) * and convert them into a real mode using CVT/GTF/DMT. */ -static struct drm_display_mode * +static unsigned int drm_mode_std(struct drm_connector *connector, struct edid *edid, struct std_timing *t, int revision) { struct drm_device *dev = connector->dev; struct drm_display_mode *m, *mode = NULL; + unsigned int modes = 0; int hsize, vsize; int vrefresh_rate; unsigned aspect_ratio = (t->vfreq_aspect & EDID_TIMING_ASPECT_MASK) @@ -1607,7 +1608,7 @@ drm_mode_std(struct drm_connector *connector, struct edid *edid, int timing_level = standard_timing_level(edid); if (bad_std_timing(t->hsize, t->vfreq_aspect)) - return NULL; + return modes; /* According to the EDID spec, the hdisplay = hsize * 8 + 248 */ hsize = t->hsize * 8 + 248; @@ -1643,7 +1644,7 @@ drm_mode_std(struct drm_connector *connector, struct edid *edid, list_for_each_entry(m, &connector->probed_modes, head) if (m->hdisplay == hsize && m->vdisplay == vsize && drm_mode_vrefresh(m) == vrefresh_rate) - return NULL; + return modes; /* HDTV hack, part 2 */ if (hsize == 1366 && vsize == 768 && vrefresh_rate == 60) { @@ -1652,19 +1653,21 @@ drm_mode_std(struct drm_connector *connector, struct edid *edid, mode->hdisplay = 1366; mode->hsync_start = mode->hsync_start - 1; mode->hsync_end = mode->hsync_end - 1; - return mode; + goto done; } /* check whether it can be found in default mode table */ if (drm_monitor_supports_rb(edid)) { mode = drm_mode_find_dmt(dev, hsize, vsize, vrefresh_rate, true); - if (mode) - return mode; + if (mode) { + drm_mode_probed_add(connector, mode); + modes++; + } } mode = drm_mode_find_dmt(dev, hsize, vsize, vrefresh_rate, false); if (mode) - return mode; + goto done; /* okay, generate it */ switch (timing_level) { @@ -1681,7 +1684,7 @@ drm_mode_std(struct drm_connector *connector, struct edid *edid, */ mode = drm_gtf_mode(dev, hsize, vsize, vrefresh_rate, 0, 0); if (!mode) - return NULL; + return modes; if (drm_mode_hsync(mode) > drm_gtf2_hbreak(edid)) { drm_mode_destroy(dev, mode); mode = drm_gtf_mode_complex(dev, hsize, vsize, @@ -1697,7 +1700,11 @@ drm_mode_std(struct drm_connector *connector, struct edid *edid, false); break; } - return mode; + +done: + drm_mode_probed_add(connector, mode); + return modes++; + } /* @@ -2179,15 +2186,10 @@ do_standard_modes(struct detailed_timing *timing, void *c) int i; for (i = 0; i < 6; i++) { struct std_timing *std; - struct drm_display_mode *newmode; std = &data->data.timings[i]; - newmode = drm_mode_std(connector, edid, std, + closure->modes += drm_mode_std(connector, edid, std, edid->revision); - if (newmode) { - drm_mode_probed_add(connector, newmode); - closure->modes++; - } } } } @@ -2208,15 +2210,10 @@ add_standard_modes(struct drm_connector *connector, struct edid *edid) }; for (i = 0; i < EDID_STD_TIMINGS; i++) { - struct drm_display_mode *newmode; - newmode = drm_mode_std(connector, edid, + modes += drm_mode_std(connector, edid, &edid->standard_timings[i], edid->revision); - if (newmode) { - drm_mode_probed_add(connector, newmode); - modes++; - } } if (version_greater(edid, 1, 0))