[vlc-devel] commit: XCB_xv: wait until picture is displayed ( Rémi Denis-Courmont )

git version control git at videolan.org
Wed Sep 2 18:24:35 CEST 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Sep  2 19:22:53 2009 +0300| [696b3dc2fd71642f1d3fa6c8a010cb86bdc2d886] | committer: Rémi Denis-Courmont 

XCB_xv: wait until picture is displayed

Note that this does not ensure that the SHM can be written to (we would
need to handle an event for this).

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=696b3dc2fd71642f1d3fa6c8a010cb86bdc2d886
---

 modules/video_output/xcb/xvideo.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/modules/video_output/xcb/xvideo.c b/modules/video_output/xcb/xvideo.c
index 5c07cde..e4b8d75 100644
--- a/modules/video_output/xcb/xvideo.c
+++ b/modules/video_output/xcb/xvideo.c
@@ -593,10 +593,11 @@ static void Display (vout_display_t *vd, picture_t *pic)
 {
     vout_display_sys_t *p_sys = vd->sys;
     xcb_shm_seg_t segment = pic->p_sys->segment;
+    xcb_void_cookie_t ck;
 
     if (segment)
-        xcb_xv_shm_put_image (p_sys->conn, p_sys->port, p_sys->window,
-                              p_sys->gc, segment, p_sys->id, 0,
+        ck = xcb_xv_shm_put_image_checked (p_sys->conn, p_sys->port,
+                              p_sys->window, p_sys->gc, segment, p_sys->id, 0,
                    /* Src: */ vd->source.i_x_offset,
                               vd->source.i_y_offset,
                               vd->source.i_visible_width,
@@ -605,7 +606,7 @@ static void Display (vout_display_t *vd, picture_t *pic)
                 /* Memory: */ pic->p->i_pitch / pic->p->i_pixel_pitch,
                               pic->p->i_visible_lines, false);
     else
-        xcb_xv_put_image (p_sys->conn, p_sys->port, p_sys->window,
+        ck = xcb_xv_put_image_checked (p_sys->conn, p_sys->port, p_sys->window,
                           p_sys->gc, p_sys->id,
                           vd->source.i_x_offset,
                           vd->source.i_y_offset,
@@ -615,7 +616,14 @@ static void Display (vout_display_t *vd, picture_t *pic)
                           vd->source.i_width, vd->source.i_height,
                           p_sys->data_size, pic->p->p_pixels);
 
-    xcb_flush (p_sys->conn);
+    /* Wait for reply. See x11.c for rationale. */
+    xcb_generic_error_t *e = xcb_request_check (p_sys->conn, ck);
+    if (e != NULL)
+    {
+        msg_Dbg (vd, "%s: X11 error %d", "cannot put image", e->error_code);
+        free (e);
+    }
+
     picture_Release (pic);
 }
 




More information about the vlc-devel mailing list