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