3 * @brief X C Bindings video output module for VLC media player
5 /*****************************************************************************
6 * Copyright © 2009 Rémi Denis-Courmont
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 ****************************************************************************/
35 #include <vlc_common.h>
36 #include <vlc_plugin.h>
37 #include <vlc_vout_display.h>
38 #include <vlc_picture_pool.h>
39 #include <vlc_dialog.h>
43 #define ADAPTOR_TEXT N_("XVideo adaptor number")
44 #define ADAPTOR_LONGTEXT N_( \
45 "XVideo hardware adaptor to use. By default, VLC will " \
46 "use the first functional adaptor.")
48 #define FORMAT_TEXT N_("XVideo format id")
49 #define FORMAT_LONGTEXT N_( \
50 "XVideo image format id to use. By default, VLC will " \
51 "try to use the best match for the video being played.")
53 static int Open (vlc_object_t *);
54 static void Close (vlc_object_t *);
60 set_shortname (N_("XVideo"))
61 set_description (N_("XVideo output (XCB)"))
62 set_category (CAT_VIDEO)
63 set_subcategory (SUBCAT_VIDEO_VOUT)
64 set_capability ("vout display", 200)
65 set_callbacks (Open, Close)
67 add_integer ("xvideo-adaptor", -1,
68 ADAPTOR_TEXT, ADAPTOR_LONGTEXT, true)
69 add_integer ("xvideo-format-id", 0,
70 FORMAT_TEXT, FORMAT_LONGTEXT, true)
71 add_obsolete_bool ("xvideo-shm") /* removed in 2.0.0 */
72 add_shortcut ("xcb-xv", "xv", "xvideo", "xid")
75 #define MAX_PICTURES (128)
77 struct vout_display_sys_t
79 xcb_connection_t *conn;
80 vout_window_t *embed;/* VLC window */
82 xcb_cursor_t cursor; /* blank cursor */
83 xcb_window_t window; /* drawable X window */
84 xcb_gcontext_t gc; /* context to put images */
85 xcb_xv_port_t port; /* XVideo port */
86 uint32_t id; /* XVideo format */
87 uint16_t width; /* display width */
88 uint16_t height; /* display height */
89 uint32_t data_size; /* picture byte size (for non-SHM) */
90 bool swap_uv; /* U/V pointer must be swapped in a picture */
91 bool shm; /* whether to use MIT-SHM */
92 bool visible; /* whether it makes sense to draw at all */
94 xcb_xv_query_image_attributes_reply_t *att;
95 picture_pool_t *pool; /* picture pool */
96 picture_resource_t resource[MAX_PICTURES];
99 static picture_pool_t *Pool (vout_display_t *, unsigned);
100 static void Display (vout_display_t *, picture_t *, subpicture_t *subpicture);
101 static int Control (vout_display_t *, int, va_list);
102 static void Manage (vout_display_t *);
105 * Check that the X server supports the XVideo extension.
107 static bool CheckXVideo (vout_display_t *vd, xcb_connection_t *conn)
109 xcb_xv_query_extension_reply_t *r;
110 xcb_xv_query_extension_cookie_t ck = xcb_xv_query_extension (conn);
113 /* We need XVideo 2.2 for PutImage */
114 r = xcb_xv_query_extension_reply (conn, ck, NULL);
116 msg_Dbg (vd, "XVideo extension not available");
119 msg_Dbg (vd, "XVideo extension v%"PRIu8".%"PRIu8" unknown",
123 msg_Dbg (vd, "XVideo extension v%"PRIu8".%"PRIu8" too old",
127 msg_Dbg (vd, "using XVideo extension v%"PRIu8".%"PRIu8,
135 static vlc_fourcc_t ParseFormat (vlc_object_t *obj,
136 const xcb_xv_image_format_info_t *restrict f)
140 case XCB_XV_IMAGE_FORMAT_INFO_TYPE_RGB:
141 switch (f->num_planes)
144 switch (popcount (f->red_mask | f->green_mask | f->blue_mask))
147 if (f->bpp == 32 && f->depth == 32)
148 return VLC_CODEC_RGBA;
149 if (f->bpp == 32 && f->depth == 24)
150 return VLC_CODEC_RGB32;
151 if (f->bpp == 24 && f->depth == 24)
152 return VLC_CODEC_RGB24;
155 if (f->byte_order != ORDER)
156 return 0; /* Mixed endian! */
157 if (f->bpp == 16 && f->depth == 16)
158 return VLC_CODEC_RGB16;
161 if (f->byte_order != ORDER)
162 return 0; /* Mixed endian! */
163 if (f->bpp == 16 && f->depth == 16)
164 return VLC_CODEC_RGBT;
165 if (f->bpp == 16 && f->depth == 15)
166 return VLC_CODEC_RGB15;
169 if (f->bpp == 16 && f->depth == 16)
170 return VLC_CODEC_RGBA16;
171 if (f->bpp == 16 && f->depth == 12)
172 return VLC_CODEC_RGB12;
174 if (f->bpp == 8 && f->depth == 8)
175 return VLC_CODEC_RGB8;
180 msg_Err (obj, "unknown XVideo RGB format %"PRIx32" (%.4s)",
182 msg_Dbg (obj, " %"PRIu8" planes, %"PRIu8" bits/pixel, "
183 "depth %"PRIu8, f->num_planes, f->bpp, f->depth);
186 case XCB_XV_IMAGE_FORMAT_INFO_TYPE_YUV:
187 if (f->u_sample_bits != f->v_sample_bits
188 || f->vhorz_u_period != f->vhorz_v_period
189 || f->vvert_u_period != f->vvert_v_period
190 || f->y_sample_bits != 8 || f->u_sample_bits != 8
191 || f->vhorz_y_period != 1 || f->vvert_y_period != 1)
193 switch (f->num_planes)
199 if (f->vhorz_u_period == 1 && f->vvert_u_period == 1)
200 return VLC_CODEC_I444;
203 if (f->vhorz_u_period == 2 && f->vvert_u_period == 1)
205 if (!strcmp ((const char *)f->vcomp_order, "YUYV"))
206 return VLC_CODEC_YUYV;
207 if (!strcmp ((const char *)f->vcomp_order, "UYVY"))
208 return VLC_CODEC_UYVY;
217 if (f->vhorz_u_period == 2 && f->vvert_u_period == 2)
219 if (!strcmp ((const char *)f->vcomp_order, "YVU"))
220 return VLC_CODEC_YV12;
221 if (!strcmp ((const char *)f->vcomp_order, "YUV"))
222 return VLC_CODEC_I420;
228 msg_Err (obj, "unknown XVideo YUV format %"PRIx32" (%.4s)", f->id,
230 msg_Dbg (obj, " %"PRIu8" planes, %"PRIu32" bits/pixel, "
231 "%"PRIu32"/%"PRIu32"/%"PRIu32" bits/sample", f->num_planes,
232 f->bpp, f->y_sample_bits, f->u_sample_bits, f->v_sample_bits);
233 msg_Dbg (obj, " period: %"PRIu32"/%"PRIu32"/%"PRIu32"x"
234 "%"PRIu32"/%"PRIu32"/%"PRIu32,
235 f->vhorz_y_period, f->vhorz_u_period, f->vhorz_v_period,
236 f->vvert_y_period, f->vvert_u_period, f->vvert_v_period);
237 msg_Warn (obj, " order: %.32s", f->vcomp_order);
243 static bool BetterFormat (vlc_fourcc_t a, const vlc_fourcc_t *tab,
246 for (unsigned i = 0, max = *rankp; i < max && tab[i] != 0; i++)
255 static xcb_xv_query_image_attributes_reply_t *
256 FindFormat (vlc_object_t *obj, xcb_connection_t *conn, video_format_t *fmt,
257 const xcb_xv_adaptor_info_t *a, uint32_t *idp)
259 /* Order chromas by preference */
261 const vlc_fourcc_t *chromav = tab;
263 vlc_fourcc_t chroma = var_InheritInteger (obj, "xvideo-format-id");
264 if (chroma != 0) /* Forced chroma */
269 else if (vlc_fourcc_IsYUV (fmt->i_chroma)) /* YUV chroma */
271 chromav = vlc_fourcc_GetYUVFallback (fmt->i_chroma);
273 else /* RGB chroma */
275 tab[0] = fmt->i_chroma;
276 tab[1] = VLC_CODEC_RGB32;
277 tab[2] = VLC_CODEC_RGB24;
278 tab[3] = VLC_CODEC_RGB16;
279 tab[4] = VLC_CODEC_RGB15;
280 tab[5] = VLC_CODEC_YUYV;
284 /* Get available image formats */
285 xcb_xv_list_image_formats_reply_t *list =
286 xcb_xv_list_image_formats_reply (conn,
287 xcb_xv_list_image_formats (conn, a->base_id), NULL);
291 /* Check available XVideo chromas */
292 xcb_xv_query_image_attributes_reply_t *attr = NULL;
293 unsigned rank = UINT_MAX;
295 for (const xcb_xv_image_format_info_t *f =
296 xcb_xv_list_image_formats_format (list),
298 f + xcb_xv_list_image_formats_format_length (list);
302 chroma = ParseFormat (obj, f);
307 if ((chroma == VLC_CODEC_I420 || chroma == VLC_CODEC_YV12)
309 && !memcmp ("OMAP", xcb_xv_adaptor_info_name (a), 4))
311 msg_Dbg (obj, "skipping slow I420 format");
312 continue; /* OMAP framebuffer sucks at YUV 4:2:0 */
315 if (!BetterFormat (chroma, chromav, &rank))
318 /* VLC pads scanline to 16 pixels internally */
319 unsigned width = fmt->i_width;
320 unsigned height = fmt->i_height;
321 xcb_xv_query_image_attributes_reply_t *i;
322 i = xcb_xv_query_image_attributes_reply (conn,
323 xcb_xv_query_image_attributes (conn, a->base_id, f->id,
324 width, height), NULL);
328 if (i->width != width || i->height != height)
330 msg_Warn (obj, "incompatible size %ux%u -> %"PRIu32"x%"PRIu32,
331 fmt->i_width, fmt->i_height,
332 i->width, i->height);
333 var_Create (obj->p_libvlc, "xvideo-res-error", VLC_VAR_BOOL);
334 if (!var_GetBool (obj->p_libvlc, "xvideo-res-error"))
336 dialog_FatalWait (obj, _("Video acceleration not available"),
337 _("The XVideo rendering acceleration driver does not "
338 "support the required resolution of %ux%u pixels but "
339 "%"PRIu32"x%"PRIu32" pixels instead.\n"
340 "Acceleration will thus be disabled. Performance may "
341 "be degraded severely if the resolution is large."),
342 width, height, i->width, i->height);
343 var_SetBool (obj->p_libvlc, "xvideo-res-error", true);
349 fmt->i_chroma = chroma;
350 if (f->type == XCB_XV_IMAGE_FORMAT_INFO_TYPE_RGB)
352 fmt->i_rmask = f->red_mask;
353 fmt->i_gmask = f->green_mask;
354 fmt->i_bmask = f->blue_mask;
360 break; /* shortcut for perfect match */
369 * Probe the X server.
371 static int Open (vlc_object_t *obj)
373 vout_display_t *vd = (vout_display_t *)obj;
374 vout_display_sys_t *p_sys;
376 if (!var_InheritBool (obj, "overlay"))
378 p_sys = malloc (sizeof (*p_sys));
385 xcb_connection_t *conn;
386 const xcb_screen_t *screen;
388 p_sys->embed = GetWindow (vd, &conn, &screen, &depth);
389 if (p_sys->embed == NULL)
399 if (!CheckXVideo (vd, conn))
401 msg_Warn (vd, "Please enable XVideo 2.2 for faster video display");
405 p_sys->window = xcb_generate_id (conn);
406 xcb_pixmap_t pixmap = xcb_generate_id (conn);
408 /* Cache adaptors infos */
409 xcb_xv_query_adaptors_reply_t *adaptors =
410 xcb_xv_query_adaptors_reply (conn,
411 xcb_xv_query_adaptors (conn, p_sys->embed->handle.xid), NULL);
412 if (adaptors == NULL)
415 int forced_adaptor = var_InheritInteger (obj, "xvideo-adaptor");
421 xcb_xv_adaptor_info_iterator_t it;
422 for (it = xcb_xv_query_adaptors_info_iterator (adaptors);
424 xcb_xv_adaptor_info_next (&it))
426 const xcb_xv_adaptor_info_t *a = it.data;
429 if (forced_adaptor != -1 && forced_adaptor != 0)
435 if (!(a->type & XCB_XV_TYPE_INPUT_MASK)
436 || !(a->type & XCB_XV_TYPE_IMAGE_MASK))
439 /* Look for an image format */
442 p_sys->att = FindFormat (obj, conn, &fmt, a, &p_sys->id);
443 if (p_sys->att == NULL) /* No acceptable image formats */
447 for (unsigned i = 0; i < a->num_ports; i++)
449 xcb_xv_port_t port = a->base_id + i;
450 xcb_xv_grab_port_reply_t *gr =
451 xcb_xv_grab_port_reply (conn,
452 xcb_xv_grab_port (conn, port, XCB_CURRENT_TIME), NULL);
453 uint8_t result = gr ? gr->result : 0xff;
461 msg_Dbg (vd, "cannot grab port %"PRIu32": Xv error %"PRIu8, port,
464 continue; /* No usable port */
467 /* Found port - initialize selected format */
468 name = strndup (xcb_xv_adaptor_info_name (a), a->name_size);
471 msg_Dbg (vd, "using adaptor %s", name);
474 msg_Dbg (vd, "using port %"PRIu32, p_sys->port);
475 msg_Dbg (vd, "using image format 0x%"PRIx32, p_sys->id);
477 /* Look for an X11 visual, create a window */
478 xcb_xv_format_t *f = xcb_xv_adaptor_info_formats (a);
479 for (uint_fast16_t i = a->num_formats; i > 0; i--, f++)
481 if (f->depth != screen->root_depth)
482 continue; /* this would fail anyway */
487 XCB_CW_BORDER_PIXMAP |
488 XCB_CW_BORDER_PIXEL |
491 const uint32_t list[] = {
492 /* XCB_CW_BACK_PIXMAP */
494 /* XCB_CW_BACK_PIXEL */
496 /* XCB_CW_BORDER_PIXMAP */
498 /* XCB_CW_BORDER_PIXEL */
500 /* XCB_CW_EVENT_MASK */
501 XCB_EVENT_MASK_VISIBILITY_CHANGE,
502 /* XCB_CW_COLORMAP */
503 screen->default_colormap,
508 xcb_create_pixmap (conn, f->depth, pixmap, screen->root, 1, 1);
509 c = xcb_create_window_checked (conn, f->depth, p_sys->window,
510 p_sys->embed->handle.xid, 0, 0, 1, 1, 0,
511 XCB_WINDOW_CLASS_INPUT_OUTPUT, f->visual, mask, list);
513 if (!CheckError (vd, conn, "cannot create X11 window", c))
515 msg_Dbg (vd, "using X11 visual ID 0x%"PRIx32
516 " (depth: %"PRIu8")", f->visual, f->depth);
517 msg_Dbg (vd, "using X11 window 0x%08"PRIx32, p_sys->window);
521 xcb_xv_ungrab_port (conn, p_sys->port, XCB_CURRENT_TIME);
523 msg_Dbg (vd, "no usable X11 visual");
524 continue; /* No workable XVideo format (visual/depth) */
532 msg_Err (vd, "no available XVideo adaptor");
535 /* Compute video (window) placement within the parent window */
537 xcb_map_window (conn, p_sys->window);
539 vout_display_place_t place;
541 vout_display_PlacePicture (&place, &vd->source, vd->cfg, false);
542 p_sys->width = place.width;
543 p_sys->height = place.height;
546 const uint32_t values[] = {
547 place.x, place.y, place.width, place.height };
548 xcb_configure_window (conn, p_sys->window,
549 XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y |
550 XCB_CONFIG_WINDOW_WIDTH |
551 XCB_CONFIG_WINDOW_HEIGHT,
554 p_sys->visible = false;
556 /* Create graphic context */
557 p_sys->gc = xcb_generate_id (conn);
558 xcb_create_gc (conn, p_sys->gc, p_sys->window, 0, NULL);
559 msg_Dbg (vd, "using X11 graphic context 0x%08"PRIx32, p_sys->gc);
561 /* Disable color keying if applicable */
563 xcb_intern_atom_reply_t *r =
564 xcb_intern_atom_reply (conn,
565 xcb_intern_atom (conn, 1, 21, "XV_AUTOPAINT_COLORKEY"), NULL);
566 if (r != NULL && r->atom != 0)
567 xcb_xv_set_port_attribute(conn, p_sys->port, r->atom, 1);
571 p_sys->cursor = CreateBlankCursor (conn, screen);
573 p_sys->shm = CheckSHM (obj, conn);
576 vout_display_info_t info = vd->info;
577 info.has_pictures_invalid = false;
578 info.has_event_thread = true;
580 /* Setup vout_display_t once everything is fine */
581 p_sys->swap_uv = vlc_fourcc_AreUVPlanesSwapped (fmt.i_chroma,
584 fmt.i_chroma = vd->fmt.i_chroma;
590 vd->display = Display;
591 vd->control = Control;
595 bool is_fullscreen = vd->cfg->is_fullscreen;
596 if (is_fullscreen && vout_window_SetFullScreen (p_sys->embed, true))
597 is_fullscreen = false;
598 vout_display_SendEventFullscreen (vd, is_fullscreen);
599 unsigned width, height;
600 if (!GetWindowSize (p_sys->embed, conn, &width, &height))
601 vout_display_SendEventDisplaySize (vd, width, height, is_fullscreen);
612 * Disconnect from the X server.
614 static void Close (vlc_object_t *obj)
616 vout_display_t *vd = (vout_display_t *)obj;
617 vout_display_sys_t *p_sys = vd->sys;
621 for (unsigned i = 0; i < MAX_PICTURES; i++)
623 picture_resource_t *res = &p_sys->resource[i];
625 if (!res->p->p_pixels)
627 PictureResourceFree (res, NULL);
629 picture_pool_Delete (p_sys->pool);
632 /* show the default cursor */
633 xcb_change_window_attributes (p_sys->conn, p_sys->embed->handle.xid, XCB_CW_CURSOR,
634 &(uint32_t) { XCB_CURSOR_NONE });
635 xcb_flush (p_sys->conn);
638 xcb_disconnect (p_sys->conn);
639 vout_display_DeleteWindow (vd, p_sys->embed);
643 static void PoolAlloc (vout_display_t *vd, unsigned requested_count)
645 vout_display_sys_t *p_sys = vd->sys;
647 memset (p_sys->resource, 0, sizeof(p_sys->resource));
649 const uint32_t *pitches= xcb_xv_query_image_attributes_pitches (p_sys->att);
650 const uint32_t *offsets= xcb_xv_query_image_attributes_offsets (p_sys->att);
651 const unsigned num_planes= __MIN(p_sys->att->num_planes, PICTURE_PLANE_MAX);
652 p_sys->data_size = p_sys->att->data_size;
654 picture_t *pic_array[MAX_PICTURES];
655 requested_count = __MIN(requested_count, MAX_PICTURES);
658 for (count = 0; count < requested_count; count++)
660 picture_resource_t *res = &p_sys->resource[count];
662 for (unsigned i = 0; i < num_planes; i++)
665 data_size = (i < num_planes - 1) ? offsets[i+1] : p_sys->data_size;
667 res->p[i].i_lines = (data_size - offsets[i]) / pitches[i];
668 res->p[i].i_pitch = pitches[i];
671 if (PictureResourceAlloc (vd, res, p_sys->att->data_size,
672 p_sys->conn, p_sys->shm))
675 /* Allocate further planes as specified by XVideo */
676 /* We assume that offsets[0] is zero */
677 for (unsigned i = 1; i < num_planes; i++)
678 res->p[i].p_pixels = res->p[0].p_pixels + offsets[i];
681 { /* YVU: swap U and V planes */
682 uint8_t *buf = res->p[2].p_pixels;
683 res->p[2].p_pixels = res->p[1].p_pixels;
684 res->p[1].p_pixels = buf;
687 pic_array[count] = picture_NewFromResource (&vd->fmt, res);
688 if (!pic_array[count])
690 PictureResourceFree (res, p_sys->conn);
691 memset (res, 0, sizeof(*res));
699 p_sys->pool = picture_pool_New (count, pic_array);
700 /* TODO release picture resources if NULL */
701 xcb_flush (p_sys->conn);
705 * Return a direct buffer
707 static picture_pool_t *Pool (vout_display_t *vd, unsigned requested_count)
709 vout_display_sys_t *p_sys = vd->sys;
712 PoolAlloc (vd, requested_count);
718 * Sends an image to the X server.
720 static void Display (vout_display_t *vd, picture_t *pic, subpicture_t *subpicture)
722 vout_display_sys_t *p_sys = vd->sys;
723 xcb_shm_seg_t segment = pic->p_sys->segment;
724 xcb_void_cookie_t ck;
729 ck = xcb_xv_shm_put_image_checked (p_sys->conn, p_sys->port,
730 p_sys->window, p_sys->gc, segment, p_sys->id, 0,
731 /* Src: */ vd->source.i_x_offset,
732 vd->source.i_y_offset,
733 vd->source.i_visible_width,
734 vd->source.i_visible_height,
735 /* Dst: */ 0, 0, p_sys->width, p_sys->height,
736 /* Memory: */ pic->p->i_pitch / pic->p->i_pixel_pitch,
737 pic->p->i_lines, false);
739 ck = xcb_xv_put_image_checked (p_sys->conn, p_sys->port, p_sys->window,
740 p_sys->gc, p_sys->id,
741 vd->source.i_x_offset,
742 vd->source.i_y_offset,
743 vd->source.i_visible_width,
744 vd->source.i_visible_height,
745 0, 0, p_sys->width, p_sys->height,
746 pic->p->i_pitch / pic->p->i_pixel_pitch,
748 p_sys->data_size, pic->p->p_pixels);
750 /* Wait for reply. See x11.c for rationale. */
751 xcb_generic_error_t *e = xcb_request_check (p_sys->conn, ck);
754 msg_Dbg (vd, "%s: X11 error %d", "cannot put image", e->error_code);
758 picture_Release (pic);
762 static int Control (vout_display_t *vd, int query, va_list ap)
764 vout_display_sys_t *p_sys = vd->sys;
768 case VOUT_DISPLAY_CHANGE_FULLSCREEN:
770 const vout_display_cfg_t *c = va_arg (ap, const vout_display_cfg_t *);
771 return vout_window_SetFullScreen (p_sys->embed, c->is_fullscreen);
774 case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
775 case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED:
776 case VOUT_DISPLAY_CHANGE_ZOOM:
777 case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
778 case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
780 const vout_display_cfg_t *cfg;
781 const video_format_t *source;
782 bool is_forced = false;
784 if (query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT
785 || query == VOUT_DISPLAY_CHANGE_SOURCE_CROP)
787 source = (const video_format_t *)va_arg (ap, const video_format_t *);
792 source = &vd->source;
793 cfg = (const vout_display_cfg_t*)va_arg (ap, const vout_display_cfg_t *);
794 if (query == VOUT_DISPLAY_CHANGE_DISPLAY_SIZE)
795 is_forced = (bool)va_arg (ap, int);
799 if (query == VOUT_DISPLAY_CHANGE_DISPLAY_SIZE
801 && (cfg->display.width != vd->cfg->display.width
802 ||cfg->display.height != vd->cfg->display.height)
803 && vout_window_SetSize (p_sys->embed,
805 cfg->display.height))
808 vout_display_place_t place;
809 vout_display_PlacePicture (&place, source, cfg, false);
810 p_sys->width = place.width;
811 p_sys->height = place.height;
813 /* Move the picture within the window */
814 const uint32_t values[] = { place.x, place.y,
815 place.width, place.height, };
816 xcb_configure_window (p_sys->conn, p_sys->window,
817 XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y
818 | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
820 xcb_flush (p_sys->conn);
823 case VOUT_DISPLAY_CHANGE_WINDOW_STATE:
825 unsigned state = va_arg (ap, unsigned);
826 return vout_window_SetState (p_sys->embed, state);
829 /* Hide the mouse. It will be send when
830 * vout_display_t::info.b_hide_mouse is false */
831 case VOUT_DISPLAY_HIDE_MOUSE:
832 xcb_change_window_attributes (p_sys->conn, p_sys->embed->handle.xid,
833 XCB_CW_CURSOR, &(uint32_t){ p_sys->cursor });
834 xcb_flush (p_sys->conn);
836 case VOUT_DISPLAY_RESET_PICTURES:
839 msg_Err (vd, "Unknown request in XCB vout display");
844 static void Manage (vout_display_t *vd)
846 vout_display_sys_t *p_sys = vd->sys;
848 ManageEvent (vd, p_sys->conn, &p_sys->visible);