[PATCH] drm: Honour O_NONBLOCK on the device for reading events
Chris Wilson
chris at chris-wilson.co.uk
Wed Jun 8 12:14:01 PDT 2011
Otherwise drmHandleEvent will block if accidentally read too often...
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Phillip Haddad <phillip.haddad at gmail.com>
---
drivers/gpu/drm/drm_fops.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 2ec7d48..279aa95 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -617,6 +617,9 @@ ssize_t drm_read(struct file *filp, char __user *buffer,
size_t total;
ssize_t ret;
+ if (filp->f_flags & O_NONBLOCK && list_empty(&file_priv->event_list))
+ return -EAGAIN;
+
ret = wait_event_interruptible(file_priv->event_wait,
!list_empty(&file_priv->event_list));
if (ret < 0)
--
1.7.5.3
More information about the dri-devel
mailing list