summaryrefslogtreecommitdiff
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
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>
-rw-r--r--src/i830_hwmc.c42
-rw-r--r--src/i965_hwmc.h9
-rw-r--r--src/xvmc/i965_xvmc.c16
-rw-r--r--src/xvmc/i965_xvmc.h5
-rw-r--r--src/xvmc/xvmc_vld.c14
5 files changed, 26 insertions, 60 deletions
diff --git a/src/i830_hwmc.c b/src/i830_hwmc.c
index 133518a1..a55b7e6a 100644
--- a/src/i830_hwmc.c
+++ b/src/i830_hwmc.c
@@ -114,10 +114,6 @@ Bool intel_xvmc_screen_init(ScreenPtr pScreen)
/* i915 hwmc support */
#define _INTEL_XVMC_SERVER_
-#define I915_XVMC_MAX_BUFFERS 2
-#define I915_XVMC_MAX_CONTEXTS 4
-#define I915_XVMC_MAX_SURFACES 20
-
static XF86MCSurfaceInfoRec i915_YV12_mpg2_surface = {
SURFACE_TYPE_MPEG2_MPML,
XVMC_CHROMA_FORMAT_420,
@@ -337,49 +333,11 @@ static void destroy_context(ScrnInfoPtr scrn, XvMCContextPtr context)
static int create_surface(ScrnInfoPtr scrn, XvMCSurfacePtr surface,
int *num_priv, CARD32 ** priv)
{
- XvMCContextPtr ctx = surface->context;
-
- struct i965_xvmc_surface *priv_surface, *surface_dup;
- struct i965_xvmc_context *priv_ctx = ctx->driver_priv;
- int i;
- for (i = 0; i < I965_MAX_SURFACES; i++) {
- if (priv_ctx->surfaces[i] == NULL) {
- priv_surface = Xcalloc(sizeof(*priv_surface));
- if (priv_surface == NULL)
- return BadAlloc;
- surface_dup = Xcalloc(sizeof(*priv_surface));
- if (surface_dup == NULL)
- return BadAlloc;
-
- priv_surface->no = i;
- priv_surface->handle = priv_surface;
- priv_surface->w = ctx->width;
- priv_surface->h = ctx->height;
- priv_ctx->surfaces[i] = surface->driver_priv
- = priv_surface;
- memcpy(surface_dup, priv_surface,
- sizeof(*priv_surface));
- *num_priv = sizeof(*priv_surface) / sizeof(CARD32);
- *priv = (CARD32 *) surface_dup;
- break;
- }
- }
-
- if (i >= I965_MAX_SURFACES) {
- ErrorF("I965 XVMC too many surfaces in one context\n");
- return BadAlloc;
- }
-
return Success;
}
static void destory_surface(ScrnInfoPtr scrn, XvMCSurfacePtr surface)
{
- XvMCContextPtr ctx = surface->context;
- struct i965_xvmc_surface *priv_surface = surface->driver_priv;
- struct i965_xvmc_context *priv_ctx = ctx->driver_priv;
- priv_ctx->surfaces[priv_surface->no] = NULL;
- Xfree(priv_surface);
}
static XF86MCSurfaceInfoRec yv12_mpeg2_vld_surface = {
diff --git a/src/i965_hwmc.h b/src/i965_hwmc.h
index 194d07f9..8b388679 100644
--- a/src/i965_hwmc.h
+++ b/src/i965_hwmc.h
@@ -1,15 +1,6 @@
#define I965_MC_STATIC_BUFFER_SIZE (1024*512)
-#define I965_MAX_SURFACES 12
-struct i965_xvmc_surface {
- int w, h;
- unsigned int no;
- void *handle;
- dri_bo *bo;
-};
-
struct i965_xvmc_context {
struct _intel_xvmc_common comm;
- struct i965_xvmc_surface *surfaces[I965_MAX_SURFACES];
unsigned int is_g4x:1;
unsigned int is_965_q:1;
unsigned int is_igdng:1;
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;
}