]> git.sesse.net Git - vlc/blob - modules/video_output/xcb/xvideo.c
xcb-xv: remove old cruft
[vlc] / modules / video_output / xcb / xvideo.c
1 /**
2  * @file xvideo.c
3  * @brief X C Bindings video output module for VLC media player
4  */
5 /*****************************************************************************
6  * Copyright © 2009 Rémi Denis-Courmont
7  *
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.0
11  * of the License, or (at your option) any later version.
12  *
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.
17  *
18  * You should have received a copy of the GNU Lesser 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  ****************************************************************************/
22
23 #ifdef HAVE_CONFIG_H
24 # include <config.h>
25 #endif
26
27 #include <stdlib.h>
28 #include <assert.h>
29
30 #include <xcb/xcb.h>
31 #include <xcb/shm.h>
32 #include <xcb/xv.h>
33
34 #include <vlc_common.h>
35 #include <vlc_plugin.h>
36 #include <vlc_vout_display.h>
37 #include <vlc_picture_pool.h>
38
39 #include "xcb_vlc.h"
40
41 #define DISPLAY_TEXT N_("X11 display")
42 #define DISPLAY_LONGTEXT N_( \
43     "X11 hardware display to use. By default, VLC will " \
44     "use the value of the DISPLAY environment variable.")
45
46 #define ADAPTOR_TEXT N_("XVideo adaptor number")
47 #define ADAPTOR_LONGTEXT N_( \
48     "XVideo hardware adaptor to use. By default, VLC will " \
49     "use the first functional adaptor.")
50
51 #define SHM_TEXT N_("Use shared memory")
52 #define SHM_LONGTEXT N_( \
53     "Use shared memory to communicate between VLC and the X server.")
54
55 static int  Open (vlc_object_t *);
56 static void Close (vlc_object_t *);
57
58 /*
59  * Module descriptor
60  */
61 vlc_module_begin ()
62     set_shortname (N_("XVideo"))
63     set_description (N_("XVideo output (XCB)"))
64     set_category (CAT_VIDEO)
65     set_subcategory (SUBCAT_VIDEO_VOUT)
66     set_capability ("vout display", 155)
67     set_callbacks (Open, Close)
68
69     add_string ("x11-display", NULL, NULL,
70                 DISPLAY_TEXT, DISPLAY_LONGTEXT, true)
71         add_deprecated_alias ("xvideo-display")
72     add_integer ("xvideo-adaptor", -1, NULL,
73                  ADAPTOR_TEXT, ADAPTOR_LONGTEXT, true)
74     add_bool ("x11-shm", true, NULL, SHM_TEXT, SHM_LONGTEXT, true)
75         add_deprecated_alias ("xvideo-shm")
76     add_shortcut ("xcb-xv")
77     add_shortcut ("xv")
78     add_shortcut ("xvideo")
79 vlc_module_end ()
80
81 #define MAX_PICTURES (VOUT_MAX_PICTURES)
82
83 struct vout_display_sys_t
84 {
85     xcb_connection_t *conn;
86     vout_window_t *embed;/* VLC window */
87
88     xcb_window_t window; /* drawable X window */
89     xcb_gcontext_t gc;   /* context to put images */
90     xcb_xv_port_t port;  /* XVideo port */
91     uint32_t id;         /* XVideo format */
92     uint16_t width;      /* display width */
93     uint16_t height;     /* display height */
94     uint32_t data_size;  /* picture byte size (for non-SHM) */
95     bool shm;            /* whether to use MIT-SHM */
96
97     xcb_xv_query_image_attributes_reply_t *att;
98     picture_pool_t *pool; /* picture pool */
99     picture_resource_t resource[MAX_PICTURES];
100 };
101
102 static picture_t *Get (vout_display_t *);
103 static void Display (vout_display_t *, picture_t *);
104 static int Control (vout_display_t *, int, va_list);
105 static void Manage (vout_display_t *);
106
107 /**
108  * Check that the X server supports the XVideo extension.
109  */
110 static bool CheckXVideo (vout_display_t *vd, xcb_connection_t *conn)
111 {
112     xcb_xv_query_extension_reply_t *r;
113     xcb_xv_query_extension_cookie_t ck = xcb_xv_query_extension (conn);
114     bool ok = false;
115
116     r = xcb_xv_query_extension_reply (conn, ck, NULL);
117     if (r != NULL)
118     {   /* We need XVideo 2.2 for PutImage */
119         if ((r->major > 2) || (r->major == 2 && r->minor >= 2))
120         {
121             msg_Dbg (vd, "using XVideo extension v%"PRIu8".%"PRIu8,
122                      r->major, r->minor);
123             ok = true;
124         }
125         else
126             msg_Dbg (vd, "XVideo extension too old (v%"PRIu8".%"PRIu8,
127                      r->major, r->minor);
128         free (r);
129     }
130     else
131         msg_Dbg (vd, "XVideo extension not available");
132     return ok;
133 }
134
135 static vlc_fourcc_t ParseFormat (vout_display_t *vd,
136                                  const xcb_xv_image_format_info_t *restrict f)
137 {
138     if (f->byte_order != ORDER && f->bpp != 8)
139         return 0; /* Argh! */
140
141     switch (f->type)
142     {
143       case XCB_XV_IMAGE_FORMAT_INFO_TYPE_RGB:
144         switch (f->num_planes)
145         {
146           case 1:
147             switch (f->bpp)
148             {
149               case 32:
150                 if (f->depth == 24)
151                     return VLC_CODEC_RGB32;
152                 break;
153               case 24:
154                 if (f->depth == 24)
155                     return VLC_CODEC_RGB24;
156                 break;
157               case 16:
158                 if (f->depth == 16)
159                     return VLC_CODEC_RGB16;
160                 if (f->depth == 15)
161                     return VLC_CODEC_RGB15;
162                 break;
163               case 8:
164                 if (f->depth == 8)
165                     return VLC_CODEC_RGB8;
166                 break;
167             }
168             break;
169         }
170         msg_Err (vd, "unknown XVideo RGB format %"PRIx32" (%.4s)",
171                  f->id, f->guid);
172         msg_Dbg (vd, " %"PRIu8" planes, %"PRIu8" bits/pixel, "
173                  "depth %"PRIu8, f->num_planes, f->bpp, f->depth);
174         break;
175
176       case XCB_XV_IMAGE_FORMAT_INFO_TYPE_YUV:
177         if (f->u_sample_bits != f->v_sample_bits
178          || f->vhorz_u_period != f->vhorz_v_period
179          || f->vvert_u_period != f->vvert_v_period
180          || f->y_sample_bits != 8 || f->u_sample_bits != 8
181          || f->vhorz_y_period != 1 || f->vvert_y_period != 1)
182             goto bad;
183         switch (f->num_planes)
184         {
185           case 1:
186             switch (f->bpp)
187             {
188               /*untested: case 24:
189                 if (f->vhorz_u_period == 1 && f->vvert_u_period == 1)
190                     return VLC_CODEC_I444;
191                 break;*/
192               case 16:
193                 if (f->vhorz_u_period == 2 && f->vvert_u_period == 1)
194                 {
195                     if (!strcmp ((const char *)f->vcomp_order, "YUYV"))
196                         return VLC_CODEC_YUYV;
197                     if (!strcmp ((const char *)f->vcomp_order, "UYVY"))
198                         return VLC_CODEC_UYVY;
199                 }
200                 break;
201             }
202             break;
203           case 3:
204             switch (f->bpp)
205             {
206               case 12:
207                 if (f->vhorz_u_period == 2 && f->vvert_u_period == 2)
208                 {
209                     if (!strcmp ((const char *)f->vcomp_order, "YVU"))
210                         return VLC_CODEC_YV12;
211                     if (!strcmp ((const char *)f->vcomp_order, "YUV"))
212                         return VLC_CODEC_I420;
213                 }
214             }
215             break;
216         }
217     bad:
218         msg_Err (vd, "unknown XVideo YUV format %"PRIx32" (%.4s)", f->id,
219                  f->guid);
220         msg_Dbg (vd, " %"PRIu8" planes, %"PRIu32" bits/pixel, "
221                  "%"PRIu32"/%"PRIu32"/%"PRIu32" bits/sample", f->num_planes,
222                  f->bpp, f->y_sample_bits, f->u_sample_bits, f->v_sample_bits);
223         msg_Dbg (vd, " period: %"PRIu32"/%"PRIu32"/%"PRIu32"x"
224                  "%"PRIu32"/%"PRIu32"/%"PRIu32,
225                  f->vhorz_y_period, f->vhorz_u_period, f->vhorz_v_period,
226                  f->vvert_y_period, f->vvert_u_period, f->vvert_v_period);
227         msg_Warn (vd, " order: %.32s", f->vcomp_order);
228         break;
229     }
230     return 0;
231 }
232
233
234 static const xcb_xv_image_format_info_t *
235 FindFormat (vout_display_t *vd,
236             vlc_fourcc_t chroma, const video_format_t *fmt,
237             xcb_xv_port_t port,
238             const xcb_xv_list_image_formats_reply_t *list,
239             xcb_xv_query_image_attributes_reply_t **restrict pa)
240 {
241     xcb_connection_t *conn = vd->sys->conn;
242     const xcb_xv_image_format_info_t *f, *end;
243
244 #ifndef XCB_XV_OLD
245     f = xcb_xv_list_image_formats_format (list);
246 #else
247     f = (xcb_xv_image_format_info_t *) (list + 1);
248 #endif
249     end = f + xcb_xv_list_image_formats_format_length (list);
250     for (; f < end; f++)
251     {
252         if (chroma != ParseFormat (vd, f))
253             continue;
254
255         xcb_xv_query_image_attributes_reply_t *i;
256         i = xcb_xv_query_image_attributes_reply (conn,
257             xcb_xv_query_image_attributes (conn, port, f->id,
258                 fmt->i_width, fmt->i_height), NULL);
259         if (i == NULL)
260             continue;
261
262         if (i->width != fmt->i_width
263          || i->height != fmt->i_height)
264         {
265             msg_Warn (vd, "incompatible size %ux%u -> %"PRIu32"x%"PRIu32,
266                       fmt->i_width, fmt->i_height,
267                       i->width, i->height);
268             free (i);
269             continue;
270         }
271         *pa = i;
272         return f;
273     }
274     return NULL;
275 }
276
277
278 /**
279  * Probe the X server.
280  */
281 static int Open (vlc_object_t *obj)
282 {
283     vout_display_t *vd = (vout_display_t *)obj;
284     vout_display_sys_t *p_sys = malloc (sizeof (*p_sys));
285     if (p_sys == NULL)
286         return VLC_ENOMEM;
287
288     vd->sys = p_sys;
289
290     /* Connect to X */
291     xcb_connection_t *conn = Connect (obj);
292     if (conn == NULL)
293     {
294         free (p_sys);
295         return VLC_EGENERIC;
296     }
297     p_sys->conn = conn;
298
299     if (!CheckXVideo (vd, conn))
300     {
301         msg_Warn (vd, "Please enable XVideo 2.2 for faster video display");
302         xcb_disconnect (conn);
303         free (p_sys);
304         return VLC_EGENERIC;
305     }
306
307     const xcb_screen_t *screen;
308     p_sys->embed = GetWindow (vd, conn, &screen, &p_sys->shm);
309     if (p_sys->embed == NULL)
310     {
311         xcb_disconnect (conn);
312         free (p_sys);
313         return VLC_EGENERIC;
314     }
315
316     /* */
317     p_sys->att = NULL;
318     p_sys->pool = NULL;
319
320     /* Cache adaptors infos */
321     xcb_xv_query_adaptors_reply_t *adaptors =
322         xcb_xv_query_adaptors_reply (conn,
323             xcb_xv_query_adaptors (conn, p_sys->embed->handle.xid), NULL);
324     if (adaptors == NULL)
325         goto error;
326
327     int forced_adaptor = var_CreateGetInteger (obj, "xvideo-adaptor");
328
329     /* */
330     video_format_t fmt = vd->fmt;
331     bool found_adaptor = false;
332
333     /* FIXME: check max image size */
334     xcb_xv_adaptor_info_iterator_t it;
335     for (it = xcb_xv_query_adaptors_info_iterator (adaptors);
336          it.rem > 0;
337          xcb_xv_adaptor_info_next (&it))
338     {
339         const xcb_xv_adaptor_info_t *a = it.data;
340
341         if (forced_adaptor != -1 && forced_adaptor != 0)
342         {
343             forced_adaptor--;
344             continue;
345         }
346
347         if (!(a->type & XCB_XV_TYPE_IMAGE_MASK))
348             continue;
349
350         xcb_xv_list_image_formats_reply_t *r =
351             xcb_xv_list_image_formats_reply (conn,
352                 xcb_xv_list_image_formats (conn, a->base_id), NULL);
353         if (r == NULL)
354             continue;
355
356         const xcb_xv_image_format_info_t *xfmt;
357
358         /* */
359         const vlc_fourcc_t *chromas, chromas_default[] = {
360             fmt.i_chroma,
361             VLC_CODEC_RGB24,
362             VLC_CODEC_RGB15,
363             VLC_CODEC_YUYV,
364             0
365         };
366         if (vlc_fourcc_IsYUV (fmt.i_chroma))
367             chromas = vlc_fourcc_GetYUVFallback (fmt.i_chroma);
368         else
369             chromas = chromas_default;
370
371         for (size_t i = 0; chromas[i]; i++)
372         {
373             vlc_fourcc_t chroma = chromas[i];
374             xfmt = FindFormat (vd, chroma, &fmt, a->base_id, r, &p_sys->att);
375             if (xfmt != NULL)
376             {
377                 fmt.i_chroma = chroma;
378                 goto found_format;
379             }
380         }
381         free (r);
382         continue;
383
384     found_format:
385         /* Grab a port */
386         /* XXX: assume all of an adapter's ports have the same formats */
387         for (unsigned i = 0; i < a->num_ports; i++)
388         {
389              xcb_xv_port_t port = a->base_id + i;
390              xcb_xv_grab_port_reply_t *gr =
391                  xcb_xv_grab_port_reply (conn,
392                      xcb_xv_grab_port (conn, port, XCB_CURRENT_TIME), NULL);
393              uint8_t result = gr ? gr->result : 0xff;
394
395              free (gr);
396              if (result == 0)
397              {
398                  p_sys->port = port;
399                  goto grabbed_port;
400              }
401              msg_Dbg (vd, "cannot grab port %"PRIu32, port);
402         }
403         continue;
404
405     grabbed_port:
406         msg_Dbg (vd, "using port %"PRIu32, p_sys->port);
407
408         p_sys->id = xfmt->id;
409         msg_Dbg (vd, "using image format 0x%"PRIx32, p_sys->id);
410         if (xfmt->type == XCB_XV_IMAGE_FORMAT_INFO_TYPE_RGB)
411         {
412             fmt.i_rmask = xfmt->red_mask;
413             fmt.i_gmask = xfmt->green_mask;
414             fmt.i_bmask = xfmt->blue_mask;
415         }
416         free (r);
417         found_adaptor = true;
418         break;
419     }
420     free (adaptors);
421     if (!found_adaptor)
422     {
423         msg_Err (vd, "no available XVideo adaptor");
424         goto error;
425     }
426
427     /* Create window */
428     {
429         const uint32_t mask =
430             /* XCB_CW_EVENT_MASK */
431             XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
432             XCB_EVENT_MASK_POINTER_MOTION;
433         xcb_void_cookie_t c;
434         xcb_window_t window = xcb_generate_id (conn);
435
436         c = xcb_create_window_checked (conn, screen->root_depth, window,
437                                        p_sys->embed->handle.xid, 0, 0, 1, 1, 0,
438                                        XCB_WINDOW_CLASS_INPUT_OUTPUT,
439                                        screen->root_visual,
440                                        XCB_CW_EVENT_MASK, &mask);
441         if (CheckError (vd, conn, "cannot create X11 window", c))
442             goto error;
443         p_sys->window = window;
444         msg_Dbg (vd, "using X11 window %08"PRIx32, window);
445         xcb_map_window (conn, window);
446
447         vout_display_place_t place;
448
449         vout_display_PlacePicture (&place, &vd->source, vd->cfg, false);
450         p_sys->width  = place.width;
451         p_sys->height = place.height;
452
453         /* */
454         const uint32_t values[] = { place.x, place.y, place.width, place.height };
455         xcb_configure_window (conn, window,
456                               XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y |
457                               XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
458                               values);
459     }
460
461     /* Create graphic context */
462     p_sys->gc = xcb_generate_id (conn);
463     xcb_create_gc (conn, p_sys->gc, p_sys->window, 0, NULL);
464     msg_Dbg (vd, "using X11 graphic context %08"PRIx32, p_sys->gc);
465
466     /* */
467     p_sys->pool = NULL;
468
469     /* */
470     vout_display_info_t info = vd->info;
471     info.has_pictures_invalid = false;
472
473     /* Setup vout_display_t once everything is fine */
474     vd->fmt = fmt;
475     vd->info = info;
476
477     vd->get = Get;
478     vd->prepare = NULL;
479     vd->display = Display;
480     vd->control = Control;
481     vd->manage = Manage;
482
483     /* */
484     unsigned width, height;
485     if (!GetWindowSize (p_sys->embed, conn, &width, &height))
486         vout_display_SendEventDisplaySize (vd, width, height);
487     vout_display_SendEventFullscreen (vd, false);
488
489     return VLC_SUCCESS;
490
491 error:
492     Close (obj);
493     return VLC_EGENERIC;
494 }
495
496
497 /**
498  * Disconnect from the X server.
499  */
500 static void Close (vlc_object_t *obj)
501 {
502     vout_display_t *vd = (vout_display_t *)obj;
503     vout_display_sys_t *p_sys = vd->sys;
504
505     if (p_sys->pool)
506     {
507         for (unsigned i = 0; i < MAX_PICTURES; i++)
508         {
509             picture_resource_t *res = &p_sys->resource[i];
510
511             if (!res->p->p_pixels)
512                 break;
513             PictureResourceFree (res, p_sys->conn);
514         }
515         picture_pool_Delete (p_sys->pool);
516     }
517
518     free (p_sys->att);
519     vout_display_DeleteWindow (vd, p_sys->embed);
520     xcb_disconnect (p_sys->conn);
521     free (p_sys);
522 }
523
524 /**
525  * Return a direct buffer
526  */
527 static picture_t *Get (vout_display_t *vd)
528 {
529     vout_display_sys_t *p_sys = vd->sys;
530
531     if (!p_sys->pool)
532     {
533         picture_t *pic = picture_New (vd->fmt.i_chroma,
534                                       p_sys->att->width, p_sys->att->height, 0);
535         if (!pic)
536             return NULL;
537
538         memset (p_sys->resource, 0, sizeof(p_sys->resource));
539
540         const uint32_t *offsets =
541             xcb_xv_query_image_attributes_offsets (p_sys->att);
542         p_sys->data_size = p_sys->att->data_size;
543
544         unsigned count;
545         picture_t *pic_array[MAX_PICTURES];
546         for (count = 0; count < MAX_PICTURES; count++)
547         {
548             picture_resource_t *res = &p_sys->resource[count];
549
550             for (int i = 0; i < pic->i_planes; i++)
551             {
552                 res->p[i].i_lines = pic->p[i].i_lines; /* FIXME seems wrong*/
553                 res->p[i].i_pitch = pic->p[i].i_pitch;
554             }
555             if (PictureResourceAlloc (vd, res, p_sys->att->data_size,
556                                       p_sys->conn, p_sys->shm))
557                 break;
558
559             /* Allocate further planes as specified by XVideo */
560             /* We assume that offsets[0] is zero */
561             for (int i = 1; i < pic->i_planes; i++)
562                 res->p[i].p_pixels = res->p[0].p_pixels + offsets[i];
563             pic_array[count] = picture_NewFromResource (&vd->fmt, res);
564             if (!pic_array[count])
565             {
566                 PictureResourceFree (res, p_sys->conn);
567                 memset (res, 0, sizeof(*res));
568                 break;
569             }
570         }
571         picture_Release (pic);
572
573         if (count == 0)
574             return NULL;
575
576         p_sys->pool = picture_pool_New (count, pic_array);
577         if (!p_sys->pool)
578         {
579             /* TODO release picture resources */
580             return NULL;
581         }
582         /* FIXME should also do it in case of error ? */
583         xcb_flush (p_sys->conn);
584     }
585
586     return picture_pool_Get (p_sys->pool);
587 }
588
589 /**
590  * Sends an image to the X server.
591  */
592 static void Display (vout_display_t *vd, picture_t *pic)
593 {
594     vout_display_sys_t *p_sys = vd->sys;
595     xcb_shm_seg_t segment = pic->p_sys->segment;
596     xcb_void_cookie_t ck;
597
598     if (segment)
599         ck = xcb_xv_shm_put_image_checked (p_sys->conn, p_sys->port,
600                               p_sys->window, p_sys->gc, segment, p_sys->id, 0,
601                    /* Src: */ vd->source.i_x_offset,
602                               vd->source.i_y_offset,
603                               vd->source.i_visible_width,
604                               vd->source.i_visible_height,
605                    /* Dst: */ 0, 0, p_sys->width, p_sys->height,
606                 /* Memory: */ pic->p->i_pitch / pic->p->i_pixel_pitch,
607                               pic->p->i_visible_lines, false);
608     else
609         ck = xcb_xv_put_image_checked (p_sys->conn, p_sys->port, p_sys->window,
610                           p_sys->gc, p_sys->id,
611                           vd->source.i_x_offset,
612                           vd->source.i_y_offset,
613                           vd->source.i_visible_width,
614                           vd->source.i_visible_height,
615                           0, 0, p_sys->width, p_sys->height,
616                           vd->source.i_width, vd->source.i_height,
617                           p_sys->data_size, pic->p->p_pixels);
618
619     /* Wait for reply. See x11.c for rationale. */
620     xcb_generic_error_t *e = xcb_request_check (p_sys->conn, ck);
621     if (e != NULL)
622     {
623         msg_Dbg (vd, "%s: X11 error %d", "cannot put image", e->error_code);
624         free (e);
625     }
626
627     picture_Release (pic);
628 }
629
630 static int Control (vout_display_t *vd, int query, va_list ap)
631 {
632     vout_display_sys_t *p_sys = vd->sys;
633
634     switch (query)
635     {
636     case VOUT_DISPLAY_CHANGE_FULLSCREEN:
637     {
638         const vout_display_cfg_t *c = va_arg (ap, const vout_display_cfg_t *);
639         return vout_window_SetFullScreen (p_sys->embed, c->is_fullscreen);
640     }
641
642     case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
643     case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED:
644     case VOUT_DISPLAY_CHANGE_ZOOM:
645     case VOUT_DISPLAY_CHANGE_SOURCE_ASPECT:
646     case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
647     {
648         const vout_display_cfg_t *cfg;
649         const video_format_t *source;
650
651         if (query == VOUT_DISPLAY_CHANGE_SOURCE_ASPECT
652          || query == VOUT_DISPLAY_CHANGE_SOURCE_CROP)
653         {
654             source = (const video_format_t *)va_arg (ap, const video_format_t *);
655             cfg = vd->cfg;
656         }
657         else
658         {
659             source = &vd->source;
660             cfg = (const vout_display_cfg_t*)va_arg (ap, const vout_display_cfg_t *);
661         }
662
663         /* */
664         if (query == VOUT_DISPLAY_CHANGE_DISPLAY_SIZE
665          && (cfg->display.width  != vd->cfg->display.width
666            ||cfg->display.height != vd->cfg->display.height)
667          && vout_window_SetSize (p_sys->embed,
668                                   cfg->display.width,
669                                   cfg->display.height))
670             return VLC_EGENERIC;
671
672         vout_display_place_t place;
673         vout_display_PlacePicture (&place, source, cfg, false);
674         p_sys->width  = place.width;
675         p_sys->height = place.height;
676
677         /* Move the picture within the window */
678         const uint32_t values[] = { place.x, place.y,
679                                     place.width, place.height, };
680         xcb_configure_window (p_sys->conn, p_sys->window,
681                               XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y
682                             | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT,
683                               values);
684         xcb_flush (p_sys->conn);
685         return VLC_SUCCESS;
686     }
687     case VOUT_DISPLAY_CHANGE_ON_TOP:
688     {
689         int on_top = (int)va_arg (ap, int);
690         return vout_window_SetOnTop (p_sys->embed, on_top);
691     }
692
693     /* TODO */
694 #if 0
695     /* Hide the mouse. It will be send when
696      * vout_display_t::info.b_hide_mouse is false */
697     VOUT_DISPLAY_HIDE_MOUSE,
698 #endif
699     case VOUT_DISPLAY_RESET_PICTURES:
700         assert(0);
701     default:
702         msg_Err (vd, "Unknown request in XCB vout display");
703         return VLC_EGENERIC;
704     }
705 }
706
707 static void Manage (vout_display_t *vd)
708 {
709     vout_display_sys_t *p_sys = vd->sys;
710
711     ManageEvent (vd, p_sys->conn, p_sys->window);
712 }
713