diff options
author | Zhenyu Wang <zhenyu.z.wang@intel.com> | 2007-12-20 13:08:07 +0800 |
---|---|---|
committer | Zhenyu Wang <zhenyu.z.wang@intel.com> | 2007-12-20 13:08:07 +0800 |
commit | a811ca30659e8c477027ea9c91fb9fc516fdabc7 (patch) | |
tree | e922a356db1323b90fca5d85e0527862df74e207 | |
parent | 5f961f28310a1cd19967df2034b0452bf4446394 (diff) |
xvmc: handle surface create/destory in generic code
-rw-r--r-- | src/xvmc/i915_xvmc.c | 25 | ||||
-rw-r--r-- | src/xvmc/intel_xvmc.c | 13 | ||||
-rw-r--r-- | src/xvmc/intel_xvmc.h | 2 |
3 files changed, 15 insertions, 25 deletions
diff --git a/src/xvmc/i915_xvmc.c b/src/xvmc/i915_xvmc.c index bc219d42..44ccdc11 100644 --- a/src/xvmc/i915_xvmc.c +++ b/src/xvmc/i915_xvmc.c @@ -1728,17 +1728,13 @@ static int i915_xvmc_mc_destroy_context(Display *display, XvMCContext *context) } static Status i915_xvmc_mc_create_surface(Display *display, - XvMCContext *context, XvMCSurface *surface) + XvMCContext *context, XvMCSurface *surface, int priv_count, + CARD32 *priv_data) { Status ret; i915XvMCContext *pI915XvMC; i915XvMCSurface *pI915Surface; I915XvMCCreateSurfaceRec *tmpComm = NULL; - int priv_count; - uint *priv_data; - - if (!display || !context) - return BadValue; if (!(pI915XvMC = context->privData)) return (error_base + XvMCBadContext); @@ -1764,19 +1760,6 @@ static Status i915_xvmc_mc_create_surface(Display *display, pI915Surface->privContext = pI915XvMC; pI915Surface->privSubPic = NULL; pI915Surface->srf.map = NULL; - XLockDisplay(display); - - if ((ret = _xvmc_create_surface(display, context, surface, - &priv_count, &priv_data))) { - XUnlockDisplay(display); - XVMC_ERR("Unable to create XvMCSurface."); - free(pI915Surface); - surface->privData = NULL; - PPTHREAD_MUTEX_UNLOCK(); - return ret; - } - - XUnlockDisplay(display); if (priv_count != (sizeof(I915XvMCCreateSurfaceRec) >> 2)) { XVMC_ERR("_xvmc_create_surface() returned incorrect data size!"); @@ -1836,10 +1819,6 @@ static int i915_xvmc_mc_destroy_surface(Display *display, XvMCSurface *surface) if (pI915Surface->srf.map) drmUnmap(pI915Surface->srf.map, pI915Surface->srf.size); - XLockDisplay(display); - _xvmc_destroy_surface(display, surface); - XUnlockDisplay(display); - free(pI915Surface); surface->privData = NULL; pI915XvMC->ref--; diff --git a/src/xvmc/intel_xvmc.c b/src/xvmc/intel_xvmc.c index 9b80eb4c..0b6e5a31 100644 --- a/src/xvmc/intel_xvmc.c +++ b/src/xvmc/intel_xvmc.c @@ -366,6 +366,8 @@ Status XvMCDestroyContext(Display *display, XvMCContext *context) Status XvMCCreateSurface(Display *display, XvMCContext *context, XvMCSurface *surface) { Status ret; + int priv_count; + CARD32 *priv_data; if (!display || !context) return XvMCBadContext; @@ -373,7 +375,14 @@ Status XvMCCreateSurface(Display *display, XvMCContext *context, XvMCSurface *su if (!surface) return XvMCBadSurface; - ret = (xvmc_driver->create_surface)(display, context, surface); + if ((ret = _xvmc_create_surface(display, context, surface, + &priv_count, &priv_data))) { + XVMC_ERR("Unable to create XvMCSurface."); + return ret; + } + + ret = (xvmc_driver->create_surface)(display, context, surface, priv_count, + priv_data); if (ret) { XVMC_ERR("create surface failed\n"); return ret; @@ -393,6 +402,8 @@ Status XvMCDestroySurface(Display *display, XvMCSurface *surface) (xvmc_driver->destroy_surface)(display, surface); + _xvmc_destroy_surface(display, surface); + return Success; } diff --git a/src/xvmc/intel_xvmc.h b/src/xvmc/intel_xvmc.h index 8a6f8747..961a2e17 100644 --- a/src/xvmc/intel_xvmc.h +++ b/src/xvmc/intel_xvmc.h @@ -164,7 +164,7 @@ typedef struct _intel_xvmc_driver { Status (*destroy_context)(Display* display, XvMCContext *context); Status (*create_surface)(Display* display, XvMCContext *context, - XvMCSurface *surface); + XvMCSurface *surface, int priv_count, CARD32 *priv_data); Status (*destroy_surface)(Display* display, XvMCSurface *surface); |