aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon_irq_kms.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2009-12-01 01:04:56 -0500
committerDave Airlie <airlied@redhat.com>2009-12-01 23:00:13 -0500
commit1614f8b17b8cc3ad143541d41569623d30dbc9ec (patch)
tree7b0284e942cb68ea47cdc832bbd43864b23dcd2d /drivers/gpu/drm/radeon/radeon_irq_kms.c
parentd8f60cfc93452d0554f6a701aa8e3236cbee4636 (diff)
drm/radeon/kms: add irq mitigation code for sw interrupt.
We really don't need to process every irq that comes in, we only really want to do SW irq processing when we are actually waiting for a fence to pass. I'm not 100% sure this is race free esp on non-MSI systems so it needs some testing. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_irq_kms.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_irq_kms.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c
index 84f8a6fb0da..26789970c5c 100644
--- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
@@ -87,7 +87,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
87 87
88 if (rdev->flags & RADEON_SINGLE_CRTC) 88 if (rdev->flags & RADEON_SINGLE_CRTC)
89 num_crtc = 1; 89 num_crtc = 1;
90 90 spin_lock_init(&rdev->irq.sw_lock);
91 r = drm_vblank_init(rdev->ddev, num_crtc); 91 r = drm_vblank_init(rdev->ddev, num_crtc);
92 if (r) { 92 if (r) {
93 return r; 93 return r;
@@ -122,3 +122,29 @@ void radeon_irq_kms_fini(struct radeon_device *rdev)
122 pci_disable_msi(rdev->pdev); 122 pci_disable_msi(rdev->pdev);
123 } 123 }
124} 124}
125
126void radeon_irq_kms_sw_irq_get(struct radeon_device *rdev)
127{
128 unsigned long irqflags;
129
130 spin_lock_irqsave(&rdev->irq.sw_lock, irqflags);
131 if (rdev->ddev->irq_enabled && (++rdev->irq.sw_refcount == 1)) {
132 rdev->irq.sw_int = true;
133 radeon_irq_set(rdev);
134 }
135 spin_unlock_irqrestore(&rdev->irq.sw_lock, irqflags);
136}
137
138void radeon_irq_kms_sw_irq_put(struct radeon_device *rdev)
139{
140 unsigned long irqflags;
141
142 spin_lock_irqsave(&rdev->irq.sw_lock, irqflags);
143 BUG_ON(rdev->ddev->irq_enabled && rdev->irq.sw_refcount <= 0);
144 if (rdev->ddev->irq_enabled && (--rdev->irq.sw_refcount == 0)) {
145 rdev->irq.sw_int = false;
146 radeon_irq_set(rdev);
147 }
148 spin_unlock_irqrestore(&rdev->irq.sw_lock, irqflags);
149}
150