radeon: added support for 2560x1080 resolution
Subsystems (2)
PATCH 1/1 radeon: added support for 2560x1080 resolution
I was wondering why I can't set the resolution to 2560x1080,
while in windows 7 I can without a problem. I looked at the radeon driver code and found it doesn't support this resolution. So I made some changes. I added the hdmi_mhz parameter. In cmdline I set radeon.hdmi_mhz=190 Only tested on the Radeon HD 5830
--- drivers/gpu/drm/radeon/radeon_benchmark.c | 5 +++-- drivers/gpu/drm/radeon/radeon_connectors.c | 25 +++++++++++++--------- drivers/gpu/drm/radeon/radeon_drv.c | 5 +++++ drivers/gpu/drm/radeon/radeon_encoders.c | 6 ++++-- 4 files changed, 27 insertions(+), 14 deletions(-)
drivers/gpu/drm/radeon/radeon_benchmark.c +3 -2
@@ -30,7 +30,7 @@#define RADEON_BENCHMARK_COPY_DMA 0#define RADEON_BENCHMARK_ITERATIONS 1024 -#define RADEON_BENCHMARK_COMMON_MODES_N 17 +#define RADEON_BENCHMARK_COMMON_MODES_N 18 static int radeon_benchmark_do_move(struct radeon_device *rdev, unsigned size, uint64_t saddr, uint64_t daddr,
@@ -184,7 +184,8 @@ void radeon_benchmark(struct radeon_device *rdev, int test_number)1680 *1050 *4 ,1600 *1200 *4 ,1920 *1080 *4 , - 1920 * 1200 * 4 +1920 *1200 *4 , + 2560 * 1080 * 4 };switch (test_number) {
drivers/gpu/drm/radeon/radeon_connectors.c +15 -10
@@ -37,6 +37,8 @@#include <linux/pm_runtime.h> #include <linux/vga_switcheroo.h> +extern int hdmimhz; +static int radeon_dp_handle_hpd (struct drm_connector *connector) {struct radeon_connector *radeon_connector =to_radeon_connector (connector);
@@ -503,7 +505,7 @@ static void radeon_add_common_modes(struct drm_encoder *encoder, struct drm_connstruct mode_size {int w;int h; - } common_modes[17 ] = { + } common_modes[] = { {640 ,480 }, {720 ,480 }, {800 ,600 },
@@ -520,10 +522,11 @@ static void radeon_add_common_modes(struct drm_encoder *encoder, struct drm_conn {1680, 1050}, {1600, 1200}, {1920, 1080}, - {1920, 1200} + {1920, 1200}, + {2560, 1080} }; -for (i =0 ; i <17 ; i++) { +for (i =0 ; i <ARRAY_SIZE (common_modes); i++) {if (radeon_encoder->devices & (ATOM_DEVICE_TV_SUPPORT )) {if (common_modes[i].w >1024 || common_modes[i].h >768 )
@@ -1491,25 +1494,27 @@ static enum drm_mode_status radeon_dvi_mode_valid(struct drm_connector *connecto (mode->clock > 135000))return MODE_CLOCK_HIGH ; -if (radeon_connector->use_digital && (mode->clock >165000 )) { +if (radeon_connector->use_digital && (mode->clock > (hdmimhz *1000 ))) {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 )) + (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))) { + }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 {return MODE_CLOCK_HIGH ; } }/* check against the max pixel clock */ -if ((mode->clock /10 ) > rdev->clock.max_pixel_clock) +if ((mode->clock /10 ) > rdev->clock.max_pixel_clock){return MODE_CLOCK_HIGH ; + }return MODE_OK ; }
@@ -1809,7 +1814,7 @@ static enum drm_mode_status radeon_dp_mode_valid(struct drm_connector *connectorif (mode->clock >340000 )return MODE_CLOCK_HIGH ; }else { -if (mode->clock >165000 ) +if (mode->clock > (hdmimhz *1000 ))return MODE_CLOCK_HIGH ; } }
drivers/gpu/drm/radeon/radeon_drv.c +5 -0
@@ -281,6 +281,11 @@ int radeon_cik_support = 1;MODULE_PARM_DESC (cik_support,"CIK support (1 = enabled (default), 0 = disabled)" );module_param_named (cik_support, radeon_cik_support, int,0444 ); +int hdmimhz =165 ; +MODULE_PARM_DESC (hdmi_mhz,"set HDMI max frequency, default is 165" ); +module_param_named (hdmi_mhz, hdmimhz, int,0444 ); + +static struct pci_device_id pciidlist[] = { radeon_PCI_IDS };
drivers/gpu/drm/radeon/radeon_encoders.c +4 -2
@@ -35,6 +35,8 @@#include "radeon_legacy_encoders.h" #include "atom.h" +extern int hdmimhz; +static uint32_t radeon_encoder_clones (struct drm_encoder *encoder) {struct drm_device *dev = encoder->dev;
@@ -389,7 +391,7 @@ bool radeon_dig_monitor_is_duallink(struct drm_encoder *encoder,else return false; }else { -if (pixel_clock >165000 ) +if (pixel_clock > (hdmimhz *1000 ))return true;else return false;
@@ -414,7 +416,7 @@ bool radeon_dig_monitor_is_duallink(struct drm_encoder *encoder,else return false; }else { -if (pixel_clock >165000 ) +if (pixel_clock > (hdmimhz *1000 ))return true;else return false;
Signature · 6 lines
2.30.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 28 lines · Marcin Raszka
I was wondering why I can't set the resolution to 2560x1080,
while in windows 7 I can without a problem. I looked at the radeon driver code and found it doesn't support this resolution. So I made some changes. I added thehdmi_mhzparameter. In cmdline I set radeon.hdmi_mhz=190 Only tested on the Radeon HD 5830--- drivers/gpu/drm/radeon/radeon_benchmark.c | 5 +++-- drivers/gpu/drm/radeon/radeon_connectors.c | 25 +++++++++++++--------- drivers/gpu/drm/radeon/radeon_drv.c | 5 +++++ drivers/gpu/drm/radeon/radeon_encoders.c | 6 ++++-- 4 files changed, 27 insertions(+), 14 deletions(-)drivers/gpu/drm/radeon/radeon_benchmark.c +1
-1@@ -30,7 +30,7 @@#define RADEON_BENCHMARK_COPY_DMA 0#define RADEON_BENCHMARK_ITERATIONS 1024 -#define RADEON_BENCHMARK_COMMON_MODES_N 17 +#define RADEON_BENCHMARK_COMMON_MODES_N 18 static int radeon_benchmark_do_move(struct radeon_device *rdev, unsigned size, uint64_t saddr, uint64_t daddr,
drivers/gpu/drm/radeon/radeon_benchmark.c void radeon_benchmark(struct radeon_device *rdev, int test_number) · line 190
Quoted 8 lines
drivers/gpu/drm/radeon/radeon_benchmark.c +2
-1@@ -184,7 +184,8 @@ void radeon_benchmark(struct radeon_device *rdev, int test_number)1680 *1050 *4 ,1600 *1200 *4 ,1920 *1080 *4 , - 1920 * 1200 * 4 +1920 *1200 *4 , + 2560 * 1080 * 4 };
This change is unrelated.
Quoted 27 lines
drivers/gpu/drm/radeon/radeon_benchmark.c +0
-0switch (test_number) {drivers/gpu/drm/radeon/radeon_connectors.c +3
-1@@ -37,6 +37,8 @@#include <linux/pm_runtime.h> #include <linux/vga_switcheroo.h> +extern int hdmimhz; +static int radeon_dp_handle_hpd (struct drm_connector *connector) {struct radeon_connector *radeon_connector =to_radeon_connector (connector);@@ -503,7 +505,7 @@ static void radeon_add_common_modes(struct drm_encoder *encoder, struct drm_connstruct mode_size {int w;int h; - } common_modes[17 ] = { + } common_modes[] = { {640 ,480 }, {720 ,480 }, {800 ,600 },@@ -520,10 +522,11 @@ static void radeon_add_common_modes(struct drm_encoder *encoder, struct drm_conn {1680, 1050}, {1600, 1200}, {1920, 1080},
drivers/gpu/drm/radeon/radeon_connectors.c static void radeon_add_common_modes(struct drm_encoder *encoder, struct drm_conn · line 532
Quoted 10 lines
drivers/gpu/drm/radeon/radeon_connectors.c +3
-2- {1920, 1200} + {1920, 1200}, + {2560, 1080} }; -for (i =0 ; i <17 ; i++) { +for (i =0 ; i <ARRAY_SIZE (common_modes); i++) {if (radeon_encoder->devices & (ATOM_DEVICE_TV_SUPPORT )) {if (common_modes[i].w >1024 || common_modes[i].h >768 )
Same with these changes.
Quoted 21 lines
drivers/gpu/drm/radeon/radeon_connectors.c +6
-5@@ -1491,25 +1494,27 @@ static enum drm_mode_status radeon_dvi_mode_valid(struct drm_connector *connecto (mode->clock > 135000))return MODE_CLOCK_HIGH ; -if (radeon_connector->use_digital && (mode->clock >165000 )) { +if (radeon_connector->use_digital && (mode->clock > (hdmimhz *1000 ))) {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 )) + (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))) { + }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 ; + }
drivers/gpu/drm/radeon/radeon_connectors.c static enum drm_mode_status radeon_dvi_mode_valid(struct drm_connector *connecto · line 1517
Quoted 10 lines
drivers/gpu/drm/radeon/radeon_connectors.c +2
-1}else {return MODE_CLOCK_HIGH ; } }/* check against the max pixel clock */ -if ((mode->clock /10 ) > rdev->clock.max_pixel_clock) +if ((mode->clock /10 ) > rdev->clock.max_pixel_clock){return MODE_CLOCK_HIGH ; + }
Unrelated whitespace change.
Quoted 17 lines
drivers/gpu/drm/radeon/radeon_connectors.c +1
-1return MODE_OK ; }@@ -1809,7 +1814,7 @@ static enum drm_mode_status radeon_dp_mode_valid(struct drm_connector *connectorif (mode->clock >340000 )return MODE_CLOCK_HIGH ; }else { -if (mode->clock >165000 ) +if (mode->clock > (hdmimhz *1000 ))return MODE_CLOCK_HIGH ; } }drivers/gpu/drm/radeon/radeon_drv.c +0
-0
drivers/gpu/drm/radeon/radeon_drv.c int radeon_cik_support = 1; · line 286
Quoted 6 lines
drivers/gpu/drm/radeon/radeon_drv.c +3
-0@@ -281,6 +281,11 @@ int radeon_cik_support = 1;MODULE_PARM_DESC (cik_support,"CIK support (1 = enabled (default), 0 = disabled)" );module_param_named (cik_support, radeon_cik_support, int,0444 ); +int hdmimhz =165 ; +MODULE_PARM_DESC (hdmi_mhz,"set HDMI max frequency, default is 165" ); +module_param_named (hdmi_mhz, hdmimhz, int,0444 );
A similar patch has been proposed before. I'd prefer not to add an option to overclock the display hardware. See this discussion for more background:
https://bugzilla.kernel.org/show_bug.cgi?id=172421
Alex
Quoted 39 lines
drivers/gpu/drm/radeon/radeon_drv.c +2
-0+ +static struct pci_device_id pciidlist[] = { radeon_PCI_IDS };drivers/gpu/drm/radeon/radeon_encoders.c +4
-3@@ -35,6 +35,8 @@#include "radeon_legacy_encoders.h" #include "atom.h" +extern int hdmimhz; +static uint32_t radeon_encoder_clones (struct drm_encoder *encoder) {struct drm_device *dev = encoder->dev;@@ -389,7 +391,7 @@ bool radeon_dig_monitor_is_duallink(struct drm_encoder *encoder,else return false; }else { -if (pixel_clock >165000 ) +if (pixel_clock > (hdmimhz *1000 ))return true;else return false;@@ -414,7 +416,7 @@ bool radeon_dig_monitor_is_duallink(struct drm_encoder *encoder,else return false; }else { -if (pixel_clock >165000 ) +if (pixel_clock > (hdmimhz *1000 ))return true;else return false; --2.30.0
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel