From patchwork Mon Mar 29 21:43:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Jackson X-Patchwork-Id: 89097 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2TLkUcs024366 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 29 Mar 2010 21:47:07 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NwMmB-0004ww-8i; Mon, 29 Mar 2010 21:45:39 +0000 Received: from sfi-mx-4.v28.ch3.sourceforge.com ([172.29.28.124] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NwMmA-0004wl-6Z for dri-devel@lists.sourceforge.net; Mon, 29 Mar 2010 21:45:38 +0000 Received-SPF: pass (sfi-mx-4.v28.ch3.sourceforge.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=ajax@redhat.com; helo=mx1.redhat.com; Received: from mx1.redhat.com ([209.132.183.28]) by sfi-mx-4.v28.ch3.sourceforge.com with esmtp (Exim 4.69) id 1NwMm9-0000Zf-9H for dri-devel@lists.sourceforge.net; Mon, 29 Mar 2010 21:45:38 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2TLjSqo013774 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 29 Mar 2010 17:45:29 -0400 Received: from localhost.localdomain (ihatethathostname.lab.bos.redhat.com [10.16.43.238]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2TLhWM9032019 for ; Mon, 29 Mar 2010 17:45:22 -0400 From: Adam Jackson To: dri-devel@lists.sf.net Subject: [PATCH 12/14] drm/edid: Strengthen the algorithm for standard mode codes Date: Mon, 29 Mar 2010 17:43:29 -0400 Message-Id: <1269899011-22519-12-git-send-email-ajax@redhat.com> In-Reply-To: <1269899011-22519-11-git-send-email-ajax@redhat.com> References: <1269899011-22519-1-git-send-email-ajax@redhat.com> <1269899011-22519-2-git-send-email-ajax@redhat.com> <1269899011-22519-3-git-send-email-ajax@redhat.com> <1269899011-22519-4-git-send-email-ajax@redhat.com> <1269899011-22519-5-git-send-email-ajax@redhat.com> <1269899011-22519-6-git-send-email-ajax@redhat.com> <1269899011-22519-7-git-send-email-ajax@redhat.com> <1269899011-22519-8-git-send-email-ajax@redhat.com> <1269899011-22519-9-git-send-email-ajax@redhat.com> <1269899011-22519-10-git-send-email-ajax@redhat.com> <1269899011-22519-11-git-send-email-ajax@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-Spam-Score: -1.4 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 AWL AWL: From: address is in the auto white-list X-Headers-End: 1NwMm9-0000Zf-9H X-BeenThere: dri-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 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.sourceforge.net X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 29 Mar 2010 21:47:07 +0000 (UTC) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 93ddc9a..8c8acfe 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -736,12 +736,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. */ -struct drm_display_mode *drm_mode_std(struct drm_device *dev, - struct std_timing *t, - int revision, - int timing_level) +static struct drm_display_mode * +drm_mode_std(struct drm_connector *connector, struct std_timing *t, + int revision, int timing_level) { - struct drm_display_mode *mode; + struct drm_device *dev = connector->dev; + struct drm_display_mode *m, *mode = NULL; int hsize, vsize; int vrefresh_rate; unsigned aspect_ratio = (t->vfreq_aspect & EDID_TIMING_ASPECT_MASK) @@ -777,6 +777,17 @@ struct drm_display_mode *drm_mode_std(struct drm_device *dev, vsize = 768; } + /* + * If this connector already has a mode for this size and refresh + * rate (because it came from detailed or CVT info), use that + * instead. This way we don't have to guess at interlace or + * reduced blanking. + */ + list_for_each_entry(m, &connector->modes, head) + if (m->hdisplay == hsize && m->vdisplay == vsize && + drm_mode_vrefresh(m) == vrefresh_rate) + return NULL; + /* HDTV hack, part 2 */ if (hsize == 1366 && vsize == 768 && vrefresh_rate == 60) { mode = drm_cvt_mode(dev, 1366, 768, vrefresh_rate, 0, 0, @@ -787,7 +798,6 @@ struct drm_display_mode *drm_mode_std(struct drm_device *dev, return mode; } - mode = NULL; /* check whether it can be found in default mode table */ mode = drm_find_dmt(dev, hsize, vsize, vrefresh_rate); if (mode) @@ -1067,17 +1077,15 @@ static int standard_timing_level(struct edid *edid) */ static int add_standard_modes(struct drm_connector *connector, struct edid *edid) { - struct drm_device *dev = connector->dev; int i, modes = 0; int timing_level; timing_level = standard_timing_level(edid); for (i = 0; i < EDID_STD_TIMINGS; i++) { - struct std_timing *t = &edid->standard_timings[i]; struct drm_display_mode *newmode; - newmode = drm_mode_std(dev, &edid->standard_timings[i], + newmode = drm_mode_std(connector, &edid->standard_timings[i], edid->revision, timing_level); if (newmode) { drm_mode_probed_add(connector, newmode); @@ -1374,7 +1382,7 @@ static int add_detailed_modes(struct drm_connector *connector, struct drm_display_mode *newmode; std = &data->data.timings[i]; - newmode = drm_mode_std(dev, std, edid->revision, + newmode = drm_mode_std(connector, std, edid->revision, timing_level); if (newmode) { drm_mode_probed_add(connector, newmode);