From: dmunsie@cecropia.com (Dennis Munsie)
To: linux-fbdev-devel@lists.sourceforge.net
Subject: [PATCH 2.6.17-rc6-mm2 4/5] intelfb: RESEND - add vsync interrupt support
Date: Tue, 20 Jun 2006 14:31:38 -0400 (EDT) [thread overview]
Message-ID: <20060620183138.2F6DE90CE13@xenon> (raw)
From: Eric Hustvedt <ehustvedt@cecropia.com>
[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 | 4 +++
drivers/video/intelfb/intelfbdrv.c | 13 ++++++++++
drivers/video/intelfb/intelfbhw.c | 33 +++++++++++++++++++++++++++
drivers/video/intelfb/intelfbhw.h | 1
4 files changed, 51 insertions(+)
diff -X linux-2.6.17-rc4-interrupt/Documentation/dontdiff -Naurp linux-2.6.17-rc4-interrupt/drivers/video/intelfb/intelfb.h linux-2.6.17-rc4-vsyncwait/drivers/video/intelfb/intelfb.h
--- linux-2.6.17-rc4-interrupt/drivers/video/intelfb/intelfb.h 2006-06-09 10:10:15.000000000 -0600
+++ linux-2.6.17-rc4-vsyncwait/drivers/video/intelfb/intelfb.h 2006-06-09 10:41:06.000000000 -0600
@@ -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);
diff -X linux-2.6.17-rc4-interrupt/Documentation/dontdiff -Naurp linux-2.6.17-rc4-interrupt/drivers/video/intelfb/intelfbdrv.c linux-2.6.17-rc4-vsyncwait/drivers/video/intelfb/intelfbdrv.c
--- linux-2.6.17-rc4-interrupt/drivers/video/intelfb/intelfbdrv.c 2006-06-09 10:11:11.000000000 -0600
+++ linux-2.6.17-rc4-vsyncwait/drivers/video/intelfb/intelfbdrv.c 2006-06-09 10:45:10.000000000 -0600
@@ -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;
}
diff -X linux-2.6.17-rc4-interrupt/Documentation/dontdiff -Naurp linux-2.6.17-rc4-interrupt/drivers/video/intelfb/intelfbhw.c linux-2.6.17-rc4-vsyncwait/drivers/video/intelfb/intelfbhw.c
--- linux-2.6.17-rc4-interrupt/drivers/video/intelfb/intelfbhw.c 2006-06-09 10:17:11.000000000 -0600
+++ linux-2.6.17-rc4-vsyncwait/drivers/video/intelfb/intelfbhw.c 2006-06-09 10:48:26.000000000 -0600
@@ -2067,3 +2067,36 @@ intelfbhw_disable_irq(struct intelfb_inf
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;
+}
diff -X linux-2.6.17-rc4-interrupt/Documentation/dontdiff -Naurp linux-2.6.17-rc4-interrupt/drivers/video/intelfb/intelfbhw.h linux-2.6.17-rc4-vsyncwait/drivers/video/intelfb/intelfbhw.h
--- linux-2.6.17-rc4-interrupt/drivers/video/intelfb/intelfbhw.h 2006-06-09 10:17:51.000000000 -0600
+++ linux-2.6.17-rc4-vsyncwait/drivers/video/intelfb/intelfbhw.h 2006-06-09 10:49:16.000000000 -0600
@@ -563,5 +563,6 @@ extern void intelfbhw_cursor_load(struct
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 */
reply other threads:[~2006-06-20 18:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060620183138.2F6DE90CE13@xenon \
--to=dmunsie@cecropia.com \
--cc=linux-fbdev-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).