aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/intelfb
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 04:59:46 -0400
commit37bced38b3d09c3de7c871790eddde81a3ce57cb (patch)
tree9472bb814b65c990fe004e715e810eb0ac0fc120 /drivers/video/intelfb
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')
-rw-r--r--drivers/video/intelfb/intelfb.h4
-rw-r--r--drivers/video/intelfb/intelfbdrv.c13
-rw-r--r--drivers/video/intelfb/intelfbhw.c33
-rw-r--r--drivers/video/intelfb/intelfbhw.h1
4 files changed, 51 insertions, 0 deletions
diff --git a/drivers/video/intelfb/intelfb.h b/drivers/video/intelfb/intelfb.h
index dab1f2d764d2..65ac37071a02 100644
--- a/drivers/video/intelfb/intelfb.h
+++ b/drivers/video/intelfb/intelfb.h
@@ -304,6 +304,10 @@ struct intelfb_info {
304 304
305#define IS_I9XX(dinfo) (((dinfo)->chipset == INTEL_915G)||(dinfo->chipset == INTEL_915GM)||((dinfo)->chipset == INTEL_945G)||(dinfo->chipset==INTEL_945GM)) 305#define IS_I9XX(dinfo) (((dinfo)->chipset == INTEL_915G)||(dinfo->chipset == INTEL_915GM)||((dinfo)->chipset == INTEL_945G)||(dinfo->chipset==INTEL_945GM))
306 306
307#ifndef FBIO_WAITFORVSYNC
308#define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
309#endif
310
307/*** function prototypes ***/ 311/*** function prototypes ***/
308 312
309extern int intelfb_var_to_depth(const struct fb_var_screeninfo *var); 313extern int intelfb_var_to_depth(const struct fb_var_screeninfo *var);
diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c
index 068c56d4e652..08f8241bb92a 100644
--- a/drivers/video/intelfb/intelfbdrv.c
+++ b/drivers/video/intelfb/intelfbdrv.c
@@ -1473,6 +1473,19 @@ static int
1473intelfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) 1473intelfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
1474{ 1474{
1475 int retval = 0; 1475 int retval = 0;
1476 struct intelfb_info *dinfo = GET_DINFO(info);
1477 u32 pipe = 0;
1478
1479 switch (cmd) {
1480 case FBIO_WAITFORVSYNC:
1481 if (get_user(pipe, (__u32 __user *)arg))
1482 return -EFAULT;
1483
1484 retval = intelfbhw_wait_for_vsync(dinfo, pipe);
1485 break;
1486 default:
1487 break;
1488 }
1476 1489
1477 return retval; 1490 return retval;
1478} 1491}
diff --git a/drivers/video/intelfb/intelfbhw.c b/drivers/video/intelfb/intelfbhw.c
index 1a698a7230e0..0f9631c2ad33 100644
--- a/drivers/video/intelfb/intelfbhw.c
+++ b/drivers/video/intelfb/intelfbhw.c
@@ -2019,3 +2019,36 @@ intelfbhw_disable_irq(struct intelfb_info *dinfo) {
2019 free_irq(dinfo->pdev->irq, dinfo); 2019 free_irq(dinfo->pdev->irq, dinfo);
2020 } 2020 }
2021} 2021}
2022
2023int
2024intelfbhw_wait_for_vsync(struct intelfb_info *dinfo, u32 pipe) {
2025 struct intelfb_vsync *vsync;
2026 unsigned int count;
2027 int ret;
2028
2029 switch (pipe) {
2030 case 0:
2031 vsync = &dinfo->vsync;
2032 break;
2033 default:
2034 return -ENODEV;
2035 }
2036
2037 ret = intelfbhw_enable_irq(dinfo, 0);
2038 if (ret) {
2039 return ret;
2040 }
2041
2042 count = vsync->count;
2043 ret = wait_event_interruptible_timeout(vsync->wait, count != vsync->count, HZ/10);
2044 if (ret < 0) {
2045 return ret;
2046 }
2047 if (ret == 0) {
2048 intelfbhw_enable_irq(dinfo, 1);
2049 DBG_MSG("wait_for_vsync timed out!\n");
2050 return -ETIMEDOUT;
2051 }
2052
2053 return 0;
2054}
diff --git a/drivers/video/intelfb/intelfbhw.h b/drivers/video/intelfb/intelfbhw.h
index aa0c139a2301..36980c785e13 100644
--- a/drivers/video/intelfb/intelfbhw.h
+++ b/drivers/video/intelfb/intelfbhw.h
@@ -563,5 +563,6 @@ extern void intelfbhw_cursor_load(struct intelfb_info *dinfo, int width,
563extern void intelfbhw_cursor_reset(struct intelfb_info *dinfo); 563extern void intelfbhw_cursor_reset(struct intelfb_info *dinfo);
564extern int intelfbhw_enable_irq(struct intelfb_info *dinfo, int reenable); 564extern int intelfbhw_enable_irq(struct intelfb_info *dinfo, int reenable);
565extern void intelfbhw_disable_irq(struct intelfb_info *dinfo); 565extern void intelfbhw_disable_irq(struct intelfb_info *dinfo);
566extern int intelfbhw_wait_for_vsync(struct intelfb_info *dinfo, u32 pipe);
566 567
567#endif /* _INTELFBHW_H */ 568#endif /* _INTELFBHW_H */