Use amdgpu by default on CIK dGPUs
Subsystems (2)
cover Use amdgpu by default on CIK dGPUs
Now that analog connector support is merged in DC, amdgpu has reached feature parity with the old radeon driver on CIK dedicated GPUs.
This series refactors how the default driver for SI/CIK is determined, adds a "-1" option for default, and makes it possible to determine the default depending on the chip. This way we can make sure to keep using radeon on those chips that are not at feature parity yet.
As a reminder, CIK dedicated GPUs are the following:
Hawaii (2013~2015): Radeon R9 290 and 390 series Bonaire (2013~2016): Radeon HD 7790/8870, R7 260/360/450, RX 455, FirePro W5100, etc. and their mobile variants.
Why?
Compared to the old radeon driver, amdgpu offers better performance, more display features through DC, as well as support for Vulkan 1.3 through RADV. (Note, although the hardware is 10 years old, the R9 290 still appears in the Steam hardware survey for Linux, albeit at a modest 0.25%.)
What can these GPUs actually do on amdgpu?
Hawaii (eg. R9 390X) can even play modern games such as Baldur's Gate 3 or Cyberpunk 2077 and gives a decent user experience considering the age of the hardware. Bonaire can play games from its era well.
Looking forward to reviews and feedback!
ps. After VCE1 support is merged, I would like to also enable amdgpu by default on SI dGPUs.
Timur Kristóf (3):
drm/radeon: Refactor how SI and CIK support is determined drm/amdgpu: Refactor how SI and CIK support is determined drm/amdgpu: Use amdgpu by default on CIK dedicated GPUs
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 159 ++++++++++++++---------- drivers/gpu/drm/radeon/radeon_drv.c | 80 +++++++----- 2 files changed, 144 insertions(+), 95 deletions(-)
Signature · 1 line
2.51.1
PATCH 1/3 drm/radeon: Refactor how SI and CIK support is determined
Move the determination into a separate function. Change radeon.si_support and radeon.cik_support so that their default value is -1 (default).
This prepares the code for changing the default driver based on the chip.
--- drivers/gpu/drm/radeon/radeon_drv.c | 78 ++++++++++++++++++----------- 1 file changed, 50 insertions(+), 28 deletions(-)
drivers/gpu/drm/radeon/radeon_drv.c +50 -28
@@ -241,12 +241,12 @@ module_param_named(uvd, radeon_uvd, int, 0444);MODULE_PARM_DESC (vce,"vce enable/disable vce support (1 = enable, 0 = disable)" );module_param_named (vce, radeon_vce, int,0444 ); -int radeon_si_support =1 ; -MODULE_PARM_DESC (si_support,"SI support (1 = enabled (default), 0 = disabled)" ); +int radeon_si_support =-1 ; +MODULE_PARM_DESC (si_support,"SI support (1 = enabled, 0 = disabled, -1 = default)" );module_param_named (si_support, radeon_si_support, int,0444 ); -int radeon_cik_support =1 ; -MODULE_PARM_DESC (cik_support,"CIK support (1 = enabled (default), 0 = disabled)" ); +int radeon_cik_support =-1 ; +MODULE_PARM_DESC (cik_support,"CIK support (1 = enabled, 0 = disabled, -1 = default)" );module_param_named (cik_support, radeon_cik_support, int,0444 );static const struct pci_device_id pciidlist[] = {
@@ -256,6 +256,50 @@ MODULE_DEVICE_TABLE(pci, pciidlist);static const struct drm_driver kms_driver; +static bool radeon_support_enabled (struct device *dev, +const enum radeon_family family) +{ +const char *gen; +int module_param =-1 ; +bool amdgpu_support_built =IS_ENABLED (CONFIG_DRM_AMDGPU ); +bool support_by_default = true; + +switch (family) { +case CHIP_TAHITI : +case CHIP_PITCAIRN : +case CHIP_VERDE : +case CHIP_OLAND : +case CHIP_HAINAN : + gen ="SI" ; + module_param = radeon_si_support; + amdgpu_support_built &=IS_ENABLED (CONFIG_DRM_AMDGPU_SI ); +break ; + +case CHIP_BONAIRE : +case CHIP_HAWAII : +case CHIP_KAVERI : +case CHIP_KABINI : +case CHIP_MULLINS : + gen ="CIK" ; + module_param = radeon_cik_support; + amdgpu_support_built &=IS_ENABLED (CONFIG_DRM_AMDGPU_CIK ); +break ; + +default : +/* All other chips are supported by radeon only */ +return true; + } + +if ((module_param ==-1 && (support_by_default || !amdgpu_support_built)) || + module_param ==1 ) +return true; + +if (!module_param) +dev_info (dev,"%s support disabled by module param\n" , gen); + +return false; +} +static int radeon_pci_probe (struct pci_dev *pdev,const struct pci_device_id *ent) {
@@ -271,30 +315,8 @@ static int radeon_pci_probe(struct pci_dev *pdev, flags = ent->driver_data; -if (!radeon_si_support) { -switch (flags &RADEON_FAMILY_MASK ) { -case CHIP_TAHITI : -case CHIP_PITCAIRN : -case CHIP_VERDE : -case CHIP_OLAND : -case CHIP_HAINAN : -dev_info (dev, -"SI support disabled by module param\n" ); -return -ENODEV ; - } - } -if (!radeon_cik_support) { -switch (flags &RADEON_FAMILY_MASK ) { -case CHIP_KAVERI : -case CHIP_BONAIRE : -case CHIP_HAWAII : -case CHIP_KABINI : -case CHIP_MULLINS : -dev_info (dev, -"CIK support disabled by module param\n" ); -return -ENODEV ; - } - } +if (!radeon_support_enabled (dev, flags &RADEON_FAMILY_MASK )) +return -ENODEV ;if (vga_switcheroo_client_probe_defer (pdev))return -EPROBE_DEFER ;
Signature · 1 line
2.51.1
PATCH 2/3 drm/amdgpu: Refactor how SI and CIK support is determined
In reply to Timur KristófMove the determination into a separate function. Change amdgpu.si_support and amdgpu.cik_support so that their
default value is -1 (default).
This prepares the code for changing the default driver based
on the chip.
Also adjust the module param documentation.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 155 ++++++++++++++---------- 1 file changed, 88 insertions(+), 67 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +88 -67
@@ -618,39 +618,37 @@ module_param_named(timeout_period, amdgpu_watchdog_timer.period, uint, 0644);/** * DOC: si_support (int) -* Set SI support driver. This parameter works after set config CONFIG_DRM_AMDGPU_SI. For SI asic, when radeon driver is enabled, -* set value 0 to use radeon driver, while set value 1 to use amdgpu driver. The default is using radeon driver when it available, -* otherwise using amdgpu driver. -*/ +* 1 = enabled, 0 = disabled, -1 = default +* +* SI (Southern Islands) are first generation GCN GPUs, supported by both +* drivers: radeon (old) and amdgpu (new). This parameter controls whether +* amdgpu should support SI. +* By default, SI chips are supported by radeon (except when radeon is not built). +* Only relevant when CONFIG_DRM_AMDGPU_SI is enabled to build SI support in amdgpu. +* See also radeon.si_support which should be disabled when amdgpu.si_support is +* enabled, and vice versa. +*/ +int amdgpu_si_support =-1 ;#ifdef CONFIG_DRM_AMDGPU_SI - -#if IS_ENABLED (CONFIG_DRM_RADEON ) ||IS_ENABLED (CONFIG_DRM_RADEON_MODULE ) -int amdgpu_si_support; -MODULE_PARM_DESC (si_support,"SI support (1 = enabled, 0 = disabled (default))" ); -#else -int amdgpu_si_support =1 ; -MODULE_PARM_DESC (si_support,"SI support (1 = enabled (default), 0 = disabled)" ); -#endif - +MODULE_PARM_DESC (si_support,"SI support (1 = enabled, 0 = disabled, -1 = default)" );module_param_named (si_support, amdgpu_si_support, int,0444 );#endif /** * DOC: cik_support (int) -* Set CIK support driver. This parameter works after set config CONFIG_DRM_AMDGPU_CIK. For CIK asic, when radeon driver is enabled, -* set value 0 to use radeon driver, while set value 1 to use amdgpu driver. The default is using radeon driver when it available, -* otherwise using amdgpu driver. -*/ +* 1 = enabled, 0 = disabled, -1 = default +* +* CIK (Sea Islands) are second generation GCN GPUs, supported by both +* drivers: radeon (old) and amdgpu (new). This parameter controls whether +* amdgpu should support CIK. +* By default, CIK chips are supported by radeon (except when radeon is not built). +* Only relevant when CONFIG_DRM_AMDGPU_CIK is enabled to build CIK support in amdgpu. +* See also radeon.cik_support which should be disabled when amdgpu.cik_support is +* enabled, and vice versa. +*/ +int amdgpu_cik_support =-1 ;#ifdef CONFIG_DRM_AMDGPU_CIK - -#if IS_ENABLED (CONFIG_DRM_RADEON ) ||IS_ENABLED (CONFIG_DRM_RADEON_MODULE ) -int amdgpu_cik_support; -MODULE_PARM_DESC (cik_support,"CIK support (1 = enabled, 0 = disabled (default))" ); -#else -int amdgpu_cik_support =1 ; -MODULE_PARM_DESC (cik_support,"CIK support (1 = enabled (default), 0 = disabled)" ); -#endif - +MODULE_PARM_DESC (cik_support,"CIK support (1 = enabled, 0 = disabled, -1 = default)" );module_param_named (cik_support, amdgpu_cik_support, int,0444 );#endif
@@ -2307,6 +2305,69 @@ static unsigned long amdgpu_fix_asic_type(struct pci_dev *pdev, unsigned long flreturn flags; } +static bool amdgpu_support_enabled (struct device *dev, +const enum amd_asic_type family) +{ +const char *gen; +const char *param; +int module_param =-1 ; +bool radeon_support_built =IS_ENABLED (CONFIG_DRM_RADEON ); +bool amdgpu_support_built = false; +bool support_by_default = false; + +switch (family) { +case CHIP_TAHITI : +case CHIP_PITCAIRN : +case CHIP_VERDE : +case CHIP_OLAND : +case CHIP_HAINAN : + gen ="SI" ; + param ="si_support" ; + module_param = amdgpu_si_support; + amdgpu_support_built =IS_ENABLED (CONFIG_DRM_AMDGPU_SI ); +break ; + +case CHIP_BONAIRE : +case CHIP_HAWAII : +case CHIP_KAVERI : +case CHIP_KABINI : +case CHIP_MULLINS : + gen ="CIK" ; + param ="cik_support" ; + module_param = amdgpu_cik_support; + amdgpu_support_built =IS_ENABLED (CONFIG_DRM_AMDGPU_CIK ); +break ; + +default : +/* All other chips are supported by amdgpu only */ +return true; + } + +if (!amdgpu_support_built) { +dev_info (dev,"amdgpu built without %s support\n" , gen); +return false; + } + +if ((module_param ==-1 && (support_by_default || !radeon_support_built)) || + module_param ==1 ) { +if (radeon_support_built) +dev_info (dev,"%s support provided by amdgpu.\n" +"Use radeon.%s=1 amdgpu.%s=0 to override.\n" , + gen, param, param); + +return true; + } + +if (radeon_support_built) +dev_info (dev,"%s support provided by radeon.\n" +"Use radeon.%s=0 amdgpu.%s=1 to override.\n" , + gen, param, param); +else if (module_param ==0 ) +dev_info (dev,"%s support disabled by module param\n" , gen); + +return false; +} +static int amdgpu_pci_probe (struct pci_dev *pdev,const struct pci_device_id *ent) {
@@ -2354,48 +2415,8 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,return -ENOTSUPP ; } -switch (flags &AMD_ASIC_MASK ) { -case CHIP_TAHITI : -case CHIP_PITCAIRN : -case CHIP_VERDE : -case CHIP_OLAND : -case CHIP_HAINAN : -#ifdef CONFIG_DRM_AMDGPU_SI -if (!amdgpu_si_support) { -dev_info (&pdev->dev, -"SI support provided by radeon.\n" ); -dev_info (&pdev->dev, -"Use radeon.si_support=0 amdgpu.si_support=1 to override.\n" - ); -return -ENODEV ; - } -break ; -#else -dev_info (&pdev->dev,"amdgpu is built without SI support.\n" ); +if (!amdgpu_support_enabled (&pdev->dev, flags &AMD_ASIC_MASK ))return -ENODEV ; -#endif -case CHIP_KAVERI : -case CHIP_BONAIRE : -case CHIP_HAWAII : -case CHIP_KABINI : -case CHIP_MULLINS : -#ifdef CONFIG_DRM_AMDGPU_CIK -if (!amdgpu_cik_support) { -dev_info (&pdev->dev, -"CIK support provided by radeon.\n" ); -dev_info (&pdev->dev, -"Use radeon.cik_support=0 amdgpu.cik_support=1 to override.\n" - ); -return -ENODEV ; - } -break ; -#else -dev_info (&pdev->dev,"amdgpu is built without CIK support.\n" ); -return -ENODEV ; -#endif -default : -break ; - } adev =devm_drm_dev_alloc (&pdev->dev, &amdgpu_kms_driver,typeof (*adev), ddev);if (IS_ERR (adev))
Signature · 1 line
2.51.1
PATCH 3/3 drm/amdgpu: Use amdgpu by default on CIK dedicated GPUs
In reply to Timur KristófThe amdgpu driver has been working well on CIK dGPUs for years. Now that the DC analog connector support landed, these GPUs are at feature parity with the old radeon driver.
Additionally, amdgpu yields extra performance, supports Vulkan and provides more display features through DC as well as more robust power management.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 6 +++++- drivers/gpu/drm/radeon/radeon_drv.c | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +5 -1
@@ -641,7 +641,9 @@ module_param_named(si_support, amdgpu_si_support, int, 0444);* CIK (Sea Islands) are second generation GCN GPUs, supported by both * drivers: radeon (old) and amdgpu (new). This parameter controls whether * amdgpu should support CIK. -* By default, CIK chips are supported by radeon (except when radeon is not built). +* By default: +* - CIK dedicated GPUs are supported by amdgpu. +* - CIK APUs are supported by radeon (except when radeon is not built). * Only relevant when CONFIG_DRM_AMDGPU_CIK is enabled to build CIK support in amdgpu. * See also radeon.cik_support which should be disabled when amdgpu.cik_support is * enabled, and vice versa.
@@ -2329,6 +2331,8 @@ static bool amdgpu_support_enabled(struct device *dev,case CHIP_BONAIRE :case CHIP_HAWAII : + support_by_default = true; + fallthrough;case CHIP_KAVERI :case CHIP_KABINI :case CHIP_MULLINS :
drivers/gpu/drm/radeon/radeon_drv.c +2 -0
@@ -277,6 +277,8 @@ static bool radeon_support_enabled(struct device *dev,case CHIP_BONAIRE :case CHIP_HAWAII : + support_by_default = false; + fallthrough;case CHIP_KAVERI :case CHIP_KABINI :case CHIP_MULLINS :
Signature · 1 line
2.51.1
Alex Deucher
AppliedApplied the series. Thanks!
Alex
Quoted 49 lines · Timur Kristóf
Now that analog connector support is merged in DC, amdgpu has reached feature parity with the old radeon driver on CIK dedicated GPUs.
This series refactors how the default driver for SI/CIK is determined, adds a "-1" option for default, and makes it possible to determine the default depending on the chip. This way we can make sure to keep using radeon on those chips that are not at feature parity yet.
As a reminder, CIK dedicated GPUs are the following:
Hawaii (2013~2015): Radeon R9 290 and 390 series Bonaire (2013~2016): Radeon HD 7790/8870, R7 260/360/450, RX 455, FirePro W5100, etc. and their mobile variants.Why?
Compared to the old radeon driver, amdgpu offers better performance, more display features through DC, as well as support for Vulkan 1.3 through RADV. (Note, although the hardware is 10 years old, the R9 290 still appears in the Steam hardware survey for Linux, albeit at a modest 0.25%.)
What can these GPUs actually do on amdgpu?
Hawaii (eg. R9 390X) can even play modern games such as Baldur's Gate 3 or Cyberpunk 2077 and gives a decent user experience considering the age of the hardware. Bonaire can play games from its era well.
Looking forward to reviews and feedback!
ps. After VCE1 support is merged, I would like to also enable amdgpu by default on SI dGPUs.
Timur Kristóf (3):
drm/radeon: Refactor how SI and CIK support is determined drm/amdgpu: Refactor how SI and CIK support is determined drm/amdgpu: Use amdgpu by default on CIK dedicated GPUsdrivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 159 ++++++++++++++---------- drivers/gpu/drm/radeon/radeon_drv.c | 80 +++++++----- 2 files changed, 144 insertions(+), 95 deletions(-)--
2.51.1