Skip to contentSkip to conversation

drm/i915:merge ring_put/get_irq into bsd_ring_put/get_irq

PATCH In review Feng, Boqun 2 participants 6 messages Apr 27, 2011 – Apr 28, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/i915:merge ring_put/get_irq into bsd_ring_put/get_irq

Remove ring_put_irq/ring_get_irq:drivers/gpu/drm/i915/intel_ringbuffer.c , they are only used by bsd_ring_put_irq/bsd_ring_get_irq. Expand the code in bsd_ring_put_irq/bsd_ring_get_irq.

---
 drivers/gpu/drm/i915/intel_ringbuffer.c |   48 +++++++++++-------------------
 1 files changed, 18 insertions(+), 30 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +18 -30
index e9e6f71..06c921f 100644
@@ -600,7 +600,7 @@ ring_add_request(struct intel_ring_buffer *ring,
 }
 
 static bool
-ring_get_irq(struct intel_ring_buffer *ring, u32 flag)
+gen6_ring_get_irq(struct intel_ring_buffer *ring, u32 gflag, u32 rflag)
 {
 	struct drm_device *dev = ring->dev;
 	drm_i915_private_t *dev_priv = dev->dev_private;
@@ -609,27 +609,33 @@ ring_get_irq(struct intel_ring_buffer *ring, u32 flag)
 	       return false;
 
 	spin_lock(&ring->irq_lock);
-	if (ring->irq_refcount++ == 0)
-		ironlake_enable_irq(dev_priv, flag);
+	if (ring->irq_refcount++ == 0) {
+		ring->irq_mask &= ~rflag;
+		I915_WRITE_IMR(ring, ring->irq_mask);
+		ironlake_enable_irq(dev_priv, gflag);
+	}
 	spin_unlock(&ring->irq_lock);
 
 	return true;
 }
 
 static void
-ring_put_irq(struct intel_ring_buffer *ring, u32 flag)
+gen6_ring_put_irq(struct intel_ring_buffer *ring, u32 gflag, u32 rflag)
 {
 	struct drm_device *dev = ring->dev;
 	drm_i915_private_t *dev_priv = dev->dev_private;
 
 	spin_lock(&ring->irq_lock);
-	if (--ring->irq_refcount == 0)
-		ironlake_disable_irq(dev_priv, flag);
+	if (--ring->irq_refcount == 0) {
+		ring->irq_mask |= rflag;
+		I915_WRITE_IMR(ring, ring->irq_mask);
+		ironlake_disable_irq(dev_priv, gflag);
+	}
 	spin_unlock(&ring->irq_lock);
 }
 
 static bool
-gen6_ring_get_irq(struct intel_ring_buffer *ring, u32 gflag, u32 rflag)
+bsd_ring_get_irq(struct intel_ring_buffer *ring)
 {
 	struct drm_device *dev = ring->dev;
 	drm_i915_private_t *dev_priv = dev->dev_private;
@@ -638,42 +644,24 @@ gen6_ring_get_irq(struct intel_ring_buffer *ring, u32 gflag, u32 rflag)
 	       return false;
 
 	spin_lock(&ring->irq_lock);
-	if (ring->irq_refcount++ == 0) {
-		ring->irq_mask &= ~rflag;
-		I915_WRITE_IMR(ring, ring->irq_mask);
-		ironlake_enable_irq(dev_priv, gflag);
-	}
+	if (ring->irq_refcount++ == 0)
+		ironlake_enable_irq(dev_priv, GT_BSD_USER_INTERRUPT);
 	spin_unlock(&ring->irq_lock);
 
 	return true;
 }
-
 static void
-gen6_ring_put_irq(struct intel_ring_buffer *ring, u32 gflag, u32 rflag)
+bsd_ring_put_irq(struct intel_ring_buffer *ring)
 {
 	struct drm_device *dev = ring->dev;
 	drm_i915_private_t *dev_priv = dev->dev_private;
 
 	spin_lock(&ring->irq_lock);
-	if (--ring->irq_refcount == 0) {
-		ring->irq_mask |= rflag;
-		I915_WRITE_IMR(ring, ring->irq_mask);
-		ironlake_disable_irq(dev_priv, gflag);
-	}
+	if (--ring->irq_refcount == 0)
+		ironlake_disable_irq(dev_priv, GT_BSD_USER_INTERRUPT);
 	spin_unlock(&ring->irq_lock);
 }
 
-static bool
-bsd_ring_get_irq(struct intel_ring_buffer *ring)
-{
-	return ring_get_irq(ring, GT_BSD_USER_INTERRUPT);
-}
-static void
-bsd_ring_put_irq(struct intel_ring_buffer *ring)
-{
-	ring_put_irq(ring, GT_BSD_USER_INTERRUPT);
-}
-
 static int
 ring_dispatch_execbuffer(struct intel_ring_buffer *ring, u32 offset, u32 length)
 {
Signature · 1 line
1.7.4.4
#1 lore raw

PATCH 2/2 drm/i915:fix irq miss in bsd ring for g4x

On g4x, user interrupt in bsd ring is missed.
g4x and ironlake share the same bsd_ring, but their interrupt control interfaces are different. G4x use I915 while ironlake use GT. The interrupt mask reg address on g4x should be IMR, user interrupt bit in bsd ring on g4x is I915_BSD_USER_INTERRUPT

Add conditional judgment about platform to find out which interrupt interface is to use.

---
 drivers/gpu/drm/i915/intel_ringbuffer.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +12 -4
index 06c921f..48c21aa 100644
@@ -644,8 +644,12 @@ bsd_ring_get_irq(struct intel_ring_buffer *ring)
 	       return false;
 
 	spin_lock(&ring->irq_lock);
-	if (ring->irq_refcount++ == 0)
-		ironlake_enable_irq(dev_priv, GT_BSD_USER_INTERRUPT);
+	if (ring->irq_refcount++ == 0) {
+		if (IS_G4X(dev))
+			i915_enable_irq(dev_priv, I915_BSD_USER_INTERRUPT);
+		else
+			ironlake_enable_irq(dev_priv, GT_BSD_USER_INTERRUPT);
+	}
 	spin_unlock(&ring->irq_lock);
 
 	return true;
@@ -657,8 +661,12 @@ bsd_ring_put_irq(struct intel_ring_buffer *ring)
 	drm_i915_private_t *dev_priv = dev->dev_private;
 
 	spin_lock(&ring->irq_lock);
-	if (--ring->irq_refcount == 0)
-		ironlake_disable_irq(dev_priv, GT_BSD_USER_INTERRUPT);
+	if (--ring->irq_refcount == 0) {
+		if (IS_G4X(dev))
+			i915_disable_irq(dev_priv, I915_BSD_USER_INTERRUPT);
+		else
+			ironlake_disable_irq(dev_priv, GT_BSD_USER_INTERRUPT);
+	}
 	spin_unlock(&ring->irq_lock);
 }
 
Signature · 1 line
1.7.4.4
#3 lore raw

I have discussed this with Chris in my earlier patch.

This change is a clean-up, since ring_put_irq and ring_get_irq are only used by bsd_ring_put_irq and bsd_ring_get_irq.

And once this change is made, it is more clear to see the difference between g4x and ironlake BSD interrupt control interface, because they are handled in a single function and they are different at the interrupt mask reg addresss as well as the interrupt flag
.
Thanks
Feng, Boqun

-----Original Message-----
From: Keith Packard [mailto:[email protected]]
Sent: Thursday, April 28, 2011 12:43 AM
To: Feng, Boqun; [email protected]
Subject: Re: [Intel-gfx] [PATCH 1/2] drm/i915:merge ring_put/get_irq into bsd_ring_put/get_irq

Quoted 3 lines · Boqun

Remove ring_put_irq/ring_get_irq:drivers/gpu/drm/i915/intel_ringbuffer.c , they are only used by bsd_ring_put_irq/bsd_ring_get_irq. Expand the code in bsd_ring_put_irq/bsd_ring_get_irq.

Why is this change useful?

Signature · 1 line
[email protected]
#4 lore raw
Quoted 9 lines · Boqun

I have discussed this with Chris in my earlier patch.

This change is a clean-up, since ring_put_irq and ring_get_irq are only used by bsd_ring_put_irq and bsd_ring_get_irq.

And once this change is made, it is more clear to see the difference between g4x and ironlake BSD interrupt control interface, because they are handled in a single function and they are different at the interrupt mask reg addresss as well as the interrupt flag

please put important details like that in the commit message; having some way to evaluate the utility of the patch is very important for something which doesn't actually change how the code works.

Signature · 1 line
[email protected]

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

I got it!
Thanks for reminding me. :)

-----Original Message-----
From: Keith Packard [mailto:[email protected]]
Sent: Thursday, April 28, 2011 10:41 AM
To: Feng, Boqun; [email protected]
Subject: RE: [Intel-gfx] [PATCH 1/2] drm/i915:merge ring_put/get_irq into bsd_ring_put/get_irq

Quoted 9 lines · Boqun

I have discussed this with Chris in my earlier patch.

This change is a clean-up, since ring_put_irq and ring_get_irq are only used by bsd_ring_put_irq and bsd_ring_get_irq.

And once this change is made, it is more clear to see the difference between g4x and ironlake BSD interrupt control interface, because they are handled in a single function and they are different at the interrupt mask reg addresss as well as the interrupt flag

please put important details like that in the commit message; having some way to evaluate the utility of the patch is very important for something which doesn't actually change how the code works.

--
[email protected]