Skip to contentSkip to conversation

drm/edid: add support for min horizontal rate equal to max horizontal rate

PATCH In review Cyrus Lien 2 participants 4 messages Jun 8, 2020 – Jun 17, 2020

Subsystems (2)
lore
Share & tools
lore

Cyrus Lien

author
#0 lore raw

PATCH 1/1 drm/edid: add support for min horizontal rate equal to max horizontal rate

According to EDID spec, table 3.26, byte #6 and #8, which said "Minimum rate value shall be less than or equal to maximum rate value". The minimum horizontal/vertical rate value is able to be equal to maximum horizontal/ veritcal rate value.

This change check if h/v-sync excess maximum horizontal/vertical rate if hmin equal to hmax or vmin equal to vmax.

---
 drivers/gpu/drm/drm_edid.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_edid.c +6 -0
index fed653f13c26..23878320eabd 100644
@@ -2674,6 +2674,9 @@ mode_in_hsync_range(const struct drm_display_mode *mode,
 	    hmax += ((t[4] & 0x08) ? 255 : 0);
 	hsync = drm_mode_hsync(mode);
 
+	if (hmax == hmin)
+		return (hsync <= hmax);
+
 	return (hsync <= hmax && hsync >= hmin);
 }
 
@@ -2691,6 +2694,9 @@ mode_in_vsync_range(const struct drm_display_mode *mode,
 	    vmax += ((t[4] & 0x02) ? 255 : 0);
 	vsync = drm_mode_vrefresh(mode);
 
+	if (vmax == vmin)
+		return (vsync <= vmax);
+
 	return (vsync <= vmax && vsync >= vmin);
 }
 
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 4 lines · Cyrus Lien

According to EDID spec, table 3.26, byte #6 and #8, which said "Minimum rate value shall be less than or equal to maximum rate value". The minimum horizontal/vertical rate value is able to be equal to maximum horizontal/ veritcal rate value.

How does that justifiy ignoring the min value?

Quoted 40 lines

This change check if h/v-sync excess maximum horizontal/vertical rate if hmin equal to hmax or vmin equal to vmax.

---
 drivers/gpu/drm/drm_edid.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_edid.c +6 -0
index fed653f13c26..23878320eabd 100644
@@ -2674,6 +2674,9 @@ mode_in_hsync_range(const struct drm_display_mode *mode,
 	    hmax += ((t[4] & 0x08) ? 255 : 0);
 	hsync = drm_mode_hsync(mode);
 
+	if (hmax == hmin)
+		return (hsync <= hmax);
+
 	return (hsync <= hmax && hsync >= hmin);
 }
 
@@ -2691,6 +2694,9 @@ mode_in_vsync_range(const struct drm_display_mode *mode,
 	    vmax += ((t[4] & 0x02) ? 255 : 0);
 	vsync = drm_mode_vrefresh(mode);
 
+	if (vmax == vmin)
+		return (vsync <= vmax);
+
 	return (vsync <= vmax && vsync >= vmin);
 }
 
Signature · 6 lines
2.25.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#2 lore raw
Quoted 10 lines · Ville Syrjälä
Quoted 2 lines · Cyrus Lien

According to EDID spec, table 3.26, byte #6 and #8, which said "Minimum rate value shall be less than or equal to maximum rate value". The

minimum

Quoted 2 lines

horizontal/vertical rate value is able to be equal to maximum horizontal/ veritcal rate value.

How does that justifiy ignoring the min value?

Indeed, this patch does not make sense.

Setting minimum horizontal rate equal to maximum horizontal rate is a request come from AMD Windows graphic driver for support freesync (I'm not sure if linux AMD driver also require it).
The problem is mode_in_hsync_range always return false except the mode's hsync exactly equal to hmax and hmin.

Add print in mode_in_hsync_range():
[drm] mode_in_hsync_range 1920x1200: hsync: 94, hmax: 110, hmix:110 [drm] mode_in_hsync_range 1920x1200: hsync: 107, hmax: 110, hmix:110 [drm] mode_in_hsync_range 1920x1200: hsync: 152, hmax: 110, hmix:110 [drm] mode_in_hsync_range 1920x1440: hsync: 90, hmax: 110, hmix:110 [drm] mode_in_hsync_range 1920x1440: hsync: 113, hmax: 110, hmix:110 [drm] mode_in_hsync_range 1920x1440: hsync: 183, hmax: 110, hmix:110

Is it available to get or calculate the hmax, hmix value from other fields in EDID ?
Would you please provide some advice or directions to solve this problem ? Thank you and appreciated the help.

edid-decode (hex):

00 ff ff ff ff ff ff 00 06 af 9b 32 00 00 00 00
00 1e 01 04 b5 26 15 78 03 1f 95 a5 53 35 b5 26
0f 50 54 00 00 00 01 01 01 01 01 01 01 01 01 01
01 01 01 01 01 01 70 d0 00 a0 f0 70 3e 80 30 20
35 00 7d d6 10 00 00 1a 00 00 00 fd 00 32 5a 6e
6e 17 01 11 01 e0 60 20 50 3c 00 00 00 fe 00 34
34 54 52 4e 15 42 31 37 33 5a 41 4e 00 00 00 00
00 05 81 01 28 00 12 00 00 0b 01 0a 20 20 01 af

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

----------------

EDID version: 1.4
Manufacturer: AUO Model 12955 Serial Number 0
Made in year 2020
Digital display
10 bits per primary color channel
DisplayPort interface
Maximum image size: 38 cm x 21 cm
Gamma: 2.20
Supported color formats: RGB 4:4:4
First detailed timing includes the native pixel format and preferred refresh rate
Display is continuous frequency
Color Characteristics
Red: 0.6445, 0.3251
Green: 0.2099, 0.7099
Blue: 0.1503, 0.0595
White: 0.3134, 0.3291
Established Timings I & II: none
Standard Timings: none
Detailed mode: Clock 533.600 MHz, 381 mm x 214 mm

               3840 3888 3920 4000 ( 48  32  80)
               2160 2163 2168 2222 (  3   5  54)
               +hsync -vsync
               VertFreq: 60.036 Hz, HorFreq: 133.400 kHz

Display Range Limits
Monitor ranges (Bare Limits): 50-90 Hz V, 110-110 kHz H, max dotclock 230
MHz
Alphanumeric Data String: 44TRN
Manufacturer-Specified Display Descriptor (0x00): 00 00 00 05 81 01 28 00 12 00 00 0b 01 0a 20 20 ......(.......
Has 1 extension block
Checksum: 0xaf

----------------

Quoted 38 lines

drivers/gpu/drm/drm_edid.c mode_in_hsync_range(const struct drm_display_mode

Quoted 14 lines

This change check if h/v-sync excess maximum horizontal/vertical rate if hmin equal to hmax or vmin equal to vmax.

---
 drivers/gpu/drm/drm_edid.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_edid.c +0 -0
index fed653f13c26..23878320eabd 100644
@@ -2674,6 +2674,9 @@ mode_in_hsync_range(const struct drm_display_mode

*mode,

drivers/gpu/drm/drm_edid.c mode_in_vsync_range(const struct drm_display_mode

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +3 -0
          hmax += ((t[4] & 0x08) ? 255 : 0);
      hsync = drm_mode_hsync(mode);
 
+     if (hmax == hmin)
+             return (hsync <= hmax);
+
      return (hsync <= hmax && hsync >= hmin);
 }
 
@@ -2691,6 +2694,9 @@ mode_in_vsync_range(const struct drm_display_mode

*mode,

Quoted 12 lines
drivers/gpu/drm/drm_edid.c +3 -1
          vmax += ((t[4] & 0x02) ? 255 : 0);
      vsync = drm_mode_vrefresh(mode);
 
+     if (vmax == vmin)
+             return (vsync <= vmax);
+
      return (vsync <= vmax && vsync >= vmin);
 }
 
--

2.25.1

Quoted 9 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Ville Syrjälä
Intel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
Quoted 10 lines · Cyrus Lien
Quoted 7 lines · Ville Syrjälä
Quoted 2 lines · Cyrus Lien

According to EDID spec, table 3.26, byte #6 and #8, which said "Minimum rate value shall be less than or equal to maximum rate value". The

minimum

Quoted 2 lines

horizontal/vertical rate value is able to be equal to maximum horizontal/ veritcal rate value.

Quoted 6 lines
Quoted 3 lines

How does that justifiy ignoring the min value?

Indeed, this patch does not make sense.

Setting minimum horizontal rate equal to maximum horizontal rate is a request come from AMD Windows graphic driver for support freesync (I'm not sure if linux AMD driver also require it).

AFAICS the DP spec itself doesn't say anything about the horizontal min/max rates. However DP-EDID-CTS 1.2 / 4.8 seems to say that hmin==hmax==hsync should hold. Not sure if that should be the hsync rate of the min/max/nominal refresh rate. I would have maybe expected the max since that's the actual rate it's going operate at. Alhtough I even less of an idea what it should be if the monitor supports multiple resolutions.

In this case it doesn't seem to be any of those exactly. Pretty close to the min refresh rate though. hmin=hmax=110 kHz vs. actual hsync rate for 50Hz would be 111.1 kHz (if it was actually running at 50Hz with the declared vblank length which it won't be of course). If we calculate in the opposite direction we get a vrefresh of ~49.5 Hz based on the 110 kHz hsync rate. So if we round to nearest integer it does match the declared vmin of 50Hz.

I suspect the right answer is to just ignore hmin/hmax when it comes to adaptive sync.

Quoted 120 lines

The problem is mode_in_hsync_range always return false except the mode's hsync exactly equal to hmax and hmin.

Add print in mode_in_hsync_range():
[drm] mode_in_hsync_range 1920x1200: hsync: 94, hmax: 110, hmix:110 [drm] mode_in_hsync_range 1920x1200: hsync: 107, hmax: 110, hmix:110 [drm] mode_in_hsync_range 1920x1200: hsync: 152, hmax: 110, hmix:110 [drm] mode_in_hsync_range 1920x1440: hsync: 90, hmax: 110, hmix:110 [drm] mode_in_hsync_range 1920x1440: hsync: 113, hmax: 110, hmix:110 [drm] mode_in_hsync_range 1920x1440: hsync: 183, hmax: 110, hmix:110

Is it available to get or calculate the hmax, hmix value from other fields in EDID ?
Would you please provide some advice or directions to solve this problem ? Thank you and appreciated the help.

edid-decode (hex):

00 ff ff ff ff ff ff 00 06 af 9b 32 00 00 00 00
00 1e 01 04 b5 26 15 78 03 1f 95 a5 53 35 b5 26
0f 50 54 00 00 00 01 01 01 01 01 01 01 01 01 01
01 01 01 01 01 01 70 d0 00 a0 f0 70 3e 80 30 20
35 00 7d d6 10 00 00 1a 00 00 00 fd 00 32 5a 6e
6e 17 01 11 01 e0 60 20 50 3c 00 00 00 fe 00 34
34 54 52 4e 15 42 31 37 33 5a 41 4e 00 00 00 00
00 05 81 01 28 00 12 00 00 0b 01 0a 20 20 01 af

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

----------------

EDID version: 1.4
Manufacturer: AUO Model 12955 Serial Number 0
Made in year 2020
Digital display
10 bits per primary color channel
DisplayPort interface
Maximum image size: 38 cm x 21 cm
Gamma: 2.20
Supported color formats: RGB 4:4:4
First detailed timing includes the native pixel format and preferred refresh rate
Display is continuous frequency
Color Characteristics
Red: 0.6445, 0.3251
Green: 0.2099, 0.7099
Blue: 0.1503, 0.0595
White: 0.3134, 0.3291
Established Timings I & II: none
Standard Timings: none
Detailed mode: Clock 533.600 MHz, 381 mm x 214 mm

               3840 3888 3920 4000 ( 48  32  80)
               2160 2163 2168 2222 (  3   5  54)
               +hsync -vsync
               VertFreq: 60.036 Hz, HorFreq: 133.400 kHz

Display Range Limits
Monitor ranges (Bare Limits): 50-90 Hz V, 110-110 kHz H, max dotclock 230
MHz
Alphanumeric Data String: 44TRN
Manufacturer-Specified Display Descriptor (0x00): 00 00 00 05 81 01 28 00 12 00 00 0b 01 0a 20 20 ......(.......
Has 1 extension block
Checksum: 0xaf

----------------

Quoted 47 lines

drivers/gpu/drm/drm_edid.c mode_in_hsync_range(const struct drm_display_mode

Quoted 14 lines

This change check if h/v-sync excess maximum horizontal/vertical rate if hmin equal to hmax or vmin equal to vmax.

---
 drivers/gpu/drm/drm_edid.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_edid.c +0 -0
index fed653f13c26..23878320eabd 100644
@@ -2674,6 +2674,9 @@ mode_in_hsync_range(const struct drm_display_mode

*mode,

drivers/gpu/drm/drm_edid.c mode_in_vsync_range(const struct drm_display_mode

Quoted 10 lines
drivers/gpu/drm/drm_edid.c +3 -0
          hmax += ((t[4] & 0x08) ? 255 : 0);
      hsync = drm_mode_hsync(mode);
 
+     if (hmax == hmin)
+             return (hsync <= hmax);
+
      return (hsync <= hmax && hsync >= hmin);
 }
 
@@ -2691,6 +2694,9 @@ mode_in_vsync_range(const struct drm_display_mode

*mode,

Quoted 12 lines
drivers/gpu/drm/drm_edid.c +3 -1
          vmax += ((t[4] & 0x02) ? 255 : 0);
      vsync = drm_mode_vrefresh(mode);
 
+     if (vmax == vmin)
+             return (vsync <= vmax);
+
      return (vsync <= vmax && vsync >= vmin);
 }
 
--

2.25.1

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Ville Syrjälä
Intel

Signature · 2 lines
Ville Syrjälä
Intel