2001-02-24 21:28:24 +01:00
|
|
|
/*
|
2002-10-09 15:25:13 +02:00
|
|
|
* output through mga_vid kernel driver
|
2001-02-24 21:28:24 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "config.h"
|
2006-04-24 06:23:53 +02:00
|
|
|
#include "mp_msg.h"
|
|
|
|
#include "help_mp.h"
|
2001-02-24 21:28:24 +01: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 02:10:22 +01:00
|
|
|
#include <linux/fb.h>
|
2001-02-24 21:28:24 +01:00
|
|
|
|
|
|
|
#include "drivers/mga_vid.h"
|
2001-04-24 13:42:04 +02:00
|
|
|
#include "sub.h"
|
2001-10-21 00:29:29 +02:00
|
|
|
#include "aspect.h"
|
2001-02-24 21:28:24 +01:00
|
|
|
|
2007-12-02 15:06:03 +01:00
|
|
|
static const vo_info_t info =
|
2001-02-24 21:28:24 +01:00
|
|
|
{
|
2002-10-09 15:25:13 +02:00
|
|
|
"Matrox G200/G4x0/G550 overlay (/dev/mga_vid)",
|
2001-02-24 21:28:24 +01:00
|
|
|
"mga",
|
2002-10-09 15:25:13 +02:00
|
|
|
"A'rpi",
|
|
|
|
"Based on some code by Aaron Holtzman <aholtzma@ess.engr.uvic.ca>"
|
2001-02-24 21:28:24 +01:00
|
|
|
};
|
|
|
|
|
2007-12-02 15:39:15 +01:00
|
|
|
const LIBVO_EXTERN(mga)
|
2001-02-24 21:28:24 +01:00
|
|
|
|
|
|
|
#include "mga_common.c"
|
|
|
|
|
2002-02-09 02:10:22 +01:00
|
|
|
#define FBDEV "/dev/fb0"
|
|
|
|
|
2005-08-05 03:24:37 +02: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 21:28:24 +01:00
|
|
|
{
|
|
|
|
|
2002-03-31 22:45:31 +02:00
|
|
|
// if (f >= 0) mga_uninit();
|
2002-02-09 02:10:22 +01: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-21 00:29:29 +02: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);
|
|
|
|
|
2005-04-20 00:11:34 +02:00
|
|
|
if(flags&VOFLAG_FULLSCREEN) { /* -fs */
|
2001-10-21 00:30:25 +02:00
|
|
|
aspect(&d_width,&d_height,A_ZOOM);
|
2002-05-05 20:58:42 +02:00
|
|
|
vo_fs = VO_TRUE;
|
|
|
|
} else {
|
2001-10-21 00:29:29 +02:00
|
|
|
aspect(&d_width,&d_height,A_NOZOOM);
|
2002-05-05 20:58:42 +02:00
|
|
|
vo_fs = VO_FALSE;
|
|
|
|
}
|
2006-04-24 06:23:53 +02:00
|
|
|
mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_MGA_AspectResized,d_width,d_height);
|
2001-10-21 00:29:29 +02:00
|
|
|
}
|
|
|
|
|
2003-04-26 18:56:21 +02:00
|
|
|
vo_dwidth=d_width; vo_dheight=d_height;
|
2001-02-24 21:28:24 +01: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 23:12:00 +02: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;
|
|
|
|
}
|
2001-03-08 02:06:03 +01:00
|
|
|
|
2002-10-09 15:25:13 +02:00
|
|
|
return mga_init(width,height,format);
|
2001-02-24 21:28:24 +01:00
|
|
|
}
|
|
|
|
|
2002-10-09 15:25:13 +02:00
|
|
|
static void uninit(void)
|
2001-02-24 21:28:24 +01:00
|
|
|
{
|
2006-04-24 06:23:53 +02:00
|
|
|
mp_msg(MSGT_VO,MSGL_INFO, MSGTR_LIBVO_MGA_Uninit);
|
2002-10-09 15:25:13 +02:00
|
|
|
mga_uninit();
|
2001-02-24 21:28:24 +01:00
|
|
|
}
|
|
|
|
|
2001-08-13 13:08:18 +02:00
|
|
|
static void flip_page(void)
|
|
|
|
{
|
2001-03-03 22:46:39 +01:00
|
|
|
vo_mga_flip_page();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void check_events(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|