summaryrefslogtreecommitdiff
path: root/src/video_out
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_out')
-rw-r--r--src/video_out/video_out_xvmc.c116
-rw-r--r--src/video_out/video_out_xxmc.c28
-rw-r--r--src/video_out/xvmc_mocomp.c11
3 files changed, 37 insertions, 118 deletions
diff --git a/src/video_out/video_out_xvmc.c b/src/video_out/video_out_xvmc.c
index d71feceae..aee64cc08 100644
--- a/src/video_out/video_out_xvmc.c
+++ b/src/video_out/video_out_xvmc.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_out_xvmc.c,v 1.20 2004/12/12 22:01:29 mroi Exp $
+ * $Id: video_out_xvmc.c,v 1.21 2005/02/22 18:31:55 totte67 Exp $
*
* video_out_xvmc.c, X11 video motion compensation extension interface for xine
*
@@ -124,8 +124,6 @@ typedef struct {
XvMCSurface surface;
/* temporary Xv only storage */
- XvImage *image;
- XShmSegmentInfo shminfo;
xine_xvmc_t xvmc_data;
} xvmc_frame_t;
@@ -384,9 +382,6 @@ static void xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type,
mbs->macroblockptr->dct_type = dct_type;
mbs->macroblockptr->coded_block_pattern = cbp;
- cbp &= 0x3F;
- mbs->macroblockptr->coded_block_pattern = cbp;
-
while(cbp) {
if(cbp & 1) mbs->macroblockptr->index--;
cbp >>= 1;
@@ -471,18 +466,11 @@ static uint32_t xvmc_get_capabilities (vo_driver_t *this_gen) {
}
static void xvmc_frame_field (vo_frame_t *vo_img, int which_field) {
- xvmc_driver_t *this = (xvmc_driver_t *) vo_img->driver;
-
lprintf ("xvmc_frame_field\n");
-
- this->macroblocks.num_blocks = 0;
- this->macroblocks.macroblockptr = this->macroblocks.macroblockbaseptr;
- this->macroblocks.xine_mc.blockptr = this->macroblocks.xine_mc.blockbaseptr;
}
static void xvmc_frame_dispose (vo_frame_t *vo_img) {
xvmc_frame_t *frame = (xvmc_frame_t *) vo_img ;
- xvmc_driver_t *this = (xvmc_driver_t *) vo_img->driver;
lprintf ("xvmc_frame_dispose\n");
@@ -492,11 +480,6 @@ static void xvmc_frame_dispose (vo_frame_t *vo_img) {
* set_context does the work
*/
- if (frame->image) {
- XLockDisplay (this->display);
- XFree (frame->image);
- XUnlockDisplay (this->display);
- }
free (frame);
}
@@ -510,6 +493,7 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image,
xvmc_frame_t *current_frame = (xvmc_frame_t *) current_image;
xvmc_frame_t *forward_frame = (xvmc_frame_t *) forward_ref_image;
xvmc_frame_t *backward_frame = (xvmc_frame_t *) backward_ref_image;
+ int flags;
lprintf ("xvmc_render_macro_blocks\n");
lprintf ("slices %d 0x%08lx 0x%08lx 0x%08lx\n",
@@ -521,14 +505,15 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image,
(long) forward_frame->surface);
*/
- /* XvMCSyncSurface(this->display,&current_frame->surface); */
+ flags = second_field;
+
if(forward_frame) {
if(backward_frame) {
XvMCRenderSurface(this->display, &this->context, picture_structure,
&current_frame->surface,
&forward_frame->surface,
&backward_frame->surface,
- second_field,
+ flags,
macroblocks->slices, 0, macroblocks->macro_blocks,
macroblocks->blocks);
}
@@ -537,7 +522,7 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image,
&current_frame->surface,
&forward_frame->surface,
NULL,
- second_field,
+ flags,
macroblocks->slices, 0, macroblocks->macro_blocks,
macroblocks->blocks);
}
@@ -548,7 +533,7 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image,
&current_frame->surface,
NULL,
&backward_frame->surface,
- second_field,
+ flags,
macroblocks->slices, 0, macroblocks->macro_blocks,
macroblocks->blocks);
}
@@ -557,13 +542,13 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image,
&current_frame->surface,
NULL,
NULL,
- second_field,
+ flags,
macroblocks->slices, 0, macroblocks->macro_blocks,
macroblocks->blocks);
}
}
- /* XvMCFlushSurface(this->display, &current_frame->surface); */
+ XvMCFlushSurface(this->display, &current_frame->surface);
lprintf ("xvmc_render_macro_blocks done\n");
}
@@ -712,7 +697,6 @@ static cxid_t *xvmc_set_context (xvmc_driver_t *this,
macroblocks->macroblockptr = macroblocks->macroblockbaseptr;
macroblocks->slices = slices;
macroblocks->xine_mc.xvmc_accel = this->acceleration;
-
return(&this->context_id);
}
@@ -792,45 +776,20 @@ static void xvmc_update_frame_format (vo_driver_t *this_gen,
lprintf ("updating frame to %d x %d (ratio=%f, format=%08x)\n",
width, height, ratio, format);
- XLockDisplay (this->display);
-
- /*
- * (re-) allocate xvimage
- */
-
- if (frame->image) {
- dispose_ximage (this, &frame->shminfo, frame->image);
- frame->image = NULL;
- }
-
- frame->image = create_ximage (this, &frame->shminfo, width, height, format);
-
- frame->vo_frame.pitches[0] = frame->image->pitches[0];
- frame->vo_frame.pitches[1] = frame->image->pitches[2];
- frame->vo_frame.pitches[2] = frame->image->pitches[1];
- frame->vo_frame.base[0] = frame->image->data + frame->image->offsets[0];
- frame->vo_frame.base[1] = frame->image->data + frame->image->offsets[2];
- frame->vo_frame.base[2] = frame->image->data + frame->image->offsets[1];
-
+ /* Note that since we are rendering in hardware, we do not need to
+ * allocate any ximage's for the software rendering buffers.
+ */
frame->width = width;
frame->height = height;
frame->format = format;
-
- XUnlockDisplay (this->display);
+ frame->ratio = ratio;
}
- frame->ratio = ratio;
-
xvmc->macroblocks = (xine_macroblocks_t *)&this->macroblocks;
if( flags & VO_NEW_SEQUENCE_FLAG ) {
xvmc_set_context (this, width, height, ratio, format, flags,
xvmc->macroblocks);
}
-
- this->macroblocks.num_blocks = 0;
- this->macroblocks.macroblockptr = this->macroblocks.macroblockbaseptr;
- this->macroblocks.xine_mc.blockptr = this->macroblocks.xine_mc.blockbaseptr;
-
}
static void xvmc_clean_output_area (xvmc_driver_t *this) {
@@ -955,7 +914,6 @@ static int xvmc_redraw_needed (vo_driver_t *this_gen) {
static void xvmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) {
xvmc_driver_t *this = (xvmc_driver_t *) this_gen;
xvmc_frame_t *frame = (xvmc_frame_t *) frame_gen;
- int status;
lprintf ("xvmc_display_frame %d %x\n",frame_gen->id,frame_gen);
@@ -998,13 +956,9 @@ static void xvmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) {
xvmc_redraw_needed (this_gen);
XLockDisplay (this->display);
-
- XvMCGetSurfaceStatus(this->display, &this->cur_frame->surface, &status);
-
- if(status & XVMC_RENDERING) {
- lprintf("--------- current frame is still being rendered %x --------\n",status);
- XvMCSyncSurface(this->display, &this->cur_frame->surface);
- }
+
+ /* Make sure the surface has finished rendering before we display */
+ XvMCSyncSurface(this->display, &this->cur_frame->surface);
if (this->deinterlace_enabled &&
(this->deinterlace_method == DEINTERLACE_ONEFIELD)) {
@@ -1167,15 +1121,6 @@ static int xvmc_gui_data_exchange (vo_driver_t *this_gen,
XLockDisplay (this->display);
- /*
- XvPutImage(this->display, this->xv_port,
- this->drawable, this->gc, this->cur_frame->image,
- this->sc.displayed_xoffset, this->sc.displayed_yoffset,
- this->sc.displayed_width, this->sc.displayed_height,
- this->sc.output_xoffset, this->sc.output_yoffset,
- this->sc.output_width, this->sc.output_height);
- */
-
XSetForeground (this->display, this->gc, this->black.pixel);
for( i = 0; i < 4; i++ ) {
@@ -1250,15 +1195,6 @@ static void xvmc_dispose (vo_driver_t *this_gen) {
lprintf ("xvmc_dispose\n");
- if (this->deinterlace_frame.image) {
- /* dispose_ximage should be xlocked */
- XLockDisplay(this->display);
- dispose_ximage (this, &this->deinterlace_frame.shminfo,
- this->deinterlace_frame.image);
- XUnlockDisplay(this->display);
- this->deinterlace_frame.image = NULL;
- }
-
if(this->context_id.xid) {
XLockDisplay(this->display);
for(i = 0; i < this->num_frame_buffers; i++) {
@@ -1425,7 +1361,6 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi
this->user_data = visual->user_data;
this->deinterlace_method = 0;
- this->deinterlace_frame.image = NULL;
this->use_colorkey = 0;
this->colorkey = 0;
@@ -1731,7 +1666,7 @@ static void *init_class (xine_t *xine, void *visual_gen) {
if(Success == XvGrabPort(display,
adaptor_info[adaptor_num].base_id + j, CurrentTime)) {
xv_port = adaptor_info[adaptor_num].base_id + j;
- surface_type = surfaceInfo[j].surface_type_id;
+ surface_type = surfaceInfo[surface_num].surface_type_id;
break;
}
}
@@ -1757,7 +1692,7 @@ static void *init_class (xine_t *xine, void *visual_gen) {
if(Success == XvGrabPort(display,
adaptor_info[adaptor_num].base_id + j, CurrentTime)) {
xv_port = adaptor_info[adaptor_num].base_id + j;
- surface_type = surfaceInfo[j].surface_type_id;
+ surface_type = surfaceInfo[surface_num].surface_type_id;
break;
}
}
@@ -1770,19 +1705,18 @@ static void *init_class (xine_t *xine, void *visual_gen) {
if(xv_port) {
lprintf ("port %ld surface %d\n",xv_port,j);
- if(surfaceInfo[j].flags & XVMC_OVERLAID_SURFACE)
+ IDCTaccel = 0;
+ if(surfaceInfo[surface_num].flags & XVMC_OVERLAID_SURFACE)
useOverlay = 1;
- if(surfaceInfo[j].flags & XVMC_INTRA_UNSIGNED)
+ if(surfaceInfo[surface_num].flags & XVMC_INTRA_UNSIGNED)
unsignedIntra = 1;
- if(surfaceInfo[j].mc_type == (XVMC_IDCT | XVMC_MPEG_2))
- IDCTaccel = XINE_VO_IDCT_ACCEL + XINE_VO_MOTION_ACCEL;
- else if(surfaceInfo[j].mc_type == (XVMC_MOCOMP | XVMC_MPEG_2)) {
- IDCTaccel = XINE_VO_MOTION_ACCEL;
+ if(surfaceInfo[surface_num].mc_type == (XVMC_IDCT | XVMC_MPEG_2))
+ IDCTaccel |= XINE_VO_IDCT_ACCEL | XINE_VO_MOTION_ACCEL;
+ else if(surfaceInfo[surface_num].mc_type == (XVMC_MOCOMP | XVMC_MPEG_2)) {
+ IDCTaccel |= XINE_VO_MOTION_ACCEL;
if(!unsignedIntra)
IDCTaccel |= XINE_VO_SIGNED_INTRA;
}
- else
- IDCTaccel = 0;
xprintf (xine, XINE_VERBOSITY_DEBUG, "video_out_xvmc: IDCTaccel %02x\n",IDCTaccel);
break;
}
diff --git a/src/video_out/video_out_xxmc.c b/src/video_out/video_out_xxmc.c
index e2bb7e280..b6cf74d10 100644
--- a/src/video_out/video_out_xxmc.c
+++ b/src/video_out/video_out_xxmc.c
@@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_out_xxmc.c,v 1.11 2004/12/12 22:01:30 mroi Exp $
+ * $Id: video_out_xxmc.c,v 1.12 2005/02/22 18:31:58 totte67 Exp $
*
* video_out_xxmc.c, X11 decoding accelerated video extension interface for xine
*
@@ -369,7 +369,6 @@ static void xvmc_flush(vo_frame_t *this_gen)
XVMCLOCKDISPLAY( driver->display );
frame->xxmc_data.result = XvMCFlushSurface( driver->display, frame->xvmc_surf );
- frame->xxmc_data.result = XvMCSyncSurface( driver->display, frame->xvmc_surf );
XVMCUNLOCKDISPLAY( driver->display );
xvmc_context_reader_unlock( &driver->xvmc_lock );
@@ -453,17 +452,7 @@ static uint32_t xxmc_get_capabilities (vo_driver_t *this_gen) {
static void xxmc_frame_field (vo_frame_t *vo_img, int which_field)
{
- xxmc_driver_t *this = (xxmc_driver_t *) vo_img->driver;
-
-
lprintf ("xvmc_frame_field\n");
- if (this->xvmc_cap) {
- if (this->xvmc_accel & (XINE_XVMC_ACCEL_IDCT | XINE_XVMC_ACCEL_MOCOMP)) {
- this->macroblocks.num_blocks = 0;
- this->macroblocks.macroblockptr = this->macroblocks.macroblockbaseptr;
- this->macroblocks.xine_mc.blockptr = this->macroblocks.xine_mc.blockbaseptr;
- }
- }
}
static void xxmc_frame_dispose (vo_frame_t *vo_img) {
@@ -1008,26 +997,18 @@ static void xxmc_frame_updates(xxmc_driver_t *driver,
xxmc->acceleration = driver->xvmc_accel;
xxmc->xvmc.macroblocks = (xine_macroblocks_t *) &driver->macroblocks;
- xxmc->xvmc.macroblocks->xvmc_accel = (driver->unsigned_intra) ?
+ xxmc->xvmc.macroblocks->xvmc_accel = (driver->unsigned_intra) ?
0 : XINE_VO_SIGNED_INTRA;
switch(driver->xvmc_accel) {
case XINE_XVMC_ACCEL_IDCT:
xxmc->xvmc.macroblocks->xvmc_accel |= XINE_VO_IDCT_ACCEL;
break;
case XINE_XVMC_ACCEL_MOCOMP:
- xxmc->xvmc.macroblocks->xvmc_accel |= XINE_VO_MOTION_ACCEL;
+ xxmc->xvmc.macroblocks->xvmc_accel |= XINE_VO_MOTION_ACCEL;
break;
default:
xxmc->xvmc.macroblocks->xvmc_accel = 0;
}
- driver->macroblocks.num_blocks = 0;
- driver->macroblocks.macroblockptr = driver->macroblocks.macroblockbaseptr;
- driver->macroblocks.xine_mc.blockptr =
- driver->macroblocks.xine_mc.blockbaseptr;
-
- /*
- * Accelerated callbacks.
- */
xxmc->proc_xxmc_flush = xvmc_flush;
xxmc->xvmc.proc_macro_block = xxmc_xvmc_proc_macro_block;
@@ -1515,6 +1496,7 @@ static void xxmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen)
xxmc_redraw_needed (this_gen);
if (frame->format == XINE_IMGFMT_XXMC) {
XVMCLOCKDISPLAY( this->display );
+ XvMCSyncSurface( this->display, frame->xvmc_surf );
XvMCPutSurface( this->display, frame->xvmc_surf , this->drawable,
this->sc.displayed_xoffset, this->sc.displayed_yoffset,
this->sc.displayed_width, this->sc.displayed_height,
@@ -1711,6 +1693,7 @@ static int xxmc_gui_data_exchange (vo_driver_t *this_gen,
xxmc_clean_output_area(this,(frame->format == XINE_IMGFMT_XXMC));
if (frame->format == XINE_IMGFMT_XXMC) {
XVMCLOCKDISPLAY( this->display );
+ XvMCSyncSurface( this->display, frame->xvmc_surf );
XvMCPutSurface( this->display, frame->xvmc_surf, this->drawable,
this->sc.displayed_xoffset, this->sc.displayed_yoffset,
this->sc.displayed_width, this->sc.displayed_height,
@@ -2429,7 +2412,6 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi
_("There's a bug in NVIDIA's XvMC lib that makes red OSD colors\n"
"look blue and vice versa. This option provides a workaround.\n"),
10, xxmc_update_nvidia_fix, this);
-
this->deinterlace_enabled = 0;
#ifdef HAVE_VLDXVMC
printf("video_out_xxmc: Unichrome CPU saving is %s.\n",
diff --git a/src/video_out/xvmc_mocomp.c b/src/video_out/xvmc_mocomp.c
index ca6873ccb..75a1aa4d9 100644
--- a/src/video_out/xvmc_mocomp.c
+++ b/src/video_out/xvmc_mocomp.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: xvmc_mocomp.c,v 1.2 2004/10/03 12:36:15 totte67 Exp $
+ * $Id: xvmc_mocomp.c,v 1.3 2005/02/22 18:31:59 totte67 Exp $
*
* XvMC image support by Jack Kelliher
*/
@@ -75,19 +75,22 @@ static void xvmc_render_macro_blocks(vo_frame_t *current_image,
xxmc_frame_t *current_frame = (xxmc_frame_t *) current_image;
xxmc_frame_t *forward_frame = (xxmc_frame_t *) forward_ref_image;
xxmc_frame_t *backward_frame = (xxmc_frame_t *) backward_ref_image;
+ int flags;
lprintf ("xvmc_render_macro_blocks\n");
lprintf ("slices %d 0x%08lx 0x%08lx 0x%08lx\n",
macroblocks->slices,
(long) current_frame, (long) backward_frame,
(long) forward_frame);
-
+
+ flags = second_field;
+
XVMCLOCKDISPLAY( this->display);
XvMCRenderSurface(this->display, &this->context, picture_structure,
current_frame->xvmc_surf,
forward_frame ? forward_frame->xvmc_surf : NULL,
backward_frame ? backward_frame->xvmc_surf : NULL,
- second_field,
+ flags,
macroblocks->slices, 0, &macroblocks->macro_blocks,
&macroblocks->blocks);
XVMCUNLOCKDISPLAY( this->display);
@@ -185,7 +188,7 @@ void xxmc_xvmc_proc_macro_block(int x, int y, int mb_type, int motion_type,
mbs->macroblockptr->index = ((unsigned long)mbs->xine_mc.blockptr -
(unsigned long)mbs->xine_mc.blockbaseptr) >> 7;
-
+
mbs->macroblockptr->dct_type = dct_type;
mbs->macroblockptr->coded_block_pattern = cbp;