[PATCH] drm/radeon/kms: add accel parameter
Alex Deucher
alexdeucher at gmail.com
Tue Apr 27 19:32:41 PDT 2010
Additional patch on top of the no accel patch to fix resume when no
accel is specified or if accel failed to init at startup.
Alex
On Fri, Apr 23, 2010 at 5:21 PM, Alex Deucher <alexdeucher at gmail.com> wrote:
> From 114f3491a411f50a0de1d59475fc267efd5afa6a Mon Sep 17 00:00:00 2001
> From: Alex Deucher <alexdeucher at gmail.com>
> Date: Fri, 23 Apr 2010 17:12:46 -0400
> Subject: [PATCH] drm/radeon/kms: add accel parameter
>
> passing accel=0 will disable acceleration.
>
> This is useful for debugging.
>
> Signed-off-by: Alex Deucher <alexdeucher at gmail.com>
> ---
> drivers/gpu/drm/radeon/evergreen.c | 2 +-
> drivers/gpu/drm/radeon/r100.c | 2 +-
> drivers/gpu/drm/radeon/r300.c | 2 +-
> drivers/gpu/drm/radeon/r420.c | 2 +-
> drivers/gpu/drm/radeon/r520.c | 2 +-
> drivers/gpu/drm/radeon/r600.c | 2 +-
> drivers/gpu/drm/radeon/radeon.h | 1 +
> drivers/gpu/drm/radeon/radeon_drv.c | 4 ++++
> drivers/gpu/drm/radeon/rs400.c | 2 +-
> drivers/gpu/drm/radeon/rs600.c | 2 +-
> drivers/gpu/drm/radeon/rs690.c | 2 +-
> drivers/gpu/drm/radeon/rv515.c | 2 +-
> drivers/gpu/drm/radeon/rv770.c | 2 +-
> 13 files changed, 16 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/evergreen.c
> b/drivers/gpu/drm/radeon/evergreen.c
> index 0137a4c..af19080 100644
> --- a/drivers/gpu/drm/radeon/evergreen.c
> +++ b/drivers/gpu/drm/radeon/evergreen.c
> @@ -2111,7 +2111,7 @@ int evergreen_init(struct radeon_device *rdev)
>
> rdev->accel_working = false;
> r = evergreen_startup(rdev);
> - if (r) {
> + if (r || (radeon_accel == 0)) {
> dev_err(rdev->dev, "disabling GPU acceleration\n");
> r700_cp_fini(rdev);
> r600_wb_fini(rdev);
> diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
> index 6443d9e..0441e80 100644
> --- a/drivers/gpu/drm/radeon/r100.c
> +++ b/drivers/gpu/drm/radeon/r100.c
> @@ -3738,7 +3738,7 @@ int r100_init(struct radeon_device *rdev)
> r100_set_safe_registers(rdev);
> rdev->accel_working = true;
> r = r100_startup(rdev);
> - if (r) {
> + if (r || (radeon_accel == 0)) {
> /* Somethings want wront with the accel init stop accel */
> dev_err(rdev->dev, "Disabling GPU acceleration\n");
> r100_cp_fini(rdev);
> diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c
> index 590f6a8..30a9112 100644
> --- a/drivers/gpu/drm/radeon/r300.c
> +++ b/drivers/gpu/drm/radeon/r300.c
> @@ -1443,7 +1443,7 @@ int r300_init(struct radeon_device *rdev)
> r300_set_reg_safe(rdev);
> rdev->accel_working = true;
> r = r300_startup(rdev);
> - if (r) {
> + if (r || (radeon_accel == 0)) {
> /* Somethings want wront with the accel init stop accel */
> dev_err(rdev->dev, "Disabling GPU acceleration\n");
> r100_cp_fini(rdev);
> diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c
> index be092d2..ebb9017 100644
> --- a/drivers/gpu/drm/radeon/r420.c
> +++ b/drivers/gpu/drm/radeon/r420.c
> @@ -376,7 +376,7 @@ int r420_init(struct radeon_device *rdev)
> r420_set_reg_safe(rdev);
> rdev->accel_working = true;
> r = r420_startup(rdev);
> - if (r) {
> + if (r || (radeon_accel == 0)) {
> /* Somethings want wront with the accel init stop accel */
> dev_err(rdev->dev, "Disabling GPU acceleration\n");
> r100_cp_fini(rdev);
> diff --git a/drivers/gpu/drm/radeon/r520.c b/drivers/gpu/drm/radeon/r520.c
> index 870111e..38caca5 100644
> --- a/drivers/gpu/drm/radeon/r520.c
> +++ b/drivers/gpu/drm/radeon/r520.c
> @@ -290,7 +290,7 @@ int r520_init(struct radeon_device *rdev)
> rv515_set_safe_registers(rdev);
> rdev->accel_working = true;
> r = r520_startup(rdev);
> - if (r) {
> + if (r || (radeon_accel == 0)) {
> /* Somethings want wront with the accel init stop accel */
> dev_err(rdev->dev, "Disabling GPU acceleration\n");
> r100_cp_fini(rdev);
> diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
> index 4a35c54..d11632f 100644
> --- a/drivers/gpu/drm/radeon/r600.c
> +++ b/drivers/gpu/drm/radeon/r600.c
> @@ -2324,7 +2324,7 @@ int r600_init(struct radeon_device *rdev)
>
> rdev->accel_working = true;
> r = r600_startup(rdev);
> - if (r) {
> + if (r || (radeon_accel == 0)) {
> dev_err(rdev->dev, "disabling GPU acceleration\n");
> r600_cp_fini(rdev);
> r600_wb_fini(rdev);
> diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
> index d284270..fc0574c 100644
> --- a/drivers/gpu/drm/radeon/radeon.h
> +++ b/drivers/gpu/drm/radeon/radeon.h
> @@ -93,6 +93,7 @@ extern int radeon_dynpm;
> extern int radeon_audio;
> extern int radeon_disp_priority;
> extern int radeon_hw_i2c;
> +extern int radeon_accel;
>
> /*
> * Copy from radeon_drv.h so we don't have to include both and have conflicting
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c
> b/drivers/gpu/drm/radeon/radeon_drv.c
> index 4b05563..cfe5cd8 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -95,6 +95,7 @@ int radeon_dynpm = -1;
> int radeon_audio = 1;
> int radeon_disp_priority = 0;
> int radeon_hw_i2c = 0;
> +int radeon_accel = 1;
>
> MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers");
> module_param_named(no_wb, radeon_no_wb, int, 0444);
> @@ -144,6 +145,9 @@ module_param_named(disp_priority,
> radeon_disp_priority, int, 0444);
> MODULE_PARM_DESC(hw_i2c, "hw i2c engine enable (0 = disable)");
> module_param_named(hw_i2c, radeon_hw_i2c, int, 0444);
>
> +MODULE_PARM_DESC(accel, "acceleration (0 = disable)");
> +module_param_named(accel, radeon_accel, int, 0444);
> +
> static int radeon_suspend(struct drm_device *dev, pm_message_t state)
> {
> drm_radeon_private_t *dev_priv = dev->dev_private;
> diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c
> index dc76fe7..e36f193 100644
> --- a/drivers/gpu/drm/radeon/rs400.c
> +++ b/drivers/gpu/drm/radeon/rs400.c
> @@ -528,7 +528,7 @@ int rs400_init(struct radeon_device *rdev)
> r300_set_reg_safe(rdev);
> rdev->accel_working = true;
> r = rs400_startup(rdev);
> - if (r) {
> + if (r || (radeon_accel == 0)) {
> /* Somethings want wront with the accel init stop accel */
> dev_err(rdev->dev, "Disabling GPU acceleration\n");
> r100_cp_fini(rdev);
> diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
> index b312b72..fbdc6be 100644
> --- a/drivers/gpu/drm/radeon/rs600.c
> +++ b/drivers/gpu/drm/radeon/rs600.c
> @@ -789,7 +789,7 @@ int rs600_init(struct radeon_device *rdev)
> rs600_set_safe_registers(rdev);
> rdev->accel_working = true;
> r = rs600_startup(rdev);
> - if (r) {
> + if (r || (radeon_accel == 0)) {
> /* Somethings want wront with the accel init stop accel */
> dev_err(rdev->dev, "Disabling GPU acceleration\n");
> r100_cp_fini(rdev);
> diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c
> index 56a0aec..1a38699 100644
> --- a/drivers/gpu/drm/radeon/rs690.c
> +++ b/drivers/gpu/drm/radeon/rs690.c
> @@ -749,7 +749,7 @@ int rs690_init(struct radeon_device *rdev)
> rs600_set_safe_registers(rdev);
> rdev->accel_working = true;
> r = rs690_startup(rdev);
> - if (r) {
> + if (r || (radeon_accel == 0)) {
> /* Somethings want wront with the accel init stop accel */
> dev_err(rdev->dev, "Disabling GPU acceleration\n");
> r100_cp_fini(rdev);
> diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c
> index c513473..104e285 100644
> --- a/drivers/gpu/drm/radeon/rv515.c
> +++ b/drivers/gpu/drm/radeon/rv515.c
> @@ -523,7 +523,7 @@ int rv515_init(struct radeon_device *rdev)
> rv515_set_safe_registers(rdev);
> rdev->accel_working = true;
> r = rv515_startup(rdev);
> - if (r) {
> + if (r || (radeon_accel == 0)) {
> /* Somethings want wront with the accel init stop accel */
> dev_err(rdev->dev, "Disabling GPU acceleration\n");
> r100_cp_fini(rdev);
> diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
> index a74683e..779a89e 100644
> --- a/drivers/gpu/drm/radeon/rv770.c
> +++ b/drivers/gpu/drm/radeon/rv770.c
> @@ -1123,7 +1123,7 @@ int rv770_init(struct radeon_device *rdev)
>
> rdev->accel_working = true;
> r = rv770_startup(rdev);
> - if (r) {
> + if (r || (radeon_accel == 0)) {
> dev_err(rdev->dev, "disabling GPU acceleration\n");
> r700_cp_fini(rdev);
> r600_wb_fini(rdev);
> --
> 1.5.6.3
>
-------------- next part --------------
From e5696b6500de7a8d13e3bf73eac7ec3bc68f3d03 Mon Sep 17 00:00:00 2001
From: Alex Deucher <alexdeucher at gmail.com>
Date: Tue, 27 Apr 2010 14:03:45 -0400
Subject: [PATCH] drm/radeon/kms: handle accel failure on resume better
If initializing accel on resume fails, fallback to no
accel. This should fix resume if accel setup failed
initially or was forced off by the user.
Signed-off-by: Alex Deucher <alexdeucher at gmail.com>
---
drivers/gpu/drm/radeon/evergreen.c | 40 ++++++++++++++++++---------------
drivers/gpu/drm/radeon/r100.c | 35 +++++++++++++++++++----------
drivers/gpu/drm/radeon/r300.c | 41 ++++++++++++++++++++++------------
drivers/gpu/drm/radeon/r420.c | 42 +++++++++++++++++++++++------------
drivers/gpu/drm/radeon/r520.c | 36 ++++++++++++++++++++----------
drivers/gpu/drm/radeon/r600.c | 39 ++++++++++++++++++---------------
drivers/gpu/drm/radeon/rs400.c | 34 +++++++++++++++++++---------
drivers/gpu/drm/radeon/rs600.c | 34 +++++++++++++++++++---------
drivers/gpu/drm/radeon/rs690.c | 34 +++++++++++++++++++---------
drivers/gpu/drm/radeon/rv515.c | 36 ++++++++++++++++++++----------
drivers/gpu/drm/radeon/rv770.c | 40 ++++++++++++++++++---------------
11 files changed, 258 insertions(+), 153 deletions(-)
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 480a362..4ac3998 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -1992,6 +1992,17 @@ static int evergreen_startup(struct radeon_device *rdev)
return 0;
}
+static void evergreen_disable_accel(struct radeon_device *rdev)
+{
+ dev_err(rdev->dev, "disabling GPU acceleration\n");
+ r700_cp_fini(rdev);
+ r600_wb_fini(rdev);
+ r600_irq_fini(rdev);
+ radeon_irq_kms_fini(rdev);
+ evergreen_pcie_gart_fini(rdev);
+ rdev->accel_working = false;
+}
+
int evergreen_resume(struct radeon_device *rdev)
{
int r;
@@ -2009,15 +2020,14 @@ int evergreen_resume(struct radeon_device *rdev)
}
r = evergreen_startup(rdev);
- if (r) {
- DRM_ERROR("r600 startup failed on resume\n");
- return r;
- }
-
- r = r600_ib_test(rdev);
- if (r) {
- DRM_ERROR("radeon: failled testing IB (%d).\n", r);
- return r;
+ if (r || (radeon_accel == 0))
+ evergreen_disable_accel(rdev);
+ else {
+ r = r600_ib_test(rdev);
+ if (r) {
+ DRM_ERROR("radeon: failled testing IB (%d).\n", r);
+ return r;
+ }
}
return r;
@@ -2152,15 +2162,9 @@ int evergreen_init(struct radeon_device *rdev)
rdev->accel_working = false;
r = evergreen_startup(rdev);
- if (r || (radeon_accel == 0)) {
- dev_err(rdev->dev, "disabling GPU acceleration\n");
- r700_cp_fini(rdev);
- r600_wb_fini(rdev);
- r600_irq_fini(rdev);
- radeon_irq_kms_fini(rdev);
- evergreen_pcie_gart_fini(rdev);
- rdev->accel_working = false;
- }
+ if (r || (radeon_accel == 0))
+ evergreen_disable_accel(rdev);
+
if (rdev->accel_working) {
r = radeon_ib_pool_init(rdev);
if (r) {
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 54cc9df..71c076f 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -3778,8 +3778,23 @@ static int r100_startup(struct radeon_device *rdev)
return 0;
}
+static void r100_disable_accel(struct radeon_device *rdev)
+{
+ /* Something went wrong with the accel init stop accel */
+ dev_err(rdev->dev, "Disabling GPU acceleration\n");
+ r100_cp_fini(rdev);
+ r100_wb_fini(rdev);
+ r100_ib_fini(rdev);
+ radeon_irq_kms_fini(rdev);
+ if (rdev->flags & RADEON_IS_PCI)
+ r100_pci_gart_fini(rdev);
+ rdev->accel_working = false;
+}
+
int r100_resume(struct radeon_device *rdev)
{
+ int r;
+
/* Make sur GART are not working */
if (rdev->flags & RADEON_IS_PCI)
r100_pci_gart_disable(rdev);
@@ -3797,7 +3812,11 @@ int r100_resume(struct radeon_device *rdev)
r100_clock_startup(rdev);
/* Initialize surface registers */
radeon_surface_init(rdev);
- return r100_startup(rdev);
+
+ r = r100_startup(rdev);
+ if (r || (radeon_accel == 0))
+ r100_disable_accel(rdev);
+ return 0;
}
int r100_suspend(struct radeon_device *rdev)
@@ -3898,16 +3917,8 @@ int r100_init(struct radeon_device *rdev)
r100_set_safe_registers(rdev);
rdev->accel_working = true;
r = r100_startup(rdev);
- if (r || (radeon_accel == 0)) {
- /* Somethings want wront with the accel init stop accel */
- dev_err(rdev->dev, "Disabling GPU acceleration\n");
- r100_cp_fini(rdev);
- r100_wb_fini(rdev);
- r100_ib_fini(rdev);
- radeon_irq_kms_fini(rdev);
- if (rdev->flags & RADEON_IS_PCI)
- r100_pci_gart_fini(rdev);
- rdev->accel_working = false;
- }
+ if (r || (radeon_accel == 0))
+ r100_disable_accel(rdev);
+
return 0;
}
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c
index 30a9112..49a2855 100644
--- a/drivers/gpu/drm/radeon/r300.c
+++ b/drivers/gpu/drm/radeon/r300.c
@@ -1314,8 +1314,26 @@ static int r300_startup(struct radeon_device *rdev)
return 0;
}
+static void r300_disable_accel(struct radeon_device *rdev)
+{
+ /* Something went wrong with the accel init stop accel */
+ dev_err(rdev->dev, "Disabling GPU acceleration\n");
+ r100_cp_fini(rdev);
+ r100_wb_fini(rdev);
+ r100_ib_fini(rdev);
+ radeon_irq_kms_fini(rdev);
+ if (rdev->flags & RADEON_IS_PCIE)
+ rv370_pcie_gart_fini(rdev);
+ if (rdev->flags & RADEON_IS_PCI)
+ r100_pci_gart_fini(rdev);
+ radeon_agp_fini(rdev);
+ rdev->accel_working = false;
+}
+
int r300_resume(struct radeon_device *rdev)
{
+ int r;
+
/* Make sur GART are not working */
if (rdev->flags & RADEON_IS_PCIE)
rv370_pcie_gart_disable(rdev);
@@ -1335,7 +1353,11 @@ int r300_resume(struct radeon_device *rdev)
r300_clock_startup(rdev);
/* Initialize surface registers */
radeon_surface_init(rdev);
- return r300_startup(rdev);
+
+ r = r300_startup(rdev);
+ if (r || (radeon_accel == 0))
+ r300_disable_accel(rdev);
+ return 0;
}
int r300_suspend(struct radeon_device *rdev)
@@ -1443,19 +1465,8 @@ int r300_init(struct radeon_device *rdev)
r300_set_reg_safe(rdev);
rdev->accel_working = true;
r = r300_startup(rdev);
- if (r || (radeon_accel == 0)) {
- /* Somethings want wront with the accel init stop accel */
- dev_err(rdev->dev, "Disabling GPU acceleration\n");
- r100_cp_fini(rdev);
- r100_wb_fini(rdev);
- r100_ib_fini(rdev);
- radeon_irq_kms_fini(rdev);
- if (rdev->flags & RADEON_IS_PCIE)
- rv370_pcie_gart_fini(rdev);
- if (rdev->flags & RADEON_IS_PCI)
- r100_pci_gart_fini(rdev);
- radeon_agp_fini(rdev);
- rdev->accel_working = false;
- }
+ if (r || (radeon_accel == 0))
+ r300_disable_accel(rdev);
+
return 0;
}
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c
index ebb9017..4ef5b8f 100644
--- a/drivers/gpu/drm/radeon/r420.c
+++ b/drivers/gpu/drm/radeon/r420.c
@@ -231,8 +231,26 @@ static int r420_startup(struct radeon_device *rdev)
return 0;
}
+static void r420_disable_accel(struct radeon_device *rdev)
+{
+ /* Something went wrong with the accel init stop accel */
+ dev_err(rdev->dev, "Disabling GPU acceleration\n");
+ r100_cp_fini(rdev);
+ r100_wb_fini(rdev);
+ r100_ib_fini(rdev);
+ radeon_irq_kms_fini(rdev);
+ if (rdev->flags & RADEON_IS_PCIE)
+ rv370_pcie_gart_fini(rdev);
+ if (rdev->flags & RADEON_IS_PCI)
+ r100_pci_gart_fini(rdev);
+ radeon_agp_fini(rdev);
+ rdev->accel_working = false;
+}
+
int r420_resume(struct radeon_device *rdev)
{
+ int r;
+
/* Make sur GART are not working */
if (rdev->flags & RADEON_IS_PCIE)
rv370_pcie_gart_disable(rdev);
@@ -256,7 +274,12 @@ int r420_resume(struct radeon_device *rdev)
r420_clock_resume(rdev);
/* Initialize surface registers */
radeon_surface_init(rdev);
- return r420_startup(rdev);
+
+ r = r420_startup(rdev);
+ if (r || (radeon_accel == 0))
+ r420_disable_accel(rdev);
+
+ return 0;
}
int r420_suspend(struct radeon_device *rdev)
@@ -376,20 +399,9 @@ int r420_init(struct radeon_device *rdev)
r420_set_reg_safe(rdev);
rdev->accel_working = true;
r = r420_startup(rdev);
- if (r || (radeon_accel == 0)) {
- /* Somethings want wront with the accel init stop accel */
- dev_err(rdev->dev, "Disabling GPU acceleration\n");
- r100_cp_fini(rdev);
- r100_wb_fini(rdev);
- r100_ib_fini(rdev);
- radeon_irq_kms_fini(rdev);
- if (rdev->flags & RADEON_IS_PCIE)
- rv370_pcie_gart_fini(rdev);
- if (rdev->flags & RADEON_IS_PCI)
- r100_pci_gart_fini(rdev);
- radeon_agp_fini(rdev);
- rdev->accel_working = false;
- }
+ if (r || (radeon_accel == 0))
+ r420_disable_accel(rdev);
+
return 0;
}
diff --git a/drivers/gpu/drm/radeon/r520.c b/drivers/gpu/drm/radeon/r520.c
index 38caca5..6b6b0ce 100644
--- a/drivers/gpu/drm/radeon/r520.c
+++ b/drivers/gpu/drm/radeon/r520.c
@@ -200,8 +200,23 @@ static int r520_startup(struct radeon_device *rdev)
return 0;
}
+static void r520_disable_accel(struct radeon_device *rdev)
+{
+ /* Something went wrong with the accel init stop accel */
+ dev_err(rdev->dev, "Disabling GPU acceleration\n");
+ r100_cp_fini(rdev);
+ r100_wb_fini(rdev);
+ r100_ib_fini(rdev);
+ radeon_irq_kms_fini(rdev);
+ rv370_pcie_gart_fini(rdev);
+ radeon_agp_fini(rdev);
+ rdev->accel_working = false;
+}
+
int r520_resume(struct radeon_device *rdev)
{
+ int r;
+
/* Make sur GART are not working */
if (rdev->flags & RADEON_IS_PCIE)
rv370_pcie_gart_disable(rdev);
@@ -219,7 +234,12 @@ int r520_resume(struct radeon_device *rdev)
rv515_clock_startup(rdev);
/* Initialize surface registers */
radeon_surface_init(rdev);
- return r520_startup(rdev);
+
+ r = r520_startup(rdev);
+ if (r || (radeon_accel == 0))
+ r520_disable_accel(rdev);
+
+ return 0;
}
int r520_init(struct radeon_device *rdev)
@@ -290,16 +310,8 @@ int r520_init(struct radeon_device *rdev)
rv515_set_safe_registers(rdev);
rdev->accel_working = true;
r = r520_startup(rdev);
- if (r || (radeon_accel == 0)) {
- /* Somethings want wront with the accel init stop accel */
- dev_err(rdev->dev, "Disabling GPU acceleration\n");
- r100_cp_fini(rdev);
- r100_wb_fini(rdev);
- r100_ib_fini(rdev);
- radeon_irq_kms_fini(rdev);
- rv370_pcie_gart_fini(rdev);
- radeon_agp_fini(rdev);
- rdev->accel_working = false;
- }
+ if (r || (radeon_accel == 0))
+ r520_disable_accel(rdev);
+
return 0;
}
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 7876b58..5482ee7 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -2197,6 +2197,17 @@ void r600_vga_set_state(struct radeon_device *rdev, bool state)
WREG32(CONFIG_CNTL, temp);
}
+static void r600_disable_accel(struct radeon_device *rdev)
+{
+ dev_err(rdev->dev, "disabling GPU acceleration\n");
+ r600_cp_fini(rdev);
+ r600_wb_fini(rdev);
+ r600_irq_fini(rdev);
+ radeon_irq_kms_fini(rdev);
+ r600_pcie_gart_fini(rdev);
+ rdev->accel_working = false;
+}
+
int r600_resume(struct radeon_device *rdev)
{
int r;
@@ -2214,15 +2225,14 @@ int r600_resume(struct radeon_device *rdev)
}
r = r600_startup(rdev);
- if (r) {
- DRM_ERROR("r600 startup failed on resume\n");
- return r;
- }
-
- r = r600_ib_test(rdev);
- if (r) {
- DRM_ERROR("radeon: failled testing IB (%d).\n", r);
- return r;
+ if (r || (radeon_accel == 0))
+ r600_disable_accel(rdev);
+ else {
+ r = r600_ib_test(rdev);
+ if (r) {
+ DRM_ERROR("radeon: failled testing IB (%d).\n", r);
+ return r;
+ }
}
r = r600_audio_init(rdev);
@@ -2342,15 +2352,8 @@ int r600_init(struct radeon_device *rdev)
rdev->accel_working = true;
r = r600_startup(rdev);
- if (r || (radeon_accel == 0)) {
- dev_err(rdev->dev, "disabling GPU acceleration\n");
- r600_cp_fini(rdev);
- r600_wb_fini(rdev);
- r600_irq_fini(rdev);
- radeon_irq_kms_fini(rdev);
- r600_pcie_gart_fini(rdev);
- rdev->accel_working = false;
- }
+ if (r || (radeon_accel == 0))
+ r600_disable_accel(rdev);
if (rdev->accel_working) {
r = radeon_ib_pool_init(rdev);
if (r) {
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c
index e36f193..1b930b4 100644
--- a/drivers/gpu/drm/radeon/rs400.c
+++ b/drivers/gpu/drm/radeon/rs400.c
@@ -422,8 +422,22 @@ static int rs400_startup(struct radeon_device *rdev)
return 0;
}
+static void rs400_disable_accel(struct radeon_device *rdev)
+{
+ /* Something went wrong with the accel init stop accel */
+ dev_err(rdev->dev, "Disabling GPU acceleration\n");
+ r100_cp_fini(rdev);
+ r100_wb_fini(rdev);
+ r100_ib_fini(rdev);
+ rs400_gart_fini(rdev);
+ radeon_irq_kms_fini(rdev);
+ rdev->accel_working = false;
+}
+
int rs400_resume(struct radeon_device *rdev)
{
+ int r;
+
/* Make sur GART are not working */
rs400_gart_disable(rdev);
/* Resume clock before doing reset */
@@ -442,7 +456,12 @@ int rs400_resume(struct radeon_device *rdev)
r300_clock_startup(rdev);
/* Initialize surface registers */
radeon_surface_init(rdev);
- return rs400_startup(rdev);
+
+ r = rs400_startup(rdev);
+ if (r || (radeon_accel == 0))
+ rs400_disable_accel(rdev);
+
+ return 0;
}
int rs400_suspend(struct radeon_device *rdev)
@@ -528,15 +547,8 @@ int rs400_init(struct radeon_device *rdev)
r300_set_reg_safe(rdev);
rdev->accel_working = true;
r = rs400_startup(rdev);
- if (r || (radeon_accel == 0)) {
- /* Somethings want wront with the accel init stop accel */
- dev_err(rdev->dev, "Disabling GPU acceleration\n");
- r100_cp_fini(rdev);
- r100_wb_fini(rdev);
- r100_ib_fini(rdev);
- rs400_gart_fini(rdev);
- radeon_irq_kms_fini(rdev);
- rdev->accel_working = false;
- }
+ if (r || (radeon_accel == 0))
+ rs400_disable_accel(rdev);
+
return 0;
}
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index 0390a54..b9b5128 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -808,8 +808,22 @@ static int rs600_startup(struct radeon_device *rdev)
return 0;
}
+static void rs600_disable_accel(struct radeon_device *rdev)
+{
+ /* Something went wrong with the accel init stop accel */
+ dev_err(rdev->dev, "Disabling GPU acceleration\n");
+ r100_cp_fini(rdev);
+ r100_wb_fini(rdev);
+ r100_ib_fini(rdev);
+ rs600_gart_fini(rdev);
+ radeon_irq_kms_fini(rdev);
+ rdev->accel_working = false;
+}
+
int rs600_resume(struct radeon_device *rdev)
{
+ int r;
+
/* Make sur GART are not working */
rs600_gart_disable(rdev);
/* Resume clock before doing reset */
@@ -826,7 +840,12 @@ int rs600_resume(struct radeon_device *rdev)
rv515_clock_startup(rdev);
/* Initialize surface registers */
radeon_surface_init(rdev);
- return rs600_startup(rdev);
+
+ r = rs600_startup(rdev);
+ if (r || (radeon_accel == 0))
+ rs600_disable_accel(rdev);
+
+ return 0;
}
int rs600_suspend(struct radeon_device *rdev)
@@ -912,15 +931,8 @@ int rs600_init(struct radeon_device *rdev)
rs600_set_safe_registers(rdev);
rdev->accel_working = true;
r = rs600_startup(rdev);
- if (r || (radeon_accel == 0)) {
- /* Somethings want wront with the accel init stop accel */
- dev_err(rdev->dev, "Disabling GPU acceleration\n");
- r100_cp_fini(rdev);
- r100_wb_fini(rdev);
- r100_ib_fini(rdev);
- rs600_gart_fini(rdev);
- radeon_irq_kms_fini(rdev);
- rdev->accel_working = false;
- }
+ if (r || (radeon_accel == 0))
+ rs600_disable_accel(rdev);
+
return 0;
}
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c
index 1a38699..694927d 100644
--- a/drivers/gpu/drm/radeon/rs690.c
+++ b/drivers/gpu/drm/radeon/rs690.c
@@ -644,8 +644,22 @@ static int rs690_startup(struct radeon_device *rdev)
return 0;
}
+static void rs690_disable_accel(struct radeon_device *rdev)
+{
+ /* Something went wrong with the accel init stop accel */
+ dev_err(rdev->dev, "Disabling GPU acceleration\n");
+ r100_cp_fini(rdev);
+ r100_wb_fini(rdev);
+ r100_ib_fini(rdev);
+ rs400_gart_fini(rdev);
+ radeon_irq_kms_fini(rdev);
+ rdev->accel_working = false;
+}
+
int rs690_resume(struct radeon_device *rdev)
{
+ int r;
+
/* Make sur GART are not working */
rs400_gart_disable(rdev);
/* Resume clock before doing reset */
@@ -662,7 +676,12 @@ int rs690_resume(struct radeon_device *rdev)
rv515_clock_startup(rdev);
/* Initialize surface registers */
radeon_surface_init(rdev);
- return rs690_startup(rdev);
+
+ r = rs690_startup(rdev);
+ if (r || (radeon_accel == 0))
+ rs690_disable_accel(rdev);
+
+ return 0;
}
int rs690_suspend(struct radeon_device *rdev)
@@ -749,15 +768,8 @@ int rs690_init(struct radeon_device *rdev)
rs600_set_safe_registers(rdev);
rdev->accel_working = true;
r = rs690_startup(rdev);
- if (r || (radeon_accel == 0)) {
- /* Somethings want wront with the accel init stop accel */
- dev_err(rdev->dev, "Disabling GPU acceleration\n");
- r100_cp_fini(rdev);
- r100_wb_fini(rdev);
- r100_ib_fini(rdev);
- rs400_gart_fini(rdev);
- radeon_irq_kms_fini(rdev);
- rdev->accel_working = false;
- }
+ if (r || (radeon_accel == 0))
+ rs690_disable_accel(rdev);
+
return 0;
}
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c
index 104e285..e337842 100644
--- a/drivers/gpu/drm/radeon/rv515.c
+++ b/drivers/gpu/drm/radeon/rv515.c
@@ -405,8 +405,23 @@ static int rv515_startup(struct radeon_device *rdev)
return 0;
}
+static void rv515_disable_accel(struct radeon_device *rdev)
+{
+ /* Something went wrong with the accel init stop accel */
+ dev_err(rdev->dev, "Disabling GPU acceleration\n");
+ r100_cp_fini(rdev);
+ r100_wb_fini(rdev);
+ r100_ib_fini(rdev);
+ radeon_irq_kms_fini(rdev);
+ rv370_pcie_gart_fini(rdev);
+ radeon_agp_fini(rdev);
+ rdev->accel_working = false;
+}
+
int rv515_resume(struct radeon_device *rdev)
{
+ int r;
+
/* Make sur GART are not working */
if (rdev->flags & RADEON_IS_PCIE)
rv370_pcie_gart_disable(rdev);
@@ -424,7 +439,12 @@ int rv515_resume(struct radeon_device *rdev)
rv515_clock_startup(rdev);
/* Initialize surface registers */
radeon_surface_init(rdev);
- return rv515_startup(rdev);
+
+ r = rv515_startup(rdev);
+ if (r || (radeon_accel == 0))
+ rv515_disable_accel(rdev);
+
+ return 0;
}
int rv515_suspend(struct radeon_device *rdev)
@@ -523,17 +543,9 @@ int rv515_init(struct radeon_device *rdev)
rv515_set_safe_registers(rdev);
rdev->accel_working = true;
r = rv515_startup(rdev);
- if (r || (radeon_accel == 0)) {
- /* Somethings want wront with the accel init stop accel */
- dev_err(rdev->dev, "Disabling GPU acceleration\n");
- r100_cp_fini(rdev);
- r100_wb_fini(rdev);
- r100_ib_fini(rdev);
- radeon_irq_kms_fini(rdev);
- rv370_pcie_gart_fini(rdev);
- radeon_agp_fini(rdev);
- rdev->accel_working = false;
- }
+ if (r || (radeon_accel == 0))
+ rv515_disable_accel(rdev);
+
return 0;
}
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index 7a959fa..7f03d4e 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -983,6 +983,17 @@ static int rv770_startup(struct radeon_device *rdev)
return 0;
}
+static void rv770_disable_accel(struct radeon_device *rdev)
+{
+ dev_err(rdev->dev, "disabling GPU acceleration\n");
+ r700_cp_fini(rdev);
+ r600_wb_fini(rdev);
+ r600_irq_fini(rdev);
+ radeon_irq_kms_fini(rdev);
+ rv770_pcie_gart_fini(rdev);
+ rdev->accel_working = false;
+}
+
int rv770_resume(struct radeon_device *rdev)
{
int r;
@@ -1000,15 +1011,14 @@ int rv770_resume(struct radeon_device *rdev)
}
r = rv770_startup(rdev);
- if (r) {
- DRM_ERROR("r600 startup failed on resume\n");
- return r;
- }
-
- r = r600_ib_test(rdev);
- if (r) {
- DRM_ERROR("radeon: failled testing IB (%d).\n", r);
- return r;
+ if (r || (radeon_accel == 0))
+ rv770_disable_accel(rdev);
+ else {
+ r = r600_ib_test(rdev);
+ if (r) {
+ DRM_ERROR("radeon: failled testing IB (%d).\n", r);
+ return r;
+ }
}
r = r600_audio_init(rdev);
@@ -1127,15 +1137,9 @@ int rv770_init(struct radeon_device *rdev)
rdev->accel_working = true;
r = rv770_startup(rdev);
- if (r || (radeon_accel == 0)) {
- dev_err(rdev->dev, "disabling GPU acceleration\n");
- r700_cp_fini(rdev);
- r600_wb_fini(rdev);
- r600_irq_fini(rdev);
- radeon_irq_kms_fini(rdev);
- rv770_pcie_gart_fini(rdev);
- rdev->accel_working = false;
- }
+ if (r || (radeon_accel == 0))
+ rv770_disable_accel(rdev);
+
if (rdev->accel_working) {
r = radeon_ib_pool_init(rdev);
if (r) {
--
1.5.6.3
More information about the dri-devel
mailing list