Skip to contentSkip to conversation

disp: activate dual link TMDS links only when possible

PATCH Superseded Ilia Mirkin 2 participants 5 messages Nov 3, 2015 – Nov 4, 2015 3 messages not in the archive

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 disp: activate dual link TMDS links only when possible

From: Hauke Mehrtens <[email protected]>

Without this patch a pixel clock rate above 165 MHz on a TMDS link is assumed to be dual link. This is true for DVI, but not for HDMI. HDMI supports no dual link, but it supports pixel clock rates above 165 MHz. Only activate Dual Link mode when it is actual possible.

---
 drm/nouveau/nv50_display.c           | 8 ++++----
 drm/nouveau/nvkm/engine/disp/gf119.c | 2 +-
 drm/nouveau/nvkm/engine/disp/nv50.c  | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)
drm/nouveau/nv50_display.c +4 -4
index c053c50..93bcfdf 100644
@@ -1961,10 +1961,10 @@ nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *umode,
 	switch (nv_encoder->dcb->type) {
 	case DCB_OUTPUT_TMDS:
 		if (nv_encoder->dcb->sorconf.link & 1) {
-			if (mode->clock < 165000)
-				proto = 0x1;
-			else
-				proto = 0x5;
+			proto = 0x1;
+			if (mode->clock >= 165000 &&
+			    nv_encoder->dcb->duallink_possible)
+				proto |= 0x4;
 		} else {
 			proto = 0x2;
 		}
drm/nouveau/nvkm/engine/disp/gf119.c +1 -1
index 186fd3a..8691b68 100644
@@ -158,7 +158,7 @@ exec_clkcmp(struct nv50_disp *disp, int head, int id, u32 pclk, u32 *conf)
 	switch (outp->info.type) {
 	case DCB_OUTPUT_TMDS:
 		*conf = (ctrl & 0x00000f00) >> 8;
-		if (pclk >= 165000)
+		if (pclk >= 165000 && outp->info.duallink_possible)
 			*conf |= 0x0100;
 		break;
 	case DCB_OUTPUT_LVDS:
drm/nouveau/nvkm/engine/disp/nv50.c +1 -1
index 32e73a9..ceecd0e 100644
@@ -391,7 +391,7 @@ exec_clkcmp(struct nv50_disp *disp, int head, int id, u32 pclk, u32 *conf)
 		switch (outp->info.type) {
 		case DCB_OUTPUT_TMDS:
 			*conf = (ctrl & 0x00000f00) >> 8;
-			if (pclk >= 165000)
+			if (pclk >= 165000 && outp->info.duallink_possible)
 				*conf |= 0x0100;
 			break;
 		case DCB_OUTPUT_LVDS:
Signature · 6 lines
2.4.10

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): 1446590484-8670-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/[email protected]

#2 lore raw

PATCH 2/2 connector: allow 225/297MHz pixel clocks for HDMI on Fermi/Kepler

Some Fermi's apparently alow allow 297MHz clocks, so create a parameter which allows end-users to set it themselves until we have a reliable way to determine the board's maximum pixel clocks.

---
 drm/nouveau/nouveau_connector.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drm/nouveau/nouveau_connector.c +15 -0
index 4c8f6ef..f5806eb 100644
@@ -56,6 +56,10 @@ MODULE_PARM_DESC(duallink, "Allow dual-link TMDS (default: enabled)");
 int nouveau_duallink = 1;
 module_param_named(duallink, nouveau_duallink, int, 0400);
 
+MODULE_PARM_DESC(hdmimhz, "Force a maximum HDMI pixel clock (in MHz)");
+int nouveau_hdmimhz = 0;
+module_param_named(hdmimhz, nouveau_hdmimhz, int, 0400);
+
 struct nouveau_encoder *
 find_encoder(struct drm_connector *connector, int type)
 {
@@ -815,6 +819,17 @@ get_tmds_link_bandwidth(struct drm_connector *connector)
 	struct nouveau_drm *drm = nouveau_drm(connector->dev);
 	struct dcb_output *dcb = nv_connector->detected_encoder->dcb;
 
+	if (drm_detect_hdmi_monitor(nv_connector->edid)) {
+		if (nouveau_hdmimhz > 0)
+			return nouveau_hdmimhz * 1000;
+		/* Note: these limits are conservative, some Fermi's
+		 * can do 297 MHz. Unclear how this can be determined.
+		 */
+		if (drm->device.info.family >= NV_DEVICE_INFO_V0_KEPLER)
+			return 297000;
+		if (drm->device.info.family >= NV_DEVICE_INFO_V0_FERMI)
+			return 225000;
+	}
 	if (dcb->location != DCB_LOC_ON_CHIP ||
 	    drm->device.info.chipset >= 0x46)
 		return 165000;
Signature · 6 lines
2.4.10

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
#3 lore raw
In reply to a message not in the archive
Quoted 21 lines · Ilia Mirkin

From: Hauke Mehrtens <hauke-5/[email protected]>

Without this patch a pixel clock rate above 165 MHz on a TMDS link is assumed to be dual link. This is true for DVI, but not for HDMI. HDMI supports no dual link, but it supports pixel clock rates above 165 MHz. Only activate Dual Link mode when it is actual possible.

---
 drm/nouveau/nv50_display.c           | 8 ++++----
 drm/nouveau/nvkm/engine/disp/gf119.c | 2 +-
 drm/nouveau/nvkm/engine/disp/nv50.c  | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)
drm/nouveau/nv50_display.c +0 -0
index c053c50..93bcfdf 100644
@@ -1961,10 +1961,10 @@ nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *umode,
 	switch (nv_encoder->dcb->type) {

drm/nouveau/nv50_display.c nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *umode, · line 1967

Quoted 10 lines
drm/nouveau/nv50_display.c +4 -4
 	case DCB_OUTPUT_TMDS:
 		if (nv_encoder->dcb->sorconf.link & 1) {
-			if (mode->clock < 165000)
-				proto = 0x1;
-			else
-				proto = 0x5;
+			proto = 0x1;
+			if (mode->clock >= 165000 &&
+			    nv_encoder->dcb->duallink_possible)
+				proto |= 0x4;

This is a somewhat flaky condition, given that one could plug a single-link HDMI monitor into a duallink-capable TMDS connector.

Still, it's an improvement :)

Quoted 8 lines
drm/nouveau/nv50_display.c +0 -0
 		} else {
 			proto = 0x2;
 		}
drm/nouveau/nvkm/engine/disp/gf119.c +0 -0
index 186fd3a..8691b68 100644

drm/nouveau/nvkm/engine/disp/gf119.c exec_clkcmp(struct nv50_disp *disp, int head, int id, u32 pclk, u32 *conf) · line 162

Quoted 6 lines
drm/nouveau/nvkm/engine/disp/gf119.c +1 -1
@@ -158,7 +158,7 @@ exec_clkcmp(struct nv50_disp *disp, int head, int id, u32 pclk, u32 *conf)
 	switch (outp->info.type) {
 	case DCB_OUTPUT_TMDS:
 		*conf = (ctrl & 0x00000f00) >> 8;
-		if (pclk >= 165000)
+		if (pclk >= 165000 && outp->info.duallink_possible)
 			*conf |= 0x0100;

I think it might be more robust to key this off the SOR protocol, rather than duplicating the condition above.

drm/nouveau/nvkm/engine/disp/nv50.c exec_clkcmp(struct nv50_disp *disp, int head, int id, u32 pclk, u32 *conf) · line 395

Quoted 13 lines
drm/nouveau/nvkm/engine/disp/gf119.c +0 -0
 		break;
 	case DCB_OUTPUT_LVDS:
drm/nouveau/nvkm/engine/disp/nv50.c +1 -1
index 32e73a9..ceecd0e 100644
@@ -391,7 +391,7 @@ exec_clkcmp(struct nv50_disp *disp, int head, int id, u32 pclk, u32 *conf)
 		switch (outp->info.type) {
 		case DCB_OUTPUT_TMDS:
 			*conf = (ctrl & 0x00000f00) >> 8;
-			if (pclk >= 165000)
+			if (pclk >= 165000 && outp->info.duallink_possible)
 				*conf |= 0x0100;

Same here.

drm/nouveau/nvkm/engine/disp/nv50.c exec_clkcmp(struct nv50_disp *disp, int head, int id, u32 pclk, u32 *conf) · line 397

Quoted 3 lines
drm/nouveau/nvkm/engine/disp/nv50.c +0 -0
 			break;
 		case DCB_OUTPUT_LVDS:

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw
Quoted 35 lines · Ben Skeggs
Quoted 21 lines · Ilia Mirkin

From: Hauke Mehrtens <[email protected]>

Without this patch a pixel clock rate above 165 MHz on a TMDS link is assumed to be dual link. This is true for DVI, but not for HDMI. HDMI supports no dual link, but it supports pixel clock rates above 165 MHz. Only activate Dual Link mode when it is actual possible.

---
 drm/nouveau/nv50_display.c           | 8 ++++----
 drm/nouveau/nvkm/engine/disp/gf119.c | 2 +-
 drm/nouveau/nvkm/engine/disp/nv50.c  | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)
drm/nouveau/nv50_display.c +0 -0
index c053c50..93bcfdf 100644
@@ -1961,10 +1961,10 @@ nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *umode,
      switch (nv_encoder->dcb->type) {

drm/nouveau/nv50_display.c nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *umode, · line 1967

Quoted 10 lines
drm/nouveau/nv50_display.c +4 -4
      case DCB_OUTPUT_TMDS:
              if (nv_encoder->dcb->sorconf.link & 1) {
-                     if (mode->clock < 165000)
-                             proto = 0x1;
-                     else
-                             proto = 0x5;
+                     proto = 0x1;
+                     if (mode->clock >= 165000 &&
+                         nv_encoder->dcb->duallink_possible)
+                             proto |= 0x4;

This is a somewhat flaky condition, given that one could plug a single-link HDMI monitor into a duallink-capable TMDS connector.

Quoted 1 line

Still, it's an improvement :)

Yeah, FWIW I thought of that (for the second patch too). All this stuff is pretty fragile. But... what are you gonna do. Is there some other way of telling whether we're on HDMI or DVI?

Quoted 17 lines
Quoted 9 lines
drm/nouveau/nv50_display.c +0 -0
              } else {
                      proto = 0x2;
              }
drm/nouveau/nvkm/engine/disp/gf119.c +0 -0
index 186fd3a..8691b68 100644

drm/nouveau/nvkm/engine/disp/gf119.c exec_clkcmp(struct nv50_disp *disp, int head, int id, u32 pclk, u32 *conf) · line 162

Quoted 6 lines
drm/nouveau/nvkm/engine/disp/gf119.c +1 -1
@@ -158,7 +158,7 @@ exec_clkcmp(struct nv50_disp *disp, int head, int id, u32 pclk, u32 *conf)
      switch (outp->info.type) {
      case DCB_OUTPUT_TMDS:
              *conf = (ctrl & 0x00000f00) >> 8;
-             if (pclk >= 165000)
+             if (pclk >= 165000 && outp->info.duallink_possible)
                      *conf |= 0x0100;

I think it might be more robust to key this off the SOR protocol, rather than duplicating the condition above.

You mean disp->sor.lvdsconf? What do I do with that? Or did you have something else in mind?

Quoted 20 lines
Quoted 8 lines
drm/nouveau/nvkm/engine/disp/gf119.c +0 -0
              break;
      case DCB_OUTPUT_LVDS:
drm/nouveau/nvkm/engine/disp/nv50.c +0 -0
index 32e73a9..ceecd0e 100644

drm/nouveau/nvkm/engine/disp/nv50.c exec_clkcmp(struct nv50_disp *disp, int head, int id, u32 pclk, u32 *conf) · line 395

Quoted 6 lines
drm/nouveau/nvkm/engine/disp/nv50.c +1 -1
@@ -391,7 +391,7 @@ exec_clkcmp(struct nv50_disp *disp, int head, int id, u32 pclk, u32 *conf)
              switch (outp->info.type) {
              case DCB_OUTPUT_TMDS:
                      *conf = (ctrl & 0x00000f00) >> 8;
-                     if (pclk >= 165000)
+                     if (pclk >= 165000 && outp->info.duallink_possible)
                              *conf |= 0x0100;

Same here.

Quoted 3 lines
drm/nouveau/nvkm/engine/disp/nv50.c +0 -0
                      break;
              case DCB_OUTPUT_LVDS:

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): CAKb7Uvi1uJt29hW4-VbVCwaTD4cOT5VZ9AbFvUdUYg8NZ957hA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#7 lore raw
Quoted 36 lines · Ilia Mirkin
Quoted 35 lines · Ben Skeggs
Quoted 21 lines · Ilia Mirkin

From: Hauke Mehrtens <hauke-5/[email protected]>

Without this patch a pixel clock rate above 165 MHz on a TMDS link is assumed to be dual link. This is true for DVI, but not for HDMI. HDMI supports no dual link, but it supports pixel clock rates above 165 MHz. Only activate Dual Link mode when it is actual possible.

---
 drm/nouveau/nv50_display.c           | 8 ++++----
 drm/nouveau/nvkm/engine/disp/gf119.c | 2 +-
 drm/nouveau/nvkm/engine/disp/nv50.c  | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)
drm/nouveau/nv50_display.c +0 -0
index c053c50..93bcfdf 100644
@@ -1961,10 +1961,10 @@ nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *umode,
      switch (nv_encoder->dcb->type) {

drm/nouveau/nv50_display.c nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *umode, · line 1967

Quoted 10 lines
drm/nouveau/nv50_display.c +4 -4
      case DCB_OUTPUT_TMDS:
              if (nv_encoder->dcb->sorconf.link & 1) {
-                     if (mode->clock < 165000)
-                             proto = 0x1;
-                     else
-                             proto = 0x5;
+                     proto = 0x1;
+                     if (mode->clock >= 165000 &&
+                         nv_encoder->dcb->duallink_possible)
+                             proto |= 0x4;

This is a somewhat flaky condition, given that one could plug a single-link HDMI monitor into a duallink-capable TMDS connector.

Quoted 5 lines
Quoted 1 line

Still, it's an improvement :)

Yeah, FWIW I thought of that (for the second patch too). All this stuff is pretty fragile. But... what are you gonna do. Is there some other way of telling whether we're on HDMI or DVI?

drm_detect_hdmi_monitor() should do the trick :)

Quoted 19 lines
Quoted 18 lines
Quoted 10 lines
drm/nouveau/nv50_display.c +0 -0
              } else {
                      proto = 0x2;
              }
drm/nouveau/nvkm/engine/disp/gf119.c +0 -0
index 186fd3a..8691b68 100644

drm/nouveau/nvkm/engine/disp/gf119.c exec_clkcmp(struct nv50_disp *disp, int head, int id, u32 pclk, u32 *conf) · line 162

Quoted 6 lines
drm/nouveau/nvkm/engine/disp/gf119.c +1 -1
@@ -158,7 +158,7 @@ exec_clkcmp(struct nv50_disp *disp, int head, int id, u32 pclk, u32 *conf)
      switch (outp->info.type) {
      case DCB_OUTPUT_TMDS:
              *conf = (ctrl & 0x00000f00) >> 8;
-             if (pclk >= 165000)
+             if (pclk >= 165000 && outp->info.duallink_possible)
                      *conf |= 0x0100;

I think it might be more robust to key this off the SOR protocol, rather than duplicating the condition above.

Quoted 2 lines

You mean disp->sor.lvdsconf? What do I do with that? Or did you have something else in mind?

No, not that. The "proto" field you're setting set "5" in the previous hunk when dual-link is requested is actually NV907D_SOR_SET_CONTROL_PROTOCOL_DUAL_TMDS - which is what is parsed here with (ctrl & 0x00000f00).

So, instead of "if (pclk >= 165000)" here, you should just be able to do "(*conf == 5)".

I have no idea why the BIOS tables identify the dual-link data with 0x0105 instead of 0x0005, when "5" already indicates DUAL_TMDS - but anyway.

Quoted 17 lines
Quoted 17 lines
Quoted 9 lines
drm/nouveau/nvkm/engine/disp/gf119.c +0 -0
              break;
      case DCB_OUTPUT_LVDS:
drm/nouveau/nvkm/engine/disp/nv50.c +0 -0
index 32e73a9..ceecd0e 100644

drm/nouveau/nvkm/engine/disp/nv50.c exec_clkcmp(struct nv50_disp *disp, int head, int id, u32 pclk, u32 *conf) · line 395

Quoted 6 lines
drm/nouveau/nvkm/engine/disp/nv50.c +1 -1
@@ -391,7 +391,7 @@ exec_clkcmp(struct nv50_disp *disp, int head, int id, u32 pclk, u32 *conf)
              switch (outp->info.type) {
              case DCB_OUTPUT_TMDS:
                      *conf = (ctrl & 0x00000f00) >> 8;
-                     if (pclk >= 165000)
+                     if (pclk >= 165000 && outp->info.duallink_possible)
                              *conf |= 0x0100;

Same here.

Quoted 4 lines
Quoted 4 lines

drm/nouveau/nvkm/engine/disp/nv50.c exec_clkcmp(struct nv50_disp *disp, int head, int id, u32 pclk, u32 *conf) · line 397

Quoted 3 lines
drm/nouveau/nvkm/engine/disp/nv50.c +0 -0
                      break;
              case DCB_OUTPUT_LVDS:

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau