summaryrefslogtreecommitdiffstats
path: root/src/libXvMC
diff options
context:
space:
mode:
Diffstat (limited to 'src/libXvMC')
-rw-r--r--src/libXvMC/block.c47
-rw-r--r--src/libXvMC/context.c194
-rw-r--r--src/libXvMC/surface.c403
3 files changed, 267 insertions, 377 deletions
diff --git a/src/libXvMC/block.c b/src/libXvMC/block.c
index deca305bdcf..328b035576b 100644
--- a/src/libXvMC/block.c
+++ b/src/libXvMC/block.c
@@ -2,83 +2,78 @@
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/extensions/XvMC.h>
+#include <vl_display.h>
+#include <vl_screen.h>
#include <vl_context.h>
-/*
- * XvMC defines 64 element blocks (8x8 elements).
- * Elements are 8 bits when they represent color values,
- * 9 bits when they reprecent DCT coefficients, we
- * store them in 2 bytes in either case.
- */
#define BLOCK_SIZE (64 * 2)
Status XvMCCreateBlocks(Display *display, XvMCContext *context, unsigned int num_blocks, XvMCBlockArray *blocks)
{
- struct vl_context *vl_ctx;
-
+ struct vlContext *vl_ctx;
+
assert(display);
-
+
if (!context)
return XvMCBadContext;
if (num_blocks == 0)
return BadValue;
-
+
assert(blocks);
-
+
vl_ctx = context->privData;
- assert(display == vl_ctx->display);
+ assert(display == vlGetNativeDisplay(vlGetDisplay(vlContextGetScreen(vl_ctx))));
blocks->context_id = context->context_id;
blocks->num_blocks = num_blocks;
blocks->blocks = malloc(BLOCK_SIZE * num_blocks);
/* Since we don't have a VL type for blocks, set privData to the display so we can catch mismatches */
blocks->privData = display;
-
+
return Success;
}
Status XvMCDestroyBlocks(Display *display, XvMCBlockArray *blocks)
-{
+{
assert(display);
assert(blocks);
assert(display == blocks->privData);
free(blocks->blocks);
-
+
return Success;
}
Status XvMCCreateMacroBlocks(Display *display, XvMCContext *context, unsigned int num_blocks, XvMCMacroBlockArray *blocks)
{
- struct vl_context *vl_ctx;
-
+ struct vlContext *vl_ctx;
+
assert(display);
-
+
if (!context)
return XvMCBadContext;
if (num_blocks == 0)
return BadValue;
-
+
assert(blocks);
-
+
vl_ctx = context->privData;
- assert(display == vl_ctx->display);
-
+ assert(display == vlGetNativeDisplay(vlGetDisplay(vlContextGetScreen(vl_ctx))));
+
blocks->context_id = context->context_id;
blocks->num_blocks = num_blocks;
blocks->macro_blocks = malloc(sizeof(XvMCMacroBlock) * num_blocks);
/* Since we don't have a VL type for blocks, set privData to the display so we can catch mismatches */
blocks->privData = display;
-
+
return Success;
}
Status XvMCDestroyMacroBlocks(Display *display, XvMCMacroBlockArray *blocks)
-{
+{
assert(display);
assert(blocks);
assert(display == blocks->privData);
free(blocks->macro_blocks);
-
+
return Success;
}
-
diff --git a/src/libXvMC/context.c b/src/libXvMC/context.c
index 9cf654d6bb2..760e012d1a8 100644
--- a/src/libXvMC/context.c
+++ b/src/libXvMC/context.c
@@ -1,10 +1,23 @@
#include <assert.h>
#include <X11/Xlib.h>
#include <X11/extensions/XvMClib.h>
+#include <pipe/p_context.h>
+#include <vl_display.h>
+#include <vl_screen.h>
#include <vl_context.h>
#include <vl_winsys.h>
-static Status Validate(Display *display, XvPortID port, int surface_type_id, unsigned int width, unsigned int height, int flags, int *chroma_format)
+static Status Validate
+(
+ Display *display,
+ XvPortID port,
+ int surface_type_id,
+ unsigned int width,
+ unsigned int height,
+ int flags,
+ int *chroma_format,
+ int *mc_type
+)
{
unsigned int found_port = 0;
unsigned int found_surface = 0;
@@ -14,13 +27,13 @@ static Status Validate(Display *display, XvPortID port, int surface_type_id, uns
unsigned int max_width, max_height;
Status ret;
unsigned int i, j, k;
-
+
assert(display && chroma_format);
-
+
ret = XvQueryAdaptors(display, XDefaultRootWindow(display), &num_adaptors, &adaptor_info);
if (ret != Success)
return ret;
-
+
/* Scan through all adaptors looking for this port and surface */
for (i = 0; i < num_adaptors && !found_port; ++i)
{
@@ -31,10 +44,10 @@ static Status Validate(Display *display, XvPortID port, int surface_type_id, uns
if (adaptor_info[i].base_id + j == port)
{
XvMCSurfaceInfo *surface_info;
-
+
found_port = 1;
surface_info = XvMCListSurfaceTypes(display, adaptor_info[i].base_id, &num_types);
-
+
if (surface_info)
{
for (k = 0; k < num_types && !found_surface; ++k)
@@ -45,9 +58,10 @@ static Status Validate(Display *display, XvPortID port, int surface_type_id, uns
max_width = surface_info[k].max_width;
max_height = surface_info[k].max_height;
*chroma_format = surface_info[k].chroma_format;
+ *mc_type = surface_info[k].mc_type;
}
}
-
+
XFree(surface_info);
}
else
@@ -58,9 +72,9 @@ static Status Validate(Display *display, XvPortID port, int surface_type_id, uns
}
}
}
-
+
XvFreeAdaptorInfo(adaptor_info);
-
+
if (!found_port)
return XvBadPort;
if (!found_surface)
@@ -69,60 +83,86 @@ static Status Validate(Display *display, XvPortID port, int surface_type_id, uns
return BadValue;
if (flags != XVMC_DIRECT && flags != 0)
return BadValue;
-
+
return Success;
}
-static enum VL_FORMAT FormatToVL(int xvmc_format)
+static enum vlProfile ProfileToVL(int xvmc_profile)
+{
+ if (xvmc_profile & XVMC_MPEG_1)
+ assert(0);
+ else if (xvmc_profile & XVMC_MPEG_2)
+ return vlProfileMpeg2Main;
+ else if (xvmc_profile & XVMC_H263)
+ assert(0);
+ else if (xvmc_profile & XVMC_MPEG_4)
+ assert(0);
+ else
+ assert(0);
+
+ return -1;
+}
+
+static enum vlEntryPoint EntryToVL(int xvmc_entry)
+{
+ return xvmc_entry & XVMC_IDCT ? vlEntryPointIDCT : vlEntryPointMC;
+}
+
+static enum vlFormat FormatToVL(int xvmc_format)
{
- enum VL_FORMAT vl_format;
-
switch (xvmc_format)
{
case XVMC_CHROMA_FORMAT_420:
- {
- vl_format = VL_FORMAT_YCBCR_420;
- break;
- }
+ return vlFormatYCbCr420;
case XVMC_CHROMA_FORMAT_422:
- {
- vl_format = VL_FORMAT_YCBCR_422;
- break;
- }
+ return vlFormatYCbCr422;
case XVMC_CHROMA_FORMAT_444:
- {
- vl_format = VL_FORMAT_YCBCR_444;
- break;
- }
+ return vlFormatYCbCr444;
default:
assert(0);
}
-
- return vl_format;
+
+ return -1;
}
Status XvMCCreateContext(Display *display, XvPortID port, int surface_type_id, int width, int height, int flags, XvMCContext *context)
{
int chroma_format;
+ int mc_type;
Status ret;
- struct VL_CONTEXT *vl_ctx;
+ struct vlDisplay *vl_dpy;
+ struct vlScreen *vl_scrn;
+ struct vlContext *vl_ctx;
struct pipe_context *pipe;
-
+
assert(display);
-
+
if (!context)
return XvMCBadContext;
-
- ret = Validate(display, port, surface_type_id, width, height, flags, &chroma_format);
+
+ ret = Validate(display, port, surface_type_id, width, height, flags, &chroma_format, &mc_type);
if (ret != Success)
return ret;
-
+
+ /* XXX: Assumes default screen, should check which screen port is on */
pipe = create_pipe_context(display, XDefaultScreen(display));
-
+
assert(pipe);
-
- vlCreateContext(display, pipe, width, height, FormatToVL(chroma_format), &vl_ctx);
-
+
+ vlCreateDisplay(display, &vl_dpy);
+ vlCreateScreen(vl_dpy, XDefaultScreen(display), pipe->screen, &vl_scrn);
+ vlCreateContext
+ (
+ vl_scrn,
+ pipe,
+ width,
+ height,
+ FormatToVL(chroma_format),
+ ProfileToVL(mc_type),
+ EntryToVL(mc_type),
+ &vl_ctx
+ );
+
context->context_id = XAllocID(display);
context->surface_type_id = surface_type_id;
context->width = width;
@@ -130,89 +170,27 @@ Status XvMCCreateContext(Display *display, XvPortID port, int surface_type_id, i
context->flags = flags;
context->port = port;
context->privData = vl_ctx;
-
+
return Success;
}
Status XvMCDestroyContext(Display *display, XvMCContext *context)
{
- struct VL_CONTEXT *vl_ctx;
+ struct vlContext *vl_ctx;
struct pipe_context *pipe;
-
+
assert(display);
-
+
if (!context)
return XvMCBadContext;
-
+
vl_ctx = context->privData;
-
- assert(display == vl_ctx->display);
-
- pipe = vl_ctx->pipe;
- vlDestroyContext(vl_ctx);
- destroy_pipe_context(pipe);
-
- return Success;
-}
-/* XXX: The following are here temporarily, need to be implemented in the DDX driver */
-/* TODO: Figure out which of these need to be in DDX, which are better off in DDX, which can stay */
+ assert(display == vlGetNativeDisplay(vlGetDisplay(vlContextGetScreen(vl_ctx))));
-Bool XvMCQueryExtension(Display *display, int *event_base, int *err_base)
-{
- *event_base = 0;
- *err_base = 0;
-
- return True;
-}
+ pipe = vlGetPipeContext(vl_ctx);
+ vlDestroyContext(vl_ctx);
+ destroy_pipe_context(pipe);
-Status XvMCQueryVersion(Display *display, int *major, int *minor)
-{
- *major = 1;
- *minor = 0;
-
return Success;
}
-
-XvMCSurfaceInfo* XvMCListSurfaceTypes(Display *display, XvPortID port, int *num)
-{
- XvMCSurfaceInfo *surface_info = calloc(1, sizeof(XvMCSurfaceInfo));
-
- *num = 1;
-
- surface_info->chroma_format = XVMC_CHROMA_FORMAT_420;
- surface_info->max_width = 2048;
- surface_info->max_height = 2048;
- surface_info->subpicture_max_width = 2048;
- surface_info->subpicture_max_height = 2048;
- surface_info->mc_type = XVMC_IDCT | XVMC_MPEG_2;
- surface_info->surface_type_id = 123; /* FIXME: XAllocID(display)*/;
- surface_info->flags = XVMC_INTRA_UNSIGNED | XVMC_SUBPICTURE_INDEPENDENT_SCALING | XVMC_BACKEND_SUBPICTURE;
-
- return surface_info;
-}
-
-XvImageFormatValues* XvMCListSubpictureTypes(Display* display, XvPortID port, int surface_type_id, int *count_return)
-{
- XvImageFormatValues *image_formats = calloc(1, sizeof(XvImageFormatValues));
-
- *count_return = 1;
-
- image_formats[0].id = 123;
- image_formats[0].type = XvRGB;
- image_formats[0].byte_order = LSBFirst;
- image_formats[0].bits_per_pixel = 8;
- image_formats[0].format = XvPacked;
- image_formats[0].num_planes = 1;
- image_formats[0].depth = 8;
- image_formats[0].red_mask = 0x0000FF;
- image_formats[0].green_mask = 0x00FF00;
- image_formats[0].blue_mask = 0xFF0000;
- image_formats[0].component_order[0] = 'R';
- image_formats[0].component_order[0] = 'G';
- image_formats[0].component_order[0] = 'B';
- image_formats[0].scanline_order = XvTopToBottom;
-
- return image_formats;
-}
-
diff --git a/src/libXvMC/surface.c b/src/libXvMC/surface.c
index 1c07220e844..038befc297b 100644
--- a/src/libXvMC/surface.c
+++ b/src/libXvMC/surface.c
@@ -1,90 +1,96 @@
#include <assert.h>
#include <X11/Xlib.h>
#include <X11/extensions/XvMC.h>
+#include <vl_display.h>
+#include <vl_screen.h>
#include <vl_context.h>
#include <vl_surface.h>
+#include <vl_types.h>
-static enum VL_PICTURE PictureToVL(int xvmc_pic)
+static enum vlMacroBlockType TypeToVL(int xvmc_mb_type)
+{
+ if (xvmc_mb_type & XVMC_MB_TYPE_INTRA)
+ return vlMacroBlockTypeIntra;
+ if ((xvmc_mb_type & (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD)) == XVMC_MB_TYPE_MOTION_FORWARD)
+ return vlMacroBlockTypeFwdPredicted;
+ if ((xvmc_mb_type & (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD)) == XVMC_MB_TYPE_MOTION_BACKWARD)
+ return vlMacroBlockTypeBkwdPredicted;
+ if ((xvmc_mb_type & (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD)) == (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD))
+ return vlMacroBlockTypeBiPredicted;
+
+ assert(0);
+
+ return -1;
+}
+
+static enum vlPictureType PictureToVL(int xvmc_pic)
{
- enum VL_PICTURE vl_pic;
-
switch (xvmc_pic)
{
case XVMC_TOP_FIELD:
- {
- vl_pic = VL_TOP_FIELD;
- break;
- }
+ return vlPictureTypeTopField;
case XVMC_BOTTOM_FIELD:
- {
- vl_pic = VL_BOTTOM_FIELD;
- break;
- }
+ return vlPictureTypeBottomField;
case XVMC_FRAME_PICTURE:
- {
- vl_pic = VL_FRAME_PICTURE;
- break;
- }
+ return vlPictureTypeFrame;
default:
assert(0);
}
-
- return vl_pic;
+
+ return -1;
}
-static enum VL_MC_TYPE MotionToVL(int xvmc_motion_type)
+static enum vlMotionType MotionToVL(int xvmc_motion_type)
{
- enum VL_MC_TYPE vl_mc_type;
-
switch (xvmc_motion_type)
{
case XVMC_PREDICTION_FRAME:
- {
- vl_mc_type = VL_FRAME_MC;
- break;
- }
+ return vlMotionTypeFrame;
case XVMC_PREDICTION_FIELD:
- {
- vl_mc_type = VL_FIELD_MC;
- break;
- }
+ return vlMotionTypeField;
case XVMC_PREDICTION_DUAL_PRIME:
- {
- vl_mc_type = VL_DUAL_PRIME_MC;
- break;
- }
+ return vlMotionTypeDualPrime;
default:
assert(0);
}
-
- return vl_mc_type;
+
+ return -1;
}
Status XvMCCreateSurface(Display *display, XvMCContext *context, XvMCSurface *surface)
{
- struct VL_CONTEXT *vl_ctx;
- struct VL_SURFACE *vl_sfc;
-
+ struct vlContext *vl_ctx;
+ struct vlSurface *vl_sfc;
+
assert(display);
-
+
if (!context)
return XvMCBadContext;
if (!surface)
return XvMCBadSurface;
-
+
vl_ctx = context->privData;
-
- assert(display == vl_ctx->display);
-
- vlCreateSurface(vl_ctx, &vl_sfc);
-
+
+ assert(display == vlGetNativeDisplay(vlGetDisplay(vlContextGetScreen(vl_ctx))));
+
+ vlCreateSurface
+ (
+ vlContextGetScreen(vl_ctx),
+ context->width,
+ context->height,
+ vlGetPictureFormat(vl_ctx),
+ &vl_sfc
+ );
+
+ vlBindToContext(vl_sfc, vl_ctx);
+
surface->surface_id = XAllocID(display);
surface->context_id = context->context_id;
surface->surface_type_id = context->surface_type_id;
surface->width = context->width;
surface->height = context->height;
surface->privData = vl_sfc;
-
+
return Success;
}
@@ -103,19 +109,21 @@ Status XvMCRenderSurface
XvMCBlockArray *blocks
)
{
- struct VL_CONTEXT *vl_ctx;
- struct VL_SURFACE *target_vl_surface;
- struct VL_SURFACE *past_vl_surface;
- struct VL_SURFACE *future_vl_surface;
- unsigned int i;
-
+ struct vlContext *vl_ctx;
+ struct vlSurface *target_vl_surface;
+ struct vlSurface *past_vl_surface;
+ struct vlSurface *future_vl_surface;
+ struct vlMpeg2MacroBlockBatch batch;
+ struct vlMpeg2MacroBlock vl_macroblocks[num_macroblocks];
+ unsigned int i;
+
assert(display);
-
+
if (!context)
return XvMCBadContext;
if (!target_surface)
return XvMCBadSurface;
-
+
if
(
picture_structure != XVMC_TOP_FIELD &&
@@ -125,178 +133,94 @@ Status XvMCRenderSurface
return BadValue;
if (future_surface && !past_surface)
return BadMatch;
-
+
vl_ctx = context->privData;
-
- assert(display == vl_ctx->display);
-
+
+ assert(display == vlGetNativeDisplay(vlGetDisplay(vlContextGetScreen(vl_ctx))));
+
target_vl_surface = target_surface->privData;
past_vl_surface = past_surface ? past_surface->privData : NULL;
future_vl_surface = future_surface ? future_surface->privData : NULL;
-
- assert(vl_ctx == target_vl_surface->context);
- assert(!past_vl_surface || vl_ctx == past_vl_surface->context);
- assert(!future_vl_surface || vl_ctx == future_vl_surface->context);
-
+
+ assert(context->context_id == target_surface->context_id);
+ assert(!past_surface || context->context_id == past_surface->context_id);
+ assert(!future_surface || context->context_id == future_surface->context_id);
+
assert(macroblocks);
assert(blocks);
-
+
assert(macroblocks->context_id == context->context_id);
assert(blocks->context_id == context->context_id);
-
+
assert(flags == 0 || flags == XVMC_SECOND_FIELD);
-
- /* TODO: Batch macroblocks by type (I,P,B) */
-
- for (i = first_macroblock; i < first_macroblock + num_macroblocks; ++i)
- if (macroblocks->macro_blocks[i].macroblock_type & XVMC_MB_TYPE_INTRA)
- vlRenderIMacroBlock
- (
- PictureToVL(picture_structure),
- flags == XVMC_SECOND_FIELD ? VL_FIELD_SECOND : VL_FIELD_FIRST,
- macroblocks->macro_blocks[i].x,
- macroblocks->macro_blocks[i].y,
- macroblocks->macro_blocks[i].coded_block_pattern,
- macroblocks->macro_blocks[i].dct_type == XVMC_DCT_TYPE_FIELD ? VL_DCT_FIELD_CODED : VL_DCT_FRAME_CODED,
- blocks->blocks + (macroblocks->macro_blocks[i].index * 64),
- target_vl_surface
- );
- else if
- (
- (macroblocks->macro_blocks[i].macroblock_type & (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD))
- == XVMC_MB_TYPE_MOTION_FORWARD
- )
- {
- struct VL_MOTION_VECTOR motion_vector =
- {
- {
- macroblocks->macro_blocks[i].PMV[0][0][0],
- macroblocks->macro_blocks[i].PMV[0][0][1],
- },
- {
- macroblocks->macro_blocks[i].PMV[1][0][0],
- macroblocks->macro_blocks[i].PMV[1][0][1],
- }
- };
-
- vlRenderPMacroBlock
- (
- PictureToVL(picture_structure),
- flags == XVMC_SECOND_FIELD ? VL_FIELD_SECOND : VL_FIELD_FIRST,
- macroblocks->macro_blocks[i].x,
- macroblocks->macro_blocks[i].y,
- MotionToVL(macroblocks->macro_blocks[i].motion_type),
- &motion_vector,
- macroblocks->macro_blocks[i].coded_block_pattern,
- macroblocks->macro_blocks[i].dct_type == XVMC_DCT_TYPE_FIELD ? VL_DCT_FIELD_CODED : VL_DCT_FRAME_CODED,
- blocks->blocks + (macroblocks->macro_blocks[i].index * 64),
- past_vl_surface,
- target_vl_surface
- );
- }
- else if
- (
- (macroblocks->macro_blocks[i].macroblock_type & (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD))
- == XVMC_MB_TYPE_MOTION_BACKWARD
- )
- {
- struct VL_MOTION_VECTOR motion_vector =
- {
- {
- macroblocks->macro_blocks[i].PMV[0][1][0],
- macroblocks->macro_blocks[i].PMV[0][1][1],
- },
- {
- macroblocks->macro_blocks[i].PMV[1][1][0],
- macroblocks->macro_blocks[i].PMV[1][1][1],
- }
- };
-
- vlRenderPMacroBlock
- (
- PictureToVL(picture_structure),
- flags == XVMC_SECOND_FIELD ? VL_FIELD_SECOND : VL_FIELD_FIRST,
- macroblocks->macro_blocks[i].x,
- macroblocks->macro_blocks[i].y,
- MotionToVL(macroblocks->macro_blocks[i].motion_type),
- &motion_vector,
- macroblocks->macro_blocks[i].coded_block_pattern,
- macroblocks->macro_blocks[i].dct_type == XVMC_DCT_TYPE_FIELD ? VL_DCT_FIELD_CODED : VL_DCT_FRAME_CODED,
- blocks->blocks + (macroblocks->macro_blocks[i].index * 64),
- future_vl_surface,
- target_vl_surface
- );
- }
- else if
- (
- (macroblocks->macro_blocks[i].macroblock_type & (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD))
- == (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD)
- )
- {
- struct VL_MOTION_VECTOR motion_vector[2] =
- {
- {
- {
- macroblocks->macro_blocks[i].PMV[0][0][0],
- macroblocks->macro_blocks[i].PMV[0][0][1],
- },
- {
- macroblocks->macro_blocks[i].PMV[1][0][0],
- macroblocks->macro_blocks[i].PMV[1][0][1],
- }
- },
- {
- {
- macroblocks->macro_blocks[i].PMV[0][1][0],
- macroblocks->macro_blocks[i].PMV[0][1][1],
- },
- {
- macroblocks->macro_blocks[i].PMV[1][1][0],
- macroblocks->macro_blocks[i].PMV[1][1][1],
- }
- }
- };
-
- vlRenderBMacroBlock
- (
- PictureToVL(picture_structure),
- flags == XVMC_SECOND_FIELD ? VL_FIELD_SECOND : VL_FIELD_FIRST,
- macroblocks->macro_blocks[i].x,
- macroblocks->macro_blocks[i].y,
- MotionToVL(macroblocks->macro_blocks[i].motion_type),
- motion_vector,
- macroblocks->macro_blocks[i].coded_block_pattern,
- macroblocks->macro_blocks[i].dct_type == XVMC_DCT_TYPE_FIELD ? VL_DCT_FIELD_CODED : VL_DCT_FRAME_CODED,
- blocks->blocks + (macroblocks->macro_blocks[i].index * 64),
- past_vl_surface,
- future_vl_surface,
- target_vl_surface
- );
- }
- else
- fprintf(stderr, "Unrecognized macroblock\n");
-
+
+ batch.past_surface = past_vl_surface;
+ batch.future_surface = future_vl_surface;
+ batch.picture_type = PictureToVL(picture_structure);
+ batch.field_order = flags & XVMC_SECOND_FIELD ? vlFieldOrderSecond : vlFieldOrderFirst;
+ batch.num_macroblocks = num_macroblocks;
+ batch.macroblocks = vl_macroblocks;
+
+ for (i = 0; i < num_macroblocks; ++i)
+ {
+ unsigned int j = first_macroblock + i;
+
+ unsigned int k, l, m;
+
+ batch.macroblocks[i].mbx = macroblocks->macro_blocks[j].x;
+ batch.macroblocks[i].mby = macroblocks->macro_blocks[j].y;
+ batch.macroblocks[i].mb_type = TypeToVL(macroblocks->macro_blocks[j].macroblock_type);
+ if (batch.macroblocks[i].mb_type != vlMacroBlockTypeIntra)
+ batch.macroblocks[i].mo_type = MotionToVL(macroblocks->macro_blocks[j].motion_type);
+ batch.macroblocks[i].dct_type = macroblocks->macro_blocks[j].dct_type & XVMC_DCT_TYPE_FIELD ? vlDCTTypeFieldCoded : vlDCTTypeFrameCoded;
+
+ for (k = 0; k < 2; ++k)
+ for (l = 0; l < 2; ++l)
+ for (m = 0; m < 2; ++m)
+ batch.macroblocks[i].PMV[k][l][m] = macroblocks->macro_blocks[j].PMV[k][l][m];
+
+ batch.macroblocks[i].cbp = macroblocks->macro_blocks[j].coded_block_pattern;
+ batch.macroblocks[i].blocks = blocks->blocks + (macroblocks->macro_blocks[j].index * 64);
+ }
+
+ vlRenderMacroBlocksMpeg2(&batch, target_vl_surface);
+
return Success;
}
Status XvMCFlushSurface(Display *display, XvMCSurface *surface)
{
+ struct vlSurface *vl_sfc;
+
assert(display);
-
+
if (!surface)
return XvMCBadSurface;
-
- /* TODO: Check display & surface match */
+
+ vl_sfc = surface->privData;
+
+ assert(display == vlGetNativeDisplay(vlGetDisplay(vlSurfaceGetScreen(vl_sfc))));
+
+ /* TODO */
+
return Success;
}
Status XvMCSyncSurface(Display *display, XvMCSurface *surface)
{
+ struct vlSurface *vl_sfc;
+
assert(display);
-
+
if (!surface)
return XvMCBadSurface;
-
+
+ vl_sfc = surface->privData;
+
+ assert(display == vlGetNativeDisplay(vlGetDisplay(vlSurfaceGetScreen(vl_sfc))));
+
+ /* TODO */
+
return Success;
}
@@ -321,92 +245,85 @@ Status XvMCPutSurface
unsigned int width, height;
unsigned int border_width;
unsigned int depth;
- struct VL_SURFACE *vl_sfc;
-
+ struct vlSurface *vl_sfc;
+
assert(display);
-
+
if (!surface)
return XvMCBadSurface;
-
+
if (XGetGeometry(display, drawable, &root, &x, &y, &width, &height, &border_width, &depth) == BadDrawable)
return BadDrawable;
-
+
assert(flags == XVMC_TOP_FIELD || flags == XVMC_BOTTOM_FIELD || flags == XVMC_FRAME_PICTURE);
-
+
/* TODO: Correct for negative srcx,srcy & destx,desty by clipping */
-
+
assert(srcx + srcw - 1 < surface->width);
assert(srcy + srch - 1 < surface->height);
assert(destx + destw - 1 < width);
assert(desty + desth - 1 < height);
-
+
vl_sfc = surface->privData;
-
- vlPutSurface(vl_sfc, drawable, srcx, srcy, srcw, srch, destx, desty, destw, desth, PictureToVL(flags));
-
+
+ vlPutPicture(vl_sfc, drawable, srcx, srcy, srcw, srch, destx, desty, destw, desth, PictureToVL(flags));
+
return Success;
}
Status XvMCGetSurfaceStatus(Display *display, XvMCSurface *surface, int *status)
{
- struct VL_CONTEXT *vl_ctx;
- struct VL_SURFACE *vl_sfc;
-
+ struct vlSurface *vl_sfc;
+
assert(display);
-
+
if (!surface)
return XvMCBadSurface;
-
+
assert(status);
-
+
vl_sfc = surface->privData;
- vl_ctx = vl_sfc->context;
-
- assert(display == vl_ctx->display);
-
+
+ assert(display == vlGetNativeDisplay(vlGetDisplay(vlSurfaceGetScreen(vl_sfc))));
+
/* TODO */
*status = 0;
-
+
return Success;
}
Status XvMCDestroySurface(Display *display, XvMCSurface *surface)
{
- struct VL_CONTEXT *vl_ctx;
- struct VL_SURFACE *vl_sfc;
-
+ struct vlSurface *vl_sfc;
+
assert(display);
-
+
if (!surface)
return XvMCBadSurface;
-
+
vl_sfc = surface->privData;
- vl_ctx = vl_sfc->context;
-
- assert(display == vl_ctx->display);
-
+
+ assert(display == vlGetNativeDisplay(vlGetDisplay(vlSurfaceGetScreen(vl_sfc))));
+
vlDestroySurface(vl_sfc);
-
+
return Success;
}
Status XvMCHideSurface(Display *display, XvMCSurface *surface)
{
- struct VL_CONTEXT *vl_ctx;
- struct VL_SURFACE *vl_sfc;
-
+ struct vlSurface *vl_sfc;
+
assert(display);
-
+
if (!surface)
return XvMCBadSurface;
-
+
vl_sfc = surface->privData;
- vl_ctx = vl_sfc->context;
-
- assert(display == vl_ctx->display);
-
+
+ assert(display == vlGetNativeDisplay(vlGetDisplay(vlSurfaceGetScreen(vl_sfc))));
+
/* No op, only for overlaid rendering */
-
+
return Success;
}
-