From: Reinhard N. <rn...@gm...> - 2010-07-15 22:02:15
|
# HG changeset patch # User Reinhard Nißl <rn...@gm...> # Date 1279221108 -7200 # Node ID 8d864acff67ddbc2280b8eef26b6ac527fd811d3 # Parent 886becfd9d4fbb4084719ede8e155c663e44e911 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. diff --git a/src/video_out/video_out_vdpau.c b/src/video_out/video_out_vdpau.c --- a/src/video_out/video_out_vdpau.c +++ b/src/video_out/video_out_vdpau.c @@ -1564,11 +1564,6 @@ 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 */ } @@ -1582,6 +1577,11 @@ this->sc.crop_bottom = frame->vo_frame.crop_bottom; 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; |