aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
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
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')
-rw-r--r--drivers/gpu/drm/radeon/r100.c1
-rw-r--r--drivers/gpu/drm/radeon/r300.c1
-rw-r--r--drivers/gpu/drm/radeon/r420.c1
-rw-r--r--drivers/gpu/drm/radeon/r520.c1
-rw-r--r--drivers/gpu/drm/radeon/r600.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon.h5
-rw-r--r--drivers/gpu/drm/radeon/radeon_fence.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_irq_kms.c28
-rw-r--r--drivers/gpu/drm/radeon/rs400.c1
-rw-r--r--drivers/gpu/drm/radeon/rs600.c1
-rw-r--r--drivers/gpu/drm/radeon/rs690.c1
-rw-r--r--drivers/gpu/drm/radeon/rv515.c1
-rw-r--r--drivers/gpu/drm/radeon/rv770.c1
13 files changed, 35 insertions, 12 deletions
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 0862fa4b746d..04d4b4ca0ef3 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -3129,7 +3129,6 @@ static int r100_startup(struct radeon_device *rdev)
3129 return r; 3129 return r;
3130 } 3130 }
3131 /* Enable IRQ */ 3131 /* Enable IRQ */
3132 rdev->irq.sw_int = true;
3133 r100_irq_set(rdev); 3132 r100_irq_set(rdev);
3134 /* 1M ring buffer */ 3133 /* 1M ring buffer */
3135 r = r100_cp_init(rdev, 1024 * 1024); 3134 r = r100_cp_init(rdev, 1024 * 1024);
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c
index 430fc2a984b2..6be3acdc9e7d 100644
--- a/drivers/gpu/drm/radeon/r300.c
+++ b/drivers/gpu/drm/radeon/r300.c
@@ -1205,7 +1205,6 @@ static int r300_startup(struct radeon_device *rdev)
1205 return r; 1205 return r;
1206 } 1206 }
1207 /* Enable IRQ */ 1207 /* Enable IRQ */
1208 rdev->irq.sw_int = true;
1209 r100_irq_set(rdev); 1208 r100_irq_set(rdev);
1210 /* 1M ring buffer */ 1209 /* 1M ring buffer */
1211 r = r100_cp_init(rdev, 1024 * 1024); 1210 r = r100_cp_init(rdev, 1024 * 1024);
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c
index e7c34776a013..885610f8dd85 100644
--- a/drivers/gpu/drm/radeon/r420.c
+++ b/drivers/gpu/drm/radeon/r420.c
@@ -186,7 +186,6 @@ static int r420_startup(struct radeon_device *rdev)
186 } 186 }
187 r420_pipes_init(rdev); 187 r420_pipes_init(rdev);
188 /* Enable IRQ */ 188 /* Enable IRQ */
189 rdev->irq.sw_int = true;
190 r100_irq_set(rdev); 189 r100_irq_set(rdev);
191 /* 1M ring buffer */ 190 /* 1M ring buffer */
192 r = r100_cp_init(rdev, 1024 * 1024); 191 r = r100_cp_init(rdev, 1024 * 1024);
diff --git a/drivers/gpu/drm/radeon/r520.c b/drivers/gpu/drm/radeon/r520.c
index 26c37792c8fe..92fbc982b889 100644
--- a/drivers/gpu/drm/radeon/r520.c
+++ b/drivers/gpu/drm/radeon/r520.c
@@ -185,7 +185,6 @@ static int r520_startup(struct radeon_device *rdev)
185 return r; 185 return r;
186 } 186 }
187 /* Enable IRQ */ 187 /* Enable IRQ */
188 rdev->irq.sw_int = true;
189 rs600_irq_set(rdev); 188 rs600_irq_set(rdev);
190 /* 1M ring buffer */ 189 /* 1M ring buffer */
191 r = r100_cp_init(rdev, 1024 * 1024); 190 r = r100_cp_init(rdev, 1024 * 1024);
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 5067ab7fdced..5966027aa967 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -1571,7 +1571,6 @@ int r600_startup(struct radeon_device *rdev)
1571 } 1571 }
1572 1572
1573 /* Enable IRQ */ 1573 /* Enable IRQ */
1574 rdev->irq.sw_int = true;
1575 r = r600_irq_init(rdev); 1574 r = r600_irq_init(rdev);
1576 if (r) { 1575 if (r) {
1577 DRM_ERROR("radeon: IH init failed (%d).\n", r); 1576 DRM_ERROR("radeon: IH init failed (%d).\n", r);
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 0b8dad604ad8..bdad153953e6 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -352,11 +352,14 @@ struct radeon_irq {
352 bool sw_int; 352 bool sw_int;
353 /* FIXME: use a define max crtc rather than hardcode it */ 353 /* FIXME: use a define max crtc rather than hardcode it */
354 bool crtc_vblank_int[2]; 354 bool crtc_vblank_int[2];
355 spinlock_t sw_lock;
356 int sw_refcount;
355}; 357};
356 358
357int radeon_irq_kms_init(struct radeon_device *rdev); 359int radeon_irq_kms_init(struct radeon_device *rdev);
358void radeon_irq_kms_fini(struct radeon_device *rdev); 360void radeon_irq_kms_fini(struct radeon_device *rdev);
359 361void radeon_irq_kms_sw_irq_get(struct radeon_device *rdev);
362void radeon_irq_kms_sw_irq_put(struct radeon_device *rdev);
360 363
361/* 364/*
362 * CP & ring. 365 * CP & ring.
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c
index ab2a8b16836c..2ac31633d72c 100644
--- a/drivers/gpu/drm/radeon/radeon_fence.c
+++ b/drivers/gpu/drm/radeon/radeon_fence.c
@@ -193,14 +193,18 @@ retry:
193 } 193 }
194 194
195 if (intr) { 195 if (intr) {
196 radeon_irq_kms_sw_irq_get(rdev);
196 r = wait_event_interruptible_timeout(rdev->fence_drv.queue, 197 r = wait_event_interruptible_timeout(rdev->fence_drv.queue,
197 radeon_fence_signaled(fence), timeout); 198 radeon_fence_signaled(fence), timeout);
199 radeon_irq_kms_sw_irq_put(rdev);
198 if (unlikely(r == -ERESTARTSYS)) { 200 if (unlikely(r == -ERESTARTSYS)) {
199 return -EBUSY; 201 return -EBUSY;
200 } 202 }
201 } else { 203 } else {
204 radeon_irq_kms_sw_irq_get(rdev);
202 r = wait_event_timeout(rdev->fence_drv.queue, 205 r = wait_event_timeout(rdev->fence_drv.queue,
203 radeon_fence_signaled(fence), timeout); 206 radeon_fence_signaled(fence), timeout);
207 radeon_irq_kms_sw_irq_put(rdev);
204 } 208 }
205 if (unlikely(!radeon_fence_signaled(fence))) { 209 if (unlikely(!radeon_fence_signaled(fence))) {
206 if (unlikely(r == 0)) { 210 if (unlikely(r == 0)) {
diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c
index 84f8a6fb0da3..26789970c5cf 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
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c
index 2e5b9450a804..50907f84461b 100644
--- a/drivers/gpu/drm/radeon/rs400.c
+++ b/drivers/gpu/drm/radeon/rs400.c
@@ -394,7 +394,6 @@ static int rs400_startup(struct radeon_device *rdev)
394 if (r) 394 if (r)
395 return r; 395 return r;
396 /* Enable IRQ */ 396 /* Enable IRQ */
397 rdev->irq.sw_int = true;
398 r100_irq_set(rdev); 397 r100_irq_set(rdev);
399 /* 1M ring buffer */ 398 /* 1M ring buffer */
400 r = r100_cp_init(rdev, 1024 * 1024); 399 r = r100_cp_init(rdev, 1024 * 1024);
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index d2dac45173c2..9b6303dd7d3a 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -388,7 +388,6 @@ static int rs600_startup(struct radeon_device *rdev)
388 if (r) 388 if (r)
389 return r; 389 return r;
390 /* Enable IRQ */ 390 /* Enable IRQ */
391 rdev->irq.sw_int = true;
392 rs600_irq_set(rdev); 391 rs600_irq_set(rdev);
393 /* 1M ring buffer */ 392 /* 1M ring buffer */
394 r = r100_cp_init(rdev, 1024 * 1024); 393 r = r100_cp_init(rdev, 1024 * 1024);
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c
index 7ffd6db1223f..4607025125c0 100644
--- a/drivers/gpu/drm/radeon/rs690.c
+++ b/drivers/gpu/drm/radeon/rs690.c
@@ -605,7 +605,6 @@ static int rs690_startup(struct radeon_device *rdev)
605 if (r) 605 if (r)
606 return r; 606 return r;
607 /* Enable IRQ */ 607 /* Enable IRQ */
608 rdev->irq.sw_int = true;
609 rs600_irq_set(rdev); 608 rs600_irq_set(rdev);
610 /* 1M ring buffer */ 609 /* 1M ring buffer */
611 r = r100_cp_init(rdev, 1024 * 1024); 610 r = r100_cp_init(rdev, 1024 * 1024);
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c
index 93de4a9807ab..0ecf5d939aa0 100644
--- a/drivers/gpu/drm/radeon/rv515.c
+++ b/drivers/gpu/drm/radeon/rv515.c
@@ -478,7 +478,6 @@ static int rv515_startup(struct radeon_device *rdev)
478 return r; 478 return r;
479 } 479 }
480 /* Enable IRQ */ 480 /* Enable IRQ */
481 rdev->irq.sw_int = true;
482 rs600_irq_set(rdev); 481 rs600_irq_set(rdev);
483 /* 1M ring buffer */ 482 /* 1M ring buffer */
484 r = r100_cp_init(rdev, 1024 * 1024); 483 r = r100_cp_init(rdev, 1024 * 1024);
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index 479684bda7e2..a96be8b3a530 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -888,7 +888,6 @@ static int rv770_startup(struct radeon_device *rdev)
888 } 888 }
889 889
890 /* Enable IRQ */ 890 /* Enable IRQ */
891 rdev->irq.sw_int = true;
892 r = r600_irq_init(rdev); 891 r = r600_irq_init(rdev);
893 if (r) { 892 if (r) {
894 DRM_ERROR("radeon: IH init failed (%d).\n", r); 893 DRM_ERROR("radeon: IH init failed (%d).\n", r);