#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"
*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);
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;
}
assert(0);
+ XVMC_MSG(XVMC_ERR, "[XvMC] Unrecognized profile 0x%08X.\n", xvmc_profile);
+
return -1;
}
assert(0);
}
+ XVMC_MSG(XVMC_ERR, "[XvMC] Unrecognized format 0x%08X.\n", xvmc_format);
+
return -1;
}
XvMCContextPrivate *context_priv;
float csc[16];
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Creating context %p.\n", context);
+
assert(dpy);
if (!context)
/* 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;
}
vscreen = vl_screen_create(dpy, scrn);
if (!vscreen) {
+ XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL screen.\n");
FREE(context_priv);
return BadAlloc;
}
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;
SyncHandle();
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Context %p created.\n", context);
+
return Success;
}
struct vl_context *vctx;
XvMCContextPrivate *context_priv;
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Destroying context %p.\n", context);
+
assert(dpy);
if (!context || !context->privData)
FREE(context_priv);
context->privData = NULL;
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Context %p destroyed.\n", context);
+
return Success;
}
struct pipe_texture template;
struct pipe_texture *tex;
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Creating subpicture %p.\n", subpicture);
+
assert(dpy);
if (!context)
if (!subpicture)
return XvMCBadSubpicture;
+ /* TODO: Check against surface max width, height */
if (width > 2048 || height > 2048)
return BadValue;
SyncHandle();
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Subpicture %p created.\n", subpicture);
+
return Success;
}
{
XvMCSubPicturePrivate *subpicture_priv;
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Destroying subpicture %p.\n", subpicture);
+
assert(dpy);
if (!subpicture)
pipe_surface_reference(&subpicture_priv->sfc, NULL);
FREE(subpicture_priv);
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Subpicture %p destroyed.\n", subpicture);
+
return Success;
}
assert(0);
+ XVMC_MSG(XVMC_ERR, "[XvMC] Unrecognized mb type 0x%08X.\n", xvmc_mb_type);
+
return -1;
}
assert(0);
}
+ XVMC_MSG(XVMC_ERR, "[XvMC] Unrecognized picture type 0x%08X.\n", xvmc_pic);
+
return -1;
}
{
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:
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;
}
XvMCSurfacePrivate *surface_priv;
struct pipe_video_surface *vsfc;
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Creating surface %p.\n", surface);
+
assert(dpy);
if (!context)
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) {
SyncHandle();
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Surface %p created.\n", surface);
+
return Success;
}
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)
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;
}
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)
context_priv->backbuffer, &dst_rect, surface_priv->disp_fence);
vl_video_bind_drawable(context_priv->vctx, drawable);
-
+
vpipe->screen->flush_frontbuffer
(
vpipe->screen,
vpipe->priv
);
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Submitted surface %p for display.\n", surface);
+
return Success;
}
{
XvMCSurfacePrivate *surface_priv;
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Destroying surface %p.\n", surface);
+
assert(dpy);
if (!surface || !surface->privData)
FREE(surface_priv);
surface->privData = NULL;
+ XVMC_MSG(XVMC_TRACE, "[XvMC] Surface %p destroyed.\n", surface);
+
return Success;
}
#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)
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 */