summaryrefslogtreecommitdiff
path: root/src/xvmc
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2010-03-08 17:33:18 +0100
committerDaniel Vetter <daniel.vetter@ffwll.ch>2010-04-08 11:22:17 +0200
commit036cd4bb82131c08b79f596667f00b19a0c8ab79 (patch)
tree08589d2a40b6219886ed5d92645a4a751c64330f /src/xvmc
parent69218cc1b51acfee91b471bb973a4419b79cdd85 (diff)
i965 XvMC: don't create any surface state in the ddx
Like for i915. Also drop that now totally superflous limit on the available surfaces. Move the surface struct into the userspace library header now that the ddx doesn't use it anymore. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'src/xvmc')
-rw-r--r--src/xvmc/i965_xvmc.c16
-rw-r--r--src/xvmc/i965_xvmc.h5
-rw-r--r--src/xvmc/xvmc_vld.c14
3 files changed, 26 insertions, 9 deletions
diff --git a/src/xvmc/i965_xvmc.c b/src/xvmc/i965_xvmc.c
index 3de60546..417c32e9 100644
--- a/src/xvmc/i965_xvmc.c
+++ b/src/xvmc/i965_xvmc.c
@@ -256,12 +256,18 @@ static Status create_surface(Display * display,
XvMCContext * context, XvMCSurface * surface,
int priv_count, CARD32 * priv_data)
{
- struct i965_xvmc_surface *priv_surface =
- (struct i965_xvmc_surface *)priv_data;
- size_t size = SIZE_YUV420(priv_surface->w, priv_surface->h);
- surface->privData = priv_data;
+ struct i965_xvmc_surface *priv_surface = malloc(sizeof(struct i965_xvmc_surface));
+
+ if (!priv_surface)
+ return BadAlloc;
+
+ size_t size = SIZE_YUV420(context->width, context->height);
+ surface->privData = priv_surface;
priv_surface->bo = drm_intel_bo_alloc(xvmc_driver->bufmgr, "surface",
size, 0x1000);
+
+ Xfree(priv_data);
+
return Success;
}
@@ -269,8 +275,8 @@ static Status destroy_surface(Display * display, XvMCSurface * surface)
{
struct i965_xvmc_surface *priv_surface = surface->privData;
XSync(display, False);
-
drm_intel_bo_unreference(priv_surface->bo);
+ free(priv_surface);
return Success;
}
diff --git a/src/xvmc/i965_xvmc.h b/src/xvmc/i965_xvmc.h
index ed201c89..58462685 100644
--- a/src/xvmc/i965_xvmc.h
+++ b/src/xvmc/i965_xvmc.h
@@ -1 +1,6 @@
#include "intel_xvmc.h"
+
+#define I965_MAX_SURFACES 12
+struct i965_xvmc_surface {
+ dri_bo *bo;
+};
diff --git a/src/xvmc/xvmc_vld.c b/src/xvmc/xvmc_vld.c
index bea1ec76..8e8d4d6f 100644
--- a/src/xvmc/xvmc_vld.c
+++ b/src/xvmc/xvmc_vld.c
@@ -620,13 +620,18 @@ static Status create_surface(Display * display,
XvMCContext * context, XvMCSurface * surface,
int priv_count, CARD32 * priv_data)
{
- struct i965_xvmc_surface *priv_surface =
- (struct i965_xvmc_surface *)priv_data;
- size_t size = SIZE_YUV420(priv_surface->w, priv_surface->h);
- surface->privData = priv_data;
+ struct i965_xvmc_surface *priv_surface = malloc(sizeof(struct i965_xvmc_surface));
+
+ if (!priv_surface)
+ return BadAlloc;
+
+ size_t size = SIZE_YUV420(context->width, context->height);
+ surface->privData = priv_surface;
priv_surface->bo = drm_intel_bo_alloc(xvmc_driver->bufmgr, "surface",
size, 0x1000);
+ Xfree(priv_data);
+
return Success;
}
@@ -635,6 +640,7 @@ static Status destroy_surface(Display * display, XvMCSurface * surface)
struct i965_xvmc_surface *priv_surface = surface->privData;
XSync(display, False);
drm_intel_bo_unreference(priv_surface->bo);
+ free(priv_surface);
return Success;
}