summaryrefslogtreecommitdiff
path: root/src/xvmc/intel_batchbuffer.c
diff options
context:
space:
mode:
authorZhenyu Wang <zhenyu.z.wang@intel.com>2007-11-15 02:23:07 +0800
committerZhenyu Wang <zhenyu.z.wang@intel.com>2007-11-15 02:23:07 +0800
commit619044b242d4abf605b42cfff538b63f445fe709 (patch)
tree16de2213ac2b889d380e3103b7bc7618fd2bf784 /src/xvmc/intel_batchbuffer.c
parentae805ac379ccfdae9ee272896665e73f5bc7d2cf (diff)
xvmc: move batch buffer init/fini to intel_batchbuffer.c
Diffstat (limited to 'src/xvmc/intel_batchbuffer.c')
-rw-r--r--src/xvmc/intel_batchbuffer.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/src/xvmc/intel_batchbuffer.c b/src/xvmc/intel_batchbuffer.c
index 77682188..c96bd459 100644
--- a/src/xvmc/intel_batchbuffer.c
+++ b/src/xvmc/intel_batchbuffer.c
@@ -96,20 +96,38 @@ void intelDestroyBatchBuffer(void)
}
-void intelInitBatchBuffer(void)
+Bool intelInitBatchBuffer(void)
{
if (xvmc_driver->batchbuffer.map) {
- xvmc_driver->alloc.size = xvmc_driver->batchbuffer.size;
- xvmc_driver->alloc.offset = xvmc_driver->batchbuffer.offset;
- xvmc_driver->alloc.ptr = xvmc_driver->batchbuffer.map;
+ xvmc_driver->alloc.size = xvmc_driver->batchbuffer.size;
+ xvmc_driver->alloc.offset = xvmc_driver->batchbuffer.offset;
+ xvmc_driver->alloc.ptr = xvmc_driver->batchbuffer.map;
} else {
- xvmc_driver->alloc.size = 8 * 1024;
- xvmc_driver->alloc.offset = 0;
- xvmc_driver->alloc.ptr = malloc(xvmc_driver->alloc.size);
+ xvmc_driver->alloc.size = 8 * 1024;
+ xvmc_driver->alloc.offset = 0;
+ xvmc_driver->alloc.ptr = malloc(xvmc_driver->alloc.size);
}
- xvmc_driver->alloc.active_buf = 0;
- assert(xvmc_driver->alloc.ptr);
+ xvmc_driver->alloc.active_buf = 0;
+ assert(xvmc_driver->alloc.ptr);
+
+ if (drmMap(xvmc_driver->fd,
+ xvmc_driver->batchbuffer.handle,
+ xvmc_driver->batchbuffer.size,
+ (drmAddress *)&xvmc_driver->batchbuffer.map) != 0) {
+ XVMC_ERR("fail to map batch buffer\n");
+ return False;
+ }
+}
+
+void intelFiniBatchBuffer(void)
+{
+ intelFlushBatch(TRUE);
+
+ if (xvmc_driver->batchbuffer.map) {
+ drmUnmap(xvmc_driver->batchbuffer.map, xvmc_driver->batchbuffer.size);
+ xvmc_driver->batchbuffer.map = NULL;
+ }
}
void intelBatchbufferRequireSpace(unsigned int sz)