summaryrefslogtreecommitdiff
path: root/xvmc/intel_xvmc.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-11-11 14:56:22 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-11-11 15:05:56 +0000
commitc489934ed732ed3d5a906939381c62a6bc1c38d5 (patch)
tree7d96475036f22ccad0bc43ad98ad7f71449f4ecb /xvmc/intel_xvmc.c
parent3e93449b5492a4fc09401c23f8754655b63959b5 (diff)
xvmc: Handle allocation failure around batch submission
If we fail to allocate a new batch, just stall and reuse the old one rather than crashing. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'xvmc/intel_xvmc.c')
-rw-r--r--xvmc/intel_xvmc.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/xvmc/intel_xvmc.c b/xvmc/intel_xvmc.c
index ff13d03c..2a2c8b9a 100644
--- a/xvmc/intel_xvmc.c
+++ b/xvmc/intel_xvmc.c
@@ -313,6 +313,16 @@ _X_EXPORT Status XvMCCreateContext(Display * display, XvPortID port,
}
drm_intel_bufmgr_gem_enable_reuse(xvmc_driver->bufmgr);
+ if (!intelInitBatchBuffer()) {
+ XFree(priv_data);
+ context->privData = NULL;
+
+ dri_bufmgr_destroy(xvmc_driver->bufmgr);
+ xvmc_driver = NULL;
+
+ return BadAlloc;
+ }
+
/* call driver hook.
* driver hook should free priv_data after return if success.*/
ret =
@@ -320,14 +330,18 @@ _X_EXPORT Status XvMCCreateContext(Display * display, XvPortID port,
priv_data);
if (ret) {
XVMC_ERR("driver create context failed\n");
+ intelFiniBatchBuffer();
+
XFree(priv_data);
context->privData = NULL;
+
+ dri_bufmgr_destroy(xvmc_driver->bufmgr);
xvmc_driver = NULL;
return ret;
}
+
pthread_mutex_init(&xvmc_driver->ctxmutex, NULL);
- intelInitBatchBuffer();
intel_xvmc_dump_open();
return Success;