In playing around yesterday, we found that some drivers will 
unnecessarily enable interrupts for vblank events.  Since these tend to 
happen frequently (60+ Hz), they'll cause your CPU to wake up a lot, 
which will waste power if they're not really in use.

This patch hacks the radeon driver to only enable vblank interrupts when 
the user is waiting for one, rather than at IRQ setup time.  I couldn't 
find any code in the DDX that wanted vblank support, so I suppose the 
real users are in the Mesa driver somewhere, so I haven't tested it 
other than to see that my interrupt frequency really does decrease.

Comments?

Thanks,
Jesse
diff --git a/drivers/char/drm/radeon_irq.c b/drivers/char/drm/radeon_irq.c
index 3ff0baa..71f1919 100644
--- a/drivers/char/drm/radeon_irq.c
+++ b/drivers/char/drm/radeon_irq.c
@@ -147,9 +147,14 @@ int radeon_driver_vblank_wait(drm_device_t * dev, unsigned int *sequence)
 	 * by about a day rather than she wants to wait for years
 	 * using vertical blanks...
 	 */
+	/* Turn on VBL ints */
+	RADEON_WRITE(RADEON_GEN_INT_CNTL,
+		     RADEON_CRTC_VBLANK_MASK | RADEON_SW_INT_ENABLE);
 	DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ,
 		    (((cur_vblank = atomic_read(&dev->vbl_received))
 		      - *sequence) <= (1 << 23)));
+	/* Go back to just SW interrupts */
+	RADEON_WRITE(RADEON_GEN_INT_CNTL, RADEON_SW_INT_ENABLE);
 
 	*sequence = cur_vblank;
 
@@ -227,9 +232,8 @@ void radeon_driver_irq_postinstall(drm_device_t * dev)
 	atomic_set(&dev_priv->swi_emitted, 0);
 	DRM_INIT_WAITQUEUE(&dev_priv->swi_queue);
 
-	/* Turn on SW and VBL ints */
-	RADEON_WRITE(RADEON_GEN_INT_CNTL,
-		     RADEON_CRTC_VBLANK_MASK | RADEON_SW_INT_ENABLE);
+	/* Enable SW interrupts */
+	RADEON_WRITE(RADEON_GEN_INT_CNTL, RADEON_SW_INT_ENABLE);
 }
 
 void radeon_driver_irq_uninstall(drm_device_t * dev)
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to