From 036cd4bb82131c08b79f596667f00b19a0c8ab79 Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Mon, 8 Mar 2010 17:33:18 +0100 Subject: 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 --- src/xvmc/i965_xvmc.c | 16 +++++++++++----- src/xvmc/i965_xvmc.h | 5 +++++ src/xvmc/xvmc_vld.c | 14 ++++++++++---- 3 files changed, 26 insertions(+), 9 deletions(-) (limited to 'src/xvmc') 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; } -- cgit v1.2.3