All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/12] Add more DMT and common modes
@ 2012-04-13 20:33 Adam Jackson
  2012-04-13 20:33 ` [PATCH 01/12] drm/edid: Document drm_mode_find_dmt Adam Jackson
                   ` (13 more replies)
  0 siblings, 14 replies; 26+ messages in thread
From: Adam Jackson @ 2012-04-13 20:33 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

Incorporates some feedback from Rodrigo and Takashi.  Major themes of the
series:

- Fix the DMT list to include reduced-blanking modes
- Add modes from DMT for any range descriptor type
- Add an extra modes list for things not in DMT
- For ranges that specify a formula, generate timings from the extra modes

This still doesn't address the driver policy decision of "I know I have
a scaler, add modes as if there were a range descriptor even if there's
not one".  But it should at least make clear what such a helper function
should do.

- ajax

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH 01/12] drm/edid: Document drm_mode_find_dmt
  2012-04-13 20:33 [PATCH 00/12] Add more DMT and common modes Adam Jackson
@ 2012-04-13 20:33 ` Adam Jackson
  2012-04-13 20:33 ` [PATCH 02/12] drm/edid: Rewrite drm_mode_find_dmt search loop Adam Jackson
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 26+ messages in thread
From: Adam Jackson @ 2012-04-13 20:33 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

Signed-off-by: Adam Jackson <ajax@redhat.com>
---
 drivers/gpu/drm/drm_edid.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 5a18b0d..79a3637 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -486,6 +486,16 @@ static void edid_fixup_preferred(struct drm_connector *connector,
 	preferred_mode->type |= DRM_MODE_TYPE_PREFERRED;
 }
 
+/*
+ * drm_mode_find_dmt - Create a copy of a mode if present in DMT
+ * @dev: Device to duplicate against
+ * @hsize: Mode width
+ * @vsize: Mode height
+ * @fresh: Mode refresh rate
+ *
+ * Walk the DMT mode list looking for a match for the given parameters.
+ * Return a newly allocated copy of the mode, or NULL if not found.
+ */
 struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
 					   int hsize, int vsize, int fresh)
 {
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 02/12] drm/edid: Rewrite drm_mode_find_dmt search loop
  2012-04-13 20:33 [PATCH 00/12] Add more DMT and common modes Adam Jackson
  2012-04-13 20:33 ` [PATCH 01/12] drm/edid: Document drm_mode_find_dmt Adam Jackson
@ 2012-04-13 20:33 ` Adam Jackson
  2012-04-13 20:33 ` [PATCH 03/12] drm/edid: Allow drm_mode_find_dmt to hunt for reduced-blanking modes Adam Jackson
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 26+ messages in thread
From: Adam Jackson @ 2012-04-13 20:33 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

No functional change, but will make an upcoming change clearer.

Signed-off-by: Adam Jackson <ajax@redhat.com>
---
 drivers/gpu/drm/drm_edid.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 79a3637..0a23ee5 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -499,20 +499,21 @@ static void edid_fixup_preferred(struct drm_connector *connector,
 struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
 					   int hsize, int vsize, int fresh)
 {
-	struct drm_display_mode *mode = NULL;
 	int i;
 
 	for (i = 0; i < drm_num_dmt_modes; i++) {
 		const struct drm_display_mode *ptr = &drm_dmt_modes[i];
-		if (hsize == ptr->hdisplay &&
-			vsize == ptr->vdisplay &&
-			fresh == drm_mode_vrefresh(ptr)) {
-			/* get the expected default mode */
-			mode = drm_mode_duplicate(dev, ptr);
-			break;
-		}
+		if (hsize != ptr->hdisplay)
+			continue;
+		if (vsize != ptr->vdisplay)
+			continue;
+		if (fresh != drm_mode_vrefresh(ptr))
+			continue;
+
+		return drm_mode_duplicate(dev, ptr);
 	}
-	return mode;
+
+	return NULL;
 }
 EXPORT_SYMBOL(drm_mode_find_dmt);
 
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 03/12] drm/edid: Allow drm_mode_find_dmt to hunt for reduced-blanking modes
  2012-04-13 20:33 [PATCH 00/12] Add more DMT and common modes Adam Jackson
  2012-04-13 20:33 ` [PATCH 01/12] drm/edid: Document drm_mode_find_dmt Adam Jackson
  2012-04-13 20:33 ` [PATCH 02/12] drm/edid: Rewrite drm_mode_find_dmt search loop Adam Jackson
@ 2012-04-13 20:33 ` Adam Jackson
  2012-04-13 20:33 ` [PATCH 04/12] drm/edid: Remove a misleading comment Adam Jackson
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 26+ messages in thread
From: Adam Jackson @ 2012-04-13 20:33 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

It won't find any, yet.  Fix up callers to match: standard mode codes
will look prefer r-b modes for a given size if present, EST3 mode codes
will look for exactly the r-b-ness mentioned in the mode code.  This
might mean fewer modes matched for EST3 mode codes between now and when
the DMT mode list regrows the r-b modes, but practically speaking EST3
codes don't exist in the wild.

Signed-off-by: Adam Jackson <ajax@redhat.com>
---
 drivers/gpu/drm/drm_edid.c      |   37 ++++++++++++++++++++++++-------------
 drivers/gpu/drm/drm_fb_helper.c |    2 +-
 include/drm/drm_crtc.h          |    3 ++-
 3 files changed, 27 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 0a23ee5..4f52103 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -486,18 +486,29 @@ static void edid_fixup_preferred(struct drm_connector *connector,
 	preferred_mode->type |= DRM_MODE_TYPE_PREFERRED;
 }
 
+static bool
+mode_is_rb(const struct drm_display_mode *mode)
+{
+	return (mode->htotal - mode->hdisplay == 160) &&
+	       (mode->hsync_end - mode->hdisplay == 80) &&
+	       (mode->hsync_end - mode->hsync_start == 32) &&
+	       (mode->vsync_start - mode->vdisplay == 3);
+}
+
 /*
  * drm_mode_find_dmt - Create a copy of a mode if present in DMT
  * @dev: Device to duplicate against
  * @hsize: Mode width
  * @vsize: Mode height
  * @fresh: Mode refresh rate
+ * @rb: Mode reduced-blanking-ness
  *
  * Walk the DMT mode list looking for a match for the given parameters.
  * Return a newly allocated copy of the mode, or NULL if not found.
  */
 struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
-					   int hsize, int vsize, int fresh)
+					   int hsize, int vsize, int fresh,
+					   bool rb)
 {
 	int i;
 
@@ -509,6 +520,8 @@ struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
 			continue;
 		if (fresh != drm_mode_vrefresh(ptr))
 			continue;
+		if (rb != mode_is_rb(ptr))
+			continue;
 
 		return drm_mode_duplicate(dev, ptr);
 	}
@@ -742,10 +755,17 @@ drm_mode_std(struct drm_connector *connector, struct edid *edid,
 	}
 
 	/* check whether it can be found in default mode table */
-	mode = drm_mode_find_dmt(dev, hsize, vsize, vrefresh_rate);
+	if (drm_monitor_supports_rb(edid)) {
+		mode = drm_mode_find_dmt(dev, hsize, vsize, vrefresh_rate,
+					 true);
+		if (mode)
+			return mode;
+	}
+	mode = drm_mode_find_dmt(dev, hsize, vsize, vrefresh_rate, false);
 	if (mode)
 		return mode;
 
+	/* okay, generate it */
 	switch (timing_level) {
 	case LEVEL_DMT:
 		break;
@@ -920,15 +940,6 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,
 }
 
 static bool
-mode_is_rb(const struct drm_display_mode *mode)
-{
-	return (mode->htotal - mode->hdisplay == 160) &&
-	       (mode->hsync_end - mode->hdisplay == 80) &&
-	       (mode->hsync_end - mode->hsync_start == 32) &&
-	       (mode->vsync_start - mode->vdisplay == 3);
-}
-
-static bool
 mode_in_hsync_range(const struct drm_display_mode *mode,
 		    struct edid *edid, u8 *t)
 {
@@ -1073,8 +1084,8 @@ drm_est3_modes(struct drm_connector *connector, struct detailed_timing *timing)
 				mode = drm_mode_find_dmt(connector->dev,
 							 est3_modes[m].w,
 							 est3_modes[m].h,
-							 est3_modes[m].r
-							 /*, est3_modes[m].rb */);
+							 est3_modes[m].r,
+							 est3_modes[m].rb);
 				if (mode) {
 					drm_mode_probed_add(connector, mode);
 					modes++;
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index a0d6e89..6e19dd1 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1083,7 +1083,7 @@ static bool drm_target_cloned(struct drm_fb_helper *fb_helper,
 
 	/* try and find a 1024x768 mode on each connector */
 	can_clone = true;
-	dmt_mode = drm_mode_find_dmt(fb_helper->dev, 1024, 768, 60);
+	dmt_mode = drm_mode_find_dmt(fb_helper->dev, 1024, 768, 60, false);
 
 	for (i = 0; i < fb_helper->connector_count; i++) {
 
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index e250eda..2be73d7 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1015,7 +1015,8 @@ extern int drm_edid_header_is_valid(const u8 *raw_edid);
 extern bool drm_edid_block_valid(u8 *raw_edid);
 extern bool drm_edid_is_valid(struct edid *edid);
 struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
-					   int hsize, int vsize, int fresh);
+					   int hsize, int vsize, int fresh,
+					   bool rb);
 
 extern int drm_mode_create_dumb_ioctl(struct drm_device *dev,
 				      void *data, struct drm_file *file_priv);
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 04/12] drm/edid: Remove a misleading comment
  2012-04-13 20:33 [PATCH 00/12] Add more DMT and common modes Adam Jackson
                   ` (2 preceding siblings ...)
  2012-04-13 20:33 ` [PATCH 03/12] drm/edid: Allow drm_mode_find_dmt to hunt for reduced-blanking modes Adam Jackson
@ 2012-04-13 20:33 ` Adam Jackson
  2012-04-13 20:33 ` [PATCH 05/12] drm/edid: s/drm_gtf_modes_for_range/drm_dmt_modes_for_range/ Adam Jackson
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 26+ messages in thread
From: Adam Jackson @ 2012-04-13 20:33 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

mode_in_range() handles what this was warning about.

Signed-off-by: Adam Jackson <ajax@redhat.com>
---
 drivers/gpu/drm/drm_edid.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 4f52103..70dcf7a 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1016,10 +1016,6 @@ mode_in_range(const struct drm_display_mode *mode, struct edid *edid,
 	return true;
 }
 
-/*
- * XXX If drm_dmt_modes ever regrows the CVT-R modes (and it will) this will
- * need to account for them.
- */
 static int
 drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid,
 			struct detailed_timing *timing)
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 05/12] drm/edid: s/drm_gtf_modes_for_range/drm_dmt_modes_for_range/
  2012-04-13 20:33 [PATCH 00/12] Add more DMT and common modes Adam Jackson
                   ` (3 preceding siblings ...)
  2012-04-13 20:33 ` [PATCH 04/12] drm/edid: Remove a misleading comment Adam Jackson
@ 2012-04-13 20:33 ` Adam Jackson
  2012-04-13 20:33 ` [PATCH 06/12] drm/edid: Add the reduced blanking DMT modes to the DMT list Adam Jackson
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 26+ messages in thread
From: Adam Jackson @ 2012-04-13 20:33 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

Slightly more honest naming.

Signed-off-by: Adam Jackson <ajax@redhat.com>
---
 drivers/gpu/drm/drm_edid.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 70dcf7a..355e6a0 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1017,7 +1017,7 @@ mode_in_range(const struct drm_display_mode *mode, struct edid *edid,
 }
 
 static int
-drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid,
+drm_dmt_modes_for_range(struct drm_connector *connector, struct edid *edid,
 			struct detailed_timing *timing)
 {
 	int i, modes = 0;
@@ -1045,7 +1045,7 @@ do_inferred_modes(struct detailed_timing *timing, void *c)
 	int gtf = (closure->edid->features & DRM_EDID_FEATURE_DEFAULT_GTF);
 
 	if (gtf && data->type == EDID_DETAIL_MONITOR_RANGE)
-		closure->modes += drm_gtf_modes_for_range(closure->connector,
+		closure->modes += drm_dmt_modes_for_range(closure->connector,
 							  closure->edid,
 							  timing);
 }
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 06/12] drm/edid: Add the reduced blanking DMT modes to the DMT list
  2012-04-13 20:33 [PATCH 00/12] Add more DMT and common modes Adam Jackson
                   ` (4 preceding siblings ...)
  2012-04-13 20:33 ` [PATCH 05/12] drm/edid: s/drm_gtf_modes_for_range/drm_dmt_modes_for_range/ Adam Jackson
@ 2012-04-13 20:33 ` Adam Jackson
  2012-04-13 20:33 ` [PATCH 07/12] drm/edid: Fix some comment typos in the DMT mode list Adam Jackson
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 26+ messages in thread
From: Adam Jackson @ 2012-04-13 20:33 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

Copied from the list in xserver.

Signed-off-by: Adam Jackson <ajax@redhat.com>
---
 drivers/gpu/drm/drm_edid_modes.h |   94 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 93 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid_modes.h b/drivers/gpu/drm/drm_edid_modes.h
index a91ffb1..4be9c1a 100644
--- a/drivers/gpu/drm/drm_edid_modes.h
+++ b/drivers/gpu/drm/drm_edid_modes.h
@@ -30,7 +30,6 @@
 /*
  * Autogenerated from the DMT spec.
  * This table is copied from xfree86/modes/xf86EdidModes.c.
- * But the mode with Reduced blank feature is deleted.
  */
 static const struct drm_display_mode drm_dmt_modes[] = {
 	/* 640x350@85Hz */
@@ -81,6 +80,10 @@ static const struct drm_display_mode drm_dmt_modes[] = {
 	{ DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 56250, 800, 832,
 		   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,
+		   880, 960, 0, 600, 603, 607, 636, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
 	/* 848x480@60Hz */
 	{ DRM_MODE("848x480", DRM_MODE_TYPE_DRIVER, 33750, 848, 864,
 		   976, 1088, 0, 480, 486, 494, 517, 0,
@@ -106,10 +109,18 @@ static const struct drm_display_mode drm_dmt_modes[] = {
 	{ DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 94500, 1024, 1072,
 		   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,
+		   1104, 1184, 0, 768, 771, 775, 813, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
 	/* 1152x864@75Hz */
 	{ DRM_MODE("1152x864", DRM_MODE_TYPE_DRIVER, 108000, 1152, 1216,
 		   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,
+		   1360, 1440, 0, 768, 771, 778, 790, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
 	/* 1280x768@60Hz */
 	{ DRM_MODE("1280x768", DRM_MODE_TYPE_DRIVER, 79500, 1280, 1344,
 		   1472, 1664, 0, 768, 771, 778, 798, 0,
@@ -122,6 +133,14 @@ static const struct drm_display_mode drm_dmt_modes[] = {
 	{ DRM_MODE("1280x768", DRM_MODE_TYPE_DRIVER, 117500, 1280, 1360,
 		   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,
+		   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,
+		   1360, 1440, 0, 800, 803, 809, 823, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
 	/* 1280x800@60Hz */
 	{ DRM_MODE("1280x800", DRM_MODE_TYPE_DRIVER, 83500, 1280, 1352,
 		   1480, 1680, 0, 800, 803, 809, 831, 0,
@@ -134,6 +153,10 @@ static const struct drm_display_mode drm_dmt_modes[] = {
 	{ DRM_MODE("1280x800", DRM_MODE_TYPE_DRIVER, 122500, 1280, 1360,
 		   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,
+		   1360, 1440, 0, 800, 803, 809, 847, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
 	/* 1280x960@60Hz */
 	{ DRM_MODE("1280x960", DRM_MODE_TYPE_DRIVER, 108000, 1280, 1376,
 		   1488, 1800, 0, 960, 961, 964, 1000, 0,
@@ -142,6 +165,10 @@ static const struct drm_display_mode drm_dmt_modes[] = {
 	{ DRM_MODE("1280x960", DRM_MODE_TYPE_DRIVER, 148500, 1280, 1344,
 		   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,
+		   1360, 1440, 0, 960, 963, 967, 1017, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
 	/* 1280x1024@60Hz */
 	{ DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER, 108000, 1280, 1328,
 		   1440, 1688, 0, 1024, 1025, 1028, 1066, 0,
@@ -154,10 +181,22 @@ static const struct drm_display_mode drm_dmt_modes[] = {
 	{ DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER, 157500, 1280, 1344,
 		   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,
+		   1360, 1440, 0, 1024, 1027, 1034, 1084, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
 	/* 1360x768@60Hz */
 	{ DRM_MODE("1360x768", DRM_MODE_TYPE_DRIVER, 85500, 1360, 1424,
 		   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,
+		   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,
+		   1480, 1560, 0, 1050, 1053, 1057, 1080, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
 	/* 1440x1050@60Hz */
 	{ DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER, 121750, 1400, 1488,
 		   1632, 1864, 0, 1050, 1053, 1057, 1089, 0,
@@ -170,6 +209,14 @@ static const struct drm_display_mode drm_dmt_modes[] = {
 	{ DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER, 179500, 1400, 1504,
 		   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,
+		   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,
+		   1520, 1600, 0, 900, 903, 909, 926, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
 	/* 1440x900@60Hz */
 	{ DRM_MODE("1440x900", DRM_MODE_TYPE_DRIVER, 106500, 1440, 1520,
 		   1672, 1904, 0, 900, 903, 909, 934, 0,
@@ -182,6 +229,10 @@ static const struct drm_display_mode drm_dmt_modes[] = {
 	{ DRM_MODE("1440x900", DRM_MODE_TYPE_DRIVER, 157000, 1440, 1544,
 		   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,
+		   1520, 1600, 0, 900, 903, 909, 953, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
 	/* 1600x1200@60Hz */
 	{ DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 162000, 1600, 1664,
 		   1856, 2160, 0, 1200, 1201, 1204, 1250, 0,
@@ -202,6 +253,14 @@ static const struct drm_display_mode drm_dmt_modes[] = {
 	{ DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 229500, 1600, 1664,
 		   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,
+		   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,
+		   1760, 1840, 0, 1050, 1053, 1059, 1080, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
 	/* 1680x1050@60Hz */
 	{ DRM_MODE("1680x1050", DRM_MODE_TYPE_DRIVER, 146250, 1680, 1784,
 		   1960, 2240, 0, 1050, 1053, 1059, 1089, 0,
@@ -214,6 +273,10 @@ static const struct drm_display_mode drm_dmt_modes[] = {
 	{ DRM_MODE("1680x1050", DRM_MODE_TYPE_DRIVER, 214750, 1680, 1808,
 		   1984, 2288, 0, 1050, 1053, 1059, 1105, 0,
 		   DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
+	/* 1680x1050@120Hz RB */
+	{ DRM_MODE("1680x1050", DRM_MODE_TYPE_DRIVER, 245500, 1680, 1728,
+		   1760, 1840, 0, 1050, 1053, 1059, 1112, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
 	/* 1792x1344@60Hz */
 	{ DRM_MODE("1792x1344", DRM_MODE_TYPE_DRIVER, 204750, 1792, 1920,
 		   2120, 2448, 0, 1344, 1345, 1348, 1394, 0,
@@ -222,6 +285,10 @@ static const struct drm_display_mode drm_dmt_modes[] = {
 	{ DRM_MODE("1792x1344", DRM_MODE_TYPE_DRIVER, 261000, 1792, 1888,
 		   2104, 2456, 0, 1344, 1345, 1348, 1417, 0,
 		   DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
+	/* 1792x1344@120Hz RB */
+	{ DRM_MODE("1792x1344", DRM_MODE_TYPE_DRIVER, 333250, 1792, 1840,
+		   1872, 1952, 0, 1344, 1347, 1351, 1423, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
 	/* 1853x1392@60Hz */
 	{ DRM_MODE("1856x1392", DRM_MODE_TYPE_DRIVER, 218250, 1856, 1952,
 		   2176, 2528, 0, 1392, 1393, 1396, 1439, 0,
@@ -230,6 +297,14 @@ static const struct drm_display_mode drm_dmt_modes[] = {
 	{ DRM_MODE("1856x1392", DRM_MODE_TYPE_DRIVER, 288000, 1856, 1984,
 		   2208, 2560, 0, 1392, 1395, 1399, 1500, 0,
 		   DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
+	/* 1856x1392@120Hz RB */
+	{ DRM_MODE("1856x1392", DRM_MODE_TYPE_DRIVER, 356500, 1856, 1904,
+		   1936, 2016, 0, 1392, 1395, 1399, 1474, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
+	/* 1920x1200@60Hz RB */
+	{ DRM_MODE("1920x1200", DRM_MODE_TYPE_DRIVER, 154000, 1920, 1968,
+		   2000, 2080, 0, 1200, 1203, 1209, 1235, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
 	/* 1920x1200@60Hz */
 	{ DRM_MODE("1920x1200", DRM_MODE_TYPE_DRIVER, 193250, 1920, 2056,
 		   2256, 2592, 0, 1200, 1203, 1209, 1245, 0,
@@ -242,6 +317,10 @@ static const struct drm_display_mode drm_dmt_modes[] = {
 	{ DRM_MODE("1920x1200", DRM_MODE_TYPE_DRIVER, 281250, 1920, 2064,
 		   2272, 2624, 0, 1200, 1203, 1209, 1262, 0,
 		   DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
+	/* 1920x1200@120Hz RB */
+	{ DRM_MODE("1920x1200", DRM_MODE_TYPE_DRIVER, 317000, 1920, 1968,
+		   2000, 2080, 0, 1200, 1203, 1209, 1271, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
 	/* 1920x1440@60Hz */
 	{ DRM_MODE("1920x1440", DRM_MODE_TYPE_DRIVER, 234000, 1920, 2048,
 		   2256, 2600, 0, 1440, 1441, 1444, 1500, 0,
@@ -250,6 +329,14 @@ static const struct drm_display_mode drm_dmt_modes[] = {
 	{ DRM_MODE("1920x1440", DRM_MODE_TYPE_DRIVER, 297000, 1920, 2064,
 		   2288, 2640, 0, 1440, 1441, 1444, 1500, 0,
 		   DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
+	/* 1920x1440@120Hz RB */
+	{ DRM_MODE("1920x1440", DRM_MODE_TYPE_DRIVER, 380500, 1920, 1968,
+		   2000, 2080, 0, 1440, 1443, 1447, 1525, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
+	/* 2560x1600@60Hz RB */
+	{ DRM_MODE("2560x1600", DRM_MODE_TYPE_DRIVER, 268500, 2560, 2608,
+		   2640, 2720, 0, 1600, 1603, 1609, 1646, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
 	/* 2560x1600@60Hz */
 	{ DRM_MODE("2560x1600", DRM_MODE_TYPE_DRIVER, 348500, 2560, 2752,
 		   3032, 3504, 0, 1600, 1603, 1609, 1658, 0,
@@ -262,6 +349,11 @@ static const struct drm_display_mode drm_dmt_modes[] = {
 	{ DRM_MODE("2560x1600", DRM_MODE_TYPE_DRIVER, 505250, 2560, 2768,
 		   3048, 3536, 0, 1600, 1603, 1609, 1682, 0,
 		   DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
+	/* 2560x1600@120Hz RB */
+	{ DRM_MODE("2560x1600", DRM_MODE_TYPE_DRIVER, 552750, 2560, 2608,
+		   2640, 2720, 0, 1600, 1603, 1609, 1694, 0,
+		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
+
 };
 static const int drm_num_dmt_modes =
 	sizeof(drm_dmt_modes) / sizeof(struct drm_display_mode);
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 07/12] drm/edid: Fix some comment typos in the DMT mode list
  2012-04-13 20:33 [PATCH 00/12] Add more DMT and common modes Adam Jackson
                   ` (5 preceding siblings ...)
  2012-04-13 20:33 ` [PATCH 06/12] drm/edid: Add the reduced blanking DMT modes to the DMT list Adam Jackson
@ 2012-04-13 20:33 ` Adam Jackson
  2012-04-13 20:33 ` [PATCH 08/12] drm/edid: Do drm_dmt_modes_for_range() for all range descriptor types Adam Jackson
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 26+ messages in thread
From: Adam Jackson @ 2012-04-13 20:33 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

Signed-off-by: Adam Jackson <ajax@redhat.com>
---
 drivers/gpu/drm/drm_edid_modes.h |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid_modes.h b/drivers/gpu/drm/drm_edid_modes.h
index 4be9c1a..ab3a051 100644
--- a/drivers/gpu/drm/drm_edid_modes.h
+++ b/drivers/gpu/drm/drm_edid_modes.h
@@ -197,15 +197,15 @@ static const struct drm_display_mode drm_dmt_modes[] = {
 	{ DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER, 101000, 1400, 1448,
 		   1480, 1560, 0, 1050, 1053, 1057, 1080, 0,
 		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
-	/* 1440x1050@60Hz */
+	/* 1400x1050@60Hz */
 	{ DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER, 121750, 1400, 1488,
 		   1632, 1864, 0, 1050, 1053, 1057, 1089, 0,
 		   DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
-	/* 1440x1050@75Hz */
+	/* 1400x1050@75Hz */
 	{ DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER, 156000, 1400, 1504,
 		   1648, 1896, 0, 1050, 1053, 1057, 1099, 0,
 		   DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
-	/* 1440x1050@85Hz */
+	/* 1400x1050@85Hz */
 	{ DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER, 179500, 1400, 1504,
 		   1656, 1912, 0, 1050, 1053, 1057, 1105, 0,
 		   DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
@@ -281,7 +281,7 @@ static const struct drm_display_mode drm_dmt_modes[] = {
 	{ DRM_MODE("1792x1344", DRM_MODE_TYPE_DRIVER, 204750, 1792, 1920,
 		   2120, 2448, 0, 1344, 1345, 1348, 1394, 0,
 		   DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
-	/* 1729x1344@75Hz */
+	/* 1792x1344@75Hz */
 	{ DRM_MODE("1792x1344", DRM_MODE_TYPE_DRIVER, 261000, 1792, 1888,
 		   2104, 2456, 0, 1344, 1345, 1348, 1417, 0,
 		   DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
@@ -289,7 +289,7 @@ static const struct drm_display_mode drm_dmt_modes[] = {
 	{ DRM_MODE("1792x1344", DRM_MODE_TYPE_DRIVER, 333250, 1792, 1840,
 		   1872, 1952, 0, 1344, 1347, 1351, 1423, 0,
 		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
-	/* 1853x1392@60Hz */
+	/* 1856x1392@60Hz */
 	{ DRM_MODE("1856x1392", DRM_MODE_TYPE_DRIVER, 218250, 1856, 1952,
 		   2176, 2528, 0, 1392, 1393, 1396, 1439, 0,
 		   DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 08/12] drm/edid: Do drm_dmt_modes_for_range() for all range descriptor types
  2012-04-13 20:33 [PATCH 00/12] Add more DMT and common modes Adam Jackson
                   ` (6 preceding siblings ...)
  2012-04-13 20:33 ` [PATCH 07/12] drm/edid: Fix some comment typos in the DMT mode list Adam Jackson
@ 2012-04-13 20:33 ` Adam Jackson
  2012-04-13 20:33 ` [PATCH 09/12] drm/edid: Update range descriptor struct for EDID 1.4 Adam Jackson
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 26+ messages in thread
From: Adam Jackson @ 2012-04-13 20:33 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

EDID 1.4 retcons the meaning of the "GTF feature" bit to mean "is
continuous frequency", and moves the set of supported timing formulas
into the range descriptor itself.  In any event, the range descriptor
can act as a filter on the DMT list without regard to a specific timing
formula.

Signed-off-by: Adam Jackson <ajax@redhat.com>
---
 drivers/gpu/drm/drm_edid.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 355e6a0..7131f38 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1042,12 +1042,13 @@ do_inferred_modes(struct detailed_timing *timing, void *c)
 {
 	struct detailed_mode_closure *closure = c;
 	struct detailed_non_pixel *data = &timing->data.other_data;
-	int gtf = (closure->edid->features & DRM_EDID_FEATURE_DEFAULT_GTF);
 
-	if (gtf && data->type == EDID_DETAIL_MONITOR_RANGE)
-		closure->modes += drm_dmt_modes_for_range(closure->connector,
-							  closure->edid,
-							  timing);
+	if (data->type != EDID_DETAIL_MONITOR_RANGE)
+		return;
+
+	closure->modes += drm_dmt_modes_for_range(closure->connector,
+						  closure->edid,
+						  timing);
 }
 
 static int
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 09/12] drm/edid: Update range descriptor struct for EDID 1.4
  2012-04-13 20:33 [PATCH 00/12] Add more DMT and common modes Adam Jackson
                   ` (7 preceding siblings ...)
  2012-04-13 20:33 ` [PATCH 08/12] drm/edid: Do drm_dmt_modes_for_range() for all range descriptor types Adam Jackson
@ 2012-04-13 20:33 ` Adam Jackson
  2012-04-17 15:25   ` [Intel-gfx] " Takashi Iwai
  2012-04-13 20:33 ` [PATCH 10/12] drm/edid: Give the est3 mode struct a real name Adam Jackson
                   ` (4 subsequent siblings)
  13 siblings, 1 reply; 26+ messages in thread
From: Adam Jackson @ 2012-04-13 20:33 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

Signed-off-by: Adam Jackson <ajax@redhat.com>
---
 include/drm/drm_edid.h |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index bcb9a66..8cefbbe 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -90,12 +90,26 @@ struct detailed_data_monitor_range {
 	u8 min_hfreq_khz;
 	u8 max_hfreq_khz;
 	u8 pixel_clock_mhz; /* need to multiply by 10 */
-	__le16 sec_gtf_toggle; /* A000=use above, 20=use below */
-	u8 hfreq_start_khz; /* need to multiply by 2 */
-	u8 c; /* need to divide by 2 */
-	__le16 m;
-	u8 k;
-	u8 j; /* need to divide by 2 */
+	u8 flags;
+	union {
+		struct {
+			u8 reserved;
+			u8 hfreq_start_khz; /* need to multiply by 2 */
+			u8 c; /* need to divide by 2 */
+			__le16 m;
+			u8 k;
+			u8 j; /* need to divide by 2 */
+		} gtf2;
+		struct {
+			u8 version;
+			u8 data1; /* high 6 bits: extra clock resolution */
+			u8 data2; /* plus low 2 of above: max hactive */
+			u8 supported_aspects;
+			u8 flags; /* preferred aspect and blanking support */
+			u8 supported_scalings;
+			u8 preferred_refresh;
+		} cvt;
+	} formula;
 } __attribute__((packed));
 
 struct detailed_data_wpindex {
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 10/12] drm/edid: Give the est3 mode struct a real name
  2012-04-13 20:33 [PATCH 00/12] Add more DMT and common modes Adam Jackson
                   ` (8 preceding siblings ...)
  2012-04-13 20:33 ` [PATCH 09/12] drm/edid: Update range descriptor struct for EDID 1.4 Adam Jackson
@ 2012-04-13 20:33 ` Adam Jackson
  2012-04-13 20:33 ` [PATCH 11/12] drm/edid: Add extra_modes Adam Jackson
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 26+ messages in thread
From: Adam Jackson @ 2012-04-13 20:33 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

We want the same type for extra modes inferred from ranges.

Signed-off-by: Adam Jackson <ajax@redhat.com>
---
 drivers/gpu/drm/drm_edid_modes.h |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid_modes.h b/drivers/gpu/drm/drm_edid_modes.h
index ab3a051..eab60ea 100644
--- a/drivers/gpu/drm/drm_edid_modes.h
+++ b/drivers/gpu/drm/drm_edid_modes.h
@@ -412,12 +412,14 @@ static const struct drm_display_mode edid_est_modes[] = {
 		   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 1152x864@75Hz */
 };
 
-static const struct {
+struct minimode {
 	short w;
 	short h;
 	short r;
 	short rb;
-} est3_modes[] = {
+};
+
+static const struct minimode est3_modes[] = {
 	/* byte 6 */
 	{ 640, 350, 85, 0 },
 	{ 640, 400, 85, 0 },
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 11/12] drm/edid: Add extra_modes
  2012-04-13 20:33 [PATCH 00/12] Add more DMT and common modes Adam Jackson
                   ` (9 preceding siblings ...)
  2012-04-13 20:33 ` [PATCH 10/12] drm/edid: Give the est3 mode struct a real name Adam Jackson
@ 2012-04-13 20:33 ` Adam Jackson
  2012-04-13 20:33 ` [PATCH 12/12] drm/edid: Generate modes from extra_modes for range descriptors Adam Jackson
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 26+ messages in thread
From: Adam Jackson @ 2012-04-13 20:33 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

Some common sizes that don't show up in DMT.

Signed-off-by: Adam Jackson <ajax@redhat.com>
---
 drivers/gpu/drm/drm_edid_modes.h |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid_modes.h b/drivers/gpu/drm/drm_edid_modes.h
index eab60ea..26a1d33 100644
--- a/drivers/gpu/drm/drm_edid_modes.h
+++ b/drivers/gpu/drm/drm_edid_modes.h
@@ -473,6 +473,17 @@ static const struct minimode est3_modes[] = {
 };
 static const int num_est3_modes = sizeof(est3_modes) / sizeof(est3_modes[0]);
 
+static const struct minimode extra_modes[] = {
+	{ 1024, 576,  60, 0 },
+	{ 1366, 768,  60, 0 },
+	{ 1600, 900,  60, 0 },
+	{ 1680, 945,  60, 0 },
+	{ 1920, 1080, 60, 0 },
+	{ 2048, 1152, 60, 0 },
+	{ 2048, 1536, 60, 0 },
+};
+static const int num_extra_modes = sizeof(extra_modes) / sizeof(extra_modes[0]);
+
 /*
  * Probably taken from CEA-861 spec.
  * This table is converted from xorg's hw/xfree86/modes/xf86EdidModes.c.
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH 12/12] drm/edid: Generate modes from extra_modes for range descriptors
  2012-04-13 20:33 [PATCH 00/12] Add more DMT and common modes Adam Jackson
                   ` (10 preceding siblings ...)
  2012-04-13 20:33 ` [PATCH 11/12] drm/edid: Add extra_modes Adam Jackson
@ 2012-04-13 20:33 ` Adam Jackson
  2012-04-13 20:56 ` [PATCH 00/12] Add more DMT and common modes Adam Jackson
  2012-04-17 15:33 ` Takashi Iwai
  13 siblings, 0 replies; 26+ messages in thread
From: Adam Jackson @ 2012-04-13 20:33 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

Signed-off-by: Adam Jackson <ajax@redhat.com>
---
 drivers/gpu/drm/drm_edid.c |   73 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 73 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 7131f38..9e3794d 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1037,11 +1037,61 @@ drm_dmt_modes_for_range(struct drm_connector *connector, struct edid *edid,
 	return modes;
 }
 
+static int
+drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid,
+			struct detailed_timing *timing)
+{
+	int i, modes = 0;
+	struct drm_display_mode *newmode;
+	struct drm_device *dev = connector->dev;
+
+	for (i = 0; i < num_extra_modes; i++) {
+		const struct minimode *m = &extra_modes[i];
+		newmode = drm_gtf_mode(dev, m->w, m->h, m->r, 0, 0);
+
+		if (!mode_in_range(newmode, edid, timing)) {
+			drm_mode_destroy(dev, newmode);
+			continue;
+		}
+
+		drm_mode_probed_add(connector, newmode);
+		modes++;
+	}
+
+	return modes;
+}
+
+static int
+drm_cvt_modes_for_range(struct drm_connector *connector, struct edid *edid,
+			struct detailed_timing *timing)
+{
+	int i, modes = 0;
+	struct drm_display_mode *newmode;
+	struct drm_device *dev = connector->dev;
+	bool rb = drm_monitor_supports_rb(edid);
+
+	for (i = 0; i < num_extra_modes; i++) {
+		const struct minimode *m = &extra_modes[i];
+		newmode = drm_cvt_mode(dev, m->w, m->h, m->r, rb, 0, 0);
+
+		if (!mode_in_range(newmode, edid, timing)) {
+			drm_mode_destroy(dev, newmode);
+			continue;
+		}
+
+		drm_mode_probed_add(connector, newmode);
+		modes++;
+	}
+
+	return modes;
+}
+
 static void
 do_inferred_modes(struct detailed_timing *timing, void *c)
 {
 	struct detailed_mode_closure *closure = c;
 	struct detailed_non_pixel *data = &timing->data.other_data;
+	struct detailed_data_monitor_range *range = &data->data.range;
 
 	if (data->type != EDID_DETAIL_MONITOR_RANGE)
 		return;
@@ -1049,6 +1099,29 @@ do_inferred_modes(struct detailed_timing *timing, void *c)
 	closure->modes += drm_dmt_modes_for_range(closure->connector,
 						  closure->edid,
 						  timing);
+	
+	if (!version_greater(closure->edid, 1, 1))
+		return; /* GTF not defined yet */
+
+	switch (range->flags) {
+	case 0x02: /* secondary gtf, XXX could do more */
+	case 0x00: /* default gtf */
+		closure->modes += drm_gtf_modes_for_range(closure->connector,
+							  closure->edid,
+							  timing);
+		break;
+	case 0x04: /* cvt, only in 1.4+ */
+		if (!version_greater(closure->edid, 1, 3))
+			break;
+
+		closure->modes += drm_cvt_modes_for_range(closure->connector,
+							  closure->edid,
+							  timing);
+		break;
+	case 0x01: /* just the ranges, no formula */
+	default:
+		break;
+	}
 }
 
 static int
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH 00/12] Add more DMT and common modes
  2012-04-13 20:33 [PATCH 00/12] Add more DMT and common modes Adam Jackson
                   ` (11 preceding siblings ...)
  2012-04-13 20:33 ` [PATCH 12/12] drm/edid: Generate modes from extra_modes for range descriptors Adam Jackson
@ 2012-04-13 20:56 ` Adam Jackson
  2012-04-17 15:26   ` [Intel-gfx] " Takashi Iwai
  2012-04-17 15:33 ` Takashi Iwai
  13 siblings, 1 reply; 26+ messages in thread
From: Adam Jackson @ 2012-04-13 20:56 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

On 4/13/12 4:33 PM, Adam Jackson wrote:
> Incorporates some feedback from Rodrigo and Takashi.  Major themes of the
> series:
>
> - Fix the DMT list to include reduced-blanking modes
> - Add modes from DMT for any range descriptor type
> - Add an extra modes list for things not in DMT
> - For ranges that specify a formula, generate timings from the extra modes
>
> This still doesn't address the driver policy decision of "I know I have
> a scaler, add modes as if there were a range descriptor even if there's
> not one".  But it should at least make clear what such a helper function
> should do.

One minor buglet in this series that's not obvious from inspection (and 
that I didn't realize until just now) is that putting 1366x768 in the 
minimode list won't do what you want, since the mode you get back will 
be 1368x768.  Probably we should move the manual-underscan hack into the 
timing generators themselves.

- ajax

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Intel-gfx] [PATCH 09/12] drm/edid: Update range descriptor struct for EDID 1.4
  2012-04-13 20:33 ` [PATCH 09/12] drm/edid: Update range descriptor struct for EDID 1.4 Adam Jackson
@ 2012-04-17 15:25   ` Takashi Iwai
  2012-04-17 17:17     ` Adam Jackson
  0 siblings, 1 reply; 26+ messages in thread
From: Takashi Iwai @ 2012-04-17 15:25 UTC (permalink / raw)
  To: Adam Jackson; +Cc: intel-gfx, dri-devel

At Fri, 13 Apr 2012 16:33:37 -0400,
Adam Jackson wrote:
> 
> Signed-off-by: Adam Jackson <ajax@redhat.com>
> ---
>  include/drm/drm_edid.h |   26 ++++++++++++++++++++------
>  1 files changed, 20 insertions(+), 6 deletions(-)
> 
> diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
> index bcb9a66..8cefbbe 100644
> --- a/include/drm/drm_edid.h
> +++ b/include/drm/drm_edid.h
> @@ -90,12 +90,26 @@ struct detailed_data_monitor_range {
>  	u8 min_hfreq_khz;
>  	u8 max_hfreq_khz;
>  	u8 pixel_clock_mhz; /* need to multiply by 10 */
> -	__le16 sec_gtf_toggle; /* A000=use above, 20=use below */
> -	u8 hfreq_start_khz; /* need to multiply by 2 */
> -	u8 c; /* need to divide by 2 */
> -	__le16 m;
> -	u8 k;
> -	u8 j; /* need to divide by 2 */
> +	u8 flags;
> +	union {
> +		struct {
> +			u8 reserved;
> +			u8 hfreq_start_khz; /* need to multiply by 2 */
> +			u8 c; /* need to divide by 2 */
> +			__le16 m;
> +			u8 k;
> +			u8 j; /* need to divide by 2 */
> +		} gtf2;
> +		struct {
> +			u8 version;
> +			u8 data1; /* high 6 bits: extra clock resolution */
> +			u8 data2; /* plus low 2 of above: max hactive */
> +			u8 supported_aspects;
> +			u8 flags; /* preferred aspect and blanking support */
> +			u8 supported_scalings;
> +			u8 preferred_refresh;
> +		} cvt;

These new structs must be marked with __attribute__((packed)) although
the struct detailed_data_monitor_range itself is already marked.  At
least, with gcc 4.6 and x86-64 here, they get unaligned.


thanks,

Takashi

> +	} formula;
>  } __attribute__((packed));
>  
>  struct detailed_data_wpindex {
> -- 
> 1.7.7.6
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Intel-gfx] [PATCH 00/12] Add more DMT and common modes
  2012-04-13 20:56 ` [PATCH 00/12] Add more DMT and common modes Adam Jackson
@ 2012-04-17 15:26   ` Takashi Iwai
  2012-04-19 12:03     ` Takashi Iwai
  0 siblings, 1 reply; 26+ messages in thread
From: Takashi Iwai @ 2012-04-17 15:26 UTC (permalink / raw)
  To: Adam Jackson; +Cc: intel-gfx, dri-devel

At Fri, 13 Apr 2012 16:56:26 -0400,
Adam Jackson wrote:
> 
> On 4/13/12 4:33 PM, Adam Jackson wrote:
> > Incorporates some feedback from Rodrigo and Takashi.  Major themes of the
> > series:
> >
> > - Fix the DMT list to include reduced-blanking modes
> > - Add modes from DMT for any range descriptor type
> > - Add an extra modes list for things not in DMT
> > - For ranges that specify a formula, generate timings from the extra modes
> >
> > This still doesn't address the driver policy decision of "I know I have
> > a scaler, add modes as if there were a range descriptor even if there's
> > not one".  But it should at least make clear what such a helper function
> > should do.
> 
> One minor buglet in this series that's not obvious from inspection (and 
> that I didn't realize until just now) is that putting 1366x768 in the 
> minimode list won't do what you want, since the mode you get back will 
> be 1368x768.  Probably we should move the manual-underscan hack into the 
> timing generators themselves.

Sounds like a good compromise.  We have already hacks in drm_edid.c
for HDMI TV, so one exception more isn't that bad ;)


Takashi

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Intel-gfx] [PATCH 00/12] Add more DMT and common modes
  2012-04-13 20:33 [PATCH 00/12] Add more DMT and common modes Adam Jackson
                   ` (12 preceding siblings ...)
  2012-04-13 20:56 ` [PATCH 00/12] Add more DMT and common modes Adam Jackson
@ 2012-04-17 15:33 ` Takashi Iwai
  2012-04-17 15:50   ` Takashi Iwai
  13 siblings, 1 reply; 26+ messages in thread
From: Takashi Iwai @ 2012-04-17 15:33 UTC (permalink / raw)
  To: Adam Jackson; +Cc: intel-gfx, dri-devel

At Fri, 13 Apr 2012 16:33:28 -0400,
Adam Jackson wrote:
> 
> Incorporates some feedback from Rodrigo and Takashi.  Major themes of the
> series:
> 
> - Fix the DMT list to include reduced-blanking modes
> - Add modes from DMT for any range descriptor type
> - Add an extra modes list for things not in DMT
> - For ranges that specify a formula, generate timings from the extra modes
> 
> This still doesn't address the driver policy decision of "I know I have
> a scaler, add modes as if there were a range descriptor even if there's
> not one".  But it should at least make clear what such a helper function
> should do.

I tried these patches now with a few monitors here and it looks
working well (after fixing the alignment as I posted in another
mail).  I got new 1600x900 output on two monitors.  Yay!

I guess this will solve major of problems we've face for HD+ panel.
The rest is the 1366x768 mode, but it's often covered by 1360x768.
So, once when LVDS gets additional de facto standard modes, it'll be
fixed as well.


thanks,

Takashi

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Intel-gfx] [PATCH 00/12] Add more DMT and common modes
  2012-04-17 15:33 ` Takashi Iwai
@ 2012-04-17 15:50   ` Takashi Iwai
  2012-04-17 16:02     ` Rodrigo Vivi
  0 siblings, 1 reply; 26+ messages in thread
From: Takashi Iwai @ 2012-04-17 15:50 UTC (permalink / raw)
  To: Adam Jackson; +Cc: intel-gfx, dri-devel

At Tue, 17 Apr 2012 17:33:17 +0200,
Takashi Iwai wrote:
> 
> At Fri, 13 Apr 2012 16:33:28 -0400,
> Adam Jackson wrote:
> > 
> > Incorporates some feedback from Rodrigo and Takashi.  Major themes of the
> > series:
> > 
> > - Fix the DMT list to include reduced-blanking modes
> > - Add modes from DMT for any range descriptor type
> > - Add an extra modes list for things not in DMT
> > - For ranges that specify a formula, generate timings from the extra modes
> > 
> > This still doesn't address the driver policy decision of "I know I have
> > a scaler, add modes as if there were a range descriptor even if there's
> > not one".  But it should at least make clear what such a helper function
> > should do.
> 
> I tried these patches now with a few monitors here and it looks
> working well (after fixing the alignment as I posted in another
> mail).  I got new 1600x900 output on two monitors.  Yay!

Oh, feel free to add my tested-by tag:

	Tested-by: Takashi Iwai <tiwai@suse.de>


thanks,

Takashi

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Intel-gfx] [PATCH 00/12] Add more DMT and common modes
  2012-04-17 15:50   ` Takashi Iwai
@ 2012-04-17 16:02     ` Rodrigo Vivi
  0 siblings, 0 replies; 26+ messages in thread
From: Rodrigo Vivi @ 2012-04-17 16:02 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: intel-gfx, dri-devel

Thanks for the patches ajax

Feel free to use
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

On Tue, Apr 17, 2012 at 12:50 PM, Takashi Iwai <tiwai@suse.de> wrote:
> At Tue, 17 Apr 2012 17:33:17 +0200,
> Takashi Iwai wrote:
>>
>> At Fri, 13 Apr 2012 16:33:28 -0400,
>> Adam Jackson wrote:
>> >
>> > Incorporates some feedback from Rodrigo and Takashi.  Major themes of the
>> > series:
>> >
>> > - Fix the DMT list to include reduced-blanking modes
>> > - Add modes from DMT for any range descriptor type
>> > - Add an extra modes list for things not in DMT
>> > - For ranges that specify a formula, generate timings from the extra modes
>> >
>> > This still doesn't address the driver policy decision of "I know I have
>> > a scaler, add modes as if there were a range descriptor even if there's
>> > not one".  But it should at least make clear what such a helper function
>> > should do.
>>
>> I tried these patches now with a few monitors here and it looks
>> working well (after fixing the alignment as I posted in another
>> mail).  I got new 1600x900 output on two monitors.  Yay!
>
> Oh, feel free to add my tested-by tag:
>
>        Tested-by: Takashi Iwai <tiwai@suse.de>
>
>
> thanks,
>
> Takashi
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel



-- 
Rodrigo Vivi
Blog: http://blog.vivi.eng.br
GPG: 0x905BE242 @ wwwkeys.pgp.net

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Intel-gfx] [PATCH 09/12] drm/edid: Update range descriptor struct for EDID 1.4
  2012-04-17 15:25   ` [Intel-gfx] " Takashi Iwai
@ 2012-04-17 17:17     ` Adam Jackson
  0 siblings, 0 replies; 26+ messages in thread
From: Adam Jackson @ 2012-04-17 17:17 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: intel-gfx, dri-devel


[-- Attachment #1.1: Type: text/plain, Size: 953 bytes --]

On Tue, 2012-04-17 at 17:25 +0200, Takashi Iwai wrote:
> At Fri, 13 Apr 2012 16:33:37 -0400, Adam Jackson wrote:
> > +	u8 flags;
> > +	union {
> > +		struct {
> > +			u8 reserved;
> > +			u8 hfreq_start_khz; /* need to multiply by 2 */
> > +			u8 c; /* need to divide by 2 */
> > +			__le16 m;
> > +			u8 k;
> > +			u8 j; /* need to divide by 2 */
> > +		} gtf2;
> > +		struct {
> > +			u8 version;
> > +			u8 data1; /* high 6 bits: extra clock resolution */
> > +			u8 data2; /* plus low 2 of above: max hactive */
> > +			u8 supported_aspects;
> > +			u8 flags; /* preferred aspect and blanking support */
> > +			u8 supported_scalings;
> > +			u8 preferred_refresh;
> > +		} cvt;
> 
> These new structs must be marked with __attribute__((packed)) although
> the struct detailed_data_monitor_range itself is already marked.  At
> least, with gcc 4.6 and x86-64 here, they get unaligned.

Eek.  Good catch, thanks.

- ajax

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Intel-gfx] [PATCH 00/12] Add more DMT and common modes
  2012-04-17 15:26   ` [Intel-gfx] " Takashi Iwai
@ 2012-04-19 12:03     ` Takashi Iwai
  2012-04-19 14:58       ` Takashi Iwai
  2012-04-20 12:04       ` [Intel-gfx] " Dave Airlie
  0 siblings, 2 replies; 26+ messages in thread
From: Takashi Iwai @ 2012-04-19 12:03 UTC (permalink / raw)
  To: Adam Jackson; +Cc: intel-gfx, dri-devel, Rodrigo Vivi

At Tue, 17 Apr 2012 17:26:26 +0200,
Takashi Iwai wrote:
> 
> At Fri, 13 Apr 2012 16:56:26 -0400,
> Adam Jackson wrote:
> > 
> > On 4/13/12 4:33 PM, Adam Jackson wrote:
> > > Incorporates some feedback from Rodrigo and Takashi.  Major themes of the
> > > series:
> > >
> > > - Fix the DMT list to include reduced-blanking modes
> > > - Add modes from DMT for any range descriptor type
> > > - Add an extra modes list for things not in DMT
> > > - For ranges that specify a formula, generate timings from the extra modes
> > >
> > > This still doesn't address the driver policy decision of "I know I have
> > > a scaler, add modes as if there were a range descriptor even if there's
> > > not one".  But it should at least make clear what such a helper function
> > > should do.
> > 
> > One minor buglet in this series that's not obvious from inspection (and 
> > that I didn't realize until just now) is that putting 1366x768 in the 
> > minimode list won't do what you want, since the mode you get back will 
> > be 1368x768.  Probably we should move the manual-underscan hack into the 
> > timing generators themselves.
> 
> Sounds like a good compromise.  We have already hacks in drm_edid.c
> for HDMI TV, so one exception more isn't that bad ;)

FYI, I tried the hack below and it seems working.


Takashi

---
---
 drivers/gpu/drm/drm_edid.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1047,6 +1047,19 @@ drm_dmt_modes_for_range(struct drm_conne
 	return modes;
 }
 
+/* fix up 1366x768 mode from 1368x768;
+ * GTF/CVT can't express 1366 width which isn't dividable by 8
+ */
+static void fixup_mode_1366x768(struct drm_display_mode *mode)
+{
+	if (mode->hdisplay == 1368 && mode->vdisplay == 768) {
+		mode->hdisplay = 1366;
+		mode->hsync_start--;
+		mode->hsync_end--;
+		drm_mode_set_name(mode);
+	}
+}
+
 static int
 drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid,
 			struct detailed_timing *timing)
@@ -1059,6 +1072,7 @@ drm_gtf_modes_for_range(struct drm_conne
 		const struct minimode *m = &extra_modes[i];
 		newmode = drm_gtf_mode(dev, m->w, m->h, m->r, 0, 0);
 
+		fixup_mode_1366x768(newmode);
 		if (!mode_in_range(newmode, edid, timing)) {
 			drm_mode_destroy(dev, newmode);
 			continue;
@@ -1084,6 +1098,7 @@ drm_cvt_modes_for_range(struct drm_conne
 		const struct minimode *m = &extra_modes[i];
 		newmode = drm_cvt_mode(dev, m->w, m->h, m->r, rb, 0, 0);
 
+		fixup_mode_1366x768(newmode);
 		if (!mode_in_range(newmode, edid, timing)) {
 			drm_mode_destroy(dev, newmode);
 			continue;

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Intel-gfx] [PATCH 00/12] Add more DMT and common modes
  2012-04-19 12:03     ` Takashi Iwai
@ 2012-04-19 14:58       ` Takashi Iwai
  2012-04-20 12:05         ` Dave Airlie
  2012-04-20 12:04       ` [Intel-gfx] " Dave Airlie
  1 sibling, 1 reply; 26+ messages in thread
From: Takashi Iwai @ 2012-04-19 14:58 UTC (permalink / raw)
  To: Adam Jackson; +Cc: intel-gfx, dri-devel, Rodrigo Vivi

At Thu, 19 Apr 2012 14:03:58 +0200,
Takashi Iwai wrote:
> 
> At Tue, 17 Apr 2012 17:26:26 +0200,
> Takashi Iwai wrote:
> > 
> > At Fri, 13 Apr 2012 16:56:26 -0400,
> > Adam Jackson wrote:
> > > 
> > > On 4/13/12 4:33 PM, Adam Jackson wrote:
> > > > Incorporates some feedback from Rodrigo and Takashi.  Major themes of the
> > > > series:
> > > >
> > > > - Fix the DMT list to include reduced-blanking modes
> > > > - Add modes from DMT for any range descriptor type
> > > > - Add an extra modes list for things not in DMT
> > > > - For ranges that specify a formula, generate timings from the extra modes
> > > >
> > > > This still doesn't address the driver policy decision of "I know I have
> > > > a scaler, add modes as if there were a range descriptor even if there's
> > > > not one".  But it should at least make clear what such a helper function
> > > > should do.
> > > 
> > > One minor buglet in this series that's not obvious from inspection (and 
> > > that I didn't realize until just now) is that putting 1366x768 in the 
> > > minimode list won't do what you want, since the mode you get back will 
> > > be 1368x768.  Probably we should move the manual-underscan hack into the 
> > > timing generators themselves.
> > 
> > Sounds like a good compromise.  We have already hacks in drm_edid.c
> > for HDMI TV, so one exception more isn't that bad ;)
> 
> FYI, I tried the hack below and it seems working.

In addition, there are some missing NULL checks...


Takashi

---
---
 drivers/gpu/drm/drm_edid.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -789,6 +789,8 @@ drm_mode_std(struct drm_connector *conne
 		 * secondary GTF curve.  Please don't do that.
 		 */
 		mode = drm_gtf_mode(dev, hsize, vsize, vrefresh_rate, 0, 0);
+		if (!mode)
+			return NULL;
 		if (drm_mode_hsync(mode) > drm_gtf2_hbreak(edid)) {
 			kfree(mode);
 			mode = drm_gtf_mode_complex(dev, hsize, vsize,
@@ -1071,6 +1073,8 @@ drm_gtf_modes_for_range(struct drm_conne
 	for (i = 0; i < num_extra_modes; i++) {
 		const struct minimode *m = &extra_modes[i];
 		newmode = drm_gtf_mode(dev, m->w, m->h, m->r, 0, 0);
+		if (!newmode)
+			return modes;
 
 		fixup_mode_1366x768(newmode);
 		if (!mode_in_range(newmode, edid, timing)) {
@@ -1097,6 +1101,8 @@ drm_cvt_modes_for_range(struct drm_conne
 	for (i = 0; i < num_extra_modes; i++) {
 		const struct minimode *m = &extra_modes[i];
 		newmode = drm_cvt_mode(dev, m->w, m->h, m->r, rb, 0, 0);
+		if (!newmode)
+			return modes;
 
 		fixup_mode_1366x768(newmode);
 		if (!mode_in_range(newmode, edid, timing)) {

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Intel-gfx] [PATCH 00/12] Add more DMT and common modes
  2012-04-19 12:03     ` Takashi Iwai
  2012-04-19 14:58       ` Takashi Iwai
@ 2012-04-20 12:04       ` Dave Airlie
  2012-04-20 12:32         ` Takashi Iwai
  1 sibling, 1 reply; 26+ messages in thread
From: Dave Airlie @ 2012-04-20 12:04 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: intel-gfx, dri-devel, Rodrigo Vivi

On Thu, Apr 19, 2012 at 1:03 PM, Takashi Iwai <tiwai@suse.de> wrote:
> At Tue, 17 Apr 2012 17:26:26 +0200,
> Takashi Iwai wrote:
>>
>> At Fri, 13 Apr 2012 16:56:26 -0400,
>> Adam Jackson wrote:
>> >
>> > On 4/13/12 4:33 PM, Adam Jackson wrote:
>> > > Incorporates some feedback from Rodrigo and Takashi.  Major themes of the
>> > > series:
>> > >
>> > > - Fix the DMT list to include reduced-blanking modes
>> > > - Add modes from DMT for any range descriptor type
>> > > - Add an extra modes list for things not in DMT
>> > > - For ranges that specify a formula, generate timings from the extra modes
>> > >
>> > > This still doesn't address the driver policy decision of "I know I have
>> > > a scaler, add modes as if there were a range descriptor even if there's
>> > > not one".  But it should at least make clear what such a helper function
>> > > should do.
>> >
>> > One minor buglet in this series that's not obvious from inspection (and
>> > that I didn't realize until just now) is that putting 1366x768 in the
>> > minimode list won't do what you want, since the mode you get back will
>> > be 1368x768.  Probably we should move the manual-underscan hack into the
>> > timing generators themselves.
>>
>> Sounds like a good compromise.  We have already hacks in drm_edid.c
>> for HDMI TV, so one exception more isn't that bad ;)
>
> FYI, I tried the hack below and it seems working.
>
Is this hack going to be a real patch? ajax care to review?

Dave.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Intel-gfx] [PATCH 00/12] Add more DMT and common modes
  2012-04-19 14:58       ` Takashi Iwai
@ 2012-04-20 12:05         ` Dave Airlie
  2012-04-20 12:34           ` Takashi Iwai
  0 siblings, 1 reply; 26+ messages in thread
From: Dave Airlie @ 2012-04-20 12:05 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: intel-gfx, dri-devel, Rodrigo Vivi

On Thu, Apr 19, 2012 at 3:58 PM, Takashi Iwai <tiwai@suse.de> wrote:
> At Thu, 19 Apr 2012 14:03:58 +0200,
> Takashi Iwai wrote:
>>
>> At Tue, 17 Apr 2012 17:26:26 +0200,
>> Takashi Iwai wrote:
>> >
>> > At Fri, 13 Apr 2012 16:56:26 -0400,
>> > Adam Jackson wrote:
>> > >
>> > > On 4/13/12 4:33 PM, Adam Jackson wrote:
>> > > > Incorporates some feedback from Rodrigo and Takashi.  Major themes of the
>> > > > series:
>> > > >
>> > > > - Fix the DMT list to include reduced-blanking modes
>> > > > - Add modes from DMT for any range descriptor type
>> > > > - Add an extra modes list for things not in DMT
>> > > > - For ranges that specify a formula, generate timings from the extra modes
>> > > >
>> > > > This still doesn't address the driver policy decision of "I know I have
>> > > > a scaler, add modes as if there were a range descriptor even if there's
>> > > > not one".  But it should at least make clear what such a helper function
>> > > > should do.
>> > >
>> > > One minor buglet in this series that's not obvious from inspection (and
>> > > that I didn't realize until just now) is that putting 1366x768 in the
>> > > minimode list won't do what you want, since the mode you get back will
>> > > be 1368x768.  Probably we should move the manual-underscan hack into the
>> > > timing generators themselves.
>> >
>> > Sounds like a good compromise.  We have already hacks in drm_edid.c
>> > for HDMI TV, so one exception more isn't that bad ;)

I've pulled the series into -next along with the NULL check fix.

the only outstanding bit is the hack.

Thanks,
Dave.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [Intel-gfx] [PATCH 00/12] Add more DMT and common modes
  2012-04-20 12:04       ` [Intel-gfx] " Dave Airlie
@ 2012-04-20 12:32         ` Takashi Iwai
  0 siblings, 0 replies; 26+ messages in thread
From: Takashi Iwai @ 2012-04-20 12:32 UTC (permalink / raw)
  To: Dave Airlie; +Cc: intel-gfx, dri-devel, Rodrigo Vivi

At Fri, 20 Apr 2012 13:04:42 +0100,
Dave Airlie wrote:
> 
> On Thu, Apr 19, 2012 at 1:03 PM, Takashi Iwai <tiwai@suse.de> wrote:
> > At Tue, 17 Apr 2012 17:26:26 +0200,
> > Takashi Iwai wrote:
> >>
> >> At Fri, 13 Apr 2012 16:56:26 -0400,
> >> Adam Jackson wrote:
> >> >
> >> > On 4/13/12 4:33 PM, Adam Jackson wrote:
> >> > > Incorporates some feedback from Rodrigo and Takashi.  Major themes of the
> >> > > series:
> >> > >
> >> > > - Fix the DMT list to include reduced-blanking modes
> >> > > - Add modes from DMT for any range descriptor type
> >> > > - Add an extra modes list for things not in DMT
> >> > > - For ranges that specify a formula, generate timings from the extra modes
> >> > >
> >> > > This still doesn't address the driver policy decision of "I know I have
> >> > > a scaler, add modes as if there were a range descriptor even if there's
> >> > > not one".  But it should at least make clear what such a helper function
> >> > > should do.
> >> >
> >> > One minor buglet in this series that's not obvious from inspection (and
> >> > that I didn't realize until just now) is that putting 1366x768 in the
> >> > minimode list won't do what you want, since the mode you get back will
> >> > be 1368x768.  Probably we should move the manual-underscan hack into the
> >> > timing generators themselves.
> >>
> >> Sounds like a good compromise.  We have already hacks in drm_edid.c
> >> for HDMI TV, so one exception more isn't that bad ;)
> >
> > FYI, I tried the hack below and it seems working.
> >
> Is this hack going to be a real patch? ajax care to review?

For the easiness, below is the patch with my sign-off.


thanks,

Takashi

---

From: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH 1/2] drm/edid: Add a workaround for 1366x768 HD panel

HD panel (1366x768) found most commonly on laptops can't be represented
exactly in CVT/DMT expression, which leads to 1368x768 instead, because
1366 can't be divided by 8.

Add a hack to convert to 1366x768 manually as an exception.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 drivers/gpu/drm/drm_edid.c |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index bad2f11..c6366e9 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1039,6 +1039,19 @@ drm_dmt_modes_for_range(struct drm_connector *connector, struct edid *edid,
 	return modes;
 }
 
+/* fix up 1366x768 mode from 1368x768;
+ * GFT/CVT can't express 1366 width which isn't dividable by 8
+ */
+static void fixup_mode_1366x768(struct drm_display_mode *mode)
+{
+	if (mode->hdisplay == 1368 && mode->vdisplay == 768) {
+		mode->hdisplay = 1366;
+		mode->hsync_start--;
+		mode->hsync_end--;
+		drm_mode_set_name(mode);
+	}
+}
+
 static int
 drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid,
 			struct detailed_timing *timing)
@@ -1053,6 +1066,7 @@ drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid,
 		if (!newmode)
 			return modes;
 
+		fixup_mode_1366x768(newmode);
 		if (!mode_in_range(newmode, edid, timing)) {
 			drm_mode_destroy(dev, newmode);
 			continue;
@@ -1080,6 +1094,7 @@ drm_cvt_modes_for_range(struct drm_connector *connector, struct edid *edid,
 		if (!newmode)
 			return modes;
 
+		fixup_mode_1366x768(newmode);
 		if (!mode_in_range(newmode, edid, timing)) {
 			drm_mode_destroy(dev, newmode);
 			continue;
-- 
1.7.9.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH 00/12] Add more DMT and common modes
  2012-04-20 12:05         ` Dave Airlie
@ 2012-04-20 12:34           ` Takashi Iwai
  0 siblings, 0 replies; 26+ messages in thread
From: Takashi Iwai @ 2012-04-20 12:34 UTC (permalink / raw)
  To: Dave Airlie; +Cc: intel-gfx, dri-devel, Rodrigo Vivi

At Fri, 20 Apr 2012 13:05:48 +0100,
Dave Airlie wrote:
> 
> On Thu, Apr 19, 2012 at 3:58 PM, Takashi Iwai <tiwai@suse.de> wrote:
> > At Thu, 19 Apr 2012 14:03:58 +0200,
> > Takashi Iwai wrote:
> >>
> >> At Tue, 17 Apr 2012 17:26:26 +0200,
> >> Takashi Iwai wrote:
> >> >
> >> > At Fri, 13 Apr 2012 16:56:26 -0400,
> >> > Adam Jackson wrote:
> >> > >
> >> > > On 4/13/12 4:33 PM, Adam Jackson wrote:
> >> > > > Incorporates some feedback from Rodrigo and Takashi.  Major themes of the
> >> > > > series:
> >> > > >
> >> > > > - Fix the DMT list to include reduced-blanking modes
> >> > > > - Add modes from DMT for any range descriptor type
> >> > > > - Add an extra modes list for things not in DMT
> >> > > > - For ranges that specify a formula, generate timings from the extra modes
> >> > > >
> >> > > > This still doesn't address the driver policy decision of "I know I have
> >> > > > a scaler, add modes as if there were a range descriptor even if there's
> >> > > > not one".  But it should at least make clear what such a helper function
> >> > > > should do.
> >> > >
> >> > > One minor buglet in this series that's not obvious from inspection (and
> >> > > that I didn't realize until just now) is that putting 1366x768 in the
> >> > > minimode list won't do what you want, since the mode you get back will
> >> > > be 1368x768.  Probably we should move the manual-underscan hack into the
> >> > > timing generators themselves.
> >> >
> >> > Sounds like a good compromise.  We have already hacks in drm_edid.c
> >> > for HDMI TV, so one exception more isn't that bad ;)
> 
> I've pulled the series into -next along with the NULL check fix.

Thanks!

> the only outstanding bit is the hack.

Also the packed attributes are missing in the new structs.
The fix patch is below.


Takashi

---

From: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH 2/2] drm/edid: Add packed attribute to new gtf2 and cvt structs

The new structs added in struct detailed_data_monitor_range must be
marked with packed attribute although the outer struct itself is
already marked as packed.  Otherwise these 7-bytes structs may be
aligned, and give the wrong position and size for the data.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 include/drm/drm_edid.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index 8cefbbe..0cac551 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -99,7 +99,7 @@ struct detailed_data_monitor_range {
 			__le16 m;
 			u8 k;
 			u8 j; /* need to divide by 2 */
-		} gtf2;
+		} __attribute__((packed)) gtf2;
 		struct {
 			u8 version;
 			u8 data1; /* high 6 bits: extra clock resolution */
@@ -108,7 +108,7 @@ struct detailed_data_monitor_range {
 			u8 flags; /* preferred aspect and blanking support */
 			u8 supported_scalings;
 			u8 preferred_refresh;
-		} cvt;
+		} __attribute__((packed)) cvt;
 	} formula;
 } __attribute__((packed));
 
-- 
1.7.9.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2012-04-20 12:34 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-13 20:33 [PATCH 00/12] Add more DMT and common modes Adam Jackson
2012-04-13 20:33 ` [PATCH 01/12] drm/edid: Document drm_mode_find_dmt Adam Jackson
2012-04-13 20:33 ` [PATCH 02/12] drm/edid: Rewrite drm_mode_find_dmt search loop Adam Jackson
2012-04-13 20:33 ` [PATCH 03/12] drm/edid: Allow drm_mode_find_dmt to hunt for reduced-blanking modes Adam Jackson
2012-04-13 20:33 ` [PATCH 04/12] drm/edid: Remove a misleading comment Adam Jackson
2012-04-13 20:33 ` [PATCH 05/12] drm/edid: s/drm_gtf_modes_for_range/drm_dmt_modes_for_range/ Adam Jackson
2012-04-13 20:33 ` [PATCH 06/12] drm/edid: Add the reduced blanking DMT modes to the DMT list Adam Jackson
2012-04-13 20:33 ` [PATCH 07/12] drm/edid: Fix some comment typos in the DMT mode list Adam Jackson
2012-04-13 20:33 ` [PATCH 08/12] drm/edid: Do drm_dmt_modes_for_range() for all range descriptor types Adam Jackson
2012-04-13 20:33 ` [PATCH 09/12] drm/edid: Update range descriptor struct for EDID 1.4 Adam Jackson
2012-04-17 15:25   ` [Intel-gfx] " Takashi Iwai
2012-04-17 17:17     ` Adam Jackson
2012-04-13 20:33 ` [PATCH 10/12] drm/edid: Give the est3 mode struct a real name Adam Jackson
2012-04-13 20:33 ` [PATCH 11/12] drm/edid: Add extra_modes Adam Jackson
2012-04-13 20:33 ` [PATCH 12/12] drm/edid: Generate modes from extra_modes for range descriptors Adam Jackson
2012-04-13 20:56 ` [PATCH 00/12] Add more DMT and common modes Adam Jackson
2012-04-17 15:26   ` [Intel-gfx] " Takashi Iwai
2012-04-19 12:03     ` Takashi Iwai
2012-04-19 14:58       ` Takashi Iwai
2012-04-20 12:05         ` Dave Airlie
2012-04-20 12:34           ` Takashi Iwai
2012-04-20 12:04       ` [Intel-gfx] " Dave Airlie
2012-04-20 12:32         ` Takashi Iwai
2012-04-17 15:33 ` Takashi Iwai
2012-04-17 15:50   ` Takashi Iwai
2012-04-17 16:02     ` Rodrigo Vivi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.