summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYounes Manton <[email protected]>2010-03-05 23:14:49 -0500
committerYounes Manton <[email protected]>2010-03-05 23:14:49 -0500
commit8580b7a0eeed3fc29320b2c0a184084e4267661a (patch)
tree4b7b4174cea14256e85412309e056adcca67aa73 /src
parent40cd082afa42c86e320f73389f3d0836587f97d9 (diff)
vl: Add some basic debug output for XvMC.
Set the XVMC_DEBUG env var to: 0 for no extra output 1 for error output 2 for warning output 3 for tracing output
Diffstat (limited to 'src')
-rw-r--r--src/gallium/state_trackers/xorg/xvmc/context.c47
-rw-r--r--src/gallium/state_trackers/xorg/xvmc/subpicture.c9
-rw-r--r--src/gallium/state_trackers/xorg/xvmc/surface.c32
-rw-r--r--src/gallium/state_trackers/xorg/xvmc/xvmc_private.h23
4 files changed, 100 insertions, 11 deletions
diff --git a/src/gallium/state_trackers/xorg/xvmc/context.c b/src/gallium/state_trackers/xorg/xvmc/context.c
index 56003618ada..d56d61c79c6 100644
--- a/src/gallium/state_trackers/xorg/xvmc/context.c
+++ b/src/gallium/state_trackers/xorg/xvmc/context.c
@@ -34,7 +34,6 @@
#include <pipe/p_state.h>
#include <vl_winsys.h>
#include <util/u_memory.h>
-#include <util/u_debug.h>
#include <vl/vl_csc.h>
#include "xvmc_private.h"
@@ -90,6 +89,15 @@ static Status Validate(Display *dpy, XvPortID port, int surface_type_id,
*mc_type = surface_info[l].mc_type;
*surface_flags = surface_info[l].flags;
*screen = i;
+
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Found suitable context surface format.\n" \
+ "[XvMC] screen=%u, port=%u\n" \
+ "[XvMC] id: 0x%08X\n" \
+ "[XvMC] max width=%u, max height=%u\n" \
+ "[XvMC] chroma format=0x%08X\n" \
+ "[XvMC] acceleration level=0x%08X\n" \
+ "[XvMC] flags=0x%08X\n",
+ i, port, surface_type_id, max_width, max_height, *chroma_format, *mc_type, *surface_flags);
}
XFree(surface_info);
@@ -99,14 +107,23 @@ static Status Validate(Display *dpy, XvPortID port, int surface_type_id,
XvFreeAdaptorInfo(adaptor_info);
}
- if (!*found_port)
+ if (!*found_port) {
+ XVMC_MSG(XVMC_ERR, "[XvMC] Could not find a suitable port.\n");
return XvBadPort;
- if (!found_surface)
+ }
+ if (!found_surface) {
+ XVMC_MSG(XVMC_ERR, "[XvMC] Could not find a suitable surface.\n");
return BadMatch;
- if (width > max_width || height > max_height)
+ }
+ if (width > max_width || height > max_height) {
+ XVMC_MSG(XVMC_ERR, "[XvMC] Requested context dimensions (w=%u,h=%u) too large (max w=%u,h=%u).\n",
+ width, height, max_width, max_height);
return BadValue;
- if (flags != XVMC_DIRECT && flags != 0)
+ }
+ if (flags != XVMC_DIRECT && flags != 0) {
+ XVMC_MSG(XVMC_ERR, "[XvMC] Invalid context flags 0x%08X.\n", flags);
return BadValue;
+ }
return Success;
}
@@ -124,6 +141,8 @@ static enum pipe_video_profile ProfileToPipe(int xvmc_profile)
assert(0);
+ XVMC_MSG(XVMC_ERR, "[XvMC] Unrecognized profile 0x%08X.\n", xvmc_profile);
+
return -1;
}
@@ -140,6 +159,8 @@ static enum pipe_video_chroma_format FormatToPipe(int xvmc_format)
assert(0);
}
+ XVMC_MSG(XVMC_ERR, "[XvMC] Unrecognized format 0x%08X.\n", xvmc_format);
+
return -1;
}
@@ -157,6 +178,8 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
XvMCContextPrivate *context_priv;
float csc[16];
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Creating context %p.\n", context);
+
assert(dpy);
if (!context)
@@ -171,15 +194,15 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
/* XXX: Current limits */
if (chroma_format != XVMC_CHROMA_FORMAT_420) {
- debug_printf("[XvMCg3dvl] Cannot decode requested surface type. Unsupported chroma format.\n");
+ XVMC_MSG(XVMC_ERR, "[XvMC] Cannot decode requested surface type. Unsupported chroma format.\n");
return BadImplementation;
}
if (mc_type != (XVMC_MOCOMP | XVMC_MPEG_2)) {
- debug_printf("[XvMCg3dvl] Cannot decode requested surface type. Non-MPEG2/Mocomp acceleration unsupported.\n");
+ XVMC_MSG(XVMC_ERR, "[XvMC] Cannot decode requested surface type. Non-MPEG2/Mocomp acceleration unsupported.\n");
return BadImplementation;
}
if (!(surface_flags & XVMC_INTRA_UNSIGNED)) {
- debug_printf("[XvMCg3dvl] Cannot decode requested surface type. Signed intra unsupported.\n");
+ XVMC_MSG(XVMC_ERR, "[XvMC] Cannot decode requested surface type. Signed intra unsupported.\n");
return BadImplementation;
}
@@ -191,6 +214,7 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
vscreen = vl_screen_create(dpy, scrn);
if (!vscreen) {
+ XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL screen.\n");
FREE(context_priv);
return BadAlloc;
}
@@ -199,6 +223,7 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
FormatToPipe(chroma_format), width, height);
if (!vctx) {
+ XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL context.\n");
vl_screen_destroy(vscreen);
FREE(context_priv);
return BadAlloc;
@@ -225,6 +250,8 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id,
SyncHandle();
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Context %p created.\n", context);
+
return Success;
}
@@ -234,6 +261,8 @@ Status XvMCDestroyContext(Display *dpy, XvMCContext *context)
struct vl_context *vctx;
XvMCContextPrivate *context_priv;
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Destroying context %p.\n", context);
+
assert(dpy);
if (!context || !context->privData)
@@ -248,5 +277,7 @@ Status XvMCDestroyContext(Display *dpy, XvMCContext *context)
FREE(context_priv);
context->privData = NULL;
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Context %p destroyed.\n", context);
+
return Success;
}
diff --git a/src/gallium/state_trackers/xorg/xvmc/subpicture.c b/src/gallium/state_trackers/xorg/xvmc/subpicture.c
index 7f10f366d21..d64d075f330 100644
--- a/src/gallium/state_trackers/xorg/xvmc/subpicture.c
+++ b/src/gallium/state_trackers/xorg/xvmc/subpicture.c
@@ -47,6 +47,8 @@ Status XvMCCreateSubpicture(Display *dpy, XvMCContext *context, XvMCSubpicture *
struct pipe_texture template;
struct pipe_texture *tex;
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Creating subpicture %p.\n", subpicture);
+
assert(dpy);
if (!context)
@@ -58,6 +60,7 @@ Status XvMCCreateSubpicture(Display *dpy, XvMCContext *context, XvMCSubpicture *
if (!subpicture)
return XvMCBadSubpicture;
+ /* TODO: Check against surface max width, height */
if (width > 2048 || height > 2048)
return BadValue;
@@ -109,6 +112,8 @@ Status XvMCCreateSubpicture(Display *dpy, XvMCContext *context, XvMCSubpicture *
SyncHandle();
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Subpicture %p created.\n", subpicture);
+
return Success;
}
@@ -155,6 +160,8 @@ Status XvMCDestroySubpicture(Display *dpy, XvMCSubpicture *subpicture)
{
XvMCSubPicturePrivate *subpicture_priv;
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Destroying subpicture %p.\n", subpicture);
+
assert(dpy);
if (!subpicture)
@@ -164,6 +171,8 @@ Status XvMCDestroySubpicture(Display *dpy, XvMCSubpicture *subpicture)
pipe_surface_reference(&subpicture_priv->sfc, NULL);
FREE(subpicture_priv);
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Subpicture %p destroyed.\n", subpicture);
+
return Success;
}
diff --git a/src/gallium/state_trackers/xorg/xvmc/surface.c b/src/gallium/state_trackers/xorg/xvmc/surface.c
index f640b1464f4..79dae3fb8b7 100644
--- a/src/gallium/state_trackers/xorg/xvmc/surface.c
+++ b/src/gallium/state_trackers/xorg/xvmc/surface.c
@@ -48,6 +48,8 @@ static enum pipe_mpeg12_macroblock_type TypeToPipe(int xvmc_mb_type)
assert(0);
+ XVMC_MSG(XVMC_ERR, "[XvMC] Unrecognized mb type 0x%08X.\n", xvmc_mb_type);
+
return -1;
}
@@ -64,6 +66,8 @@ static enum pipe_mpeg12_picture_type PictureToPipe(int xvmc_pic)
assert(0);
}
+ XVMC_MSG(XVMC_ERR, "[XvMC] Unrecognized picture type 0x%08X.\n", xvmc_pic);
+
return -1;
}
@@ -71,8 +75,11 @@ static enum pipe_mpeg12_motion_type MotionToPipe(int xvmc_motion_type, int xvmc_
{
switch (xvmc_motion_type) {
case XVMC_PREDICTION_FRAME:
- return xvmc_dct_type == XVMC_DCT_TYPE_FIELD ?
- PIPE_MPEG12_MOTION_TYPE_16x8 : PIPE_MPEG12_MOTION_TYPE_FRAME;
+ if (xvmc_dct_type == XVMC_DCT_TYPE_FIELD)
+ return PIPE_MPEG12_MOTION_TYPE_16x8;
+ else if (xvmc_dct_type == XVMC_DCT_TYPE_FRAME)
+ return PIPE_MPEG12_MOTION_TYPE_FRAME;
+ break;
case XVMC_PREDICTION_FIELD:
return PIPE_MPEG12_MOTION_TYPE_FIELD;
case XVMC_PREDICTION_DUAL_PRIME:
@@ -81,6 +88,8 @@ static enum pipe_mpeg12_motion_type MotionToPipe(int xvmc_motion_type, int xvmc_
assert(0);
}
+ XVMC_MSG(XVMC_ERR, "[XvMC] Unrecognized motion type 0x%08X (with DCT type 0x%08X).\n", xvmc_motion_type, xvmc_dct_type);
+
return -1;
}
@@ -183,6 +192,8 @@ Status XvMCCreateSurface(Display *dpy, XvMCContext *context, XvMCSurface *surfac
XvMCSurfacePrivate *surface_priv;
struct pipe_video_surface *vsfc;
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Creating surface %p.\n", surface);
+
assert(dpy);
if (!context)
@@ -197,6 +208,7 @@ Status XvMCCreateSurface(Display *dpy, XvMCContext *context, XvMCSurface *surfac
if (!surface_priv)
return BadAlloc;
+ assert(vpipe->screen->video_surface_create);
vsfc = vpipe->screen->video_surface_create(vpipe->screen, vpipe->chroma_format,
vpipe->width, vpipe->height);
if (!vsfc) {
@@ -216,6 +228,8 @@ Status XvMCCreateSurface(Display *dpy, XvMCContext *context, XvMCSurface *surfac
SyncHandle();
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Surface %p created.\n", surface);
+
return Success;
}
@@ -236,6 +250,8 @@ Status XvMCRenderSurface(Display *dpy, XvMCContext *context, unsigned int pictur
struct pipe_mpeg12_macroblock pipe_macroblocks[num_macroblocks];
unsigned int i;
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Rendering to surface %p.\n", target_surface);
+
assert(dpy);
if (!context || !context->privData)
@@ -288,6 +304,8 @@ Status XvMCRenderSurface(Display *dpy, XvMCContext *context, unsigned int pictur
for (i = 0; i < num_macroblocks; ++i)
vpipe->screen->buffer_destroy(pipe_macroblocks[i].blocks);
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Submitted surface %p for rendering.\n", target_surface);
+
return Success;
}
@@ -328,6 +346,8 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
struct pipe_video_rect src_rect = {srcx, srcy, srcw, srch};
struct pipe_video_rect dst_rect = {destx, desty, destw, desth};
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Displaying surface %p.\n", surface);
+
assert(dpy);
if (!surface || !surface->privData)
@@ -363,7 +383,7 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
context_priv->backbuffer, &dst_rect, surface_priv->disp_fence);
vl_video_bind_drawable(context_priv->vctx, drawable);
-
+
vpipe->screen->flush_frontbuffer
(
vpipe->screen,
@@ -371,6 +391,8 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable,
vpipe->priv
);
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Submitted surface %p for display.\n", surface);
+
return Success;
}
@@ -392,6 +414,8 @@ Status XvMCDestroySurface(Display *dpy, XvMCSurface *surface)
{
XvMCSurfacePrivate *surface_priv;
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Destroying surface %p.\n", surface);
+
assert(dpy);
if (!surface || !surface->privData)
@@ -402,6 +426,8 @@ Status XvMCDestroySurface(Display *dpy, XvMCSurface *surface)
FREE(surface_priv);
surface->privData = NULL;
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Surface %p destroyed.\n", surface);
+
return Success;
}
diff --git a/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h b/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h
index 6e1b86304ba..96fe7a9f5e3 100644
--- a/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h
+++ b/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h
@@ -30,6 +30,7 @@
#include <X11/Xlib.h>
#include <X11/extensions/XvMClib.h>
+#include <util/u_debug.h>
#define BLOCK_SIZE_SAMPLES 64
#define BLOCK_SIZE_BYTES (BLOCK_SIZE_SAMPLES * 2)
@@ -63,4 +64,26 @@ typedef struct
XvMCContext *context;
} XvMCSubPicturePrivate;
+#define XVMC_OUT 0
+#define XVMC_ERR 1
+#define XVMC_WARN 2
+#define XVMC_TRACE 3
+static INLINE void XVMC_MSG(unsigned int level, const char *fmt, ...)
+{
+ static boolean check_dbg_level = TRUE;
+ static unsigned int debug_level;
+
+ if (check_dbg_level) {
+ debug_level = debug_get_num_option("XVMC_DEBUG", 0);
+ check_dbg_level = FALSE;
+ }
+
+ if (level <= debug_level) {
+ va_list ap;
+ va_start(ap, fmt);
+ _debug_vprintf(fmt, ap);
+ va_end(ap);
+ }
+}
+
#endif /* xvmc_private_h */