diff options
Diffstat (limited to 'xvmc')
-rw-r--r-- | xvmc/intel_xvmc.c | 23 | ||||
-rw-r--r-- | xvmc/intel_xvmc_private.h | 39 |
2 files changed, 18 insertions, 44 deletions
diff --git a/xvmc/intel_xvmc.c b/xvmc/intel_xvmc.c index 2a2c8b9a..9a09aeb8 100644 --- a/xvmc/intel_xvmc.c +++ b/xvmc/intel_xvmc.c @@ -103,21 +103,6 @@ unsigned int mb_bytes_420[] = { 768 /* 111111 */ }; -void LOCK_HARDWARE(drm_context_t ctx) -{ - PPTHREAD_MUTEX_LOCK(); - assert(!xvmc_driver->locked); - - xvmc_driver->locked = 1; -} - -void UNLOCK_HARDWARE(drm_context_t ctx) -{ - xvmc_driver->locked = 0; - - PPTHREAD_MUTEX_UNLOCK(); -} - static int dri2_connect(Display *display) { @@ -340,8 +325,14 @@ _X_EXPORT Status XvMCCreateContext(Display * display, XvPortID port, return ret; } - + sigfillset(&xvmc_driver->sa_mask); + sigdelset(&xvmc_driver->sa_mask, SIGFPE); + sigdelset(&xvmc_driver->sa_mask, SIGILL); + sigdelset(&xvmc_driver->sa_mask, SIGSEGV); + sigdelset(&xvmc_driver->sa_mask, SIGBUS); + sigdelset(&xvmc_driver->sa_mask, SIGKILL); pthread_mutex_init(&xvmc_driver->ctxmutex, NULL); + intel_xvmc_dump_open(); return Success; diff --git a/xvmc/intel_xvmc_private.h b/xvmc/intel_xvmc_private.h index e2ea2dca..d3f7b9e1 100644 --- a/xvmc/intel_xvmc_private.h +++ b/xvmc/intel_xvmc_private.h @@ -147,9 +147,8 @@ typedef struct _intel_xvmc_driver { } alloc; intel_xvmc_drm_map_t batchbuffer; - sigset_t sa_mask; + sigset_t sa_mask, old_mask; pthread_mutex_t ctxmutex; - int locked; int num_ctx; intel_xvmc_context_ptr ctx_list; @@ -194,33 +193,17 @@ extern struct _intel_xvmc_driver i965_xvmc_mc_driver; extern struct _intel_xvmc_driver xvmc_vld_driver; extern struct _intel_xvmc_driver *xvmc_driver; -#define SET_BLOCKED_SIGSET() do { \ - sigset_t bl_mask; \ - sigfillset(&bl_mask); \ - sigdelset(&bl_mask, SIGFPE); \ - sigdelset(&bl_mask, SIGILL); \ - sigdelset(&bl_mask, SIGSEGV); \ - sigdelset(&bl_mask, SIGBUS); \ - sigdelset(&bl_mask, SIGKILL); \ - pthread_sigmask(SIG_SETMASK, &bl_mask, &xvmc_driver->sa_mask); \ - } while (0) - -#define RESTORE_BLOCKED_SIGSET() do { \ - pthread_sigmask(SIG_SETMASK, &xvmc_driver->sa_mask, NULL); \ - } while (0) - -#define PPTHREAD_MUTEX_LOCK() do { \ - SET_BLOCKED_SIGSET(); \ - pthread_mutex_lock(&xvmc_driver->ctxmutex); \ - } while (0) - -#define PPTHREAD_MUTEX_UNLOCK() do { \ - pthread_mutex_unlock(&xvmc_driver->ctxmutex); \ - RESTORE_BLOCKED_SIGSET(); \ - } while (0) +static inline void LOCK_HARDWARE(drm_context_t ctx) +{ + pthread_mutex_lock(&xvmc_driver->ctxmutex); + pthread_sigmask(SIG_SETMASK, &xvmc_driver->sa_mask, &xvmc_driver->old_mask); +} -extern void LOCK_HARDWARE(drm_context_t); -extern void UNLOCK_HARDWARE(drm_context_t); +static inline void UNLOCK_HARDWARE(drm_context_t ctx) +{ + pthread_sigmask(SIG_SETMASK, &xvmc_driver->old_mask, NULL); + pthread_mutex_unlock(&xvmc_driver->ctxmutex); +} static inline const char *intel_xvmc_decoder_string(int flag) { |