Comment out the correct #endif directive.
[mplayer/greg.git] / libvo / vo_mga.c
blobff6d4cf19a6d44e2668fcb7487b074efc3f914b6
1 /*
2 * output through mga_vid kernel driver
3 */
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <string.h>
9 #include "config.h"
10 #include "mp_msg.h"
11 #include "help_mp.h"
12 #include "video_out.h"
13 #include "video_out_internal.h"
15 #include <sys/ioctl.h>
16 #include <unistd.h>
17 #include <fcntl.h>
18 #include <sys/mman.h>
19 #include <linux/fb.h>
21 #include "drivers/mga_vid.h"
22 #include "sub.h"
23 #include "aspect.h"
25 static const vo_info_t info =
27 "Matrox G200/G4x0/G550 overlay (/dev/mga_vid)",
28 "mga",
29 "A'rpi",
30 "Based on some code by Aaron Holtzman <aholtzma@ess.engr.uvic.ca>"
33 const LIBVO_EXTERN(mga)
35 #include "mga_common.c"
37 #define FBDEV "/dev/fb0"
39 static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format)
42 // if (f >= 0) mga_uninit();
43 if(!vo_screenwidth || !vo_screenheight) {
44 int fd;
45 struct fb_var_screeninfo fbinfo;
47 if(-1 != (fd = open(FBDEV, O_RDONLY))) {
48 if(0 == ioctl(fd, FBIOGET_VSCREENINFO, &fbinfo)) {
49 if(!vo_screenwidth) vo_screenwidth = fbinfo.xres;
50 if(!vo_screenheight) vo_screenheight = fbinfo.yres;
51 } else {
52 perror("FBIOGET_VSCREENINFO");
54 close(fd);
55 } else {
56 perror(FBDEV);
60 if(vo_screenwidth && vo_screenheight){
61 aspect_save_orig(width,height);
62 aspect_save_prescale(d_width,d_height);
63 aspect_save_screenres(vo_screenwidth,vo_screenheight);
65 if(flags&VOFLAG_FULLSCREEN) { /* -fs */
66 aspect(&d_width,&d_height,A_ZOOM);
67 vo_fs = VO_TRUE;
68 } else {
69 aspect(&d_width,&d_height,A_NOZOOM);
70 vo_fs = VO_FALSE;
72 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_MGA_AspectResized,d_width,d_height);
75 vo_dwidth=d_width; vo_dheight=d_height;
76 mga_vid_config.dest_width = d_width;
77 mga_vid_config.dest_height= d_height;
78 mga_vid_config.x_org= 0; // (720-mga_vid_config.dest_width)/2;
79 mga_vid_config.y_org= 0; // (576-mga_vid_config.dest_height)/2;
80 if(vo_screenwidth && vo_screenheight){
81 mga_vid_config.x_org=(vo_screenwidth-d_width)/2;
82 mga_vid_config.y_org=(vo_screenheight-d_height)/2;
85 return mga_init(width,height,format);
88 static void uninit(void)
90 mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_MGA_Uninit);
91 mga_uninit();
94 static void flip_page(void)
96 vo_mga_flip_page();
100 static void check_events(void)