Commit a811ca30 authored by Zhenyu Wang's avatar Zhenyu Wang

xvmc: handle surface create/destory in generic code

parent 5f961f28
......@@ -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--;
......
......@@ -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;
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment