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"
|
|
|
|
#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
|
|
|
|
2002-11-11 16:22:10 +01:00
|
|
|
static 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
|
|
|
};
|
|
|
|
|
2002-11-11 16:22:10 +01:00
|
|
|
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"
|
|
|
|
|
2002-10-09 15:25:13 +02:00
|
|
|
static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, 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);
|
|
|
|
|
2002-05-05 20:58:42 +02:00
|
|
|
if(fullscreen&0x01) { /* -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;
|
|
|
|
}
|
2001-10-21 00:53:32 +02:00
|
|
|
printf("vo_mga aspect(): resized to %dx%d\n",d_width,d_height);
|
2001-10-21 00:29:29 +02:00
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2002-10-09 15:25:13 +02:00
|
|
|
printf("vo: uninit!\n");
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|