**************************************************************************/
#include <assert.h>
+
#include <X11/Xlibint.h>
#include <X11/extensions/XvMClib.h>
-#include <pipe/p_screen.h>
-#include <pipe/p_video_context.h>
-#include <pipe/p_video_state.h>
-#include <pipe/p_state.h>
-#include <vl_winsys.h>
-#include <util/u_memory.h>
-#include <vl/vl_csc.h>
+
+#include "pipe/p_screen.h"
+#include "pipe/p_video_decoder.h"
+#include "pipe/p_video_state.h"
+#include "pipe/p_state.h"
+
+#include "util/u_memory.h"
+
+#include "vl/vl_csc.h"
+#include "vl_winsys.h"
+
#include "xvmc_private.h"
static Status Validate(Display *dpy, XvPortID port, int surface_type_id,
XvAdaptorInfo *adaptor_info;
unsigned int num_adaptors;
int num_types;
- unsigned int max_width, max_height;
+ unsigned int max_width = 0, max_height = 0;
Status ret;
assert(dpy);
int width, int height, int flags, XvMCContext *context)
{
bool found_port;
- int scrn;
- int chroma_format;
- int mc_type;
- int surface_flags;
- unsigned short subpic_max_w;
- unsigned short subpic_max_h;
+ int scrn = 0;
+ int chroma_format = 0;
+ int mc_type = 0;
+ int surface_flags = 0;
+ unsigned short subpic_max_w = 0;
+ unsigned short subpic_max_h = 0;
Status ret;
struct vl_screen *vscreen;
struct vl_context *vctx;
XVMC_MSG(XVMC_ERR, "[XvMC] Cannot decode requested surface type. Unsupported chroma format.\n");
return BadImplementation;
}
- if (mc_type != (XVMC_MOCOMP | XVMC_MPEG_2)) {
- XVMC_MSG(XVMC_ERR, "[XvMC] Cannot decode requested surface type. Non-MPEG2/Mocomp acceleration unsupported.\n");
+ if ((mc_type & ~XVMC_IDCT) != (XVMC_MOCOMP | XVMC_MPEG_2)) {
+ XVMC_MSG(XVMC_ERR, "[XvMC] Cannot decode requested surface type. Non-MPEG2/Mocomp/iDCT acceleration unsupported.\n");
return BadImplementation;
}
- if (!(surface_flags & XVMC_INTRA_UNSIGNED)) {
- XVMC_MSG(XVMC_ERR, "[XvMC] Cannot decode requested surface type. Signed intra unsupported.\n");
+ if (surface_flags & XVMC_INTRA_UNSIGNED) {
+ XVMC_MSG(XVMC_ERR, "[XvMC] Cannot decode requested surface type. Unsigned intra unsupported.\n");
return BadImplementation;
}
return BadAlloc;
}
- vctx = vl_video_create(vscreen, ProfileToPipe(mc_type),
- FormatToPipe(chroma_format), width, height);
-
+ vctx = vl_video_create(vscreen);
if (!vctx) {
XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL context.\n");
vl_screen_destroy(vscreen);
return BadAlloc;
}
- /* TODO: Define some Xv attribs to allow users to specify color standard, procamp */
- vl_csc_get_matrix
+ context_priv->decoder = vctx->pipe->create_video_decoder
(
+ vctx->pipe,
+ ProfileToPipe(mc_type),
+ (mc_type & XVMC_IDCT) ? PIPE_VIDEO_ENTRYPOINT_IDCT : PIPE_VIDEO_ENTRYPOINT_MC,
+ FormatToPipe(chroma_format),
+ width, height
+ );
+
+ if (!context_priv->decoder) {
+ XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL decoder.\n");
+ vl_video_destroy(vctx);
+ vl_screen_destroy(vscreen);
+ FREE(context_priv);
+ return BadAlloc;
+ }
+
+ if (!vl_compositor_init(&context_priv->compositor, vctx->pipe)) {
+ XVMC_MSG(XVMC_ERR, "[XvMC] Could not create VL compositor.\n");
+ context_priv->decoder->destroy(context_priv->decoder);
+ vl_video_destroy(vctx);
+ vl_screen_destroy(vscreen);
+ FREE(context_priv);
+ return BadAlloc;
+ }
+
+ context_priv->color_standard =
debug_get_bool_option("G3DVL_NO_CSC", FALSE) ?
- VL_CSC_COLOR_STANDARD_IDENTITY : VL_CSC_COLOR_STANDARD_BT_601,
- NULL, true, csc
+ VL_CSC_COLOR_STANDARD_IDENTITY : VL_CSC_COLOR_STANDARD_BT_601;
+ context_priv->procamp = vl_default_procamp;
+
+ vl_csc_get_matrix
+ (
+ context_priv->color_standard,
+ &context_priv->procamp, true, csc
);
- vctx->vpipe->set_csc_matrix(vctx->vpipe, csc);
+ vl_compositor_set_csc_matrix(&context_priv->compositor, csc);
context_priv->vctx = vctx;
context_priv->subpicture_max_width = subpic_max_w;
context_priv = context->privData;
vctx = context_priv->vctx;
- pipe_surface_reference(&context_priv->backbuffer, NULL);
vscreen = vctx->vscreen;
+ pipe_surface_reference(&context_priv->drawable_surface, NULL);
+ context_priv->decoder->destroy(context_priv->decoder);
+ vl_compositor_cleanup(&context_priv->compositor);
vl_video_destroy(vctx);
vl_screen_destroy(vscreen);
FREE(context_priv);