diff options
author | Zhenyu Wang <zhenyu.z.wang@intel.com> | 2007-11-16 15:49:10 +0800 |
---|---|---|
committer | Zhenyu Wang <zhenyu.z.wang@intel.com> | 2007-11-16 15:49:10 +0800 |
commit | a03a758db0df615fbb44dae1ab6910bfeaeb54f9 (patch) | |
tree | 2876d339bcf5b121b0114dd5551ec4bec3cad7ff /src/xvmc | |
parent | 7bfbcb4dc7806ae7543f230373e67f35ba30668d (diff) |
xvmc: move some i915 context destroy code to generic function
Diffstat (limited to 'src/xvmc')
-rw-r--r-- | src/xvmc/i915_xvmc.c | 13 | ||||
-rw-r--r-- | src/xvmc/intel_xvmc.c | 19 |
2 files changed, 16 insertions, 16 deletions
diff --git a/src/xvmc/i915_xvmc.c b/src/xvmc/i915_xvmc.c index 404edc0b..53dfbdf7 100644 --- a/src/xvmc/i915_xvmc.c +++ b/src/xvmc/i915_xvmc.c @@ -1612,23 +1612,10 @@ static void i915_release_resource(Display *display, XvMCContext *context) driDestroyHashContents(pI915XvMC->drawHash); drmHashDestroy(pI915XvMC->drawHash); - pthread_mutex_destroy(&xvmc_driver->ctxmutex); - XLockDisplay(display); uniDRIDestroyContext(display, screen, pI915XvMC->id); XUnlockDisplay(display); - drmUnmap(xvmc_driver->sarea_address, xvmc_driver->sarea_size); - - if (xvmc_driver->fd >= 0) - drmClose(xvmc_driver->fd); - xvmc_driver->fd = -1; - - XLockDisplay(display); - uniDRICloseConnection(display, screen); - _xvmc_destroy_context(display, context); - XUnlockDisplay(display); - free(pI915XvMC); context->privData = NULL; } diff --git a/src/xvmc/intel_xvmc.c b/src/xvmc/intel_xvmc.c index 164b4b22..1de53f3b 100644 --- a/src/xvmc/intel_xvmc.c +++ b/src/xvmc/intel_xvmc.c @@ -256,6 +256,7 @@ Status XvMCCreateContext(Display *display, XvPortID port, Status XvMCDestroyContext(Display *display, XvMCContext *context) { Status ret; + int screen = DefaultScreen(display); if (!display || !context) return XvMCBadContext; @@ -266,9 +267,21 @@ Status XvMCDestroyContext(Display *display, XvMCContext *context) return ret; } - /* Pass Control to the X server to destroy the drm_context_t */ - //XXX move generic destroy method here - //i915_release_resource(display,context); + ret = _xvmc_destroy_context(display, context); + if (ret != Success) { + XVMC_ERR("_xvmc_destroy_context fail\n"); + return ret; + } + uniDRICloseConnection(display, screen); + + pthread_mutex_destroy(&xvmc_driver->ctxmutex); + + drmUnmap(xvmc_driver->sarea_address, xvmc_driver->sarea_size); + + if (xvmc_driver->fd >= 0) + drmClose(xvmc_driver->fd); + xvmc_driver->fd = -1; + intelFiniBatchBuffer(); return Success; } |