[RFC] fbcon and VBL IRQs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




I haven't submitted this with sign-off because I'm not actually sure that 
a VBL interrupt is desirable. It adds overhead and I don't think I've seen 
any problems from the cursor timer on macs (are there any?). Perhaps we 
should just rip out the mac VBL code instead of fixing it?

Parts of this patch relate to atari, too--


Don't use both the timer and the VBL interrupt at once: add a flag to 
disable the timer.

Add missing volatile to VBL detection.

Eliminate the "Freeing probably wrong IRQ 9" error on bootup on Macs that 
is caused by passing the wrong dev_id.

Remove the pointless irqres variable.

Remove obvious comments and other cleanups.


Index: linux-2.6.27-rc8/drivers/video/console/fbcon.c
===================================================================
--- linux-2.6.27-rc8.orig/drivers/video/console/fbcon.c
+++ linux-2.6.27-rc8/drivers/video/console/fbcon.c
@@ -161,7 +161,6 @@
 /* # VBL ints between cursor state changes */
 #define ATARI_CURSOR_BLINK_RATE		(42)
 #define MAC_CURSOR_BLINK_RATE		(32)
-#define DEFAULT_CURSOR_BLINK_RATE	(20)
 
 static int vbl_cursor_cnt;
 static int fbcon_cursor_noblink;
@@ -214,7 +213,7 @@
 /*
  * On the Macintoy, there may or may not be a working VBL int. We need to probe
  */
-static int vbl_detected;
+static volatile int vbl_detected;
 
 static irqreturn_t fb_vbl_detect(int irq, void *dummy)
 {
@@ -449,7 +448,8 @@
 	struct fbcon_ops *ops = info->fbcon_par;
 
 	if ((!info->queue.func || info->queue.func == fb_flashcursor) &&
-	    !(ops->flags & FBCON_FLAGS_CURSOR_TIMER) &&
+	    !(ops->flags & (FBCON_FLAGS_CURSOR_TIMER |
+	                    FBCON_FLAGS_CURSOR_INTR)) &&
 	    !fbcon_cursor_noblink) {
 		if (!info->queue.func)
 			INIT_WORK(&info->queue, fb_flashcursor);
@@ -949,9 +949,7 @@
 	struct fb_info *info = NULL;
 	struct fbcon_ops *ops;
 	int rows, cols;
-	int irqres;
 
-	irqres = 1;
 	/*
 	 *  If num_registered_fb is zero, this is a call for the dummy part.
 	 *  The frame buffer devices weren't initialized yet.
@@ -1040,56 +1038,34 @@
 #ifdef CONFIG_ATARI
 	if (MACH_IS_ATARI) {
 		cursor_blink_rate = ATARI_CURSOR_BLINK_RATE;
-		irqres =
-		    request_irq(IRQ_AUTO_4, fb_vbl_handler,
-				IRQ_TYPE_PRIO, "framebuffer vbl",
-				info);
+		if (!request_irq(IRQ_AUTO_4, fb_vbl_handler, IRQ_TYPE_PRIO,
+		                 "framebuffer vbl", info))
+			info->flags |= FBCON_FLAGS_CURSOR_INTR;
 	}
-#endif				/* CONFIG_ATARI */
+#endif /* CONFIG_ATARI */
 
 #ifdef CONFIG_MAC
-	/*
-	 * On a Macintoy, the VBL interrupt may or may not be active. 
-	 * As interrupt based cursor is more reliable and race free, we 
-	 * probe for VBL interrupts.
-	 */
 	if (MACH_IS_MAC) {
 		int ct = 0;
-		/*
-		 * Probe for VBL: set temp. handler ...
-		 */
-		irqres = request_irq(IRQ_MAC_VBL, fb_vbl_detect, 0,
-				     "framebuffer vbl", info);
-		vbl_detected = 0;
 
-		/*
-		 * ... and spin for 20 ms ...
-		 */
-		while (!vbl_detected && ++ct < 1000)
-			udelay(20);
-
-		if (ct == 1000)
-			printk
-			    ("fbcon_startup: No VBL detected, using timer based cursor.\n");
+		vbl_detected = 0;
 
-		free_irq(IRQ_MAC_VBL, fb_vbl_detect);
+		if (!request_irq(IRQ_MAC_VBL, fb_vbl_detect, 0,
+		                 "framebuffer vbl", info)) {
+			while (!vbl_detected && ++ct < 1000)
+				udelay(20);
+			free_irq(IRQ_MAC_VBL, info);
+		}
 
 		if (vbl_detected) {
-			/*
-			 * interrupt based cursor ok
-			 */
+			printk(KERN_INFO "fbcon: VBL IRQ detected\n");
 			cursor_blink_rate = MAC_CURSOR_BLINK_RATE;
-			irqres =
-			    request_irq(IRQ_MAC_VBL, fb_vbl_handler, 0,
-					"framebuffer vbl", info);
-		} else {
-			/*
-			 * VBL not detected: fall through, use timer based cursor
-			 */
-			irqres = 1;
+			if (!request_irq(IRQ_MAC_VBL, fb_vbl_handler, 0,
+			                 "framebuffer vbl", info))
+				info->flags |= FBCON_FLAGS_CURSOR_INTR;
 		}
 	}
-#endif				/* CONFIG_MAC */
+#endif /* CONFIG_MAC */
 
 	fbcon_add_cursor_timer(info);
 	fbcon_has_exited = 0;
Index: linux-2.6.27-rc8/drivers/video/console/fbcon.h
===================================================================
--- linux-2.6.27-rc8.orig/drivers/video/console/fbcon.h
+++ linux-2.6.27-rc8/drivers/video/console/fbcon.h
@@ -19,6 +19,7 @@
 
 #define FBCON_FLAGS_INIT         1
 #define FBCON_FLAGS_CURSOR_TIMER 2
+#define FBCON_FLAGS_CURSOR_INTR  4
 
    /*
     *    This is the interface between the low-level console driver and the
--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux