surface->privData = calloc(1, sizeof(struct intel_xvmc_surface));
- if (!(intel_surf = surface->privData)) {
- PPTHREAD_MUTEX_UNLOCK();
- return BadAlloc;
- }
+ if (!(intel_surf = surface->privData))
+ goto out_xvmc;
intel_surf->bo = drm_intel_bo_alloc(xvmc_driver->bufmgr,
"surface",
intel_ctx->surface_bo_size,
GTT_PAGE_SIZE);
- if (!intel_surf->bo) {
- free(intel_surf);
- return BadAlloc;
- }
+ if (!intel_surf->bo)
+ goto out_surf;
- drm_intel_bo_disable_reuse(intel_surf->bo);
+ if (drm_intel_bo_flink(intel_surf->bo, &intel_surf->gem_handle))
+ goto out_bo;
intel_surf = surface->privData;
intel_surf->context = context;
surface->width, surface->height);
if (!intel_surf->image) {
XVMC_ERR("Can't create XvImage for surface\n");
- free(intel_surf);
- _xvmc_destroy_surface(display, surface);
- return BadAlloc;
+ goto out_bo;
}
return Success;
+
+out_bo:
+ drm_intel_bo_unreference(intel_surf->bo);
+out_surf:
+ free(intel_surf);
+out_xvmc:
+ _xvmc_destroy_surface(display, surface);
+ return BadAlloc;
}
/*
unsigned short destw, unsigned short desth,
int flags)
{
- Status ret = Success;
XvMCContext *context;
intel_xvmc_surface_ptr intel_surf;
return XvMCBadSurface;
intel_surf = surface->privData;
+ if (!intel_surf)
+ return XvMCBadSurface;
+
context = intel_surf->context;
- if (!context || !intel_surf)
+ if (!context)
return XvMCBadSurface;
if (intel_surf->gc_init == FALSE) {
}
intel_surf->last_draw = draw;
- drm_intel_bo_flink(intel_surf->bo, &intel_surf->gem_handle);
-
- ret = XvPutImage(display, context->port, draw, intel_surf->gc,
- intel_surf->image, srcx, srcy, srcw, srch, destx,
- desty, destw, desth);
- return ret;
+ return XvPutImage(display, context->port, draw, intel_surf->gc,
+ intel_surf->image, srcx, srcy, srcw, srch, destx,
+ desty, destw, desth);
}
/*