2001-02-24 20:28:24 +00:00
|
|
|
/*
|
2002-10-09 13:25:13 +00:00
|
|
|
* output through mga_vid kernel driver
|
2001-02-24 20:28:24 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#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"
|
2001-04-24 11:42:04 +00:00
|
|
|
#include "sub.h"
|
2001-10-20 22:29:29 +00:00
|
|
|
#include "aspect.h"
|
2001-02-24 20:28:24 +00:00
|
|
|
|
2002-11-11 15:22:10 +00:00
|
|
|
static 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
|
|
|
};
|
|
|
|
|
2002-11-11 15:22:10 +00:00
|
|
|
LIBVO_EXTERN(mga)
|
2001-02-24 20:28:24 +00:00
|
|
|
|
|
|
|
#include "mga_common.c"
|
|
|
|
|
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);
|
|
|
|
|
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;
|
|
|
|
}
|
2001-10-20 22:53:32 +00:00
|
|
|
printf("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;
|
|
|
|
}
|
2001-03-08 01:06:03 +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
|
|
|
{
|
2002-10-09 13:25:13 +00:00
|
|
|
printf("vo: uninit!\n");
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|