DRM vblank fixes + radeon associated fixes
Subsystems (3)
Following two patch avoid to activate hw IRQ/MSI when there is no handler. Such case might happen for various reasons (for instance if we disable accel we also disable irq along the way).
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
--
PATCH 1/2 drm: Avoid calling vblank function is vblank wasn't initialized
In some case vblank might not be initialized and we shouldn't try to use associated function. This patch make sure this is the case. It also export drm_vblank_cleanup so driver can cleanup vblank if for any reason IRQ/MSI is not working.
--- drivers/gpu/drm/drm_irq.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/gpu/drm/drm_irq.c +4 -1
@@ -115,6 +115,7 @@ void drm_vblank_cleanup(struct drm_device *dev) dev->num_crtcs =0 ; } +EXPORT_SYMBOL (drm_vblank_cleanup);int drm_vblank_init (struct drm_device *dev,int num_crtcs) {
@@ -163,7 +164,6 @@ int drm_vblank_init(struct drm_device *dev, int num_crtcs) } dev->vblank_disable_allowed =0 ; -return 0 ; err:
@@ -493,6 +493,9 @@ EXPORT_SYMBOL(drm_vblank_off);*/ void drm_vblank_pre_modeset (struct drm_device *dev,int crtc) { +/* vblank is not initialized (IRQ not installed ?) */ +if (!dev->num_crtcs) +return ;/* * To avoid all the problems that might happen if interrupts * were enabled/disabled around or between these calls, we just
Signature · 10 lines
1.6.5.2 ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev --
PATCH 2/2 drm/radeon/kms: Don't try to enable IRQ if we have no handler installed
If for any reason we haven't installed handler we shouldn't try to enable IRQ/MSI on the hw so we don't get unhandled IRQ/MSI which makes the kernel sad.
--- drivers/gpu/drm/radeon/r100.c | 8 +++++++- drivers/gpu/drm/radeon/r600.c | 7 ++++++- drivers/gpu/drm/radeon/radeon_irq_kms.c | 10 ++++++++-- drivers/gpu/drm/radeon/rs600.c | 8 +++++++- 4 files changed, 28 insertions(+), 5 deletions(-)
drivers/gpu/drm/radeon/r100.c +7 -1
@@ -131,7 +131,8 @@ void r100_hpd_init(struct radeon_device *rdev)break ; } } -r100_irq_set (rdev); +if (rdev->irq.installed) +r100_irq_set (rdev); }void r100_hpd_fini (struct radeon_device *rdev)
@@ -243,6 +244,11 @@ int r100_irq_set(struct radeon_device *rdev) {uint32_t tmp =0 ; +if (!rdev->irq.installed) { +WARN (1 ,"Can't enable IRQ/MSI because no handler is installed.\n" ); +WREG32 (R_000040_GEN_INT_CNTL ,0 ); +return -EINVAL ; + }if (rdev->irq.sw_int) { tmp |=RADEON_SW_INT_ENABLE ; }
drivers/gpu/drm/radeon/r600.c +6 -1
@@ -285,7 +285,8 @@ void r600_hpd_init(struct radeon_device *rdev) } } } -r600_irq_set (rdev); +if (rdev->irq.installed) +r600_irq_set (rdev); }void r600_hpd_fini (struct radeon_device *rdev)
@@ -2458,6 +2459,10 @@ int r600_irq_set(struct radeon_device *rdev)u32 mode_int =0 ;u32 hpd1, hpd2, hpd3, hpd4 =0 , hpd5 =0 , hpd6 =0 ; +if (!rdev->irq.installed) { +WARN (1 ,"Can't enable IRQ/MSI because no handler is installed.\n" ); +return -EINVAL ; + }/* don't enable anything if the ih is disabled */ if (!rdev->ih.enabled)return 0 ;
drivers/gpu/drm/radeon/radeon_irq_kms.c +8 -2
@@ -97,6 +97,7 @@ void radeon_driver_irq_uninstall_kms(struct drm_device *dev) rdev->irq.sw_int = false;for (i =0 ; i <2 ; i++) { rdev->irq.crtc_vblank_int[i] = false; + rdev->irq.hpd[i] = false; }radeon_irq_set (rdev); }
@@ -128,17 +129,22 @@ int radeon_irq_kms_init(struct radeon_device *rdev)DRM_INFO ("radeon: using MSI.\n" ); } } -drm_irq_install (rdev->ddev); rdev->irq.installed = true; + r =drm_irq_install (rdev->ddev); +if (r) { + rdev->irq.installed = false; +return r; + }DRM_INFO ("radeon: irq initialized.\n" );return 0 ; }void radeon_irq_kms_fini (struct radeon_device *rdev) { +drm_vblank_cleanup (rdev->ddev);if (rdev->irq.installed) { - rdev->irq.installed = false;drm_irq_uninstall (rdev->ddev); + rdev->irq.installed = false;if (rdev->msi_enabled)pci_disable_msi (rdev->pdev); }
drivers/gpu/drm/radeon/rs600.c +7 -1
@@ -134,7 +134,8 @@ void rs600_hpd_init(struct radeon_device *rdev)break ; } } -rs600_irq_set (rdev); +if (rdev->irq.installed) +rs600_irq_set (rdev); }void rs600_hpd_fini (struct radeon_device *rdev)
@@ -315,6 +316,11 @@ int rs600_irq_set(struct radeon_device *rdev)u32 hpd2 =RREG32 (R_007D18_DC_HOT_PLUG_DETECT2_INT_CONTROL ) & ~S_007D18_DC_HOT_PLUG_DETECT2_INT_EN (1 ); +if (!rdev->irq.installed) { +WARN (1 ,"Can't enable IRQ/MSI because no handler is installed.\n" ); +WREG32 (R_000040_GEN_INT_CNTL ,0 ); +return -EINVAL ; + }if (rdev->irq.sw_int) { tmp |=S_000040_SW_INT_EN (1 ); }
Signature · 10 lines
1.6.5.2 ------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev --