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 <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2011-06-08 20:34:57 +01:00
parent 67ed14c536
commit d0b09f1024
1 changed files with 8 additions and 0 deletions

View File

@ -68,6 +68,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "intel_driver.h"
#include <sys/ioctl.h>
#include <sys/fcntl.h>
#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);