aboutsummaryrefslogtreecommitdiff
path: root/drivers/video/intelfb/intelfbhw.c
diff options
context:
space:
mode:
authorEric Hustvedt <ehustvedt@cecropia.com>2006-06-20 14:36:42 -0400
committerDave Airlie <airlied@linux.ie>2006-07-03 18:59:46 +1000
commit37bced38b3d09c3de7c871790eddde81a3ce57cb (patch)
tree9472bb814b65c990fe004e715e810eb0ac0fc120 /drivers/video/intelfb/intelfbhw.c
parent7649757bd900bc900adcd95ab08903cdc28342fa (diff)
intelfb: add vsync interrupt support
[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>
Diffstat (limited to 'drivers/video/intelfb/intelfbhw.c')
-rw-r--r--drivers/video/intelfb/intelfbhw.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/video/intelfb/intelfbhw.c b/drivers/video/intelfb/intelfbhw.c
index 1a698a7230e..0f9631c2ad3 100644
--- a/drivers/video/intelfb/intelfbhw.c
+++ b/drivers/video/intelfb/intelfbhw.c
@@ -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;
+}