{
vout_display_sys_t *p_sys = vd->sys;
xcb_shm_seg_t segment = pic->p_sys->segment;
+ xcb_void_cookie_t ck;
if (segment != 0)
- xcb_shm_put_image (p_sys->conn, p_sys->window, p_sys->gc,
+ ck = xcb_shm_put_image_checked (p_sys->conn, p_sys->window, p_sys->gc,
/* real width */ pic->p->i_pitch / pic->p->i_pixel_pitch,
/* real height */ pic->p->i_lines,
/* x */ vd->fmt.i_x_offset,
const size_t offset = vd->fmt.i_y_offset * pic->p->i_pitch;
const unsigned lines = pic->p->i_lines - vd->fmt.i_y_offset;
- xcb_put_image (p_sys->conn, XCB_IMAGE_FORMAT_Z_PIXMAP,
+ ck = xcb_put_image_checked (p_sys->conn, XCB_IMAGE_FORMAT_Z_PIXMAP,
p_sys->window, p_sys->gc,
pic->p->i_pitch / pic->p->i_pixel_pitch,
lines, -vd->fmt.i_x_offset, 0, 0, p_sys->depth,
pic->p->i_pitch * lines, pic->p->p_pixels + offset);
}
- xcb_flush (p_sys->conn);
+
+ /* Wait for reply. This makes sure that the X server gets CPU time to
+ * display the picture. xcb_flush() is *not* sufficient: especially with
+ * shared memory the PUT requests are so short that many of them can fit in
+ * X11 socket output buffer before the kernel preempts VLC. */
+ 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);
+ }
/* FIXME might be WAY better to wait in some case (be carefull with
* VOUT_DISPLAY_RESET_PICTURES if done) + does not work with