summaryrefslogtreecommitdiffstats
path: root/src/xvmc/block.c
diff options
context:
space:
mode:
authorYounes Manton <[email protected]>2009-01-12 13:19:07 -0500
committerYounes Manton <[email protected]>2009-01-18 21:40:10 -0500
commitc35dc4a741d4147a5da8bbe834a38a4c2ce627d1 (patch)
tree49880bd3e0cf8a05ce5164103dc9254d2b06f972 /src/xvmc/block.c
parent1fd411539b9b7b8ae46c1aff0a000d9b4a8f5f3b (diff)
g3dvl: Follow mesa naming conventions for src dirs.
Diffstat (limited to 'src/xvmc/block.c')
-rw-r--r--src/xvmc/block.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/src/xvmc/block.c b/src/xvmc/block.c
new file mode 100644
index 00000000000..b38a89be092
--- /dev/null
+++ b/src/xvmc/block.c
@@ -0,0 +1,79 @@
+#include <assert.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/XvMC.h>
+#include <util/u_memory.h>
+#include <vl_display.h>
+#include <vl_screen.h>
+#include <vl_context.h>
+
+#define BLOCK_SIZE (64 * 2)
+
+Status XvMCCreateBlocks(Display *display, XvMCContext *context, unsigned int num_blocks, XvMCBlockArray *blocks)
+{
+ struct vlContext *vl_ctx;
+
+ assert(display);
+
+ if (!context)
+ return XvMCBadContext;
+ if (num_blocks == 0)
+ return BadValue;
+
+ assert(blocks);
+
+ vl_ctx = context->privData;
+ assert(display == vlGetNativeDisplay(vlGetDisplay(vlContextGetScreen(vl_ctx))));
+
+ blocks->context_id = context->context_id;
+ blocks->num_blocks = num_blocks;
+ blocks->blocks = MALLOC(BLOCK_SIZE * num_blocks);
+ /* Since we don't have a VL type for blocks, set privData to the display so we can catch mismatches */
+ blocks->privData = display;
+
+ return Success;
+}
+
+Status XvMCDestroyBlocks(Display *display, XvMCBlockArray *blocks)
+{
+ assert(display);
+ assert(blocks);
+ assert(display == blocks->privData);
+ FREE(blocks->blocks);
+
+ return Success;
+}
+
+Status XvMCCreateMacroBlocks(Display *display, XvMCContext *context, unsigned int num_blocks, XvMCMacroBlockArray *blocks)
+{
+ struct vlContext *vl_ctx;
+
+ assert(display);
+
+ if (!context)
+ return XvMCBadContext;
+ if (num_blocks == 0)
+ return BadValue;
+
+ assert(blocks);
+
+ vl_ctx = context->privData;
+ assert(display == vlGetNativeDisplay(vlGetDisplay(vlContextGetScreen(vl_ctx))));
+
+ blocks->context_id = context->context_id;
+ blocks->num_blocks = num_blocks;
+ blocks->macro_blocks = MALLOC(sizeof(XvMCMacroBlock) * num_blocks);
+ /* Since we don't have a VL type for blocks, set privData to the display so we can catch mismatches */
+ blocks->privData = display;
+
+ return Success;
+}
+
+Status XvMCDestroyMacroBlocks(Display *display, XvMCMacroBlockArray *blocks)
+{
+ assert(display);
+ assert(blocks);
+ assert(display == blocks->privData);
+ FREE(blocks->macro_blocks);
+
+ return Success;
+}