2 * video output through mga_vid kernel driver
4 * This file is part of MPlayer.
6 * MPlayer is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * MPlayer is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 #include "video_out.h"
28 #include "video_out_internal.h"
30 #include <sys/ioctl.h>
36 #include "drivers/mga_vid.h"
40 static const vo_info_t info
=
42 "Matrox G200/G4x0/G550 overlay (/dev/mga_vid)",
45 "Based on some code by Aaron Holtzman <aholtzma@ess.engr.uvic.ca>"
48 const LIBVO_EXTERN(mga
)
50 #include "mga_template.c"
52 #define FBDEV "/dev/fb0"
54 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
)
57 // if (f >= 0) mga_uninit();
58 if(!vo_screenwidth
|| !vo_screenheight
) {
60 struct fb_var_screeninfo fbinfo
;
62 if(-1 != (fd
= open(FBDEV
, O_RDONLY
))) {
63 if(0 == ioctl(fd
, FBIOGET_VSCREENINFO
, &fbinfo
)) {
64 if(!vo_screenwidth
) vo_screenwidth
= fbinfo
.xres
;
65 if(!vo_screenheight
) vo_screenheight
= fbinfo
.yres
;
67 perror("FBIOGET_VSCREENINFO");
75 if(vo_screenwidth
&& vo_screenheight
){
76 aspect_save_orig(width
,height
);
77 aspect_save_prescale(d_width
,d_height
);
78 aspect_save_screenres(vo_screenwidth
,vo_screenheight
);
80 if(flags
&VOFLAG_FULLSCREEN
) { /* -fs */
81 aspect(&d_width
,&d_height
,A_ZOOM
);
84 aspect(&d_width
,&d_height
,A_NOZOOM
);
87 mp_tmsg(MSGT_VO
,MSGL_INFO
, "[VO_MGA] aspect(): resized to %dx%d.\n",d_width
,d_height
);
90 vo_dwidth
=d_width
; vo_dheight
=d_height
;
91 mga_vid_config
.dest_width
= d_width
;
92 mga_vid_config
.dest_height
= d_height
;
93 mga_vid_config
.x_org
= 0; // (720-mga_vid_config.dest_width)/2;
94 mga_vid_config
.y_org
= 0; // (576-mga_vid_config.dest_height)/2;
95 if(vo_screenwidth
&& vo_screenheight
){
96 mga_vid_config
.x_org
=(vo_screenwidth
-d_width
)/2;
97 mga_vid_config
.y_org
=(vo_screenheight
-d_height
)/2;
100 return mga_init(width
,height
,format
);
103 static void uninit(void)
105 mp_tmsg(MSGT_VO
,MSGL_INFO
, "[VO] uninit!\n");
109 static void flip_page(void)
115 static void check_events(void)