-
Notifications
You must be signed in to change notification settings - Fork 1
/
0001-Added-hdmimhz-and-dvi-override.patch
118 lines (112 loc) · 4.95 KB
/
0001-Added-hdmimhz-and-dvi-override.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
From 9b0505272514b4f1aadf4b801aa62dae107a4dc2 Mon Sep 17 00:00:00 2001
From: Samuel <[email protected]>
Date: Sun, 17 Jan 2021 15:41:15 +0000
Subject: [PATCH] Added hdmimhz and dvi override
Signed-off-by: Samuel <[email protected]>
---
drivers/gpu/drm/radeon/radeon.h | 2 ++
drivers/gpu/drm/radeon/radeon_connectors.c | 26 +++++++++++++++++-----
drivers/gpu/drm/radeon/radeon_drv.c | 8 +++++++
drivers/gpu/drm/radeon/radeon_encoders.c | 8 ++++++-
4 files changed, 38 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 30e32adc1fc6..dffc40360282 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -117,6 +117,8 @@ extern int radeon_bapm;
extern int radeon_backlight;
extern int radeon_auxch;
extern int radeon_mst;
+extern int radeon_hdmimhz;
+extern int radeon_apply_hdmimhz_to_dvid;
extern int radeon_uvd;
extern int radeon_vce;
extern int radeon_si_support;
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index e30834434442..932583f1d878 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -1490,18 +1490,34 @@ static enum drm_mode_status radeon_dvi_mode_valid(struct drm_connector *connecto
(rdev->family == CHIP_RV100) &&
(mode->clock > 135000))
return MODE_CLOCK_HIGH;
-
if (radeon_connector->use_digital && (mode->clock > 165000)) {
if ((radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I) ||
- (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D) ||
- (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_B))
+ // hdmimhz may be lower than the maximum supported frequency of monitor
+ // don't apply hdmimhz to dvi if there isn't a hdmi monitor plugged into the dvi port
+ (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D && !(radeon_apply_hdmimhz_to_dvid &&
+ radeon_hdmimhz > 0 && drm_detect_hdmi_monitor(radeon_connector_edid(connector)))) ||
+ (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_B)){
+
return MODE_OK;
+ }
else if (ASIC_IS_DCE6(rdev) && drm_detect_hdmi_monitor(radeon_connector_edid(connector))) {
/* HDMI 1.3+ supports max clock of 340 Mhz */
- if (mode->clock > 340000)
+ if (mode->clock > 340000){
return MODE_CLOCK_HIGH;
- else
+ }
+ else{
return MODE_OK;
+ }
+
+ } else if (
+ // Either HDMI port or a HDMI monitor plugged into DVI-D port
+ (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_A ||
+ (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D &&
+ drm_detect_hdmi_monitor(radeon_connector_edid(connector)) && radeon_apply_hdmimhz_to_dvid)) &&
+ radeon_hdmimhz > 0 && (mode->clock <= radeon_hdmimhz * 1000) &&
+ ((mode->clock / 10) <= rdev->clock.max_pixel_clock)
+ ) {
+ return MODE_OK;
} else {
return MODE_CLOCK_HIGH;
}
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 4cd30613fa1d..3b3738bcdc17 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -197,6 +197,8 @@ int radeon_bapm = -1;
int radeon_backlight = -1;
int radeon_auxch = -1;
int radeon_mst = 0;
+int radeon_hdmimhz = 0;
+int radeon_apply_hdmimhz_to_dvid = 0;
int radeon_uvd = 1;
int radeon_vce = 1;
@@ -290,6 +292,12 @@ module_param_named(auxch, radeon_auxch, int, 0444);
MODULE_PARM_DESC(mst, "DisplayPort MST experimental support (1 = enable, 0 = disable)");
module_param_named(mst, radeon_mst, int, 0444);
+MODULE_PARM_DESC(hdmimhz, "Force a maximum HDMI pixel clock (in MHz); try 165/225/297/330 to overclock your TMDS for gaining a higher resolution.");
+module_param_named(hdmimhz, radeon_hdmimhz, int, 0400);
+
+MODULE_PARM_DESC(apply_hdmimhz_to_dvid, "Apply radeon_hdmimhz to DVI-D port (only applies when HDMI monitor is connected to DVI-D port) (1 = enable, 0 = disable)");
+module_param_named(apply_hdmimhz_to_dvid, radeon_apply_hdmimhz_to_dvid, int, 0400);
+
MODULE_PARM_DESC(uvd, "uvd enable/disable uvd support (1 = enable, 0 = disable)");
module_param_named(uvd, radeon_uvd, int, 0444);
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c
index ced022fae19d..2c05df20eb8e 100644
--- a/drivers/gpu/drm/radeon/radeon_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_encoders.c
@@ -421,7 +421,13 @@ bool radeon_dig_monitor_is_duallink(struct drm_encoder *encoder,
return false;
} else {
if (pixel_clock > 165000)
- return true;
+ if ((connector->connector_type == DRM_MODE_CONNECTOR_HDMIA ||
+ (DRM_MODE_CONNECTOR_DVID && drm_detect_hdmi_monitor(radeon_connector_edid(connector)) &&
+ radeon_apply_hdmimhz_to_dvid)) &&
+ radeon_hdmimhz > 0)
+ return false;
+ else
+ return true;
else
return false;
}
--
2.25.1