2009-02-08 03:27:30 +00:00
|
|
|
/*
|
|
|
|
* video output through mga_vid kernel driver
|
|
|
|
*
|
|
|
|
* This file is part of MPlayer.
|
|
|
|
*
|
|
|
|
* MPlayer is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* MPlayer is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2001-02-24 20:28:24 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "config.h"
|
2006-04-24 04:23:53 +00:00
|
|
|
#include "mp_msg.h"
|
2001-02-24 20:28:24 +00:00
|
|
|
#include "video_out.h"
|
|
|
|
#include "video_out_internal.h"
|
|
|
|
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <sys/mman.h>
|
2002-02-09 01:10:22 +00:00
|
|
|
#include <linux/fb.h>
|
2001-02-24 20:28:24 +00:00
|
|
|
|
|
|
|
#include "drivers/mga_vid.h"
|
2011-01-26 17:40:52 +00:00
|
|
|
#include "sub/sub.h"
|
2001-10-20 22:29:29 +00:00
|
|
|
#include "aspect.h"
|
2001-02-24 20:28:24 +00:00
|
|
|
|
2009-07-06 23:26:13 +00:00
|
|
|
static const vo_info_t info =
|
2001-02-24 20:28:24 +00:00
|
|
|
{
|
2002-10-09 13:25:13 +00:00
|
|
|
"Matrox G200/G4x0/G550 overlay (/dev/mga_vid)",
|
2001-02-24 20:28:24 +00:00
|
|
|
"mga",
|
2002-10-09 13:25:13 +00:00
|
|
|
"A'rpi",
|
|
|
|
"Based on some code by Aaron Holtzman <aholtzma@ess.engr.uvic.ca>"
|
2001-02-24 20:28:24 +00:00
|
|
|
};
|
|
|
|
|
2007-12-02 14:39:15 +00:00
|
|
|
const LIBVO_EXTERN(mga)
|
2001-02-24 20:28:24 +00:00
|
|
|
|
2010-06-16 13:55:09 +00:00
|
|
|
#include "mga_template.c"
|
2001-02-24 20:28:24 +00:00
|
|
|
|
2002-02-09 01:10:22 +00:00
|
|
|
#define FBDEV "/dev/fb0"
|
|
|
|
|
2005-08-05 01:24:37 +00:00
|
|
|
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)
|
2001-02-24 20:28:24 +00:00
|
|
|
{
|
|
|
|
|
2002-03-31 20:45:31 +00:00
|
|
|
// if (f >= 0) mga_uninit();
|
2002-02-09 01:10:22 +00:00
|
|
|
if(!vo_screenwidth || !vo_screenheight) {
|
|
|
|
int fd;
|
|
|
|
struct fb_var_screeninfo fbinfo;
|
|
|
|
|
|
|
|
if(-1 != (fd = open(FBDEV, O_RDONLY))) {
|
|
|
|
if(0 == ioctl(fd, FBIOGET_VSCREENINFO, &fbinfo)) {
|
|
|
|
if(!vo_screenwidth) vo_screenwidth = fbinfo.xres;
|
|
|
|
if(!vo_screenheight) vo_screenheight = fbinfo.yres;
|
|
|
|
} else {
|
|
|
|
perror("FBIOGET_VSCREENINFO");
|
|
|
|
}
|
|
|
|
close(fd);
|
|
|
|
} else {
|
|
|
|
perror(FBDEV);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-10-20 22:29:29 +00:00
|
|
|
if(vo_screenwidth && vo_screenheight){
|
|
|
|
aspect_save_orig(width,height);
|
|
|
|
aspect_save_prescale(d_width,d_height);
|
|
|
|
aspect_save_screenres(vo_screenwidth,vo_screenheight);
|
2009-07-06 23:26:13 +00:00
|
|
|
|
2005-04-19 22:11:34 +00:00
|
|
|
if(flags&VOFLAG_FULLSCREEN) { /* -fs */
|
2001-10-20 22:30:25 +00:00
|
|
|
aspect(&d_width,&d_height,A_ZOOM);
|
2002-05-05 18:58:42 +00:00
|
|
|
vo_fs = VO_TRUE;
|
|
|
|
} else {
|
2001-10-20 22:29:29 +00:00
|
|
|
aspect(&d_width,&d_height,A_NOZOOM);
|
2002-05-05 18:58:42 +00:00
|
|
|
vo_fs = VO_FALSE;
|
|
|
|
}
|
2009-07-06 22:15:02 +00:00
|
|
|
mp_tmsg(MSGT_VO,MSGL_INFO, "[VO_MGA] aspect(): resized to %dx%d.\n",d_width,d_height);
|
2001-10-20 22:29:29 +00:00
|
|
|
}
|
|
|
|
|
2003-04-26 16:56:21 +00:00
|
|
|
vo_dwidth=d_width; vo_dheight=d_height;
|
2001-02-24 20:28:24 +00:00
|
|
|
mga_vid_config.dest_width = d_width;
|
|
|
|
mga_vid_config.dest_height= d_height;
|
|
|
|
mga_vid_config.x_org= 0; // (720-mga_vid_config.dest_width)/2;
|
|
|
|
mga_vid_config.y_org= 0; // (576-mga_vid_config.dest_height)/2;
|
2001-10-21 21:12:00 +00:00
|
|
|
if(vo_screenwidth && vo_screenheight){
|
|
|
|
mga_vid_config.x_org=(vo_screenwidth-d_width)/2;
|
|
|
|
mga_vid_config.y_org=(vo_screenheight-d_height)/2;
|
|
|
|
}
|
2009-07-06 23:26:13 +00:00
|
|
|
|
2002-10-09 13:25:13 +00:00
|
|
|
return mga_init(width,height,format);
|
2001-02-24 20:28:24 +00:00
|
|
|
}
|
|
|
|
|
2002-10-09 13:25:13 +00:00
|
|
|
static void uninit(void)
|
2001-02-24 20:28:24 +00:00
|
|
|
{
|
2009-07-06 22:15:02 +00:00
|
|
|
mp_tmsg(MSGT_VO,MSGL_INFO, "[VO] uninit!\n");
|
2002-10-09 13:25:13 +00:00
|
|
|
mga_uninit();
|
2001-02-24 20:28:24 +00:00
|
|
|
}
|
|
|
|
|
2001-08-13 11:08:18 +00:00
|
|
|
static void flip_page(void)
|
|
|
|
{
|
2001-03-03 21:46:39 +00:00
|
|
|
vo_mga_flip_page();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void check_events(void)
|
|
|
|
{
|
|
|
|
}
|