From 99fac65726da3158cfcbe2323fc15bca28d304df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20Ni=C3=9Fl?= Date: Thu, 15 Jul 2010 21:11:48 +0200 Subject: Change order of locking drawable and frame output callback to avoid deadlock. Recently I've posted a patch for xine-ui which uses a timed lock to avoid a deadlock when the output callback happens while changing the drawable. It is possible to avoid this deadlock at all by moving the drawable lock (and the reinit call which it is not necessary for the callback) after the callback. As a result the mentioned patch for xine-ui may be reverted. --- src/video_out/video_out_vdpau.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/video_out/video_out_vdpau.c b/src/video_out/video_out_vdpau.c index e512a4127..7ca5775f1 100644 --- a/src/video_out/video_out_vdpau.c +++ b/src/video_out/video_out_vdpau.c @@ -1564,11 +1564,6 @@ static void vdpau_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) uint32_t mix_h = this->video_mixer_height; VdpTime stream_speed; - pthread_mutex_lock(&this->drawable_lock); /* protect drawble from being changed */ - - if(this->reinit_needed) - vdpau_reinit(this_gen); - if ( (frame->width != this->sc.delivered_width) || (frame->height != this->sc.delivered_height) || (frame->ratio != this->sc.delivered_ratio) ) { this->sc.force_redraw = 1; /* trigger re-calc of output size */ } @@ -1583,6 +1578,11 @@ static void vdpau_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) vdpau_redraw_needed( this_gen ); + pthread_mutex_lock(&this->drawable_lock); /* protect drawble from being changed */ + + if(this->reinit_needed) + vdpau_reinit(this_gen); + if ( (frame->format == XINE_IMGFMT_YV12) || (frame->format == XINE_IMGFMT_YUY2) ) { chroma = ( frame->format==XINE_IMGFMT_YV12 )? VDP_CHROMA_TYPE_420 : VDP_CHROMA_TYPE_422; if ( (frame->width != this->soft_surface_width) || (frame->height != this->soft_surface_height) || (frame->format != this->soft_surface_format) ) { -- cgit v1.2.3