From d0b09f10242e09adfddbbe6ee1ea39dbf5d1b32d Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 8 Jun 2011 20:34:57 +0100 Subject: [PATCH] sna: Make the device fd non-blocking So that we can simply query it from each of the Zaphod instances without blocking. Requires a fixed kernel... Signed-off-by: Chris Wilson --- src/sna/sna_driver.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c index 9d8a067c..ca1f32cb 100644 --- a/src/sna/sna_driver.c +++ b/src/sna/sna_driver.c @@ -68,6 +68,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "intel_driver.h" #include +#include #include "i915_drm.h" static OptionInfoRec sna_options[] = { @@ -331,6 +332,13 @@ static int sna_open_drm_master(ScrnInfoPtr scrn) dev = malloc(sizeof(*dev)); if (dev) { + int flags; + + /* make the fd nonblocking to handle event loops */ + flags = fcntl(fd, F_GETFL, 0); + if (flags != -1) + fcntl(fd, F_SETFL, flags | O_NONBLOCK); + dev->fd = fd; dev->open_count = 1; sna_set_device(scrn, dev);