1 /*****************************************************************************
2 * omapfb.c : omap framebuffer plugin for vlc
3 *****************************************************************************
4 * Copyright (C) 2008 the VideoLAN team
7 * Authors: Antoine Lejeune <phytos @ videolan.org>
8 * Based on fb.c and work of Siarhei Siamashka on mplayer for Maemo
9 * Needs a recent omapfb.h to compile
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24 *****************************************************************************/
30 #include <errno.h> /* ENOMEM */
31 #include <fcntl.h> /* open() */
32 #include <unistd.h> /* close() */
34 #include <sys/ioctl.h>
35 #include <sys/mman.h> /* mmap() */
38 #include <asm/arch-omap/omapfb.h>
40 /* Embedded window handling */
42 #include <X11/Xutil.h>
43 #include <X11/keysym.h>
49 #include <vlc_common.h>
50 #include <vlc_plugin.h>
53 #include <vlc_window.h>
54 #include <vlc_playlist.h>
56 /*****************************************************************************
58 *****************************************************************************/
59 static int Create ( vlc_object_t * );
60 static void Destroy ( vlc_object_t * );
62 static int Init ( vout_thread_t * );
63 static void End ( vout_thread_t * );
64 static int Manage ( vout_thread_t * );
65 static void DisplayVideo ( vout_thread_t *, picture_t * );
66 static int Control ( vout_thread_t *, int, va_list );
68 static void FreePicture ( vout_thread_t *, picture_t * );
70 static int OpenDisplay ( vout_thread_t * );
71 static void CloseDisplay ( vout_thread_t * );
72 static void UpdateScreen ( vout_thread_t *,
73 int, int, int, int, int, int, int );
75 static int InitWindow ( vout_thread_t * );
76 static void CreateWindow ( vout_sys_t * );
77 static void ToggleFullScreen ( vout_thread_t * );
80 static const int i_backlight_on_interval = 300;
83 /*****************************************************************************
85 *****************************************************************************/
86 #define FB_DEV_VAR "omapfbdev"
88 #define DEVICE_TEXT N_("OMAP Framebuffer device")
89 #define DEVICE_LONGTEXT N_( \
90 "OMAP Framebuffer device to use for rendering (usually /dev/fb0).")
92 #define CHROMA_TEXT N_("Chroma used.")
93 #define CHROMA_LONGTEXT N_( \
94 "Force use of a specific chroma for output. Default is Y420 (specific to N770/N8xx hardware)." )
96 #define OVERLAY_TEXT N_("Embed the overlay")
97 #define OVERLAY_LONGTEXT N_( \
98 "Embed the framebuffer overlay into a X11 window" )
101 set_shortname( "OMAP framebuffer" );
102 set_category( CAT_VIDEO );
103 set_subcategory( SUBCAT_VIDEO_VOUT );
104 add_file( FB_DEV_VAR, "/dev/fb0", NULL, DEVICE_TEXT, DEVICE_LONGTEXT,
106 add_string( "omap-chroma", NULL, NULL, CHROMA_TEXT, CHROMA_LONGTEXT,
108 add_bool( "omap-embedded", true, NULL, OVERLAY_TEXT, OVERLAY_LONGTEXT,
110 set_description( N_("OMAP framebuffer video output") );
111 set_capability( "video output", 200 );
112 set_callbacks( Create, Destroy );
115 /*****************************************************************************
116 * omap_window_t: simple structure with the geometry of a window
117 *****************************************************************************/
126 /*****************************************************************************
127 * vout_sys_t: video output omap framebuffer method descriptor
128 *****************************************************************************
129 * This structure is part of the video output thread descriptor.
130 * It describes the FB specific properties of an output thread.
131 *****************************************************************************/
134 /* Framebuffer information */
135 int i_fd; /* device handle */
136 struct fb_var_screeninfo fb_vinfo; /* current mode information */
137 struct fb_fix_screeninfo fb_finfo;
138 struct omapfb_caps caps;
141 /* Window information */
142 struct omap_window_t output_window; /* Size of the real output window */
143 struct omap_window_t main_window; /* Size of the area we got to display */
144 struct omap_window_t embedded_window; /* Size of the embedded window */
146 /* Video information */
147 uint32_t i_video_width; /* video width */
148 uint32_t i_video_height; /* video height */
149 vlc_fourcc_t i_chroma;
150 int i_color_format; /* OMAPFB_COLOR_* */
152 bool b_video_enabled; /* Video must be displayed? */
153 picture_t *p_output_picture;
156 uint8_t *p_video; /* base adress */
157 uint8_t *p_center; /* output adress */
158 size_t i_page_size; /* page size */
159 int i_bytes_per_pixel; /* Bytes used by one pixel */
160 int i_line_len; /* Length of one line in bytes */
164 vout_window_t *owner_window;
166 mtime_t i_time_button_last_pressed; /* To detect double click */
173 osso_context_t *p_octx;
174 int i_backlight_on_counter;
178 /*****************************************************************************
179 * Create: allocates omapfb video thread output method
180 *****************************************************************************
181 * This function allocates and initializes a FB vout method.
182 *****************************************************************************/
183 static int Create( vlc_object_t *p_this )
185 vout_thread_t *p_vout = (vout_thread_t *)p_this;
188 if( p_vout->fmt_in.i_chroma != VLC_FOURCC('I','4','2','0') &&
189 p_vout->fmt_in.i_chroma != VLC_FOURCC('I','Y','U','V') &&
190 p_vout->fmt_in.i_chroma != VLC_FOURCC('Y','V','1','2') )
193 /* Allocate instance and initialize some members */
194 p_vout->p_sys = p_sys = malloc( sizeof( vout_sys_t ) );
195 if( p_vout->p_sys == NULL )
197 memset( p_sys, 0, sizeof(vout_sys_t) );
199 p_vout->pf_init = Init;
200 p_vout->pf_end = End;
201 p_vout->pf_manage = Manage;
202 p_vout->pf_render = NULL;
203 p_vout->pf_display = DisplayVideo;
204 p_vout->pf_control = Control;
206 p_sys->b_embed = var_CreateGetInteger( p_vout, "omap-embedded" );
207 p_sys->b_video_enabled = true;
209 if( OpenDisplay( p_vout ) )
211 free( p_vout->p_sys );
215 if( InitWindow( p_vout ) )
217 free( p_vout->p_sys );
222 p_vout->p_sys->i_backlight_on_counter = i_backlight_on_interval;
223 p_vout->p_sys->p_octx = osso_initialize( "vlc", VERSION, 0, NULL );
224 if ( p_vout->p_sys->p_octx == NULL ) {
225 msg_Err( p_vout, "Could not get osso context" );
227 msg_Dbg( p_vout, "Initialized osso context" );
234 /*****************************************************************************
235 * Destroy: destroy omapfb video thread output method
236 *****************************************************************************
237 * Terminate an output method created by Create
238 *****************************************************************************/
239 static void Destroy( vlc_object_t *p_this )
241 vout_thread_t *p_vout = (vout_thread_t *)p_this;
243 CloseDisplay( p_vout );
245 if( p_vout->p_sys->b_embed )
247 vout_ReleaseWindow( p_vout->p_sys->owner_window );
248 if( p_vout->b_fullscreen )
249 XDestroyWindow( p_vout->p_sys->p_display, p_vout->p_sys->window );
250 XCloseDisplay( p_vout->p_sys->p_display );
254 if ( p_vout->p_sys->p_octx != NULL ) {
255 msg_Dbg( p_vout, "Deinitializing osso context" );
256 osso_deinitialize( p_vout->p_sys->p_octx );
260 /* Destroy structure */
261 free( p_vout->p_sys );
265 /*****************************************************************************
266 * Init: initialize omap framebuffer video thread output method
267 *****************************************************************************/
268 static int Init( vout_thread_t *p_vout )
270 vout_sys_t *p_sys = (vout_sys_t *)p_vout->p_sys;
272 // We want to keep the same aspect
273 p_vout->fmt_out.i_aspect = p_vout->output.i_aspect = p_vout->render.i_aspect;
274 // We ask where the video should be displayed in the video area
275 vout_PlacePicture( p_vout, p_sys->main_window.i_width,
276 p_sys->main_window.i_height,
277 &p_sys->output_window.i_x,
278 &p_sys->output_window.i_y,
279 &p_sys->output_window.i_width,
280 &p_sys->output_window.i_height );
281 p_sys->output_window.i_x = ( p_sys->output_window.i_x +
282 p_sys->main_window.i_x ) & ~1;
283 p_sys->output_window.i_y = ( p_sys->output_window.i_y +
284 p_sys->main_window.i_y ) & ~1;
286 // Hardware upscaling better than software
287 if( p_vout->fmt_render.i_width <= p_sys->main_window.i_width &&
288 p_vout->fmt_render.i_height <= p_sys->main_window.i_height )
290 p_sys->i_video_width =
291 p_vout->output.i_width =
292 p_vout->fmt_out.i_width =
293 p_vout->fmt_out.i_visible_width = p_vout->fmt_render.i_width;
294 p_sys->i_video_height =
295 p_vout->output.i_height =
296 p_vout->fmt_out.i_height =
297 p_vout->fmt_out.i_visible_height = p_vout->fmt_render.i_height;
301 p_sys->i_video_width =
302 p_vout->output.i_width =
303 p_vout->fmt_out.i_width =
304 p_vout->fmt_out.i_visible_width = p_sys->output_window.i_width;
305 p_sys->i_video_height =
306 p_vout->output.i_height =
307 p_vout->fmt_out.i_height =
308 p_vout->fmt_out.i_visible_height = p_sys->output_window.i_height;
311 p_vout->output.i_chroma =
312 p_vout->fmt_out.i_chroma = VLC_FOURCC( 'Y','4','2','0' );
313 p_sys->i_color_format = OMAPFB_COLOR_YUV420;
315 // place in the framebuffer where we have to write
316 p_sys->p_center = p_sys->p_video + p_sys->output_window.i_x*p_sys->i_bytes_per_pixel
317 + p_sys->output_window.i_y*p_sys->i_line_len;
319 // We get and set a direct render vlc picture
320 I_OUTPUTPICTURES = 0;
321 picture_t *p_pic = NULL;
324 for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ )
326 if( p_vout->p_picture[ i_index ].i_status == FREE_PICTURE )
328 p_pic = p_vout->p_picture + i_index;
333 /* Allocate the picture */
339 p_sys->p_output_picture = p_pic;
340 p_pic->p->p_pixels = p_vout->p_sys->p_center;
341 p_pic->p->i_pixel_pitch = p_vout->p_sys->i_bytes_per_pixel;
342 p_pic->p->i_lines = p_sys->i_video_height;
343 p_pic->p->i_visible_lines = p_sys->i_video_height;
344 p_pic->p->i_pitch = p_sys->i_line_len;
345 p_pic->p->i_visible_pitch = p_sys->i_line_len;
347 p_pic->i_status = DESTROYED_PICTURE;
348 p_pic->i_type = DIRECT_PICTURE;
350 PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic;
357 /*****************************************************************************
358 * End: terminate omap framebuffer video thread output method
359 *****************************************************************************/
360 static void End( vout_thread_t *p_vout )
362 /* Clear the screen */
363 UpdateScreen( p_vout, 0, 0,
364 p_vout->p_sys->fb_vinfo.xres,
365 p_vout->p_sys->fb_vinfo.yres,
366 p_vout->p_sys->fb_vinfo.xres,
367 p_vout->p_sys->fb_vinfo.yres,
368 OMAPFB_COLOR_RGB565 );
371 /*****************************************************************************
372 * Control: control facility for the vout
373 *****************************************************************************/
374 static int Control( vout_thread_t *p_vout, int i_query, va_list args )
380 vout_ReleaseWindow( p_vout->p_sys->owner_window );
383 return vout_vaControlDefault( p_vout, i_query, args );
387 /*****************************************************************************
388 * FreePicture: Destroy the picture and make it free again
389 ******************************************************************************/
390 static void FreePicture( vout_thread_t *p_vout, picture_t *p_pic )
392 p_pic->p->p_pixels = NULL;
393 p_pic->i_status = FREE_PICTURE;
396 /*****************************************************************************
397 * Manage: handle omapfb events
398 *****************************************************************************
399 * This function should be called regularly by video output thread.
400 *****************************************************************************/
401 static int Manage( vout_thread_t *p_vout )
405 while( XPending( p_vout->p_sys->p_display ) )
407 XNextEvent( p_vout->p_sys->p_display, &xevent );
409 if( xevent.type == ButtonPress &&
410 ((XButtonEvent *)&xevent)->button == Button1 )
412 /* detect double-clicks */
413 if( ( ((XButtonEvent *)&xevent)->time -
414 p_vout->p_sys->i_time_button_last_pressed ) < 300 )
416 p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
419 p_vout->p_sys->i_time_button_last_pressed =
420 ((XButtonEvent *)&xevent)->time;
422 else if( xevent.type == KeyPress )
427 x_key_symbol = XKeycodeToKeysym( p_vout->p_sys->p_display,
428 xevent.xkey.keycode, 0 );
430 switch( x_key_symbol )
433 val.i_int = ACTIONID_PLAY_PAUSE; break;
435 val.i_int = ACTIONID_QUIT; break;
437 val.i_int = ACTIONID_JUMP_BACKWARD_MEDIUM; break;
439 val.i_int = ACTIONID_JUMP_FORWARD_MEDIUM; break;
441 val.i_int = ACTIONID_JUMP_FORWARD_SHORT; break;
443 val.i_int = ACTIONID_JUMP_BACKWARD_SHORT; break;
445 val.i_int = ACTIONID_TOGGLE_FULLSCREEN; break;
447 val.i_int = ACTIONID_VOL_UP; break;
449 val.i_int = ACTIONID_VOL_DOWN; break;
451 var_SetInteger( p_vout->p_libvlc, "key-action", val.i_int );
453 else if( ( xevent.type == VisibilityNotify &&
454 xevent.xvisibility.state == VisibilityUnobscured ) ||
455 xevent.type == FocusIn )
457 p_vout->p_sys->b_video_enabled = true;
458 p_vout->p_sys->p_output_picture->p->p_pixels =
459 p_vout->p_sys->p_center;
460 XSetInputFocus( p_vout->p_sys->p_display, p_vout->p_sys->window,
461 RevertToParent, CurrentTime );
463 else if( ( xevent.type == VisibilityNotify &&
464 xevent.xvisibility.state != VisibilityUnobscured ) ||
465 xevent.type == FocusOut || xevent.type == UnmapNotify )
467 UpdateScreen( p_vout, 0, 0,
468 p_vout->p_sys->fb_vinfo.xres,
469 p_vout->p_sys->fb_vinfo.yres,
470 p_vout->p_sys->fb_vinfo.xres,
471 p_vout->p_sys->fb_vinfo.yres,
472 OMAPFB_COLOR_RGB565 );
473 p_vout->p_sys->b_video_enabled = false;
474 p_vout->p_sys->p_output_picture->p->p_pixels =
475 p_vout->p_sys->p_null;
479 if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE )
481 /* Update the object variable and trigger callback */
482 var_SetBool( p_vout, "fullscreen", !p_vout->b_fullscreen );
484 if( p_vout->p_sys->b_embed )
485 ToggleFullScreen( p_vout );
486 p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
489 if( p_vout->i_changes & VOUT_SIZE_CHANGE )
491 FreePicture( p_vout, p_vout->p_sys->p_output_picture );
494 msg_Err( p_vout, "cannot reinit framebuffer screen" );
501 if ( p_vout->p_sys->p_octx != NULL ) {
502 if ( p_vout->p_sys->i_backlight_on_counter == i_backlight_on_interval ) {
503 if ( osso_display_blanking_pause( p_vout->p_sys->p_octx ) != OSSO_OK ) {
504 msg_Err( p_vout, "Could not disable backlight blanking" );
506 msg_Dbg( p_vout, "Backlight blanking disabled" );
508 p_vout->p_sys->i_backlight_on_counter = 0;
510 p_vout->p_sys->i_backlight_on_counter ++;
518 /*****************************************************************************
519 * DisplayVideo: displays previously rendered output
520 *****************************************************************************
521 * This function update the screen resulting in the display of the last
523 *****************************************************************************/
524 static void DisplayVideo( vout_thread_t *p_vout, picture_t *p_pic )
528 if( !p_vout->p_sys->b_video_enabled )
531 UpdateScreen( p_vout,
532 p_vout->p_sys->output_window.i_x,
533 p_vout->p_sys->output_window.i_y,
534 p_vout->p_sys->i_video_width,
535 p_vout->p_sys->i_video_height,
536 p_vout->p_sys->output_window.i_width,
537 p_vout->p_sys->output_window.i_height,
538 p_vout->p_sys->i_color_format );
540 // Wait for the window to be fully displayed
541 ioctl( p_vout->p_sys->i_fd, OMAPFB_SYNC_GFX);
544 /*****************************************************************************
545 * OpenDisplay: initialize framebuffer
546 *****************************************************************************/
547 static int OpenDisplay( vout_thread_t *p_vout )
549 vout_sys_t *p_sys = (vout_sys_t *) p_vout->p_sys;
550 char *psz_device; /* framebuffer device path */
552 /* Open framebuffer device */
553 if( !(psz_device = config_GetPsz( p_vout, FB_DEV_VAR )) )
555 msg_Err( p_vout, "don't know which fb device to open" );
559 p_sys->i_fd = open( psz_device, O_RDWR );
560 if( p_sys->i_fd == -1 )
562 msg_Err( p_vout, "cannot open %s (%m)", psz_device );
569 // Get caps, try older interface if needed
570 if( ioctl( p_sys->i_fd, OMAPFB_GET_CAPS, &p_sys->caps ) != 0 )
572 if( ioctl( p_sys->i_fd, OMAP_IOR( 42, unsigned long ), &p_sys->caps ) != 0 )
574 msg_Err( p_vout, "OMAPFB_GET_CAPS ioctl failed" );
575 close( p_sys->i_fd );
580 if( ( p_sys->caps.ctrl & OMAPFB_CAPS_TEARSYNC ) != 0 )
581 p_sys->b_tearsync = true;
583 if( ioctl( p_sys->i_fd, FBIOGET_VSCREENINFO, &p_sys->fb_vinfo ) )
585 msg_Err( p_vout, "Can't get VSCREENINFO: %s", strerror(errno) );
588 if( ioctl( p_sys->i_fd, FBIOGET_FSCREENINFO, &p_sys->fb_finfo ) )
590 msg_Err( p_vout, "Can't get FSCREENINFO: %s", strerror(errno) );
594 p_sys->i_bytes_per_pixel = 2;
595 p_sys->i_page_size = p_sys->fb_finfo.smem_len;
596 p_sys->i_line_len = p_sys->fb_finfo.line_length;
598 if( (p_sys->p_video = (uint8_t *)mmap( 0, p_sys->i_page_size, PROT_READ | PROT_WRITE, MAP_SHARED,
599 p_sys->i_fd, 0 )) == MAP_FAILED )
601 msg_Err( p_vout, "Can't mmap: %s", strerror(errno) );
605 p_sys->p_display = XOpenDisplay( NULL );
607 /* Open /dev/null and map it */
608 p_sys->i_null_fd = open( "/dev/zero", O_RDWR );
609 if( p_sys->i_null_fd == -1 )
611 msg_Err( p_vout, "cannot open /dev/zero (%m)" );
615 if( (p_sys->p_null = (uint8_t *)mmap( 0, p_sys->i_page_size, PROT_READ | PROT_WRITE,
616 MAP_PRIVATE, p_sys->i_null_fd, 0 )) == MAP_FAILED )
618 msg_Err( p_vout, "Can't mmap 2: %s", strerror(errno) );
625 /*****************************************************************************
626 * CloseDisplay: terminate FB video thread output method
627 *****************************************************************************/
628 static void CloseDisplay( vout_thread_t *p_vout )
630 munmap( p_vout->p_sys->p_video, p_vout->p_sys->i_page_size );
631 munmap( p_vout->p_sys->p_null, p_vout->p_sys->i_page_size );
633 close( p_vout->p_sys->i_fd );
634 close( p_vout->p_sys->i_null_fd );
637 /*****************************************************************************
638 * UpdateScreen: update the screen of the omapfb
639 *****************************************************************************/
640 static void UpdateScreen( vout_thread_t *p_vout, int i_x, int i_y,
641 int i_width, int i_height,
642 int i_out_width, int i_out_height, int i_format )
644 struct omapfb_update_window update;
647 update.width = i_width;
648 update.height = i_height;
651 update.out_width = i_out_width;
652 update.out_height = i_out_height;
653 update.format = i_format;
654 if( p_vout->p_sys->b_tearsync )
655 update.format |= OMAPFB_FORMAT_FLAG_TEARSYNC;
656 ioctl( p_vout->p_sys->i_fd, OMAPFB_UPDATE_WINDOW, &update );
659 /*****************************************************************************
660 * InitWindow: get embedded window and init X11
661 *****************************************************************************/
662 static int InitWindow( vout_thread_t *p_vout )
664 vout_sys_t *p_sys = (vout_sys_t *)p_vout->p_sys;
668 p_sys->p_display = XOpenDisplay( NULL );
670 // Request window from interface
671 p_sys->owner_window =
672 vout_RequestXWindow( p_vout,
673 &p_sys->embedded_window.i_x,
674 &p_sys->embedded_window.i_y,
675 &p_sys->embedded_window.i_width,
676 &p_sys->embedded_window.i_height );
677 p_sys->main_window = p_sys->embedded_window;
679 // We have to create a new window to get some events
680 // (ButtonPress for example)
681 CreateWindow( p_sys );
685 // No embedding, fullscreen framebuffer overlay with no events handling
686 p_sys->main_window.i_x = p_sys->main_window.i_y = 0;
687 p_sys->main_window.i_width = p_sys->fb_vinfo.xres;
688 p_sys->main_window.i_height = p_sys->fb_vinfo.yres;
689 p_vout->b_fullscreen = true;
690 var_SetBool( p_vout, "fullscreen", p_vout->b_fullscreen );
696 static void CreateWindow( vout_sys_t *p_sys )
698 XSetWindowAttributes xwindow_attributes;
699 xwindow_attributes.backing_store = Always;
700 xwindow_attributes.background_pixel =
701 BlackPixel( p_sys->p_display, DefaultScreen(p_sys->p_display) );
702 xwindow_attributes.event_mask = ExposureMask | StructureNotifyMask;
703 p_sys->window = XCreateWindow( p_sys->p_display,
704 p_sys->owner_window->handle.xid,
706 p_sys->main_window.i_width,
707 p_sys->main_window.i_height,
710 CWBackingStore | CWBackPixel | CWEventMask,
711 &xwindow_attributes );
713 XMapWindow( p_sys->p_display, p_sys->window );
714 XSelectInput( p_sys->p_display, p_sys->window,
715 KeyPressMask | ButtonPressMask | StructureNotifyMask |
716 VisibilityChangeMask | FocusChangeMask );
717 XSelectInput( p_sys->p_display, p_sys->owner_window->handle.xid,
718 StructureNotifyMask );
719 XSetInputFocus( p_sys->p_display, p_sys->window, RevertToParent, CurrentTime );
722 static void ToggleFullScreen ( vout_thread_t * p_vout )
724 p_vout->b_fullscreen = !p_vout->b_fullscreen;
726 if( p_vout->b_fullscreen )
728 msg_Dbg( p_vout, "Entering fullscreen mode" );
729 XReparentWindow( p_vout->p_sys->p_display,
730 p_vout->p_sys->window,
731 DefaultRootWindow( p_vout->p_sys->p_display ),
736 /* init X event structure for _NET_WM_FULLSCREEN client msg */
737 xev.xclient.type = ClientMessage;
738 xev.xclient.serial = 0;
739 xev.xclient.send_event = True;
740 xev.xclient.message_type = XInternAtom( p_vout->p_sys->p_display,
741 "_NET_WM_STATE", False );
742 xev.xclient.window = p_vout->p_sys->window;
743 xev.xclient.format = 32;
744 if( p_vout->b_fullscreen )
745 xev.xclient.data.l[0] = 1;
747 xev.xclient.data.l[0] = 0;
748 xev.xclient.data.l[1] = XInternAtom( p_vout->p_sys->p_display,
749 "_NET_WM_STATE_FULLSCREEN", False );
750 xev.xclient.data.l[2] = 0;
751 xev.xclient.data.l[3] = 0;
752 xev.xclient.data.l[4] = 0;
754 XSendEvent( p_vout->p_sys->p_display,
755 DefaultRootWindow( p_vout->p_sys->p_display ), False,
756 SubstructureRedirectMask | SubstructureNotifyMask, &xev);
758 p_vout->p_sys->main_window.i_x = p_vout->p_sys->main_window.i_y = 0;
759 p_vout->p_sys->main_window.i_width = p_vout->p_sys->fb_vinfo.xres;
760 p_vout->p_sys->main_window.i_height = p_vout->p_sys->fb_vinfo.yres;
764 msg_Dbg( p_vout, "Leaving fullscreen mode" );
766 XDestroyWindow( p_vout->p_sys->p_display, p_vout->p_sys->window );
768 p_vout->p_sys->main_window = p_vout->p_sys->embedded_window;
769 CreateWindow( p_vout->p_sys );
772 XSync( p_vout->p_sys->p_display, False);
774 /* signal that the size needs to be updated */
775 p_vout->i_changes |= VOUT_SIZE_CHANGE;