]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
intelfb: add vsync interrupt support
authorEric Hustvedt <ehustvedt@cecropia.com>
Tue, 20 Jun 2006 18:36:42 +0000 (14:36 -0400)
committerDave Airlie <airlied@linux.ie>
Mon, 3 Jul 2006 08:59:46 +0000 (18:59 +1000)
[04/05] intelfb: implement FBIO_WAITFORVSYNC ioctl

The (unofficial) FBIO_WAITFORVSYNC ioctl is implemented by sleeping on the appropriate waitqueue, as defined in my earlier patch. Currently, only display 0 (aka pipe A) is supported.

Signed-off-by: Eric Hustvedt <ehustvedt@cecropia.com>
drivers/video/intelfb/intelfb.h
drivers/video/intelfb/intelfbdrv.c
drivers/video/intelfb/intelfbhw.c
drivers/video/intelfb/intelfbhw.h

index dab1f2d764d29eb9b8f4f64da8e9f7b3631e4dd3..65ac37071a0295432be2ae7ad5b91d0aeac90412 100644 (file)
@@ -304,6 +304,10 @@ struct intelfb_info {
 
 #define IS_I9XX(dinfo) (((dinfo)->chipset == INTEL_915G)||(dinfo->chipset == INTEL_915GM)||((dinfo)->chipset == INTEL_945G)||(dinfo->chipset==INTEL_945GM))
 
+#ifndef FBIO_WAITFORVSYNC
+#define FBIO_WAITFORVSYNC      _IOW('F', 0x20, __u32)
+#endif
+
 /*** function prototypes ***/
 
 extern int intelfb_var_to_depth(const struct fb_var_screeninfo *var);
index 068c56d4e6528ca556001d2aba95e3c89186d0c3..08f8241bb92a21c534014d8818698b08c0041007 100644 (file)
@@ -1473,6 +1473,19 @@ static int
 intelfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
 {
        int retval = 0;
+       struct intelfb_info *dinfo = GET_DINFO(info);
+       u32 pipe = 0;
+
+       switch (cmd) {
+               case FBIO_WAITFORVSYNC:
+                       if (get_user(pipe, (__u32 __user *)arg))
+                               return -EFAULT;
+
+                       retval = intelfbhw_wait_for_vsync(dinfo, pipe);
+                       break;
+               default:
+                       break;
+       }
 
        return retval;
 }
index 1a698a7230e0bd0ab434a370db38a7894592d07e..0f9631c2ad33c0d90fe491ba37821abf2fad8423 100644 (file)
@@ -2019,3 +2019,36 @@ intelfbhw_disable_irq(struct intelfb_info *dinfo) {
                free_irq(dinfo->pdev->irq, dinfo);
        }
 }
+
+int
+intelfbhw_wait_for_vsync(struct intelfb_info *dinfo, u32 pipe) {
+       struct intelfb_vsync *vsync;
+       unsigned int count;
+       int ret;
+
+       switch (pipe) {
+               case 0:
+                       vsync = &dinfo->vsync;
+                       break;
+               default:
+                       return -ENODEV;
+       }
+
+       ret = intelfbhw_enable_irq(dinfo, 0);
+       if (ret) {
+               return ret;
+       }
+
+       count = vsync->count;
+       ret = wait_event_interruptible_timeout(vsync->wait, count != vsync->count, HZ/10);
+       if (ret < 0) {
+               return ret;
+       }
+       if (ret == 0) {
+               intelfbhw_enable_irq(dinfo, 1);
+               DBG_MSG("wait_for_vsync timed out!\n");
+               return -ETIMEDOUT;
+       }
+
+       return 0;
+}
index aa0c139a2301fbbd285c343017c435944b38e90a..36980c785e13ebbd4c560da7491ad7d050e08c80 100644 (file)
@@ -563,5 +563,6 @@ extern void intelfbhw_cursor_load(struct intelfb_info *dinfo, int width,
 extern void intelfbhw_cursor_reset(struct intelfb_info *dinfo);
 extern int intelfbhw_enable_irq(struct intelfb_info *dinfo, int reenable);
 extern void intelfbhw_disable_irq(struct intelfb_info *dinfo);
+extern int intelfbhw_wait_for_vsync(struct intelfb_info *dinfo, u32 pipe);
 
 #endif /* _INTELFBHW_H */