diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-07-20 11:16:47 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-07-20 11:29:20 +0100 |
commit | 24ab9145c7748cb344b69d70b4f8eccb0c90db76 (patch) | |
tree | 375e6ad49e81c2727e45eae13b9590ad93c4ede3 /src/sna/sna_driver.c | |
parent | df0b2ce823e8bc9e994875ce349cf1da4cf8e402 (diff) |
Update to ABI 22 and NotifyFd
ABI 22 brings in a new BlockHandler/WakeupHandler interface
(SetNotifyFd) and throws out the current interface (albeit without
delivering any improvements).
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_driver.c')
-rw-r--r-- | src/sna/sna_driver.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/sna/sna_driver.c b/src/sna/sna_driver.c index 455113f0..60a5a970 100644 --- a/src/sna/sna_driver.c +++ b/src/sna/sna_driver.c @@ -681,6 +681,7 @@ cleanup: return FALSE; } +#if !HAVE_NOTIFY_FD static bool has_shadow(struct sna *sna) { if (!sna->mode.shadow_enabled) @@ -737,6 +738,31 @@ sna_wakeup_handler(WAKEUPHANDLER_ARGS_DECL) FD_CLR(sna->kgem.fd, (fd_set*)read_mask); } } +#else +static void +sna_block_handler(void *data, void *_timeout) +{ + struct sna *sna = data; + int *timeout = _timeout; + struct timeval tv, *tvp; + + DBG(("%s (timeout=%d)\n", __FUNCTION__, *timeout)); + if (*timeout == 0) + return; + + if (*timeout < 0) { + tvp = NULL; + } else { + tv.tv_sec = *timeout / 1000; + tv.tv_usec = (*timeout % 1000) * 1000; + tvp = &tv; + } + + sna_accel_block(sna, &tvp); + if (tvp) + *timeout = tvp->tv_sec * 1000 + tvp->tv_usec / 1000; +} +#endif #if HAVE_UDEV #include <sys/stat.h> @@ -1141,11 +1167,17 @@ sna_screen_init(SCREEN_INIT_ARGS_DECL) * later memory should be bound when allocating, e.g rotate_mem */ scrn->vtSema = TRUE; +#if !HAVE_NOTIFY_FD sna->BlockHandler = screen->BlockHandler; screen->BlockHandler = sna_block_handler; sna->WakeupHandler = screen->WakeupHandler; screen->WakeupHandler = sna_wakeup_handler; +#else + RegisterBlockAndWakeupHandlers(sna_block_handler, + (ServerWakeupHandlerProcPtr)NoopDDA, + sna); +#endif screen->SaveScreen = sna_save_screen; screen->CreateScreenResources = sna_create_screen_resources; |