summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinhard Nißl <rnissl@gmx.de>2007-08-26 21:49:44 +0200
committerReinhard Nißl <rnissl@gmx.de>2007-08-26 21:49:44 +0200
commit195b53839e170cc4efe059784b1ebb31ce7707af (patch)
tree4ebd88c937aa5c448a302a01e722bf85e79a2a90
parentcbd017c8bc0139311d149c58fabba4e783dd95a9 (diff)
downloadxine-lib-195b53839e170cc4efe059784b1ebb31ce7707af.tar.gz
xine-lib-195b53839e170cc4efe059784b1ebb31ce7707af.tar.bz2
Protect drawable from beeing changed while drawing.
When xine-ui switches to fullscreen mode or back again, it will change the drawable by sending XINE_GUI_SEND_DRAWABLE_CHANGED. This may lead to BadDrawable X Errors when the video out thread is still using the old drawable for drawing. The changes below block XINE_GUI_SEND_DRAWABLE_CHANGED from changing the drawable while it is used for drawing.
-rw-r--r--src/video_out/video_out_xxmc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/video_out/video_out_xxmc.c b/src/video_out/video_out_xxmc.c
index 4b926a2f1..60bd694b2 100644
--- a/src/video_out/video_out_xxmc.c
+++ b/src/video_out/video_out_xxmc.c
@@ -1684,12 +1684,14 @@ static void xxmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen)
if (frame->format == XINE_IMGFMT_XXMC) {
XVMCLOCKDISPLAY( this->display );
XvMCSyncSurface( this->display, frame->xvmc_surf );
+ XLockDisplay( this->display ); /* blocks XINE_GUI_SEND_DRAWABLE_CHANGED from changing drawable */
XvMCPutSurface( this->display, frame->xvmc_surf , this->drawable,
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,
this->cur_field);
+ XUnlockDisplay( this->display ); /* unblocks XINE_GUI_SEND_DRAWABLE_CHANGED from changing drawable */
XVMCUNLOCKDISPLAY( this->display );
if (this->deinterlace_enabled && !disable_deinterlace && this->bob) {
struct timeval tv_middle;
@@ -1718,13 +1720,14 @@ static void xxmc_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen)
this->cur_field = (frame->vo_frame.top_field_first) ? XVMC_BOTTOM_FIELD : XVMC_TOP_FIELD;
XVMCLOCKDISPLAY( this->display );
+ XLockDisplay( this->display ); /* blocks XINE_GUI_SEND_DRAWABLE_CHANGED from changing drawable */
XvMCPutSurface( this->display, frame->xvmc_surf , this->drawable,
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,
this->cur_field);
-
+ XUnlockDisplay( this->display ); /* unblocks XINE_GUI_SEND_DRAWABLE_CHANGED from changing drawable */
XVMCUNLOCKDISPLAY( this->display );
}
}