From patchwork Fri Nov 15 05:08:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shirish S X-Patchwork-Id: 3190261 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 35CD49F39E for ; Fri, 15 Nov 2013 22:12:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 10227207C1 for ; Fri, 15 Nov 2013 22:12:47 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 87714206FD for ; Fri, 15 Nov 2013 22:12:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0A210105B0B; Fri, 15 Nov 2013 14:12:30 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 034A6FB71D for ; Thu, 14 Nov 2013 20:49:10 -0800 (PST) Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MWA0071NG1SDXH0@mailout1.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 15 Nov 2013 13:49:08 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.126]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id 12.FA.10672.4C7A5825; Fri, 15 Nov 2013 13:49:08 +0900 (KST) X-AuditID: cbfee68d-b7fa16d0000029b0-0c-5285a7c4f0c3 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 8E.82.09687.4C7A5825; Fri, 15 Nov 2013 13:49:08 +0900 (KST) Received: from chromeserver-PowerEdge-T410.sisodomain.com ([107.108.73.106]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MWA00JOHG1QVT60@mmp1.samsung.com>; Fri, 15 Nov 2013 13:49:08 +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: Fri, 15 Nov 2013 10:38:58 +0530 Message-id: <1384492138-12471-2-git-send-email-s.shirish@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-reply-to: <1384492138-12471-1-git-send-email-s.shirish@samsung.com> References: <1384492138-12471-1-git-send-email-s.shirish@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDLMWRmVeSWpSXmKPExsWyRsSkTvfI8tYgg9bPJhZXby1gsljwbBWT xcKHd5ktrnx9z2YxbfZGRoumHQfZLL7/W8jkwO4xu+Eii8febwtYPOadDPS4332cyeP9vqts Hn1bVjEGsEVx2aSk5mSWpRbp2yVwZSxZvIutYHZIxeZvV1gbGP86dTFyckgImEhM+nGICcIW k7hwbz1bFyMXh5DAUkaJrqnNLDBFC6+fZIVILGKU6O28B+XMZpLoWgnicHKwCahLXJy8mhnE FhHwkOjvbwXrZhYokTh2bBtYXFjATWLhqmtg9SwCqhI7jm0Hs3kFXCVWr3sHdYaiRPezCWwg NidQ/fUT88B6hYBq3m46yAiyWEJgEbvE9o3L2CEGCUh8m3wIaBkHUEJWYtMBZog5khIHV9xg mcAovICRYRWjaGpBckFxUnqRoV5xYm5xaV66XnJ+7iZGYMif/vesdwfj7QPWhxiTgcZNZJYS Tc4HxkxeSbyhsZmRhamJqbGRuaUZacJK4rxJD5OChATSE0tSs1NTC1KL4otKc1K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uxFGckGmoxFxUnAgDYKeMe 7AIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Mailman-Approved-At: Fri, 15 Nov 2013 14:12:12 -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.2 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 does 2 things: 1. adds "rb" suffix to rb modes. 2. 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 | 74 +++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 38 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 830f750..3276761 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -184,7 +184,7 @@ static const struct drm_display_mode drm_dmt_modes[] = { 896, 1048, 0, 600, 601, 604, 631, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 800x600@120Hz RB */ - { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 73250, 800, 848, + { DRM_MODE("800x600rb", DRM_MODE_TYPE_DRIVER, 73250, 800, 848, 880, 960, 0, 600, 603, 607, 636, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 848x480@60Hz */ @@ -213,7 +213,7 @@ static const struct drm_display_mode drm_dmt_modes[] = { 1168, 1376, 0, 768, 769, 772, 808, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 1024x768@120Hz RB */ - { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 115500, 1024, 1072, + { DRM_MODE("1024x768rb", DRM_MODE_TYPE_DRIVER, 115500, 1024, 1072, 1104, 1184, 0, 768, 771, 775, 813, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 1152x864@75Hz */ @@ -221,7 +221,7 @@ static const struct drm_display_mode drm_dmt_modes[] = { 1344, 1600, 0, 864, 865, 868, 900, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 1280x768@60Hz RB */ - { DRM_MODE("1280x768", DRM_MODE_TYPE_DRIVER, 68250, 1280, 1328, + { DRM_MODE("1280x768rb", DRM_MODE_TYPE_DRIVER, 68250, 1280, 1328, 1360, 1440, 0, 768, 771, 778, 790, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 1280x768@60Hz */ @@ -237,11 +237,11 @@ static const struct drm_display_mode drm_dmt_modes[] = { 1496, 1712, 0, 768, 771, 778, 809, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 1280x768@120Hz RB */ - { DRM_MODE("1280x768", DRM_MODE_TYPE_DRIVER, 140250, 1280, 1328, + { DRM_MODE("1280x768rb", DRM_MODE_TYPE_DRIVER, 140250, 1280, 1328, 1360, 1440, 0, 768, 771, 778, 813, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 1280x800@60Hz RB */ - { DRM_MODE("1280x800", DRM_MODE_TYPE_DRIVER, 71000, 1280, 1328, + { DRM_MODE("1280x800rb", DRM_MODE_TYPE_DRIVER, 71000, 1280, 1328, 1360, 1440, 0, 800, 803, 809, 823, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 1280x800@60Hz */ @@ -257,7 +257,7 @@ static const struct drm_display_mode drm_dmt_modes[] = { 1496, 1712, 0, 800, 803, 809, 843, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 1280x800@120Hz RB */ - { DRM_MODE("1280x800", DRM_MODE_TYPE_DRIVER, 146250, 1280, 1328, + { DRM_MODE("1280x800rb", DRM_MODE_TYPE_DRIVER, 146250, 1280, 1328, 1360, 1440, 0, 800, 803, 809, 847, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 1280x960@60Hz */ @@ -269,7 +269,7 @@ static const struct drm_display_mode drm_dmt_modes[] = { 1504, 1728, 0, 960, 961, 964, 1011, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 1280x960@120Hz RB */ - { DRM_MODE("1280x960", DRM_MODE_TYPE_DRIVER, 175500, 1280, 1328, + { DRM_MODE("1280x960rb", DRM_MODE_TYPE_DRIVER, 175500, 1280, 1328, 1360, 1440, 0, 960, 963, 967, 1017, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 1280x1024@60Hz */ @@ -285,7 +285,7 @@ static const struct drm_display_mode drm_dmt_modes[] = { 1504, 1728, 0, 1024, 1025, 1028, 1072, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 1280x1024@120Hz RB */ - { DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER, 187250, 1280, 1328, + { DRM_MODE("1280x1024rb", DRM_MODE_TYPE_DRIVER, 187250, 1280, 1328, 1360, 1440, 0, 1024, 1027, 1034, 1084, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 1360x768@60Hz */ @@ -293,11 +293,11 @@ static const struct drm_display_mode drm_dmt_modes[] = { 1536, 1792, 0, 768, 771, 777, 795, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 1360x768@120Hz RB */ - { DRM_MODE("1360x768", DRM_MODE_TYPE_DRIVER, 148250, 1360, 1408, + { DRM_MODE("1360x768rb", DRM_MODE_TYPE_DRIVER, 148250, 1360, 1408, 1440, 1520, 0, 768, 771, 776, 813, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 1400x1050@60Hz RB */ - { DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER, 101000, 1400, 1448, + { DRM_MODE("1400x1050rb", DRM_MODE_TYPE_DRIVER, 101000, 1400, 1448, 1480, 1560, 0, 1050, 1053, 1057, 1080, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 1400x1050@60Hz */ @@ -313,11 +313,11 @@ static const struct drm_display_mode drm_dmt_modes[] = { 1656, 1912, 0, 1050, 1053, 1057, 1105, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 1400x1050@120Hz RB */ - { DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER, 208000, 1400, 1448, + { DRM_MODE("1400x1050rb", DRM_MODE_TYPE_DRIVER, 208000, 1400, 1448, 1480, 1560, 0, 1050, 1053, 1057, 1112, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 1440x900@60Hz RB */ - { DRM_MODE("1440x900", DRM_MODE_TYPE_DRIVER, 88750, 1440, 1488, + { DRM_MODE("1440x900rb", DRM_MODE_TYPE_DRIVER, 88750, 1440, 1488, 1520, 1600, 0, 900, 903, 909, 926, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 1440x900@60Hz */ @@ -333,7 +333,7 @@ static const struct drm_display_mode drm_dmt_modes[] = { 1696, 1952, 0, 900, 903, 909, 948, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 1440x900@120Hz RB */ - { DRM_MODE("1440x900", DRM_MODE_TYPE_DRIVER, 182750, 1440, 1488, + { DRM_MODE("1440x900rb", DRM_MODE_TYPE_DRIVER, 182750, 1440, 1488, 1520, 1600, 0, 900, 903, 909, 953, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 1600x1200@60Hz */ @@ -357,11 +357,11 @@ static const struct drm_display_mode drm_dmt_modes[] = { 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 1600x1200@120Hz RB */ - { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 268250, 1600, 1648, + { DRM_MODE("1600x1200rb", DRM_MODE_TYPE_DRIVER, 268250, 1600, 1648, 1680, 1760, 0, 1200, 1203, 1207, 1271, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 1680x1050@60Hz RB */ - { DRM_MODE("1680x1050", DRM_MODE_TYPE_DRIVER, 119000, 1680, 1728, + { DRM_MODE("1680x1050rb", DRM_MODE_TYPE_DRIVER, 119000, 1680, 1728, 1760, 1840, 0, 1050, 1053, 1059, 1080, 0, DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 1680x1050@60Hz */ @@ -1561,12 +1561,12 @@ 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 * -drm_mode_std(struct drm_connector *connector, struct edid *edid, +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) @@ -1576,7 +1576,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; @@ -1612,7 +1612,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) { @@ -1621,19 +1621,20 @@ 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) { @@ -1650,7 +1651,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, @@ -1666,7 +1667,14 @@ drm_mode_std(struct drm_connector *connector, struct edid *edid, false); break; } - return mode; + +done: + if (mode) { + drm_mode_probed_add(connector, mode); + modes++; + } + + return modes; } /* @@ -2148,15 +2156,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++; - } } } } @@ -2177,15 +2180,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))