Add a poll function that alternates between zero and normal poll return to
authorJon Smirl <jonsmirl@yahoo.com>
Wed, 13 Oct 2004 16:40:53 +0000 (16:40 +0000)
committerJon Smirl <jonsmirl@yahoo.com>
Wed, 13 Oct 2004 16:40:53 +0000 (16:40 +0000)
    bring DRM into conformance with normal poll().

13 files changed:
linux-core/drmP.h
linux-core/drm_fops.c
linux-core/ffb_drv.c
linux-core/i810_drv.c
linux-core/i830_drv.c
linux-core/i915_drv.c
linux-core/mach64_drv.c
linux-core/mga_drv.c
linux-core/r128_drv.c
linux-core/radeon_drv.c
linux-core/savage_drv.c
linux-core/sis_drv.c
linux-core/tdfx_drv.c

index 583ead0..8af9f35 100644 (file)
@@ -749,6 +749,7 @@ extern int drm_open_helper(struct inode *inode, struct file *filp,
                           drm_device_t * dev);
 extern int drm_fasync(int fd, struct file *filp, int on);
 extern int drm_release(struct inode *inode, struct file *filp);
+unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait);
 
                                /* Mapping support (drm_vm.h) */
 extern void drm_vm_open(struct vm_area_struct *vma);
index 0c62a1d..54cebbc 100644 (file)
@@ -451,3 +451,19 @@ int drm_release(struct inode *inode, struct file *filp)
        return retcode;
 }
 EXPORT_SYMBOL(drm_release);
+
+/** No-op. */
+/* This is to deal with older X servers that believe 0 means data is
+ * available which is not the correct return for a poll function.
+ * By alternating returns both interfaces are happy. This is fixed
+ * in newer X servers.
+ */
+unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait)
+{
+       static int flip;
+       if ((flip = !flip))
+               return (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM);
+       return 0;
+}
+EXPORT_SYMBOL(drm_poll);
+
index c4a1a9f..8122e95 100644 (file)
@@ -324,6 +324,7 @@ static struct drm_driver ffb_driver = {
                .ioctl   = drm_ioctl,
                .mmap    = drm_mmap,
                .fasync  = drm_fasync,
+               .poll    = drm_poll,
                .get_unmapped_area = ffb_get_unmapped_area,
        },
 };
index bfeb35a..6ffa167 100644 (file)
@@ -114,6 +114,7 @@ static struct drm_driver driver = {
                .release = drm_release,
                .ioctl = drm_ioctl,
                .mmap = i810_mmap_buffers,
+               .poll = drm_poll,
                .fasync = drm_fasync,
                },
        .pci_driver = {
index e7c00a8..0846da6 100644 (file)
@@ -124,6 +124,7 @@ static struct drm_driver driver = {
                .release = drm_release,
                .ioctl = drm_ioctl,
                .mmap = i830_mmap_buffers,
+               .poll = drm_poll,
                .fasync = drm_fasync,
                },
        .pci_driver = {
index 6cb2774..f0298e1 100644 (file)
@@ -89,6 +89,7 @@ static struct drm_driver driver = {
                .release = drm_release,
                .ioctl = drm_ioctl,
                .mmap = drm_mmap,
+               .poll = drm_poll,
                .fasync = drm_fasync,
                },
        .pci_driver = {
index e1be1fa..3f736aa 100644 (file)
@@ -106,6 +106,7 @@ static struct drm_driver driver = {
                .release = drm_release,
                .ioctl = drm_ioctl,
                .mmap = drm_mmap,
+               .poll = drm_poll,
                .fasync = drm_fasync,
                },
        .pci_driver = {
index 6e90e5d..65e9d9c 100644 (file)
@@ -111,6 +111,7 @@ static struct drm_driver driver = {
                .release = drm_release,
                .ioctl = drm_ioctl,
                .mmap = drm_mmap,
+               .poll = drm_poll,
                .fasync = drm_fasync,
                },
        .pci_driver = {
index 31ee1aa..0a34625 100644 (file)
@@ -121,6 +121,7 @@ static struct drm_driver driver = {
                .release = drm_release,
                .ioctl = drm_ioctl,
                .mmap = drm_mmap,
+               .poll = drm_poll,
                .fasync = drm_fasync,
                },
        .pci_driver = {
index dbf530f..fbf6b23 100644 (file)
@@ -161,6 +161,7 @@ static struct drm_driver driver = {
                .release = drm_release,
                .ioctl = drm_ioctl,
                .mmap = drm_mmap,
+               .poll = drm_poll,
                .fasync = drm_fasync,
                },
        .pci_driver = {
index ffec6e7..e859168 100644 (file)
@@ -299,6 +299,7 @@ static struct drm_driver driver = {
                .release = drm_release,
                .ioctl   = drm_ioctl,
                .mmap    = drm_mmap,
+               .poll = drm_poll,
                .fasync  = drm_fasync,
        },
        .pci_driver = {
index f516847..a630050 100644 (file)
@@ -88,6 +88,7 @@ static struct drm_driver driver = {
                .release = drm_release,
                .ioctl = drm_ioctl,
                .mmap = drm_mmap,
+               .poll = drm_poll,
                .fasync = drm_fasync,
                },
        .pci_driver = {
index 66d5728..9062cb0 100644 (file)
@@ -79,6 +79,7 @@ static struct drm_driver driver = {
                .release = drm_release,
                .ioctl = drm_ioctl,
                .mmap = drm_mmap,
+               .poll = drm_poll,
                .fasync = drm_fasync,
                },
        .pci_driver = {