[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xine-cvslog
Subject:    [xine-cvs] HG: xine-lib-1.2-plugin-loader: [34/35] Merge from 1.2
From:       Darren Salt <linux () youmustbejoking ! demon ! co ! uk>
Date:       2007-06-21 22:31:51
Message-ID: 3e9d711a77870cbbca8d.1182464857:34 () hg ! debian ! org
[Download RAW message or body]

# [node df73844e8a47005bef76ffe6cd9323d8e6a1c218 part 34]

diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/libdha/sysdep/libdha_win32.c
--- a/src/video_out/libdha/sysdep/libdha_win32.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
-  MAPDEV.h - include file for VxD MAPDEV
-  Copyright (c) 1996 Vireo Software, Inc.
-  Modified for libdha by Nick Kurshev.
-*/
-
-#include <windows.h>
-
-/*
-  This is the request structure that applications use
-  to request services from the MAPDEV VxD.
-*/
-
-typedef struct _MapDevRequest
-{
-	DWORD	mdr_ServiceID;		/* supplied by caller */
-	LPVOID	mdr_PhysicalAddress;	/* supplied by caller */
-	DWORD	mdr_SizeInBytes;	/* supplied by caller */
-	LPVOID	mdr_LinearAddress;	/* returned by VxD */
-	WORD	mdr_Selector;		/* returned if 16-bit caller */
-	WORD	mdr_Status;		/* MDR_xxxx code below */
-} MAPDEVREQUEST, *PMAPDEVREQUEST;
-
-#define MDR_SERVICE_MAP		CTL_CODE(FILE_DEVICE_UNKNOWN, 1, METHOD_NEITHER, \
                FILE_ANY_ACCESS)
-#define MDR_SERVICE_UNMAP	CTL_CODE(FILE_DEVICE_UNKNOWN, 2, METHOD_NEITHER, \
                FILE_ANY_ACCESS)
-
-#define MDR_STATUS_SUCCESS	1
-#define MDR_STATUS_ERROR	0
-/*#include "winioctl.h"*/
-#define FILE_DEVICE_UNKNOWN             0x00000022
-#define METHOD_NEITHER                  3
-#define FILE_ANY_ACCESS                 0
-#define CTL_CODE( DeviceType, Function, Method, Access ) ( \
-    ((DeviceType)<<16) | ((Access)<<14) | ((Function)<<2) | (Method) )
-
-/* Memory Map a piece of Real Memory */
-void *map_phys_mem(unsigned base, unsigned size) {
-
-  HANDLE hDevice ;
-  PVOID inBuf[1] ;		/* buffer for struct pointer to VxD */
-  DWORD RetInfo[2] ;		/* buffer to receive data from VxD */
-  DWORD cbBytesReturned ;	/* count of bytes returned from VxD */
-  MAPDEVREQUEST req ;		/* map device request structure */
-  DWORD *pNicstar, Status, Time ; int i ; char *endptr ;
-  const PCHAR VxDName = "\\\\.\\MAPDEV.VXD" ;
-  const PCHAR VxDNameAlreadyLoaded = "\\\\.\\MAPDEV" ;
-
-  hDevice = CreateFile(VxDName, 0,0,0,
-                       CREATE_NEW, FILE_FLAG_DELETE_ON_CLOSE, 0) ;
-  if (hDevice == INVALID_HANDLE_VALUE)
-    hDevice = CreateFile(VxDNameAlreadyLoaded, 0,0,0,
-                         CREATE_NEW, FILE_FLAG_DELETE_ON_CLOSE, 0) ;
-  if (hDevice == INVALID_HANDLE_VALUE) {
-    fprintf(stderr, "Cannot open driver, error=%08lx\n", GetLastError()) ;
-    exit(1) ; }
-
-  req.mdr_ServiceID = MDR_SERVICE_MAP ;
-  req.mdr_PhysicalAddress = (PVOID)base ;
-  req.mdr_SizeInBytes = size ;
-  inBuf[0] = &req ;
-
-  if ( ! DeviceIoControl(hDevice, MDR_SERVICE_MAP, inBuf, sizeof(PVOID),
-         NULL, 0, &cbBytesReturned, NULL) ) {
-    fprintf(stderr, "Failed to map device\n") ; exit(1) ; }
-
-  return (void*)req.mdr_LinearAddress ;
-}
-
-void unmap_phys_mem(void *ptr, unsigned size) { }
-
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/libdha/sysdep/pci_386bsd.c
--- a/src/video_out/libdha/sysdep/pci_386bsd.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
-   This file is based on:
-   $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 \
                11:55:40 dawes Exp $
-   Modified for readability by Nick Kurshev
-*/
-#include <errno.h>
-#include <sys/file.h>
-#include <machine/console.h>
-#ifndef GCCUSESGAS
-#define GCCUSESGAS
-#endif
-
-static int io_fd;
-
-static __inline__ int enable_os_io(void)
-{
-    io_fd = -1 ;
-    if ((io_fd = open("/dev/console", O_RDWR, 0)) < 0) {
-        perror("/dev/console");
-	return(errno);
-    }
-    if (ioctl(io_fd, KDENABIO, 0) < 0) {
-        perror("ioctl(KDENABIO)");
-	return(errno);
-    }
-    return(0);
-}
-
-static __inline__ int disable_os_io(void)
-{
-    if (ioctl(io_fd, KDDISABIO, 0) < 0) {
-        perror("ioctl(KDDISABIO)");
-	close(io_fd);
-	return(errno);
-    }
-    close(io_fd);
-    return(0);
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/libdha/sysdep/pci_alpha.c
--- a/src/video_out/libdha/sysdep/pci_alpha.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
-   This file is based on:
-   $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 \
                11:55:40 dawes Exp $
-   Modified for readability by Nick Kurshev
-*/
-
-static int pci_config_type( void ) { return 1; }
-
-static int pci_get_vendor(
-          unsigned char bus,
-          unsigned char dev,
-          int func)
-{
-    unsigned long retval;
-    pciconfig_read(bus, dev<<3, PCI_ID_REG, 4, &retval);
-    return retval;
-}
-
-static long pci_config_read_long(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd)
-{
-    unsigned long retval;
-    pciconfig_read(bus, dev<<3, cmd, 4, &retval);
-    return retval;
-}
-
-static long pci_config_read_word(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd)
-{
-    unsigned long retval;
-    pciconfig_read(bus, dev<<3, cmd, 2, &retval);
-    return retval;
-}
-
-static long pci_config_read_byte(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd)
-{
-    unsigned long retval;
-    pciconfig_read(bus, dev<<3, cmd, 1, &retval);
-    return retval;
-}
-
-static void pci_config_write_long(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd,
-	  long val)
-{
-    pciconfig_write(bus, dev<<3, cmd, 4, val);
-}
-
-static void pci_config_write_word(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd,
-	  long val)
-{
-    pciconfig_write(bus, dev<<3, cmd, 2, val);
-}
-
-static void pci_config_write_byte(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd,
-	  long val)
-{
-    pciconfig_write(bus, dev<<3, cmd, 1, val);
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/libdha/sysdep/pci_arm32.c
--- a/src/video_out/libdha/sysdep/pci_arm32.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*
-   This file is based on:
-   $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 \
                11:55:40 dawes Exp $
-   Modified for readability by Nick Kurshev
-*/
-
-static int pci_config_type( void )
-{
-  unsigned long tmplong1, tmplong2;
-  unsigned char tmp1, tmp2;
-  int retval;
-    retval = 0;
- 
-    OUTPORT8(PCI_MODE2_ENABLE_REG, 0x00);
-    OUTPORT8(PCI_MODE2_FORWARD_REG, 0x00);
-    tmp1 = INPORT8(PCI_MODE2_ENABLE_REG);
-    tmp2 = INPORT8(PCI_MODE2_FORWARD_REG);
-    if ((tmp1 == 0x00) && (tmp2 == 0x00)) {
-	retval = 2;
-        /*printf("PCI says configuration type 2\n");*/
-    } else {
-        tmplong1 = INPORT32(PCI_MODE1_ADDRESS_REG);
-        OUTPORT32(PCI_MODE1_ADDRESS_REG, PCI_EN);
-        tmplong2 = INPORT32(PCI_MODE1_ADDRESS_REG);
-        OUTPORT32(PCI_MODE1_ADDRESS_REG, tmplong1);
-        if (tmplong2 == PCI_EN) {
-	    retval = 1;
-            /*printf("PCI says configuration type 1\n");*/
-	} else {
-            /*printf("No PCI !\n");*/
-	    disable_app_io();
-	    /*exit(1);*/
-	    retval = 0xFFFF;
-	}
-    }
-  return retval;
-}
-
-static int pci_get_vendor(
-          unsigned char bus,
-          unsigned char dev,
-          int func)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd);
-    return INPORT32(PCI_MODE1_DATA_REG);
-}
-
-static long pci_config_read_long(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
-    return INPORT32(PCI_MODE1_DATA_REG);
-}
-
-static long pci_config_read_word(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
-    return INPORT16(PCI_MODE1_DATA_REG);
-}
-
-static long pci_config_read_byte(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
-    return INPORT8(PCI_MODE1_DATA_REG);
-}
-
-static void pci_config_write_long(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd,
-	  long val)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
-    OUTPORT32(PCI_MODE1_DATA_REG,val);
-}
-
-static void pci_config_write_word(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd,
-	  unsigned val)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
-    OUTPORT16(PCI_MODE1_DATA_REG,val);
-}
-
-static void pci_config_write_byte(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd,
-	  long val)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
-    OUTPORT8(PCI_MODE1_DATA_REG,val);
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/libdha/sysdep/pci_bsdi.c
--- a/src/video_out/libdha/sysdep/pci_bsdi.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
-   This file is based on:
-   $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 \
                11:55:40 dawes Exp $
-   Modified for readability by Nick Kurshev
-*/
-#include <errno.h>
-#include <sys/file.h>
-#include <sys/ioctl.h>
-#include <i386/isa/pcconsioctl.h>
-#ifndef GCCUSESGAS
-#define GCCUSESGAS
-#endif
-
-static int io_fd;
-
-static __inline__ int enable_os_io(void)
-{
-    io_fd = -1 ;
-    if ((io_fd = open("/dev/console", O_RDWR, 0)) < 0) {
-        perror("/dev/console");
-	return(errno);
-    }
-    if (ioctl(io_fd, PCCONENABIOPL, 0) < 0) {
-        perror("ioctl(PCCONENABIOPL)");
-        return(errno);
-    }
-    return(0);
-}
-
-static __inline__ int disable_os_io(void)
-{
-    if (ioctl(io_fd, PCCONDISABIOPL, 0) < 0) {
-        perror("ioctl(PCCONDISABIOPL)");
-	close(io_fd);
-        return(errno);
-    }
-    close(io_fd);
-    return(0);
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/libdha/sysdep/pci_freebsd.c
--- a/src/video_out/libdha/sysdep/pci_freebsd.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
-   This file is based on:
-   $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 \
                11:55:40 dawes Exp $
-   Modified for readability by Nick Kurshev
-*/
-#include <errno.h>
-#include <sys/file.h>
-/* machine/console.h seems to be outdated by recent FreeBSD *
- * however pcvt_ioctl.h seems to exist for very long time   */
-/* #include <machine/console.h>*/
-#include <machine/pcvt_ioctl.h>
-#ifndef GCCUSESGAS
-#define GCCUSESGAS
-#endif
-
-static int io_fd;
-
-static __inline__ int enable_os_io(void)
-{
-    io_fd = -1 ;
-    if ((io_fd = open("/dev/console", O_RDWR, 0)) < 0) {
-        perror("/dev/console");
-	return(errno);
-    }
-    if (ioctl(io_fd, KDENABIO, 0) < 0) {
-        perror("ioctl(KDENABIO)");
-        return(errno);
-    }
-    return(0);
-}
-
-static __inline__ int disable_os_io(void)
-{
-    if (ioctl(io_fd, KDDISABIO, 0) < 0) {
-        perror("ioctl(KDDISABIO)");
-	close(io_fd);
-        return(errno);
-    }
-    close(io_fd);
-    return(0);
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/libdha/sysdep/pci_generic_cpu.c
--- a/src/video_out/libdha/sysdep/pci_generic_cpu.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
-    Generic stuff to compile VIDIX only on any system (SCRATCH)
-*/
-#warning This stuff is not ported on your system
-
-static int pci_config_type( void )
-{
-    printf("pci_config_type: generic function call\n");
-    return 0xFFFF;
-}
-
-static int pci_get_vendor(
-          unsigned char bus,
-          unsigned char dev,
-          int func)
-{
-    printf("pci_get_vendor: generic function call\n");
-    return 0;
-}
-
-static long pci_config_read_long(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd)
-{
-    printf("pci_config_read_long: generic function call\n");
-    return 0;
-}
-
-static long pci_config_read_word(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd)
-{
-    printf("pci_config_read_word: generic function call\n");
-    return 0;
-}
-
-static long pci_config_read_byte(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd)
-{
-    printf("pci_config_read_byte: generic function call\n");
-    return 0;
-}
-
-static void pci_config_write_long(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd,
-	  long val)
-{
-    printf("pci_config_write_long: generic function call\n");
-}
-
-static void pci_config_write_word(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd,
-	  long val)
-{
-    printf("pci_config_write_word: generic function call\n");
-}
-
-static void pci_config_write_byte(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd,
-	  long val)
-{
-    printf("pci_config_write_byte: generic function call\n");
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/libdha/sysdep/pci_generic_os.c
--- a/src/video_out/libdha/sysdep/pci_generic_os.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-/*
-    Generic stuff to compile VIDIX only on any system (SCRATCH)
-*/
-#warn This stuff is not ported on yur system
-static __inline__ int enable_os_io(void)
-{
-    printf("enable_os_io: generic function call\n");
-    return 0;
-}
-
-static __inline__ int disable_os_io(void)
-{
-    printf("disable_os_io: generic function call\n");
-    return 0;
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/libdha/sysdep/pci_ia64.c
--- a/src/video_out/libdha/sysdep/pci_ia64.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*
-   This file is based on:
-   $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 \
                11:55:40 dawes Exp $
-   Modified for readability by Nick Kurshev
-*/
-
-static int pci_config_type( void )
-{
-  unsigned long tmplong1, tmplong2;
-  unsigned char tmp1, tmp2;
-  int retval;
-    retval = 0;
- 
-    OUTPORT8(PCI_MODE2_ENABLE_REG, 0x00);
-    OUTPORT8(PCI_MODE2_FORWARD_REG, 0x00);
-    tmp1 = INPORT8(PCI_MODE2_ENABLE_REG);
-    tmp2 = INPORT8(PCI_MODE2_FORWARD_REG);
-    if ((tmp1 == 0x00) && (tmp2 == 0x00)) {
-	retval = 2;
-        /*printf("PCI says configuration type 2\n");*/
-    } else {
-        tmplong1 = INPORT32(PCI_MODE1_ADDRESS_REG);
-        OUTPORT32(PCI_MODE1_ADDRESS_REG, PCI_EN);
-        tmplong2 = INPORT32(PCI_MODE1_ADDRESS_REG);
-        OUTPORT32(PCI_MODE1_ADDRESS_REG, tmplong1);
-        if (tmplong2 == PCI_EN) {
-	    retval = 1;
-            /*printf("PCI says configuration type 1\n");*/
-	} else {
-            /*printf("No PCI !\n");*/
-	    disable_app_io();
-	    /*exit(1);*/
-	    retval = 0xFFFF;
-	}
-    }
-  return retval;
-}
-
-static int pci_get_vendor(
-          unsigned char bus,
-          unsigned char dev,
-          int func)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd);
-    return INPORT32(PCI_MODE1_DATA_REG);
-}
-
-static long pci_config_read_long(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
-    return INPORT32(PCI_MODE1_DATA_REG);
-}
-
-static long pci_config_read_word(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
-    return INPORT16(PCI_MODE1_DATA_REG);
-}
-
-static long pci_config_read_byte(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
-    return INPORT8(PCI_MODE1_DATA_REG);
-}
-
-static void pci_config_write_long(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd,
-	  long val)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
-    OUTPORT32(PCI_MODE1_DATA_REG,val);
-}
-
-static void pci_config_write_word(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd,
-	  long val)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
-    OUTPORT16(PCI_MODE1_DATA_REG,val);
-}
-
-static void pci_config_write_byte(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd,
-	  long val)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
-    OUTPORT8(PCI_MODE1_DATA_REG,val);
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/libdha/sysdep/pci_isc.c
--- a/src/video_out/libdha/sysdep/pci_isc.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
-   This file is based on:
-   $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 \
                11:55:40 dawes Exp $
-   Modified for readability by Nick Kurshev
-*/
-#include <sys/param.h>
-#include <sys/immu.h>
-#include <sys/region.h>
-#include <sys/proc.h>
-#include <sys/tss.h>
-#include <sys/sysi86.h>
-#include <sys/v86.h>
-
-static __inline__ int enable_os_io(void)
-{
-#if defined(SI86IOPL)
-    sysi86(SI86IOPL, 3);
-#else
-    sysi86(SI86V86, V86SC_IOPL, PS_IOPL);
-#endif
-    return(0);
-}
-
-static __inline__ int disable_os_io(void)
-{
-#if defined(SI86IOPL)
-    sysi86(SI86IOPL, 0);
-#else
-    sysi86(SI86V86, V86SC_IOPL, 0);
-#endif
-    return(0);
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/libdha/sysdep/pci_linux.c
--- a/src/video_out/libdha/sysdep/pci_linux.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
-   This file is based on:
-   $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 \
                11:55:40 dawes Exp $
-   Modified for readability by Nick Kurshev
-*/
-#include <errno.h>
-#ifdef __i386__
-#include <sys/perm.h>
-#else
-#ifndef __sparc__
-#include <sys/io.h>
-#endif
-#endif
-
-#include "config.h"
-
-#ifdef CONFIG_DHAHELPER
-#include <fcntl.h>
-int dhahelper_initialized = 0;
-int dhahelper_fd = 0;
-#endif
-
-#if defined(__sparc__) || defined(__powerpc__)
-#define iopl(x) (0)
-#endif
-
-static __inline__ int enable_os_io(void)
-{
-#ifdef CONFIG_DHAHELPER
-    dhahelper_fd = open("/dev/dhahelper", O_RDWR);
-    if (dhahelper_fd > 0)
-    {
-	dhahelper_initialized = 1;
-	return(0);
-    }
-    dhahelper_initialized = -1;
-#endif
-
-    if (iopl(3) != 0)
-	return(errno);
-    return(0);
-}
-
-static __inline__ int disable_os_io(void)
-{
-#ifdef CONFIG_DHAHELPER
-    if (dhahelper_initialized == 1)
-	close(dhahelper_fd);
-    else
-#endif
-    if (iopl(0) != 0)
-	return(errno);
-    return(0);
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/libdha/sysdep/pci_lynx.c
--- a/src/video_out/libdha/sysdep/pci_lynx.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
-   This file is based on:
-   $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 \
                11:55:40 dawes Exp $
-   Modified for readability by Nick Kurshev
-*/
-
-#if defined(Lynx_22)
-#ifndef GCCUSESGAS
-#define GCCUSESGAS
-#endif
-
-/* let's mimick the Linux Alpha stuff for LynxOS so we don't have
- * to change too much code
- */
-#include <smem.h>
- 
-static unsigned char *pciConfBase;
-
-static __inline__ void enable_os_io(void)
-{
-    pciConfBase = (unsigned char *) smem_create("PCI-CONF",
-    	    (char *)0x80800000, 64*1024, SM_READ|SM_WRITE);
-    if (pciConfBase == (void *) -1)
-        exit(1);
-}
-
-static __inline__ void disable_os_io(void)
-{
-    smem_create(NULL, (char *) pciConfBase, 0, SM_DETACH);
-    smem_remove("PCI-CONF");
-    pciConfBase = NULL;
-}
-
-#include <smem.h>
- 
-static unsigned char *pciConfBase;
- 
-static __inline__ unsigned long
-static swapl(unsigned long val)
-{
-	unsigned char *p = (unsigned char *)&val;
-	return ((p[3] << 24) | (p[2] << 16) | (p[1] << 8) | (p[0] << 0));
-}
- 
- 
-#define BUS(tag) (((tag)>>16)&0xff)
-#define DFN(tag) (((tag)>>8)&0xff)
- 
-#define PCIBIOS_DEVICE_NOT_FOUND	0x86
-#define PCIBIOS_SUCCESSFUL		0x00
- 
-static int pciconfig_read(
-          unsigned char bus,
-          unsigned char dev,
-          unsigned char offset,
-          int len,		/* unused, alway 4 */
-          unsigned long *val)
-{
-	unsigned long _val;
-	unsigned long *ptr;
- 
-	dev >>= 3;
-	if (bus || dev >= 16) {
-		*val = 0xFFFFFFFF;
-		return PCIBIOS_DEVICE_NOT_FOUND;
-	} else {
-		ptr = (unsigned long *)(pciConfBase + ((1<<dev) | offset));
-		_val = swapl(*ptr);
-	}
-	*val = _val;
-	return PCIBIOS_SUCCESSFUL;
-}
- 
-static int pciconfig_write(
-          unsigned char bus,
-          unsigned char dev,
-          unsigned char offset,
-          int len,		/* unused, alway 4 */
-          unsigned long val)
-{
-	unsigned long _val;
-	unsigned long *ptr;
- 
-	dev >>= 3;
-	_val = swapl(val);
-	if (bus || dev >= 16) {
-		return PCIBIOS_DEVICE_NOT_FOUND;
-	} else {
-		ptr = (unsigned long *)(pciConfBase + ((1<<dev) | offset));
-		*ptr = _val;
-	}
-	return PCIBIOS_SUCCESSFUL;
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/libdha/sysdep/pci_mach386.c
--- a/src/video_out/libdha/sysdep/pci_mach386.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/*
-   This file is based on:
-   $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 \
                11:55:40 dawes Exp $
-   Modified for readability by Nick Kurshev
-*/
-
-#include <errno.h>
-
-static int io_fd;
-
-static __inline__ int enable_os_io(void)
-{
-    io_fd = -1 ;
-    if ((io_fd = open("/dev/iopl", O_RDWR, 0)) < 0) {
-        perror("/dev/iopl");
-        return(errno);
-    }
-    return(0);
-}
-
-static __inline__ int disable_os_io(void)
-{
-    close(io_fd);
-    return(0);
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/libdha/sysdep/pci_netbsd.c
--- a/src/video_out/libdha/sysdep/pci_netbsd.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
-   This file is based on:
-   $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 \
                11:55:40 dawes Exp $
-   Modified for readability by Nick Kurshev
-*/
-#include <errno.h>
-#include <sys/param.h>
-#include <sys/file.h>
-#include <machine/sysarch.h>
-#ifndef GCCUSESGAS
-#define GCCUSESGAS
-#endif
-
-static int io_fd;
-
-static __inline__ int enable_os_io(void)
-{
-    io_fd = -1 ;
-#if !defined(USE_I386_IOPL)
-    if ((io_fd = open("/dev/io", O_RDWR, 0)) < 0) {
-	perror("/dev/io");
-	return(errno);
-    }
-#else
-    if (i386_iopl(1) < 0) {
-	perror("i386_iopl");
-	return(errno);
-    }
-#endif /* USE_I386_IOPL */
-    return(0);
-}
-
-static __inline__ int disable_os_io(void)
-{
-#if !defined(USE_I386_IOPL)
-    close(io_fd);
-#else
-    if (i386_iopl(0) < 0) {
-	perror("i386_iopl");
-	return(errno);
-    }
-#endif /* NetBSD1_1 */
-    return(0);
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/libdha/sysdep/pci_openbsd.c
--- a/src/video_out/libdha/sysdep/pci_openbsd.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
-   This file is based on:
-   $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 \
                11:55:40 dawes Exp $
-   Modified for readability by Nick Kurshev
-*/
-
-#ifdef __i386__
-
-#include <errno.h>
-#include <sys/types.h>
-#include <machine/sysarch.h>
-
-static __inline__ int enable_os_io(void)
-{
-    if (i386_iopl(1) < 0) {
-	perror("i386_iopl");
-	return(errno);
-    }
-    return(0);
-}
-
-static __inline__ int disable_os_io(void)
-{
- /* Nothing to do */
-    return(0);
-}
-#endif
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/libdha/sysdep/pci_os2.c
--- a/src/video_out/libdha/sysdep/pci_os2.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
-   This file is based on:
-   $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 \
                11:55:40 dawes Exp $
-   Modified for readability by Nick Kurshev
-*/
-#define INCL_DOSFILEMGR
-#include <os2.h>
-
-static USHORT callgate[3] = {0,0,0};
-
-static __inline__ int enable_os_io(void)
-{
-	HFILE hfd;
-	ULONG dlen,action;
-	APIRET rc;
-	static char *ioDrvPath = "/dev/fastio$";
- 
-	if (DosOpen((PSZ)ioDrvPath, (PHFILE)&hfd, (PULONG)&action,
-	   (ULONG)0, FILE_SYSTEM, FILE_OPEN,
-	   OPEN_SHARE_DENYNONE|OPEN_FLAGS_NOINHERIT|OPEN_ACCESS_READONLY,
-	   (ULONG)0) != 0) {
-		fprintf(stderr,"Error opening fastio$ driver...\n");
-		fprintf(stderr,"Please install xf86sup.sys in config.sys!\n");
-		return(42);
-	}
-	callgate[0] = callgate[1] = 0;
- 
-/* Get callgate from driver for fast io to ports and other stuff */
- 
-	rc = DosDevIOCtl(hfd, (ULONG)0x76, (ULONG)0x64,
-		NULL, 0, NULL,
-		(ULONG*)&callgate[2], sizeof(USHORT), &dlen);
-	if (rc) {
-		fprintf(stderr,"xf86-OS/2: EnableIOPorts failed, rc=%d, dlen=%d; emergency \
                exit\n",
-			rc,dlen);
-		DosClose(hfd);
-		return(42);
-	}
- 
-/* Calling callgate with function 13 sets IOPL for the program */
- 
-	asm volatile ("movl $13,%%ebx;.byte 0xff,0x1d;.long _callgate"
-			: /*no outputs */
-			: /*no inputs */
-			: "eax","ebx","ecx","edx","cc");
- 
-        DosClose(hfd);
-	return(0);
-}
-
-static __inline__ int disable_os_io(void)
-{
-/* Nothing to do */
-        return(0);
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/libdha/sysdep/pci_powerpc.c
--- a/src/video_out/libdha/sysdep/pci_powerpc.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,250 +0,0 @@
-/*
-   This file is based on:
-   $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 \
                11:55:40 dawes Exp $
-   Modified for readability by Nick Kurshev
-*/
-
-static int pci_config_type( void ) { return 1; }
-#ifdef linux
-#include <fcntl.h>
-#include <sys/io.h>
-#include <linux/pci.h>
-#include "../../bswap.h"
-#endif
-
-#ifdef linux
-static int pci_get_vendor(
-	  unsigned char bus,
-	  unsigned char dev,
-	  int func)
-{
-    int retval;
-    char path[100];
-    int fd;
-    short vendor, device;
-    sprintf(path,"/proc/bus/pci/%02d/%02x.0", bus, dev);
-    fd = open(path,O_RDONLY|O_SYNC);
-    if (fd == -1) {
-	    retval=0xFFFF;
-    }
-    else if (pread(fd, &vendor, 2, PCI_VENDOR_ID) == 2 &&
-             pread(fd, &device, 2, PCI_DEVICE_ID) == 2) {
-	    vendor = bswap_16(vendor);
-	    device = bswap_16(device);
-	    retval = vendor + (device<<16); /*no worries about byte order, 
-	    				      all ppc are bigendian*/
-    } else {
-	    retval = 0xFFFF;
-    }   
-    if (fd > 0) {
-	    close(fd);
-    }
-    return retval;
-}
-#else
-static int pci_get_vendor(
-          unsigned char bus,
-          unsigned char dev,
-          int func)
-{
-    int retval;
-    pciconfig_read(bus, dev<<3, PCI_ID_REG, 4, &retval);
-    return retval;
-}
-#endif
-#ifdef linux
-static long pci_config_read_long(
-	  unsigned char bus,
-	  unsigned char dev,
-	  int func, 
-	  unsigned cmd)
-{
-    long retval;
-    char path[100];
-    int fd;
-    sprintf(path,"/proc/bus/pci/%02d/%02x.0", bus, dev);
-    fd = open(path,O_RDONLY|O_SYNC);
-    if (fd == -1) {
-	    retval=0;
-    }
-    else if (pread(fd, &retval, 4, cmd) == 4) {
-	    retval = bswap_32(retval);
-    } else {
-	    retval = 0;
-    }   
-    if (fd > 0) {
-	    close(fd);
-    }
-    return retval;
-}
-
-static long pci_config_read_word(
-	  unsigned char bus,
-	  unsigned char dev,
-	  int func, 
-	  unsigned cmd)
-{
-    long retval;
-    char path[100];
-    int fd;
-    sprintf(path,"/proc/bus/pci/%02d/%02x.0", bus, dev);
-    fd = open(path,O_RDONLY|O_SYNC);
-    if (fd == -1) {
-	    retval=0;
-    }
-    else if (pread(fd, &retval, 2, cmd) == 2) {
-	    retval = bswap_16(retval);
-    } else {
-	    retval = 0;
-    }   
-    if (fd > 0) {
-	    close(fd);
-    }
-    return retval;
-}
-
-static long pci_config_read_byte(
-	  unsigned char bus,
-	  unsigned char dev,
-	  int func, 
-	  unsigned cmd)
-{
-    long retval;
-    char path[100];
-    int fd;
-    sprintf(path,"/proc/bus/pci/%02d/%02x.0", bus, dev);
-    fd = open(path,O_RDONLY|O_SYNC);
-    if (fd == -1) {
-	    retval=0;
-    }
-    else if (pread(fd, &retval, 1, cmd) != 1) {
-	    retval = 0;
-    }   
-    if (fd > 0) {
-	    close(fd);
-    }
-    return retval;
-}
-
-static void pci_config_write_long(
-	  unsigned char bus,
-	  unsigned char dev,
-	  int func, 
-	  unsigned cmd,
-	  long val)
-{
-    char path[100];
-    int fd;
-    val = bswap_32(val);
-    sprintf(path,"/proc/bus/pci/%02d/%02x.0", bus, dev);
-    fd = open(path,O_RDONLY|O_SYNC);
-    if (fd > 0) {
-	    pwrite(fd, &val, 4, cmd);
-	    close(fd);
-    }
-}
-
-static void pci_config_write_word(
-	  unsigned char bus,
-	  unsigned char dev,
-	  int func, 
-	  unsigned cmd,
-	  long val)
-{
-    char path[100];
-    int fd;
-    val = bswap_16(val);
-    sprintf(path,"/proc/bus/pci/%02d/%02x.0", bus, dev);
-    fd = open(path,O_RDONLY|O_SYNC);
-    if (fd > 0) {
-	    pwrite(fd, &val, 2, cmd);
-	    close(fd);
-    }
-}
-
-static void pci_config_write_byte(
-	  unsigned char bus,
-	  unsigned char dev,
-	  int func, 
-	  unsigned cmd,
-	  long val)
-{
-    char path[100];
-    int fd;
-    sprintf(path,"/proc/bus/pci/%02d/%02x.0", bus, dev);
-    fd = open(path,O_RDONLY|O_SYNC);
-    if (fd > 0) {
-	    pwrite(fd, &val, 1, cmd);
-	    close(fd);
-    }
-}
-#else
-static long pci_config_read_long(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd)
-{
-    long retval;
-    pciconfig_read(bus, dev<<3, cmd, 4, &retval);
-    return retval;
-}
-
-static long pci_config_read_word(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd)
-{
-    long retval;
-    pciconfig_read(bus, dev<<3, cmd, 2, &retval);
-    return retval;
-}
-
-static long pci_config_read_byte(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd)
-{
-    long retval;
-    pciconfig_read(bus, dev<<3, cmd, 1, &retval);
-    return retval;
-}
-
-static void pci_config_write_long(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd,
-	  long val)
-{
-    long retval;
-    pciconfig_write(bus, dev<<3, cmd, 4, val);
-    return retval;
-}
-
-static void pci_config_write_word(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd,
-	  long val)
-{
-    long retval;
-    pciconfig_write(bus, dev<<3, cmd, 2, val);
-    return retval;
-}
-
-static void pci_config_write_byte(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd,
-	  long val)
-{
-    long retval;
-    pciconfig_write(bus, dev<<3, cmd, 1, val);
-    return retval;
-}
-#endif
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/libdha/sysdep/pci_sco.c
--- a/src/video_out/libdha/sysdep/pci_sco.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
-   This file is based on:
-   $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 \
                11:55:40 dawes Exp $
-   Modified for readability by Nick Kurshev
-*/
-#include <sys/console.h>
-#include <sys/param.h>
-#include <sys/immu.h>
-#include <sys/region.h>
-#include <sys/proc.h>
-#include <sys/tss.h>
-#include <sys/sysi86.h>
-#include <sys/v86.h>
-
-static __inline__ int enable_os_io(void)
-{
-#if defined(SI86IOPL)
-    sysi86(SI86IOPL, 3);
-#else
-    sysi86(SI86V86, V86SC_IOPL, PS_IOPL);
-#endif
-    return(0);
-}
-
-static __inline__ int disable_os_io(void)
-{
-#if defined(SI86IOPL)
-    sysi86(SI86IOPL, 0);
-#else
-    sysi86(SI86V86, V86SC_IOPL, 0);
-#endif
-    return(0);
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/libdha/sysdep/pci_sparc.c
--- a/src/video_out/libdha/sysdep/pci_sparc.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*
-   This file is based on:
-   $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 \
                11:55:40 dawes Exp $
-   Modified for readability by Nick Kurshev
-*/
-
-static int pci_config_type( void )
-{
-  unsigned long tmplong1, tmplong2;
-  unsigned char tmp1, tmp2;
-  int retval;
-    retval = 0;
- 
-    OUTPORT8(PCI_MODE2_ENABLE_REG, 0x00);
-    OUTPORT8(PCI_MODE2_FORWARD_REG, 0x00);
-    tmp1 = INPORT8(PCI_MODE2_ENABLE_REG);
-    tmp2 = INPORT8(PCI_MODE2_FORWARD_REG);
-    if ((tmp1 == 0x00) && (tmp2 == 0x00)) {
-	retval = 2;
-        /*printf("PCI says configuration type 2\n");*/
-    } else {
-        tmplong1 = INPORT32(PCI_MODE1_ADDRESS_REG);
-        OUTPORT32(PCI_MODE1_ADDRESS_REG, PCI_EN);
-        tmplong2 = INPORT32(PCI_MODE1_ADDRESS_REG);
-        OUTPORT32(PCI_MODE1_ADDRESS_REG, tmplong1);
-        if (tmplong2 == PCI_EN) {
-	    retval = 1;
-            /*printf("PCI says configuration type 1\n");*/
-	} else {
-            /*printf("No PCI !\n");*/
-	    disable_app_io();
-	    /*exit(1);*/
-	    retval = 0xFFFF;
-	}
-    }
-  return retval;
-}
-
-static int pci_get_vendor(
-          unsigned char bus,
-          unsigned char dev,
-          int func)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd);
-    return INPORT32(PCI_MODE1_DATA_REG);
-}
-
-static long pci_config_read_long(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
-    return INPORT32(PCI_MODE1_DATA_REG);
-}
-
-static long pci_config_read_word(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
-    return INPORT16(PCI_MODE1_DATA_REG);
-}
-
-static long pci_config_read_byte(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
-    return INPORT8(PCI_MODE1_DATA_REG);
-}
-
-static void pci_config_write_long(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd,
-	  long val)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
-    OUTPORT32(PCI_MODE1_DATA_REG,val);
-}
-
-static void pci_config_write_word(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd,
-	  long val)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
-    OUTPORT16(PCI_MODE1_DATA_REG,val);
-}
-
-static void pci_config_write_byte(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd,
-	  long val)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
-    OUTPORT8(PCI_MODE1_DATA_REG,val);
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/libdha/sysdep/pci_svr4.c
--- a/src/video_out/libdha/sysdep/pci_svr4.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
-   This file is based on:
-   $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 \
                11:55:40 dawes Exp $
-   Modified for readability by Nick Kurshev
-*/
-#include <sys/types.h>
-#include <sys/proc.h>
-#include <sys/tss.h>
-#if defined(NCR)
-#define __STDC
-#include <sys/sysi86.h>
-#undef __STDC
-#else
-#include <sys/sysi86.h>
-#endif
-
-#if defined(sun)
-# ifndef __EXTENSIONS__
-# define __EXTENSIONS__
-# endif
-# include <sys/psw.h>
-#endif
-
-static __inline__ int enable_os_io(void)
-{
-#if defined(SI86IOPL)
-    sysi86(SI86IOPL, 3);
-#else
-    sysi86(SI86V86, V86SC_IOPL, PS_IOPL);
-#endif
-    return(0);
-}
-
-static __inline__ int disable_os_io(void)
-{
-#if defined(SI86IOPL)
-    sysi86(SI86IOPL, 0);
-#else
-    sysi86(SI86V86, V86SC_IOPL, 0);
-#endif
-    return(0);
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/libdha/sysdep/pci_win32.c
--- a/src/video_out/libdha/sysdep/pci_win32.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-/*
-   This file is based on:
-   $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 \
                11:55:40 dawes Exp $
-   Modified for readability by Nick Kurshev
-*/
-#include <windows.h>
-
-/* Nothing to do for Win9x. For WinNT I have no solution */
-
-static __inline__ int enable_os_io(void)
-{
-    return(0);
-}
-
-static __inline__ int disable_os_io(void)
-{
-    return(0);
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/libdha/sysdep/pci_x86.c
--- a/src/video_out/libdha/sysdep/pci_x86.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/*
-   This file is based on:
-   $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 \
                11:55:40 dawes Exp $
-   Modified for readability by Nick Kurshev
-*/
-
-static int pci_config_type( void )
-{
-  unsigned long tmplong1, tmplong2;
-  unsigned char tmp1, tmp2;
-  int retval;
-    retval = 0;
- 
-    OUTPORT8(PCI_MODE2_ENABLE_REG, 0x00);
-    OUTPORT8(PCI_MODE2_FORWARD_REG, 0x00);
-    tmp1 = INPORT8(PCI_MODE2_ENABLE_REG);
-    tmp2 = INPORT8(PCI_MODE2_FORWARD_REG);
-    if ((tmp1 == 0x00) && (tmp2 == 0x00)) {
-	retval = 2;
-        /*printf("PCI says configuration type 2\n");*/
-    } else {
-        tmplong1 = INPORT32(PCI_MODE1_ADDRESS_REG);
-        OUTPORT32(PCI_MODE1_ADDRESS_REG, PCI_EN);
-        tmplong2 = INPORT32(PCI_MODE1_ADDRESS_REG);
-        OUTPORT32(PCI_MODE1_ADDRESS_REG, tmplong1);
-        if (tmplong2 == PCI_EN) {
-	    retval = 1;
-            /*printf("PCI says configuration type 1\n");*/
-	} else {
-            /*printf("No PCI !\n");*/
-	    disable_app_io();
-	    /*exit(1);*/
-	    retval = 0xFFFF;
-	}
-    }
-  return retval;
-}
-
-static int pci_get_vendor(
-          unsigned char bus,
-          unsigned char dev,
-          int func)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd);
-    return INPORT32(PCI_MODE1_DATA_REG);
-}
-
-static long pci_config_read_long(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
-    return INPORT32(PCI_MODE1_DATA_REG);
-}
-
-static long pci_config_read_word(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
-    return INPORT16(PCI_MODE1_DATA_REG);
-}
-
-static long pci_config_read_byte(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
-    return INPORT8(PCI_MODE1_DATA_REG);
-}
-
-static void pci_config_write_long(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd,
-	  long val)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
-    OUTPORT32(PCI_MODE1_DATA_REG,val);
-}
-
-static void pci_config_write_word(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd,
-	  long val)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
-    OUTPORT16(PCI_MODE1_DATA_REG,val);
-}
-
-static void pci_config_write_byte(
-          unsigned char bus,
-          unsigned char dev,
-          int func, 
-          unsigned cmd,
-	  long val)
-{
-    unsigned long config_cmd;
-    config_cmd = PCI_EN | (bus<<16) | (dev<<11) | (func<<8);
-    OUTPORT32(PCI_MODE1_ADDRESS_REG, config_cmd | cmd);
-    OUTPORT8(PCI_MODE1_DATA_REG,val);
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 src/video_out/libdha/test.c
--- a/src/video_out/libdha/test.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-#include "libdha.h"
-#include "pci_names.h"
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <inttypes.h> /* for __WORDSIZE */
-
-int main( void )
-{
-  pciinfo_t lst[MAX_PCI_DEVICES];
-  unsigned i,num_pci;
-  int err;
-  err = pci_scan(lst,&num_pci);
-  if(err)
-  {
-    printf("Error occured during pci scan: %s\n",strerror(err));
-    return EXIT_FAILURE;
-  }
-  else
-  {
-    printf(" Bus:card:func vend:dev  base0   :base1   :base2   :baserom \
                :irq:pin:gnt:lat\n");
-    for(i=0;i<num_pci;i++)
-#if __WORDSIZE > 32
-	printf("%04X:%04X:%04X %04X:%04X %16X:%16X:%16X:%16X:%02X :%02X :%02X :%02X\n"
-#else
-	printf("%04X:%04X:%04X %04X:%04X %08X:%08X:%08X:%08X:%02X :%02X :%02X :%02X\n"
-#endif
-    	    ,lst[i].bus,lst[i].card,lst[i].func
-	    ,lst[i].vendor,lst[i].device
-	    ,lst[i].base0,lst[i].base1,lst[i].base2,lst[i].baserom
-	    ,lst[i].irq,lst[i].ipin,lst[i].gnt,lst[i].lat);
-    printf("Additional info:\n");
-    printf("================\n");
-    printf("base3   :base4   :base5   :name (vendor)\n");
-    for(i=0;i<num_pci;i++)
-    {
-	const char *vname,*dname;
-	dname = pci_device_name(lst[i].vendor,lst[i].device);
-	dname = dname ? dname : "Unknown chip";
-	vname = pci_vendor_name(lst[i].vendor);
-	vname = vname ? vname : "Unknown chip";
-	printf("%08X:%08X:%08X:%s (%s)\n"
-		,lst[i].base3,lst[i].base4,lst[i].base5
-		,dname,vname);
-    }
-  }
-  return EXIT_SUCCESS;
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/vidix/Makefile.am
--- a/src/video_out/vidix/Makefile.am	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-include $(top_srcdir)/misc/Makefile.common
-
-EXTRA_DIST = README vidix.txt
-
-SUBDIRS = drivers
-
-AM_CFLAGS = @STATIC@
-
-if HAVE_VIDIX
-vidix_lib = libvidix.la
-endif
-
-noinst_LTLIBRARIES = $(vidix_lib)
-
-libvidix_la_SOURCES = vidixlib.c
-libvidix_la_LIBADD = $(DYNAMIC_LD_LIBS) \
                $(top_builddir)/src/video_out/libdha/libdha.la
-
-noinst_HEADERS = fourcc.h vidix.h vidixlib.h
-
-AM_CPPFLAGS = -I$(top_srcdir)/src/video_out/vidix \
-	-I$(top_builddir)/src/video_out/libdha
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 src/video_out/vidix/README
--- a/src/video_out/vidix/README	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-VIDIX - Video Interface for *niX.
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-This library was designed and introduced as interface to userspace drivers
-to provide DGA everywhere where it's possible (unline X11).
-I hope that these drivers will be portable same as X11 (not only on *nix).
-
-For detail on how to develop new driver see vidix.txt
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/vidix/drivers/Makefile.am
--- a/src/video_out/vidix/drivers/Makefile.am	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-include $(top_srcdir)/misc/Makefile.common
-
-EXTRA_DIST = genfb_vid.c
-
-if HAVE_VIDIX
-vidix_drivers = \
-	mach64_vid.la \
-	mga_crtc2_vid.la \
-	mga_vid.la \
-	pm2_vid.la \
-	pm3_vid.la \
-	radeon_vid.la \
-	rage128_vid.la \
-	cyberblade_vid.la \
-	unichrome_vid.la \
-	nvidia_vid.la \
-	sis_vid.la \
-	savage_vid.la 
-endif
-
-vidix_LTLIBRARIES = $(vidix_drivers)
-
-radeon_vid_la_SOURCES = radeon_vid.c
-radeon_vid_la_LDFLAGS = -avoid-version -module -lm
-
-rage128_vid_la_SOURCES = radeon_vid.c
-rage128_vid_la_LDFLAGS = -avoid-version -module -lm
-rage128_vid_la_CFLAGS = -DRAGE128 $(AM_CFLAGS)
-
-pm2_vid_la_SOURCES = pm2_vid.c
-pm2_vid_la_LDFLAGS = -avoid-version -module
-
-pm3_vid_la_SOURCES = pm3_vid.c
-pm3_vid_la_LDFLAGS = -avoid-version -module
-
-mach64_vid_la_SOURCES = mach64_vid.c
-mach64_vid_la_LDFLAGS = -avoid-version -module
-
-mga_vid_la_SOURCES = mga_vid.c
-mga_vid_la_LDFLAGS = -avoid-version -module -lm
-
-mga_crtc2_vid_la_SOURCES = mga_vid.c
-mga_crtc2_vid_la_LDFLAGS = -avoid-version -module -lm
-mga_crtc2_vid_la_CFLAGS = -DCRTC2 $(AM_CFLAGS)
-
-cyberblade_vid_la_SOURCES = cyberblade_vid.c
-cyberblade_vid_la_LDFLAGS = -avoid-version -module
-
-unichrome_vid_la_SOURCES = unichrome_vid.c
-unichrome_vid_la_LDFLAGS = -avoid-version -module
-
-nvidia_vid_la_SOURCES = nvidia_vid.c
-nvidia_vid_la_LDFLAGS = -avoid-version -module
-
-sis_vid_la_SOURCES = sis_vid.c sis_bridge.c
-sis_vid_la_LDFLAGS = -avoid-version -module
-
-savage_vid_la_SOURCES = savage_vid.c
-savage_vid_la_LDFLAGS = -avoid-version -module -lm
-
-noinst_HEADERS = mach64.h glint_regs.h pm3_regs.h radeon.h savage_regs.h \
-	cyberblade_regs.h unichrome_regs.h sis_defs.h sis_regs.h
-
-AM_CPPFLAGS = -I$(top_srcdir)/src/video_out/vidix \
-	-I$(top_srcdir)/src/video_out/libdha \
-	-I$(top_builddir)/src/video_out/libdha
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/vidix/drivers/cyberblade_regs.h
--- a/src/video_out/vidix/drivers/cyberblade_regs.h	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/*
- * Copyright 1992-2000 by Alan Hourihane, Wigan, England.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission.  Alan Hourihane makes no representations
- * about the suitability of this software for any purpose.  It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Author:  Alan Hourihane, alanh@fairlite.demon.co.uk
- */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h,v 1.22 \
                2002/01/11 13:06:30 alanh Exp $ */
-
-#define DEBUG 1
-
-#define NTSC 14.31818
-#define PAL  17.73448
-
-/* General Registers */
-#define SPR	0x1F		/* Software Programming Register (videoram) */
-
-/* 3C4 */
-#define RevisionID 0x09
-#define ConfPort1 0x0C
-#define ConfPort2 0x0C
-#define NewMode2 0x0D
-#define OldMode2 0x00 /* Should be 0x0D - dealt with in trident_dac.c */
-#define OldMode1 0x0E
-#define NewMode1 0x0E
-#define Protection 0x11
-#define MCLKLow 0x16
-#define MCLKHigh 0x17
-#define ClockLow 0x18
-#define ClockHigh 0x19
-#define SSetup 0x20
-#define SKey 0x37
-#define SPKey 0x57
-
-/* 3x4 */
-#define Offset 0x13
-#define Underline 0x14
-#define CRTCMode 0x17
-#define CRTCModuleTest 0x1E
-#define FIFOControl 0x20
-#define LinearAddReg 0x21
-#define DRAMTiming 0x23
-#define New32 0x23
-#define RAMDACTiming 0x25
-#define CRTHiOrd 0x27
-#define AddColReg 0x29
-#define InterfaceSel 0x2A
-#define HorizOverflow 0x2B
-#define GETest 0x2D
-#define Performance 0x2F
-#define GraphEngReg 0x36
-#define I2C 0x37
-#define PixelBusReg 0x38
-#define PCIReg 0x39
-#define DRAMControl 0x3A
-#define MiscContReg 0x3C
-#define CursorXLow 0x40
-#define CursorXHigh 0x41
-#define CursorYLow 0x42
-#define CursorYHigh 0x43
-#define CursorLocLow 0x44
-#define CursorLocHigh 0x45
-#define CursorXOffset 0x46
-#define CursorYOffset 0x47
-#define CursorFG1 0x48
-#define CursorFG2 0x49
-#define CursorFG3 0x4A
-#define CursorFG4 0x4B
-#define CursorBG1 0x4C
-#define CursorBG2 0x4D
-#define CursorBG3 0x4E
-#define CursorBG4 0x4F
-#define CursorControl 0x50
-#define PCIRetry 0x55
-#define PreEndControl 0x56
-#define PreEndFetch 0x57
-#define PCIMaster 0x60
-#define Enhancement0 0x62
-#define NewEDO 0x64
-
-/* --- Additions by AMR for Vidix support --- */
-#define VideoWin1_HScale 0x80
-#define VideoWin1_VScale 0x82
-#define VideoWin1_Start 0x86
-#define VideoWin1_Stop 0x8a
-#define Video_Flags 0x8e
-#define VideoWin1_Y_BPR 0x90
-#define VideoWin1_Y_Offset 0x92
-#define Video_LineBufferThreshold 0x95
-#define Video_LineBufferLevel 0x96
-#define Video_Flags2 0x97
-/* --- */
-
-#define TVinterface 0xC0
-#define TVMode 0xC1
-#define ClockControl 0xCF
-
-
-/* 3CE */
-#define MiscExtFunc 0x0F
-#define MiscIntContReg 0x2F
-#define CyberControl 0x30
-#define CyberEnhance 0x31
-#define FPConfig     0x33
-#define VertStretch  0x52
-#define HorStretch   0x53
-#define BiosMode     0x5c
-#define BiosNewMode1 0x5a
-#define BiosNewMode2 0x5c
-#define BiosReg      0x5d
-
-/* --- IO Macros by AMR --- */
-
-#define CRINB(reg) (OUTPORT8(0x3d4,reg), INPORT8(0x3d5))
-#define SRINB(reg) (OUTPORT8(0x3c4,reg), INPORT8(0x3c5))
-#define CROUTB(reg,val) (OUTPORT8(0x3d4,reg), OUTPORT8(0x3d5,val))
-#define SROUTB(reg,val) (OUTPORT8(0x3c4,reg), OUTPORT8(0x3c5,val))
-
-/* --- */
-
-
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/vidix/drivers/cyberblade_vid.c
--- a/src/video_out/vidix/drivers/cyberblade_vid.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,649 +0,0 @@
-/*
-    Driver for CyberBlade/i1 - Version 0.1.4
-
-    Copyright (C) 2002 by Alastair M. Robinson.
-    Official homepage: http://www.blackfiveservices.co.uk/EPIAVidix.shtml
-
-    Based on Permedia 3 driver by Måns Rullgård
-
-    Thanks to Gilles Frattini for bugfixes
-
-    This program 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.
-
-    This program 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 this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-    Changes:
-    18/01/03
-      MMIO is no longer used, sidestepping cache issues on EPIA-800
-      TV-Out modes are now better supported - this should be the end
-        of the magenta stripes :)
-      Brightness/Contrast controls disabled for the time being - they were
-        seriously degrading picture quality, especially with TV-Out.
-
-    To Do:
-    Implement Hue/Saturation controls
-    Support / Test multiple frames
-    Test colour-key code more extensively
-*/
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <unistd.h>
-
-#include "vidix.h"
-#include "fourcc.h"
-#include "libdha.h"
-#include "pci_ids.h"
-#include "pci_names.h"
-
-
-#include "cyberblade_regs.h"
-
-pciinfo_t pci_info;
-
-char save_colourkey[6];
-char *cyberblade_mem;
-
-#ifdef DEBUG_LOGFILE
-FILE *logfile=0;
-#define LOGWRITE(x) {if(logfile) fprintf(logfile,x);}
-#else
-#define LOGWRITE(x)
-#endif
-
-/* Helper functions for reading registers. */    
-
-#if 0 /* unused */
-static int CRINW(int reg)
-{
-	int result;
-	result=CRINB(reg);
-	result|=CRINB(reg+1)<<8;
-	return(result);
-}
-#endif
-
-static void CROUTW(int reg,int val)
-{
-	CROUTB(reg,val&255);
-	CROUTB(reg+1,(val>>8)&255);
-}
-
-#if 0 /* unused */
-static int SRINW(int reg)
-{
-	int result;
-	result=SRINB(reg);
-	result|=SRINB(reg+1)<<8;
-	return(result);
-}
-#endif
-
-static void SROUTW(int reg,int val)
-{
-	SROUTB(reg,val&255);
-	SROUTB(reg+1,(val>>8)&255);
-}
-
-#if 0 /* unused */
-static void DumpRegisters(void)
-{
-#ifdef DEBUG_LOGFILE
-	int reg,val;
-	if(logfile)
-	{
-		LOGWRITE("CRTC Register Dump:\n")
-		for(reg=0;reg<256;++reg)
-		{
-			val=CRINB(reg);
-			fprintf(logfile,"CR0x%2x: 0x%2x\n",reg,val);
-		}
-		LOGWRITE("SR Register Dump:\n")
-		for(reg=0;reg<256;++reg)
-		{
-			val=SRINB(reg);
-			fprintf(logfile,"SR0x%2x: 0x%2x\n",reg,val);
-		}
-	}
-#endif
-}
-#endif
-
[... 397 lines omitted ...]
-                VWinStart=(VTotal-VSync)-8;
-
-		printf("[cyberblade] HTotal: 0x%x, HSStart: 0x%x\n",HTotal,HSync); 
-		printf("  VTotal: 0x%x, VStart: 0x%x\n",VTotal,VSync);
-		tx1=HWinStart+info->dest.x;
-		ty1=VWinStart+info->dest.y;
-		tx2=tx1+info->dest.w;
-		ty2=ty1+info->dest.h;
-
-		CROUTW(0x86,tx1);
-		CROUTW(0x88,ty1);
-		CROUTW(0x8a,tx2);
-		CROUTW(0x8c,ty2+3);
-	}
-
-	if(src_w==drw_w)
-		hscale=0;
-	else if(src_w<drw_w)
-	{
-		hscale=((src_w<<10)/(drw_w-2)) & 0x1fff;
-	}
-	else
-	{
-		hscale=0x8000 | ((((src_w/drw_w)-1)&7)<<10) | (((drw_w<<10)/src_w) & 0x3ff);
-	}
-
-	vscale=(src_h<<10)/(drw_h);
-	if(drw_h<src_h)
-		vscale=0x8000|((drw_h<<10)/(src_h));
-
-	/* Write scale factors to hardware */
-
-	CROUTW(0x80,hscale); /* Horizontal Scale */
-	CROUTW(0x82,vscale); /* Vertical Scale */
-
-	/* Now set the start address and data layout */
-	{
-		int lb = (y_pitch+2) >> 2;
-		CROUTB(0x95, ((lb & 0x100)>>1) | 0x08 ); /* Linebuffer level bit 8 & threshold */
-		CROUTB(0x96, (lb & 0xFF)); /* Linebuffer level */
-
-		CROUTB(0x97, 0x00); /* VDE Flags */
-		CROUTB(0xBA, 0x00); /* Chroma key */
-		CROUTB(0xBB, 0x00); /* Chroma key */
-		CROUTB(0xBC, 0xFF); /* Chroma key */
-		CROUTB(0xBD, 0xFF); /* Chroma key */
-		CROUTB(0xBE, 0x04); /* Capture control */
-
-		if(src_w > 384)
-			layout|=4; /* 2x line buffers */
-		SROUTB(0x97, layout);
-
-		CROUTW(0x90,y_pitch); /* Y Bytes per row */
-		SROUTW(0x9A,uv_pitch); /* UV Bytes per row */
-
-		switch(info->fourcc)
-		{
-			case IMGFMT_BGR16:
-				CROUTB(0x8F, 0x24); /* VDE Flags - Edge Recovery & CSC Bypass */
-				CROUTB(0xBF, 0x02); /* Video format - RGB16 */
-				SROUTB(0xBE, 0x0); /* HSCB disabled */
-				break;
-			default:
-				CROUTB(0x8F, 0x20); /* VDE Flags - Edge Recovery */
-				CROUTB(0xBF, 0x00); /* Video format - YUV */
-				SROUTB(0xBE, 0x00); /* HSCB disable - was 0x03*/
-				break;
-		}
-
-		CROUTB(0x92, ((base0+info->offset.y) >> 3) &0xff); /* Lower 8 bits of start \
                address */
-		CROUTB(0x93, ((base0+info->offset.y) >> 11) &0xff); /* Mid 8 bits of start address \
                */
-		CROUTB(0x94, ((base0+info->offset.y) >> 19) &0xf); /* Upper 4 bits of start \
                address */
-		SROUTB(0x80, ((base0+info->offset.v) >> 3) &0xff); /* Lower 8 bits of start \
                address */
-		SROUTB(0x81, ((base0+info->offset.v) >> 11) &0xff); /* Mid 8 bits of start address \
                */
-		SROUTB(0x82, ((base0+info->offset.v) >> 19) &0xf); /* Upper 4 bits of start \
                address */
-		SROUTB(0x83, ((base0+info->offset.u) >> 3) &0xff); /* Lower 8 bits of start \
                address */
-		SROUTB(0x84, ((base0+info->offset.u) >> 11) &0xff); /* Mid 8 bits of start address \
                */
-		SROUTB(0x85, ((base0+info->offset.u) >> 19) &0xf); /* Upper 4 bits of start \
                address */
-	}
-
-	vixPlaybackSetEq(&equal);
-
-	/* Protect hardware registers again */
-	SROUTB(0x11, protect);
-	return 0;
-}
-
-
-int vixPlaybackOn(void)
-{
-	LOGWRITE("Enable overlay\n");
-	CROUTB(0x8E, 0xd4); /* VDE Flags*/
-
-	return 0;
-}
-
-
-int vixPlaybackOff(void)
-{
-        LOGWRITE("Disable overlay\n"); 
-	CROUTB(0x8E, 0xc4); /* VDE Flags*/
-
-	return 0;
-}
-
-
-int vixPlaybackFrameSelect(unsigned int frame)
-{
-	int protect;
-        LOGWRITE("Frame select\n"); 
-	protect=SRINB(0x11);
-	SROUTB(0x11, 0x92);
-	/* Set overlay address to that of selected frame */
-	CROUTB(0x92, ((frames[frame]+YOffs) >> 3) &0xff); /* Lower 8 bits of start address \
                */
-	CROUTB(0x93, ((frames[frame]+YOffs) >> 11) &0xff); /* Mid 8 bits of start address \
                */
-	CROUTB(0x94, ((frames[frame]+YOffs) >> 19) &0xf); /* Upper 4 bits of start address \
                */
-	SROUTB(0x80, ((frames[frame]+VOffs) >> 3) &0xff); /* Lower 8 bits of start address \
                */
-	SROUTB(0x81, ((frames[frame]+VOffs) >> 11) &0xff); /* Mid 8 bits of start address \
                */
-	SROUTB(0x82, ((frames[frame]+VOffs) >> 19) &0xf); /* Upper 4 bits of start address \
                */
-	SROUTB(0x83, ((frames[frame]+UOffs) >> 3) &0xff); /* Lower 8 bits of start address \
                */
-	SROUTB(0x84, ((frames[frame]+UOffs) >> 11) &0xff); /* Mid 8 bits of start address \
                */
-	SROUTB(0x85, ((frames[frame]+UOffs) >> 19) &0xf); /* Upper 4 bits of start address \
                */
-	SROUTB(0x11, protect);
-	return 0;
-}
-
-
-
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/vidix/drivers/genfb_vid.c
--- a/src/video_out/vidix/drivers/genfb_vid.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <inttypes.h>
-#include <fcntl.h>
-
-#include "../vidix.h"
-#include "../fourcc.h"
-#include "../../libdha/libdha.h"
-#include "../../libdha/pci_ids.h"
-#include "../../libdha/pci_names.h"
-
-#define DEMO_DRIVER 1
-#define VIDIX_STATIC genfb_
-
-#define GENFB_MSG "[genfb-demo-driver] "
-
-#if 0 /* these are unused. remove? */
-static int fd;
-
-static void *mmio_base = 0;
-static void *mem_base = 0;
-static int32_t overlay_offset = 0;
-static uint32_t ram_size = 0;
-#endif
-
-static int probed = 0;
-
-/* VIDIX exports */
-
-static vidix_capability_t genfb_cap =
-{
-    "General Framebuffer",
-    "alex",
-    TYPE_OUTPUT,
-    { 0, 0, 0, 0 },
-    2048,
-    2048,
-    4,
-    4,
-    -1,
-    FLAG_UPSCALER|FLAG_DOWNSCALER,
-    -1,
-    -1,
-    { 0, 0, 0, 0 }
-};
-
-unsigned int VIDIX_NAME(vixGetVersion)(void)
-{
-    return(VIDIX_VERSION);
-}
-
-int VIDIX_NAME(vixProbe)(int verbose,int force)
-{
-#if 0
-    int err = 0;
-#ifdef DEMO_DRIVER
-    err = ENOSYS;
-#endif
-    
-    printf(GENFB_MSG"probe\n");
-
-    fd = open("/dev/fb0", O_RDWR);
-    if (fd < 0)
-    {
-	printf(GENFB_MSG"Error occured durint open: %s\n", strerror(errno));
-	err = errno;
-    }
-    
-    probed = 1;
-
-    return(err);
-#else
-  pciinfo_t lst[MAX_PCI_DEVICES];
-  unsigned i,num_pci;
-  int err;
-  err = pci_scan(lst,&num_pci);
-  if(err)
-  {
-    printf(GENFB_MSG"Error occured during pci scan: %s\n",strerror(err));
-    return err;
-  }
-  else
-  {
-    err = ENXIO;
-    for(i=0;i<num_pci;i++)
-    {
-	if(verbose)
-	    printf(GENFB_MSG" Found chip [%04X:%04X] '%s' '%s'\n"
-	    ,lst[i].vendor
-	    ,lst[i].device
-	    ,pci_vendor_name(lst[i].vendor)
-	    ,pci_device_name(lst[i].vendor,lst[i].device));
-    }
-  }
-  return ENOSYS;
-#endif
-}
-
-int VIDIX_NAME(vixInit)(const char *args)
-{
-    printf(GENFB_MSG"init\n");
-    
-    if (!probed)
-    {
-	printf(GENFB_MSG"Driver was not probed but is being initialized\n");
-	return(EINTR);
-    }
-
-    return(0);
-}
-
-void VIDIX_NAME(vixDestroy)(void)
-{
-    printf(GENFB_MSG"destory\n");
-    return;
-}
-
-int VIDIX_NAME(vixGetCapability)(vidix_capability_t *to)
-{
-    memcpy(to, &genfb_cap, sizeof(vidix_capability_t));
-    return(0);
-}
-
-int VIDIX_NAME(vixQueryFourcc)(vidix_fourcc_t *to)
-{
-    printf(GENFB_MSG"query fourcc (%x)\n", to->fourcc);
-
-    to->depth = VID_DEPTH_1BPP | VID_DEPTH_2BPP |
-		VID_DEPTH_4BPP | VID_DEPTH_8BPP |
-		VID_DEPTH_12BPP | VID_DEPTH_15BPP |
-		VID_DEPTH_16BPP | VID_DEPTH_24BPP |
-		VID_DEPTH_32BPP;
-
-    to->flags = 0;
-    return(0);
-}
-
-int VIDIX_NAME(vixConfigPlayback)(vidix_playback_t *info)
-{
-    printf(GENFB_MSG"config playback\n");
-
-    info->num_frames = 2;
-    info->frame_size = info->src.w*info->src.h+(info->src.w*info->src.h)/2;
-    info->dest.pitch.y = 32;
-    info->dest.pitch.u = info->dest.pitch.v = 16;
-    info->offsets[0] = 0;
-    info->offsets[1] = info->frame_size;
-    info->offset.y = 0;
-    info->offset.v = ((info->src.w+31) & ~31) * info->src.h;
-    info->offset.u = info->offset.v+((info->src.w+31) & ~31) * info->src.h/4;    
-    info->dga_addr = malloc(info->num_frames*info->frame_size);   
-    printf(GENFB_MSG"frame_size: %d, dga_addr: %p\n",
-	info->frame_size, info->dga_addr);
-
-    return(0);
-}
-
-int VIDIX_NAME(vixPlaybackOn)(void)
-{
-    printf(GENFB_MSG"playback on\n");
-    return(0);
-}
-
-int VIDIX_NAME(vixPlaybackOff)(void)
-{
-    printf(GENFB_MSG"playback off\n");
-    return(0);
-}
-
-int VIDIX_NAME(vixPlaybackFrameSelect)(unsigned int frame)
-{
-    printf(GENFB_MSG"frameselect: %d\n", frame);
-    return(0);
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/vidix/drivers/glint_regs.h
--- a/src/video_out/vidix/drivers/glint_regs.h	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1304 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h,v 1.31 \
                2001/12/08 16:01:52 alanh Exp $ */
-
-/*
- * glint register file 
- *
- * Copyright by Stefan Dirsch, Dirk Hohndel, Alan Hourihane
- * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
- *          Dirk Hohndel, <hohndel@suse.de>
- *          Stefan Dirsch, <sndirsch@suse.de>
- *          Simon P., <sim@suse.de>
- *
- * this work is sponsored by S.u.S.E. GmbH, Fuerth, Elsa GmbH, Aachen and
- * Siemens Nixdorf Informationssysteme
- *
- */ 
-
-#ifndef _GLINTREG_H_
-#define _GLINTREG_H_
-
-/**********************************************
-*  GLINT 500TX Configuration Region Registers *
-***********************************************/
-
-/* Device Identification */
-#define CFGVendorId						0x0000
-#define PCI_VENDOR_3DLABS					0x3D3D
-#define PCI_VENDOR_TI						0x104C
-#define CFGDeviceId						0x0002
-
-#define CFGRevisionId						0x08
-#define CFGClassCode						0x09
-#define CFGHeaderType						0x0E
-
-/* Device Control/Status */
-#define CFGCommand							0x04
-#define CFGStatus							0x06
-
-/* Miscellaneous Functions */
-#define CFGBist								0x0f
-#define CFGLatTimer							0x0d
-#define CFGCacheLine							0x0c
-#define CFGMaxLat							0x3f
-#define CFGMinGrant							0x3e
-#define CFGIntPin							0x3d
-#define CFGIntLine							0x3c
-
-/* Base Adresses */
-#define CFGBaseAddr0							0x10 
-#define CFGBaseAddr1							0x14
-#define CFGBaseAddr2							0x18
-#define CFGBaseAddr3							0x1C
-#define CFGBaseAddr4							0x20
-#define CFGRomAddr							0x30
-
-
-
-/**********************************
- * GLINT 500TX Region 0 Registers *
- **********************************/
-
-/* Control Status Registers */
-#define ResetStatus							0x0000
-#define IntEnable							0x0008
-#define IntFlags							0x0010
-#define InFIFOSpace							0x0018
-#define OutFIFOWords							0x0020
-#define DMAAddress							0x0028
-#define DMACount							0x0030
-#define ErrorFlags							0x0038
-#define VClkCtl								0x0040
-#define TestRegister							0x0048
-#define Aperture0							0x0050
-#define Aperture1							0x0058
-#define DMAControl							0x0060
-#define FIFODis								0x0068
-
-/* GLINT PerMedia Region 0 additional Registers */
-#define ChipConfig							0x0070
-#define   SCLK_SEL_MASK		(3 << 10)
-#define   SCLK_SEL_MCLK_HALF	(3 << 10)
-#define ByDMAControl							0x00D8
-
-/* GLINT 500TX LocalBuffer Registers */
-#define LBMemoryCtl							0x1000
-#define   LBNumBanksMask	0x00000001
-#define    LBNumBanks1		(0)
-#define    LBNumBanks2		(1)
-#define   LBPageSizeMask        0x00000006
-#define    LBPageSize256	(0<<1)
-#define    LBPageSize512	(1<<1)
-#define    LBPageSize1024	(2<<1)
-#define    LBPageSize2048	(3<<1)
-#define   LBRASCASLowMask	0x00000018
-#define    LBRASCASLow2		(0<<3)
-#define    LBRASCASLow3		(1<<3)
-#define    LBRASCASLow4		(2<<3)
-#define    LBRASCASLow5		(3<<3)
-#define   LBRASPrechargeMask	0x00000060
-#define    LBRASPrecharge2	(0<<5)
-#define    LBRASPrecharge3	(1<<5)
-#define    LBRASPrecharge4	(2<<5)
-#define    LBRASPrecharge5	(3<<5)
-#define   LBCASLowMask		0x00000180
-#define    LBCASLow1		(0<<7)
-#define    LBCASLow2		(1<<7)
-#define    LBCASLow3		(2<<7)
-#define    LBCASLow4		(3<<7)
-#define   LBPageModeMask	0x00000200
-#define    LBPageModeEnabled	(0<<9)
-#define    LBPageModeDisabled	(1<<9)
-#define   LBRefreshCountMask    0x0003fc00
-#define   LBRefreshCountShift   10
-
-#define LBMemoryEDO							0x1008
-#define   LBEDOMask		0x00000001
-#define    LBEDODisabled	(0)
-#define    LBEDOEnabled		(1)
-#define   LBEDOBankSizeMask	0x0000000e
-#define    LBEDOBankSizeDiabled	(0<<1)
-#define    LBEDOBankSize256K	(1<<1)
-#define    LBEDOBankSize512K	(2<<1)
-#define    LBEDOBankSize1M	(3<<1)
-#define    LBEDOBankSize2M	(4<<1)
-#define    LBEDOBankSize4M	(5<<1)
[... 1052 lines omitted ...]
-
-#define GLINT_WAIT(n)						\
-do{								\
-	if (pGlint->InFifoSpace>=(n))				\
-	    pGlint->InFifoSpace -= (n);				\
-	else {							\
-	    int tmp;						\
-	    while((tmp=GLINT_READ_REG(InFIFOSpace))<(n));	\
-	    /* Clamp value due to bugs in PM3 */		\
-	    if (tmp > pGlint->FIFOSize)				\
-		tmp = pGlint->FIFOSize;				\
-	    pGlint->InFifoSpace = tmp - (n);			\
-	}							\
-}while(0)
-
-#define GLINTDACDelay(x) do {                                   \
-        int delay = x;                                          \
-        unsigned char tmp;                                      \
-	while(delay--){tmp = GLINT_READ_REG(InFIFOSpace);};     \
-	} while(0)
-        
-#define GLINT_MASK_WRITE_REG(v,m,r)				\
-	GLINT_WRITE_REG((GLINT_READ_REG(r)&(m))|(v),r)
-
-#define GLINT_SLOW_WRITE_REG(v,r)				\
-do{								\
-	mem_barrier();						\
-	GLINT_WAIT(pGlint->FIFOSize);	     			\
-	mem_barrier();						\
-        GLINT_WRITE_REG(v,r);					\
-}while(0)
-
-#define GLINT_SET_INDEX(index)					\
-do{								\
-	GLINT_SLOW_WRITE_REG(((index)>>8)&0xff,PM2VDACIndexRegHigh);	\
-	GLINT_SLOW_WRITE_REG((index)&0xff,PM2VDACIndexRegLow);	\
-} while(0)
-
-#define REPLICATE(r)						\
-{								\
-	if (pScrn->bitsPerPixel == 16) {			\
-		r &= 0xFFFF;					\
-		r |= (r<<16);					\
-	} else							\
-	if (pScrn->bitsPerPixel == 8) { 			\
-		r &= 0xFF;					\
-		r |= (r<<8);					\
-		r |= (r<<16);					\
-	}							\
-}
-
-#ifndef XF86DRI
-#define LOADROP(rop)						\
-{								\
-	if (pGlint->ROP != rop)	{				\
-		GLINT_WRITE_REG(rop<<1|UNIT_ENABLE, LogicalOpMode);	\
-		pGlint->ROP = rop;				\
-	}							\
-}
-#else
-#define LOADROP(rop) \
-	{				\
-		GLINT_WRITE_REG(rop<<1|UNIT_ENABLE, LogicalOpMode);	\
-		pGlint->ROP = rop;				\
-	}
-#endif
-	
-#define CHECKCLIPPING						\
-{								\
-	if (pGlint->ClippingOn) {				\
-		pGlint->ClippingOn = FALSE;			\
-		GLINT_WAIT(1);					\
-		GLINT_WRITE_REG(0, ScissorMode);		\
-	}							\
-}
-
-#ifndef XF86DRI
-#define DO_PLANEMASK(planemask)					\
-{ 								\
-	if (planemask != pGlint->planemask) {			\
-		pGlint->planemask = planemask;			\
-		REPLICATE(planemask); 				\
-		GLINT_WRITE_REG(planemask, FBHardwareWriteMask);\
-	}							\
-} 
-#else
-#define DO_PLANEMASK(planemask)					\
-	{							\
-		pGlint->planemask = planemask;			\
-		REPLICATE(planemask); 				\
-		GLINT_WRITE_REG(planemask, FBHardwareWriteMask);\
-	}
-#endif
-
-/* Permedia Save/Restore functions */
-
-#define STOREREG(address,value) 				\
-    	pReg->glintRegs[address >> 3] = value;
-
-#define SAVEREG(address) 					\
-    	pReg->glintRegs[address >> 3] = GLINT_READ_REG(address);
-
-#define RESTOREREG(address) 					\
-    	GLINT_SLOW_WRITE_REG(pReg->glintRegs[address >> 3], address);
-
-#define STOREDAC(address,value)					\
-    	pReg->DacRegs[address] = value;
-
-#define P2VOUT(address)						\
-    Permedia2vOutIndReg(pScrn, address, 0x00, pReg->DacRegs[address]);
-
-#define P2VIN(address)						\
-    pReg->DacRegs[address] = Permedia2vInIndReg(pScrn, address);
-
-/* RamDac Save/Restore functions, used by external DAC's */
-
-#define STORERAMDAC(address,value)				\
-    	ramdacReg->DacRegs[address] = value;
-
-/* Multi Chip access */
-
-#define ACCESSCHIP1()						\
-    pGlint->IOOffset = 0;
-
-#define ACCESSCHIP2()						\
-    pGlint->IOOffset = 0x10000;
-
-#endif
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/vidix/drivers/mach64.h
--- a/src/video_out/vidix/drivers/mach64.h	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2611 +0,0 @@
-/*
- * mach64.h
- * 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	based on radeonfb, X11,	GATOS sources
-*/
-
-#ifndef __MACH64_INCLUDED
-#define __MACH64_INCLUDED 1
-
-/* Note: this model of accessing to IO space is based on MMIO technology.
-This means that this sources don't support ISA and VLB cards */
-#define BlockIOTag(val) (val)
-#define IOPortTag(sparce,val) (val)
-
-/* MDA/[M]CGA/EGA/VGA I/O ports */
-#define GENVS			0x0102u		/* Write (and Read on uC only) */
-
-#define R_GENLPS		0x03b9u		/* Read */
-
-#define GENHP			0x03bfu
-
-#define ATTRX			0x03c0u
-#define ATTRD			0x03c1u
-#define GENS0			0x03c2u		/* Read */
-#define GENMO			0x03c2u		/* Write */
-#define GENENB			0x03c3u		/* Read */
-#define SEQX			0x03c4u
-#define SEQD			0x03c5u
-#define VGA_DAC_MASK		0x03c6u
-#define VGA_DAC_READ		0x03c7u
-#define VGA_DAC_WRITE		0x03c8u
-#define VGA_DAC_DATA		0x03c9u
-#define R_GENFC			0x03cau		/* Read */
-/*	?			0x03cbu */
-#define R_GENMO			0x03ccu		/* Read */
-/*	?			0x03cdu */
-#define GRAX			0x03ceu
-#define GRAD			0x03cfu
-
-#define GENB			0x03d9u
-
-#define GENLPS			0x03dcu		/* Write */
-#define KCX			0x03ddu
-#define KCD			0x03deu
-
-#define GENENA			0x46e8u		/* Write */
-
-/* I/O port base numbers */
-#define MonochromeIOBase	0x03b0u
-#define ColourIOBase		0x03d0u
-
-/* Other MDA/[M]CGA/EGA/VGA I/O ports */
-/*	?(_IOBase)		((_IOBase) + 0x00u) */	/* CRTX synonym */
-/*	?(_IOBase)		((_IOBase) + 0x01u) */	/* CRTD synonym */
-/*	?(_IOBase)		((_IOBase) + 0x02u) */	/* CRTX synonym */
-/*	?(_IOBase)		((_IOBase) + 0x03u) */	/* CRTD synonym */
-#define CRTX(_IOBase)		((_IOBase) + 0x04u)
-#define CRTD(_IOBase)		((_IOBase) + 0x05u)
-/*	?(_IOBase)		((_IOBase) + 0x06u) */
-/*	?(_IOBase)		((_IOBase) + 0x07u) */
-#define GENMC(_IOBase)		((_IOBase) + 0x08u)
-/*	?(_IOBase)		((_IOBase) + 0x09u) */	/* R_GENLPS/GENB */
-#define GENS1(_IOBase)		((_IOBase) + 0x0au)	/* Read */
-#define GENFC(_IOBase)		((_IOBase) + 0x0au)	/* Write */
-#define GENLPC(_IOBase)		((_IOBase) + 0x0bu)
-/*	?(_IOBase)		((_IOBase) + 0x0cu) */	/* /GENLPS */
-/*	?(_IOBase)		((_IOBase) + 0x0du) */	/* /KCX */
-/*	?(_IOBase)		((_IOBase) + 0x0eu) */	/* /KCD */
-/*	?(_IOBase)		((_IOBase) + 0x0fu) */	/* GENHP/ */
-
-/* 8514/A VESA approved register definitions */
-#define DISP_STAT		0x02e8u		/* Read */
-#define SENSE				0x0001u	/* Presumably belong here */
-#define VBLANK				0x0002u
-#define HORTOG				0x0004u
-#define H_TOTAL			0x02e8u		/* Write */
-#define IBM_DAC_MASK		0x02eau
-#define IBM_DAC_READ		0x02ebu
-#define IBM_DAC_WRITE		0x02ecu
-#define IBM_DAC_DATA		0x02edu
-#define H_DISP			0x06e8u		/* Write */
-#define H_SYNC_STRT		0x0ae8u		/* Write */
-#define H_SYNC_WID		0x0ee8u		/* Write */
-#define HSYNCPOL_POS			0x0000u
-#define HSYNCPOL_NEG			0x0020u
-#define H_POLARITY_POS			HSYNCPOL_POS	/* Sigh */
-#define H_POLARITY_NEG			HSYNCPOL_NEG	/* Sigh */
-#define V_TOTAL			0x12e8u		/* Write */
-#define V_DISP			0x16e8u		/* Write */
-#define V_SYNC_STRT		0x1ae8u		/* Write */
-#define V_SYNC_WID		0x1ee8u		/* Write */
-#define VSYNCPOL_POS			0x0000u
-#define VSYNCPOL_NEG			0x0020u
-#define V_POLARITY_POS			VSYNCPOL_POS	/* Sigh */
-#define V_POLARITY_NEG			VSYNCPOL_NEG	/* Sigh */
-#define DISP_CNTL		0x22e8u		/* Write */
-#define ODDBNKENAB			0x0001u
-#define MEMCFG_2			0x0000u
-#define MEMCFG_4			0x0002u
-#define MEMCFG_6			0x0004u
-#define MEMCFG_8			0x0006u
-#define DBLSCAN				0x0008u
-#define INTERLACE			0x0010u
-#define DISPEN_NC			0x0000u
-#define DISPEN_ENAB			0x0020u
-#define DISPEN_DISAB			0x0040u
-#define R_H_TOTAL		0x26e8u		/* Read */
-/*	?			0x2ae8u */
-/*	?			0x2ee8u */
-/*	?			0x32e8u */
-/*	?			0x36e8u */
-/*	?			0x3ae8u */
-/*	?			0x3ee8u */
-#define SUBSYS_STAT		0x42e8u		/* Read */
-#define VBLNKFLG			0x0001u
-#define PICKFLAG			0x0002u
-#define INVALIDIO			0x0004u
-#define GPIDLE				0x0008u
-#define MONITORID_MASK			0x0070u
-/*	MONITORID_?				0x0000u */
-#define MONITORID_8507				0x0010u
-#define MONITORID_8514				0x0020u
[... 2359 lines omitted ...]
-/*	?			0xbfu */
-#define TV_UV_ADR		0xc0u
-#define TV_FIFO_TEST_CNTL	0xc1u
-/*	?			0xc2u */
-/*	?			0xc3u */
-/*	?			0xc4u */
-/*	?			0xc5u */
-/*	?			0xc6u */
-/*	?			0xc7u */
-/*	?			0xc8u */
-/*	?			0xc9u */
-/*	?			0xcau */
-/*	?			0xcbu */
-/*	?			0xccu */
-/*	?			0xcdu */
-/*	?			0xceu */
-/*	?			0xcfu */
-/*	?			0xd0u */
-/*	?			0xd1u */
-/*	?			0xd2u */
-/*	?			0xd3u */
-/*	?			0xd4u */
-/*	?			0xd5u */
-/*	?			0xd6u */
-/*	?			0xd7u */
-/*	?			0xd8u */
-/*	?			0xd9u */
-/*	?			0xdau */
-/*	?			0xdbu */
-/*	?			0xdcu */
-/*	?			0xddu */
-/*	?			0xdeu */
-/*	?			0xdfu */
-/*	?			0xe0u */
-/*	?			0xe1u */
-/*	?			0xe2u */
-/*	?			0xe3u */
-/*	?			0xe4u */
-/*	?			0xe5u */
-/*	?			0xe6u */
-/*	?			0xe7u */
-/*	?			0xe8u */
-/*	?			0xe9u */
-/*	?			0xeau */
-/*	?			0xebu */
-/*	?			0xecu */
-/*	?			0xedu */
-/*	?			0xeeu */
-/*	?			0xefu */
-/*	?			0xf0u */
-/*	?			0xf1u */
-/*	?			0xf2u */
-/*	?			0xf3u */
-/*	?			0xf4u */
-/*	?			0xf5u */
-/*	?			0xf6u */
-/*	?			0xf7u */
-/*	?			0xf8u */
-/*	?			0xf9u */
-/*	?			0xfau */
-/*	?			0xfbu */
-/*	?			0xfcu */
-/*	?			0xfdu */
-/*	?			0xfeu */
-/*	?			0xffu */
-
-/* Miscellaneous */
-
-/* Current X, Y & Dest X, Y mask */
-#define COORD_MASK	0x07ffu
-
-/* Pixel widths */
-#define PIX_WIDTH_1BPP			0x00u
-#define PIX_WIDTH_4BPP			0x01u	/* CRTC2: 8bpp */
-#define PIX_WIDTH_8BPP			0x02u	/* CRTC2: Undefined */
-#define PIX_WIDTH_15BPP			0x03u
-#define PIX_WIDTH_16BPP			0x04u
-#define PIX_WIDTH_24BPP			0x05u
-#define PIX_WIDTH_32BPP			0x06u
-#define PIX_WIDTH_YUV422		0x07u	/* CRTC2 only */
-
-/* Source definitions */
-#define SRC_BKGD			0x00u
-#define SRC_FRGD			0x01u
-#define SRC_HOST			0x02u
-#define SRC_BLIT			0x03u
-#define SRC_PATTERN			0x04u
-#define SRC_SCALER_3D			0x05u
-/*	?				0x06u */
-/*	?				0x07u */
-
-/* The Mixes */
-#define MIX_MASK			0x001fu
-
-#define MIX_NOT_DST			0x0000u
-#define MIX_0				0x0001u
-#define MIX_1				0x0002u
-#define MIX_DST				0x0003u
-#define MIX_NOT_SRC			0x0004u
-#define MIX_XOR				0x0005u
-#define MIX_XNOR			0x0006u
-#define MIX_SRC				0x0007u
-#define MIX_NAND			0x0008u
-#define MIX_NOT_SRC_OR_DST		0x0009u
-#define MIX_SRC_OR_NOT_DST		0x000au
-#define MIX_OR				0x000bu
-#define MIX_AND				0x000cu
-#define MIX_SRC_AND_NOT_DST		0x000du
-#define MIX_NOT_SRC_AND_DST		0x000eu
-#define MIX_NOR				0x000fu
-
-#define MIX_MIN				0x0010u
-#define MIX_DST_MINUS_SRC		0x0011u
-#define MIX_SRC_MINUS_DST		0x0012u
-#define MIX_PLUS			0x0013u
-#define MIX_MAX				0x0014u
-#define MIX_HALF__DST_MINUS_SRC		0x0015u
-#define MIX_HALF__SRC_MINUS_DST		0x0016u
-#define MIX_AVERAGE			0x0017u
-#define MIX_DST_MINUS_SRC_SAT		0x0018u
-#define MIX_SRC_MINUS_DST_SAT		0x001au
-#define MIX_HALF__DST_MINUS_SRC_SAT	0x001cu
-#define MIX_HALF__SRC_MINUS_DST_SAT	0x001eu
-#define MIX_AVERAGE_SAT			0x001fu
-#define MIX_FN_PAINT			MIX_SRC
-
-
-#endif
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/vidix/drivers/mach64_vid.c
--- a/src/video_out/vidix/drivers/mach64_vid.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1390 +0,0 @@
-/*
-   mach64_vid - VIDIX based video driver for Mach64 and 3DRage chips
-   Copyrights 2002 Nick Kurshev. This file is based on sources from
-   GATOS (gatos.sf.net) and X11 (www.xfree86.org)
-   Licence: GPL
-   WARNING: THIS DRIVER IS IN BETTA STAGE
-*/
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <inttypes.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <sys/mman.h> /* for m(un)lock */
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#ifdef HAVE_MEMALIGN
-#define MACH64_ENABLE_BM 1
-#endif
-#endif
-
-#include "vidix.h"
-#include "fourcc.h"
-#include "libdha.h"
-#include "pci_ids.h"
-#include "pci_names.h"
-#include "bswap.h"
-
-#include "mach64.h"
-
-#define UNUSED(x) ((void)(x)) /**< Removes warning about unused arguments */
-
-#define VIDIX_STATIC mach64_
-
-#ifdef MACH64_ENABLE_BM
-
-#define cpu_to_le32(a) (a)
-#define VIRT_TO_CARD(a,b,c) bm_virt_to_bus(a,b,c)
-#pragma pack(1)
-typedef struct
-{
-	uint32_t framebuf_offset;
-	uint32_t sys_addr;
-	uint32_t command;
-	uint32_t reserved;
-} bm_list_descriptor;
-#pragma pack()
-static void *mach64_dma_desc_base[64];
-static unsigned long bus_addr_dma_desc = 0;
-static unsigned long *dma_phys_addrs;
-#endif
-
-static void *mach64_mmio_base = 0;
-static void *mach64_mem_base = 0;
-static int32_t mach64_overlay_offset = 0;
-static uint32_t mach64_ram_size = 0;
-static uint32_t mach64_buffer_base[64][3];
-static int num_mach64_buffers=-1;
-static int supports_planar=0;
-static int supports_colour_adj=0;
-static int supports_idct=0;
-static int supports_subpic=0;
-static int supports_lcd_v_stretch=0;
-
-pciinfo_t pci_info;
-static int probed = 0;
-static int __verbose = 0;
-
-#define VERBOSE_LEVEL 2
-
-typedef struct bes_registers_s
-{
-  /* base address of yuv framebuffer */
-  uint32_t yuv_base;
-  uint32_t fourcc;
-  /* YUV BES registers */
-  uint32_t reg_load_cntl;
-  uint32_t scale_inc;
-  uint32_t y_x_start;
-  uint32_t y_x_end;
-  uint32_t vid_buf_pitch;
-  uint32_t height_width;
-
-  uint32_t scale_cntl;
-  uint32_t exclusive_horz;
-  uint32_t auto_flip_cntl;
-  uint32_t filter_cntl;
-  uint32_t key_cntl;
-  uint32_t test;
-  /* Configurable stuff */
-  
-  int brightness;
-  int saturation;
-  
-  int ckey_on;
-  uint32_t graphics_key_clr;
-  uint32_t graphics_key_msk;
-  
-  int deinterlace_on;
-  uint32_t deinterlace_pattern;
-  
-} bes_registers_t;
-
-static bes_registers_t besr;
-
-typedef struct video_registers_s
-{
-  const char * sname;
-  uint32_t name;
-  uint32_t value;
-}video_registers_t;
-
-static bes_registers_t besr;
-
-/* Graphic keys */
-static vidix_grkey_t mach64_grkey;
-
-#define DECLARE_VREG(name) { #name, name, 0 }
-static video_registers_t vregs[] = 
-{
-  DECLARE_VREG(OVERLAY_SCALE_INC),
-  DECLARE_VREG(OVERLAY_Y_X_START),
[... 1138 lines omitted ...]
-		besr.graphics_key_msk=0xFFFFFF;
-		besr.graphics_key_clr=
-			  ((mach64_grkey.ckey.blue &0xFF))
-			| ((mach64_grkey.ckey.green&0xFF)<<8)
-			| ((mach64_grkey.ckey.red  &0xFF)<<16);
-		break;
-	default:
-		besr.ckey_on=0;
-		besr.graphics_key_msk=0;
-		besr.graphics_key_clr=0;
-	}
-    }
-    else
-    {
-	besr.ckey_on=0;
-	besr.graphics_key_msk=0;
-	besr.graphics_key_clr=0;
-    }
-
-    mach64_fifo_wait(4);
-    OUTREG(OVERLAY_GRAPHICS_KEY_MSK, besr.graphics_key_msk);
-    OUTREG(OVERLAY_GRAPHICS_KEY_CLR, besr.graphics_key_clr);
-//    OUTREG(OVERLAY_VIDEO_KEY_MSK, 0);
-//    OUTREG(OVERLAY_VIDEO_KEY_CLR, 0);
-    if(besr.ckey_on)
-    	OUTREG(OVERLAY_KEY_CNTL,VIDEO_KEY_FN_TRUE|GRAPHIC_KEY_FN_EQ|CMP_MIX_AND);
-    else
-    	OUTREG(OVERLAY_KEY_CNTL,VIDEO_KEY_FN_TRUE|GRAPHIC_KEY_FN_TRUE|CMP_MIX_AND);
-
-    return(0);
-}
-
-#ifdef MACH64_ENABLE_BM
-static int mach64_setup_frame( vidix_dma_t * dmai )
-{
-    if(mach64_overlay_offset + dmai->dest_offset + dmai->size > mach64_ram_size) \
                return E2BIG;
-    if(dmai->idx > VID_PLAY_MAXFRAMES-1) dmai->idx=0;
-    if(!(dmai->internal[dmai->idx] && (dmai->flags & BM_DMA_FIXED_BUFFS)))
-    {
-	bm_list_descriptor * list = (bm_list_descriptor *)mach64_dma_desc_base[dmai->idx];
-	unsigned long dest_ptr;
-	unsigned i,n,count;
-	int retval;
-	n = dmai->size / 4096;
-	if(dmai->size % 4096) n++;
-	if((retval = VIRT_TO_CARD(dmai->src,dmai->size,dma_phys_addrs)) != 0) return \
                retval;
-	dmai->internal[dmai->idx] = mach64_dma_desc_base[dmai->idx];
-	dest_ptr = dmai->dest_offset;
-	count = dmai->size;
-#if 0
-printf("MACH64_DMA_REQUEST va=%X size=%X\n",dmai->src,dmai->size);
-#endif
-	for(i=0;i<n;i++)
-	{
-	    list[i].framebuf_offset = mach64_overlay_offset + dest_ptr; /* offset within of \
                video memory */
-	    list[i].sys_addr = dma_phys_addrs[i];
-	    list[i].command = (count > 4096 ? 4096 : (count | DMA_GUI_COMMAND__EOL));
-	    list[i].reserved = 0;
-#if 0
-printf("MACH64_DMA_TABLE[%i] fboff=%X pa=%X cmd=%X \
rsrvd=%X\n",i,list[i].framebuf_offset,list[i].sys_addr,list[i].command,list[i].reserved);
                
-#endif
-	    dest_ptr += 4096;
-	    count -= 4096;
-	}
-	cpu_flush(list,4096);
-    }
-    return 0;
-}
-
-static int mach64_transfer_frame( unsigned long ba_dma_desc,int sync_mode )
-{
-    uint32_t crtc_int;
-    mach64_wait_for_idle();
-    mach64_fifo_wait(4);
-    OUTREG(BUS_CNTL,(INREG(BUS_CNTL)|BUS_EXT_REG_EN)&(~BUS_MASTER_DIS));
-    crtc_int = INREG(CRTC_INT_CNTL);
-    if(sync_mode && can_use_irq) \
                OUTREG(CRTC_INT_CNTL,crtc_int|CRTC_BUSMASTER_EOL_INT|CRTC_BUSMASTER_EOL_INT_EN);
                
-    else			 OUTREG(CRTC_INT_CNTL,crtc_int|CRTC_BUSMASTER_EOL_INT);
-    OUTREG(BM_SYSTEM_TABLE,ba_dma_desc|SYSTEM_TRIGGER_SYSTEM_TO_VIDEO);
-    if(__verbose > VERBOSE_LEVEL) mach64_vid_dump_regs();    
-#if 0
-    mach64_fifo_wait(4);
-    mach64_fifo_wait(16);
-    printf("MACH64_DMA_DBG: bm_fb_off=%08X bm_sysmem_addr=%08X bm_cmd=%08X \
                bm_status=%08X bm_agp_base=%08X bm_agp_cntl=%08X\n",
-	    INREG(BM_FRAME_BUF_OFFSET),
-	    INREG(BM_SYSTEM_MEM_ADDR),
-	    INREG(BM_COMMAND),
-	    INREG(BM_STATUS),
-	    INREG(AGP_BASE),
-	    INREG(AGP_CNTL));
-#endif
-    return 0;
-}
-
-int VIDIX_NAME(vixQueryDMAStatus)( void )
-{
-    int bm_off;
-    unsigned crtc_int_cntl;
-    mach64_wait_for_idle();
-    mach64_fifo_wait(2);
-    crtc_int_cntl = INREG(CRTC_INT_CNTL);
-    bm_off = crtc_int_cntl & CRTC_BUSMASTER_EOL_INT;
-//    if(bm_off) OUTREG(CRTC_INT_CNTL,crtc_int_cntl | CRTC_BUSMASTER_EOL_INT);
-    return bm_off?0:1;
-}
-
-int VIDIX_NAME(vixPlaybackCopyFrame)( vidix_dma_t * dmai )
-{
-    int retval,sync_mode;
-    if(!(dmai->flags & BM_DMA_FIXED_BUFFS)) if(bm_lock_mem(dmai->src,dmai->size) != \
                0) return errno;
-    sync_mode = (dmai->flags & BM_DMA_SYNC) == BM_DMA_SYNC;
-    if(sync_mode)
-    {
-	if(!irq_installed) init_irq();
-	/* burn CPU instead of PCI bus here */
-	while(vixQueryDMAStatus()!=0){
-	    if(can_use_irq)	hwirq_wait(pci_info.irq);
-	    else		usleep(0); /* ugly but may help */
-	}
-    }
-    mach64_engine_reset();
-    retval = mach64_setup_frame(dmai);
-    VIRT_TO_CARD(mach64_dma_desc_base[dmai->idx],1,&bus_addr_dma_desc);
-    if(retval == 0) retval = mach64_transfer_frame(bus_addr_dma_desc,sync_mode);
-    if(!(dmai->flags & BM_DMA_FIXED_BUFFS)) bm_unlock_mem(dmai->src,dmai->size);
-    return retval;
-}
-#endif
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/vidix/drivers/mga_vid.c
--- a/src/video_out/vidix/drivers/mga_vid.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1567 +0,0 @@
-/*
- * Matrox MGA driver
- *
- * ported to VIDIX by Alex Beregszaszi
- *
- * YUY2 support (see config.format) added by A'rpi/ESP-team
- * double buffering added by A'rpi/ESP-team
- *
- * Brightness/contrast support by Nick Kurshev/Dariush Pietrzak (eyck) and me
- *
- * Fixed Brightness/Contrast
- * Rewrite or read/write kabi@users.sf.net
- *
- * TODO:
- * * fix memory size detection (current reading pci userconfig isn't
- *   working as requested - returns the max avail. ram on arch?)
- * * translate all non-english comments to english
- */
-
-/*
- * Original copyright:
- *
- * 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.
- */
-
-//#define CRTC2
-
-// Set this value, if autodetection fails! (video ram size in megabytes)
-//#define MGA_MEMORY_SIZE 16
-
-/* No irq support in userspace implemented yet, do not enable this! */
-/* disable irq */
-#undef MGA_ALLOW_IRQ
-
-#define MGA_VSYNC_POS 2
-
-#undef MGA_PCICONFIG_MEMDETECT
-
-#define MGA_DEFAULT_FRAMES 64
-
-#define BES
-
-#ifdef MGA_TV
-#undef BES
-#define CRTC2
-#endif
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <inttypes.h>
-
-#include "vidix.h"
-#include "fourcc.h"
-#include "libdha.h"
-#include "pci_ids.h"
-#include "pci_names.h"
-
-#if    !defined(ENOTSUP) && defined(EOPNOTSUPP)
-#define ENOTSUP EOPNOTSUPP
-#endif
-
-#ifdef CRTC2
-#define VIDIX_STATIC mga_crtc2_
-#define MGA_MSG "[mga_crtc2]"
-#else
-#define VIDIX_STATIC mga_
-#define MGA_MSG "[mga]"
-#endif
-
-/* from radeon_vid */
-#define GETREG(TYPE,PTR,OFFZ)		(*((volatile TYPE*)((PTR)+(OFFZ))))
-#define SETREG(TYPE,PTR,OFFZ,VAL)	(*((volatile TYPE*)((PTR)+(OFFZ))))=VAL
-
-#define readb(addr)	  GETREG(uint8_t,(uint32_t)(mga_mmio_base + addr),0)
-#define writeb(addr, val) SETREG(uint8_t,(uint32_t)(mga_mmio_base + addr),0,val)
-#define readl(addr)	  GETREG(uint32_t,(uint32_t)(mga_mmio_base + addr),0)
-#define writel(addr, val) SETREG(uint32_t,(uint32_t)(mga_mmio_base + addr),0,val)
-
-static int mga_verbose = 0;
-
-/* for device detection */
-static int probed = 0;
-static pciinfo_t pci_info;
-
-/* internal booleans */
-static int mga_vid_in_use = 0;
-static int is_g400 = 0;
-static int vid_src_ready = 0;
-static int vid_overlay_on = 0;
-
-/* mapped physical addresses */
-static uint8_t *mga_mmio_base = 0;
-static uint8_t* mga_mem_base = 0;
-
-static int mga_src_base = 0; /* YUV buffer position in video memory */
-
-static uint32_t mga_ram_size = 0; /* how much megabytes videoram we have */
-
-/* Graphic keys */
-static vidix_grkey_t mga_grkey;
-
-static int colkey_saved = 0;
-static int colkey_on = 0;
-static unsigned char colkey_color[4];
-static unsigned char colkey_mask[4];
-
-/* for IRQ */
-static int mga_irq = -1;
-
[... 1315 lines omitted ...]
-
-    /* FIXME turn off BES */
-    vid_src_ready = 0;
-    regs.besctl &= ~1;
-    regs.besglobctl &= ~(1<<6);  // UYVY format selected
-    //    mga_config.colkey_on=0; //!!!
-    mga_vid_write_regs(1);
-    mga_vid_in_use = 0;
-
-#ifdef MGA_ALLOW_IRQ
-    if (mga_irq != -1)
-	free_irq(mga_irq, &mga_irq);
-#endif
-
-    if (mga_mmio_base)
-	unmap_phys_mem(mga_mmio_base, 0x4000);
-    if (mga_mem_base)
-	unmap_phys_mem(mga_mem_base, mga_ram_size);
-    return;
-}
-
-int VIDIX_NAME(vixQueryFourcc)(vidix_fourcc_t *to)
-{
-    int supports=0;
-    if (mga_verbose) printf(MGA_MSG" query fourcc (%x)\n", to->fourcc);
-
-    switch(to->fourcc)
-    {
-    case IMGFMT_YV12:
-    case IMGFMT_IYUV:
-    case IMGFMT_I420:
-	supports = is_g400 ? 1 : 0;
-    case IMGFMT_NV12:
-	supports = is_g400 ? 0 : 1;
-    case IMGFMT_YUY2:
-    case IMGFMT_UYVY:
-	supports = 1;
-	break;
-    default:
-	supports = 0;
-    }
-
-    if(!supports)
-    {
-	to->depth = to->flags = 0;
-	return(ENOTSUP);
-    }
-    to->depth = VID_DEPTH_12BPP |
-	VID_DEPTH_15BPP | VID_DEPTH_16BPP |
-	VID_DEPTH_24BPP | VID_DEPTH_32BPP;
-    to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK | VID_CAP_COLORKEY;
-    return(0);
-}
-
-unsigned int VIDIX_NAME(vixGetVersion)(void)
-{
-    return(VIDIX_VERSION);
-}
-
-int VIDIX_NAME(vixGetCapability)(vidix_capability_t *to)
-{
-    memcpy(to, &mga_cap, sizeof(vidix_capability_t));
-    return(0);
-}
-
-int VIDIX_NAME(vixGetGrKeys)(vidix_grkey_t *grkey)
-{
-    memcpy(grkey, &mga_grkey, sizeof(vidix_grkey_t));
-    return(0);
-}
-
-int VIDIX_NAME(vixSetGrKeys)(const vidix_grkey_t *grkey)
-{
-    memcpy(&mga_grkey, grkey, sizeof(vidix_grkey_t));
-    return(0);
-}
-
-int VIDIX_NAME(vixPlaybackSetEq)( const vidix_video_eq_t * eq)
-{
-    uint32_t luma;
-    float factor = 255.0 / 2000;
-
-    /* contrast and brightness control isn't supported on G200 - alex */
-    if (!is_g400)
-    {
-	if (mga_verbose) printf(MGA_MSG" equalizer isn't supported with G200\n");
-	return(ENOTSUP);
-    }
-
-    luma = regs.beslumactl;
-
-    if (eq->cap & VEQ_CAP_BRIGHTNESS)
-    {
-	luma &= 0xffff;
-	luma |= (((int)(eq->brightness * factor) & 0xff) << 16);
-    }
-    if (eq->cap & VEQ_CAP_CONTRAST)
-    {
-	luma &= 0xffff << 16;
-	luma |= ((int)((eq->contrast + 1000) * factor) & 0xff);
-    }
-
-    regs.beslumactl = luma;
-#ifdef BES
-    writel(BESLUMACTL, regs.beslumactl);
-#endif
-    return(0);
-}
-
-int VIDIX_NAME(vixPlaybackGetEq)( vidix_video_eq_t * eq)
-{
-    float factor = 2000.0 / 255;
-
-    /* contrast and brightness control isn't supported on G200 - alex */
-    if (!is_g400)
-    {
-	if (mga_verbose) printf(MGA_MSG" equalizer isn't supported with G200\n");
-	return(ENOTSUP);
-    }
-
-    // BESLUMACTL is WO only registr!
-    // this will not work: regs.beslumactl = readl(BESLUMACTL);
-    eq->brightness = ((signed char)((regs.beslumactl >> 16) & 0xff)) * factor;
-    eq->contrast = (regs.beslumactl & 0xFF) * factor - 1000;
-    eq->cap = VEQ_CAP_BRIGHTNESS | VEQ_CAP_CONTRAST;
-
-    return(0);
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/vidix/drivers/nvidia_vid.c
--- a/src/video_out/vidix/drivers/nvidia_vid.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,976 +0,0 @@
-/*
-   nvidia_vid - VIDIX based video driver for NVIDIA chips
-   Copyrights 2003 - 2004 Sascha Sommer. This file is based on sources from
-   RIVATV (rivatv.sf.net)
-   Licence: GPL
-   WARNING: THIS DRIVER IS IN BETA STAGE
-   
-   multi buffer support and TNT2 fixes by Dmitry Baryshkov
-*/
-
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <unistd.h>
-
-
-#include "vidix.h"
-#include "fourcc.h"
-#include "libdha.h"
-#include "pci_ids.h"
-#include "pci_names.h"
-#include "bswap.h"
-
-
-pciinfo_t pci_info;
-
-
-#define MAX_FRAMES 3
-#define NV04_BES_SIZE 1024*2000*4
-
-
-static vidix_capability_t nvidia_cap = {
-    "NVIDIA RIVA OVERLAY DRIVER",
-    "Sascha Sommer <saschasommer@freenet.de>",
-    TYPE_OUTPUT,
-    { 0, 0, 0, 0 },
-    2046,
-    2046,
-    4,
-    4,
-    -1,
-    FLAG_UPSCALER|FLAG_DOWNSCALER,
-    VENDOR_NVIDIA2,
-    -1,
-    { 0, 0, 0, 0 }
-};
-
-
-unsigned int vixGetVersion(void){
-    return(VIDIX_VERSION);
-}
-
-
-#define NV_ARCH_03  0x03
-#define NV_ARCH_04  0x04
-#define NV_ARCH_10  0x10
-#define NV_ARCH_20  0x20
-#define NV_ARCH_30  0x30
-
-struct nvidia_cards {
-  unsigned short chip_id;
-  unsigned short arch;
-};
-
-static struct nvidia_cards nvidia_card_ids[] = {
-  /*NV03*/
-  {DEVICE_NVIDIA2_RIVA128, NV_ARCH_03},
-  {DEVICE_NVIDIA2_RIVA128ZX,NV_ARCH_03},
-  /*NV04*/
-  {DEVICE_NVIDIA_NV4_RIVA_TNT,NV_ARCH_04},
-  {DEVICE_NVIDIA_NV5_RIVA_TNT2,NV_ARCH_04},  
-  {DEVICE_NVIDIA_NV5_RIVA_TNT22,NV_ARCH_04},  
-  {DEVICE_NVIDIA_NV5_RIVA_TNT23,NV_ARCH_04},  
-  {DEVICE_NVIDIA_NV6_VANTA,NV_ARCH_04},
-  {DEVICE_NVIDIA_NV6_VANTA2,NV_ARCH_04},
-  {DEVICE_NVIDIA2_TNT,NV_ARCH_04},
-  {DEVICE_NVIDIA2_TNT2,NV_ARCH_04},  
-  {DEVICE_NVIDIA2_VTNT2,NV_ARCH_04},  
-  {DEVICE_NVIDIA2_UTNT2	,NV_ARCH_04},
-  {DEVICE_NVIDIA2_ITNT2,NV_ARCH_04},
-  {DEVICE_NVIDIA_NV5_ALADDIN_TNT2,NV_ARCH_30},
-  /*NV10*/
-  {DEVICE_NVIDIA_NV18_GEFORCE_PCX,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV10_GEFORCE_256,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV10DDR_GEFORCE_256,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV10GL_QUADRO,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV11_GEFORCE2_MX_MX,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV11DDR_GEFORCE2_MX,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV11_GEFORCE2_GO,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV11GL_QUADRO2_MXR_EX,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV15_GEFORCE2_GTS_PRO,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV15DDR_GEFORCE2_TI,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV15BR_GEFORCE2_ULTRA,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV15GL_QUADRO2_PRO,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV17_GEFORCE4_MX,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV17_GEFORCE4_MX2,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV17_GEFORCE4_MX3,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV17_GEFORCE4_MX4,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV17_GEFORCE4_440,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV17_GEFORCE4_420,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV17_GEFORCE4_4202,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV17GL_QUADRO4_550,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV17_GEFORCE4_4402,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV17GL_QUADRO4_200_400,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV17GL_QUADRO4_5502,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV17GL_QUADRO4_5503,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV17_GEFORCE4_410,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV18_GEFORCE4_MX,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV18_GEFORCE4_MX2,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV18_GEFORCE4_MX3,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV18_GEFORCE4_MX4,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV18M_GEFORCE4_448,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV18M_GEFORCE4_488,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV18GL_QUADRO4_580,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV18GL_QUADRO4_NVS,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV18GL_QUADRO4_380,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV18M_GEFORCE4_4482,NV_ARCH_10},
-  {DEVICE_NVIDIA_NVCRUSH11_GEFORCE2_MX,NV_ARCH_10},
-  {DEVICE_NVIDIA_NFORCE2_AGP_DIFFERENT,NV_ARCH_10},
-  {DEVICE_NVIDIA_NFORCE2_AGP,NV_ARCH_10},
-  {DEVICE_NVIDIA_NV18_GEFORCE4_MX5,NV_ARCH_10},
[... 724 lines omitted ...]
-	  printf("[nvidia_vid] unable to setup MTRR: %s\n", strerror(mtrr));
-  else
-	  printf("[nvidia_vid] MTRR set up\n");
-  
-  nv_getscreenproperties(info);
-  if(!info->depth)printf("[nvidia_vid] text mode: \
                %ux%u\n",info->screen_x,info->screen_y);
-  else printf("[nvidia_vid] video mode: %ux%u@%u\n",info->screen_x,info->screen_y, \
                info->depth);
- 
-   
-  rivatv_enable_PMEDIA(info);
-  info->cur_frame = 0;
-  info->use_colorkey = 0;
-
-  return 0;
-}
-
-void vixDestroy(void){
-  unmap_phys_mem(info->control_base ,0x00C00000 + 0x00008000);
-  unmap_phys_mem(info->video_base, info->chip.fbsize);
-  free(info);
-}
-
-int vixGetCapability(vidix_capability_t *to){
-    memcpy(to, &nvidia_cap, sizeof(vidix_capability_t));
-    return 0;
-}
-
-inline static int is_supported_fourcc(uint32_t fourcc)
-{
-	if	(fourcc == IMGFMT_UYVY || fourcc == IMGFMT_YUY2)
-		return 1;
-	else
-		return 0;
-}
-
-int vixQueryFourcc(vidix_fourcc_t *to){
-    if(is_supported_fourcc(to->fourcc)){
-	to->depth = VID_DEPTH_1BPP | VID_DEPTH_2BPP |
-		    VID_DEPTH_4BPP | VID_DEPTH_8BPP |
-		    VID_DEPTH_12BPP| VID_DEPTH_15BPP|
-		    VID_DEPTH_16BPP| VID_DEPTH_24BPP|
-		    VID_DEPTH_32BPP;
-	to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK | VID_CAP_COLORKEY;
-	return 0;
-    }
-    else  to->depth = to->flags = 0;
-    return ENOSYS;
-}
-
-int vixConfigPlayback(vidix_playback_t *vinfo){
-    uint32_t i;
-    printf("called %s\n", __FUNCTION__);
-    if (! is_supported_fourcc(vinfo->fourcc))
-	    return ENOSYS;
-
-    info->width = vinfo->src.w;
-    info->height = vinfo->src.h;
-
-    info->d_width = vinfo->dest.w;
-    info->d_height = vinfo->dest.h;
-    info->wx = vinfo->dest.x;
-    info->wy = vinfo->dest.y;
-    info->format = vinfo->fourcc;
-
-    printf("[nvidia_vid] setting up a %dx%d-%dx%d video window (src %dx%d), format \
                0x%X\n",
-		    info->d_width, info->d_height, info->wx, info->wy, info->width, info->height, \
                vinfo->fourcc);
-    
-    
-    vinfo->dga_addr=(void*)(info->picture_base);
-
-    switch (vinfo->fourcc)
-    {
-	    case IMGFMT_YUY2:
-	    case IMGFMT_UYVY:
-
-		    vinfo->dest.pitch.y = 16;
-		    vinfo->dest.pitch.u = 0;
-		    vinfo->dest.pitch.v = 0;
-
-		    vinfo->offset.y = 0;
-		    vinfo->offset.v = 0;
-		    vinfo->offset.u = 0;
-		    info->pitch = ((info->width << 1) + (vinfo->dest.pitch.y-1)) & \
                ~(vinfo->dest.pitch.y-1);
-		    vinfo->frame_size = info->pitch * info->height;
-		    break;
-    }
-    info->buffer_size = vinfo->frame_size;
-    info->num_frames = vinfo->num_frames= (info->chip.fbsize - \
                info->picture_offset)/vinfo->frame_size;
-    if(vinfo->num_frames > MAX_FRAMES)vinfo->num_frames = MAX_FRAMES;
-//    vinfo->num_frames = 1;
-//    printf("[nvidia_vid] Number of frames %i\n",vinfo->num_frames);
-    for(i=0;i <vinfo->num_frames;i++)vinfo->offsets[i] = vinfo->frame_size*i;
-    return 0;
-}
-
-int vixPlaybackOn(void){
-    rivatv_overlay_start(info,info->cur_frame);
-    return 0;
-}
-
-int vixPlaybackOff(void){
-    rivatv_overlay_stop(info);
-    return 0;
-}
-
-int vixSetGrKeys( const vidix_grkey_t * grkey){
-  if (grkey->ckey.op == CKEY_FALSE)
-  {
-    info->use_colorkey = 0;
-    printf("[nvidia_vid] colorkeying disabled\n");
-  }
-  else {
-  info->use_colorkey = 1;
-  info->vidixcolorkey = \
                ((grkey->ckey.red<<16)|(grkey->ckey.green<<8)|grkey->ckey.blue);
-  printf("[nvidia_vid] set colorkey 0x%x\n",info->vidixcolorkey);
-  }
-  if(info->d_width && info->d_height)rivatv_overlay_start(info,0);
-  return 0;
-}
-
-int vixPlaybackFrameSelect(unsigned int frame){
-//  printf("selecting buffer %d\n", frame);
-  rivatv_overlay_start(info, frame);
-  if (info->num_frames >= 1)
-	  info->cur_frame = frame/*(frame+1)%info->num_frames*/;
-  return 0;
-}
-
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/vidix/drivers/pm2_vid.c
--- a/src/video_out/vidix/drivers/pm2_vid.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,357 +0,0 @@
-/**
-    Driver for 3DLabs Permedia 2.
-
-    Copyright (C) 2002  Måns Rullgård
-
-    This program 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.
-
-    This program 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 this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-**/
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include "vidix.h"
-#include "fourcc.h"
-#include "libdha.h"
-#include "pci_ids.h"
-#include "pci_names.h"
-
-#include "glint_regs.h"
-
-#define VIDIX_STATIC pm2_
-
-/* MBytes of video memory to use */
-#define PM2_VIDMEM 6
-
-#if 0
-#define TRACE_ENTER() fprintf(stderr, "%s: enter\n", __FUNCTION__)
-#define TRACE_EXIT() fprintf(stderr, "%s: exit\n", __FUNCTION__)
-#else
-#define TRACE_ENTER()
-#define TRACE_EXIT()
-#endif
-
-#define WRITE_REG(offset,val)						\
-    *(volatile u_long *)(((u_char *)(pm2_reg_base)) + offset) = (val)
-#define READ_REG(offset)						    \
-    *(volatile unsigned long *)(((unsigned char *)(pm2_reg_base)) + offset)
-
-pciinfo_t pci_info;
-
-void *pm2_reg_base;
-void *pm2_mem;
-
-int pm2_vidmem = PM2_VIDMEM;
-
-static vidix_capability_t pm2_cap =
-{
-    "3DLabs Permedia2 driver",
-    "Måns Rullgård <mru@users.sf.net>",
-    TYPE_OUTPUT,
-    { 0, 0, 0, 0 },
-    2048,
-    2048,
-    4,
-    4,
-    -1,
-    FLAG_UPSCALER|FLAG_DOWNSCALER,
-    VENDOR_3DLABS,
-    -1,
-    { 0, 0, 0, 0 }
-};
-
-
-unsigned int VIDIX_NAME(vixGetVersion)(void)
-{
-    return(VIDIX_VERSION);
-}
-
-static u_int pm2_card_ids[] =
-{
-    (VENDOR_3DLABS << 16) | DEVICE_3DLABS_PERMEDIA2,
-    (VENDOR_TEXAS << 16) | DEVICE_TEXAS_TVP4020_PERMEDIA_2
-};
-
-static int find_chip(u_int vendor, u_int chip_id)
-{
-    u_int vci = (vendor << 16) | chip_id;
-    unsigned i;
-    for(i = 0; i < sizeof(pm2_card_ids)/sizeof(u_int); i++){
-	if(vci == pm2_card_ids[i]) return i;
-    }
-    return -1;
-}
-
-int VIDIX_NAME(vixProbe)(int verbose, int force)
-{
-    pciinfo_t lst[MAX_PCI_DEVICES];
-    unsigned i,num_pci;
-    int err;
-
-    err = pci_scan(lst,&num_pci);
-    if(err)
-    {
-	printf("[pm2] Error occured during pci scan: %s\n",strerror(err));
-	return err;
-    }
-    else
-    {
-	err = ENXIO;
-	for(i=0; i < num_pci; i++)
-	{
-	    int idx;
-	    const char *dname;
-	    idx = find_chip(lst[i].vendor, lst[i].device);
-	    if(idx == -1)
-		continue;
-	    dname = pci_device_name(lst[i].vendor, lst[i].device);
-	    dname = dname ? dname : "Unknown chip";
[... 105 lines omitted ...]
-
-static int frames[VID_PLAY_MAXFRAMES];
-
-int VIDIX_NAME(vixConfigPlayback)(vidix_playback_t *info)
-{
-    u_int src_w, drw_w;
-    u_int src_h, drw_h;
-    long base0;
-    u_int stride, sstr;
-    u_int format;
-    unsigned int i;
-    u_int ppcode = 0, sppc = 0;
-    u_int pitch = 0;
-
-    TRACE_ENTER();
-
-    switch(info->fourcc){
-    case IMGFMT_YUY2:
-	format = FORMAT_YUV422;
-	break;
-    default:
-	return -1;
-    }
-
-    src_w = info->src.w;
-    src_h = info->src.h;
-
-    drw_w = info->dest.w;
-    drw_h = info->dest.h;
-
-    sstr = READ_REG(PMScreenStride) * 2;
-
-    stride = 0;
-    for(i = 1; i < sizeof(ppcodes) / sizeof(ppcodes[0]); i++){
-	if((!stride) && (ppcodes[i][0] >= src_w)){
-	    stride = ppcodes[i][0];
-	    ppcode = ppcodes[i][1];
-	    pitch = ppcodes[i][0] - ppcodes[i-1][0];
-	}
-	if(ppcodes[i][0] == sstr)
-	    sppc = ppcodes[i][1];
-    }
-
-    if(!stride)
-	return -1;
-
-    info->num_frames = pm2_vidmem*1024*1024 / (stride * src_h * 2);
-    if(info->num_frames > VID_PLAY_MAXFRAMES)
-	info->num_frames = VID_PLAY_MAXFRAMES;
-
-    /* Use end of video memory. Assume the card has 8 MB */
-    base0 = (8 - pm2_vidmem)*1024*1024;
-    info->dga_addr = pm2_mem + base0;
-
-    info->dest.pitch.y = pitch*2;
-    info->dest.pitch.u = 0;
-    info->dest.pitch.v = 0;
-    info->offset.y = 0;
-    info->offset.v = 0;
-    info->offset.u = 0;
-    info->frame_size = stride * src_h * 2;
-
-    for(i = 0; i < info->num_frames; i++){
-	info->offsets[i] = info->frame_size * i;
-	frames[i] = (base0 + info->offsets[i]) >> 1;
-    }
-
-    WRITE_REG(WindowOrigin, 0);
-    WRITE_REG(dY, 1 << 16);
-    WRITE_REG(RasterizerMode, 0);
-    WRITE_REG(ScissorMode, 0);
-    WRITE_REG(AreaStippleMode, 0);
-    WRITE_REG(StencilMode, 0);
-    WRITE_REG(TextureAddressMode, 1);
-
-    WRITE_REG(dSdyDom, 0);
-    WRITE_REG(dTdx, 0);
-
-    WRITE_REG(PMTextureMapFormat, (1 << 19) | ppcode);
-    WRITE_REG(PMTextureDataFormat, format);
-    WRITE_REG(PMTextureReadMode, (1 << 17) | /* FilterMode */
-	      (11 << 13) | (11 << 9) /* TextureSize log2 */ | 1);
-    WRITE_REG(ColorDDAMode, 0);
-    WRITE_REG(TextureColorMode, (0 << 4) /* RGB */ | (3 << 1) /* Copy */ | 1);
-    WRITE_REG(AlphaBlendMode, 0);
-    WRITE_REG(DitherMode, (1 << 10) | 1);
-    WRITE_REG(LogicalOpMode, 0);
-    WRITE_REG(FBReadMode, sppc);
-    WRITE_REG(FBHardwareWriteMask, 0xFFFFFFFF);
-    WRITE_REG(FBWriteMode, 1);
-    WRITE_REG(YUVMode, 1);
-
-    WRITE_REG(SStart, 0);
-    WRITE_REG(TStart, 0);
-
-    WRITE_REG(dSdx, (src_w << 20) / drw_w);
-    WRITE_REG(dTdyDom, (src_h << 20) / drw_h);
-    WRITE_REG(RectangleOrigin, info->dest.x | (info->dest.y << 16));
-    WRITE_REG(RectangleSize, (drw_h << 16) | drw_w);
-
-    TRACE_EXIT();
-    return 0;
-}
-
-int VIDIX_NAME(vixPlaybackOn)(void)
-{
-    TRACE_ENTER();
-
-    TRACE_EXIT();
-    return 0;
-}
-
-int VIDIX_NAME(vixPlaybackOff)(void)
-{
-    WRITE_REG(YUVMode, 0);
-    WRITE_REG(TextureColorMode, 0);
-    WRITE_REG(TextureAddressMode, 0);
-    WRITE_REG(TextureReadMode, 0);
-    return 0;
-}
-
-int VIDIX_NAME(vixPlaybackFrameSelect)(unsigned int frame)
-{
-    WRITE_REG(PMTextureBaseAddress, frames[frame]);
-    WRITE_REG(Render, PrimitiveRectangle | XPositive | YPositive |
-	      TextureEnable);
-    return 0;
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/vidix/drivers/pm3_regs.h
--- a/src/video_out/vidix/drivers/pm3_regs.h	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1253 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h,v 1.9 \
                2001/11/20 00:09:15 alanh Exp $ */
-
-/*
- * glint register file
- *
- * Copyright by Sven Luther
- * Authors: Sven Luther, <luther@dpt-info.u-strasbg.fr>
- *          Thomas Witzel, <twitzel@nmr.mgh.harvard.edu>
- *
- * this work is sponsored by Appian Graphics.
- *
- */
-
-#ifndef _PM3_REG_H_
-#define _PM3_REG_H_
-
-#define PM3FIFOSize 120
-
-#define PM3Tag(r) ((r>>3)&0x7ff)
-
-#define PM3OutputFIFO						0x2000
-
-/**********************************************
-*  GLINT Permedia3 Control Status registers   *
-***********************************************/
-/* Control Status Registers */
-#define PM3ResetStatus						0x0000
-#define PM3IntEnable						0x0008
-#define PM3IntFlags						0x0010
-#define PM3InFIFOSpace						0x0018
-#define PM3OutFIFOWords						0x0020
-#define PM3DMAAddress						0x0028
-#define PM3DMACount						0x0030
-#define PM3ErrorFlags						0x0038
-#define PM3VClkCtl						0x0040
-#define PM3TestRegister						0x0048
-#define PM3Aperture0						0x0050
-#define PM3Aperture1						0x0058
-#define PM3DMAControl						0x0060
-#define PM3FIFODis						0x0068
-#define PM3ChipConfig						0x0070
-#define PM3AGPControl						0x0078
-
-#define PM3GPOutDMAAddress					0x0080
-#define PM3PCIFeedbackCount					0x0088
-#define PM3PCIAbortStatus					0x0090
-#define PM3PCIAbortAddress					0x0098
-
-#define PM3PCIPLLStatus						0x00f0
-
-#define PM3HostTextureAddress					0x0100
-#define PM3TextureDownloadControl				0x0108
-#define PM3TextureOperation					0x0110
-#define PM3LogicalTexturePage					0x0118
-#define PM3TexDMAAddress					0x0120
-#define PM3TexFIFOSpace						0x0128
-
-/**********************************************
-*  GLINT Permedia3 Region 0 Bypass Controls   *
-***********************************************/
-#define PM3ByAperture1Mode					0x0300
-	#define PM3ByApertureMode_BYTESWAP_ABCD			(0<<0)
-	#define PM3ByApertureMode_BYTESWAP_BADC			(1<<0)
-	#define PM3ByApertureMode_BYTESWAP_CDAB			(2<<0)
-	#define PM3ByApertureMode_BYTESWAP_DCBA			(3<<0)
-	#define PM3ByApertureMode_PATCH_DISABLE			(0<<2)
-	#define PM3ByApertureMode_PATCH_ENABLE			(1<<2)
-	#define PM3ByApertureMode_FORMAT_RAW			(0<<3)
-	#define PM3ByApertureMode_FORMAT_YUYV			(1<<3)
-	#define PM3ByApertureMode_FORMAT_UYVY			(2<<3)
-	#define PM3ByApertureMode_PIXELSIZE_8BIT		(0<<5)
-	#define PM3ByApertureMode_PIXELSIZE_16BIT		(1<<5)
-	#define PM3ByApertureMode_PIXELSIZE_32BIT		(2<<5)
-	#define PM3ByApertureMode_EFFECTIVE_STRIDE_1024		(0<<7)
-	#define PM3ByApertureMode_EFFECTIVE_STRIDE_2048		(1<<7)
-	#define PM3ByApertureMode_EFFECTIVE_STRIDE_4096		(2<<7)
-	#define PM3ByApertureMode_EFFECTIVE_STRIDE_8192		(3<<7)
-	#define PM3ByApertureMode_PATCH_OFFSET_X(off)	(((off)&7f)<<9)
-	#define PM3ByApertureMode_PATCH_OFFSET_Y(off)	(((off)&7f)<<16)
-	#define PM3ByApertureMode_FRAMEBUFFER			(0<<21)
-	#define PM3ByApertureMode_LOCALBUFFER			(1<<21)
-	#define PM3ByApertureMode_DOUBLE_WRITE_OFF		(0<<22)
-	#define PM3ByApertureMode_DOUBLE_WRITE_1MB		(1<<22)
-	#define PM3ByApertureMode_DOUBLE_WRITE_2MB		(2<<22)
-	#define PM3ByApertureMode_DOUBLE_WRITE_4MB		(3<<22)
-	#define PM3ByApertureMode_DOUBLE_WRITE_8MB		(4<<22)
-	#define PM3ByApertureMode_DOUBLE_WRITE_16MB		(5<<22)
-	#define PM3ByApertureMode_DOUBLE_WRITE_32MB		(6<<22)
-#define PM3Aperture1Stride					0x0308
-#define PM3Aperture1YStart					0x0310
-#define PM3Aperture1UStart					0x0318
-#define PM3Aperture1VStart					0x0320
-
-#define PM3ByAperture2Mode					0x0328
-#define PM3Aperture2Stride					0x0330
-#define PM3Aperture2YStart					0x0338
-#define PM3Aperture2UStart					0x0340
-#define PM3Aperture2VStart					0x0348
-
-#define PM3ByDMAReadCommandBase					0x0378
-#define PM3ByDMAReadCommandCount				0x0380
-#define PM3ByDMAReadMode					0x0350
-	#define PM3ByDMAReadMode_ByteSwap_NONE			(0<<0)
-	#define PM3ByDMAReadMode_ByteSwap_BYTE			(1<<0)
-	#define PM3ByDMAReadMode_ByteSwap_HWORD			(2<<0)
-	#define PM3ByDMAReadMode_ByteSwap_FULL			(3<<0)
-	#define PM3ByDMAReadMode_PatchEnable			(1<<2)
-	#define PM3ByDMAReadMode_Format_RAW			(0<<3)
-	#define PM3ByDMAReadMode_Format_YUYV			(1<<3)
-	#define PM3ByDMAReadMode_Format_UYVY			(2<<3)
-	#define PM3ByDMAReadMode_PixelSize(s)			(((s>>4)&3)<<5)
-	#define PM3ByDMAReadMode_EffectiveStride(s)		((s&3)<<7)
-	#define PM3ByDMAReadMode_PatchOffsetX(x)		((x&0x3f)<<9)
-	#define PM3ByDMAReadMode_PatchOffsetY(y)		((y&0x3f)<<16)
-	#define PM3ByDMAReadMode_Buffer_FB			(0<<21)
-	#define PM3ByDMAReadMode_Buffer_LB			(1<<21)
-	#define PM3ByDMAReadMode_Active				(1<<22)
-	#define PM3ByDMAReadMode_MemType_PCI			(0<<23)
-	#define PM3ByDMAReadMode_MemType_AGP			(1<<23)
-	#define PM3ByDMAReadMode_Burst(b)			((b&7)<<24)
-	#define PM3ByDMAReadMode_Align				(1<<27)
-#define PM3ByDMAReadStride					0x0358
-#define PM3ByDMAReadUStart					0x0368
-#define PM3ByDMAReadVStart					0x0370
[... 1001 lines omitted ...]
-	#define PM3Render2D_XPositive				(1<<28)
-	#define PM3Render2D_YPositive				(1<<29)
-	#define PM3Render2D_AreaStippleEnable			(1<<30)
-	#define PM3Render2D_TextureEnable			(1<<31)
-#define PM3Render2DGlyph					0xb648
-	#define PM3Render2DGlyph_Width(w)		((w)&0x7f)
-	#define PM3Render2DGlyph_Height(h)		(((h)&0x7f)<<7)
-	#define PM3Render2DGlyph_XOffset(x)		(((x)&0x1ff)<<14)
-	#define PM3Render2DGlyph_YOffset(y)		(((y)&0x1ff)<<23)
-#define PM3RenderPatchOffset					0xb610
-	#define PM3RenderPatchOffset_XOffset(x)		((x)&0xffff)
-	#define PM3RenderPatchOffset_YOffset(y)		(((y)&0xffff)<<16)
-#define PM3RLCount						0xb678
-	#define PM3RLCount_Count(c)			((c)&0x0fff)
-#define PM3RLData						0xb670
-
-/**********************************************
-*  GLINT Permedia3 Alias Register             *
-***********************************************/
-#define PM3FillBackgroundColor                                  0x8330
-#define PM3FillConfig2D0                                        0x8338
-#define PM3FillConfig2D1                                        0x8360
-	#define PM3FillConfig2D_OpaqueSpan                      1<<0
-	#define PM3FillConfig2D_MultiRXBlit                     1<<1
-	#define PM3FillConfig2D_UserScissorEnable               1<<2
-	#define PM3FillConfig2D_FBDestReadEnable                1<<3
-	#define PM3FillConfig2D_AlphaBlendEnable                1<<4
-	#define PM3FillConfig2D_DitherEnable                    1<<5
-	#define PM3FillConfig2D_ForegroundROPEnable             1<<6
-	#define PM3FillConfig2D_ForegroundROP(rop)              (((rop)&0xf)<<7)
-	#define PM3FillConfig2D_BackgroundROPEnable             1<<11
-	#define PM3FillConfig2D_BackgroundROP(rop)              (((rop)&0xf)<<12)
-	#define PM3FillConfig2D_UseConstantSource               1<<16
-	#define PM3FillConfig2D_FBWriteEnable                   1<<17
-	#define PM3FillConfig2D_Blocking                        1<<18
-	#define PM3FillConfig2D_ExternalSourceData              1<<19
-	#define PM3FillConfig2D_LUTModeEnable                   1<<20
-#define PM3FillFBDestReadBufferAddr                             0x8310
-#define PM3FillFBSourceReadBufferAddr                           0x8308
-#define PM3FillFBSourceReadBufferOffset                         0x8340
-	#define PM3FillFBSourceReadBufferOffset_XOffset(x)     ((x)&0xffff)
-	#define PM3FillFBSourceReadBufferOffset_YOffset(y)      (((y)&0xffff)<<16)
-#define PM3FillFBWriteBufferAddr                                0x8300
-#define PM3FillForegroundColor0                                 0x8328
-#define PM3FillForegroundColor1                                 0x8358
-#define PM3FillGlyphPosition                                    0x8368
-        #define PM3FillGlyphPosition_XOffset(x)                        ((x)&0xffff)
-	#define PM3FillGlyphPosition_YOffset(y)                        (((y)&0xffff)<<16)
-#define PM3FillRectanglePosition                                0x8348
-	#define PM3FillRectanglePosition_XOffset(x)            ((x)&0xffff)
-	#define PM3FillRectanglePosition_YOffset(y)            (((y)&0xffff)<<16)
-
-/**********************************************
-*  GLINT Permedia3 Macros                     *
-***********************************************/
-
-#ifdef __alpha__
-#define mem_barrier()        asm volatile ("mb"  : : : "memory")
-#define write_mem_barrier()  asm volatile ("wmb" : : : "memory")
-#else
-#define mem_barrier()
-#define write_mem_barrier()
-#endif
-
-extern void *pm3_reg_base;
-
-#define WRITE_REG(offset,val)						\
-    do {								\
-	write_mem_barrier();						\
-	*(volatile uint32_t *)						\
-	    (((unsigned char *)(pm3_reg_base)) + offset) = (val);	\
-    } while(0)
-
-static inline uint32_t
-READ_REG(uint32_t offset)
-{
-    mem_barrier();
-    return *(volatile uint32_t *)(((unsigned char *)(pm3_reg_base)) + offset);
-}
-
-#define UPDATE_SET_REG(offset,val)		\
-    {						\
-	unsigned long temp;			\
-	temp = READ_REG(offset);		\
-	WRITE_REG(offset,temp|(val));		\
-    }
-
-#define UPDATE_CLEAR_REG(offset,val)		\
-    {						\
-	unsigned long temp;			\
-	temp = READ_REG(offset);		\
-	WRITE_REG(offset,temp&(~(val)));	\
-    }
-
-#define WAIT_FIFO(n) while(READ_REG(PM3InFIFOSpace) < (n))
-
-#define RAMDAC_DELAY(x) do {					\
-	int delay = x;						\
-	unsigned char tmp;					\
-	while(delay--){tmp = READ_REG(PM3InFIFOSpace);};	\
-} while(0)
-
-#define SLOW_WRITE_REG(v,r)			\
-do{						\
-	RAMDAC_DELAY(5);			\
-	WRITE_REG(v,r);				\
-	RAMDAC_DELAY(5);			\
-}while(0)
-
-#define RAMDAC_SET_INDEX(index)					\
-{								\
-    SLOW_WRITE_REG (PM3RD_IndexHigh,(index>>8)&0xff);		\
-    SLOW_WRITE_REG (PM3RD_IndexLow,index&0xff);			\
-}
-
-#define RAMDAC_SET_REG(index, data)				\
-{								\
-    RAMDAC_SET_INDEX(index);					\
-    SLOW_WRITE_REG(PM3RD_IndexedData, data);			\
-}
-
-#define RAMDAC_GET_REG(index, temp)		\
-{						\
-    RAMDAC_SET_INDEX(index);			\
-    temp = READ_REG(PM3RD_IndexedData);		\
-}
-
-#endif /* _PM3_REG_H_ */
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/vidix/drivers/pm3_vid.c
--- a/src/video_out/vidix/drivers/pm3_vid.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,573 +0,0 @@
-/**
-    Driver for 3DLabs GLINT R3 and Permedia3 chips.
-
-    Copyright (C) 2002, 2003  Måns Rullgård
-
-    This program 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.
-
-    This program 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 this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-**/
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <unistd.h>
-#include <sys/mman.h>
-
-#include "vidix.h"
-#include "fourcc.h"
-#include "libdha.h"
-#include "pci_ids.h"
-#include "pci_names.h"
-
-#include "pm3_regs.h"
-
-#define VIDIX_STATIC pm3_
-
-/* MBytes of video memory to use */
-#define PM3_VIDMEM 24
-
-#if 0
-#define TRACE_ENTER() fprintf(stderr, "%s: enter\n", __FUNCTION__)
-#define TRACE_EXIT() fprintf(stderr, "%s: exit\n", __FUNCTION__)
-#else
-#define TRACE_ENTER()
-#define TRACE_EXIT()
-#endif
-
-static pciinfo_t pci_info;
-
-void *pm3_reg_base;
-static void *pm3_mem;
-
-static int pm3_vidmem = PM3_VIDMEM;
-static int pm3_blank = 0;
-static int pm3_dma = 0;
-
-static int pm3_ckey_red, pm3_ckey_green, pm3_ckey_blue;
-
-static u_int page_size;
-
-static vidix_capability_t pm3_cap =
-{
-    "3DLabs GLINT R3/Permedia3 driver",
-    "Måns Rullgård <mru@users.sf.net>",
-    TYPE_OUTPUT,
-    { 0, 0, 0, 0 },
-    2048,
-    2048,
-    4,
-    4,
-    -1,
-    FLAG_UPSCALER | FLAG_DOWNSCALER,
-    VENDOR_3DLABS,
-    -1,
-    { 0, 0, 0, 0 }
-};
-
-
-unsigned int VIDIX_NAME(vixGetVersion)(void)
-{
-    return(VIDIX_VERSION);
-}
-
-static unsigned short pm3_card_ids[] = 
-{
-    DEVICE_3DLABS_GLINT_R3
-};
-
-static int find_chip(unsigned chip_id)
-{
-  unsigned i;
-  for(i = 0;i < sizeof(pm3_card_ids)/sizeof(unsigned short);i++)
-  {
-    if(chip_id == pm3_card_ids[i]) return i;
-  }
-  return -1;
-}
-
-int VIDIX_NAME(vixProbe)(int verbose, int force)
-{
-    pciinfo_t lst[MAX_PCI_DEVICES];
-    unsigned i,num_pci;
-    int err;
-
-    err = pci_scan(lst,&num_pci);
-    if(err)
-    {
-	printf("[pm3] Error occured during pci scan: %s\n",strerror(err));
-	return err;
-    }
-    else
-    {
-	err = ENXIO;
-	for(i=0; i < num_pci; i++)
-	{
-	    if(lst[i].vendor == VENDOR_3DLABS)
-	    {
-		int idx;
-		const char *dname;
-		idx = find_chip(lst[i].device);
-		if(idx == -1)
-		    continue;
[... 321 lines omitted ...]
-		   overlay_control | rdoverlay_mode);
-    WRITE_REG(PM3VideoOverlayUpdate, PM3VideoOverlayUpdate_ENABLE);
-
-    if(pm3_blank)
-	WRITE_REG(PM3VideoControl,
-		  video_control | PM3VideoControl_DISPLAY_ENABLE);
-
-    TRACE_EXIT();
-    return 0;
-}
-
-int VIDIX_NAME(vixPlaybackOff)(void)
-{
-    overlay_control &= ~PM3RD_VideoOverlayControl_ENABLE;
-    RAMDAC_SET_REG(PM3RD_VideoOverlayControl,
-		   PM3RD_VideoOverlayControl_DISABLE);
-    WRITE_REG(PM3VideoOverlayMode,
-	      PM3VideoOverlayMode_DISABLE);
-
-    if(video_control)
-	WRITE_REG(PM3VideoControl,
-		  video_control & ~PM3VideoControl_DISPLAY_ENABLE);
-
-    return 0;
-}
-
-int VIDIX_NAME(vixPlaybackFrameSelect)(unsigned int frame)
-{
-    WRITE_REG(PM3VideoOverlayBase0, frames[frame]);
-
-    return 0;
-}
-
-struct pm3_bydma_cmd {
-    uint32_t bus_addr;
-    uint32_t fb_addr;
-    uint32_t mask;
-    uint32_t count;
-};
-
-struct pm3_bydma_frame {
-    struct pm3_bydma_cmd *cmds;
-    u_long bus_addr;
-    uint32_t count;
-};
-
-static struct pm3_bydma_frame *
-pm3_setup_bydma(vidix_dma_t *dma, struct pm3_bydma_frame *bdf)
-{
-    u_int size = dma->size;
-    u_int pages = (size + page_size-1) / page_size;
-    unsigned long baddr[pages];
-    u_int i;
-    uint32_t dest;
-
-    if(bm_virt_to_bus(dma->src, dma->size, baddr))
-	return NULL;
-
-    if(!bdf){
-	bdf = malloc(sizeof(*bdf));
-	bdf->cmds = valloc(pages * sizeof(struct pm3_bydma_cmd));
-	if(dma->flags & BM_DMA_FIXED_BUFFS){
-	    mlock(bdf->cmds, page_size);
-	}
-    }
-
-    dest = vid_base + dma->dest_offset;
-    for(i = 0; i < pages; i++, dest += page_size, size -= page_size){
-	bdf->cmds[i].bus_addr = baddr[i];
-	bdf->cmds[i].fb_addr = dest;
-	bdf->cmds[i].mask = ~0;
-	bdf->cmds[i].count = ((size > page_size)? page_size: size) / 16;
-    }
-
-    bdf->count = pages;
-
-    if(bm_virt_to_bus(bdf->cmds, page_size, &bdf->bus_addr) != 0){
-	free(bdf->cmds);
-	free(bdf);
-	return NULL;
-    }
-
-    return bdf;
-}
-
-extern int
-VIDIX_NAME(vixPlaybackCopyFrame)(vidix_dma_t *dma)
-{
-    u_int frame = dma->idx;
-    struct pm3_bydma_frame *bdf;
-
-    bdf = dma->internal[frame];
-    if(!bdf || !(dma->flags & BM_DMA_FIXED_BUFFS))
-	bdf = pm3_setup_bydma(dma, bdf);
-    if(!bdf)
-	return -1;
-
-    if(!dma->internal[frame])
-	dma->internal[frame] = bdf;
-
-    if(dma->flags & BM_DMA_SYNC){
-	hwirq_wait(pci_info.irq);
-    }
-
-    WAIT_FIFO(3);
-    WRITE_REG(PM3ByDMAReadCommandBase, bdf->bus_addr);
-    WRITE_REG(PM3ByDMAReadCommandCount, bdf->count);
-    WRITE_REG(PM3ByDMAReadMode,
-	      PM3ByDMAReadMode_ByteSwap_NONE |
-	      PM3ByDMAReadMode_Format_RAW |
-	      PM3ByDMAReadMode_PixelSize(16) |
-	      PM3ByDMAReadMode_Active |
-	      PM3ByDMAReadMode_Burst(7) |
-	      PM3ByDMAReadMode_Align);
-
-    if(dma->flags & BM_DMA_BLOCK){
-	hwirq_wait(pci_info.irq);
-    }
-
-    return 0;
-}
-
-extern int
-VIDIX_NAME(vixQueryDMAStatus)(void)
-{
-    uint32_t bdm = READ_REG(PM3ByDMAReadMode);
-    return (bdm & PM3ByDMAReadMode_Active)? 1: 0;
-}
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/vidix/drivers/radeon.h
--- a/src/video_out/vidix/drivers/radeon.h	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2221 +0,0 @@
-/*
- * radeon.h
- * This	software has been released under the terms of the GNU Public
- * license. See	http://www.gnu.org/copyleft/gpl.html for details.
- *
- * This	collection of definition was written by	Nick Kurshev
- * It's	based on radeonfb, X11,	GATOS sources
- * and partly compatible with Rage128 set (in OV0, CAP0, CAP1 parts)
-*/
-
-#ifndef	_RADEON_H
-#define	_RADEON_H
-
-#define	RADEON_REGSIZE			0x4000
-#define	MM_INDEX			0x0000
-/* MM_INDEX bit	constants */
-#	define MM_APER				0x80000000
-#define	MM_DATA					0x0004
-#define	BUS_CNTL				0x0030
-/* BUS_CNTL bit	constants */
-#	define BUS_DBL_RESYNC			0x00000001
-#	define BUS_MSTR_RESET			0x00000002
-#	define BUS_FLUSH_BUF			0x00000004
-#	define BUS_STOP_REQ_DIS			0x00000008
-#	define BUS_ROTATION_DIS			0x00000010
-#	define BUS_MASTER_DIS			0x00000040
-#	define BUS_ROM_WRT_EN			0x00000080
-#	define BUS_DIS_ROM			0x00001000
-#	define BUS_PCI_READ_RETRY_EN		0x00002000
-#	define BUS_AGP_AD_STEPPING_EN		0x00004000
-#	define BUS_PCI_WRT_RETRY_EN		0x00008000
-#	define BUS_MSTR_RD_MULT			0x00100000
-#	define BUS_MSTR_RD_LINE			0x00200000
-#	define BUS_SUSPEND			0x00400000
-#	define LAT_16X				0x00800000
-#	define BUS_RD_DISCARD_EN		0x01000000
-#	define BUS_RD_ABORT_EN			0x02000000
-#	define BUS_MSTR_WS			0x04000000
-#	define BUS_PARKING_DIS			0x08000000
-#	define BUS_MSTR_DISCONNECT_EN		0x10000000
-#	define BUS_WRT_BURST			0x20000000
-#	define BUS_READ_BURST			0x40000000
-#	define BUS_RDY_READ_DLY			0x80000000
-#define	HI_STAT					0x004C
-#define	BUS_CNTL1				0x0034
-#	define BUS_WAIT_ON_LOCK_EN		(1 << 4)
-#define	I2C_CNTL_0				0x0090
-#	define I2C_DONE				(1<<0)
-#	define I2C_NACK				(1<<1)
-#	define I2C_HALT				(1<<2)
-#	define I2C_SOFT_RST			(1<<5)
-#	define I2C_DRIVE_EN			(1<<6)
-#	define I2C_DRIVE_SEL			(1<<7)
-#	define I2C_START			(1<<8)
-#	define I2C_STOP				(1<<9)
-#	define I2C_RECEIVE			(1<<10)
-#	define I2C_ABORT			(1<<11)
-#	define I2C_GO				(1<<12)
-#	define I2C_SEL				(1<<16)
-#	define I2C_EN				(1<<17)
-#define	I2C_CNTL_1				0x0094
-#define	I2C_DATA				0x0098
-#define	CONFIG_CNTL				0x00E0
-/* CONFIG_CNTL bit constants */
-#	define CFG_VGA_RAM_EN			0x00000100
-#ifdef RAGE128
-#define GEN_RESET_CNTL				0x00f0
-#	define SOFT_RESET_GUI			0x00000001
-#	define SOFT_RESET_VCLK			0x00000100
-#	define SOFT_RESET_PCLK			0x00000200
-#	define SOFT_RESET_ECP			0x00000400
-#	define SOFT_RESET_DISPENG_XCLK		0x00000800
-#	define SOFT_RESET_MEMCTLR_XCLK		0x00001000
-#endif
-#define	CONFIG_MEMSIZE				0x00F8
-#define	CONFIG_APER_0_BASE			0x0100
-#define	CONFIG_APER_1_BASE			0x0104
-#define	CONFIG_APER_SIZE			0x0108
-#define	CONFIG_REG_1_BASE			0x010C
-#define	CONFIG_REG_APER_SIZE			0x0110
-#define	PAD_AGPINPUT_DELAY			0x0164
-#define	PAD_CTLR_STRENGTH			0x0168
-#define	PAD_CTLR_UPDATE				0x016C
-#define	AGP_CNTL				0x0174
-#	define AGP_APER_SIZE_256MB		(0x00 << 0)
-#	define AGP_APER_SIZE_128MB		(0x20 << 0)
-#	define AGP_APER_SIZE_64MB		(0x30 << 0)
-#	define AGP_APER_SIZE_32MB		(0x38 << 0)
-#	define AGP_APER_SIZE_16MB		(0x3c << 0)
-#	define AGP_APER_SIZE_8MB		(0x3e << 0)
-#	define AGP_APER_SIZE_4MB		(0x3f << 0)
-#	define AGP_APER_SIZE_MASK		(0x3f << 0)
-#define	AMCGPIO_A_REG				0x01a0
-#define	AMCGPIO_EN_REG				0x01a8
-#define	AMCGPIO_MASK				0x0194
-#define	AMCGPIO_Y_REG				0x01a4
-/*#define	BM_STATUS				0x0160*/
-#define	MPP_TB_CONFIG				0x01c0 /* ? */
-#define	MPP_GP_CONFIG				0x01c8 /* ? */
-#define	VENDOR_ID				0x0F00
-#define	DEVICE_ID				0x0F02
-#define	COMMAND					0x0F04
-#define	STATUS					0x0F06
-#define	REVISION_ID				0x0F08
-#define	REGPROG_INF				0x0F09
-#define	SUB_CLASS				0x0F0A
-#define	CACHE_LINE				0x0F0C
-#define	LATENCY					0x0F0D
-#define	HEADER					0x0F0E
-#define	BIST					0x0F0F
-#define	REG_MEM_BASE				0x0F10
-#define	REG_IO_BASE				0x0F14
-#define	REG_REG_BASE				0x0F18
-#define	ADAPTER_ID				0x0F2C
-#define	BIOS_ROM				0x0F30
-#define	CAPABILITIES_PTR			0x0F34
-#define	INTERRUPT_LINE				0x0F3C
-#define	INTERRUPT_PIN				0x0F3D
-#define	MIN_GRANT				0x0F3E
-#define	MAX_LATENCY				0x0F3F
-#define	ADAPTER_ID_W				0x0F4C
-#define	PMI_CAP_ID				0x0F50
-#define	PMI_NXT_CAP_PTR				0x0F51
-#define	PMI_PMC_REG				0x0F52
[... 1969 lines omitted ...]
-#define	fld_DVS_ASYNC_RST_def			0x00000001
-
-/* Vendor IDs: */
-#define	fld_VIP_VENDOR_ID_def			0x00001002
-#define	fld_VIP_DEVICE_ID_def			0x00004d54
-#define	fld_VIP_REVISION_ID_def			0x00000001
-
-/* AGC Delay Register */
-#define	fld_BLACK_INT_START_def			0x00000031
-#define	fld_BLACK_INT_LENGTH_def		0x0000000f
-
-#define	fld_UV_INT_START_def			0x0000003b
-#define	fld_U_INT_LENGTH_def			0x0000000f
-#define	fld_V_INT_LENGTH_def			0x0000000f
-#define	fld_CRDR_ACTIVE_GAIN_def		0x0000007a
-#define	fld_CBDB_ACTIVE_GAIN_def		0x000000ac
-
-#define	fld_DVS_DIRECTION_def			0x00000000
-#define	fld_DVS_VBI_CARD8_SWAP_def		0x00000000
-#define	fld_DVS_CLK_SELECT_def			0x00000000
-#define	fld_CONTINUOUS_STREAM_def		0x00000000
-#define	fld_DVSOUT_CLK_DRV_def			0x00000001
-#define	fld_DVSOUT_DATA_DRV_def			0x00000001
-
-#define	fld_COMB_CNTL0_def			0x09438090
-#define	fld_COMB_CNTL1_def			0x00000010
-
-#define	fld_COMB_CNTL2_def			0x16161010
-#define	fld_COMB_LENGTH_def			0x0718038A
-
-#define	fld_SYNCTIP_REF0_def			0x00000037
-#define	fld_SYNCTIP_REF1_def			0x00000029
-#define	fld_CLAMP_REF_def			0x0000003B
-#define	fld_AGC_PEAKWHITE_def			0x000000FF
-#define	fld_VBI_PEAKWHITE_def			0x000000D2
-
-#define	fld_WPA_THRESHOLD_def			0x000003B0
-
-#define	fld_WPA_TRIGGER_LO_def			0x000000B4
-#define	fld_WPA_TRIGGER_HIGH_def		0x0000021C
-
-#define	fld_LOCKOUT_START_def			0x00000206
-#define	fld_LOCKOUT_END_def			0x00000021
-
-#define	fld_CH_DTO_INC_def			0x00400000
-#define	fld_PLL_SGAIN_def			0x00000001
-#define	fld_PLL_FGAIN_def			0x00000002
-
-#define	fld_CR_BURST_GAIN_def			0x0000007a
-#define	fld_CB_BURST_GAIN_def			0x000000ac
-
-#define	fld_VERT_LOCKOUT_START_def		0x00000207
-#define	fld_VERT_LOCKOUT_END_def		0x0000000E
-
-#define	fld_H_IN_WIND_START_def			0x00000070
-#define	fld_V_IN_WIND_START_def			0x00000027
-
-#define	fld_H_OUT_WIND_WIDTH_def		0x000002f4
-
-#define	fld_V_OUT_WIND_WIDTH_def		0x000000f0
-
-#define	fld_HS_LINE_TOTAL_def			0x0000038E
-
-#define	fld_MIN_PULSE_WIDTH_def			0x0000002F
-#define	fld_MAX_PULSE_WIDTH_def			0x00000046
-
-#define	fld_WIN_CLOSE_LIMIT_def			0x0000004D
-#define	fld_WIN_OPEN_LIMIT_def			0x000001B7
-
-#define	fld_VSYNC_INT_TRIGGER_def		0x000002AA
-
-#define	fld_VSYNC_INT_HOLD_def			0x0000001D
-
-#define	fld_VIN_M0_def				0x00000039
-#define	fld_VIN_N0_def				0x0000014c
-#define	fld_MNFLIP_EN_def			0x00000000
-#define	fld_VIN_P_def				0x00000006
-#define	fld_REG_CLK_SEL_def			0x00000000
-
-#define	fld_VIN_M1_def				0x00000000
-#define	fld_VIN_N1_def				0x00000000
-#define	fld_VIN_DRIVER_SEL_def			0x00000000
-#define	fld_VIN_MNFLIP_REQ_def			0x00000000
-#define	fld_VIN_MNFLIP_DONE_def			0x00000000
-#define	fld_TV_LOCK_TO_VIN_def			0x00000000
-#define	fld_TV_P_FOR_WINCLK_def			0x00000004
-
-#define	fld_VINRST_def				0x00000001
-#define	fld_VIN_CLK_SEL_def			0x00000000
-
-#define	fld_VS_FIELD_BLANK_START_def		0x00000206
-
-#define	fld_VS_FIELD_BLANK_END_def		0x0000000A
-
-/*#define fld_VS_FIELD_IDLOCATION_def		0x00000105 */
-#define	fld_VS_FIELD_IDLOCATION_def		0x00000001
-#define	fld_VS_FRAME_TOTAL_def			0x00000217
-
-#define	fld_SYNC_TIP_START_def			0x00000372
-#define	fld_SYNC_TIP_LENGTH_def			0x0000000F
-
-#define	fld_GAIN_FORCE_DATA_def			0x00000000
-#define	fld_GAIN_FORCE_EN_def			0x00000000
-#define	fld_I_CLAMP_SEL_def			0x00000003
-#define	fld_I_AGC_SEL_def			0x00000001
-#define	fld_EXT_CLAMP_CAP_def			0x00000001
-#define	fld_EXT_AGC_CAP_def			0x00000001
-#define	fld_DECI_DITHER_EN_def			0x00000001
-#define	fld_ADC_PREFHI_def			0x00000000
-#define	fld_ADC_CH_GAIN_SEL_def			0x00000001
-
-#define	fld_HS_PLL_SGAIN_def			0x00000003
-
-#define	fld_NREn_def				0x00000000
-#define	fld_NRGainCntl_def			0x00000000
-#define	fld_NRBWTresh_def			0x00000000
-#define	fld_NRGCTresh_def			0x00000000
-#define	fld_NRCoefDespeclMode_def		0x00000000
-
-#define	fld_GPIO_5_OE_def			0x00000000
-#define	fld_GPIO_6_OE_def			0x00000000
-
-#define	fld_GPIO_5_OUT_def			0x00000000
-#define	fld_GPIO_6_OUT_def			0x00000000
-
-/* End of field	default	values.	*/
-
-#endif	/* RADEON_H */
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/vidix/drivers/radeon_vid.c
--- a/src/video_out/vidix/drivers/radeon_vid.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3366 +0,0 @@
-/*
-   radeon_vid - VIDIX based video driver for Radeon and Rage128 chips
-   Copyrights 2002 Nick Kurshev. This file is based on sources from
-   GATOS (gatos.sf.net) and X11 (www.xfree86.org)
-   Licence: GPL
-*/
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include "bswap.h"
-#include "pci_ids.h"
-#include "pci_names.h"
-#include "vidix.h"
-#include "fourcc.h"
-#include "libdha.h"
-#include "radeon.h"
-
-#ifdef RAGE128
-#define RADEON_MSG "[rage128]"
-#define X_ADJUST 0
-#else
-#define RADEON_MSG "[radeon]"
-#define X_ADJUST (((besr.chip_flags&R_OVL_SHIFT)==R_OVL_SHIFT)?8:0)
-#ifndef RADEON
-#define RADEON
-#endif
-#endif
-
-#define RADEON_ASSERT(msg) printf(RADEON_MSG"################# FATAL:"msg);
-
-#ifdef RAGE128
-#define VIDIX_STATIC rage128_
-#else
-#define VIDIX_STATIC radeo_
-#endif
-
-//#undef RADEON_ENABLE_BM /* unfinished stuff. May corrupt your filesystem ever */
-#define RADEON_ENABLE_BM 1
-
-#ifdef RADEON_ENABLE_BM
-static void * radeon_dma_desc_base = 0;
-static unsigned long bus_addr_dma_desc = 0;
-static unsigned long *dma_phys_addrs = 0;
-#pragma pack(1)
-typedef struct
-{
-	uint32_t framebuf_offset;
-	uint32_t sys_addr;
-	uint32_t command;
-	uint32_t reserved;
-} bm_list_descriptor;
-#pragma pack()
-#endif
-
-#define VERBOSE_LEVEL 0
-static int __verbose = 0;
-typedef struct bes_registers_s
-{
-  /* base address of yuv framebuffer */
-  uint32_t yuv_base;
-  uint32_t fourcc;
-  uint32_t surf_id;
-  int load_prg_start;
-  int horz_pick_nearest;
-  int vert_pick_nearest;
-  int swap_uv; /* for direct support of bgr fourccs */
-  uint32_t dest_bpp;
-  /* YUV BES registers */
-  uint32_t reg_load_cntl;
-  uint32_t h_inc;
-  uint32_t step_by;
-  uint32_t y_x_start;
-  uint32_t y_x_end;
-  uint32_t v_inc;
-  uint32_t p1_blank_lines_at_top;
-  uint32_t p23_blank_lines_at_top;
-  uint32_t vid_buf_pitch0_value;
-  uint32_t vid_buf_pitch1_value;
-  uint32_t p1_x_start_end;
-  uint32_t p2_x_start_end;
-  uint32_t p3_x_start_end;
-  uint32_t base_addr;
-  uint32_t vid_buf_base_adrs_y[VID_PLAY_MAXFRAMES];
-  uint32_t vid_buf_base_adrs_u[VID_PLAY_MAXFRAMES];
-  uint32_t vid_buf_base_adrs_v[VID_PLAY_MAXFRAMES];
-  uint32_t vid_nbufs;
-
-  uint32_t p1_v_accum_init;
-  uint32_t p1_h_accum_init;
-  uint32_t p23_v_accum_init;
-  uint32_t p23_h_accum_init;
-  uint32_t scale_cntl;
-  uint32_t exclusive_horz;
-  uint32_t auto_flip_cntl;
-  uint32_t filter_cntl;
-  uint32_t four_tap_coeff[5];
-  uint32_t key_cntl;
-  uint32_t test;
-  /* Configurable stuff */
-  int double_buff;
-  
-  int brightness;
-  int saturation;
-  
-  uint32_t graphics_key_clr;
-  uint32_t graphics_key_msk;
-  uint32_t ckey_cntl;
-  
-  int deinterlace_on;
-  uint32_t deinterlace_pattern;
-  unsigned chip_flags;
-} bes_registers_t;
-
-typedef struct video_registers_s
-{
-  const char * sname;
-  uint32_t name;
-  uint32_t value;
[... 3114 lines omitted ...]
-		besr.graphics_key_clr=
-			  ((radeon_grkey.ckey.blue &0xF8)>>3)
-			| ((radeon_grkey.ckey.green&0xFC)<<3)
-			| ((radeon_grkey.ckey.red  &0xF8)<<8);
-#endif
-		break;
-	case 24:
-	case 32:
-		besr.graphics_key_clr=
-			  ((radeon_grkey.ckey.blue &0xFF))
-			| ((radeon_grkey.ckey.green&0xFF)<<8)
-			| ((radeon_grkey.ckey.red  &0xFF)<<16);
-		break;
-	default:
-		besr.graphics_key_msk=0;
-		besr.graphics_key_clr=0;
-	}
-#ifdef RAGE128
-	besr.graphics_key_msk=(1<<dbpp)-1;
-	besr.ckey_cntl = VIDEO_KEY_FN_TRUE|GRAPHIC_KEY_FN_NE|CMP_MIX_AND;
-#else
-	besr.graphics_key_msk=besr.graphics_key_clr;
-	besr.ckey_cntl = VIDEO_KEY_FN_TRUE|CMP_MIX_AND|GRAPHIC_KEY_FN_EQ;
-#endif
-    }
-    else
-    {
-	besr.graphics_key_msk=0;
-	besr.graphics_key_clr=0;
-	besr.ckey_cntl = VIDEO_KEY_FN_TRUE|GRAPHIC_KEY_FN_TRUE|CMP_MIX_AND;
-    }
-    radeon_fifo_wait(3);
-    OUTREG(OV0_GRAPHICS_KEY_MSK, besr.graphics_key_msk);
-    OUTREG(OV0_GRAPHICS_KEY_CLR, besr.graphics_key_clr);
-    OUTREG(OV0_KEY_CNTL,besr.ckey_cntl);
-}
-
-int VIDIX_NAME(vixGetGrKeys)(vidix_grkey_t *grkey)
-{
-    memcpy(grkey, &radeon_grkey, sizeof(vidix_grkey_t));
-    return(0);
-}
-
-int VIDIX_NAME(vixSetGrKeys)(const vidix_grkey_t *grkey)
-{
-    memcpy(&radeon_grkey, grkey, sizeof(vidix_grkey_t));
-    set_gr_key();
-    return(0);
-}
-
-#ifdef RADEON_ENABLE_BM
-static int radeon_setup_frame( vidix_dma_t * dmai )
-{
-    bm_list_descriptor * list = (bm_list_descriptor *)radeon_dma_desc_base;
-    unsigned long dest_ptr;
-    unsigned i,n,count;
-    int retval;
-    if(dmai->dest_offset + dmai->size > radeon_ram_size) return E2BIG;
-    n = dmai->size / 4096;
-    if(dmai->size % 4096) n++;
-    if((retval = bm_virt_to_bus(dmai->src,dmai->size,dma_phys_addrs)) != 0) return \
                retval;
-    dest_ptr = dmai->dest_offset;
-    count = dmai->size;
-    for(i=0;i<n;i++)
-    {
-	list[i].framebuf_offset = radeon_overlay_off + dest_ptr;
-	list[i].sys_addr = dma_phys_addrs[i]; 
-#ifdef RAGE128
-	list[i].command = (count > 4096 ? 4096 : count | BM_END_OF_LIST)|BM_FORCE_TO_PCI;
-#else
-	list[i].command = (count > 4096 ? 4096 : count | DMA_GUI_COMMAND__EOL);
-#endif
-	list[i].reserved = 0;
-printf("RADEON_DMA_TABLE[%i] %X %X %X \
                %X\n",i,list[i].framebuf_offset,list[i].sys_addr,list[i].command,list[i].reserved);
                
-	dest_ptr += 4096;
-	count -= 4096;
-    }
-    return 0;
-}
-
-static int radeon_transfer_frame( void	)
-{
-    unsigned i;
-    radeon_engine_idle();
-    for(i=0;i<1000;i++) INREG(BUS_CNTL); /* FlushWriteCombining */
-    OUTREG(BUS_CNTL,(INREG(BUS_CNTL) | BUS_STOP_REQ_DIS)&(~BUS_MASTER_DIS));
-#ifdef RAGE128
-    OUTREG(BM_CHUNK_0_VAL,0x000000FF | BM_GLOBAL_FORCE_TO_PCI);
-    OUTREG(BM_CHUNK_1_VAL,0x0F0F0F0F);
-    OUTREG(BM_VIP0_BUF,bus_addr_dma_desc|SYSTEM_TRIGGER_SYSTEM_TO_VIDEO);
-//    OUTREG(GEN_INT_STATUS,INREG(GEN_INT_STATUS)|0x00010000);
-#else
-    OUTREG(MC_FB_LOCATION,
-	    ((pci_info.base0>>16)&0xffff)|
-	    ((pci_info.base0+INREG(CONFIG_APER_SIZE)-1)&0xffff0000));
-    if((INREG(MC_AGP_LOCATION)&0xffff)!=
-      (((pci_info.base0+INREG(CONFIG_APER_SIZE))>>16)&0xffff))
-    /*Radeon memory controller is misconfigured*/
-	    return EINVAL;
-    OUTREG(DMA_VID_ACT_DSCRPTR,bus_addr_dma_desc);
-//    OUTREG(GEN_INT_STATUS,INREG(GEN_INT_STATUS)|(1<<30));
-#endif
-    OUTREG(GEN_INT_STATUS,INREG(GEN_INT_STATUS)|0x00010000);
-    return 0;
-}
-
-
-int VIDIX_NAME(vixPlaybackCopyFrame)( vidix_dma_t * dmai )
-{
-    int retval;
-    if(mlock(dmai->src,dmai->size) != 0) return errno;
-    retval = radeon_setup_frame(dmai);
-    if(retval == 0) retval = radeon_transfer_frame();
-    munlock(dmai->src,dmai->size);
-    return retval;
-}
-
-int VIDIX_NAME(vixQueryDMAStatus)( void )
-{
-    int bm_active;
-#if 1 //def RAGE128
-    bm_active=(INREG(GEN_INT_STATUS)&0x00010000)==0?1:0;
-#else
-    bm_active=(INREG(GEN_INT_STATUS)&(1<<30))==0?1:0;
-#endif
-    return bm_active?1:0;
-}
-#endif
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/vidix/drivers/savage_regs.h
--- a/src/video_out/vidix/drivers/savage_regs.h	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,304 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h,v 1.10 \
                2001/11/04 22:17:48 alanh Exp $ */
-
-#ifndef _SAVAGE_REGS_H
-#define _SAVAGE_REGS_H
-
-/* These are here until xf86PciInfo.h is updated. */
-
-#ifndef PCI_CHIP_S3TWISTER_P
-#define PCI_CHIP_S3TWISTER_P	0x8d01
-#endif
-#ifndef PCI_CHIP_S3TWISTER_K
-#define PCI_CHIP_S3TWISTER_K	0x8d02
-#endif
-#ifndef PCI_CHIP_SUPSAV_MX128
-#define PCI_CHIP_SUPSAV_MX128		0x8c22
-#define PCI_CHIP_SUPSAV_MX64		0x8c24
-#define PCI_CHIP_SUPSAV_MX64C		0x8c26
-#define PCI_CHIP_SUPSAV_IX128SDR	0x8c2a
-#define PCI_CHIP_SUPSAV_IX128DDR	0x8c2b
-#define PCI_CHIP_SUPSAV_IX64SDR		0x8c2c
-#define PCI_CHIP_SUPSAV_IX64DDR		0x8c2d
-#define PCI_CHIP_SUPSAV_IXCSDR		0x8c2e
-#define PCI_CHIP_SUPSAV_IXCDDR		0x8c2f
-#endif
-#ifndef PCI_CHIP_PROSAVAGE_DDR
-#define PCI_CHIP_PROSAVAGE_DDR	0x8d03
-#define PCI_CHIP_PROSAVAGE_DDRK	0x8d04
-#endif
-
-#define S3_SAVAGE3D_SERIES(chip)  ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE_MX))
-
-#define S3_SAVAGE4_SERIES(chip)   ((chip==S3_SAVAGE4) || (chip==S3_PROSAVAGE))
-
-#define	S3_SAVAGE_MOBILE_SERIES(chip)	((chip==S3_SAVAGE_MX) || \
                (chip==S3_SUPERSAVAGE))
-
-#define S3_SAVAGE_SERIES(chip)    ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE2000))
-
-
-/* Chip tags.  These are used to group the adapters into 
- * related families.
- */
-
-
-enum S3CHIPTAGS {
-    S3_UNKNOWN = 0,
-    S3_SAVAGE3D,
-    S3_SAVAGE_MX,
-    S3_SAVAGE4,
-    S3_PROSAVAGE,
-    S3_SUPERSAVAGE,
-    S3_SAVAGE2000,
-    S3_LAST
-};
-
-typedef struct {
-    unsigned int mode, refresh;
-    unsigned char SR08, SR0E, SR0F;
-    unsigned char SR10, SR11, SR12, SR13, SR15, SR18, SR1B, SR29, SR30;
-    unsigned char SR54[8];
-    unsigned char Clock;
-    unsigned char CR31, CR32, CR33, CR34, CR36, CR3A, CR3B, CR3C;
-    unsigned char CR40, CR41, CR42, CR43, CR45;
-    unsigned char CR50, CR51, CR53, CR55, CR58, CR5B, CR5D, CR5E;
-    unsigned char CR60, CR63, CR65, CR66, CR67, CR68, CR69, CR6D, CR6F;
-    unsigned char CR86, CR88;
-    unsigned char CR90, CR91, CRB0;
-    unsigned int  STREAMS[22];	/* yuck, streams regs */
-    unsigned int  MMPR0, MMPR1, MMPR2, MMPR3;
-} SavageRegRec, *SavageRegPtr;
-
-
-
-#define BIOS_BSIZE			1024
-#define BIOS_BASE			0xc0000
-
-#define SAVAGE_NEWMMIO_REGBASE_S3	0x1000000  /* 16MB */
-#define SAVAGE_NEWMMIO_REGBASE_S4	0x0000000 
-#define SAVAGE_NEWMMIO_REGSIZE		0x0080000	/* 512kb */
-#define SAVAGE_NEWMMIO_VGABASE		0x8000
-
-#define BASE_FREQ			14.31818	
-
-#define FIFO_CONTROL_REG		0x8200
-#define MIU_CONTROL_REG			0x8204
-#define STREAMS_TIMEOUT_REG		0x8208
-#define MISC_TIMEOUT_REG		0x820c
-
-/* Stream Processor 1 */
-
-/* Primary Stream 1 Frame Buffer Address 0 */
-#define PRI_STREAM_FBUF_ADDR0           0x81c0
-/* Primary Stream 1 Frame Buffer Address 0 */
-#define PRI_STREAM_FBUF_ADDR1           0x81c4
-/* Primary Stream 1 Stride */
-#define PRI_STREAM_STRIDE               0x81c8
-/* Primary Stream 1 Frame Buffer Size */
-#define PRI_STREAM_BUFFERSIZE           0x8214
-
-/* Secondary stream 1 Color/Chroma Key Control */
-#define SEC_STREAM_CKEY_LOW             0x8184
-/* Secondary stream 1 Chroma Key Upper Bound */
-#define SEC_STREAM_CKEY_UPPER           0x8194
-/* Blend Control of Secondary Stream 1 & 2 */
-#define BLEND_CONTROL                   0x8190
-/* Secondary Stream 1 Color conversion/Adjustment 1 */
-#define SEC_STREAM_COLOR_CONVERT1       0x8198
-/* Secondary Stream 1 Color conversion/Adjustment 2 */
-#define SEC_STREAM_COLOR_CONVERT2       0x819c
-/* Secondary Stream 1 Color conversion/Adjustment 3 */
-#define SEC_STREAM_COLOR_CONVERT3       0x81e4
-/* Secondary Stream 1 Horizontal Scaling */
-#define SEC_STREAM_HSCALING             0x81a0
-/* Secondary Stream 1 Frame Buffer Size */
-#define SEC_STREAM_BUFFERSIZE           0x81a8
-/* Secondary Stream 1 Horizontal Scaling Normalization (2K only) */
-#define SEC_STREAM_HSCALE_NORMALIZE	0x81ac
-/* Secondary Stream 1 Horizontal Scaling */
-#define SEC_STREAM_VSCALING             0x81e8
-/* Secondary Stream 1 Frame Buffer Address 0 */
-#define SEC_STREAM_FBUF_ADDR0           0x81d0
-/* Secondary Stream 1 Frame Buffer Address 1 */
-#define SEC_STREAM_FBUF_ADDR1           0x81d4
-/* Secondary Stream 1 Frame Buffer Address 2 */
-#define SEC_STREAM_FBUF_ADDR2           0x81ec
[... 52 lines omitted ...]
-#define SEC_STREAM2_OPAQUE_OVERLAY      0x8180
-
-
-/* savage 2000 */
-#define SEC_STREAM_COLOR_CONVERT0_2000       0x8198
-#define SEC_STREAM_COLOR_CONVERT1_2000       0x819c
-#define SEC_STREAM_COLOR_CONVERT2_2000       0x81e0
-#define SEC_STREAM_COLOR_CONVERT3_2000       0x81e4
-
-#define SUBSYS_STAT_REG			0x8504
-
-#define SRC_BASE			0xa4d4
-#define DEST_BASE			0xa4d8
-#define CLIP_L_R			0xa4dc
-#define CLIP_T_B			0xa4e0
-#define DEST_SRC_STR			0xa4e4
-#define MONO_PAT_0			0xa4e8
-#define MONO_PAT_1			0xa4ec
-
-/* Constants for CR69. */
-
-#define CRT_ACTIVE	0x01
-#define LCD_ACTIVE	0x02
-#define TV_ACTIVE	0x04
-#define CRT_ATTACHED	0x10
-#define LCD_ATTACHED	0x20
-#define TV_ATTACHED	0x40
-
-
-/*
- * reads from SUBSYS_STAT
- */
-#define STATUS_WORD0            (INREG(0x48C00))
-#define ALT_STATUS_WORD0        (INREG(0x48C60))
-#define MAXLOOP			0xffffff
-#define IN_SUBSYS_STAT()	(INREG(SUBSYS_STAT_REG))
-
-#define MAXFIFO		0x7f00
-
-/*
- * NOTE: don't remove 'VGAIN8(vgaCRIndex);'.
- * If not present it will cause lockups on Savage4.
- * Ask S3, why.
- */
-/*#define VerticalRetraceWait() \
-{ \
-        VGAIN8(0x3d0+4); \
-	VGAOUT8(0x3d0+4, 0x17); \
-	if (VGAIN8(0x3d0+5) & 0x80) { \
-		while ((VGAIN8(0x3d0 + 0x0a) & 0x08) == 0x08) ; \
-		while ((VGAIN8(0x3d0 + 0x0a) & 0x08) == 0x00) ; \
-	} \
-}
-*/
-
-#define VerticalRetraceWait()           \
-do {                                    \
-	VGAIN8(0x3d4);            \
-	VGAOUT8(0x3d4, 0x17);     \
-	if (VGAIN8(0x3d5) & 0x80) {  \
-		int i = 0x10000;                \
-		while ((VGAIN8(0x3da) & 0x08) == 0x08 && i--) ; \
-		i = 0x10000;                                                  \
-		while ((VGAIN8(0x3da) & 0x08) == 0x00 && i--) ; \
-	} \
-} while (0)
-
-
-#define	I2C_REG		0xa0
-#define InI2CREG(a)	\
-{ \
-    VGAOUT8(0x3d0 + 4, I2C_REG);	\
-    a = VGAIN8(0x3d0 + 5);		\
-}
-
-#define OutI2CREG(a)	\
-{ \
-    VGAOUT8(0x3d0 + 4, I2C_REG);	\
-    VGAOUT8(0x3d0 + 5, a);		\
-}
- 
-#define HZEXP_COMP_1		0x54
-#define HZEXP_BORDER		0x58
-#define HZEXP_FACTOR_IGA1	0x59
-
-#define VTEXP_COMP_1		0x56
-#define VTEXP_BORDER		0x5a
-#define VTEXP_FACTOR_IGA1	0x5b
-
-#define EC1_CENTER_ON	0x10
-#define EC1_EXPAND_ON	0x0c
-
-#define MODE_24 24
-
-#if (MODE_24 == 32)
-# define  BYTES_PP24 4
-#else
-# define BYTES_PP24 3
-#endif
-
-#define OVERLAY_DEPTH 16
-
-#define  STREAMS_MODE32 0x7
-#define  STREAMS_MODE24 0x6
-#define  STREAMS_MODE16 0x5 /* @@@ */
-
-
-#define DEPTH_BPP(depth) (depth == 24 ? (BYTES_PP24 << 3) : (depth + 7) & ~0x7)
-#define DEPTH_2ND(depth) (depth > 8 ? depth\
-                              : OVERLAY_DEPTH)
-#define SSTREAMS_MODE(bpp) (bpp > 16 ? (bpp > 24 ? STREAMS_MODE32 :\
-				       STREAMS_MODE24) : STREAMS_MODE16)
-
-#define HSCALING_Shift    0
-#define HSCALING_Mask     (((1L << 16)-1) << HSCALING_Shift)
-#define HSCALING(w0,w1)   ((((unsigned int)(((double)w0/(double)w1) * (1 << 15))) \
-                               << HSCALING_Shift) \
-                           & HSCALING_Mask)
-                                                                                     \
                
-#define VSCALING_Shift    0
-#define VSCALING_Mask     (((1L << 20)-1) << VSCALING_Shift)
-#define VSCALING(h0,h1)   ((((unsigned int) (((double)h0/(double)h1) * (1 << 15))) \
-                               << VSCALING_Shift) \
-                           & VSCALING_Mask)
-
-
-#endif /* _SAVAGE_REGS_H */
-
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/vidix/drivers/savage_vid.c
--- a/src/video_out/vidix/drivers/savage_vid.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1472 +0,0 @@
-/*
-    Driver for S3 Savage Series
-
-    Copyright (C) 2004 by Reza Jelveh
-
-    Based on the X11 driver and nvidia vid 
-
-    Thanks to Alex Deucher for Support
-
-    This program 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.
-
-    This program 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 this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-    Changes:
-    2004-11-09
-      Initial version
-
-    To Do:
-			
-*/
-
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <unistd.h>
-#include <math.h>
-
-#include "vidix.h"
-#include "fourcc.h"
-#include "libdha.h"
-#include "pci_ids.h"
-#include "pci_names.h"
-
-#include "savage_regs.h"
-
-
-#define VF_STREAMS_ON   0x0001
-#define BASE_PAD 0xf
-#define FRAMEBUFFER_SIZE 1024*2000*4
-/**************************************
-   S3 streams processor
-**************************************/
-
-#define EXT_MISC_CTRL2              0x67
-
-/* New streams */
-
-/* CR67[2] = 1 : enable stream 1 */
-#define ENABLE_STREAM1              0x04
-/* CR67[1] = 1 : enable stream 2 */
-#define ENABLE_STREAM2              0x02
-/* mask to clear CR67[2,1] */
-#define NO_STREAMS                  0xF9
-/* CR67[3] = 1 : Mem-mapped regs */
-#define USE_MM_FOR_PRI_STREAM       0x08
-
-#define HDM_SHIFT	16
-#define HDSCALE_4	(2 << HDM_SHIFT)
-#define HDSCALE_8	(3 << HDM_SHIFT)
-#define HDSCALE_16	(4 << HDM_SHIFT)
-#define HDSCALE_32	(5 << HDM_SHIFT)
-#define HDSCALE_64	(6 << HDM_SHIFT)
-
-/* Old Streams */
-
-#define ENABLE_STREAMS_OLD	    0x0c
-#define NO_STREAMS_OLD		    0xf3
-/* CR69[0] = 1 : Mem-mapped regs */
-#define USE_MM_FOR_PRI_STREAM_OLD   0x01
-
-static void SavageStreamsOn(void);
-
-/*
- * There are two different streams engines used in the Savage line.
- * The old engine is in the 3D, 4, Pro, and Twister.
- * The new engine is in the 2000, MX, IX, and Super.
- */
-
-
-/* streams registers for old engine */
-#define PSTREAM_CONTROL_REG		0x8180
-#define COL_CHROMA_KEY_CONTROL_REG	0x8184
-#define SSTREAM_CONTROL_REG		0x8190
-#define CHROMA_KEY_UPPER_BOUND_REG	0x8194
-#define SSTREAM_STRETCH_REG		0x8198
-#define COLOR_ADJUSTMENT_REG		0x819C
-#define BLEND_CONTROL_REG		0x81A0
-#define PSTREAM_FBADDR0_REG		0x81C0
-#define PSTREAM_FBADDR1_REG		0x81C4
-#define PSTREAM_STRIDE_REG		0x81C8
-#define DOUBLE_BUFFER_REG		0x81CC
-#define SSTREAM_FBADDR0_REG		0x81D0
-#define SSTREAM_FBADDR1_REG		0x81D4
-#define SSTREAM_STRIDE_REG		0x81D8
-#define SSTREAM_VSCALE_REG		0x81E0
-#define SSTREAM_VINITIAL_REG		0x81E4
-#define SSTREAM_LINES_REG		0x81E8
-#define STREAMS_FIFO_REG		0x81EC
-#define PSTREAM_WINDOW_START_REG	0x81F0
-#define PSTREAM_WINDOW_SIZE_REG		0x81F4
-#define SSTREAM_WINDOW_START_REG	0x81F8
-#define SSTREAM_WINDOW_SIZE_REG		0x81FC
-#define FIFO_CONTROL			0x8200
-#define PSTREAM_FBSIZE_REG		0x8300
-#define SSTREAM_FBSIZE_REG		0x8304
-#define SSTREAM_FBADDR2_REG		0x8308
-
-#define OS_XY(x,y)	(((x+1)<<16)|(y+1))
-#define OS_WH(x,y)	(((x-1)<<16)|(y))
-
-#define PCI_COMMAND_MEM 0x2
[... 1220 lines omitted ...]
-//  info->vidixcolorkey=0x0;
-
-//  OUTREG( SSTREAM_WINDOW_START_REG, OS_XY(0xfffe, 0xfffe) );
-//  SavageSetColorKeyOld();
-//FIXME ADD
-  return 0;
-}
-
-/**
- * @brief Driver should prepare and activate corresponded frame.
- *
- * @param frame the frame index.
- *
- * @return 0.
- *
- * @note This function is used only for double and triple buffering
- *       and never used for single buffering playback.
- */
-#if 0
-int
-vixPlaybackFrameSelect (unsigned int frame)
-{
-////FIXME ADD
-//    savage_overlay_start(info, frame);
-    //if (info->num_frames >= 1)
-//	    info->cur_frame = frame//(frame+1)%info->num_frames;
-//
-//	savage4_waitidle(info); 
- 	
-   printf("vixPlaybackFrameSelect Leave\n" );
-	 // FIXME: does this work to avoid tearing?
-//   VerticalRetraceWait();
-   
-  return 0;
-}
-
-#endif 
-
-
-
-void debugout(unsigned int addr, unsigned int val){
-	return ;
-    switch ( addr ){
-	case PSTREAM_CONTROL_REG:
-	    fprintf(stderr,"PSTREAM_CONTROL_REG");
-	    break;
-	case COL_CHROMA_KEY_CONTROL_REG:
-	    fprintf(stderr,"COL_CHROMA_KEY_CONTROL_REG");
-	    break;
-	case SSTREAM_CONTROL_REG:
-	    fprintf(stderr,"SSTREAM_CONTROL_REG");
-	    break;
-	case CHROMA_KEY_UPPER_BOUND_REG:
-	    fprintf(stderr,"CHROMA_KEY_UPPER_BOUND_REG");
-	    break;
-	case SSTREAM_STRETCH_REG:
-	    fprintf(stderr,"SSTREAM_STRETCH_REG");
-	    break;
-	case COLOR_ADJUSTMENT_REG:
-	    fprintf(stderr,"COLOR_ADJUSTMENT_REG");
-	    break;
-	case BLEND_CONTROL_REG:
-	    fprintf(stderr,"BLEND_CONTROL_REG");
-	    break;
-	case PSTREAM_FBADDR0_REG:
-	    fprintf(stderr,"PSTREAM_FBADDR0_REG");
-	    break;
-	case PSTREAM_FBADDR1_REG:
-	    fprintf(stderr,"PSTREAM_FBADDR1_REG");
-	    break;
-	case PSTREAM_STRIDE_REG:
-	    fprintf(stderr,"PSTREAM_STRIDE_REG");
-	    break;
-	case DOUBLE_BUFFER_REG:
-	    fprintf(stderr,"DOUBLE_BUFFER_REG");
-	    break;
-	case SSTREAM_FBADDR0_REG:
-	    fprintf(stderr,"SSTREAM_FBADDR0_REG");
-	    break;
-	case SSTREAM_FBADDR1_REG:
-	    fprintf(stderr,"SSTREAM_FBADDR1_REG");
-	    break;
-	case SSTREAM_STRIDE_REG:
-	    fprintf(stderr,"SSTREAM_STRIDE_REG");
-	    break;
-	case SSTREAM_VSCALE_REG:
-	    fprintf(stderr,"SSTREAM_VSCALE_REG");
-	    break;
-	case SSTREAM_VINITIAL_REG:
-	    fprintf(stderr,"SSTREAM_VINITIAL_REG");
-	    break;
-	case SSTREAM_LINES_REG:
-	    fprintf(stderr,"SSTREAM_LINES_REG");
-	    break;
-	case STREAMS_FIFO_REG:
-	    fprintf(stderr,"STREAMS_FIFO_REG");
-	    break;
-	case PSTREAM_WINDOW_START_REG:
-	    fprintf(stderr,"PSTREAM_WINDOW_START_REG");
-	    break;
-	case PSTREAM_WINDOW_SIZE_REG:
-	    fprintf(stderr,"PSTREAM_WINDOW_SIZE_REG");
-	    break;
-	case SSTREAM_WINDOW_START_REG:
-	    fprintf(stderr,"SSTREAM_WINDOW_START_REG");
-	    break;
-	case SSTREAM_WINDOW_SIZE_REG:
-	    fprintf(stderr,"SSTREAM_WINDOW_SIZE_REG");
-	    break;
-	case FIFO_CONTROL:
-	    fprintf(stderr,"FIFO_CONTROL");
-	    break;
-	case PSTREAM_FBSIZE_REG:
-	    fprintf(stderr,"PSTREAM_FBSIZE_REG");
-	    break;
-	case SSTREAM_FBSIZE_REG:
-	    fprintf(stderr,"SSTREAM_FBSIZE_REG");
-	    break;
-	case SSTREAM_FBADDR2_REG:
-	    fprintf(stderr,"SSTREAM_FBADDR2_REG");
-	    break;
-
-    }
-    fprintf(stderr,":\t\t 0x%08X = %u\n",val,val);
-}
-
-
-
diff -r 3e9d711a77870cbbca8db3bca3dcacad6092064f -r \
                df73844e8a47005bef76ffe6cd9323d8e6a1c218 \
                src/video_out/vidix/drivers/sis_bridge.c
--- a/src/video_out/vidix/drivers/sis_bridge.c	Thu Jun 21 23:27:37 2007 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,835 +0,0 @@
-/**
-    Video bridge detection for SiS 300 and 310/325 series chips.
-
-    Copyright 2003 Jake Page, Sugar Media.
-
-    Based on SiS Xv driver:
-    Copyright 2002-2003 by Thomas Winischhofer, Vienna, Austria.
-
-    This program 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.
-
-    This program 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 this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-**/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "libdha.h"
-
-#include "sis_regs.h"
-#include "sis_defs.h"
-
-void sis_init_video_bridge(void);
-
-static void sis_ddc2_delay(unsigned short delaytime)
-{
-    unsigned short i;
-    int temp;
-
-    for (i = 0; i < delaytime; i++) {
-	inSISIDXREG(SISSR, 0x05, temp);
-    }
-}
-
-
-static int sis_do_sense(int tempbl, int tempbh, int tempcl, int tempch)
-{
-    int temp;
-
-    outSISIDXREG(SISPART4, 0x11, tempbl);
-    temp = tempbh | tempcl;
-    setSISIDXREG(SISPART4, 0x10, 0xe0, temp);
-    //usleep(200000);
-    sis_ddc2_delay(0x1000);
-    tempch &= 0x7f;
-    inSISIDXREG(SISPART4, 0x03, temp);
-    temp ^= 0x0e;
-    temp &= tempch;
-    return (temp == tempch);
-}
-
-
-/* sense connected devices on 30x bridge */
-static void sis_sense_30x()
-{
-    unsigned char backupP4_0d, backupP2_00, biosflag;
-    unsigned char testsvhs_tempbl, testsvhs_tempbh;
-    unsigned char testsvhs_tempcl, testsvhs_tempch;
-    unsigned char testcvbs_tempbl, testcvbs_tempbh;
-    unsigned char testcvbs_tempcl, testcvbs_tempch;
-    unsigned char testvga2_tempbl, testvga2_tempbh;
-    unsigned char testvga2_tempcl, testvga2_tempch;
-    int myflag, result = 0, i, j, haveresult;
-#if 0
-    unsigned short temp;
-#endif
-
-    inSISIDXREG(SISPART4, 0x0d, backupP4_0d);
-    outSISIDXREG(SISPART4, 0x0d, (backupP4_0d | 0x04));
-
-    inSISIDXREG(SISPART2, 0x00, backupP2_00);
-    outSISIDXREG(SISPART2, 0x00, (backupP2_00 | 0x1c));
-
-    sis_do_sense(0, 0, 0, 0);
-
-    if ((sis_vga_engine == SIS_315_VGA) ||
-	(sis_device_id == DEVICE_SIS_300)) {
-#if 0
-	if (0 /*pSiS->sishw_ext.UseROM */ ) {
-	    if (sis_vga_engine == SIS_300_VGA)
-		temp = 0xfe;
-	    else {
-		temp = 0xf3;
-		if (sis_device_id == DEVICE_SIS_330)
-		    temp = 0x11b;
-	    }
-	    if (pSiS->BIOS[temp] & 0x08) {
-		if (sis_verbose > 1) {
-		    printf
-			("[SiS] SiS30x: Video bridge has DVI-I TMDS/VGA combo connector\n");
-		}
-		orSISIDXREG(SISCR, 0x32, 0x80);
-	    } else {
-		andSISIDXREG(SISCR, 0x32, 0x7f);
-	    }
-	}
-#endif
-    }
-
-    if (sis_vga_engine == SIS_300_VGA) {
-	if (0 /*pSiS->sishw_ext.UseROM */ ) {
-#if 0
-	    testvga2_tempbh = pSiS->BIOS[0xf9];
-	    testvga2_tempbl = pSiS->BIOS[0xf8];
-	    testsvhs_tempbh = pSiS->BIOS[0xfb];
-	    testsvhs_tempbl = pSiS->BIOS[0xfa];
-	    testcvbs_tempbh = pSiS->BIOS[0xfd];
-	    testcvbs_tempbl = pSiS->BIOS[0xfc];
-	    biosflag = pSiS->BIOS[0xfe];
-#endif
-	} else {
-	    testvga2_tempbh = 0x00;
-	    testvga2_tempbl = 0xd1;
[... 583 lines omitted ...]
-	    if (sis_vbflags & VB_USELCDA) {
-		/* printf("Bridge uses LCDA for low resolution and text modes\n"); */
-	    }
-	}
-    }
-
-
-}
-
-
-/* detect video bridge type and sense connected devices */
-void sis_init_video_bridge()
-{
-
-    sis_detect_video_bridge();
-
-    sis_detect_crt1();
-    //sis_detect_lcd(); /* not fully ready probably */
-    sis_detect_tv();
-    sis_detect_crt2();
-
-    sis_detected_crt2_devices =
-	sis_vbflags & (CRT2_LCD | CRT2_TV | CRT2_VGA);
-
-    // force crt2 type
-    if (sis_force_crt2_type == CRT2_DEFAULT) {
-	if (sis_vbflags & CRT2_VGA)
-	    sis_force_crt2_type = CRT2_VGA;
-	else if (sis_vbflags & CRT2_LCD)
-	    sis_force_crt2_type = CRT2_LCD;
-	else if (sis_vbflags & CRT2_TV)
-	    sis_force_crt2_type = CRT2_TV;
-    }
-
-    switch (sis_force_crt2_type) {
-    case CRT2_TV:
-	sis_vbflags = sis_vbflags & ~(CRT2_LCD | CRT2_VGA);
-	if (sis_vbflags & VB_VIDEOBRIDGE)
-	    sis_vbflags = sis_vbflags | CRT2_TV;
-	else
-	    sis_vbflags = sis_vbflags & ~(CRT2_TV);
-	break;
-    case CRT2_LCD:
-	sis_vbflags = sis_vbflags & ~(CRT2_TV | CRT2_VGA);
-	if ((sis_vbflags & VB_VIDEOBRIDGE) /* XXX: && (pSiS->VBLCDFlags) */
-	    )
-	    sis_vbflags = sis_vbflags | CRT2_LCD;
-	else {
-	    sis_vbflags = sis_vbflags & ~(CRT2_LCD);
-	    if (sis_verbose > 0) {
-		printf
-		    ("[SiS] Can't force CRT2 to LCD, no panel detected\n");
-	    }
-	}
-	break;
-    case CRT2_VGA:
-	if (sis_vbflags & VB_LVDS) {
-	    if (sis_verbose > 0) {
-		printf("[SiS] LVDS does not support secondary VGA\n");
-	    }
-	    break;
-	}
-	if (sis_vbflags & (VB_301LV | VB_302LV)) {
-	    if (sis_verbose > 0) {
-		printf
-		    ("[SiS] SiS30xLV bridge does not support secondary VGA\n");
-	    }
-	    break;
-	}
-	sis_vbflags = sis_vbflags & ~(CRT2_TV | CRT2_LCD);
-	if (sis_vbflags & VB_VIDEOBRIDGE)
-	    sis_vbflags = sis_vbflags | CRT2_VGA;
-	else
-	    sis_vbflags = sis_vbflags & ~(CRT2_VGA);
-	break;
-    default:
-	sis_vbflags &= ~(CRT2_TV | CRT2_LCD | CRT2_VGA);
-    }
-
-    /* CRT2 gamma correction?? */
-
-    /* other force modes: */
-    /*  have a 'force tv type' (svideo, composite, scart) option? */
-    /*  have a 'force crt1 type' (to turn it off, etc??) */
-
-    /* TW: Check if CRT1 used (or needed; this eg. if no CRT2 detected) */
-    if (sis_vbflags & VB_VIDEOBRIDGE) {
-
-	/* TW: No CRT2 output? Then we NEED CRT1!
-	 *     We also need CRT1 if depth = 8 and bridge=LVDS|630+301B
-	 */
-	if ((!(sis_vbflags & (CRT2_VGA | CRT2_LCD | CRT2_TV))) || (	/*(pScrn->bitsPerPixel \
                == 8) && */
-								      ((sis_vbflags & (VB_LVDS | VB_CHRONTEL)) || ((sis_vga_engine == \
                SIS_300_VGA) && (sis_vbflags & VB_301B))))) {
-	    sis_crt1_off = 0;
-	}
-	/* TW: No CRT2 output? Then we can't use hw overlay on CRT2 */
-	if (!(sis_vbflags & (CRT2_VGA | CRT2_LCD | CRT2_TV)))
-	    sis_overlay_on_crt1 = 1;
-
-    } else {			/* TW: no video bridge? */
-
-	/* Then we NEED CRT1... */
-	sis_crt1_off = 0;
-	/* ... and can't use CRT2 for overlay output */
-	sis_overlay_on_crt1 = 1;
-    }
-
-    /* tvstandard options ? */
-
-    // determine using CRT1 or CRT2?
-    /* -> NO dualhead right now... */
-    if (sis_vbflags & DISPTYPE_DISP2) {
-	if (sis_crt1_off) {
-	    sis_vbflags |= VB_DISPMODE_SINGLE;
-	    /* TW: No CRT1? Then we use the video overlay on CRT2 */
-	    sis_overlay_on_crt1 = 0;
-	} else			/* TW: CRT1 and CRT2 - mirror or dual head ----- */
-	    sis_vbflags |= (VB_DISPMODE_MIRROR | DISPTYPE_CRT1);
-    } else {			/* TW: CRT1 only ------------------------------- */
-	sis_vbflags |= (VB_DISPMODE_SINGLE | DISPTYPE_CRT1);
-    }
-
-    if (sis_verbose > 0) {
-	printf("[SiS] Using hardware overlay on CRT%d\n",
-	       sis_overlay_on_crt1 ? 1 : 2);
-    }
-
-}



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

_______________________________________________
Xine-cvslog mailing list
Xine-cvslog@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xine-cvslog


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic