diff options
author | Ben Widawsky <ben@bwidawsk.net> | 2012-03-29 22:11:26 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-04-09 12:04:05 -0400 |
commit | e2a1e2f0242c363ed80458282d67039c373fbb1f (patch) | |
tree | 7219f4986094a8f86bcb09fe39af1e73199916f8 /drivers/gpu/drm/i915/intel_ringbuffer.c | |
parent | 96d6e3506739c1ca2ebe578eb157dfd504bfad3a (diff) |
drm/i915: ring irq cleanups
- gen6 put/get only need one argument
rflags and gflags are always the same (see above explanation)
- remove a couple redundantly defined IRQs
- reordered some lines to make things go in descending order
Every ring has its own interrupts, enables, masks, and status bits that
are fed into the main interrupt enable/mask/status registers. At one
point in time it seemed like a good idea to make our functions support
the notion that each interrupt may have a different bit position in the
corresponding register (blitter parser error may be bit n in IMR, but
bit m in blitter IMR). It turned out though that the HW designers did us
a solid on Gen6+ and this unfortunate situation has been avoided. This
allows our interrupt code to be cleaned up a bit.
I jammed this into one commit because there should be no functional
change with this commit, and staging it into multiple commits was
unnecessarily artificial IMO.
CC: Chris Wilson <chris@chris-wilson.co.uk>
CC: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Ben Widawsky <benjamin.widawsky@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
[danvet:
- fixed up merged conflict with vlv changes.
- added GEN6 to GT blitter bit, we only use it on gen6+.
- added a comment to both ring irq bits and GT irq bits that on gen6+
these alias.
- added comment that GT_BSD_USER_INTERRUPT is ilk-only.
- I've got confused a bit that we still use GT_USER_INTERRUPT on ivb
for the render ring - but this goes back to ilk where we have only
gt interrupt bits and so we be equally confusing if changed.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_ringbuffer.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_ringbuffer.c | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index 75081f146390..c7eea7fad16f 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c | |||
@@ -788,7 +788,7 @@ ring_add_request(struct intel_ring_buffer *ring, | |||
788 | } | 788 | } |
789 | 789 | ||
790 | static bool | 790 | static bool |
791 | gen6_ring_get_irq(struct intel_ring_buffer *ring, u32 gflag, u32 rflag) | 791 | gen6_ring_get_irq(struct intel_ring_buffer *ring, u32 mask) |
792 | { | 792 | { |
793 | struct drm_device *dev = ring->dev; | 793 | struct drm_device *dev = ring->dev; |
794 | drm_i915_private_t *dev_priv = dev->dev_private; | 794 | drm_i915_private_t *dev_priv = dev->dev_private; |
@@ -803,9 +803,9 @@ gen6_ring_get_irq(struct intel_ring_buffer *ring, u32 gflag, u32 rflag) | |||
803 | 803 | ||
804 | spin_lock(&ring->irq_lock); | 804 | spin_lock(&ring->irq_lock); |
805 | if (ring->irq_refcount++ == 0) { | 805 | if (ring->irq_refcount++ == 0) { |
806 | ring->irq_mask &= ~rflag; | 806 | ring->irq_mask &= ~mask; |
807 | I915_WRITE_IMR(ring, ring->irq_mask); | 807 | I915_WRITE_IMR(ring, ring->irq_mask); |
808 | ironlake_enable_irq(dev_priv, gflag); | 808 | ironlake_enable_irq(dev_priv, mask); |
809 | } | 809 | } |
810 | spin_unlock(&ring->irq_lock); | 810 | spin_unlock(&ring->irq_lock); |
811 | 811 | ||
@@ -813,16 +813,16 @@ gen6_ring_get_irq(struct intel_ring_buffer *ring, u32 gflag, u32 rflag) | |||
813 | } | 813 | } |
814 | 814 | ||
815 | static void | 815 | static void |
816 | gen6_ring_put_irq(struct intel_ring_buffer *ring, u32 gflag, u32 rflag) | 816 | gen6_ring_put_irq(struct intel_ring_buffer *ring, u32 mask) |
817 | { | 817 | { |
818 | struct drm_device *dev = ring->dev; | 818 | struct drm_device *dev = ring->dev; |
819 | drm_i915_private_t *dev_priv = dev->dev_private; | 819 | drm_i915_private_t *dev_priv = dev->dev_private; |
820 | 820 | ||
821 | spin_lock(&ring->irq_lock); | 821 | spin_lock(&ring->irq_lock); |
822 | if (--ring->irq_refcount == 0) { | 822 | if (--ring->irq_refcount == 0) { |
823 | ring->irq_mask |= rflag; | 823 | ring->irq_mask |= mask; |
824 | I915_WRITE_IMR(ring, ring->irq_mask); | 824 | I915_WRITE_IMR(ring, ring->irq_mask); |
825 | ironlake_disable_irq(dev_priv, gflag); | 825 | ironlake_disable_irq(dev_priv, mask); |
826 | } | 826 | } |
827 | spin_unlock(&ring->irq_lock); | 827 | spin_unlock(&ring->irq_lock); |
828 | 828 | ||
@@ -1376,33 +1376,25 @@ gen6_ring_dispatch_execbuffer(struct intel_ring_buffer *ring, | |||
1376 | static bool | 1376 | static bool |
1377 | gen6_render_ring_get_irq(struct intel_ring_buffer *ring) | 1377 | gen6_render_ring_get_irq(struct intel_ring_buffer *ring) |
1378 | { | 1378 | { |
1379 | return gen6_ring_get_irq(ring, | 1379 | return gen6_ring_get_irq(ring, GT_USER_INTERRUPT); |
1380 | GT_USER_INTERRUPT, | ||
1381 | GEN6_RENDER_USER_INTERRUPT); | ||
1382 | } | 1380 | } |
1383 | 1381 | ||
1384 | static void | 1382 | static void |
1385 | gen6_render_ring_put_irq(struct intel_ring_buffer *ring) | 1383 | gen6_render_ring_put_irq(struct intel_ring_buffer *ring) |
1386 | { | 1384 | { |
1387 | return gen6_ring_put_irq(ring, | 1385 | return gen6_ring_put_irq(ring, GT_USER_INTERRUPT); |
1388 | GT_USER_INTERRUPT, | ||
1389 | GEN6_RENDER_USER_INTERRUPT); | ||
1390 | } | 1386 | } |
1391 | 1387 | ||
1392 | static bool | 1388 | static bool |
1393 | gen6_bsd_ring_get_irq(struct intel_ring_buffer *ring) | 1389 | gen6_bsd_ring_get_irq(struct intel_ring_buffer *ring) |
1394 | { | 1390 | { |
1395 | return gen6_ring_get_irq(ring, | 1391 | return gen6_ring_get_irq(ring, GEN6_BSD_USER_INTERRUPT); |
1396 | GT_GEN6_BSD_USER_INTERRUPT, | ||
1397 | GEN6_BSD_USER_INTERRUPT); | ||
1398 | } | 1392 | } |
1399 | 1393 | ||
1400 | static void | 1394 | static void |
1401 | gen6_bsd_ring_put_irq(struct intel_ring_buffer *ring) | 1395 | gen6_bsd_ring_put_irq(struct intel_ring_buffer *ring) |
1402 | { | 1396 | { |
1403 | return gen6_ring_put_irq(ring, | 1397 | return gen6_ring_put_irq(ring, GEN6_BSD_USER_INTERRUPT); |
1404 | GT_GEN6_BSD_USER_INTERRUPT, | ||
1405 | GEN6_BSD_USER_INTERRUPT); | ||
1406 | } | 1398 | } |
1407 | 1399 | ||
1408 | /* ring buffer for Video Codec for Gen6+ */ | 1400 | /* ring buffer for Video Codec for Gen6+ */ |
@@ -1431,17 +1423,13 @@ static const struct intel_ring_buffer gen6_bsd_ring = { | |||
1431 | static bool | 1423 | static bool |
1432 | blt_ring_get_irq(struct intel_ring_buffer *ring) | 1424 | blt_ring_get_irq(struct intel_ring_buffer *ring) |
1433 | { | 1425 | { |
1434 | return gen6_ring_get_irq(ring, | 1426 | return gen6_ring_get_irq(ring, GEN6_BLITTER_USER_INTERRUPT); |
1435 | GT_BLT_USER_INTERRUPT, | ||
1436 | GEN6_BLITTER_USER_INTERRUPT); | ||
1437 | } | 1427 | } |
1438 | 1428 | ||
1439 | static void | 1429 | static void |
1440 | blt_ring_put_irq(struct intel_ring_buffer *ring) | 1430 | blt_ring_put_irq(struct intel_ring_buffer *ring) |
1441 | { | 1431 | { |
1442 | gen6_ring_put_irq(ring, | 1432 | gen6_ring_put_irq(ring, GEN6_BLITTER_USER_INTERRUPT); |
1443 | GT_BLT_USER_INTERRUPT, | ||
1444 | GEN6_BLITTER_USER_INTERRUPT); | ||
1445 | } | 1433 | } |
1446 | 1434 | ||
1447 | static int blt_ring_flush(struct intel_ring_buffer *ring, | 1435 | static int blt_ring_flush(struct intel_ring_buffer *ring, |