xf86-video-intel: 4 commits - src/i915_hwmc.c src/i915_hwmc.h src/xvmc/driDrawable.c src/xvmc/driDrawable.h src/xvmc/i915_xvmc.c src/xvmc/intel_xvmc.c src/xvmc/intel_xvmc_dump.c src/xvmc/intel_xvmc.h src/xvmc/Makefile.am
Zhenyu Wang
zhen at kemper.freedesktop.org
Wed Jun 4 00:46:03 PDT 2008
src/i915_hwmc.c | 36 ++++++---
src/i915_hwmc.h | 2
src/xvmc/Makefile.am | 6 -
src/xvmc/driDrawable.c | 174 ---------------------------------------------
src/xvmc/driDrawable.h | 64 ----------------
src/xvmc/i915_xvmc.c | 28 -------
src/xvmc/intel_xvmc.c | 79 ++++++++++++++++++++
src/xvmc/intel_xvmc.h | 12 ++-
src/xvmc/intel_xvmc_dump.c | 142 ++++++++++++++++++++++++++++++++++++
9 files changed, 264 insertions(+), 279 deletions(-)
New commits:
commit 64ccc8a036a1d80fc918e9b124d24ce0d26bdbbb
Author: Zhenyu Wang <zhenyu.z.wang at intel.com>
Date: Wed Jun 4 22:30:04 2008 +0800
xvmc: add render dump function
diff --git a/src/xvmc/Makefile.am b/src/xvmc/Makefile.am
index f2dab22..345160f 100644
--- a/src/xvmc/Makefile.am
+++ b/src/xvmc/Makefile.am
@@ -11,6 +11,7 @@ libI810XvMC_la_LIBADD = @DRI_LIBS@
libIntelXvMC_la_SOURCES = intel_xvmc.c \
intel_xvmc.h \
+ intel_xvmc_dump.c \
i915_structs.h \
i915_program.h \
i915_xvmc.c \
diff --git a/src/xvmc/intel_xvmc.c b/src/xvmc/intel_xvmc.c
index f3a8395..ae357aa 100644
--- a/src/xvmc/intel_xvmc.c
+++ b/src/xvmc/intel_xvmc.c
@@ -431,6 +431,8 @@ Status XvMCCreateContext(Display *display, XvPortID port,
intelInitBatchBuffer();
+ intel_xvmc_dump_open();
+
return Success;
}
@@ -478,6 +480,8 @@ Status XvMCDestroyContext(Display *display, XvMCContext *context)
xvmc_driver->fd = -1;
intelFiniBatchBuffer();
+
+ intel_xvmc_dump_close();
}
return Success;
}
@@ -666,6 +670,10 @@ Status XvMCRenderSurface(Display *display, XvMCContext *context,
if (!target_surface)
return XvMCBadSurface;
+ intel_xvmc_dump_render(context, picture_structure, target_surface,
+ past_surface, future_surface, flags, num_macroblocks,
+ first_macroblock, macroblock_array, blocks);
+
ret = (xvmc_driver->render_surface)(display, context, picture_structure,
target_surface, past_surface, future_surface, flags,
num_macroblocks, first_macroblock, macroblock_array,
diff --git a/src/xvmc/intel_xvmc.h b/src/xvmc/intel_xvmc.h
index e5e623e..3119623 100644
--- a/src/xvmc/intel_xvmc.h
+++ b/src/xvmc/intel_xvmc.h
@@ -251,4 +251,13 @@ extern intel_xvmc_surface_ptr intel_xvmc_find_surface(XID id);
extern unsigned int mb_bytes_420[64];
+/* dump function */
+extern void intel_xvmc_dump_open(void);
+extern void intel_xvmc_dump_close(void);
+extern void intel_xvmc_dump_render(XvMCContext *context, unsigned int picture_structure,
+ XvMCSurface *target_surface, XvMCSurface *past_surface,
+ XvMCSurface *future_surface, unsigned int flags,
+ unsigned int num_macroblocks, unsigned int first_macroblock,
+ XvMCMacroBlockArray *macroblock_array, XvMCBlockArray *blocks);
+
#endif
diff --git a/src/xvmc/intel_xvmc_dump.c b/src/xvmc/intel_xvmc_dump.c
new file mode 100644
index 0000000..12fc52a
--- /dev/null
+++ b/src/xvmc/intel_xvmc_dump.c
@@ -0,0 +1,142 @@
+/*
+ * Copyright © 2008 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Authors:
+ * Zhenyu Wang <zhenyu.z.wang at intel.com>
+ *
+ */
+#include "intel_xvmc.h"
+
+#define DUMPFILE "./intel_xvmc_dump"
+
+static int xvmc_dump = 0;
+static FILE *fp = NULL;
+
+void intel_xvmc_dump_open(void)
+{
+ char *d = NULL;
+
+ if (xvmc_dump)
+ return;
+
+ if (d = getenv("INTEL_XVMC_DUMP"))
+ xvmc_dump = 1;
+
+ if (xvmc_dump) {
+ fp = fopen(DUMPFILE, "a");
+ if (!fp)
+ xvmc_dump = 0;
+ }
+}
+
+void intel_xvmc_dump_close(void)
+{
+ if (xvmc_dump) {
+ fclose(fp);
+ xvmc_dump = 0;
+ }
+}
+
+void intel_xvmc_dump_render(XvMCContext *context, unsigned int picture_structure,
+ XvMCSurface *target, XvMCSurface *past, XvMCSurface *future, unsigned int flags,
+ unsigned int num_macroblocks, unsigned int first_macroblock,
+ XvMCMacroBlockArray *macroblock_array, XvMCBlockArray *blocks)
+{
+ int i;
+ XvMCMacroBlock *mb;
+
+ if (!xvmc_dump)
+ return;
+
+ fprintf(fp, "========== new surface rendering ==========\n");
+ fprintf(fp, "Context (id:%d) (surface_type_id:%d) (width:%d) (height:%d)\n",
+ context->context_id, context->surface_type_id, context->width, context->height);
+
+ if (picture_structure == XVMC_FRAME_PICTURE)
+ fprintf(fp, "picture structure: frame picture\n");
+ else if (picture_structure == XVMC_TOP_FIELD)
+ fprintf(fp, "picture structure: top field picture (%s)\n",
+ (flags == XVMC_SECOND_FIELD)?"second":"first");
+ else if (picture_structure == XVMC_BOTTOM_FIELD)
+ fprintf(fp, "picture structure: bottom field picture (%s)\n",
+ (flags == XVMC_SECOND_FIELD)?"second":"first");
+
+ if (!past && !future)
+ fprintf(fp, "picture type: I\n");
+ else if (past && !future)
+ fprintf(fp, "picture type: P\n");
+ else if (past && future)
+ fprintf(fp, "picture type: B\n");
+ else
+ fprintf(fp, "picture type: Bad!\n");
+
+ fprintf(fp, "target picture: id (%d) width (%d) height (%d)\n", target->surface_id,
+ target->width, target->height);
+ if (past)
+ fprintf(fp, "past picture: id (%d) width (%d) height (%d)\n", past->surface_id,
+ past->width, past->height);
+ if (future)
+ fprintf(fp, "future picture: id (%d) width (%d) height (%d)\n", future->surface_id,
+ future->width, future->height);
+
+ fprintf(fp, "num macroblocks: %d, first macroblocks %d\n", num_macroblocks, first_macroblock);
+
+ for (i = first_macroblock; i < (first_macroblock + num_macroblocks); i++) {
+ mb = ¯oblock_array->macro_blocks[i];
+
+ fprintf(fp, "- MB(%d): ", i);
+ fprintf(fp, "x (%d) y (%d) ", mb->x, mb->y);
+ fprintf(fp, "macroblock type (");
+ if (mb->macroblock_type & XVMC_MB_TYPE_MOTION_FORWARD)
+ fprintf(fp, "motion_forward ");
+ if (mb->macroblock_type & XVMC_MB_TYPE_MOTION_BACKWARD)
+ fprintf(fp, "motion_backward ");
+ if (mb->macroblock_type & XVMC_MB_TYPE_PATTERN)
+ fprintf(fp, "pattern ");
+ if (mb->macroblock_type & XVMC_MB_TYPE_INTRA)
+ fprintf(fp, "intra ");
+ fprintf(fp, ") ");
+ fprintf(fp, "mc type ");
+ if (mb->motion_type & XVMC_PREDICTION_FIELD)
+ fprintf(fp, "(field) ");
+ else if (mb->motion_type & XVMC_PREDICTION_FRAME)
+ fprintf(fp, "(frame) ");
+ else if (mb->motion_type & XVMC_PREDICTION_DUAL_PRIME)
+ fprintf(fp, "(dual-prime) ");
+ else if (mb->motion_type & XVMC_PREDICTION_16x8)
+ fprintf(fp, "(16x8) ");
+ else if (mb->motion_type & XVMC_PREDICTION_4MV)
+ fprintf(fp, "(4MV) ");
+ else
+ fprintf(fp, "(none) ");
+
+ if (mb->dct_type == XVMC_DCT_TYPE_FRAME)
+ fprintf(fp, "dct type (frame) ");
+ else if (mb->dct_type == XVMC_DCT_TYPE_FIELD)
+ fprintf(fp, "dct type (field) ");
+
+ fprintf(fp, "coded_block_pattern (0x%x)\n", mb->coded_block_pattern);
+
+ /* XXX mv dump */
+ }
+
+}
commit 1729a4f29dd52346a9fa997f818d57884047657f
Author: Zhenyu Wang <zhenyu.z.wang at intel.com>
Date: Wed Jun 4 22:25:39 2008 +0800
xvmc: move block size lookup helper to generic
diff --git a/src/xvmc/i915_xvmc.c b/src/xvmc/i915_xvmc.c
index b1a17b4..519de5a 100644
--- a/src/xvmc/i915_xvmc.c
+++ b/src/xvmc/i915_xvmc.c
@@ -38,18 +38,6 @@
#define VOFFSET(surface) (surface->srf.offset + \
SIZE_Y420(surface->width, surface->height))
-/* Lookup tables to speed common calculations */
-static unsigned int mb_bytes[] = {
- 000, 128, 128, 256, 128, 256, 256, 384, // 0
- 128, 256, 256, 384, 256, 384, 384, 512, // 1
- 128, 256, 256, 384, 256, 384, 384, 512, // 10
- 256, 384, 384, 512, 384, 512, 512, 640, // 11
- 128, 256, 256, 384, 256, 384, 384, 512, // 100
- 256, 384, 384, 512, 384, 512, 512, 640, // 101
- 256, 384, 384, 512, 384, 512, 512, 640, // 110
- 384, 512, 512, 640, 512, 640, 640, 768 // 111
-};
-
typedef union {
short s[4];
uint u[2];
@@ -1931,7 +1919,7 @@ static int i915_xvmc_mc_render_surface(Display *display, XvMCContext *context,
XVMC_INFO("no coded blocks present!");
}
- bspm = mb_bytes[mb->coded_block_pattern];
+ bspm = mb_bytes_420[mb->coded_block_pattern];
if (!bspm)
continue;
diff --git a/src/xvmc/intel_xvmc.c b/src/xvmc/intel_xvmc.c
index 1be8cc6..f3a8395 100644
--- a/src/xvmc/intel_xvmc.c
+++ b/src/xvmc/intel_xvmc.c
@@ -26,7 +26,78 @@
*/
#include "intel_xvmc.h"
+/* global */
struct _intel_xvmc_driver *xvmc_driver = NULL;
+
+/* Lookup tables to speed common calculations for coded_block_pattern */
+/* each block is ((8*8) * sizeof(short)) */
+unsigned int mb_bytes_420[] = {
+ 0, /* 0 */
+ 128, /* 1 */
+ 128, /* 10 */
+ 256, /* 11 */
+ 128, /* 100 */
+ 256, /* 101 */
+ 256, /* 110 */
+ 384, /* 111 */
+ 128, /* 1000 */
+ 256, /* 1001 */
+ 256, /* 1010 */
+ 384, /* 1011 */
+ 256, /* 1100 */
+ 384, /* 1101 */
+ 384, /* 1110 */
+ 512, /* 1111 */
+ 128, /* 10000 */
+ 256, /* 10001 */
+ 256, /* 10010 */
+ 384, /* 10011 */
+ 256, /* 10100 */
+ 384, /* 10101 */
+ 384, /* 10110 */
+ 512, /* 10111 */
+ 256, /* 11000 */
+ 384, /* 11001 */
+ 384, /* 11010 */
+ 512, /* 11011 */
+ 384, /* 11100 */
+ 512, /* 11101 */
+ 512, /* 11110 */
+ 640, /* 11111 */
+ 128, /* 100000 */
+ 256, /* 100001 */
+ 256, /* 100010 */
+ 384, /* 100011 */
+ 256, /* 100100 */
+ 384, /* 100101 */
+ 384, /* 100110 */
+ 512, /* 100111 */
+ 256, /* 101000 */
+ 384, /* 101001 */
+ 384, /* 101010 */
+ 512, /* 101011 */
+ 384, /* 101100 */
+ 512, /* 101101 */
+ 512, /* 101110 */
+ 640, /* 101111 */
+ 256, /* 110000 */
+ 384, /* 110001 */
+ 384, /* 110010 */
+ 512, /* 110011 */
+ 384, /* 110100 */
+ 512, /* 110101 */
+ 512, /* 110110 */
+ 640, /* 110111 */
+ 384, /* 111000 */
+ 512, /* 111001 */
+ 512, /* 111010 */
+ 640, /* 111011 */
+ 512, /* 111100 */
+ 640, /* 111101 */
+ 640, /* 111110 */
+ 768 /* 111111 */
+};
+
static int error_base;
static int event_base;
diff --git a/src/xvmc/intel_xvmc.h b/src/xvmc/intel_xvmc.h
index bc863c4..e5e623e 100644
--- a/src/xvmc/intel_xvmc.h
+++ b/src/xvmc/intel_xvmc.h
@@ -249,4 +249,6 @@ static inline const char* intel_xvmc_decoder_string(int flag)
extern intel_xvmc_context_ptr intel_xvmc_find_context(XID id);
extern intel_xvmc_surface_ptr intel_xvmc_find_surface(XID id);
+extern unsigned int mb_bytes_420[64];
+
#endif
commit 3cc8876db7ba82fa18e8fab4f267ac6e87964c47
Author: Zhenyu Wang <zhenyu.z.wang at intel.com>
Date: Tue Jun 3 16:15:36 2008 +0800
xvmc: a little cleanup
Also safe check context size to not exceed surface max.
diff --git a/src/i915_hwmc.c b/src/i915_hwmc.c
index c3d3c75..50e1106 100644
--- a/src/i915_hwmc.c
+++ b/src/i915_hwmc.c
@@ -95,8 +95,6 @@ typedef struct _I915XvMC
PutImageFuncPtr savePutImage;
} I915XvMC, *I915XvMCPtr;
-#define ARRARY_SIZE(a) (sizeof(a) / sizeof(a[0]))
-
/*
static int yv12_subpicture_index_list[2] =
{
@@ -161,6 +159,22 @@ static XF86ImagePtr i915_subpicture_list[2] =
};
#endif
+/* Check context size not exceed surface type max */
+static void
+i915_check_context_size(XvMCContextPtr ctx)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(ppSI); i++) {
+ if (ctx->surface_type_id == ppSI[i]->surface_type_id) {
+ if (ctx->width > ppSI[i]->max_width)
+ ctx->width = ppSI[i]->max_width;
+ if (ctx->height > ppSI[i]->max_height)
+ ctx->height = ppSI[i]->max_height;
+ }
+ }
+}
+
/*
* Init and clean up the screen private parts of XvMC.
*/
@@ -430,6 +444,8 @@ static int i915_xvmc_create_context (ScrnInfoPtr pScrn, XvMCContextPtr pContext,
return BadAlloc;
}
+ i915_check_context_size(pContext);
+
*priv = xcalloc(1, sizeof(I915XvMCCreateContextRec));
contextRec = (I915XvMCCreateContextRec *)*priv;
@@ -776,10 +792,9 @@ static int i915_xvmc_put_image(ScrnInfoPtr pScrn,
struct intel_xvmc_command *xvmc_cmd = (struct intel_xvmc_command *)buf;
int ret;
- if (pI830->XvMCEnabled) {
- if (FOURCC_XVMC == id) {
- switch (xvmc_cmd->command) {
- case INTEL_XVMC_COMMAND_DISPLAY:
+ if (FOURCC_XVMC == id) {
+ switch (xvmc_cmd->command) {
+ case INTEL_XVMC_COMMAND_DISPLAY:
if ((xvmc_cmd->srfNo >= I915_XVMC_MAX_SURFACES) ||
!pXvMC->surfaces[xvmc_cmd->srfNo] ||
!pXvMC->sfprivs[xvmc_cmd->srfNo]) {
@@ -793,10 +808,9 @@ static int i915_xvmc_put_image(ScrnInfoPtr pScrn,
id = xvmc_cmd->real_id;
pI830->IsXvMCSurface = 1;
break;
- default:
- return 0;
- }
- }
+ default:
+ return 0;
+ }
}
ret = pXvMC->savePutImage(pScrn, src_x, src_y, drw_x, drw_y, src_w, src_h,
@@ -850,7 +864,7 @@ static void i915_xvmc_fini(ScrnInfoPtr pScrn)
static XF86MCAdaptorRec pAdapt =
{
.name = "Intel(R) Textured Video",
- .num_surfaces = ARRARY_SIZE(ppSI),
+ .num_surfaces = ARRAY_SIZE(ppSI),
.surfaces = ppSI,
#if 0
.num_subpictures = ARRARY_SIZE(i915_subpicture_list),
diff --git a/src/i915_hwmc.h b/src/i915_hwmc.h
index 0141fb2..7d90afc 100644
--- a/src/i915_hwmc.h
+++ b/src/i915_hwmc.h
@@ -32,7 +32,7 @@
#define STRIDE(w) (((w) + 0x3ff) & ~0x3ff)
#define SIZE_Y420(w, h) (h * STRIDE(w))
#define SIZE_UV420(w, h) ((h >> 1) * STRIDE(w >> 1))
-#define SIZE_YUV420(w, h) (h * (STRIDE(w) + STRIDE(w >> 1)))
+#define SIZE_YUV420(w, h) (SIZE_Y420(w,h) + SIZE_UV420(w,h) * 2)
#define SIZE_XX44(w, h) (h * STRIDE(w))
#define I915_NUM_XVMC_ATTRIBUTES 0x02
diff --git a/src/xvmc/i915_xvmc.c b/src/xvmc/i915_xvmc.c
index f2d8ded..b1a17b4 100644
--- a/src/xvmc/i915_xvmc.c
+++ b/src/xvmc/i915_xvmc.c
@@ -1987,7 +1987,7 @@ static int i915_xvmc_mc_render_surface(Display *display, XvMCContext *context,
XVMC_ERR("Invalid Macroblock Parameters found.");
break;
}
- } else { /* Frame Picture */
+ } else { /* Field Picture */
switch (mb->motion_type & 3) {
case XVMC_PREDICTION_FIELD: /* Field Based */
i915_mc_mpeg_macroblock_1fbmv(context, mb);
@@ -2005,7 +2005,7 @@ static int i915_xvmc_mc_render_surface(Display *display, XvMCContext *context,
XVMC_ERR("Invalid Macroblock Parameters found.");
break;
}
- } /* Field Picture */
+ }
}
intelFlushBatch(TRUE);
commit 96955003557686469c7ae9f7d42620d2851e6fad
Author: Zhenyu Wang <zhenyu.z.wang at intel.com>
Date: Tue Jun 3 16:13:52 2008 +0800
xvmc: remove unused dri drawable
diff --git a/src/xvmc/Makefile.am b/src/xvmc/Makefile.am
index f571743..f2dab22 100644
--- a/src/xvmc/Makefile.am
+++ b/src/xvmc/Makefile.am
@@ -19,9 +19,8 @@ libIntelXvMC_la_SOURCES = intel_xvmc.c \
intel_batchbuffer.h \
xf86dri.c \
xf86dri.h \
- xf86dristr.h \
- driDrawable.c \
- driDrawable.h
+ xf86dristr.h
+
libIntelXvMC_la_CFLAGS = @XORG_CFLAGS@ @DRI_CFLAGS@ @XVMCLIB_CFLAGS@ -I$(top_srcdir)/src -DTRUE=1 -DFALSE=0
libIntelXvMC_la_LDFLAGS = -version-number 1:0:0
libIntelXvMC_la_LIBADD = @DRI_LIBS@
diff --git a/src/xvmc/driDrawable.c b/src/xvmc/driDrawable.c
deleted file mode 100644
index 8386334..0000000
--- a/src/xvmc/driDrawable.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*****************************************************************************
- * driDrawable.c: Lean Version of DRI utilities.
- *
- * Copyright (c) 2005 Thomas Hellstrom. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHOR(S) OR COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-
-#include <X11/Xlibint.h>
-#include <X11/Xutil.h>
-#include "xf86drm.h"
-#include "drm.h"
-#include "xf86dri.h"
-#include "drm_sarea.h"
-#include "driDrawable.h"
-
-static unsigned
-drawStamp(volatile drm_sarea_t * pSarea, int index)
-{
- return pSarea->drawableTable[index].stamp;
-}
-
-int
-getDRIDrawableInfoLocked(void *drawHash, Display * display, int screen,
- Drawable draw, unsigned lockFlags, int drmFD, drm_context_t drmContext,
- drmAddress sarea, Bool updateInfo, drawableInfo ** info,
- unsigned long infoSize)
-{
- drawableInfo *drawInfo;
- void *res;
- drm_drawable_t drmDraw = 0;
- volatile drm_sarea_t *pSarea = (drm_sarea_t *) sarea;
- drm_clip_rect_t *clipFront, *clipBack;
-
- int ret;
-
- if (drmHashLookup(drawHash, (unsigned long)draw, &res)) {
-
- /*
- * The drawable is unknown to us. Create it and put it in the
- * hash table.
- */
-
- DRM_UNLOCK(drmFD, &pSarea->lock, drmContext);
- if (!uniDRICreateDrawable(display, screen, draw, &drmDraw)) {
- DRM_LOCK(drmFD, &pSarea->lock, drmContext, lockFlags);
- return 1;
- }
- DRM_LOCK(drmFD, &pSarea->lock, drmContext, lockFlags);
-
- drawInfo = (drawableInfo *) malloc(infoSize);
- if (!drawInfo)
- return 1;
-
- drawInfo->drmDraw = drmDraw;
- drawInfo->stamp = 0;
- drawInfo->clipFront = 0;
- drawInfo->clipBack = 0;
-
- drmHashInsert(drawHash, (unsigned long)draw, drawInfo);
-
- } else {
- drawInfo = res;
- }
-
- drawInfo->touched = FALSE;
- while (!drawInfo->clipFront
- || drawInfo->stamp != drawStamp(pSarea, drawInfo->index)) {
-
- /*
- * The drawable has been touched since we last got info about it.
- * obtain new info from the X server.
- */
-
- drawInfo->touched = TRUE;
-
- if (updateInfo || !drawInfo->clipFront) {
- DRM_UNLOCK(drmFD, &pSarea->lock, drmContext);
-
- ret = uniDRIGetDrawableInfo(display, screen, draw,
- &drawInfo->index, &drawInfo->stamp, &drawInfo->x,
- &drawInfo->y, &drawInfo->w, &drawInfo->h,
- &drawInfo->numClipFront, &clipFront,
- &drawInfo->backX, &drawInfo->backY,
- &drawInfo->numClipBack, &clipBack);
-
- DRM_LIGHT_LOCK(drmFD, &pSarea->lock, drmContext);
-
- /*
- * Error. Probably the drawable is destroyed. Return error and old values.
- */
-
- if (!ret) {
- free(drawInfo);
- drawInfo = NULL;
- drmHashDelete(drawHash, (unsigned long)draw);
-
- DRM_UNLOCK(drmFD, &pSarea->lock, drmContext);
- uniDRIDestroyDrawable(display, screen, draw);
- DRM_LOCK(drmFD, &pSarea->lock, drmContext, lockFlags);
-
- return 1;
- }
-
- if (drawInfo->stamp != drawStamp(pSarea, drawInfo->index)) {
-
- /*
- * The info is already outdated. Sigh. Have another go.
- */
-
- XFree(clipFront);
- XFree(clipBack);
- continue;
- }
-
- if (drawInfo->clipFront)
- XFree(drawInfo->clipFront);
- drawInfo->clipFront = clipFront;
- if (drawInfo->clipBack)
- XFree(drawInfo->clipBack);
- drawInfo->clipBack = clipBack;
- } else {
- if (!drawInfo->clipFront)
- drawInfo->clipFront = (drm_clip_rect_t *) ~ 0UL;
- drawInfo->stamp = drawStamp(pSarea, drawInfo->index);
- }
- }
- *info = drawInfo;
- return 0;
-}
-
-void
-driDestroyHashContents(void *drawHash)
-{
- unsigned long key;
- void *content;
- drawableInfo *drawInfo;
-
- if (drmHashFirst(drawHash, &key, &content) < 1)
- return;
- drawInfo = (drawableInfo *) content;
- if (drawInfo->clipBack)
- XFree(drawInfo->clipBack);
- if (drawInfo->clipFront)
- XFree(drawInfo->clipFront);
- free(drawInfo);
- while (drmHashNext(drawHash, &key, &content) == 1) {
- drawInfo = (drawableInfo *) content;
- if (drawInfo->clipBack)
- XFree(drawInfo->clipBack);
- if (drawInfo->clipFront)
- XFree(drawInfo->clipFront);
- free(drawInfo);
- }
-
- return;
-}
diff --git a/src/xvmc/driDrawable.h b/src/xvmc/driDrawable.h
deleted file mode 100644
index a758c7c..0000000
--- a/src/xvmc/driDrawable.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*****************************************************************************
- * driDrawable.h: Lean Version of DRI utilities.
- *
- * Copyright (c) 2005 Thomas Hellstrom. All rights reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHOR(S) OR COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef _DRIDRAWABLE_H
-#define _DRIDRAWABLE_H
-
-typedef struct _drawableInfo
-{
- drm_drawable_t drmDraw;
- unsigned stamp;
- unsigned index;
- drm_clip_rect_t *clipFront;
- drm_clip_rect_t *clipBack;
- int x;
- int y;
- int w;
- int h;
- int backX;
- int backY;
- int numClipFront;
- int numClipBack;
- Bool touched;
-} drawableInfo;
-
-/*
- * Get updated info about the drawable "draw". The drawableInfo record returned is malloced
- * and administrated internally. Never free it unless you know exactly what you are doing.
- * The drm hash table "drawHash" needs to be initialized externally.
- */
-
-extern int
-getDRIDrawableInfoLocked(void *drawHash, Display * display, int screen,
- Drawable draw, unsigned lockFlags, int drmFD, drm_context_t drmContext,
- drmAddress sarea, Bool updateInfo, drawableInfo ** info,
- unsigned long infoSize);
-
-/*
- * Free all resources created by the above function. Typically done on exit.
- */
-
-extern void driDestroyHashContents(void *drawHash);
-
-#endif
diff --git a/src/xvmc/i915_xvmc.c b/src/xvmc/i915_xvmc.c
index 20b2e61..f2d8ded 100644
--- a/src/xvmc/i915_xvmc.c
+++ b/src/xvmc/i915_xvmc.c
@@ -1608,9 +1608,6 @@ static void i915_release_resource(Display *display, XvMCContext *context)
pI915XvMC->ref--;
i915_xvmc_unmap_buffers(pI915XvMC);
- driDestroyHashContents(pI915XvMC->drawHash);
- drmHashDestroy(pI915XvMC->drawHash);
-
free(pI915XvMC);
context->privData = NULL;
}
@@ -1683,13 +1680,6 @@ static Status i915_xvmc_mc_create_context(Display *display, XvMCContext *context
pSAREA = (drm_sarea_t *)xvmc_driver->sarea_address;
pI915XvMC->sarea = (drmI830Sarea*)((char*)pSAREA + pI915XvMC->sarea_priv_offset);
- if (NULL == (pI915XvMC->drawHash = drmHashCreate())) {
- XVMC_ERR("Could not allocate drawable hash table.");
- free(pI915XvMC);
- context->privData = NULL;
- return BadAlloc;
- }
-
if (i915_xvmc_map_buffers(pI915XvMC)) {
i915_xvmc_unmap_buffers(pI915XvMC);
free(pI915XvMC);
diff --git a/src/xvmc/intel_xvmc.h b/src/xvmc/intel_xvmc.h
index 5506683..bc863c4 100644
--- a/src/xvmc/intel_xvmc.h
+++ b/src/xvmc/intel_xvmc.h
@@ -53,7 +53,6 @@
#include <drm_sarea.h>
#include "xf86dri.h"
-#include "driDrawable.h"
#include "intel_batchbuffer.h"
More information about the xorg-commit
mailing list