//#define CRTC2
// YUY2 support (see config.format) added by A'rpi/ESP-team
// double buffering added by A'rpi/ESP-team
// brightness/contrast introduced by eyck
// Set this value, if autodetection fails! (video ram size in megabytes)
// #define MGA_MEMORY_SIZE 16
//#define MGA_ALLOW_IRQ
#define MGA_VSYNC_POS 2
/*
*
* mga_vid.c
*
* Copyright (C) 1999 Aaron Holtzman
*
* Module skeleton based on gutted agpgart module by Jeff Hartmann
* <slicer@ionet.net>
*
* Matrox MGA G200/G400 YUV Video Interface module Version 0.1.0
*
* BES == Back End Scaler
*
* This software has been released under the terms of the GNU Public
* license. See http://www.gnu.org/copyleft/gpl.html for details.
*/
//It's entirely possible this major conflicts with something else
/* mknod /dev/mga_vid c 178 0 */
#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/errno.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10)
#include <linux/malloc.h>
#else
#include <linux/slab.h>
#endif
#include <linux/pci.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include "mga_vid.h"
#ifdef CONFIG_MTRR
#include <asm/mtrr.h>
#endif
#ifdef CONFIG_DEVFS_FS
#include <linux/devfs_fs_kernel.h>
#endif
#include <asm/uaccess.h>
#include <asm/system.h>
#include <asm/io.h>
#define TRUE 1
#define FALSE 0
#define MGA_VID_MAJOR 178
//#define MGA_VIDMEM_SIZE mga_ram_size
#ifndef PCI_DEVICE_ID_MATROX_G200_PCI
#define PCI_DEVICE_ID_MATROX_G200_PCI 0x0520
#endif
#ifndef PCI_DEVICE_ID_MATROX_G200_AGP
#define PCI_DEVICE_ID_MATROX_G200_AGP 0x0521
#endif
#ifndef PCI_DEVICE_ID_MATROX_G400
#define PCI_DEVICE_ID_MATROX_G400 0x0525
#endif
#ifndef PCI_DEVICE_ID_MATROX_G550
#define PCI_DEVICE_ID_MATROX_G550 0x2527
#endif
MODULE_AUTHOR("Aaron Holtzman <aholtzma@engr.uvic.ca>");
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
#define PARAM_BRIGHTNESS "brightness="
#define PARAM_CONTRAST "contrast="
#define PARAM_BLACKIE "blackie="
#define PARAM_BUFF_SIZE 4096
static uint8_t *mga_param_buff = NULL;
static uint32_t mga_param_buff_size=0;
static uint32_t mga_param_buff_len=0;
#ifndef min
#define min(x,y) (((x)<(y))?(x):(y))
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
#include <linux/ctype.h>
static unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base)
{
unsigned long res
|