From 3bdb84af9ee2b4935d423306a30ca1d273d8207a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= Date: Wed, 4 May 2005 04:27:20 +0000 Subject: **BUGFIX** fix xxmc plugin wanting to change vld xvmc context when stream changes from non-interlaced to interlaced [bug #1194350] CVS patchset: 7518 CVS date: 2005/05/04 04:27:20 --- src/video_out/video_out_xxmc.c | 62 ++++++++++++++++++++++++++++++++++++------ src/video_out/xvmc_vld.c | 9 ++++-- 2 files changed, 60 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/video_out/video_out_xxmc.c b/src/video_out/video_out_xxmc.c index ebf15767b..d22d80623 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.14 2005/04/26 09:03:05 totte67 Exp $ + * $Id: video_out_xxmc.c,v 1.15 2005/05/04 04:27:20 totte67 Exp $ * * video_out_xxmc.c, X11 decoding accelerated video extension interface for xine * @@ -349,6 +349,8 @@ static void xxmc_xvmc_free_subpicture(xxmc_driver_t *this, XvMCSubpicture *sub) } + + /* * Here follows a number of callback function. */ @@ -700,7 +702,6 @@ static XvImage *create_ximage (xxmc_driver_t *this, XShmSegmentInfo *shminfo, static void xxmc_dispose_context(xxmc_driver_t *driver) { if (driver->contextActive) { - if (driver->xvmc_accel & (XINE_XVMC_ACCEL_MOCOMP | XINE_XVMC_ACCEL_IDCT)) { xvmc_macroblocks_t *macroblocks = &driver->macroblocks; @@ -1108,6 +1109,45 @@ static void xxmc_do_update_frame_xv(vo_driver_t *this_gen, frame->vo_frame.format = frame->format; } +/* + * Check if we need to change XvMC context due to a + * acceleration request change. + */ + +static int xxmc_accel_update(xxmc_driver_t *driver, + uint32_t last_request, + uint32_t new_request) +{ + int k; + + /* + * Same acceleration request. No need to change. + */ + + if (last_request == new_request) return 0; + + /* + * Current acceleration not valid. Change. + */ + + if ((driver->xvmc_accel & new_request) == 0) return 1; + + /* + * Test for a higher acceleration level. + */ + + for (k = 0; k < NUM_ACCEL_PRIORITY; ++k) { + if (last_request & accel_priority[k]) return 0; + if (new_request & accel_priority[k]) return 1; + } + + /* + * Should never get here. + */ + + return 0; +} + static void xxmc_do_update_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen, @@ -1121,13 +1161,17 @@ static void xxmc_do_update_frame(vo_driver_t *this_gen, xine_xxmc_t *xxmc = &frame->xxmc_data; xvmc_context_writer_lock( &this->xvmc_lock); - if ((this->last_accel_request != xxmc->acceleration) || - (this->xvmc_mpeg != xxmc->mpeg) || - (this->xvmc_width != width) || - (this->xvmc_height != height)) { - this->last_accel_request = xxmc->acceleration; - xxmc_xvmc_update_context(this, frame, width, height); - } + if ( flags & VO_NEW_SEQUENCE_FLAG ) { + if (xxmc_accel_update(this, this->last_accel_request, xxmc->acceleration) || + (this->xvmc_mpeg != xxmc->mpeg) || + (this->xvmc_width != width) || + (this->xvmc_height != height)) { + this->last_accel_request = xxmc->acceleration; + xxmc_xvmc_update_context(this, frame, width, height); + } else { + this->last_accel_request = xxmc->acceleration; + } + } if (this->contextActive) xxmc_frame_updates(this, frame, 1); diff --git a/src/video_out/xvmc_vld.c b/src/video_out/xvmc_vld.c index e667761d7..93c5f00bd 100644 --- a/src/video_out/xvmc_vld.c +++ b/src/video_out/xvmc_vld.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: xvmc_vld.c,v 1.2 2004/10/03 12:36:15 totte67 Exp $ + * $Id: xvmc_vld.c,v 1.3 2005/05/04 04:27:20 totte67 Exp $ * * xvmc_vld.c, X11 decoding accelerated video extension interface for xine * @@ -93,7 +93,12 @@ void xvmc_vld_frame(struct vo_frame_s *this_gen) qmx.load_chroma_intra_quantiser_matrix = 0; qmx.load_chroma_non_intra_quantiser_matrix = 0; xvmc_context_reader_lock( &driver->xvmc_lock ); - if ( ! xxmc_xvmc_surface_valid( driver, cf->xvmc_surf)) { + if ( (!xxmc_xvmc_surface_valid( driver, cf->xvmc_surf)) || + ((ctl.picture_coding_type == XVMC_P_PICTURE || + ctl.picture_coding_type == XVMC_B_PICTURE) && + !xxmc_xvmc_surface_valid( driver, fs )) || + ((ctl.picture_coding_type == XVMC_B_PICTURE) && + !xxmc_xvmc_surface_valid( driver, bs )) ) { cf->xxmc_data.result = 128; xvmc_context_reader_unlock( &driver->xvmc_lock ); return; -- cgit v1.2.3