Skip to contentSkip to conversation

drm/amdgpu: Respect max pixel clock for HDMI and DVI-D

PATCH In review Timur Kristóf 2 participants 8 messages Aug 25, 2025 – Aug 27, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: Respect max pixel clock for HDMI and DVI-D

Change the legacy (non-DC) display code to respect the maximum pixel clock for HDMI and DVI-D. Reject modes that would require a higher pixel clock than can be supported.

Also update the maximum supported HDMI clock value depending on the ASIC type.

For reference, see the DC code:
check max_hdmi_pixel_clock in dce*_resource.c

---
 .../gpu/drm/amd/amdgpu/amdgpu_connectors.c    | 21 +++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +19 -2
index 5e375e9c4f5d..abcc4469cf57 100644
@@ -1195,12 +1195,26 @@ static void amdgpu_connector_dvi_force(struct drm_connector *connector)
 		amdgpu_connector->use_digital = true;
 }
 
+/**
+ * Returns the maximum supported HDMI (TMDS) pixel clock in KHz.
+ */
+static int amdgpu_max_hdmi_pixel_clock(const struct amdgpu_device *adev)
+{
+	if (adev->asic_type >= CHIP_POLARIS10)
+		return 600000;
+	else if (adev->asic_type >= CHIP_TONGA)
+		return 300000;
+	else
+		return 297000;
+}
+
 static enum drm_mode_status amdgpu_connector_dvi_mode_valid(struct drm_connector *connector,
 					    const struct drm_display_mode *mode)
 {
 	struct drm_device *dev = connector->dev;
 	struct amdgpu_device *adev = drm_to_adev(dev);
 	struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
+	const int max_hdmi_pixel_clock = amdgpu_max_hdmi_pixel_clock(adev);
 
 	/* XXX check mode bandwidth */
 
@@ -1208,10 +1222,13 @@ static enum drm_mode_status amdgpu_connector_dvi_mode_valid(struct drm_connector
 		if ((amdgpu_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I) ||
 		    (amdgpu_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D) ||
 		    (amdgpu_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_B)) {
-			return MODE_OK;
+			if (mode->clock > max_hdmi_pixel_clock)
+				return MODE_CLOCK_HIGH;
+			else
+				return MODE_OK;
 		} else if (connector->display_info.is_hdmi) {
 			/* HDMI 1.3+ supports max clock of 340 Mhz */
-			if (mode->clock > 340000)
+			if (mode->clock > max_hdmi_pixel_clock)
 				return MODE_CLOCK_HIGH;
 			else
 				return MODE_OK;
Signature · 1 line
2.50.1
#1 lore raw
Quoted 48 lines · Timur Kristóf

Change the legacy (non-DC) display code to respect the maximum pixel clock for HDMI and DVI-D. Reject modes that would require a higher pixel clock than can be supported.

Also update the maximum supported HDMI clock value depending on the ASIC type.

For reference, see the DC code:
check max_hdmi_pixel_clock in dce*_resource.c

---
 .../gpu/drm/amd/amdgpu/amdgpu_connectors.c    | 21 +++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +14 -0
index 5e375e9c4f5d..abcc4469cf57 100644
@@ -1195,12 +1195,26 @@ static void amdgpu_connector_dvi_force(struct drm_connector *connector)
                amdgpu_connector->use_digital = true;
 }
 
+/**
+ * Returns the maximum supported HDMI (TMDS) pixel clock in KHz.
+ */
+static int amdgpu_max_hdmi_pixel_clock(const struct amdgpu_device *adev)
+{
+       if (adev->asic_type >= CHIP_POLARIS10)
+               return 600000;
+       else if (adev->asic_type >= CHIP_TONGA)
+               return 300000;
+       else
+               return 297000;
+}
+
 static enum drm_mode_status amdgpu_connector_dvi_mode_valid(struct drm_connector *connector,
                                            const struct drm_display_mode *mode)
 {
        struct drm_device *dev = connector->dev;
        struct amdgpu_device *adev = drm_to_adev(dev);
        struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
+       const int max_hdmi_pixel_clock = amdgpu_max_hdmi_pixel_clock(adev);
 
        /* XXX check mode bandwidth */
 

drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c static enum drm_mode_status amdgpu_connector_dvi_mode_valid(struct drm_connector · line 1228

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +4 -1
@@ -1208,10 +1222,13 @@ static enum drm_mode_status amdgpu_connector_dvi_mode_valid(struct drm_connector
                if ((amdgpu_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I) ||
                    (amdgpu_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D) ||
                    (amdgpu_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_B)) {
-                       return MODE_OK;
+                       if (mode->clock > max_hdmi_pixel_clock)
+                               return MODE_CLOCK_HIGH;
+                       else
+                               return MODE_OK;

I don't think it makes sense to limit dual link DVI to the max HDMI clock. HDMI is single link TMDS. Other than that, the patch looks good to me.

Alex

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +1 -2
                } else if (connector->display_info.is_hdmi) {
                        /* HDMI 1.3+ supports max clock of 340 Mhz */
-                       if (mode->clock > 340000)
+                       if (mode->clock > max_hdmi_pixel_clock)
                                return MODE_CLOCK_HIGH;
                        else
                                return MODE_OK;
--

2.50.1

#2 lore raw
Quoted 75 lines · Alex Deucher
Quoted 60 lines · Timur Kristóf

Change the legacy (non-DC) display code to respect the maximum pixel clock for HDMI and DVI-D. Reject modes that would require a higher pixel clock than can be supported.

Also update the maximum supported HDMI clock value depending on the ASIC type.

For reference, see the DC code:
check max_hdmi_pixel_clock in dce*_resource.c

---
 .../gpu/drm/amd/amdgpu/amdgpu_connectors.c    | 21
+++++++++++++++++--

 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +13 -0
index 5e375e9c4f5d..abcc4469cf57 100644
@@ -1195,12 +1195,26 @@ static void
 amdgpu_connector_dvi_force(struct drm_connector *connector)
                 amdgpu_connector->use_digital = true;
  }
 
+/**
+ * Returns the maximum supported HDMI (TMDS) pixel clock in KHz.
+ */
+static int amdgpu_max_hdmi_pixel_clock(const struct amdgpu_device
 *adev)
+{
+       if (adev->asic_type >= CHIP_POLARIS10)
+               return 600000;
+       else if (adev->asic_type >= CHIP_TONGA)
+               return 300000;
+       else
+               return 297000;
+}
+

 static enum drm_mode_status amdgpu_connector_dvi_mode_valid(struct drm_connector *connector,
                                            const struct drm_display_mode *mode)
 {
        struct drm_device *dev = connector->dev;
        struct amdgpu_device *adev = drm_to_adev(dev); struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
+       const int max_hdmi_pixel_clock = amdgpu_max_hdmi_pixel_clock(adev);

        /* XXX check mode bandwidth */

drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +0 -0
@@ -1208,10 +1222,13 @@ static enum drm_mode_status

amdgpu_connector_dvi_mode_valid(struct drm_connector if ((amdgpu_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I) || (amdgpu_connector->connector_object_id ==

Quoted 8 lines

CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D) || (amdgpu_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_B)) {
-                       return MODE_OK;
+                       if (mode->clock > max_hdmi_pixel_clock) +                               return MODE_CLOCK_HIGH; +                       else
+                               return MODE_OK;

I don't think it makes sense to limit dual link DVI to the max HDMI clock.  HDMI is single link TMDS.  Other than that, the patch looks good to me.

Quoted 1 line

Alex

Hi Alex,

The problem I'm trying to solve here is that on the non-DC code, by default I get a black screen on DVI-D because the code doesn't set an upper limit on what is actually supported. (And the monitor supports some modes which won't work.)

As far as I see, DC only allows 4K 30 Hz on DVI for the same connector and DVI/HDMI adapter. That may be wrong, though.

What value do you suggest to use?

If HDMI = single link TMDS, does that mean that a passive DVI/HDMI adapter cannot take advantage of dual-link DVI?

Thanks,
Timur

Quoted 12 lines
Quoted 12 lines

                } else if (connector->display_info.is_hdmi) { /* HDMI 1.3+ supports max clock of 340 Mhz */
-                       if (mode->clock > 340000)
+                       if (mode->clock > max_hdmi_pixel_clock) return MODE_CLOCK_HIGH; else
                                return MODE_OK;
--
2.50.1

#3 lore raw
Quoted 86 lines · Timur Kristóf
Quoted 75 lines · Alex Deucher
Quoted 63 lines · Timur Kristóf

Change the legacy (non-DC) display code to respect the maximum pixel clock for HDMI and DVI-D. Reject modes that would require a higher pixel clock than can be supported.

Also update the maximum supported HDMI clock value depending on the ASIC type.

For reference, see the DC code:
check max_hdmi_pixel_clock in dce*_resource.c

---
 .../gpu/drm/amd/amdgpu/amdgpu_connectors.c    | 21
+++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +13 -0
index 5e375e9c4f5d..abcc4469cf57 100644
@@ -1195,12 +1195,26 @@ static void
 amdgpu_connector_dvi_force(struct drm_connector *connector)
                amdgpu_connector->use_digital = true;
 }
 
+/**
+ * Returns the maximum supported HDMI (TMDS) pixel clock in KHz.
+ */
+static int amdgpu_max_hdmi_pixel_clock(const struct amdgpu_device
 *adev)
+{
+       if (adev->asic_type >= CHIP_POLARIS10)
+               return 600000;
+       else if (adev->asic_type >= CHIP_TONGA)
+               return 300000;
+       else
+               return 297000;
+}
+
 static enum drm_mode_status amdgpu_connector_dvi_mode_valid(struct
 drm_connector *connector,
                                            const struct
 drm_display_mode *mode)
 {
        struct drm_device *dev = connector->dev;
        struct amdgpu_device *adev = drm_to_adev(dev);
        struct amdgpu_connector *amdgpu_connector =

to_amdgpu_connector(connector);
+ const int max_hdmi_pixel_clock =
amdgpu_max_hdmi_pixel_clock(adev);

        /* XXX check mode bandwidth */
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +0 -0
@@ -1208,10 +1222,13 @@ static enum drm_mode_status

amdgpu_connector_dvi_mode_valid(struct drm_connector

                if ((amdgpu_connector->connector_object_id ==
CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I) ||
                    (amdgpu_connector->connector_object_id ==
CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D) ||
                    (amdgpu_connector->connector_object_id ==

CONNECTOR_OBJECT_ID_HDMI_TYPE_B)) {

drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c static enum drm_mode_status amdgpu_connector_dvi_mode_valid(struct drm_connector · line 1228

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +4 -1
-                       return MODE_OK;
+                       if (mode->clock > max_hdmi_pixel_clock)
+                               return MODE_CLOCK_HIGH;
+                       else
+                               return MODE_OK;

I don't think it makes sense to limit dual link DVI to the max HDMI clock. HDMI is single link TMDS. Other than that, the patch looks good to me.

Quoted 1 line

Alex

Hi Alex,

The problem I'm trying to solve here is that on the non-DC code, by default I get a black screen on DVI-D because the code doesn't set an upper limit on what is actually supported. (And the monitor supports some modes which won't work.)

Quoted 7 lines

As far as I see, DC only allows 4K 30 Hz on DVI for the same connector and DVI/HDMI adapter. That may be wrong, though.

What value do you suggest to use?

If HDMI = single link TMDS, does that mean that a passive DVI/HDMI adapter cannot take advantage of dual-link DVI?

DVI has a 165 Mhz limit per link so dual link would be 330 Mhz.

Alex

Quoted 16 lines

Thanks,
Timur

Quoted 12 lines
Quoted 12 lines
                } else if (connector->display_info.is_hdmi) {
                        /* HDMI 1.3+ supports max clock of 340 Mhz

*/

drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +1 -2
-                       if (mode->clock > 340000)
+                       if (mode->clock > max_hdmi_pixel_clock)
                                return MODE_CLOCK_HIGH;
                        else
                                return MODE_OK;
--

2.50.1

#4 lore raw
Quoted 99 lines · Alex Deucher
Quoted 97 lines · Timur Kristóf
Quoted 80 lines · Alex Deucher
Quoted 63 lines · Timur Kristóf

Change the legacy (non-DC) display code to respect the maximum pixel clock for HDMI and DVI-D. Reject modes that would require a higher pixel clock than can be supported.

Also update the maximum supported HDMI clock value depending on the ASIC type.

For reference, see the DC code:
check max_hdmi_pixel_clock in dce*_resource.c

---
 .../gpu/drm/amd/amdgpu/amdgpu_connectors.c    | 21
+++++++++++++++++--

 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +2 -0
index 5e375e9c4f5d..abcc4469cf57 100644
@@ -1195,12 +1195,26 @@ static void
 amdgpu_connector_dvi_force(struct drm_connector *connector)
                 amdgpu_connector->use_digital = true;
  }
 
+/**
+ * Returns the maximum supported HDMI (TMDS) pixel clock in

KHz.
+ */
+static int amdgpu_max_hdmi_pixel_clock(const struct amdgpu_device
*adev)

drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +9 -0
+{
+       if (adev->asic_type >= CHIP_POLARIS10)
+               return 600000;
+       else if (adev->asic_type >= CHIP_TONGA)
+               return 300000;
+       else
+               return 297000;
+}
+

 static enum drm_mode_status amdgpu_connector_dvi_mode_valid(struct drm_connector *connector,
                                            const struct drm_display_mode *mode)
 {
        struct drm_device *dev = connector->dev; struct amdgpu_device *adev = drm_to_adev(dev); struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
+       const int max_hdmi_pixel_clock = amdgpu_max_hdmi_pixel_clock(adev);

        /* XXX check mode bandwidth */

drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +0 -0
@@ -1208,10 +1222,13 @@ static enum drm_mode_status

amdgpu_connector_dvi_mode_valid(struct drm_connector if ((amdgpu_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I) || (amdgpu_connector->connector_object_id ==

Quoted 8 lines

CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D) || (amdgpu_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_B)) {
-                       return MODE_OK;
+                       if (mode->clock > max_hdmi_pixel_clock) +                               return MODE_CLOCK_HIGH; +                       else
+                               return MODE_OK;

I don't think it makes sense to limit dual link DVI to the max HDMI
clock.  HDMI is single link TMDS.  Other than that, the patch looks
good to me.

Quoted 1 line

Alex

Hi Alex,

The problem I'm trying to solve here is that on the non-DC code, by default I get a black screen on DVI-D because the code doesn't set an
upper limit on what is actually supported. (And the monitor supports
some modes which won't work.)

As far as I see, DC only allows 4K 30 Hz on DVI for the same connector
and DVI/HDMI adapter. That may be wrong, though.

Quoted 8 lines
Quoted 4 lines

What value do you suggest to use?

If HDMI = single link TMDS, does that mean that a passive DVI/HDMI adapter cannot take advantage of dual-link DVI?

DVI has a 165 Mhz limit per link so dual link would be 330 Mhz.

Alex

I see. That's my mistake, I thought that the max_hdmi_pixel_clock as defined in DC is applicable to all TMDS signals, not just HDMI.

That being said, can you confirm that a DVI/HDMI adapter can indeed use both links of the dual-link DVI?

Quoted 18 lines
Quoted 18 lines

Thanks,
Timur

Quoted 13 lines
Quoted 13 lines

                } else if (connector->display_info.is_hdmi) { /* HDMI 1.3+ supports max clock of 340 Mhz
*/
-                       if (mode->clock > 340000)
+                       if (mode->clock > max_hdmi_pixel_clock) return MODE_CLOCK_HIGH; else
                                return MODE_OK;
--
2.50.1

#5 lore raw
Quoted 108 lines · Timur Kristóf
Quoted 106 lines · Alex Deucher
Quoted 93 lines · Timur Kristóf
Quoted 80 lines · Alex Deucher
Quoted 66 lines · Timur Kristóf

Change the legacy (non-DC) display code to respect the maximum pixel clock for HDMI and DVI-D. Reject modes that would require a higher pixel clock than can be supported.

Also update the maximum supported HDMI clock value depending on the ASIC type.

For reference, see the DC code:
check max_hdmi_pixel_clock in dce*_resource.c

---
 .../gpu/drm/amd/amdgpu/amdgpu_connectors.c    | 21
+++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +2 -0
index 5e375e9c4f5d..abcc4469cf57 100644
@@ -1195,12 +1195,26 @@ static void
 amdgpu_connector_dvi_force(struct drm_connector *connector)
                amdgpu_connector->use_digital = true;
 }
 
+/**
+ * Returns the maximum supported HDMI (TMDS) pixel clock in

KHz.
+ */
+static int amdgpu_max_hdmi_pixel_clock(const struct amdgpu_device
*adev)

drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +9 -0
+{
+       if (adev->asic_type >= CHIP_POLARIS10)
+               return 600000;
+       else if (adev->asic_type >= CHIP_TONGA)
+               return 300000;
+       else
+               return 297000;
+}
+
 static enum drm_mode_status

amdgpu_connector_dvi_mode_valid(struct drm_connector *connector,
const struct
drm_display_mode *mode)

 {
        struct drm_device *dev = connector->dev;
        struct amdgpu_device *adev = drm_to_adev(dev);
        struct amdgpu_connector *amdgpu_connector =

to_amdgpu_connector(connector);
+ const int max_hdmi_pixel_clock =
amdgpu_max_hdmi_pixel_clock(adev);

        /* XXX check mode bandwidth */
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +0 -0
@@ -1208,10 +1222,13 @@ static enum drm_mode_status

amdgpu_connector_dvi_mode_valid(struct drm_connector

                if ((amdgpu_connector->connector_object_id ==
CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I) ||
                    (amdgpu_connector->connector_object_id ==
CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D) ||
                    (amdgpu_connector->connector_object_id ==

CONNECTOR_OBJECT_ID_HDMI_TYPE_B)) {

drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c static enum drm_mode_status amdgpu_connector_dvi_mode_valid(struct drm_connector · line 1228

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +4 -1
-                       return MODE_OK;
+                       if (mode->clock > max_hdmi_pixel_clock)
+                               return MODE_CLOCK_HIGH;
+                       else
+                               return MODE_OK;

I don't think it makes sense to limit dual link DVI to the max HDMI
clock. HDMI is single link TMDS. Other than that, the patch looks
good to me.

Quoted 1 line

Alex

Hi Alex,

The problem I'm trying to solve here is that on the non-DC code, by default I get a black screen on DVI-D because the code doesn't set an
upper limit on what is actually supported. (And the monitor supports
some modes which won't work.)

Quoted 8 lines

As far as I see, DC only allows 4K 30 Hz on DVI for the same connector
and DVI/HDMI adapter. That may be wrong, though.

What value do you suggest to use?

If HDMI = single link TMDS, does that mean that a passive DVI/HDMI adapter cannot take advantage of dual-link DVI?

DVI has a 165 Mhz limit per link so dual link would be 330 Mhz.

Quoted 8 lines
Quoted 1 line

Alex

I see. That's my mistake, I thought that the max_hdmi_pixel_clock as defined in DC is applicable to all TMDS signals, not just HDMI.

That being said, can you confirm that a DVI/HDMI adapter can indeed use both links of the dual-link DVI?

DVI to HDMI adapters probably only wire up the a single TMDS link because that is all HDMI supports. HDMI is single link TMDS and it was extended beyond 165 Mhz, so most monitors that support HDMI support faster single link clocks on DVI as well if they have both inputs since it's the same panel. Older DVI only monitors are probably the only ones where the single vs dual link clocks are important.

Alex

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines

Thanks,
Timur

Quoted 13 lines
Quoted 13 lines
                } else if (connector->display_info.is_hdmi) {
                        /* HDMI 1.3+ supports max clock of 340

Mhz
*/

drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +1 -2
-                       if (mode->clock > 340000)
+                       if (mode->clock > max_hdmi_pixel_clock)
                                return MODE_CLOCK_HIGH;
                        else
                                return MODE_OK;
--

2.50.1

#6 lore raw
Quoted 141 lines · Alex Deucher
Quoted 122 lines · Timur Kristóf
Quoted 112 lines · Alex Deucher
Quoted 110 lines · Timur Kristóf
Quoted 89 lines · Alex Deucher
Quoted 71 lines · Timur Kristóf

Change the legacy (non-DC) display code to respect the maximum
pixel clock for HDMI and DVI-D. Reject modes that would require
a higher pixel clock than can be supported.

Also update the maximum supported HDMI clock value depending on
the ASIC type.

For reference, see the DC code:
check max_hdmi_pixel_clock in dce*_resource.c

---
 .../gpu/drm/amd/amdgpu/amdgpu_connectors.c    | 21
+++++++++++++++++--

 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +2 -0
index 5e375e9c4f5d..abcc4469cf57 100644
@@ -1195,12 +1195,26 @@ static void
 amdgpu_connector_dvi_force(struct drm_connector *connector)
                 amdgpu_connector->use_digital = true;
  }
 
+/**
+ * Returns the maximum supported HDMI (TMDS) pixel clock

in
KHz.
+ */
+static int amdgpu_max_hdmi_pixel_clock(const struct amdgpu_device
*adev)

drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +9 -0
+{
+       if (adev->asic_type >= CHIP_POLARIS10)
+               return 600000;
+       else if (adev->asic_type >= CHIP_TONGA)
+               return 300000;
+       else
+               return 297000;
+}
+

 static enum drm_mode_status amdgpu_connector_dvi_mode_valid(struct drm_connector *connector,
                                            const struct drm_display_mode *mode)
 {
        struct drm_device *dev = connector->dev; struct amdgpu_device *adev = drm_to_adev(dev); struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
+       const int max_hdmi_pixel_clock = amdgpu_max_hdmi_pixel_clock(adev);

        /* XXX check mode bandwidth */

drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +0 -0
@@ -1208,10 +1222,13 @@ static enum drm_mode_status

amdgpu_connector_dvi_mode_valid(struct drm_connector if ((amdgpu_connector->connector_object_id ==
CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I) || (amdgpu_connector->connector_object_id ==
CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D) || (amdgpu_connector->connector_object_id

Quoted 8 lines

==
CONNECTOR_OBJECT_ID_HDMI_TYPE_B)) {
-                       return MODE_OK;
+                       if (mode->clock > max_hdmi_pixel_clock)
+                               return MODE_CLOCK_HIGH; +                       else
+                               return MODE_OK;

I don't think it makes sense to limit dual link DVI to the max
HDMI
clock.  HDMI is single link TMDS.  Other than that, the patch looks
good to me.

Quoted 1 line

Alex

Hi Alex,

The problem I'm trying to solve here is that on the non-DC code, by
default I get a black screen on DVI-D because the code doesn't set
an
upper limit on what is actually supported. (And the monitor supports
some modes which won't work.)

As far as I see, DC only allows 4K 30 Hz on DVI for the same connector
and DVI/HDMI adapter. That may be wrong, though.

What value do you suggest to use?

Quoted 7 lines
Quoted 3 lines

If HDMI = single link TMDS, does that mean that a passive DVI/HDMI
adapter cannot take advantage of dual-link DVI?

DVI has a 165 Mhz limit per link so dual link would be 330 Mhz.

Alex

Quoted 8 lines

I see. That's my mistake, I thought that the max_hdmi_pixel_clock as
defined in DC is applicable to all TMDS signals, not just HDMI.

That being said, can you confirm that a DVI/HDMI adapter can indeed use
both links of the dual-link DVI?

DVI to HDMI adapters probably only wire up the a single TMDS link because that is all HDMI supports.  HDMI is single link TMDS and it was extended beyond 165 Mhz, so most monitors that support HDMI support faster single link clocks on DVI as well if they have both inputs since it's the same panel.  Older DVI only monitors are probably the only ones where the single vs dual link clocks are important.

Quoted 1 line

Alex

Would it make sense to still use the HDMI clock for DVI-D when the monitor is a HDMI monitor, ie. display_info.is_hdmi is set? Considering that in this case we use the HDMI encoder mode.

Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines

Thanks,
Timur

Quoted 16 lines
Quoted 16 lines

                } else if (connector->display_info.is_hdmi) {
                        /* HDMI 1.3+ supports max clock of 340
Mhz
*/
-                       if (mode->clock > 340000) +                       if (mode->clock > max_hdmi_pixel_clock)
                                return MODE_CLOCK_HIGH; else
                                return MODE_OK;
--
2.50.1

#7 lore raw
Quoted 143 lines · Timur Kristóf
Quoted 141 lines · Alex Deucher
Quoted 122 lines · Timur Kristóf
Quoted 112 lines · Alex Deucher
Quoted 110 lines · Timur Kristóf
Quoted 89 lines · Alex Deucher
Quoted 76 lines · Timur Kristóf

Change the legacy (non-DC) display code to respect the maximum
pixel clock for HDMI and DVI-D. Reject modes that would require
a higher pixel clock than can be supported.

Also update the maximum supported HDMI clock value depending on
the ASIC type.

For reference, see the DC code:
check max_hdmi_pixel_clock in dce*_resource.c

---
 .../gpu/drm/amd/amdgpu/amdgpu_connectors.c    | 21
+++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +2 -0
index 5e375e9c4f5d..abcc4469cf57 100644
@@ -1195,12 +1195,26 @@ static void
 amdgpu_connector_dvi_force(struct drm_connector *connector)
                amdgpu_connector->use_digital = true;
 }
 
+/**
+ * Returns the maximum supported HDMI (TMDS) pixel clock

in
KHz.
+ */
+static int amdgpu_max_hdmi_pixel_clock(const struct amdgpu_device
*adev)

drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +9 -0
+{
+       if (adev->asic_type >= CHIP_POLARIS10)
+               return 600000;
+       else if (adev->asic_type >= CHIP_TONGA)
+               return 300000;
+       else
+               return 297000;
+}
+
 static enum drm_mode_status

amdgpu_connector_dvi_mode_valid(struct drm_connector *connector,
const struct
drm_display_mode *mode)

 {
        struct drm_device *dev = connector->dev;
        struct amdgpu_device *adev = drm_to_adev(dev);
        struct amdgpu_connector *amdgpu_connector =

to_amdgpu_connector(connector);
+ const int max_hdmi_pixel_clock =
amdgpu_max_hdmi_pixel_clock(adev);

        /* XXX check mode bandwidth */
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +0 -0
@@ -1208,10 +1222,13 @@ static enum drm_mode_status

amdgpu_connector_dvi_mode_valid(struct drm_connector

                if ((amdgpu_connector->connector_object_id
==
CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I) ||
                    (amdgpu_connector->connector_object_id
==
CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D) ||
                    (amdgpu_connector->connector_object_id

==
CONNECTOR_OBJECT_ID_HDMI_TYPE_B)) {

drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +1 -1
-                       return MODE_OK;
+                       if (mode->clock >

max_hdmi_pixel_clock)

drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +3 -0
+                               return MODE_CLOCK_HIGH;
+                       else
+                               return MODE_OK;

I don't think it makes sense to limit dual link DVI to the max
HDMI
clock. HDMI is single link TMDS. Other than that, the patch looks
good to me.

Quoted 1 line

Alex

Hi Alex,

The problem I'm trying to solve here is that on the non-DC code, by
default I get a black screen on DVI-D because the code doesn't set
an
upper limit on what is actually supported. (And the monitor supports
some modes which won't work.)

As far as I see, DC only allows 4K 30 Hz on DVI for the same connector
and DVI/HDMI adapter. That may be wrong, though.

What value do you suggest to use?

Quoted 7 lines
Quoted 3 lines

If HDMI = single link TMDS, does that mean that a passive DVI/HDMI
adapter cannot take advantage of dual-link DVI?

DVI has a 165 Mhz limit per link so dual link would be 330 Mhz.

Alex

Quoted 8 lines

I see. That's my mistake, I thought that the max_hdmi_pixel_clock as
defined in DC is applicable to all TMDS signals, not just HDMI.

That being said, can you confirm that a DVI/HDMI adapter can indeed use
both links of the dual-link DVI?

DVI to HDMI adapters probably only wire up the a single TMDS link because that is all HDMI supports. HDMI is single link TMDS and it was extended beyond 165 Mhz, so most monitors that support HDMI support faster single link clocks on DVI as well if they have both inputs since it's the same panel. Older DVI only monitors are probably the only ones where the single vs dual link clocks are important.

Quoted 5 lines
Quoted 1 line

Alex

Would it make sense to still use the HDMI clock for DVI-D when the monitor is a HDMI monitor, ie. display_info.is_hdmi is set? Considering that in this case we use the HDMI encoder mode.

Yes. In that case, we are basically just sending an HDMI signal.

Alex

Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines

Thanks,
Timur

Quoted 16 lines
Quoted 16 lines
                } else if (connector->display_info.is_hdmi)
{
                        /* HDMI 1.3+ supports max clock of

340
Mhz
*/

drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +1 -1
-                       if (mode->clock > 340000)
+                       if (mode->clock >

max_hdmi_pixel_clock)

                                return MODE_CLOCK_HIGH;
                        else
                                return MODE_OK;

--
2.50.1