gpu: pvr: support for polling events
authorTopi Pohjolainen <topi.pohjolainen@nokia.com>
Tue, 27 Apr 2010 11:14:18 +0000 (13:14 +0200)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 20 May 2012 18:09:41 +0000 (21:09 +0300)
In DRM style provide means for userspace to monitor availability
of events via the poll syscall.

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@nokia.com>
Signed-off-by: Imre Deak <imre.deak@nokia.com>
pvr/pvr_events.c
pvr/pvr_events.h

index 70c061b..9b3db1f 100644 (file)
@@ -66,6 +66,19 @@ ssize_t pvr_read(struct file *filp, char __user *buf, size_t count, loff_t *off)
        return total;
 }
 
+unsigned int pvr_poll(struct file *filp, struct poll_table_struct *wait)
+{
+       struct PVRSRV_FILE_PRIVATE_DATA *priv = filp->private_data;
+       unsigned int mask = 0;
+
+       poll_wait(filp, &priv->event_wait, wait);
+
+       if (!list_empty(&priv->event_list))
+               mask |= POLLIN | POLLRDNORM;
+
+       return mask;
+}
+
 void pvr_release_events(struct PVRSRV_FILE_PRIVATE_DATA *priv)
 {
        struct pvr_pending_event *w;
index f046cbf..f64b48f 100644 (file)
@@ -6,6 +6,7 @@
 #include "private_data.h"
 #include <linux/list.h>
 #include <linux/file.h>
+#include <linux/poll.h>
 
 /*
  * Header for events written back to userspace on the drm fd. The
@@ -33,6 +34,7 @@ void pvr_init_events(void);
 
 ssize_t pvr_read(struct file *filp, char __user *buf, size_t count,
                loff_t *off);
+unsigned int pvr_poll(struct file *filp, struct poll_table_struct *wait);
 void pvr_release_events(struct PVRSRV_FILE_PRIVATE_DATA *priv);
 
 #endif /* PVR_EVENTS_H */