+/**************************************************************************
+ *
+ * Copyright 2009 Younes Manton.
+ * 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, sub license, 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 NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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 <assert.h>
#include <X11/Xlibint.h>
#include <pipe/p_video_context.h>
static enum pipe_mpeg12_picture_type PictureToPipe(int xvmc_pic)
{
- switch (xvmc_pic)
- {
+ switch (xvmc_pic) {
case XVMC_TOP_FIELD:
return PIPE_MPEG12_PICTURE_TYPE_FIELD_TOP;
case XVMC_BOTTOM_FIELD:
static enum pipe_mpeg12_motion_type MotionToPipe(int xvmc_motion_type, int xvmc_dct_type)
{
- switch (xvmc_motion_type)
- {
+ 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;
assert(vpipe);
- if (*backbuffer)
- {
+ if (*backbuffer) {
if ((*backbuffer)->width != width || (*backbuffer)->height != height)
pipe_surface_reference(backbuffer, NULL);
else
memset(&template, 0, sizeof(struct pipe_texture));
template.target = PIPE_TEXTURE_2D;
/* XXX: Needs to match the drawable's format? */
- template.format = PIPE_FORMAT_X8R8G8B8_UNORM;
+ template.format = PIPE_FORMAT_B8G8R8X8_UNORM;
template.last_level = 0;
- template.width[0] = width;
- template.height[0] = height;
- template.depth[0] = 1;
- pf_get_block(template.format, &template.block);
- template.tex_usage = PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
+ template.width0 = width;
+ template.height0 = height;
+ template.depth0 = 1;
+ template.tex_usage = PIPE_TEXTURE_USAGE_SHARED;
tex = vpipe->screen->texture_create(vpipe->screen, &template);
if (!tex)
xvmc_mb = xvmc_macroblocks->macro_blocks + first_macroblock;
- for (i = 0; i < num_macroblocks; ++i)
- {
+ for (i = 0; i < num_macroblocks; ++i) {
pipe_macroblocks->base.codec = PIPE_VIDEO_CODEC_MPEG12;
pipe_macroblocks->mbx = xvmc_mb->x;
pipe_macroblocks->mby = xvmc_mb->y;
vsfc = vpipe->screen->video_surface_create(vpipe->screen, vpipe->chroma_format,
vpipe->width, vpipe->height);
- if (!vsfc)
- {
+ if (!vsfc) {
FREE(surface_priv);
return BadAlloc;
}
Status XvMCFlushSurface(Display *dpy, XvMCSurface *surface)
{
-#if 0
- struct vlSurface *vl_sfc;
-
- assert(dpy);
-
- if (!surface)
- return XvMCBadSurface;
+ assert(dpy);
- vl_sfc = surface->privData;
+ if (!surface)
+ return XvMCBadSurface;
- vlSurfaceFlush(vl_sfc);
-#endif
return Success;
}
Status XvMCSyncSurface(Display *dpy, XvMCSurface *surface)
{
-#if 0
- struct vlSurface *vl_sfc;
-
- assert(dpy);
-
- if (!surface)
- return XvMCBadSurface;
+ assert(dpy);
- vl_sfc = surface->privData;
+ if (!surface)
+ return XvMCBadSurface;
- vlSurfaceSync(vl_sfc);
-#endif
return Success;
}
Status XvMCGetSurfaceStatus(Display *dpy, XvMCSurface *surface, int *status)
{
-#if 0
- struct vlSurface *vl_sfc;
- enum vlResourceStatus res_status;
-
- assert(dpy);
-
- if (!surface)
- return XvMCBadSurface;
-
- assert(status);
-
- vl_sfc = surface->privData;
-
- vlSurfaceGetStatus(vl_sfc, &res_status);
-
- switch (res_status)
- {
- case vlResourceStatusFree:
- {
- *status = 0;
- break;
- }
- case vlResourceStatusRendering:
- {
- *status = XVMC_RENDERING;
- break;
- }
- case vlResourceStatusDisplaying:
- {
- *status = XVMC_DISPLAYING;
- break;
- }
- default:
- assert(0);
- }
-#endif
+ assert(dpy);
+
+ if (!surface)
+ return XvMCBadSurface;
+
+ assert(status);
+
*status = 0;
+
return Success;
}