summaryrefslogtreecommitdiff
path: root/xc/programs/Xserver/hw/xfree86
diff options
context:
space:
mode:
authordawes <dawes>2000-11-08 00:06:24 +0000
committerdawes <dawes>2000-11-08 00:06:24 +0000
commitbc9d002299a38f40073b455ab00a382510a82485 (patch)
tree992568d20d107747e284c8a4763e2193153daecc /xc/programs/Xserver/hw/xfree86
parent38b17cc33454f7fb15124f3d6662db17742608b1 (diff)
merge with 4.0.1dX_4_0_1d-20001107-merge
Diffstat (limited to 'xc/programs/Xserver/hw/xfree86')
-rw-r--r--xc/programs/Xserver/hw/xfree86/OS_cygwin.c221
-rw-r--r--xc/programs/Xserver/hw/xfree86/XF86Config.cpp5
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Config.c89
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86Debug.c2
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h11
-rw-r--r--xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c168
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml2
-rw-r--r--xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c7
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.c119
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h3
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h32
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c67
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm398
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glint/glint.cpp14
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h11
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c20
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c1795
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c199
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h24
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h16
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c13
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h1
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/imstt/Imakefile4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h14
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c48
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c70
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c205
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c344
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c7
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_warp.c6
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_dga.c78
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.cpp66
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/Imakefile68
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/ati2.h49
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/ati2_probe.c313
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/r128.h56
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/r128_accel.c437
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/r128_cursor.c33
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/r128_dga.c31
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/r128_dri.c526
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/r128_driver.c489
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/r128_probe.h42
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/r128_reg.h122
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/r128_sarea.h2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/radeon.h411
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_accel.c981
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_cursor.c267
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_dga.c368
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_driver.c2921
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_probe.h42
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_reg.h1477
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/init300.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c13
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dga.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h6
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c10
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h2
-rw-r--r--xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c389
-rw-r--r--xc/programs/Xserver/hw/xfree86/loader/xf86sym.c86
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile7
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile4
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/bus/linuxSbus.c6
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile6
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux6
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h11
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h9
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c1
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/picker.c1
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h6
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h2
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c5
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c2
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c6
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c18
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c13
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h11
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c6
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c15
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h6
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h2
-rw-r--r--xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c20
-rw-r--r--xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c272
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile31
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad66
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c28
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c99
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/config.c27
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/config.h4
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/help.c14
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c118
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c30
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c8
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c32
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/options.c117
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/options.h9
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c124
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c27
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c49
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c78
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.h70
111 files changed, 10610 insertions, 3696 deletions
diff --git a/xc/programs/Xserver/hw/xfree86/OS_cygwin.c b/xc/programs/Xserver/hw/xfree86/OS_cygwin.c
deleted file mode 100644
index 997815e8b..000000000
--- a/xc/programs/Xserver/hw/xfree86/OS_cygwin.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * (c) Copyright 1998,1999 by Sebastien Marineau <sebastien@qnx.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * OREST ZBOROWSKI BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of Orest Zborowski shall not be
- * used in advertising or otherwise to promote the sale, use or other dealings
- * in this Software without prior written authorization from Orest Zborowski.
- *
- * $XFree86: xc/programs/Xserver/hw/xfree86/OS_cygwin.c,v 3.1 2000/08/10 17:40:32 dawes Exp $
- */
-
-#include "Probe.h"
-
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <windows.h>
-#include <sys/mman.h>
-#include <sys/cygwin.h>
-
-static int VT_fd = -1;
-static int BIOS_fd = -1;
-
-/*
- * OpenVideo --
- *
- * Enable access to the installed video hardware.
- */
-int OpenVideo()
-{
- int fd;
- char fn[20];
-
- if (geteuid() != 0) {
- fprintf(stderr, "%s: Must be run as root\n", MyName);
- return(-1);
- }
-
- if ((fd = open("/dev/conin", O_WRONLY, 0)) < 0) {
- fprintf(stderr, "%s: Cannot open /dev/conin\n", MyName);
- return(-1);
- }
-
- return fd;
-}
-
-/*
- * CloseVideo --
- *
- * Disable access to the video hardware.
- */
-void CloseVideo()
-{
- int fd;
-
- if (VT_fd > 0) {
- close(VT_fd);
- }
-}
-
-/*
- * MapVGA --
- *
- * Map the VGA memory window (0xA0000-0xAFFFF) as read/write memory for
- * the process for use in probing memory.
- */
-Byte *MapVGA()
-{
- return( MapMem(0xA0000,0x10000) );
-}
-
-Byte *MapMem(address, size)
- unsigned long address;
- unsigned long size;
-{
- int fd;
- Byte *base;
-
- if ((fd = open("/dev/zero", O_RDWR)) < 0) {
- fprintf(stderr, "%s: Failed to open /dev/zero\n", MyName);
- return((Byte *)0);
- }
-
- base = (Byte *)mmap((void *)0, size, PROT_READ|PROT_WRITE,
- MAP_SHARED, fd, (off_t)address);
- close(fd);
-
- if ((long)base == -1) {
- fprintf(stderr, "%s: Failed to mmap framebuffer\n", MyName);
- return((Byte *)0);
- }
-
- return base;
-}
-
-/*
- * UnMapVGA --
- *
- * Unmap the VGA memory window.
- */
-void UnMapVGA(base)
- Byte *base;
-{
- UnMapMem(base,0x10000);
- return;
-}
-
-void UnMapMem(base,size)
- Byte *base;
- unsigned long size;
-{
- munmap((void *)base, size);
- return;
-}
-
-/*
- * ReadBIOS --
- *
- * Read 'Len' bytes from the video BIOS at address 'Bios_Base'+'Offset' into
- * buffer 'Buffer'.
- */
-int ReadBIOS(Offset, Buffer, Len)
-unsigned Offset;
-Byte *Buffer;
-int Len;
-{
- Word tmp;
- Byte *Base = Bios_Base + Offset;
- Byte *mybase;
- off_t myoffset;
- int mysize;
-
- if (BIOS_fd == -1) {
- if ((BIOS_fd = open("/dev/mem", O_RDONLY, 0)) < 0) {
- fprintf(stderr, "%s: cannot open /dev/mem\n", MyName);
- return(-1);
- }
- }
-
- if ((off_t)((off_t)Base & 0x7FFF) != (off_t)0) {
- /*
- * Sanity check...
- */
- (void)lseek(BIOS_fd, (off_t)((off_t)Base & 0xF8000), SEEK_SET);
- (void)read(BIOS_fd, &tmp, 2);
- if (tmp != (Word)0xAA55) {
- fprintf(stderr, "%s: BIOS sanity check failed, addr=%x\n",
- MyName, (int)Base);
- return(-1);
- }
- }
-
- if (lseek(BIOS_fd, (off_t)Base, SEEK_SET) < 0) {
- fprintf(stderr, "%s: BIOS seek failed\n", MyName);
- return(-1);
- }
-
- if (read(BIOS_fd, Buffer, Len) != Len) {
- fprintf(stderr, "%s: BIOS read failed\n", MyName);
- return(-1);
- }
-
- return Len;
-}
-
-/*
- * EnableIOPort --
- *
- * Enable access to 'NumPorts' IO ports listed in array 'Ports'.
- */
-
-/*ARGSUSED*/
-int EnableIOPorts(NumPorts, Ports)
-CONST int NumPorts;
-CONST Word *Ports;
-{
- return(0);
-}
-
-/*
- * DisableIOPort --
- *
- * Disable access to 'NumPorts' IO ports listed in array 'Ports'.
- */
-
-/*ARGSUSED*/
-int DisableIOPorts(NumPorts, Port)
-CONST int NumPorts;
-CONST Word *Port;
-{
- return(0);
-}
-
-/*
- * ShortSleep --
- *
- * Sleep for the number of milliseconds specified in 'Delay'.
- */
-void ShortSleep(Delay)
-int Delay;
-{
- usleep(Delay * 1000);
-}
diff --git a/xc/programs/Xserver/hw/xfree86/XF86Config.cpp b/xc/programs/Xserver/hw/xfree86/XF86Config.cpp
index 96597ff11..47f084a5c 100644
--- a/xc/programs/Xserver/hw/xfree86/XF86Config.cpp
+++ b/xc/programs/Xserver/hw/xfree86/XF86Config.cpp
@@ -1,4 +1,4 @@
-.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Config.cpp,v 1.10 2000/06/20 05:08:42 dawes Exp $
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Config.cpp,v 1.11 2000/10/24 18:07:49 dawes Exp $
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
.TH XF86Config __filemansuffix__ "Version 4.0.1" "XFree86"
@@ -516,6 +516,9 @@ This option affects the way that bus resource sizes are estimated. Default: 0.
.BI "Option \*qNoPM\*q \*q" boolean \*q
Disables something to do with power management events. Default: PM enabled
on platforms that support it.
+.TP 7
+.BI "Option \*qXinerama\*q \*q" boolean \*q
+enable or disable XINERAMA extension. Default is disabled.
.SH MODULE SECTION
The
.B Module
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Config.c b/xc/programs/Xserver/hw/xfree86/common/xf86Config.c
index 4a64bc21b..383b00039 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86Config.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Config.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.230 2000/09/19 12:46:12 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.233 2000/10/24 18:07:50 dawes Exp $ */
/*
@@ -692,7 +692,8 @@ typedef enum {
FLAG_PIXMAP,
FLAG_PC98,
FLAG_ESTIMATE_SIZES_AGGRESSIVELY,
- FLAG_NOPM
+ FLAG_NOPM,
+ FLAG_XINERAMA
} FlagValues;
static OptionInfoRec FlagOptions[] = {
@@ -742,6 +743,8 @@ static OptionInfoRec FlagOptions[] = {
{0}, FALSE },
{ FLAG_NOPM, "NoPM", OPTV_BOOLEAN,
{0}, FALSE },
+ { FLAG_XINERAMA, "Xinerama", OPTV_BOOLEAN,
+ {0}, FALSE },
{ -1, NULL, OPTV_NONE,
{0}, FALSE }
};
@@ -770,6 +773,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
int i;
Pix24Flags pix24 = Pix24DontCare;
Bool value;
+ MessageType from;
if(flagsconf == NULL)
return TRUE;
@@ -779,11 +783,11 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
*/
optp = NULL;
if (flagsconf->flg_option_lst)
- optp = OptionListDup(flagsconf->flg_option_lst);
+ optp = xf86optionListDup(flagsconf->flg_option_lst);
if (layoutopts) {
- tmp = OptionListDup(layoutopts);
+ tmp = xf86optionListDup(layoutopts);
if (optp)
- optp = OptionListMerge(optp, tmp);
+ optp = xf86optionListMerge(optp, tmp);
else
optp = tmp;
}
@@ -912,6 +916,18 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
}
#endif
+#ifdef PANORAMIX
+ from = X_DEFAULT;
+ if (!noPanoramiXExtension)
+ from = X_CMDLINE;
+ else if (xf86GetOptValBool(FlagOptions, FLAG_XINERAMA, &value)) {
+ noPanoramiXExtension = !value;
+ from = X_CONFIG;
+ }
+ if (!noPanoramiXExtension)
+ xf86Msg(from, "Xinerama: enabled\n");
+#endif
+
return TRUE;
}
@@ -1127,7 +1143,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
}
if (!havePointer) {
if (xf86PointerName) {
- confInput = xf86FindInput(xf86PointerName,
+ confInput = xf86findInput(xf86PointerName,
xf86configptr->conf_input_lst);
if (!confInput) {
xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n",
@@ -1137,10 +1153,10 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
from = X_CMDLINE;
} else {
from = X_DEFAULT;
- confInput = xf86FindInput(CONF_IMPLICIT_POINTER,
+ confInput = xf86findInput(CONF_IMPLICIT_POINTER,
xf86configptr->conf_input_lst);
if (!confInput && implicitLayout) {
- confInput = xf86FindInputByDriver("mouse",
+ confInput = xf86findInputByDriver("mouse",
xf86configptr->conf_input_lst);
}
}
@@ -1149,7 +1165,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
}
if (!haveKeyboard) {
if (xf86KeyboardName) {
- confInput = xf86FindInput(xf86KeyboardName,
+ confInput = xf86findInput(xf86KeyboardName,
xf86configptr->conf_input_lst);
if (!confInput) {
xf86Msg(X_ERROR, "No InputDevice section called \"%s\"\n",
@@ -1159,10 +1175,10 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
from = X_CMDLINE;
} else {
from = X_DEFAULT;
- confInput = xf86FindInput(CONF_IMPLICIT_KEYBOARD,
+ confInput = xf86findInput(CONF_IMPLICIT_KEYBOARD,
xf86configptr->conf_input_lst);
if (!confInput && implicitLayout) {
- confInput = xf86FindInputByDriver("keyboard",
+ confInput = xf86findInputByDriver("keyboard",
xf86configptr->conf_input_lst);
}
}
@@ -1173,7 +1189,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
count++;
indp = xnfrealloc(servlayoutp->inputs, (count + 1) * sizeof(IDevRec));
indp[count - 1] = Pointer;
- indp[count - 1].extraOptions = addNewOption(NULL, "CorePointer", NULL);
+ indp[count - 1].extraOptions = xf86addNewOption(NULL, "CorePointer", NULL);
indp[count].identifier = NULL;
servlayoutp->inputs = indp;
} else if (!havePointer) {
@@ -1187,7 +1203,7 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
count++;
indp = xnfrealloc(servlayoutp->inputs, (count + 1) * sizeof(IDevRec));
indp[count - 1] = Keyboard;
- indp[count - 1].extraOptions = addNewOption(NULL, "CoreKeyboard", NULL);
+ indp[count - 1].extraOptions = xf86addNewOption(NULL, "CoreKeyboard", NULL);
indp[count].identifier = NULL;
servlayoutp->inputs = indp;
} else if (!haveKeyboard) {
@@ -1237,7 +1253,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
from = X_CONFIG;
}
if (xf86LayoutName != NULL) {
- if ((l = xf86FindLayout(xf86LayoutName, conf_layout)) == NULL) {
+ if ((l = xf86findLayout(xf86LayoutName, conf_layout)) == NULL) {
xf86Msg(X_ERROR, "No ServerLayout section called \"%s\"\n",
xf86LayoutName);
return FALSE;
@@ -1440,17 +1456,6 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout,
servlayoutp->inputs = indp;
servlayoutp->options = conf_layout->lay_option_lst;
from = X_DEFAULT;
-#ifdef PANORAMIX
- if (!noPanoramiXExtension)
- from = X_CMDLINE;
- else if (xf86FindOption(conf_layout->lay_option_lst, "Xinerama")) {
- noPanoramiXExtension =
- !xf86SetBoolOption(conf_layout->lay_option_lst, "Xinerama", FALSE);
- from = X_CONFIG;
- }
- if (!noPanoramiXExtension)
- xf86Msg(from, "Xinerama: enabled\n");
-#endif
if (!checkCoreInputDevices(servlayoutp, FALSE))
return FALSE;
@@ -1486,7 +1491,7 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen)
from = X_CONFIG;
if (xf86ScreenName != NULL) {
- if ((s = xf86FindScreen(xf86ScreenName, conf_screen)) == NULL) {
+ if ((s = xf86findScreen(xf86ScreenName, conf_screen)) == NULL) {
xf86Msg(X_ERROR, "No Screen section called \"%s\"\n",
xf86ScreenName);
return FALSE;
@@ -1660,16 +1665,20 @@ configMonitor(MonPtr monitorp, XF86ConfMonitorPtr conf_monitor)
*/
while(modeslnk)
{
- modes = xf86FindModes (modeslnk->ml_modes_str,
- xf86configptr->conf_modes_lst);
- modeslnk->ml_modes = modes;
+ /* We may want to reuse the monitor section */
+ if (!modeslnk->ml_modes) {
+ modes = xf86findModes (modeslnk->ml_modes_str,
+ xf86configptr->conf_modes_lst);
+ modeslnk->ml_modes = modes;
+
- /* now add the modes found in the modes
- section to the list of modes for this
- monitor */
- conf_monitor->mon_modeline_lst = (XF86ConfModeLinePtr)
- addListItem((GenericListPtr)conf_monitor->mon_modeline_lst,
+ /* now add the modes found in the modes
+ section to the list of modes for this
+ monitor */
+ conf_monitor->mon_modeline_lst = (XF86ConfModeLinePtr)
+ xf86addListItem((GenericListPtr)conf_monitor->mon_modeline_lst,
(GenericListPtr)modes->mon_modeline_lst);
+ }
modeslnk = modeslnk->list.next;
}
@@ -1758,7 +1767,7 @@ lookupVisual(const char *visname)
return -1;
for (i = 0; i <= DirectColor; i++) {
- if (!NameCompare(visname, xf86VisualNames[i]))
+ if (!xf86nameCompare(visname, xf86VisualNames[i]))
break;
}
@@ -2006,7 +2015,7 @@ xf86HandleConfigFile(void)
if (xf86ConfigFile)
from = X_CMDLINE;
- filename = xf86OpenConfigFile(searchpath, xf86ConfigFile, PROJECTROOT);
+ filename = xf86openConfigFile(searchpath, xf86ConfigFile, PROJECTROOT);
if (filename) {
xf86MsgVerb(from, 0, "Using config file: \"%s\"\n", filename);
} else {
@@ -2016,11 +2025,11 @@ xf86HandleConfigFile(void)
xf86ErrorFVerb(0, "\n");
return FALSE;
}
- if ((xf86configptr = xf86ReadConfigFile ()) == NULL) {
+ if ((xf86configptr = xf86readConfigFile ()) == NULL) {
xf86Msg(X_ERROR, "Problem parsing the config file\n");
return FALSE;
}
- xf86CloseConfigFile ();
+ xf86closeConfigFile ();
/* Initialise a few things. */
@@ -2119,12 +2128,12 @@ xf86HandleConfigFile(void)
Bool
xf86PathIsAbsolute(const char *path)
{
- return (PathIsAbsolute(path) != 0);
+ return (xf86pathIsAbsolute(path) != 0);
}
Bool
xf86PathIsSafe(const char *path)
{
- return (PathIsSafe(path) != 0);
+ return (xf86pathIsSafe(path) != 0);
}
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Debug.c b/xc/programs/Xserver/hw/xfree86/common/xf86Debug.c
index 916003230..eb8d4456d 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86Debug.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86Debug.c
@@ -1,3 +1,5 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Debug.c,v 1.3 2000/09/26 15:57:08 tsi Exp $ */
+
#include <sys/time.h>
#include <unistd.h>
#include "X.h"
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h b/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h
index c58bd5073..39b6472e7 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.72 2000/09/13 15:47:31 martin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.75 2000/10/23 21:16:45 tsi Exp $ */
/*
* PCI Probe
*
@@ -233,6 +233,10 @@
#define PCI_CHIP_RAGE128ML 0x4D4C
#define PCI_CHIP_RAGE128PF 0x5046
#define PCI_CHIP_RAGE128PR 0x5052
+#define PCI_CHIP_RADEON_QD 0x5144
+#define PCI_CHIP_RADEON_QE 0x5145
+#define PCI_CHIP_RADEON_QF 0x5146
+#define PCI_CHIP_RADEON_QG 0x5147
#define PCI_CHIP_RAGE128RE 0x5245
#define PCI_CHIP_RAGE128RF 0x5246
#define PCI_CHIP_RAGE128RK 0x524B
@@ -783,6 +787,10 @@ static pciVendorDeviceInfo xf86PCIVendorInfoData[] = {
{PCI_CHIP_RAGE128ML, "Rage 128 Mobility ML",0},
{PCI_CHIP_RAGE128PF, "Rage 128 Pro PF",0},
{PCI_CHIP_RAGE128PR, "Rage 128 Pro PR",0},
+ {PCI_CHIP_RADEON_QD, "Radeon QD",0},
+ {PCI_CHIP_RADEON_QE, "Radeon QE",0},
+ {PCI_CHIP_RADEON_QF, "Radeon QF",0},
+ {PCI_CHIP_RADEON_QG, "Radeon QG",0},
{PCI_CHIP_RAGE128RE, "Rage 128 RE",0},
{PCI_CHIP_RAGE128RF, "Rage 128 RF",0},
{PCI_CHIP_RAGE128RK, "Rage 128 RK",0},
@@ -1078,6 +1086,7 @@ static pciVendorDeviceInfo xf86PCIVendorInfoData[] = {
{PCI_VENDOR_SUN, {
{0x1000, "EBUS",0 },
{0x1001, "Happy Meal",0 },
+ {0x5000, "Advanced PCI bridge",0 },
{0x8000, "PCI Bus Module",0 },
{0x0000, NULL,0}}},
{PCI_VENDOR_CMD, {
diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c b/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c
index a6c217cfd..9b44afe8f 100644
--- a/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c
+++ b/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v 3.21 2000/09/19 12:46:13 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v 3.24 2000/10/26 11:47:45 tsi Exp $ */
/*
* Copyright (c) 1997-1999 by The XFree86 Project, Inc.
@@ -116,6 +116,8 @@ pciVendorDeviceInfo * xf86PCIVendorInfo;
static void
getPciClassFlags(pciConfigPtr *pcrpp);
+static void
+pciConvertListToHost(int bus, int dev, int func, resPtr list);
static void
FindPCIVideoInfo(void)
@@ -227,8 +229,9 @@ FindPCIVideoInfo(void)
mem64 = TRUE;
#if defined LONG64 || defined WORD64
info->memBase[0] |=
- (memType)PCIGETMEMORY64HIGH(pcrp->pci_base0) << 32;
+ (memType)PCIGETMEMORY64HIGH(pcrp->pci_base1) << 32;
#else
+ if (pcrp->pci_base1)
info->memBase[0] = 0;
#endif
}
@@ -246,13 +249,14 @@ FindPCIVideoInfo(void)
mem64 = TRUE;
#if defined LONG64 || defined WORD64
info->memBase[1] |=
- (memType)PCIGETMEMORY64HIGH(pcrp->pci_base1) << 32;
+ (memType)PCIGETMEMORY64HIGH(pcrp->pci_base2) << 32;
#else
+ if (pcrp->pci_base2)
info->memBase[1] = 0;
#endif
}
}
- } else if (mem64)
+ } else
mem64 = FALSE;
if (pcrp->pci_base2 && !mem64) {
@@ -265,14 +269,15 @@ FindPCIVideoInfo(void)
if (PCI_MAP_IS64BITMEM(pcrp->pci_base2)) {
mem64 = TRUE;
#if defined LONG64 || defined WORD64
- info->memBase[1] |=
- (memType)PCIGETMEMORY64HIGH(pcrp->pci_base1) << 32;
+ info->memBase[2] |=
+ (memType)PCIGETMEMORY64HIGH(pcrp->pci_base3) << 32;
#else
- info->memBase[1] = 0;
+ if (pcrp->pci_base3)
+ info->memBase[2] = 0;
#endif
}
}
- } else if (mem64)
+ } else
mem64 = FALSE;
if (pcrp->pci_base3 && !mem64) {
@@ -286,13 +291,14 @@ FindPCIVideoInfo(void)
mem64 = TRUE;
#if defined LONG64 || defined WORD64
info->memBase[3] |=
- (memType)PCIGETMEMORY64HIGH(pcrp->pci_base3) << 32;
+ (memType)PCIGETMEMORY64HIGH(pcrp->pci_base4) << 32;
#else
+ if (pcrp->pci_base4)
info->memBase[3] = 0;
#endif
}
}
- } else if (mem64)
+ } else
mem64 = FALSE;
if (pcrp->pci_base4 && !mem64) {
@@ -306,13 +312,14 @@ FindPCIVideoInfo(void)
mem64 = TRUE;
#if defined LONG64 || defined WORD64
info->memBase[4] |=
- (memType)PCIGETMEMORY64HIGH(pcrp->pci_base4) << 32;
+ (memType)PCIGETMEMORY64HIGH(pcrp->pci_base5) << 32;
#else
+ if (pcrp->pci_base5)
info->memBase[4] = 0;
#endif
}
}
- } else if (mem64)
+ } else
mem64 = FALSE;
if (pcrp->pci_base5 && !mem64) {
@@ -323,7 +330,8 @@ FindPCIVideoInfo(void)
info->type[5] = pcrp->pci_base5 & PCI_MAP_MEMORY_ATTR_MASK;
info->memBase[5] = (memType)PCIGETMEMORY(pcrp->pci_base5);
}
- }
+ } else
+ mem64 = FALSE;
info->listed_class = pcrp->listed_class;
}
i++;
@@ -992,11 +1000,14 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type)
resRange range;
resPtr resSize = NULL;
resPtr w_tmp, w = NULL, w_2nd = NULL;
- PCITAG tag = pciTag(pvp->bus,pvp->device,pvp->func);
+ PCITAG tag;
PciBusPtr pbp = xf86PciBus, pbp1 = xf86PciBus;
+ pciConfigPtr pcp;
resPtr tmp;
if (!pvp) return FALSE;
+ tag = pciTag(pvp->bus,pvp->device,pvp->func);
+ pcp = pvp->thisCard;
type &= ResAccMask;
if (!type) type = ResShared;
@@ -1090,8 +1101,7 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type)
}
/* convert bus based entries in avoid list to host base */
- xf86ConvertListToHost(
- xf86GetPciEntity(pvp->bus,pvp->device,pvp->func), avoid);
+ pciConvertListToHost(pvp->bus,pvp->device,pvp->func, avoid);
if (!w)
w = xf86DupResList(ResRange);
@@ -1240,19 +1250,34 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type)
(*p_base) = H2B(tag,range.rBegin,type);
#ifdef DEBUG
ErrorF("New PCI res %i base: 0x%lx, size: 0x%lx, type %s\n",
- res_n,(*p_base),(1 << (*p_size)),type | ResMem ? "Mem" : "Io");
+ res_n,(*p_base),(1 << (*p_size)), (type & ResMem) ? "Mem" : "Io");
#endif
if (res_n != 0xff) {
- pciWriteLong(tag,PCI_CMD_BASE_REG + res_n * sizeof(CARD32),
- (CARD32)(*p_base) | (CARD32)(p_type));
+ if (type & ResMem)
+ pvp->memBase[prt] = range.rBegin;
+ else
+ pvp->ioBase[prt] = range.rBegin;
+ ((CARD32 *)(&(pcp->pci_base0)))[res_n] =
+ (CARD32)(*p_base) | (CARD32)(p_type);
+ pciWriteLong(tag, PCI_CMD_BASE_REG + res_n * sizeof(CARD32),
+ ((CARD32 *)(&(pcp->pci_base0)))[res_n]);
+ if (PCI_MAP_IS64BITMEM(p_type)) {
#if defined LONG64 || defined WORD64
- if (PCI_MAP_IS64BITMEM(p_type))
- pciWriteLong(tag,PCI_CMD_BASE_REG + (res_n + 1) * sizeof(CARD32),
- (CARD32)(*p_base >> 32));
+ ((CARD32 *)(&(pcp->pci_base0)))[res_n + 1] =
+ (CARD32)(*p_base >> 32);
+ pciWriteLong(tag, PCI_CMD_BASE_REG + (res_n + 1) * sizeof(CARD32),
+ ((CARD32 *)(&(pcp->pci_base0)))[res_n + 1]);
+#else
+ ((CARD32 *)(&(pcp->pci_base0)))[res_n + 1] = 0;
+ pciWriteLong(tag, PCI_CMD_BASE_REG + (res_n + 1) * sizeof(CARD32),
+ 0);
#endif
+ }
} else {
- CARD32 val = pciReadLong(tag,PCI_CMD_BIOS_REG) & 0x01;
- pciWriteLong(tag,PCI_CMD_BIOS_REG,(CARD32)(*p_base) | val);
+ pvp->biosBase = range.rBegin;
+ pcp->pci_baserom = (pciReadLong(tag,PCI_CMD_BIOS_REG) & 0x01) |
+ (CARD32)(*p_base);
+ pciWriteLong(tag, PCI_CMD_BIOS_REG, pcp->pci_baserom);
}
/* @@@ fake BIOS allocated resource */
range.type |= ResBios;
@@ -1384,8 +1409,7 @@ getValidBIOSBase(PCITAG tag, int num)
}
pbp = pbp->next;
}
- xf86ConvertListToHost(
- xf86GetPciEntity(pvp->bus,pvp->device,pvp->func), avoid);
+ pciConvertListToHost(pvp->bus,pvp->device,pvp->func, avoid);
if (pvp->biosBase) { /* try biosBase first */
P_M_RANGE(range, TAG(pvp),pvp->biosBase,biosSize,ResExcMemBlock);
@@ -1476,6 +1500,46 @@ printBridgeInfo(PciBusPtr PciBus)
xf86PrintResList(3, PciBus->preferred_pmem);
}
+/*
+ * This Sun PCI-->PCI bridge must be handled specially since it does
+ * not report the decoded I/O and MEM ranges in the usual way.
+ */
+#define APB_IO_ADDRESS_MAP 0xde
+#define APB_MEM_ADDRESS_MAP 0xdf
+
+static void
+get_sun_apb_ranges(PciBusPtr PciBus, pciConfigPtr pcrp)
+{
+ unsigned char iomap, memmap;
+ resRange range;
+ int i;
+
+ iomap = pciReadByte(pcrp->tag, APB_IO_ADDRESS_MAP);
+ memmap = pciReadByte(pcrp->tag, APB_MEM_ADDRESS_MAP);
+
+ /* if (pcrp->pci_command & PCI_CMD_IO_ENABLE) */ { /* ??? */
+ for (i = 0; i < 8; i++) {
+ if ((iomap & (1 << i)) != 0) {
+ PCI_I_RANGE(range, pcrp->tag,
+ (i << 21), (i << 21) + ((1 << 21) - 1),
+ ResIo | ResBlock | ResExclusive);
+ PciBus->io = xf86AddResToList(PciBus->io, &range, -1);
+ }
+ }
+ }
+
+ /* if (pcrp->pci_command & PCI_CMD_MEM_ENABLE) */ { /* ??? */
+ for (i = 0; i < 8; i++) {
+ if ((memmap & (1 << i)) != 0) {
+ PCI_M_RANGE(range, pcrp->tag,
+ (i << 29), (i << 29) + ((1 << 29) - 1),
+ ResMem | ResBlock | ResExclusive);
+ PciBus->mem = xf86AddResToList(PciBus->mem, &range, -1);
+ }
+ }
+ }
+}
+
PciBusPtr
xf86GetPciBridgeInfo(const pciConfigPtr *pciInfo)
{
@@ -1519,7 +1583,14 @@ xf86GetPciBridgeInfo(const pciConfigPtr *pciInfo)
PciBus->subclass = sub_class;
PciBus->interface = pcrp->pci_prog_if;
PciBus->brcontrol = pcrp->pci_bridge_control;
- if (pcrp->pci_command & PCI_CMD_IO_ENABLE) {
+ if (pcrp->pci_vendor == PCI_VENDOR_SUN &&
+ pcrp->pci_device == 0x5000) {
+ get_sun_apb_ranges(PciBus, pcrp);
+ break;
+ }
+ if ((pcrp->pci_command & PCI_CMD_IO_ENABLE) &&
+ (pcrp->pci_upper_io_base || pcrp->pci_io_base ||
+ pcrp->pci_upper_io_limit || pcrp->pci_io_limit)) {
base = (pcrp->pci_upper_io_base << 16) |
((pcrp->pci_io_base & 0xf0u) << 8);
limit = (pcrp->pci_upper_io_limit << 16) |
@@ -1545,7 +1616,14 @@ xf86GetPciBridgeInfo(const pciConfigPtr *pciInfo)
PciBus->preferred_io, &range, -1);
}
}
- if (pcrp->pci_command & PCI_CMD_MEM_ENABLE) {
+ if (pcrp->pci_command & PCI_CMD_MEM_ENABLE) {
+ /*
+ * The P2P spec requires these next two, but some bridges
+ * don't comply. Err on the side of caution, making the not
+ * so bold assumption that no bridge would ever re-route the
+ * bottom megabyte.
+ */
+ if (pcrp->pci_mem_base || pcrp->pci_mem_limit) {
base = pcrp->pci_mem_base & 0xfff0u;
limit = pcrp->pci_mem_limit & 0xfff0u;
if (base <= limit) {
@@ -1555,6 +1633,12 @@ xf86GetPciBridgeInfo(const pciConfigPtr *pciInfo)
PciBus->preferred_mem
= xf86AddResToList(NULL, &range, -1);
}
+ }
+
+ if (pcrp->pci_prefetch_mem_base ||
+ pcrp->pci_prefetch_mem_limit ||
+ pcrp->pci_prefetch_upper_mem_base ||
+ pcrp->pci_prefetch_upper_mem_limit) {
base = pcrp->pci_prefetch_mem_base & 0xfff0u;
limit = pcrp->pci_prefetch_mem_limit & 0xfff0u;
#if defined(LONG64) || defined(WORD64)
@@ -1568,6 +1652,7 @@ xf86GetPciBridgeInfo(const pciConfigPtr *pciInfo)
PciBus->preferred_pmem
= xf86AddResToList(NULL, &range, -1);
}
+ }
}
break;
case PCI_SUBCLASS_BRIDGE_ISA:
@@ -1864,8 +1949,7 @@ ValidatePci(void)
if (res_m_io == NULL)
res_m_io = xf86DupResList(ResRange);
- xf86ConvertListToHost(
- xf86GetPciEntity(pvp->bus,pvp->device,pvp->func), avoid);
+ pciConvertListToHost(pvp->bus,pvp->device,pvp->func, avoid);
#ifdef DEBUG
xf86MsgVerb(X_INFO, 3,"avoid:\n");
@@ -2790,11 +2874,9 @@ pciTestMultiDeviceCard(int bus, int dev, int func, PCITAG** pTag)
return j;
}
-void
-pciConvertRange2Host(int entityIndex, resRange *pRange)
+static void
+pciTagConvertRange2Host(PCITAG tag, resRange *pRange)
{
- PCITAG tag = TAG(xf86GetPciInfoForEntity(entityIndex));
-
switch(pRange->type & ResPhysMask) {
case ResMem:
switch(pRange->type & ResExtMask) {
@@ -2827,3 +2909,21 @@ pciConvertRange2Host(int entityIndex, resRange *pRange)
}
}
+static void
+pciConvertListToHost(int bus, int dev, int func, resPtr list)
+{
+ PCITAG tag = pciTag(bus,dev,func);
+ while (list) {
+ pciTagConvertRange2Host(tag, &list->val);
+ list = list->next;
+ }
+}
+
+
+void
+pciConvertRange2Host(int entityIndex, resRange *pRange)
+{
+ PCITAG tag = TAG(xf86GetPciInfoForEntity(entityIndex));
+ pciTagConvertRange2Host(tag, pRange);
+}
+
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml
index 90373c9fd..633ef6b09 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml
@@ -15,7 +15,7 @@
<date>24 October 2000
<ident>
- $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.7 2000/08/28 18:24:15 dawes Exp $
+ $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.8 2000/09/24 13:51:26 alanh Exp $
</ident>
<toc>
diff --git a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml
index 3830c5821..821effd12 100644
--- a/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml
+++ b/xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml
@@ -15,7 +15,7 @@
<date>29 October 2000
<ident>
- $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.5 2000/08/28 18:24:15 dawes Exp $
+ $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.6 2000/09/24 13:51:26 alanh Exp $
</ident>
<toc>
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c
index a2c5acd04..6a8147fcd 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c,v 1.3 2000/08/04 21:07:13 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c,v 1.4 2000/10/11 22:52:55 tsi Exp $ */
/*
* Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca
*
@@ -22,12 +22,13 @@
*/
#include "ati.h"
-#include "atiadapter.h"
#include "atiadjust.h"
#include "atichip.h"
#include "atidac.h"
#include "atidga.h"
#include "atiident.h"
+#include "atimode.h"
+#include "atistruct.h"
#include "dgaproc.h"
@@ -120,7 +121,7 @@ ATIDGASetMode
pATI->XModifier = pATI->bitsPerPixel / UnitOf(pATI->bitsPerPixel);
ATIAdjustPreInit(pATI);
- ATIAdapterPreInit(pScreenInfo, pATI, &pATI->NewHW);
+ ATIModePreInit(pScreenInfo, pATI, &pATI->NewHW);
if (!(*pScreenInfo->SwitchMode)(scrnIndex, pMode, 0))
return FALSE;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.c b/xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.c
deleted file mode 100644
index f055f2029..000000000
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.c,v 1.3 1999/07/06 11:38:31 dawes Exp $ */
-/*
- * Copyright 1997 through 1999 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca
- *
- * 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 Marc Aurele La France not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. Marc Aurele La France makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as-is" without express or implied warranty.
- *
- * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
- * EVENT SHALL MARC AURELE LA FRANCE 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.
- */
-
-#include "atichip.h"
-#include "atiio.h"
-
-/*
- * ATISetVGAIOBase --
- *
- * This sets vgaIOBase according to the value of the passed value of the
- * miscellaneous output register.
- */
-void
-ATISetVGAIOBase
-(
- ATIPtr pATI,
- const CARD8 misc
-)
-{
- pATI->CPIO_VGABase = (misc & 0x01U) ? ColourIOBase : MonochromeIOBase;
-}
-
-/*
- * ATIModifyExtReg --
- *
- * This function is called to modify certain bits in an ATI extended VGA
- * register while preserving its other bits. The function will not write the
- * register if it turns out its value would not change. This helps prevent
- * server hangs on older adapters.
- */
-void
-ATIModifyExtReg
-(
- ATIPtr pATI,
- const CARD8 Index,
- int CurrentValue,
- const CARD8 CurrentMask,
- CARD8 NewValue
-)
-{
- /* Possibly retrieve the current value */
- if (CurrentValue < 0)
- CurrentValue = ATIGetExtReg(Index);
-
- /* Compute new value */
- NewValue &= (CARD8)(~CurrentMask);
- NewValue |= CurrentValue & CurrentMask;
-
- /* Check if value will be changed */
- if (CurrentValue == NewValue)
- return;
-
- /*
- * The following is taken from ATI's VGA Wonder programmer's reference
- * manual which says that this is needed to "ensure the proper state of the
- * 8/16 bit ROM toggle". I suspect a timing glitch appeared in the 18800
- * after its die was cast. 18800-1 and later chips do not exhibit this
- * problem.
- */
- if ((pATI->Chip <= ATI_CHIP_18800) && (Index == 0xB2U) &&
- ((NewValue ^ 0x40U) & CurrentValue & 0x40U))
- {
- CARD8 misc = inb(R_GENMO);
- CARD8 bb = ATIGetExtReg(0xBBU);
-
- outb(GENMO, (misc & 0xF3U) | 0x04U | ((bb & 0x10U) >> 1));
- CurrentValue &= (CARD8)(~0x40U);
- ATIPutExtReg(0xB2U, CurrentValue);
- ATIDelay(5);
- outb(GENMO, misc);
- ATIDelay(5);
- if (CurrentValue != NewValue)
- ATIPutExtReg(0xB2U, NewValue);
- }
- else
- ATIPutExtReg(Index, NewValue);
-}
-
-/*
- * ATIAccessMach64PLLReg --
- *
- * This function sets up the addressing required to access, for read or write,
- * a 264xT's PLL registers.
- */
-void
-ATIAccessMach64PLLReg
-(
- ATIPtr pATI,
- const CARD8 Index,
- const Bool Write
-)
-{
- CARD8 clock_cntl1 = inb(pATI->CPIO_CLOCK_CNTL + 1) &
- ~GetByte(PLL_WR_EN | PLL_ADDR, 1);
-
- /* Set PLL register to be read or written */
- outb(pATI->CPIO_CLOCK_CNTL + 1, clock_cntl1 |
- GetByte(SetBits(Index, PLL_ADDR) | SetBits(Write, PLL_WR_EN), 1));
-}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h
index 663e06918..e19c4019f 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h,v 1.3 2000/08/22 21:54:30 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h,v 1.4 2000/10/11 22:52:56 tsi Exp $ */
/*
* Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca
*
@@ -31,6 +31,7 @@
#define ___ATIMACH64IO_H___ 1
#include "atiio.h"
+#include "atistruct.h"
/*
* A few important notes on some of the I/O statements provided:
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h b/xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h
deleted file mode 100644
index 0aea97208..000000000
--- a/xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h,v 1.1 1999/07/06 11:38:32 dawes Exp $ */
-/*
- * Copyright 1997 through 1999 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca
- *
- * 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 Marc Aurele La France not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. Marc Aurele La France makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as-is" without express or implied warranty.
- *
- * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
- * EVENT SHALL MARC AURELE LA FRANCE 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.
- */
-
-#if defined(XFree86LOADER) && !defined(___ATI_MODULE_H___)
-#define ___ATI_MODULE_H___ 1
-
-#include "atiproto.h"
-#include "xf86str.h"
-
-extern Bool ATILoadModules FunctionPrototype((ScrnInfoPtr));
-
-#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c
index 3873c2f08..fe055b55e 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c
@@ -11,7 +11,7 @@
* Guy DESBIEF
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c,v 1.14 2000/09/22 11:12:32 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c,v 1.15 2000/10/09 23:37:11 alanh Exp $ */
/* All drivers should typically include these */
#include "xf86.h"
@@ -1660,6 +1660,8 @@ AlpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
*/
xf86SetBlackWhitePixels(pScreen);
+ xf86SetSilkenMouse(pScreen);
+
/* Initialise cursor functions */
miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c
index 52aabaed9..b28025d6d 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c
@@ -1,6 +1,6 @@
/* (c) Itai Nahshon */
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c,v 1.3 2000/09/22 11:12:32 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c,v 1.4 2000/10/23 12:10:14 alanh Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -18,6 +18,32 @@
#define WAIT outb(0x3CE,0x31); while(inb(0x3CF) & pCir->chip.alp->waitMsk){};
#define WAIT_1 outb(0x3CE,0x31); while(inb(0x3CF) & 0x1){};
+static const CARD16 translated_rop[] =
+{
+ /* GXclear */ 0x0032U,
+ /* GXand */ 0x0532U,
+ /* GXandreverse */ 0x0932U,
+ /* GXcopy */ 0x0D32U,
+ /* GXandinversted */ 0x5032U,
+ /* GXnoop */ 0x0632U,
+ /* GXxor */ 0x5932U,
+ /* GXor */ 0x6D32U,
+ /* GXnor */ 0x9032U,
+ /* GXequiv */ 0x9532U,
+ /* GXinvert */ 0x0B32U,
+ /* GXorReverse */ 0xAD32U,
+ /* GXcopyInverted */ 0xD032U,
+ /* GXorInverted */ 0xD632U,
+ /* GXnand */ 0xDA32U,
+ /* GXset */ 0x0E32U
+};
+
+#if 1
+#define SetupForRop(rop) outw(0x3CE, translated_rop[rop])
+#else
+#define SetupForRop(rop) outw(0x3CE, 0x0D32)
+#endif
+
static void AlpSync(ScrnInfoPtr pScrn)
{
#ifdef ALP_DEBUG
@@ -29,8 +55,8 @@ static void AlpSync(ScrnInfoPtr pScrn)
static void
AlpSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
- int rop, unsigned int planemask,
- int trans_color)
+ int rop, unsigned int planemask,
+ int trans_color)
{
CirPtr pCir = CIRPTR(pScrn);
int pitch = pCir->pitch;
@@ -40,7 +66,7 @@ AlpSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
xdir, ydir, rop, planemask, trans_color);
#endif
WAIT;
- outw(0x3CE,0x0d32);
+ SetupForRop(rop);
/* Set dest pitch */
outw(0x3CE, ((pitch << 8) & 0xff00) | 0x24);
outw(0x3CE, ((pitch) & 0x1f00) | 0x25);
@@ -118,8 +144,7 @@ AlpSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
#endif
WAIT;
- /* GR32 = 0x0D => verbatim source copy (no logical op) */
- outw(0x3CE, 0x0D32);
+ SetupForRop(rop);
switch (pCir -> Chipset)
{
@@ -210,8 +235,7 @@ AlpSetupForMono8x8PatternFill(ScrnInfoPtr pScrn,
#endif
WAIT;
- /* GR32 = 0x0D => verbatim source copy (no logical op) */
- outw(0x3CE, 0x0D32);
+ SetupForRop(rop);
{
int source = pAlp->monoPattern8x8;
@@ -313,8 +337,7 @@ AlpSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
#endif
WAIT;
- /* GR32 = 0x0D => verbatim source copy (no logical op) */
- outw(0x3CE, 0x0D32);
+ SetupForRop(rop);
/* GR30 = color expansion, CPU->display copy */
/* Choses 8bpp / 16bpp color expansion */
@@ -409,8 +432,7 @@ AlpSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
#endif
WAIT;
- /* GR32 = 0x0D => verbatim source copy (no logical op) */
- outw(0x3CE, 0x0D32);
+ SetupForRop(rop);
/* GR30 = color expansion, CPU->display copy */
/* Choses 8bpp / 16bpp color expansion */
@@ -559,7 +581,8 @@ AlpXAAInit(ScreenPtr pScreen)
XAAPtr->SetupForScreenToScreenCopy = AlpSetupForScreenToScreenCopy;
XAAPtr->SubsequentScreenToScreenCopy = AlpSubsequentScreenToScreenCopy;
- XAAPtr->ScreenToScreenCopyFlags = GXCOPY_ONLY|NO_TRANSPARENCY|NO_PLANEMASK;
+ XAAPtr->ScreenToScreenCopyFlags =
+ NO_TRANSPARENCY | NO_PLANEMASK;
switch (pCir->Chipset)
{
@@ -568,15 +591,15 @@ AlpXAAInit(ScreenPtr pScreen)
XAAPtr->SetupForSolidFill = AlpSetupForSolidFill;
XAAPtr->SubsequentSolidFillRect = AlpSubsequentSolidFillRect;
XAAPtr->SubsequentSolidFillTrap = NULL;
- XAAPtr->SolidFillFlags = GXCOPY_ONLY|NO_PLANEMASK;
+ XAAPtr->SolidFillFlags = NO_PLANEMASK;
XAAPtr->SetupForMono8x8PatternFill = AlpSetupForMono8x8PatternFill;
XAAPtr->SubsequentMono8x8PatternFillRect =
AlpSubsequentMono8x8PatternFillRect;
XAAPtr->SubsequentMono8x8PatternFillTrap = NULL;
XAAPtr->Mono8x8PatternFillFlags =
- GXCOPY_ONLY|NO_PLANEMASK|
- HARDWARE_PATTERN_PROGRAMMED_BITS|BIT_ORDER_IN_BYTE_MSBFIRST;
+ NO_PLANEMASK |
+ HARDWARE_PATTERN_PROGRAMMED_BITS | BIT_ORDER_IN_BYTE_MSBFIRST;
#if 0
/* Currently disabled: XF86 sends DWORD-padded data,
@@ -587,9 +610,9 @@ AlpXAAInit(ScreenPtr pScreen)
AlpSubsequentCPUToScreenColorExpandFill;
XAAPtr->ColorExpandBase = pCir->FbBase + 4;
XAAPtr->CPUToScreenColorExpandFillFlags =
- GXCOPY_ONLY|NO_PLANEMASK|BIT_ORDER_IN_BYTE_MSBFIRST|
- SCANLINE_PAD_DWORD|
- CPU_TRANSFER_PAD_DWORD|CPU_TRANSFER_BASE_FIXED;
+ NO_PLANEMASK | BIT_ORDER_IN_BYTE_MSBFIRST |
+ SCANLINE_PAD_DWORD | ROP_NEEDS_SOURCE |
+ CPU_TRANSFER_PAD_DWORD | CPU_TRANSFER_BASE_FIXED;
#endif
#if 1
/* kludge: since XF86 does not support byte-padded
@@ -622,8 +645,8 @@ AlpXAAInit(ScreenPtr pScreen)
malloc(buffer_size);
}
XAAPtr->ScanlineCPUToScreenColorExpandFillFlags =
- GXCOPY_ONLY|NO_PLANEMASK|BIT_ORDER_IN_BYTE_MSBFIRST|
- SCANLINE_PAD_DWORD;
+ NO_PLANEMASK | BIT_ORDER_IN_BYTE_MSBFIRST |
+ SCANLINE_PAD_DWORD | ROP_NEEDS_SOURCE;
#endif
break;
@@ -632,7 +655,7 @@ AlpXAAInit(ScreenPtr pScreen)
XAAPtr->SetupForSolidFill = AlpSetupForSolidFill;
XAAPtr->SubsequentSolidFillRect = AlpSubsequentSolidFillRect;
XAAPtr->SubsequentSolidFillTrap = NULL;
- XAAPtr->SolidFillFlags = GXCOPY_ONLY|NO_TRANSPARENCY|NO_PLANEMASK;
+ XAAPtr->SolidFillFlags = NO_TRANSPARENCY|NO_PLANEMASK;
outw(0x3CE, 0x200E); /* enable writes to gr33 */
break;
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3 b/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3
index 8502a81e8..3d5835856 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3
@@ -1,51 +1,44 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3,v 1.2 2000/09/19 14:12:31 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3,v 1.3 2000/10/17 09:07:03 alanh Exp $ */
-STATUS as of Sat, 9 Sep 2000 11:34:31 +0200
+STATUS as of Mon, 16 Oct 2000 21:24:51 +0200
Working :
* Unaccelerated : Depth 8, 15, 16 and 24 are ok. I tested them upto
1280x1024 only as my monitor don't support higher modes.
* HW cursor.
- * Partial 2D Accels.
* ShadowFb works.
-
-Not Working (see below for more detail) :
- * Dual head : Dual head should work, but there is still a bug in the vga
- functions mmio vs io issue. When run in dual head mode, the console,
- altough still there will show no output. Blind typing will work though.
- Well ctr-alt-del will work and is especially friendly to your partitions.
- * Full 2D Accels.
- * Video Overlay.
- * DRI.
- * Initialization on non Appian J2000 boards, if not done by the BIOS will
- cause problems.
-
-Dual head :
-
- * glint_driver.c:2322-2325:
- The problem is that the usage of mmio functions for vga graphics index &
- port (GraphicsIndexReg : 0x63ce, GraphicsPort : 0x3cf) corrupts the
- console font for pm3 and pm2v. Using IO functions for it solve this, but
- breaks dualheaded as there is no more console ouput then.
-
-2D Accels [WORK IN PROGRESS] :
-
- * Only little endian is supported right now. Big endian may work also,
- but i don't have a big endian box to test it on.
- * Implemented are :
- - Screen to screen copy.
- - Solid fills.
+ * Full 2D Accels. (Need testing and tuning on big endian systems.)
+ - Sync.
- Pixmap cache.
- Offscreen pixmaps.
- - Sync.
- Clipping.
- * Screen to screen copy present two problems :
- - when doing the copy, there are temporary noise around the area getting
- copied.
- - when doing very small copies from left to right (as when the window
- manager is doing opaque moves) there is corruption on the left side of
- the window. Using ONLY_LEFT_TO_RIGHT_BITBLT solves this. But still, the
- pm3 should be able to handle this.
+ - Screen to screen copy.
+ - Solid fills.
+ - HorVert Solid Lines .
+ - 8x8 Mono Pattern Fills.
+ - Color Expansion Fills.
+ - Images Writes.
+ * Appian J2000 second head initialization.
+ * Dual head : The console fonts will get trashed, but dual head works.
+Not Working :
+ * 2D Accel hooks not implemented :
+ - Solid & Dashed Lines are not possible on glint hardware.
+ - 8x8 Color Pattern Fill is almost never used.
+ * Video Overlay.
+ * DRI.
+
+Known Problem :
+
+ * Console gets broken when using dual headed mode. The culprit seems to be
+ the vga graphics index & port (GraphicsIndexReg : 0x63ce, GraphicsPort :
+ 0x3cf). I had to use IO acces for both these two, because if not, console
+ fonts would get trashed even in mono headed mode.
+ * R-B inversion. Sometimes, all of a sudden, it seems as the RGB order
+ gets changed. going to console and back solves this.
+ * [TRIGGERED IN ENLIGTHENMENT ONLY] When moving a window around a lot
+ quicly, the video outputs dies. I have to switch to a console and back
+ to have it restored. Is it possible that the accel engine gets
+ overloaded or something such ?
Video Overlay [NOTHING DONE YET] :
@@ -53,25 +46,12 @@ Video Overlay [NOTHING DONE YET] :
DRI/3D Accels [NOTHING DONE YET] :
- * Current Gamma support only works with dualmx boards and the like where
- the gamma chip is actually doing the rendering, and the rasterizer chip
- are slaves of the gamma chip.
-
- * The approach taken by the current pm3 driver is to have each pm3 having
- its own driver instance. We thus need a setup for sharing the gamma between
- both pm3. Such a setup was already done for the G400 dual head feature.
- Need to investigate this.
-
- * One alternative could be to use the pm3 for 3D Accels, but as the pm3 has
- only a Delta unit, this is not optimal. However it would be nice for
- pm3 boards lacking gamma chip, and could maybe be shared with pm2 boards ?
-
- * Also it could maybe be possible to share the workload between the Gamma
- and the pm3. Don't know about this though ...
-
-Initialization [NEED TESTING ON NON J2000 BOARD] :
-
- * Second head of Jeronimo 2000 is not initialized by the bios, So memory
- timings need to be set. I set them only if subsysVendor & subsysCard are
- matching J2000. Need feedback of other dual pm3 boards.
+ * First approach would be to use the gamma for one head only (most probably
+ the first head, it could be configurable though).
+ * Sharing the gamma between both driver instances would need a setup similar
+ of what was done for the Matrox dualheaded G400 (mga driver).
+ * Alternatively it could be possible to use DRI with the gamma on one head,
+ and DRI with the pm3 alone on the second head. This would need writing a
+ pm3 drm kernel driver as well as a pm3 OpenGL driver. Could be useful for
+ boards without gamma chips though.
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.cpp b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.cpp
index e96e9e40b..9aeedfe1f 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.cpp
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.cpp
@@ -1,4 +1,4 @@
-.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.cpp,v 1.8 2000/09/19 14:12:31 alanh Exp $
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.cpp,v 1.9 2000/10/17 09:07:04 alanh Exp $
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
.TH GLINT __drivermansuffix__ "Version 4.0.1" "XFree86"
@@ -18,15 +18,6 @@ is an XFree86 driver for 3Dlabs & Texas Instruments GLINT/Permedia based video
cards. The driver is rather fully accelerated, and provides support for the
following framebuffer depths: 8, 15 (may give bad results with FBDev support),
16, 24 (32 bpp recommended, 24 bpp has problems), 30, and an 8+24 overlay mode.
-For the
-.B Glint Permedia 3
-, the driver supports unaccelerated modes of depth 8 (bpp 8), 15 and 16 (bpp 16)
-and 24 (bppi 32) in single headed mode.
-2D Acceleration is working, but there are some visual artifacts with the
-ScreenToScreenCopy accel.
-Dual head (on the Appian J2000 board) is working, but the console screen will
-get corrupted, blind typing still works though.
-See the README.pm3 file for more details.
.SH SUPPORTED HARDWARE
The
.B glint
@@ -119,4 +110,5 @@ option.
.SH "SEE ALSO"
XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__)
.SH AUTHORS
-Authors include: Alan Hourihane, Dirk Hohndel, Stefan Dirsch, Michel Dänzer
+Authors include: Alan Hourihane, Dirk Hohndel, Stefan Dirsch, Michel Dänzer,
+Sven Luther
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h
index 9da2b8c26..41adfd348 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h,v 1.34 2000/09/19 19:19:22 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h,v 1.36 2000/10/17 09:07:04 alanh Exp $ */
/*
* Copyright 1997,1998 by Alan Hourihane <alanh@fairlite.demon.co.uk>
*
@@ -96,7 +96,7 @@ typedef struct {
int planemask;
int realMXWidth;
CARD32 IOAddress;
- CARD32 FbAddress;
+ unsigned long FbAddress;
int irq;
unsigned char * IOBase;
unsigned char * IOBaseVGA;
@@ -144,6 +144,7 @@ typedef struct {
CARD32 RasterizerSwap;
int PM3_Config2D;
int PM3_Render2D;
+ int PM3_AreaStippleMode;
int PM3_VideoControl;
#ifdef XF86DRI
Bool directRenderingEnabled;
@@ -209,14 +210,16 @@ Bool Permedia2VInit(ScrnInfoPtr pScrn, DisplayModePtr mode);
Bool Permedia2vHWCursorInit(ScreenPtr pScreen);
/* pm3_dac.c */
-void Permedia3PreInit(ScrnInfoPtr pScrn, GLINTPtr pGlint);
+void Permedia3PreInit(ScrnInfoPtr pScrn);
int Permedia3MemorySizeDetect(ScrnInfoPtr pScrn);
void Permedia3Restore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg);
void Permedia3Save(ScrnInfoPtr pScrn, GLINTRegPtr glintReg);
Bool Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode);
/* pm3_accel.c */
-Bool Permedia3AccelInit(ScreenPtr pScreen);
+/* Not needed, ... is it ever called outside of pm3_accel.c ?
void Permedia3Sync(ScrnInfoPtr pScrn);
+*/
+Bool Permedia3AccelInit(ScreenPtr pScreen);
void Permedia3InitializeEngine(ScrnInfoPtr pScrn);
/* End of pm3 stuff */
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c
index b63dabd90..8744c7c91 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c
@@ -28,7 +28,7 @@
* this work is sponsored by S.u.S.E. GmbH, Fuerth, Elsa GmbH, Aachen,
* Siemens Nixdorf Informationssysteme and Appian Graphics.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c,v 1.96 2000/09/19 14:12:31 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c,v 1.98 2000/10/17 09:07:04 alanh Exp $ */
#include "fb.h"
#include "cfb8_32.h"
@@ -1300,7 +1300,7 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags)
* than a J2000, as memory timings will surely change.
*/
GLINTMapMem(pScrn);
- Permedia3PreInit(pScrn, pGlint);
+ Permedia3PreInit(pScrn);
GLINTUnmapMem(pScrn);
pScrn->videoRam = Permedia3MemorySizeDetect(pScrn);
} else if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V) {
@@ -2039,7 +2039,6 @@ GLINTUnmapMem(ScrnInfoPtr pScrn)
return TRUE;
}
-
/*
* This function saves the video state.
*/
@@ -2306,10 +2305,11 @@ GLINTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (!vgaHWMapMem(pScrn))
return FALSE;
}
+
/* Timing problem with PM3 & PM2V chips dont like being blasted */
/* This solves the dual head problem but trahses the console font. */
- if (pGlint->Chipset = PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) {
+ if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) {
/* Graphics Index VGA register don't work in mmio mode
* for the Permedia3 chip, it thrashes the console font.
* Let's keep the IO functions for this instead ... */
@@ -2318,12 +2318,8 @@ GLINTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
vgaHWSetMmioFuncs(hwp, pGlint->IOBaseVGA, 0);
hwp->writeGr = writeGr;
hwp->readGr = readGr;
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "SVEN : Permedia 3 don't use mmio for VGA Graphics Index.\n");
- }
- else if (pGlint->Chipset != PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V)
+ } else if (pGlint->Chipset != PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V)
vgaHWSetMmioFuncs(hwp, pGlint->IOBaseVGA, 0);
-
vgaHWGetIOBase(hwp);
}
@@ -2634,6 +2630,7 @@ GLINTSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
pScrn = xf86Screens[scrnIndex];
pGlint = GLINTPTR(pScrn);
+ TRACE_ENTER("GLINTSwitchMode");
if (pGlint->FBDev) {
Bool ret = fbdevHWSwitchMode(scrnIndex, mode, flags);
@@ -2666,9 +2663,11 @@ GLINTSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
}
}
+ TRACE_EXIT("GLINTSwitchMode (fbdev ?)");
return ret;
}
+ TRACE_EXIT("GLINTSwitchMode (normal)");
return GLINTModeInit(xf86Screens[scrnIndex], mode);
}
@@ -2687,9 +2686,11 @@ GLINTAdjustFrame(int scrnIndex, int x, int y, int flags)
pScrn = xf86Screens[scrnIndex];
pGlint = GLINTPTR(pScrn);
+ TRACE_ENTER("GLINTAdjustFrame");
if (pGlint->FBDev) {
fbdevHWAdjustFrame(scrnIndex, x, y, flags);
+ TRACE_EXIT("GLINTAdjustFrame (fbdev)");
return;
}
@@ -2708,6 +2709,7 @@ GLINTAdjustFrame(int scrnIndex, int x, int y, int flags)
GLINT_SLOW_WRITE_REG(base, PMScreenBase);
break;
}
+ TRACE_EXIT("GLINTAdjustFrame (normal)");
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c
index 7c512d542..db94756b2 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c
@@ -1,36 +1,32 @@
/*
- * Copyright 1997,1998 by Alan Hourihane, Wigan, England.
+ * Copyright 2000 by Sven Luther <luther@dpt-info.u-strasbg.fr>.
*
* 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
+ * documentation, and that the name of Sven Luther 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
+ * specific, written prior permission. Sven Luther 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,
+ * SVEN LUTHER 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
+ * EVENT SHALL SVEN LUTHER 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.
*
- * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
- * Dirk Hohndel, <hohndel@suse.de>
- * Stefan Dirsch, <sndirsch@suse.de>
- * Mark Vojkovich, <mvojkovi@ucsd.edu>
- * Michel Dänzer, <michdaen@iiic.ethz.ch>
- * Sven Luther, <luther@dpt-info.u-strasbg.fr>
+ * Authors: Sven Luther, <luther@dpt-info.u-strasbg.fr>
+ * Alan Hourihane, <alanh@fairlite.demon.co.uk>
*
* this work is sponsored by Appian Graphics.
*
* Permedia 3 accelerated options.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c,v 1.3 2000/09/11 16:58:56 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c,v 1.5 2000/10/26 17:57:56 dawes Exp $ */
#include "Xarch.h"
#include "xf86.h"
@@ -45,6 +41,7 @@
#include "fb.h"
#include "glint_regs.h"
+#include "pm3_regs.h"
#include "glint.h"
#include "xaalocal.h" /* For replacements */
@@ -52,23 +49,22 @@
#define DEBUG 0
#if DEBUG
-# define TRACE_ENTER(str) ErrorF("pm2_accel: " str " %d\n",pScrn->scrnIndex)
-# define TRACE_EXIT(str) ErrorF("pm2_accel: " str " done\n")
-# define TRACE(str) ErrorF("pm2_accel trace: " str "\n")
+# define TRACE_ENTER(str) ErrorF("pm3_accel: " str " %d\n",pScrn->scrnIndex)
+# define TRACE_EXIT(str) ErrorF("pm3_accel: " str " done\n")
+# define TRACE(str) ErrorF("pm3_accel trace: " str "\n")
#else
# define TRACE_ENTER(str)
# define TRACE_EXIT(str)
# define TRACE(str)
#endif
-static void Permedia3SetupForFillRectSolid(ScrnInfoPtr pScrn, int color,
- int rop, unsigned int planemask);
-static void Permedia3SubsequentFillRectSolid(ScrnInfoPtr pScrn, int x,
- int y, int w, int h);
-static void Permedia3SetupForFillRectSolid24bpp(ScrnInfoPtr pScrn,int color,
- int rop, unsigned int planemask);
-static void Permedia3SubsequentFillRectSolid24bpp(ScrnInfoPtr pScrn, int x,
- int y, int w, int h);
+/* Sync */
+void Permedia3Sync(ScrnInfoPtr pScrn);
+/* Clipping */
+static void Permedia3SetClippingRectangle(ScrnInfoPtr pScrn, int x, int y,
+ int w, int h);
+static void Permedia3DisableClipping(ScrnInfoPtr pScrn);
+/* ScreenToScreenCopy */
static void Permedia3SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
int x1, int y1, int x2,
int y2, int w, int h);
@@ -76,157 +72,264 @@ static void Permedia3SetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
int xdir, int ydir, int rop,
unsigned int planemask,
int transparency_color);
-static void Permedia3SubsequentScreenToScreenCopy2432bpp(ScrnInfoPtr pScrn,
- int x1, int y1, int x2, int y2, int w, int h);
-static void Permedia3SetupForScreenToScreenCopy2432bpp(ScrnInfoPtr pScrn,
- int xdir, int ydir, int rop,
- unsigned int planemask,
- int transparency_color);
-static void Permedia3SetClippingRectangle(ScrnInfoPtr pScrn, int x, int y,
- int w, int h);
-static void Permedia3DisableClipping(ScrnInfoPtr pScrn);
-static void Permedia3SetupForSolidLine(ScrnInfoPtr pScrn, int color,
+/* SolidFill */
+static void Permedia3SetupForFillRectSolid(ScrnInfoPtr pScrn, int color,
int rop, unsigned int planemask);
-static void Permedia3SubsequentHorVertLine(ScrnInfoPtr pScrn, int x, int y,
- int len, int dir);
-static void Permedia3SubsequentSolidBresenhamLine(ScrnInfoPtr pScrn,
- int x, int y, int dmaj, int dmin, int e,
- int len, int octant);
-static void Permedia3WriteBitmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *src, int srcwidth, int skipleft,
- int fg, int bg, int rop,unsigned int planemask);
+static void Permedia3SubsequentFillRectSolid(ScrnInfoPtr pScrn, int x,
+ int y, int w, int h);
+/* 8x8 Mono Pattern Fills */
static void Permedia3SetupForMono8x8PatternFill(ScrnInfoPtr pScrn,
- int patternx, int patterny, int fg, int bg,
+ int patternx, int patterny, int fg, int bg,
int rop, unsigned int planemask);
static void Permedia3SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn,
- int patternx, int patterny, int x, int y,
+ int x_offset, int y_offset, int x, int y,
int w, int h);
-static void Permedia3SetupForMono8x8PatternFill24bpp(ScrnInfoPtr pScrn,
- int patternx, int patterny, int fg, int bg,
- int rop, unsigned int planemask);
-static void Permedia3SubsequentMono8x8PatternFillRect24bpp(ScrnInfoPtr pScrn,
- int patternx, int patterny, int x, int y,
- int w, int h);
-static void Permedia3WritePixmap8bpp(ScrnInfoPtr pScrn, int x, int y, int w,
- int h, unsigned char *src, int srcwidth,
- int rop, unsigned int planemask,
- int transparency_color, int bpp, int depth);
-static void Permedia3WritePixmap16bpp(ScrnInfoPtr pScrn, int x, int y, int w,
- int h, unsigned char *src, int srcwidth,
- int rop, unsigned int planemask,
- int transparency_color, int bpp, int depth);
-#if 0
-static void Permedia3WritePixmap24bpp(ScrnInfoPtr pScrn, int x, int y, int w,
- int h, unsigned char *src, int srcwidth,
- int rop, unsigned int planemask,
- int transparency_color, int bpp, int depth);
-#endif
-static void Permedia3WritePixmap32bpp(ScrnInfoPtr pScrn, int x, int y, int w,
- int h, unsigned char *src, int srcwidth,
- int rop, unsigned int planemask,
- int transparency_color, int bpp, int depth);
+/* Color Expansion Fills */
static void Permedia3SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
int fg, int bg, int rop,unsigned int planemask);
static void Permedia3SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
int x, int y, int w, int h, int skipleft);
-static void Permedia3SetupForScanlineCPUToScreenColorExpandFill(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask);
-static void Permedia3SubsequentScanlineCPUToScreenColorExpandFill(
- ScrnInfoPtr pScrn, int x,
- int y, int w, int h, int skipleft);
-static void Permedia3SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno);
-static void Permedia3LoadCoord(ScrnInfoPtr pScrn, int x, int y, int w, int h);
-static void Permedia3PolylinesThinSolidWrapper(DrawablePtr pDraw, GCPtr pGC,
- int mode, int npt, DDXPointPtr pPts);
-static void Permedia3PolySegmentThinSolidWrapper(DrawablePtr pDraw, GCPtr pGC,
- int nseg, xSegment *pSeg);
+/* Images Writes */
+static void Permedia3SetupForImageWrite(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int trans_color,
+ int bpp, int depth);
+static void Permedia3SubsequentImageWriteRect(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft);
#define MAX_FIFO_ENTRIES 256
+/* Mirror stipple pattern horizontally */
#if X_BYTE_ORDER == X_BIG_ENDIAN
-# define STIPPLE_SWAP 1<<18 /* Mirror stipple pattern horizontally */
+# define STIPPLE_SWAP 1<<18
#else
# define STIPPLE_SWAP 0
#endif
+
void
Permedia3InitializeEngine(ScrnInfoPtr pScrn)
{
GLINTPtr pGlint = GLINTPTR(pScrn);
+ int colorformat = 0;
/* Initialize the Accelerator Engine to defaults */
-
TRACE_ENTER("Permedia3InitializeEngine");
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, ScissorMode);
- GLINT_SLOW_WRITE_REG(UNIT_ENABLE | FBWM_Enable0, FBWriteMode);
- GLINT_SLOW_WRITE_REG(0, dXSub);
- GLINT_SLOW_WRITE_REG(GWIN_DisableLBUpdate, GLINTWindow);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, DitherMode);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AlphaBlendMode);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, ColorDDAMode);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, TextureColorMode);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, TextureAddressMode);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PMTextureReadMode);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AlphaBlendMode);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, TexelLUTMode);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, YUVMode);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, DepthMode);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, RouterMode);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FogMode);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AntialiasMode);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AlphaTestMode);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, StencilMode);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AreaStippleMode);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LogicalOpMode);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, DepthMode);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, StatisticMode);
+ /* Host out PreInit */
+ /* Set filter mode to enable sync tag & data output */
GLINT_SLOW_WRITE_REG(0xc00, FilterMode);
- GLINT_SLOW_WRITE_REG(0xffffffff, FBHardwareWriteMask);
- GLINT_SLOW_WRITE_REG(0xffffffff, FBSoftwareWriteMask);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, RasterizerMode);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, GLINTDepth);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FBSourceOffset);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FBPixelOffset);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LBSourceOffset);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, WindowOrigin);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FBWindowBase);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FBSourceBase);
- GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LBWindowBase);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, StatisticMode);
+ Permedia3Sync(pScrn);
+
+ TRACE("Permedia3InitializeEngine : first sync");
+ /* Disable most units by default */
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PM3DeltaMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, RasterizerMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, ScissorMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LineStippleMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AreaStippleMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PM3GIDMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, DepthMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, StencilMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, ColorDDAMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PM3TextureCoordMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PM3TextureIndexMode0);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PM3TextureIndexMode1);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, TextureReadMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PM3LUTMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, TextureFilterMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PM3TextureCompositeMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PM3TextureApplicationMode);
+ GLINT_SLOW_WRITE_REG(0, PM3TextureCompositeColorMode1);
+ GLINT_SLOW_WRITE_REG(0, PM3TextureCompositeAlphaMode1);
+ GLINT_SLOW_WRITE_REG(0, PM3TextureCompositeColorMode0);
+ GLINT_SLOW_WRITE_REG(0, PM3TextureCompositeAlphaMode0);
+
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FogMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, ChromaTestMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AlphaTestMode);
+ /* Not done in P3Lib ??? */
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AntialiasMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PM3AlphaTestMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, YUVMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PM3AlphaBlendColorMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PM3AlphaBlendAlphaMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, DitherMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LogicalOpMode);
+
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, StatisticMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, RouterMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PM3Window);
+ GLINT_SLOW_WRITE_REG(0, PM3Config2D);
+
+ GLINT_SLOW_WRITE_REG(0xffffffff, PM3SpanColorMask);
+
+ GLINT_SLOW_WRITE_REG(0, PM3XBias);
+ GLINT_SLOW_WRITE_REG(0, PM3YBias);
+
+ GLINT_SLOW_WRITE_REG(0, PM3DeltaControl);
+
+ GLINT_SLOW_WRITE_REG(0xffffffff, BitMaskPattern);
+ Permedia3Sync(pScrn);
+
+ /* ScissorStippleUnit Initialization (is it needed ?) */
+ pGlint->ClippingOn = FALSE;
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, ScissorMode);
+ /* We never use Screen Scissor ...
+ GLINT_SLOW_WRITE_REG(
+ (pScrn->virtualX&0xffff)|((pScrn->virtualY&0xffff)<<16),
+ ScreenSize);
+ GLINT_SLOW_WRITE_REG(
+ (0&0xffff)|((0&0xffff)<<16),
+ WindowOrigin);
+ */
+ Permedia3Sync(pScrn);
+
+ /* StencilDepthUnit Initialization */
+ GLINT_SLOW_WRITE_REG(0, PM3Window);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, DepthMode);
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, StencilMode);
+ GLINT_SLOW_WRITE_REG(0, StencilData);
+ Permedia3Sync(pScrn);
+
+ /* FBReadUnit Initialization */
+ TRACE("Permedia3InitializeEngine : only syncs upto now");
+ GLINT_SLOW_WRITE_REG(
+ PM3FBDestReadEnables_E(0xff) |
+ PM3FBDestReadEnables_R(0xff) |
+ PM3FBDestReadEnables_ReferenceAlpha(0xff),
+ PM3FBDestReadEnables);
+ GLINT_SLOW_WRITE_REG(0, PM3FBDestReadBufferAddr0);
+ GLINT_SLOW_WRITE_REG(0, PM3FBDestReadBufferOffset0);
+ GLINT_SLOW_WRITE_REG(
+ PM3FBDestReadBufferWidth_Width(pScrn->displayWidth),
+ PM3FBDestReadBufferWidth0);
+ /*
+ GLINT_SLOW_WRITE_REG(0, PM3FBDestReadBufferAddr1);
+ GLINT_SLOW_WRITE_REG(0, PM3FBDestReadBufferOffset1);
+ GLINT_SLOW_WRITE_REG(
+ PM3FBDestReadBufferWidth_Width(pScrn->displayWidth),
+ PM3FBDestReadBufferWidth1);
+ GLINT_SLOW_WRITE_REG(0, PM3FBDestReadBufferAddr2);
+ GLINT_SLOW_WRITE_REG(0, PM3FBDestReadBufferOffset2);
+ GLINT_SLOW_WRITE_REG(
+ PM3FBDestReadBufferWidth_Width(pScrn->displayWidth),
+ PM3FBDestReadBufferWidth2);
+ GLINT_SLOW_WRITE_REG(0, PM3FBDestReadBufferAddr3);
+ GLINT_SLOW_WRITE_REG(0, PM3FBDestReadBufferOffset3);
+ GLINT_SLOW_WRITE_REG(
+ PM3FBDestReadBufferWidth_Width(pScrn->displayWidth),
+ PM3FBDestReadBufferWidth3);
+ */
+ GLINT_SLOW_WRITE_REG(
+ PM3FBDestReadMode_ReadEnable |
+ /* Not needed, since FBDestRead is the same as FBWrite.
+ PM3FBDestReadMode_Blocking |
+ */
+ PM3FBDestReadMode_Enable0,
+ PM3FBDestReadMode);
+ TRACE("Permedia3InitializeEngine : DestRead");
+ GLINT_SLOW_WRITE_REG(0, PM3FBSourceReadBufferAddr);
+ GLINT_SLOW_WRITE_REG(0, PM3FBSourceReadBufferOffset);
+ GLINT_SLOW_WRITE_REG(
+ PM3FBSourceReadBufferWidth_Width(pScrn->displayWidth),
+ PM3FBSourceReadBufferWidth);
+ GLINT_SLOW_WRITE_REG(
+ PM3FBSourceReadMode_Blocking |
+ PM3FBSourceReadMode_ReadEnable,
+ PM3FBSourceReadMode);
+ TRACE("Permedia3InitializeEngine : SourceRead");
#if X_BYTE_ORDER == X_BIG_ENDIAN
pGlint->RasterizerSwap = 1;
#else
pGlint->RasterizerSwap = 0;
#endif
-
switch (pScrn->bitsPerPixel) {
case 8:
- pGlint->PixelWidth = 0x0; /* 8 Bits */
- pGlint->TexMapFormat = pGlint->pprod;
+ GLINT_SLOW_WRITE_REG(0x2, PixelSize);
#if X_BYTE_ORDER == X_BIG_ENDIAN
pGlint->RasterizerSwap |= 3<<15; /* Swap host data */
#endif
break;
case 16:
- pGlint->PixelWidth = 0x1; /* 16 Bits */
- pGlint->TexMapFormat = pGlint->pprod | 1<<19;
+ GLINT_SLOW_WRITE_REG(0x1, PixelSize);
#if X_BYTE_ORDER == X_BIG_ENDIAN
pGlint->RasterizerSwap |= 2<<15; /* Swap host data */
#endif
break;
- case 24:
- pGlint->PixelWidth = 0x4; /* 24 Bits */
- pGlint->TexMapFormat = pGlint->pprod | 2<<19;
+ case 32:
+ GLINT_SLOW_WRITE_REG(0x0, PixelSize);
break;
+ }
+ TRACE("Permedia3InitializeEngine : PixelSize");
+ Permedia3Sync(pScrn);
+
+ /* LogicalOpUnit Initialization */
+ GLINT_SLOW_WRITE_REG(0xffffffff, FBSoftwareWriteMask);
+ Permedia3Sync(pScrn);
+
+ /* FBWriteUnit Initialization */
+ GLINT_SLOW_WRITE_REG(
+ PM3FBWriteMode_WriteEnable|
+ PM3FBWriteMode_OpaqueSpan|
+ PM3FBWriteMode_Enable0,
+ PM3FBWriteMode);
+ GLINT_SLOW_WRITE_REG(0, PM3FBWriteBufferAddr0);
+ GLINT_SLOW_WRITE_REG(0, PM3FBWriteBufferOffset0);
+ GLINT_SLOW_WRITE_REG(
+ PM3FBWriteBufferWidth_Width(pScrn->displayWidth),
+ PM3FBWriteBufferWidth0);
+ Permedia3Sync(pScrn);
+ /*
+ GLINT_SLOW_WRITE_REG(0, PM3FBWriteBufferAddr1);
+ GLINT_SLOW_WRITE_REG(0, PM3FBWriteBufferOffset1);
+ GLINT_SLOW_WRITE_REG(
+ PM3FBWriteBufferWidth_Width(pScrn->displayWidth),
+ PM3FBWriteBufferWidth1);
+ GLINT_SLOW_WRITE_REG(0, PM3FBWriteBufferAddr2);
+ GLINT_SLOW_WRITE_REG(0, PM3FBWriteBufferOffset2);
+ GLINT_SLOW_WRITE_REG(
+ PM3FBWriteBufferWidth_Width(pScrn->displayWidth),
+ PM3FBWriteBufferWidth2);
+ GLINT_SLOW_WRITE_REG(0, PM3FBWriteBufferAddr3);
+ GLINT_SLOW_WRITE_REG(0, PM3FBWriteBufferOffset3);
+ GLINT_SLOW_WRITE_REG(
+ PM3FBWriteBufferWidth_Width(pScrn->displayWidth),
+ PM3FBWriteBufferWidth3);
+ */
+ TRACE("Permedia3InitializeEngine : FBWrite");
+ /* SizeOfframebuffer */
+ GLINT_SLOW_WRITE_REG(
+ pScrn->displayWidth *
+ (8 * pGlint->FbMapSize / (pScrn->bitsPerPixel * pScrn->displayWidth)
+ >4095?4095: 8 * pGlint->FbMapSize /
+ (pScrn->bitsPerPixel * pScrn->displayWidth)),
+ PM3SizeOfFramebuffer);
+ GLINT_SLOW_WRITE_REG(0xffffffff, FBHardwareWriteMask);
+ Permedia3Sync(pScrn);
+ TRACE("Permedia3InitializeEngine : FBHardwareWriteMask & SizeOfFramebuffer");
+ /* Color Format */
+ switch (pScrn->depth) {
+ case 8:
+ colorformat = 4;
+ break;
+ case 15:
+ colorformat = 2;
+ break;
+ case 16:
+ colorformat = 3;
+ break;
+ case 24:
case 32:
- pGlint->PixelWidth = 0x2; /* 32 Bits */
- pGlint->TexMapFormat = pGlint->pprod | 2<<19;
- break;
+ colorformat = 0;
+ break;
}
- pGlint->ClippingOn = FALSE;
+ GLINT_SLOW_WRITE_REG(UNIT_DISABLE|
+ ((colorformat&0xf)<<2)|(1<<10),
+ DitherMode);
+
+ /* Other stuff */
pGlint->startxdom = 0;
pGlint->startxsub = 0;
pGlint->starty = 0;
@@ -238,42 +341,13 @@ Permedia3InitializeEngine(ScrnInfoPtr pScrn)
pGlint->h = 0;
pGlint->w = 0;
pGlint->ROP = 0xFF;
- GLINT_SLOW_WRITE_REG(pGlint->PixelWidth, FBReadPixel);
- GLINT_SLOW_WRITE_REG(pGlint->TexMapFormat, PMTextureMapFormat);
- GLINT_SLOW_WRITE_REG(0, RectangleSize);
- GLINT_SLOW_WRITE_REG(0, RectangleOrigin);
GLINT_SLOW_WRITE_REG(0, dXDom);
+ GLINT_SLOW_WRITE_REG(0, dXSub);
GLINT_SLOW_WRITE_REG(1<<16, dY);
GLINT_SLOW_WRITE_REG(0, StartXDom);
GLINT_SLOW_WRITE_REG(0, StartXSub);
GLINT_SLOW_WRITE_REG(0, StartY);
GLINT_SLOW_WRITE_REG(0, GLINTCount);
-
- GLINT_SLOW_WRITE_REG(1 | 1<<8, 0xAEE0);
- GLINT_SLOW_WRITE_REG(1, 0xAEE0);
- GLINT_SLOW_WRITE_REG(pScrn->displayWidth, FBSrcReadBufWidth);
- GLINT_SLOW_WRITE_REG(pScrn->displayWidth, FBDstReadBufWidth0);
- GLINT_SLOW_WRITE_REG(pScrn->displayWidth, FBWriteBufWidth0);
- GLINT_SLOW_WRITE_REG(0, FBSrcReadBufAddr);
- GLINT_SLOW_WRITE_REG(0, FBDstReadBufAddr0);
- GLINT_SLOW_WRITE_REG(0, FBWriteBufAddr0);
- GLINT_SLOW_WRITE_REG(0, FBSrcReadBufOffset0);
- GLINT_SLOW_WRITE_REG(0, FBDstReadBufOffset0);
- GLINT_SLOW_WRITE_REG(0, FBWriteBufOffset0);
- GLINT_SLOW_WRITE_REG(0xff00ffff, FBDstReadEnables);
-
- switch (pScrn->bitsPerPixel) {
- case 8:
- GLINT_SLOW_WRITE_REG(0x2, PixelSize);
- break;
- case 16:
- GLINT_SLOW_WRITE_REG(0x1, PixelSize);
- break;
- case 32:
- GLINT_SLOW_WRITE_REG(0x0, PixelSize);
- break;
- }
-
TRACE_EXIT("Permedia3InitializeEngine");
}
@@ -290,155 +364,109 @@ Permedia3AccelInit(ScreenPtr pScreen)
Permedia3InitializeEngine(pScrn);
- infoPtr->Flags = PIXMAP_CACHE |
- OFFSCREEN_PIXMAPS |
- LINEAR_FRAMEBUFFER;
+ /* Generic accel engine flags */
+ infoPtr->Flags =
+ PIXMAP_CACHE |
+ OFFSCREEN_PIXMAPS |
+ LINEAR_FRAMEBUFFER;
+ /* Synchronization of the accel engine */
infoPtr->Sync = Permedia3Sync;
+ /* Clipping Setup */
+ infoPtr->ClippingFlags = 0;
+ /* This does not work correctly, i don't know why, but i guess it is
+ * because the clipping stuff is not ok ...
+ * Let's disable it for now (also in the respective functions, we
+ * clear the UserScissorEnable bit in Render2D.
+ HARDWARE_CLIP_MONO_8x8_FILL |
+ HARDWARE_CLIP_SOLID_FILL;
+ */
infoPtr->SetClippingRectangle = Permedia3SetClippingRectangle;
infoPtr->DisableClipping = Permedia3DisableClipping;
- infoPtr->ClippingFlags = HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY;
-#if 0
+ /* ScreenToScreenCopy */
+ infoPtr->ScreenToScreenCopyFlags =
+ NO_TRANSPARENCY;
+ infoPtr->SetupForScreenToScreenCopy =
+ Permedia3SetupForScreenToScreenCopy;
+ infoPtr->SubsequentScreenToScreenCopy =
+ Permedia3SubsequentScreenToScreenCopy;
+
+ /* SolidFill */
infoPtr->SolidFillFlags = 0;
- infoPtr->WriteBitmapFlags = 0;
- if (pScrn->bitsPerPixel == 24) {
- /* SVEN : This should be bad also,
- * didn't tested it since 24bpp is broken....
- infoPtr->SetupForSolidFill =
- Permedia3SetupFortillRectSolid24bpp;
- infoPtr->SubsequentSolidFillRect =
- Permedia3SubsequentFillRectSolid24bpp;
- */
- } else {
- infoPtr->SolidLineFlags = 0;
- infoPtr->PolySegmentThinSolidFlags = 0;
- infoPtr->PolylinesThinSolidFlags = 0;
- infoPtr->SetupForSolidLine = Permedia3SetupForSolidLine;
- if (!(pScrn->overlayFlags & OVERLAY_8_32_PLANAR))
- {
- infoPtr->SubsequentSolidBresenhamLine =
- Permedia3SubsequentSolidBresenhamLine;
- }
- infoPtr->PolySegmentThinSolid = Permedia3PolySegmentThinSolidWrapper;
- infoPtr->PolylinesThinSolid = Permedia3PolylinesThinSolidWrapper;
- }
infoPtr->SetupForSolidFill = Permedia3SetupForFillRectSolid;
infoPtr->SubsequentSolidFillRect = Permedia3SubsequentFillRectSolid;
-#endif
-
- infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY;
- infoPtr->SetupForScreenToScreenCopy =
- Permedia3SetupForScreenToScreenCopy;
- infoPtr->SubsequentScreenToScreenCopy =
- Permedia3SubsequentScreenToScreenCopy;
-#if 0
+ /* 8x8 Mono Pattern Fills */
infoPtr->Mono8x8PatternFillFlags =
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN |
- HARDWARE_PATTERN_PROGRAMMED_BITS |
- HARDWARE_PATTERN_SCREEN_ORIGIN;
-
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN |
+ HARDWARE_PATTERN_PROGRAMMED_BITS |
+ HARDWARE_PATTERN_SCREEN_ORIGIN |
+ BIT_ORDER_IN_BYTE_LSBFIRST;
infoPtr->SetupForMono8x8PatternFill =
- Permedia3SetupForMono8x8PatternFill;
+ Permedia3SetupForMono8x8PatternFill;
infoPtr->SubsequentMono8x8PatternFillRect =
- Permedia3SubsequentMono8x8PatternFillRect;
-#endif
-
-#if 0
- if (pGlint->UsePCIRetry) {
- infoPtr->CPUToScreenColorExpandFillFlags = SYNC_AFTER_COLOR_EXPAND |
- BIT_ORDER_IN_BYTE_LSBFIRST |
- CPU_TRANSFER_PAD_DWORD;
-
- infoPtr->ColorExpandBase = pGlint->IOBase + OutputFIFO + 4;
- infoPtr->SetupForCPUToScreenColorExpandFill =
- Permedia3SetupForCPUToScreenColorExpandFill;
- infoPtr->SubsequentCPUToScreenColorExpandFill =
- Permedia3SubsequentCPUToScreenColorExpandFill;
- } else {
- infoPtr->ScanlineCPUToScreenColorExpandFillFlags =
- BIT_ORDER_IN_BYTE_LSBFIRST;
-
- infoPtr->NumScanlineColorExpandBuffers = 1;
- infoPtr->ScanlineColorExpandBuffers =
- pGlint->XAAScanlineColorExpandBuffers;
- pGlint->XAAScanlineColorExpandBuffers[0] =
- pGlint->IOBase + OutputFIFO + 4;
-
- infoPtr->SetupForScanlineCPUToScreenColorExpandFill =
- Permedia3SetupForScanlineCPUToScreenColorExpandFill;
- infoPtr->SubsequentScanlineCPUToScreenColorExpandFill =
- Permedia3SubsequentScanlineCPUToScreenColorExpandFill;
- infoPtr->SubsequentColorExpandScanline =
- Permedia3SubsequentColorExpandScanline;
- }
-#endif
-
- infoPtr->ColorExpandRange = MAX_FIFO_ENTRIES;
-
-#if 0
- infoPtr->WriteBitmap = Permedia3WriteBitmap;
-
- if (pScrn->bitsPerPixel == 8)
- infoPtr->WritePixmap = Permedia3WritePixmap8bpp;
- else
- if (pScrn->bitsPerPixel == 16)
- infoPtr->WritePixmap = Permedia3WritePixmap16bpp;
- else
- if (pScrn->bitsPerPixel == 24) {
- infoPtr->WritePixmap = Permedia3WritePixmap24bpp;
- infoPtr->WritePixmapFlags |= NO_PLANEMASK;
- }
- else
- if (pScrn->bitsPerPixel == 32)
- infoPtr->WritePixmap = Permedia3WritePixmap32bpp;
-#endif
-
- /* Now fixup if we are 24bpp */
- if (pScrn->bitsPerPixel == 24) {
- infoPtr->SolidFillFlags |= NO_PLANEMASK;
- infoPtr->ScreenToScreenCopyFlags |= NO_PLANEMASK;
- infoPtr->WriteBitmapFlags |= NO_PLANEMASK;
- infoPtr->CPUToScreenColorExpandFillFlags |= NO_PLANEMASK;
- infoPtr->ScanlineCPUToScreenColorExpandFillFlags |= NO_PLANEMASK;
- infoPtr->Mono8x8PatternFillFlags |= NO_PLANEMASK;
- }
-
+ Permedia3SubsequentMono8x8PatternFillRect;
+
+ /* Color Expand Fills */
+ infoPtr->CPUToScreenColorExpandFillFlags =
+ SYNC_AFTER_COLOR_EXPAND |
+ LEFT_EDGE_CLIPPING |
+ BIT_ORDER_IN_BYTE_LSBFIRST |
+ CPU_TRANSFER_BASE_FIXED |
+ CPU_TRANSFER_PAD_DWORD;
+ infoPtr->ColorExpandBase = pGlint->IOBase + BitMaskPattern;
+ infoPtr->ColorExpandRange = 4;
+ infoPtr->SetupForCPUToScreenColorExpandFill =
+ Permedia3SetupForCPUToScreenColorExpandFill;
+ infoPtr->SubsequentCPUToScreenColorExpandFill =
+ Permedia3SubsequentCPUToScreenColorExpandFill;
+
+ /* Images Writes */
+ infoPtr->ImageWriteFlags =
+ NO_GXCOPY |
+ SYNC_AFTER_IMAGE_WRITE |
+ LEFT_EDGE_CLIPPING |
+ BIT_ORDER_IN_BYTE_LSBFIRST |
+ CPU_TRANSFER_BASE_FIXED |
+ CPU_TRANSFER_PAD_DWORD;
+ infoPtr->ImageWriteBase = pGlint->IOBase + PM3FBSourceData;
+ infoPtr->ImageWriteRange = 8;
+ infoPtr->SetupForImageWrite =
+ Permedia3SetupForImageWrite;
+ infoPtr->SubsequentImageWriteRect =
+ Permedia3SubsequentImageWriteRect;
+
AvailFBArea.x1 = 0;
AvailFBArea.y1 = 0;
AvailFBArea.x2 = pScrn->displayWidth;
- AvailFBArea.y2 = ((pGlint->FbMapSize > 16384*1024) ? 16384*1024 : pGlint->FbMapSize) / (pScrn->displayWidth *
+ AvailFBArea.y2 = pGlint->FbMapSize / (pScrn->displayWidth *
pScrn->bitsPerPixel / 8);
+ /* Alan does this ???
+ AvailFBArea.y2 = ((pGlint->FbMapSize > 16384*1024) ? 16384*1024 :
+ pGlint->FbMapSize) / (pScrn->displayWidth
+ pScrn->bitsPerPixel / 8);
+ */
+ /* Permedia3 has a maximum 4096x4096 framebuffer */
if (AvailFBArea.y2 > 4095) AvailFBArea.y2 = 4095;
xf86InitFBManager(pScreen, &AvailFBArea);
+ Permedia3Sync(pScrn);
return(XAAInit(pScreen, infoPtr));
}
-static void Permedia3LoadCoord(
- ScrnInfoPtr pScrn,
- int x, int y,
- int w, int h
-){
- GLINTPtr pGlint = GLINTPTR(pScrn);
-
- if ((h != pGlint->h) || (w != pGlint->w)) {
- pGlint->w = w;
- pGlint->h = h;
- GLINT_WRITE_REG(((h&0x0FFF)<<16)|(w&0x0FFF), RectangleSize);
- }
- if ((y != pGlint->y) || (x != pGlint->x)) {
- pGlint->x = x;
- pGlint->y = y;
- GLINT_WRITE_REG(((y&0x0FFF)<<16)|(x&0x0FFF), RectangleOrigin);
- }
+#define CHECKCLIPPING \
+{ \
+ if (pGlint->ClippingOn) { \
+ pGlint->ClippingOn = FALSE; \
+ GLINT_WAIT(1); \
+ GLINT_WRITE_REG(0, ScissorMode); \
+ } \
}
-
void
Permedia3Sync(ScrnInfoPtr pScrn)
{
@@ -451,8 +479,7 @@ Permedia3Sync(ScrnInfoPtr pScrn)
GLINT_WRITE_REG(0, GlintSync);
do {
while(GLINT_READ_REG(OutFIFOWords) == 0);
-#define Sync_tag 0x188
- } while (GLINT_READ_REG(OutputFIFO) != Sync_tag);
+ } while (GLINT_READ_REG(OutputFIFO) != PM3SyncTag);
}
static void
@@ -465,7 +492,6 @@ Permedia3SetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2)
GLINT_WRITE_REG(1, ScissorMode);
pGlint->ClippingOn = TRUE;
}
-
static void
Permedia3DisableClipping(ScrnInfoPtr pScrn)
{
@@ -473,6 +499,7 @@ Permedia3DisableClipping(ScrnInfoPtr pScrn)
CHECKCLIPPING;
}
+/* ScreenToScreenCopy definition */
static void
Permedia3SetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
int xdir, int ydir, int rop,
@@ -480,232 +507,143 @@ Permedia3SetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
{
GLINTPtr pGlint = GLINTPTR(pScrn);
TRACE_ENTER("Permedia3SetupForScreenToScreenCopy");
-
- pGlint->BltScanDirection = 0;
- if (xdir == 1) pGlint->BltScanDirection |= 1<<28;
- if (ydir == 1) pGlint->BltScanDirection |= 1<<29;
-
- GLINT_WAIT(5);
- DO_PLANEMASK(planemask);
-
- GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode);
- GLINT_WRITE_REG(UNIT_ENABLE /*| FBSRM_Blocking*/, FBSrcReadMode);
- if ((rop == GXcopy) || (rop == GXcopyInverted)) {
- GLINT_WRITE_REG(UNIT_DISABLE, FBDstReadMode);
- } else {
- GLINT_WRITE_REG(UNIT_ENABLE | FBDRM_Enable0 /*| FBDRM_Blocking*/, FBDstReadMode);
+ pGlint->PM3_Render2D =
+ PM3Render2D_SpanOperation |
+ PM3Render2D_Operation_Normal;
+ pGlint->ClippingOn = TRUE;
+ pGlint->PM3_Config2D =
+ PM3Config2D_UserScissorEnable |
+ PM3Config2D_ForegroundROPEnable |
+ PM3Config2D_ForegroundROP(rop) |
+ PM3Config2D_FBWriteEnable;
+ if (xdir == 1) pGlint->PM3_Render2D |= PM3Render2D_XPositive;
+ if (ydir == 1) pGlint->PM3_Render2D |= PM3Render2D_YPositive;
+ if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXnoop)&&(rop!=GXinvert)) {
+ pGlint->PM3_Render2D |= PM3Render2D_FBSourceReadEnable;
+ pGlint->PM3_Config2D |= PM3Config2D_Blocking;
}
- GLINT_WRITE_REG(rop<<1|1, LogicalOpMode);
+ if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted))
+ pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable;
+ GLINT_WAIT(2);
+ DO_PLANEMASK(planemask);
+ GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D);
TRACE_EXIT("Permedia3SetupForScreenToScreenCopy");
}
-
static void
Permedia3SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1,
int x2, int y2, int w, int h)
{
GLINTPtr pGlint = GLINTPTR(pScrn);
-
+ /* Spans needs to be 32 bit aligned. */
+ int x_align = x1 & 0x1f;
TRACE_ENTER("Permedia3SubsequentScreenToScreenCopy");
-
- GLINT_WAIT(3);
- GLINT_WRITE_REG(y2<<16 | x2, RectanglePosition);
- GLINT_WRITE_REG((y1-y2)<<16 | (x1-x2) & 0xffff, FBSrcReadBufOffset0);
- GLINT_WRITE_REG(w | 3<<14| h<<16 | pGlint->BltScanDirection, Render2D);
-}
-
-
-
-static void
-Permedia3PolylinesThinSolidWrapper(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pPts
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- GLINTPtr pGlint = GLINTPTR(infoRec->pScrn);
- pGlint->CurrentGC = pGC;
- pGlint->CurrentDrawable = pDraw;
- if(infoRec->NeedToSync) (*infoRec->Sync)(infoRec->pScrn);
- XAAPolyLines(pDraw, pGC, mode, npt, pPts);
-}
-
-static void
-Permedia3PolySegmentThinSolidWrapper(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nseg,
- xSegment *pSeg
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- GLINTPtr pGlint = GLINTPTR(infoRec->pScrn);
- pGlint->CurrentGC = pGC;
- pGlint->CurrentDrawable = pDraw;
- if(infoRec->NeedToSync) (*infoRec->Sync)(infoRec->pScrn);
- XAAPolySegment(pDraw, pGC, nseg, pSeg);
-}
-
-static void
-Permedia3SetupForSolidLine(ScrnInfoPtr pScrn, int color,
- int rop, unsigned int planemask)
-{
- GLINTPtr pGlint = GLINTPTR(pScrn);
-
- GLINT_WAIT(6);
- DO_PLANEMASK(planemask);
- GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode);
- GLINT_WRITE_REG(color, GLINTColor);
- if (rop == GXcopy) {
- GLINT_WRITE_REG(pGlint->pprod, FBReadMode);
- } else {
- GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode);
- }
- LOADROP(rop);
-}
-
-static void
-Permedia3SubsequentSolidBresenhamLine( ScrnInfoPtr pScrn,
- int x, int y, int dmaj, int dmin, int e, int len, int octant)
-{
- GLINTPtr pGlint = GLINTPTR(pScrn);
-
- if(dmaj == dmin) {
- GLINT_WAIT(6);
- if(octant & YDECREASING) {
- GLINT_WRITE_REG(-1<<16, dY);
- } else {
- GLINT_WRITE_REG(1<<16, dY);
- }
-
- if(octant & XDECREASING) {
- GLINT_WRITE_REG(-1<<16, dXDom);
- } else {
- GLINT_WRITE_REG(1<<16, dXDom);
- }
-
- GLINT_WRITE_REG(x<<16, StartXDom);
- GLINT_WRITE_REG(y<<16, StartY);
- GLINT_WRITE_REG(len,GLINTCount);
- GLINT_WRITE_REG(PrimitiveLine, Render);
- return;
- }
-
- fbBres(pGlint->CurrentDrawable, pGlint->CurrentGC, 0,
- (octant & XDECREASING) ? -1 : 1,
- (octant & YDECREASING) ? -1 : 1,
- (octant & YMAJOR) ? Y_AXIS : X_AXIS,
- x, y, dmin + e, dmin, -dmaj, len);
+ GLINT_WAIT(5);
+ GLINT_WRITE_REG(((y2&0x0fff)<<16)|(x2&0x0fff), ScissorMinXY);
+ GLINT_WRITE_REG((((y2+h)&0x0fff)<<16)|((x2+w)&0x0fff), ScissorMaxXY);
+ GLINT_WRITE_REG(
+ PM3RectanglePosition_XOffset(x2-x_align) |
+ PM3RectanglePosition_YOffset(y2),
+ PM3RectanglePosition);
+ GLINT_WRITE_REG(
+ PM3FBSourceReadBufferOffset_XOffset(x1-x2)|
+ PM3FBSourceReadBufferOffset_YOffset(y1-y2),
+ PM3FBSourceReadBufferOffset);
+ GLINT_WRITE_REG(pGlint->PM3_Render2D |
+ PM3Render2D_Width(w+x_align)|
+ PM3Render2D_Height(h),
+ PM3Render2D);
+ TRACE_EXIT("Permedia3SubsequentScreenToScreenCopy");
}
+/* Solid Fills */
static void
Permedia3SetupForFillRectSolid(ScrnInfoPtr pScrn, int color,
int rop, unsigned int planemask)
{
GLINTPtr pGlint = GLINTPTR(pScrn);
TRACE_ENTER("Permedia3SetupForFillRectSolid");
-
REPLICATE(color);
- GLINT_WAIT(4);
+ /* Prepapre Common Render2D & Config2D data */
+ pGlint->PM3_Render2D =
+ PM3Render2D_SpanOperation |
+ PM3Render2D_XPositive |
+ PM3Render2D_YPositive |
+ PM3Render2D_Operation_Normal;
+ pGlint->PM3_Config2D =
+ PM3Config2D_UseConstantSource |
+ PM3Config2D_ForegroundROPEnable |
+ PM3Config2D_ForegroundROP(rop) |
+ PM3Config2D_FBWriteEnable;
+ if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted))
+ pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable;
+ /* Clipping is not working ok yet, let's disable it.
+ if (pGlint->ClippingOn)
+ pGlint->PM3_Config2D |= PM3Config2D_UserScissorEnable;
+ */
+ GLINT_WAIT(3);
+ /* Using FBClockColor (have to disable SpanOperation) will fill only the
+ * first 32 pixels of the 64 pixels of a span. Lets use ForegroundColor
+ * instead (from the LogicOps unit)
+ GLINT_WRITE_REG(color, PM3FBBlockColor);
+ */
+ GLINT_WRITE_REG(color, PM3ForegroundColor);
DO_PLANEMASK(planemask);
- GLINT_WRITE_REG(color, FBBlockColor);
- if ((rop == GXcopy) || (rop == GXcopyInverted)) {
- GLINT_WRITE_REG(UNIT_DISABLE, FBDstReadMode);
- } else {
- GLINT_WRITE_REG(UNIT_ENABLE | FBDRM_Enable0 /*| FBDRM_Blocking*/, FBDstReadMode);
- }
- GLINT_WRITE_REG(rop<<1| 1, LogicalOpMode);
+ GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D);
TRACE_EXIT("Permedia3SetupForFillRectSolid");
}
-
static void
Permedia3SubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, int y, int w, int h)
{
GLINTPtr pGlint = GLINTPTR(pScrn);
TRACE_ENTER("Permedia3SubsequentFillRectSolid");
-
- GLINT_WAIT(3);
- GLINT_WRITE_REG(y<<16 | x, RectanglePosition);
- GLINT_WRITE_REG(w | 3<<28 | h<<16, Render2D);
+ GLINT_WAIT(2);
+ GLINT_WRITE_REG(
+ PM3RectanglePosition_XOffset(x) |
+ PM3RectanglePosition_YOffset(y),
+ PM3RectanglePosition);
+ GLINT_WRITE_REG(pGlint->PM3_Render2D |
+ PM3Render2D_Width(w) | PM3Render2D_Height(h),
+ PM3Render2D);
TRACE_EXIT("Permedia3SubsequentFillRectSolid");
}
-
-static void MoveBYTE(
- register CARD32* dest,
- register unsigned char* src,
- register int dwords
-)
-{
- while(dwords) {
- *dest = *src;
- src += 1;
- dest += 1;
- dwords -= 1;
- }
-}
-
-static void MoveWORDS(
- register CARD32* dest,
- register unsigned short* src,
- register int dwords
-)
-{
- while(dwords & ~0x01) {
- *dest = *src;
- *(dest + 1) = *(src + 1);
- src += 2;
- dest += 2;
- dwords -= 2;
- }
- switch(dwords) {
- case 0: return;
- case 1: *dest = *src;
- return;
- }
-}
-
-static void MoveDWORDS(
- register CARD32* dest,
- register CARD32* src,
- register int dwords )
-{
- while(dwords & ~0x03) {
- *dest = *src;
- *(dest + 1) = *(src + 1);
- *(dest + 2) = *(src + 2);
- *(dest + 3) = *(src + 3);
- src += 4;
- dest += 4;
- dwords -= 4;
- }
- if (!dwords) return;
- *dest = *src;
- if (dwords == 1) return;
- *(dest + 1) = *(src + 1);
- if (dwords == 2) return;
- *(dest + 2) = *(src + 2);
-}
-
+/* 8x8 Mono Pattern Fills */
static void
Permedia3SetupForMono8x8PatternFill(ScrnInfoPtr pScrn,
- int patternx, int patterny,
- int fg, int bg, int rop,
- unsigned int planemask)
+ int patternx, int patterny,
+ int fg, int bg, int rop,
+ unsigned int planemask)
{
GLINTPtr pGlint = GLINTPTR(pScrn);
TRACE_ENTER("Permedia3SetupForMono8x8PatternFill");
-
- GLINT_WAIT(14);
-
- GLINT_WRITE_REG(fg, ForegroundColor);
- pGlint->FrameBufferReadMode = 0;
-
+ REPLICATE(fg);
+ pGlint->PM3_Render2D =
+ PM3Render2D_AreaStippleEnable |
+ PM3Render2D_SpanOperation |
+ PM3Render2D_XPositive |
+ PM3Render2D_YPositive |
+ PM3Render2D_Operation_Normal;
+ pGlint->PM3_Config2D =
+ PM3Config2D_UseConstantSource |
+ PM3Config2D_ForegroundROPEnable |
+ PM3Config2D_ForegroundROP(rop) |
+ PM3Config2D_FBWriteEnable;
+ if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted))
+ pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable;
+ /* Clipping is not working correctly yet ...
+ if (pGlint->ClippingOn)
+ pGlint->PM3_Config2D |= PM3Config2D_UserScissorEnable;
+ */
+ pGlint->PM3_AreaStippleMode = 1;
+ pGlint->PM3_AreaStippleMode |= (2<<1);
+ pGlint->PM3_AreaStippleMode |= (2<<4);
if (bg != -1) {
+ REPLICATE(bg);
+ pGlint->PM3_Config2D |= PM3Config2D_OpaqueSpan;
+ pGlint->PM3_AreaStippleMode |= 1<<20;
+ GLINT_WAIT(12);
GLINT_WRITE_REG(bg, BackgroundColor);
- pGlint->FrameBufferReadMode = 1<<20;
}
-
- DO_PLANEMASK(planemask);
+ else GLINT_WAIT(11);
GLINT_WRITE_REG((patternx & 0xFF), AreaStipplePattern0);
GLINT_WRITE_REG((patternx & 0xFF00) >> 8, AreaStipplePattern1);
GLINT_WRITE_REG((patternx & 0xFF0000) >> 16, AreaStipplePattern2);
@@ -714,848 +652,121 @@ Permedia3SetupForMono8x8PatternFill(ScrnInfoPtr pScrn,
GLINT_WRITE_REG((patterny & 0xFF00) >> 8, AreaStipplePattern5);
GLINT_WRITE_REG((patterny & 0xFF0000) >> 16, AreaStipplePattern6);
GLINT_WRITE_REG((patterny & 0xFF000000) >> 24, AreaStipplePattern7);
-
- if ((rop == GXcopy) || (rop == GXcopyInverted)) {
- GLINT_WRITE_REG(UNIT_DISABLE, FBDstReadMode);
- } else {
- GLINT_WRITE_REG(UNIT_ENABLE | FBDRM_Enable0 /*| FBDRM_Blocking*/, FBDstReadMode);
- }
-
- GLINT_WRITE_REG(rop<<1 | 1, LogicalOpMode);
+ GLINT_WRITE_REG(fg, PM3ForegroundColor);
+ DO_PLANEMASK(planemask);
+ GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D);
TRACE_EXIT("Permedia3SetupForMono8x8PatternFill");
}
-
static void
Permedia3SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn,
- int patternx, int patterny,
- int x, int y,
- int w, int h)
+ int x_offset, int y_offset,
+ int x, int y, int w, int h)
{
GLINTPtr pGlint = GLINTPTR(pScrn);
-
- TRACE_ENTER("Permedia3SubsequentMono8x8PatternFillRect()");
-
- GLINT_WAIT(4);
- GLINT_WRITE_REG(pGlint->FrameBufferReadMode|patternx<<7|patterny<<12|2<<1|2<<4|STIPPLE_SWAP|UNIT_ENABLE, AreaStippleMode);
- GLINT_WRITE_REG(y<<16 | x, RectanglePosition);
- GLINT_WRITE_REG(w | 1<<30 | 3<<28 |h<<16, Render2D);
-
- TRACE_EXIT("Permedia3SubsequentMono8x8PatternFillRect()");
+ TRACE_ENTER("Permedia3SubsequentMono8x8PatternFillRect");
+ GLINT_WAIT(3);
+ GLINT_WRITE_REG(
+ PM3RectanglePosition_XOffset(x) |
+ PM3RectanglePosition_YOffset(y),
+ PM3RectanglePosition);
+ GLINT_WRITE_REG(
+ (x_offset&0x7)<<7 | (y_offset&0x7)<<12 |
+ pGlint->PM3_AreaStippleMode,
+ AreaStippleMode);
+ GLINT_WRITE_REG(pGlint->PM3_Render2D |
+ PM3Render2D_Width(w) | PM3Render2D_Height(h),
+ PM3Render2D);
+ TRACE_EXIT("Permedia3SubsequentMono8x8PatternFillRect");
}
-static void
-Permedia3SetupForCPUToScreenColorExpandFill(
- ScrnInfoPtr pScrn,
- int fg, int bg,
- int rop,
- unsigned int planemask
-){
+/* Color Expansion Fills */
+static void Permedia3SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,unsigned int planemask)
+{
GLINTPtr pGlint = GLINTPTR(pScrn);
- int dobackground = 0;
-
TRACE_ENTER("Permedia3SetupForCPUToScreenColorExpandFill");
- if (bg != -1) dobackground |= ForceBackgroundColor;
-
- GLINT_WAIT(7);
- DO_PLANEMASK(planemask);
- if (rop == GXcopy) {
- GLINT_WRITE_REG(pGlint->pprod, FBReadMode);
- } else {
- GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode);
- }
-
- pGlint->ForeGroundColor = fg;
- pGlint->BackGroundColor = bg;
REPLICATE(fg);
- REPLICATE(bg);
-
- if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) {
- GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode);
- if (dobackground) {
- GLINT_WRITE_REG(bg, FBBlockColor);
- } else {
- GLINT_WRITE_REG(fg, FBBlockColor);
- }
- GLINT_WRITE_REG(pGlint->RasterizerSwap,RasterizerMode);
- pGlint->FrameBufferReadMode = FastFillEnable;
- } else {
- GLINT_WRITE_REG(UNIT_ENABLE, ColorDDAMode);
- GLINT_WRITE_REG(BitMaskPackingEachScanline|dobackground|
- pGlint->RasterizerSwap,RasterizerMode);
- GLINT_WRITE_REG(fg, ConstantColor);
- if (dobackground) {
- pGlint->FrameBufferReadMode = TextureEnable;
- GLINT_WRITE_REG(bg, Texel0);
- } else
- pGlint->FrameBufferReadMode = 0;
+ pGlint->PM3_Render2D =
+ PM3Render2D_SpanOperation |
+ PM3Render2D_XPositive |
+ PM3Render2D_YPositive |
+ PM3Render2D_Operation_SyncOnBitMask;
+ pGlint->PM3_Config2D =
+ PM3Config2D_UserScissorEnable |
+ PM3Config2D_UseConstantSource |
+ PM3Config2D_ForegroundROPEnable |
+ PM3Config2D_ForegroundROP(rop) |
+ PM3Config2D_FBWriteEnable;
+ if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted))
+ pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable;
+ if (bg != -1) {
+ REPLICATE(bg);
+ pGlint->PM3_Config2D |= PM3Config2D_OpaqueSpan;
+ GLINT_WAIT(4);
+ GLINT_WRITE_REG(bg, BackgroundColor);
}
- LOADROP(rop);
+ else GLINT_WAIT(3);
+ GLINT_WRITE_REG(fg, PM3ForegroundColor);
+ DO_PLANEMASK(planemask);
+ GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D);
TRACE_EXIT("Permedia3SetupForCPUToScreenColorExpandFill");
}
-
-static void
-Permedia3SubsequentCPUToScreenColorExpandFill(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- int skipleft
-){
+static void Permedia3SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft)
+{
GLINTPtr pGlint = GLINTPTR(pScrn);
- int dwords = ((w + 31) >> 5) * h;
-
TRACE_ENTER("Permedia3SubsequentCPUToScreenColorExpandFill");
- GLINT_WAIT(8);
- Permedia3LoadCoord(pScrn, x, y, w, h);
-
- if ((pGlint->ROP == GXcopy) && (pGlint->BackGroundColor != -1)) {
- GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive | FastFillEnable, Render);
- REPLICATE(pGlint->ForeGroundColor)
- GLINT_WRITE_REG(pGlint->ForeGroundColor, FBBlockColor);
- }
-
- GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive | SyncOnBitMask |
- pGlint->FrameBufferReadMode, Render);
- GLINT_WRITE_REG((dwords - 1)<<16 | 0x0D, OutputFIFO);
- GLINT_WAIT(dwords);
+ GLINT_WAIT(4);
+ GLINT_WRITE_REG(((y&0x0fff)<<16)|((x+skipleft)&0x0fff), ScissorMinXY);
+ GLINT_WRITE_REG((((y+h)&0x0fff)<<16)|((x+w)&0x0fff), ScissorMaxXY);
+ GLINT_WRITE_REG(
+ PM3RectanglePosition_XOffset(x) |
+ PM3RectanglePosition_YOffset(y),
+ PM3RectanglePosition);
+ GLINT_WRITE_REG(pGlint->PM3_Render2D |
+ PM3Render2D_Width(w) | PM3Render2D_Height(h),
+ PM3Render2D);
TRACE_EXIT("Permedia3SubsequentCPUToScreenColorExpandFill");
}
-static void
-Permedia3SetupForScanlineCPUToScreenColorExpandFill(
- ScrnInfoPtr pScrn,
- int fg, int bg,
- int rop,
- unsigned int planemask
-){
- GLINTPtr pGlint = GLINTPTR(pScrn);
- int dobackground = 0;
-
- TRACE_ENTER("Permedia3SetupForScanlineCPUToScreenColorExpandFill");
- if (bg != -1) dobackground |= ForceBackgroundColor;
- pGlint->BackGroundColor = bg;
- pGlint->ForeGroundColor = fg;
- REPLICATE(fg);
- REPLICATE(bg);
- GLINT_WAIT(7);
- DO_PLANEMASK(planemask);
- if (rop == GXcopy) {
- GLINT_WRITE_REG(pGlint->pprod, FBReadMode);
- } else {
- GLINT_WRITE_REG(pGlint->pprod|FBRM_DstEnable, FBReadMode);
- }
- if ((rop == GXcopy) && (pGlint->BackGroundColor == -1)) {
- pGlint->FrameBufferReadMode = FastFillEnable;
- GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode);
- GLINT_WRITE_REG(fg, FBBlockColor);
- GLINT_WRITE_REG(pGlint->RasterizerSwap,RasterizerMode);
- } else {
- GLINT_WRITE_REG(UNIT_ENABLE, ColorDDAMode);
- GLINT_WRITE_REG(fg, ConstantColor);
- GLINT_WRITE_REG(BitMaskPackingEachScanline|dobackground|
- pGlint->RasterizerSwap,RasterizerMode);
- if (dobackground) {
- GLINT_WRITE_REG(bg, Texel0);
- pGlint->FrameBufferReadMode = TextureEnable;
- } else {
- pGlint->FrameBufferReadMode = 0;
- }
- }
- LOADROP(rop);
- TRACE_EXIT("Permedia3SetupForScanlineCPUToScreenColorExpandFill");
-}
-
-static void
-Permedia3SubsequentScanlineCPUToScreenColorExpandFill(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- int skipleft
-){
- GLINTPtr pGlint = GLINTPTR(pScrn);
-
- TRACE_ENTER("Permedia3SubsequentScanlineCPUToScreenColorExpandFill");
-
- pGlint->dwords = ((w + 31) >> 5); /* dwords per scanline */
-
- pGlint->cpucount = h;
-
- GLINT_WAIT(6);
- Permedia3LoadCoord(pScrn, x, y, w, h);
- GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive | pGlint->FrameBufferReadMode | SyncOnBitMask, Render);
- GLINT_WRITE_REG(((pGlint->dwords*h)-1)<<16 | 0x0D, OutputFIFO);
- GLINT_WAIT(pGlint->dwords);
- pGlint->cpucount--;
- TRACE_EXIT("Permedia3SubsequentScanlineCPUToScreenColorExpandFill");
-}
-
-static void
-Permedia3SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
+/* Images Writes */
+static void Permedia3SetupForImageWrite(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int trans_color, int bpp, int depth)
{
GLINTPtr pGlint = GLINTPTR(pScrn);
-
- if (pGlint->cpucount--)
- GLINT_WAIT(pGlint->dwords);
-}
-
-
-static void
-Permedia3WriteBitmap(ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- GLINTPtr pGlint = GLINTPTR(pScrn);
- unsigned char *srcpntr;
- int dwords, height, mode;
- Bool SecondPass = FALSE;
-
- TRACE_ENTER("Permedia3WriteBitmap");
-
- w += skipleft;
- x -= skipleft;
- dwords = (w + 31) >> 5;
-
- Permedia3SetClippingRectangle(pScrn,x+skipleft,y,x+w,y+h);
-
- if (pScrn->bitsPerPixel == 24) {
- GLINT_WAIT(10);
- } else {
- GLINT_WAIT(11);
- DO_PLANEMASK(planemask);
- }
- LOADROP(rop);
- Permedia3LoadCoord(pScrn, x&0xFFFF, y, w, h);
- if (rop == GXcopy) {
- GLINT_WRITE_REG(pGlint->pprod, FBReadMode);
- } else {
- GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode);
- }
- if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) {
- mode = FastFillEnable;
- GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode);
- GLINT_WRITE_REG(pGlint->RasterizerSwap,RasterizerMode);
- } else {
- mode = 0;
- GLINT_WRITE_REG(UNIT_ENABLE, ColorDDAMode);
- GLINT_WRITE_REG(BitMaskPackingEachScanline|
- pGlint->RasterizerSwap,RasterizerMode);
- }
-
- if(bg == -1) {
- /* >>>>> set fg <<<<<<<< */
- REPLICATE(fg);
- if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) {
- GLINT_WRITE_REG(fg, FBBlockColor);
- } else {
- GLINT_WRITE_REG(fg, ConstantColor);
- }
- } else if(rop == GXcopy) {
- /* >>>>> set bg <<<<<<< */
- /* >>>>> draw rect (x,y,w,h) */
- REPLICATE(bg);
- if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) {
- GLINT_WRITE_REG(bg, FBBlockColor);
- } else {
- GLINT_WRITE_REG(bg, ConstantColor);
- }
- GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive |mode,Render);
- /* >>>>>> set fg <<<<<< */
- REPLICATE(fg);
- if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) {
- GLINT_WRITE_REG(fg, FBBlockColor);
- } else {
- GLINT_WRITE_REG(fg, ConstantColor);
- }
- } else {
- SecondPass = TRUE;
- /* >>>>> set fg <<<<<<< */
- REPLICATE(fg);
- if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) {
- GLINT_WRITE_REG(fg, FBBlockColor);
- } else {
- GLINT_WRITE_REG(fg, ConstantColor);
- }
- }
-
- /* >>>>>>>>> initiate transfer (x,y,w,h). Skipleft pixels on the
- left edge will be clipped <<<<<< */
-
-SECOND_PASS:
- GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive | mode | SyncOnBitMask, Render);
-
- height = h;
- srcpntr = src;
- while(height--) {
- GLINT_WAIT(dwords);
- /* 0x0D is the TAG value for BitMaskPattern */
- GLINT_WRITE_REG(((dwords - 1) << 16) | 0x0D, OutputFIFO);
- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32 *)srcpntr, dwords);
- srcpntr += srcwidth;
- }
-
- if(SecondPass) {
- SecondPass = FALSE;
- /* >>>>>> invert bitmask and set bg <<<<<<<< */
- REPLICATE(bg);
- GLINT_WAIT(3);
- if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) {
- GLINT_WRITE_REG(InvertBitMask|pGlint->RasterizerSwap,RasterizerMode);
- GLINT_WRITE_REG(bg, FBBlockColor);
- } else {
- GLINT_WRITE_REG(InvertBitMask|BitMaskPackingEachScanline|
- pGlint->RasterizerSwap, RasterizerMode);
- GLINT_WRITE_REG(bg, ConstantColor);
- }
- goto SECOND_PASS;
- }
-
- GLINT_WAIT(1);
- GLINT_WRITE_REG(pGlint->RasterizerSwap, RasterizerMode);
- Permedia3DisableClipping(pScrn);
- SET_SYNC_FLAG(infoRec);
- TRACE_EXIT("Permedia3WriteBitmap");
-}
-
-
-static void
-Permedia3WritePixmap8bpp(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int rop,
- unsigned int planemask,
- int transparency_color,
- int bpp, int depth
-)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- GLINTPtr pGlint = GLINTPTR(pScrn);
- int skipleft, dwords, count;
- CARD32* srcp;
- unsigned char *srcpbyte;
- Bool FastTexLoad = FALSE;
-
- GLINT_WAIT(3);
+ TRACE_ENTER("Permedia3SetupForImageWrite");
+ pGlint->PM3_Render2D =
+ PM3Render2D_SpanOperation |
+ PM3Render2D_XPositive |
+ PM3Render2D_YPositive |
+ PM3Render2D_Operation_SyncOnHostData;
+ pGlint->PM3_Config2D =
+ PM3Config2D_UserScissorEnable |
+ PM3Config2D_ForegroundROPEnable |
+ PM3Config2D_ForegroundROP(rop) |
+ PM3Config2D_FBWriteEnable;
+ if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted))
+ pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable;
+ GLINT_WAIT(2);
DO_PLANEMASK(planemask);
- GLINT_WRITE_REG(pGlint->RasterizerSwap,RasterizerMode);
- if (rop == GXcopy) {
- GLINT_WRITE_REG(pGlint->pprod | FBRM_Packed, FBReadMode);
- } else {
- GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode);
- }
-
- dwords = (w + 3) >> 2;
-#if X_BYTE_ORDER == X_LITTLE_ENDIAN
- if((!(x&3)) && (!(w&3))) FastTexLoad = TRUE;
-#endif
- if((rop != GXcopy) || (planemask != ~0))
- FastTexLoad = FALSE;
-
- if (rop == GXcopy) {
- skipleft = 0;
- } else {
- if((skipleft = (long)src & 0x03)) {
- skipleft /= (bpp>>3);
-
- x -= skipleft;
- w += skipleft;
-
- src = (unsigned char*)((long)src & ~0x03);
- }
- }
-
-
- if(FastTexLoad) {
- int address;
-
- GLINT_WAIT(1);
- GLINT_WRITE_REG(UNIT_DISABLE, FBWriteMode);
- Permedia3Sync(pScrn); /* we are not using the rasterizer */
- while(h--) {
- count = dwords;
- address = ((y * pScrn->displayWidth) + x) >> 2;
- srcp = (CARD32*)src;
- GLINT_WRITE_REG(address, TextureDownloadOffset);
- while(count >= MAX_FIFO_ENTRIES) {
- GLINT_WAIT(MAX_FIFO_ENTRIES);
- /* (0x11 << 4) | 0x0D is the TAG for TextureData */
- GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x11 << 4) |
- 0x0D, OutputFIFO);
- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, MAX_FIFO_ENTRIES - 1);
- count -= MAX_FIFO_ENTRIES - 1;
- address += MAX_FIFO_ENTRIES - 1;
- srcp += MAX_FIFO_ENTRIES - 1;
- }
- if(count) {
- GLINT_WAIT(count + 1);
- /* (0x11 << 4) | 0x0D is the TAG for TextureData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x11 << 4) | 0x0D,
- OutputFIFO);
- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, count);
- }
- src += srcwidth;
- y++;
- }
- GLINT_WAIT(1);
- GLINT_WRITE_REG(UNIT_ENABLE, FBWriteMode);
- } else {
- char align = (x & pGlint->bppalign);
-
-
- GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode);
- if (rop == GXcopy) {
- GLINT_WAIT(6);
- Permedia3LoadCoord(pScrn, x>>pGlint->BppShift, y,
- (w+pGlint->bppalign)>>pGlint->BppShift, h);
- GLINT_WRITE_REG(align<<29|x<<16|(x+w), PackedDataLimits);
- } else {
- Permedia3SetClippingRectangle(pScrn,x+skipleft,y,x+w,y+h);
- GLINT_WAIT(5);
- Permedia3LoadCoord(pScrn, x, y, w, h);
- }
- LOADROP(rop);
- GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive |
- SyncOnHostData, Render);
-
- if (rop == GXcopy) {
- while(h--) {
- count = dwords;
- srcp = (CARD32*)src;
- while(count >= MAX_FIFO_ENTRIES) {
- GLINT_WAIT(MAX_FIFO_ENTRIES);
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, MAX_FIFO_ENTRIES - 1);
- count -= MAX_FIFO_ENTRIES - 1;
- srcp += MAX_FIFO_ENTRIES - 1;
- }
- if(count) {
- GLINT_WAIT(count + 1);
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, count);
- }
- src += srcwidth;
- }
- } else {
- while(h--) {
- count = w;
- srcpbyte = (unsigned char *)src;
- while(count >= MAX_FIFO_ENTRIES) {
- GLINT_WAIT(MAX_FIFO_ENTRIES);
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
- MoveBYTE((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (unsigned char *)srcpbyte, MAX_FIFO_ENTRIES - 1);
- count -= MAX_FIFO_ENTRIES - 1;
- srcpbyte += MAX_FIFO_ENTRIES - 1;
- }
- if(count) {
- GLINT_WAIT(count + 1);
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
- MoveBYTE((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (unsigned char *)srcpbyte, count);
- }
- src += srcwidth;
- }
- }
- }
-
- Permedia3DisableClipping(pScrn);
- SET_SYNC_FLAG(infoRec);
-}
-
-static void
-Permedia3WritePixmap16bpp(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int rop,
- unsigned int planemask,
- int transparency_color,
- int bpp, int depth
-)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- GLINTPtr pGlint = GLINTPTR(pScrn);
- int skipleft, dwords, count;
- CARD32* srcp;
- unsigned short* srcpword;
- Bool FastTexLoad;
-
- TRACE_ENTER("Permedia3WritePixmap16bpp");
- GLINT_WAIT(3);
- DO_PLANEMASK(planemask);
- GLINT_WRITE_REG(pGlint->RasterizerSwap,RasterizerMode);
- if (rop == GXcopy) {
- GLINT_WRITE_REG(pGlint->pprod | FBRM_Packed, FBReadMode);
- } else {
- GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode);
- }
-
- FastTexLoad = FALSE;
- dwords = (w + 1) >> 1;
-#if X_BYTE_ORDER == X_LITTLE_ENDIAN
- if((!(x&1)) && (!(w&1))) FastTexLoad = TRUE;
-#endif
- if((rop != GXcopy) || (planemask != ~0))
- FastTexLoad = FALSE;
-
- if (rop == GXcopy) {
- skipleft = 0;
- } else {
- if((skipleft = (long)src & 0x03L)) {
- skipleft /= (bpp>>3);
-
- x -= skipleft;
- w += skipleft;
-
- src = (unsigned char*)((long)src & ~0x03L);
- }
- }
-
- if(FastTexLoad) {
- int address;
-
- GLINT_WAIT(1);
- GLINT_WRITE_REG(UNIT_DISABLE, FBWriteMode);
- Permedia3Sync(pScrn); /* we are not using the rasterizer */
- while(h--) {
- count = dwords;
- address = ((y * pScrn->displayWidth) + x) >> 1;
- srcp = (CARD32*)src;
- GLINT_WRITE_REG(address, TextureDownloadOffset);
- while(count >= MAX_FIFO_ENTRIES) {
- GLINT_WAIT(MAX_FIFO_ENTRIES);
- /* (0x11 << 4) | 0x0D is the TAG for TextureData */
- GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x11 << 4) |
- 0x0D, OutputFIFO);
- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, MAX_FIFO_ENTRIES - 1);
- count -= MAX_FIFO_ENTRIES - 1;
- address += MAX_FIFO_ENTRIES - 1;
- srcp += MAX_FIFO_ENTRIES - 1;
- }
- if(count) {
- GLINT_WAIT(count + 1);
- /* (0x11 << 4) | 0x0D is the TAG for TextureData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x11 << 4) | 0x0D,
- OutputFIFO);
- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, count);
- }
- src += srcwidth;
- y++;
- }
- GLINT_WAIT(1);
- GLINT_WRITE_REG(UNIT_ENABLE, FBWriteMode);
- } else {
- char align = (x & pGlint->bppalign);
-
-
- GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode);
- if (rop == GXcopy) {
- GLINT_WAIT(6);
- Permedia3LoadCoord(pScrn, x>>pGlint->BppShift, y,
- (w+pGlint->bppalign)>>pGlint->BppShift, h);
- GLINT_WRITE_REG(align<<29|x<<16|(x+w), PackedDataLimits);
- } else {
- Permedia3SetClippingRectangle(pScrn,x+skipleft,y,x+w,y+h);
- GLINT_WAIT(5);
- Permedia3LoadCoord(pScrn, x, y, w, h);
- }
- LOADROP(rop);
- GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive |
- SyncOnHostData, Render);
-
- if (rop == GXcopy) {
- while(h--) {
- count = dwords;
- srcp = (CARD32*)src;
- while(count >= MAX_FIFO_ENTRIES) {
- GLINT_WAIT(MAX_FIFO_ENTRIES);
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, MAX_FIFO_ENTRIES - 1);
- count -= MAX_FIFO_ENTRIES - 1;
- srcp += MAX_FIFO_ENTRIES - 1;
- }
- if(count) {
- GLINT_WAIT(count + 1);
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, count);
- }
- src += srcwidth;
- }
- } else {
- while(h--) {
- count = w;
- srcpword = (unsigned short *)src;
- while(count >= MAX_FIFO_ENTRIES) {
- GLINT_WAIT(MAX_FIFO_ENTRIES);
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
- MoveWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (unsigned short *)srcpword, MAX_FIFO_ENTRIES - 1);
- count -= MAX_FIFO_ENTRIES - 1;
- srcpword += MAX_FIFO_ENTRIES - 1;
- }
- if(count) {
- GLINT_WAIT(count + 1);
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
- MoveWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (unsigned short *)srcpword, count);
- }
- src += srcwidth;
- }
- }
- }
-
- Permedia3DisableClipping(pScrn);
- SET_SYNC_FLAG(infoRec);
- TRACE_EXIT("Permedia3WritePixmap16bpp");
+ GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D);
+ TRACE_EXIT("Permedia3SetupForImageWrite");
}
-
-#if 0
-static void
-Permedia3WritePixmap24bpp(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int rop,
- unsigned int planemask,
- int transparency_color,
- int bpp, int depth
-)
+static void Permedia3SubsequentImageWriteRect(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft)
{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
GLINTPtr pGlint = GLINTPTR(pScrn);
- int skipleft = 0, dwords, count;
- unsigned char* srcpbyte;
- CARD32* srcp;
-
- GLINT_WAIT(3);
- GLINT_WRITE_REG(pGlint->RasterizerSwap,RasterizerMode);
- GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode);
- if (rop == GXcopy) {
- GLINT_WRITE_REG(pGlint->pprod, FBReadMode);
- } else {
- GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode);
- }
-
- dwords = ((w+1)*3)>>2;
- if((skipleft = (long)src & 0x03L)) {
- skipleft = 4 - skipleft;
-
- x -= skipleft;
- w += skipleft;
-
- src = (unsigned char*)(src - (3*skipleft));
- }
-
- {
- Permedia3SetClippingRectangle(pScrn,x+skipleft,y,x+w,y+h);
-
- GLINT_WAIT(4);
- Permedia3LoadCoord(pScrn, x&0xFFFF, y, w, h);
- LOADROP(rop);
- GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive |
- SyncOnHostData, Render);
-
-#if 1
- while(h--) {
- count = w;
- srcpbyte = (unsigned char *)src;
- while(count >= MAX_FIFO_ENTRIES) {
- GLINT_WAIT(MAX_FIFO_ENTRIES);
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
- MoveBYTE((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (unsigned char *)srcpbyte, MAX_FIFO_ENTRIES - 1);
- count -= MAX_FIFO_ENTRIES - 1;
- srcpbyte += MAX_FIFO_ENTRIES - 1;
- }
- if(count) {
- GLINT_WAIT(count + 1);
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
- MoveBYTE((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (unsigned char *)srcpbyte, count);
- }
- src += srcwidth;
-#else
- while(h--) {
- count = dwords;
- srcp = (CARD32*)src;
- while(count >= MAX_FIFO_ENTRIES) {
- GLINT_WAIT(MAX_FIFO_ENTRIES);
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, MAX_FIFO_ENTRIES - 1);
- count -= MAX_FIFO_ENTRIES - 1;
- srcp += MAX_FIFO_ENTRIES - 1;
- }
- if(count) {
- GLINT_WAIT(count + 1);
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, count);
- }
- src += srcwidth;
-#endif
- }
- }
-
- Permedia3DisableClipping(pScrn);
- SET_SYNC_FLAG(infoRec);
+ TRACE_ENTER("Permedia3SubsequentImageWrite");
+ GLINT_WAIT(4);
+ GLINT_WRITE_REG(((y&0x0fff)<<16)|((x+skipleft)&0x0fff), ScissorMinXY);
+ GLINT_WRITE_REG((((y+h)&0x0fff)<<16)|((x+w)&0x0fff), ScissorMaxXY);
+ GLINT_WRITE_REG(
+ PM3RectanglePosition_XOffset(x) |
+ PM3RectanglePosition_YOffset(y),
+ PM3RectanglePosition);
+ GLINT_WRITE_REG(pGlint->PM3_Render2D |
+ PM3Render2D_Width(w) | PM3Render2D_Height(h),
+ PM3Render2D);
+ TRACE_EXIT("Permedia3SubsequentImageWrite");
}
-#endif
-
-static void
-Permedia3WritePixmap32bpp(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int rop,
- unsigned int planemask,
- int transparency_color,
- int bpp, int depth
-)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- GLINTPtr pGlint = GLINTPTR(pScrn);
- int skipleft, dwords, count;
- CARD32* srcp;
- Bool FastTexLoad;
-
- GLINT_WAIT(3);
- DO_PLANEMASK(planemask);
- GLINT_WRITE_REG(pGlint->RasterizerSwap,RasterizerMode);
- if (rop == GXcopy) {
- GLINT_WRITE_REG(pGlint->pprod, FBReadMode);
- } else {
- GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode);
- }
-
- FastTexLoad = TRUE;
- dwords = w;
- if((rop != GXcopy) || (planemask != ~0))
- FastTexLoad = FALSE;
-
- if (!FastTexLoad) {
- if((skipleft = (long)src & 0x03L)) {
- skipleft /= (bpp>>3);
-
- x -= skipleft;
- w += skipleft;
-
- src = (unsigned char*)((long)src & ~0x03L);
- }
- }
-
- if(FastTexLoad) {
- int address;
-
- GLINT_WAIT(1);
- GLINT_WRITE_REG(UNIT_DISABLE, FBWriteMode);
- Permedia3Sync(pScrn); /* we are not using the rasterizer */
- while(h--) {
- count = dwords;
- address = (y * pScrn->displayWidth) + x;
- srcp = (CARD32*)src;
- GLINT_WRITE_REG(address, TextureDownloadOffset);
- while(count >= MAX_FIFO_ENTRIES) {
- GLINT_WAIT(MAX_FIFO_ENTRIES);
- /* (0x11 << 4) | 0x0D is the TAG for TextureData */
- GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x11 << 4) |
- 0x0D, OutputFIFO);
- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, MAX_FIFO_ENTRIES - 1);
- count -= MAX_FIFO_ENTRIES - 1;
- address += MAX_FIFO_ENTRIES - 1;
- srcp += MAX_FIFO_ENTRIES - 1;
- }
- if(count) {
- GLINT_WAIT(count + 1);
- /* (0x11 << 4) | 0x0D is the TAG for TextureData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x11 << 4) | 0x0D,
- OutputFIFO);
- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, count);
- }
- src += srcwidth;
- y++;
- }
- GLINT_WAIT(1);
- GLINT_WRITE_REG(UNIT_ENABLE, FBWriteMode);
- } else {
- Permedia3SetClippingRectangle(pScrn,x+skipleft,y,x+w,y+h);
-
- GLINT_WAIT(6);
- Permedia3LoadCoord(pScrn, x, y, w, h);
- GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode);
- LOADROP(rop);
- GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive |
- SyncOnHostData, Render);
-
- while(h--) {
- count = dwords;
- srcp = (CARD32*)src;
- while(count >= MAX_FIFO_ENTRIES) {
- GLINT_WAIT(MAX_FIFO_ENTRIES);
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, MAX_FIFO_ENTRIES - 1);
- count -= MAX_FIFO_ENTRIES - 1;
- srcp += MAX_FIFO_ENTRIES - 1;
- }
- if(count) {
- GLINT_WAIT(count + 1);
- /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */
- GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) |
- 0x05, OutputFIFO);
- MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4),
- (CARD32*)srcp, count);
- }
- src += srcwidth;
- }
- }
-
- Permedia3DisableClipping(pScrn);
- SET_SYNC_FLAG(infoRec);
-}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c
index 37ee0059f..467d9674f 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c
@@ -1,35 +1,31 @@
/*
- * Copyright 1997,1998 by Alan Hourihane <alanh@fairlite.demon.co.uk>
+ * Copyright 2000 by Sven Luther <luther@dpt-info.u-strasbg.fr>.
*
* 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
+ * documentation, and that the name of Sven Luther not be used in
* advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
+ * specific, written prior permission. Sven Luther 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,
+ * SVEN LUTHER 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
+ * EVENT SHALL SVEN LUTHER 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.
*
* Authors: Sven Luther, <luther@dpt-info.u-strasbg.fr>
- * Thomas Witzel, <twitzel@nmr.mgh.harvard.edu>
- *
- *
- *
- *
+ * Thomas Witzel, <twitzel@nmr.mgh.harvard.edu>
*
* this work is sponsored by Appian Graphics.
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c,v 1.6 2000/09/19 14:12:32 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c,v 1.8 2000/10/26 13:41:32 alanh Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -54,43 +50,17 @@
# define TRACE(str)
#endif
-void
-Permedia3PreInit(ScrnInfoPtr pScrn, GLINTPtr pGlint)
-{
- TRACE_ENTER("Permedia3PreInit");
- if ((pGlint->PciInfo->subsysVendor == 0x1097) &&
- (pGlint->PciInfo->subsysCard == 0x3d32)) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Appian Jeronimo 2000 board detected and initialized.\n\t"
- "subsysVendor = 0x%04x, subsysCard = 0x%04x.\n",
- pGlint->PciInfo->subsysVendor, pGlint->PciInfo->subsysCard);
- /* Memory timings for the Appian J2000 board.
- * This is needed for the second head which is left unitilialized
- * by the bios, thus freezing the machine.
- */
- GLINT_SLOW_WRITE_REG(0x02e311B8, PM3LocalMemCaps);
- GLINT_SLOW_WRITE_REG(0x07424905, PM3LocalMemTimings);
- GLINT_SLOW_WRITE_REG(0x0c000003, PM3LocalMemControl);
- GLINT_SLOW_WRITE_REG(0x00000061, PM3LocalMemRefresh);
- GLINT_SLOW_WRITE_REG(0x00000000, PM3LocalMemPowerDown);
- }
- else xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Unknown Glint Permedia3 board detected.\n\t"
- "subsysVendor = 0x%04x, subsysCard = 0x%04x.\n",
- pGlint->PciInfo->subsysVendor, pGlint->PciInfo->subsysCard);
- TRACE_EXIT("Permedia3PreInit");
-}
+int PM3QuickFillMemory(ScrnInfoPtr pScrn,int size);
int
PM3QuickFillMemory(ScrnInfoPtr pScrn,int size)
{
- GLINTPtr pGlint;
+ GLINTPtr pGlint = GLINTPTR (pScrn);
unsigned int * p;
unsigned int p_content;
unsigned int i, j;
long savemapsize;
- pGlint = GLINTPTR (pScrn);
savemapsize = pGlint->FbMapSize;
pGlint->FbMapSize = size*1024*1024;
@@ -214,6 +184,61 @@ PM3DAC_CalculateClock
return(actualclock);
}
+void
+Permedia3PreInit(ScrnInfoPtr pScrn)
+{
+ GLINTPtr pGlint = GLINTPTR(pScrn);
+ TRACE_ENTER("Permedia3PreInit");
+ if ((pGlint->PciInfo->subsysVendor == 0x1097) &&
+ (pGlint->PciInfo->subsysCard == 0x3d32)) {
+ unsigned char m,n,p;
+ unsigned long clockused;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Appian Jeronimo 2000 board detected and initialized.\n\t"
+ "subsysVendor = 0x%04x, subsysCard = 0x%04x.\n",
+ pGlint->PciInfo->subsysVendor, pGlint->PciInfo->subsysCard);
+
+ /* Memory timings for the Appian J2000 board.
+ * This is needed for the second head which is left unitilialized
+ * by the bios, thus freezing the machine. */
+ GLINT_SLOW_WRITE_REG(0x02e311B8, PM3LocalMemCaps);
+ GLINT_SLOW_WRITE_REG(0x07424905, PM3LocalMemTimings);
+ GLINT_SLOW_WRITE_REG(0x0c000003, PM3LocalMemControl);
+ GLINT_SLOW_WRITE_REG(0x00000061, PM3LocalMemRefresh);
+ GLINT_SLOW_WRITE_REG(0x00000000, PM3LocalMemPowerDown);
+
+ /* Let's program the K, M and S Clocks to the same values as the bios
+ * does for first head :
+ * - KClk and MClk are 105Mhz.
+ * - S Clock is set to PClk.
+ * Note 1 : pGlint->RefClock is not set yet, so use 14318 instead.
+ * Note 2 : KClk gets internally halved, so we need to double it.
+ */
+ clockused = PM3DAC_CalculateClock(2*105000, 14318, &m,&n,&p);
+ Permedia2vOutIndReg(pScrn, PM3RD_KClkPreScale, 0x00, m);
+ Permedia2vOutIndReg(pScrn, PM3RD_KClkFeedbackScale, 0x00, n);
+ Permedia2vOutIndReg(pScrn, PM3RD_KClkPostScale, 0x00, p);
+ Permedia2vOutIndReg(pScrn, PM3RD_KClkControl, 0x00,
+ PM3RD_KClkControl_STATE_RUN |
+ PM3RD_KClkControl_SOURCE_PLL |
+ PM3RD_KClkControl_ENABLE);
+ Permedia2vOutIndReg(pScrn, PM3RD_MClkControl, 0x00,
+ PM3RD_MClkControl_STATE_RUN |
+ PM3RD_MClkControl_SOURCE_KCLK |
+ PM3RD_MClkControl_ENABLE);
+ Permedia2vOutIndReg(pScrn, PM3RD_SClkControl, 0x00,
+ PM3RD_SClkControl_STATE_RUN |
+ PM3RD_SClkControl_SOURCE_PCLK |
+ PM3RD_SClkControl_ENABLE);
+ }
+ else xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Unknown Glint Permedia3 board detected.\n\t"
+ "subsysVendor = 0x%04x, subsysCard = 0x%04x.\n\t"
+ "Let's hope that it is correctly initialized by the bios.\n",
+ pGlint->PciInfo->subsysVendor, pGlint->PciInfo->subsysCard);
+ TRACE_EXIT("Permedia3PreInit");
+}
+
Bool
Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode)
{
@@ -221,19 +246,6 @@ Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode)
GLINTRegPtr pReg = &pGlint->ModeReg;
CARD32 temp1, temp2, temp3, temp4;
- /* Memory timings for the Appian J2000 board
- * This is not ideal, since the work here is duplicated
- * in the Permedia3PreInit function :(((
- */
- if ((pGlint->PciInfo->subsysVendor == 0x1097) &&
- (pGlint->PciInfo->subsysCard == 0x3d32)) {
- pReg->glintRegs[PM3LocalMemCaps >> 3] = 0x02e311B8;
- pReg->glintRegs[PM3LocalMemTimings >> 3] = 0x07424905;
- pReg->glintRegs[PM3LocalMemControl >> 3] = 0x0c000003;
- pReg->glintRegs[PM3LocalMemRefresh >> 3] = 0x00000061;
- }
-
- pReg->glintRegs[PM3LocalMemPowerDown >> 3] = 0x00000000;
pReg->glintRegs[PM3MemBypassWriteMask >> 3] = 0xffffffff;
pReg->glintRegs[PM3ByAperture1Mode >> 3] = 0x00000000;
pReg->glintRegs[PM3ByAperture2Mode >> 3] = 0x00000000;
@@ -316,25 +328,6 @@ Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode)
unsigned char m,n,p;
unsigned long clockused;
- /* Let's program the KClk to 100Mhz and set the S & M Clk too. */
-/* clockused = PM3DAC_CalculateClock(100000,
- pGlint->RefClock, &m,&n,&p);
- pReg->DacRegs[PM3RD_KClkPreScale] = m;
- pReg->DacRegs[PM3RD_KClkFeedbackScale] = n;
- pReg->DacRegs[PM3RD_KClkPostScale] = p;
- pReg->DacRegs[PM3RD_KClkControl] =
- PM3RD_KClkControl_STATE_RUN |
- PM3RD_KClkControl_SOURCE_PLL |
- PM3RD_KClkControl_ENABLE;
- pReg->DacRegs[PM3RD_MClkControl] =
- PM3RD_MClkControl_STATE_RUN |
- PM3RD_MClkControl_SOURCE_KCLK |
- PM3RD_MClkControl_ENABLE;
- pReg->DacRegs[PM3RD_SClkControl] =
- PM3RD_SClkControl_STATE_RUN |
- PM3RD_SClkControl_SOURCE_HALF_KCLK |
- PM3RD_SClkControl_ENABLE;
-*/
/* Let's program the dot clock */
clockused = PM3DAC_CalculateClock(mode->Clock,
pGlint->RefClock, &m,&n,&p);
@@ -356,6 +349,13 @@ Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode)
if (!(mode->Flags & V_PVSYNC))
pReg->DacRegs[PM2VDACRDSyncControl] |= 0x08; /* invert vsync */
+#if 0 /* Currently commented out while testing Flat Panel support */
+ pReg->DacRegs[PM2VDACRDDACControl] = 0x01;
+ pReg->DacRegs[PM2VDACRDSyncControl] |= 0x40;
+ pReg->glintRegs[VSConfiguration >> 3] = (GLINT_READ_REG(VSConfiguration) & 0xFFFFFFF8) | 0x06;
+ pReg->glintRegs[VSBBase >> 3] = 1<<14;
+#endif
+
switch (pScrn->bitsPerPixel)
{
case 8:
@@ -395,16 +395,6 @@ Permedia3Save(ScrnInfoPtr pScrn, GLINTRegPtr glintReg)
/* Permedia 3 memory Timings */
glintReg->glintRegs[PM3MemBypassWriteMask >> 3] =
GLINT_READ_REG(PM3MemBypassWriteMask);
- glintReg->glintRegs[PM3LocalMemCaps >> 3] =
- GLINT_READ_REG(PM3LocalMemCaps);
- glintReg->glintRegs[PM3LocalMemTimings >> 3] =
- GLINT_READ_REG(PM3LocalMemTimings);
- glintReg->glintRegs[PM3LocalMemControl >> 3] =
- GLINT_READ_REG(PM3LocalMemControl);
- glintReg->glintRegs[PM3LocalMemRefresh >> 3] =
- GLINT_READ_REG(PM3LocalMemRefresh);
- glintReg->glintRegs[PM3LocalMemPowerDown >> 3] =
- GLINT_READ_REG(PM3LocalMemPowerDown);
glintReg->glintRegs[PM3ByAperture1Mode >> 3] =
GLINT_READ_REG(PM3ByAperture1Mode);
glintReg->glintRegs[PM3ByAperture2Mode >> 3] =
@@ -429,6 +419,10 @@ Permedia3Save(ScrnInfoPtr pScrn, GLINTRegPtr glintReg)
glintReg->glintRegs[PMScreenBase >> 3] = GLINT_READ_REG(PMScreenBase);
glintReg->glintRegs[PMVideoControl >> 3] = GLINT_READ_REG(PMVideoControl);
glintReg->glintRegs[VClkCtl >> 3] = GLINT_READ_REG(VClkCtl);
+#if 0 /* Currently commented out while testing Flat Panel support */
+ glintReg->glintRegs[VSConfiguration >> 3] = GLINT_READ_REG(VSConfiguration);
+ glintReg->glintRegs[VSBBase >> 3] = GLINT_READ_REG(VSBBase);
+#endif
for (i=0;i<768;i++) {
Permedia2ReadAddress(pScrn, i);
@@ -453,20 +447,6 @@ Permedia3Save(ScrnInfoPtr pScrn, GLINTRegPtr glintReg)
glintReg->DacRegs[PM2VDACRDDClk0PreScale] = Permedia2vInIndReg(pScrn, PM2VDACRDDClk0PreScale);
glintReg->DacRegs[PM2VDACRDDClk0FeedbackScale] = Permedia2vInIndReg(pScrn, PM2VDACRDDClk0FeedbackScale);
glintReg->DacRegs[PM2VDACRDDClk0PostScale] = Permedia2vInIndReg(pScrn, PM2VDACRDDClk0PostScale);
- /* save KClk, MClk and SClk settings */
- /* glintReg->DacRegs[PM3RD_KClkControl] =
- Permedia2vInIndReg(pScrn,PM3RD_KClkControl);
- glintReg->DacRegs[PM3RD_MClkControl] =
- Permedia2vInIndReg(pScrn,PM3RD_MClkControl);
- glintReg->DacRegs[PM3RD_SClkControl] =
- Permedia2vInIndReg(pScrn,PM3RD_SClkControl);
- glintReg->DacRegs[PM3RD_KClkPreScale] =
- Permedia2vInIndReg(pScrn,PM3RD_KClkPreScale);
- glintReg->DacRegs[PM3RD_KClkFeedbackScale] =
- Permedia2vInIndReg(pScrn,PM3RD_KClkFeedbackScale);
- glintReg->DacRegs[PM3RD_KClkPostScale] =
- Permedia2vInIndReg(pScrn,PM3RD_KClkPostScale);
-*/
}
void
@@ -486,16 +466,6 @@ Permedia3Restore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg)
/* Permedia 3 memory Timings */
GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PM3MemBypassWriteMask >> 3],
PM3MemBypassWriteMask);
- GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PM3LocalMemCaps >> 3],
- PM3LocalMemCaps);
- GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PM3LocalMemTimings >> 3],
- PM3LocalMemTimings);
- GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PM3LocalMemControl >> 3],
- PM3LocalMemControl);
- GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PM3LocalMemRefresh >> 3],
- PM3LocalMemRefresh);
- GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PM3LocalMemPowerDown >> 3],
- PM3LocalMemPowerDown);
GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PM3ByAperture1Mode >> 3],
PM3ByAperture1Mode);
GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PM3ByAperture2Mode >> 3],
@@ -521,6 +491,10 @@ Permedia3Restore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg)
GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMVbEnd >> 3], PMVbEnd);
GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMVsStart >> 3], PMVsStart);
GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMVsEnd >> 3], PMVsEnd);
+#if 0 /* Currently commented out while testing Flat Panel support */
+ GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VSConfiguration >> 3], VSConfiguration);
+ GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VSBBase >> 3], VSBBase);
+#endif
Permedia2vOutIndReg(pScrn, PM2VDACRDIndexControl, 0x00,
glintReg->DacRegs[PM2VDACRDIndexControl]);
@@ -550,19 +524,4 @@ Permedia3Restore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg)
Permedia2vOutIndReg(pScrn, PM2VDACRDDClk0PostScale, 0x00,
glintReg->DacRegs[PM2VDACRDDClk0PostScale]);
Permedia2vOutIndReg(pScrn, PM2VDACIndexClockControl, 0x00, temp|0x03);
- /* retsore the KClk, MClk and SClk settings */
- /* Permedia2vOutIndReg(pScrn, PM3RD_KClkPreScale, 0x00,
- glintReg->DacRegs[PM3RD_KClkPreScale]);
- Permedia2vOutIndReg(pScrn, PM3RD_KClkFeedbackScale, 0x00,
- glintReg->DacRegs[PM3RD_KClkFeedbackScale]);
- Permedia2vOutIndReg(pScrn, PM3RD_KClkPostScale, 0x00,
- glintReg->DacRegs[PM3RD_KClkPostScale]);
- Permedia2vOutIndReg(pScrn, PM3RD_KClkControl, 0x00,
- glintReg->DacRegs[PM3RD_KClkControl]);
- */ /* Should we wait for KClk to be locked here ? */
- /* Permedia2vOutIndReg(pScrn, PM3RD_MClkControl, 0x00,
- glintReg->DacRegs[PM3RD_MClkControl]);
- Permedia2vOutIndReg(pScrn, PM3RD_SClkControl, 0x00,
- glintReg->DacRegs[PM3RD_SClkControl]);
-*/
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h
index 677227a1f..ed455edd9 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h
@@ -1,4 +1,4 @@
-/* $XFree86: $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h,v 1.3 2000/10/17 09:07:05 alanh Exp $ */
/*
* glint register file
@@ -435,7 +435,8 @@
#define PM3AntialiasMode 0x8808
#define PM3AntialiasModeAnd 0xac00
#define PM3AntialiasModeOr 0xac08
-
+/* ... */
+#define PM3BackgroundColor 0xb0c8
/* ... */
#define PM3ColorDDAMode 0x87e0
#define PM3ColorDDAModeAnd 0xabe0
@@ -470,6 +471,17 @@
#define PM3dXSub 0x8018
#define PM3dY 0x8028
/* ... */
+#define PM3FBBlockColor 0x8ac8
+#define PM3FBBlockColor0 0xb060
+#define PM3FBBlockColor1 0xb068
+#define PM3FBBlockColor2 0xb070
+#define PM3FBBlockColor3 0xb078
+#define PM3FBBlockColorBack 0xb0a0
+#define PM3FBBlockColorBack0 0xb080
+#define PM3FBBlockColorBack1 0xb088
+#define PM3FBBlockColorBack2 0xb090
+#define PM3FBBlockColorBack3 0xb098
+#define PM3FBColor 0x8a98
#define PM3FBDestReadBufferAddr0 0xae80
#define PM3FBDestReadBufferAddr1 0xae88
#define PM3FBDestReadBufferAddr2 0xae90
@@ -534,6 +546,7 @@
#define PM3FBHardwareWriteMask 0x8ac0
#define PM3FBSoftwareWriteMask 0x8820
+#define PM3FBData 0x8aa0
#define PM3FBSourceData 0x8aa8
#define PM3FBSourceReadBufferAddr 0xaf08
#define PM3FBSourceReadBufferOffset 0xaf10
@@ -660,6 +673,11 @@
#define PM3LBWriteMode_Packed16 1<<11
#define PM3LBWriteMode_Width(w) (((w)&0xfff)<<12)
/* ... */
+#define PM3LineStippleMode 0x81a8
+#define PM3LineStippleModeAnd 0xabc0
+#define PM3LineStippleModeOr 0xabc8
+#define PM3LoadLineStippleCounters 0x81b0
+/* ... */
#define PM3LogicalOpMode 0x8828
#define PM3LogicalOpModeAnd 0xace0
#define PM3LogicalOpModeOr 0xace8
@@ -880,7 +898,7 @@
#define PM3Render2D_Width(w) ((w)&0x0fff)
#define PM3Render2D_Operation_Normal 0<<12
#define PM3Render2D_Operation_SyncOnHostData 1<<12
- #define PM3Render2D_Operation_SyncOnbitMask 2<<12
+ #define PM3Render2D_Operation_SyncOnBitMask 2<<12
#define PM3Render2D_Operation_PatchOrderRendering 3<<12
#define PM3Render2D_FBSourceReadEnable 1<<14
#define PM3Render2D_SpanOperation 1<<15
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h
index a9d77a2a7..528344b8f 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h
@@ -25,7 +25,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h,v 1.16 2000/09/17 01:36:27 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h,v 1.18 2000/10/24 22:45:06 dawes Exp $ */
/*
* Authors:
@@ -166,8 +166,8 @@ typedef struct _I810Rec {
int DGAViewportStatus;
int Chipset;
- int LinearAddr;
- int MMIOAddr;
+ unsigned long LinearAddr;
+ unsigned long MMIOAddr;
EntityInfoPtr pEnt;
pciVideoPtr PciInfo;
PCITAG PciTag;
@@ -311,6 +311,14 @@ extern void I810InitVideo(ScreenPtr pScreen);
OUTREG(LP_RING + RING_TAIL, outring); \
}
+#ifdef __GNUC__
+#define LP_RING_MESSAGE(n) \
+ ErrorF("BEGIN_LP_RING %d in %s\n", n, __FUNCTION__)
+#else
+#define LP_RING_MESSAGE(n) \
+ ErrorF("BEGIN_LP_RING %d in %s:%d\n", n, __FILE__, __LINE__)
+#endif
+
#define BEGIN_LP_RING(n) \
unsigned int outring, ringmask; \
volatile unsigned char *virt; \
@@ -318,7 +326,7 @@ extern void I810InitVideo(ScreenPtr pScreen);
if (pI810->LpRing.space < n*4) I810WaitLpRing( pScrn, n*4, 0); \
pI810->LpRing.space -= n*4; \
if (I810_DEBUG & DEBUG_VERBOSE_RING) \
- ErrorF( "BEGIN_LP_RING %d in %s\n", n, __FUNCTION__); \
+ LP_RING_MESSAGE(n); \
outring = pI810->LpRing.tail; \
ringmask = pI810->LpRing.tail_mask; \
virt = pI810->LpRing.virtual_start;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c
index 2e97a3c26..ccc01e0d0 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c,v 1.11 2000/09/17 01:36:27 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c,v 1.12 2000/09/24 13:51:26 alanh Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c
index 2e55a7849..7997567c5 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c
@@ -25,7 +25,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c,v 1.32 2000/09/19 12:46:16 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c,v 1.34 2000/09/26 15:57:11 tsi Exp $ */
/*
* Authors:
@@ -359,7 +359,7 @@ static Bool
I810Probe(DriverPtr drv, int flags) {
int i, numUsed, numDevSections, *usedChips;
GDevPtr *devSections;
- Bool foundScreen = 0;
+ Bool foundScreen = FALSE;
/*
Find the config file Device sections that match this
@@ -381,9 +381,10 @@ I810Probe(DriverPtr drv, int flags) {
devSections, numDevSections,
drv, &usedChips);
- if (flags & PROBE_DETECT)
- foundScreen = TRUE;
- else
+ if (flags & PROBE_DETECT) {
+ if (numUsed > 0)
+ foundScreen = TRUE;
+ } else
for (i=0; i<numUsed; i++) {
ScrnInfoPtr pScrn = NULL;
/* Allocate new ScrnInfoRec and claim the slot */
@@ -1645,7 +1646,7 @@ I810ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
if (!I810MapMem(pScrn)) return FALSE;
- pScrn->memPhysBase = (int)pI810->FbBase;
+ pScrn->memPhysBase = (unsigned long)pI810->FbBase;
pScrn->fbOffset = 0;
vgaHWSetMmioFuncs(hwp, pI810->MMIOBase, 0);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c
index 42893411d..e37ade8b5 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c,v 1.15 2000/08/28 18:12:55 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_memory.c,v 1.16 2000/09/24 13:51:26 alanh Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h
index 450f88570..ae665af09 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h
@@ -25,6 +25,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_reg.h,v 1.4 2000/09/26 15:57:12 tsi Exp $ */
/*
* Authors:
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/imstt/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/imstt/Imakefile
index 14eab93ed..a2f771acb 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/imstt/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/drivers/imstt/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/Imakefile,v 1.2 2000/06/14 01:56:08 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/Imakefile,v 1.3 2000/10/11 16:21:21 mvojkovi Exp $
/*
*
* Copyright 2000 Ani Joshi <ajoshi@unixbox.com>
@@ -22,7 +22,7 @@ INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \
-I$(XF86SRC)/xf24_32bpp -I$(SERVERSRC)/Xext \
-I$(XF86SRC)/vgahw -I$(XF86SRC)/ramdac \
-I$(XF86SRC)/rac -I$(XF86SRC)/int10 \
- -I$(XF86SRC)/fbdevhw \
+ -I$(XF86SRC)/fbdevhw -I$(SERVERSRC)/render \
-I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(FONTINCSRC) \
-I$(EXTINCSRC)
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile
index abfc49e87..2af10824a 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile,v 1.35 2000/09/20 00:09:22 keithp Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile,v 1.37 2000/10/09 23:12:45 alanh Exp $
XCOMM
XCOMM This is an Imakefile for the MGA driver.
XCOMM
@@ -15,7 +15,7 @@ SUBDIRS=hallib
DRISRCS = mga_dri.c mga_warp.c mga_wrap.c
DRIOBJS = mga_dri.o mga_warp.o mga_wrap.o
DRIINCLUDES = -I$(SERVERSRC)/GL/dri -I$(LIBSRC)/GL/dri \
- -I$(XF86OSSRC)/linux/drm/kernel -I$(TOP)/include
+ -I$(TOP)/include
DRIDEFINES = $(GLX_DEFINES)
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h
index 26da1dead..95b44d32c 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.61 2000/08/21 00:36:37 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.65 2000/10/24 22:45:06 dawes Exp $ */
/*
* MGA Millennium (MGA2064W) functions
*
@@ -187,11 +187,11 @@ typedef struct {
int YDstOrg;
int DstOrg;
int SrcOrg;
- CARD32 IOAddress;
- CARD32 FbAddress;
- CARD32 ILOADAddress;
+ unsigned long IOAddress;
+ unsigned long FbAddress;
+ unsigned long ILOADAddress;
int FbBaseReg;
- CARD32 BiosAddress;
+ unsigned long BiosAddress;
MessageType BiosFrom;
unsigned char * IOBase;
unsigned char * IOBaseDense;
@@ -296,7 +296,10 @@ typedef struct {
int allowedWidth;
void (*VideoTimerCallback)(ScrnInfoPtr, Time);
void (*PaletteLoadCallback)(ScrnInfoPtr);
+ void (*RenderCallback)(ScrnInfoPtr);
+ Time RenderTime;
MGAPaletteInfo palinfo[256]; /* G400 hardware bug workaround */
+ FBLinearPtr LinearScratch;
} MGARec, *MGAPtr;
#ifdef XF86DRI
@@ -361,6 +364,7 @@ Bool MGADRIScreenInit(ScreenPtr pScreen);
void MGADRICloseScreen(ScreenPtr pScreen);
Bool MGADRIFinishScreenInit(ScreenPtr pScreen);
void MGASwapContext(ScreenPtr pScreen);
+void MGASwapContext_shared(ScreenPtr pScreen);
Bool mgaConfigureWarp(ScrnInfoPtr pScrn);
unsigned int mgaInstallMicrocode(ScreenPtr pScreen, int agp_offset);
unsigned int mgaGetMicrocodeSize(ScreenPtr pScreen);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c
index 651acbf50..5ec08696f 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c,v 1.52 2000/01/21 01:12:20 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c,v 1.54 2000/10/24 22:45:07 dawes Exp $ */
/*
* Copyright 1994 by Robin Cutshaw <robin@XFree86.org>
*
@@ -269,6 +269,7 @@ MGATi3026CalcClock (
return f_pll;
}
+#ifndef USEMGAHAL
/*
* MGATi3026SetMCLK - Set the memory clock (MCLK) PLL.
*
@@ -352,6 +353,7 @@ MGATi3026SetMCLK( ScrnInfoPtr pScrn, long f_out )
;
}
}
+#endif
/*
* MGATi3026SetPCLK - Set the pixel (PCLK) and loop (LCLK) clocks.
@@ -503,7 +505,9 @@ MGA3026Init(ScrnInfoPtr pScrn, DisplayModePtr mode)
int i, BppShift, index_1d = 0;
const unsigned char* initDAC;
MGAPtr pMga = MGAPTR(pScrn);
+#ifndef USEMGAHAL
MGARamdacPtr MGAdac = &pMga->Dac;
+#endif
MGAFBLayout *pLayout = &pMga->CurrentLayout;
MGARegPtr pReg = &pMga->ModeReg;
vgaRegPtr pVga = &VGAHWPTR(pScrn)->ModeReg;
@@ -716,15 +720,8 @@ MGA3026Init(ScrnInfoPtr pScrn, DisplayModePtr mode)
but that's no big deal since we will Restore right after
this function */
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
#ifndef USEMGAHAL
MGATi3026SetMCLK( pScrn, MGAdac->MemoryClock );
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
-
#endif
#ifdef DEBUG
@@ -763,9 +760,6 @@ MGA3026Restore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
pciSetBitsLong(pMga->PciTag, PCI_OPTION_REG, OPTION_MASK,
mgaReg->Option);
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
#ifndef USEMGAHAL
/* select pixel clock PLL as clock source */
outTi3026(TVP3026_CLK_SEL, 0, mgaReg->DacRegs[3]);
@@ -774,10 +768,7 @@ MGA3026Restore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
outTi3026(TVP3026_PLL_ADDR, 0, 0x2A);
outTi3026(TVP3026_LOAD_CLK_DATA, 0, 0);
outTi3026(TVP3026_PIX_CLK_DATA, 0, 0);
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
-#endif
+#endif
/*
* This function handles restoring the generic VGA registers.
@@ -791,9 +782,6 @@ MGA3026Restore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
* goes here.
*/
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
#ifndef USEMGAHAL
/* program pixel clock PLL */
outTi3026(TVP3026_PLL_ADDR, 0, 0x00);
@@ -808,31 +796,20 @@ MGA3026Restore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
/* set Q divider for loop clock PLL */
outTi3026(TVP3026_MCLK_CTL, 0, mgaReg->DacRegs[18]);
-
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
-#endif
+#endif
/* program loop PLL */
outTi3026(TVP3026_PLL_ADDR, 0, 0x00);
for (i = 3; i < 6; i++)
outTi3026(TVP3026_LOAD_CLK_DATA, 0, mgaReg->DacClk[i]);
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
#ifndef USEMGAHAL
if ((vgaReg->MiscOutReg & 0x08) && ((mgaReg->DacClk[3] & 0xC0) == 0xC0) ) {
/* poll until loop PLL LOCK bit is set */
outTi3026(TVP3026_PLL_ADDR, 0, 0x3F);
while ( ! (inTi3026(TVP3026_LOAD_CLK_DATA) & 0x40) );
}
-
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
-#endif
+#endif
/*
* restore other DAC registers
@@ -885,9 +862,6 @@ MGA3026Save(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
mgaReg->ExtVga[i] = INREG8(0x1FDF);
}
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
#ifndef USEMGAHAL
outTi3026(TVP3026_PLL_ADDR, 0, 0x00);
for (i = 0; i < 3; i++)
@@ -898,11 +872,7 @@ MGA3026Save(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
for (i = 3; i < 6; i++)
outTi3026(TVP3026_LOAD_CLK_DATA, 0, mgaReg->DacClk[i] =
inTi3026(TVP3026_LOAD_CLK_DATA));
-
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
-#endif
+#endif
for (i = 0; i < DACREGSIZE; i++)
mgaReg->DacRegs[i] = inTi3026(MGADACregs[i]);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c
index 091dd3edb..620b2c7d0 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c
@@ -2,7 +2,7 @@
* MGA-1064, MGA-G100, MGA-G200, MGA-G400 RAMDAC driver
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c,v 1.37 2000/08/21 00:36:37 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c,v 1.40 2000/10/24 22:45:07 dawes Exp $ */
/*
* This is a first cut at a non-accelerated version to work with the
@@ -82,11 +82,6 @@ static Bool MGAGInit(ScrnInfoPtr, DisplayModePtr);
static void MGAGLoadPalette(ScrnInfoPtr, int, int*, LOCO*, VisualPtr);
static Bool MGAG_i2cInit(ScrnInfoPtr pScrn);
-
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
-/* We don't need anymore: MGAGCalcClock and MGAGSetPCLK function */
#ifndef USEMGAHAL
/*
* MGAGCalcClock - Calculate the PLL settings (m, n, p, s).
@@ -150,6 +145,7 @@ MGAGCalcClock ( ScrnInfoPtr pScrn, long f_out,
post_div_max = 7;
break;
case PCI_CHIP_MGAG100:
+ case PCI_CHIP_MGAG100_PCI:
case PCI_CHIP_MGAG200:
case PCI_CHIP_MGAG200_PCI:
default:
@@ -226,7 +222,6 @@ MGAGCalcClock ( ScrnInfoPtr pScrn, long f_out,
return f_pll;
}
-
/*
* MGAGSetPCLK - Set the pixel (PCLK) clock.
*/
@@ -250,9 +245,6 @@ MGAGSetPCLK( ScrnInfoPtr pScrn, long f_out )
pReg->DacRegs[ MGA1064_PIX_PLLC_N ] = n & 0x7F;
pReg->DacRegs[ MGA1064_PIX_PLLC_P ] = (p & 0x07) | ((s & 0x03) << 3);
}
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
#endif
/*
@@ -261,6 +253,7 @@ MGAGSetPCLK( ScrnInfoPtr pScrn, long f_out )
static Bool
MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
{
+#ifndef USEMGAHAL
/*
* initial values of the DAC registers
*/
@@ -277,13 +270,14 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
/* 0x48: */ 0, 0, 0, 0, 0, 0, 0, 0
};
+ int i, weight555 = FALSE;
+#endif
int hd, hs, he, ht, vd, vs, ve, vt, wd;
- int i, BppShift;
+ int BppShift;
MGAPtr pMga;
MGARegPtr pReg;
vgaRegPtr pVga;
MGAFBLayout *pLayout;
- int weight555 = FALSE;
pMga = MGAPTR(pScrn);
pReg = &pMga->ModeReg;
@@ -292,9 +286,6 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
BppShift = pMga->BppShifts[(pLayout->bitsPerPixel >> 3) - 1];
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
#ifndef USEMGAHAL
/* Allocate the DacRegs space if not done already */
if (pReg->DacRegs == NULL) {
@@ -436,9 +427,6 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
default:
FatalError("MGA: unsupported depth\n");
}
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
#endif
/*
@@ -520,29 +508,17 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
pVga->CRTC[21] = vd & 0xFF;
pVga->CRTC[22] = (vt + 1) & 0xFF;
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
#ifndef USEMGAHAL
pReg->DacRegs[ MGA1064_CURSOR_BASE_ADR_LOW ] =
pMga->FbCursorOffset >> 10;
pReg->DacRegs[ MGA1064_CURSOR_BASE_ADR_HI ] =
pMga->FbCursorOffset >> 18;
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
#endif
if (pMga->SyncOnGreen) {
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
#ifndef USEMGAHAL
pReg->DacRegs[ MGA1064_GEN_CTL ] &= ~0x20;
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
-#endif
+#endif
pReg->ExtVga[3] |= 0x40;
}
@@ -552,16 +528,8 @@ MGAGInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
#ifndef USEMGAHAL
if (mode->Flags & V_DBLSCAN)
pVga->CRTC[9] |= 0x80;
-#endif
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
-#ifndef USEMGAHAL
MGAGSetPCLK( pScrn, mode->Clock );
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
#endif
/* This disables the VGA memory aperture */
@@ -670,13 +638,10 @@ MGAGRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
Bool restoreFonts)
{
int i;
- CARD32 optionMask;
MGAPtr pMga = MGAPTR(pScrn);
-
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
#ifndef USEMGAHAL
+ CARD32 optionMask;
+
/*
* Code is needed to get things back to bank zero.
*/
@@ -710,10 +675,6 @@ MGAGRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
if (pMga->Chipset == PCI_CHIP_MGAG400)
pciSetBitsLong(pMga->PciTag, PCI_MGA_OPTION3, OPTION3_MASK,
mgaReg->Option3);
-
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
#endif
/* restore CRTCEXT regs */
for (i = 0; i < 6; i++)
@@ -763,18 +724,11 @@ MGAGSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
MGAPtr pMga = MGAPTR(pScrn);
if(pMga->SecondCrtc == TRUE) return;
-
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
#ifndef USEMGAHAL
/* Allocate the DacRegs space if not done already */
if (mgaReg->DacRegs == NULL) {
mgaReg->DacRegs = xnfcalloc(DACREGSIZE, 1);
}
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
#endif
/*
@@ -789,9 +743,6 @@ MGAGSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
vgaHWSave(pScrn, vgaReg, VGA_SR_MODE | (saveFonts ? VGA_SR_FONTS : 0));
MGAGSavePalette(pScrn, vgaReg->DAC);
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
#ifndef USEMGAHAL
/*
* The port I/O code necessary to read in the extended registers.
@@ -804,9 +755,6 @@ MGAGSave(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, MGARegPtr mgaReg,
mgaReg->Option2 = pciReadLong(pMga->PciTag, PCI_MGA_OPTION2);
if (pMga->Chipset == PCI_CHIP_MGAG400)
mgaReg->Option3 = pciReadLong(pMga->PciTag, PCI_MGA_OPTION3);
-/*******************/
-/* ADDED BY MATROX */
-/*******************/
#endif
for (i = 0; i < 6; i++)
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c
index 41b82801c..79aa84eac 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.5 2000/06/23 23:43:44 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.9 2000/10/24 22:45:07 dawes Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -391,7 +391,7 @@ Bool MGADRIScreenInit(ScreenPtr pScreen)
if (!xf86LoaderCheckSymbol("drmAvailable")) return FALSE;
if (!xf86LoaderCheckSymbol("DRIQueryVersion")) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
- "TDFXDRIScreenInit failed (libdri.a too old)\n");
+ "MGADRIScreenInit failed (libdri.a too old)\n");
return FALSE;
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c
index 845e3f85a..8f78d5ab8 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c
@@ -43,7 +43,7 @@
* Fixed 32bpp hires 8MB horizontal line glitch at middle right
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.165 2000/07/11 01:46:36 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.173 2000/10/24 22:45:07 dawes Exp $ */
/*
* This is a first cut at a non-accelerated version to work with the
@@ -173,6 +173,7 @@ static SymTabRec MGAChipsets[] = {
{ PCI_CHIP_MGA1064, "mga1064sg" },
{ PCI_CHIP_MGA2164, "mga2164w" },
{ PCI_CHIP_MGA2164_AGP, "mga2164w AGP" },
+ { PCI_CHIP_MGAG100_PCI, "mgag100" },
{ PCI_CHIP_MGAG100, "mgag100" },
{ PCI_CHIP_MGAG200, "mgag200" },
{ PCI_CHIP_MGAG200_PCI, "mgag200 PCI" },
@@ -186,6 +187,7 @@ static PciChipsets MGAPciChipsets[] = {
{ PCI_CHIP_MGA2164, PCI_CHIP_MGA2164, RES_SHARED_VGA },
{ PCI_CHIP_MGA2164_AGP, PCI_CHIP_MGA2164_AGP, RES_SHARED_VGA },
{ PCI_CHIP_MGAG100, PCI_CHIP_MGAG100, RES_SHARED_VGA },
+ { PCI_CHIP_MGAG100_PCI, PCI_CHIP_MGAG100_PCI, RES_SHARED_VGA },
{ PCI_CHIP_MGAG200, PCI_CHIP_MGAG200, RES_SHARED_VGA },
{ PCI_CHIP_MGAG200_PCI, PCI_CHIP_MGAG200_PCI, RES_SHARED_VGA },
{ PCI_CHIP_MGAG400, PCI_CHIP_MGAG400, RES_SHARED_VGA },
@@ -211,8 +213,13 @@ typedef enum {
OPTION_TEXTURED_VIDEO,
OPTION_XAALINES,
OPTION_CRTC2HALF,
+ OPTION_INT10,
OPTION_AGP_MODE_2X,
- OPTION_AGP_MODE_4X
+ OPTION_AGP_MODE_4X,
+ OPTION_DIGITAL,
+ OPTION_TV,
+ OPTION_TVSTANDARD,
+ OPTION_CABLETYPE
} MGAOpts;
static OptionInfoRec MGAOptions[] = {
@@ -234,8 +241,13 @@ static OptionInfoRec MGAOptions[] = {
{ OPTION_TEXTURED_VIDEO, "TexturedVideo",OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_XAALINES, "XAALines", OPTV_INTEGER, {0}, FALSE },
{ OPTION_CRTC2HALF, "Crtc2Half", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_INT10, "Int10", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_AGP_MODE_2X, "AGPMode2x", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_AGP_MODE_4X, "AGPMode4x", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_DIGITAL, "DigitalScreen",OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_TV, "TV", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_TVSTANDARD, "TVStandard", OPTV_ANYSTR, {0}, FALSE },
+ { OPTION_CABLETYPE, "CableType", OPTV_ANYSTR, {0}, FALSE },
{ -1, NULL, OPTV_NONE, {0}, FALSE }
};
@@ -287,6 +299,9 @@ static const char *xaaSymbols[] = {
"XAAOverlayFBfuncs",
"XAACachePlanarMonoStipple",
"XAAScreenIndex",
+ "XAAFallbackOps",
+ "XAAFillSolidRects",
+ "XAAMoveDWORDS",
NULL
};
@@ -368,6 +383,12 @@ static const char *vbeSymbols[] = {
NULL
};
+static const char *int10Symbols[] = {
+ "xf86InitInt10",
+ "xf86FreeInt10",
+ NULL
+};
+
static const char *fbdevHWSymbols[] = {
"fbdevHWInit",
"fbdevHWUseBuildinMode",
@@ -441,7 +462,7 @@ mgaSetup(pointer module, pointer opts, int *errmaj, int *errmin)
xf8_32bppSymbols, ramdacSymbols,
ddcSymbols, i2cSymbols, shadowSymbols,
fbdevHWSymbols, vbeSymbols,
- fbSymbols,
+ fbSymbols, int10Symbols,
#ifdef XF86DRI
drmSymbols, driSymbols,
#endif
@@ -913,6 +934,7 @@ MGACountRam(ScrnInfoPtr pScrn)
ProbeSize = 16384;
break;
case PCI_CHIP_MGAG100:
+ case PCI_CHIP_MGAG100_PCI:
if(biosInfo) /* I'm not sure if the docs are correct */
return (biosInfo & (1 << 12)) ? 16384 : 8192;
case PCI_CHIP_MGA1064:
@@ -1121,8 +1143,12 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
MGAMODEINFO mgaModeInfo = {0};
ULONG ulBOARDHANDLESize;
UCHAR ucMgaBase2;
+#if 0
ULONG ulOrgFBuffer;
#endif
+ Bool digital = FALSE;
+ Bool tv = FALSE;
+#endif
/*
* Note: This function is only called once at server startup, and
@@ -1184,20 +1210,6 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
if (!vgaHWGetHWRec(pScrn))
return FALSE;
-#if 0
- /* This is causing problems with restoring the card to it's
- original state. If this is to be done, it needs to happen
- after we've saved the original state */
- /* Initialize the card through int10 interface if needed */
- if ( xf86LoadSubModule(pScrn, "int10")){
- xf86Int10InfoPtr pInt;
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing int10\n");
- pInt = xf86InitInt10(pMga->pEnt->index);
- xf86FreeInt10(pInt);
- }
-#endif
-
/* Find the PCI info for this screen */
pMga->PciInfo = xf86GetPciInfoForEntity(pMga->pEnt->index);
pMga->PciTag = pciTag(pMga->PciInfo->bus, pMga->PciInfo->device,
@@ -1350,6 +1362,16 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
/* Process the options */
xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, MGAOptions);
+ if(xf86ReturnOptValBool(MGAOptions, OPTION_INT10, FALSE) &&
+ xf86LoadSubModule(pScrn, "int10"))
+ {
+ xf86Int10InfoPtr pInt;
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing int10\n");
+ pInt = xf86InitInt10(pMga->pEnt->index);
+ xf86FreeInt10(pInt);
+ }
+
/* Set the bits per RGB for 8bpp mode */
if (pScrn->depth == 8)
pScrn->rgbBits = 8;
@@ -1453,13 +1475,17 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
if (xf86GetOptValBool(MGAOptions, OPTION_HW_CURSOR, &pMga->HWCursor)) {
from = X_CONFIG;
}
- /* For compatibility, accept this too (as an override) */
- if (xf86ReturnOptValBool(MGAOptions, OPTION_SW_CURSOR, FALSE)) {
- from = X_CONFIG;
- pMga->HWCursor = FALSE;
+#ifdef USEMGAHAL
+ xf86GetOptValBool(MGAOptions, OPTION_TV, &tv);
+ if (tv == TRUE) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "TV Support\n");
+ }
+ xf86GetOptValBool(MGAOptions, OPTION_DIGITAL, &digital);
+ if (digital == TRUE) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Digital Screen Support\n");
}
- xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n",
- pMga->HWCursor ? "HW" : "SW");
+#endif
+ /* For compatibility, accept this too (as an override) */
if (xf86ReturnOptValBool(MGAOptions, OPTION_NOACCEL, FALSE)) {
pMga->NoAccel = TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n");
@@ -1594,6 +1620,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
break;
case PCI_CHIP_MGA1064:
case PCI_CHIP_MGAG100:
+ case PCI_CHIP_MGAG100_PCI:
case PCI_CHIP_MGAG200:
case PCI_CHIP_MGAG200_PCI:
case PCI_CHIP_MGAG400:
@@ -1964,6 +1991,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
}
break;
case PCI_CHIP_MGAG100:
+ case PCI_CHIP_MGAG100_PCI:
maxPitch = 2048;
break;
case PCI_CHIP_MGAG200:
@@ -2007,9 +2035,6 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
MGAFreeRec(pScrn);
return FALSE;
}
- /*******************/
- /* ADDED BY MATROX */
- /*******************/
#ifdef USEMGAHAL
if(pMga->SecondCrtc == FALSE) {
ulBOARDHANDLESize = MGAGetBOARDHANDLESize();
@@ -2061,8 +2086,16 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
mgaModeInfo.ulBpp = pScrn->bitsPerPixel;
mgaModeInfo.ulZoom = 1;
} else { /* Second CRTC && entity is shared */
- mgaModeInfo.flOutput = MGAMODEINFO_ANALOG2 |
- MGAMODEINFO_SECOND_CRTC;
+ if (digital == TRUE) {
+ mgaModeInfo.flOutput = MGAMODEINFO_DIGITAL2 |
+ MGAMODEINFO_SECOND_CRTC;
+ } else if (tv == TRUE) {
+ mgaModeInfo.flOutput = MGAMODEINFO_TV |
+ MGAMODEINFO_SECOND_CRTC;
+ } else {
+ mgaModeInfo.flOutput = MGAMODEINFO_ANALOG2 |
+ MGAMODEINFO_SECOND_CRTC;
+ }
#if 1
mgaModeInfo.ulDispWidth = pScrn->virtualX;
mgaModeInfo.ulDispHeight = pScrn->virtualY;
@@ -2080,13 +2113,12 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags)
}
if(MGAValidateMode(pMga->pBoard,&mgaModeInfo) != 0) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "MGAValidateMode found the mode to be invalid\n");
+ "MGAValidateMode from HALlib found the mode to be invalid\n");
return FALSE;
}
pScrn->displayWidth = mgaModeInfo.ulFBPitch;
-
-#endif /* USEMGAHAL */
+#endif
/*
* Set the CRTC parameters for all of the modes based on the type
@@ -2461,6 +2493,7 @@ MGASave(ScrnInfoPtr pScrn)
/* Convert DisplayModeRec parameters in MGAMODEINFO parameters. */
static void FillModeInfoStruct(ScrnInfoPtr pScrn, DisplayModePtr mode)
{
+ const char *s;
MGAPtr pMga = MGAPTR(pScrn);
pMga->pMgaModeInfo = (LPMGAMODEINFO) xalloc (sizeof(MGAMODEINFO));
@@ -2472,8 +2505,38 @@ static void FillModeInfoStruct(ScrnInfoPtr pScrn, DisplayModePtr mode)
pMga->pMgaModeInfo->ulFBPitch = 0;
pMga->pMgaModeInfo->ulBpp = pScrn->bitsPerPixel;
pMga->pMgaModeInfo->ulZoom = 1;
- pMga->pMgaModeInfo->flSignalMode = 0;
- pMga->pMgaModeInfo->ulRefreshRate = 0;
+ pMga->pMgaModeInfo->flSignalMode = 0x10;
+
+ /* Set TV standard */
+ if ((s = xf86GetOptValString(MGAOptions, OPTION_TVSTANDARD))) {
+ if (!xf86NameCmp(s, "PAL")) {
+ pMga->pMgaModeInfo->flSignalMode = 0x00;
+ pMga->pMgaModeInfo->ulRefreshRate = 50;
+ pMga->pMgaModeInfo->ulTVStandard = TV_PAL;
+ } else {
+ pMga->pMgaModeInfo->ulRefreshRate = 60;
+ pMga->pMgaModeInfo->ulTVStandard = TV_NTSC;
+ }
+ } else {
+ pMga->pMgaModeInfo->ulRefreshRate = 60;
+ pMga->pMgaModeInfo->ulTVStandard = TV_NTSC;
+ }
+
+ /* Set Cable Type */
+ if ((s = xf86GetOptValString(MGAOptions, OPTION_CABLETYPE))) {
+ if (!xf86NameCmp(s, "SCART_RGB")) {
+ pMga->pMgaModeInfo->ulCableType = TV_SCART_RGB;
+ } else if (!xf86NameCmp(s, "SCART_COMPOSITE")) {
+ pMga->pMgaModeInfo->ulCableType = TV_SCART_COMPOSITE;
+ } else if (!xf86NameCmp(s, "SCART_TYPE2")) {
+ pMga->pMgaModeInfo->ulCableType = TV_SCART_TYPE2;
+ } else {
+ pMga->pMgaModeInfo->ulCableType = TV_YC_COMPOSITE;
+ }
+ } else {
+ pMga->pMgaModeInfo->ulCableType = TV_YC_COMPOSITE;
+ }
+
pMga->pMgaModeInfo->ulHorizRate = 0;
pMga->pMgaModeInfo->ulPixClock = mode->Clock;
pMga->pMgaModeInfo->ulHFPorch = mode->HSyncStart - mode->HDisplay;
@@ -2489,7 +2552,7 @@ static void FillModeInfoStruct(ScrnInfoPtr pScrn, DisplayModePtr mode)
pMga->pMgaModeInfo->ulPanXGran = 0;
pMga->pMgaModeInfo->ulPanYGran = 0;
}
-#endif /* USEMGAHAL */
+#endif
/*
* Initialise a new mode. This is currently still using the old
@@ -2504,6 +2567,16 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
vgaRegPtr vgaReg;
MGAPtr pMga = MGAPTR(pScrn);
MGARegPtr mgaReg;
+#ifdef USEMGAHAL
+ Bool digital = FALSE;
+ Bool tv = FALSE;
+ ULONG status;
+
+ /* Verify if user wants digital screen output */
+ xf86GetOptValBool(MGAOptions, OPTION_DIGITAL, &digital);
+ /* Verify if user wants TV output */
+ xf86GetOptValBool(MGAOptions, OPTION_TV, &tv);
+#endif
vgaHWUnlock(hwp);
@@ -2524,26 +2597,40 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
FillModeInfoStruct(pScrn,mode);
if(pMga->SecondCrtc == TRUE) {
- pMga->pMgaModeInfo->flOutput = MGAMODEINFO_ANALOG2 |
- MGAMODEINFO_SECOND_CRTC |
- MGAMODEINFO_FORCE_PITCH |
- MGAMODEINFO_FORCE_DISPLAYORG;
+ if (digital == TRUE) {
+ pMga->pMgaModeInfo->flOutput = MGAMODEINFO_DIGITAL2 |
+ MGAMODEINFO_SECOND_CRTC |
+ MGAMODEINFO_FORCE_PITCH |
+ MGAMODEINFO_FORCE_DISPLAYORG;
+ } else if (tv == TRUE) {
+ pMga->pMgaModeInfo->flOutput = MGAMODEINFO_TV |
+ MGAMODEINFO_SECOND_CRTC |
+ MGAMODEINFO_FORCE_PITCH |
+ MGAMODEINFO_FORCE_DISPLAYORG;
+ } else {
+ pMga->pMgaModeInfo->flOutput = MGAMODEINFO_ANALOG2 |
+ MGAMODEINFO_SECOND_CRTC |
+ MGAMODEINFO_FORCE_PITCH |
+ MGAMODEINFO_FORCE_DISPLAYORG;
+ }
} else {
pMga->pMgaModeInfo->flOutput = MGAMODEINFO_ANALOG1 |
MGAMODEINFO_FORCE_PITCH;
}
pMga->pMgaModeInfo->ulFBPitch = pScrn->displayWidth;
- if(MGAValidateMode(pMga->pBoard,pMga->pMgaModeInfo) != 0) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"Invalid parameters\n");
+ /* Validate the parameters */
+ if ((status = MGAValidateMode(pMga->pBoard, pMga->pMgaModeInfo)) != 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "MGAValidateMode from HALlib found the mode to be invalid. Error: %lx\n", status);
return FALSE;
}
- if(MGAValidateVideoParameters(pMga->pBoard,pMga->pMgaModeInfo) != 0) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,"Invalid parameters\n");
+ /* Validates the Video parameters */
+ if ((status = MGAValidateVideoParameters(pMga->pBoard, pMga->pMgaModeInfo)) != 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "MGAValidateVideoParameters from HALlib found the mode to be invalid. Error: %lx\n", status);
return FALSE;
}
-#endif /* USEMGAHAL */
+#endif
#ifdef XF86DRI
if (pMga->directRenderingEnabled) {
@@ -2552,12 +2639,14 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
#endif
#ifdef USEMGAHAL
+ /* Initialize the board */
if(MGASetMode(pMga->pBoard,pMga->pMgaModeInfo) != 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "MGASetMode returned an error. Make sure to validate the mode before.\n");
return FALSE;
}
#define outMGAdreg(reg, val) OUTREG8(RAMDAC_OFFSET + (reg), val)
-
#define outMGAdac(reg, val) \
(outMGAdreg(MGA1064_INDEX, reg), outMGAdreg(MGA1064_DATA, val))
@@ -2565,10 +2654,7 @@ MGAModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
outMGAdac(MGA1064_CURSOR_BASE_ADR_LOW, pMga->FbCursorOffset >> 10);
outMGAdac(MGA1064_CURSOR_BASE_ADR_HI, pMga->FbCursorOffset >> 18);
}
-#endif /* USEMGAHAL */
-
-
-#ifndef USEMGAHAL
+#else
(*pMga->Restore)(pScrn, vgaReg, mgaReg, FALSE);
#endif
@@ -2698,11 +2784,18 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pMga->pClientStruct = (LPCLIENTDATA) xalloc (sizeof(CLIENTDATA));
/* Fill the client part */
pMga->pClientStruct->pMga = (MGAPtr) pMga;
-
MGAOpenLibrary(pMga->pBoard,pMga->pClientStruct,sizeof(CLIENTDATA));
-
pMga->pMgaHwInfo = (LPMGAHWINFO) xalloc (sizeof(MGAHWINFO));
MGAGetHardwareInfo(pMga->pBoard,pMga->pMgaHwInfo);
+
+ /* Detecting for type of display */
+ if (pMga->pMgaHwInfo->ulCapsSecondOutput & MGAHWINFOCAPS_OUTPUT_TV) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "TV detected\n");
+ }
+ if (pMga->pMgaHwInfo->ulCapsSecondOutput & MGAHWINFOCAPS_OUTPUT_DIGITAL) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Digital Screen detected\n");
+ }
+
/* Now copy these to the entitystructure */
pMgaEnt->pClientStruct = pMga->pClientStruct;
pMgaEnt->pBoard = pMga->pBoard;
@@ -2712,7 +2805,7 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pMga->pBoard = pMgaEnt->pBoard;
pMga->pMgaHwInfo = pMgaEnt->pMgaHwInfo;
}
-#endif /* USEMGAHAL */
+#endif
} else {
#ifdef USEMGAHAL
pMga->pBoard =
@@ -2721,15 +2814,12 @@ MGAScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pMga->pClientStruct = (LPCLIENTDATA) xalloc (sizeof(CLIENTDATA));
/* Fill the client part */
pMga->pClientStruct->pMga = (MGAPtr) pMga;
-
MGAOpenLibrary(pMga->pBoard,pMga->pClientStruct,sizeof(CLIENTDATA));
-
pMga->pMgaHwInfo = (LPMGAHWINFO) xalloc (sizeof(MGAHWINFO));
MGAGetHardwareInfo(pMga->pBoard,pMga->pMgaHwInfo);
-#endif /* USEMGAHAL */
+#endif
}
-
/* Initialise the MMIO vgahw functions */
vgaHWSetMmioFuncs(hwp, pMga->IOBase, PORT_OFFSET);
vgaHWGetIOBase(hwp);
@@ -3245,7 +3335,7 @@ MGACloseScreen(int scrnIndex, ScreenPtr pScreen)
if (pMga->pMgaHwInfo)
xfree(pMga->pMgaHwInfo);
}
-#endif /* USEMGAHAL */
+#endif
if (pMga->AccelInfoRec)
XAADestroyInfoRec(pMga->AccelInfoRec);
@@ -3440,6 +3530,9 @@ MGABlockHandler (
UpdateCurrentTime();
(*pMga->VideoTimerCallback)(pScrn, currentTime.milliseconds);
}
+
+ if(pMga->RenderCallback)
+ (*pMga->RenderCallback)(pScrn);
}
#if defined (DEBUG)
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h
index 70dbcf4bb..c2a47eaf1 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h,v 1.14 2000/06/17 00:03:20 martin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h,v 1.16 2000/10/24 22:45:07 dawes Exp $ */
#ifndef _MGA_MACROS_H_
#define _MGA_MACROS_H_
@@ -84,8 +84,6 @@ while(INREG(MGAREG_DWGSYNC) != MGA_SYNC_XTAG) ; \
OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); }
#ifdef XF86DRI
-extern void mgaGetQuiescence( ScrnInfoPtr pScrn );
-
#define CHECK_DMA_QUIESCENT(pMGA, pScrn) { \
if (!pMGA->have_quiescense) { \
pMGA->GetQuiescence( pScrn ); \
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c
index ab978513d..d8dbe698e 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c,v 1.70 2000/07/08 22:09:11 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c,v 1.78 2000/10/27 18:31:04 dawes Exp $ */
/* All drivers should typically include these */
@@ -134,6 +134,315 @@ extern void MGAValidatePolyPoint(GCPtr, unsigned long, DrawablePtr);
extern void MGAFillCacheBltRects(ScrnInfoPtr, int, unsigned int, int, BoxPtr,
int, int, XAACacheInfoPtr);
+#ifdef RENDER
+
+extern Bool
+MGASetupForCPUToScreenAlphaTexture (
+ ScrnInfoPtr pScrn,
+ int op,
+ CARD16 red,
+ CARD16 green,
+ CARD16 blue,
+ CARD16 alpha,
+ int alphaType,
+ CARD8 *alphaPtr,
+ int alphaPitch,
+ int width,
+ int height,
+ int flags
+);
+
+extern Bool
+MGASetupForCPUToScreenTexture (
+ ScrnInfoPtr pScrn,
+ int op,
+ int texType,
+ CARD8 *texPtr,
+ int texPitch,
+ int width,
+ int height,
+ int flags
+);
+
+extern void
+MGASubsequentCPUToScreenTexture (
+ ScrnInfoPtr pScrn,
+ int dstx,
+ int dsty,
+ int srcx,
+ int srcy,
+ int width,
+ int height
+);
+
+extern CARD32 MGAAlphaTextureFormats[2];
+extern CARD32 MGATextureFormats[2];
+
+#if PSZ == 8
+#include "mipict.h"
+#include "dixstruct.h"
+
+CARD32 MGAAlphaTextureFormats[2] = {PICT_a8, 0};
+CARD32 MGATextureFormats[2] = {PICT_a8r8g8b8, 0};
+
+static void
+RemoveLinear (FBLinearPtr linear)
+{
+ MGAPtr pMga = (MGAPtr)(linear->devPrivate.ptr);
+
+ pMga->LinearScratch = NULL; /* just lost our scratch */
+}
+
+static void
+RenderCallback (ScrnInfoPtr pScrn)
+{
+ MGAPtr pMga = MGAPTR(pScrn);
+
+ if((currentTime.milliseconds > pMga->RenderTime) && pMga->LinearScratch) {
+ xf86FreeOffscreenLinear(pMga->LinearScratch);
+ pMga->LinearScratch = NULL;
+ }
+
+ if(!pMga->LinearScratch)
+ pMga->RenderCallback = NULL;
+}
+
+#define RENDER_DELAY 15000
+
+static Bool
+AllocateLinear (
+ ScrnInfoPtr pScrn,
+ int sizeNeeded
+){
+ MGAPtr pMga = MGAPTR(pScrn);
+
+ pMga->RenderTime = currentTime.milliseconds + RENDER_DELAY;
+ pMga->RenderCallback = RenderCallback;
+
+ if(pMga->LinearScratch) {
+ if(pMga->LinearScratch->size >= sizeNeeded)
+ return TRUE;
+ else {
+ if(xf86ResizeOffscreenLinear(pMga->LinearScratch, sizeNeeded))
+ return TRUE;
+
+ xf86FreeOffscreenLinear(pMga->LinearScratch);
+ pMga->LinearScratch = NULL;
+ }
+ }
+
+ pMga->LinearScratch = xf86AllocateOffscreenLinear(
+ pScrn->pScreen, sizeNeeded, 32,
+ NULL, RemoveLinear, pMga);
+
+ return (pMga->LinearScratch != NULL);
+}
+
+static int
+GetPowerOfTwo(int w)
+{
+ int Pof2;
+ int i = 12;
+
+ while(--i) {
+ if(w & (1 << i)) {
+ Pof2 = i;
+ if(w & ((1 << i) - 1))
+ Pof2++;
+ break;
+ }
+ }
+ return Pof2;
+}
+
+
+static int tex_padw, tex_padh;
+
+Bool
+MGASetupForCPUToScreenAlphaTexture (
+ ScrnInfoPtr pScrn,
+ int op,
+ CARD16 red,
+ CARD16 green,
+ CARD16 blue,
+ CARD16 alpha,
+ int alphaType,
+ CARD8 *alphaPtr,
+ int alphaPitch,
+ int width,
+ int height,
+ int flags
+){
+ int log2w, log2h, i, pitch, sizeNeeded, offset;
+ MGAPtr pMga = MGAPTR(pScrn);
+
+ if(op != PictOpOver) /* only one tested */
+ return FALSE;
+
+ if((width > 2048) || (height > 2048))
+ return FALSE;
+
+ log2w = GetPowerOfTwo(width);
+ log2h = GetPowerOfTwo(height);
+
+ CHECK_DMA_QUIESCENT(pMga, pScrn);
+
+ if(pMga->Overlay8Plus24) {
+ i = 0x00ffffff;
+ WAITFIFO(1);
+ SET_PLANEMASK(i);
+ }
+
+ pitch = (width + 15) & ~15;
+ sizeNeeded = pitch * height;
+ if(pScrn->bitsPerPixel == 16)
+ sizeNeeded <<= 1;
+
+ if(!AllocateLinear(pScrn, sizeNeeded))
+ return FALSE;
+
+ offset = pMga->LinearScratch->offset << 1;
+ if(pScrn->bitsPerPixel == 32)
+ offset <<= 1;
+
+ if(pMga->AccelInfoRec->NeedToSync)
+ MGAStormSync(pScrn);
+
+ XAA_888_plus_PICT_a8_to_8888(
+ (blue >> 8) | (green & 0xff00) | ((red & 0xff00) << 8),
+ alphaPtr, alphaPitch, (CARD32*)(pMga->FbStart + offset),
+ pitch, width, height);
+
+ tex_padw = 1 << log2w;
+ tex_padh = 1 << log2h;
+
+ WAITFIFO(15);
+ OUTREG(MGAREG_TMR0, (1 << 20) / tex_padw); /* sx inc */
+ OUTREG(MGAREG_TMR1, 0); /* sy inc */
+ OUTREG(MGAREG_TMR2, 0); /* tx inc */
+ OUTREG(MGAREG_TMR3, (1 << 20) / tex_padh); /* ty inc */
+ OUTREG(MGAREG_TMR4, 0x00000000);
+ OUTREG(MGAREG_TMR5, 0x00000000);
+ OUTREG(MGAREG_TMR8, 0x00010000);
+ OUTREG(MGAREG_TEXORG, offset);
+ OUTREG(MGAREG_TEXWIDTH, log2w | (((8 - log2w) & 63) << 9) |
+ ((width - 1) << 18));
+ OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) |
+ ((height - 1) << 18));
+ OUTREG(MGAREG_TEXCTL, 0x1A000106 | ((pitch & 0x07FF) << 9));
+ OUTREG(MGAREG_TEXCTL2, 0x00000014);
+ OUTREG(MGAREG_DWGCTL, 0x000c7076);
+ OUTREG(MGAREG_TEXFILTER, 0x01e00020);
+ OUTREG(MGAREG_ALPHACTRL, 0x00000154);
+
+ return TRUE;
+}
+
+Bool
+MGASetupForCPUToScreenTexture (
+ ScrnInfoPtr pScrn,
+ int op,
+ int texType,
+ CARD8 *texPtr,
+ int texPitch,
+ int width,
+ int height,
+ int flags
+){
+ int log2w, log2h, i, pitch, sizeNeeded, offset;
+ MGAPtr pMga = MGAPTR(pScrn);
+
+ if(op != PictOpOver) /* only one tested */
+ return FALSE;
+
+ if((width > 2048) || (height > 2048))
+ return FALSE;
+
+ log2w = GetPowerOfTwo(width);
+ log2h = GetPowerOfTwo(height);
+
+ CHECK_DMA_QUIESCENT(pMga, pScrn);
+
+ if(pMga->Overlay8Plus24) {
+ i = 0x00ffffff;
+ WAITFIFO(1);
+ SET_PLANEMASK(i);
+ }
+
+ pitch = (width + 15) & ~15;
+ sizeNeeded = pitch * height;
+ if(pScrn->bitsPerPixel == 16)
+ sizeNeeded <<= 1;
+
+ if(!AllocateLinear(pScrn, sizeNeeded))
+ return FALSE;
+
+ offset = pMga->LinearScratch->offset << 1;
+ if(pScrn->bitsPerPixel == 32)
+ offset <<= 1;
+
+ if(pMga->AccelInfoRec->NeedToSync)
+ MGAStormSync(pScrn);
+
+ {
+ CARD8 *dst = (CARD8*)(pMga->FbStart + offset);
+ i = height;
+ while(i--) {
+ memcpy(dst, texPtr, width << 2);
+ texPtr += texPitch;
+ dst += pitch << 2;
+ }
+ }
+
+ tex_padw = 1 << log2w;
+ tex_padh = 1 << log2h;
+
+ WAITFIFO(15);
+ OUTREG(MGAREG_TMR0, (1 << 20) / tex_padw); /* sx inc */
+ OUTREG(MGAREG_TMR1, 0); /* sy inc */
+ OUTREG(MGAREG_TMR2, 0); /* tx inc */
+ OUTREG(MGAREG_TMR3, (1 << 20) / tex_padh); /* ty inc */
+ OUTREG(MGAREG_TMR4, 0x00000000);
+ OUTREG(MGAREG_TMR5, 0x00000000);
+ OUTREG(MGAREG_TMR8, 0x00010000);
+ OUTREG(MGAREG_TEXORG, offset);
+ OUTREG(MGAREG_TEXWIDTH, log2w | (((8 - log2w) & 63) << 9) |
+ ((width - 1) << 18));
+ OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) |
+ ((height - 1) << 18));
+ OUTREG(MGAREG_TEXCTL, 0x1A000106 | ((pitch & 0x07FF) << 9));
+ OUTREG(MGAREG_TEXCTL2, 0x00000014);
+ OUTREG(MGAREG_DWGCTL, 0x000c7076);
+ OUTREG(MGAREG_TEXFILTER, 0x01e00020);
+ OUTREG(MGAREG_ALPHACTRL, 0x00000151);
+
+ return TRUE;
+}
+void
+MGASubsequentCPUToScreenTexture (
+ ScrnInfoPtr pScrn,
+ int dstx,
+ int dsty,
+ int srcx,
+ int srcy,
+ int width,
+ int height
+){
+ MGAPtr pMga = MGAPTR(pScrn);
+
+ WAITFIFO(4);
+ OUTREG(MGAREG_TMR6, (srcx << 20) / tex_padw);
+ OUTREG(MGAREG_TMR7, (srcy << 20) / tex_padh);
+ OUTREG(MGAREG_FXBNDRY, ((dstx + width) << 16) | (dstx & 0xffff));
+ OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (dsty << 16) | height);
+
+ pMga->AccelInfoRec->NeedToSync = TRUE;
+}
+
+
+#endif
+#endif
+
Bool
MGANAME(AccelInit)(ScreenPtr pScreen)
{
@@ -141,6 +450,7 @@ MGANAME(AccelInit)(ScreenPtr pScreen)
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
MGAPtr pMga = MGAPTR(pScrn);
int maxFastBlitMem, maxlines;
+ Bool doRender = FALSE;
BoxRec AvailFBArea;
pMga->ScratchBuffer = xalloc(((pScrn->displayWidth * PSZ) + 127) >> 3);
@@ -167,8 +477,10 @@ MGANAME(AccelInit)(ScreenPtr pScreen)
pMga->HasFBitBlt = FALSE;
}
pMga->MaxBlitDWORDS = 0x400000 >> 5;
+ /* fallthrough */
case PCI_CHIP_MGAG200:
case PCI_CHIP_MGAG200_PCI:
+ doRender = TRUE;
pMga->AccelFlags = TRANSC_SOLID_FILL |
TWO_PASS_COLOR_EXPAND;
@@ -181,6 +493,7 @@ MGANAME(AccelInit)(ScreenPtr pScreen)
pMga->AccelFlags = 0;
break;
case PCI_CHIP_MGAG100:
+ case PCI_CHIP_MGAG100_PCI:
default:
pMga->AccelFlags = MGA_NO_PLANEMASK;
break;
@@ -314,6 +627,7 @@ MGANAME(AccelInit)(ScreenPtr pScreen)
SCANLINE_PAD_DWORD |
LEFT_EDGE_CLIPPING |
LEFT_EDGE_CLIPPING_NEGATIVE_X |
+ NO_TRANSPARENCY |
NO_GXCOPY;
infoPtr->SetupForScanlineImageWrite =
@@ -347,9 +661,9 @@ MGANAME(AccelInit)(ScreenPtr pScreen)
infoPtr->PolyPointMask = GCFunction | GCPlaneMask;
}
if(pMga->AccelFlags & MGA_NO_PLANEMASK) {
- infoPtr->ImageWriteFlags |= NO_PLANEMASK;
+ infoPtr->ScanlineImageWriteFlags |= NO_PLANEMASK;
infoPtr->ScreenToScreenCopyFlags |= NO_PLANEMASK;
- infoPtr->CPUToScreenColorExpandFillFlags |= NO_PLANEMASK;
+ infoPtr->ScanlineCPUToScreenColorExpandFillFlags |= NO_PLANEMASK;
infoPtr->SolidFillFlags |= NO_PLANEMASK;
infoPtr->SolidLineFlags |= NO_PLANEMASK;
infoPtr->DashedLineFlags |= NO_PLANEMASK;
@@ -414,6 +728,24 @@ MGANAME(AccelInit)(ScreenPtr pScreen)
infoPtr->RestoreAccelState = MGANAME(RestoreAccelState);
}
+#ifdef RENDER
+ if(doRender && ((pScrn->bitsPerPixel == 32) || (pScrn->bitsPerPixel == 16)))
+ {
+ infoPtr->SetupForCPUToScreenAlphaTexture =
+ MGASetupForCPUToScreenAlphaTexture;
+ infoPtr->SubsequentCPUToScreenAlphaTexture =
+ MGASubsequentCPUToScreenTexture;
+ infoPtr->CPUToScreenAlphaTextureFlags = XAA_RENDER_NO_TILE |
+ XAA_RENDER_NO_SRC_ALPHA;
+ infoPtr->CPUToScreenAlphaTextureFormats = MGAAlphaTextureFormats;
+
+ infoPtr->SetupForCPUToScreenTexture = MGASetupForCPUToScreenTexture;
+ infoPtr->SubsequentCPUToScreenTexture = MGASubsequentCPUToScreenTexture;
+ infoPtr->CPUToScreenTextureFlags = XAA_RENDER_NO_TILE;
+ infoPtr->CPUToScreenTextureFormats = MGATextureFormats;
+ }
+#endif
+
return(XAAInit(pScreen, infoPtr));
}
@@ -528,7 +860,8 @@ MGAStormEngineInit(ScrnInfoPtr pScrn)
CHECK_DMA_QUIESCENT(pMga, pScrn);
- if (pMga->Chipset == PCI_CHIP_MGAG100)
+ if ((pMga->Chipset == PCI_CHIP_MGAG100)
+ || (pMga->Chipset == PCI_CHIP_MGAG100_PCI))
maccess = 1 << 14;
switch( pLayout->bitsPerPixel )
@@ -570,7 +903,8 @@ MGAStormEngineInit(ScrnInfoPtr pScrn)
OUTREG(MGAREG_MACCESS, maccess);
pMga->MAccess = maccess;
pMga->PlaneMask = ~0;
- if(pMga->Chipset != PCI_CHIP_MGAG100)
+ if((pMga->Chipset != PCI_CHIP_MGAG100)
+ && (pMga->Chipset != PCI_CHIP_MGAG100_PCI))
OUTREG(MGAREG_PLNWT, pMga->PlaneMask);
pMga->FgColor = 0;
OUTREG(MGAREG_FCOL, pMga->FgColor);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c
index 1bb193516..59a4da867 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c,v 1.17 2000/09/08 02:22:00 mvojkovi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c,v 1.18 2000/10/24 22:45:07 dawes Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -79,7 +79,7 @@ void MGAInitVideo(ScreenPtr pScreen)
(pMga->Chipset == PCI_CHIP_MGAG400)))
{
- if((pMga->Overlay8Plus24 /* || dualhead */ || pMga->TexturedVideo) &&
+ if((pMga->Overlay8Plus24 || pMga->TexturedVideo) &&
(pScrn->bitsPerPixel != 24))
{
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using texture video\n");
@@ -91,9 +91,8 @@ void MGAInitVideo(ScreenPtr pScreen)
pMga->TexturedVideo = FALSE;
}
- if(!pMga->Overlay8Plus24 /* && !dualhead */)
+ if(!pMga->Overlay8Plus24)
MGAInitOffscreenImages(pScreen);
-
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_warp.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_warp.c
index 50b9871b3..066d20991 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_warp.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_warp.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_warp.c,v 1.3 2000/06/17 18:23:23 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_warp.c,v 1.4 2000/09/26 15:57:12 tsi Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -108,7 +108,7 @@ static unsigned int mgaG400InstallMicrocode(MGAPtr pMGA, int agp_offset)
MGADRIServerPrivatePtr pMGADRIServer = pMGA->DRIServerInfo;
CARD8 *vcbase = pMGADRIServer->agp_map + agp_offset;
- CARD32 pcbase = (CARD32)pMGADRIServer->agpBase + agp_offset;
+ unsigned long pcbase = (unsigned long)pMGADRIServer->agpBase + agp_offset;
unsigned int microcode_size = 0;
memset(pMGADRIServer->WarpIndex, 0,
@@ -150,7 +150,7 @@ static unsigned int mgaG200InstallMicrocode(MGAPtr pMGA, int agp_offset)
MGADRIServerPrivatePtr pMGADRIServer = pMGA->DRIServerInfo;
CARD8 *vcbase = pMGADRIServer->agp_map + agp_offset;
- CARD32 pcbase = (CARD32)pMGADRIServer->agpBase + agp_offset;
+ unsigned long pcbase = (unsigned long)pMGADRIServer->agpBase + agp_offset;
unsigned int microcode_size = 0;
memset(pMGADRIServer->WarpIndex, 0,
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c
index 553d14489..4a5b7ef5f 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c,v 1.1 2000/06/17 00:03:20 martin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c,v 1.2 2000/09/24 13:51:28 alanh Exp $ */
/**************************************************************************
Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_dga.c
index da4f97e89..6124f86c2 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_dga.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_dga.c
@@ -21,7 +21,7 @@
*
* Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk>
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_dga.c,v 1.1 2000/06/22 18:09:37 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_dga.c,v 1.3 2000/10/17 21:36:15 mvojkovi Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -33,6 +33,7 @@
#include "neo.h"
#include "neo_reg.h"
#include "dgaproc.h"
+#include "vgaHW.h"
static Bool NEO_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **,
int *, int *, int *);
@@ -70,20 +71,18 @@ NEODGAInit(ScreenPtr pScreen)
DGAModePtr modes = NULL, newmodes = NULL, currentMode;
DisplayModePtr pMode, firstMode;
int Bpp = pScrn->bitsPerPixel >> 3;
- int num = 0;
- Bool oneMore;
+ int num = 0, imlines, pixlines;
+
+ imlines = (pScrn->videoRam * 1024) /
+ (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3));
+
+ pixlines = (imlines > 1024) ? 1024 : imlines;
pMode = firstMode = pScrn->modes;
while(pMode) {
- if(0 /*pScrn->displayWidth != pMode->HDisplay*/) {
- newmodes = xrealloc(modes, (num + 2) * sizeof(DGAModeRec));
- oneMore = TRUE;
- } else {
- newmodes = xrealloc(modes, (num + 1) * sizeof(DGAModeRec));
- oneMore = FALSE;
- }
+ newmodes = xrealloc(modes, (num + 1) * sizeof(DGAModeRec));
if(!newmodes) {
xfree(modes);
@@ -91,8 +90,6 @@ NEODGAInit(ScreenPtr pScreen)
}
modes = newmodes;
-SECOND_PASS:
-
currentMode = modes + num;
num++;
@@ -118,32 +115,16 @@ SECOND_PASS:
currentMode->offset = 0;
currentMode->address = pNEO->NeoFbBase;
- if(oneMore) { /* first one is narrow width */
- currentMode->bytesPerScanline = ((pMode->HDisplay * Bpp) + 3) & ~3L;
- currentMode->imageWidth = pMode->HDisplay;
- currentMode->imageHeight = pMode->VDisplay;
- currentMode->pixmapWidth = currentMode->imageWidth;
- currentMode->pixmapHeight = currentMode->imageHeight;
- currentMode->maxViewportX = currentMode->imageWidth -
- currentMode->viewportWidth;
- /* this might need to get clamped to some maximum */
- currentMode->maxViewportY = currentMode->imageHeight -
- currentMode->viewportHeight;
- oneMore = FALSE;
- goto SECOND_PASS;
- } else {
- currentMode->bytesPerScanline =
+ currentMode->bytesPerScanline =
((pScrn->displayWidth * Bpp) + 3) & ~3L;
- currentMode->imageWidth = pScrn->displayWidth;
- currentMode->imageHeight = pMode->VDisplay;
- currentMode->pixmapWidth = currentMode->imageWidth;
- currentMode->pixmapHeight = currentMode->imageHeight;
- currentMode->maxViewportX = currentMode->imageWidth -
+ currentMode->imageWidth = pScrn->displayWidth;
+ currentMode->imageHeight = imlines;
+ currentMode->pixmapWidth = currentMode->imageWidth;
+ currentMode->pixmapHeight = pixlines;
+ currentMode->maxViewportX = currentMode->imageWidth -
currentMode->viewportWidth;
- /* this might need to get clamped to some maximum */
- currentMode->maxViewportY = currentMode->imageHeight -
+ currentMode->maxViewportY = currentMode->imageHeight -
currentMode->viewportHeight;
- }
pMode = pMode->next;
if(pMode == firstMode)
@@ -156,33 +137,29 @@ SECOND_PASS:
return DGAInit(pScreen, &NEODGAFuncs, modes, num);
}
+static DisplayModePtr NEOSavedDGAModes[MAXSCREENS];
static Bool
NEO_SetMode(
ScrnInfoPtr pScrn,
DGAModePtr pMode
){
- static int OldDisplayWidth[MAXSCREENS];
int index = pScrn->pScreen->myNum;
NEOPtr pNEO = NEOPTR(pScrn);
if(!pMode) { /* restore the original mode */
- /* put the ScreenParameters back */
-
- pScrn->displayWidth = OldDisplayWidth[index];
-
- NEOSwitchMode(index, pScrn->currentMode, 0);
- pNEO->DGAactive = FALSE;
+ if(pNEO->DGAactive) {
+ pScrn->currentMode = NEOSavedDGAModes[index];
+ NEOSwitchMode(index, pScrn->currentMode, 0);
+ NEOAdjustFrame(index, 0, 0, 0);
+ pNEO->DGAactive = FALSE;
+ }
} else {
if(!pNEO->DGAactive) { /* save the old parameters */
- OldDisplayWidth[index] = pScrn->displayWidth;
-
+ NEOSavedDGAModes[index] = pScrn->currentMode;
pNEO->DGAactive = TRUE;
}
- pScrn->displayWidth = pMode->bytesPerScanline /
- (pMode->bitsPerPixel >> 3);
-
NEOSwitchMode(index, pMode->mode, 0);
}
@@ -205,9 +182,14 @@ NEO_SetViewport(
int flags
){
NEOPtr pNEO = NEOPTR(pScrn);
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
NEOAdjustFrame(pScrn->pScreen->myNum, x, y, flags);
- pNEO->DGAViewportStatus = 0; /* NEOAdjustFrame loops until finished */
+ /* wait for retrace */
+ while((hwp->readST01(hwp) & 0x08));
+ while(!(hwp->readST01(hwp) & 0x08));
+
+ pNEO->DGAViewportStatus = 0;
}
static void
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.cpp b/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.cpp
index fb78c1238..0b8914545 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.cpp
+++ b/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.cpp
@@ -1,9 +1,9 @@
-.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.cpp,v 1.4 2000/06/14 02:13:12 dawes Exp $
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.cpp,v 1.5 2000/09/25 23:57:11 mvojkovi Exp $
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
.TH NEOMAGIC __drivermansuffix__ "Version 4.0.1" "XFree86"
.SH NAME
-neomagic \- NeoMagic video driver
+neomagic \- Neomagic video driver
.SH SYNOPSIS
.nf
.B "Section \*qDevice\*q"
@@ -14,17 +14,69 @@ neomagic \- NeoMagic video driver
.fi
.SH DESCRIPTION
.B neomagic
-is an XFree86 driver for NeoMagic video chips.
-THIS MAN PAGE NEEDS TO BE FILLED IN.
+is an XFree86 driver for the Neomagic graphics chipsets found in many
+laptop computers.
.SH SUPPORTED HARDWARE
-The
.B neomagic
-driver supports...
+supports the following chipsets:
+.PP
+.TP
+MagicGraph 128 (NM2070)
+.TP
+MagicGraph 128V (NM2090)
+.TP
+MagicGraph 128ZV (NM2093)
+.TP
+MagicGraph 128ZV+ (NM2097)
+.TP
+MagicGraph 128XD (NM2160)
+.TP
+MagicGraph 256AV (NM2200)
+.TP
+MagicGraph 256AV+ (NM2230)
+.TP
+MagicGraph 256ZX (NM2360)
+.TP
+MagicGraph 256XL+ (NM2380)
+.PP
+The driver supports depths 8, 15, 16 and 24 for all chipsets except the
+NM2070 which does not support depth 24. All depths are accelerated except for
+depth 24 which is only accelerated on NM2200
+and newer models. All visuals are supported in depth 8. TrueColor and
+DirectColor visuals are supported in the other depths.
+
.SH CONFIGURATION DETAILS
Please refer to XF86Config(__filemansuffix__) for general configuration
details. This section only covers configuration details specific to this
driver.
+.PP
+The following driver
+.B Options
+are supported
+.TP
+.BI "Option \*qNoAccel\*q \*q" boolean \*q
+Disable or enable acceleration. Default: acceleration is enabled.
+.TP
+.BI "Option \*qSWCursor\*q \*q" boolean \*q
+Disable or enable software cursor. Default: software cursor is disable
+and a hardware cursor is used.
+.TP
+.BI "Option \*qPCIBurst\*q \*q" boolean \*q
+Disable or enable PCI burst modes. Default: enabled.
+.TP
+.BI "Option \*qRotate\*q \*qCW\*q"
+.TP
+.BI "Option \*qRotate\*q \*qCCW\*q"
+Rotate the display clockwise or counterclockwise. This mode is unaccelerated.
+Default: no rotation.
+.TP
+.BI "Option \*qShadowFB\*q \*q" boolean \*q
+Enable or disable use of the shadow framebuffer layer. See
+shadowfb(__drivermansuffix__) for further information. Default: off.
+.TP
+
.SH "SEE ALSO"
XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__)
.SH AUTHORS
-Authors include: ...
+Authors include: Jens Owen, Kevin E. Martin, and also Egbert Eich,
+Mark Vojkovich, Alan Hourihane.
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/Imakefile b/xc/programs/Xserver/hw/xfree86/drivers/r128/Imakefile
index 23fa7504d..c13d95034 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/r128/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/Imakefile
@@ -1,21 +1,35 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/Imakefile,v 1.9 2000/09/20 00:09:26 keithp Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/Imakefile,v 1.11 2000/10/18 17:19:58 alanh Exp $
+XCOMM
+XCOMM This is the Imakefile for the ATI Rage 128 (r128) and
+XCOMM the ATI Radeon (radeon) driver.
XCOMM
-XCOMM This is the Imakefile for the ATI Rage 128 (r128) driver.
-XCOMM
#define IHaveModules
#include <Server.tmpl>
#if BuildXF86DRI
-DRISRCS = r128_dri.c
-DRIOBJS = r128_dri.o
-DRIINCLUDES = -I$(SERVERSRC)/GL/dri -I$(LIBSRC)/GL/dri -I$(TOP)/include
-DRIDEFINES = $(GLX_DEFINES)
+R128DRISRCS = r128_dri.c
+R128DRIOBJS = r128_dri.o
+
+DRISRCS = $(R128DRISRCS)
+DRIOBJS = $(R128DRIOBJS)
+DRIINCLUDES = -I$(SERVERSRC)/GL/dri -I$(LIBSRC)/GL/dri -I$(TOP)/include
+DRIDEFINES = $(GLX_DEFINES)
#endif
-SRCS = r128_driver.c r128_cursor.c r128_accel.c r128_dga.c $(DRISRCS) # r128_i2c.c
+PROBESRCS = ati2_probe.c
+PROBEOBJS = ati2_probe.o
+
+R128SRCS = r128_driver.c r128_cursor.c r128_accel.c r128_dga.c r128_video.c
+R128OBJS = r128_driver.o r128_cursor.o r128_accel.o r128_dga.o r128_video.o
+
+RADEONSRCS = radeon_driver.c radeon_cursor.c radeon_accel.c radeon_dga.c \
+ radeon_video.c
+RADEONOBJS = radeon_driver.o radeon_cursor.o radeon_accel.o radeon_dga.o \
+ radeon_video.o
-OBJS = r128_driver.o r128_cursor.o r128_accel.o r128_dga.o $(DRIOBJS) # r128_i2c.o
+SRCS = $(PROBESRCS) $(R128SRCS) $(RADEONSRCS) $(DRISRCS)
+OBJS = $(PROBEOBJS) $(R128OBJS) $(RADEONOBJS) $(DRIOBJS)
#if defined(XF86DriverSDK)
INCLUDES = -I. -I../../include
@@ -39,12 +53,37 @@ DEFINES = $(DRIDEFINES)
SubdirLibraryRule($(OBJS))
#endif
+#ifndef InstallLinkedDynamicModule
+#define InstallLinkedDynamicModule(module,linkname,dest,subdir) @@\
+linkname: module @@\
+ @@\
+AllTarget(linkname) @@\
+ LinkBuildNamedModule(module,linkname,subdir) @@\
+ @@\
+install:: linkname @@\
+ MakeDir($(DESTDIR)dest/subdir) @@\
+ RemoveFile($(DESTDIR)dest/subdir/linkname) @@\
+ $(LN) module $(DESTDIR)dest/subdir/linkname
+#endif
+
+#ifndef InstallLinkedObjectModule
+#if !DoLoadableServer
+#define InstallLinkedObjectModule(module,linkname,dest,subdir) /**/
+#else
+#define InstallLinkedObjectModule(module,linkname,dest,subdir) @@\
+InstallLinkedDynamicModule(Concat(module,_drv.o),Concat(linkname,_drv.o),dest,subdir)
+#endif
+#endif
+
ModuleObjectRule()
ObjectModuleTarget(r128,$(OBJS))
InstallObjectModule(r128,$(MODULEDIR),drivers)
+InstallLinkedObjectModule(r128,ati2,$(MODULEDIR),drivers)
+InstallLinkedObjectModule(r128,radeon,$(MODULEDIR),drivers)
+
#if !defined(XF86DriverSDK)
CppManTarget(r128,)
InstallModuleManPage(r128)
@@ -53,6 +92,9 @@ InstallModuleManPage(r128)
DependTarget()
InstallDriverSDKNonExecFile(Imakefile,$(DRIVERSDKDIR)/drivers/r128)
+
+InstallDriverSDKNonExecFile(ati_probe.c,$(DRIVERSDKDIR)/drivers/r128)
+
InstallDriverSDKNonExecFile(r128.h,$(DRIVERSDKDIR)/drivers/r128)
InstallDriverSDKNonExecFile(r128_accel.c,$(DRIVERSDKDIR)/drivers/r128)
InstallDriverSDKNonExecFile(r128_cursor.c,$(DRIVERSDKDIR)/drivers/r128)
@@ -65,5 +107,11 @@ InstallDriverSDKNonExecFile(r128_dri.h,$(DRIVERSDKDIR)/drivers/r128)
InstallDriverSDKNonExecFile(r128_dripriv.h,$(DRIVERSDKDIR)/drivers/r128)
InstallDriverSDKNonExecFile(r128_sarea.h,$(DRIVERSDKDIR)/drivers/r128)
-InstallDriverSDKObjectModule(r128,$(DRIVERSDKMODULEDIR),drivers)
+InstallDriverSDKNonExecFile(radeon.h,$(DRIVERSDKDIR)/drivers/r128)
+InstallDriverSDKNonExecFile(radeon_accel.c,$(DRIVERSDKDIR)/drivers/r128)
+InstallDriverSDKNonExecFile(radeon_cursor.c,$(DRIVERSDKDIR)/drivers/r128)
+InstallDriverSDKNonExecFile(radeon_driver.c,$(DRIVERSDKDIR)/drivers/r128)
+InstallDriverSDKNonExecFile(radeon_dga.c,$(DRIVERSDKDIR)/drivers/r128)
+InstallDriverSDKNonExecFile(radeon_reg.h,$(DRIVERSDKDIR)/drivers/r128)
+InstallDriverSDKObjectModule(r128,$(DRIVERSDKMODULEDIR),drivers)
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/ati2.h b/xc/programs/Xserver/hw/xfree86/drivers/r128/ati2.h
new file mode 100644
index 000000000..e3eefb89d
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/ati2.h
@@ -0,0 +1,49 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/ati2.h,v 1.2 2000/10/23 21:16:48 tsi Exp $ */
+/**************************************************************************
+
+Copyright 2000 ATI Technologies Inc. and VA Linux Systems, Inc.,
+ Sunnyvale, California.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+on the rights to use, copy, modify, merge, publish, distribute, sub
+license, and/or sell copies of the Software, and to permit persons to whom
+the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <martin@valinux.com>
+ *
+ */
+
+#ifndef _ATI2_H_
+#define _ATI2_H_
+
+ /* ATI2_NAME is used for the server-side
+ ddx driver, the client-side DRI driver,
+ and the kernel-level DRM driver. */
+#define ATI2_NAME "ati2"
+#define ATI2_VERSION_MAJOR 4
+#define ATI2_VERSION_MINOR 0
+#define ATI2_VERSION_PATCH 0
+#define ATI2_VERSION ((ATI2_VERSION_MAJOR << 16) \
+ | (ATI2_VERSION_MINOR << 8) \
+ | ATI2_VERSION_PATCH)
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/ati2_probe.c b/xc/programs/Xserver/hw/xfree86/drivers/r128/ati2_probe.c
new file mode 100644
index 000000000..e52c1bdae
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/ati2_probe.c
@@ -0,0 +1,313 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/ati2_probe.c,v 1.2 2000/10/23 12:10:14 alanh Exp $ */
+/**************************************************************************
+
+Copyright 2000 ATI Technologies Inc. and VA Linux Systems, Inc.,
+ Sunnyvale, California.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+on the rights to use, copy, modify, merge, publish, distribute, sub
+license, and/or sell copies of the Software, and to permit persons to whom
+the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <martin@valinux.com>
+ *
+ */
+
+
+/*
+ * To add a new driver (e.g., zzzzz) to the r128 directory:
+ *
+ * 1. Add a new XF86ModuleData line for the new driver:
+ * XF86ModuleData zzzzzModuleData = { &ATI2VersRec, ATI2Setup, 0 };
+ *
+ * 2. Add a new driver AvailableOptions function call to
+ * ATI2AvailableOptions:
+ * if (!opts) opts = ZZZZZAvailableOptions(chipid, busid);
+ *
+ * 3. Add a new driver Identify function call to ATI2Identify:
+ * ZZZZZIdentify(flags);
+ *
+ * 4. Add a new driver Probe function call ATI2Probe:
+ * foundScreen |= ZZZZZProbe(drv, flags);
+ *
+ * 5. Add any symbols that are needed in your driver as an argument to
+ * the call to LoaderRefSymbLists() in ATI2Setup.
+ *
+ * Note: see r128_driver.c for examples of how to write the following
+ * functions:
+ * OptionInfoPtr ZZZZZAvailableOptions(int chipid, int busid);
+ * void ZZZZZIdentify(int flags);
+ * Bool ZZZZZProbe(DriverPtr drv, int flags); */
+
+
+ /* X and server generic header files */
+#include "xf86.h"
+
+ /* Driver data structures */
+#include "ati2.h"
+#include "r128_probe.h"
+#include "radeon_probe.h"
+
+ /* Forward definitions for driver functions */
+static OptionInfoPtr ATI2AvailableOptions(int chipid, int busid);
+static Bool ATI2Probe(DriverPtr drv, int flags);
+static void ATI2Identify(int flags);
+
+ /* Define driver */
+/* NOTE: This structure must be named R128 since the directory's name is
+ r128 so that the static X server can find the driver. */
+DriverRec R128 = {
+ ATI2_VERSION,
+ "ATI Rage 128 and Radeon",
+ ATI2Identify,
+ ATI2Probe,
+ ATI2AvailableOptions,
+ NULL
+};
+
+const char *vgahwSymbols[] = {
+ "vgaHWGetHWRec",
+ "vgaHWFreeHWRec",
+ "vgaHWLock",
+ "vgaHWUnlock",
+ "vgaHWSave",
+ "vgaHWRestore",
+ NULL
+};
+
+const char *fbdevHWSymbols[] = {
+ "fbdevHWInit",
+ "fbdevHWUseBuildinMode",
+
+ "fbdevHWGetDepth",
+ "fbdevHWGetVidmem",
+
+ /* colormap */
+ "fbdevHWLoadPalette",
+
+ /* ScrnInfo hooks */
+ "fbdevHWSwitchMode",
+ "fbdevHWAdjustFrame",
+ "fbdevHWEnterVT",
+ "fbdevHWLeaveVT",
+ "fbdevHWValidMode",
+ "fbdevHWRestore",
+ "fbdevHWModeInit",
+ "fbdevHWSave",
+
+ "fbdevHWUnmapMMIO",
+ "fbdevHWUnmapVidmem",
+ "fbdevHWMapMMIO",
+ "fbdevHWMapVidmem",
+
+ NULL
+};
+
+const char *ddcSymbols[] = {
+ "xf86PrintEDID",
+ "xf86DoEDID_DDC1",
+ "xf86DoEDID_DDC2",
+ NULL
+};
+
+#ifdef XFree86LOADER
+#ifdef USE_FB
+static const char *fbSymbols[] = {
+ "fbScreenInit",
+ NULL
+};
+#else
+static const char *cfbSymbols[] = {
+ "cfbScreenInit",
+ "cfb16ScreenInit",
+ "cfb24ScreenInit",
+ "cfb32ScreenInit",
+ "cfb24_32ScreenInit",
+ NULL
+};
+#endif
+
+static const char *xaaSymbols[] = {
+ "XAADestroyInfoRec",
+ "XAACreateInfoRec",
+ "XAAInit",
+ "XAAStippleScanlineFuncLSBFirst",
+ "XAAOverlayFBfuncs",
+ "XAACachePlanarMonoStipple",
+ "XAAScreenIndex",
+ NULL
+};
+
+static const char *xf8_32bppSymbols[] = {
+ "xf86Overlay8Plus32Init",
+ NULL
+};
+
+static const char *ramdacSymbols[] = {
+ "xf86InitCursor",
+ "xf86CreateCursorInfoRec",
+ "xf86DestroyCursorInfoRec",
+ NULL
+};
+
+#ifdef XF86DRI
+static const char *drmSymbols[] = {
+ "drmAddBufs",
+ "drmAddMap",
+ "drmAvailable",
+ "drmCtlAddCommand",
+ "drmCtlInstHandler",
+ "drmGetInterruptFromBusID",
+ "drmMapBufs",
+ "drmMarkBufs",
+ "drmUnmapBufs",
+ "drmFreeVersion",
+ "drmGetVersion",
+ NULL
+};
+
+static const char *driSymbols[] = {
+ "DRIGetDrawableIndex",
+ "DRIFinishScreenInit",
+ "DRIDestroyInfoRec",
+ "DRICloseScreen",
+ "DRIDestroyInfoRec",
+ "DRIScreenInit",
+ "DRIDestroyInfoRec",
+ "DRICreateInfoRec",
+ "DRILock",
+ "DRIUnlock",
+ "DRIGetSAREAPrivate",
+ "DRIGetContext",
+ "DRIQueryVersion",
+ "GlxSetVisualConfigs",
+ NULL
+};
+#endif
+
+static const char *vbeSymbols[] = {
+ "VBEInit",
+ "vbeDoEDID",
+ NULL
+};
+
+static MODULESETUPPROTO(ATI2Setup);
+
+static XF86ModuleVersionInfo ATI2VersRec =
+{
+ ATI2_NAME,
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XF86_VERSION_CURRENT,
+ ATI2_VERSION_MAJOR, ATI2_VERSION_MINOR, ATI2_VERSION_PATCH,
+ ABI_CLASS_VIDEODRV,
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_VIDEODRV,
+ { 0, 0, 0, 0 }
+};
+
+XF86ModuleData ati2ModuleData = { &ATI2VersRec, ATI2Setup, 0 };
+XF86ModuleData r128ModuleData = { &ATI2VersRec, ATI2Setup, 0 };
+XF86ModuleData radeonModuleData = { &ATI2VersRec, ATI2Setup, 0 };
+
+static pointer ATI2Setup(pointer module, pointer opts, int *errmaj,
+ int *errmin)
+{
+ static Bool setupDone = FALSE;
+
+ /* This module should be loaded only once, but check to be sure. */
+
+ if (!setupDone) {
+ setupDone = TRUE;
+ xf86AddDriver(&R128, module, 0);
+
+ /*
+ * Modules that this driver always requires may be loaded here
+ * by calling LoadSubModule().
+ */
+ /* FIXME: add DRI support here */
+
+ /*
+ * Tell the loader about symbols from other modules that this
+ * module might refer to.
+ */
+ LoaderRefSymLists(vgahwSymbols,
+#ifdef USE_FB
+ fbSymbols,
+#else
+ cfbSymbols,
+#endif
+ xaaSymbols,
+ xf8_32bppSymbols,
+ ramdacSymbols,
+#ifdef XF86DRI
+ drmSymbols,
+ driSymbols,
+#endif
+ fbdevHWSymbols,
+ vbeSymbols,
+ /* ddcsymbols, */
+ /* i2csymbols, */
+ /* shadowSymbols, */
+ NULL);
+
+ /*
+ * The return value must be non-NULL on success even though there
+ * is no TearDownProc.
+ */
+ return (pointer)1;
+ } else {
+ if (errmaj) *errmaj = LDR_ONCEONLY;
+ return NULL;
+ }
+}
+#endif
+
+/* Return the options for supported chipset 'n'; NULL otherwise. */
+static OptionInfoPtr ATI2AvailableOptions(int chipid, int busid)
+{
+ OptionInfoPtr opts = NULL;
+
+ opts = R128AvailableOptions(chipid, busid);
+ if (!opts) opts = RADEONAvailableOptions(chipid, busid);
+
+ return opts;
+}
+
+/* Return the string name for supported chipset 'n'; NULL otherwise. */
+static void ATI2Identify(int flags)
+{
+ R128Identify(flags);
+ RADEONIdentify(flags);
+}
+
+/* Return TRUE if chipset is present; FALSE otherwise. */
+static Bool ATI2Probe(DriverPtr drv, int flags)
+{
+ Bool foundScreen = FALSE;
+
+ foundScreen |= R128Probe(drv, flags);
+ foundScreen |= RADEONProbe(drv, flags);
+
+ return foundScreen;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128.h b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128.h
index 29895d14d..8e60e2ae4 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128.h,v 1.12 2000/09/13 15:47:32 martin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128.h,v 1.15 2000/10/18 17:19:59 alanh Exp $ */
/**************************************************************************
Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
@@ -36,6 +36,50 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef _R128_H_
#define _R128_H_
+ /* Xv support */
+#include "xf86xv.h"
+#include "Xv.h"
+
+ /* vgahw module (for VC save/restore only) */
+#include "vgaHW.h"
+
+#include "fbdevhw.h"
+
+ /* XAA and Cursor Support */
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xf86Cursor.h"
+
+
+ /* PCI support */
+#include "xf86PciInfo.h"
+#include "xf86Pci.h"
+
+ /* DDC support */
+#include "xf86DDC.h"
+
+ /* VESA support */
+#include "vbe.h"
+
+ /* DRI support */
+#ifdef XF86DRI
+#include "GL/glxint.h"
+#include "GL/glxtokens.h"
+#include "xf86drm.h"
+#include "xf86drmR128.h"
+#include "sarea.h"
+#define _XF86DRI_SERVER_
+#include "xf86dri.h"
+#include "dri.h"
+#include "r128_dri.h"
+#include "r128_dripriv.h"
+#include "r128_sarea.h"
+#endif
+
+#ifdef RENDER
+#include "picturestr.h"
+#endif
+
#define R128_DEBUG 0 /* Turn off debugging output */
#define R128_TIMEOUT 2000000 /* Fall out of wait loops after this count */
#define R128_MMIOSIZE 0x80000
@@ -46,12 +90,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
ddx driver, the client-side DRI driver,
and the kernel-level DRM driver. */
#define R128_NAME "r128"
-#define R128_VERSION_MAJOR 3
-#define R128_VERSION_MINOR 1
-#define R128_VERSION_PATCH 1
-#define R128_VERSION ((R128_VERSION_MAJOR << 16) \
- | (R128_VERSION_MINOR << 8) \
- | R128_VERSION_PATCH)
#if R128_DEBUG
#define R128TRACE(x) \
@@ -210,7 +248,6 @@ typedef struct {
Bool PaletteSavedOnVT; /* Palette saved on last VT switch */
- I2CBusPtr i2c;
XAAInfoRecPtr accel;
Bool accelOn;
xf86CursorInfoPtr cursor;
@@ -325,6 +362,7 @@ typedef struct {
int textureSize;
int log2TexGran;
#endif
+ XF86VideoAdaptorPtr adaptor;
} R128InfoRec, *R128InfoPtr;
#define R128WaitForFifo(pScrn, entries) \
@@ -338,7 +376,7 @@ extern void R128WaitForIdle(ScrnInfoPtr pScrn);
extern void R128EngineReset(ScrnInfoPtr pScrn);
extern void R128EngineFlush(ScrnInfoPtr pScrn);
-extern int INPLL(ScrnInfoPtr pScrn, int addr);
+extern int R128INPLL(ScrnInfoPtr pScrn, int addr);
extern void R128WaitForVerticalSync(ScrnInfoPtr pScrn);
extern void R128AdjustFrame(int scrnIndex, int x, int y, int flags);
extern Bool R128SwitchMode(int ScrnIndex, DisplayModePtr mode, int flags);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_accel.c
index 0729e13a5..26ce9f163 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_accel.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_accel.c,v 1.14 2000/08/24 22:20:17 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_accel.c,v 1.16 2000/10/18 17:19:59 alanh Exp $ */
/**************************************************************************
Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
@@ -30,6 +30,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
* Authors:
* Rickard E. Faith <faith@precisioninsight.com>
* Kevin E. Martin <kevin@precisioninsight.com>
+ * Alan Hourihane <ahourihane@valinux.com>
*
* Credits:
*
@@ -48,6 +49,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Notes on unimplemented XAA optimizations:
*
+ * SetClipping: The Rage128 doesn't support the full 16bit registers needed
+ * for XAA clip rect support.
* SolidFillTrap: This will probably work if we can compute the correct
* Bresenham error values.
* TwoPointLine: The Rage 128 supports Bresenham lines instead.
@@ -61,17 +64,18 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
* direct/indirect method. If we had more data registers,
* then we could do better. If XAA supported a trigger write
* address, the code would be simpler.
+ * (Alan Hourihane) Update. We now use purely indirect and clip the full
+ * rectangle. Seems as the direct method has some problems
+ * with this, although this indirect method is much faster
+ * than the old method of setting up the engine per scanline.
+ * This code was the basis of the Radeon work we did.
* Color8x8PatternFill: Apparently, an 8x8 color brush cannot take an 8x8
* pattern from frame buffer memory.
- * ImageWrites: The direct method isn't supported because XAA does not
- * support a final trigger register write. The indirect
- * method slows down common operations. Perhaps additional
- * XAA flags to use this only for some operations would help.
+ * ImageWrites: See CPUToScreenColorExpandFill.
*
*/
-#define R128_CLIPPING 1
-#define R128_IMAGEWRITE 0 /* Indirect image write is slow */
+#define R128_IMAGEWRITE 0 /* Disable ImageWrites - faster in software */
#define R128_TRAPEZOIDS 0 /* Trapezoids don't work */
/* X and server generic header files */
@@ -88,26 +92,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "xaa.h"
#include "xf86Cursor.h"
- /* PCI support */
-#include "xf86PciInfo.h"
-#include "xf86Pci.h"
-
- /* DDC support */
-#include "xf86DDC.h"
-
- /* DRI support */
-#ifdef XF86DRI
-#include "GL/glxint.h"
-#include "xf86drm.h"
-#include "sarea.h"
-#define _XF86DRI_SERVER_
-#include "xf86dri.h"
-#include "dri.h"
-#include "r128_dri.h"
-#include "r128_dripriv.h"
-#include "r128_sarea.h"
-#endif
-
/* Driver data structures */
#include "r128.h"
#include "r128_reg.h"
@@ -137,25 +121,24 @@ static struct {
/* Flush all dirty data in the Pixel Cache to memory. */
void R128EngineFlush(ScrnInfoPtr pScrn)
{
- int i;
- unsigned int j;
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ int i;
OUTREGP(R128_PC_NGUI_CTLSTAT, R128_PC_FLUSH_ALL, ~R128_PC_FLUSH_ALL);
for (i = 0; i < R128_TIMEOUT; i++) {
- if (!((j=INREG(R128_PC_NGUI_CTLSTAT)) & R128_PC_BUSY)) break;
+ if (!(INREG(R128_PC_NGUI_CTLSTAT) & R128_PC_BUSY)) break;
}
}
/* Reset graphics card to known state. */
void R128EngineReset(ScrnInfoPtr pScrn)
{
- R128InfoPtr info = R128PTR(pScrn);
- CARD32 clock_cntl_index;
- CARD32 mclk_cntl;
- CARD32 gen_reset_cntl;
- unsigned int j;
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ CARD32 clock_cntl_index;
+ CARD32 mclk_cntl;
+ CARD32 gen_reset_cntl;
R128EngineFlush(pScrn);
@@ -167,9 +150,9 @@ void R128EngineReset(ScrnInfoPtr pScrn)
gen_reset_cntl = INREG(R128_GEN_RESET_CNTL);
OUTREG(R128_GEN_RESET_CNTL, gen_reset_cntl | R128_SOFT_RESET_GUI);
- j = INREG(R128_GEN_RESET_CNTL);
+ INREG(R128_GEN_RESET_CNTL);
OUTREG(R128_GEN_RESET_CNTL, gen_reset_cntl & ~R128_SOFT_RESET_GUI);
- j = INREG(R128_GEN_RESET_CNTL);
+ INREG(R128_GEN_RESET_CNTL);
OUTPLL(R128_MCLK_CNTL, mclk_cntl);
OUTREG(R128_CLOCK_CNTL_INDEX, clock_cntl_index);
@@ -184,20 +167,18 @@ void R128EngineReset(ScrnInfoPtr pScrn)
these slots are empty. */
void R128WaitForFifoFunction(ScrnInfoPtr pScrn, int entries)
{
- R128InfoPtr info = R128PTR(pScrn);
- int i;
- unsigned int j;
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ int i;
for (;;) {
for (i = 0; i < R128_TIMEOUT; i++) {
- j = INREG(R128_GUI_STAT);
- info->fifo_slots = j & R128_GUI_FIFOCNT_MASK;
+ info->fifo_slots = INREG(R128_GUI_STAT) & R128_GUI_FIFOCNT_MASK;
if (info->fifo_slots >= entries) return;
}
R128TRACE(("FIFO timed out: %d entries, stat=0x%08x, probe=0x%08x\n",
- j & R128_GUI_FIFOCNT_MASK,
- j,
+ INREG(R128_GUI_STAT) & R128_GUI_FIFOCNT_MASK,
+ INREG(R128_GUI_STAT),
INREG(R128_GUI_PROBE)));
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"FIFO timed out, resetting engine...\n");
@@ -213,24 +194,22 @@ void R128WaitForFifoFunction(ScrnInfoPtr pScrn, int entries)
standard "sync" function that will make the hardware "quiescent". */
void R128WaitForIdle(ScrnInfoPtr pScrn)
{
- R128InfoPtr info = R128PTR(pScrn);
- int i;
- unsigned int j;
- R128MMIO_VARS();
-
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ int i;
R128WaitForFifoFunction(pScrn, 64);
for (;;) {
for (i = 0; i < R128_TIMEOUT; i++) {
- if (!((j=INREG(R128_GUI_STAT)) & R128_GUI_ACTIVE)) {
+ if (!(INREG(R128_GUI_STAT) & R128_GUI_ACTIVE)) {
R128EngineFlush(pScrn);
return;
}
}
R128TRACE(("Idle timed out: %d entries, stat=0x%08x, probe=0x%08x\n",
- j & R128_GUI_FIFOCNT_MASK,
- j,
+ INREG(R128_GUI_STAT) & R128_GUI_FIFOCNT_MASK,
+ INREG(R128_GUI_STAT),
INREG(R128_GUI_PROBE)));
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Idle timed out, resetting engine...\n");
@@ -245,8 +224,8 @@ void R128WaitForIdle(ScrnInfoPtr pScrn)
static void R128SetupForSolidFill(ScrnInfoPtr pScrn,
int color, int rop, unsigned int planemask)
{
- R128InfoPtr info = R128PTR(pScrn);
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
R128WaitForFifo(pScrn, 4);
OUTREG(R128_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
@@ -266,8 +245,8 @@ static void R128SetupForSolidFill(ScrnInfoPtr pScrn,
static void R128SubsequentSolidFillRect(ScrnInfoPtr pScrn,
int x, int y, int w, int h)
{
- R128InfoPtr info = R128PTR(pScrn);
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
R128WaitForFifo(pScrn, 2);
OUTREG(R128_DST_Y_X, (y << 16) | x);
@@ -278,8 +257,8 @@ static void R128SubsequentSolidFillRect(ScrnInfoPtr pScrn,
static void R128SetupForSolidLine(ScrnInfoPtr pScrn,
int color, int rop, unsigned int planemask)
{
- R128InfoPtr info = R128PTR(pScrn);
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
R128WaitForFifo(pScrn, 3);
OUTREG(R128_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
@@ -309,9 +288,9 @@ static void R128SubsequentSolidBresenhamLine(ScrnInfoPtr pScrn,
int major, int minor,
int err, int len, int octant)
{
- R128InfoPtr info = R128PTR(pScrn);
- int flags = 0;
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ int flags = 0;
if (octant & YMAJOR) flags |= R128_DST_Y_MAJOR;
if (!(octant & XDECREASING)) flags |= R128_DST_X_DIR_LEFT_TO_RIGHT;
@@ -336,8 +315,8 @@ static void R128SubsequentSolidBresenhamLine(ScrnInfoPtr pScrn,
static void R128SubsequentSolidHorVertLine(ScrnInfoPtr pScrn,
int x, int y, int len, int dir )
{
- R128InfoPtr info = R128PTR(pScrn);
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
R128WaitForFifo(pScrn, 1);
OUTREG(R128_DP_CNTL, (R128_DST_X_LEFT_TO_RIGHT
@@ -369,9 +348,9 @@ static void R128SetupForDashedLine(ScrnInfoPtr pScrn,
int rop, unsigned int planemask,
int length, unsigned char *pattern)
{
- R128InfoPtr info = R128PTR(pScrn);
- CARD32 pat = *(CARD32 *)pattern;
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ CARD32 pat = *(CARD32 *)pattern;
switch (length) {
case 2: pat |= pat << 2; /* fall through */
@@ -400,9 +379,9 @@ static void R128SubsequentDashedBresenhamLine(ScrnInfoPtr pScrn,
int err, int len, int octant,
int phase)
{
- R128InfoPtr info = R128PTR(pScrn);
- int flags = 0;
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ int flags = 0;
if (octant & YMAJOR) flags |= R128_DST_Y_MAJOR;
if (!(octant & XDECREASING)) flags |= R128_DST_X_DIR_LEFT_TO_RIGHT;
@@ -433,12 +412,13 @@ static void R128SubsequentSolidFillTrap(ScrnInfoPtr pScrn, int y, int h,
int left, int dxL, int dyL, int eL,
int right, int dxR, int dyR, int eR)
{
- int flags = 0;
- int Lymajor = 0;
- int Rymajor = 0;
- int origdxL = dxL;
- int origdxR = dxR;
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ int flags = 0;
+ int Lymajor = 0;
+ int Rymajor = 0;
+ int origdxL = dxL;
+ int origdxR = dxR;
R128TRACE(("Trap %d %d; L %d %d %d %d; R %d %d %d %d\n",
y, h,
@@ -478,52 +458,6 @@ static void R128SubsequentSolidFillTrap(ScrnInfoPtr pScrn, int y, int h,
}
#endif
-#if R128_CLIPPING
-/* Setup for XAA clipping rectangle.
-
- Tests: xtest CH06/drwrctngl
-
- These x11perf data show why we don't use clipping for lines. Clipping
- can improve performance for other functions.
-
- 1024x768@76 8bpp
- Without With
- x11perf -seg100c1 241000.0/sec 185000.0/sec
- x11perf -seg100c2 238000.0/sec 154000.0/sec
- x11perf -seg100c3 194000.0/sec 132000.0/sec
-
-*/
-static void R128SetClippingRectangle(ScrnInfoPtr pScrn,
- int left, int top, int right, int bottom)
-{
- R128InfoPtr info = R128PTR(pScrn);
- R128MMIO_VARS();
-
- if (left > 8191 || top > 8191 || right > 8191 || bottom > 8191
- || left < 0 || top < 0 || right < 0 || bottom < 0
- || left > 4000 || right > 4000 || top > 4000 || bottom > 4000
- || left >= right || top >= bottom)
- R128TRACE(("Clip %d %d %d %d *************************************\n",
- left, top, right, bottom));
-
- R128WaitForFifo(pScrn, 2);
- OUTREG(R128_SC_TOP_LEFT, (top << 16) | left);
- OUTREG(R128_SC_BOTTOM_RIGHT, (bottom << 16) | right);
-}
-
-static void R128DisableClipping (ScrnInfoPtr pScrn)
-{
- R128InfoPtr info = R128PTR(pScrn);
- R128MMIO_VARS();
-
- R128WaitForFifo(pScrn, 2);
- OUTREG(R128_SC_TOP_LEFT, 0);
- OUTREG(R128_SC_BOTTOM_RIGHT, (R128_DEFAULT_SC_RIGHT_MAX
- | R128_DEFAULT_SC_BOTTOM_MAX));
-}
-#endif
-
-
/* Setup for XAA screen-to-screen copy.
Tests: xtest CH06/fllrctngl (also tests transparency).
@@ -533,8 +467,8 @@ static void R128SetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
unsigned int planemask,
int trans_color)
{
- R128InfoPtr info = R128PTR(pScrn);
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
info->xdir = xdir;
info->ydir = ydir;
@@ -566,8 +500,8 @@ static void R128SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
int x2, int y2,
int w, int h)
{
- R128InfoPtr info = R128PTR(pScrn);
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
if (info->xdir < 0) x1 += w - 1, x2 += w - 1;
if (info->ydir < 0) y1 += h - 1, y2 += h - 1;
@@ -595,8 +529,8 @@ static void R128SetupForMono8x8PatternFill(ScrnInfoPtr pScrn,
int fg, int bg, int rop,
unsigned int planemask)
{
- R128InfoPtr info = R128PTR(pScrn);
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
R128WaitForFifo(pScrn, 6);
OUTREG(R128_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
@@ -618,8 +552,8 @@ static void R128SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn,
int patternx, int patterny,
int x, int y, int w, int h)
{
- R128InfoPtr info = R128PTR(pScrn);
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
R128WaitForFifo(pScrn, 3);
OUTREG(R128_BRUSH_Y_X, (patterny << 8) | patternx);
@@ -637,8 +571,8 @@ static void R128SetupForColor8x8PatternFill(ScrnInfoPtr pScrn,
int rop, unsigned int planemask,
int trans_color)
{
- R128InfoPtr info = R128PTR(pScrn);
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
R128TRACE(("Color8x8 %d %d %d\n", trans_color, patx, paty));
@@ -665,7 +599,8 @@ static void R128SubsequentColor8x8PatternFillRect( ScrnInfoPtr pScrn,
int patx, int paty,
int x, int y, int w, int h)
{
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
R128TRACE(("Color8x8 %d,%d %d,%d %d %d\n", patx, paty, x, y, w, h));
R128WaitForFifo(pScrn, 3);
@@ -724,12 +659,13 @@ static void R128SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
unsigned int
planemask)
{
- R128InfoPtr info = R128PTR(pScrn);
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
R128WaitForFifo(pScrn, 4);
OUTREG(R128_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
- | R128_GMC_BRUSH_1X8_COLOR
+ | R128_GMC_DST_CLIPPING
+ | R128_GMC_BRUSH_NONE
| (bg == -1
? R128_GMC_SRC_DATATYPE_MONO_FG_LA
: R128_GMC_SRC_DATATYPE_MONO_FG_BG)
@@ -748,65 +684,74 @@ static void R128SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
int w, int h,
int skipleft)
{
- R128InfoPtr info = R128PTR(pScrn);
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ int x1clip = x+skipleft;
+ int x2clip = x+w;
- info->scanline_y = y;
- info->scanline_x = x;
info->scanline_h = h;
- info->scanline_h_w = (1 << 16) | w;
- info->scanline_words = (w + 31) / 32;
- info->scanline_direct = 0;
+ info->scanline_words = (w + 31) >> 5;
- if (info->scanline_words <= 9 && info->scanline_h > 1) {
- /* Turn on direct for next set of scan lines */
+#if 0
+ /* Seems as though the Rage128's doesn't like blitting directly
+ * as we must be overwriting something too quickly, therefore we
+ * render to the buffer first and then blit */
+ if ((info->scanline_words * h) <= 9) {
+ /* Turn on direct for less than 9 dword colour expansion */
info->scratch_buffer[0]
= (unsigned char *)(ADDRREG(R128_HOST_DATA_LAST)
- (info->scanline_words - 1));
- info->scanline_direct = 1;
+ info->scanline_direct = 1;
+ } else
+#endif
+ {
+ /* Use indirect for anything else */
+ info->scratch_buffer[0] = info->scratch_save;
+ info->scanline_direct = 0;
+ }
- /* Make engine ready for next line */
- R128WaitForFifo(pScrn, 2);
- OUTREG(R128_DST_Y_X, ((info->scanline_y++ << 16)
- | info->scanline_x));
- OUTREG(R128_DST_HEIGHT_WIDTH, info->scanline_h_w);
+ if (pScrn->bitsPerPixel == 24) {
+ x1clip *= 3;
+ x2clip *= 3;
}
+
+ R128WaitForFifo(pScrn, 4 + (info->scanline_direct ?
+ (info->scanline_words * h) : 0) );
+ OUTREG(R128_SC_TOP_LEFT, (y << 16) | (x1clip & 0xffff));
+ OUTREG(R128_SC_BOTTOM_RIGHT, ((y+h-1) << 16) | ((x2clip-1) & 0xffff));
+ OUTREG(R128_DST_Y_X, (y << 16) | (x & 0xffff));
+ /* Have to pad the width here and use clipping engine */
+ OUTREG(R128_DST_HEIGHT_WIDTH, (h << 16) | ((w + 31) & ~31));
}
/* Subsequent XAA indirect CPU-to-screen color expandion. This is called
once for each scanline. */
static void R128SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
{
- R128InfoPtr info = R128PTR(pScrn);
- CARD32 *p = (CARD32 *)info->scratch_buffer[bufno];
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ CARD32 *p = (CARD32 *)info->scratch_buffer[bufno];
int i;
- int left = info->scanline_words;
+ int left = info->scanline_words;
volatile CARD32 *d;
- R128MMIO_VARS();
-
- --info->scanline_h;
- if (info->scanline_direct) {
- if (info->scanline_h <= 1) {
- /* Turn off direct for last scan line */
- info->scratch_buffer[0] = info->scratch_save;
- info->scanline_direct = 0;
- return;
- }
- }
- R128WaitForFifo(pScrn, 2);
- OUTREG(R128_DST_Y_X, ((info->scanline_y++ << 16)
- | info->scanline_x));
- OUTREG(R128_DST_HEIGHT_WIDTH, info->scanline_h_w);
-
if (info->scanline_direct) return;
-
+ --info->scanline_h;
while (left) {
- if (left <= 9) {
+ if (left <= 8) {
+ /* Last scanline - finish write to DATA_LAST */
+ if (info->scanline_h == 0) {
R128WaitForFifo(pScrn, left);
/* Unrolling doesn't improve performance */
for (d = ADDRREG(R128_HOST_DATA_LAST) - (left - 1); left; --left)
*d++ = *p++;
+ return;
+ } else {
+ R128WaitForFifo(pScrn, left);
+ /* Unrolling doesn't improve performance */
+ for (d = ADDRREG(R128_HOST_DATA7) - (left - 1); left; --left)
+ *d++ = *p++;
+ }
} else {
R128WaitForFifo(pScrn, 8);
/* Unrolling doesn't improve performance */
@@ -817,7 +762,6 @@ static void R128SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
}
}
-#if R128_IMAGEWRITE
/* Setup for XAA indirect image write.
@@ -827,6 +771,7 @@ static void R128SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
x11perf -putimage100 2150.0/sec 1170.0/sec
x11perf -putimage500 108.0/sec 49.8/sec
*/
+#if R128_IMAGEWRITE
static void R128SetupForScanlineImageWrite(ScrnInfoPtr pScrn,
int rop,
unsigned int planemask,
@@ -834,14 +779,15 @@ static void R128SetupForScanlineImageWrite(ScrnInfoPtr pScrn,
int bpp,
int depth)
{
- R128InfoPtr info = R128PTR(pScrn);
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
info->scanline_bpp = bpp;
R128WaitForFifo(pScrn, 2);
OUTREG(R128_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
- | R128_GMC_BRUSH_SOLID_COLOR
+ | R128_GMC_DST_CLIPPING
+ | R128_GMC_BRUSH_1X8_COLOR
| R128_GMC_SRC_DATATYPE_COLOR
| R128_ROP[rop].rop
| R128_GMC_BYTE_LSB_TO_MSB
@@ -865,65 +811,78 @@ static void R128SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn,
int w, int h,
int skipleft)
{
- R128InfoPtr info = R128PTR(pScrn);
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ int x1clip = x+skipleft;
+ int x2clip = x+w;
+
+ int shift = 0; /* 32bpp */
+
+ if (pScrn->bitsPerPixel == 8) shift = 3;
+ else if (pScrn->bitsPerPixel == 16) shift = 1;
- info->scanline_y = y;
- info->scanline_x = x;
info->scanline_h = h;
- info->scanline_h_w = (1 << 16) | w;
- info->scanline_words = (w * info->scanline_bpp + 31) / 32;
- info->scanline_direct = 0;
+ info->scanline_words = (w * info->scanline_bpp + 31) >> 5;
- if (info->scanline_words <= 9 && info->scanline_h > 1) {
- /* Turn on direct for next set of scan lines */
+#if 0
+ /* Seeing as the CPUToScreen doesn't like this, I've done this
+ * here too, as it uses pretty much the same path. */
+ if ((info->scanline_words * h) <= 9) {
+ /* Turn on direct for less than 9 dword colour expansion */
info->scratch_buffer[0]
= (unsigned char *)(ADDRREG(R128_HOST_DATA_LAST)
- (info->scanline_words - 1));
- info->scanline_direct = 1;
+ info->scanline_direct = 1;
+ } else
+#endif
+ {
+ /* Use indirect for anything else */
+ info->scratch_buffer[0] = info->scratch_save;
+ info->scanline_direct = 0;
+ }
- /* Make engine ready for next line */
- R128WaitForFifo(pScrn, 2);
- OUTREG(R128_DST_Y_X, ((info->scanline_y++ << 16)
- | info->scanline_x));
- OUTREG(R128_DST_HEIGHT_WIDTH, info->scanline_h_w);
+ if (pScrn->bitsPerPixel == 24) {
+ x1clip *= 3;
+ x2clip *= 3;
}
+
+ R128WaitForFifo(pScrn, 4 + (info->scanline_direct ?
+ (info->scanline_words * h) : 0) );
+ OUTREG(R128_SC_TOP_LEFT, (y << 16) | (x1clip & 0xffff));
+ OUTREG(R128_SC_BOTTOM_RIGHT, ((y+h-1) << 16) | ((x2clip-1) & 0xffff));
+ OUTREG(R128_DST_Y_X, (y << 16) | (x & 0xffff));
+ /* Have to pad the width here and use clipping engine */
+ OUTREG(R128_DST_HEIGHT_WIDTH, (h << 16) | ((w + shift) & ~shift));
}
/* Subsequent XAA indirect iamge write. This is called once for each
scanline. */
static void R128SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno)
{
- R128InfoPtr info = R128PTR(pScrn);
- CARD32 *p = (CARD32 *)info->scratch_buffer[bufno];
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ CARD32 *p = (CARD32 *)info->scratch_buffer[bufno];
int i;
- int left = info->scanline_words;
+ int left = info->scanline_words;
volatile CARD32 *d;
- R128MMIO_VARS();
-
- --info->scanline_h;
- if (info->scanline_direct) {
- if (info->scanline_h <= 1) {
- /* Turn off direct for last scan line */
- info->scratch_buffer[0] = info->scratch_save;
- info->scanline_direct = 0;
- return;
- }
- }
-
- R128WaitForFifo(pScrn, 2);
- OUTREG(R128_DST_Y_X, ((info->scanline_y++ << 16)
- | info->scanline_x));
- OUTREG(R128_DST_HEIGHT_WIDTH, info->scanline_h_w);
if (info->scanline_direct) return;
-
+ --info->scanline_h;
while (left) {
- if (left <= 9) {
+ if (left <= 8) {
+ /* Last scanline - finish write to DATA_LAST */
+ if (info->scanline_h == 0) {
R128WaitForFifo(pScrn, left);
/* Unrolling doesn't improve performance */
for (d = ADDRREG(R128_HOST_DATA_LAST) - (left - 1); left; --left)
*d++ = *p++;
+ return;
+ } else {
+ R128WaitForFifo(pScrn, left);
+ /* Unrolling doesn't improve performance */
+ for (d = ADDRREG(R128_HOST_DATA7) - (left - 1); left; --left)
+ *d++ = *p++;
+ }
} else {
R128WaitForFifo(pScrn, 8);
/* Unrolling doesn't improve performance */
@@ -938,8 +897,8 @@ static void R128SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno)
/* Initialize the acceleration hardware. */
void R128EngineInit(ScrnInfoPtr pScrn)
{
- R128InfoPtr info = R128PTR(pScrn);
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
R128TRACE(("EngineInit (%d/%d)\n", info->CurrentLayout.pixel_code, info->CurrentLayout.bitsPerPixel));
@@ -975,8 +934,7 @@ void R128EngineInit(ScrnInfoPtr pScrn)
info->dp_gui_master_cntl = ((info->datatype << R128_GMC_DST_DATATYPE_SHIFT)
| R128_GMC_CLR_CMP_CNTL_DIS
- | R128_GMC_AUX_CLIP_DIS
- | R128_GMC_DST_CLIPPING);
+ | R128_GMC_AUX_CLIP_DIS);
R128WaitForFifo(pScrn, 1);
OUTREG(R128_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
| R128_GMC_BRUSH_SOLID_COLOR
@@ -992,6 +950,7 @@ void R128EngineInit(ScrnInfoPtr pScrn)
OUTREG(R128_DP_SRC_BKGD_CLR, 0x00000000);
OUTREG(R128_DP_WRITE_MASK, 0xffffffff);
+ R128WaitForFifo(pScrn, 1);
#if X_BYTE_ORDER == X_BIG_ENDIAN
OUTREGP(R128_DP_DATATYPE,
R128_HOST_BIG_ENDIAN_EN, ~R128_HOST_BIG_ENDIAN_EN);
@@ -1054,19 +1013,18 @@ static void R128MMIOAccelInit(ScrnInfoPtr pScrn, XAAInfoRecPtr a)
/* Indirect CPU-To-Screen Color Expand */
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
- a->ScanlineCPUToScreenColorExpandFillFlags = 0;
+ a->ScanlineCPUToScreenColorExpandFillFlags = LEFT_EDGE_CLIPPING
+ | LEFT_EDGE_CLIPPING_NEGATIVE_X;
#else
- a->ScanlineCPUToScreenColorExpandFillFlags = BIT_ORDER_IN_BYTE_MSBFIRST;
+ a->ScanlineCPUToScreenColorExpandFillFlags = BIT_ORDER_IN_BYTE_MSBFIRST
+ | LEFT_EDGE_CLIPPING
+ | LEFT_EDGE_CLIPPING_NEGATIVE_X;
#endif
a->NumScanlineColorExpandBuffers = 1;
a->ScanlineColorExpandBuffers = info->scratch_buffer;
-#if R128_IMAGEWRITE
info->scratch_save = xalloc(((pScrn->virtualX+31)/32*4)
- + (pScrn->virtualX
- * info->pixel_bytes));
-#else
- info->scratch_save = xalloc(((pScrn->virtualX+31)/32*4));
-#endif
+ + (pScrn->virtualX
+ * info->CurrentLayout.pixel_bytes));
info->scratch_buffer[0] = info->scratch_save;
a->SetupForScanlineCPUToScreenColorExpandFill
= R128SetupForScanlineCPUToScreenColorExpandFill;
@@ -1085,33 +1043,22 @@ static void R128MMIOAccelInit(ScrnInfoPtr pScrn, XAAInfoRecPtr a)
a->DashPatternMaxLength = 32;
a->DashedLineFlags = (LINE_PATTERN_LSBFIRST_LSBJUSTIFIED
| LINE_PATTERN_POWER_OF_2_ONLY);
-#if R128_CLIPPING
- /* Clipping. */
- if (info->CurrentLayout.depth != 8 && info->CurrentLayout.pixel_code != 24) {
- /* There is one xtest error in 8bpp and
- many xtest errors in 24/24 that do not
- appear at other depths. */
- a->SetClippingRectangle = R128SetClippingRectangle;
- a->DisableClipping = R128DisableClipping;
- a->ClippingFlags
- = (HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY
- | HARDWARE_CLIP_MONO_8x8_FILL
- | HARDWARE_CLIP_COLOR_8x8_FILL
- | HARDWARE_CLIP_SOLID_FILL);
- }
-#endif
-#if R128_IMAGEWRITE
/* ImageWrite */
+#if R128_IMAGEWRITE
a->NumScanlineImageWriteBuffers = 1;
a->ScanlineImageWriteBuffers = info->scratch_buffer;
info->scratch_buffer[0] = info->scratch_save;
a->SetupForScanlineImageWrite = R128SetupForScanlineImageWrite;
a->SubsequentScanlineImageWriteRect= R128SubsequentScanlineImageWriteRect;
a->SubsequentImageWriteScanline = R128SubsequentImageWriteScanline;
- a->ImageWriteFlags = (CPU_TRANSFER_PAD_DWORD
- | SCANLINE_PAD_DWORD
- | SYNC_AFTER_IMAGE_WRITE);
+ a->ScanlineImageWriteFlags = CPU_TRANSFER_PAD_DWORD
+ /* Performance tests show that we shouldn't use GXcopy for
+ * uploads as a memcpy is faster */
+ | NO_GXCOPY
+ | LEFT_EDGE_CLIPPING
+ | LEFT_EDGE_CLIPPING_NEGATIVE_X
+ | SCANLINE_PAD_DWORD;
#endif
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_cursor.c b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_cursor.c
index 586a5c36a..02f9d80c9 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_cursor.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_cursor.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_cursor.c,v 1.9 2000/06/17 00:27:32 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_cursor.c,v 1.11 2000/10/18 17:19:59 alanh Exp $ */
/**************************************************************************
Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
@@ -53,6 +53,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "xaa.h"
#include "xf86Cursor.h"
+#include "xf86xv.h"
+
/* PCI support */
#include "xf86PciInfo.h"
#include "xf86Pci.h"
@@ -95,7 +97,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
/* Set cursor foreground and background colors. */
static void R128SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
{
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
OUTREG(R128_CUR_CLR0, bg);
OUTREG(R128_CUR_CLR1, fg);
@@ -105,12 +108,12 @@ static void R128SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
(xorigin,yorigin). */
static void R128SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
{
- R128InfoPtr info = R128PTR(pScrn);
- xf86CursorInfoPtr cursor = info->cursor;
- int xorigin = 0;
- int yorigin = 0;
- int total_y = pScrn->frameY1 - pScrn->frameY0;
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ xf86CursorInfoPtr cursor = info->cursor;
+ int xorigin = 0;
+ int yorigin = 0;
+ int total_y = pScrn->frameY1 - pScrn->frameY0;
if (x < 0) xorigin = -x;
if (y < 0) yorigin = -y;
@@ -130,12 +133,12 @@ static void R128SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
will be called after this, so we can ignore xorigin and yorigin. */
static void R128LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *image)
{
- R128InfoPtr info = R128PTR(pScrn);
- CARD32 *s = (CARD32 *)image;
- CARD32 *d = (CARD32 *)(info->FB + info->cursor_start);
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ CARD32 *s = (CARD32 *)image;
+ CARD32 *d = (CARD32 *)(info->FB + info->cursor_start);
int y;
CARD32 save;
- R128MMIO_VARS();
save = INREG(R128_CRTC_GEN_CNTL);
OUTREG(R128_CRTC_GEN_CNTL, save & ~R128_CRTC_CUR_EN);
@@ -200,7 +203,8 @@ static void R128LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *image)
/* Hide hardware cursor. */
static void R128HideCursor(ScrnInfoPtr pScrn)
{
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
OUTREGP(R128_CRTC_GEN_CNTL, 0, ~R128_CRTC_CUR_EN);
}
@@ -208,7 +212,8 @@ static void R128HideCursor(ScrnInfoPtr pScrn)
/* Show hardware cursor. */
static void R128ShowCursor(ScrnInfoPtr pScrn)
{
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
OUTREGP(R128_CRTC_GEN_CNTL, R128_CRTC_CUR_EN, ~R128_CRTC_CUR_EN);
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_dga.c
index 918928861..9206f4728 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_dga.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_dga.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_dga.c,v 1.2 2000/06/17 00:03:22 martin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_dga.c,v 1.4 2000/10/18 17:20:00 alanh Exp $ */
/*
* Authors:
* Ove Kåven <ovek@transgaming.com>,
@@ -10,31 +10,6 @@
#include "xf86_OSproc.h"
#include "xf86_ansic.h"
- /* PCI support */
-#include "xf86Pci.h"
-#include "xf86PciInfo.h"
-
- /* DDC support */
-#include "xf86DDC.h"
-
- /* XAA and Cursor Support */
-#include "xaa.h"
-#include "xaalocal.h"
-#include "xf86Cursor.h"
-
- /* DRI support */
-#ifdef XF86DRI
-#include "GL/glxint.h"
-#include "xf86drm.h"
-#include "sarea.h"
-#define _XF86DRI_SERVER_
-#include "xf86dri.h"
-#include "dri.h"
-#include "r128_dri.h"
-#include "r128_dripriv.h"
-#include "r128_sarea.h"
-#endif
-
/* Driver data structures */
#include "r128.h"
@@ -49,8 +24,10 @@ static int R128_GetViewport(ScrnInfoPtr);
static void R128_SetViewport(ScrnInfoPtr, int, int, int);
static void R128_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long);
static void R128_BlitRect(ScrnInfoPtr, int, int, int, int, int, int);
+#if 0
static void R128_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int,
unsigned long);
+#endif
static
DGAFunctionRec R128_DGAFuncs = {
@@ -344,6 +321,7 @@ R128_BlitRect(
}
+#if 0
static void
R128_BlitTransRect(
ScrnInfoPtr pScrn,
@@ -355,6 +333,7 @@ R128_BlitTransRect(
/* this one should be separate since the XAA function would
prohibit usage of ~0 as the key */
}
+#endif
static Bool
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_dri.c
index 4e8005602..e069bf08a 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_dri.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_dri.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_dri.c,v 1.5 2000/08/25 13:42:37 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_dri.c,v 1.6 2000/10/18 17:20:00 alanh Exp $ */
/**************************************************************************
Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
@@ -59,31 +59,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "cfb32.h"
#include "cfb24_32.h"
- /* XAA and Cursor Support */
-#include "xaa.h"
-#include "xf86Cursor.h"
-
- /* PCI support */
-#include "xf86PciInfo.h"
-#include "xf86Pci.h"
-
- /* DDC support */
-#include "xf86DDC.h"
-
- /* DRI support */
-#include "GL/glxint.h"
-#include "GL/glxtokens.h"
-#include "xf86drm.h"
-#include "xf86drmR128.h"
-#include "sarea.h"
-#define _XF86DRI_SERVER_
-#include "xf86dri.h"
-#include "dri.h"
-#include "r128_dri.h"
-#include "r128_sarea.h"
-#include "r128_dripriv.h"
-
/* Driver data structures */
+#include "ati2.h"
#include "r128.h"
#include "r128_reg.h"
@@ -104,9 +81,9 @@ do { \
slots available is stored in info->CCEFifoSize. */
static void R128CCEWaitForFifoFunction(ScrnInfoPtr pScrn, int entries)
{
- R128InfoPtr info = R128PTR(pScrn);
+ R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
- int i;
+ int i;
for (;;) {
for (i = 0; i < R128_TIMEOUT; i++) {
@@ -122,9 +99,9 @@ static void R128CCEWaitForFifoFunction(ScrnInfoPtr pScrn, int entries)
CCE is idle. */
void R128CCEWaitForIdle(ScrnInfoPtr pScrn)
{
- R128InfoPtr info = R128PTR(pScrn);
+ R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
- int i;
+ int i;
if (!info->CCEInUse || info->CCEMode == R128_PM4_NONPM4) return;
@@ -172,9 +149,9 @@ void R128CCEWaitForIdle(ScrnInfoPtr pScrn)
/* Reset the ring buffer status, if the engine was reset */
void R128CCEResetRing(ScrnInfoPtr pScrn)
{
- R128InfoPtr info = R128PTR(pScrn);
- unsigned char *R128MMIO = info->MMIO;
- R128SAREAPrivPtr pSAREAPriv;
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ R128SAREAPrivPtr pSAREAPriv;
volatile CARD32 *r128RingReadPtr;
if (!info->CCEInUse || info->CCEMode == R128_PM4_NONPM4) return;
@@ -195,7 +172,7 @@ void R128CCEResetRing(ScrnInfoPtr pScrn)
mode is a CCE mode. The mode is stored in info->CCEMode. */
void R128CCEStart(ScrnInfoPtr pScrn)
{
- R128InfoPtr info = R128PTR(pScrn);
+ R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
if (info->CCEInUse || info->CCEMode == R128_PM4_NONPM4) return;
@@ -212,7 +189,7 @@ void R128CCEStart(ScrnInfoPtr pScrn)
requests before switching modes.*/
void R128CCEStop(ScrnInfoPtr pScrn)
{
- R128InfoPtr info = R128PTR(pScrn);
+ R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
if (!info->CCEInUse || info->CCEMode == R128_PM4_NONPM4) return;
@@ -231,14 +208,14 @@ void R128CCEStop(ScrnInfoPtr pScrn)
static Bool R128InitVisualConfigs(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- R128InfoPtr pR128 = R128PTR(pScrn);
+ R128InfoPtr info = R128PTR(pScrn);
int numConfigs = 0;
__GLXvisualConfig *pConfigs = 0;
R128ConfigPrivPtr pR128Configs = 0;
R128ConfigPrivPtr *pR128ConfigPtrs = 0;
int i, accum, stencil;
- switch (pR128->CurrentLayout.pixel_code) {
+ switch (info->CurrentLayout.pixel_code) {
case 8: /* 8bpp mode is not support */
case 15: /* FIXME */
case 24: /* FIXME */
@@ -395,9 +372,9 @@ static Bool R128InitVisualConfigs(ScreenPtr pScreen)
break;
}
- pR128->numVisualConfigs = numConfigs;
- pR128->pVisualConfigs = pConfigs;
- pR128->pVisualConfigsPriv = pR128Configs;
+ info->numVisualConfigs = numConfigs;
+ info->pVisualConfigs = pConfigs;
+ info->pVisualConfigsPriv = pR128Configs;
GlxSetVisualConfigs(numConfigs, pConfigs, (void**)pR128ConfigPtrs);
return TRUE;
}
@@ -427,15 +404,15 @@ static void R128DestroyContext(ScreenPtr pScreen, drmContext hwContext,
static void R128EnterServer(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- R128InfoPtr pR128 = R128PTR(pScrn);
+ R128InfoPtr info = R128PTR(pScrn);
- if (pR128->accel) pR128->accel->NeedToSync = TRUE;
+ if (info->accel) info->accel->NeedToSync = TRUE;
#if 1
- if (!pR128->CCE2D) R128CCEStop(pScrn);
+ if (!info->CCE2D) R128CCEStop(pScrn);
#else
- if (pR128->CCE2D) R128CCEWaitForIdle(pScrn);
- else R128CCEStop(pScrn);
+ if (info->CCE2D) R128CCEWaitForIdle(pScrn);
+ else R128CCEStop(pScrn);
#endif
}
@@ -448,13 +425,13 @@ static void R128EnterServer(ScreenPtr pScreen)
static void R128LeaveServer(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- R128InfoPtr pR128 = R128PTR(pScrn);
+ R128InfoPtr info = R128PTR(pScrn);
#if 1
- if (!pR128->CCE2D) R128CCEStart(pScrn);
+ if (!info->CCE2D) R128CCEStart(pScrn);
#else
- if (pR128->CCE2D) R128CCEWaitForIdle(pScrn);
- else R128CCEStart(pScrn);
+ if (info->CCE2D) R128CCEWaitForIdle(pScrn);
+ else R128CCEStart(pScrn);
#endif
}
@@ -482,13 +459,13 @@ static void R128DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index)
/* FIXME: This routine needs to have acceleration turned on */
ScreenPtr pScreen = pWin->drawable.pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- R128InfoPtr pR128 = R128PTR(pScrn);
+ R128InfoPtr info = R128PTR(pScrn);
BoxPtr pbox;
int nbox;
int depth;
/* FIXME: Use accel when CCE 2D code is written */
- if (pR128->CCE2D) return;
+ if (info->CCE2D) return;
/* FIXME: This should be based on the __GLXvisualConfig info */
switch (pScrn->bitsPerPixel) {
@@ -506,29 +483,29 @@ static void R128DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index)
pbox = REGION_RECTS(prgn);
nbox = REGION_NUM_RECTS(prgn);
- (*pR128->accel->SetupForSolidFill)(pScrn, 0, GXcopy, -1);
+ (*info->accel->SetupForSolidFill)(pScrn, 0, GXcopy, -1);
for (; nbox; nbox--, pbox++) {
- (*pR128->accel->SubsequentSolidFillRect)(pScrn,
- pbox->x1 + pR128->fbX,
- pbox->y1 + pR128->fbY,
- pbox->x2 - pbox->x1,
- pbox->y2 - pbox->y1);
- (*pR128->accel->SubsequentSolidFillRect)(pScrn,
- pbox->x1 + pR128->backX,
- pbox->y1 + pR128->backY,
- pbox->x2 - pbox->x1,
- pbox->y2 - pbox->y1);
+ (*info->accel->SubsequentSolidFillRect)(pScrn,
+ pbox->x1 + info->fbX,
+ pbox->y1 + info->fbY,
+ pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1);
+ (*info->accel->SubsequentSolidFillRect)(pScrn,
+ pbox->x1 + info->backX,
+ pbox->y1 + info->backY,
+ pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1);
}
- (*pR128->accel->SetupForSolidFill)(pScrn, depth, GXcopy, -1);
+ (*info->accel->SetupForSolidFill)(pScrn, depth, GXcopy, -1);
for (; nbox; nbox--, pbox++)
- (*pR128->accel->SubsequentSolidFillRect)(pScrn,
- pbox->x1 + pR128->depthX,
- pbox->y1 + pR128->depthY,
- pbox->x2 - pbox->x1,
- pbox->y2 - pbox->y1);
+ (*info->accel->SubsequentSolidFillRect)(pScrn,
+ pbox->x1 + info->depthX,
+ pbox->y1 + info->depthY,
+ pbox->x2 - pbox->x1,
+ pbox->y2 - pbox->y1);
- pR128->accel->NeedToSync = TRUE;
+ info->accel->NeedToSync = TRUE;
}
/* Copy the back and depth buffers when the X server moves a window. */
@@ -537,7 +514,7 @@ static void R128DRIMoveBuffers(WindowPtr pWin, DDXPointRec ptOldOrg,
{
ScreenPtr pScreen = pWin->drawable.pScreen;
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- R128InfoPtr pR128 = R128PTR(pScrn);
+ R128InfoPtr info = R128PTR(pScrn);
/* FIXME: This routine needs to have acceleration turned on */
/* FIXME: Copy XAACopyWindow() and use REGION_TRANSLATE() */
@@ -545,14 +522,14 @@ static void R128DRIMoveBuffers(WindowPtr pWin, DDXPointRec ptOldOrg,
that request them */
/* FIXME: Use accel when CCE 2D code is written */
- if (pR128->CCE2D) return;
+ if (info->CCE2D) return;
}
/* Initialize the AGP state. Request memory for use in AGP space, and
initialize the Rage 128 registers to point to that memory. */
-static Bool R128DRIAgpInit(R128InfoPtr pR128, ScreenPtr pScreen)
+static Bool R128DRIAgpInit(R128InfoPtr info, ScreenPtr pScreen)
{
- unsigned char *R128MMIO = pR128->MMIO;
+ unsigned char *R128MMIO = info->MMIO;
unsigned long mode;
unsigned int vendor, device;
int ret;
@@ -560,7 +537,7 @@ static Bool R128DRIAgpInit(R128InfoPtr pR128, ScreenPtr pScreen)
int s, l;
int flags;
- if (drmAgpAcquire(pR128->drmFD) < 0) {
+ if (drmAgpAcquire(info->drmFD) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] AGP not available\n");
return FALSE;
}
@@ -570,12 +547,12 @@ static Bool R128DRIAgpInit(R128InfoPtr pR128, ScreenPtr pScreen)
combination of graphics card and AGP
chipset. */
- mode = drmAgpGetMode(pR128->drmFD); /* Default mode */
- vendor = drmAgpVendorId(pR128->drmFD);
- device = drmAgpDeviceId(pR128->drmFD);
+ mode = drmAgpGetMode(info->drmFD); /* Default mode */
+ vendor = drmAgpVendorId(info->drmFD);
+ device = drmAgpDeviceId(info->drmFD);
mode &= ~R128_AGP_MODE_MASK;
- switch (pR128->agpMode) {
+ switch (info->agpMode) {
case 2: mode |= R128_AGP_2X_MODE;
case 1: default: mode |= R128_AGP_1X_MODE;
}
@@ -583,161 +560,161 @@ static Bool R128DRIAgpInit(R128InfoPtr pR128, ScreenPtr pScreen)
xf86DrvMsg(pScreen->myNum, X_INFO,
"[agp] Mode 0x%08lx [AGP 0x%04x/0x%04x; Card 0x%04x/0x%04x]\n",
mode, vendor, device,
- pR128->PciInfo->vendor,
- pR128->PciInfo->chipType);
+ info->PciInfo->vendor,
+ info->PciInfo->chipType);
- if (drmAgpEnable(pR128->drmFD, mode) < 0) {
+ if (drmAgpEnable(info->drmFD, mode) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] AGP not enabled\n");
- drmAgpRelease(pR128->drmFD);
+ drmAgpRelease(info->drmFD);
return FALSE;
}
- pR128->agpOffset = 0;
+ info->agpOffset = 0;
- if ((ret = drmAgpAlloc(pR128->drmFD, pR128->agpSize*1024*1024, 0, NULL,
- &pR128->agpMemHandle)) < 0) {
+ if ((ret = drmAgpAlloc(info->drmFD, info->agpSize*1024*1024, 0, NULL,
+ &info->agpMemHandle)) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] Out of memory (%d)\n", ret);
- drmAgpRelease(pR128->drmFD);
+ drmAgpRelease(info->drmFD);
return FALSE;
}
xf86DrvMsg(pScreen->myNum, X_INFO,
"[agp] %d kB allocated with handle 0x%08x\n",
- pR128->agpSize*1024, pR128->agpMemHandle);
+ info->agpSize*1024, info->agpMemHandle);
- if (drmAgpBind(pR128->drmFD, pR128->agpMemHandle, pR128->agpOffset) < 0) {
+ if (drmAgpBind(info->drmFD, info->agpMemHandle, info->agpOffset) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] Could not bind\n");
- drmAgpFree(pR128->drmFD, pR128->agpMemHandle);
- drmAgpRelease(pR128->drmFD);
+ drmAgpFree(info->drmFD, info->agpMemHandle);
+ drmAgpRelease(info->drmFD);
return FALSE;
}
/* Initialize the CCE ring buffer data */
- pR128->ringStart = pR128->agpOffset;
- pR128->ringMapSize = pR128->ringSize*1024*1024 + 4096;
- pR128->ringSizeLog2QW = R128MinBits(pR128->ringSize*1024*1024/8) - 1;
+ info->ringStart = info->agpOffset;
+ info->ringMapSize = info->ringSize*1024*1024 + 4096;
+ info->ringSizeLog2QW = R128MinBits(info->ringSize*1024*1024/8) - 1;
- pR128->ringReadOffset = pR128->ringStart + pR128->ringMapSize;
- pR128->ringReadMapSize = 4096;
+ info->ringReadOffset = info->ringStart + info->ringMapSize;
+ info->ringReadMapSize = 4096;
/* Reserve space for the vertex buffer */
- pR128->vbStart = pR128->ringReadOffset + pR128->ringReadMapSize;
- pR128->vbMapSize = pR128->vbSize*1024*1024;
+ info->vbStart = info->ringReadOffset + info->ringReadMapSize;
+ info->vbMapSize = info->vbSize*1024*1024;
/* Reserve space for the indirect buffer */
- pR128->indStart = pR128->vbStart + pR128->vbMapSize;
- pR128->indMapSize = pR128->indSize*1024*1024;
+ info->indStart = info->vbStart + info->vbMapSize;
+ info->indMapSize = info->indSize*1024*1024;
/* Reserve the rest for AGP textures */
- pR128->agpTexStart = pR128->indStart + pR128->indMapSize;
- s = (pR128->agpSize*1024*1024 - pR128->agpTexStart);
+ info->agpTexStart = info->indStart + info->indMapSize;
+ s = (info->agpSize*1024*1024 - info->agpTexStart);
l = R128MinBits((s-1) / R128_NR_TEX_REGIONS);
if (l < R128_LOG_TEX_GRANULARITY) l = R128_LOG_TEX_GRANULARITY;
- pR128->agpTexMapSize = (s >> l) << l;
- pR128->log2AGPTexGran = l;
+ info->agpTexMapSize = (s >> l) << l;
+ info->log2AGPTexGran = l;
- if (pR128->CCESecure) flags = DRM_READ_ONLY;
+ if (info->CCESecure) flags = DRM_READ_ONLY;
else flags = 0;
- if (drmAddMap(pR128->drmFD, pR128->ringStart, pR128->ringMapSize,
- DRM_AGP, flags, &pR128->ringHandle) < 0) {
+ if (drmAddMap(info->drmFD, info->ringStart, info->ringMapSize,
+ DRM_AGP, flags, &info->ringHandle) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
"[agp] Could not add ring mapping\n");
return FALSE;
}
xf86DrvMsg(pScreen->myNum, X_INFO,
- "[agp] ring handle = 0x%08lx\n", pR128->ringHandle);
+ "[agp] ring handle = 0x%08lx\n", info->ringHandle);
- if (drmMap(pR128->drmFD, pR128->ringHandle, pR128->ringMapSize,
- (drmAddressPtr)&pR128->ring) < 0) {
+ if (drmMap(info->drmFD, info->ringHandle, info->ringMapSize,
+ (drmAddressPtr)&info->ring) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] Could not map ring\n");
return FALSE;
}
xf86DrvMsg(pScreen->myNum, X_INFO,
"[agp] Ring mapped at 0x%08lx\n",
- (unsigned long)pR128->ring);
+ (unsigned long)info->ring);
- if (drmAddMap(pR128->drmFD, pR128->ringReadOffset, pR128->ringReadMapSize,
- DRM_AGP, flags, &pR128->ringReadPtrHandle) < 0) {
+ if (drmAddMap(info->drmFD, info->ringReadOffset, info->ringReadMapSize,
+ DRM_AGP, flags, &info->ringReadPtrHandle) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
"[agp] Could not add ring read ptr mapping\n");
return FALSE;
}
xf86DrvMsg(pScreen->myNum, X_INFO,
"[agp] ring read ptr handle = 0x%08lx\n",
- pR128->ringReadPtrHandle);
+ info->ringReadPtrHandle);
- if (drmMap(pR128->drmFD, pR128->ringReadPtrHandle, pR128->ringReadMapSize,
- (drmAddressPtr)&pR128->ringReadPtr) < 0) {
+ if (drmMap(info->drmFD, info->ringReadPtrHandle, info->ringReadMapSize,
+ (drmAddressPtr)&info->ringReadPtr) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
"[agp] Could not map ring read ptr\n");
return FALSE;
}
xf86DrvMsg(pScreen->myNum, X_INFO,
"[agp] Ring read ptr mapped at 0x%08lx\n",
- (unsigned long)pR128->ringReadPtr);
+ (unsigned long)info->ringReadPtr);
- if (drmAddMap(pR128->drmFD, pR128->vbStart, pR128->vbMapSize,
- DRM_AGP, 0, &pR128->vbHandle) < 0) {
+ if (drmAddMap(info->drmFD, info->vbStart, info->vbMapSize,
+ DRM_AGP, 0, &info->vbHandle) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
"[agp] Could not add vertex buffers mapping\n");
return FALSE;
}
xf86DrvMsg(pScreen->myNum, X_INFO,
- "[agp] vertex buffers handle = 0x%08lx\n", pR128->vbHandle);
+ "[agp] vertex buffers handle = 0x%08lx\n", info->vbHandle);
- if (drmMap(pR128->drmFD, pR128->vbHandle, pR128->vbMapSize,
- (drmAddressPtr)&pR128->vb) < 0) {
+ if (drmMap(info->drmFD, info->vbHandle, info->vbMapSize,
+ (drmAddressPtr)&info->vb) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
"[agp] Could not map vertex buffers\n");
return FALSE;
}
xf86DrvMsg(pScreen->myNum, X_INFO,
"[agp] Vertex buffers mapped at 0x%08lx\n",
- (unsigned long)pR128->vb);
+ (unsigned long)info->vb);
- if (drmAddMap(pR128->drmFD, pR128->indStart, pR128->indMapSize,
- DRM_AGP, flags, &pR128->indHandle) < 0) {
+ if (drmAddMap(info->drmFD, info->indStart, info->indMapSize,
+ DRM_AGP, flags, &info->indHandle) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
"[agp] Could not add indirect buffers mapping\n");
return FALSE;
}
xf86DrvMsg(pScreen->myNum, X_INFO,
- "[agp] indirect buffers handle = 0x%08lx\n", pR128->indHandle);
+ "[agp] indirect buffers handle = 0x%08lx\n", info->indHandle);
- if (drmMap(pR128->drmFD, pR128->indHandle, pR128->indMapSize,
- (drmAddressPtr)&pR128->ind) < 0) {
+ if (drmMap(info->drmFD, info->indHandle, info->indMapSize,
+ (drmAddressPtr)&info->ind) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
"[agp] Could not map indirect buffers\n");
return FALSE;
}
xf86DrvMsg(pScreen->myNum, X_INFO,
"[agp] Indirect buffers mapped at 0x%08lx\n",
- (unsigned long)pR128->ind);
+ (unsigned long)info->ind);
- if (drmAddMap(pR128->drmFD, pR128->agpTexStart, pR128->agpTexMapSize,
- DRM_AGP, 0, &pR128->agpTexHandle) < 0) {
+ if (drmAddMap(info->drmFD, info->agpTexStart, info->agpTexMapSize,
+ DRM_AGP, 0, &info->agpTexHandle) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
"[agp] Could not add AGP texture map mapping\n");
return FALSE;
}
xf86DrvMsg(pScreen->myNum, X_INFO,
"[agp] AGP texture map handle = 0x%08lx\n",
- pR128->agpTexHandle);
+ info->agpTexHandle);
- if (drmMap(pR128->drmFD, pR128->agpTexHandle, pR128->agpTexMapSize,
- (drmAddressPtr)&pR128->agpTex) < 0) {
+ if (drmMap(info->drmFD, info->agpTexHandle, info->agpTexMapSize,
+ (drmAddressPtr)&info->agpTex) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
"[agp] Could not map AGP texture map\n");
return FALSE;
}
xf86DrvMsg(pScreen->myNum, X_INFO,
"[agp] AGP Texture map mapped at 0x%08lx\n",
- (unsigned long)pR128->agpTex);
+ (unsigned long)info->agpTex);
/* Initialize Rage 128's AGP registers */
cntl = INREG(R128_AGP_CNTL);
cntl &= ~R128_AGP_APER_SIZE_MASK;
- switch (pR128->agpSize) {
+ switch (info->agpSize) {
case 256: cntl |= R128_AGP_APER_SIZE_256MB; break;
case 128: cntl |= R128_AGP_APER_SIZE_128MB; break;
case 64: cntl |= R128_AGP_APER_SIZE_64MB; break;
@@ -748,41 +725,41 @@ static Bool R128DRIAgpInit(R128InfoPtr pR128, ScreenPtr pScreen)
default:
xf86DrvMsg(pScreen->myNum, X_ERROR,
"[agp] Illegal aperture size %d kB\n",
- pR128->agpSize*1024);
+ info->agpSize*1024);
return FALSE;
}
- OUTREG(R128_AGP_BASE, pR128->ringHandle); /* Ring buf is at AGP offset 0 */
+ OUTREG(R128_AGP_BASE, info->ringHandle); /* Ring buf is at AGP offset 0 */
OUTREG(R128_AGP_CNTL, cntl);
return TRUE;
}
/* Fake the vertex buffers for PCI cards. */
-static Bool R128DRIPciInit(R128InfoPtr pR128, ScreenPtr pScreen)
+static Bool R128DRIPciInit(R128InfoPtr info, ScreenPtr pScreen)
{
- pR128->vbStart = 0;
- pR128->vbMapSize = pR128->vbSize*1024*1024;
+ info->vbStart = 0;
+ info->vbMapSize = info->vbSize*1024*1024;
return TRUE;
}
/* Add a map for the MMIO registers that will be accessed by any
DRI-based clients. */
-static Bool R128DRIMapInit(R128InfoPtr pR128, ScreenPtr pScreen)
+static Bool R128DRIMapInit(R128InfoPtr info, ScreenPtr pScreen)
{
int flags;
- if (pR128->CCESecure) flags = DRM_READ_ONLY;
- else flags = 0;
+ if (info->CCESecure) flags = DRM_READ_ONLY;
+ else flags = 0;
/* Map registers */
- pR128->registerSize = R128_MMIOSIZE;
- if (drmAddMap(pR128->drmFD, pR128->MMIOAddr, pR128->registerSize,
- DRM_REGISTERS, flags, &pR128->registerHandle) < 0) {
+ info->registerSize = R128_MMIOSIZE;
+ if (drmAddMap(info->drmFD, info->MMIOAddr, info->registerSize,
+ DRM_REGISTERS, flags, &info->registerHandle) < 0) {
return FALSE;
}
xf86DrvMsg(pScreen->myNum, X_INFO,
- "[drm] register handle = 0x%08lx\n", pR128->registerHandle);
+ "[drm] register handle = 0x%08lx\n", info->registerHandle);
return TRUE;
}
@@ -791,9 +768,9 @@ static Bool R128DRIMapInit(R128InfoPtr pR128, ScreenPtr pScreen)
DRI-based clients. */
static void R128DRICCEInitRingBuffer(ScrnInfoPtr pScrn)
{
- R128InfoPtr info = R128PTR(pScrn);
+ R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
- unsigned long addr;
+ unsigned long addr;
/* FIXME: When we use the CCE for the X server, we should move this
function (and the support functions above) to r128_accel.c */
@@ -831,63 +808,63 @@ static void R128DRICCEInitRingBuffer(ScrnInfoPtr pScrn)
}
/* Initialize the kernel data structures. */
-static int R128DRIKernelInit(R128InfoPtr pR128, ScreenPtr pScreen)
+static int R128DRIKernelInit(R128InfoPtr info, ScreenPtr pScreen)
{
drmR128Init drmInfo;
drmInfo.sarea_priv_offset = sizeof(XF86DRISAREARec);
- drmInfo.is_pci = pR128->IsPCI;
- drmInfo.cce_mode = pR128->CCEMode;
- drmInfo.cce_fifo_size = pR128->CCEFifoSize;
- drmInfo.cce_secure = pR128->CCESecure;
- drmInfo.ring_size = pR128->ringSize*1024*1024;
- drmInfo.usec_timeout = pR128->CCEusecTimeout;
-
- drmInfo.fb_offset = pR128->LinearAddr;
- drmInfo.agp_ring_offset = pR128->ringHandle;
- drmInfo.agp_read_ptr_offset = pR128->ringReadPtrHandle;
- drmInfo.agp_vertbufs_offset = pR128->vbHandle;
- drmInfo.agp_indbufs_offset = pR128->indHandle;
- drmInfo.agp_textures_offset = pR128->agpTexHandle;
- drmInfo.mmio_offset = pR128->registerHandle;
-
- if (drmR128InitCCE(pR128->drmFD, &drmInfo) < 0) return FALSE;
+ drmInfo.is_pci = info->IsPCI;
+ drmInfo.cce_mode = info->CCEMode;
+ drmInfo.cce_fifo_size = info->CCEFifoSize;
+ drmInfo.cce_secure = info->CCESecure;
+ drmInfo.ring_size = info->ringSize*1024*1024;
+ drmInfo.usec_timeout = info->CCEusecTimeout;
+
+ drmInfo.fb_offset = info->LinearAddr;
+ drmInfo.agp_ring_offset = info->ringHandle;
+ drmInfo.agp_read_ptr_offset = info->ringReadPtrHandle;
+ drmInfo.agp_vertbufs_offset = info->vbHandle;
+ drmInfo.agp_indbufs_offset = info->indHandle;
+ drmInfo.agp_textures_offset = info->agpTexHandle;
+ drmInfo.mmio_offset = info->registerHandle;
+
+ if (drmR128InitCCE(info->drmFD, &drmInfo) < 0) return FALSE;
return TRUE;
}
/* Add a map for the vertex buffers that will be accessed by any
DRI-based clients. */
-static Bool R128DRIBufInit(R128InfoPtr pR128, ScreenPtr pScreen)
+static Bool R128DRIBufInit(R128InfoPtr info, ScreenPtr pScreen)
{
/* Initialize vertex buffers */
- if ((pR128->vbNumBufs = drmAddBufs(pR128->drmFD,
- pR128->vbMapSize / pR128->vbBufSize,
- pR128->vbBufSize,
- DRM_AGP_BUFFER,
- pR128->vbStart)) <= 0) {
+ if ((info->vbNumBufs = drmAddBufs(info->drmFD,
+ info->vbMapSize / info->vbBufSize,
+ info->vbBufSize,
+ DRM_AGP_BUFFER,
+ info->vbStart)) <= 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
"[drm] Could not create vertex buffers list\n");
return FALSE;
}
xf86DrvMsg(pScreen->myNum, X_INFO,
"[drm] Added %d %d byte vertex buffers\n",
- pR128->vbNumBufs, pR128->vbBufSize);
+ info->vbNumBufs, info->vbBufSize);
- if (drmMarkBufs(pR128->drmFD, 0.133333, 0.266666)) {
+ if (drmMarkBufs(info->drmFD, 0.133333, 0.266666)) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
"[drm] Failed to mark vertex buffers list\n");
return FALSE;
}
- if (!(pR128->vbBufs = drmMapBufs(pR128->drmFD))) {
+ if (!(info->vbBufs = drmMapBufs(info->drmFD))) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
"[drm] Failed to map vertex buffers list\n");
return FALSE;
}
xf86DrvMsg(pScreen->myNum, X_INFO,
"[drm] Mapped %d vertex buffers\n",
- pR128->vbBufs->count);
+ info->vbBufs->count);
return TRUE;
}
@@ -895,9 +872,10 @@ static Bool R128DRIBufInit(R128InfoPtr pR128, ScreenPtr pScreen)
/* Load the microcode for the CCE */
static void R128DRILoadMicrocode(ScrnInfoPtr pScrn)
{
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO;
- int i;
- unsigned long R128Microcode[] = {
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ int i;
+ unsigned long R128Microcode[] = {
/* CCE microcode (from ATI) */
0, 276838400, 0, 268449792, 2, 142, 2, 145, 0, 1076765731, 0, 1617039951,
0, 774592877, 0, 1987540286, 0, 2307490946U, 0, 599558925, 0, 589505315, 0,
@@ -948,7 +926,7 @@ static void R128DRILoadMicrocode(ScrnInfoPtr pScrn)
/* Initialize the CCE state, and start the CCE (if used by the X server) */
static void R128DRICCEInit(ScrnInfoPtr pScrn)
{
- R128InfoPtr info = R128PTR(pScrn);
+ R128InfoPtr info = R128PTR(pScrn);
unsigned char *R128MMIO = info->MMIO;
/* CCEMode is initialized in r128_driver.c */
@@ -982,7 +960,7 @@ static void R128DRICCEInit(ScrnInfoPtr pScrn)
Bool R128DRIScreenInit(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- R128InfoPtr pR128 = R128PTR(pScrn);
+ R128InfoPtr info = R128PTR(pScrn);
DRIInfoPtr pDRIInfo;
R128DRIPtr pR128DRI;
int major, minor, patch;
@@ -1010,7 +988,7 @@ Bool R128DRIScreenInit(ScreenPtr pScreen)
return FALSE;
}
- switch (pR128->CurrentLayout.pixel_code) {
+ switch (info->CurrentLayout.pixel_code) {
case 8:
/* These modes are not supported (yet). */
case 15:
@@ -1027,22 +1005,22 @@ Bool R128DRIScreenInit(ScreenPtr pScreen)
DRIScreenInit(). */
if (!(pDRIInfo = DRICreateInfoRec())) return FALSE;
- pR128->pDRIInfo = pDRIInfo;
+ info->pDRIInfo = pDRIInfo;
pDRIInfo->drmDriverName = R128_NAME;
pDRIInfo->clientDriverName = R128_NAME;
pDRIInfo->busIdString = xalloc(64);
sprintf(pDRIInfo->busIdString,
"PCI:%d:%d:%d",
- pR128->PciInfo->bus,
- pR128->PciInfo->device,
- pR128->PciInfo->func);
- pDRIInfo->ddxDriverMajorVersion = R128_VERSION_MAJOR;
- pDRIInfo->ddxDriverMinorVersion = R128_VERSION_MINOR;
- pDRIInfo->ddxDriverPatchVersion = R128_VERSION_PATCH;
- pDRIInfo->frameBufferPhysicalAddress = pR128->LinearAddr;
- pDRIInfo->frameBufferSize = pR128->FbMapSize;
+ info->PciInfo->bus,
+ info->PciInfo->device,
+ info->PciInfo->func);
+ pDRIInfo->ddxDriverMajorVersion = ATI2_VERSION_MAJOR;
+ pDRIInfo->ddxDriverMinorVersion = ATI2_VERSION_MINOR;
+ pDRIInfo->ddxDriverPatchVersion = ATI2_VERSION_PATCH;
+ pDRIInfo->frameBufferPhysicalAddress = info->LinearAddr;
+ pDRIInfo->frameBufferSize = info->FbMapSize;
pDRIInfo->frameBufferStride = (pScrn->displayWidth *
- pR128->CurrentLayout.pixel_bytes);
+ info->CurrentLayout.pixel_bytes);
pDRIInfo->ddxDrawableTableEntry = R128_MAX_DRAWABLES;
pDRIInfo->maxDrawableTableEntry = (SAREA_MAX_DRAWABLES
< R128_MAX_DRAWABLES
@@ -1068,8 +1046,8 @@ Bool R128DRIScreenInit(ScreenPtr pScreen)
#endif
if (!(pR128DRI = (R128DRIPtr)xnfcalloc(sizeof(R128DRIRec),1))) {
- DRIDestroyInfoRec(pR128->pDRIInfo);
- pR128->pDRIInfo = NULL;
+ DRIDestroyInfoRec(info->pDRIInfo);
+ info->pDRIInfo = NULL;
return FALSE;
}
pDRIInfo->devPrivate = pR128DRI;
@@ -1083,7 +1061,7 @@ Bool R128DRIScreenInit(ScreenPtr pScreen)
pDRIInfo->MoveBuffers = R128DRIMoveBuffers;
pDRIInfo->bufferRequests = DRI_ALL_WINDOWS;
- if (!DRIScreenInit(pScreen, pDRIInfo, &pR128->drmFD)) {
+ if (!DRIScreenInit(pScreen, pDRIInfo, &info->drmFD)) {
xfree(pDRIInfo->devPrivate);
pDRIInfo->devPrivate = NULL;
DRIDestroyInfoRec(pDRIInfo);
@@ -1092,7 +1070,7 @@ Bool R128DRIScreenInit(ScreenPtr pScreen)
}
/* Check the r128 DRM version */
- version = drmGetVersion(pR128->drmFD);
+ version = drmGetVersion(info->drmFD);
if (version) {
if (version->version_major != 1 ||
version->version_minor != 0 ||
@@ -1113,12 +1091,12 @@ Bool R128DRIScreenInit(ScreenPtr pScreen)
}
/* Initialize AGP */
- if (!pR128->IsPCI && !R128DRIAgpInit(pR128, pScreen)) {
+ if (!info->IsPCI && !R128DRIAgpInit(info, pScreen)) {
R128DRICloseScreen(pScreen);
return FALSE;
}
/* Initialize PCI */
- if (pR128->IsPCI && !R128DRIPciInit(pR128, pScreen)) {
+ if (info->IsPCI && !R128DRIPciInit(info, pScreen)) {
R128DRICloseScreen(pScreen);
return FALSE;
}
@@ -1126,22 +1104,22 @@ Bool R128DRIScreenInit(ScreenPtr pScreen)
/* DRIScreenInit doesn't add all the
common mappings. Add additional
mappings here. */
- if (!R128DRIMapInit(pR128, pScreen)) {
+ if (!R128DRIMapInit(info, pScreen)) {
R128DRICloseScreen(pScreen);
return FALSE;
}
/* Initialize the ring buffer */
- if (!pR128->IsPCI) R128DRICCEInitRingBuffer(pScrn);
+ if (!info->IsPCI) R128DRICCEInitRingBuffer(pScrn);
/* Initialize the kernel data structures */
- if (!R128DRIKernelInit(pR128, pScreen)) {
+ if (!R128DRIKernelInit(info, pScreen)) {
R128DRICloseScreen(pScreen);
return FALSE;
}
/* Initialize vertex buffers list */
- if (!pR128->IsPCI && !R128DRIBufInit(pR128, pScreen)) {
+ if (!info->IsPCI && !R128DRIBufInit(info, pScreen)) {
R128DRICloseScreen(pScreen);
return FALSE;
}
@@ -1169,7 +1147,7 @@ Bool R128DRIScreenInit(ScreenPtr pScreen)
Bool R128DRIFinishScreenInit(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- R128InfoPtr pR128 = R128PTR(pScrn);
+ R128InfoPtr info = R128PTR(pScrn);
R128SAREAPrivPtr pSAREAPriv;
R128DRIPtr pR128DRI;
@@ -1179,54 +1157,54 @@ Bool R128DRIFinishScreenInit(ScreenPtr pScreen)
pSAREAPriv = (R128SAREAPrivPtr)DRIGetSAREAPrivate(pScreen);
memset(pSAREAPriv, 0, sizeof(*pSAREAPriv));
- pR128->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT;
- /* pR128->pDRIInfo->driverSwapMethod = DRI_SERVER_SWAP; */
+ info->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT;
+ /* info->pDRIInfo->driverSwapMethod = DRI_SERVER_SWAP; */
- pR128DRI = (R128DRIPtr)pR128->pDRIInfo->devPrivate;
- pR128DRI->registerHandle = pR128->registerHandle;
- pR128DRI->registerSize = pR128->registerSize;
+ pR128DRI = (R128DRIPtr)info->pDRIInfo->devPrivate;
+ pR128DRI->registerHandle = info->registerHandle;
+ pR128DRI->registerSize = info->registerSize;
- pR128DRI->ringHandle = pR128->ringHandle;
- pR128DRI->ringMapSize = pR128->ringMapSize;
- pR128DRI->ringSize = pR128->ringSize*1024*1024;
+ pR128DRI->ringHandle = info->ringHandle;
+ pR128DRI->ringMapSize = info->ringMapSize;
+ pR128DRI->ringSize = info->ringSize*1024*1024;
- pR128DRI->ringReadPtrHandle = pR128->ringReadPtrHandle;
- pR128DRI->ringReadMapSize = pR128->ringReadMapSize;
+ pR128DRI->ringReadPtrHandle = info->ringReadPtrHandle;
+ pR128DRI->ringReadMapSize = info->ringReadMapSize;
- pR128DRI->vbHandle = pR128->vbHandle;
- pR128DRI->vbMapSize = pR128->vbMapSize;
- pR128DRI->vbOffset = pR128->vbStart;
- pR128DRI->vbBufSize = pR128->vbBufSize;
+ pR128DRI->vbHandle = info->vbHandle;
+ pR128DRI->vbMapSize = info->vbMapSize;
+ pR128DRI->vbOffset = info->vbStart;
+ pR128DRI->vbBufSize = info->vbBufSize;
- pR128DRI->indHandle = pR128->indHandle;
- pR128DRI->indMapSize = pR128->indMapSize;
+ pR128DRI->indHandle = info->indHandle;
+ pR128DRI->indMapSize = info->indMapSize;
- pR128DRI->agpTexHandle = pR128->agpTexHandle;
- pR128DRI->agpTexMapSize = pR128->agpTexMapSize;
- pR128DRI->log2AGPTexGran = pR128->log2AGPTexGran;
- pR128DRI->agpTexOffset = pR128->agpTexStart;
+ pR128DRI->agpTexHandle = info->agpTexHandle;
+ pR128DRI->agpTexMapSize = info->agpTexMapSize;
+ pR128DRI->log2AGPTexGran = info->log2AGPTexGran;
+ pR128DRI->agpTexOffset = info->agpTexStart;
- pR128DRI->deviceID = pR128->Chipset;
+ pR128DRI->deviceID = info->Chipset;
pR128DRI->width = pScrn->virtualX;
pR128DRI->height = pScrn->virtualY;
pR128DRI->depth = pScrn->depth;
pR128DRI->bpp = pScrn->bitsPerPixel;
- pR128DRI->fbX = pR128->fbX;
- pR128DRI->fbY = pR128->fbY;
- pR128DRI->backX = pR128->backX;
- pR128DRI->backY = pR128->backY;
- pR128DRI->depthX = pR128->depthX;
- pR128DRI->depthY = pR128->depthY;
- pR128DRI->textureX = pR128->textureX;
- pR128DRI->textureY = pR128->textureY;
- pR128DRI->textureSize = pR128->textureSize;
- pR128DRI->log2TexGran = pR128->log2TexGran;
+ pR128DRI->fbX = info->fbX;
+ pR128DRI->fbY = info->fbY;
+ pR128DRI->backX = info->backX;
+ pR128DRI->backY = info->backY;
+ pR128DRI->depthX = info->depthX;
+ pR128DRI->depthY = info->depthY;
+ pR128DRI->textureX = info->textureX;
+ pR128DRI->textureY = info->textureY;
+ pR128DRI->textureSize = info->textureSize;
+ pR128DRI->log2TexGran = info->log2TexGran;
- pR128DRI->IsPCI = pR128->IsPCI;
+ pR128DRI->IsPCI = info->IsPCI;
- pR128DRI->CCEMode = pR128->CCEMode;
- pR128DRI->CCEFifoSize = pR128->CCEFifoSize;
+ pR128DRI->CCEMode = info->CCEMode;
+ pR128DRI->CCEFifoSize = info->CCEFifoSize;
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "0x%08lx %d\n",
pR128DRI->registerHandle, pR128DRI->registerSize);
@@ -1238,66 +1216,66 @@ Bool R128DRIFinishScreenInit(ScreenPtr pScreen)
void R128DRICloseScreen(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- R128InfoPtr pR128 = R128PTR(pScrn);
+ R128InfoPtr info = R128PTR(pScrn);
/* Stop the CCE if it is still in use */
- if (pR128->CCE2D) R128CCEStop(pScrn);
+ if (info->CCE2D) R128CCEStop(pScrn);
/* De-allocate vertex buffers */
- if (pR128->vbBufs) {
- drmUnmapBufs(pR128->vbBufs);
- pR128->vbBufs = NULL;
+ if (info->vbBufs) {
+ drmUnmapBufs(info->vbBufs);
+ info->vbBufs = NULL;
}
/* De-allocate all kernel resources */
- drmR128CleanupCCE(pR128->drmFD);
+ drmR128CleanupCCE(info->drmFD);
/* De-allocate all AGP resources */
- if (pR128->agpTex) {
- drmUnmap(pR128->agpTex, pR128->agpTexMapSize);
- pR128->agpTex = NULL;
+ if (info->agpTex) {
+ drmUnmap(info->agpTex, info->agpTexMapSize);
+ info->agpTex = NULL;
}
- if (pR128->ind) {
- drmUnmap(pR128->ind, pR128->indMapSize);
- pR128->ind = NULL;
+ if (info->ind) {
+ drmUnmap(info->ind, info->indMapSize);
+ info->ind = NULL;
}
- if (pR128->vb) {
- drmUnmap(pR128->vb, pR128->vbMapSize);
- pR128->vb = NULL;
+ if (info->vb) {
+ drmUnmap(info->vb, info->vbMapSize);
+ info->vb = NULL;
}
- if (pR128->ringReadPtr) {
- drmUnmap(pR128->ringReadPtr, pR128->ringReadMapSize);
- pR128->ringReadPtr = NULL;
+ if (info->ringReadPtr) {
+ drmUnmap(info->ringReadPtr, info->ringReadMapSize);
+ info->ringReadPtr = NULL;
}
- if (pR128->ring) {
- drmUnmap(pR128->ring, pR128->ringMapSize);
- pR128->ring = NULL;
+ if (info->ring) {
+ drmUnmap(info->ring, info->ringMapSize);
+ info->ring = NULL;
}
- if (pR128->agpMemHandle) {
- drmAgpUnbind(pR128->drmFD, pR128->agpMemHandle);
- drmAgpFree(pR128->drmFD, pR128->agpMemHandle);
- pR128->agpMemHandle = 0;
- drmAgpRelease(pR128->drmFD);
+ if (info->agpMemHandle) {
+ drmAgpUnbind(info->drmFD, info->agpMemHandle);
+ drmAgpFree(info->drmFD, info->agpMemHandle);
+ info->agpMemHandle = 0;
+ drmAgpRelease(info->drmFD);
}
/* De-allocate all DRI resources */
DRICloseScreen(pScreen);
/* De-allocate all DRI data structures */
- if (pR128->pDRIInfo) {
- if (pR128->pDRIInfo->devPrivate) {
- xfree(pR128->pDRIInfo->devPrivate);
- pR128->pDRIInfo->devPrivate = NULL;
+ if (info->pDRIInfo) {
+ if (info->pDRIInfo->devPrivate) {
+ xfree(info->pDRIInfo->devPrivate);
+ info->pDRIInfo->devPrivate = NULL;
}
- DRIDestroyInfoRec(pR128->pDRIInfo);
- pR128->pDRIInfo = NULL;
+ DRIDestroyInfoRec(info->pDRIInfo);
+ info->pDRIInfo = NULL;
}
- if (pR128->pVisualConfigs) {
- xfree(pR128->pVisualConfigs);
- pR128->pVisualConfigs = NULL;
+ if (info->pVisualConfigs) {
+ xfree(info->pVisualConfigs);
+ info->pVisualConfigs = NULL;
}
- if (pR128->pVisualConfigsPriv) {
- xfree(pR128->pVisualConfigsPriv);
- pR128->pVisualConfigsPriv = NULL;
+ if (info->pVisualConfigsPriv) {
+ xfree(info->pVisualConfigsPriv);
+ info->pVisualConfigsPriv = NULL;
}
}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_driver.c
index 618abb408..a15f4f1b4 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_driver.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_driver.c,v 1.46 2000/09/20 00:09:26 keithp Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_driver.c,v 1.53 2000/10/18 17:20:00 alanh Exp $ */
/**************************************************************************
Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
@@ -70,7 +70,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "mipointer.h"
#include "micmap.h"
-#define USE_FB /* not until overlays and 24->32 code added */
+#define USE_FB /* not until overlays */
#ifdef USE_FB
#include "fb.h"
#else
@@ -83,48 +83,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "cfb32.h"
#include "cfb24_32.h"
#endif
- /* Xv support */
-#include "xf86xv.h"
-#include "Xv.h"
-
- /* vgahw module (for VC save/restore only) */
-#include "vgaHW.h"
-
-#include "fbdevhw.h"
-
- /* XAA and Cursor Support */
-#include "xaa.h"
-#include "xf86Cursor.h"
-
-
- /* PCI support */
-#include "xf86PciInfo.h"
-#include "xf86Pci.h"
-
- /* DDC support */
-#include "xf86DDC.h"
-
- /* VESA support */
-#include "vbe.h"
-
- /* DRI support */
-#ifdef XF86DRI
-#include "GL/glxint.h"
-#include "xf86drm.h"
-#include "sarea.h"
-#define _XF86DRI_SERVER_
-#include "xf86dri.h"
-#include "dri.h"
-#include "r128_dri.h"
-#include "r128_dripriv.h"
-#include "r128_sarea.h"
-#endif
-
-#ifdef RENDER
-#include "picturestr.h"
-#endif
/* Driver data structures */
+#include "ati2.h"
#include "r128.h"
+#include "r128_probe.h"
#include "r128_reg.h"
#ifndef MAX
@@ -133,9 +95,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
/* Forward definitions for driver functions */
-static OptionInfoPtr R128AvailableOptions(int chipid, int busid);
-static Bool R128Probe(DriverPtr drv, int flags);
-static void R128Identify(int flags);
static Bool R128PreInit(ScrnInfoPtr pScrn, int flags);
static Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen,
int argc, char **argv);
@@ -155,16 +114,6 @@ static void R128DisplayPowerManagementSet(ScrnInfoPtr pScrn,
static Bool R128EnterVTFBDev(int scrnIndex, int flags);
static void R128LeaveVTFBDev(int scrnIndex, int flags);
- /* Define driver */
-DriverRec R128 = {
- R128_VERSION,
- "ATI Rage 128",
- R128Identify,
- R128Probe,
- R128AvailableOptions,
- NULL
-};
-
/* Chipsets */
static SymTabRec R128Chipsets[] = {
{ PCI_CHIP_RAGE128RE, "ATI Rage 128 RE (PCI)" },
@@ -195,7 +144,6 @@ static PciChipsets R128PciChipsets[] = {
typedef enum {
OPTION_NOACCEL,
OPTION_SW_CURSOR,
- OPTION_HW_CURSOR,
OPTION_DAC_6BIT,
OPTION_DAC_8BIT,
#ifdef XF86DRI
@@ -216,13 +164,13 @@ typedef enum {
#endif
OPTION_PANEL_WIDTH,
OPTION_PANEL_HEIGHT,
+ OPTION_PROG_FP_REGS,
OPTION_FBDEV
} R128Opts;
static OptionInfoRec R128Options[] = {
{ OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, TRUE },
{ OPTION_DAC_6BIT, "Dac6Bit", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_DAC_8BIT, "Dac8Bit", OPTV_BOOLEAN, {0}, TRUE },
#ifdef XF86DRI
@@ -243,6 +191,7 @@ static OptionInfoRec R128Options[] = {
#endif
{ OPTION_PANEL_WIDTH, "PanelWidth", OPTV_INTEGER, {0}, FALSE },
{ OPTION_PANEL_HEIGHT, "PanelHeight", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_PROG_FP_REGS, "ProgramFPRegs", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_FBDEV, "UseFBDev", OPTV_BOOLEAN, {0}, FALSE },
{ -1, NULL, OPTV_NONE, {0}, FALSE }
};
@@ -257,216 +206,9 @@ R128RAMRec R128RAM[] = { /* Memory Specifications
{ 4, 4, 3, 3, 2, 3, 1, 16, 12, "64-bit DDR SGRAM" },
};
-static const char *vgahwSymbols[] = {
- "vgaHWGetHWRec",
- "vgaHWFreeHWRec",
- "vgaHWLock",
- "vgaHWUnlock",
- "vgaHWSave",
- "vgaHWRestore",
- NULL
-};
-
-static const char *fbdevHWSymbols[] = {
- "fbdevHWInit",
- "fbdevHWUseBuildinMode",
-
- "fbdevHWGetDepth",
- "fbdevHWGetVidmem",
-
- /* colormap */
- "fbdevHWLoadPalette",
-
- /* ScrnInfo hooks */
- "fbdevHWSwitchMode",
- "fbdevHWAdjustFrame",
- "fbdevHWEnterVT",
- "fbdevHWLeaveVT",
- "fbdevHWValidMode",
- "fbdevHWRestore",
- "fbdevHWModeInit",
- "fbdevHWSave",
-
- "fbdevHWUnmapMMIO",
- "fbdevHWUnmapVidmem",
- "fbdevHWMapMMIO",
- "fbdevHWMapVidmem",
-
- NULL
-};
-
-static const char *ddcSymbols[] = {
- "xf86PrintEDID",
- "xf86DoEDID_DDC1",
- "xf86DoEDID_DDC2",
- NULL
-};
-
-#if 0
-static const char *i2cSymbols[] = {
- "xf86CreateI2CBusRec",
- "xf86I2CBusInit",
- NULL
-};
-#endif
-
-#ifdef XFree86LOADER
-static const char *vbeSymbols[] = {
- "VBEInit",
- "vbeDoEDID",
- NULL
-};
-
-#ifdef USE_FB
-static const char *fbSymbols[] = {
- "fbScreenInit",
-#ifdef RENDER
- "fbPictureInit",
-#endif
- NULL
-};
-#else
-static const char *cfbSymbols[] = {
- "cfbScreenInit",
- "cfb16ScreenInit",
- "cfb24ScreenInit",
- "cfb32ScreenInit",
- "cfb24_32ScreenInit",
- NULL
-};
-#endif
-
-static const char *xf8_32bppSymbols[] = {
- "xf86Overlay8Plus32Init",
- NULL
-};
-
-static const char *xaaSymbols[] = {
- "XAADestroyInfoRec",
- "XAACreateInfoRec",
- "XAAInit",
- "XAAStippleScanlineFuncLSBFirst",
- "XAAOverlayFBfuncs",
- "XAACachePlanarMonoStipple",
- "XAAScreenIndex",
- NULL
-};
-
-static const char *ramdacSymbols[] = {
- "xf86InitCursor",
- "xf86CreateCursorInfoRec",
- "xf86DestroyCursorInfoRec",
- NULL
-};
-
-#ifdef XF86DRI
-static const char *drmSymbols[] = {
- "drmAddBufs",
- "drmAddMap",
- "drmAvailable",
- "drmCtlAddCommand",
- "drmCtlInstHandler",
- "drmGetInterruptFromBusID",
- "drmMapBufs",
- "drmMarkBufs",
- "drmUnmapBufs",
- "drmFreeVersion",
- "drmGetVersion",
- NULL
-};
-
-static const char *driSymbols[] = {
- "DRIGetDrawableIndex",
- "DRIFinishScreenInit",
- "DRIDestroyInfoRec",
- "DRICloseScreen",
- "DRIDestroyInfoRec",
- "DRIScreenInit",
- "DRIDestroyInfoRec",
- "DRICreateInfoRec",
- "DRILock",
- "DRIUnlock",
- "DRIGetSAREAPrivate",
- "DRIGetContext",
- "DRIQueryVersion",
- "GlxSetVisualConfigs",
- NULL
-};
-#endif
-
-static MODULESETUPPROTO(R128Setup);
-
-static XF86ModuleVersionInfo R128VersRec =
-{
- R128_NAME,
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XF86_VERSION_CURRENT,
- R128_VERSION_MAJOR, R128_VERSION_MINOR, R128_VERSION_PATCH,
- ABI_CLASS_VIDEODRV,
- ABI_VIDEODRV_VERSION,
- MOD_CLASS_VIDEODRV,
- { 0, 0, 0, 0 }
-};
-
-XF86ModuleData r128ModuleData = { &R128VersRec, R128Setup, 0 };
-
-static pointer R128Setup(pointer module, pointer opts, int *errmaj,
- int *errmin)
-{
- static Bool setupDone = FALSE;
-
- /* This module should be loaded only once, but check to be sure. */
-
- if (!setupDone) {
- setupDone = TRUE;
- xf86AddDriver(&R128, module, 0);
-
- /*
- * Modules that this driver always requires may be loaded here
- * by calling LoadSubModule().
- */
- /* FIXME: add DRI support here */
-
- /*
- * Tell the loader about symbols from other modules that this module
- * might refer to.
- */
- LoaderRefSymLists(vgahwSymbols,
-#ifdef USE_FB
- fbSymbols,
-#else
- cfbSymbols,
-#endif
- xaaSymbols,
- xf8_32bppSymbols,
- ramdacSymbols,
-#ifdef XF86DRI
- drmSymbols,
- driSymbols,
-#endif
- fbdevHWSymbols,
- vbeSymbols,
-#if 0
- NULL /* ddcsymbols */,
- NULL /* i2csymbols */,
- NULL /* shadowSymbols */,
-#endif
- NULL);
-
- /*
- * The return value must be non-NULL on success even though there
- * is no TearDownProc.
- */
- return (pointer)1;
- } else {
- if (errmaj) *errmaj = LDR_ONCEONLY;
- return NULL;
- }
-}
-
-#endif
+extern const char *vgahwSymbols[];
+extern const char *fbdevHWSymbols[];
+extern const char *ddcSymbols[];
/* Allocate our private R128InfoRec. */
static Bool R128GetRec(ScrnInfoPtr pScrn)
@@ -571,9 +313,10 @@ static Bool R128UnmapMem(ScrnInfoPtr pScrn)
}
/* Read PLL information */
-int INPLL(ScrnInfoPtr pScrn, int addr)
+int R128INPLL(ScrnInfoPtr pScrn, int addr)
{
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
OUTREG8(R128_CLOCK_CNTL_INDEX, addr & 0x1f);
return INREG(R128_CLOCK_CNTL_DATA);
@@ -581,9 +324,10 @@ int INPLL(ScrnInfoPtr pScrn, int addr)
#if 0
/* Read PAL information (only used for debugging). */
-static int INPAL(int idx)
+static int R128INPAL(int idx)
{
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
OUTREG(R128_PALETTE_INDEX, idx << 16);
return INREG(R128_PALETTE_DATA);
@@ -593,21 +337,21 @@ static int INPAL(int idx)
/* Wait for vertical sync. */
void R128WaitForVerticalSync(ScrnInfoPtr pScrn)
{
- int i;
- R128MMIO_VARS();
- unsigned int j;
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ int i;
OUTREG(R128_GEN_INT_STATUS, R128_VSYNC_INT_AK);
for (i = 0; i < R128_TIMEOUT; i++) {
- j = INREG(R128_GEN_INT_STATUS);
- if (j & R128_VSYNC_INT) break;
+ if (INREG(R128_GEN_INT_STATUS) & R128_VSYNC_INT) break;
}
}
/* Blank screen. */
static void R128Blank(ScrnInfoPtr pScrn)
{
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
OUTREGP(R128_CRTC_EXT_CNTL, R128_CRTC_DISPLAY_DIS, ~R128_CRTC_DISPLAY_DIS);
}
@@ -615,7 +359,8 @@ static void R128Blank(ScrnInfoPtr pScrn)
/* Unblank screen. */
static void R128Unblank(ScrnInfoPtr pScrn)
{
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
OUTREGP(R128_CRTC_EXT_CNTL, 0, ~R128_CRTC_DISPLAY_DIS);
}
@@ -643,9 +388,9 @@ static Bool R128GetBIOSParameters(ScrnInfoPtr pScrn)
int i;
int FPHeader = 0;
-#define R128ReadBIOS(offset, buffer, length) \
- (info->BIOSFromPCI ? \
- xf86ReadPciBIOS(offset, info->PciTag, 0, buffer, length) : \
+#define R128ReadBIOS(offset, buffer, length) \
+ (info->BIOSFromPCI ? \
+ xf86ReadPciBIOS(offset, info->PciTag, 0, buffer, length) : \
xf86ReadBIOS(info->BIOSAddr, offset, buffer, length))
#define R128_BIOS8(v) (*((CARD8 *)(info->VBIOS + (v))))
@@ -757,6 +502,7 @@ static Bool R128GetPLLParameters(ScrnInfoPtr pScrn)
CARD16 bios_header;
CARD16 pll_info_block;
+
if (!info->VBIOS) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Video BIOS not detected, using default PLL parameters!\n");
@@ -793,15 +539,22 @@ static Bool R128GetPLLParameters(ScrnInfoPtr pScrn)
return TRUE;
}
-static
-OptionInfoPtr
-R128AvailableOptions(int chipid, int busid)
+/* Return the options for supported chipset 'n'; NULL otherwise. */
+OptionInfoPtr R128AvailableOptions(int chipid, int busid)
{
- return R128Options;
+ int i;
+
+ /* Check to make sure that chip 'chipid' is supported by the Rage
+ 128 driver */
+ for (i = 0; R128PciChipsets[i].PCIid > 0; i++) {
+ if (chipid == R128PciChipsets[i].PCIid)
+ return R128Options;
+ }
+ return NULL;
}
/* Return the string name for supported chipset 'n'; NULL otherwise. */
-static void R128Identify(int flags)
+void R128Identify(int flags)
{
xf86PrintChipsets(R128_NAME,
"Driver for ATI Rage 128 chipset",
@@ -809,7 +562,7 @@ static void R128Identify(int flags)
}
/* Return TRUE if chipset is present; FALSE otherwise. */
-static Bool R128Probe(DriverPtr drv, int flags)
+Bool R128Probe(DriverPtr drv, int flags)
{
int numUsed;
int numDevSections;
@@ -819,8 +572,11 @@ static Bool R128Probe(DriverPtr drv, int flags)
Bool foundScreen = FALSE;
int i;
+ /* Check to make sure that the R128_NAME or the ATI2_NAME is listed
+ as the Driver in the "Device" section of the XF86Config file */
if ((numDevSections = xf86MatchDevice(R128_NAME, &devSections)) <= 0)
- return FALSE;
+ if ((numDevSections = xf86MatchDevice(ATI2_NAME, &devSections)) <= 0)
+ return FALSE;
if (!xf86GetPciVideoInfo()) return FALSE;
@@ -843,7 +599,7 @@ static Bool R128Probe(DriverPtr drv, int flags)
if (pEnt->active) {
ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0);
- pScrn->driverVersion = R128_VERSION;
+ pScrn->driverVersion = ATI2_VERSION;
pScrn->driverName = R128_NAME;
pScrn->name = R128_NAME;
pScrn->Probe = R128Probe;
@@ -877,9 +633,7 @@ static Bool R128PreInitVisual(ScrnInfoPtr pScrn)
if (!xf86SetDepthBpp(pScrn, 8, 8, 8, (Support24bppFb
| Support32bppFb
-#ifndef USE_FB
| SupportConvert32to24
-#endif
)))
return FALSE;
@@ -961,12 +715,12 @@ static Bool R128PreInitWeight(ScrnInfoPtr pScrn)
If memory type ever needs an override, put it in this routine. */
static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
{
- R128InfoPtr info = R128PTR(pScrn);
- EntityInfoPtr pEnt = info->pEnt;
- GDevPtr dev = pEnt->device;
- int offset = 0; /* RAM Type */
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ EntityInfoPtr pEnt = info->pEnt;
+ GDevPtr dev = pEnt->device;
+ int offset = 0; /* RAM Type */
MessageType from;
- unsigned char *R128MMIO;
/* Chipset */
from = X_PROBED;
@@ -1051,18 +805,26 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
}
/* Flat panel (part 1) */
- /* FIXME: Make this an option */
- switch (info->Chipset) {
- case PCI_CHIP_RAGE128LE:
- case PCI_CHIP_RAGE128LF:
- case PCI_CHIP_RAGE128MF:
- case PCI_CHIP_RAGE128ML: info->HasPanelRegs = TRUE; break;
- case PCI_CHIP_RAGE128RE:
- case PCI_CHIP_RAGE128RF:
- case PCI_CHIP_RAGE128RK:
- case PCI_CHIP_RAGE128RL:
- case PCI_CHIP_RAGE128PF:
- default: info->HasPanelRegs = FALSE; break;
+ if (xf86GetOptValBool(R128Options, OPTION_PROG_FP_REGS,
+ &info->HasPanelRegs)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Turned flat panel register programming %s\n",
+ info->HasPanelRegs ? "on" : "off");
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "\n\nWARNING: Forcing the driver to use/not use the flat panel registers\nmight damage your flat panel. Use at your *OWN* *RISK*.\n\n");
+ } else {
+ switch (info->Chipset) {
+ case PCI_CHIP_RAGE128LE:
+ case PCI_CHIP_RAGE128LF:
+ case PCI_CHIP_RAGE128MF:
+ case PCI_CHIP_RAGE128ML: info->HasPanelRegs = TRUE; break;
+ case PCI_CHIP_RAGE128RE:
+ case PCI_CHIP_RAGE128RF:
+ case PCI_CHIP_RAGE128RK:
+ case PCI_CHIP_RAGE128RL:
+ case PCI_CHIP_RAGE128PF:
+ default: info->HasPanelRegs = FALSE; break;
+ }
}
/* Read registers used to determine options */
@@ -1074,6 +836,7 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
else
pScrn->videoRam = INREG(R128_CONFIG_MEMSIZE) / 1024;
info->MemCntl = INREG(R128_MEM_CNTL);
+
info->BusCntl = INREG(R128_BUS_CNTL);
R128MMIO = NULL;
R128UnmapMMIO(pScrn);
@@ -1119,6 +882,7 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Using flat panel for display\n");
#else
+ /* Panel CRT mode override */
if ((info->CRTOnly = xf86ReturnOptValBool(R128Options,
OPTION_CRT, FALSE))) {
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
@@ -1129,11 +893,8 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
"Using flat panel for display\n");
}
#endif
- } else {
- info->CRTOnly = FALSE;
- }
- if (info->HasPanelRegs) {
+ /* Panel width/height overrides */
info->PanelXRes = 0;
info->PanelYRes = 0;
if (xf86GetOptValInteger(R128Options,
@@ -1146,6 +907,8 @@ static Bool R128PreInitConfig(ScrnInfoPtr pScrn)
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
"Flat panel height: %d\n", info->PanelYRes);
}
+ } else {
+ info->CRTOnly = FALSE;
}
#ifdef XF86DRI
@@ -1181,7 +944,7 @@ static Bool R128PreInitDDC(ScrnInfoPtr pScrn)
xf86LoaderReqSymLists(ddcSymbols, NULL);
if (xf86LoadSubModule(pScrn, "vbe")) {
pVbe = VBEInit(NULL,info->pEnt->index);
- if (!pVbe) return NULL;
+ if (!pVbe) return FALSE;
xf86SetDDCproperties(pScrn,xf86PrintEDID(vbeDoEDID(pVbe,NULL)));
return TRUE;
@@ -1572,11 +1335,11 @@ static Bool R128PreInit(ScrnInfoPtr pScrn, int flags)
static void R128LoadPalette(ScrnInfoPtr pScrn, int numColors,
int *indices, LOCO *colors, VisualPtr pVisual)
{
- R128InfoPtr info = R128PTR(pScrn);
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
int i;
int idx;
unsigned char r, g, b;
- R128MMIO_VARS();
/* Select palette 0 (main CRTC) if using FP-enabled chip */
if (info->HasPanelRegs) PAL_SELECT(0);
@@ -1677,7 +1440,7 @@ static Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen,
if (!xf86ReturnOptValBool(R128Options, OPTION_NOACCEL, FALSE) &&
(maxy > pScrn->virtualY * 3)
-#if 1
+#if 0
/* FIXME: Disable 3D support for FPs until it is tested */
&& !info->HasPanelRegs
#endif
@@ -1769,7 +1532,8 @@ static Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen,
MemBox.x1 = 0;
MemBox.y1 = 0;
MemBox.x2 = pScrn->displayWidth;
- y2 = info->FbMapSize / (pScrn->displayWidth * info->CurrentLayout.pixel_bytes);
+ y2 = (info->FbMapSize
+ / (pScrn->displayWidth * info->CurrentLayout.pixel_bytes));
if (y2 >= 32768) y2 = 32767; /* because MemBox.y2 is signed short */
MemBox.y2 = y2;
@@ -1932,6 +1696,9 @@ static Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen,
miInitializeBackingStore(pScreen);
xf86SetBackingStore(pScreen);
+ /* Set Silken Mouse */
+ xf86SetSilkenMouse(pScreen);
+
/* Acceleration setup */
if (!xf86ReturnOptValBool(R128Options, OPTION_NOACCEL, FALSE)) {
if (R128AccelInit(pScreen)) {
@@ -1992,16 +1759,7 @@ static Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen,
xf86DPMSInit(pScreen, R128DisplayPowerManagementSet, 0);
#endif
- /* Xv setup */
-#ifdef XvExtension
- {
- XF86VideoAdaptorPtr *ptr;
- int n;
-
- if ((n = xf86XVListGenericAdaptors(pScrn, &ptr)))
- xf86XVScreenInit(pScreen, ptr, n);
- }
-#endif
+ R128InitVideo(pScreen);
/* Provide SaveScreen */
pScreen->SaveScreen = R128SaveScreen;
@@ -2035,7 +1793,8 @@ static Bool R128ScreenInit(int scrnIndex, ScreenPtr pScreen,
/* Write common registers (initialized to 0). */
static void R128RestoreCommonRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
{
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
OUTREG(R128_OVR_CLR, restore->ovr_clr);
OUTREG(R128_OVR_WID_LEFT_RIGHT, restore->ovr_wid_left_right);
@@ -2055,7 +1814,8 @@ static void R128RestoreCommonRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
/* Write CRTC registers. */
static void R128RestoreCrtcRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
{
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
OUTREG(R128_CRTC_GEN_CNTL, restore->crtc_gen_cntl);
@@ -2077,8 +1837,9 @@ static void R128RestoreCrtcRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
/* Write flat panel registers */
static void R128RestoreFPRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
{
- CARD32 tmp;
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ CARD32 tmp;
OUTREG(R128_CRTC2_GEN_CNTL, restore->crtc2_gen_cntl);
OUTREG(R128_FP_CRTC_H_TOTAL_DISP, restore->fp_crtc_h_total_disp);
@@ -2115,7 +1876,8 @@ static void R128PLLWaitForReadUpdateComplete(ScrnInfoPtr pScrn)
static void R128PLLWriteUpdate(ScrnInfoPtr pScrn)
{
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
OUTPLLP(pScrn, R128_PPLL_REF_DIV, R128_PPLL_ATOMIC_UPDATE_W, 0xffff);
}
@@ -2123,7 +1885,8 @@ static void R128PLLWriteUpdate(ScrnInfoPtr pScrn)
/* Write PLL registers. */
static void R128RestorePLLRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
{
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
OUTREGP(R128_CLOCK_CNTL_INDEX, R128_PLL_DIV_SEL, 0xffff);
@@ -2167,7 +1930,8 @@ static void R128RestorePLLRegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
/* Write DDA registers. */
static void R128RestoreDDARegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
{
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
OUTREG(R128_DDA_CONFIG, restore->dda_config);
OUTREG(R128_DDA_ON_OFF, restore->dda_on_off);
@@ -2176,9 +1940,9 @@ static void R128RestoreDDARegisters(ScrnInfoPtr pScrn, R128SavePtr restore)
/* Write palette data. */
static void R128RestorePalette(ScrnInfoPtr pScrn, R128SavePtr restore)
{
- R128InfoPtr info = R128PTR(pScrn);
- int i;
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ int i;
if (!restore->palette_valid) return;
@@ -2208,7 +1972,8 @@ static void R128RestoreMode(ScrnInfoPtr pScrn, R128SavePtr restore)
/* Read common registers. */
static void R128SaveCommonRegisters(ScrnInfoPtr pScrn, R128SavePtr save)
{
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
save->ovr_clr = INREG(R128_OVR_CLR);
save->ovr_wid_left_right = INREG(R128_OVR_WID_LEFT_RIGHT);
@@ -2228,7 +1993,8 @@ static void R128SaveCommonRegisters(ScrnInfoPtr pScrn, R128SavePtr save)
/* Read CRTC registers. */
static void R128SaveCrtcRegisters(ScrnInfoPtr pScrn, R128SavePtr save)
{
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
save->crtc_gen_cntl = INREG(R128_CRTC_GEN_CNTL);
save->crtc_ext_cntl = INREG(R128_CRTC_EXT_CNTL);
@@ -2245,7 +2011,8 @@ static void R128SaveCrtcRegisters(ScrnInfoPtr pScrn, R128SavePtr save)
/* Read flat panel registers */
static void R128SaveFPRegisters(ScrnInfoPtr pScrn, R128SavePtr save)
{
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
save->crtc2_gen_cntl = INREG(R128_CRTC2_GEN_CNTL);
save->fp_crtc_h_total_disp = INREG(R128_FP_CRTC_H_TOTAL_DISP);
@@ -2280,7 +2047,8 @@ static void R128SavePLLRegisters(ScrnInfoPtr pScrn, R128SavePtr save)
/* Read DDA registers. */
static void R128SaveDDARegisters(ScrnInfoPtr pScrn, R128SavePtr save)
{
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
save->dda_config = INREG(R128_DDA_CONFIG);
save->dda_on_off = INREG(R128_DDA_ON_OFF);
@@ -2289,9 +2057,9 @@ static void R128SaveDDARegisters(ScrnInfoPtr pScrn, R128SavePtr save)
/* Read palette data. */
static void R128SavePalette(ScrnInfoPtr pScrn, R128SavePtr save)
{
- R128InfoPtr info = R128PTR(pScrn);
- int i;
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ int i;
/* Select palette 0 (main CRTC) if using FP-enabled chip */
if (info->HasPanelRegs) PAL_SELECT(0);
@@ -2320,10 +2088,10 @@ static void R128SaveMode(ScrnInfoPtr pScrn, R128SavePtr save)
/* Save everything needed to restore the original VC state. */
static void R128Save(ScrnInfoPtr pScrn)
{
- R128InfoPtr info = R128PTR(pScrn);
- R128SavePtr save = &info->SavedReg;
- vgaHWPtr hwp = VGAHWPTR(pScrn);
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ R128SavePtr save = &info->SavedReg;
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
R128TRACE(("R128Save\n"));
if (info->FBDev) {
@@ -2346,10 +2114,10 @@ static void R128Save(ScrnInfoPtr pScrn)
/* Restore the original (text) mode. */
static void R128Restore(ScrnInfoPtr pScrn)
{
- R128InfoPtr info = R128PTR(pScrn);
- R128SavePtr restore = &info->SavedReg;
- vgaHWPtr hwp = VGAHWPTR(pScrn);
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ R128SavePtr restore = &info->SavedReg;
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
R128TRACE(("R128Restore\n"));
if (info->FBDev) {
@@ -2872,10 +2640,10 @@ static int R128ValidMode(int scrnIndex, DisplayModePtr mode,
is (x,y) in virtual space. */
void R128AdjustFrame(int scrnIndex, int x, int y, int flags)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
- R128InfoPtr info = R128PTR(pScrn);
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
int Base;
- R128MMIO_VARS();
Base = y * info->CurrentLayout.displayWidth + x;
@@ -2898,7 +2666,7 @@ void R128AdjustFrame(int scrnIndex, int x, int y, int flags)
mode. */
static Bool R128EnterVT(int scrnIndex, int flags)
{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
R128InfoPtr info = R128PTR(pScrn);
R128TRACE(("R128EnterVT\n"));
@@ -3015,10 +2783,11 @@ static void R128FreeScreen(int scrnIndex, int flags)
static void R128DisplayPowerManagementSet(ScrnInfoPtr pScrn,
int PowerManagementMode, int flags)
{
- int mask = (R128_CRTC_DISPLAY_DIS
- | R128_CRTC_HSYNC_DIS
- | R128_CRTC_VSYNC_DIS);
- R128MMIO_VARS();
+ R128InfoPtr info = R128PTR(pScrn);
+ unsigned char *R128MMIO = info->MMIO;
+ int mask = (R128_CRTC_DISPLAY_DIS
+ | R128_CRTC_HSYNC_DIS
+ | R128_CRTC_VSYNC_DIS);
switch (PowerManagementMode) {
case DPMSModeOn:
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_probe.h b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_probe.h
new file mode 100644
index 000000000..35460505d
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_probe.h
@@ -0,0 +1,42 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_probe.h,v 1.2 2000/10/23 21:16:49 tsi Exp $ */
+/**************************************************************************
+
+Copyright 2000 ATI Technologies Inc. and VA Linux Systems, Inc.,
+ Sunnyvale, California.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+on the rights to use, copy, modify, merge, publish, distribute, sub
+license, and/or sell copies of the Software, and to permit persons to whom
+the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <martin@valinux.com>
+ *
+ */
+
+#ifndef _R128_PROBE_H_
+#define _R128_PROBE_H_
+
+extern OptionInfoPtr R128AvailableOptions(int chipid, int busid);
+extern void R128Identify(int flags);
+extern Bool R128Probe(DriverPtr drv, int flags);
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_reg.h b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_reg.h
index e8ff8b915..8bf906a92 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_reg.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_reg.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_reg.h,v 1.13 2000/09/13 15:47:32 martin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_reg.h,v 1.15 2000/10/18 17:20:01 alanh Exp $ */
/**************************************************************************
Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
@@ -56,9 +56,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define ADDRREG(addr) ((volatile CARD32 *)(R128MMIO + (addr)))
-#define R128MMIO_VARS() \
- unsigned char *R128MMIO = R128PTR(pScrn)->MMIO
-
#define OUTREGP(addr, val, mask) \
do { \
@@ -68,6 +65,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
OUTREG(addr, tmp); \
} while (0)
+#define INPLL(pScrn, addr) R128INPLL(pScrn, addr)
+
#define OUTPLL(addr, val) \
do { \
OUTREG8(R128_CLOCK_CNTL_INDEX, ((addr) & 0x1f) | R128_PLL_WR_EN); \
@@ -271,6 +270,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define R128_CLR_CMP_CLR_DST 0x15c8
#define R128_CLR_CMP_CLR_SRC 0x15c4
#define R128_CLR_CMP_CNTL 0x15c0
+# define R128_SRC_CMP_EQ_COLOR (4 << 0)
# define R128_SRC_CMP_NEQ_COLOR (5 << 0)
# define R128_CLR_CMP_SRC_SOURCE (1 << 24)
#define R128_CLR_CMP_MASK 0x15cc
@@ -688,11 +688,123 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#define R128_N_VIF_COUNT 0x0248
-#define R128_OV0_SCALE_CNTL 0x0420 /* ? */
#define R128_OVR_CLR 0x0230
#define R128_OVR_WID_LEFT_RIGHT 0x0234
#define R128_OVR_WID_TOP_BOTTOM 0x0238
+/* first overlay unit (there is only one) */
+
+#define R128_OV0_Y_X_START 0x0400
+#define R128_OV0_Y_X_END 0x0404
+#define R128_OV0_EXCLUSIVE_HORZ 0x0408
+# define R128_EXCL_HORZ_START_MASK 0x000000ff
+# define R128_EXCL_HORZ_END_MASK 0x0000ff00
+# define R128_EXCL_HORZ_BACK_PORCH_MASK 0x00ff0000
+# define R128_EXCL_HORZ_EXCLUSIVE_EN 0x80000000
+#define R128_OV0_EXCLUSIVE_VERT 0x040C
+# define R128_EXCL_VERT_START_MASK 0x000003ff
+# define R128_EXCL_VERT_END_MASK 0x03ff0000
+#define R128_OV0_REG_LOAD_CNTL 0x0410
+# define R128_REG_LD_CTL_LOCK 0x00000001L
+# define R128_REG_LD_CTL_VBLANK_DURING_LOCK 0x00000002L
+# define R128_REG_LD_CTL_STALL_GUI_UNTIL_FLIP 0x00000004L
+# define R128_REG_LD_CTL_LOCK_READBACK 0x00000008L
+#define R128_OV0_SCALE_CNTL 0x0420
+# define R128_SCALER_PIX_EXPAND 0x00000001L
+# define R128_SCALER_Y2R_TEMP 0x00000002L
+# define R128_SCALER_HORZ_PICK_NEAREST 0x00000003L
+# define R128_SCALER_VERT_PICK_NEAREST 0x00000004L
+# define R128_SCALER_SIGNED_UV 0x00000010L
+# define R128_SCALER_GAMMA_SEL_MASK 0x00000060L
+# define R128_SCALER_GAMMA_SEL_BRIGHT 0x00000000L
+# define R128_SCALER_GAMMA_SEL_G22 0x00000020L
+# define R128_SCALER_GAMMA_SEL_G18 0x00000040L
+# define R128_SCALER_GAMMA_SEL_G14 0x00000060L
+# define R128_SCALER_COMCORE_SHIFT_UP_ONE 0x00000080L
+# define R128_SCALER_SURFAC_FORMAT 0x00000f00L
+# define R128_SCALER_SOURCE_15BPP 0x00000300L
+# define R128_SCALER_SOURCE_16BPP 0x00000400L
+# define R128_SCALER_SOURCE_32BPP 0x00000600L
+# define R128_SCALER_SOURCE_YUV9 0x00000900L
+# define R128_SCALER_SOURCE_YUV12 0x00000A00L
+# define R128_SCALER_SOURCE_VYUY422 0x00000B00L
+# define R128_SCALER_SOURCE_YVYU422 0x00000C00L
+# define R128_SCALER_SMART_SWITCH 0x00008000L
+# define R128_SCALER_BURST_PER_PLANE 0x00ff0000L
+# define R128_SCALER_DOUBLE_BUFFER 0x01000000L
+# define R128_SCALER_DIS_LIMIT 0x08000000L
+# define R128_SCALER_PRG_LOAD_START 0x10000000L
+# define R128_SCALER_INT_EMU 0x20000000L
+# define R128_SCALER_ENABLE 0x40000000L
+# define R128_SCALER_SOFT_RESET 0x80000000L
+#define R128_OV0_V_INC 0x0424
+#define R128_OV0_P1_V_ACCUM_INIT 0x0428
+# define R128_OV0_P1_MAX_LN_IN_PER_LN_OUT 0x00000003L
+# define R128_OV0_P1_V_ACCUM_INIT_MASK 0x01ff8000L
+#define R128_OV0_P23_V_ACCUM_INIT 0x042C
+#define R128_OV0_P1_BLANK_LINES_AT_TOP 0x0430
+# define R128_P1_BLNK_LN_AT_TOP_M1_MASK 0x00000fffL
+# define R128_P1_ACTIVE_LINES_M1 0x0fff0000L
+#define R128_OV0_P23_BLANK_LINES_AT_TOP 0x0434
+# define R128_P23_BLNK_LN_AT_TOP_M1_MASK 0x000007ffL
+# define R128_P23_ACTIVE_LINES_M1 0x07ff0000L
+#define R128_OV0_VID_BUF0_BASE_ADRS 0x0440
+# define R128_VIF_BUF0_PITCH_SEL 0x00000001L
+# define R128_VIF_BUF0_TILE_ADRS 0x00000002L
+# define R128_VIF_BUF0_BASE_ADRS_MASK 0x03fffff0L
+# define R128_VIF_BUF0_1ST_LINE_LSBS_MASK 0x48000000L
+#define R128_OV0_VID_BUF1_BASE_ADRS 0x0444
+# define R128_VIF_BUF1_PITCH_SEL 0x00000001L
+# define R128_VIF_BUF1_TILE_ADRS 0x00000002L
+# define R128_VIF_BUF1_BASE_ADRS_MASK 0x03fffff0L
+# define R128_VIF_BUF1_1ST_LINE_LSBS_MASK 0x48000000L
+#define R128_OV0_VID_BUF2_BASE_ADRS 0x0448
+# define R128_VIF_BUF2_PITCH_SEL 0x00000001L
+# define R128_VIF_BUF2_TILE_ADRS 0x00000002L
+# define R128_VIF_BUF2_BASE_ADRS_MASK 0x03fffff0L
+# define R128_VIF_BUF2_1ST_LINE_LSBS_MASK 0x48000000L
+#define R128_OV0_VID_BUF3_BASE_ADRS 0x044C
+#define R128_OV0_VID_BUF4_BASE_ADRS 0x0450
+#define R128_OV0_VID_BUF5_BASE_ADRS 0x0454
+#define R128_OV0_VID_BUF_PITCH0_VALUE 0x0460
+#define R128_OV0_VID_BUF_PITCH1_VALUE 0x0464
+#define R128_OV0_AUTO_FLIP_CNTL 0x0470
+#define R128_OV0_DEINTERLACE_PATTERN 0x0474
+#define R128_OV0_H_INC 0x0480
+#define R128_OV0_STEP_BY 0x0484
+#define R128_OV0_P1_H_ACCUM_INIT 0x0488
+#define R128_OV0_P23_H_ACCUM_INIT 0x048C
+#define R128_OV0_P1_X_START_END 0x0494
+#define R128_OV0_P2_X_START_END 0x0498
+#define R128_OV0_P3_X_START_END 0x049C
+#define R128_OV0_FILTER_CNTL 0x04A0
+#define R128_OV0_FOUR_TAP_COEF_0 0x04B0
+#define R128_OV0_FOUR_TAP_COEF_1 0x04B4
+#define R128_OV0_FOUR_TAP_COEF_2 0x04B8
+#define R128_OV0_FOUR_TAP_COEF_3 0x04BC
+#define R128_OV0_FOUR_TAP_COEF_4 0x04C0
+#define R128_OV0_COLOUR_CNTL 0x04E0
+#define R128_OV0_VIDEO_KEY_CLR 0x04E4
+#define R128_OV0_VIDEO_KEY_MSK 0x04E8
+#define R128_OV0_GRAPHICS_KEY_CLR 0x04EC
+#define R128_OV0_GRAPHICS_KEY_MSK 0x04F0
+#define R128_OV0_KEY_CNTL 0x04F4
+# define R128_VIDEO_KEY_FN_MASK 0x00000007L
+# define R128_VIDEO_KEY_FN_FALSE 0x00000000L
+# define R128_VIDEO_KEY_FN_TRUE 0x00000001L
+# define R128_VIDEO_KEY_FN_EQ 0x00000004L
+# define R128_VIDEO_KEY_FN_NE 0x00000005L
+# define R128_GRAPHIC_KEY_FN_MASK 0x00000070L
+# define R128_GRAPHIC_KEY_FN_FALSE 0x00000000L
+# define R128_GRAPHIC_KEY_FN_TRUE 0x00000010L
+# define R128_GRAPHIC_KEY_FN_EQ 0x00000040L
+# define R128_GRAPHIC_KEY_FN_NE 0x00000050L
+# define R128_CMP_MIX_MASK 0x00000100L
+# define R128_CMP_MIX_OR 0x00000000L
+# define R128_CMP_MIX_AND 0x00000100L
+#define R128_OV0_TEST 0x04F8
+
+
#define R128_PALETTE_DATA 0x00b4
#define R128_PALETTE_INDEX 0x00b0
#define R128_PC_DEBUG_MODE 0x1760
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_sarea.h b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_sarea.h
index 2af80d140..dcfba4084 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_sarea.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/r128_sarea.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_sarea.h,v 1.1 2000/06/17 00:03:23 martin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/r128_sarea.h,v 1.2 2000/10/18 17:20:01 alanh Exp $ */
/**************************************************************************
Copyright 1999, 2000 ATI Technologies Inc. and Precision Insight, Inc.,
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/radeon.h b/xc/programs/Xserver/hw/xfree86/drivers/r128/radeon.h
new file mode 100644
index 000000000..530d2b039
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/radeon.h
@@ -0,0 +1,411 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/radeon.h,v 1.2 2000/10/23 21:16:49 tsi Exp $ */
+/**************************************************************************
+
+Copyright 2000 ATI Technologies Inc. and VA Linux Systems, Inc.,
+ Sunnyvale, California.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+on the rights to use, copy, modify, merge, publish, distribute, sub
+license, and/or sell copies of the Software, and to permit persons to whom
+the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <martin@valinux.com>
+ * Rickard E. Faith <faith@valinux.com>
+ *
+ */
+
+#ifndef _RADEON_H_
+#define _RADEON_H_
+
+ /* Xv support */
+#include "xf86xv.h"
+#include "Xv.h"
+
+ /* vgahw module (for VC save/restore only) */
+#include "vgaHW.h"
+
+#include "fbdevhw.h"
+
+ /* XAA and Cursor Support */
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xf86Cursor.h"
+
+
+ /* PCI support */
+#include "xf86PciInfo.h"
+#include "xf86Pci.h"
+
+ /* DDC support */
+#include "xf86DDC.h"
+
+ /* VESA support */
+#include "vbe.h"
+
+ /* DRI support */
+#ifdef XF86DRI
+#include "GL/glxint.h"
+#include "xf86drm.h"
+#include "sarea.h"
+#define _XF86DRI_SERVER_
+#include "xf86dri.h"
+#include "dri.h"
+#include "r128_dri.h"
+#include "r128_dripriv.h"
+#include "r128_sarea.h"
+#endif
+
+#ifdef RENDER
+#include "picturestr.h"
+#endif
+
+/* NOTE: Turn off DRI until it is working */
+#ifdef XF86DRI
+#undef XF86DRI
+#endif
+
+#define RADEON_DEBUG 0 /* Turn off debugging output */
+#define RADEON_TIMEOUT 2000000 /* Fall out of wait loops after this count */
+#define RADEON_MMIOSIZE 0x80000
+/* Atomic updates of PLL clock don't seem to always work and stick, thus
+ * the bit never resets. Here - we use our own check by reading back the
+ * register we've just wrote to make sure it's got the Right! value */
+#define RADEON_ATOMIC_UPDATE 0 /* Use PLL Atomic updates (seems broken) */
+
+#define RADEON_VBIOS_SIZE 0x00010000
+
+ /* RADEON_NAME is used for the server-side
+ ddx driver, the client-side DRI driver,
+ and the kernel-level DRM driver. */
+#define RADEON_NAME "radeon"
+
+#if RADEON_DEBUG
+#define RADEONTRACE(x) \
+ do { \
+ ErrorF("(**) %s(%d): ", RADEON_NAME, pScrn->scrnIndex); \
+ ErrorF x; \
+ } while (0);
+#else
+#define RADEONTRACE(x)
+#endif
+
+
+/* Other macros */
+#define RADEON_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
+#define RADEON_ALIGN(x,bytes) (((x) + ((bytes) - 1)) & ~((bytes) - 1))
+#define RADEONPTR(pScrn) ((RADEONInfoPtr)(pScrn)->driverPrivate)
+
+typedef struct { /* All values in XCLKS */
+ int ML; /* Memory Read Latency */
+ int MB; /* Memory Burst Length */
+ int Trcd; /* RAS to CAS delay */
+ int Trp; /* RAS percentage */
+ int Twr; /* Write Recovery */
+ int CL; /* CAS Latency */
+ int Tr2w; /* Read to Write Delay */
+ int Rloop; /* Loop Latency */
+ int Rloop_fudge; /* Add to ML to get Rloop */
+ char *name;
+} RADEONRAMRec, *RADEONRAMPtr;
+
+typedef struct {
+ /* Common registers */
+ CARD32 ovr_clr;
+ CARD32 ovr_wid_left_right;
+ CARD32 ovr_wid_top_bottom;
+ CARD32 ov0_scale_cntl;
+ CARD32 mpp_tb_config;
+ CARD32 mpp_gp_config;
+ CARD32 subpic_cntl;
+ CARD32 viph_control;
+ CARD32 i2c_cntl_1;
+ CARD32 gen_int_cntl;
+ CARD32 cap0_trig_cntl;
+ CARD32 cap1_trig_cntl;
+ CARD32 bus_cntl;
+
+ /* Other registers to save for VT switches */
+ CARD32 dp_datatype;
+ CARD32 rbbm_soft_reset;
+ CARD32 clock_cntl_index;
+ CARD32 amcgpio_en_reg;
+ CARD32 amcgpio_mask;
+
+ /* CRTC registers */
+ CARD32 crtc_gen_cntl;
+ CARD32 crtc_ext_cntl;
+ CARD32 dac_cntl;
+ CARD32 crtc_h_total_disp;
+ CARD32 crtc_h_sync_strt_wid;
+ CARD32 crtc_v_total_disp;
+ CARD32 crtc_v_sync_strt_wid;
+ CARD32 crtc_offset;
+ CARD32 crtc_offset_cntl;
+ CARD32 crtc_pitch;
+
+ /* CRTC2 registers */
+ CARD32 crtc2_gen_cntl;
+
+ /* Flat panel registers */
+ CARD32 fp_crtc_h_total_disp;
+ CARD32 fp_crtc_v_total_disp;
+ CARD32 fp_gen_cntl;
+ CARD32 fp_h_sync_strt_wid;
+ CARD32 fp_horz_stretch;
+ CARD32 fp_panel_cntl;
+ CARD32 fp_v_sync_strt_wid;
+ CARD32 fp_vert_stretch;
+ CARD32 lvds_gen_cntl;
+ CARD32 tmds_crc;
+
+ /* Computed values for PLL */
+ int dot_clock_freq;
+ int pll_output_freq;
+ int feedback_div;
+ int post_div;
+
+ /* PLL registers */
+ CARD32 ppll_ref_div;
+ CARD32 ppll_div_3;
+ CARD32 htotal_cntl;
+
+ /* DDA register */
+ CARD32 dda_config;
+ CARD32 dda_on_off;
+
+ /* Pallet */
+ Bool palette_valid;
+ CARD32 palette[256];
+} RADEONSaveRec, *RADEONSavePtr;
+
+typedef struct {
+ CARD16 reference_freq;
+ CARD16 reference_div;
+ CARD32 min_pll_freq;
+ CARD32 max_pll_freq;
+ CARD16 xclk;
+} RADEONPLLRec, *RADEONPLLPtr;
+
+typedef struct {
+ int bitsPerPixel;
+ int depth;
+ int displayWidth;
+ int pixel_code;
+ int pixel_bytes;
+ DisplayModePtr mode;
+} RADEONFBLayout;
+
+typedef struct {
+ EntityInfoPtr pEnt;
+ pciVideoPtr PciInfo;
+ PCITAG PciTag;
+ int Chipset;
+ Bool Primary;
+
+ Bool FBDev;
+
+ unsigned long LinearAddr; /* Frame buffer physical address */
+ unsigned long MMIOAddr; /* MMIO region physical address */
+ unsigned long BIOSAddr; /* BIOS physical address */
+ Bool BIOSFromPCI; /* BIOS is read from PCI space */
+
+ unsigned char *MMIO; /* Map of MMIO region */
+ unsigned char *FB; /* Map of frame buffer */
+ CARD8 *VBIOS; /* Video BIOS pointer */
+
+ CARD32 MemCntl;
+ CARD32 BusCntl;
+ unsigned long FbMapSize; /* Size of frame buffer, in bytes */
+ int Flags; /* Saved copy of mode flags */
+
+#ifdef ENABLE_FLAT_PANEL
+ Bool HasPanelRegs; /* Current chip can connect to a FP */
+ Bool CRTOnly; /* Only use External CRT instead of FP */
+ int FPBIOSstart; /* Start of the flat panel info */
+
+ /* Computed values for FPs */
+ int PanelXRes;
+ int PanelYRes;
+ int PanelPwrDly;
+#endif
+
+ RADEONPLLRec pll;
+ RADEONRAMPtr ram;
+
+ RADEONSaveRec SavedReg; /* Original (text) mode */
+ RADEONSaveRec ModeReg; /* Current mode */
+ Bool (*CloseScreen)(int, ScreenPtr);
+
+ Bool PaletteSavedOnVT; /* Palette saved on last VT switch */
+
+ XAAInfoRecPtr accel;
+ Bool accelOn;
+ xf86CursorInfoPtr cursor;
+ unsigned long cursor_start;
+ unsigned long cursor_end;
+
+ int fifo_slots; /* Free slots in the FIFO (64 max) */
+ int pix24bpp; /* Depth of pixmap for 24bpp framebuffer */
+ Bool dac6bits; /* Use 6 bit DAC? */
+
+ /* Computed values for Radeon */
+ int pitch;
+ int datatype;
+ CARD32 dp_gui_master_cntl;
+
+ /* Saved values for ScreenToScreenCopy */
+ int xdir;
+ int ydir;
+
+ /* ScanlineScreenToScreenColorExpand support */
+ unsigned char *scratch_buffer[1];
+ unsigned char *scratch_save;
+ int scanline_x;
+ int scanline_y;
+ int scanline_h;
+ int scanline_h_w;
+ int scanline_words;
+ int scanline_direct;
+ int scanline_bpp; /* Only used for ImageWrite */
+
+ DGAModePtr DGAModes;
+ int numDGAModes;
+ Bool DGAactive;
+ int DGAViewportStatus;
+
+ RADEONFBLayout CurrentLayout;
+#ifdef XF86DRI
+ Bool directRenderingEnabled;
+ DRIInfoPtr pDRIInfo;
+ int drmFD;
+ int numVisualConfigs;
+ __GLXvisualConfig *pVisualConfigs;
+ RADEONConfigPrivPtr pVisualConfigsPriv;
+
+ drmHandle fbHandle;
+
+ drmSize registerSize;
+ drmHandle registerHandle;
+
+ Bool IsPCI; /* Current card is a PCI card */
+
+ drmSize agpSize;
+ drmHandle agpMemHandle; /* Handle from drmAgpAlloc */
+ unsigned long agpOffset;
+ unsigned char *AGP; /* Map */
+ int agpMode;
+
+ Bool CPInUse; /* CP is currently active */
+ int CPMode; /* CP mode that server/clients use */
+ int CPFifoSize; /* Size of the CP command FIFO */
+ Bool CPSecure; /* CP security enabled */
+ int CPusecTimeout; /* CP timeout in usecs */
+ Bool CP2D; /* CP is used for X server 2D prims */
+
+ /* CP ring buffer data */
+ unsigned long ringStart; /* Offset into AGP space */
+ drmHandle ringHandle; /* Handle from drmAddMap */
+ drmSize ringMapSize; /* Size of map */
+ int ringSize; /* Size of ring (in MB) */
+ unsigned char *ring; /* Map */
+ int ringSizeLog2QW;
+
+ unsigned long ringReadOffset; /* Offset into AGP space */
+ drmHandle ringReadPtrHandle; /* Handle from drmAddMap */
+ drmSize ringReadMapSize; /* Size of map */
+ unsigned char *ringReadPtr; /* Map */
+
+ /* CP vertex buffer data */
+ unsigned long vbStart; /* Offset into AGP space */
+ drmHandle vbHandle; /* Handle from drmAddMap */
+ drmSize vbMapSize; /* Size of map */
+ int vbSize; /* Size of vert bufs (in MB) */
+ unsigned char *vb; /* Map */
+ int vbBufSize; /* Size of individual vert buf */
+ int vbNumBufs; /* Number of vert bufs */
+ drmBufMapPtr vbBufs; /* Buffer map */
+
+ /* CP indirect buffer data */
+ unsigned long indStart; /* Offset into AGP space */
+ drmHandle indHandle; /* Handle from drmAddMap */
+ drmSize indMapSize; /* Size of map */
+ int indSize; /* Size of indirect bufs (in MB) */
+ unsigned char *ind; /* Map */
+
+ /* CP AGP Texture data */
+ unsigned long agpTexStart; /* Offset into AGP space */
+ drmHandle agpTexHandle; /* Handle from drmAddMap */
+ drmSize agpTexMapSize; /* Size of map */
+ int agpTexSize; /* Size of AGP tex space (in MB) */
+ unsigned char *agpTex; /* Map */
+ int log2AGPTexGran;
+
+ /* DRI screen private data */
+ int fbX;
+ int fbY;
+ int backX;
+ int backY;
+ int depthX;
+ int depthY;
+ int textureX;
+ int textureY;
+ int textureSize;
+ int log2TexGran;
+#endif
+ XF86VideoAdaptorPtr adaptor;
+} RADEONInfoRec, *RADEONInfoPtr;
+
+#define RADEONWaitForFifo(pScrn, entries) \
+do { \
+ if (info->fifo_slots < entries) \
+ RADEONWaitForFifoFunction(pScrn, entries); \
+ info->fifo_slots -= entries; \
+} while (0)
+
+extern void RADEONWaitForFifoFunction(ScrnInfoPtr pScrn, int entries);
+extern void RADEONWaitForIdle(ScrnInfoPtr pScrn);
+extern void RADEONEngineReset(ScrnInfoPtr pScrn);
+extern void RADEONEngineFlush(ScrnInfoPtr pScrn);
+
+extern int RADEONINPLL(ScrnInfoPtr pScrn, int addr);
+extern void RADEONWaitForVerticalSync(ScrnInfoPtr pScrn);
+extern void RADEONAdjustFrame(int scrnIndex, int x, int y, int flags);
+extern Bool RADEONSwitchMode(int ScrnIndex, DisplayModePtr mode, int flags);
+
+extern Bool RADEONAccelInit(ScreenPtr pScreen);
+extern void RADEONEngineInit(ScrnInfoPtr pScrn);
+extern Bool RADEONCursorInit(ScreenPtr pScreen);
+extern Bool RADEONDGAInit(ScreenPtr pScreen);
+
+extern int RADEONMinBits(int val);
+
+#ifdef XF86DRI
+extern Bool RADEONDRIScreenInit(ScreenPtr pScreen);
+extern void RADEONDRICloseScreen(ScreenPtr pScreen);
+extern Bool RADEONDRIFinishScreenInit(ScreenPtr pScreen);
+extern void RADEONCPStart(ScrnInfoPtr pScrn);
+extern void RADEONCPStop(ScrnInfoPtr pScrn);
+extern void RADEONCPResetRing(ScrnInfoPtr pScrn);
+extern void RADEONCPWaitForIdle(ScrnInfoPtr pScrn);
+#endif
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_accel.c
new file mode 100644
index 000000000..88e4f7a0a
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_accel.c
@@ -0,0 +1,981 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_accel.c,v 1.1 2000/10/18 17:20:02 alanh Exp $ */
+/**************************************************************************
+
+Copyright 2000 ATI Technologies Inc. and VA Linux Systems, Inc.,
+ Sunnyvale, California.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+on the rights to use, copy, modify, merge, publish, distribute, sub
+license, and/or sell copies of the Software, and to permit persons to whom
+the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <martin@valinux.com>
+ * Rickard E. Faith <faith@valinux.com>
+ * Alan Hourihane <ahourihane@valinux.com>
+ *
+ * Credits:
+ *
+ * Thanks to Ani Joshi <ajoshi@shell.unixbox.com> for providing source
+ * code to his Radeon driver. Portions of this file are based on the
+ * initialization code for that driver.
+ *
+ * References:
+ *
+ * !!!! FIXME !!!!
+ * RAGE 128 VR/ RAGE 128 GL Register Reference Manual (Technical
+ * Reference Manual P/N RRG-G04100-C Rev. 0.04), ATI Technologies: April
+ * 1999.
+ *
+ * RAGE 128 Software Development Manual (Technical Reference Manual P/N
+ * SDK-G04000 Rev. 0.01), ATI Technologies: June 1999.
+ *
+ * Notes on unimplemented XAA optimizations:
+ *
+ * SetClipping: This has been removed as XAA expects 16bit registers
+ * for full clipping.
+ * TwoPointLine: The Radeon supports this. Not Bresenham.
+ * DashedLine with non-power-of-two pattern length: Apparently, there is
+ * no way to set the length of the pattern -- it is always
+ * assumed to be 8 or 32 (or 1024?).
+ * ScreenToScreenColorExpandFill: See p. 4-17 of the Technical Reference
+ * Manual where it states that monochrome expansion of frame
+ * buffer data is not supported.
+ * CPUToScreenColorExpandFill, direct: The implementation here uses a hybrid
+ * direct/indirect method. If we had more data registers,
+ * then we could do better. If XAA supported a trigger write
+ * address, the code would be simpler.
+ * Color8x8PatternFill: Apparently, an 8x8 color brush cannot take an 8x8
+ * pattern from frame buffer memory.
+ * ImageWrites: Same as CPUToScreenColorExpandFill
+ *
+ */
+
+#define RADEON_IMAGEWRITE 0 /* Turned off by default - slower in accel */
+
+ /* X and server generic header files */
+#include "Xarch.h"
+#include "xf86.h"
+#include "xf86_ansic.h"
+#include "xf86_OSproc.h"
+#include "xf86fbman.h"
+
+ /* Line support */
+#include "miline.h"
+
+ /* Driver data structures */
+#include "radeon.h"
+#include "radeon_reg.h"
+
+static struct {
+ int rop;
+ int pattern;
+} RADEON_ROP[] = {
+ { RADEON_ROP3_ZERO, RADEON_ROP3_ZERO }, /* GXclear */
+ { RADEON_ROP3_DSa, RADEON_ROP3_DPa }, /* Gxand */
+ { RADEON_ROP3_SDna, RADEON_ROP3_PDna }, /* GXandReverse */
+ { RADEON_ROP3_S, RADEON_ROP3_P }, /* GXcopy */
+ { RADEON_ROP3_DSna, RADEON_ROP3_DPna }, /* GXandInverted */
+ { RADEON_ROP3_D, RADEON_ROP3_D }, /* GXnoop */
+ { RADEON_ROP3_DSx, RADEON_ROP3_DPx }, /* GXxor */
+ { RADEON_ROP3_DSo, RADEON_ROP3_DPo }, /* GXor */
+ { RADEON_ROP3_DSon, RADEON_ROP3_DPon }, /* GXnor */
+ { RADEON_ROP3_DSxn, RADEON_ROP3_PDxn }, /* GXequiv */
+ { RADEON_ROP3_Dn, RADEON_ROP3_Dn }, /* GXinvert */
+ { RADEON_ROP3_SDno, RADEON_ROP3_PDno }, /* GXorReverse */
+ { RADEON_ROP3_Sn, RADEON_ROP3_Pn }, /* GXcopyInverted */
+ { RADEON_ROP3_DSno, RADEON_ROP3_DPno }, /* GXorInverted */
+ { RADEON_ROP3_DSan, RADEON_ROP3_DPan }, /* GXnand */
+ { RADEON_ROP3_ONE, RADEON_ROP3_ONE } /* GXset */
+};
+
+/* Flush all dirty data in the Pixel Cache to memory. */
+void RADEONEngineFlush(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+ int i;
+
+ OUTREGP(RADEON_RB2D_DSTCACHE_CTLSTAT, RADEON_RB2D_DC_FLUSH_ALL,
+ ~RADEON_RB2D_DC_FLUSH_ALL);
+ for (i = 0; i < RADEON_TIMEOUT; i++) {
+ if (!(INREG(RADEON_RB2D_DSTCACHE_CTLSTAT) & RADEON_RB2D_DC_BUSY)) break;
+ }
+}
+
+/* Reset graphics card to known state. */
+void RADEONEngineReset(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+ CARD32 clock_cntl_index;
+ CARD32 mclk_cntl;
+ CARD32 rbbm_soft_reset;
+
+ RADEONEngineFlush(pScrn);
+
+ clock_cntl_index = INREG(RADEON_CLOCK_CNTL_INDEX);
+ mclk_cntl = INPLL(pScrn, RADEON_MCLK_CNTL);
+
+ OUTPLL(RADEON_MCLK_CNTL, (mclk_cntl | 0x003f0000));
+
+ rbbm_soft_reset = INREG(RADEON_RBBM_SOFT_RESET);
+
+ OUTREG(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset |
+ RADEON_SOFT_RESET_CP |
+ RADEON_SOFT_RESET_HI |
+ RADEON_SOFT_RESET_SE |
+ RADEON_SOFT_RESET_RE |
+ RADEON_SOFT_RESET_PP |
+ RADEON_SOFT_RESET_E2 |
+ RADEON_SOFT_RESET_RB |
+ RADEON_SOFT_RESET_HDP);
+ INREG(RADEON_RBBM_SOFT_RESET);
+ OUTREG(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset &
+ ~(RADEON_SOFT_RESET_CP |
+ RADEON_SOFT_RESET_HI |
+ RADEON_SOFT_RESET_SE |
+ RADEON_SOFT_RESET_RE |
+ RADEON_SOFT_RESET_PP |
+ RADEON_SOFT_RESET_E2 |
+ RADEON_SOFT_RESET_RB |
+ RADEON_SOFT_RESET_HDP));
+ INREG(RADEON_RBBM_SOFT_RESET);
+
+ OUTPLL(RADEON_MCLK_CNTL, mclk_cntl);
+ OUTREG(RADEON_CLOCK_CNTL_INDEX, clock_cntl_index);
+ OUTREG(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset);
+
+#ifdef XF86DRI
+ if (RADEONCP_USE_RING_BUFFER(info->CPMode)) RADEONCPResetRing(pScrn);
+#endif
+}
+
+/* The FIFO has 64 slots. This routines waits until at least `entries' of
+ these slots are empty. */
+void RADEONWaitForFifoFunction(ScrnInfoPtr pScrn, int entries)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+ int i;
+
+ for (;;) {
+ for (i = 0; i < RADEON_TIMEOUT; i++) {
+ info->fifo_slots =
+ INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK;
+ if (info->fifo_slots >= entries) return;
+ }
+ RADEONTRACE(("FIFO timed out: %d entries, stat=0x%08x\n",
+ INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK,
+ INREG(RADEON_RBBM_STATUS)));
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "FIFO timed out, resetting engine...\n");
+ RADEONEngineReset(pScrn);
+#ifdef XF86DRI
+ if (info->CP2D) RADEONCPStart(pScrn);
+#endif
+ }
+}
+
+/* Wait for the graphics engine to be completely idle: the FIFO has
+ drained, the Pixel Cache is flushed, and the engine is idle. This is a
+ standard "sync" function that will make the hardware "quiescent". */
+void RADEONWaitForIdle(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+ int i;
+
+ RADEONTRACE(("WaitForIdle (entering): %d entries, stat=0x%08x\n",
+ INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK,
+ INREG(RADEON_RBBM_STATUS)));
+
+ RADEONWaitForFifoFunction(pScrn, 64);
+
+ for (;;) {
+ for (i = 0; i < RADEON_TIMEOUT; i++) {
+ if (!(INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_ACTIVE)) {
+ RADEONEngineFlush(pScrn);
+ return;
+ }
+ }
+ RADEONTRACE(("Idle timed out: %d entries, stat=0x%08x\n",
+ INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK,
+ INREG(RADEON_RBBM_STATUS)));
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Idle timed out, resetting engine...\n");
+ RADEONEngineReset(pScrn);
+#ifdef XF86DRI
+ if (info->CP2D) RADEONCPStart(pScrn);
+#endif
+ }
+}
+
+/* Setup for XAA SolidFill. */
+static void RADEONSetupForSolidFill(ScrnInfoPtr pScrn,
+ int color, int rop, unsigned int planemask)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ RADEONWaitForFifo(pScrn, 4);
+ OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
+ | RADEON_GMC_BRUSH_SOLID_COLOR
+ | RADEON_GMC_SRC_DATATYPE_COLOR
+ | RADEON_ROP[rop].pattern));
+ OUTREG(RADEON_DP_BRUSH_FRGD_CLR, color);
+ OUTREG(RADEON_DP_WRITE_MASK, planemask);
+ OUTREG(RADEON_DP_CNTL, (RADEON_DST_X_LEFT_TO_RIGHT
+ | RADEON_DST_Y_TOP_TO_BOTTOM));
+}
+
+/* Subsequent XAA SolidFillRect.
+
+ Tests: xtest CH06/fllrctngl, xterm
+*/
+static void RADEONSubsequentSolidFillRect(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ RADEONWaitForFifo(pScrn, 2);
+ OUTREG(RADEON_DST_Y_X, (y << 16) | x);
+ OUTREG(RADEON_DST_WIDTH_HEIGHT, (w << 16) | h);
+}
+
+/* Setup for XAA solid lines. */
+static void RADEONSetupForSolidLine(ScrnInfoPtr pScrn,
+ int color, int rop, unsigned int planemask)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ RADEONWaitForFifo(pScrn, 3);
+ OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
+ | RADEON_GMC_BRUSH_SOLID_COLOR
+ | RADEON_GMC_SRC_DATATYPE_COLOR
+ | RADEON_ROP[rop].pattern));
+ OUTREG(RADEON_DP_BRUSH_FRGD_CLR, color);
+ OUTREG(RADEON_DP_WRITE_MASK, planemask);
+}
+
+
+/* Subsequent XAA solid TwoPointLine line.
+
+ Tests: xtest CH06/drwln, ico, Mark Vojkovich's linetest program
+
+ [See http://www.xfree86.org/devel/archives/devel/1999-Jun/0102.shtml for
+ Mark Vojkovich's linetest program, posted 2Jun99 to devel@xfree86.org.]
+*/
+static void RADEONSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
+ int x1, int y1, int x2, int y2,
+ int flags)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+ int direction = 0;
+
+ if (x1 < x2) direction |= RADEON_DST_X_DIR_LEFT_TO_RIGHT;
+ if (y1 < y2) direction |= RADEON_DST_Y_DIR_TOP_TO_BOTTOM;
+
+ RADEONWaitForFifo(pScrn, 4);
+ OUTREG(RADEON_DST_Y_X, (y1 << 16) | x1);
+ if (!(flags & OMIT_LAST))
+ OUTREG(RADEON_DP_CNTL_XDIR_YDIR_YMAJOR, direction);
+ OUTREG(RADEON_DST_LINE_START, (y1 << 16) | x1);
+ OUTREG(RADEON_DST_LINE_END, (y2 << 16) | x2);
+}
+
+/* Subsequent XAA solid horizontal and vertical lines */
+static void RADEONSubsequentSolidHorVertLine(ScrnInfoPtr pScrn,
+ int x, int y, int len, int dir )
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ RADEONWaitForFifo(pScrn, 1);
+ OUTREG(RADEON_DP_CNTL, (RADEON_DST_X_LEFT_TO_RIGHT
+ | RADEON_DST_Y_TOP_TO_BOTTOM));
+
+ if (dir == DEGREES_0) {
+ RADEONSubsequentSolidFillRect(pScrn, x, y, len, 1);
+ } else {
+ RADEONSubsequentSolidFillRect(pScrn, x, y, 1, len);
+ }
+}
+
+/* Setup for XAA dashed lines.
+
+ Tests: xtest CH05/stdshs, XFree86/drwln
+
+ NOTE: Since we can only accelerate lines with power-of-2 patterns of
+ length <= 32.
+*/
+static void RADEONSetupForDashedLine(ScrnInfoPtr pScrn,
+ int fg, int bg,
+ int rop, unsigned int planemask,
+ int length, unsigned char *pattern)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+ CARD32 pat = *(CARD32 *)pattern;
+
+ switch (length) {
+ case 2: pat |= pat << 2; /* fall through */
+ case 4: pat |= pat << 4; /* fall through */
+ case 8: pat |= pat << 8; /* fall through */
+ case 16: pat |= pat << 16;
+ }
+
+ RADEONWaitForFifo(pScrn, 5);
+ OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
+ | (bg == -1
+ ? RADEON_GMC_BRUSH_32x1_MONO_FG_LA
+ : RADEON_GMC_BRUSH_32x1_MONO_FG_BG)
+ | RADEON_ROP[rop].pattern
+ | RADEON_GMC_BYTE_LSB_TO_MSB));
+ OUTREG(RADEON_DP_WRITE_MASK, planemask);
+ OUTREG(RADEON_DP_BRUSH_FRGD_CLR, fg);
+ OUTREG(RADEON_DP_BRUSH_BKGD_CLR, bg);
+ OUTREG(RADEON_BRUSH_DATA0, pat);
+}
+
+/* Subsequent XAA dashed line. */
+static void RADEONSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn,
+ int x1, int y1,
+ int x2, int y2,
+ int flags,
+ int phase)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+ int direction = 0;
+
+ if (x1 < x2) direction |= RADEON_DST_X_DIR_LEFT_TO_RIGHT;
+ if (y1 < y2) direction |= RADEON_DST_Y_DIR_TOP_TO_BOTTOM;
+
+ RADEONWaitForFifo(pScrn, 5);
+ if (!(flags & OMIT_LAST))
+ OUTREG(RADEON_DP_CNTL_XDIR_YDIR_YMAJOR, direction);
+ OUTREG(RADEON_DST_Y_X, (y1 << 16) | x1);
+ OUTREG(RADEON_BRUSH_Y_X, (phase << 16) | phase);
+ OUTREG(RADEON_DST_LINE_START, (y1 << 16) | x1);
+ OUTREG(RADEON_DST_LINE_END, (y2 << 16) | x2);
+}
+
+/* Setup for XAA screen-to-screen copy.
+
+ Tests: xtest CH06/fllrctngl (also tests transparency).
+*/
+static void RADEONSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
+ int xdir, int ydir, int rop,
+ unsigned int planemask,
+ int trans_color)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ info->xdir = xdir;
+ info->ydir = ydir;
+ RADEONWaitForFifo(pScrn, 3);
+ OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
+ | RADEON_GMC_BRUSH_NONE
+ | RADEON_GMC_SRC_DATATYPE_COLOR
+ | RADEON_ROP[rop].rop
+ | RADEON_DP_SRC_SOURCE_MEMORY));
+ OUTREG(RADEON_DP_WRITE_MASK, planemask);
+ OUTREG(RADEON_DP_CNTL, ((xdir >= 0
+ ? RADEON_DST_X_LEFT_TO_RIGHT
+ : 0)
+ | (ydir >= 0
+ ? RADEON_DST_Y_TOP_TO_BOTTOM
+ : 0)));
+
+ if (trans_color != -1) {
+ /* Set up for transparency */
+ RADEONWaitForFifo(pScrn, 3);
+ OUTREG(RADEON_CLR_CMP_CLR_SRC, trans_color);
+ OUTREG(RADEON_CLR_CMP_MASK, RADEON_CLR_CMP_MSK);
+ /* Mmmm, Seems as though the transparency compare is opposite to r128
+ * It should only draw when source != trans_color,
+ * this is the opposite of that. */
+ OUTREG(RADEON_CLR_CMP_CNTL, (RADEON_SRC_CMP_EQ_COLOR
+ | RADEON_CLR_CMP_SRC_SOURCE));
+ }
+}
+
+/* Subsequent XAA screen-to-screen copy. */
+static void RADEONSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
+ int x1, int y1,
+ int x2, int y2,
+ int w, int h)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ if (info->xdir < 0) x1 += w - 1, x2 += w - 1;
+ if (info->ydir < 0) y1 += h - 1, y2 += h - 1;
+
+ RADEONWaitForFifo(pScrn, 3);
+ OUTREG(RADEON_SRC_Y_X, (y1 << 16) | x1);
+ OUTREG(RADEON_DST_Y_X, (y2 << 16) | x2);
+ OUTREG(RADEON_DST_HEIGHT_WIDTH, (h << 16) | w);
+}
+
+/* Setup for XAA mono 8x8 pattern color expansion. Patterns with
+ transparency use `bg == -1'. This routine is only used if the XAA
+ pixmap cache is turned on.
+
+ Tests: xtest XFree86/fllrctngl (no other test will test this routine with
+ both transparency and non-transparency)
+*/
+static void RADEONSetupForMono8x8PatternFill(ScrnInfoPtr pScrn,
+ int patternx, int patterny,
+ int fg, int bg, int rop,
+ unsigned int planemask)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ RADEONWaitForFifo(pScrn, 6);
+ OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
+ | (bg == -1
+ ? RADEON_GMC_BRUSH_8X8_MONO_FG_LA
+ : RADEON_GMC_BRUSH_8X8_MONO_FG_BG)
+ | RADEON_ROP[rop].pattern
+ | RADEON_GMC_BYTE_LSB_TO_MSB));
+ OUTREG(RADEON_DP_WRITE_MASK, planemask);
+ OUTREG(RADEON_DP_BRUSH_FRGD_CLR, fg);
+ OUTREG(RADEON_DP_BRUSH_BKGD_CLR, bg);
+ OUTREG(RADEON_BRUSH_DATA0, patternx);
+ OUTREG(RADEON_BRUSH_DATA1, patterny);
+}
+
+/* Subsequent XAA 8x8 pattern color expansion. Because they are used in
+ the setup function, `patternx' and `patterny' are not used here. */
+static void RADEONSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn,
+ int patternx, int patterny,
+ int x, int y, int w, int h)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ RADEONWaitForFifo(pScrn, 3);
+ OUTREG(RADEON_BRUSH_Y_X, (patterny << 8) | patternx);
+ OUTREG(RADEON_DST_Y_X, (y << 16) | x);
+ OUTREG(RADEON_DST_HEIGHT_WIDTH, (h << 16) | w);
+}
+
+#if 0
+/* Setup for XAA color 8x8 pattern fill.
+
+ Tests: xtest XFree86/fllrctngl (with Mono8x8PatternFill off)
+*/
+static void RADEONSetupForColor8x8PatternFill(ScrnInfoPtr pScrn,
+ int patx, int paty,
+ int rop, unsigned int planemask,
+ int trans_color)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ ErrorF("Color8x8 %d %d %d\n", trans_color, patx, paty);
+
+ RADEONWaitForFifo(pScrn, 3);
+ OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
+ | RADEON_GMC_BRUSH_8x8_COLOR
+ | RADEON_GMC_SRC_DATATYPE_COLOR
+ | RADEON_ROP[rop].pattern
+ | RADEON_DP_SRC_SOURCE_MEMORY));
+ OUTREG(RADEON_DP_WRITE_MASK, planemask);
+ OUTREG(RADEON_SRC_Y_X, (paty << 16) | patx);
+
+ if (trans_color != -1) {
+ /* Set up for transparency */
+ RADEONWaitForFifo(pScrn, 3);
+ OUTREG(RADEON_CLR_CMP_CLR_SRC, trans_color);
+ OUTREG(RADEON_CLR_CMP_MASK, RADEON_CLR_CMP_MSK);
+ /* Mmmm, Seems as though the transparency compare is opposite to r128
+ * It should only draw when source != trans_color,
+ * this is the opposite of that. */
+ OUTREG(RADEON_CLR_CMP_CNTL, (RADEON_SRC_CMP_EQ_COLOR
+ | RADEON_CLR_CMP_SRC_SOURCE));
+ }
+}
+
+/* Subsequent XAA 8x8 pattern color expansion. */
+static void RADEONSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn,
+ int patx, int paty,
+ int x, int y, int w, int h)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ ErrorF("Color8x8 %d,%d %d,%d %d %d\n", patx, paty, x, y, w, h);
+
+ RADEONWaitForFifo(pScrn, 4);
+ OUTREG(RADEON_BRUSH_Y_X, (paty << 16) | patx);
+ OUTREG(RADEON_DST_Y_X, (y << 16) | x);
+ OUTREG(RADEON_DST_HEIGHT_WIDTH, (h << 16) | w);
+}
+#endif
+
+/* Setup for XAA indirect CPU-to-screen color expansion (indirect).
+ Because of how the scratch buffer is initialized, this is really a
+ mainstore-to-screen color expansion. Transparency is supported when `bg
+ == -1'.
+ Implementing the hybrid indirect/direct scheme improved performance in a
+ few areas:
+*/
+static void RADEONSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
+ int fg, int bg,
+ int rop,
+ unsigned int
+ planemask)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ RADEONWaitForFifo(pScrn, 4);
+ OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
+ | RADEON_GMC_DST_CLIPPING
+ | RADEON_GMC_BRUSH_NONE
+ | (bg == -1
+ ? RADEON_GMC_SRC_DATATYPE_MONO_FG_LA
+ : RADEON_GMC_SRC_DATATYPE_MONO_FG_BG)
+ | RADEON_ROP[rop].rop
+ | RADEON_GMC_BYTE_LSB_TO_MSB
+ | RADEON_DP_SRC_SOURCE_HOST_DATA));
+ OUTREG(RADEON_DP_WRITE_MASK, planemask);
+ OUTREG(RADEON_DP_SRC_FRGD_CLR, fg);
+ OUTREG(RADEON_DP_SRC_BKGD_CLR, bg);
+}
+
+/* Subsequent XAA indirect CPU-to-screen color expansion. This is only
+ called once for each rectangle. */
+static void RADEONSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr
+ pScrn,
+ int x, int y,
+ int w, int h,
+ int skipleft)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ info->scanline_h = h;
+ info->scanline_words = (w + 31) >> 5;
+
+ if ((info->scanline_words * h) <= 9) {
+ /* Turn on direct for less than 9 dword colour expansion */
+ info->scratch_buffer[0]
+ = (unsigned char *)(ADDRREG(RADEON_HOST_DATA_LAST)
+ - (info->scanline_words - 1));
+ info->scanline_direct = 1;
+ } else {
+ /* Use indirect for anything else */
+ info->scratch_buffer[0] = info->scratch_save;
+ info->scanline_direct = 0;
+ }
+
+ RADEONWaitForFifo(pScrn, 4 + (info->scanline_direct ?
+ (info->scanline_words * h) : 0) );
+ OUTREG(RADEON_SC_TOP_LEFT, (y << 16) | ((x+skipleft) & 0xffff));
+ /* MMmm, we don't need the -1 on both y+h or x+w, why ? */
+ OUTREG(RADEON_SC_BOTTOM_RIGHT, ((y+h) << 16) | ((x+w) & 0xffff));
+ OUTREG(RADEON_DST_Y_X, (y << 16) | (x & 0xffff));
+ /* Have to pad the width here and use clipping engine */
+ OUTREG(RADEON_DST_HEIGHT_WIDTH, (h << 16) | ((w + 31) & ~31));
+}
+
+/* Subsequent XAA indirect CPU-to-screen color expandion. This is called
+ once for each scanline. */
+static void RADEONSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+ CARD32 *p = (CARD32 *)info->scratch_buffer[bufno];
+ int i;
+ int left = info->scanline_words;
+ volatile CARD32 *d;
+
+ if (info->scanline_direct) return;
+ --info->scanline_h;
+ while (left) {
+ if (left <= 8) {
+ /* Last scanline - finish write to DATA_LAST */
+ if (info->scanline_h == 0) {
+ RADEONWaitForFifo(pScrn, left);
+ /* Unrolling doesn't improve performance */
+ for (d = ADDRREG(RADEON_HOST_DATA_LAST) - (left - 1); left; --left)
+ *d++ = *p++;
+ return;
+ } else {
+ RADEONWaitForFifo(pScrn, left);
+ /* Unrolling doesn't improve performance */
+ for (d = ADDRREG(RADEON_HOST_DATA7) - (left - 1); left; --left)
+ *d++ = *p++;
+ }
+ } else {
+ RADEONWaitForFifo(pScrn, 8);
+ /* Unrolling doesn't improve performance */
+ for (d = ADDRREG(RADEON_HOST_DATA0), i = 0; i < 8; i++)
+ *d++ = *p++;
+ left -= 8;
+ }
+ }
+}
+
+#if RADEON_IMAGEWRITE
+/* Setup for XAA indirect image write. */
+static void RADEONSetupForScanlineImageWrite(ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int trans_color,
+ int bpp,
+ int depth)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ info->scanline_bpp = bpp;
+
+ RADEONWaitForFifo(pScrn, 2);
+ OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
+ | RADEON_GMC_DST_CLIPPING
+ | RADEON_GMC_BRUSH_NONE
+ | RADEON_GMC_SRC_DATATYPE_COLOR
+ | RADEON_ROP[rop].rop
+ | RADEON_GMC_BYTE_LSB_TO_MSB
+ | RADEON_DP_SRC_SOURCE_HOST_DATA));
+ OUTREG(RADEON_DP_WRITE_MASK, planemask);
+
+ if (trans_color != -1) {
+ /* Set up for transparency */
+ RADEONWaitForFifo(pScrn, 3);
+ OUTREG(RADEON_CLR_CMP_CLR_SRC, trans_color);
+ OUTREG(RADEON_CLR_CMP_MASK, RADEON_CLR_CMP_MSK);
+ /* Mmmm, Seems as though the transparency compare is opposite to r128
+ * It should only draw when source != trans_color,
+ * this is the opposite of that. */
+ OUTREG(RADEON_CLR_CMP_CNTL, (RADEON_SRC_CMP_EQ_COLOR
+ | RADEON_CLR_CMP_SRC_SOURCE));
+ }
+}
+
+/* Subsequent XAA indirect image write. This is only called once for each
+ rectangle. */
+static void RADEONSubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn,
+ int x, int y,
+ int w, int h,
+ int skipleft)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+ int shift = 0; /* 32bpp */
+
+ if (pScrn->bitsPerPixel == 8) shift = 3;
+ else if (pScrn->bitsPerPixel == 16) shift = 1;
+
+ info->scanline_h = h;
+ info->scanline_words = (w * info->scanline_bpp + 31) >> 5;
+
+ if ((info->scanline_words * h) <= 9) {
+ /* Turn on direct for less than 9 dword colour expansion */
+ info->scratch_buffer[0]
+ = (unsigned char *)(ADDRREG(RADEON_HOST_DATA_LAST)
+ - (info->scanline_words - 1));
+ info->scanline_direct = 1;
+ } else {
+ /* Use indirect for anything else */
+ info->scratch_buffer[0] = info->scratch_save;
+ info->scanline_direct = 0;
+ }
+
+ RADEONWaitForFifo(pScrn, 4 + (info->scanline_direct ?
+ (info->scanline_words * h) : 0) );
+ OUTREG(RADEON_SC_TOP_LEFT, (y << 16) | ((x+skipleft) & 0xffff));
+ /* MMmm, we don't need the -1 on both y+h or x+w, why ? */
+ OUTREG(RADEON_SC_BOTTOM_RIGHT, ((y+h) << 16) | ((x+w) & 0xffff));
+ OUTREG(RADEON_DST_Y_X, (y << 16) | (x & 0xffff));
+ /* Have to pad the width here and use clipping engine */
+ OUTREG(RADEON_DST_HEIGHT_WIDTH, (h << 16) | ((w + shift) & ~shift));
+}
+
+/* Subsequent XAA indirect image write. This is called once for each
+ scanline. */
+static void RADEONSubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+ CARD32 *p = (CARD32 *)info->scratch_buffer[bufno];
+ int i;
+ int left = info->scanline_words;
+ volatile CARD32 *d;
+
+ if (info->scanline_direct) return;
+ --info->scanline_h;
+ while (left) {
+ if (left <= 8) {
+ /* Last scanline - finish write to DATA_LAST */
+ if (info->scanline_h == 0) {
+ RADEONWaitForFifo(pScrn, left);
+ /* Unrolling doesn't improve performance */
+ for (d = ADDRREG(RADEON_HOST_DATA_LAST) - (left - 1); left; --left)
+ *d++ = *p++;
+ return;
+ } else {
+ RADEONWaitForFifo(pScrn, left);
+ /* Unrolling doesn't improve performance */
+ for (d = ADDRREG(RADEON_HOST_DATA7) - (left - 1); left; --left)
+ *d++ = *p++;
+ }
+ } else {
+ RADEONWaitForFifo(pScrn, 8);
+ /* Unrolling doesn't improve performance */
+ for (d = ADDRREG(RADEON_HOST_DATA0), i = 0; i < 8; i++)
+ *d++ = *p++;
+ left -= 8;
+ }
+ }
+}
+#endif
+
+/* Initialize the acceleration hardware. */
+void RADEONEngineInit(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+ int pitch64;
+
+ RADEONTRACE(("EngineInit (%d/%d)\n",
+ info->CurrentLayout.pixel_code,
+ info->CurrentLayout.bitsPerPixel));
+
+ OUTREG(RADEON_SCALE_3D_CNTL, 0);
+ RADEONEngineReset(pScrn);
+
+ RADEONWaitForFifo(pScrn, 1);
+ /* turn of all automatic flushing - we'll do it all */
+ OUTREG(RADEON_RB2D_DSTCACHE_MODE, 0);
+
+ switch (info->CurrentLayout.pixel_code) {
+ case 8: info->datatype = 2; break;
+ case 15: info->datatype = 3; break;
+ case 16: info->datatype = 4; break;
+ case 24: info->datatype = 5; break;
+ case 32: info->datatype = 6; break;
+ default:
+ RADEONTRACE(("Unknown depth/bpp = %d/%d (code = %d)\n",
+ info->CurrentLayout.depth,
+ info->CurrentLayout.bitsPerPixel,
+ info->CurrentLayout.pixel_code));
+ }
+ info->pitch = ((info->CurrentLayout.displayWidth / 8) *
+ (info->CurrentLayout.pixel_bytes == 3 ? 3 : 1));
+
+ RADEONTRACE(("Pitch for acceleration = %d\n", info->pitch));
+
+ pitch64 = ((pScrn->displayWidth * (pScrn->bitsPerPixel / 8) + 0x3f)) >> 6;
+
+ RADEONWaitForFifo(pScrn, 1);
+ OUTREG(RADEON_DEFAULT_OFFSET, (INREG(RADEON_DEFAULT_OFFSET) & 0xC0000000) |
+ (pitch64 << 22));
+
+ RADEONWaitForFifo(pScrn, 1);
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ OUTREGP(RADEON_DP_DATATYPE,
+ RADEON_HOST_BIG_ENDIAN_EN, ~RADEON_HOST_BIG_ENDIAN_EN);
+#else
+ OUTREGP(RADEON_DP_DATATYPE, 0, ~RADEON_HOST_BIG_ENDIAN_EN);
+#endif
+
+ RADEONWaitForFifo(pScrn, 1);
+ OUTREG(RADEON_DEFAULT_SC_BOTTOM_RIGHT, (RADEON_DEFAULT_SC_RIGHT_MAX
+ | RADEON_DEFAULT_SC_BOTTOM_MAX));
+ info->dp_gui_master_cntl =
+ ((info->datatype << RADEON_GMC_DST_DATATYPE_SHIFT)
+ | RADEON_GMC_CLR_CMP_CNTL_DIS);
+ RADEONWaitForFifo(pScrn, 1);
+ OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl
+ | RADEON_GMC_BRUSH_SOLID_COLOR
+ | RADEON_GMC_SRC_DATATYPE_COLOR));
+
+ RADEONWaitForFifo(pScrn, 7);
+ OUTREG(RADEON_DST_LINE_START, 0);
+ OUTREG(RADEON_DST_LINE_END, 0);
+ OUTREG(RADEON_DP_BRUSH_FRGD_CLR, 0xffffffff);
+ OUTREG(RADEON_DP_BRUSH_BKGD_CLR, 0x00000000);
+ OUTREG(RADEON_DP_SRC_FRGD_CLR, 0xffffffff);
+ OUTREG(RADEON_DP_SRC_BKGD_CLR, 0x00000000);
+ OUTREG(RADEON_DP_WRITE_MASK, 0xffffffff);
+
+ RADEONWaitForIdle(pScrn);
+}
+
+#ifdef XF86DRI
+/* FIXME: When direct rendering is enabled, we should use the CP to
+ draw 2D commands */
+static void RADEONCPAccelInit(ScrnInfoPtr pScrn, XAAInfoRecPtr a)
+{
+ a->Flags = 0;
+
+ /* Sync */
+#if 1
+ a->Sync = RADEONWaitForIdle;
+#else
+ a->Sync = RADEONCCEWaitForIdle;
+#endif
+
+}
+#endif
+
+static void RADEONMMIOAccelInit(ScrnInfoPtr pScrn, XAAInfoRecPtr a)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+ a->Flags = (PIXMAP_CACHE
+ | OFFSCREEN_PIXMAPS
+ | LINEAR_FRAMEBUFFER);
+
+ /* Sync */
+ a->Sync = RADEONWaitForIdle;
+
+ /* Solid Filled Rectangle */
+ a->PolyFillRectSolidFlags = 0;
+ a->SetupForSolidFill = RADEONSetupForSolidFill;
+ a->SubsequentSolidFillRect = RADEONSubsequentSolidFillRect;
+
+ /* Screen-to-screen Copy */
+ /* Transparency uses the wrong colors for
+ 24 bpp mode -- the transparent part is
+ correct, but the opaque color is wrong.
+ This can be seen with netscape's I-bar
+ cursor when editing in the URL location
+ box. */
+ a->ScreenToScreenCopyFlags = ((pScrn->bitsPerPixel == 24)
+ ? NO_TRANSPARENCY
+ : 0);
+ a->SetupForScreenToScreenCopy = RADEONSetupForScreenToScreenCopy;
+ a->SubsequentScreenToScreenCopy = RADEONSubsequentScreenToScreenCopy;
+
+ /* Mono 8x8 Pattern Fill (Color Expand) */
+ a->SetupForMono8x8PatternFill
+ = RADEONSetupForMono8x8PatternFill;
+ a->SubsequentMono8x8PatternFillRect
+ = RADEONSubsequentMono8x8PatternFillRect;
+ a->Mono8x8PatternFillFlags = (HARDWARE_PATTERN_PROGRAMMED_BITS
+ | HARDWARE_PATTERN_PROGRAMMED_ORIGIN
+ | HARDWARE_PATTERN_SCREEN_ORIGIN
+ | BIT_ORDER_IN_BYTE_LSBFIRST);
+
+ /* Indirect CPU-To-Screen Color Expand */
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+ a->ScanlineCPUToScreenColorExpandFillFlags = LEFT_EDGE_CLIPPING
+ /* RADEON gets upset, when using HOST provided data
+ * without a source rop. To show run 'xtest's drwarc */
+ | ROP_NEEDS_SOURCE
+ | LEFT_EDGE_CLIPPING_NEGATIVE_X;
+#else
+ a->ScanlineCPUToScreenColorExpandFillFlags = BIT_ORDER_IN_BYTE_MSBFIRST
+ /* RADEON gets upset, when using HOST provided data
+ * without a source rop. To show run 'xtest's drwarc */
+ | ROP_NEEDS_SOURCE
+ | LEFT_EDGE_CLIPPING
+ | LEFT_EDGE_CLIPPING_NEGATIVE_X;
+#endif
+ a->NumScanlineColorExpandBuffers = 1;
+ a->ScanlineColorExpandBuffers = info->scratch_buffer;
+ info->scratch_save = xalloc(((pScrn->virtualX+31)/32*4)
+ + (pScrn->virtualX
+ * info->CurrentLayout.pixel_bytes));
+ info->scratch_buffer[0] = info->scratch_save;
+ a->SetupForScanlineCPUToScreenColorExpandFill
+ = RADEONSetupForScanlineCPUToScreenColorExpandFill;
+ a->SubsequentScanlineCPUToScreenColorExpandFill
+ = RADEONSubsequentScanlineCPUToScreenColorExpandFill;
+ a->SubsequentColorExpandScanline = RADEONSubsequentColorExpandScanline;
+
+ a->SetupForSolidLine = RADEONSetupForSolidLine;
+ a->SubsequentSolidTwoPointLine = RADEONSubsequentSolidTwoPointLine;
+ a->SubsequentSolidHorVertLine = RADEONSubsequentSolidHorVertLine;
+
+ a->SetupForDashedLine = RADEONSetupForDashedLine;
+ a->SubsequentDashedTwoPointLine = RADEONSubsequentDashedTwoPointLine;
+ a->DashPatternMaxLength = 32;
+ a->DashedLineFlags = (LINE_PATTERN_LSBFIRST_LSBJUSTIFIED
+ | LINE_PATTERN_POWER_OF_2_ONLY);
+
+#if RADEON_IMAGEWRITE
+ /* ImageWrite */
+ a->NumScanlineImageWriteBuffers = 1;
+ a->ScanlineImageWriteBuffers = info->scratch_buffer;
+ info->scratch_buffer[0] = info->scratch_save;
+ a->SetupForScanlineImageWrite = RADEONSetupForScanlineImageWrite;
+ a->SubsequentScanlineImageWriteRect
+ = RADEONSubsequentScanlineImageWriteRect;
+ a->SubsequentImageWriteScanline = RADEONSubsequentImageWriteScanline;
+ a->ScanlineImageWriteFlags = CPU_TRANSFER_PAD_DWORD
+ /* Performance tests show that we shouldn't use GXcopy for
+ * uploads as a memcpy is faster */
+ | NO_GXCOPY
+ /* RADEON gets upset, when using HOST provided data
+ * without a source rop. To show run 'xtest's ptimg */
+ | ROP_NEEDS_SOURCE
+ | SCANLINE_PAD_DWORD
+ | LEFT_EDGE_CLIPPING
+ | LEFT_EDGE_CLIPPING_NEGATIVE_X;
+#endif
+
+#if 0
+ /* Color 8x8 Pattern Fill */
+ a->SetupForColor8x8PatternFill
+ = RADEONSetupForColor8x8PatternFill;
+ a->SubsequentColor8x8PatternFillRect
+ = RADEONSubsequentColor8x8PatternFillRect;
+ a->Color8x8PatternFillFlags =
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN
+ | HARDWARE_PATTERN_SCREEN_ORIGIN
+ | BIT_ORDER_IN_BYTE_LSBFIRST;
+#endif
+}
+
+/* Initialize XAA for supported acceleration and also initialize the
+ graphics hardware for acceleration. */
+Bool RADEONAccelInit(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ XAAInfoRecPtr a;
+
+ if (!(a = info->accel = XAACreateInfoRec())) return FALSE;
+
+#ifdef XF86DRI
+ /* FIXME: When direct rendering is enabled, we should use the CP to
+ draw 2D commands */
+ if (info->CP2D) RADEONCPAccelInit(pScrn, a);
+ else
+#endif
+ RADEONMMIOAccelInit(pScrn, a);
+
+ RADEONEngineInit(pScrn);
+ return XAAInit(pScreen, a);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_cursor.c b/xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_cursor.c
new file mode 100644
index 000000000..d0f55fea2
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_cursor.c
@@ -0,0 +1,267 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_cursor.c,v 1.1 2000/10/18 17:20:02 alanh Exp $ */
+/**************************************************************************
+
+Copyright 2000 ATI Technologies Inc. and VA Linux Systems, Inc.,
+ Sunnyvale, California.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+on the rights to use, copy, modify, merge, publish, distribute, sub
+license, and/or sell copies of the Software, and to permit persons to whom
+the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <martin@valinux.com>
+ * Rickard E. Faith <faith@valinux.com>
+ *
+ * References:
+ *
+ * !!!! FIXME !!!!
+ * RAGE 128 VR/ RAGE 128 GL Register Reference Manual (Technical
+ * Reference Manual P/N RRG-G04100-C Rev. 0.04), ATI Technologies: April
+ * 1999.
+ *
+ * RAGE 128 Software Development Manual (Technical Reference Manual P/N
+ * SDK-G04000 Rev. 0.01), ATI Technologies: June 1999.
+ *
+ */
+
+ /* X and server generic header files */
+#include "Xarch.h"
+#include "xf86.h"
+#include "xf86_ansic.h"
+#include "xf86_OSproc.h"
+#include "xf86fbman.h"
+
+ /* Driver data structures */
+#include "radeon.h"
+#include "radeon_reg.h"
+
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+#define P_SWAP32( a , b ) \
+ ((char *)a)[0] = ((char *)b)[3]; \
+ ((char *)a)[1] = ((char *)b)[2]; \
+ ((char *)a)[2] = ((char *)b)[1]; \
+ ((char *)a)[3] = ((char *)b)[0]
+
+#define P_SWAP16( a , b ) \
+ ((char *)a)[0] = ((char *)b)[1]; \
+ ((char *)a)[1] = ((char *)b)[0]; \
+ ((char *)a)[2] = ((char *)b)[3]; \
+ ((char *)a)[3] = ((char *)b)[2]
+#endif
+
+
+/* Set cursor foreground and background colors. */
+static void RADEONSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ OUTREG(RADEON_CUR_CLR0, bg);
+ OUTREG(RADEON_CUR_CLR1, fg);
+}
+
+/* Set cursor position to (x,y) with offset into cursor bitmap at
+ (xorigin,yorigin). */
+static void RADEONSetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+ xf86CursorInfoPtr cursor = info->cursor;
+ int xorigin = 0;
+ int yorigin = 0;
+ int total_y = pScrn->frameY1 - pScrn->frameY0;
+
+ if (x < 0) xorigin = -x;
+ if (y < 0) yorigin = -y;
+ if (y > total_y) y = total_y;
+ if (info->Flags & V_DBLSCAN) y *= 2;
+ if (xorigin >= cursor->MaxWidth) xorigin = cursor->MaxWidth - 1;
+ if (yorigin >= cursor->MaxHeight) yorigin = cursor->MaxHeight - 1;
+
+ OUTREG(RADEON_CUR_HORZ_VERT_OFF, (RADEON_CUR_LOCK
+ | (xorigin << 16)
+ | yorigin));
+ OUTREG(RADEON_CUR_HORZ_VERT_POSN, (RADEON_CUR_LOCK
+ | ((xorigin ? 0 : x) << 16)
+ | (yorigin ? 0 : y)));
+ OUTREG(RADEON_CUR_OFFSET, info->cursor_start + yorigin * 16);
+}
+
+/* Copy cursor image from `image' to video memory. RADEONSetCursorPosition
+ will be called after this, so we can ignore xorigin and yorigin. */
+static void RADEONLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *image)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+ CARD32 *s = (CARD32 *)image;
+ CARD32 *d = (CARD32 *)(info->FB + info->cursor_start);
+ int y;
+ CARD32 save;
+
+ save = INREG(RADEON_CRTC_GEN_CNTL);
+ OUTREG(RADEON_CRTC_GEN_CNTL, save & ~RADEON_CRTC_CUR_EN);
+
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ switch(info->CurrentLayout.pixel_bytes) {
+ case 4:
+ case 3:
+ for (y = 0; y < 64; y++) {
+ P_SWAP32(d,s);
+ d++; s++;
+ P_SWAP32(d,s);
+ d++; s++;
+ P_SWAP32(d,s);
+ d++; s++;
+ P_SWAP32(d,s);
+ d++; s++;
+ }
+ break;
+ case 2:
+ for (y = 0; y < 64; y++) {
+ P_SWAP16(d,s);
+ d++; s++;
+ P_SWAP16(d,s);
+ d++; s++;
+ P_SWAP16(d,s);
+ d++; s++;
+ P_SWAP16(d,s);
+ d++; s++;
+ }
+ break;
+ default:
+ for (y = 0; y < 64; y++) {
+ *d++ = *s++;
+ *d++ = *s++;
+ *d++ = *s++;
+ *d++ = *s++;
+ }
+ }
+#else
+ for (y = 0; y < 64; y++) {
+ *d++ = *s++;
+ *d++ = *s++;
+ *d++ = *s++;
+ *d++ = *s++;
+ }
+#endif
+
+ /* Set the area after the cursor to be all transparent so that we
+ won't display corrupted cursors on the screen */
+ for (y = 0; y < 64; y++) {
+ *d++ = 0xffffffff; /* The AND bits */
+ *d++ = 0xffffffff;
+ *d++ = 0x00000000; /* The XOR bits */
+ *d++ = 0x00000000;
+ }
+
+ OUTREG(RADEON_CRTC_GEN_CNTL, save);
+}
+
+/* Hide hardware cursor. */
+static void RADEONHideCursor(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ OUTREGP(RADEON_CRTC_GEN_CNTL, 0, ~RADEON_CRTC_CUR_EN);
+}
+
+/* Show hardware cursor. */
+static void RADEONShowCursor(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ OUTREGP(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_CUR_EN, ~RADEON_CRTC_CUR_EN);
+}
+
+/* Determine if hardware cursor is in use. */
+static Bool RADEONUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+ return info->cursor_start ? TRUE : FALSE;
+}
+
+/* Initialize hardware cursor support. */
+Bool RADEONCursorInit(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ xf86CursorInfoPtr cursor;
+ FBAreaPtr fbarea;
+ int width;
+ int height;
+ int size;
+
+
+ if (!(cursor = info->cursor = xf86CreateCursorInfoRec())) return FALSE;
+
+ cursor->MaxWidth = 64;
+ cursor->MaxHeight = 64;
+ cursor->Flags = (HARDWARE_CURSOR_TRUECOLOR_AT_8BPP
+
+#if X_BYTE_ORDER == X_LITTLE_ENDIAN
+ | HARDWARE_CURSOR_BIT_ORDER_MSBFIRST
+#endif
+ | HARDWARE_CURSOR_INVERT_MASK
+ | HARDWARE_CURSOR_AND_SOURCE_WITH_MASK
+ | HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64
+ | HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK);
+
+ cursor->SetCursorColors = RADEONSetCursorColors;
+ cursor->SetCursorPosition = RADEONSetCursorPosition;
+ cursor->LoadCursorImage = RADEONLoadCursorImage;
+ cursor->HideCursor = RADEONHideCursor;
+ cursor->ShowCursor = RADEONShowCursor;
+ cursor->UseHWCursor = RADEONUseHWCursor;
+
+ size = (cursor->MaxWidth/4) * cursor->MaxHeight;
+ width = pScrn->displayWidth;
+ height = (size*2 + 1023) / pScrn->displayWidth;
+ fbarea = xf86AllocateOffscreenArea(pScreen,
+ width,
+ height,
+ 16,
+ NULL,
+ NULL,
+ NULL);
+
+ if (!fbarea) {
+ info->cursor_start = 0;
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Hardware cursor disabled"
+ " due to insufficient offscreen memory\n");
+ } else {
+ info->cursor_start = RADEON_ALIGN((fbarea->box.x1
+ + width * fbarea->box.y1)
+ * info->CurrentLayout.pixel_bytes,
+ 16);
+ info->cursor_end = info->cursor_start + size;
+ }
+
+ RADEONTRACE(("RADEONCursorInit (0x%08x-0x%08x)\n",
+ info->cursor_start, info->cursor_end));
+
+ return xf86InitCursor(pScreen, cursor);
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_dga.c
new file mode 100644
index 000000000..73c9ab786
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_dga.c
@@ -0,0 +1,368 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_dga.c,v 1.1 2000/10/18 17:20:03 alanh Exp $ */
+/**************************************************************************
+
+Copyright 2000 ATI Technologies Inc. and VA Linux Systems, Inc.,
+ Sunnyvale, California.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+on the rights to use, copy, modify, merge, publish, distribute, sub
+license, and/or sell copies of the Software, and to permit persons to whom
+the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <martin@valinux.com>
+ *
+ * Credits:
+ *
+ * Thanks to Ove Kåven <ovek@transgaming.com> for writing the Rage 128
+ * DGA support. Portions of this file are based on the initialization
+ * code for that driver.
+ *
+ */
+
+ /* X and server generic header files */
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "xf86_ansic.h"
+
+ /* Driver data structures */
+#include "radeon.h"
+
+ /* DGA support */
+#include "dgaproc.h"
+
+
+static Bool RADEON_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **,
+ int *, int *, int *);
+static Bool RADEON_SetMode(ScrnInfoPtr, DGAModePtr);
+static int RADEON_GetViewport(ScrnInfoPtr);
+static void RADEON_SetViewport(ScrnInfoPtr, int, int, int);
+static void RADEON_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long);
+static void RADEON_BlitRect(ScrnInfoPtr, int, int, int, int, int, int);
+#if 0
+static void RADEON_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int,
+ unsigned long);
+#endif
+
+static
+DGAFunctionRec RADEON_DGAFuncs = {
+ RADEON_OpenFramebuffer,
+ NULL,
+ RADEON_SetMode,
+ RADEON_SetViewport,
+ RADEON_GetViewport,
+ RADEONWaitForIdle,
+ RADEON_FillRect,
+ RADEON_BlitRect,
+#if 0
+ RADEON_BlitTransRect
+#else
+ NULL
+#endif
+};
+
+
+static DGAModePtr RADEONSetupDGAMode(ScrnInfoPtr pScrn,
+ DGAModePtr modes,
+ int *num,
+ int bitsPerPixel,
+ int depth,
+ Bool pixmap,
+ int secondPitch,
+ unsigned long red,
+ unsigned long green,
+ unsigned long blue,
+ short visualClass)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ DGAModePtr newmodes = NULL, currentMode;
+ DisplayModePtr pMode, firstMode;
+ int otherPitch, Bpp = bitsPerPixel >> 3;
+ Bool oneMore;
+
+ pMode = firstMode = pScrn->modes;
+
+ while (pMode) {
+ otherPitch = secondPitch ? secondPitch : pMode->HDisplay;
+
+ if (pMode->HDisplay != otherPitch) {
+ newmodes = xrealloc(modes, (*num + 2) * sizeof(DGAModeRec));
+ oneMore = TRUE;
+ } else {
+ newmodes = xrealloc(modes, (*num + 1) * sizeof(DGAModeRec));
+ oneMore = FALSE;
+ }
+
+ if (!newmodes) {
+ xfree(modes);
+ return NULL;
+ }
+ modes = newmodes;
+
+SECOND_PASS:
+
+ currentMode = modes + *num;
+ (*num)++;
+
+ currentMode->mode = pMode;
+ /* FIXME: is concurrent access really possible? */
+ currentMode->flags = DGA_CONCURRENT_ACCESS;
+ if (pixmap)
+ currentMode->flags |= DGA_PIXMAP_AVAILABLE;
+ if (info->accel)
+ currentMode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT;
+ if (pMode->Flags & V_DBLSCAN)
+ currentMode->flags |= DGA_DOUBLESCAN;
+ if (pMode->Flags & V_INTERLACE)
+ currentMode->flags |= DGA_INTERLACED;
+ currentMode->byteOrder = pScrn->imageByteOrder;
+ currentMode->depth = depth;
+ currentMode->bitsPerPixel = bitsPerPixel;
+ currentMode->red_mask = red;
+ currentMode->green_mask = green;
+ currentMode->blue_mask = blue;
+ currentMode->visualClass = visualClass;
+ currentMode->viewportWidth = pMode->HDisplay;
+ currentMode->viewportHeight = pMode->VDisplay;
+ currentMode->xViewportStep = 8;
+ currentMode->yViewportStep = 1;
+ currentMode->viewportFlags = DGA_FLIP_RETRACE;
+ currentMode->offset = 0;
+ currentMode->address = (unsigned char*)info->LinearAddr;
+
+ if (oneMore) { /* first one is narrow width */
+ currentMode->bytesPerScanline = (((pMode->HDisplay * Bpp) + 3)
+ & ~3L);
+ currentMode->imageWidth = pMode->HDisplay;
+ currentMode->imageHeight = pMode->VDisplay;
+ currentMode->pixmapWidth = currentMode->imageWidth;
+ currentMode->pixmapHeight = currentMode->imageHeight;
+ currentMode->maxViewportX = currentMode->imageWidth -
+ currentMode->viewportWidth;
+ /* this might need to get clamped to some maximum */
+ currentMode->maxViewportY = (currentMode->imageHeight -
+ currentMode->viewportHeight);
+ oneMore = FALSE;
+ goto SECOND_PASS;
+ } else {
+ currentMode->bytesPerScanline = ((otherPitch * Bpp) + 3) & ~3L;
+ currentMode->imageWidth = otherPitch;
+ currentMode->imageHeight = pMode->VDisplay;
+ currentMode->pixmapWidth = currentMode->imageWidth;
+ currentMode->pixmapHeight = currentMode->imageHeight;
+ currentMode->maxViewportX = (currentMode->imageWidth -
+ currentMode->viewportWidth);
+ /* this might need to get clamped to some maximum */
+ currentMode->maxViewportY = (currentMode->imageHeight -
+ currentMode->viewportHeight);
+ }
+
+ pMode = pMode->next;
+ if (pMode == firstMode)
+ break;
+ }
+
+ return modes;
+}
+
+Bool RADEONDGAInit(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ DGAModePtr modes = NULL;
+ int num = 0;
+
+ /* 8 */
+ modes = RADEONSetupDGAMode(pScrn, modes, &num, 8, 8,
+ (pScrn->bitsPerPixel == 8),
+ ((pScrn->bitsPerPixel != 8)
+ ? 0 : pScrn->displayWidth),
+ 0, 0, 0, PseudoColor);
+
+ /* 15 */
+ modes = RADEONSetupDGAMode(pScrn, modes, &num, 16, 15,
+ (pScrn->bitsPerPixel == 16),
+ ((pScrn->depth != 15)
+ ? 0 : pScrn->displayWidth),
+ 0x7c00, 0x03e0, 0x001f, TrueColor);
+
+ modes = RADEONSetupDGAMode(pScrn, modes, &num, 16, 15,
+ (pScrn->bitsPerPixel == 16),
+ ((pScrn->depth != 15)
+ ? 0 : pScrn->displayWidth),
+ 0x7c00, 0x03e0, 0x001f, DirectColor);
+
+ /* 16 */
+ modes = RADEONSetupDGAMode(pScrn, modes, &num, 16, 16,
+ (pScrn->bitsPerPixel == 16),
+ ((pScrn->depth != 16)
+ ? 0 : pScrn->displayWidth),
+ 0xf800, 0x07e0, 0x001f, TrueColor);
+
+ modes = RADEONSetupDGAMode(pScrn, modes, &num, 16, 16,
+ (pScrn->bitsPerPixel == 16),
+ ((pScrn->depth != 16)
+ ? 0 : pScrn->displayWidth),
+ 0xf800, 0x07e0, 0x001f, DirectColor);
+
+ /* 24 */
+ modes = RADEONSetupDGAMode(pScrn, modes, &num, 24, 24,
+ (pScrn->bitsPerPixel == 24),
+ ((pScrn->bitsPerPixel != 24)
+ ? 0 : pScrn->displayWidth),
+ 0xff0000, 0x00ff00, 0x0000ff, TrueColor);
+
+ modes = RADEONSetupDGAMode(pScrn, modes, &num, 24, 24,
+ (pScrn->bitsPerPixel == 24),
+ ((pScrn->bitsPerPixel != 24)
+ ? 0 : pScrn->displayWidth),
+ 0xff0000, 0x00ff00, 0x0000ff, DirectColor);
+
+ /* 32 */
+ modes = RADEONSetupDGAMode(pScrn, modes, &num, 32, 24,
+ (pScrn->bitsPerPixel == 32),
+ ((pScrn->bitsPerPixel != 32)
+ ? 0 : pScrn->displayWidth),
+ 0xff0000, 0x00ff00, 0x0000ff, TrueColor);
+
+ modes = RADEONSetupDGAMode(pScrn, modes, &num, 32, 24,
+ (pScrn->bitsPerPixel == 32),
+ ((pScrn->bitsPerPixel != 32)
+ ? 0 : pScrn->displayWidth),
+ 0xff0000, 0x00ff00, 0x0000ff, DirectColor);
+
+ info->numDGAModes = num;
+ info->DGAModes = modes;
+
+ return DGAInit(pScreen, &RADEON_DGAFuncs, modes, num);
+}
+
+static Bool RADEON_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode)
+{
+ static RADEONFBLayout SavedLayouts[MAXSCREENS];
+ int index = pScrn->pScreen->myNum;
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+ if (!pMode) { /* restore the original mode */
+ /* put the ScreenParameters back */
+ if (info->DGAactive)
+ memcpy(&info->CurrentLayout, &SavedLayouts[index],
+ sizeof(RADEONFBLayout));
+
+ pScrn->currentMode = info->CurrentLayout.mode;
+
+ RADEONSwitchMode(index, pScrn->currentMode, 0);
+ RADEONAdjustFrame(index, 0, 0, 0);
+ info->DGAactive = FALSE;
+ } else {
+ if (!info->DGAactive) { /* save the old parameters */
+ memcpy(&SavedLayouts[index], &info->CurrentLayout,
+ sizeof(RADEONFBLayout));
+ info->DGAactive = TRUE;
+ }
+
+ info->CurrentLayout.bitsPerPixel = pMode->bitsPerPixel;
+ info->CurrentLayout.depth = pMode->depth;
+ info->CurrentLayout.displayWidth = (pMode->bytesPerScanline /
+ (pMode->bitsPerPixel >> 3));
+ info->CurrentLayout.pixel_bytes = pMode->bitsPerPixel / 8;
+ info->CurrentLayout.pixel_code = (pMode->bitsPerPixel != 16
+ ? pMode->bitsPerPixel
+ : pMode->depth);
+ /* RADEONModeInit() will set the mode field */
+
+ RADEONSwitchMode(index, pMode->mode, 0);
+ }
+
+ return TRUE;
+}
+
+static int RADEON_GetViewport(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+ return info->DGAViewportStatus;
+}
+
+static void RADEON_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+ RADEONAdjustFrame(pScrn->pScreen->myNum, x, y, flags);
+ info->DGAViewportStatus = 0; /* FIXME */
+}
+
+static void RADEON_FillRect(ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned long color)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+ if (info->accel) {
+ (*info->accel->SetupForSolidFill)(pScrn, color, GXcopy, ~0);
+ (*info->accel->SubsequentSolidFillRect)(pScrn, x, y, w, h);
+ SET_SYNC_FLAG(info->accel);
+ }
+}
+
+static void RADEON_BlitRect(ScrnInfoPtr pScrn,
+ int srcx, int srcy, int w, int h,
+ int dstx, int dsty)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+ if (info->accel) {
+ int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1;
+ int ydir = (srcy < dsty) ? -1 : 1;
+
+ (*info->accel->SetupForScreenToScreenCopy)(pScrn, xdir, ydir,
+ GXcopy, ~0, -1);
+ (*info->accel->SubsequentScreenToScreenCopy)(pScrn, srcx, srcy,
+ dstx, dsty, w, h);
+ SET_SYNC_FLAG(info->accel);
+ }
+}
+
+#if 0
+static void RADEON_BlitTransRect(ScrnInfoPtr pScrn,
+ int srcx, int srcy, int w, int h,
+ int dstx, int dsty, unsigned long color)
+{
+ /* this one should be separate since the XAA function would prohibit
+ usage of ~0 as the key */
+}
+#endif
+
+static Bool RADEON_OpenFramebuffer(ScrnInfoPtr pScrn,
+ char **name,
+ unsigned char **mem,
+ int *size, int *offset, int *flags)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+ *name = NULL; /* no special device */
+ *mem = (unsigned char*)info->LinearAddr;
+ *size = info->FbMapSize;
+ *offset = 0;
+ *flags = 0; /* DGA_NEED_ROOT; -- don't need root, just /dev/mem access */
+
+ return TRUE;
+}
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_driver.c
new file mode 100644
index 000000000..9b510272d
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_driver.c
@@ -0,0 +1,2921 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_driver.c,v 1.2 2000/10/19 10:06:25 alanh Exp $ */
+/**************************************************************************
+
+Copyright 2000 ATI Technologies Inc. and VA Linux Systems, Inc.,
+ Sunnyvale, California.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+on the rights to use, copy, modify, merge, publish, distribute, sub
+license, and/or sell copies of the Software, and to permit persons to whom
+the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <martin@valinux.com>
+ * Rickard E. Faith <faith@valinux.com>
+ *
+ * Credits:
+ *
+ * Thanks to Ani Joshi <ajoshi@shell.unixbox.com> for providing source
+ * code to his Radeon driver. Portions of this file are based on the
+ * initialization code for that driver.
+ *
+ * References:
+ *
+ * !!!! FIXME !!!!
+ * RAGE 128 VR/ RAGE 128 GL Register Reference Manual (Technical
+ * Reference Manual P/N RRG-G04100-C Rev. 0.04), ATI Technologies: April
+ * 1999.
+ *
+ * RAGE 128 Software Development Manual (Technical Reference Manual P/N
+ * SDK-G04000 Rev. 0.01), ATI Technologies: June 1999.
+ *
+ * This server does not yet support these XFree86 4.0 features:
+ * !!!! FIXME !!!!
+ * DDC1 & DDC2
+ * shadowfb
+ * overlay planes
+ *
+ */
+
+
+ /* X and server generic header files */
+#include "xf86.h"
+#include "xf86_ansic.h"
+#include "xf86_OSproc.h"
+#include "xf86Resources.h"
+#include "xf86RAC.h"
+#include "xf86cmap.h"
+#include "xf86fbman.h"
+#include "xf86int10.h"
+ /* Backing store, software cursor, and
+ colormap initialization */
+#include "mibstore.h"
+#include "mipointer.h"
+#include "micmap.h"
+
+#define USE_FB /* not until overlays */
+#ifdef USE_FB
+#include "fb.h"
+#else
+ /* CFB support */
+#define PSZ 8
+#include "cfb.h"
+#undef PSZ
+#include "cfb16.h"
+#include "cfb24.h"
+#include "cfb32.h"
+#include "cfb24_32.h"
+#endif
+
+ /* Driver data structures */
+#include "ati2.h"
+#include "radeon.h"
+#include "radeon_probe.h"
+#include "radeon_reg.h"
+
+#ifndef MAX
+#define MAX(a,b) ((a)>(b)?(a):(b))
+#endif
+
+
+ /* Forward definitions for driver functions */
+static Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags);
+static Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen,
+ int argc, char **argv);
+
+static int RADEONValidMode(int scrnIndex, DisplayModePtr mode,
+ Bool verbose, int flag);
+static Bool RADEONEnterVT(int scrnIndex, int flags);
+static void RADEONLeaveVT(int scrnIndex, int flags);
+static Bool RADEONCloseScreen(int scrnIndex, ScreenPtr pScreen);
+static void RADEONFreeScreen(int scrnIndex, int flags);
+static Bool RADEONSaveScreen(ScreenPtr pScreen, int mode);
+static void RADEONSave(ScrnInfoPtr pScrn);
+static void RADEONRestore(ScrnInfoPtr pScrn);
+static Bool RADEONModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode);
+static void RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn,
+ int PowerManagementMode,
+ int flags);
+static Bool RADEONEnterVTFBDev(int scrnIndex, int flags);
+static void RADEONLeaveVTFBDev(int scrnIndex, int flags);
+
+ /* Chipsets */
+static SymTabRec RADEONChipsets[] = {
+ { PCI_CHIP_RADEON_QD, "ATI Radeon QD (AGP)" },
+ { PCI_CHIP_RADEON_QE, "ATI Radeon QE (AGP)" },
+ { PCI_CHIP_RADEON_QF, "ATI Radeon QF (AGP)" },
+ { PCI_CHIP_RADEON_QG, "ATI Radeon QG (AGP)" },
+ { -1, NULL }
+};
+
+static PciChipsets RADEONPciChipsets[] = {
+ { PCI_CHIP_RADEON_QD, PCI_CHIP_RADEON_QD, RES_SHARED_VGA },
+ { PCI_CHIP_RADEON_QE, PCI_CHIP_RADEON_QE, RES_SHARED_VGA },
+ { PCI_CHIP_RADEON_QF, PCI_CHIP_RADEON_QF, RES_SHARED_VGA },
+ { PCI_CHIP_RADEON_QG, PCI_CHIP_RADEON_QG, RES_SHARED_VGA },
+ { -1, -1, RES_UNDEFINED }
+};
+
+typedef enum {
+ OPTION_NOACCEL,
+ OPTION_SW_CURSOR,
+ OPTION_DAC_6BIT,
+ OPTION_DAC_8BIT,
+#ifdef XF86DRI
+ OPTION_IS_PCI,
+ OPTION_CP_PIO,
+ OPTION_NO_SECURITY,
+ OPTION_USEC_TIMEOUT,
+ OPTION_AGP_MODE,
+ OPTION_AGP_SIZE,
+ OPTION_RING_SIZE,
+ OPTION_VERT_SIZE,
+ OPTION_VBUF_SIZE,
+ OPTION_USE_CP_2D,
+#endif
+#ifdef ENABLE_FLAT_PANEL
+ /* Note: Radeon flat panel support has been disabled for now */
+#if 0
+ /* FIXME: Disable CRTOnly until it is tested */
+ OPTION_CRT,
+#endif
+ OPTION_PANEL_WIDTH,
+ OPTION_PANEL_HEIGHT,
+#endif
+ OPTION_FBDEV
+} RADEONOpts;
+
+static OptionInfoRec RADEONOptions[] = {
+ { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_DAC_6BIT, "Dac6Bit", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_DAC_8BIT, "Dac8Bit", OPTV_BOOLEAN, {0}, TRUE },
+#ifdef XF86DRI
+ { OPTION_IS_PCI, "ForcePCIMode", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_CP_PIO, "CPPIOMode", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_NO_SECURITY, "CPNoSecurity", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_USEC_TIMEOUT, "CPusecTimeout", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_AGP_MODE, "AGPMode", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_AGP_SIZE, "AGPSize", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_RING_SIZE, "RingSize", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_VERT_SIZE, "VBListSize", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_VBUF_SIZE, "VBSize", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_USE_CP_2D, "UseCPfor2D", OPTV_BOOLEAN, {0}, FALSE },
+#endif
+#ifdef ENABLE_FLAT_PANEL
+ /* Note: Radeon flat panel support has been disabled for now */
+#if 0
+ /* FIXME: Disable CRTOnly until it is tested */
+ { OPTION_CRT, "CRTOnly", OPTV_BOOLEAN, {0}, FALSE },
+#endif
+ { OPTION_PANEL_WIDTH, "PanelWidth", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_PANEL_HEIGHT, "PanelHeight", OPTV_INTEGER, {0}, FALSE },
+#endif
+ { OPTION_FBDEV, "UseFBDev", OPTV_BOOLEAN, {0}, FALSE },
+ { -1, NULL, OPTV_NONE, {0}, FALSE }
+};
+
+RADEONRAMRec RADEONRAM[] = { /* Memory Specifications
+ From Radeon Manual */
+ { 4, 4, 1, 2, 1, 2, 1, 16, 12, "64-bit SDR SDRAM" },
+ { 4, 4, 3, 3, 2, 3, 1, 16, 12, "64-bit DDR SDRAM" },
+};
+
+extern const char *vgahwSymbols[];
+extern const char *fbdevHWSymbols[];
+extern const char *ddcSymbols[];
+
+/* Allocate our private RADEONInfoRec. */
+static Bool RADEONGetRec(ScrnInfoPtr pScrn)
+{
+ if (pScrn->driverPrivate) return TRUE;
+
+ pScrn->driverPrivate = xnfcalloc(sizeof(RADEONInfoRec), 1);
+ return TRUE;
+}
+
+/* Free our private RADEONInfoRec. */
+static void RADEONFreeRec(ScrnInfoPtr pScrn)
+{
+ if (!pScrn || !pScrn->driverPrivate) return;
+ xfree(pScrn->driverPrivate);
+ pScrn->driverPrivate = NULL;
+}
+
+/* Memory map the MMIO region. Used during pre-init and by RADEONMapMem,
+ below. */
+static Bool RADEONMapMMIO(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+ if (info->FBDev) {
+ info->MMIO = fbdevHWMapMMIO(pScrn);
+ } else {
+ info->MMIO = xf86MapPciMem(pScrn->scrnIndex,
+ VIDMEM_MMIO | VIDMEM_READSIDEEFFECT,
+ info->PciTag,
+ info->MMIOAddr,
+ RADEON_MMIOSIZE);
+ }
+
+ if (!info->MMIO) return FALSE;
+ return TRUE;
+}
+
+/* Unmap the MMIO region. Used during pre-init and by RADEONUnmapMem,
+ below. */
+static Bool RADEONUnmapMMIO(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+ if (info->FBDev)
+ fbdevHWUnmapMMIO(pScrn);
+ else {
+ xf86UnMapVidMem(pScrn->scrnIndex, info->MMIO, RADEON_MMIOSIZE);
+ }
+ info->MMIO = NULL;
+ return TRUE;
+}
+
+/* Memory map the frame buffer. Used by RADEONMapMem, below. */
+static Bool RADEONMapFB(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+ if (info->FBDev) {
+ info->FB = fbdevHWMapVidmem(pScrn);
+ } else {
+ info->FB = xf86MapPciMem(pScrn->scrnIndex,
+ VIDMEM_FRAMEBUFFER,
+ info->PciTag,
+ info->LinearAddr,
+ info->FbMapSize);
+ }
+
+ if (!info->FB) return FALSE;
+ return TRUE;
+}
+
+/* Unmap the frame buffer. Used by RADEONUnmapMem, below. */
+static Bool RADEONUnmapFB(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+ if (info->FBDev)
+ fbdevHWUnmapVidmem(pScrn);
+ else
+ xf86UnMapVidMem(pScrn->scrnIndex, info->FB, info->FbMapSize);
+ info->FB = NULL;
+ return TRUE;
+}
+
+/* Memory map the MMIO region and the frame buffer. */
+static Bool RADEONMapMem(ScrnInfoPtr pScrn)
+{
+ if (!RADEONMapMMIO(pScrn)) return FALSE;
+ if (!RADEONMapFB(pScrn)) {
+ RADEONUnmapMMIO(pScrn);
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/* Unmap the MMIO region and the frame buffer. */
+static Bool RADEONUnmapMem(ScrnInfoPtr pScrn)
+{
+ if (!RADEONUnmapMMIO(pScrn) || !RADEONUnmapFB(pScrn)) return FALSE;
+ return TRUE;
+}
+
+/* Read PLL information */
+int RADEONINPLL(ScrnInfoPtr pScrn, int addr)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+#if !RADEON_ATOMIC_UPDATE
+ while ( (INREG8(RADEON_CLOCK_CNTL_INDEX) & 0x9f) != addr) {
+#endif
+ OUTREG8(RADEON_CLOCK_CNTL_INDEX, addr & 0x1f);
+#if !RADEON_ATOMIC_UPDATE
+ }
+#endif
+ return INREG(RADEON_CLOCK_CNTL_DATA);
+}
+
+#if 0
+/* Read PAL information (only used for debugging). */
+static int RADEONINPAL(int idx)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ OUTREG(RADEON_PALETTE_INDEX, idx << 16);
+ return INREG(RADEON_PALETTE_DATA);
+}
+#endif
+
+/* Wait for vertical sync. */
+void RADEONWaitForVerticalSync(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+ int i;
+
+ OUTREG(RADEON_GEN_INT_STATUS, RADEON_VSYNC_INT_AK);
+ for (i = 0; i < RADEON_TIMEOUT; i++) {
+ if (INREG(RADEON_GEN_INT_STATUS) & RADEON_VSYNC_INT) break;
+ }
+}
+
+/* Blank screen. */
+static void RADEONBlank(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ OUTREGP(RADEON_CRTC_EXT_CNTL,
+ RADEON_CRTC_DISPLAY_DIS |
+ RADEON_CRTC_VSYNC_DIS |
+ RADEON_CRTC_HSYNC_DIS,
+ ~(RADEON_CRTC_DISPLAY_DIS |
+ RADEON_CRTC_VSYNC_DIS |
+ RADEON_CRTC_HSYNC_DIS));
+}
+
+/* Unblank screen. */
+static void RADEONUnblank(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ OUTREGP(RADEON_CRTC_EXT_CNTL, 0,
+ ~(RADEON_CRTC_DISPLAY_DIS |
+ RADEON_CRTC_VSYNC_DIS |
+ RADEON_CRTC_HSYNC_DIS));
+}
+
+/* Compute log base 2 of val. */
+int RADEONMinBits(int val)
+{
+ int bits;
+
+ if (!val) return 1;
+ for (bits = 0; val; val >>= 1, ++bits);
+ return bits;
+}
+
+/* Compute n/d with rounding. */
+static int RADEONDiv(int n, int d)
+{
+ return (n + (d / 2)) / d;
+}
+
+/* Read the Video BIOS block and the FP registers (if applicable). */
+static Bool RADEONGetBIOSParameters(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+#ifdef ENABLE_FLAT_PANEL
+ int i;
+ int FPHeader = 0;
+#endif
+
+#define RADEONReadBIOS(offset, buffer, length) \
+ (info->BIOSFromPCI ? \
+ xf86ReadPciBIOS(offset, info->PciTag, 0, buffer, length) : \
+ xf86ReadBIOS(info->BIOSAddr, offset, buffer, length))
+
+#define RADEON_BIOS8(v) (*((CARD8 *)(info->VBIOS + (v))))
+#define RADEON_BIOS16(v) (*((CARD16 *)(info->VBIOS + (v))))
+#define RADEON_BIOS32(v) (*((CARD32 *)(info->VBIOS + (v))))
+
+ if (!(info->VBIOS = xalloc(RADEON_VBIOS_SIZE))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Cannot allocate space for hold Video BIOS!\n");
+ return FALSE;
+ }
+
+ info->BIOSFromPCI = TRUE;
+ RADEONReadBIOS(0x0000, info->VBIOS, RADEON_VBIOS_SIZE);
+ if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Video BIOS not detected in PCI space!\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Attempting to read Video BIOS from legacy ISA space!\n");
+ info->BIOSFromPCI = FALSE;
+ info->BIOSAddr = 0x000c0000;
+ RADEONReadBIOS(0x0000, info->VBIOS, RADEON_VBIOS_SIZE);
+ }
+ if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) {
+ info->BIOSAddr = 0x00000000;
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Video BIOS not found!\n");
+ }
+
+#ifdef ENABLE_FLAT_PANEL
+ /* Note: Radeon flat panel support has been disabled for now */
+ if (info->HasPanelRegs) {
+ info->FPBIOSstart = 0;
+
+ /* FIXME: There should be direct access to the start of the FP info
+ tables, but until we find out where that offset is stored, we
+ must search for the ATI signature string: "M3 ". */
+ for (i = 4; i < RADEON_VBIOS_SIZE-8; i++) {
+ if (RADEON_BIOS8(i) == 'M' &&
+ RADEON_BIOS8(i+1) == '3' &&
+ RADEON_BIOS8(i+2) == ' ' &&
+ RADEON_BIOS8(i+3) == ' ' &&
+ RADEON_BIOS8(i+4) == ' ' &&
+ RADEON_BIOS8(i+5) == ' ' &&
+ RADEON_BIOS8(i+6) == ' ' &&
+ RADEON_BIOS8(i+7) == ' ') {
+ FPHeader = i-2;
+ break;
+ }
+ }
+
+ if (!FPHeader) return TRUE;
+
+ /* Assume that only one panel is attached and supported */
+ for (i = FPHeader+20; i < FPHeader+84; i += 2) {
+ if (RADEON_BIOS16(i) != 0) {
+ info->FPBIOSstart = RADEON_BIOS16(i);
+ break;
+ }
+ }
+ if (!info->FPBIOSstart) return TRUE;
+
+ if (!info->PanelXRes)
+ info->PanelXRes = RADEON_BIOS16(info->FPBIOSstart+25);
+ if (!info->PanelYRes)
+ info->PanelYRes = RADEON_BIOS16(info->FPBIOSstart+27);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel size: %dx%d\n",
+ info->PanelXRes, info->PanelYRes);
+
+ info->PanelPwrDly = RADEON_BIOS8(info->FPBIOSstart+56);
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel ID: ");
+ for (i = 1; i <= 24; i++)
+ ErrorF("%c", RADEON_BIOS8(info->FPBIOSstart+i));
+ ErrorF("\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel Type: ");
+ i = RADEON_BIOS16(info->FPBIOSstart+29);
+ if (i & 1) ErrorF("Color, ");
+ else ErrorF("Monochrome, ");
+ if (i & 2) ErrorF("Dual(split), ");
+ else ErrorF("Single, ");
+ switch ((i >> 2) & 0x3f) {
+ case 0: ErrorF("STN"); break;
+ case 1: ErrorF("TFT"); break;
+ case 2: ErrorF("Active STN"); break;
+ case 3: ErrorF("EL"); break;
+ case 4: ErrorF("Plasma"); break;
+ default: ErrorF("UNKNOWN"); break;
+ }
+ ErrorF("\n");
+ if (RADEON_BIOS8(info->FPBIOSstart+61) & 1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Panel Interface: LVDS\n");
+ } else {
+ /* FIXME: Add Non-LVDS flat pael support */
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Non-LVDS panel interface detected! "
+ "This support is untested and may not "
+ "function properly\n");
+ }
+ }
+#endif
+
+ return TRUE;
+}
+
+/* Read PLL parameters from BIOS block. Default to typical values if there
+ is no BIOS. */
+static Bool RADEONGetPLLParameters(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ RADEONPLLPtr pll = &info->pll;
+ CARD16 bios_header;
+ CARD16 pll_info_block;
+
+ if (!info->VBIOS) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Video BIOS not detected, using default PLL parameters!\n");
+ /* These probably aren't going to work for
+ the card you are using. Specifically,
+ reference freq can be 29.50MHz,
+ 28.63MHz, or 14.32MHz. YMMV. */
+ pll->reference_freq = 2950;
+ pll->reference_div = 65;
+ pll->min_pll_freq = 12500;
+ pll->max_pll_freq = 35000;
+ pll->xclk = 10300;
+ } else {
+ bios_header = RADEON_BIOS16(0x48);
+ pll_info_block = RADEON_BIOS16(bios_header + 0x30);
+ RADEONTRACE(("Header at 0x%04x; PLL Information at 0x%04x\n",
+ bios_header, pll_info_block));
+
+ pll->reference_freq = RADEON_BIOS16(pll_info_block + 0x0e);
+ pll->reference_div = RADEON_BIOS16(pll_info_block + 0x10);
+ pll->min_pll_freq = RADEON_BIOS32(pll_info_block + 0x12);
+ pll->max_pll_freq = RADEON_BIOS32(pll_info_block + 0x16);
+ pll->xclk = RADEON_BIOS16(pll_info_block + 0x08);
+ }
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "PLL parameters: rf=%d rd=%d min=%d max=%d; xclk=%d\n",
+ pll->reference_freq,
+ pll->reference_div,
+ pll->min_pll_freq,
+ pll->max_pll_freq,
+ pll->xclk);
+
+ return TRUE;
+}
+
+/* Return the options for supported chipset 'n'; NULL otherwise. */
+OptionInfoPtr RADEONAvailableOptions(int chipid, int busid)
+{
+ int i;
+
+ /* Check to make sure that chip 'chipid' is supported by the Radeon
+ driver */
+ for (i = 0; RADEONPciChipsets[i].PCIid > 0; i++) {
+ if (chipid == RADEONPciChipsets[i].PCIid)
+ return RADEONOptions;
+ }
+ return NULL;
+}
+
+/* Return the string name for supported chipset 'n'; NULL otherwise. */
+void RADEONIdentify(int flags)
+{
+ xf86PrintChipsets(RADEON_NAME,
+ "Driver for ATI Radeon chipset",
+ RADEONChipsets);
+}
+
+/* Return TRUE if chipset is present; FALSE otherwise. */
+Bool RADEONProbe(DriverPtr drv, int flags)
+{
+ int numUsed;
+ int numDevSections;
+ int *usedChips;
+ GDevPtr *devSections;
+ EntityInfoPtr pEnt;
+ Bool foundScreen = FALSE;
+ int i;
+
+ /* Check to make sure that the RADEON_NAME or the ATI2_NAME is listed
+ as the Driver in the "Device" section of the XF86Config file */
+ if ((numDevSections = xf86MatchDevice(RADEON_NAME, &devSections)) <= 0)
+ if ((numDevSections = xf86MatchDevice(ATI2_NAME, &devSections)) <= 0)
+ return FALSE;
+
+ if (!xf86GetPciVideoInfo()) return FALSE;
+
+ numUsed = xf86MatchPciInstances(RADEON_NAME,
+ PCI_VENDOR_ATI,
+ RADEONChipsets,
+ RADEONPciChipsets,
+ devSections,
+ numDevSections,
+ drv,
+ &usedChips);
+
+ if (numUsed<=0) return FALSE;
+
+ if (flags & PROBE_DETECT)
+ foundScreen = TRUE;
+ else for (i = 0; i < numUsed; i++) {
+ pEnt = xf86GetEntityInfo(usedChips[i]);
+
+ if (pEnt->active) {
+ ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0);
+
+ pScrn->driverVersion = ATI2_VERSION;
+ pScrn->driverName = RADEON_NAME;
+ pScrn->name = RADEON_NAME;
+ pScrn->Probe = RADEONProbe;
+ pScrn->PreInit = RADEONPreInit;
+ pScrn->ScreenInit = RADEONScreenInit;
+ pScrn->SwitchMode = RADEONSwitchMode;
+ pScrn->AdjustFrame = RADEONAdjustFrame;
+ pScrn->EnterVT = RADEONEnterVT;
+ pScrn->LeaveVT = RADEONLeaveVT;
+ pScrn->FreeScreen = RADEONFreeScreen;
+ pScrn->ValidMode = RADEONValidMode;
+
+ foundScreen = TRUE;
+
+ xf86ConfigActivePciEntity(pScrn, usedChips[i], RADEONPciChipsets,
+ 0, 0, 0, 0, 0);
+ }
+ xfree(pEnt);
+ }
+
+ if (numUsed) xfree(usedChips);
+ xfree(devSections);
+
+ return foundScreen;
+}
+
+/* This is called by RADEONPreInit to set up the default visual. */
+static Bool RADEONPreInitVisual(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+ if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support32bppFb))
+ return FALSE;
+
+ switch (pScrn->depth) {
+ case 8:
+ case 15:
+ case 16:
+ case 24:
+ break;
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Given depth (%d) is not supported by %s driver\n",
+ pScrn->depth, RADEON_NAME);
+ return FALSE;
+ }
+
+ xf86PrintDepthBpp(pScrn);
+
+ info->fifo_slots = 0;
+ info->pix24bpp = xf86GetBppFromDepth(pScrn, pScrn->depth);
+ info->CurrentLayout.bitsPerPixel = pScrn->bitsPerPixel;
+ info->CurrentLayout.depth = pScrn->depth;
+ info->CurrentLayout.pixel_bytes = pScrn->bitsPerPixel / 8;
+ info->CurrentLayout.pixel_code = (pScrn->bitsPerPixel != 16
+ ? pScrn->bitsPerPixel
+ : pScrn->depth);
+
+ if (info->pix24bpp == 24) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Radeon does NOT support 24bpp\n");
+ return FALSE;
+ }
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Pixel depth = %d bits stored in %d byte%s (%d bpp pixmaps)\n",
+ pScrn->depth,
+ info->CurrentLayout.pixel_bytes,
+ info->CurrentLayout.pixel_bytes > 1 ? "s" : "",
+ info->pix24bpp);
+
+
+ if (!xf86SetDefaultVisual(pScrn, -1)) return FALSE;
+
+ if (pScrn->depth > 8 && pScrn->defaultVisual != TrueColor) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Default visual (%s) is not supported at depth %d\n",
+ xf86GetVisualName(pScrn->defaultVisual), pScrn->depth);
+ return FALSE;
+ }
+ return TRUE;
+
+}
+
+/* This is called by RADEONPreInit to handle all color weight issues. */
+static Bool RADEONPreInitWeight(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+ /* Save flag for 6 bit DAC to use for
+ setting CRTC registers. Otherwise use
+ an 8 bit DAC, even if xf86SetWeight sets
+ pScrn->rgbBits to some value other than
+ 8. */
+ info->dac6bits = FALSE;
+ if (pScrn->depth > 8) {
+ rgb defaultWeight = { 0, 0, 0 };
+ if (!xf86SetWeight(pScrn, defaultWeight, defaultWeight)) return FALSE;
+ } else {
+ pScrn->rgbBits = 8;
+ if (xf86ReturnOptValBool(RADEONOptions, OPTION_DAC_6BIT, FALSE)) {
+ pScrn->rgbBits = 6;
+ info->dac6bits = TRUE;
+ }
+ }
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Using %d bits per RGB (%d bit DAC)\n",
+ pScrn->rgbBits, info->dac6bits ? 6 : 8);
+
+ return TRUE;
+
+}
+
+/* This is called by RADEONPreInit to handle config file overrides for things
+ like chipset and memory regions. Also determine memory size and type.
+ If memory type ever needs an override, put it in this routine. */
+static Bool RADEONPreInitConfig(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ EntityInfoPtr pEnt = info->pEnt;
+ GDevPtr dev = pEnt->device;
+ int offset = 0; /* RAM Type */
+ MessageType from;
+ unsigned char *RADEONMMIO;
+
+ /* Chipset */
+ from = X_PROBED;
+ if (dev->chipset && *dev->chipset) {
+ info->Chipset = xf86StringToToken(RADEONChipsets, dev->chipset);
+ from = X_CONFIG;
+ } else if (dev->chipID >= 0) {
+ info->Chipset = dev->chipID;
+ from = X_CONFIG;
+ } else {
+ info->Chipset = info->PciInfo->chipType;
+ }
+ pScrn->chipset = (char *)xf86TokenToString(RADEONChipsets, info->Chipset);
+
+ if (!pScrn->chipset) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "ChipID 0x%04x is not recognized\n", info->Chipset);
+ return FALSE;
+ }
+
+ if (info->Chipset < 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Chipset \"%s\" is not recognized\n", pScrn->chipset);
+ return FALSE;
+ }
+
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "Chipset: \"%s\" (ChipID = 0x%04x)\n",
+ pScrn->chipset,
+ info->Chipset);
+
+ /* Framebuffer */
+
+ from = X_PROBED;
+ info->LinearAddr = info->PciInfo->memBase[0] & 0xfc000000;
+ if (dev->MemBase) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Linear address override, using 0x%08x instead of 0x%08x\n",
+ dev->MemBase,
+ info->LinearAddr);
+ info->LinearAddr = dev->MemBase;
+ from = X_CONFIG;
+ } else if (!info->LinearAddr) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "No valid linear framebuffer address\n");
+ return FALSE;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "Linear framebuffer at 0x%08lx\n", info->LinearAddr);
+
+ /* MMIO registers */
+ from = X_PROBED;
+ info->MMIOAddr = info->PciInfo->memBase[2] & 0xffffff00;
+ if (dev->IOBase) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "MMIO address override, using 0x%08x instead of 0x%08x\n",
+ dev->IOBase,
+ info->MMIOAddr);
+ info->MMIOAddr = dev->IOBase;
+ from = X_CONFIG;
+ } else if (!info->MMIOAddr) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid MMIO address\n");
+ return FALSE;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "MMIO registers at 0x%08lx\n", info->MMIOAddr);
+
+ /* BIOS */
+ from = X_PROBED;
+ info->BIOSAddr = info->PciInfo->biosBase & 0xfffe0000;
+ if (dev->BiosBase) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "BIOS address override, using 0x%08x instead of 0x%08x\n",
+ dev->BiosBase,
+ info->BIOSAddr);
+ info->BIOSAddr = dev->BiosBase;
+ from = X_CONFIG;
+ }
+ if (info->BIOSAddr) {
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "BIOS at 0x%08lx\n", info->BIOSAddr);
+ }
+
+#ifdef ENABLE_FLAT_PANEL
+ /* Note: Radeon flat panel support has been disabled for now */
+ /* Flat panel (part 1) */
+ /* FIXME: Make this an option */
+ switch (info->Chipset) {
+#if 0
+ case PCI_CHIP_RADEON_XX: info->HasPanelRegs = TRUE; break;
+#endif
+ case PCI_CHIP_RADEON_QD:
+ case PCI_CHIP_RADEON_QE:
+ case PCI_CHIP_RADEON_QF:
+ case PCI_CHIP_RADEON_QG:
+ default: info->HasPanelRegs = FALSE; break;
+ }
+#endif
+
+ /* Read registers used to determine options */
+ from = X_PROBED;
+ RADEONMapMMIO(pScrn);
+ RADEONMMIO = info->MMIO;
+ if (info->FBDev)
+ pScrn->videoRam = fbdevHWGetVidmem(pScrn) / 1024;
+ else
+ pScrn->videoRam = INREG(RADEON_CONFIG_MEMSIZE) / 1024;
+ info->MemCntl = INREG(RADEON_SDRAM_MODE_REG);
+ info->BusCntl = INREG(RADEON_BUS_CNTL);
+ RADEONMMIO = NULL;
+ RADEONUnmapMMIO(pScrn);
+
+ /* RAM */
+ switch (info->MemCntl >> 30) {
+ case 0: offset = 0; break; /* 64-bit SDR SDRAM */
+ case 1: offset = 1; break; /* 64-bit DDR SDRAM */
+ default: offset = 0;
+ }
+ info->ram = &RADEONRAM[offset];
+
+ if (dev->videoRam) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Video RAM override, using %d kB instead of %d kB\n",
+ dev->videoRam,
+ pScrn->videoRam);
+ from = X_CONFIG;
+ pScrn->videoRam = dev->videoRam;
+ }
+ pScrn->videoRam &= ~1023;
+ info->FbMapSize = pScrn->videoRam * 1024;
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "VideoRAM: %d kByte (%s)\n", pScrn->videoRam, info->ram->name);
+
+#ifdef ENABLE_FLAT_PANEL
+ /* Note: Radeon flat panel support has been disabled for now */
+ /* Flat panel (part 2) */
+ if (info->HasPanelRegs) {
+#if 1
+ info->CRTOnly = FALSE;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Using flat panel for display\n");
+#else
+ /* Panel CRT mode override */
+ if ((info->CRTOnly = xf86ReturnOptValBool(RADEONOptions,
+ OPTION_CRT, FALSE))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Using external CRT instead of "
+ "flat panel for display\n");
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Using flat panel for display\n");
+ }
+#endif
+
+ /* Panel width/height overrides */
+ info->PanelXRes = 0;
+ info->PanelYRes = 0;
+ if (xf86GetOptValInteger(RADEONOptions,
+ OPTION_PANEL_WIDTH, &(info->PanelXRes))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Flat panel width: %d\n", info->PanelXRes);
+ }
+ if (xf86GetOptValInteger(RADEONOptions,
+ OPTION_PANEL_HEIGHT, &(info->PanelYRes))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Flat panel height: %d\n", info->PanelYRes);
+ }
+ } else {
+ info->CRTOnly = FALSE;
+ }
+#endif
+
+#ifdef XF86DRI
+ /* AGP/PCI */
+ if (xf86ReturnOptValBool(RADEONOptions, OPTION_IS_PCI, FALSE)) {
+ info->IsPCI = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Forced into PCI-only mode\n");
+ } else {
+ switch (info->Chipset) {
+#if 0
+ case PCI_CHIP_RADEON_XX: info->IsPCI = TRUE; break;
+#endif
+ case PCI_CHIP_RADEON_QD:
+ case PCI_CHIP_RADEON_QE:
+ case PCI_CHIP_RADEON_QF:
+ case PCI_CHIP_RADEON_QG:
+ default: info->IsPCI = FALSE; break;
+ }
+ }
+#endif
+
+ return TRUE;
+}
+
+static Bool RADEONPreInitDDC(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ vbeInfoPtr pVbe;
+
+ if (!xf86LoadSubModule(pScrn, "ddc")) return FALSE;
+ xf86LoaderReqSymLists(ddcSymbols, NULL);
+ if (xf86LoadSubModule(pScrn, "vbe")) {
+ pVbe = VBEInit(NULL,info->pEnt->index);
+ if (!pVbe) return FALSE;
+
+ xf86SetDDCproperties(pScrn,xf86PrintEDID(vbeDoEDID(pVbe,NULL)));
+ return TRUE;
+ } else
+ return FALSE;
+}
+
+/* This is called by RADEONPreInit to initialize gamma correction. */
+static Bool RADEONPreInitGamma(ScrnInfoPtr pScrn)
+{
+ Gamma zeros = { 0.0, 0.0, 0.0 };
+
+ if (!xf86SetGamma(pScrn, zeros)) return FALSE;
+ return TRUE;
+}
+
+/* This is called by RADEONPreInit to validate modes and compute parameters
+ for all of the valid modes. */
+static Bool RADEONPreInitModes(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ ClockRangePtr clockRanges;
+ int modesFound;
+ char *mod = NULL;
+ const char *Sym = NULL;
+
+ /* Get mode information */
+ pScrn->progClock = TRUE;
+ clockRanges = xnfcalloc(sizeof(*clockRanges), 1);
+ clockRanges->next = NULL;
+ clockRanges->minClock = info->pll.min_pll_freq;
+ clockRanges->maxClock = info->pll.max_pll_freq * 10;
+ clockRanges->clockIndex = -1;
+#ifdef ENABLE_FLAT_PANEL
+ /* Note: Radeon flat panel support has been disabled for now */
+ if (info->HasPanelRegs) {
+ clockRanges->interlaceAllowed = FALSE;
+ clockRanges->doubleScanAllowed = FALSE;
+ } else {
+ clockRanges->interlaceAllowed = TRUE;
+ clockRanges->doubleScanAllowed = TRUE;
+ }
+#else
+ clockRanges->interlaceAllowed = TRUE;
+ clockRanges->doubleScanAllowed = TRUE;
+#endif
+
+ modesFound = xf86ValidateModes(pScrn,
+ pScrn->monitor->Modes,
+ pScrn->display->modes,
+ clockRanges,
+ NULL, /* linePitches */
+ 8 * 64, /* minPitch */
+ 8 * 1024, /* maxPitch */
+ 64 * pScrn->bitsPerPixel, /* pitchInc */
+ 128, /* minHeight */
+ 2048, /* maxHeight */
+ pScrn->virtualX,
+ pScrn->virtualY,
+ info->FbMapSize,
+ LOOKUP_BEST_REFRESH);
+
+ if (modesFound < 1 && info->FBDev) {
+ fbdevHWUseBuildinMode(pScrn);
+ pScrn->displayWidth = pScrn->virtualX; /* FIXME: might be wrong */
+ modesFound = 1;
+ }
+
+ if (modesFound == -1) return FALSE;
+ xf86PruneDriverModes(pScrn);
+ if (!modesFound || !pScrn->modes) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n");
+ return FALSE;
+ }
+ xf86SetCrtcForModes(pScrn, 0);
+ pScrn->currentMode = pScrn->modes;
+ xf86PrintModes(pScrn);
+
+ /* Set DPI */
+ xf86SetDpi(pScrn, 0, 0);
+
+ /* Get ScreenInit function */
+#ifdef USE_FB
+ mod = "fb";
+ Sym = "fbScreenInit";
+#else
+ switch (pScrn->bitsPerPixel) {
+ case 8: mod = "cfb"; Sym = "cfbScreenInit"; break;
+ case 16: mod = "cfb16"; Sym = "cfb16ScreenInit"; break;
+ case 32: mod = "cfb32"; Sym = "cfb32ScreenInit"; break;
+ }
+#endif
+ if (mod && !xf86LoadSubModule(pScrn, mod)) return FALSE;
+ xf86LoaderReqSymbols(Sym, NULL);
+
+#ifdef USE_FB
+#ifdef RENDER
+ xf86LoaderReqSymbols("fbPictureInit", NULL);
+#endif
+#endif
+
+ info->CurrentLayout.displayWidth = pScrn->displayWidth;
+ info->CurrentLayout.mode = pScrn->currentMode;
+
+ return TRUE;
+}
+
+/* This is called by RADEONPreInit to initialize the hardware cursor. */
+static Bool RADEONPreInitCursor(ScrnInfoPtr pScrn)
+{
+ if (!xf86ReturnOptValBool(RADEONOptions, OPTION_SW_CURSOR, FALSE)) {
+ if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE;
+ }
+ return TRUE;
+}
+
+/* This is called by RADEONPreInit to initialize hardware acceleration. */
+static Bool RADEONPreInitAccel(ScrnInfoPtr pScrn)
+{
+ if (!xf86ReturnOptValBool(RADEONOptions, OPTION_NOACCEL, FALSE)) {
+ if (!xf86LoadSubModule(pScrn, "xaa")) return FALSE;
+ }
+ return TRUE;
+}
+
+static Bool RADEONPreInitInt10(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+#if 1
+ if (xf86LoadSubModule(pScrn, "int10")) {
+ xf86Int10InfoPtr pInt;
+ xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n");
+ pInt = xf86InitInt10(info->pEnt->index);
+ xf86FreeInt10(pInt);
+ }
+#endif
+ return TRUE;
+}
+
+#ifdef XF86DRI
+static Bool RADEONPreInitDRI(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+ if (info->IsPCI) {
+ info->CPMode = RADEON_DEFAULT_CP_PIO_MODE;
+ } else if (xf86ReturnOptValBool(RADEONOptions, OPTION_CP_PIO, FALSE)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Forcing CP into PIO mode\n");
+ info->CPMode = RADEON_DEFAULT_CP_PIO_MODE;
+ } else {
+ info->CPMode = RADEON_DEFAULT_CP_BM_MODE;
+ }
+
+ if (xf86ReturnOptValBool(RADEONOptions, OPTION_USE_CP_2D, FALSE)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using CP for 2D\n");
+ info->CP2D = TRUE;
+ } else {
+ info->CP2D = FALSE;
+ }
+
+ if (xf86ReturnOptValBool(RADEONOptions, OPTION_NO_SECURITY, FALSE)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "WARNING!!! CP Security checks disabled!!! **********\n");
+ info->CPSecure = FALSE;
+ } else {
+ info->CPSecure = TRUE;
+ }
+
+ info->agpMode = RADEON_DEFAULT_AGP_MODE;
+ info->agpSize = RADEON_DEFAULT_AGP_SIZE;
+ info->ringSize = RADEON_DEFAULT_RING_SIZE;
+ info->vbSize = RADEON_DEFAULT_VB_SIZE;
+ info->indSize = RADEON_DEFAULT_IND_SIZE;
+ info->agpTexSize = RADEON_DEFAULT_AGP_TEX_SIZE;
+
+ info->vbBufSize = RADEON_DEFAULT_VB_BUF_SIZE;
+
+ info->CPusecTimeout = RADEON_DEFAULT_CP_TIMEOUT;
+
+ if (!info->IsPCI) {
+ if (xf86GetOptValInteger(RADEONOptions,
+ OPTION_AGP_MODE, &(info->agpMode))) {
+ if (info->agpMode < 1 || info->agpMode > RADEON_AGP_MAX_MODE) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Illegal AGP Mode: %d\n", info->agpMode);
+ return FALSE;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Using AGP %dx mode\n", info->agpMode);
+ }
+
+ if (xf86GetOptValInteger(RADEONOptions,
+ OPTION_AGP_SIZE, (int *)&(info->agpSize))) {
+ switch (info->agpSize) {
+ case 4:
+ case 8:
+ case 16:
+ case 32:
+ case 64:
+ case 128:
+ case 256:
+ break;
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Illegal AGP size: %d MB\n", info->agpSize);
+ return FALSE;
+ }
+ }
+
+ if (xf86GetOptValInteger(RADEONOptions,
+ OPTION_RING_SIZE, &(info->ringSize))) {
+ if (info->ringSize < 1 || info->ringSize >= info->agpSize) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Illegal ring buffer size: %d MB\n",
+ info->ringSize);
+ return FALSE;
+ }
+ }
+
+ if (xf86GetOptValInteger(RADEONOptions,
+ OPTION_VERT_SIZE, &(info->vbSize))) {
+ if (info->vbSize < 1 || info->vbSize >= info->agpSize) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Illegal vertex buffers list size: %d MB\n",
+ info->vbSize);
+ return FALSE;
+ }
+ }
+
+ if (xf86GetOptValInteger(RADEONOptions,
+ OPTION_VBUF_SIZE, &(info->vbBufSize))) {
+ int numBufs = info->vbSize*1024*1024/info->vbBufSize;
+ if (numBufs < 2 || numBufs > 512) { /* FIXME: 512 is arbitrary */
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Illegal individual vertex buffer size: %d bytes\n",
+ info->vbBufSize);
+ return FALSE;
+ }
+ }
+
+ if (info->ringSize + info->vbSize + info->indSize + info->agpTexSize >
+ info->agpSize) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Buffers are too big for requested AGP space\n");
+ return FALSE;
+ }
+
+ info->agpTexSize = info->agpSize - (info->ringSize +
+ info->vbSize +
+ info->indSize);
+ }
+
+ if (xf86GetOptValInteger(RADEONOptions, OPTION_USEC_TIMEOUT,
+ &(info->CPusecTimeout))) {
+ /* This option checked by the RADEON DRM kernel module */
+ }
+
+ return TRUE;
+}
+#endif
+
+static void
+RADEONProbeDDC(ScrnInfoPtr pScrn, int index)
+{
+ vbeInfoPtr pVbe;
+ if (xf86LoadSubModule(pScrn, "vbe")) {
+ pVbe = VBEInit(NULL,index);
+ ConfiguredMonitor = vbeDoEDID(pVbe, NULL);
+ }
+}
+
+/* RADEONPreInit is called once at server startup. */
+static Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags)
+{
+ RADEONInfoPtr info;
+
+ RADEONTRACE(("RADEONPreInit\n"));
+ if (pScrn->numEntities != 1) return FALSE;
+
+ if (!RADEONGetRec(pScrn)) return FALSE;
+
+ info = RADEONPTR(pScrn);
+
+ info->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
+ if (info->pEnt->location.type != BUS_PCI) goto fail;
+
+ if (flags & PROBE_DETECT) {
+ RADEONProbeDDC(pScrn, info->pEnt->index);
+ return TRUE;
+ }
+
+ if (!xf86LoadSubModule(pScrn, "vgahw")) return FALSE;
+ xf86LoaderReqSymLists(vgahwSymbols, NULL);
+ if (!vgaHWGetHWRec(pScrn)) {
+ RADEONFreeRec(pScrn);
+ return FALSE;
+ }
+
+ info->PciInfo = xf86GetPciInfoForEntity(info->pEnt->index);
+ info->PciTag = pciTag(info->PciInfo->bus,
+ info->PciInfo->device,
+ info->PciInfo->func);
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "PCI bus %d card %d func %d\n",
+ info->PciInfo->bus,
+ info->PciInfo->device,
+ info->PciInfo->func);
+
+ if (xf86RegisterResources(info->pEnt->index, 0, ResNone)) goto fail;
+
+ pScrn->racMemFlags = RAC_FB | RAC_COLORMAP;
+ pScrn->monitor = pScrn->confScreen->monitor;
+
+ if (!RADEONPreInitVisual(pScrn)) goto fail;
+
+ /* We can't do this until we have a
+ pScrn->display. */
+ xf86CollectOptions(pScrn, NULL);
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, RADEONOptions);
+
+ if (!RADEONPreInitWeight(pScrn)) goto fail;
+
+ if (xf86ReturnOptValBool(RADEONOptions, OPTION_FBDEV, FALSE)) {
+ info->FBDev = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Using framebuffer device\n");
+ }
+
+ if (info->FBDev) {
+ /* check for linux framebuffer device */
+ if (!xf86LoadSubModule(pScrn, "fbdevhw")) return FALSE;
+ xf86LoaderReqSymLists(fbdevHWSymbols, NULL);
+ if (!fbdevHWInit(pScrn, info->PciInfo, NULL)) return FALSE;
+ pScrn->SwitchMode = fbdevHWSwitchMode;
+ pScrn->AdjustFrame = fbdevHWAdjustFrame;
+ pScrn->EnterVT = RADEONEnterVTFBDev;
+ pScrn->LeaveVT = RADEONLeaveVTFBDev;
+ pScrn->ValidMode = fbdevHWValidMode;
+ }
+
+ if (!info->FBDev)
+ if (!RADEONPreInitInt10(pScrn)) goto fail;
+
+ if (!RADEONPreInitConfig(pScrn)) goto fail;
+
+ if (!RADEONGetBIOSParameters(pScrn)) goto fail;
+
+ if (!RADEONGetPLLParameters(pScrn)) goto fail;
+
+ if (!RADEONPreInitDDC(pScrn)) goto fail;
+
+ if (!RADEONPreInitGamma(pScrn)) goto fail;
+
+ if (!RADEONPreInitModes(pScrn)) goto fail;
+
+ if (!RADEONPreInitCursor(pScrn)) goto fail;
+
+ if (!RADEONPreInitAccel(pScrn)) goto fail;
+
+#ifdef XF86DRI
+ if (!RADEONPreInitDRI(pScrn)) goto fail;
+#endif
+
+ /* Free the video bios (if applicable) */
+ if (info->VBIOS) {
+ xfree(info->VBIOS);
+ info->VBIOS = NULL;
+ }
+
+ return TRUE;
+
+ fail:
+ /* Pre-init failed. */
+
+ /* Free the video bios (if applicable) */
+ if (info->VBIOS) {
+ xfree(info->VBIOS);
+ info->VBIOS = NULL;
+ }
+
+ vgaHWFreeHWRec(pScrn);
+ RADEONFreeRec(pScrn);
+ return FALSE;
+}
+
+/* Load a palette. */
+static void RADEONLoadPalette(ScrnInfoPtr pScrn, int numColors,
+ int *indices, LOCO *colors, VisualPtr pVisual)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+ int i;
+ int idx;
+ unsigned char r, g, b;
+
+#ifdef ENABLE_FLAT_PANEL
+ /* Note: Radeon flat panel support has been disabled for now */
+ /* Select palette 0 (main CRTC) if using FP-enabled chip */
+ if (info->HasPanelRegs) PAL_SELECT(0);
+#endif
+
+ if (info->CurrentLayout.depth == 15) {
+ /* 15bpp mode. This sends 32 values. */
+ for (i = 0; i < numColors; i++) {
+ idx = indices[i];
+ r = colors[idx].red;
+ g = colors[idx].green;
+ b = colors[idx].blue;
+ RADEONWaitForFifo(pScrn, 32); /* delay */
+ OUTPAL(idx * 8, r, g, b);
+ }
+ }
+ else if (info->CurrentLayout.depth == 16) {
+ /* 16bpp mode. This sends 64 values. */
+ /* There are twice as many green values as
+ there are values for red and blue. So,
+ we take each red and blue pair, and
+ combine it with each of the two green
+ values. */
+ for (i = 0; i < numColors; i++) {
+ idx = indices[i];
+ r = colors[idx / 2].red;
+ g = colors[idx].green;
+ b = colors[idx / 2].blue;
+ RADEONWaitForFifo(pScrn, 32); /* delay */
+ OUTPAL(idx * 4, r, g, b);
+
+ /* AH - Added to write extra green data - How come this isn't
+ * needed on R128 ? We didn't load the extra green data in the
+ * other routine */
+ if (idx <= 31) {
+ r = colors[idx].red;
+ g = colors[(idx * 2) + 1].green;
+ b = colors[idx].blue;
+ RADEONWaitForFifo(pScrn, 32); /* delay */
+ OUTPAL(idx * 8, r, g, b);
+ }
+ }
+ }
+ else {
+ /* 8bpp mode. This sends 256 values. */
+ for (i = 0; i < numColors; i++) {
+ idx = indices[i];
+ r = colors[idx].red;
+ b = colors[idx].blue;
+ g = colors[idx].green;
+ RADEONWaitForFifo(pScrn, 32); /* delay */
+ OUTPAL(idx, r, g, b);
+ }
+ }
+}
+
+/* Called at the start of each server generation. */
+static Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen,
+ int argc, char **argv)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ BoxRec MemBox;
+ int y2;
+
+ RADEONTRACE(("RADEONScreenInit %x %d\n",
+ pScrn->memPhysBase, pScrn->fbOffset));
+
+#ifdef XF86DRI
+ /* Turn off the CP for now. */
+ info->CPInUse = FALSE;
+#endif
+
+ if (!RADEONMapMem(pScrn)) return FALSE;
+ pScrn->fbOffset = 0;
+#ifdef XF86DRI
+ info->fbX = 0;
+ info->fbY = 0;
+#endif
+
+ info->PaletteSavedOnVT = FALSE;
+
+ RADEONSave(pScrn);
+ if (info->FBDev) {
+ if (!fbdevHWModeInit(pScrn, pScrn->currentMode)) return FALSE;
+ } else {
+ if (!RADEONModeInit(pScrn, pScrn->currentMode)) return FALSE;
+ }
+
+ RADEONSaveScreen(pScreen, SCREEN_SAVER_ON);
+ pScrn->AdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+
+ /* Visual setup */
+ miClearVisualTypes();
+ if (!miSetVisualTypes(pScrn->depth,
+ miGetDefaultVisualMask(pScrn->depth),
+ pScrn->rgbBits,
+ pScrn->defaultVisual)) return FALSE;
+ miSetPixmapDepths ();
+
+#ifdef XF86DRI
+ /* Setup DRI after visuals have been
+ established, but before cfbScreenInit is
+ called. cfbScreenInit will eventually
+ call the driver's InitGLXVisuals call
+ back. */
+ {
+ /* FIXME: When we move to dynamic allocation of back and depth
+ buffers, we will want to revisit the following check for 3
+ times the virtual size of the screen below. */
+ int width_bytes = (pScrn->displayWidth *
+ info->CurrentLayout.pixel_bytes);
+ int maxy = info->FbMapSize / width_bytes;
+
+ if (!xf86ReturnOptValBool(RADEONOptions, OPTION_NOACCEL, FALSE) &&
+ (maxy > pScrn->virtualY * 3)
+#ifdef ENABLE_FLAT_PANEL
+ /* FIXME: Disable 3D support for FPs until it is tested */
+ && !info->HasPanelRegs
+#endif
+ ) {
+ info->directRenderingEnabled = RADEONDRIScreenInit(pScreen);
+ } else {
+ xf86DrvMsg(scrnIndex, X_WARNING,
+ "Static buffer allocation failed -- "
+ "need at least %d kB video memory\n",
+ (pScrn->displayWidth * pScrn->virtualY *
+ info->CurrentLayout.pixel_bytes * 3 + 1023) / 1024);
+ info->directRenderingEnabled = FALSE;
+ }
+ }
+#endif
+
+#ifdef USE_FB
+ if (!fbScreenInit (pScreen, info->FB,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
+ pScrn->bitsPerPixel))
+ return FALSE;
+#ifdef RENDER
+ fbPictureInit (pScreen, 0, 0);
+#endif
+#else
+ switch (pScrn->bitsPerPixel) {
+ case 8:
+ if (!cfbScreenInit(pScreen, info->FB,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth))
+ return FALSE;
+ break;
+ case 16:
+ if (!cfb16ScreenInit(pScreen, info->FB,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth))
+ return FALSE;
+ break;
+ case 32:
+ if (!cfb32ScreenInit(pScreen, info->FB,
+ pScrn->virtualX, pScrn->virtualY,
+ pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth))
+ return FALSE;
+ break;
+ default:
+ xf86DrvMsg(scrnIndex, X_ERROR,
+ "Invalid bpp (%d)\n", pScrn->bitsPerPixel);
+ return FALSE;
+ }
+#endif
+ xf86SetBlackWhitePixels(pScreen);
+
+ if (pScrn->bitsPerPixel > 8) {
+ VisualPtr visual;
+
+ for (visual = pScreen->visuals + pScreen->numVisuals;
+ visual >= pScreen->visuals;
+ visual--) {
+ if ((visual->class | DynamicClass) == DirectColor) {
+ visual->offsetRed = pScrn->offset.red;
+ visual->offsetGreen = pScrn->offset.green;
+ visual->offsetBlue = pScrn->offset.blue;
+ visual->redMask = pScrn->mask.red;
+ visual->greenMask = pScrn->mask.green;
+ visual->blueMask = pScrn->mask.blue;
+ }
+ }
+ }
+
+ RADEONDGAInit(pScreen);
+
+ /* Memory manager setup */
+ MemBox.x1 = 0;
+ MemBox.y1 = 0;
+ MemBox.x2 = pScrn->displayWidth;
+ y2 = (info->FbMapSize
+ / (pScrn->displayWidth * info->CurrentLayout.pixel_bytes));
+ if (y2 >= 32768) y2 = 32767; /* because MemBox.y2 is signed short */
+ MemBox.y2 = y2;
+
+ /* The acceleration engine uses 14 bit
+ signed coordinates, so we can't have any
+ drawable caches beyond this region. */
+ if (MemBox.y2 > 8191) MemBox.y2 = 8191;
+
+ if (!xf86InitFBManager(pScreen, &MemBox)) {
+ xf86DrvMsg(scrnIndex, X_ERROR,
+ "Memory manager initialization to (%d,%d) (%d,%d) failed\n",
+ MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2);
+ return FALSE;
+ } else {
+ int width, height;
+ FBAreaPtr fbarea;
+
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Memory manager initialized to (%d,%d) (%d,%d)\n",
+ MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2);
+ if ((fbarea = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth,
+ 2, 0, NULL, NULL, NULL))) {
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Reserved area from (%d,%d) to (%d,%d)\n",
+ fbarea->box.x1, fbarea->box.y1,
+ fbarea->box.x2, fbarea->box.y2);
+ } else {
+ xf86DrvMsg(scrnIndex, X_ERROR, "Unable to reserve area\n");
+ }
+ if (xf86QueryLargestOffscreenArea(pScreen, &width, &height, 0, 0, 0)) {
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Largest offscreen area available: %d x %d\n",
+ width, height);
+ }
+ }
+
+#ifdef XF86DRI
+ /* Allocate frame buffer space for the
+ shared back and depth buffers as well
+ as for local textures. */
+ if (info->directRenderingEnabled) {
+ FBAreaPtr fbarea;
+ int width_bytes = (pScrn->displayWidth *
+ info->CurrentLayout.pixel_bytes);
+ int maxy = info->FbMapSize / width_bytes;
+ int l;
+
+ switch (info->CPMode) {
+ case RADEON_DEFAULT_CP_PIO_MODE:
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CP in PIO mode\n");
+ break;
+ case RADEON_DEFAULT_CP_BM_MODE:
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CP in BM mode\n");
+ break;
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CP in UNKNOWN mode\n");
+ break;
+ }
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Using %d MB AGP aperture\n", info->agpSize);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Using %d MB for the ring buffer\n", info->ringSize);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Using %d MB for vertex buffers\n", info->vbSize);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Using %d MB for indirect buffers\n", info->indSize);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Using %d MB for AGP textures\n", info->agpTexSize);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Using %d byte vertex buffers\n", info->vbBufSize);
+
+ /* Allocate the shared back buffer */
+ if ((fbarea = xf86AllocateOffscreenArea(pScreen,
+ pScrn->virtualX,
+ pScrn->virtualY,
+ 32, NULL, NULL, NULL))) {
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Reserved back buffer from (%d,%d) to (%d,%d)\n",
+ fbarea->box.x1, fbarea->box.y1,
+ fbarea->box.x2, fbarea->box.y2);
+
+ info->backX = fbarea->box.x1;
+ info->backY = fbarea->box.y1;
+ } else {
+ xf86DrvMsg(scrnIndex, X_ERROR, "Unable to reserve back buffer\n");
+ info->backX = -1;
+ info->backY = -1;
+ }
+
+ /* Allocate the shared depth buffer */
+ if ((fbarea = xf86AllocateOffscreenArea(pScreen,
+ pScrn->virtualX,
+ pScrn->virtualY,
+ 32, NULL, NULL, NULL))) {
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Reserved depth buffer from (%d,%d) to (%d,%d)\n",
+ fbarea->box.x1, fbarea->box.y1,
+ fbarea->box.x2, fbarea->box.y2);
+
+ info->depthX = fbarea->box.x1;
+ info->depthY = fbarea->box.y1;
+ } else {
+ xf86DrvMsg(scrnIndex, X_ERROR, "Unable to reserve depth buffer\n");
+ info->depthX = -1;
+ info->depthY = -1;
+ }
+
+ /* Allocate local texture space */
+ if (((maxy - MemBox.y2 - 1) * width_bytes) >
+ (pScrn->virtualX * pScrn->virtualY * 2 *
+ info->CurrentLayout.pixel_bytes)) {
+ info->textureX = 0;
+ info->textureY = MemBox.y2 + 1;
+ info->textureSize = (maxy - MemBox.y2 - 1) * width_bytes;
+
+ l = RADEONMinBits((info->textureSize-1) / RADEON_NR_TEX_REGIONS);
+ if (l < RADEON_LOG_TEX_GRANULARITY) l = RADEON_LOG_TEX_GRANULARITY;
+
+ info->log2TexGran = l;
+ info->textureSize = (info->textureSize >> l) << l;
+
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Reserved %d kb for textures: (%d,%d)-(%d,%d)\n",
+ info->textureSize/1024,
+ info->textureX, info->textureY,
+ pScrn->displayWidth, maxy);
+ } else if ((fbarea = xf86AllocateOffscreenArea(pScreen,
+ pScrn->virtualX,
+ pScrn->virtualY * 2,
+ 32,
+ NULL, NULL, NULL))) {
+ info->textureX = fbarea->box.x1;
+ info->textureY = fbarea->box.y1;
+ info->textureSize = ((fbarea->box.y2 - fbarea->box.y1) *
+ (fbarea->box.x2 - fbarea->box.x1) *
+ info->CurrentLayout.pixel_bytes);
+
+ l = RADEONMinBits((info->textureSize-1) / RADEON_NR_TEX_REGIONS);
+ if (l < RADEON_LOG_TEX_GRANULARITY) l = RADEON_LOG_TEX_GRANULARITY;
+
+ info->log2TexGran = l;
+ info->textureSize = (info->textureSize >> l) << l;
+
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Reserved %d kb for textures: (%d,%d)-(%d,%d)\n",
+ info->textureSize/1024,
+ fbarea->box.x1, fbarea->box.y1,
+ fbarea->box.x2, fbarea->box.y2);
+ } else {
+ xf86DrvMsg(scrnIndex, X_ERROR,
+ "Unable to reserve texture space in frame buffer\n");
+ info->textureX = -1;
+ info->textureY = -1;
+ }
+ }
+#endif
+
+ /* Backing store setup */
+ miInitializeBackingStore(pScreen);
+ xf86SetBackingStore(pScreen);
+
+ /* Set Silken Mouse */
+ xf86SetSilkenMouse(pScreen);
+
+ /* Acceleration setup */
+ if (!xf86ReturnOptValBool(RADEONOptions, OPTION_NOACCEL, FALSE)) {
+ if (RADEONAccelInit(pScreen)) {
+ xf86DrvMsg(scrnIndex, X_INFO, "Acceleration enabled\n");
+ info->accelOn = TRUE;
+ } else {
+ xf86DrvMsg(scrnIndex, X_ERROR,
+ "Acceleration initialization failed\n");
+ xf86DrvMsg(scrnIndex, X_INFO, "Acceleration disabled\n");
+ info->accelOn = FALSE;
+ }
+ } else {
+ xf86DrvMsg(scrnIndex, X_INFO, "Acceleration disabled\n");
+ info->accelOn = FALSE;
+ }
+
+ /* Cursor setup */
+ miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
+
+ /* Hardware cursor setup */
+ if (!xf86ReturnOptValBool(RADEONOptions, OPTION_SW_CURSOR, FALSE)) {
+ if (RADEONCursorInit(pScreen)) {
+ int width, height;
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Using hardware cursor (scanline %d)\n",
+ info->cursor_start / pScrn->displayWidth);
+ if (xf86QueryLargestOffscreenArea(pScreen, &width, &height,
+ 0, 0, 0)) {
+ xf86DrvMsg(scrnIndex, X_INFO,
+ "Largest offscreen area available: %d x %d\n",
+ width, height);
+ }
+ } else {
+ xf86DrvMsg(scrnIndex, X_ERROR,
+ "Hardware cursor initialization failed\n");
+ xf86DrvMsg(scrnIndex, X_INFO, "Using software cursor\n");
+ }
+ } else {
+ xf86DrvMsg(scrnIndex, X_INFO, "Using software cursor\n");
+ }
+
+ /* Colormap setup */
+ if (!miCreateDefColormap(pScreen)) return FALSE;
+ if (!xf86HandleColormaps(pScreen, 256, info->dac6bits ? 6 : 8,
+ (info->FBDev ? fbdevHWLoadPalette :
+ RADEONLoadPalette), NULL,
+ CMAP_PALETTED_TRUECOLOR
+ | CMAP_RELOAD_ON_MODE_SWITCH
+#if 0 /* This option messes up text mode! (eich@suse.de) */
+ | CMAP_LOAD_EVEN_IF_OFFSCREEN
+#endif
+ )) return FALSE;
+
+ /* DPMS setup */
+#ifdef DPMSExtension
+#ifdef ENABLE_FLAT_PANEL
+ if (!info->HasPanelRegs || info->CRTOnly)
+ xf86DPMSInit(pScreen, RADEONDisplayPowerManagementSet, 0);
+#else
+ xf86DPMSInit(pScreen, RADEONDisplayPowerManagementSet, 0);
+#endif
+#endif
+
+ RADEONInitVideo(pScreen);
+
+ /* Provide SaveScreen */
+ pScreen->SaveScreen = RADEONSaveScreen;
+
+ /* Wrap CloseScreen */
+ info->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = RADEONCloseScreen;
+
+ /* Note unused options */
+ if (serverGeneration == 1)
+ xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
+
+#ifdef XF86DRI
+ /* DRI finalization */
+ if (info->directRenderingEnabled) {
+ /* Now that mi, cfb, drm and others have
+ done their thing, complete the DRI
+ setup. */
+ info->directRenderingEnabled = RADEONDRIFinishScreenInit(pScreen);
+ }
+ if (info->directRenderingEnabled) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Direct rendering enabled\n");
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Direct rendering disabled\n");
+ }
+#endif
+
+ return TRUE;
+}
+
+/* Write common registers (initialized to 0). */
+static void RADEONRestoreCommonRegisters(ScrnInfoPtr pScrn,
+ RADEONSavePtr restore)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ OUTREG(RADEON_OVR_CLR, restore->ovr_clr);
+ OUTREG(RADEON_OVR_WID_LEFT_RIGHT, restore->ovr_wid_left_right);
+ OUTREG(RADEON_OVR_WID_TOP_BOTTOM, restore->ovr_wid_top_bottom);
+ OUTREG(RADEON_OV0_SCALE_CNTL, restore->ov0_scale_cntl);
+ OUTREG(RADEON_MPP_TB_CONFIG, restore->mpp_tb_config );
+ OUTREG(RADEON_MPP_GP_CONFIG, restore->mpp_gp_config );
+ OUTREG(RADEON_SUBPIC_CNTL, restore->subpic_cntl);
+ OUTREG(RADEON_VIPH_CONTROL, restore->viph_control);
+ OUTREG(RADEON_I2C_CNTL_1, restore->i2c_cntl_1);
+ OUTREG(RADEON_GEN_INT_CNTL, restore->gen_int_cntl);
+ OUTREG(RADEON_CAP0_TRIG_CNTL, restore->cap0_trig_cntl);
+ OUTREG(RADEON_CAP1_TRIG_CNTL, restore->cap1_trig_cntl);
+ OUTREG(RADEON_BUS_CNTL, restore->bus_cntl);
+}
+
+/* Write CRTC registers. */
+static void RADEONRestoreCrtcRegisters(ScrnInfoPtr pScrn,
+ RADEONSavePtr restore)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ OUTREG(RADEON_CRTC_GEN_CNTL, restore->crtc_gen_cntl);
+
+ OUTREGP(RADEON_CRTC_EXT_CNTL, restore->crtc_ext_cntl,
+ RADEON_CRTC_VSYNC_DIS |
+ RADEON_CRTC_HSYNC_DIS |
+ RADEON_CRTC_DISPLAY_DIS);
+
+ OUTREGP(RADEON_DAC_CNTL, restore->dac_cntl,
+ RADEON_DAC_RANGE_CNTL |
+ RADEON_DAC_BLANKING);
+
+ OUTREG(RADEON_CRTC_H_TOTAL_DISP, restore->crtc_h_total_disp);
+ OUTREG(RADEON_CRTC_H_SYNC_STRT_WID, restore->crtc_h_sync_strt_wid);
+ OUTREG(RADEON_CRTC_V_TOTAL_DISP, restore->crtc_v_total_disp);
+ OUTREG(RADEON_CRTC_V_SYNC_STRT_WID, restore->crtc_v_sync_strt_wid);
+ OUTREG(RADEON_CRTC_OFFSET, restore->crtc_offset);
+ OUTREG(RADEON_CRTC_OFFSET_CNTL, restore->crtc_offset_cntl);
+ OUTREG(RADEON_CRTC_PITCH, restore->crtc_pitch);
+}
+
+#ifdef ENABLE_FLAT_PANEL
+/* Note: Radeon flat panel support has been disabled for now */
+/* Write flat panel registers */
+static void RADEONRestoreFPRegisters(ScrnInfoPtr pScrn, RADEONSavePtr restore)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+ CARD32 tmp;
+
+ OUTREG(RADEON_CRTC2_GEN_CNTL, restore->crtc2_gen_cntl);
+ OUTREG(RADEON_FP_CRTC_H_TOTAL_DISP, restore->fp_crtc_h_total_disp);
+ OUTREG(RADEON_FP_CRTC_V_TOTAL_DISP, restore->fp_crtc_v_total_disp);
+ OUTREG(RADEON_FP_GEN_CNTL, restore->fp_gen_cntl);
+ OUTREG(RADEON_FP_H_SYNC_STRT_WID, restore->fp_h_sync_strt_wid);
+ OUTREG(RADEON_FP_HORZ_STRETCH, restore->fp_horz_stretch);
+ OUTREG(RADEON_FP_PANEL_CNTL, restore->fp_panel_cntl);
+ OUTREG(RADEON_FP_V_SYNC_STRT_WID, restore->fp_v_sync_strt_wid);
+ OUTREG(RADEON_FP_VERT_STRETCH, restore->fp_vert_stretch);
+ OUTREG(RADEON_TMDS_CRC, restore->tmds_crc);
+
+ tmp = INREG(RADEON_LVDS_GEN_CNTL);
+ if ((tmp & (RADEON_LVDS_ON | RADEON_LVDS_BLON)) ==
+ (restore->lvds_gen_cntl & (RADEON_LVDS_ON | RADEON_LVDS_BLON))) {
+ OUTREG(RADEON_LVDS_GEN_CNTL, restore->lvds_gen_cntl);
+ } else {
+ if (restore->lvds_gen_cntl & (RADEON_LVDS_ON | RADEON_LVDS_BLON)) {
+ OUTREG(RADEON_LVDS_GEN_CNTL,
+ restore->lvds_gen_cntl & ~RADEON_LVDS_BLON);
+ usleep(RADEONPTR(pScrn)->PanelPwrDly * 1000);
+ OUTREG(RADEON_LVDS_GEN_CNTL, restore->lvds_gen_cntl);
+ } else {
+ OUTREG(RADEON_LVDS_GEN_CNTL,
+ restore->lvds_gen_cntl | RADEON_LVDS_BLON);
+ usleep(RADEONPTR(pScrn)->PanelPwrDly * 1000);
+ OUTREG(RADEON_LVDS_GEN_CNTL, restore->lvds_gen_cntl);
+ }
+ }
+}
+#endif
+
+#if RADEON_ATOMIC_UPDATE
+static void RADEONPLLWaitForReadUpdateComplete(ScrnInfoPtr pScrn)
+{
+ while (INPLL(pScrn, RADEON_PPLL_REF_DIV) & RADEON_PPLL_ATOMIC_UPDATE_R);
+}
+
+static void RADEONPLLWriteUpdate(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ OUTPLLP(pScrn, RADEON_PPLL_REF_DIV, RADEON_PPLL_ATOMIC_UPDATE_W, 0xffff);
+}
+#endif
+
+/* Write PLL registers. */
+static void RADEONRestorePLLRegisters(ScrnInfoPtr pScrn, RADEONSavePtr restore)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+#if !RADEON_ATOMIC_UPDATE
+ while ( (INREG(RADEON_CLOCK_CNTL_INDEX) & RADEON_PLL_DIV_SEL) !=
+ RADEON_PLL_DIV_SEL) {
+#endif
+ OUTREGP(RADEON_CLOCK_CNTL_INDEX, RADEON_PLL_DIV_SEL, 0xffff);
+#if !RADEON_ATOMIC_UPDATE
+ }
+#endif
+
+#if RADEON_ATOMIC_UPDATE
+ OUTPLLP(pScrn,
+ RADEON_PPLL_CNTL,
+ RADEON_PPLL_RESET
+ | RADEON_PPLL_ATOMIC_UPDATE_EN
+ | RADEON_PPLL_VGA_ATOMIC_UPDATE_EN,
+ 0xffff);
+#else
+ OUTPLLP(pScrn,
+ RADEON_PPLL_CNTL,
+ RADEON_PPLL_RESET,
+ 0xffff);
+#endif
+
+#if RADEON_ATOMIC_UPDATE
+ RADEONPLLWaitForReadUpdateComplete(pScrn);
+#endif
+ while ( (INPLL(pScrn, RADEON_PPLL_REF_DIV) & RADEON_PPLL_REF_DIV_MASK) !=
+ (restore->ppll_ref_div & RADEON_PPLL_REF_DIV_MASK)) {
+ OUTPLLP(pScrn, RADEON_PPLL_REF_DIV,
+ restore->ppll_ref_div, ~RADEON_PPLL_REF_DIV_MASK);
+ }
+#if RADEON_ATOMIC_UPDATE
+ RADEONPLLWriteUpdate(pScrn);
+#endif
+
+#if RADEON_ATOMIC_UPDATE
+ RADEONPLLWaitForReadUpdateComplete(pScrn);
+#endif
+ while ( (INPLL(pScrn, RADEON_PPLL_DIV_3) & RADEON_PPLL_FB3_DIV_MASK) !=
+ (restore->ppll_div_3 & RADEON_PPLL_FB3_DIV_MASK)) {
+ OUTPLLP(pScrn, RADEON_PPLL_DIV_3,
+ restore->ppll_div_3, ~RADEON_PPLL_FB3_DIV_MASK);
+ }
+#if RADEON_ATOMIC_UPDATE
+ RADEONPLLWriteUpdate(pScrn);
+#endif
+
+#if RADEON_ATOMIC_UPDATE
+ RADEONPLLWaitForReadUpdateComplete(pScrn);
+#endif
+ while ( (INPLL(pScrn, RADEON_PPLL_DIV_3) & RADEON_PPLL_POST3_DIV_MASK) !=
+ (restore->ppll_div_3 & RADEON_PPLL_POST3_DIV_MASK)) {
+ OUTPLLP(pScrn, RADEON_PPLL_DIV_3,
+ restore->ppll_div_3, ~RADEON_PPLL_POST3_DIV_MASK);
+ }
+#if RADEON_ATOMIC_UPDATE
+ RADEONPLLWriteUpdate(pScrn);
+#endif
+
+#if RADEON_ATOMIC_UPDATE
+ RADEONPLLWaitForReadUpdateComplete(pScrn);
+#endif
+ OUTPLL(RADEON_HTOTAL_CNTL, restore->htotal_cntl);
+#if RADEON_ATOMIC_UPDATE
+ RADEONPLLWriteUpdate(pScrn);
+#endif
+
+ OUTPLLP(pScrn, RADEON_PPLL_CNTL, 0, ~RADEON_PPLL_RESET);
+
+ RADEONTRACE(("Wrote: 0x%08x 0x%08x 0x%08x (0x%08x)\n",
+ restore->ppll_ref_div,
+ restore->ppll_div_3,
+ restore->htotal_cntl,
+ INPLL(pScrn, RADEON_PPLL_CNTL)));
+ RADEONTRACE(("Wrote: rd=%d, fd=%d, pd=%d\n",
+ restore->ppll_ref_div & RADEON_PPLL_REF_DIV_MASK,
+ restore->ppll_div_3 & RADEON_PPLL_FB3_DIV_MASK,
+ (restore->ppll_div_3 & RADEON_PPLL_POST3_DIV_MASK) >> 16));
+}
+
+/* Write DDA registers. */
+static void RADEONRestoreDDARegisters(ScrnInfoPtr pScrn, RADEONSavePtr restore)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ OUTREG(RADEON_DDA_CONFIG, restore->dda_config);
+ OUTREG(RADEON_DDA_ON_OFF, restore->dda_on_off);
+}
+
+/* Write palette data. */
+static void RADEONRestorePalette(ScrnInfoPtr pScrn, RADEONSavePtr restore)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+ int i;
+
+ if (!restore->palette_valid) return;
+
+#ifdef ENABLE_FLAT_PANEL
+ /* Note: Radeon flat panel support has been disabled for now */
+ /* Select palette 0 (main CRTC) if using FP-enabled chip */
+ if (info->HasPanelRegs) PAL_SELECT(0);
+#endif
+
+ OUTPAL_START(0);
+ for (i = 0; i < 256; i++) {
+ RADEONWaitForFifo(pScrn, 32); /* delay */
+ OUTPAL_NEXT_CARD32(restore->palette[i]);
+ }
+}
+
+/* Write out state to define a new video mode. */
+static void RADEONRestoreMode(ScrnInfoPtr pScrn, RADEONSavePtr restore)
+{
+#ifdef ENABLE_FLAT_PANEL
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+#endif
+
+ RADEONTRACE(("RADEONRestoreMode(%p)\n", restore));
+ RADEONRestoreCommonRegisters(pScrn, restore);
+ RADEONRestoreCrtcRegisters(pScrn, restore);
+#ifdef ENABLE_FLAT_PANEL
+ /* Note: Radeon flat panel support has been disabled for now */
+ if (info->HasPanelRegs)
+ RADEONRestoreFPRegisters(pScrn, restore);
+ if (!info->HasPanelRegs || info->CRTOnly)
+ RADEONRestorePLLRegisters(pScrn, restore);
+#else
+ RADEONRestorePLLRegisters(pScrn, restore);
+#endif
+ RADEONRestoreDDARegisters(pScrn, restore);
+ RADEONRestorePalette(pScrn, restore);
+}
+
+/* Read common registers. */
+static void RADEONSaveCommonRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ save->ovr_clr = INREG(RADEON_OVR_CLR);
+ save->ovr_wid_left_right = INREG(RADEON_OVR_WID_LEFT_RIGHT);
+ save->ovr_wid_top_bottom = INREG(RADEON_OVR_WID_TOP_BOTTOM);
+ save->ov0_scale_cntl = INREG(RADEON_OV0_SCALE_CNTL);
+ save->mpp_tb_config = INREG(RADEON_MPP_TB_CONFIG);
+ save->mpp_gp_config = INREG(RADEON_MPP_GP_CONFIG);
+ save->subpic_cntl = INREG(RADEON_SUBPIC_CNTL);
+ save->viph_control = INREG(RADEON_VIPH_CONTROL);
+ save->i2c_cntl_1 = INREG(RADEON_I2C_CNTL_1);
+ save->gen_int_cntl = INREG(RADEON_GEN_INT_CNTL);
+ save->cap0_trig_cntl = INREG(RADEON_CAP0_TRIG_CNTL);
+ save->cap1_trig_cntl = INREG(RADEON_CAP1_TRIG_CNTL);
+ save->bus_cntl = INREG(RADEON_BUS_CNTL);
+}
+
+/* Read CRTC registers. */
+static void RADEONSaveCrtcRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ save->crtc_gen_cntl = INREG(RADEON_CRTC_GEN_CNTL);
+ save->crtc_ext_cntl = INREG(RADEON_CRTC_EXT_CNTL);
+ save->dac_cntl = INREG(RADEON_DAC_CNTL);
+ save->crtc_h_total_disp = INREG(RADEON_CRTC_H_TOTAL_DISP);
+ save->crtc_h_sync_strt_wid = INREG(RADEON_CRTC_H_SYNC_STRT_WID);
+ save->crtc_v_total_disp = INREG(RADEON_CRTC_V_TOTAL_DISP);
+ save->crtc_v_sync_strt_wid = INREG(RADEON_CRTC_V_SYNC_STRT_WID);
+ save->crtc_offset = INREG(RADEON_CRTC_OFFSET);
+ save->crtc_offset_cntl = INREG(RADEON_CRTC_OFFSET_CNTL);
+ save->crtc_pitch = INREG(RADEON_CRTC_PITCH);
+}
+
+#ifdef ENABLE_FLAT_PANEL
+/* Note: Radeon flat panel support has been disabled for now */
+/* Read flat panel registers */
+static void RADEONSaveFPRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ save->crtc2_gen_cntl = INREG(RADEON_CRTC2_GEN_CNTL);
+ save->fp_crtc_h_total_disp = INREG(RADEON_FP_CRTC_H_TOTAL_DISP);
+ save->fp_crtc_v_total_disp = INREG(RADEON_FP_CRTC_V_TOTAL_DISP);
+ save->fp_gen_cntl = INREG(RADEON_FP_GEN_CNTL);
+ save->fp_h_sync_strt_wid = INREG(RADEON_FP_H_SYNC_STRT_WID);
+ save->fp_horz_stretch = INREG(RADEON_FP_HORZ_STRETCH);
+ save->fp_panel_cntl = INREG(RADEON_FP_PANEL_CNTL);
+ save->fp_v_sync_strt_wid = INREG(RADEON_FP_V_SYNC_STRT_WID);
+ save->fp_vert_stretch = INREG(RADEON_FP_VERT_STRETCH);
+ save->lvds_gen_cntl = INREG(RADEON_LVDS_GEN_CNTL);
+ save->tmds_crc = INREG(RADEON_TMDS_CRC);
+}
+#endif
+
+/* Read PLL registers. */
+static void RADEONSavePLLRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save)
+{
+ save->ppll_ref_div = INPLL(pScrn, RADEON_PPLL_REF_DIV);
+ save->ppll_div_3 = INPLL(pScrn, RADEON_PPLL_DIV_3);
+ save->htotal_cntl = INPLL(pScrn, RADEON_HTOTAL_CNTL);
+
+ RADEONTRACE(("Read: 0x%08x 0x%08x 0x%08x\n",
+ save->ppll_ref_div,
+ save->ppll_div_3,
+ save->htotal_cntl));
+ RADEONTRACE(("Read: rd=%d, fd=%d, pd=%d\n",
+ save->ppll_ref_div & RADEON_PPLL_REF_DIV_MASK,
+ save->ppll_div_3 & RADEON_PPLL_FB3_DIV_MASK,
+ (save->ppll_div_3 & RADEON_PPLL_POST3_DIV_MASK) >> 16));
+}
+
+/* Read DDA registers. */
+static void RADEONSaveDDARegisters(ScrnInfoPtr pScrn, RADEONSavePtr save)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+
+ save->dda_config = INREG(RADEON_DDA_CONFIG);
+ save->dda_on_off = INREG(RADEON_DDA_ON_OFF);
+}
+
+/* Read palette data. */
+static void RADEONSavePalette(ScrnInfoPtr pScrn, RADEONSavePtr save)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+ int i;
+
+#ifdef ENABLE_FLAT_PANEL
+ /* Note: Radeon flat panel support has been disabled for now */
+ /* Select palette 0 (main CRTC) if using FP-enabled chip */
+ if (info->HasPanelRegs) PAL_SELECT(0);
+#endif
+
+ INPAL_START(0);
+ for (i = 0; i < 256; i++) save->palette[i] = INPAL_NEXT();
+ save->palette_valid = TRUE;
+}
+
+/* Save state that defines current video mode. */
+static void RADEONSaveMode(ScrnInfoPtr pScrn, RADEONSavePtr save)
+{
+ RADEONTRACE(("RADEONSaveMode(%p)\n", save));
+
+ RADEONSaveCommonRegisters(pScrn, save);
+ RADEONSaveCrtcRegisters(pScrn, save);
+#ifdef ENABLE_FLAT_PANEL
+ /* Note: Radeon flat panel support has been disabled for now */
+ if (RADEONPTR(pScrn)->HasPanelRegs)
+ RADEONSaveFPRegisters(pScrn, save);
+#endif
+ RADEONSavePLLRegisters(pScrn, save);
+ RADEONSaveDDARegisters(pScrn, save);
+ RADEONSavePalette(pScrn, save);
+
+ RADEONTRACE(("RADEONSaveMode returns %p\n", save));
+}
+
+/* Save everything needed to restore the original VC state. */
+static void RADEONSave(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+ RADEONSavePtr save = &info->SavedReg;
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+
+ RADEONTRACE(("RADEONSave\n"));
+ if (info->FBDev) {
+ fbdevHWSave(pScrn);
+ return;
+ }
+ vgaHWUnlock(hwp);
+ vgaHWSave(pScrn, &hwp->SavedReg, VGA_SR_ALL); /* save mode, fonts, cmap */
+ vgaHWLock(hwp);
+
+ RADEONSaveMode(pScrn, save);
+
+ save->dp_datatype = INREG(RADEON_DP_DATATYPE);
+ save->rbbm_soft_reset = INREG(RADEON_RBBM_SOFT_RESET);
+ save->clock_cntl_index = INREG(RADEON_CLOCK_CNTL_INDEX);
+ save->amcgpio_en_reg = INREG(RADEON_AMCGPIO_EN_REG);
+ save->amcgpio_mask = INREG(RADEON_AMCGPIO_MASK);
+}
+
+/* Restore the original (text) mode. */
+static void RADEONRestore(ScrnInfoPtr pScrn)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+ RADEONSavePtr restore = &info->SavedReg;
+ vgaHWPtr hwp = VGAHWPTR(pScrn);
+
+ RADEONTRACE(("RADEONRestore\n"));
+ if (info->FBDev) {
+ fbdevHWRestore(pScrn);
+ return;
+ }
+
+ RADEONBlank(pScrn);
+
+ OUTREG(RADEON_AMCGPIO_MASK, restore->amcgpio_mask);
+ OUTREG(RADEON_AMCGPIO_EN_REG, restore->amcgpio_en_reg);
+ OUTREG(RADEON_CLOCK_CNTL_INDEX, restore->clock_cntl_index);
+ OUTREG(RADEON_RBBM_SOFT_RESET, restore->rbbm_soft_reset);
+ OUTREG(RADEON_DP_DATATYPE, restore->dp_datatype);
+
+ RADEONRestoreMode(pScrn, restore);
+ vgaHWUnlock(hwp);
+ vgaHWRestore(pScrn, &hwp->SavedReg, VGA_SR_MODE | VGA_SR_FONTS );
+ vgaHWLock(hwp);
+
+#if 0
+ RADEONWaitForVerticalSync(pScrn);
+#endif
+ RADEONUnblank(pScrn);
+}
+
+/* Define common registers for requested video mode. */
+static void RADEONInitCommonRegisters(RADEONSavePtr save, DisplayModePtr mode,
+ RADEONInfoPtr info)
+{
+ save->ovr_clr = 0;
+ save->ovr_wid_left_right = 0;
+ save->ovr_wid_top_bottom = 0;
+ save->ov0_scale_cntl = 0;
+ save->mpp_tb_config = 0;
+ save->mpp_gp_config = 0;
+ save->subpic_cntl = 0;
+ save->viph_control = 0;
+ save->i2c_cntl_1 = 0;
+ save->rbbm_soft_reset = 0;
+ save->cap0_trig_cntl = 0;
+ save->cap1_trig_cntl = 0;
+ save->bus_cntl = info->BusCntl;
+ /*
+ * If bursts are enabled, turn on discards
+ * Radeon doesn't have write bursts
+ */
+ if (save->bus_cntl & (RADEON_BUS_READ_BURST))
+ save->bus_cntl |= RADEON_BUS_RD_DISCARD_EN;
+}
+
+/* Define CRTC registers for requested video mode. */
+static Bool RADEONInitCrtcRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save,
+ DisplayModePtr mode, RADEONInfoPtr info)
+{
+ int format;
+ int hsync_start;
+ int hsync_wid;
+ int hsync_fudge;
+ int vsync_wid;
+ int bytpp;
+ int hsync_fudge_default[] = { 0x00, 0x12, 0x09, 0x09, 0x06, 0x05 };
+#ifdef ENABLE_FLAT_PANEL
+ /* Note: Radeon flat panel support has been disabled for now */
+ int hsync_fudge_fp[] = { 0x12, 0x11, 0x09, 0x09, 0x05, 0x05 };
+ int hsync_fudge_fp_crt[] = { 0x12, 0x10, 0x08, 0x08, 0x04, 0x04 };
+#endif
+
+ switch (info->CurrentLayout.pixel_code) {
+ case 4: format = 1; bytpp = 0; break;
+ case 8: format = 2; bytpp = 1; break;
+ case 15: format = 3; bytpp = 2; break; /* 555 */
+ case 16: format = 4; bytpp = 2; break; /* 565 */
+ case 24: format = 5; bytpp = 3; break; /* RGB */
+ case 32: format = 6; bytpp = 4; break; /* xRGB */
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Unsupported pixel depth (%d)\n", info->CurrentLayout.bitsPerPixel);
+ return FALSE;
+ }
+ RADEONTRACE(("Format = %d (%d bytes per pixel)\n", format, bytpp));
+
+#ifdef ENABLE_FLAT_PANEL
+ /* Note: Radeon flat panel support has been disabled for now */
+ if (info->HasPanelRegs)
+ if (info->CRTOnly) hsync_fudge = hsync_fudge_fp_crt[format-1];
+ else hsync_fudge = hsync_fudge_fp[format-1];
+ else hsync_fudge = hsync_fudge_default[format-1];
+#else
+ hsync_fudge = hsync_fudge_default[format-1];
+#endif
+
+ save->crtc_gen_cntl = (RADEON_CRTC_EXT_DISP_EN
+ | RADEON_CRTC_EN
+ | (format << 8)
+ | ((mode->Flags & V_DBLSCAN)
+ ? RADEON_CRTC_DBL_SCAN_EN
+ : 0)
+ | ((mode->Flags & V_INTERLACE)
+ ? RADEON_CRTC_INTERLACE_EN
+ : 0));
+
+ save->crtc_ext_cntl = RADEON_VGA_ATI_LINEAR | RADEON_XCRT_CNT_EN;
+ save->dac_cntl = (RADEON_DAC_MASK_ALL
+ | RADEON_DAC_VGA_ADR_EN
+ | (info->dac6bits ? 0 : RADEON_DAC_8BIT_EN));
+
+ save->crtc_h_total_disp = ((((mode->CrtcHTotal / 8) - 1) & 0xffff)
+ | (((mode->CrtcHDisplay / 8) - 1) << 16));
+
+ hsync_wid = (mode->CrtcHSyncEnd - mode->CrtcHSyncStart) / 8;
+ if (!hsync_wid) hsync_wid = 1;
+ if (hsync_wid > 0x3f) hsync_wid = 0x3f;
+
+ hsync_start = mode->CrtcHSyncStart - 8 + hsync_fudge;
+
+ save->crtc_h_sync_strt_wid = ((hsync_start & 0x1fff)
+ | (hsync_wid << 16)
+ | ((mode->Flags & V_NHSYNC)
+ ? RADEON_CRTC_H_SYNC_POL
+ : 0));
+
+#if 1
+ /* This works for double scan mode. */
+ save->crtc_v_total_disp = (((mode->CrtcVTotal - 1) & 0xffff)
+ | ((mode->CrtcVDisplay - 1) << 16));
+#else
+ /* This is what cce/nbmode.c example code
+ does -- is this correct? */
+ save->crtc_v_total_disp = (((mode->CrtcVTotal - 1) & 0xffff)
+ | ((mode->CrtcVDisplay
+ * ((mode->Flags & V_DBLSCAN) ? 2 : 1) - 1)
+ << 16));
+#endif
+
+ vsync_wid = mode->CrtcVSyncEnd - mode->CrtcVSyncStart;
+ if (!vsync_wid) vsync_wid = 1;
+ if (vsync_wid > 0x1f) vsync_wid = 0x1f;
+
+ save->crtc_v_sync_strt_wid = (((mode->CrtcVSyncStart - 1) & 0xfff)
+ | (vsync_wid << 16)
+ | ((mode->Flags & V_NVSYNC)
+ ? RADEON_CRTC_V_SYNC_POL
+ : 0));
+ save->crtc_offset = 0;
+ save->crtc_offset_cntl = 0;
+
+ save->crtc_pitch = ((pScrn->displayWidth * pScrn->bitsPerPixel) +
+ ((pScrn->bitsPerPixel * 8) -1)) /
+ (pScrn->bitsPerPixel * 8);
+ save->crtc_pitch |= save->crtc_pitch << 16;
+
+ RADEONTRACE(("Pitch = %d bytes (virtualX = %d, displayWidth = %d)\n",
+ save->crtc_pitch, pScrn->virtualX,
+ info->CurrentLayout.displayWidth));
+ return TRUE;
+}
+
+#ifdef ENABLE_FLAT_PANEL
+/* Note: Radeon flat panel support has been disabled for now */
+/* Define CRTC registers for requested video mode. */
+static void RADEONInitFPRegisters(ScrnInfoPtr pScrn, RADEONSavePtr orig,
+ RADEONSavePtr save, DisplayModePtr mode,
+ RADEONInfoPtr info)
+{
+ int xres = mode->CrtcHDisplay;
+ int yres = mode->CrtcVDisplay;
+ float Hratio, Vratio;
+
+ if (info->CRTOnly) {
+ save->crtc_ext_cntl |= RADEON_CRTC_CRT_ON;
+ save->crtc2_gen_cntl = 0;
+ save->fp_gen_cntl = orig->fp_gen_cntl;
+ save->fp_gen_cntl &= ~(RADEON_FP_FPON |
+ RADEON_FP_CRTC_USE_SHADOW_VEND |
+ RADEON_FP_CRTC_HORZ_DIV2_EN |
+ RADEON_FP_CRTC_HOR_CRT_DIV2_DIS |
+ RADEON_FP_USE_SHADOW_EN);
+ save->fp_gen_cntl |= (RADEON_FP_SEL_CRTC2 |
+ RADEON_FP_CRTC_DONT_SHADOW_VPAR);
+ save->fp_panel_cntl = orig->fp_panel_cntl & ~RADEON_FP_DIGON;
+ save->lvds_gen_cntl = orig->lvds_gen_cntl & ~(RADEON_LVDS_ON |
+ RADEON_LVDS_BLON);
+ return;
+ }
+
+ if (xres > info->PanelXRes) xres = info->PanelXRes;
+ if (yres > info->PanelYRes) yres = info->PanelYRes;
+
+ Hratio = (float)xres/(float)info->PanelXRes;
+ Vratio = (float)yres/(float)info->PanelYRes;
+
+ save->fp_horz_stretch =
+ (((((int)(Hratio * RADEON_HORZ_STRETCH_RATIO_MAX + 0.5))
+ & RADEON_HORZ_STRETCH_RATIO_MASK)
+ << RADEON_HORZ_STRETCH_RATIO_SHIFT) |
+ (orig->fp_horz_stretch & (RADEON_HORZ_PANEL_SIZE |
+ RADEON_HORZ_FP_LOOP_STRETCH |
+ RADEON_HORZ_STRETCH_RESERVED)));
+ save->fp_horz_stretch &= ~RADEON_HORZ_AUTO_RATIO_FIX_EN;
+ if (Hratio == 1.0) save->fp_horz_stretch &= ~(RADEON_HORZ_STRETCH_BLEND |
+ RADEON_HORZ_STRETCH_ENABLE);
+ else save->fp_horz_stretch |= (RADEON_HORZ_STRETCH_BLEND |
+ RADEON_HORZ_STRETCH_ENABLE);
+
+ save->fp_vert_stretch =
+ (((((int)(Vratio * RADEON_VERT_STRETCH_RATIO_MAX + 0.5))
+ & RADEON_VERT_STRETCH_RATIO_MASK)
+ << RADEON_VERT_STRETCH_RATIO_SHIFT) |
+ (orig->fp_vert_stretch & (RADEON_VERT_PANEL_SIZE |
+ RADEON_VERT_STRETCH_RESERVED)));
+ save->fp_vert_stretch &= ~RADEON_VERT_AUTO_RATIO_EN;
+ if (Vratio == 1.0) save->fp_vert_stretch &= ~(RADEON_VERT_STRETCH_ENABLE |
+ RADEON_VERT_STRETCH_BLEND);
+ else save->fp_vert_stretch |= (RADEON_VERT_STRETCH_ENABLE |
+ RADEON_VERT_STRETCH_BLEND);
+
+ save->fp_gen_cntl = (orig->fp_gen_cntl & ~(RADEON_FP_SEL_CRTC2 |
+ RADEON_FP_CRTC_USE_SHADOW_VEND |
+ RADEON_FP_CRTC_HORZ_DIV2_EN |
+ RADEON_FP_CRTC_HOR_CRT_DIV2_DIS |
+ RADEON_FP_USE_SHADOW_EN));
+ if (orig->fp_gen_cntl & RADEON_FP_DETECT_SENSE) {
+ save->fp_gen_cntl |= (RADEON_FP_CRTC_DONT_SHADOW_VPAR |
+ RADEON_FP_TDMS_EN);
+ }
+
+ save->fp_panel_cntl = orig->fp_panel_cntl;
+ save->lvds_gen_cntl = orig->lvds_gen_cntl;
+
+ save->tmds_crc = orig->tmds_crc;
+
+ /* Disable CRT output by disabling CRT output and setting the CRT
+ DAC to use CRTC2, which we set to 0's. In the future, we will
+ want to use the dual CRTC capabilities of the RADEON to allow both
+ the flat panel and external CRT to either simultaneously display
+ the same image or display two different images. */
+ save->crtc_ext_cntl &= ~RADEON_CRTC_CRT_ON;
+ save->dac_cntl |= RADEON_DAC_CRT_SEL_CRTC2;
+ save->crtc2_gen_cntl = 0;
+
+ /* WARNING: Be careful about turning on the flat panel */
+#if 1
+ save->lvds_gen_cntl |= (RADEON_LVDS_ON | RADEON_LVDS_BLON);
+#else
+ save->fp_panel_cntl |= (RADEON_FP_DIGON | RADEON_FP_BLON);
+ save->fp_gen_cntl |= (RADEON_FP_FPON);
+#endif
+
+ save->fp_crtc_h_total_disp = save->crtc_h_total_disp;
+ save->fp_crtc_v_total_disp = save->crtc_v_total_disp;
+ save->fp_h_sync_strt_wid = save->crtc_h_sync_strt_wid;
+ save->fp_v_sync_strt_wid = save->crtc_v_sync_strt_wid;
+}
+#endif
+
+/* Define PLL registers for requested video mode. */
+static void RADEONInitPLLRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save,
+ DisplayModePtr mode, RADEONPLLPtr pll,
+ double dot_clock)
+{
+ int freq = dot_clock * 100;
+ struct {
+ int divider;
+ int bitvalue;
+ } *post_div,
+ post_divs[] = {
+ /* From RAGE 128 VR/RAGE 128 GL Register
+ Reference Manual (Technical Reference
+ Manual P/N RRG-G04100-C Rev. 0.04), page
+ 3-17 (PLL_DIV_[3:0]). */
+ { 1, 0 }, /* VCLK_SRC */
+ { 2, 1 }, /* VCLK_SRC/2 */
+ { 4, 2 }, /* VCLK_SRC/4 */
+ { 8, 3 }, /* VCLK_SRC/8 */
+ { 3, 4 }, /* VCLK_SRC/3 */
+ { 16, 5 }, /* VCLK_SRC/16 */
+ { 6, 6 }, /* VCLK_SRC/6 */
+ { 12, 7 }, /* VCLK_SRC/12 */
+ { 0, 0 }
+ };
+
+ if (freq > pll->max_pll_freq) freq = pll->max_pll_freq;
+ if (freq * 12 < pll->min_pll_freq) freq = pll->min_pll_freq / 12;
+
+ for (post_div = &post_divs[0]; post_div->divider; ++post_div) {
+ save->pll_output_freq = post_div->divider * freq;
+ if (save->pll_output_freq >= pll->min_pll_freq
+ && save->pll_output_freq <= pll->max_pll_freq) break;
+ }
+
+ save->dot_clock_freq = freq;
+ save->feedback_div = RADEONDiv(pll->reference_div
+ * save->pll_output_freq,
+ pll->reference_freq);
+ save->post_div = post_div->divider;
+
+ RADEONTRACE(("dc=%d, of=%d, fd=%d, pd=%d\n",
+ save->dot_clock_freq,
+ save->pll_output_freq,
+ save->feedback_div,
+ save->post_div));
+
+ save->ppll_ref_div = pll->reference_div;
+ save->ppll_div_3 = (save->feedback_div | (post_div->bitvalue << 16));
+ save->htotal_cntl = 0;
+}
+
+/* Define DDA registers for requested video mode. */
+static Bool RADEONInitDDARegisters(ScrnInfoPtr pScrn, RADEONSavePtr save,
+ DisplayModePtr mode, RADEONPLLPtr pll,
+ RADEONInfoPtr info)
+{
+ int DisplayFifoWidth = 128;
+ int DisplayFifoDepth = 32;
+ int XclkFreq;
+ int VclkFreq;
+ int XclksPerTransfer;
+ int XclksPerTransferPrecise;
+ int UseablePrecision;
+ int Roff;
+ int Ron;
+
+ XclkFreq = pll->xclk;
+
+ VclkFreq = RADEONDiv(pll->reference_freq * save->feedback_div,
+ pll->reference_div * save->post_div);
+
+ XclksPerTransfer = RADEONDiv(XclkFreq * DisplayFifoWidth,
+ VclkFreq *
+ (info->CurrentLayout.pixel_bytes * 8));
+
+ UseablePrecision = RADEONMinBits(XclksPerTransfer) + 1;
+
+ XclksPerTransferPrecise = RADEONDiv((XclkFreq * DisplayFifoWidth)
+ << (11 - UseablePrecision),
+ VclkFreq *
+ (info->CurrentLayout.pixel_bytes * 8));
+
+ Roff = XclksPerTransferPrecise * (DisplayFifoDepth - 4);
+
+ Ron = (4 * info->ram->MB
+ + 3 * MAX(info->ram->Trcd - 2, 0)
+ + 2 * info->ram->Trp
+ + info->ram->Twr
+ + info->ram->CL
+ + info->ram->Tr2w
+ + XclksPerTransfer) << (11 - UseablePrecision);
+
+ if (Ron + info->ram->Rloop >= Roff) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "(Ron = %d) + (Rloop = %d) >= (Roff = %d)\n",
+ Ron, info->ram->Rloop, Roff);
+ return FALSE;
+ }
+
+ save->dda_config = (XclksPerTransferPrecise
+ | (UseablePrecision << 16)
+ | (info->ram->Rloop << 20));
+
+ save->dda_on_off = (Ron << 16) | Roff;
+
+ RADEONTRACE(("XclkFreq = %d; VclkFreq = %d; per = %d, %d (useable = %d)\n",
+ XclkFreq,
+ VclkFreq,
+ XclksPerTransfer,
+ XclksPerTransferPrecise,
+ UseablePrecision));
+ RADEONTRACE(("Roff = %d, Ron = %d, Rloop = %d\n",
+ Roff, Ron, info->ram->Rloop));
+
+ return TRUE;
+}
+
+
+/* Define initial palette for requested video mode. This doesn't do
+ anything for XFree86 4.0. */
+static void RADEONInitPalette(RADEONSavePtr save, RADEONInfoPtr info)
+{
+ save->palette_valid = FALSE;
+}
+
+/* Define registers for a requested video mode. */
+static Bool RADEONInit(ScrnInfoPtr pScrn, DisplayModePtr mode,
+ RADEONSavePtr save)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ double dot_clock = mode->Clock/1000.0;
+
+#if RADEON_DEBUG
+ ErrorF("%-12.12s %7.2f %4d %4d %4d %4d %4d %4d %4d %4d (%d,%d)",
+ mode->name,
+ dot_clock,
+
+ mode->HDisplay,
+ mode->HSyncStart,
+ mode->HSyncEnd,
+ mode->HTotal,
+
+ mode->VDisplay,
+ mode->VSyncStart,
+ mode->VSyncEnd,
+ mode->VTotal,
+ pScrn->depth,
+ pScrn->bitsPerPixel);
+ if (mode->Flags & V_DBLSCAN) ErrorF(" D");
+ if (mode->Flags & V_INTERLACE) ErrorF(" I");
+ if (mode->Flags & V_PHSYNC) ErrorF(" +H");
+ if (mode->Flags & V_NHSYNC) ErrorF(" -H");
+ if (mode->Flags & V_PVSYNC) ErrorF(" +V");
+ if (mode->Flags & V_NVSYNC) ErrorF(" -V");
+ ErrorF("\n");
+ ErrorF("%-12.12s %7.2f %4d %4d %4d %4d %4d %4d %4d %4d (%d,%d)",
+ mode->name,
+ dot_clock,
+
+ mode->CrtcHDisplay,
+ mode->CrtcHSyncStart,
+ mode->CrtcHSyncEnd,
+ mode->CrtcHTotal,
+
+ mode->CrtcVDisplay,
+ mode->CrtcVSyncStart,
+ mode->CrtcVSyncEnd,
+ mode->CrtcVTotal,
+ pScrn->depth,
+ pScrn->bitsPerPixel);
+ if (mode->Flags & V_DBLSCAN) ErrorF(" D");
+ if (mode->Flags & V_INTERLACE) ErrorF(" I");
+ if (mode->Flags & V_PHSYNC) ErrorF(" +H");
+ if (mode->Flags & V_NHSYNC) ErrorF(" -H");
+ if (mode->Flags & V_PVSYNC) ErrorF(" +V");
+ if (mode->Flags & V_NVSYNC) ErrorF(" -V");
+ ErrorF("\n");
+#endif
+
+ info->Flags = mode->Flags;
+
+ RADEONInitCommonRegisters(save, mode, info);
+ if (!RADEONInitCrtcRegisters(pScrn, save, mode, info)) return FALSE;
+#ifdef ENABLE_FLAT_PANEL
+ /* Note: Radeon flat panel support has been disabled for now */
+ if (info->HasPanelRegs)
+ RADEONInitFPRegisters(pScrn, &info->SavedReg, save, mode, info);
+#endif
+ RADEONInitPLLRegisters(pScrn, save, mode, &info->pll, dot_clock);
+ if (!RADEONInitDDARegisters(pScrn, save, mode, &info->pll, info))
+ return FALSE;
+ if (!info->PaletteSavedOnVT) RADEONInitPalette(save, info);
+
+ RADEONTRACE(("RADEONInit returns %p\n", save));
+ return TRUE;
+}
+
+/* Initialize a new mode. */
+static Bool RADEONModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+ if (!RADEONInit(pScrn, mode, &info->ModeReg)) return FALSE;
+ /* FIXME? DRILock/DRIUnlock here? */
+ pScrn->vtSema = TRUE;
+ RADEONBlank(pScrn);
+ RADEONRestoreMode(pScrn, &info->ModeReg);
+ RADEONUnblank(pScrn);
+
+ info->CurrentLayout.mode = mode;
+
+ return TRUE;
+}
+
+static Bool RADEONSaveScreen(ScreenPtr pScreen, int mode)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ Bool unblank;
+
+ unblank = xf86IsUnblank(mode);
+ if (unblank)
+ SetTimeSinceLastInputEvent();
+
+ if ((pScrn != NULL) && pScrn->vtSema) {
+ if (unblank)
+ RADEONUnblank(pScrn);
+ else
+ RADEONBlank(pScrn);
+ }
+ return TRUE;
+}
+
+Bool RADEONSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
+{
+ return RADEONModeInit(xf86Screens[scrnIndex], mode);
+}
+
+/* Used to disallow modes that are not supported by the hardware. */
+static int RADEONValidMode(int scrnIndex, DisplayModePtr mode,
+ Bool verbose, int flag)
+{
+#ifdef ENABLE_FLAT_PANEL
+ /* Note: Radeon flat panel support has been disabled for now */
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+ if (info->HasPanelRegs) {
+ if (mode->Flags & V_INTERLACE) return MODE_NO_INTERLACE;
+ if (mode->Flags & V_DBLSCAN) return MODE_NO_DBLESCAN;
+ }
+
+ if (info->HasPanelRegs && !info->CRTOnly && info->VBIOS) {
+ int i;
+ for (i = info->FPBIOSstart+64; RADEON_BIOS16(i) != 0; i += 2) {
+ int j = RADEON_BIOS16(i);
+
+ if (mode->CrtcHDisplay == RADEON_BIOS16(j) &&
+ mode->CrtcVDisplay == RADEON_BIOS16(j+2)) {
+ /* Assume we are using expanded mode */
+ if (RADEON_BIOS16(j+5)) j = RADEON_BIOS16(j+5);
+ else j += 9;
+
+ mode->Clock = (CARD32)RADEON_BIOS16(j) * 10;
+
+ mode->HDisplay = mode->CrtcHDisplay =
+ ((RADEON_BIOS16(j+10) & 0x01ff)+1)*8;
+ mode->HSyncStart = mode->CrtcHSyncStart =
+ ((RADEON_BIOS16(j+12) & 0x01ff)+1)*8;
+ mode->HSyncEnd = mode->CrtcHSyncEnd =
+ mode->CrtcHSyncStart + (RADEON_BIOS8(j+14) & 0x1f);
+ mode->HTotal = mode->CrtcHTotal =
+ ((RADEON_BIOS16(j+8) & 0x01ff)+1)*8;
+
+ mode->VDisplay = mode->CrtcVDisplay =
+ (RADEON_BIOS16(j+17) & 0x07ff)+1;
+ mode->VSyncStart = mode->CrtcVSyncStart =
+ (RADEON_BIOS16(j+19) & 0x07ff)+1;
+ mode->VSyncEnd = mode->CrtcVSyncEnd =
+ mode->CrtcVSyncStart + ((RADEON_BIOS16(j+19) >> 11)&0x1f);
+ mode->VTotal = mode->CrtcVTotal =
+ (RADEON_BIOS16(j+15) & 0x07ff)+1;
+
+ return MODE_OK;
+ }
+ }
+ return MODE_NOMODE;
+ }
+#endif
+
+ return MODE_OK;
+}
+
+/* Adjust viewport into virtual desktop such that (0,0) in viewport space
+ is (x,y) in virtual space. */
+void RADEONAdjustFrame(int scrnIndex, int x, int y, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+ int Base;
+
+ Base = y * info->CurrentLayout.displayWidth + x;
+
+ switch (info->CurrentLayout.pixel_code) {
+ case 15:
+ case 16: Base *= 2; break;
+ case 24: Base *= 3; break;
+ case 32: Base *= 4; break;
+ }
+
+ Base &= ~7; /* 3 lower bits are always 0 */
+
+ if (info->CurrentLayout.pixel_code == 24)
+ Base += 8 * (Base % 3); /* Must be multiple of 8 and 3 */
+
+ OUTREG(RADEON_CRTC_OFFSET, Base);
+}
+
+/* Called when VT switching back to the X server. Reinitialize the video
+ mode. */
+static Bool RADEONEnterVT(int scrnIndex, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+ RADEONTRACE(("RADEONEnterVT\n"));
+#ifdef XF86DRI
+ if (RADEONPTR(pScrn)->directRenderingEnabled) {
+ RADEONCPStart(pScrn);
+ DRIUnlock(pScrn->pScreen);
+ }
+#endif
+ if (!RADEONModeInit(pScrn, pScrn->currentMode)) return FALSE;
+ if (info->accelOn)
+ RADEONEngineInit(pScrn);
+
+ info->PaletteSavedOnVT = FALSE;
+ RADEONAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+
+ return TRUE;
+}
+
+/* Called when VT switching away from the X server. Restore the original
+ text mode. */
+static void RADEONLeaveVT(int scrnIndex, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ RADEONSavePtr save = &info->ModeReg;
+
+ RADEONTRACE(("RADEONLeaveVT\n"));
+#ifdef XF86DRI
+ if (RADEONPTR(pScrn)->directRenderingEnabled) {
+ DRILock(pScrn->pScreen, 0);
+ RADEONCPStop(pScrn);
+ }
+#endif
+ RADEONSavePalette(pScrn, save);
+ info->PaletteSavedOnVT = TRUE;
+ RADEONRestore(pScrn);
+}
+
+static Bool
+RADEONEnterVTFBDev(int scrnIndex, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ RADEONSavePtr restore = &info->SavedReg;
+ fbdevHWEnterVT(scrnIndex,flags);
+ RADEONRestorePalette(pScrn,restore);
+ RADEONEngineInit(pScrn);
+ return TRUE;
+}
+
+static void RADEONLeaveVTFBDev(int scrnIndex, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ RADEONSavePtr save = &info->SavedReg;
+ RADEONSavePalette(pScrn,save);
+ fbdevHWLeaveVT(scrnIndex,flags);
+}
+
+/* Called at the end of each server generation. Restore the original text
+ mode, unmap video memory, and unwrap and call the saved CloseScreen
+ function. */
+static Bool RADEONCloseScreen(int scrnIndex, ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+ RADEONTRACE(("RADEONCloseScreen\n"));
+
+#ifdef XF86DRI
+ /* Disable direct rendering */
+ if (info->directRenderingEnabled) {
+ RADEONDRICloseScreen(pScreen);
+ info->directRenderingEnabled = FALSE;
+ }
+#endif
+
+ if (pScrn->vtSema) {
+ RADEONRestore(pScrn);
+ RADEONUnmapMem(pScrn);
+ }
+
+ if (info->accel) XAADestroyInfoRec(info->accel);
+ info->accel = NULL;
+
+ if (info->scratch_buffer[0]) xfree(info->scratch_buffer[0]);
+ info->scratch_buffer[0] = NULL;
+
+ if (info->cursor) xf86DestroyCursorInfoRec(info->cursor);
+ info->cursor = NULL;
+
+ if (info->DGAModes) xfree(info->DGAModes);
+ info->DGAModes = NULL;
+
+ pScrn->vtSema = FALSE;
+
+ pScreen->CloseScreen = info->CloseScreen;
+ return (*pScreen->CloseScreen)(scrnIndex, pScreen);
+}
+
+static void RADEONFreeScreen(int scrnIndex, int flags)
+{
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+
+ RADEONTRACE(("RADEONFreeScreen\n"));
+ if (xf86LoaderCheckSymbol("vgaHWFreeHWRec"))
+ vgaHWFreeHWRec(pScrn);
+ RADEONFreeRec(pScrn);
+}
+
+#ifdef DPMSExtension
+/* Sets VESA Display Power Management Signaling (DPMS) Mode. */
+static void RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn,
+ int PowerManagementMode, int flags)
+{
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+ unsigned char *RADEONMMIO = info->MMIO;
+ int mask = (RADEON_CRTC_DISPLAY_DIS
+ | RADEON_CRTC_HSYNC_DIS
+ | RADEON_CRTC_VSYNC_DIS);
+
+ switch (PowerManagementMode) {
+ case DPMSModeOn:
+ /* Screen: On; HSync: On, VSync: On */
+ OUTREGP(RADEON_CRTC_EXT_CNTL, 0, ~mask);
+ break;
+ case DPMSModeStandby:
+ /* Screen: Off; HSync: Off, VSync: On */
+ OUTREGP(RADEON_CRTC_EXT_CNTL,
+ RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_HSYNC_DIS, ~mask);
+ break;
+ case DPMSModeSuspend:
+ /* Screen: Off; HSync: On, VSync: Off */
+ OUTREGP(RADEON_CRTC_EXT_CNTL,
+ RADEON_CRTC_DISPLAY_DIS | RADEON_CRTC_VSYNC_DIS, ~mask);
+ break;
+ case DPMSModeOff:
+ /* Screen: Off; HSync: Off, VSync: Off */
+ OUTREGP(RADEON_CRTC_EXT_CNTL, mask, ~mask);
+ break;
+ }
+}
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_probe.h b/xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_probe.h
new file mode 100644
index 000000000..7bf660aa2
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_probe.h
@@ -0,0 +1,42 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_probe.h,v 1.2 2000/10/23 21:16:49 tsi Exp $ */
+/**************************************************************************
+
+Copyright 2000 ATI Technologies Inc. and VA Linux Systems, Inc.,
+ Sunnyvale, California.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+on the rights to use, copy, modify, merge, publish, distribute, sub
+license, and/or sell copies of the Software, and to permit persons to whom
+the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <martin@valinux.com>
+ *
+ */
+
+#ifndef _RADEON_PROBE_H_
+#define _RADEON_PROBE_H_
+
+extern OptionInfoPtr RADEONAvailableOptions(int chipid, int busid);
+extern void RADEONIdentify(int flags);
+extern Bool RADEONProbe(DriverPtr drv, int flags);
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_reg.h b/xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_reg.h
new file mode 100644
index 000000000..86a73bec7
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_reg.h
@@ -0,0 +1,1477 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/r128/radeon_reg.h,v 1.2 2000/10/18 18:54:04 alanh Exp $ */
+/**************************************************************************
+
+Copyright 2000 ATI Technologies Inc. and VA Linux Systems, Inc.,
+ Sunnyvale, California.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+on the rights to use, copy, modify, merge, publish, distribute, sub
+license, and/or sell copies of the Software, and to permit persons to whom
+the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ATI, VA LINUX SYSTEMS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <martin@valinux.com>
+ * Rickard E. Faith <faith@valinux.com>
+ *
+ * References:
+ *
+ * !!!! FIXME !!!!
+ * RAGE 128 VR/ RAGE 128 GL Register Reference Manual (Technical
+ * Reference Manual P/N RRG-G04100-C Rev. 0.04), ATI Technologies: April
+ * 1999.
+ *
+ * !!!! FIXME !!!!
+ * RAGE 128 Software Development Manual (Technical Reference Manual P/N
+ * SDK-G04000 Rev. 0.01), ATI Technologies: June 1999.
+ *
+ */
+
+/* !!!! FIXME !!!! NOTE: THIS FILE HAS BEEN CONVERTED FROM r128_reg.h
+ * AND CONTAINS REGISTERS AND REGISTER DEFINITIONS THAT ARE NOT CORRECT
+ * ON THE RADEON. A FULL AUDIT OF THIS CODE IS NEEDED! */
+
+#ifndef _RADEON_REG_H_
+#define _RADEON_REG_H_
+#include <compiler.h>
+
+ /* Memory mapped register access macros */
+#define INREG8(addr) MMIO_IN8(RADEONMMIO, addr)
+#define INREG16(addr) MMIO_IN16(RADEONMMIO, addr)
+#define INREG(addr) MMIO_IN32(RADEONMMIO, addr)
+#define OUTREG8(addr, val) MMIO_OUT8(RADEONMMIO, addr, val)
+#define OUTREG16(addr, val) MMIO_OUT16(RADEONMMIO, addr, val)
+#define OUTREG(addr, val) MMIO_OUT32(RADEONMMIO, addr, val)
+
+#define ADDRREG(addr) ((volatile CARD32 *)(RADEONMMIO + (addr)))
+
+
+#define OUTREGP(addr, val, mask) \
+ do { \
+ CARD32 tmp = INREG(addr); \
+ tmp &= (mask); \
+ tmp |= (val); \
+ OUTREG(addr, tmp); \
+ } while (0)
+
+#define INPLL(pScrn, addr) RADEONINPLL(pScrn, addr)
+
+#if !RADEON_ATOMIC_UPDATE
+#define OUTPLL(addr, val) \
+ do { \
+ while ( (INREG(RADEON_CLOCK_CNTL_INDEX) & 0x9f) != \
+ (addr | RADEON_PLL_WR_EN)) { \
+ OUTREG8(RADEON_CLOCK_CNTL_INDEX, (((addr) & 0x1f) | \
+ RADEON_PLL_WR_EN)); \
+ } \
+ OUTREG(RADEON_CLOCK_CNTL_DATA, val); \
+ } while (0)
+#else
+#define OUTPLL(addr, val) \
+ do { \
+ OUTREG8(RADEON_CLOCK_CNTL_INDEX, (((addr) & 0x1f) | \
+ RADEON_PLL_WR_EN)); \
+ OUTREG(RADEON_CLOCK_CNTL_DATA, val); \
+ } while (0)
+#endif
+
+#define OUTPLLP(pScrn, addr, val, mask) \
+ do { \
+ CARD32 tmp = INPLL(pScrn, addr); \
+ tmp &= (mask); \
+ tmp |= (val); \
+ OUTPLL(addr, tmp); \
+ } while (0)
+
+#define OUTPAL_START(idx) \
+ do { \
+ OUTREG8(RADEON_PALETTE_INDEX, (idx)); \
+ } while (0)
+
+#define OUTPAL_NEXT(r, g, b) \
+ do { \
+ OUTREG(RADEON_PALETTE_DATA, ((r) << 16) | ((g) << 8) | (b)); \
+ } while (0)
+
+#define OUTPAL_NEXT_CARD32(v) \
+ do { \
+ OUTREG(RADEON_PALETTE_DATA, (v & 0x00ffffff)); \
+ } while (0)
+
+#define OUTPAL(idx, r, g, b) \
+ do { \
+ OUTPAL_START((idx)); \
+ OUTPAL_NEXT((r), (g), (b)); \
+ } while (0)
+
+#define INPAL_START(idx) \
+ do { \
+ OUTREG(RADEON_PALETTE_INDEX, (idx) << 16); \
+ } while (0)
+
+#define INPAL_NEXT() INREG(RADEON_PALETTE_DATA)
+
+#define PAL_SELECT(idx) \
+ do { \
+ if (idx) { \
+ OUTREG(RADEON_DAC_CNTL, INREG(RADEON_DAC_CNTL) | \
+ RADEON_DAC_PALETTE_ACC_CTL); \
+ } else { \
+ OUTREG(RADEON_DAC_CNTL, INREG(RADEON_DAC_CNTL) & \
+ ~RADEON_DAC_PALETTE_ACC_CTL); \
+ } \
+ } while (0)
+
+#define RADEON_ADAPTER_ID 0x0f2c /* PCI */
+#define RADEON_AGP_BASE 0x0170
+#define RADEON_AGP_CNTL 0x0174
+# define RADEON_AGP_APER_SIZE_256MB (0x00 << 0)
+# define RADEON_AGP_APER_SIZE_128MB (0x20 << 0)
+# define RADEON_AGP_APER_SIZE_64MB (0x30 << 0)
+# define RADEON_AGP_APER_SIZE_32MB (0x38 << 0)
+# define RADEON_AGP_APER_SIZE_16MB (0x3c << 0)
+# define RADEON_AGP_APER_SIZE_8MB (0x3e << 0)
+# define RADEON_AGP_APER_SIZE_4MB (0x3f << 0)
+# define RADEON_AGP_APER_SIZE_MASK (0x3f << 0)
+#define RADEON_AGP_COMMAND 0x0f60 /* PCI */
+#define RADEON_AGP_PLL_CNTL 0x000b /* PLL */
+#define RADEON_AGP_STATUS 0x0f5c /* PCI */
+# define RADEON_AGP_1X_MODE 0x01
+# define RADEON_AGP_2X_MODE 0x02
+# define RADEON_AGP_4X_MODE 0x04
+# define RADEON_AGP_MODE_MASK 0x07
+#define RADEON_AMCGPIO_A_REG 0x01a0
+#define RADEON_AMCGPIO_EN_REG 0x01a8
+#define RADEON_AMCGPIO_MASK 0x0194
+#define RADEON_AMCGPIO_Y_REG 0x01a4
+#define RADEON_ATTRDR 0x03c1 /* VGA */
+#define RADEON_ATTRDW 0x03c0 /* VGA */
+#define RADEON_ATTRX 0x03c0 /* VGA */
+# define RADEON_AUX1_SC_EN (1 << 0)
+# define RADEON_AUX1_SC_MODE_OR (0 << 1)
+# define RADEON_AUX1_SC_MODE_NAND (1 << 1)
+# define RADEON_AUX2_SC_EN (1 << 2)
+# define RADEON_AUX2_SC_MODE_OR (0 << 3)
+# define RADEON_AUX2_SC_MODE_NAND (1 << 3)
+# define RADEON_AUX3_SC_EN (1 << 4)
+# define RADEON_AUX3_SC_MODE_OR (0 << 5)
+# define RADEON_AUX3_SC_MODE_NAND (1 << 5)
+#define RADEON_AUX_SC_CNTL 0x1660
+#define RADEON_AUX1_SC_BOTTOM 0x1670
+#define RADEON_AUX1_SC_LEFT 0x1664
+#define RADEON_AUX1_SC_RIGHT 0x1668
+#define RADEON_AUX1_SC_TOP 0x166c
+#define RADEON_AUX2_SC_BOTTOM 0x1680
+#define RADEON_AUX2_SC_LEFT 0x1674
+#define RADEON_AUX2_SC_RIGHT 0x1678
+#define RADEON_AUX2_SC_TOP 0x167c
+#define RADEON_AUX3_SC_BOTTOM 0x1690
+#define RADEON_AUX3_SC_LEFT 0x1684
+#define RADEON_AUX3_SC_RIGHT 0x1688
+#define RADEON_AUX3_SC_TOP 0x168c
+#define RADEON_AUX_WINDOW_HORZ_CNTL 0x02d8
+#define RADEON_AUX_WINDOW_VERT_CNTL 0x02dc
+
+#define RADEON_BASE_CODE 0x0f0b
+#define RADEON_BIOS_0_SCRATCH 0x0010
+#define RADEON_BIOS_1_SCRATCH 0x0014
+#define RADEON_BIOS_2_SCRATCH 0x0018
+#define RADEON_BIOS_3_SCRATCH 0x001c
+#define RADEON_BIOS_ROM 0x0f30 /* PCI */
+#define RADEON_BIST 0x0f0f /* PCI */
+#define RADEON_BRUSH_DATA0 0x1480
+#define RADEON_BRUSH_DATA1 0x1484
+#define RADEON_BRUSH_DATA10 0x14a8
+#define RADEON_BRUSH_DATA11 0x14ac
+#define RADEON_BRUSH_DATA12 0x14b0
+#define RADEON_BRUSH_DATA13 0x14b4
+#define RADEON_BRUSH_DATA14 0x14b8
+#define RADEON_BRUSH_DATA15 0x14bc
+#define RADEON_BRUSH_DATA16 0x14c0
+#define RADEON_BRUSH_DATA17 0x14c4
+#define RADEON_BRUSH_DATA18 0x14c8
+#define RADEON_BRUSH_DATA19 0x14cc
+#define RADEON_BRUSH_DATA2 0x1488
+#define RADEON_BRUSH_DATA20 0x14d0
+#define RADEON_BRUSH_DATA21 0x14d4
+#define RADEON_BRUSH_DATA22 0x14d8
+#define RADEON_BRUSH_DATA23 0x14dc
+#define RADEON_BRUSH_DATA24 0x14e0
+#define RADEON_BRUSH_DATA25 0x14e4
+#define RADEON_BRUSH_DATA26 0x14e8
+#define RADEON_BRUSH_DATA27 0x14ec
+#define RADEON_BRUSH_DATA28 0x14f0
+#define RADEON_BRUSH_DATA29 0x14f4
+#define RADEON_BRUSH_DATA3 0x148c
+#define RADEON_BRUSH_DATA30 0x14f8
+#define RADEON_BRUSH_DATA31 0x14fc
+#define RADEON_BRUSH_DATA32 0x1500
+#define RADEON_BRUSH_DATA33 0x1504
+#define RADEON_BRUSH_DATA34 0x1508
+#define RADEON_BRUSH_DATA35 0x150c
+#define RADEON_BRUSH_DATA36 0x1510
+#define RADEON_BRUSH_DATA37 0x1514
+#define RADEON_BRUSH_DATA38 0x1518
+#define RADEON_BRUSH_DATA39 0x151c
+#define RADEON_BRUSH_DATA4 0x1490
+#define RADEON_BRUSH_DATA40 0x1520
+#define RADEON_BRUSH_DATA41 0x1524
+#define RADEON_BRUSH_DATA42 0x1528
+#define RADEON_BRUSH_DATA43 0x152c
+#define RADEON_BRUSH_DATA44 0x1530
+#define RADEON_BRUSH_DATA45 0x1534
+#define RADEON_BRUSH_DATA46 0x1538
+#define RADEON_BRUSH_DATA47 0x153c
+#define RADEON_BRUSH_DATA48 0x1540
+#define RADEON_BRUSH_DATA49 0x1544
+#define RADEON_BRUSH_DATA5 0x1494
+#define RADEON_BRUSH_DATA50 0x1548
+#define RADEON_BRUSH_DATA51 0x154c
+#define RADEON_BRUSH_DATA52 0x1550
+#define RADEON_BRUSH_DATA53 0x1554
+#define RADEON_BRUSH_DATA54 0x1558
+#define RADEON_BRUSH_DATA55 0x155c
+#define RADEON_BRUSH_DATA56 0x1560
+#define RADEON_BRUSH_DATA57 0x1564
+#define RADEON_BRUSH_DATA58 0x1568
+#define RADEON_BRUSH_DATA59 0x156c
+#define RADEON_BRUSH_DATA6 0x1498
+#define RADEON_BRUSH_DATA60 0x1570
+#define RADEON_BRUSH_DATA61 0x1574
+#define RADEON_BRUSH_DATA62 0x1578
+#define RADEON_BRUSH_DATA63 0x157c
+#define RADEON_BRUSH_DATA7 0x149c
+#define RADEON_BRUSH_DATA8 0x14a0
+#define RADEON_BRUSH_DATA9 0x14a4
+#define RADEON_BRUSH_SCALE 0x1470
+#define RADEON_BRUSH_Y_X 0x1474
+#define RADEON_BUS_CNTL 0x0030
+# define RADEON_BUS_MASTER_DIS (1 << 6)
+# define RADEON_BUS_RD_DISCARD_EN (1 << 24)
+# define RADEON_BUS_RD_ABORT_EN (1 << 25)
+# define RADEON_BUS_MSTR_DISCONNECT_EN (1 << 28)
+# define RADEON_BUS_WRT_BURST (1 << 29)
+# define RADEON_BUS_READ_BURST (1 << 30)
+#define RADEON_BUS_CNTL1 0x0034
+# define RADEON_BUS_WAIT_ON_LOCK_EN (1 << 4)
+
+#define RADEON_CACHE_CNTL 0x1724
+#define RADEON_CACHE_LINE 0x0f0c /* PCI */
+#define RADEON_CAP0_TRIG_CNTL 0x0950 /* ? */
+#define RADEON_CAP1_TRIG_CNTL 0x09c0 /* ? */
+#define RADEON_CAPABILITIES_ID 0x0f50 /* PCI */
+#define RADEON_CAPABILITIES_PTR 0x0f34 /* PCI */
+#define RADEON_CLK_PIN_CNTL 0x0001 /* PLL */
+#define RADEON_CLOCK_CNTL_DATA 0x000c
+#define RADEON_CLOCK_CNTL_INDEX 0x0008
+# define RADEON_PLL_WR_EN (1 << 7)
+# define RADEON_PLL_DIV_SEL (3 << 8)
+#define RADEON_CLR_CMP_CLR_3D 0x1a24
+#define RADEON_CLR_CMP_CLR_DST 0x15c8
+#define RADEON_CLR_CMP_CLR_SRC 0x15c4
+#define RADEON_CLR_CMP_CNTL 0x15c0
+# define RADEON_SRC_CMP_EQ_COLOR (4 << 0)
+# define RADEON_SRC_CMP_NEQ_COLOR (5 << 0)
+# define RADEON_CLR_CMP_SRC_SOURCE (1 << 24)
+#define RADEON_CLR_CMP_MASK 0x15cc
+# define RADEON_CLR_CMP_MSK 0xffffffff
+#define RADEON_CLR_CMP_MASK_3D 0x1A28
+#define RADEON_COMMAND 0x0f04 /* PCI */
+#define RADEON_COMPOSITE_SHADOW_ID 0x1a0c
+#define RADEON_CONFIG_APER_0_BASE 0x0100
+#define RADEON_CONFIG_APER_1_BASE 0x0104
+#define RADEON_CONFIG_APER_SIZE 0x0108
+#define RADEON_CONFIG_BONDS 0x00e8
+#define RADEON_CONFIG_CNTL 0x00e0
+#define RADEON_CONFIG_MEMSIZE 0x00f8
+#define RADEON_CONFIG_MEMSIZE_EMBEDDED 0x0114
+#define RADEON_CONFIG_REG_1_BASE 0x010c
+#define RADEON_CONFIG_REG_APER_SIZE 0x0110
+#define RADEON_CONFIG_XSTRAP 0x00e4
+#define RADEON_CONSTANT_COLOR_C 0x1d34
+# define RADEON_CONSTANT_COLOR_MASK 0x00ffffff
+# define RADEON_CONSTANT_COLOR_ONE 0x00ffffff
+# define RADEON_CONSTANT_COLOR_ZERO 0x00000000
+#define RADEON_CRC_CMDFIFO_ADDR 0x0740
+#define RADEON_CRC_CMDFIFO_DOUT 0x0744
+#define RADEON_CRTC_CRNT_FRAME 0x0214
+#define RADEON_CRTC_DEBUG 0x021c
+#define RADEON_CRTC_EXT_CNTL 0x0054
+# define RADEON_CRTC_VGA_XOVERSCAN (1 << 0)
+# define RADEON_VGA_ATI_LINEAR (1 << 3)
+# define RADEON_XCRT_CNT_EN (1 << 6)
+# define RADEON_CRTC_HSYNC_DIS (1 << 8)
+# define RADEON_CRTC_VSYNC_DIS (1 << 9)
+# define RADEON_CRTC_DISPLAY_DIS (1 << 10)
+# define RADEON_CRTC_CRT_ON (1 << 15)
+#define RADEON_CRTC_EXT_CNTL_DPMS_BYTE 0x0055
+# define RADEON_CRTC_HSYNC_DIS_BYTE (1 << 0)
+# define RADEON_CRTC_VSYNC_DIS_BYTE (1 << 1)
+# define RADEON_CRTC_DISPLAY_DIS_BYTE (1 << 2)
+#define RADEON_CRTC_GEN_CNTL 0x0050
+# define RADEON_CRTC_DBL_SCAN_EN (1 << 0)
+# define RADEON_CRTC_INTERLACE_EN (1 << 1)
+# define RADEON_CRTC_CSYNC_EN (1 << 4)
+# define RADEON_CRTC_CUR_EN (1 << 16)
+# define RADEON_CRTC_CUR_MODE_MASK (7 << 17)
+# define RADEON_CRTC_ICON_EN (1 << 20)
+# define RADEON_CRTC_EXT_DISP_EN (1 << 24)
+# define RADEON_CRTC_EN (1 << 25)
+# define RADEON_CRTC_DISP_REQ_EN_B (1 << 26)
+#define RADEON_CRTC_GUI_TRIG_VLINE 0x0218
+#define RADEON_CRTC_H_SYNC_STRT_WID 0x0204
+# define RADEON_CRTC_H_SYNC_STRT_PIX (0x07 << 0)
+# define RADEON_CRTC_H_SYNC_STRT_CHAR (0x1ff << 3)
+# define RADEON_CRTC_H_SYNC_STRT_CHAR_SHIFT 3
+# define RADEON_CRTC_H_SYNC_WID (0x3f << 16)
+# define RADEON_CRTC_H_SYNC_WID_SHIFT 16
+# define RADEON_CRTC_H_SYNC_POL (1 << 23)
+#define RADEON_CRTC_H_TOTAL_DISP 0x0200
+# define RADEON_CRTC_H_TOTAL (0x01ff << 0)
+# define RADEON_CRTC_H_TOTAL_SHIFT 0
+# define RADEON_CRTC_H_DISP (0x00ff << 16)
+# define RADEON_CRTC_H_DISP_SHIFT 16
+#define RADEON_CRTC_OFFSET 0x0224
+#define RADEON_CRTC_OFFSET_CNTL 0x0228
+#define RADEON_CRTC_PITCH 0x022c
+#define RADEON_CRTC_STATUS 0x005c
+# define RADEON_CRTC_VBLANK_SAVE (1 << 1)
+#define RADEON_CRTC_V_SYNC_STRT_WID 0x020c
+# define RADEON_CRTC_V_SYNC_STRT (0x7ff << 0)
+# define RADEON_CRTC_V_SYNC_STRT_SHIFT 0
+# define RADEON_CRTC_V_SYNC_WID (0x1f << 16)
+# define RADEON_CRTC_V_SYNC_WID_SHIFT 16
+# define RADEON_CRTC_V_SYNC_POL (1 << 23)
+#define RADEON_CRTC_V_TOTAL_DISP 0x0208
+# define RADEON_CRTC_V_TOTAL (0x07ff << 0)
+# define RADEON_CRTC_V_TOTAL_SHIFT 0
+# define RADEON_CRTC_V_DISP (0x07ff << 16)
+# define RADEON_CRTC_V_DISP_SHIFT 16
+#define RADEON_CRTC_VLINE_CRNT_VLINE 0x0210
+# define RADEON_CRTC_CRNT_VLINE_MASK (0x7ff << 16)
+#define RADEON_CRTC2_CRNT_FRAME 0x0314
+#define RADEON_CRTC2_DEBUG 0x031c
+#define RADEON_CRTC2_GEN_CNTL 0x03f8
+#define RADEON_CRTC2_GUI_TRIG_VLINE 0x0318
+#define RADEON_CRTC2_H_SYNC_STRT_WID 0x0304
+#define RADEON_CRTC2_H_TOTAL_DISP 0x0300
+#define RADEON_CRTC2_OFFSET 0x0324
+#define RADEON_CRTC2_OFFSET_CNTL 0x0328
+#define RADEON_CRTC2_PITCH 0x032c
+#define RADEON_CRTC2_STATUS 0x03fc
+#define RADEON_CRTC2_V_SYNC_STRT_WID 0x030c
+#define RADEON_CRTC2_V_TOTAL_DISP 0x0308
+#define RADEON_CRTC2_VLINE_CRNT_VLINE 0x0310
+#define RADEON_CRTC8_DATA 0x03d5 /* VGA, 0x3b5 */
+#define RADEON_CRTC8_IDX 0x03d4 /* VGA, 0x3b4 */
+#define RADEON_CUR_CLR0 0x026c
+#define RADEON_CUR_CLR1 0x0270
+#define RADEON_CUR_HORZ_VERT_OFF 0x0268
+#define RADEON_CUR_HORZ_VERT_POSN 0x0264
+#define RADEON_CUR_OFFSET 0x0260
+# define RADEON_CUR_LOCK (1 << 31)
+
+#define RADEON_DAC_CNTL 0x0058
+# define RADEON_DAC_RANGE_CNTL (3 << 0)
+# define RADEON_DAC_BLANKING (1 << 2)
+# define RADEON_DAC_CRT_SEL_CRTC2 (1 << 4)
+# define RADEON_DAC_PALETTE_ACC_CTL (1 << 5)
+# define RADEON_DAC_8BIT_EN (1 << 8)
+# define RADEON_DAC_VGA_ADR_EN (1 << 13)
+# define RADEON_DAC_MASK_ALL (0xff << 24)
+#define RADEON_DAC_CRC_SIG 0x02cc
+#define RADEON_DAC_DATA 0x03c9 /* VGA */
+#define RADEON_DAC_MASK 0x03c6 /* VGA */
+#define RADEON_DAC_R_INDEX 0x03c7 /* VGA */
+#define RADEON_DAC_W_INDEX 0x03c8 /* VGA */
+#define RADEON_DDA_CONFIG 0x02e0
+#define RADEON_DDA_ON_OFF 0x02e4
+#define RADEON_DEFAULT_OFFSET 0x16e0
+#define RADEON_DEFAULT_PITCH 0x16e4
+#define RADEON_DEFAULT_SC_BOTTOM_RIGHT 0x16e8
+# define RADEON_DEFAULT_SC_RIGHT_MAX (0x1fff << 0)
+# define RADEON_DEFAULT_SC_BOTTOM_MAX (0x1fff << 16)
+#define RADEON_DESTINATION_3D_CLR_CMP_VAL 0x1820
+#define RADEON_DESTINATION_3D_CLR_CMP_MSK 0x1824
+#define RADEON_DEVICE_ID 0x0f02 /* PCI */
+#define RADEON_DISP_MISC_CNTL 0x0d00
+# define RADEON_SOFT_RESET_GRPH_PP (1 << 0)
+#define RADEON_DP_BRUSH_BKGD_CLR 0x1478
+#define RADEON_DP_BRUSH_FRGD_CLR 0x147c
+#define RADEON_DP_CNTL 0x16c0
+# define RADEON_DST_X_LEFT_TO_RIGHT (1 << 0)
+# define RADEON_DST_Y_TOP_TO_BOTTOM (1 << 1)
+#define RADEON_DP_CNTL_XDIR_YDIR_YMAJOR 0x16d0
+# define RADEON_DST_Y_MAJOR (1 << 2)
+# define RADEON_DST_Y_DIR_TOP_TO_BOTTOM (1 << 15)
+# define RADEON_DST_X_DIR_LEFT_TO_RIGHT (1 << 31)
+#define RADEON_DP_DATATYPE 0x16c4
+# define RADEON_HOST_BIG_ENDIAN_EN (1 << 29)
+#define RADEON_DP_GUI_MASTER_CNTL 0x146c
+# define RADEON_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0)
+# define RADEON_GMC_DST_PITCH_OFFSET_CNTL (1 << 1)
+# define RADEON_GMC_SRC_CLIPPING (1 << 2)
+# define RADEON_GMC_DST_CLIPPING (1 << 3)
+# define RADEON_GMC_BRUSH_DATATYPE_MASK (0x0f << 4)
+# define RADEON_GMC_BRUSH_8X8_MONO_FG_BG (0 << 4)
+# define RADEON_GMC_BRUSH_8X8_MONO_FG_LA (1 << 4)
+# define RADEON_GMC_BRUSH_1X8_MONO_FG_BG (4 << 4)
+# define RADEON_GMC_BRUSH_1X8_MONO_FG_LA (5 << 4)
+# define RADEON_GMC_BRUSH_32x1_MONO_FG_BG (6 << 4)
+# define RADEON_GMC_BRUSH_32x1_MONO_FG_LA (7 << 4)
+# define RADEON_GMC_BRUSH_8x8_COLOR (10 << 4)
+# define RADEON_GMC_BRUSH_1X8_COLOR (12 << 4)
+# define RADEON_GMC_BRUSH_SOLID_COLOR (13 << 4)
+# define RADEON_GMC_BRUSH_NONE (15 << 4)
+# define RADEON_GMC_DST_8BPP_CI (2 << 8)
+# define RADEON_GMC_DST_15BPP (3 << 8)
+# define RADEON_GMC_DST_16BPP (4 << 8)
+# define RADEON_GMC_DST_24BPP (5 << 8)
+# define RADEON_GMC_DST_32BPP (6 << 8)
+# define RADEON_GMC_DST_8BPP_RGB (7 << 8)
+# define RADEON_GMC_DST_Y8 (8 << 8)
+# define RADEON_GMC_DST_RGB8 (9 << 8)
+# define RADEON_GMC_DST_VYUY (11 << 8)
+# define RADEON_GMC_DST_YVYU (12 << 8)
+# define RADEON_GMC_DST_AYUV444 (14 << 8)
+# define RADEON_GMC_DST_ARGB4444 (15 << 8)
+# define RADEON_GMC_DST_DATATYPE_MASK (0x0f << 8)
+# define RADEON_GMC_DST_DATATYPE_SHIFT 8
+# define RADEON_GMC_SRC_DATATYPE_MASK (3 << 12)
+# define RADEON_GMC_SRC_DATATYPE_MONO_FG_BG (0 << 12)
+# define RADEON_GMC_SRC_DATATYPE_MONO_FG_LA (1 << 12)
+# define RADEON_GMC_SRC_DATATYPE_COLOR (3 << 12)
+# define RADEON_GMC_BYTE_PIX_ORDER (1 << 14)
+# define RADEON_GMC_BYTE_MSB_TO_LSB (0 << 14)
+# define RADEON_GMC_BYTE_LSB_TO_MSB (1 << 14)
+# define RADEON_GMC_CONVERSION_TEMP (1 << 15)
+# define RADEON_GMC_CONVERSION_TEMP_6500 (0 << 15)
+# define RADEON_GMC_CONVERSION_TEMP_9300 (1 << 15)
+# define RADEON_GMC_ROP3_MASK (0xff << 16)
+# define RADEON_DP_SRC_SOURCE_MASK (7 << 24)
+# define RADEON_DP_SRC_SOURCE_MEMORY (2 << 24)
+# define RADEON_DP_SRC_SOURCE_HOST_DATA (3 << 24)
+# define RADEON_GMC_3D_FCN_EN (1 << 27)
+# define RADEON_GMC_CLR_CMP_CNTL_DIS (1 << 28)
+# define RADEON_GMC_AUX_CLIP_DIS (1 << 29)
+# define RADEON_GMC_WR_MSK_DIS (1 << 30)
+# define RADEON_GMC_LD_BRUSH_Y_X (1 << 31)
+# define RADEON_ROP3_ZERO 0x00000000
+# define RADEON_ROP3_DSa 0x00880000
+# define RADEON_ROP3_SDna 0x00440000
+# define RADEON_ROP3_S 0x00cc0000
+# define RADEON_ROP3_DSna 0x00220000
+# define RADEON_ROP3_D 0x00aa0000
+# define RADEON_ROP3_DSx 0x00660000
+# define RADEON_ROP3_DSo 0x00ee0000
+# define RADEON_ROP3_DSon 0x00110000
+# define RADEON_ROP3_DSxn 0x00990000
+# define RADEON_ROP3_Dn 0x00550000
+# define RADEON_ROP3_SDno 0x00dd0000
+# define RADEON_ROP3_Sn 0x00330000
+# define RADEON_ROP3_DSno 0x00bb0000
+# define RADEON_ROP3_DSan 0x00770000
+# define RADEON_ROP3_ONE 0x00ff0000
+# define RADEON_ROP3_DPa 0x00a00000
+# define RADEON_ROP3_PDna 0x00500000
+# define RADEON_ROP3_P 0x00f00000
+# define RADEON_ROP3_DPna 0x000a0000
+# define RADEON_ROP3_D 0x00aa0000
+# define RADEON_ROP3_DPx 0x005a0000
+# define RADEON_ROP3_DPo 0x00fa0000
+# define RADEON_ROP3_DPon 0x00050000
+# define RADEON_ROP3_PDxn 0x00a50000
+# define RADEON_ROP3_PDno 0x00f50000
+# define RADEON_ROP3_Pn 0x000f0000
+# define RADEON_ROP3_DPno 0x00af0000
+# define RADEON_ROP3_DPan 0x005f0000
+
+
+#define RADEON_DP_GUI_MASTER_CNTL_C 0x1c84
+#define RADEON_DP_MIX 0x16c8
+#define RADEON_DP_SRC_BKGD_CLR 0x15dc
+#define RADEON_DP_SRC_FRGD_CLR 0x15d8
+#define RADEON_DP_WRITE_MASK 0x16cc
+#define RADEON_DST_BRES_DEC 0x1630
+#define RADEON_DST_BRES_ERR 0x1628
+#define RADEON_DST_BRES_INC 0x162c
+#define RADEON_DST_BRES_LNTH 0x1634
+#define RADEON_DST_BRES_LNTH_SUB 0x1638
+#define RADEON_DST_HEIGHT 0x1410
+#define RADEON_DST_HEIGHT_WIDTH 0x143c
+#define RADEON_DST_HEIGHT_WIDTH_8 0x158c
+#define RADEON_DST_HEIGHT_WIDTH_BW 0x15b4
+#define RADEON_DST_HEIGHT_Y 0x15a0
+#define RADEON_DST_LINE_START 0x1600
+#define RADEON_DST_LINE_END 0x1604
+#define RADEON_DST_OFFSET 0x1404
+#define RADEON_DST_PITCH 0x1408
+#define RADEON_DST_PITCH_OFFSET 0x142c
+#define RADEON_DST_PITCH_OFFSET_C 0x1c80
+# define RADEON_PITCH_SHIFT 21
+#define RADEON_DST_WIDTH 0x140c
+#define RADEON_DST_WIDTH_HEIGHT 0x1598
+#define RADEON_DST_WIDTH_X 0x1588
+#define RADEON_DST_WIDTH_X_INCY 0x159c
+#define RADEON_DST_X 0x141c
+#define RADEON_DST_X_SUB 0x15a4
+#define RADEON_DST_X_Y 0x1594
+#define RADEON_DST_Y 0x1420
+#define RADEON_DST_Y_SUB 0x15a8
+#define RADEON_DST_Y_X 0x1438
+
+#define RADEON_FCP_CNTL 0x0012 /* PLL */
+#define RADEON_FLUSH_1 0x1704
+#define RADEON_FLUSH_2 0x1708
+#define RADEON_FLUSH_3 0x170c
+#define RADEON_FLUSH_4 0x1710
+#define RADEON_FLUSH_5 0x1714
+#define RADEON_FLUSH_6 0x1718
+#define RADEON_FLUSH_7 0x171c
+#define RADEON_FOG_3D_TABLE_START 0x1810
+#define RADEON_FOG_3D_TABLE_END 0x1814
+#define RADEON_FOG_3D_TABLE_DENSITY 0x181c
+#define RADEON_FOG_TABLE_INDEX 0x1a14
+#define RADEON_FOG_TABLE_DATA 0x1a18
+#define RADEON_FP_CRTC_H_TOTAL_DISP 0x0250
+#define RADEON_FP_CRTC_V_TOTAL_DISP 0x0254
+#define RADEON_FP_GEN_CNTL 0x0284
+# define RADEON_FP_FPON (1 << 0)
+# define RADEON_FP_TDMS_EN (1 << 2)
+# define RADEON_FP_DETECT_SENSE (1 << 8)
+# define RADEON_FP_SEL_CRTC2 (1 << 13)
+# define RADEON_FP_CRTC_DONT_SHADOW_VPAR (1 << 16)
+# define RADEON_FP_CRTC_USE_SHADOW_VEND (1 << 18)
+# define RADEON_FP_CRTC_HORZ_DIV2_EN (1 << 20)
+# define RADEON_FP_CRTC_HOR_CRT_DIV2_DIS (1 << 21)
+# define RADEON_FP_USE_SHADOW_EN (1 << 24)
+#define RADEON_FP_H_SYNC_STRT_WID 0x02c4
+#define RADEON_FP_HORZ_STRETCH 0x028c
+# define RADEON_HORZ_STRETCH_RATIO_MASK 0xffff
+# define RADEON_HORZ_STRETCH_RATIO_SHIFT 0
+# define RADEON_HORZ_STRETCH_RATIO_MAX 4096
+# define RADEON_HORZ_PANEL_SIZE (0xff << 16)
+# define RADEON_HORZ_PANEL_SHIFT 16
+# define RADEON_HORZ_STRETCH_PIXREP (0 << 25)
+# define RADEON_HORZ_STRETCH_BLEND (1 << 25)
+# define RADEON_HORZ_STRETCH_ENABLE (1 << 26)
+# define RADEON_HORZ_FP_LOOP_STRETCH (0x7 << 27)
+# define RADEON_HORZ_STRETCH_RESERVED (1 << 30)
+# define RADEON_HORZ_AUTO_RATIO_FIX_EN (1 << 31)
+
+#define RADEON_FP_PANEL_CNTL 0x0288
+# define RADEON_FP_DIGON (1 << 0)
+# define RADEON_FP_BLON (1 << 1)
+#define RADEON_FP_V_SYNC_STRT_WID 0x02c8
+#define RADEON_FP_VERT_STRETCH 0x0290
+# define RADEON_VERT_PANEL_SIZE (0x7ff << 0)
+# define RADEON_VERT_PANEL_SHIFT 0
+# define RADEON_VERT_STRETCH_RATIO_MASK 0x3ff
+# define RADEON_VERT_STRETCH_RATIO_SHIFT 11
+# define RADEON_VERT_STRETCH_RATIO_MAX 1024
+# define RADEON_VERT_STRETCH_ENABLE (1 << 24)
+# define RADEON_VERT_STRETCH_LINEREP (0 << 25)
+# define RADEON_VERT_STRETCH_BLEND (1 << 25)
+# define RADEON_VERT_AUTO_RATIO_EN (1 << 26)
+# define RADEON_VERT_STRETCH_RESERVED 0xf8e00000
+
+#define RADEON_GEN_INT_CNTL 0x0040
+#define RADEON_GEN_INT_STATUS 0x0044
+# define RADEON_VSYNC_INT_AK (1 << 2)
+# define RADEON_VSYNC_INT (1 << 2)
+#define RADEON_RBBM_SOFT_RESET 0x00f0
+# define RADEON_SOFT_RESET_CP (1 << 0)
+# define RADEON_SOFT_RESET_HI (1 << 1)
+# define RADEON_SOFT_RESET_SE (1 << 2)
+# define RADEON_SOFT_RESET_RE (1 << 3)
+# define RADEON_SOFT_RESET_PP (1 << 4)
+# define RADEON_SOFT_RESET_E2 (1 << 5)
+# define RADEON_SOFT_RESET_RB (1 << 6)
+# define RADEON_SOFT_RESET_HDP (1 << 7)
+#define RADEON_GENENB 0x03c3 /* VGA */
+#define RADEON_GENFC_RD 0x03ca /* VGA */
+#define RADEON_GENFC_WT 0x03da /* VGA, 0x03ba */
+#define RADEON_GENMO_RD 0x03cc /* VGA */
+#define RADEON_GENMO_WT 0x03c2 /* VGA */
+#define RADEON_GENS0 0x03c2 /* VGA */
+#define RADEON_GENS1 0x03da /* VGA, 0x03ba */
+#define RADEON_GPIO_MONID 0x0068
+# define RADEON_GPIO_MONID_A_0 (1 << 0)
+# define RADEON_GPIO_MONID_A_1 (1 << 1)
+# define RADEON_GPIO_MONID_A_2 (1 << 2)
+# define RADEON_GPIO_MONID_A_3 (1 << 3)
+# define RADEON_GPIO_MONID_Y_0 (1 << 8)
+# define RADEON_GPIO_MONID_Y_1 (1 << 9)
+# define RADEON_GPIO_MONID_Y_2 (1 << 10)
+# define RADEON_GPIO_MONID_Y_3 (1 << 11)
+# define RADEON_GPIO_MONID_EN_0 (1 << 16)
+# define RADEON_GPIO_MONID_EN_1 (1 << 17)
+# define RADEON_GPIO_MONID_EN_2 (1 << 18)
+# define RADEON_GPIO_MONID_EN_3 (1 << 19)
+# define RADEON_GPIO_MONID_MASK_0 (1 << 24)
+# define RADEON_GPIO_MONID_MASK_1 (1 << 25)
+# define RADEON_GPIO_MONID_MASK_2 (1 << 26)
+# define RADEON_GPIO_MONID_MASK_3 (1 << 27)
+#define RADEON_GPIO_MONIDB 0x006c
+#define RADEON_GRPH8_DATA 0x03cf /* VGA */
+#define RADEON_GRPH8_IDX 0x03ce /* VGA */
+#define RADEON_GUI_DEBUG0 0x16a0
+#define RADEON_GUI_DEBUG1 0x16a4
+#define RADEON_GUI_DEBUG2 0x16a8
+#define RADEON_GUI_DEBUG3 0x16ac
+#define RADEON_GUI_DEBUG4 0x16b0
+#define RADEON_GUI_DEBUG5 0x16b4
+#define RADEON_GUI_DEBUG6 0x16b8
+#define RADEON_GUI_SCRATCH_REG0 0x15e0
+#define RADEON_GUI_SCRATCH_REG1 0x15e4
+#define RADEON_GUI_SCRATCH_REG2 0x15e8
+#define RADEON_GUI_SCRATCH_REG3 0x15ec
+#define RADEON_GUI_SCRATCH_REG4 0x15f0
+#define RADEON_GUI_SCRATCH_REG5 0x15f4
+#define RADEON_HEADER 0x0f0e /* PCI */
+#define RADEON_HOST_DATA0 0x17c0
+#define RADEON_HOST_DATA1 0x17c4
+#define RADEON_HOST_DATA2 0x17c8
+#define RADEON_HOST_DATA3 0x17cc
+#define RADEON_HOST_DATA4 0x17d0
+#define RADEON_HOST_DATA5 0x17d4
+#define RADEON_HOST_DATA6 0x17d8
+#define RADEON_HOST_DATA7 0x17dc
+#define RADEON_HOST_DATA_LAST 0x17e0
+#define RADEON_HOST_PATH_CNTL 0x0130
+#define RADEON_HTOTAL_CNTL 0x0009 /* PLL */
+#define RADEON_HW_DEBUG 0x0128
+#define RADEON_HW_DEBUG2 0x011c
+
+#define RADEON_I2C_CNTL_1 0x0094 /* ? */
+#define RADEON_INTERRUPT_LINE 0x0f3c /* PCI */
+#define RADEON_INTERRUPT_PIN 0x0f3d /* PCI */
+#define RADEON_IO_BASE 0x0f14 /* PCI */
+
+#define RADEON_LATENCY 0x0f0d /* PCI */
+#define RADEON_LEAD_BRES_DEC 0x1608
+#define RADEON_LEAD_BRES_LNTH 0x161c
+#define RADEON_LEAD_BRES_LNTH_SUB 0x1624
+#define RADEON_LVDS_GEN_CNTL 0x02d0
+# define RADEON_LVDS_ON (1 << 0)
+# define RADEON_LVDS_BLON (1 << 19)
+# define RADEON_LVDS_SEL_CRTC2 (1 << 23)
+# define RADEON_HSYNC_DELAY_SHIFT 28
+# define RADEON_HSYNC_DELAY_MASK (0xf << 28)
+
+#define RADEON_MAX_LATENCY 0x0f3f /* PCI */
+#define RADEON_MC_AGP_LOCATION 0x014c
+#define RADEON_MC_FB_LOCATION 0x0148
+#define RADEON_MCLK_CNTL 0x0012 /* PLL */
+# define RADEON_FORCE_GCP (1 << 16)
+# define RADEON_FORCE_PIPE3D_CP (1 << 17)
+# define RADEON_FORCE_RCP (1 << 18)
+#define RADEON_MDGPIO_A_REG 0x01ac
+#define RADEON_MDGPIO_EN_REG 0x01b0
+#define RADEON_MDGPIO_MASK 0x0198
+#define RADEON_MDGPIO_Y_REG 0x01b4
+#define RADEON_MEM_ADDR_CONFIG 0x0148
+#define RADEON_MEM_BASE 0x0f10 /* PCI */
+#define RADEON_MEM_CNTL 0x0140
+#define RADEON_MEM_INIT_LAT_TIMER 0x0154
+#define RADEON_MEM_INTF_CNTL 0x014c
+#define RADEON_MEM_SDRAM_MODE_REG 0x0158
+#define RADEON_MEM_STR_CNTL 0x0150
+#define RADEON_MEM_VGA_RP_SEL 0x003c
+#define RADEON_MEM_VGA_WP_SEL 0x0038
+#define RADEON_MIN_GRANT 0x0f3e /* PCI */
+#define RADEON_MM_DATA 0x0004
+#define RADEON_MM_INDEX 0x0000
+#define RADEON_MPLL_CNTL 0x000e /* PLL */
+#define RADEON_MPP_TB_CONFIG 0x01c0 /* ? */
+#define RADEON_MPP_GP_CONFIG 0x01c8 /* ? */
+
+#define RADEON_N_VIF_COUNT 0x0248
+
+#define RADEON_OV0_SCALE_CNTL 0x0420 /* ? */
+#define RADEON_OVR_CLR 0x0230
+#define RADEON_OVR_WID_LEFT_RIGHT 0x0234
+#define RADEON_OVR_WID_TOP_BOTTOM 0x0238
+
+/* first overlay unit (there is only one) */
+
+#define RADEON_OV0_Y_X_START 0x0400
+#define RADEON_OV0_Y_X_END 0x0404
+#define RADEON_OV0_EXCLUSIVE_HORZ 0x0408
+# define RADEON_EXCL_HORZ_START_MASK 0x000000ff
+# define RADEON_EXCL_HORZ_END_MASK 0x0000ff00
+# define RADEON_EXCL_HORZ_BACK_PORCH_MASK 0x00ff0000
+# define RADEON_EXCL_HORZ_EXCLUSIVE_EN 0x80000000
+#define RADEON_OV0_EXCLUSIVE_VERT 0x040C
+# define RADEON_EXCL_VERT_START_MASK 0x000003ff
+# define RADEON_EXCL_VERT_END_MASK 0x03ff0000
+#define RADEON_OV0_REG_LOAD_CNTL 0x0410
+# define RADEON_REG_LD_CTL_LOCK 0x00000001L
+# define RADEON_REG_LD_CTL_VBLANK_DURING_LOCK 0x00000002L
+# define RADEON_REG_LD_CTL_STALL_GUI_UNTIL_FLIP 0x00000004L
+# define RADEON_REG_LD_CTL_LOCK_READBACK 0x00000008L
+#define RADEON_OV0_SCALE_CNTL 0x0420
+# define RADEON_SCALER_PIX_EXPAND 0x00000001L
+# define RADEON_SCALER_Y2R_TEMP 0x00000002L
+# define RADEON_SCALER_HORZ_PICK_NEAREST 0x00000003L
+# define RADEON_SCALER_VERT_PICK_NEAREST 0x00000004L
+# define RADEON_SCALER_SIGNED_UV 0x00000010L
+# define RADEON_SCALER_GAMMA_SEL_MASK 0x00000060L
+# define RADEON_SCALER_GAMMA_SEL_BRIGHT 0x00000000L
+# define RADEON_SCALER_GAMMA_SEL_G22 0x00000020L
+# define RADEON_SCALER_GAMMA_SEL_G18 0x00000040L
+# define RADEON_SCALER_GAMMA_SEL_G14 0x00000060L
+# define RADEON_SCALER_COMCORE_SHIFT_UP_ONE 0x00000080L
+# define RADEON_SCALER_SURFAC_FORMAT 0x00000f00L
+# define RADEON_SCALER_SOURCE_15BPP 0x00000300L
+# define RADEON_SCALER_SOURCE_16BPP 0x00000400L
+# define RADEON_SCALER_SOURCE_32BPP 0x00000600L
+# define RADEON_SCALER_SOURCE_YUV9 0x00000900L
+# define RADEON_SCALER_SOURCE_YUV12 0x00000A00L
+# define RADEON_SCALER_SOURCE_VYUY422 0x00000B00L
+# define RADEON_SCALER_SOURCE_YVYU422 0x00000C00L
+# define RADEON_SCALER_SMART_SWITCH 0x00008000L
+# define RADEON_SCALER_BURST_PER_PLANE 0x00ff0000L
+# define RADEON_SCALER_DOUBLE_BUFFER 0x01000000L
+# define RADEON_SCALER_DIS_LIMIT 0x08000000L
+# define RADEON_SCALER_PRG_LOAD_START 0x10000000L
+# define RADEON_SCALER_INT_EMU 0x20000000L
+# define RADEON_SCALER_ENABLE 0x40000000L
+# define RADEON_SCALER_SOFT_RESET 0x80000000L
+#define RADEON_OV0_V_INC 0x0424
+#define RADEON_OV0_P1_V_ACCUM_INIT 0x0428
+# define RADEON_OV0_P1_MAX_LN_IN_PER_LN_OUT 0x00000003L
+# define RADEON_OV0_P1_V_ACCUM_INIT_MASK 0x01ff8000L
+#define RADEON_OV0_P23_V_ACCUM_INIT 0x042C
+#define RADEON_OV0_P1_BLANK_LINES_AT_TOP 0x0430
+# define RADEON_P1_BLNK_LN_AT_TOP_M1_MASK 0x00000fffL
+# define RADEON_P1_ACTIVE_LINES_M1 0x0fff0000L
+#define RADEON_OV0_P23_BLANK_LINES_AT_TOP 0x0434
+# define RADEON_P23_BLNK_LN_AT_TOP_M1_MASK 0x000007ffL
+# define RADEON_P23_ACTIVE_LINES_M1 0x07ff0000L
+#define RADEON_OV0_VID_BUF0_BASE_ADRS 0x0440
+# define RADEON_VIF_BUF0_PITCH_SEL 0x00000001L
+# define RADEON_VIF_BUF0_TILE_ADRS 0x00000002L
+# define RADEON_VIF_BUF0_BASE_ADRS_MASK 0x03fffff0L
+# define RADEON_VIF_BUF0_1ST_LINE_LSBS_MASK 0x48000000L
+#define RADEON_OV0_VID_BUF1_BASE_ADRS 0x0444
+# define RADEON_VIF_BUF1_PITCH_SEL 0x00000001L
+# define RADEON_VIF_BUF1_TILE_ADRS 0x00000002L
+# define RADEON_VIF_BUF1_BASE_ADRS_MASK 0x03fffff0L
+# define RADEON_VIF_BUF1_1ST_LINE_LSBS_MASK 0x48000000L
+#define RADEON_OV0_VID_BUF2_BASE_ADRS 0x0448
+# define RADEON_VIF_BUF2_PITCH_SEL 0x00000001L
+# define RADEON_VIF_BUF2_TILE_ADRS 0x00000002L
+# define RADEON_VIF_BUF2_BASE_ADRS_MASK 0x03fffff0L
+# define RADEON_VIF_BUF2_1ST_LINE_LSBS_MASK 0x48000000L
+#define RADEON_OV0_VID_BUF3_BASE_ADRS 0x044C
+#define RADEON_OV0_VID_BUF4_BASE_ADRS 0x0450
+#define RADEON_OV0_VID_BUF5_BASE_ADRS 0x0454
+#define RADEON_OV0_VID_BUF_PITCH0_VALUE 0x0460
+#define RADEON_OV0_VID_BUF_PITCH1_VALUE 0x0464
+#define RADEON_OV0_AUTO_FLIP_CNTL 0x0470
+#define RADEON_OV0_DEINTERLACE_PATTERN 0x0474
+#define RADEON_OV0_H_INC 0x0480
+#define RADEON_OV0_STEP_BY 0x0484
+#define RADEON_OV0_P1_H_ACCUM_INIT 0x0488
+#define RADEON_OV0_P23_H_ACCUM_INIT 0x048C
+#define RADEON_OV0_P1_X_START_END 0x0494
+#define RADEON_OV0_P2_X_START_END 0x0498
+#define RADEON_OV0_P3_X_START_END 0x049C
+#define RADEON_OV0_FILTER_CNTL 0x04A0
+#define RADEON_OV0_FOUR_TAP_COEF_0 0x04B0
+#define RADEON_OV0_FOUR_TAP_COEF_1 0x04B4
+#define RADEON_OV0_FOUR_TAP_COEF_2 0x04B8
+#define RADEON_OV0_FOUR_TAP_COEF_3 0x04BC
+#define RADEON_OV0_FOUR_TAP_COEF_4 0x04C0
+#define RADEON_OV0_COLOUR_CNTL 0x04E0
+#define RADEON_OV0_VIDEO_KEY_CLR 0x04E4
+#define RADEON_OV0_VIDEO_KEY_MSK 0x04E8
+#define RADEON_OV0_GRAPHICS_KEY_CLR 0x04EC
+#define RADEON_OV0_GRAPHICS_KEY_MSK 0x04F0
+#define RADEON_OV0_KEY_CNTL 0x04F4
+# define RADEON_VIDEO_KEY_FN_MASK 0x00000007L
+# define RADEON_VIDEO_KEY_FN_FALSE 0x00000000L
+# define RADEON_VIDEO_KEY_FN_TRUE 0x00000001L
+# define RADEON_VIDEO_KEY_FN_EQ 0x00000004L
+# define RADEON_VIDEO_KEY_FN_NE 0x00000005L
+# define RADEON_GRAPHIC_KEY_FN_MASK 0x00000070L
+# define RADEON_GRAPHIC_KEY_FN_FALSE 0x00000000L
+# define RADEON_GRAPHIC_KEY_FN_TRUE 0x00000010L
+# define RADEON_GRAPHIC_KEY_FN_EQ 0x00000040L
+# define RADEON_GRAPHIC_KEY_FN_NE 0x00000050L
+# define RADEON_CMP_MIX_MASK 0x00000100L
+# define RADEON_CMP_MIX_OR 0x00000000L
+# define RADEON_CMP_MIX_AND 0x00000100L
+#define RADEON_OV0_TEST 0x04F8
+
+#define RADEON_PALETTE_DATA 0x00b4
+#define RADEON_PALETTE_30_DATA 0x00b8
+#define RADEON_PALETTE_INDEX 0x00b0
+#define RADEON_PCI_GART_PAGE 0x017c
+#define RADEON_PLANE_3D_MASK_C 0x1d44
+#define RADEON_PLL_TEST_CNTL 0x0013 /* PLL */
+#define RADEON_PMI_CAP_ID 0x0f5c /* PCI */
+#define RADEON_PMI_DATA 0x0f63 /* PCI */
+#define RADEON_PMI_NXT_CAP_PTR 0x0f5d /* PCI */
+#define RADEON_PMI_PMC_REG 0x0f5e /* PCI */
+#define RADEON_PMI_PMCSR_REG 0x0f60 /* PCI */
+#define RADEON_PMI_REGISTER 0x0f5c /* PCI */
+#define RADEON_PPLL_CNTL 0x0002 /* PLL */
+# define RADEON_PPLL_RESET (1 << 0)
+# define RADEON_PPLL_SLEEP (1 << 1)
+# define RADEON_PPLL_ATOMIC_UPDATE_EN (1 << 16)
+# define RADEON_PPLL_VGA_ATOMIC_UPDATE_EN (1 << 17)
+# define RADEON_PPLL_ATOMIC_UPDATE_VSYNC (1 << 18)
+#define RADEON_PPLL_DIV_0 0x0004 /* PLL */
+#define RADEON_PPLL_DIV_1 0x0005 /* PLL */
+#define RADEON_PPLL_DIV_2 0x0006 /* PLL */
+#define RADEON_PPLL_DIV_3 0x0007 /* PLL */
+# define RADEON_PPLL_FB3_DIV_MASK 0x07ff
+# define RADEON_PPLL_POST3_DIV_MASK 0x00070000
+#define RADEON_PPLL_REF_DIV 0x0003 /* PLL */
+# define RADEON_PPLL_REF_DIV_MASK 0x03ff
+# define RADEON_PPLL_ATOMIC_UPDATE_R (1 << 15) /* same as _W */
+# define RADEON_PPLL_ATOMIC_UPDATE_W (1 << 15) /* same as _R */
+#define RADEON_PWR_MNGMT_CNTL_STATUS 0x0f60 /* PCI */
+#define RADEON_RBBM_SOFT_RESET 0x00f0
+#define RADEON_RBBM_STATUS 0x0e40
+# define RADEON_RBBM_FIFOCNT_MASK 0x007f
+# define RADEON_RBBM_ACTIVE (1 << 31)
+#define RADEON_RB2D_DSTCACHE_CTLSTAT 0x342c
+# define RADEON_RB2D_DC_FLUSH_ALL 0xf
+# define RADEON_RB2D_DC_BUSY (1 << 31)
+#define RADEON_RB2D_DSTCACHE_MODE 0x3428
+#define RADEON_REG_BASE 0x0f18 /* PCI */
+#define RADEON_REGPROG_INF 0x0f09 /* PCI */
+#define RADEON_REVISION_ID 0x0f08 /* PCI */
+
+#define RADEON_SC_BOTTOM 0x164c
+#define RADEON_SC_BOTTOM_RIGHT 0x16f0
+#define RADEON_SC_BOTTOM_RIGHT_C 0x1c8c
+#define RADEON_SC_LEFT 0x1640
+#define RADEON_SC_RIGHT 0x1644
+#define RADEON_SC_TOP 0x1648
+#define RADEON_SC_TOP_LEFT 0x16ec
+#define RADEON_SC_TOP_LEFT_C 0x1c88
+#define RADEON_SDRAM_MODE_REG 0x0158
+#define RADEON_SEQ8_DATA 0x03c5 /* VGA */
+#define RADEON_SEQ8_IDX 0x03c4 /* VGA */
+#define RADEON_SNAPSHOT_F_COUNT 0x0244
+#define RADEON_SNAPSHOT_VH_COUNTS 0x0240
+#define RADEON_SNAPSHOT_VIF_COUNT 0x024c
+#define RADEON_SRC_OFFSET 0x15ac
+#define RADEON_SRC_PITCH 0x15b0
+#define RADEON_SRC_PITCH_OFFSET 0x1428
+#define RADEON_SRC_SC_BOTTOM 0x165c
+#define RADEON_SRC_SC_BOTTOM_RIGHT 0x16f4
+#define RADEON_SRC_SC_RIGHT 0x1654
+#define RADEON_SRC_X 0x1414
+#define RADEON_SRC_X_Y 0x1590
+#define RADEON_SRC_Y 0x1418
+#define RADEON_SRC_Y_X 0x1434
+#define RADEON_STATUS 0x0f06 /* PCI */
+#define RADEON_SUBPIC_CNTL 0x0540 /* ? */
+#define RADEON_SUB_CLASS 0x0f0a /* PCI */
+#define RADEON_SURFACE_DELAY 0x0b00
+#define RADEON_SURFACE0_INFO 0x0b0c
+#define RADEON_SURFACE0_LOWER_BOUND 0x0b04
+#define RADEON_SURFACE0_UPPER_BOUND 0x0b08
+#define RADEON_SURFACE1_INFO 0x0b1c
+#define RADEON_SURFACE1_LOWER_BOUND 0x0b14
+#define RADEON_SURFACE1_UPPER_BOUND 0x0b18
+#define RADEON_SURFACE2_INFO 0x0b2c
+#define RADEON_SURFACE2_LOWER_BOUND 0x0b24
+#define RADEON_SURFACE2_UPPER_BOUND 0x0b28
+#define RADEON_SURFACE3_INFO 0x0b3c
+#define RADEON_SURFACE3_LOWER_BOUND 0x0b34
+#define RADEON_SURFACE3_UPPER_BOUND 0x0b38
+#define RADEON_SW_SEMAPHORE 0x013c
+
+#define RADEON_TEST_DEBUG_CNTL 0x0120
+#define RADEON_TEST_DEBUG_MUX 0x0124
+#define RADEON_TEST_DEBUG_OUT 0x012c
+#define RADEON_TMDS_CRC 0x02a0
+#define RADEON_TRAIL_BRES_DEC 0x1614
+#define RADEON_TRAIL_BRES_ERR 0x160c
+#define RADEON_TRAIL_BRES_INC 0x1610
+#define RADEON_TRAIL_X 0x1618
+#define RADEON_TRAIL_X_SUB 0x1620
+
+#define RADEON_VCLK_ECP_CNTL 0x0008 /* PLL */
+#define RADEON_VENDOR_ID 0x0f00 /* PCI */
+#define RADEON_VGA_DDA_CONFIG 0x02e8
+#define RADEON_VGA_DDA_ON_OFF 0x02ec
+#define RADEON_VID_BUFFER_CONTROL 0x0900
+#define RADEON_VIDEOMUX_CNTL 0x0190
+#define RADEON_VIPH_CONTROL 0x0c40 /* ? */
+
+#define RADEON_WAIT_UNTIL 0x1720
+
+#define RADEON_X_MPLL_REF_FB_DIV 0x000a /* PLL */
+#define RADEON_XCLK_CNTL 0x000d /* PLL */
+#define RADEON_XDLL_CNTL 0x000c /* PLL */
+#define RADEON_XPLL_CNTL 0x000b /* PLL */
+
+ /* Registers for CCE and Microcode Engine */
+#define RADEON_CP_ME_RAM_ADDR 0x07d4
+#define RADEON_CP_ME_RAM_RADDR 0x07d8
+#define RADEON_CP_ME_RAM_DATAH 0x07dc
+#define RADEON_CP_ME_RAM_DATAL 0x07e0
+
+#define RADEON_CP_RB_BASE 0x0700
+#define RADEON_CP_RB_CNTL 0x0704
+#define RADEON_CP_RB_RPTR_ADDR 0x070c
+#define RADEON_CP_RB_RPTR 0x0710
+#define RADEON_CP_RB_WPTR 0x0714
+# define RADEON_PM4_BUFFER_DL_DONE (1 << 31)
+
+#define RADEON_CP_IB_BASE 0x0738
+#define RADEON_CP_IB_BUFSZ 0x073c
+
+#define RADEON_CP_CSQ_CNTL 0x0740
+# define RADEON_CSQ_PRIDIS_INDDIS (0 << 28)
+# define RADEON_CSQ_PRIPIO_INDDIS (1 << 28)
+# define RADEON_CSQ_PRIBM_INDDIS (2 << 28)
+# define RADEON_CSQ_PRIPIO_INDBM (3 << 28)
+# define RADEON_CSQ_PRIBM_INDBM (4 << 28)
+# define RADEON_CSQ_PRIPIO_INDPIO (15 << 28)
+#define RADEON_CP_RB_WPTR_DELAY 0x0718
+# define RADEON_PRE_WRITE_TIMER_SHIFT 0
+# define RADEON_PRE_WRITE_LIMIT_SHIFT 23
+
+#define RADEON_AIC_CNTL 0x01d0
+# define RADEON_PCIGART_TRANSLATE_EN (1 << 0)
+
+#define RADEON_PM4_VC_FPU_SETUP 0x071c
+# define RADEON_FRONT_DIR_CW (0 << 0)
+# define RADEON_FRONT_DIR_CCW (1 << 0)
+# define RADEON_FRONT_DIR_MASK (1 << 0)
+# define RADEON_BACKFACE_CULL (0 << 1)
+# define RADEON_BACKFACE_POINTS (1 << 1)
+# define RADEON_BACKFACE_LINES (2 << 1)
+# define RADEON_BACKFACE_SOLID (3 << 1)
+# define RADEON_BACKFACE_MASK (3 << 1)
+# define RADEON_FRONTFACE_CULL (0 << 3)
+# define RADEON_FRONTFACE_POINTS (1 << 3)
+# define RADEON_FRONTFACE_LINES (2 << 3)
+# define RADEON_FRONTFACE_SOLID (3 << 3)
+# define RADEON_FRONTFACE_MASK (3 << 3)
+# define RADEON_FPU_COLOR_SOLID (0 << 5)
+# define RADEON_FPU_COLOR_FLAT (1 << 5)
+# define RADEON_FPU_COLOR_GOURAUD (2 << 5)
+# define RADEON_FPU_COLOR_GOURAUD2 (3 << 5)
+# define RADEON_FPU_COLOR_MASK (3 << 5)
+# define RADEON_FPU_SUB_PIX_2BITS (0 << 7)
+# define RADEON_FPU_SUB_PIX_4BITS (1 << 7)
+# define RADEON_FPU_MODE_2D (0 << 8)
+# define RADEON_FPU_MODE_3D (1 << 8)
+# define RADEON_TRAP_BITS_DISABLE (1 << 9)
+# define RADEON_EDGE_ANTIALIAS (1 << 10)
+# define RADEON_SUPERSAMPLE (1 << 11)
+# define RADEON_XFACTOR_2 (0 << 12)
+# define RADEON_XFACTOR_4 (1 << 12)
+# define RADEON_YFACTOR_2 (0 << 13)
+# define RADEON_YFACTOR_4 (1 << 13)
+# define RADEON_FLAT_SHADE_VERTEX_D3D (0 << 14)
+# define RADEON_FLAT_SHADE_VERTEX_OGL (1 << 14)
+# define RADEON_FPU_ROUND_TRUNCATE (0 << 15)
+# define RADEON_FPU_ROUND_NEAREST (1 << 15)
+# define RADEON_WM_SEL_8DW (0 << 16)
+# define RADEON_WM_SEL_16DW (1 << 16)
+# define RADEON_WM_SEL_32DW (2 << 16)
+#define RADEON_PM4_VC_DEBUG_CONFIG 0x07a4
+#define RADEON_PM4_VC_STAT 0x07a8
+#define RADEON_PM4_VC_TIMESTAMP0 0x07b0
+#define RADEON_PM4_VC_TIMESTAMP1 0x07b4
+#define RADEON_PM4_STAT 0x07b8
+# define RADEON_PM4_FIFOCNT_MASK 0x0fff
+# define RADEON_PM4_BUSY (1 << 16)
+# define RADEON_PM4_GUI_ACTIVE (1 << 31)
+#define RADEON_PM4_BUFFER_ADDR 0x07f0
+#define RADEON_CP_ME_CNTL 0x07d0
+# define RADEON_CP_ME_FREERUN (1 << 30)
+#define RADEON_PM4_FIFO_DATA_EVEN 0x1000
+#define RADEON_PM4_FIFO_DATA_ODD 0x1004
+
+#define RADEON_SCALE_3D_CNTL 0x1a00
+# define RADEON_SCALE_DITHER_ERR_DIFF (0 << 1)
+# define RADEON_SCALE_DITHER_TABLE (1 << 1)
+# define RADEON_TEX_CACHE_SIZE_FULL (0 << 2)
+# define RADEON_TEX_CACHE_SIZE_HALF (1 << 2)
+# define RADEON_DITHER_INIT_CURR (0 << 3)
+# define RADEON_DITHER_INIT_RESET (1 << 3)
+# define RADEON_ROUND_24BIT (1 << 4)
+# define RADEON_TEX_CACHE_DISABLE (1 << 5)
+# define RADEON_SCALE_3D_NOOP (0 << 6)
+# define RADEON_SCALE_3D_SCALE (1 << 6)
+# define RADEON_SCALE_3D_TEXMAP_SHADE (2 << 6)
+# define RADEON_SCALE_PIX_BLEND (0 << 8)
+# define RADEON_SCALE_PIX_REPLICATE (1 << 8)
+# define RADEON_TEX_CACHE_SPLIT (1 << 9)
+# define RADEON_APPLE_YUV_MODE (1 << 10)
+# define RADEON_TEX_CACHE_PALLETE_MODE (1 << 11)
+# define RADEON_ALPHA_COMB_ADD_CLAMP (0 << 12)
+# define RADEON_ALPHA_COMB_ADD_NCLAMP (1 << 12)
+# define RADEON_ALPHA_COMB_SUB_DST_SRC_CLAMP (2 << 12)
+# define RADEON_ALPHA_COMB_SUB_DST_SRC_NCLAMP (3 << 12)
+# define RADEON_FOG_TABLE (1 << 14)
+# define RADEON_SIGNED_DST_CLAMP (1 << 15)
+# define RADEON_ALPHA_BLEND_SRC_ZERO (0 << 16)
+# define RADEON_ALPHA_BLEND_SRC_ONE (1 << 16)
+# define RADEON_ALPHA_BLEND_SRC_SRCCOLOR (2 << 16)
+# define RADEON_ALPHA_BLEND_SRC_INVSRCCOLOR (3 << 16)
+# define RADEON_ALPHA_BLEND_SRC_SRCALPHA (4 << 16)
+# define RADEON_ALPHA_BLEND_SRC_INVSRCALPHA (5 << 16)
+# define RADEON_ALPHA_BLEND_SRC_DSTALPHA (6 << 16)
+# define RADEON_ALPHA_BLEND_SRC_INVDSTALPHA (7 << 16)
+# define RADEON_ALPHA_BLEND_SRC_DSTCOLOR (8 << 16)
+# define RADEON_ALPHA_BLEND_SRC_INVDSTCOLOR (9 << 16)
+# define RADEON_ALPHA_BLEND_SRC_SAT (10 << 16)
+# define RADEON_ALPHA_BLEND_SRC_BLEND (11 << 16)
+# define RADEON_ALPHA_BLEND_SRC_INVBLEND (12 << 16)
+# define RADEON_ALPHA_BLEND_DST_ZERO (0 << 20)
+# define RADEON_ALPHA_BLEND_DST_ONE (1 << 20)
+# define RADEON_ALPHA_BLEND_DST_SRCCOLOR (2 << 20)
+# define RADEON_ALPHA_BLEND_DST_INVSRCCOLOR (3 << 20)
+# define RADEON_ALPHA_BLEND_DST_SRCALPHA (4 << 20)
+# define RADEON_ALPHA_BLEND_DST_INVSRCALPHA (5 << 20)
+# define RADEON_ALPHA_BLEND_DST_DSTALPHA (6 << 20)
+# define RADEON_ALPHA_BLEND_DST_INVDSTALPHA (7 << 20)
+# define RADEON_ALPHA_BLEND_DST_DSTCOLOR (8 << 20)
+# define RADEON_ALPHA_BLEND_DST_INVDSTCOLOR (9 << 20)
+# define RADEON_ALPHA_TEST_NEVER (0 << 24)
+# define RADEON_ALPHA_TEST_LESS (1 << 24)
+# define RADEON_ALPHA_TEST_LESSEQUAL (2 << 24)
+# define RADEON_ALPHA_TEST_EQUAL (3 << 24)
+# define RADEON_ALPHA_TEST_GREATEREQUAL (4 << 24)
+# define RADEON_ALPHA_TEST_GREATER (5 << 24)
+# define RADEON_ALPHA_TEST_NEQUAL (6 << 24)
+# define RADEON_ALPHA_TEST_ALWAYS (7 << 24)
+# define RADEON_COMPOSITE_SHADOW_CMP_EQUAL (0 << 28)
+# define RADEON_COMPOSITE_SHADOW_CMP_NEQUAL (1 << 28)
+# define RADEON_COMPOSITE_SHADOW (1 << 29)
+# define RADEON_TEX_MAP_ALPHA_IN_TEXTURE (1 << 30)
+# define RADEON_TEX_CACHE_LINE_SIZE_8QW (0 << 31)
+# define RADEON_TEX_CACHE_LINE_SIZE_4QW (1 << 31)
+#define RADEON_SCALE_3D_DATATYPE 0x1a20
+
+#define RADEON_SETUP_CNTL 0x1bc4
+# define RADEON_DONT_START_TRIANGLE (1 << 0)
+# define RADEON_Z_BIAS (0 << 1)
+# define RADEON_DONT_START_ANY_ON (1 << 2)
+# define RADEON_COLOR_SOLID_COLOR (0 << 3)
+# define RADEON_COLOR_FLAT_VERT_1 (1 << 3)
+# define RADEON_COLOR_FLAT_VERT_2 (2 << 3)
+# define RADEON_COLOR_FLAT_VERT_3 (3 << 3)
+# define RADEON_COLOR_GOURAUD (4 << 3)
+# define RADEON_PRIM_TYPE_TRI (0 << 7)
+# define RADEON_PRIM_TYPE_LINE (1 << 7)
+# define RADEON_PRIM_TYPE_POINT (2 << 7)
+# define RADEON_PRIM_TYPE_POLY_EDGE (3 << 7)
+# define RADEON_TEXTURE_ST_MULT_W (0 << 9)
+# define RADEON_TEXTURE_ST_DIRECT (1 << 9)
+# define RADEON_STARTING_VERTEX_1 (1 << 14)
+# define RADEON_STARTING_VERTEX_2 (2 << 14)
+# define RADEON_STARTING_VERTEX_3 (3 << 14)
+# define RADEON_ENDING_VERTEX_1 (1 << 16)
+# define RADEON_ENDING_VERTEX_2 (2 << 16)
+# define RADEON_ENDING_VERTEX_3 (3 << 16)
+# define RADEON_SU_POLY_LINE_LAST (0 << 18)
+# define RADEON_SU_POLY_LINE_NOT_LAST (1 << 18)
+# define RADEON_SUB_PIX_2BITS (0 << 19)
+# define RADEON_SUB_PIX_4BITS (1 << 19)
+# define RADEON_SET_UP_CONTINUE (1 << 31)
+
+#define RADEON_WINDOW_XY_OFFSET 0x1bcc
+# define RADEON_WINDOW_Y_SHIFT 4
+# define RADEON_WINDOW_X_SHIFT 20
+
+#define RADEON_Z_OFFSET_C 0x1c90
+#define RADEON_Z_PITCH_C 0x1c94
+#define RADEON_Z_STEN_CNTL_C 0x1c98
+# define RADEON_Z_PIX_WIDTH_16 (0 << 1)
+# define RADEON_Z_PIX_WIDTH_24 (1 << 1)
+# define RADEON_Z_PIX_WIDTH_32 (2 << 1)
+# define RADEON_Z_PIX_WIDTH_MASK (3 << 1)
+# define RADEON_Z_TEST_NEVER (0 << 4)
+# define RADEON_Z_TEST_LESS (1 << 4)
+# define RADEON_Z_TEST_LESSEQUAL (2 << 4)
+# define RADEON_Z_TEST_EQUAL (3 << 4)
+# define RADEON_Z_TEST_GREATEREQUAL (4 << 4)
+# define RADEON_Z_TEST_GREATER (5 << 4)
+# define RADEON_Z_TEST_NEQUAL (6 << 4)
+# define RADEON_Z_TEST_ALWAYS (7 << 4)
+# define RADEON_Z_TEST_MASK (7 << 4)
+# define RADEON_STENCIL_TEST_NEVER (0 << 12)
+# define RADEON_STENCIL_TEST_LESS (1 << 12)
+# define RADEON_STENCIL_TEST_LESSEQUAL (2 << 12)
+# define RADEON_STENCIL_TEST_EQUAL (3 << 12)
+# define RADEON_STENCIL_TEST_GREATEREQUAL (4 << 12)
+# define RADEON_STENCIL_TEST_GREATER (5 << 12)
+# define RADEON_STENCIL_TEST_NEQUAL (6 << 12)
+# define RADEON_STENCIL_TEST_ALWAYS (7 << 12)
+# define RADEON_STENCIL_S_FAIL_KEEP (0 << 16)
+# define RADEON_STENCIL_S_FAIL_ZERO (1 << 16)
+# define RADEON_STENCIL_S_FAIL_REPLACE (2 << 16)
+# define RADEON_STENCIL_S_FAIL_INC (3 << 16)
+# define RADEON_STENCIL_S_FAIL_DEC (4 << 16)
+# define RADEON_STENCIL_S_FAIL_INV (5 << 16)
+# define RADEON_STENCIL_ZPASS_KEEP (0 << 20)
+# define RADEON_STENCIL_ZPASS_ZERO (1 << 20)
+# define RADEON_STENCIL_ZPASS_REPLACE (2 << 20)
+# define RADEON_STENCIL_ZPASS_INC (3 << 20)
+# define RADEON_STENCIL_ZPASS_DEC (4 << 20)
+# define RADEON_STENCIL_ZPASS_INV (5 << 20)
+# define RADEON_STENCIL_ZFAIL_KEEP (0 << 24)
+# define RADEON_STENCIL_ZFAIL_ZERO (1 << 24)
+# define RADEON_STENCIL_ZFAIL_REPLACE (2 << 24)
+# define RADEON_STENCIL_ZFAIL_INC (3 << 24)
+# define RADEON_STENCIL_ZFAIL_DEC (4 << 24)
+# define RADEON_STENCIL_ZFAIL_INV (5 << 24)
+#define RADEON_TEX_CNTL_C 0x1c9c
+# define RADEON_Z_ENABLE (1 << 0)
+# define RADEON_Z_WRITE_ENABLE (1 << 1)
+# define RADEON_STENCIL_ENABLE (1 << 3)
+# define RADEON_SHADE_ENABLE (0 << 4)
+# define RADEON_TEXMAP_ENABLE (1 << 4)
+# define RADEON_SEC_TEXMAP_ENABLE (1 << 5)
+# define RADEON_FOG_ENABLE (1 << 7)
+# define RADEON_DITHER_ENABLE (1 << 8)
+# define RADEON_ALPHA_ENABLE (1 << 9)
+# define RADEON_ALPHA_TEST_ENABLE (1 << 10)
+# define RADEON_SPEC_LIGHT_ENABLE (1 << 11)
+# define RADEON_TEX_CHROMA_KEY_ENABLE (1 << 12)
+# define RADEON_ALPHA_IN_TEX_COMPLETE_A (0 << 13)
+# define RADEON_ALPHA_IN_TEX_LSB_A (1 << 13)
+# define RADEON_LIGHT_DIS (0 << 14)
+# define RADEON_LIGHT_COPY (1 << 14)
+# define RADEON_LIGHT_MODULATE (2 << 14)
+# define RADEON_LIGHT_ADD (3 << 14)
+# define RADEON_LIGHT_BLEND_CONSTANT (4 << 14)
+# define RADEON_LIGHT_BLEND_TEXTURE (5 << 14)
+# define RADEON_LIGHT_BLEND_VERTEX (6 << 14)
+# define RADEON_LIGHT_BLEND_CONST_COLOR (7 << 14)
+# define RADEON_ALPHA_LIGHT_DIS (0 << 18)
+# define RADEON_ALPHA_LIGHT_COPY (1 << 18)
+# define RADEON_ALPHA_LIGHT_MODULATE (2 << 18)
+# define RADEON_ALPHA_LIGHT_ADD (3 << 18)
+# define RADEON_ANTI_ALIAS (1 << 21)
+# define RADEON_TEX_CACHE_FLUSH (1 << 23)
+# define RADEON_LOD_BIAS_SHIFT 24
+#define RADEON_MISC_3D_STATE_CNTL_REG 0x1ca0
+# define RADEON_REF_ALPHA_MASK 0xff
+# define RADEON_MISC_SCALE_3D_NOOP (0 << 8)
+# define RADEON_MISC_SCALE_3D_SCALE (1 << 8)
+# define RADEON_MISC_SCALE_3D_TEXMAP_SHADE (2 << 8)
+# define RADEON_MISC_SCALE_PIX_BLEND (0 << 10)
+# define RADEON_MISC_SCALE_PIX_REPLICATE (1 << 10)
+# define RADEON_ALPHA_COMB_ADD_CLAMP (0 << 12)
+# define RADEON_ALPHA_COMB_ADD_NO_CLAMP (1 << 12)
+# define RADEON_ALPHA_COMB_SUB_SRC_DST_CLAMP (2 << 12)
+# define RADEON_ALPHA_COMB_SUB_SRC_DST_NO_CLAMP (3 << 12)
+# define RADEON_FOG_VERTEX (0 << 14)
+# define RADEON_FOG_TABLE (1 << 14)
+# define RADEON_ALPHA_BLEND_SRC_ZERO (0 << 16)
+# define RADEON_ALPHA_BLEND_SRC_ONE (1 << 16)
+# define RADEON_ALPHA_BLEND_SRC_SRCCOLOR (2 << 16)
+# define RADEON_ALPHA_BLEND_SRC_INVSRCCOLOR (3 << 16)
+# define RADEON_ALPHA_BLEND_SRC_SRCALPHA (4 << 16)
+# define RADEON_ALPHA_BLEND_SRC_INVSRCALPHA (5 << 16)
+# define RADEON_ALPHA_BLEND_SRC_DESTALPHA (6 << 16)
+# define RADEON_ALPHA_BLEND_SRC_INVDESTALPHA (7 << 16)
+# define RADEON_ALPHA_BLEND_SRC_DESTCOLOR (8 << 16)
+# define RADEON_ALPHA_BLEND_SRC_INVDESTCOLOR (9 << 16)
+# define RADEON_ALPHA_BLEND_SRC_SRCALPHASAT (10 << 16)
+# define RADEON_ALPHA_BLEND_SRC_BOTHSRCALPHA (11 << 16)
+# define RADEON_ALPHA_BLEND_SRC_BOTHINVSRCALPHA (12 << 16)
+# define RADEON_ALPHA_BLEND_SRC_MASK (15 << 16)
+# define RADEON_ALPHA_BLEND_DST_ZERO (0 << 20)
+# define RADEON_ALPHA_BLEND_DST_ONE (1 << 20)
+# define RADEON_ALPHA_BLEND_DST_SRCCOLOR (2 << 20)
+# define RADEON_ALPHA_BLEND_DST_INVSRCCOLOR (3 << 20)
+# define RADEON_ALPHA_BLEND_DST_SRCALPHA (4 << 20)
+# define RADEON_ALPHA_BLEND_DST_INVSRCALPHA (5 << 20)
+# define RADEON_ALPHA_BLEND_DST_DESTALPHA (6 << 20)
+# define RADEON_ALPHA_BLEND_DST_INVDESTALPHA (7 << 20)
+# define RADEON_ALPHA_BLEND_DST_DESTCOLOR (8 << 20)
+# define RADEON_ALPHA_BLEND_DST_INVDESTCOLOR (9 << 20)
+# define RADEON_ALPHA_BLEND_DST_SRCALPHASAT (10 << 20)
+# define RADEON_ALPHA_BLEND_DST_MASK (15 << 20)
+# define RADEON_ALPHA_TEST_NEVER (0 << 24)
+# define RADEON_ALPHA_TEST_LESS (1 << 24)
+# define RADEON_ALPHA_TEST_LESSEQUAL (2 << 24)
+# define RADEON_ALPHA_TEST_EQUAL (3 << 24)
+# define RADEON_ALPHA_TEST_GREATEREQUAL (4 << 24)
+# define RADEON_ALPHA_TEST_GREATER (5 << 24)
+# define RADEON_ALPHA_TEST_NEQUAL (6 << 24)
+# define RADEON_ALPHA_TEST_ALWAYS (7 << 24)
+# define RADEON_ALPHA_TEST_MASK (7 << 24)
+#define RADEON_TEXTURE_CLR_CMP_CLR_C 0x1ca4
+#define RADEON_TEXTURE_CLR_CMP_MSK_C 0x1ca8
+#define RADEON_FOG_COLOR_C 0x1cac
+# define RADEON_FOG_BLUE_SHIFT 0
+# define RADEON_FOG_GREEN_SHIFT 8
+# define RADEON_FOG_RED_SHIFT 16
+#define RADEON_PRIM_TEX_CNTL_C 0x1cb0
+# define RADEON_MIN_BLEND_NEAREST (0 << 1)
+# define RADEON_MIN_BLEND_LINEAR (1 << 1)
+# define RADEON_MIN_BLEND_MIPNEAREST (2 << 1)
+# define RADEON_MIN_BLEND_MIPLINEAR (3 << 1)
+# define RADEON_MIN_BLEND_LINEARMIPNEAREST (4 << 1)
+# define RADEON_MIN_BLEND_LINEARMIPLINEAR (5 << 1)
+# define RADEON_MIN_BLEND_MASK (7 << 1)
+# define RADEON_MAG_BLEND_NEAREST (0 << 4)
+# define RADEON_MAG_BLEND_LINEAR (1 << 4)
+# define RADEON_MAG_BLEND_MASK (7 << 4)
+# define RADEON_MIP_MAP_DISABLE (1 << 7)
+# define RADEON_TEX_CLAMP_S_WRAP (0 << 8)
+# define RADEON_TEX_CLAMP_S_MIRROR (1 << 8)
+# define RADEON_TEX_CLAMP_S_CLAMP (2 << 8)
+# define RADEON_TEX_CLAMP_S_BORDER_COLOR (3 << 8)
+# define RADEON_TEX_CLAMP_S_MASK (3 << 8)
+# define RADEON_TEX_WRAP_S (1 << 10)
+# define RADEON_TEX_CLAMP_T_WRAP (0 << 11)
+# define RADEON_TEX_CLAMP_T_MIRROR (1 << 11)
+# define RADEON_TEX_CLAMP_T_CLAMP (2 << 11)
+# define RADEON_TEX_CLAMP_T_BORDER_COLOR (3 << 11)
+# define RADEON_TEX_CLAMP_T_MASK (3 << 11)
+# define RADEON_TEX_WRAP_T (1 << 13)
+# define RADEON_TEX_PERSPECTIVE_DISABLE (1 << 14)
+# define RADEON_DATATYPE_VQ (0 << 16)
+# define RADEON_DATATYPE_CI4 (1 << 16)
+# define RADEON_DATATYPE_CI8 (2 << 16)
+# define RADEON_DATATYPE_ARGB1555 (3 << 16)
+# define RADEON_DATATYPE_RGB565 (4 << 16)
+# define RADEON_DATATYPE_RGB888 (5 << 16)
+# define RADEON_DATATYPE_ARGB8888 (6 << 16)
+# define RADEON_DATATYPE_RGB332 (7 << 16)
+# define RADEON_DATATYPE_Y8 (8 << 16)
+# define RADEON_DATATYPE_RGB8 (9 << 16)
+# define RADEON_DATATYPE_CI16 (10 << 16)
+# define RADEON_DATATYPE_YUV422 (11 << 16)
+# define RADEON_DATATYPE_YUV422_2 (12 << 16)
+# define RADEON_DATATYPE_AYUV444 (14 << 16)
+# define RADEON_DATATYPE_ARGB4444 (15 << 16)
+# define RADEON_PALLETE_EITHER (0 << 20)
+# define RADEON_PALLETE_1 (1 << 20)
+# define RADEON_PALLETE_2 (2 << 20)
+# define RADEON_PSEUDOCOLOR_DT_RGB565 (0 << 24)
+# define RADEON_PSEUDOCOLOR_DT_ARGB1555 (1 << 24)
+# define RADEON_PSEUDOCOLOR_DT_ARGB4444 (2 << 24)
+#define RADEON_PRIM_TEXTURE_COMBINE_CNTL_C 0x1cb4
+# define RADEON_COMB_DIS (0 << 0)
+# define RADEON_COMB_COPY (1 << 0)
+# define RADEON_COMB_COPY_INP (2 << 0)
+# define RADEON_COMB_MODULATE (3 << 0)
+# define RADEON_COMB_MODULATE2X (4 << 0)
+# define RADEON_COMB_MODULATE4X (5 << 0)
+# define RADEON_COMB_ADD (6 << 0)
+# define RADEON_COMB_ADD_SIGNED (7 << 0)
+# define RADEON_COMB_BLEND_VERTEX (8 << 0)
+# define RADEON_COMB_BLEND_TEXTURE (9 << 0)
+# define RADEON_COMB_BLEND_CONST (10 << 0)
+# define RADEON_COMB_BLEND_PREMULT (11 << 0)
+# define RADEON_COMB_BLEND_PREV (12 << 0)
+# define RADEON_COMB_BLEND_PREMULT_INV (13 << 0)
+# define RADEON_COMB_ADD_SIGNED2X (14 << 0)
+# define RADEON_COMB_BLEND_CONST_COLOR (15 << 0)
+# define RADEON_COMB_MASK (15 << 0)
+# define RADEON_COLOR_FACTOR_TEX (4 << 4)
+# define RADEON_COLOR_FACTOR_NTEX (5 << 4)
+# define RADEON_COLOR_FACTOR_ALPHA (6 << 4)
+# define RADEON_COLOR_FACTOR_NALPHA (7 << 4)
+# define RADEON_COLOR_FACTOR_MASK (15 << 4)
+# define RADEON_INPUT_FACTOR_CONST_COLOR (2 << 10)
+# define RADEON_INPUT_FACTOR_CONST_ALPHA (3 << 10)
+# define RADEON_INPUT_FACTOR_INT_COLOR (4 << 10)
+# define RADEON_INPUT_FACTOR_INT_ALPHA (5 << 10)
+# define RADEON_INPUT_FACTOR_MASK (15 << 10)
+# define RADEON_COMB_ALPHA_DIS (0 << 14)
+# define RADEON_COMB_ALPHA_COPY (1 << 14)
+# define RADEON_COMB_ALPHA_COPY_INP (2 << 14)
+# define RADEON_COMB_ALPHA_MODULATE (3 << 14)
+# define RADEON_COMB_ALPHA_MODULATE2X (4 << 14)
+# define RADEON_COMB_ALPHA_MODULATE4X (5 << 14)
+# define RADEON_COMB_ALPHA_ADD (6 << 14)
+# define RADEON_COMB_ALPHA_ADD_SIGNED (7 << 14)
+# define RADEON_COMB_ALPHA_ADD_SIGNED2X (14 << 14)
+# define RADEON_COMB_ALPHA_MASK (15 << 14)
+# define RADEON_ALPHA_FACTOR_TEX_ALPHA (6 << 18)
+# define RADEON_ALPHA_FACTOR_NTEX_ALPHA (7 << 18)
+# define RADEON_ALPHA_FACTOR_MASK (15 << 18)
+# define RADEON_INP_FACTOR_A_CONST_ALPHA (1 << 25)
+# define RADEON_INP_FACTOR_A_INT_ALPHA (2 << 25)
+# define RADEON_INP_FACTOR_A_MASK (7 << 25)
+#define RADEON_TEX_SIZE_PITCH_C 0x1cb8
+# define RADEON_TEX_PITCH_SHIFT 0
+# define RADEON_TEX_SIZE_SHIFT 4
+# define RADEON_TEX_HEIGHT_SHIFT 8
+# define RADEON_TEX_MIN_SIZE_SHIFT 12
+# define RADEON_SEC_TEX_PITCH_SHIFT 16
+# define RADEON_SEC_TEX_SIZE_SHIFT 20
+# define RADEON_SEC_TEX_HEIGHT_SHIFT 24
+# define RADEON_SEC_TEX_MIN_SIZE_SHIFT 28
+# define RADEON_TEX_PITCH_MASK (0x0f << 0)
+# define RADEON_TEX_SIZE_MASK (0x0f << 4)
+# define RADEON_TEX_HEIGHT_MASK (0x0f << 8)
+# define RADEON_TEX_MIN_SIZE_MASK (0x0f << 12)
+# define RADEON_SEC_TEX_PITCH_MASK (0x0f << 16)
+# define RADEON_SEC_TEX_SIZE_MASK (0x0f << 20)
+# define RADEON_SEC_TEX_HEIGHT_MASK (0x0f << 24)
+# define RADEON_SEC_TEX_MIN_SIZE_MASK (0x0f << 28)
+# define RADEON_TEX_SIZE_PITCH_SHIFT 0
+# define RADEON_SEC_TEX_SIZE_PITCH_SHIFT 16
+# define RADEON_TEX_SIZE_PITCH_MASK (0xffff << 0)
+# define RADEON_SEC_TEX_SIZE_PITCH_MASK (0xffff << 16)
+#define RADEON_PRIM_TEX_0_OFFSET_C 0x1cbc
+#define RADEON_PRIM_TEX_1_OFFSET_C 0x1cc0
+#define RADEON_PRIM_TEX_2_OFFSET_C 0x1cc4
+#define RADEON_PRIM_TEX_3_OFFSET_C 0x1cc8
+#define RADEON_PRIM_TEX_4_OFFSET_C 0x1ccc
+#define RADEON_PRIM_TEX_5_OFFSET_C 0x1cd0
+#define RADEON_PRIM_TEX_6_OFFSET_C 0x1cd4
+#define RADEON_PRIM_TEX_7_OFFSET_C 0x1cd8
+#define RADEON_PRIM_TEX_8_OFFSET_C 0x1cdc
+#define RADEON_PRIM_TEX_9_OFFSET_C 0x1ce0
+#define RADEON_PRIM_TEX_10_OFFSET_C 0x1ce4
+# define RADEON_TEX_NO_TILE (0 << 30)
+# define RADEON_TEX_TILED_BY_HOST (1 << 30)
+# define RADEON_TEX_TILED_BY_STORAGE (2 << 30)
+# define RADEON_TEX_TILED_BY_STORAGE2 (3 << 30)
+
+#define RADEON_SEC_TEX_CNTL_C 0x1d00
+# define RADEON_SEC_SELECT_PRIM_ST (0 << 0)
+# define RADEON_SEC_SELECT_SEC_ST (1 << 0)
+#define RADEON_SEC_TEX_COMBINE_CNTL_C 0x1d04
+# define RADEON_INPUT_FACTOR_PREV_COLOR (8 << 10)
+# define RADEON_INPUT_FACTOR_PREV_ALPHA (9 << 10)
+# define RADEON_INP_FACTOR_A_PREV_ALPHA (4 << 25)
+#define RADEON_SEC_TEX_0_OFFSET_C 0x1d08
+#define RADEON_SEC_TEX_1_OFFSET_C 0x1d0c
+#define RADEON_SEC_TEX_2_OFFSET_C 0x1d10
+#define RADEON_SEC_TEX_3_OFFSET_C 0x1d14
+#define RADEON_SEC_TEX_4_OFFSET_C 0x1d18
+#define RADEON_SEC_TEX_5_OFFSET_C 0x1d1c
+#define RADEON_SEC_TEX_6_OFFSET_C 0x1d20
+#define RADEON_SEC_TEX_7_OFFSET_C 0x1d24
+#define RADEON_SEC_TEX_8_OFFSET_C 0x1d28
+#define RADEON_SEC_TEX_9_OFFSET_C 0x1d2c
+#define RADEON_SEC_TEX_10_OFFSET_C 0x1d30
+#define RADEON_CONSTANT_COLOR_C 0x1d34
+# define RADEON_CONSTANT_BLUE_SHIFT 0
+# define RADEON_CONSTANT_GREEN_SHIFT 8
+# define RADEON_CONSTANT_RED_SHIFT 16
+# define RADEON_CONSTANT_ALPHA_SHIFT 24
+#define RADEON_PRIM_TEXTURE_BORDER_COLOR_C 0x1d38
+# define RADEON_PRIM_TEX_BORDER_BLUE_SHIFT 0
+# define RADEON_PRIM_TEX_BORDER_GREEN_SHIFT 8
+# define RADEON_PRIM_TEX_BORDER_RED_SHIFT 16
+# define RADEON_PRIM_TEX_BORDER_ALPHA_SHIFT 24
+#define RADEON_SEC_TEXTURE_BORDER_COLOR_C 0x1d3c
+# define RADEON_SEC_TEX_BORDER_BLUE_SHIFT 0
+# define RADEON_SEC_TEX_BORDER_GREEN_SHIFT 8
+# define RADEON_SEC_TEX_BORDER_RED_SHIFT 16
+# define RADEON_SEC_TEX_BORDER_ALPHA_SHIFT 24
+#define RADEON_STEN_REF_MASK_C 0x1d40
+# define RADEON_STEN_REFERENCE_SHIFT 0
+# define RADEON_STEN_MASK_SHIFT 16
+# define RADEON_STEN_WRITE_MASK_SHIFT 24
+#define RADEON_PLANE_3D_MASK_C 0x1d44
+#define RADEON_TEX_CACHE_STAT_COUNT 0x1974
+
+
+ /* Constants */
+#define RADEON_AGP_TEX_OFFSET 0x02000000
+
+#define RADEON_VB_AGE_REG RADEON_GUI_SCRATCH_REG0
+#define RADEON_SWAP_AGE_REG RADEON_GUI_SCRATCH_REG1
+
+ /* CCE packet types */
+#define RADEON_CCE_PACKET0 0x00000000
+#define RADEON_CCE_PACKET0_ONE_REG_WR 0x00008000
+#define RADEON_CCE_PACKET1 0x40000000
+#define RADEON_CCE_PACKET2 0x80000000
+#define RADEON_CCE_PACKET3_NOP 0xC0001000
+#define RADEON_CCE_PACKET3_PAINT 0xC0001100
+#define RADEON_CCE_PACKET3_BITBLT 0xC0001200
+#define RADEON_CCE_PACKET3_SMALLTEXT 0xC0001300
+#define RADEON_CCE_PACKET3_HOSTDATA_BLT 0xC0001400
+#define RADEON_CCE_PACKET3_POLYLINE 0xC0001500
+#define RADEON_CCE_PACKET3_SCALING 0xC0001600
+#define RADEON_CCE_PACKET3_TRANS_SCALING 0xC0001700
+#define RADEON_CCE_PACKET3_POLYSCANLINES 0xC0001800
+#define RADEON_CCE_PACKET3_NEXT_CHAR 0xC0001900
+#define RADEON_CCE_PACKET3_PAINT_MULTI 0xC0001A00
+#define RADEON_CCE_PACKET3_BITBLT_MULTI 0xC0001B00
+#define RADEON_CCE_PACKET3_PLY_NEXTSCAN 0xC0001D00
+#define RADEON_CCE_PACKET3_SET_SCISSORS 0xC0001E00
+#define RADEON_CCE_PACKET3_SET_MODE24BPP 0xC0001F00
+#define RADEON_CCE_PACKET3_CNTL_PAINT 0xC0009100
+#define RADEON_CCE_PACKET3_CNTL_BITBLT 0xC0009200
+#define RADEON_CCE_PACKET3_CNTL_SMALLTEXT 0xC0009300
+#define RADEON_CCE_PACKET3_CNTL_HOSTDATA_BLT 0xC0009400
+#define RADEON_CCE_PACKET3_CNTL_POLYLINE 0xC0009500
+#define RADEON_CCE_PACKET3_CNTL_SCALING 0xC0009600
+#define RADEON_CCE_PACKET3_CNTL_TRANS_SCALING 0xC0009700
+#define RADEON_CCE_PACKET3_CNTL_POLYSCANLINES 0xC0009800
+#define RADEON_CCE_PACKET3_CNTL_NEXT_CHAR 0xC0009900
+#define RADEON_CCE_PACKET3_CNTL_PAINT_MULTI 0xC0009A00
+#define RADEON_CCE_PACKET3_CNTL_BITBLT_MULTI 0xC0009B00
+#define RADEON_CCE_PACKET3_CNTL_TRANS_BITBLT 0xC0009C00
+#define RADEON_CCE_PACKET3_3D_SAVE_CONTEXT 0xC0002000
+#define RADEON_CCE_PACKET3_3D_PLAY_CONTEXT 0xC0002100
+#define RADEON_CCE_PACKET3_3D_RNDR_GEN_INDX_PRIM 0xC0002300
+#define RADEON_CCE_PACKET3_3D_RNDR_GEN_PRIM 0xC0002500
+#define RADEON_CCE_PACKET3_LOAD_PALETTE 0xC0002C00
+#define RADEON_CCE_PACKET3_PURGE 0xC0002D00
+#define RADEON_CCE_PACKET3_NEXT_VERTEX_BUNDLE 0xC0002E00
+# define RADEON_CCE_PACKET_MASK 0xC0000000
+# define RADEON_CCE_PACKET_COUNT_MASK 0x3fff0000
+# define RADEON_CCE_PACKET_MAX_DWORDS (1 << 14)
+# define RADEON_CCE_PACKET0_REG_MASK 0x000007ff
+# define RADEON_CCE_PACKET1_REG0_MASK 0x000007ff
+# define RADEON_CCE_PACKET1_REG1_MASK 0x003ff800
+
+#define RADEON_CCE_VC_FRMT_RHW 0x00000001
+#define RADEON_CCE_VC_FRMT_DIFFUSE_BGR 0x00000002
+#define RADEON_CCE_VC_FRMT_DIFFUSE_A 0x00000004
+#define RADEON_CCE_VC_FRMT_DIFFUSE_ARGB 0x00000008
+#define RADEON_CCE_VC_FRMT_SPEC_BGR 0x00000010
+#define RADEON_CCE_VC_FRMT_SPEC_F 0x00000020
+#define RADEON_CCE_VC_FRMT_SPEC_FRGB 0x00000040
+#define RADEON_CCE_VC_FRMT_S_T 0x00000080
+#define RADEON_CCE_VC_FRMT_S2_T2 0x00000100
+#define RADEON_CCE_VC_FRMT_RHW2 0x00000200
+
+#define RADEON_CCE_VC_CNTL_PRIM_TYPE_NONE 0x00000000
+#define RADEON_CCE_VC_CNTL_PRIM_TYPE_POINT 0x00000001
+#define RADEON_CCE_VC_CNTL_PRIM_TYPE_LINE 0x00000002
+#define RADEON_CCE_VC_CNTL_PRIM_TYPE_POLY_LINE 0x00000003
+#define RADEON_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST 0x00000004
+#define RADEON_CCE_VC_CNTL_PRIM_TYPE_TRI_FAN 0x00000005
+#define RADEON_CCE_VC_CNTL_PRIM_TYPE_TRI_STRIP 0x00000006
+#define RADEON_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2 0x00000007
+#define RADEON_CCE_VC_CNTL_PRIM_WALK_IND 0x00000010
+#define RADEON_CCE_VC_CNTL_PRIM_WALK_LIST 0x00000020
+#define RADEON_CCE_VC_CNTL_PRIM_WALK_RING 0x00000030
+#define RADEON_CCE_VC_CNTL_NUM_SHIFT 16
+
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/init300.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/init300.c
index 2b669d811..261d29ee1 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/init300.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/init300.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init300.c,v 1.3 2000/09/22 11:35:46 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init300.c,v 1.4 2000/09/26 15:57:14 tsi Exp $ */
#include "xf86.h"
#include "xf86PciInfo.h"
@@ -1062,7 +1062,7 @@ USHORT CalcRefreshRate(ScrnInfoPtr pScrn, DisplayModePtr mode)
break;
}
- while(RefreshRate[Index][i] != NULL)
+ while(RefreshRate[Index][i] != 0)
{
if(temp == RefreshRate[Index][i])
{
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c
index 446b4d29e..7d72a139d 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.3 2000/09/22 11:35:46 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.6 2000/10/10 16:38:19 alanh Exp $ */
/* modified from tdfx_dri.c, mga_dri.c */
@@ -24,9 +24,6 @@
#include "sis300_accel.h"
-#include "sis_drm_public.h"
-#include "drm.h"
-
extern void GlxSetVisualConfigs(
int nconfigs,
__GLXvisualConfig *configs,
@@ -371,13 +368,7 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
pSISDRI->AGPCmdBufOffset = pSIS->agpCmdBufAddr - pSIS->agpAddr;
pSISDRI->AGPCmdBufSize = pSIS->agpCmdBufSize;
- {
- drm_sis_agp_t agp;
-
- agp.offset = AGP_CMDBUF_SIZE;
- agp.size = AGP_SIZE - AGP_CMDBUF_SIZE;
- xf86ioctl(pSIS->drmSubFD, SIS_IOCTL_AGP_INIT, &agp);
- }
+ drmSiSAgpInit(pSIS->drmSubFD, AGP_CMDBUF_SIZE,(AGP_SIZE - AGP_CMDBUF_SIZE));
}
while(0);
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dga.c b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dga.c
index 5729c5e31..3ba43df23 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dga.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dga.c
@@ -21,7 +21,7 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dga.c,v 1.1 2000/05/23 04:47:44 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dga.c,v 1.2 2000/10/17 16:53:17 tsi Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -153,7 +153,7 @@ static Bool FFB_OpenFramebuffer(ScrnInfoPtr pScrn, char **name, unsigned char **
{
FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn);
- *name = &pFfb->psdp->device;
+ *name = pFfb->psdp->device;
/* We give the user the dumb frame buffer. */
*mem = (unsigned char *)FFB_DFB24_VOFF;
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h
index 74eab72e8..17221f249 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h
@@ -5,7 +5,7 @@
Copyright: 1998,1999
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h,v 1.10 2000/06/17 00:03:24 martin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h,v 1.11 2000/09/26 15:57:14 tsi Exp $ */
#ifndef _TDFX_H_
#define _TDFX_H_
@@ -149,8 +149,8 @@ typedef struct _TDFXRec {
int MaxClock;
int ChipType;
pciVideoPtr PciInfo;
- int LinearAddr[MAXCHIPS];
- int MMIOAddr[MAXCHIPS];
+ unsigned long LinearAddr[MAXCHIPS];
+ unsigned long MMIOAddr[MAXCHIPS];
EntityInfoPtr pEnt;
int numChips;
PCITAG PciTag[MAXCHIPS];
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c
index 87960acf3..89ba45a50 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c,v 1.14 2000/08/25 16:25:36 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c,v 1.15 2000/09/24 13:51:30 alanh Exp $ */
/* All drivers should typically include these */
#include "xf86.h"
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c
index 0831c92b4..a9fc4499b 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c,v 1.10 2000/06/23 23:43:45 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c,v 1.12 2000/09/26 15:57:15 tsi Exp $ */
#include "xf86.h"
#include "xf86_OSproc.h"
@@ -307,7 +307,7 @@ Bool TDFXDRIScreenInit(ScreenPtr pScreen)
pDRIInfo = DRICreateInfoRec();
if (!pDRIInfo) {
xf86DrvMsg(pScreen->myNum, X_ERROR,
- "DRICreatInfoRect() failed, disabling DRI.\n");
+ "DRICreateInfoRect() failed, disabling DRI.\n");
return FALSE;
}
@@ -449,10 +449,6 @@ TDFXCreateContext(ScreenPtr pScreen, VisualPtr visual,
drmContext hwContext, void *pVisualConfigPriv,
DRIContextType contextStore)
{
- TDFXConfigPrivPtr pTDFXConfig = (TDFXConfigPrivPtr)pVisualConfigPriv;
- TDFXDRIContextPtr ctx;
-
- ctx=(TDFXDRIContextPtr)contextStore;
return TRUE;
}
@@ -460,8 +456,6 @@ static void
TDFXDestroyContext(ScreenPtr pScreen, drmContext hwContext,
DRIContextType contextStore)
{
- TDFXDRIContextPtr ctx;
- ctx=(TDFXDRIContextPtr)contextStore;
}
Bool
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c
index 201216076..48c16e61e 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c
@@ -25,7 +25,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.42 2000/09/20 00:09:30 keithp Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.43 2000/09/24 13:51:31 alanh Exp $ */
/*
* Authors:
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h
index b5ea9f908..850f35398 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h,v 1.6 2000/06/17 00:03:25 martin Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h,v 1.7 2000/09/24 13:51:31 alanh Exp $ */
/*
Voodoo Banshee driver version 1.0.1
diff --git a/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c b/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c
index d875edefc..52fdb941b 100644
--- a/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c
+++ b/xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c,v 1.10 2000/03/06 22:59:31 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c,v 1.11 2000/10/20 12:57:26 alanh Exp $ */
/*
* Copyright 1996,1997 by Alan Hourihane, Wigan, England.
@@ -135,14 +135,11 @@ DEC21030AccelInit(ScreenPtr pScreen)
TGA_AccelInfoRec->SubsequentSolidFillRect = TGASubsequentSolidFillRect;
/* screen to screen copy */
- if(pTga->depthflag == BPP8PACKED) { /* screen to screen copy apparently doesn't work
- for 32bpp tga */
- TGA_AccelInfoRec->ScreenToScreenCopyFlags = NO_TRANSPARENCY;
- TGA_AccelInfoRec->SetupForScreenToScreenCopy =
- TGASetupForScreenToScreenCopy;
- TGA_AccelInfoRec->SubsequentScreenToScreenCopy =
- TGASubsequentScreenToScreenCopy;
- }
+ TGA_AccelInfoRec->ScreenToScreenCopyFlags = NO_TRANSPARENCY;
+ TGA_AccelInfoRec->SetupForScreenToScreenCopy =
+ TGASetupForScreenToScreenCopy;
+ TGA_AccelInfoRec->SubsequentScreenToScreenCopy =
+ TGASubsequentScreenToScreenCopy;
/* mono 8x8 pattern fill */
@@ -155,21 +152,19 @@ DEC21030AccelInit(ScreenPtr pScreen)
/* color expand */
/* does not work for 32bpp (yet) */
- if(pTga->depthflag == BPP8PACKED) {
- TGA_AccelInfoRec->ScanlineCPUToScreenColorExpandFillFlags =
- BIT_ORDER_IN_BYTE_LSBFIRST;
-
- TGA_AccelInfoRec->NumScanlineColorExpandBuffers = 1;
- pTga->buffers[0] = (CARD32 *)malloc(CE_BUFSIZE);
- TGA_AccelInfoRec->ScanlineColorExpandBuffers =
- (unsigned char **)pTga->buffers;
- TGA_AccelInfoRec->SetupForScanlineCPUToScreenColorExpandFill =
- TGASetupForScanlineCPUToScreenColorExpandFill;
- TGA_AccelInfoRec->SubsequentScanlineCPUToScreenColorExpandFill =
- TGASubsequentScanlineCPUToScreenColorExpandFill;
- TGA_AccelInfoRec->SubsequentColorExpandScanline =
- TGASubsequentColorExpandScanline;
- }
+ TGA_AccelInfoRec->ScanlineCPUToScreenColorExpandFillFlags =
+ BIT_ORDER_IN_BYTE_LSBFIRST;
+
+ TGA_AccelInfoRec->NumScanlineColorExpandBuffers = 1;
+ pTga->buffers[0] = (CARD32 *)malloc(CE_BUFSIZE);
+ TGA_AccelInfoRec->ScanlineColorExpandBuffers =
+ (unsigned char **)pTga->buffers;
+ TGA_AccelInfoRec->SetupForScanlineCPUToScreenColorExpandFill =
+ TGASetupForScanlineCPUToScreenColorExpandFill;
+ TGA_AccelInfoRec->SubsequentScanlineCPUToScreenColorExpandFill =
+ TGASubsequentScanlineCPUToScreenColorExpandFill;
+ TGA_AccelInfoRec->SubsequentColorExpandScanline =
+ TGASubsequentColorExpandScanline;
/* lines */
@@ -210,9 +205,9 @@ TGASetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
#ifdef PROFILE
unsigned int start, stop;
#endif
- register unsigned long iobase, offset;
TGAPtr pTga = NULL;
unsigned int fgcolor = 0, bgcolor = 0, pmask = 0;
+ TGA_DECL();
pTga = TGAPTR(pScrn);
TGA_GET_IOBASE();
@@ -274,8 +269,8 @@ TGASubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
#ifdef PROFILE
unsigned int start, stop;
#endif
- register unsigned long iobase, offset;
TGAPtr pTga;
+ TGA_DECL();
pTga = TGAPTR(pScrn);
TGA_GET_IOBASE();
@@ -315,27 +310,32 @@ TGASubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
#ifdef PROFILE
unsigned int start, stop;
#endif
- register unsigned long iobase, offset;
TGAPtr pTga;
unsigned char *p = NULL;
int width = 0;
unsigned int addr;
unsigned int pixelmask = 0;
unsigned int stipple;
+ unsigned int align_mask;
int align = 0;
int skipleft;
CARD32 c = 0, d = 0;
CARD32 *e = NULL;
int i = 0, num_dwords = 0;
+ TGA_DECL();
pTga = TGAPTR(pScrn);
TGA_GET_IOBASE();
TGA_GET_OFFSET();
-/* ErrorF("TGASubsequentColorExpandScanline called\n"); */
-/* if(pTga->transparent_pattern_p) */
-/* ErrorF("transparent color expand\n"); */
+ align_mask = (pTga->depthflag == BPP24) ? 0x0f : 0x03;
+
+#if 0
+ ErrorF("TGASubsequentColorExpandScanline called\n");
+ if(pTga->transparent_pattern_p)
+ ErrorF("transparent color expand\n");
+#endif
p = (unsigned char *)pTga->buffers[0];
addr = FB_OFFSET(pTga->ce_x, pTga->ce_y);
@@ -345,12 +345,13 @@ TGASubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
while(width > 0) {
if(!pTga->transparent_pattern_p)
pixelmask = 0xFFFFFFFF;
- if(addr & 0x3) {
- align = addr & 0x3;
- if(!pTga->transparent_pattern_p)
+
+ align = (addr & align_mask) / pTga->Bpp; /* no. pixels out of align */
+ if (align) {
+ if (!pTga->transparent_pattern_p)
pixelmask <<= align;
-/* ErrorF("aligment is %d\n", align); */
- addr -= align;
+/* ErrorF("alignment is %d\n", align); */
+ addr -= align * pTga->Bpp;
width += align;
e = (CARD32 *)p;
@@ -369,41 +370,43 @@ TGASubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
}
}
-
- if(!pTga->transparent_pattern_p) {
- if(skipleft) {
+ if (!pTga->transparent_pattern_p) {
+ if (skipleft) {
pixelmask <<= skipleft;
skipleft = 0;
}
- if(width < 32)
+ if (width < 32) {
pixelmask &= (0xFFFFFFFF >> (32 - width));
+ }
+ TGA_FAST_WRITE_REG(pixelmask, TGA_PIXELMASK_REG);
}
else {
unsigned int *i = NULL;
/* ErrorF("transparent scanline with x = %d, y = %d, w = %d, h = %d\n", pTga->ce_x, pTga->ce_y, pTga->ce_width, pTga->ce_height); */
- if(skipleft) {
+ if (skipleft) {
i = (unsigned int *)p;
*i &= (0xFFFFFFFF << skipleft);
skipleft = 0;
}
- if(width < 32) {
+ if (width < 32) {
i = (unsigned int *)p;
*i &= (0xFFFFFFFF >> (32 - width));
}
}
- if(!pTga->transparent_pattern_p)
- TGA_FAST_WRITE_REG(pixelmask, TGA_PIXELMASK_REG);
- TGA_FAST_WRITE_REG(addr, TGA_ADDRESS_REG);
stipple = *((unsigned int *)p);
- TGA_FAST_WRITE_REG(stipple, TGA_CONTINUE_REG);
- addr += 32;
+ switch (pTga->Chipset) {
+ case PCI_CHIP_TGA2:
+ *(unsigned int *)(pTga->FbBase + addr) = stipple; WMB;
+ break;
+ case PCI_CHIP_DEC21030:
+ TGA_FAST_WRITE_REG(addr, TGA_ADDRESS_REG);
+ TGA_FAST_WRITE_REG(stipple, TGA_CONTINUE_REG);
+ }
+ addr += 32 * pTga->Bpp;
p += 4;
width -= 32;
- if(align) {
- align = 0;
- }
}
pTga->ce_height--;
if(pTga->ce_height == 0) {
@@ -430,9 +433,9 @@ TGASetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
#ifdef PROFILE
unsigned int start, stop;
#endif
- register unsigned long iobase, offset;
TGAPtr pTga;
unsigned int fgcolor = 0, pmask = 0;
+ TGA_DECL();
pTga = TGAPTR(pScrn);
TGA_GET_IOBASE();
@@ -487,8 +490,8 @@ TGASubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h)
#ifdef PROFILE
unsigned int stop, start;
#endif
- register unsigned long iobase, offset;
TGAPtr pTga;
+ TGA_DECL();
pTga = TGAPTR(pScrn);
TGA_GET_IOBASE();
@@ -547,9 +550,9 @@ TGASetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
#ifdef PROFILE
unsigned int start, stop;
#endif
- register unsigned long iobase, offset;
TGAPtr pTga;
unsigned int pmask = 0;
+ TGA_DECL();
pTga = TGAPTR(pScrn);
TGA_GET_IOBASE();
@@ -557,9 +560,7 @@ TGASetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
/* see section 6.2.9 */
- /* ErrorF("TGASetupForScreenToScreenCopy called\n"); */
-
- if(pTga->depthflag == BPP8PACKED) {
+ if (pTga->depthflag == BPP8PACKED) {
pmask = planemask | (planemask << 8) | (planemask << 16) |
(planemask << 24);
}
@@ -572,7 +573,7 @@ TGASetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
pTga->current_rop = rop | pTga->depthflag;
/* do we copy a rectangle from top to bottom or bottom to top? */
- if(ydir == -1) {
+ if (ydir == -1) {
pTga->blitdir = BLIT_FORWARDS;
}
else {
@@ -581,6 +582,7 @@ TGASetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
TGA_SAVE_OFFSET();
return;
}
+
/*
* This is the implementation of the SubsequentForScreenToScreenCopy
* that sends commands to the coprocessor to perform a screen-to-screen
@@ -601,23 +603,32 @@ TGASubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2,
#ifdef PROFILE
unsigned int stop, start;
#endif
- register unsigned long iobase, offset;
TGAPtr pTga;
+ TGA_DECL();
pTga = TGAPTR(pScrn);
TGA_GET_IOBASE();
TGA_GET_OFFSET();
-
- /* ErrorF("TGASubsequentScreenToScreenCopy called\n"); */
-
+#if 0
+ ErrorF("TGASubsequentScreenToScreenCopy(,%d,%d,%d,%d,%d,%d):"
+ " COPY %s BLIT %s\n",
+ x1, y1, x2, y2, w, h, (x2 > x1 && (x1 + w) > x2)?"BWD":"FWD",
+ (pTga->blitdir == BLIT_FORWARDS)?"FWD":"BWD");
+#endif
+ TGASync(pScrn); /* ?? */
+
TGA_FAST_WRITE_REG(COPY | X11 | pTga->depthflag, TGA_MODE_REG);
TGA_FAST_WRITE_REG(pTga->current_rop, TGA_RASTEROP_REG);
TGA_FAST_WRITE_REG(pTga->current_planemask, TGA_PLANEMASK_REG);
+#if 1
if(x2 > x1 && (x1 + w) > x2)
copy_func = TGACopyLineBackwards;
else
copy_func = TGACopyLineForwards;
+#else
+ copy_func = TGACopyLineForwards;
+#endif
TGA_SAVE_OFFSET();
if(pTga->blitdir == BLIT_FORWARDS) {
@@ -631,6 +642,8 @@ TGASubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2,
}
}
+ TGASync(pScrn); /* ?? */
+
TGA_GET_OFFSET();
TGA_FAST_WRITE_REG(SIMPLE | X11 | pTga->depthflag, TGA_MODE_REG);
TGA_FAST_WRITE_REG(MIX_SRC | pTga->depthflag, TGA_RASTEROP_REG);
@@ -648,59 +661,84 @@ TGACopyLineForwards(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int w)
int read;
unsigned long source_address, destination_address;
unsigned int mask_source, mask_destination;
+ unsigned int cando, cando_mask;
int source_align, destination_align;
int pixel_shift;
- register unsigned long iobase, offset;
#ifdef PROFILE
unsigned int start, stop;
#endif
TGAPtr pTga;
+ TGA_DECL();
pTga = TGAPTR(pScrn);
TGA_GET_IOBASE();
TGA_GET_OFFSET();
+ cando = 32;
+ cando_mask = 0xFFFFFFFFU;
+ if (pTga->Chipset == PCI_CHIP_DEC21030 && pTga->depthflag == BPP24) {
+ cando = 16;
+ cando_mask = 0x0000FFFFU;
+ }
+
source_address = FB_OFFSET(x1, y1);
destination_address = FB_OFFSET(x2, y2);
-
+#if 0
+ ErrorF("CPY-FWD(,%d,%d,%d,%d,%d): sadr = 0x%lx, dadr = 0x%lx\n",
+ x1, y1, x2, y2, w, source_address, destination_address);
+#endif
read = 0;
- while(read < w) {
- mask_source = 0xFFFFFFFF;
- if((w - read) >= 32)
- mask_destination = 0xFFFFFFFF;
+ while (read < w) {
+
+ mask_source = cando_mask;
+ if ((w - read) >= cando)
+ mask_destination = cando_mask;
else
- mask_destination = ((unsigned int)0xFFFFFFFF) >> (32 - (w - read));
+ mask_destination = cando_mask >> (cando - (w - read));
+
source_align = source_address & 0x07;
+ source_address -= source_align;
+ mask_source <<= source_align / pTga->Bpp;
+ /* mask_source &= cando_mask; */
+
destination_align = destination_address & 0x07;
- source_address = source_address - source_align;
- mask_source <<= source_align;
- destination_address = destination_address - destination_align;
- mask_destination <<= destination_align;
+ destination_address -= destination_align;
+ mask_destination <<= destination_align / pTga->Bpp;
+ /* mask_destination &= cando_mask; */
- if(destination_align >= source_align)
+ if (destination_align >= source_align)
pixel_shift = destination_align - source_align;
else {
pixel_shift = 8 - (source_align - destination_align);
/* we need to prime the residue register in this case */
- destination_address = destination_address - 8;
- mask_destination <<= 8;
+ destination_address -= 8;
+ mask_destination <<= 8 / pTga->Bpp;
+ mask_destination &= cando_mask;/* ?? */
}
-
+
TGA_FAST_WRITE_REG(pixel_shift, TGA_PIXELSHIFT_REG);
- /* use GADR and GCTR */
- TGA_FAST_WRITE_REG(source_address, TGA_ADDRESS_REG);
- TGA_FAST_WRITE_REG(mask_source, TGA_CONTINUE_REG);
- TGA_FAST_WRITE_REG(destination_address, TGA_ADDRESS_REG);
- TGA_FAST_WRITE_REG(mask_destination, TGA_CONTINUE_REG);
+ switch (pTga->Chipset) {
+ case PCI_CHIP_TGA2:
+ *(unsigned int *)(pTga->FbBase + source_address) = mask_source; WMB;
+ *(unsigned int *)(pTga->FbBase + destination_address) = mask_destination; WMB;
+ break;
+ case PCI_CHIP_DEC21030:
+ /* use GADR and GCTR */
+ TGA_FAST_WRITE_REG(source_address, TGA_ADDRESS_REG);
+ TGA_FAST_WRITE_REG(mask_source, TGA_CONTINUE_REG);
+ TGA_FAST_WRITE_REG(destination_address, TGA_ADDRESS_REG);
+ TGA_FAST_WRITE_REG(mask_destination, TGA_CONTINUE_REG);
+ break;
+ }
- source_address = source_address + (32 - pixel_shift);
- destination_address += 32;
+ source_address += (cando - (pixel_shift / pTga->Bpp)) * pTga->Bpp;
+ destination_address += cando * pTga->Bpp;
- read += 32;
- read -= destination_align; /* "read" is perhaps better
+ read += cando;
+ read -= destination_align / pTga->Bpp; /* "read" is perhaps better
called "written"... */
- if(destination_align < source_align) {
- read -= 8;
+ if (destination_align < source_align) {
+ read -= 8 / pTga->Bpp;
}
}
@@ -720,124 +758,166 @@ TGACopyLineBackwards(ScrnInfoPtr pScrn, int x1, int y1, int x2,
unsigned long a1, a2;
unsigned long source_address, destination_address;
unsigned int mask_source, mask_destination;
+ unsigned int cando, cando_mask;
int source_align, destination_align;
int pixel_shift;
int read;
#ifdef PROFILE
unsigned int start, stop;
#endif
- register unsigned long iobase, offset;
TGAPtr pTga;
+ TGA_DECL();
pTga = TGAPTR(pScrn);
TGA_GET_IOBASE();
TGA_GET_OFFSET();
+ cando = 32;
+ cando_mask = 0xFFFFFFFFU;
+ if (pTga->Chipset == PCI_CHIP_DEC21030 && pTga->depthflag == BPP24) {
+ cando = 16;
+ cando_mask = 0x0000FFFFU;
+ }
+
a1 = FB_OFFSET(x1, y1);
a2 = FB_OFFSET(x2, y2);
- source_address = FB_OFFSET((x1 + w) - 32, y1);
- destination_address = FB_OFFSET((x2 + w) - 32, y2);
-
+ source_address = FB_OFFSET((x1 + w) - cando, y1);
+ destination_address = FB_OFFSET((x2 + w) - cando, y2);
+
+#if 0
+ ErrorF("CPY-BWD(,%d,%d,%d,%d,%d): sadr = 0x%lx, dadr = 0x%lx"
+ " a1 0x%lx a2 0x%lx\n",
+ x1, y1, x2, y2, w, source_address, destination_address, a1, a2);
+#endif
+
read = 0;
- while(read < w) {
- mask_source = 0xFFFFFFFF;
- if((w - read) >= 32)
- mask_destination = 0xFFFFFFFF;
- else
- mask_destination = ((unsigned int)0xFFFFFFFF) << (32 - (w - read));
+ while (read < w) {
+ mask_source = cando_mask;
+ if ((w - read) >= cando)
+ mask_destination = cando_mask;
+ else {
+ mask_destination = ((unsigned int)cando_mask) << (cando - (w - read));
+ mask_destination &= cando_mask; /* esp. for cando==16 */
+ }
source_align = source_address & 0x07;
destination_align = destination_address & 0x07;
- if(read == 0 && destination_align &&
+ if (read == 0 && destination_align &&
(source_align > destination_align)) {
/* we want to take out all the destination_align pixels in one
little copy first, then move on to the main stuff */
unsigned long tmp_src, tmp_dest;
unsigned int tmp_src_mask, tmp_dest_mask;
- tmp_src = (a1 + w) - source_align;
- tmp_dest = ((a2 + w) - destination_align) - 8;
- tmp_src_mask = 0xFFFFFFFF;
- tmp_dest_mask = ((unsigned int)0x000000FF) >> (8 - destination_align);
- tmp_dest_mask <<= 8;
+ tmp_src = a1 + (w - (source_align / pTga->Bpp)) * pTga->Bpp;
+ tmp_dest = a2 + (w - (destination_align / pTga->Bpp) - (8 / pTga->Bpp)) * pTga->Bpp;
+ tmp_src_mask = cando_mask;
+ tmp_dest_mask = ((unsigned int)0x000000FF) >> (8 - destination_align) / pTga->Bpp;
+ tmp_dest_mask <<= 8 / pTga->Bpp;
pixel_shift = (8 - source_align) + destination_align;
-
+#if 0
+ ErrorF("CPY-BWD - premature copy: sa = %d, da = %d, ps =%d\n",
+ source_align, destination_align, pixel_shift);
+#endif
TGA_FAST_WRITE_REG(pixel_shift, TGA_PIXELSHIFT_REG);
- TGA_FAST_WRITE_REG(tmp_src, TGA_ADDRESS_REG);
- TGA_FAST_WRITE_REG(tmp_src_mask, TGA_CONTINUE_REG);
- TGA_FAST_WRITE_REG(tmp_dest, TGA_ADDRESS_REG);
- TGA_FAST_WRITE_REG(tmp_dest_mask, TGA_CONTINUE_REG);
-
-/* ErrorF("premature copy: sa = %d, da = %d, ps =%d\n", source_align, */
-/* destination_align, pixel_shift); */
+ switch (pTga->Chipset)
+ {
+ case PCI_CHIP_TGA2:
+ *(unsigned int *)(pTga->FbBase + tmp_src) = tmp_src_mask; WMB;
+ *(unsigned int *)(pTga->FbBase + tmp_dest) = tmp_dest_mask; WMB;
+ break;
+ case PCI_CHIP_DEC21030:
+ /* use GADR and GCTR */
+ TGA_FAST_WRITE_REG(tmp_src, TGA_ADDRESS_REG);
+ TGA_FAST_WRITE_REG(tmp_src_mask, TGA_CONTINUE_REG);
+ TGA_FAST_WRITE_REG(tmp_dest, TGA_ADDRESS_REG);
+ TGA_FAST_WRITE_REG(tmp_dest_mask, TGA_CONTINUE_REG);
+ break;
+ }
source_address += (8 - source_align);
- mask_source >>= (8 - source_align);
- mask_source >>= destination_align;
- mask_destination >>= destination_align;
+ mask_source >>= (8 - source_align) / pTga->Bpp;
+ mask_source >>= destination_align / pTga->Bpp;
+ mask_destination >>= destination_align / pTga->Bpp;
}
- else if(read == 0 && (source_align != destination_align)) {
+ else if (read == 0 && (source_align != destination_align)) {
source_address += (8 - source_align);
/* mask_source >>= (8 - source_align); */
- /* if we comment this out, it breaks...TGA tries to
+ /* if we uncomment this, it breaks...TGA tries to
optimize away a read of our last pixels... */
}
- else if(source_align) {
+ else if (source_align) {
source_address += (8 - source_align);
- mask_source >>= (8 - source_align);
+ mask_source >>= (8 - source_align) / pTga->Bpp;
}
- if(destination_align) {
+
+ if (destination_align) {
destination_address += (8 - destination_align);
- mask_destination >>= (8 - destination_align);
+ mask_destination >>= (8 - destination_align) / pTga->Bpp;
}
- if(destination_align >= source_align)
+ if (destination_align >= source_align)
pixel_shift = destination_align - source_align;
else {
pixel_shift = (8 - source_align) + destination_align;
- if(destination_align) {
+ if (destination_align) {
source_address += 8;
- mask_source >>= 8;
+ mask_source >>= 8 / pTga->Bpp;
}
}
+#if 0
+ ErrorF("CPY-BWD - normal: sadr 0x%lx sm 0x%x dadr 0x%lx dm 0x%x"
+ " sa %d da %d ps %d read %d\n",
+ source_address, mask_source,
+ destination_address, mask_destination,
+ source_align, destination_align, pixel_shift, read);
+#endif
TGA_FAST_WRITE_REG(pixel_shift, TGA_PIXELSHIFT_REG);
- /* use GADR and GCTR */
- TGA_FAST_WRITE_REG(source_address, TGA_ADDRESS_REG);
- TGA_FAST_WRITE_REG(mask_source, TGA_CONTINUE_REG);
- TGA_FAST_WRITE_REG(destination_address, TGA_ADDRESS_REG);
- TGA_FAST_WRITE_REG(mask_destination, TGA_CONTINUE_REG);
+ switch (pTga->Chipset) {
+ case PCI_CHIP_TGA2:
+ *(unsigned int *)(pTga->FbBase + source_address) = mask_source; WMB;
+ *(unsigned int *)(pTga->FbBase + destination_address) = mask_destination; WMB;
+ break;
+ case PCI_CHIP_DEC21030:
+ /* use GADR and GCTR */
+ TGA_FAST_WRITE_REG(source_address, TGA_ADDRESS_REG);
+ TGA_FAST_WRITE_REG(mask_source, TGA_CONTINUE_REG);
+ TGA_FAST_WRITE_REG(destination_address, TGA_ADDRESS_REG);
+ TGA_FAST_WRITE_REG(mask_destination, TGA_CONTINUE_REG);
+ break;
+ }
/* if(read == 0) */
/* ErrorF("sa = %d, da = %d, ps = %d\n", source_align, destination_align, */
/* pixel_shift); */
- if(destination_align > source_align) {
- source_address -= 24;
- destination_address -= (32 - pixel_shift);
- if(read == 0)
- read += 24 + source_align;
+ if (destination_align > source_align) {
+ source_address -= cando * pTga->Bpp - 8;
+ destination_address -= (cando - (pixel_shift / pTga->Bpp)) * pTga->Bpp;
+ if (read == 0)
+ read += (cando - 8 / pTga->Bpp) + source_align / pTga->Bpp;
else
- read += 24;
+ read += cando - 8 / pTga->Bpp;
}
- else if(destination_align == source_align) {
- source_address -= 32;
- destination_address -= 32;
- if(read == 0 && destination_align)
- read += (32 - (8 - destination_align));
+ else if (destination_align == source_align) {
+ source_address -= cando * pTga->Bpp;
+ destination_address -= cando * pTga->Bpp;
+ if (read == 0 && destination_align)
+ read += (cando - (8 - destination_align) / pTga->Bpp);
else
- read += 32;
+ read += cando;
}
- else if(source_align > destination_align) {
- source_address -= 24;
- destination_address -= (32 - pixel_shift);
+ else if (source_align > destination_align) {
+ source_address -= cando * pTga->Bpp - 8;
+ destination_address -= (cando - (pixel_shift / pTga->Bpp)) * pTga->Bpp;
/* only happens when read == 0 */
- if(destination_align)
- read += 16 + source_align;
+ if (destination_align)
+ read += (cando - 16 / pTga->Bpp) + source_align / pTga->Bpp;
else
- read += 32 - pixel_shift;
+ read += cando - pixel_shift / pTga->Bpp;
}
}
@@ -852,9 +932,9 @@ TGASetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
#ifdef PROFILE
unsigned int start, stop;
#endif
- register unsigned long iobase, offset;
TGAPtr pTga;
unsigned int fgcolor = 0, bgcolor = 0, pmask = 0;
+ TGA_DECL();
pTga = TGAPTR(pScrn);
TGA_GET_IOBASE();
@@ -925,7 +1005,7 @@ TGASubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int patx, int paty,
#ifdef PROFILE
register unsigned int stop, start;
#endif
- register unsigned long iobase, offset;
+ TGA_DECL();
/* ErrorF("TGASubsequentMono8x8PatternFillRect called with x = %d, y = %d, w = %d, h = %d\n", x, y, w, h); */
@@ -1005,9 +1085,9 @@ TGASetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop,
#ifdef PROFILE
unsigned int start, stop;
#endif
- register unsigned long iobase, offset;
TGAPtr pTga = NULL;
unsigned int fgcolor = 0, pmask = 0;
+ TGA_DECL();
pTga = TGAPTR(pScrn);
TGA_GET_IOBASE();
@@ -1056,10 +1136,10 @@ TGASubsequentSolidLine(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2,
#ifdef PROFILE
unsigned int start, stop;
#endif
- register unsigned long iobase, offset;
TGAPtr pTga = NULL;
CARD32 abs_dx = 0, abs_dy = 0, address = 0, octant_reg = 0;
int length = 0;
+ TGA_DECL();
pTga = TGAPTR(pScrn);
TGA_GET_IOBASE();
@@ -1136,10 +1216,9 @@ TGASetupForClippedLine(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2,
#ifdef PROFILE
unsigned int start, stop;
#endif
- register unsigned long iobase, offset;
TGAPtr pTga = NULL;
CARD32 abs_dx = 0, abs_dy = 0, octant_reg = 0;
-
+ TGA_DECL();
pTga = TGAPTR(pScrn);
TGA_GET_IOBASE();
@@ -1200,10 +1279,10 @@ TGASubsequentClippedSolidLine(ScrnInfoPtr pScrn, int x1, int y1, int len,
#ifdef PROFILE
unsigned int start, stop;
#endif
- register unsigned long iobase, offset;
TGAPtr pTga = NULL;
CARD32 address = 0;
int length = 0;
+ TGA_DECL();
pTga = TGAPTR(pScrn);
TGA_GET_IOBASE();
@@ -1246,9 +1325,9 @@ TGASetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop,
#ifdef PROFILE
unsigned int start = 0, stop = 0;
#endif
- register unsigned long iobase = 0, offset = 0;
TGAPtr pTga = NULL;
unsigned int color1 = 0, color2 = 0, pmask = 0;
+ TGA_DECL();
pTga = TGAPTR(pScrn);
TGA_GET_IOBASE();
@@ -1293,13 +1372,13 @@ TGASubsequentDashedLine(ScrnInfoPtr pScrn, int x1, int y1, int x2,
#ifdef PROFILE
unsigned int start, stop;
#endif
- register unsigned long iobase, offset;
TGAPtr pTga = NULL;
CARD32 abs_dx = 0, abs_dy = 0, address = 0, octant_reg = 0;
int length = 0;
CARD16 line_mask = 0;
int pattern_overflow = 0;
int l = 0;
+ TGA_DECL();
pTga = TGAPTR(pScrn);
TGA_GET_IOBASE();
@@ -1418,13 +1497,13 @@ TGASubsequentClippedDashedLine(ScrnInfoPtr pScrn, int x1, int y1, int len,
#ifdef PROFILE
unsigned int start, stop;
#endif
- register unsigned long iobase, offset;
TGAPtr pTga = NULL;
CARD32 address = 0;
int length = 0;
CARD16 line_mask = 0;
int pattern_overflow = 0;
int l = 0;
+ TGA_DECL();
pTga = TGAPTR(pScrn);
TGA_GET_IOBASE();
diff --git a/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c b/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c
index 37ccbee14..6b080d5d9 100644
--- a/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c
+++ b/xc/programs/Xserver/hw/xfree86/loader/xf86sym.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/xf86sym.c,v 1.163 2000/09/19 12:46:21 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/xf86sym.c,v 1.167 2000/10/24 22:45:09 dawes Exp $ */
/*
*
@@ -38,7 +38,7 @@
#include "xf86Parser.h"
#include "xf86Config.h"
#ifdef XINPUT
-#include "xf86Xinput.h"
+# include "xf86Xinput.h"
#endif
#include "xf86OSmouse.h"
#include "xf86xv.h"
@@ -62,13 +62,13 @@ int sysctlbyname(const char*, void *, size_t *, void *, size_t);
#endif
/* XXX Should get all of these from elsewhere */
-#if defined (PowerMAX_OS)
-#undef inb
-#undef inw
-#undef inl
-#undef outb
-#undef outw
-#undef outl
+#if defined(PowerMAX_OS) || (defined(sun) && defined(SVR4))
+# undef inb
+# undef inw
+# undef inl
+# undef outb
+# undef outw
+# undef outl
extern void outb(unsigned int a, unsigned char b);
extern void outw(unsigned int a, unsigned short w);
@@ -79,7 +79,7 @@ extern unsigned long inl(unsigned int a);
#endif
#if defined(__alpha__)
-#ifdef linux
+# ifdef linux
extern unsigned long _bus_base(void);
extern void _outb(char val, unsigned short port);
extern void _outw(short val, unsigned short port);
@@ -87,17 +87,17 @@ extern void _outl(int val, unsigned short port);
extern unsigned int _inb(unsigned short port);
extern unsigned int _inw(unsigned short port);
extern unsigned int _inl(unsigned short port);
-#endif
+# endif
-#ifdef __FreeBSD__
-#include <sys/types.h>
+# ifdef __FreeBSD__
+# include <sys/types.h>
extern void outb(u_int32_t port, u_int8_t val);
extern void outw(u_int32_t port, u_int16_t val);
extern void outl(u_int32_t port, u_int32_t val);
extern u_int8_t inb(u_int32_t port);
extern u_int16_t inw(u_int32_t port);
extern u_int32_t inl(u_int32_t port);
-#endif
+# endif
extern void* __divl(long, long);
extern void* __reml(long, long);
@@ -110,15 +110,24 @@ extern void* __remqu(long, long);
#endif
#if defined(__ia64__)
+extern long __divdf3(long, long);
extern long __divdi3(long, long);
+extern long __divsf3(long, long);
extern long __moddi3(long, long);
-extern long __divdf3(long, long);
+extern long __udivdi3(long, long);
+extern long __umoddi3(long, long);
+extern void _outb(char val, unsigned short port);
+extern void _outw(short val, unsigned short port);
+extern void _outl(int val, unsigned short port);
+extern unsigned int _inb(unsigned short port);
+extern unsigned int _inw(unsigned short port);
+extern unsigned int _inl(unsigned short port);
#endif
#if defined(__sparc__) && defined(__GNUC__)
-#define SYMFUNCDOT(func) { "." #func, (funcptr)&__sparc_dot_ ## func },
-#define SYMFUNCDOT89(func) { "." #func, (funcptr)&func ## _sparcv89 },
-#define DEFFUNCDOT(func) \
+# define SYMFUNCDOT(func) { "." #func, (funcptr)&__sparc_dot_ ## func },
+# define SYMFUNCDOT89(func) { "." #func, (funcptr)&func ## _sparcv89 },
+# define DEFFUNCDOT(func) \
extern void __sparc_dot_ ## func (void) __asm__ ("." #func); \
extern void func ## _sparcv89 (void);
DEFFUNCDOT(rem)
@@ -893,9 +902,9 @@ LOOKUP xfree86LookupTab[] = {
of the X server) easier. */
SYMFUNC(xf86InstallSIGIOHandler)
SYMFUNC(xf86RemoveSIGIOHandler)
-#ifdef __alpha__
+# ifdef __alpha__
SYMFUNC(_bus_base)
-#endif
+# endif
#endif
SYMFUNC(xf86BlockSIGIO)
SYMFUNC(xf86UnblockSIGIO)
@@ -910,21 +919,21 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(__remq)
SYMFUNC(__remqu)
-#ifdef linux
+# ifdef linux
SYMFUNC(_outw)
SYMFUNC(_outb)
SYMFUNC(_outl)
SYMFUNC(_inb)
SYMFUNC(_inw)
SYMFUNC(_inl)
-#else
+# else
SYMFUNC(outw)
SYMFUNC(outb)
SYMFUNC(outl)
SYMFUNC(inb)
SYMFUNC(inw)
SYMFUNC(inl)
-#endif
+# endif
SYMFUNC(xf86ReadMmio32)
SYMFUNC(xf86ReadMmio16)
SYMFUNC(xf86ReadMmio8)
@@ -936,6 +945,14 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(xf86WriteMmioNB8)
SYMFUNC(memcpy)
#endif
+#if defined(sun) || defined(SVR4) && !defined(USL)
+ SYMFUNC(inb)
+ SYMFUNC(inw)
+ SYMFUNC(inl)
+ SYMFUNC(outb)
+ SYMFUNC(outw)
+ SYMFUNC(outl)
+#endif
#if defined(__powerpc__)
SYMFUNC(inb)
SYMFUNC(inw)
@@ -943,7 +960,7 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(outb)
SYMFUNC(outw)
SYMFUNC(outl)
-#if defined(NO_INLINE) || defined(Lynx)
+# if defined(NO_INLINE) || defined(Lynx)
SYMFUNC(mem_barrier)
SYMFUNC(ldl_u)
SYMFUNC(eieio)
@@ -957,14 +974,14 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(stq_u)
SYMFUNC(stw_u)
SYMFUNC(write_mem_barrier)
-#endif
+# endif
SYMFUNC(rdinx)
SYMFUNC(wrinx)
SYMFUNC(modinx)
SYMFUNC(testrg)
SYMFUNC(testinx2)
SYMFUNC(testinx)
-#if defined(Lynx)
+# if defined(Lynx)
SYMFUNC(_restf14)
SYMFUNC(_restf17)
SYMFUNC(_restf18)
@@ -991,20 +1008,29 @@ LOOKUP xfree86LookupTab[] = {
SYMFUNC(_savef27)
SYMFUNC(_savef28)
SYMFUNC(_savef29)
-#endif
-#if PPCIO_DEBUG
+# endif
+# if PPCIO_DEBUG
SYMFUNC(debug_inb)
SYMFUNC(debug_inw)
SYMFUNC(debug_inl)
SYMFUNC(debug_outb)
SYMFUNC(debug_outw)
SYMFUNC(debug_outl)
-#endif
+# endif
#endif
#if defined(__ia64__)
+ SYMFUNC(__divdf3)
SYMFUNC(__divdi3)
+ SYMFUNC(__divsf3)
SYMFUNC(__moddi3)
- SYMFUNC(__divdf3)
+ SYMFUNC(__udivdi3)
+ SYMFUNC(__umoddi3)
+ SYMFUNC(_outw)
+ SYMFUNC(_outb)
+ SYMFUNC(_outl)
+ SYMFUNC(_inb)
+ SYMFUNC(_inw)
+ SYMFUNC(_inl)
#endif
#ifdef __FreeBSD__
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile
index f0fa864fb..41328aab9 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile,v 1.2 2000/08/16 01:45:30 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile,v 1.3 2000/10/27 21:14:55 dawes Exp $
XCOMM $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile,v 1.7 1999/09/14 19:55:15 faith Exp $
#define IHaveModules
@@ -14,8 +14,8 @@ MOBJ = drmmodule.o
MTRR_DEFINES = -DHAS_MTRR_SUPPORT
#endif
-SRCS = xf86drm.c xf86drmHash.c xf86drmRandom.c xf86drmSL.c xf86drmI810.c xf86drmMga.c xf86drmR128.c $(MSRC)
-OBJS = xf86drm.o xf86drmHash.o xf86drmRandom.o xf86drmSL.o xf86drmI810.o xf86drmMga.o xf86drmR128.o $(MOBJ)
+SRCS = xf86drm.c xf86drmHash.c xf86drmRandom.c xf86drmSL.c xf86drmI810.c xf86drmMga.c xf86drmR128.c xf86drmSiS.c $(MSRC)
+OBJS = xf86drm.o xf86drmHash.o xf86drmRandom.o xf86drmSL.o xf86drmI810.o xf86drmMga.o xf86drmR128.o xf86drmSiS.o $(MOBJ)
INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \
@@ -46,5 +46,6 @@ LinkSourceFile(xf86drmMga.c,$(XF86OSSRC)/linux/drm)
LinkSourceFile(xf86drmR128.c,$(XF86OSSRC)/linux/drm)
LinkSourceFile(xf86drmRandom.c,$(XF86OSSRC)/linux/drm)
LinkSourceFile(xf86drmSL.c,$(XF86OSSRC)/linux/drm)
+LinkSourceFile(xf86drmSiS.c,$(XF86OSSRC)/linux/drm)
InstallDriverSDKLibraryModule(drm,$(DRIVERSDKMODULEDIR),freebsd)
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile
index 81445a7d3..47dff5bfb 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile,v 1.2 2000/08/16 01:45:31 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile,v 1.3 2000/10/27 16:59:40 dawes Exp $
#include <Server.tmpl>
@@ -18,7 +18,7 @@ LinkSourceFile(drm.h,$(XF86OSSRC)/linux/drm/kernel)
LinkSourceFile(i810_drm.h,$(XF86OSSRC)/linux/drm/kernel)
LinkSourceFile(mga_drm.h,$(XF86OSSRC)/linux/drm/kernel)
LinkSourceFile(r128_drm.h,$(XF86OSSRC)/linux/drm/kernel)
-LinkSourceFile(sis_drm_public.h,$(XF86OSSRC)/linux/drm/kernel)
+LinkSourceFile(sis_drm.h,$(XF86OSSRC)/linux/drm/kernel)
XCOMM This is a kludge until we determine how best to build the
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/bus/linuxSbus.c b/xc/programs/Xserver/hw/xfree86/os-support/bus/linuxSbus.c
index 0852eba20..36700c0d9 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/bus/linuxSbus.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/bus/linuxSbus.c
@@ -20,7 +20,7 @@
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/linuxSbus.c,v 1.3 2000/06/30 17:15:18 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/linuxSbus.c,v 1.4 2000/10/17 16:53:19 tsi Exp $ */
#include <fcntl.h>
#include <stdio.h>
@@ -550,8 +550,8 @@ xf86SbusHideOsHwCursor(sbusDevicePtr psdp)
fbcursor.cmap.red = zeros;
fbcursor.cmap.green = zeros;
fbcursor.cmap.blue = zeros;
- fbcursor.image = zeros;
- fbcursor.mask = zeros;
+ fbcursor.image = (char *)zeros;
+ fbcursor.mask = (char *)zeros;
fbcursor.size.x = 32;
fbcursor.size.y = 1;
fbcursor.set = FB_CUR_SETALL;
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile
index 5620604a0..853185757 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile
@@ -1,4 +1,4 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile,v 1.6 2000/06/17 00:03:34 martin Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile,v 1.7 2000/10/10 16:38:43 alanh Exp $
#define IHaveModules
#include <Server.tmpl>
@@ -13,8 +13,8 @@ MOBJ = drmmodule.o
MTRR_DEFINES = -DHAS_MTRR_SUPPORT
#endif
-SRCS = xf86drm.c xf86drmHash.c xf86drmRandom.c xf86drmSL.c xf86drmI810.c xf86drmMga.c xf86drmR128.c $(MSRC)
-OBJS = xf86drm.o xf86drmHash.o xf86drmRandom.o xf86drmSL.o xf86drmI810.o xf86drmMga.o xf86drmR128.o $(MOBJ)
+SRCS = xf86drm.c xf86drmHash.c xf86drmRandom.c xf86drmSL.c xf86drmI810.c xf86drmMga.c xf86drmR128.c xf86drmSiS.c $(MSRC)
+OBJS = xf86drm.o xf86drmHash.o xf86drmRandom.o xf86drmSL.o xf86drmI810.o xf86drmMga.o xf86drmR128.o xf86drmSiS.o $(MOBJ)
INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \
-I$(XINCLUDESRC) -I$(EXTINCSRC) -I../.. -Ikernel
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux
index b76cbeaf6..adf190059 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux
@@ -113,15 +113,15 @@ all:; @echo Error: Could not locate kernel tree in $A $B $C
else
SMP := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \
| grep -s 'SMP = ' | cut -d' ' -f3)
-MODULES := $(shell gcc -E -nostdinc -I $(TREE) picker.c 2>/dev/null \
+MODULES := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \
| grep -s 'MODULES = ' | cut -d' ' -f3)
-MODVERSIONS := $(shell gcc -E -nostdinc -I $(TREE) picker.c 2>/dev/null \
+MODVERSIONS := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \
| grep -s 'MODVERSIONS = ' | cut -d' ' -f3)
AGP := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \
| grep -s 'AGP = ' | cut -d' ' -f3)
SIS := $(shell gcc -E -nostdinc -I$(TREE) picker.c 2>/dev/null \
| grep -s 'SIS = ' | cut -d' ' -f3)
-PARAMS := $(shell if fgrep kill_fasync $(TREE)/linux/fs.h \
+PARAMS := $(shell if fgrep kill_fasync $(TREE)/linux/fs.h 2>/dev/null \
| egrep -q '(band|int, int)'; then echo 3; else echo 2; fi)
MACHINE := $(shell echo `uname -m`)
ifeq ($(AGP),0)
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h
index b182f2c99..57032d6e2 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h
@@ -82,6 +82,7 @@ typedef struct drm_clip_rect {
#include "mga_drm.h"
#include "i810_drm.h"
#include "r128_drm.h"
+#include "sis_drm.h"
typedef struct drm_version {
int version_major; /* Major version */
@@ -369,4 +370,14 @@ typedef struct drm_agp_info {
#define DRM_IOCTL_R128_PACKET DRM_IOW( 0x44, drm_r128_packet_t)
#define DRM_IOCTL_R128_VERTEX DRM_IOW( 0x45, drm_r128_vertex_t)
+/* SiS specific ioctls */
+#define SIS_IOCTL_FB_ALLOC DRM_IOWR( 0x44, drm_sis_mem_t)
+#define SIS_IOCTL_FB_FREE DRM_IOW( 0x45, drm_sis_mem_t)
+#define SIS_IOCTL_AGP_INIT DRM_IOWR( 0x53, drm_sis_agp_t)
+#define SIS_IOCTL_AGP_ALLOC DRM_IOWR( 0x54, drm_sis_mem_t)
+#define SIS_IOCTL_AGP_FREE DRM_IOW( 0x55, drm_sis_mem_t)
+#define SIS_IOCTL_FLIP DRM_IOW( 0x48, drm_sis_flip_t)
+#define SIS_IOCTL_FLIP_INIT DRM_IO( 0x49)
+#define SIS_IOCTL_FLIP_FINAL DRM_IO( 0x50)
+
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h
index 6be90c516..46e08e057 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h
@@ -59,6 +59,15 @@
#include <asm/io.h>
#include <asm/mman.h>
#include <asm/uaccess.h>
+
+#ifndef copy_to_user_ret
+#define copy_to_user_ret(to,from,n,retval) ({ if (copy_to_user(to,from,n)) return retval; })
+#endif
+
+#ifndef copy_from_user_ret
+#define copy_from_user_ret(to,from,n,retval) ({ if (copy_from_user(to,from,n)) return retval; })
+#endif
+
#ifdef CONFIG_MTRR
#include <asm/mtrr.h>
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c
index 05d941b4c..00c0ea7f9 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c
@@ -420,6 +420,7 @@ int mga_infobufs(struct inode *inode, struct file *filp, unsigned int cmd,
sizeof(dma->bufs[0]
.freelist.high_mark)))
return -EFAULT;
+
++count;
}
}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/picker.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/picker.c
index 77519a561..4b4fbe90c 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/picker.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/picker.c
@@ -1,4 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/picker.c,v 1.3 2000/09/01 02:31:40 tsi Exp $ */
#include <linux/config.h>
#include <linux/version.h>
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h
index ac6f73bcd..8a0cd1967 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h
@@ -57,9 +57,9 @@ typedef struct drm_r128_init {
} drm_r128_init_t;
typedef struct drm_r128_packet {
- unsigned long *buffer;
- int count;
- int flags;
+ void *buffer;
+ int count;
+ int flags;
} drm_r128_packet_t;
typedef enum drm_r128_prim {
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h
index 63b98c727..da2f676d3 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h
@@ -197,7 +197,7 @@ extern int r128_context_switch_complete(drm_device_t *dev, int new);
#define R128_MAX_USEC_TIMEOUT 100000 /* 100 ms */
-#define R128_BASE(reg) ((u32)(dev_priv->mmio->handle))
+#define R128_BASE(reg) ((unsigned long)(dev_priv->mmio->handle))
#define R128_ADDR(reg) (R128_BASE(reg) + reg)
#define R128_DEREF(reg) *(__volatile__ int *)R128_ADDR(reg)
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c
index e6e8ed7dd..9a8f83ea9 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c
@@ -33,9 +33,6 @@
#include "sis_drm.h"
#include "sis_ds.h"
#include "sis_drv.h"
-#include <linux/fb.h>
-#include <linux/sisfb.h>
-#include <linux/interrupt.h>
#define MAX_CONTEXT 100
#define VIDEO_TYPE 0
@@ -73,7 +70,7 @@ static int del_alloc_set(int context, int type, unsigned int val)
}
/* fb management via fb device */
-#if 1
+#if 0
int sis_fb_alloc(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
{
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c
index c933f5935..5c2c08c3b 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c
@@ -27,7 +27,7 @@
* Authors: Rickard E. (Rik) Faith <faith@valinux.com>
* Kevin E. Martin <martin@valinux.com>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.16 2000/08/28 16:55:52 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.17 2000/09/24 13:51:32 alanh Exp $
*
*/
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c
index 71cbf4bcf..04a9ececc 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.14 2000/07/21 21:04:05 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.15 2000/10/17 16:53:20 tsi Exp $ */
/*
* linux specific part of the int10 module
* Copyright 1999 Egbert Eich
@@ -12,7 +12,11 @@
#define _INT10_PRIVATE
#include "xf86int10.h"
#include "int10Defines.h"
+#ifdef __sparc__
+#define DEV_MEM "/dev/fb"
+#else
#define DEV_MEM "/dev/mem"
+#endif
#ifndef XFree86LOADER
#include <sys/mman.h>
#ifndef MAP_FAILED
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c
index c1db77996..5e783fcf2 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c,v 3.10 2000/09/19 12:46:22 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c,v 3.11 2000/10/17 16:53:20 tsi Exp $ */
/* Resource information code */
@@ -156,7 +156,11 @@ xf86AccResFromOS(resPtr ret)
* for now until we get something better.
*/
+#ifdef __sparc__
+resRange PciAvoid[] = {_END};
+#else
resRange PciAvoid[] = {_PCI_AVOID_PC_STYLE, _END};
+#endif
resPtr
xf86BusAccWindowsFromOS(void)
@@ -167,7 +171,11 @@ xf86BusAccWindowsFromOS(void)
RANGE(range,0,0xffffffff,ResExcMemBlock);
ret = xf86AddResToList(ret, &range, -1);
+#ifdef __sparc__
+ RANGE(range,0,0x00ffffff,ResExcIoBlock);
+#else
RANGE(range,0,0x0000ffff,ResExcIoBlock);
+#endif
ret = xf86AddResToList(ret, &range, -1);
return ret;
}
@@ -181,7 +189,11 @@ xf86PciBusAccWindowsFromOS(void)
RANGE(range,0,0xffffffff,ResExcMemBlock);
ret = xf86AddResToList(ret, &range, -1);
+#ifdef __sparc__
+ RANGE(range,0,0x00ffffff,ResExcIoBlock);
+#else
RANGE(range,0,0x0000ffff,ResExcIoBlock);
+#endif
ret = xf86AddResToList(ret, &range, -1);
return ret;
}
@@ -195,7 +207,11 @@ xf86IsaBusAccWindowsFromOS(void)
RANGE(range,0,0xffffffff,ResExcMemBlock);
ret = xf86AddResToList(ret, &range, -1);
+#ifdef __sparc__
+ RANGE(range,0,0x00ffffff,ResExcIoBlock);
+#else
RANGE(range,0,0x0000ffff,ResExcIoBlock);
+#endif
ret = xf86AddResToList(ret, &range, -1);
return ret;
}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c
index a47431310..6d3e0644d 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c,v 3.4 2000/02/08 17:19:22 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c,v 3.5 2000/10/17 16:53:20 tsi Exp $ */
#include <stdio.h>
#include "X.h"
@@ -28,14 +28,9 @@ xf86GetPciSizeFromOS(PCITAG tag, int index, int* bits)
do {
res = fgets(c,0xff,file);
if (res) {
-#if defined WORD64 || defined LONG64
-#define ILF "\t%*16x\t%*16x\t%*16x\t%*16x\t%*16x\t%*16x\t%*16x"
-#define LF "\t%16x\t%16x\t%16x\t%16x\t%16x\t%16x\t%16x"
-#else
-#define ILF "\t%*08x\t%*08x\t%*08x\t%*08x\t%*08x\t%*08x\t%*08x"
-#define LF "\t%08x\t%08x\t%08x\t%08x\t%08x\t%08x\t%08x"
-#endif
- num = sscanf(res,"%02x%02x\t%*04x%*04x\t%*x"ILF LF,
+ num = sscanf(res,"%02x%02x\t%*04x%*04x\t%*x"
+ "\t%*x\t%*x\t%*x\t%*x\t%*x\t%*x\t%*x"
+ "\t%x\t%x\t%x\t%x\t%x\t%x\t%x",
&bus,&devfn,&size[0],&size[1],&size[2],&size[3],
&size[4],&size[5],&size[6]);
if (num != 9) { /* apparantly not 2.3 style */
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h b/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h
index b182f2c99..57032d6e2 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel/drm.h
@@ -82,6 +82,7 @@ typedef struct drm_clip_rect {
#include "mga_drm.h"
#include "i810_drm.h"
#include "r128_drm.h"
+#include "sis_drm.h"
typedef struct drm_version {
int version_major; /* Major version */
@@ -369,4 +370,14 @@ typedef struct drm_agp_info {
#define DRM_IOCTL_R128_PACKET DRM_IOW( 0x44, drm_r128_packet_t)
#define DRM_IOCTL_R128_VERTEX DRM_IOW( 0x45, drm_r128_vertex_t)
+/* SiS specific ioctls */
+#define SIS_IOCTL_FB_ALLOC DRM_IOWR( 0x44, drm_sis_mem_t)
+#define SIS_IOCTL_FB_FREE DRM_IOW( 0x45, drm_sis_mem_t)
+#define SIS_IOCTL_AGP_INIT DRM_IOWR( 0x53, drm_sis_agp_t)
+#define SIS_IOCTL_AGP_ALLOC DRM_IOWR( 0x54, drm_sis_mem_t)
+#define SIS_IOCTL_AGP_FREE DRM_IOW( 0x55, drm_sis_mem_t)
+#define SIS_IOCTL_FLIP DRM_IOW( 0x48, drm_sis_flip_t)
+#define SIS_IOCTL_FLIP_INIT DRM_IO( 0x49)
+#define SIS_IOCTL_FLIP_FINAL DRM_IO( 0x50)
+
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c b/xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c
index 247125e6d..9a7a85a31 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c,v 1.69 2000/09/19 12:46:22 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c,v 1.70 2000/09/26 15:57:20 tsi Exp $ */
/*
* Copyright 1997 by The XFree86 Project, Inc.
*
@@ -1888,12 +1888,12 @@ xf86shmdt(char *addr)
int
xf86setjmp(xf86jmp_buf xf86env)
{
- return setjmp(xf86env);
+ return setjmp((void *)xf86env);
}
void
xf86longjmp(xf86jmp_buf xf86env, int val)
{
- longjmp(xf86env,val);
+ longjmp((void *)xf86env, val);
}
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c b/xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c
index 84639a593..0b32b0218 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c
+++ b/xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c,v 1.12 2000/08/04 16:13:41 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c,v 1.13 2000/10/12 11:19:41 tsi Exp $ */
#include "xf86.h"
#include "xf86_ansic.h"
@@ -60,20 +60,23 @@ VBEInit(xf86Int10InfoPtr pInt, int entityIndex)
xf86ExecX86int10(pInt);
- if ((pInt->ax & 0xff) != 0x4f) goto error;
+ if ((pInt->ax & 0xff) != 0x4f) {
+ xf86DrvMsgVerb(screen,X_INFO,3,"VESA BIOS not detected\n");
+ goto error;
+ }
switch (pInt->ax & 0xff00) {
case 0:
- xf86DrvMsg(screen,X_INFO,"VESA Bios detected\n");
+ xf86DrvMsg(screen,X_INFO,"VESA BIOS detected\n");
break;
case 0x100:
- xf86DrvMsg(screen,X_INFO,"VESA Bios function failed\n");
+ xf86DrvMsg(screen,X_INFO,"VESA BIOS function failed\n");
goto error;
case 0x200:
- xf86DrvMsg(screen,X_INFO,"VESA Bios not supported\n");
+ xf86DrvMsg(screen,X_INFO,"VESA BIOS not supported\n");
goto error;
case 0x300:
- xf86DrvMsg(screen,X_INFO,"VESA Bios not supported in current mode\n");
+ xf86DrvMsg(screen,X_INFO,"VESA BIOS not supported in current mode\n");
goto error;
default:
xf86DrvMsg(screen,X_INFO,"Invalid\n");
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h
index a129fc0cf..58c86a106 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h
@@ -22,7 +22,7 @@
*
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h,v 3.42 2000/09/19 12:46:21 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h,v 3.43 2000/10/24 22:45:10 dawes Exp $ */
#ifndef _XF86_ANSIC_H
#define _XF86_ANSIC_H
@@ -62,8 +62,12 @@
#endif
#ifndef NULL
+#if (defined(SVR4) || defined(SYSV)) && !defined(__GNUC__)
+#define NULL 0
+#else
#define NULL ((void *)0)
#endif
+#endif
#ifndef EOF
#define EOF (-1)
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h
index 563daff13..de77ddd8b 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h
@@ -26,7 +26,7 @@
*
* Author: Rickard E. (Rik) Faith <faith@valinux.com>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.11 2000/08/28 16:27:00 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.12 2000/09/24 13:51:32 alanh Exp $
*
*/
diff --git a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h
index 33c523a00..75157024f 100644
--- a/xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h
+++ b/xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h
@@ -1,5 +1,7 @@
+/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h,v 3.3 2000/09/26 15:57:19 tsi Exp $ */
-/* WARNING: If you change any of these defines, make sure to change
+/*
+ * WARNING: If you change any of these defines, make sure to change
* the kernel include file as well (mga_drm.h)
*/
diff --git a/xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c b/xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c
index d5f4cd97a..69c2dce13 100644
--- a/xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c
+++ b/xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c,v 1.30 2000/09/24 18:28:56 keithp Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c,v 1.31 2000/09/28 20:48:00 mvojkovi Exp $ */
#include "misc.h"
#include "xf86.h"
@@ -106,6 +106,7 @@ XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
XAAScreenPtr pScreenPriv;
+ int i;
#ifdef RENDER
PictureScreenPtr ps = GetPictureScreen(pScreen);
#endif
@@ -134,10 +135,16 @@ XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
infoRec->Flags &= ~(PIXMAP_CACHE | OFFSCREEN_PIXMAPS);
if(!(infoRec->Flags & LINEAR_FRAMEBUFFER))
infoRec->Flags &= ~OFFSCREEN_PIXMAPS;
-#if 0
- if(pScreen->backingStoreSupport || pScreen->saveUnderSupport)
- infoRec->Flags &= ~OFFSCREEN_PIXMAPS;
-#endif
+
+ if(!infoRec->FullPlanemask) { /* for backwards compatibility */
+ infoRec->FullPlanemask = (1 << pScrn->depth) - 1;
+ infoRec->FullPlanemasks[pScrn->depth - 1] = infoRec->FullPlanemask;
+ }
+
+ for(i = 0; i < 32; i++) {
+ if(!infoRec->FullPlanemasks[i]) /* keep any set by caller */
+ infoRec->FullPlanemasks[i] = (1 << (i+1)) - 1;
+ }
if(!XAAInitAccel(pScreen, infoRec)) return FALSE;
pScreenPriv->AccelInfoRec = infoRec;
@@ -275,7 +282,8 @@ XAAGetImage (
((pDraw->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pDraw)))
{
if(infoRec->ReadPixmap && (format == ZPixmap) &&
- ((planemask & infoRec->FullPlanemask) == infoRec->FullPlanemask) &&
+ ((planemask & infoRec->FullPlanemasks[pDraw->depth - 1]) ==
+ infoRec->FullPlanemasks[pDraw->depth - 1]) &&
(pDraw->bitsPerPixel == BitsPerPixel(pDraw->depth)))
{
(*infoRec->ReadPixmap)(pScrn,
diff --git a/xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c b/xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c
index f8fdde77c..b065aa35b 100644
--- a/xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c
+++ b/xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c
@@ -1,5 +1,5 @@
/*
- * $XFree86$
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c,v 1.5 2000/10/22 20:54:30 mvojkovi Exp $
*
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
*
@@ -33,13 +33,250 @@
#include "windowstr.h"
#include "xf86str.h"
#include "mi.h"
-#include "miline.h"
+#include "picturestr.h"
+#include "glyphstr.h"
+#include "picture.h"
+#include "mipict.h"
#include "xaa.h"
#include "xaalocal.h"
#include "xaawrap.h"
#include "xf86fbman.h"
#include "servermd.h"
+static Bool
+XAAGetRGBAFromPixel(
+ CARD32 pixel,
+ CARD16 *red,
+ CARD16 *green,
+ CARD16 *blue,
+ CARD16 *alpha,
+ CARD32 format
+){
+
+ *alpha = 0xffff;
+
+ switch(PICT_FORMAT_BPP(format)) {
+ case 32:
+ switch(format) {
+ case PICT_a8r8g8b8:
+ *alpha = (pixel >> 24) & 0x000000ff;
+ *alpha |= *alpha << 8;
+ case PICT_x8r8g8b8:
+ *blue = pixel & 0x000000ff;
+ *blue |= *blue << 8;
+ *green = pixel & 0x0000ff00;
+ *green |= *green >> 8;
+ *red = (pixel >> 16) & 0x000000ff;
+ *red |= *red << 8;
+ return TRUE;
+ case PICT_a8b8g8r8:
+ *alpha = (pixel >> 24) & 0x000000ff;
+ *alpha |= *alpha << 8;
+ case PICT_x8b8g8r8:
+ *red = pixel & 0x000000ff;
+ *red |= *red << 8;
+ *green = pixel & 0x0000ff00;
+ *green |= *green >> 8;
+ *blue = (pixel >> 16) & 0x000000ff;
+ *blue |= *blue << 8;
+ return TRUE;
+ default:
+ break;
+ }
+ break;
+ case 24:
+ switch(format) {
+ case PICT_r8g8b8:
+ *blue = pixel & 0x000000ff;
+ *blue |= *blue << 8;
+ *green = pixel & 0x0000ff00;
+ *green |= *green >> 8;
+ *red = (pixel >> 16) & 0x000000ff;
+ *red |= *red << 8;
+ return TRUE;
+ case PICT_b8g8r8:
+ *red = pixel & 0x000000ff;
+ *red |= *red << 8;
+ *green = pixel & 0x0000ff00;
+ *green |= *green >> 8;
+ *blue = (pixel >> 16) & 0x000000ff;
+ *blue |= *blue << 8;
+ return TRUE;
+ default:
+ break;
+ }
+ break;
+ case 16:
+ case 8:
+ case 4:
+ default:
+ return FALSE;
+ }
+
+ return FALSE;
+}
+
+/* 8:8:8 + PICT_a8 -> 8:8:8:8 texture */
+
+void
+XAA_888_plus_PICT_a8_to_8888 (
+ CARD32 color,
+ CARD8 *alphaPtr, /* in bytes */
+ int alphaPitch,
+ CARD32 *dstPtr,
+ int dstPitch, /* in dwords */
+ int width,
+ int height
+){
+ int x;
+
+ color &= 0x00ffffff;
+
+ while(height--) {
+ for(x = 0; x < width; x++)
+ dstPtr[x] = color | (alphaPtr[x] << 24);
+ dstPtr += dstPitch;
+ alphaPtr += alphaPitch;
+ }
+}
+
+
+Bool
+XAADoComposite (
+ CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height
+){
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ RegionRec region;
+ CARD32 *formats;
+ BoxPtr pbox;
+ int nbox;
+
+ if(!infoRec->pScrn->vtSema ||
+ ((pDst->pDrawable->type != DRAWABLE_WINDOW) &&
+ !IS_OFFSCREEN_PIXMAP(pDst->pDrawable)))
+ return FALSE;
+
+ xDst += pDst->pDrawable->x;
+ yDst += pDst->pDrawable->y;
+ xSrc += pSrc->pDrawable->x;
+ ySrc += pSrc->pDrawable->y;
+
+ if(pMask) {
+ /* for now we only do it if there is a 1x1 (solid) source */
+
+ if((pSrc->pDrawable->width == 1) && (pSrc->pDrawable->height == 1)) {
+ CARD16 red, green, blue, alpha;
+ CARD32 pixel =
+ *((CARD32*)(((PixmapPtr)(pSrc->pDrawable))->devPrivate.ptr));
+
+ if(!XAAGetRGBAFromPixel(pixel,&red,&green,&blue,&alpha,pSrc->format))
+ return FALSE;
+
+ if((alpha != 0xffff) &&
+ (infoRec->CPUToScreenAlphaTextureFlags & XAA_RENDER_NO_SRC_ALPHA))
+ return FALSE;
+
+ formats = infoRec->CPUToScreenAlphaTextureFormats;
+
+ while(*formats != pMask->format) {
+ if(!(*formats)) return FALSE;
+ formats++;
+ }
+
+ xMask += pMask->pDrawable->x;
+ yMask += pMask->pDrawable->y;
+
+ if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ width, height))
+ return TRUE;
+
+ nbox = REGION_NUM_RECTS(&region);
+ pbox = REGION_RECTS(&region);
+
+ if(!nbox)
+ return TRUE;
+
+ if(!(infoRec->SetupForCPUToScreenAlphaTexture)(infoRec->pScrn,
+ op, red, green, blue, alpha, pMask->format,
+ ((PixmapPtr)(pMask->pDrawable))->devPrivate.ptr,
+ ((PixmapPtr)(pMask->pDrawable))->devKind,
+ pMask->pDrawable->width, pMask->pDrawable->height, 0))
+ return FALSE;
+
+ xMask -= xDst;
+ yMask -= yDst;
+
+ while(nbox--) {
+ (*infoRec->SubsequentCPUToScreenAlphaTexture)(infoRec->pScrn,
+ pbox->x1, pbox->y1,
+ pbox->x1 + xMask, pbox->y1 + yMask,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
+ pbox++;
+ }
+
+ SET_SYNC_FLAG(infoRec);
+ REGION_UNINIT(pScreen, &region);
+ return TRUE;
+ }
+ } else {
+ formats = infoRec->CPUToScreenTextureFormats;
+
+ while(*formats != pSrc->format) {
+ if(!(*formats)) return FALSE;
+ formats++;
+ }
+
+ if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ width, height))
+ return TRUE;
+
+ nbox = REGION_NUM_RECTS(&region);
+ pbox = REGION_RECTS(&region);
+
+ if(!nbox)
+ return TRUE;
+
+ if(!(infoRec->SetupForCPUToScreenTexture)(infoRec->pScrn,
+ op, pSrc->format,
+ ((PixmapPtr)(pSrc->pDrawable))->devPrivate.ptr,
+ ((PixmapPtr)(pSrc->pDrawable))->devKind,
+ pSrc->pDrawable->width, pSrc->pDrawable->height, 0))
+ return FALSE;
+
+ xSrc -= xDst;
+ ySrc -= yDst;
+
+ while(nbox--) {
+ (*infoRec->SubsequentCPUToScreenTexture)(infoRec->pScrn,
+ pbox->x1, pbox->y1,
+ pbox->x1 + xSrc, pbox->y1 + ySrc,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
+ pbox++;
+ }
+
+ SET_SYNC_FLAG(infoRec);
+ REGION_UNINIT(pScreen, &region);
+ return TRUE;
+ }
+
+
+ return FALSE;
+}
+
void
XAAComposite (CARD8 op,
@@ -56,9 +293,16 @@ XAAComposite (CARD8 op,
CARD16 height)
{
ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
XAA_RENDER_PROLOGUE(pScreen, Composite);
- SYNC_CHECK(pDst->pDrawable);
- (*GetPictureScreen(pScreen)->Composite) (op,
+
+ if(!infoRec->Composite ||
+ !(*infoRec->Composite)(op, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ width, height))
+ {
+ SYNC_CHECK(pDst->pDrawable);
+ (*GetPictureScreen(pScreen)->Composite) (op,
pSrc,
pMask,
pDst,
@@ -70,6 +314,11 @@ XAAComposite (CARD8 op,
yDst,
width,
height);
+ }
+
+ if(pDst->pDrawable->type == DRAWABLE_PIXMAP)
+ (XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDst->pDrawable)))->flags |= DIRTY;
+
XAA_RENDER_EPILOGUE(pScreen, Composite, XAAComposite);
}
@@ -85,9 +334,20 @@ XAAGlyphs (CARD8 op,
GlyphPtr *glyphs)
{
ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
XAA_RENDER_PROLOGUE(pScreen, Glyphs);
- SYNC_CHECK(pDst->pDrawable);
- (*GetPictureScreen(pScreen)->Glyphs) (op, pSrc, pDst, maskFormat,
+
+ if(!infoRec->Glyphs ||
+ !(*infoRec->Glyphs)(op, pSrc, pDst, maskFormat,
+ xSrc, ySrc, nlist, list, glyphs))
+ {
+ SYNC_CHECK(pDst->pDrawable);
+ (*GetPictureScreen(pScreen)->Glyphs) (op, pSrc, pDst, maskFormat,
xSrc, ySrc, nlist, list, glyphs);
+ }
+
+ if(pDst->pDrawable->type == DRAWABLE_PIXMAP)
+ (XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDst->pDrawable)))->flags |= DIRTY;
+
XAA_RENDER_EPILOGUE(pScreen, Glyphs, XAAGlyphs);
}
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile b/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile
index 702961eb8..8b81fb207 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile
@@ -1,7 +1,12 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile,v 1.6 2000/06/13 23:15:51 dawes Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile,v 1.9 2000/10/23 21:16:51 tsi Exp $
XCOMM CDEBUGFLAGS=-g -Wall -ansi -pedantic
+#if DoLoadableServer
+LDSRCS = libc_wrapper.c loader.c
+LDOBJS = libc_wrapper.o loader.o
+#endif
+
SRCS =\
accessx.c\
card-cfg.c\
@@ -10,12 +15,14 @@ SRCS =\
help.c\
interface.c\
keyboard-cfg.c\
+ $(LDSRCS) \
monitor-cfg.c\
mouse-cfg.c\
options.c\
screen-cfg.c\
screen.c\
startx.c\
+ stubs.c\
vidmode.c\
xf86config.c
@@ -27,12 +34,14 @@ OBJS =\
help.o\
interface.o\
keyboard-cfg.o\
+ $(LDOBJS) \
monitor-cfg.o\
mouse-cfg.o\
options.o\
screen-cfg.o\
screen.o\
startx.o\
+ stubs.o\
vidmode.o\
xf86config.o
@@ -61,9 +70,21 @@ XPMPICS =\
AllTarget(ProgramTargetName($(PROG)))
+#if DoLoadableServer
+LOADERLIB = -L../loader -lxloader -L../dummylib -ldummy
+DEFINES = -DUSE_MODULES
+INCLUDES = -I../common -I../loader -I$(XF86OSSRC) \
+ -I$(SERVERSRC)/include -I$(XINCLUDESRC)
+WRAPPERDEFINES = -DSELF_CONTAINED_WRAPPER
+#endif
+
+#if HasDlopen
+DLLIB = DlLibrary
+#endif
+
LOCAL_LIBRARIES = $(XKBUILIB) $(XKBFILELIB) -lxf86config $(XXF86MISCLIB) \
$(XXF86VMLIB) $(XAWLIB) $(XMULIB) $(XTOOLLIB) \
- $(XPMLIB) $(XLIB) -lm
+ $(XPMLIB) $(LOADERLIB) $(DLLIB) $(XLIB) -lm
NormalProgramTarget($(PROG),$(OBJS),,$(LOCAL_LIBRARIES),)
InstallProgramWithFlags($(PROG),$(BINDIR),NullParameter)
@@ -73,4 +94,10 @@ InstallAppDefaults(XF86Cfg)
InstallManPage(xf86cfg,$(MANDIR))
NormalLibraryObjectRule()
+
+#if DoLoadableServer
+LinkSourceFile(libc_wrapper.c, $(XF86OSSRC)/shared)
+SpecialCObjectRule(libc_wrapper,NullParameter,$(WRAPPERDEFINES) $(EXT_DEFINES))
+#endif
+
DependTarget()
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad b/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad
index 2ef449bbd..4702a17e2 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad
@@ -26,7 +26,7 @@
!!
!! Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
!!
-!! $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad,v 1.4 2000/08/01 20:05:43 dawes Exp $
+!! $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad,v 1.5 2000/10/20 14:59:05 alanh Exp $
!!
*Form.background: gray85
@@ -193,6 +193,7 @@ lines -1,0,0,0,0,-1
*commands.card.tip: Add video card
*commands.monitor.tip: Add monitor
+*topM.justify: left
*topM.label: Configure Layout
*topM*layout.label: Configure Layout
*topM*screen.label: Configure Screen
@@ -201,6 +202,9 @@ lines -1,0,0,0,0,-1
*topM.showGrip: False
*work.showGrip: False
+*MenuButton.leftBitmap: menu10
+*SmeBSB.HorizontalMargins: 18
+
*back.label: << Back
*next.label: Next >>
*ok.label: Ok
@@ -359,12 +363,26 @@ lines -1,0,0,0,0,-1
*cardModel.filter.fromHoriz: label
*cardModel.filter.width: 171
*cardModel.viewport.width: 302
-*cardModel.viewport.height: 244
+*cardModel.viewport.height: 212
+*cardModel.driver.justify: left
+*cardModel.driverL.label: Driver
+*cardModel.driverL.fromVert: viewport
+*cardModel.driverL.width: 50
+*cardModel.driverL.justify: right
+*cardModel.driver.fromVert: viewport
+*cardModel.driver.fromHoriz: driverL
+*cardModel.driver.width: 250
+*cardModel.driver.left: chainRight
+*cardModel.driver.right: chainRight
*cardModel.busidL.label: BusID
-*cardModel.busidL.fromVert: viewport
-*cardModel.busid.fromVert: viewport
+*cardModel.busidL.fromVert: driver
+*cardModel.busidL.width: 50
+*cardModel.busidL.justify: right
+*cardModel.busid.fromVert: driver
*cardModel.busid.fromHoriz: busidL
-*cardModel.busid.width: 255
+*cardModel.busid.width: 250
+*cardModel.busid.left: chainRight
+*cardModel.busid.right: chainRight
*cardModel.viewport.forceBars: True
*cardModel.viewport.allowVert: True
*cardModel.viewport.useRight: True
@@ -398,18 +416,18 @@ lines -1,0,0,0,0,-1
.xf86cfg.pane.work.Simple.borderWidth: 1
.xf86cfg.pane.work.Simple.translations:\
-<Btn1Down>: select-device()\n\
-<Btn1Motion>: move-device()\n\
-<Btn1Up>: unselect-device()\n\
-<Btn3Down>: device-popup()\n\
-<Btn3Up>: device-popdown()
+Any<Btn1Down>: select-device()\n\
+Any<Btn1Motion>: move-device()\n\
+Any<Btn1Up>: unselect-device()\n\
+Any<Btn3Down>: device-popup()\n\
+Any<Btn3Up>: device-popdown()
.xf86cfg.pane.work.screen.translations:\
-<Btn1Down>: select-device()\n\
-<Btn1Motion>: move-device()\n\
-<Btn1Up>: unselect-device()\n\
-<Btn3Down>: device-popup()\n\
-<Btn3Up>: device-popdown()
+Any<Btn1Down>: select-device()\n\
+Any<Btn1Motion>: move-device()\n\
+Any<Btn1Up>: unselect-device()\n\
+Any<Btn3Down>: device-popup()\n\
+Any<Btn3Up>: device-popdown()
XF86Cfg.translations: #override \
<Message>WM_PROTOCOLS: quit()
@@ -473,6 +491,14 @@ XF86Cfg.translations: #override \
*options*viewport.right: chainRight
*options*list.longest: 376
+*options*driverOpts.label: Options for driver\
+*options*driverOpts.justify: left
+*options*driverOpts.width: 278
+*options*popdown.label: Popdown dialog
+*options*driverOpts.tip: This menu shows:\n\
+ o option name\n\
+ o option type
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! monitor
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -760,10 +786,16 @@ Press ESC or stop button to quit.
*screenD*unselect.fromHoriz: viewL
*screenD*select.fromVert: modeL
*screenD*unselect.fromVert: select
+*screenD*up.fromHoriz: viewL
+*screenD*down.fromHoriz: viewL
+*screenD*up.fromVert: unselect
+*screenD*down.fromVert: up
*screenD*viewR.fromHoriz: select
*screenD*viewR.fromVert: modeL
-*screenD*select.label: ->
-*screenD*unselect.label: <-
+*screenD*select.bitmap: right.xbm
+*screenD*unselect.bitmap: left.xbm
+*screenD*up.bitmap: up.xbm
+*screenD*down.bitmap: down.xbm
*screenD*viewL.width: 133
*screenD*viewR.width: 133
*screenD*viewL.height: 184
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c
index 3a5557fe8..3842ff230 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c,v 1.5 2000/08/01 20:05:43 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c,v 1.7 2000/10/20 14:59:05 alanh Exp $
*/
#include "config.h"
@@ -84,6 +84,10 @@ static void ScaleJumpCallback(Widget, XtPointer, XtPointer);
static void ApplyCallback(Widget, XtPointer, XtPointer);
static void AccessXInitialize(void);
+void CloseAccessXAction(Widget, XEvent*, String*, Cardinal*);
+void AccessXConfigureStart(void);
+void AccessXConfigureEnd(void);
+
/*
* Implementation
*/
@@ -368,7 +372,7 @@ AccessXInitialize(void)
XtSetArg(args[0], XtNstate, &state);
XtGetValues(timeoutToggle, args, 1);
- ScaleEnableCallback(enable, (XtPointer)timeout, (XtPointer)(int)state);
+ ScaleEnableCallback(enable, (XtPointer)timeout, (XtPointer)(long)state);
if (xkb_info->xkb->ctrls->ax_timeout > 60)
val = (float)(xkb_info->xkb->ctrls->ax_timeout - 60) /
(float)(MAX_TIMEOUT * 60);
@@ -378,11 +382,11 @@ AccessXInitialize(void)
XtSetArg(args[0], XtNstate, &state);
XtGetValues(sticky, args, 1);
- EnableCallback(sticky, (XtPointer)stickyForm, (XtPointer)(int)state);
+ EnableCallback(sticky, (XtPointer)stickyForm, (XtPointer)(long)state);
XtSetArg(args[0], XtNstate, &state);
XtGetValues(mouse, args, 1);
- EnableCallback(mouse, (XtPointer)mouseForm, (XtPointer)(int)state);
+ EnableCallback(mouse, (XtPointer)mouseForm, (XtPointer)(long)state);
if (xkb_info->xkb->ctrls->mk_time_to_max > 10)
val = (float)((xkb_info->xkb->ctrls->mk_time_to_max * (40. / 10.))) /
(float)(MAX_MOUSE_TIME * 100);
@@ -408,7 +412,7 @@ AccessXInitialize(void)
XtSetArg(args[0], XtNstate, &state);
XtGetValues(repeat, args, 1);
- EnableCallback(repeat, (XtPointer)repeatForm, (XtPointer)(int)state);
+ EnableCallback(repeat, (XtPointer)repeatForm, (XtPointer)(long)state);
if (xkb_info->xkb->ctrls->repeat_interval > 5)
val = (float)(xkb_info->xkb->ctrls->repeat_interval - 5) /
(float)(MAX_REPEAT_RATE * 1000);
@@ -426,7 +430,7 @@ AccessXInitialize(void)
XtSetArg(args[0], XtNstate, &state);
XtGetValues(slowToggle, args, 1);
- EnableCallback(slowToggle, (XtPointer)slowForm, (XtPointer)(int)state);
+ EnableCallback(slowToggle, (XtPointer)slowForm, (XtPointer)(long)state);
if (xkb_info->xkb->ctrls->slow_keys_delay > 10)
val = (float)(xkb_info->xkb->ctrls->repeat_delay - 10) /
(float)(MAX_SLOW_TIME * 1000);
@@ -436,7 +440,7 @@ AccessXInitialize(void)
XtSetArg(args[0], XtNstate, &state);
XtGetValues(bounceToggle, args, 1);
- EnableCallback(bounceToggle, (XtPointer)bounceForm, (XtPointer)(int)state);
+ EnableCallback(bounceToggle, (XtPointer)bounceForm, (XtPointer)(long)state);
if (xkb_info->xkb->ctrls->debounce_delay > 10)
val = (float)(xkb_info->xkb->ctrls->debounce_delay - 10) /
(float)(MAX_BOUNCE_TIME * 1000);
@@ -446,7 +450,7 @@ AccessXInitialize(void)
XtSetArg(args[0], XtNstate, &state);
XtGetValues(enable, args, 1);
- EnableCallback(enable, (XtPointer)form, (XtPointer)(int)state);
+ EnableCallback(enable, (XtPointer)form, (XtPointer)(long)state);
}
void
@@ -467,7 +471,7 @@ AccessXConfigureEnd(void)
static void
EnableCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
- XtSetSensitive((XtPointer)user_data, (int)call_data);
+ XtSetSensitive(user_data, (long)call_data);
}
/*ARGSUSED*/
@@ -476,9 +480,9 @@ ScaleEnableCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
Scale *scale = (Scale*)user_data;
- XtSetSensitive(scale->label, (int)call_data);
- XtSetSensitive(scale->number, (int)call_data);
- XtSetSensitive(scale->scroller, (int)call_data);
+ XtSetSensitive(scale->label, (long)call_data);
+ XtSetSensitive(scale->number, (long)call_data);
+ XtSetSensitive(scale->scroller, (long)call_data);
}
static void
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c
index 8513a9089..a8bb243d2 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c
@@ -26,33 +26,45 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c,v 1.2 2000/06/13 23:15:51 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c,v 1.3 2000/10/20 14:59:05 alanh Exp $
*/
#include "xf86config.h"
#include "mouse-cfg.h"
#include "cards.h"
+#include "card-cfg.h"
#include <X11/Xaw/AsciiText.h>
#include <X11/Xaw/Form.h>
#include <X11/Xaw/Label.h>
#include <X11/Xaw/List.h>
+#include <X11/Xaw/MenuButton.h>
+#include <X11/Xaw/SmeBSB.h>
+#include <X11/Xaw/SimpleMenu.h>
#include <X11/Xaw/Viewport.h>
+#ifdef USE_MODULES
+#include "loader.h"
+#endif
/*
* Prototypes
*/
static Bool CardConfigCheck(void);
static void CardModelCallback(Widget, XtPointer, XtPointer);
+#ifdef USE_MODULES
+static void DriverCallback(Widget, XtPointer, XtPointer);
+#endif
/*
* Initialization
*/
static CardsEntry *card_entry;
static XF86ConfDevicePtr current_device;
-static Widget filter, list, busid;
+static Widget filter, list, driver, busid;
static char **cards = NULL;
static int ncards;
-
+#ifdef USE_MODULES
+static char *driver_str;
+#endif
/*
* Implementation
@@ -65,7 +77,7 @@ CardConfig(XtPointer config)
/* XF86OptionPtr option;*/
char card_name[32];
Arg args[1];
- char *bus;
+ char *bus, *drv_nam;
xf86info.cur_list = CARD;
XtSetSensitive(back, xf86info.lists[CARD].cur_function > 0);
@@ -98,6 +110,12 @@ CardConfig(XtPointer config)
XtSetValues(ident_widget, args, 1);
XtSetArg(args[0], XtNstring, card->dev_busid);
XtSetValues(busid, args, 1);
+#ifdef USE_MODULES
+ XtSetArg(args[0], XtNlabel, driver_str = card->dev_driver);
+#else
+ XtSetArg(args[0], XtNstring, card->dev_driver);
+#endif
+ XtSetValues(driver, args, 1);
}
else {
XF86ConfDevicePtr device = XF86Config->conf_device_lst;
@@ -110,13 +128,19 @@ CardConfig(XtPointer config)
do {
++ndevices;
XmuSnprintf(card_name, sizeof(card_name), "Card%d", ndevices);
- } while (xf86FindDevice(card_name,
+ } while (xf86findDevice(card_name,
XF86Config->conf_device_lst));
XtSetArg(args[0], XtNstring, card_name);
XtSetValues(ident_widget, args, 1);
XtSetArg(args[0], XtNstring, "");
XtSetValues(busid, args, 1);
+#ifdef USE_MODULES
+ XtSetArg(args[0], XtNlabel, driver_str = "vga");
+#else
+ XtSetArg(args[0], XtNstring, "vga");
+#endif
+ XtSetValues(driver, args, 1);
}
if (ConfigLoop(CardConfigCheck) == True) {
@@ -154,12 +178,22 @@ CardConfig(XtPointer config)
}
}
if (strcasecmp(card->dev_identifier, ident_string))
- xf86RenameDevice(XF86Config, card, ident_string);
+ xf86renameDevice(XF86Config, card, ident_string);
XtSetArg(args[0], XtNstring, &bus);
XtGetValues(busid, args, 1);
XtFree(card->dev_busid);
card->dev_busid = XtNewString(bus);
+#ifdef USE_MODULES
+ drv_nam = driver_str;
+#else
+ XtSetArg(args[0], XtNstring, &drv_nam);
+ XtGetValues(driver, args, 1);
+#endif
+
+ XtFree(card->dev_driver);
+ card->dev_driver = XtNewString(drv_nam);
+
return ((XtPointer)card);
}
@@ -170,9 +204,19 @@ static Bool
CardConfigCheck(void)
{
XF86ConfDevicePtr device = XF86Config->conf_device_lst;
+ char *drv_nam;
+
+#ifdef USE_MODULES
+ drv_nam = driver_str;
+#else
+ Arg args[1];
+ XtSetArg(args[0], XtNstring, &drv_nam);
+ XtGetValues(driver, args, 1);
+#endif
if (ident_string == NULL || strlen(ident_string) == 0 ||
- (current_device == NULL && card_entry == NULL))
+ (current_device == NULL && card_entry == NULL) ||
+ drv_nam == NULL || *drv_nam == '\0')
return (False);
while (device != NULL) {
@@ -230,6 +274,9 @@ CardModelCallback(Widget w, XtPointer user_data, XtPointer call_data)
else
first = 0;
+ XtSetArg(args[0], XtNstring, card_entry->driver ? card_entry->driver : "vga");
+ XtSetValues(driver, args, 1);
+
str = XtNewString(tip);
XtSetArg(args[0], XtNtip, str);
XtSetValues(filter, args, 1);
@@ -273,6 +320,19 @@ CardFilterAction(Widget w, XEvent *ev, String *params, Cardinal *num_params)
XtManageChild(list);
}
+#ifdef USE_MODULES
+/*ARGSUSED*/
+static void
+DriverCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ Arg args[1];
+
+ driver_str = XtName(w);
+ XtSetArg(args[0], XtNlabel, driver_str);
+ XtSetValues(driver, args, 1);
+}
+#endif
+
void
CardModel(XF86SetupInfo *info)
{
@@ -303,6 +363,31 @@ CardModel(XF86SetupInfo *info)
NULL, 0);
XtAddCallback(list, XtNcallback, CardModelCallback,
(XtPointer)info);
+ XtCreateManagedWidget("driverL", labelWidgetClass, model, NULL, 0);
+#ifdef USE_MODULES
+ driver = XtVaCreateManagedWidget("driver", menuButtonWidgetClass,
+ model,
+ XtNmenuName, "driverM",
+ NULL, 0);
+ {
+ Widget menu, sme;
+ xf86cfgDriverOptions *opts = video_driver_info;
+
+ menu = XtCreatePopupShell("driverM", simpleMenuWidgetClass,
+ driver, NULL, 0);
+ while (opts) {
+ sme = XtCreateManagedWidget(opts->name, smeBSBObjectClass,
+ menu, NULL, 0);
+ XtAddCallback(sme, XtNcallback, DriverCallback, NULL);
+ opts = opts->next;
+ }
+ }
+#else
+ driver = XtVaCreateManagedWidget("driver", asciiTextWidgetClass,
+ model,
+ XtNeditType, XawtextEdit,
+ NULL, 0);
+#endif
XtCreateManagedWidget("busidL", labelWidgetClass, model, NULL, 0);
busid = XtVaCreateManagedWidget("busid", asciiTextWidgetClass,
model,
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/config.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/config.c
index 284a72d3f..4bfc62826 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/config.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/config.c
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/config.c,v 1.2 2000/05/18 16:29:59 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/config.c,v 1.4 2000/10/27 18:31:05 dawes Exp $
*/
#include "config.h"
@@ -42,9 +42,22 @@
#include <X11/Xaw/Command.h>
#include <X11/Shell.h>
-#define CONFPATH "%A,%R,/etc/X11/%R,%P/etc/X11/%R,%E,%F,/etc/X11/%F," \
- "%P/etc/X11/%F,%D/%X,/etc/X11/%X,/etc/%X,%P/etc/X11/%X.%H," \
- "%P/etc/X11/%X,%P/lib/X11/%X.%H,%P/lib/X11/%X"
+#define CONFPATH "%A," "%R," \
+ "/etc/X11/%R," "%P/etc/X11/%R," \
+ "%E," "%F," \
+ "/etc/X11/%F," "%P/etc/X11/%F," \
+ "%D/%X," \
+ "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \
+ "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \
+ "%P/etc/X11/%X," \
+ "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \
+ "%P/lib/X11/%X"
+#define USER_CONFPATH "/etc/X11/%S," "%P/etc/X11/%S," \
+ "/etc/X11/%G," "%P/etc/X11/%G," \
+ "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \
+ "%P/etc/X11/%X," \
+ "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \
+ "%P/lib/X11/%X"
/*
* Prototypes
@@ -118,11 +131,13 @@ StartConfig(void)
first = 0;
/* Read initial configuration */
- if ((filename = xf86OpenConfigFile(CONFPATH, XF86Config_path, NULL)) == NULL) {
+ if ((filename = xf86openConfigFile(getuid() == 0 ? CONFPATH : USER_CONFPATH,
+ XF86Config_path, NULL)) == NULL) {
fprintf(stderr, "Cannot to open config file.\n");
exit(1);
}
- if ((XF86Config = xf86ReadConfigFile()) == NULL) {
+ XF86Config_path = filename;
+ if ((XF86Config = xf86readConfigFile()) == NULL) {
fprintf(stderr, "Problem when parsing config file\n");
exit(1);
}
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/config.h b/xc/programs/Xserver/hw/xfree86/xf86cfg/config.h
index a912fa380..c2593d62f 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/config.h
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/config.h
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/config.h,v 1.5 2000/08/04 16:13:44 eich Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/config.h,v 1.6 2000/10/20 14:59:05 alanh Exp $
*/
#include <X11/IntrinsicP.h>
@@ -112,7 +112,7 @@ struct _XF86SetupInfo {
XF86SetupFunctionList *lists;
};
-typedef Bool (*ConfigCheckFunction)();
+typedef Bool (*ConfigCheckFunction)(void);
typedef struct _xf86cfgDevice xf86cfgDevice;
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/help.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/help.c
index a970b1006..8f53a52ed 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/help.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/help.c
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/help.c,v 1.1 2000/06/13 23:15:51 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/help.c,v 1.3 2000/10/20 14:59:05 alanh Exp $
*/
#include <X11/IntrinsicP.h>
@@ -39,11 +39,13 @@
#include <X11/Xaw/Text.h>
#include <X11/Xaw/TextSinkP.h>
#include <X11/Xaw/TextSrcP.h>
+#include <X11/Xmu/SysUtil.h>
#include <X11/Xmu/Xmu.h>
#ifndef X_NOT_STDC_ENV
#include <stdlib.h> /* for bsearch() */
#endif
#include <ctype.h>
+#include "help.h"
/*
* Prototypes
@@ -64,7 +66,7 @@ static Bool popped_up = False;
/*
* Implementation
*/
-Bool
+void
Help(char *topic)
{
Widget source;
@@ -256,7 +258,6 @@ struct _Html_SourceInfo {
/*
* Proptotypes
*/
-void Html_ModeStart(Widget);
void Html_ModeEnd(Widget);
static void Html_ModeInit(void);
static void Html_ParseCallback(Widget, XtPointer, XtPointer);
@@ -269,7 +270,7 @@ static void Html_Commit(Html_Parser*);
static void Html_AddEntities(Html_Parser*, Html_Item*);
static int Html_Put(Html_Parser*, int);
-static char *Html_Puts(Html_Parser*, char*);
+static void Html_Puts(Html_Parser*, char*);
static int Html_Format1(Html_Parser*);
static int Html_Format2(Html_Parser*);
static int Html_Format3(Html_Parser*);
@@ -737,7 +738,8 @@ Html_Commit(Html_Parser *parser)
position, length, Qli);
else
XawTextSourceAddEntity(parser->source, 0, /*XAW_TENT_LITEM,*/
- XAW_TENTF_HIDE, (XtPointer)head->li++,
+ XAW_TENTF_HIDE,
+ (XtPointer)(long)head->li++,
position, length, Qli);
}
else if (quark == Qhide)
@@ -1219,7 +1221,7 @@ Html_Put(Html_Parser *parser, int ch)
return (ch);
}
-static char *
+static void
Html_Puts(Html_Parser *parser, char *str)
{
int len = strlen(str);
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c
index e83cec850..59c49d142 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c,v 1.5 2000/08/04 16:13:44 eich Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c,v 1.8 2000/10/27 18:31:05 dawes Exp $
*/
#include <X11/IntrinsicP.h>
@@ -58,6 +58,7 @@
#include "options.h"
#include "vidmode.h"
#include "help.h"
+#include "stubs.h"
#define randomize() srand((unsigned)time((time_t*)NULL))
#define DefaultXFree86Dir "/usr/X11R6"
@@ -91,6 +92,7 @@ static Bool AskConfig(void);
void WriteConfigAction(Widget, XEvent*, String*, Cardinal*);
static void ScreenSetup(Bool);
void QuitAction(Widget, XEvent*, String*, Cardinal*);
+void PopdownErrorCallback(Widget, XtPointer, XtPointer);
static void ErrorCancelAction(Widget, XEvent*, String*, Cardinal*);
static void QuitCancelAction(Widget, XEvent*, String*, Cardinal*);
static void HelpCallback(Widget, XtPointer, XtPointer);
@@ -109,7 +111,10 @@ char *XF86Config_path = NULL;
char *XF86Module_path = NULL;
char *XF86Font_path = NULL;
char *XF86RGB_path = NULL;
+char *XkbConfig_path = NULL;
char *XFree86Dir;
+static char XF86Config_path_static[1024];
+static char XkbConfig_path_static[1024];
Bool xf86config_set = False;
xf86cfgComputer computer;
@@ -187,6 +192,10 @@ main(int argc, char *argv[])
XF86ConfLayoutPtr lay;
int i, startedx;
+#ifdef USE_MODULES
+ xf86Verbose = 1;
+#endif
+
if ((XFree86Dir = getenv("XWINHOME")) == NULL)
XFree86Dir = DefaultXFree86Dir;
@@ -212,8 +221,10 @@ main(int argc, char *argv[])
}
startedx = startx();
- if (XF86Config_path == NULL)
- XF86Config_path = "/etc/X11/XF86Config";
+/* if (XF86Config_path == NULL)
+ XF86Config_path = "/etc/X11/XF86Config-4";*/
+ if (XkbConfig_path == NULL)
+ XkbConfig_path = XkbConfigDir XkbConfigFile;
toplevel = XtAppInitialize(&appcon, "XF86Cfg",
/* optionDescList, XtNumber(optionDescList),*/
NULL, 0,
@@ -379,6 +390,10 @@ main(int argc, char *argv[])
}
}
+#ifdef USE_MODULES
+ LoaderInitializeOptions();
+#endif
+
XtAppMainLoop(appcon);
if (startedx)
endx();
@@ -400,7 +415,7 @@ WriteConfig(Widget w, XtPointer user_data, XtPointer call_data)
{
asking_cf = 0;
XtPopdown(shell_cf);
- write_cf = (int)user_data;
+ write_cf = (long)user_data;
}
/*ARGSUSED*/
@@ -460,7 +475,7 @@ AskConfig(void)
break;
case CF_XKBConfig:
str = "XKB";
- XtSetArg(args[num_args], XtNvalue, XkbConfigDir XkbConfigFile);
+ XtSetArg(args[num_args], XtNvalue, XkbConfig_path);
++num_args;
break;
}
@@ -483,8 +498,24 @@ AskConfig(void)
while (asking_cf)
XtAppProcessEvent(XtWidgetToApplicationContext(shell_cf), XtIMAll);
- if (write_cf > 0)
- XF86Config_path = XawDialogGetValueString(dialog);
+ if (write_cf > 0) {
+ switch (cf_state) {
+ case CF_XF86Config:
+ XF86Config_path = XawDialogGetValueString(dialog);
+ XmuSnprintf(XF86Config_path_static,
+ sizeof(XF86Config_path_static),
+ "%s", XF86Config_path);
+ XF86Config_path = XF86Config_path_static;
+ break;
+ case CF_XKBConfig:
+ XkbConfig_path = XawDialogGetValueString(dialog);
+ XmuSnprintf(XkbConfig_path_static,
+ sizeof(XkbConfig_path_static),
+ "%s", XkbConfig_path);
+ XkbConfig_path = XkbConfig_path_static;
+ break;
+ }
+ }
return (write_cf);
}
@@ -523,9 +554,9 @@ QuitCallback(Widget w, XtPointer user_data, XtPointer call_data)
break;
case 1:
if ((cf_state == CF_XF86Config &&
- !xf86WriteConfigFile(XF86Config_path, XF86Config)) ||
+ !xf86writeConfigFile(XF86Config_path, XF86Config)) ||
(cf_state == CF_XKBConfig &&
- !WriteXKBConfiguration(XkbConfigDir XkbConfigFile,
+ !WriteXKBConfiguration(XkbConfig_path,
&xkb_info->config))) {
static Widget shell;
@@ -861,13 +892,13 @@ SelectLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data)
do {
++num_layouts;
XmuSnprintf(name, sizeof(name), "Layout%d", num_layouts);
- } while (xf86FindLayout(name,
+ } while (xf86findLayout(name,
XF86Config->conf_layout_lst) != NULL);
l = (XF86ConfLayoutPtr)XtCalloc(1, sizeof(XF86ConfLayoutRec));
l->lay_identifier = XtNewString(name);
XF86Config->conf_layout_lst =
- xf86AddLayout(XF86Config->conf_layout_lst, l);
+ xf86addLayout(XF86Config->conf_layout_lst, l);
layoutsme = XtVaCreateManagedWidget("sme", smeBSBObjectClass,
layoutp,
XtNlabel, name,
@@ -948,7 +979,7 @@ DefaultLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data)
XtGetValues(sme, args, 1);
prev = XF86Config->conf_layout_lst;
- lay = xf86FindLayout(str, prev);
+ lay = xf86findLayout(str, prev);
if (prev == lay)
return;
@@ -997,7 +1028,7 @@ RemoveLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data)
XtSetArg(args[0], XtNlabel, &str);
XtGetValues(sme, args, 1);
prev = XF86Config->conf_layout_lst;
- lay = xf86FindLayout(str, prev);
+ lay = xf86findLayout(str, prev);
tmp = prev;
while (tmp != NULL) {
if (tmp == lay)
@@ -1039,7 +1070,7 @@ RemoveLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data)
DrawCables();
}
- xf86RemoveLayout(XF86Config, rem);
+ xf86removeLayout(XF86Config, rem);
XtDestroyWidget(sme);
}
@@ -1151,7 +1182,7 @@ SetTip(xf86cfgDevice *device)
void
AddDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
- AddDevice((int)user_data, NULL, 6, 6);
+ AddDevice((long)user_data, NULL, 6, 6);
}
void
@@ -1169,7 +1200,7 @@ ConfigureDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
if (mouse != NULL && computer.devices[i]->config == NULL) {
XF86Config->conf_input_lst =
- xf86AddInput(XF86Config->conf_input_lst,
+ xf86addInput(XF86Config->conf_input_lst,
mouse);
computer.devices[i]->config = (XtPointer)mouse;
}
@@ -1181,7 +1212,7 @@ ConfigureDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
if (keyboard != NULL && computer.devices[i]->config == NULL) {
XF86Config->conf_input_lst =
- xf86AddInput(XF86Config->conf_input_lst,
+ xf86addInput(XF86Config->conf_input_lst,
keyboard);
computer.devices[i]->config = (XtPointer)keyboard;
}
@@ -1193,7 +1224,7 @@ ConfigureDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
if (card != NULL && computer.devices[i]->config == NULL) {
XF86Config->conf_device_lst =
- xf86AddDevice(XF86Config->conf_device_lst,
+ xf86addDevice(XF86Config->conf_device_lst,
card);
computer.devices[i]->config = (XtPointer)card;
}
@@ -1208,7 +1239,7 @@ ConfigureDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
if (monitor != NULL && computer.devices[i]->config == NULL) {
XF86Config->conf_monitor_lst =
- xf86AddMonitor(XF86Config->conf_monitor_lst,
+ xf86addMonitor(XF86Config->conf_monitor_lst,
monitor);
computer.devices[i]->config = (XtPointer)monitor;
}
@@ -1236,6 +1267,9 @@ OptionsCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
int i;
XF86OptionPtr *options;
+#ifdef USE_MODULES
+ xf86cfgDriverOptions *drv_opts = NULL;
+#endif
if (config_mode == CONFIG_SCREEN) {
for (i = 0; i < computer.num_screens; i++)
@@ -1265,6 +1299,21 @@ OptionsCallback(Widget w, XtPointer user_data, XtPointer call_data)
case CARD:
options = (XF86OptionPtr*)&(((XF86ConfDevicePtr)
(computer.devices[i]->config))->dev_option_lst);
+#ifdef USE_MODULES
+ {
+ char *drv = ((XF86ConfDevicePtr)
+ (computer.devices[i]->config))->dev_driver;
+
+ if (drv) {
+ drv_opts = video_driver_info;
+ while (drv_opts) {
+ if (strcmp(drv_opts->name, drv) == 0)
+ break;
+ drv_opts = drv_opts->next;
+ }
+ }
+ }
+#endif
break;
case MONITOR:
options = (XF86OptionPtr*)&(((XF86ConfMonitorPtr)
@@ -1274,13 +1323,18 @@ OptionsCallback(Widget w, XtPointer user_data, XtPointer call_data)
}
}
+#ifdef USE_MODULES
+ OptionsPopup(options, drv_opts ? drv_opts->name : NULL,
+ drv_opts ? drv_opts->option : NULL);
+#else
OptionsPopup(options);
+#endif
if (config_mode == CONFIG_SCREEN) {
XF86OptionPtr option, options;
int rotate;
options = computer.screens[i]->screen->scrn_option_lst;
- if ((option = xf86FindOption(options, "Rotate")) != NULL) {
+ if ((option = xf86findOption(options, "Rotate")) != NULL) {
if (option->opt_val != NULL)
rotate = strcasecmp(option->opt_val, "CW") == 0 ? 1 :
strcasecmp(option->opt_val, "CCW") == 0 ? -1 : 0;
@@ -1351,14 +1405,14 @@ EnableDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
nex->iref_inputdev = input;
nex->iref_inputdev_str = XtNewString(input->inp_identifier);
if (nmouses == 0 && computer.devices[i]->type == MOUSE)
- option = xf86NewOption(XtNewString("CorePointer"), NULL);
+ option = xf86newOption(XtNewString("CorePointer"), NULL);
else if (nkeyboards == 0 && computer.devices[i]->type == KEYBOARD)
- option = xf86NewOption(XtNewString("CoreKeyboard"), NULL);
+ option = xf86newOption(XtNewString("CoreKeyboard"), NULL);
else
- option = xf86NewOption(XtNewString("SendCoreEvents"), NULL);
+ option = xf86newOption(XtNewString("SendCoreEvents"), NULL);
nex->iref_option_lst = option;
computer.layout->lay_input_lst =
- xf86AddInputref(computer.layout->lay_input_lst, nex);
+ xf86addInputref(computer.layout->lay_input_lst, nex);
} break;
case CARD:
for (i = 0; i < computer.num_screens; i++) {
@@ -1372,7 +1426,7 @@ EnableDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
adj->adj_screen_str = XtNewString(computer.screens[i]->
screen->scrn_identifier);
computer.layout->lay_adjacency_lst = (XF86ConfAdjacencyPtr)
- addListItem((GenericListPtr)computer.layout->
+ xf86addListItem((GenericListPtr)computer.layout->
lay_adjacency_lst, (GenericListPtr)adj);
computer.screens[i]->state = USED;
}
@@ -1411,7 +1465,7 @@ DisableDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
switch (computer.devices[i]->type) {
case MOUSE:
case KEYBOARD:
- xf86RemoveInputRef(computer.layout,
+ xf86removeInputRef(computer.layout,
(XF86ConfInputPtr)(computer.devices[i]->config));
break;
case CARD: {
@@ -1425,7 +1479,7 @@ DisableDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
adj = computer.layout->lay_adjacency_lst;
while (adj != NULL) {
if (adj->adj_screen == computer.screens[j]->screen) {
- xf86RemoveAdjacency(computer.layout, adj);
+ xf86removeAdjacency(computer.layout, adj);
break;
}
adj = (XF86ConfAdjacencyPtr)(adj->list.next);
@@ -1480,7 +1534,7 @@ RemoveDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
switch (computer.devices[i]->type) {
case MOUSE:
case KEYBOARD:
- xf86RemoveInput(XF86Config,
+ xf86removeInput(XF86Config,
(XF86ConfInputPtr)(computer.devices[i]->config));
break;
case CARD:
@@ -1496,7 +1550,7 @@ RemoveDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
--j;
}
if (computer.devices[i]->refcount <= 0)
- xf86RemoveDevice(XF86Config,
+ xf86removeDevice(XF86Config,
(XF86ConfDevicePtr)(computer.devices[i]->config));
}
else if (computer.devices[i]->type == MONITOR) {
@@ -1507,7 +1561,7 @@ RemoveDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
--j;
}
if (computer.devices[i]->refcount <= 0)
- xf86RemoveMonitor(XF86Config,
+ xf86removeMonitor(XF86Config,
(XF86ConfMonitorPtr)(computer.devices[i]->config));
}
@@ -1717,7 +1771,7 @@ void RenameLayoutAction(Widget w, XEvent *event,
XtSetArg(args[0], XtNlabel, name);
XtSetValues(layoutsme, args, 1);
- xf86RenameLayout(XF86Config, computer.layout, name);
+ xf86renameLayout(XF86Config, computer.layout, name);
}
/*ARGSUSED*/
@@ -1785,7 +1839,7 @@ DrawCable(Display *display, Window window, int o_x, int o_y, int d_x, int d_y)
void
SetConfigModeCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
- int i, mode = (int)user_data;
+ int i, mode = (long)user_data;
Arg args[3];
char *ptr;
static Dimension height;
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c
index 3c6bbb8c9..c1737d9d5 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c,v 1.7 2000/08/04 03:51:49 tsi Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c,v 1.8 2000/10/20 14:59:05 alanh Exp $
*/
#include "xf86config.h"
@@ -144,11 +144,11 @@ KeyboardConfig(XtPointer config)
current_input = keyboard;
if (keyboard != NULL) {
- if ((option = xf86FindOption(keyboard->inp_option_lst, XkbModel)) != NULL)
+ if ((option = xf86findOption(keyboard->inp_option_lst, XkbModel)) != NULL)
xkb_info->defs.model = model = option->opt_val;
else
xkb_info->defs.model = model = xkb_model.name[0];
- if ((option = xf86FindOption(keyboard->inp_option_lst, XkbLayout)) != NULL)
+ if ((option = xf86findOption(keyboard->inp_option_lst, XkbLayout)) != NULL)
xkb_info->defs.layout = layout = option->opt_val;
else
xkb_info->defs.layout = layout = xkb_layout.name[0];
@@ -172,7 +172,7 @@ KeyboardConfig(XtPointer config)
++nkeyboards;
XmuSnprintf(keyboard_name, sizeof(keyboard_name),
"Keyboard%d", nkeyboards);
- } while (xf86FindInput(keyboard_name,
+ } while (xf86findInput(keyboard_name,
XF86Config->conf_input_lst));
model = xkb_model.name[0];
@@ -194,7 +194,7 @@ KeyboardConfig(XtPointer config)
keyboard->list.next = NULL;
keyboard->inp_identifier = XtNewString(ident_string);
keyboard->inp_driver = XtNewString("keyboard");
- keyboard->inp_option_lst = xf86NewOption(XtNewString(XkbModel),
+ keyboard->inp_option_lst = xf86newOption(XtNewString(XkbModel),
XtNewString(model));
xf86addNewOption(keyboard->inp_option_lst,
XtNewString(XkbLayout), XtNewString(layout));
@@ -220,37 +220,37 @@ KeyboardConfig(XtPointer config)
break;
}
- if ((option = xf86FindOption(keyboard->inp_option_lst, XkbModel))
+ if ((option = xf86findOption(keyboard->inp_option_lst, XkbModel))
!= NULL) {
XtFree(option->opt_val);
option->opt_val = XtNewString(model);
XtFree(option->opt_comment);
}
-/* else {
+ else {
if (keyboard->inp_option_lst == NULL)
- keyboard->inp_option_lst = xf86NewOption(XtNewString(XkbModel),
+ keyboard->inp_option_lst = xf86newOption(XtNewString(XkbModel),
XtNewString(model));
else
xf86addNewOption(keyboard->inp_option_lst,
XtNewString(XkbModel), XtNewString(model));
- }*/
+ }
XtFree(xkb_info->config.model);
xkb_info->config.model = XtNewString(model);
- if ((option = xf86FindOption(keyboard->inp_option_lst, XkbLayout))
+ if ((option = xf86findOption(keyboard->inp_option_lst, XkbLayout))
!= NULL) {
XtFree(option->opt_val);
option->opt_val = XtNewString(layout);
XtFree(option->opt_comment);
}
- /*else
+ else
xf86addNewOption(keyboard->inp_option_lst,
- XtNewString(XkbLayout), XtNewString(layout));*/
+ XtNewString(XkbLayout), XtNewString(layout));
XtFree(xkb_info->config.layout);
xkb_info->config.layout = XtNewString(layout);
}
if (strcasecmp(keyboard->inp_identifier, ident_string))
- xf86RenameInput(XF86Config, keyboard, ident_string);
+ xf86renameInput(XF86Config, keyboard, ident_string);
xkb_info->conf = keyboard;
return ((XtPointer)keyboard);
@@ -434,7 +434,7 @@ InitializeKeyboard(void)
if (xkb_info->config.model != NULL)
xkb_info->defs.model = xkb_info->config.model;
- else if ((option = xf86FindOption(keyboard->inp_option_lst, "XkbModel"))
+ else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbModel"))
!= NULL)
xkb_info->defs.model = option->opt_val;
else
@@ -442,7 +442,7 @@ InitializeKeyboard(void)
if (xkb_info->config.layout != NULL)
xkb_info->defs.layout = xkb_info->config.layout;
- else if ((option = xf86FindOption(keyboard->inp_option_lst, "XkbLayout"))
+ else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbLayout"))
!= NULL)
xkb_info->defs.layout = option->opt_val;
else
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c
index 44a03ae68..3bfdbf57c 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c,v 1.2 2000/05/18 16:29:59 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c,v 1.3 2000/10/20 14:59:06 alanh Exp $
*/
#include "xf86config.h"
@@ -173,7 +173,7 @@ MonitorConfig(XtPointer conf)
++nmonitors;
XmuSnprintf(monitor_name, sizeof(monitor_name),
"Monitor%d", nmonitors);
- } while (xf86FindMonitor(monitor_name,
+ } while (xf86findMonitor(monitor_name,
XF86Config->conf_monitor_lst));
XtSetArg(args[0], XtNstring, monitor_name);
@@ -200,7 +200,7 @@ MonitorConfig(XtPointer conf)
(monitor->mon_n_vrefresh = mon_n_vrefresh));
if (strcasecmp(monitor->mon_identifier, ident_string))
- xf86RenameMonitor(XF86Config, monitor, ident_string);
+ xf86renameMonitor(XF86Config, monitor, ident_string);
if (oldcard != card) {
int i;
@@ -210,7 +210,7 @@ MonitorConfig(XtPointer conf)
break;
if (computer.devices[i]->config == NULL)
XF86Config->conf_monitor_lst =
- xf86AddMonitor(XF86Config->conf_monitor_lst,
+ xf86addMonitor(XF86Config->conf_monitor_lst,
monitor);
computer.devices[i]->config = (XtPointer)monitor;
ChangeScreen(monitor, monitor, card, oldcard);
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c
index 3e4e73807..e3949d60e 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c,v 1.3 2000/08/01 20:05:43 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c,v 1.5 2000/10/20 14:59:06 alanh Exp $
*/
#include "xf86config.h"
@@ -40,7 +40,7 @@
#include <X11/extensions/xf86misc.h>
/*
- * Prootypes
+ * Prototypes
*/
static void MouseDeviceCallback(Widget, XtPointer, XtPointer);
static void MouseProtocolCallback(Widget, XtPointer, XtPointer);
@@ -91,13 +91,13 @@ MouseConfig(XtPointer config)
current_input = mouse;
if (mouse != NULL) {
- emulate = xf86FindOption(mouse->inp_option_lst,
+ emulate = xf86findOption(mouse->inp_option_lst,
Emulate3Buttons) != NULL;
- if ((option = xf86FindOption(mouse->inp_option_lst, Device)) != NULL)
+ if ((option = xf86findOption(mouse->inp_option_lst, Device)) != NULL)
device = option->opt_val;
else
device = NULL;
- if ((option = xf86FindOption(mouse->inp_option_lst, Protocol)) != NULL)
+ if ((option = xf86findOption(mouse->inp_option_lst, Protocol)) != NULL)
protocol = option->opt_val;
else
protocol = NULL;
@@ -117,7 +117,7 @@ MouseConfig(XtPointer config)
do {
++nmouses;
XmuSnprintf(mouse_name, sizeof(mouse_name), "Mouse%d", nmouses);
- } while (xf86FindInput(mouse_name,
+ } while (xf86findInput(mouse_name,
XF86Config->conf_input_lst));
XtSetArg(args[0], XtNstring, mouse_name);
@@ -143,7 +143,7 @@ MouseConfig(XtPointer config)
mouse->list.next = NULL;
mouse->inp_identifier = XtNewString(ident_string);
mouse->inp_driver = XtNewString("mouse");
- mouse->inp_option_lst = xf86NewOption(XtNewString(Device),
+ mouse->inp_option_lst = xf86newOption(XtNewString(Device),
XtNewString(device));
xf86addNewOption(mouse->inp_option_lst,
XtNewString(Protocol), XtNewString(protocol));
@@ -157,21 +157,21 @@ MouseConfig(XtPointer config)
mouse->inp_comment = NULL;
}
else {
- if ((option = xf86FindOption(mouse->inp_option_lst, Device)) != NULL) {
+ if ((option = xf86findOption(mouse->inp_option_lst, Device)) != NULL) {
XtFree(option->opt_val);
option->opt_val = XtNewString(device);
XtFree(option->opt_comment);
}
else {
if (mouse->inp_option_lst == NULL)
- mouse->inp_option_lst = xf86NewOption(XtNewString(Device),
+ mouse->inp_option_lst = xf86newOption(XtNewString(Device),
XtNewString(device));
else
xf86addNewOption(mouse->inp_option_lst,
XtNewString(Device), XtNewString(device));
}
- if ((option = xf86FindOption(mouse->inp_option_lst, Protocol)) != NULL) {
+ if ((option = xf86findOption(mouse->inp_option_lst, Protocol)) != NULL) {
XtFree(option->opt_val);
option->opt_val = XtNewString(protocol);
XtFree(option->opt_comment);
@@ -181,8 +181,8 @@ MouseConfig(XtPointer config)
XtNewString(Protocol), XtNewString(protocol));
if (emulate == False) {
- xf86RemoveOption(&(mouse->inp_option_lst), Emulate3Buttons);
- xf86RemoveOption(&(mouse->inp_option_lst), Emulate3Timeout);
+ xf86removeOption(&(mouse->inp_option_lst), Emulate3Buttons);
+ xf86removeOption(&(mouse->inp_option_lst), Emulate3Timeout);
}
else if (emulate) {
xf86addNewOption(mouse->inp_option_lst,
@@ -192,7 +192,7 @@ MouseConfig(XtPointer config)
}
}
if (strcasecmp(mouse->inp_identifier, ident_string))
- xf86RenameInput(XF86Config, mouse, ident_string);
+ xf86renameInput(XF86Config, mouse, ident_string);
return ((XtPointer)mouse);
}
@@ -244,7 +244,7 @@ MouseProtocolCallback(Widget w, XtPointer user_data, XtPointer call_data)
static void
MouseEmulateCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
- emulate = (Bool)call_data;
+ emulate = (Bool)(long)call_data;
}
static void
@@ -375,8 +375,8 @@ MouseDeviceAndProtocol(XF86SetupInfo *info)
NULL, 0);
XtAddCallback(listP, XtNcallback, MouseProtocolCallback, NULL);
- emul3 = XtCreateManagedWidget("emulate3", toggleWidgetClass,
- mouse_dp, NULL, 0);
+ emul3 = XtVaCreateManagedWidget("emulate3", toggleWidgetClass,
+ mouse_dp, XtNstate, True, NULL, 0);
XtAddCallback(emul3, XtNcallback, MouseEmulateCallback, NULL);
apply = XtCreateManagedWidget("apply", commandWidgetClass,
mouse_dp, NULL, 0);
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/options.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/options.c
index 2381fb623..e3ff91b51 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/options.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/options.c
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/options.c,v 1.2 2000/05/18 16:29:59 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/options.c,v 1.3 2000/10/20 14:59:07 alanh Exp $
*/
#include "options.h"
@@ -35,7 +35,10 @@
#include <X11/Xaw/AsciiText.h>
#include <X11/Xaw/List.h>
#include <X11/Xaw/Command.h>
+#include <X11/Xaw/MenuButton.h>
#include <X11/Xaw/Paned.h>
+#include <X11/Xaw/SimpleMenP.h>
+#include <X11/Xaw/SmeBSB.h>
#include <X11/Xaw/Viewport.h>
/*
@@ -47,6 +50,9 @@ static void AddOption(Widget, XtPointer, XtPointer);
static void RemoveOption(Widget, XtPointer, XtPointer);
static void UpdateOption(Widget, XtPointer, XtPointer);
static void UpdateOptionList(void);
+#ifdef USE_MODULES
+static void AddDriverOption(Widget, XtPointer, XtPointer);
+#endif
/*
* Initialization
@@ -59,10 +65,24 @@ static int option_index, popped = False;
/*
* Implementation
*/
+#ifdef USE_MODULES
+void
+OptionsPopup(XF86OptionPtr *opts, char *driver, OptionInfoPtr drv_opts)
+#else
void
OptionsPopup(XF86OptionPtr *opts)
+#endif
{
static int first = 1;
+#ifdef USE_MODULES
+ static Widget button, menu;
+ static char label[256], menuName[16];
+ Widget sme;
+ char buf[256];
+ int i = 0;
+ Arg args[1];
+ static int menuN;
+#endif
option_str = NULL;
options = opts;
@@ -111,12 +131,76 @@ OptionsPopup(XF86OptionPtr *opts)
XtAddCallback(list, XtNcallback, SelectOptionCallback, NULL);
bottom = XtCreateManagedWidget("bottom", formWidgetClass,
pane, NULL, 0);
- popdown = XtCreateManagedWidget("popdown", commandWidgetClass,
+#ifdef USE_MODULES
+ button = XtCreateManagedWidget("driverOpts", menuButtonWidgetClass,
+ bottom, NULL, 0);
+#endif
+ popdown = XtVaCreateManagedWidget("popdown", commandWidgetClass,
bottom, NULL, 0);
+#ifdef USE_MODULES
+ XtVaSetValues(popdown, XtNfromHoriz, button, NULL, 0);
+#endif
+
XtAddCallback(popdown, XtNcallback, PopdownCallback, NULL);
XtRealizeWidget(shell);
XSetWMProtocols(DPY, XtWindow(shell), &wm_delete_window, 1);
+
+#ifdef USE_MODULES
+ {
+ char *str;
+
+ XtSetArg(args[0], XtNlabel, &str);
+ XtGetValues(button, args, 1);
+ XmuSnprintf(label, sizeof(label), "%s", str);
+ }
+#endif
+ }
+
+#ifdef USE_MODULES
+ if (menu)
+ XtDestroyWidget(menu);
+ XmuSnprintf(menuName, sizeof(buf), "optionM%d", menuN);
+ menuN = !menuN;
+ menu = XtCreatePopupShell(menuName, simpleMenuWidgetClass, button,
+ NULL, 0);
+ XtVaSetValues(button, XtNmenuName, menuName, NULL, 0);
+ if (drv_opts) {
+ int len, longest = 0;
+ char fmt[32];
+ static char *types[] = {
+ "none", "integer", "(non null) string", "string", "real",
+ "boolean", "frequency",
+ };
+
+ for (i = 0; drv_opts[i].name != NULL; i++) {
+ len = strlen(drv_opts[i].name);
+ if (len > longest)
+ longest = len;
+ }
+ XmuSnprintf(fmt, sizeof(fmt), "%c-%ds %%s", '%', longest);
+ for (; drv_opts->name != NULL; drv_opts++) {
+ char *type;
+
+ if (drv_opts->type >= OPTV_NONE && drv_opts->type <= OPTV_FREQ)
+ type = types[drv_opts->type];
+ else
+ type = "UNKNOWN";
+
+ XmuSnprintf(buf, sizeof(buf), fmt, drv_opts->name, type);
+ sme = XtVaCreateManagedWidget(drv_opts->name, smeBSBObjectClass,
+ menu, XtNlabel, buf, NULL, 0);
+ XtAddCallback(sme, XtNcallback, AddDriverOption, (XtPointer)drv_opts);
+ }
+ }
+ if (i) {
+ XmuSnprintf(buf, sizeof(buf), "%s%s", label, driver);
+ XtSetArg(args[0], XtNlabel, buf);
+ XtSetValues(button, args, 1);
+ XtMapWidget(button);
}
+ else
+ XtUnmapWidget(button);
+#endif
UpdateOptionList();
popped = True;
@@ -201,7 +285,7 @@ SelectOptionCallback(Widget w, XtPointer user_data, XtPointer call_data)
option_str = info->string;
option_index = info->list_index;
- if ((option = xf86FindOption(*options, info->string)) != NULL) {
+ if ((option = xf86findOption(*options, info->string)) != NULL) {
XtSetArg(args[0], XtNstring, option->opt_name);
XtSetValues(name, args, 1);
XtSetArg(args[0], XtNstring,
@@ -223,7 +307,7 @@ AddOption(Widget w, XtPointer user_data, XtPointer call_data)
XtGetValues(name, args, 1);
XtSetArg(args[0], XtNstring, &val);
XtGetValues(value, args, 1);
- if (xf86FindOption(*options, nam) != NULL || strlen(nam) == 0)
+ if (xf86findOption(*options, nam) != NULL || strlen(nam) == 0)
/* XXX xf86addNewOption will trash the option linked list if
* the options being added already exists.
*/
@@ -233,6 +317,25 @@ AddOption(Widget w, XtPointer user_data, XtPointer call_data)
UpdateOptionList();
}
+#ifdef USE_MODULES
+/*ARGSUSED*/
+static void
+AddDriverOption(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ Arg args[1];
+ OptionInfoPtr opt = (OptionInfoPtr)user_data;
+ XF86OptionPtr option;
+
+ XtSetArg(args[0], XtNstring, opt->name);
+ XtSetValues(name, args, 1);
+ if ((option = xf86findOption(*options, opt->name)) == NULL)
+ XtSetArg(args[0], XtNstring, "");
+ else
+ XtSetArg(args[0], XtNstring, option->opt_val);
+ XtSetValues(value, args, 1);
+}
+#endif
+
/*ARGSUSED*/
static void
RemoveOption(Widget w, XtPointer user_data, XtPointer call_data)
@@ -242,7 +345,7 @@ RemoveOption(Widget w, XtPointer user_data, XtPointer call_data)
XtSetArg(args[0], XtNstring, &str);
XtGetValues(name, args, 1);
- xf86RemoveOption(options, str);
+ xf86removeOption(options, str);
UpdateOptionList();
}
@@ -250,7 +353,7 @@ RemoveOption(Widget w, XtPointer user_data, XtPointer call_data)
static void
UpdateOption(Widget w, XtPointer user_data, XtPointer call_data)
{
-/* xf86RemoveOption(options, option_str);
+/* xf86removeOption(options, option_str);
AddOption(w, user_data, call_data);
UpdateOptionList();*/
@@ -262,7 +365,7 @@ UpdateOption(Widget w, XtPointer user_data, XtPointer call_data)
XtGetValues(name, args, 1);
XtSetArg(args[0], XtNstring, &val);
XtGetValues(value, args, 1);
- if ((option = xf86FindOption(*options, option_str)) == NULL)
+ if ((option = xf86findOption(*options, option_str)) == NULL)
return;
XtFree(option->opt_name);
option->opt_name = option_str = XtNewString(nam);
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/options.h b/xc/programs/Xserver/hw/xfree86/xf86cfg/options.h
index 0ab081f79..eb5b4474a 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/options.h
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/options.h
@@ -26,13 +26,20 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/options.h,v 1.2 2000/05/18 16:29:59 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/options.h,v 1.3 2000/10/20 14:59:07 alanh Exp $
*/
#include "config.h"
+#ifdef USE_MODULES
+#include "loader.h"
+#endif
/*
* Prototypes
*/
+#ifdef USE_MODULES
+void OptionsPopup(XF86OptionPtr*, char*, OptionInfoPtr);
+#else
void OptionsPopup(XF86OptionPtr*);
+#endif
void OptionsCancelAction(Widget, XEvent*, String*, Cardinal*);
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c
index 8a6c514be..bda0942df 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c,v 1.2 2000/05/18 16:29:59 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c,v 1.4 2000/10/20 14:59:07 alanh Exp $
*/
#include "xf86config.h"
@@ -37,6 +37,9 @@
#include <X11/Xaw/List.h>
#include <X11/Xaw/Toggle.h>
#include <X11/Xaw/Viewport.h>
+#ifdef USE_MODULES
+#include "loader.h"
+#endif
#define CW 1
#define CCW -1
@@ -49,6 +52,7 @@ static void SelectIndexCallback(Widget, XtPointer, XtPointer);
static void UnselectIndexCallback(Widget, XtPointer, XtPointer);
static void SelectCallback(Widget, XtPointer, XtPointer);
static void UnselectCallback(Widget, XtPointer, XtPointer);
+static void MoveCallback(Widget, XtPointer, XtPointer);
static void RotateCallback(Widget, XtPointer, XtPointer);
/*
@@ -152,13 +156,13 @@ ScreenConfig(XtPointer conf)
if (disp == NULL) {
disp = (XF86ConfDisplayPtr)XtCalloc(1, sizeof(XF86ConfDisplayRec));
screen->scrn_display_lst = (XF86ConfDisplayPtr)
- addListItem((GenericListPtr)(screen->scrn_display_lst),
+ xf86addListItem((GenericListPtr)(screen->scrn_display_lst),
(GenericListPtr)(disp));
disp->disp_depth = default_depth;
}
if (strcasecmp(screen->scrn_identifier, ident_string))
- xf86RenameScreen(XF86Config, screen, ident_string);
+ xf86renameScreen(XF86Config, screen, ident_string);
screen->scrn_defaultdepth = default_depth;
@@ -207,7 +211,7 @@ ScreenConfig(XtPointer conf)
static char *Rotate = "Rotate";
if (screen->scrn_option_lst != NULL)
- xf86RemoveOption(&screen->scrn_option_lst, Rotate);
+ xf86removeOption(&screen->scrn_option_lst, Rotate);
if (rotate)
screen->scrn_option_lst =
xf86addNewOption(screen->scrn_option_lst,
@@ -242,7 +246,7 @@ static void
DepthCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
if (call_data != NULL)
- default_depth = (int)user_data;
+ default_depth = (long)user_data;
}
/*ARGSUSED*/
@@ -289,7 +293,19 @@ SelectCallback(Widget w, XtPointer user_data, XtPointer call_data)
XtSetArg(args[0], XtNlist, defmodes);
XtSetArg(args[1], XtNnumberStrings, ndefmodes);
XtSetValues(listR, args, 2);
- unsel_index = -1;
+
+ XawListUnhighlight(listR);
+ if (ndefmodes > 1 || (ndefmodes == 1 && *defmodes[0] != '\0')) {
+ if (unsel_index >= ndefmodes)
+ unsel_index = ndefmodes - 1;
+ XawListHighlight(listR, unsel_index = ndefmodes - 1);
+ }
+ else
+ unsel_index = -1;
+
+ /* force realyout */
+ XtUnmanageChild(listR);
+ XtManageChild(listR);
}
/*ARGSUSED*/
@@ -297,10 +313,26 @@ static void
UnselectCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
Arg args[2];
+ char **modes;
+ Cardinal num_modes;
if (unsel_index < 0 || unsel_index >= ndefmodes)
return;
+ XawListUnhighlight(listL);
+ XtSetArg(args[0], XtNlist, &modes);
+ XtSetArg(args[1], XtNnumberStrings, &num_modes);
+ XtGetValues(listL, args, 2);
+ if (modes) {
+ for (sel_index = 0; sel_index < num_modes; sel_index++)
+ if (strcmp(defmodes[unsel_index], modes[sel_index]) == 0)
+ break;
+ if (sel_index < num_modes)
+ XawListHighlight(listL, sel_index);
+ else
+ sel_index = -1;
+ }
+
XtFree(defmodes[unsel_index]);
if (--ndefmodes > unsel_index)
memmove(&defmodes[unsel_index], &defmodes[unsel_index + 1],
@@ -317,7 +349,40 @@ UnselectCallback(Widget w, XtPointer user_data, XtPointer call_data)
XtSetArg(args[0], XtNlist, defmodes);
XtSetArg(args[1], XtNnumberStrings, ndefmodes);
XtSetValues(listR, args, 2);
- unsel_index = -1;
+
+ XawListUnhighlight(listR);
+ if (ndefmodes > 1 || (ndefmodes == 1 && *defmodes[0] != '\0')) {
+ if (unsel_index >= ndefmodes)
+ unsel_index = ndefmodes - 1;
+ XawListHighlight(listR, unsel_index);
+ }
+ else
+ unsel_index = -1;
+}
+
+/*ARGSUSED*/
+static void
+MoveCallback(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ char *tmp;
+ Bool down = (Bool)user_data;
+
+ if (unsel_index < 0 || unsel_index >= ndefmodes)
+ return;
+
+ if ((down && unsel_index + 1 >= ndefmodes) ||
+ (!down && unsel_index - 1 < 0))
+ return;
+
+ tmp = defmodes[unsel_index];
+ if (down)
+ defmodes[unsel_index] = defmodes[++unsel_index];
+ else
+ defmodes[unsel_index] = defmodes[--unsel_index];
+ defmodes[unsel_index] = tmp;
+
+ XawListUnhighlight(listR);
+ XawListHighlight(listR, unsel_index);
}
/*ARGSUSED*/
@@ -325,7 +390,7 @@ void
RotateCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
if (call_data != NULL)
- rotate = (int)user_data;
+ rotate = (long)user_data;
else
rotate = 0;
}
@@ -333,11 +398,15 @@ RotateCallback(Widget w, XtPointer user_data, XtPointer call_data)
void
ScreenDialog(XF86SetupInfo *info)
{
- static Widget dialog, d1, d4, d8, d16, d24, cw, ccw;
+ static Widget dialog, d1, d4, d8, d16, d24, labelRotate, cw, ccw;
Arg args[2];
XF86ConfMonitorPtr mon = screen->scrn_monitor;
XF86ConfModeLinePtr mline = mon != NULL ? mon->mon_modeline_lst : NULL;
int i;
+#ifdef USE_MODULES
+ xf86cfgDriverOptions *drv_opts = video_driver_info;
+ Bool foundRotate = False;
+#endif
while (nmodes > 0)
XtFree(modes[--nmodes]);
@@ -391,13 +460,20 @@ ScreenDialog(XF86SetupInfo *info)
command = XtCreateManagedWidget("unselect", commandWidgetClass,
dialog, NULL, 0);
XtAddCallback(command, XtNcallback, UnselectCallback, NULL);
+ command = XtCreateManagedWidget("up", commandWidgetClass,
+ dialog, NULL, 0);
+ XtAddCallback(command, XtNcallback, MoveCallback, (XtPointer)False);
+ command = XtCreateManagedWidget("down", commandWidgetClass,
+ dialog, NULL, 0);
+ XtAddCallback(command, XtNcallback, MoveCallback, (XtPointer)True);
viewport = XtCreateManagedWidget("viewR", viewportWidgetClass, dialog,
NULL, 0);
listR = XtCreateManagedWidget("listRight", listWidgetClass, viewport,
NULL, 0);
XtAddCallback(listR, XtNcallback, UnselectIndexCallback, NULL);
- XtCreateManagedWidget("rotate", labelWidgetClass, dialog, NULL, 0);
+ labelRotate = XtCreateManagedWidget("rotate", labelWidgetClass,
+ dialog, NULL, 0);
cw = XtCreateManagedWidget("CW", toggleWidgetClass, dialog, NULL, 0);
XtAddCallback(cw, XtNcallback, RotateCallback, (XtPointer)CW);
ccw = XtVaCreateManagedWidget("CCW", toggleWidgetClass, dialog,
@@ -407,6 +483,34 @@ ScreenDialog(XF86SetupInfo *info)
XtRealizeWidget(dialog);
}
+#ifdef USE_MODULES
+ while (drv_opts) {
+ if (strcmp(drv_opts->name, screen->scrn_device->dev_driver) == 0) {
+ OptionInfoPtr opts = drv_opts->option;
+
+ while (opts->name) {
+ if (xf86nameCompare(opts->name, "Rotate") == 0) {
+ foundRotate = True;
+ break;
+ }
+ opts++;
+ }
+ break;
+ }
+ drv_opts = drv_opts->next;
+ }
+
+ if (!foundRotate) {
+ XtUnmapWidget(labelRotate);
+ XtUnmapWidget(cw);
+ XtUnmapWidget(ccw);
+ }
+ else {
+ XtMapWidget(labelRotate);
+ XtMapWidget(cw);
+ XtMapWidget(ccw);
+ }
+#endif
if (rotate == CW) {
XtVaSetValues(cw, XtNstate, True, NULL, 0);
XtVaSetValues(ccw, XtNstate, False, NULL, 0);
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c
index 36b8ce5cb..0876e89d9 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c,v 1.3 2000/06/13 23:15:52 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c,v 1.4 2000/10/20 14:59:07 alanh Exp $
*/
#include <X11/IntrinsicP.h>
@@ -74,31 +74,31 @@ CreateScreenWidget(xf86cfgScreen *screen)
*/
if (screen->monitor != NULL) {
options = ((XF86ConfMonitorPtr)(screen->monitor->config))->mon_option_lst;
- if ((option = xf86FindOption(options, Rotate)) != NULL) {
+ if ((option = xf86findOption(options, Rotate)) != NULL) {
if (option->opt_val != NULL)
rotate = strcasecmp(option->opt_val, _CW) == 0 ? CW :
strcasecmp(option->opt_val, _CCW) == 0 ? CCW : 0;
- xf86RemoveOption(&((XF86ConfMonitorPtr)(screen->monitor->config))
+ xf86removeOption(&((XF86ConfMonitorPtr)(screen->monitor->config))
->mon_option_lst, Rotate);
}
}
if (screen->card != NULL) {
options = ((XF86ConfDevicePtr)(screen->card->config))->dev_option_lst;
- if ((option = xf86FindOption(options, Rotate)) != NULL) {
+ if ((option = xf86findOption(options, Rotate)) != NULL) {
if (option->opt_val != NULL)
rotate += strcasecmp(option->opt_val, _CW) == 0 ? CW :
strcasecmp(option->opt_val, _CCW) == 0 ? CCW : 0;
- xf86RemoveOption(&((XF86ConfDevicePtr)(screen->card->config))
+ xf86removeOption(&((XF86ConfDevicePtr)(screen->card->config))
->dev_option_lst, Rotate);
}
}
options = screen->screen->scrn_option_lst;
- if ((option = xf86FindOption(options, Rotate)) != NULL) {
+ if ((option = xf86findOption(options, Rotate)) != NULL) {
if (option->opt_val != NULL)
rotate += strcasecmp(option->opt_val, _CW) == 0 ? CW :
strcasecmp(option->opt_val, _CCW) == 0 ? CCW : 0;
- xf86RemoveOption(&screen->screen->scrn_option_lst, Rotate);
+ xf86removeOption(&screen->screen->scrn_option_lst, Rotate);
}
rotate = rotate > 0 ? CW : rotate < 0 ? CCW : 0;
@@ -195,7 +195,7 @@ AddScreen(xf86cfgDevice *mon, xf86cfgDevice *dev)
++nscreens;
XmuSnprintf(screen_name, sizeof(screen_name), "Screen%d",
nscreens);
- } while (xf86FindScreen(screen_name,
+ } while (xf86findScreen(screen_name,
XF86Config->conf_screen_lst) != NULL);
screen = (XF86ConfScreenPtr)XtCalloc(1, sizeof(XF86ConfScreenRec));
@@ -205,7 +205,7 @@ AddScreen(xf86cfgDevice *mon, xf86cfgDevice *dev)
screen->scrn_monitor_str = XtNewString(((XF86ConfMonitorPtr)(mon->config))->mon_identifier);
screen->scrn_monitor = (XF86ConfMonitorPtr)(mon->config);
XF86Config->conf_screen_lst =
- xf86AddScreen(XF86Config->conf_screen_lst, screen);
+ xf86addScreen(XF86Config->conf_screen_lst, screen);
adj = (XF86ConfAdjacencyPtr)XtCalloc(1, sizeof(XF86ConfAdjacencyRec));
adj->adj_screen = screen;
@@ -214,7 +214,7 @@ AddScreen(xf86cfgDevice *mon, xf86cfgDevice *dev)
computer.layout = XF86Config->conf_layout_lst = (XF86ConfLayoutPtr)
XtCalloc(1, sizeof(XF86ConfLayoutRec));
computer.layout->lay_adjacency_lst = (XF86ConfAdjacencyPtr)
- addListItem((GenericListPtr)computer.layout->lay_adjacency_lst,
+ xf86addListItem((GenericListPtr)computer.layout->lay_adjacency_lst,
(GenericListPtr)adj);
computer.screens = (xf86cfgScreen**)
@@ -263,7 +263,7 @@ RemoveScreen(xf86cfgDevice *mon, xf86cfgDevice *dev)
}
}
- xf86RemoveScreen(XF86Config, screen);
+ xf86removeScreen(XF86Config, screen);
}
void
@@ -695,7 +695,7 @@ AdjustScreenUI(void)
XF86ConfScreenPtr s;
if (adj->adj_where >= CONF_ADJ_RIGHTOF < adj->adj_where <= CONF_ADJ_BELOW) {
- s = xf86FindScreen(adj->adj_refscreen, XF86Config->conf_screen_lst);
+ s = xf86findScreen(adj->adj_refscreen, XF86Config->conf_screen_lst);
for (i = 0; i < computer.num_screens; i++)
if (computer.screens[i]->screen == s)
break;
@@ -793,6 +793,9 @@ AdjustScreenUI(void)
for (i = 0; i < computer.num_screens; i++)
if (computer.screens[i]->state == USED1)
computer.screens[i]->state = USED;
+ else
+ XLowerWindow(XtDisplay(computer.screens[i]->widget),
+ XtWindow(computer.screens[i]->widget));
w = work->core.width / (columns + 1) - 5;
h = work->core.height / (rows + 1) - 5;
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c
index a7ddd3e27..e9dafe5cf 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c,v 1.1 2000/05/18 16:30:00 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c,v 1.3 2000/10/20 14:59:08 alanh Exp $
*/
/*
@@ -474,7 +474,6 @@ VideoModeInitialize(void)
rep = XtCreateManagedWidget("prev", commandWidgetClass, vtune, NULL, 0);
XtAddCallback(rep, XtNcallback, SwitchCallback, (XtPointer)-1);
mode = XtCreateManagedWidget("mode", menuButtonWidgetClass, vtune, NULL, 0);
- menu = XtCreatePopupShell("menu", simpleMenuWidgetClass, vtune, NULL, 0);
rep = XtCreateManagedWidget("next", commandWidgetClass, vtune, NULL, 0);
XtAddCallback(rep, XtNcallback, SwitchCallback, (XtPointer)1);
@@ -494,7 +493,8 @@ VideoModeInitialize(void)
XmuSnprintf(name, sizeof(name), "%s.%d", dispstr, i);
rep = XtCreateManagedWidget(name, smeBSBObjectClass, screenp,
NULL, 0);
- XtAddCallback(rep, XtNcallback, ChangeScreenCallback, (XtPointer)i);
+ XtAddCallback(rep, XtNcallback, ChangeScreenCallback,
+ (XtPointer)(long)i);
if (i == 0) {
screenb = XtVaCreateManagedWidget("screenB", menuButtonWidgetClass,
vtune,
@@ -504,8 +504,6 @@ VideoModeInitialize(void)
}
}
XtRealizeWidget(screenp);
- monitor = XtCreatePopupShell("monitorP", simpleMenuWidgetClass,
- vtune, NULL, 0);
rep = XtCreateManagedWidget("up", repeaterWidgetClass,
vtune, NULL, 0);
@@ -579,8 +577,8 @@ VideoModeInitialize(void)
add = XtCreateManagedWidget("add", commandWidgetClass, vtune, NULL, 0);
XtAddCallback(add, XtNcallback, AddModeCallback, NULL);
XtCreateManagedWidget("addto", labelWidgetClass, vtune, NULL, 0);
- monitorb = XtVaCreateManagedWidget("ident", menuButtonWidgetClass, vtune,
- XtNmenuName, "monitorP", NULL, 0);
+ monitorb = XtCreateManagedWidget("ident", menuButtonWidgetClass, vtune,
+ NULL, 0);
XtCreateManagedWidget("as", labelWidgetClass, vtune, NULL, 0);
text = XtVaCreateManagedWidget("text", asciiTextWidgetClass, vtune,
XtNeditType, XawtextEdit, NULL, 0);
@@ -601,10 +599,11 @@ VideoModeConfigureStart(void)
else
XtMapWidget(vtune);
if (vidtune != NULL) {
- int i;
Arg args[1];
Boolean state;
XF86ConfMonitorPtr mon;
+ static char menuName[16];
+ static int menuN;
XtErrorFunc = XSetErrorHandler(VidmodeError);
XF86VidModeLockModeSwitch(XtDisplay(toplevel), vidtune->screen, True);
@@ -617,8 +616,14 @@ VideoModeConfigureStart(void)
XtSetSensitive(apply, !state);
autoflag = state;
- for (i = 0; i < ((CompositeWidget)monitor)->composite.num_children; i++)
- XtDestroyWidget(((CompositeWidget)monitor)->composite.children[i]);
+ if (monitor)
+ XtDestroyWidget(monitor);
+ XmuSnprintf(menuName, sizeof(menuName), "menuP%d", menuN);
+ menuN = !menuN;
+ monitor = XtCreatePopupShell(menuName, simpleMenuWidgetClass,
+ vtune, NULL, 0);
+ XtVaSetValues(monitorb, XtNmenuName, menuName, NULL, 0);
+
mon = XF86Config->conf_monitor_lst;
while (mon != NULL) {
Widget sme = XtCreateManagedWidget(mon->mon_identifier,
@@ -782,7 +787,7 @@ AdjustMonitorCallback(Widget w, XtPointer client_data, XtPointer call_data)
{
if (repeater != w)
return;
- switch ((int)client_data) {
+ switch ((long)client_data) {
case LEFT:
if (modeline.hsyncend + 4 < modeline.htotal) {
modeline.hsyncstart += 4;
@@ -936,7 +941,7 @@ ApplyCallback(Widget w, XtPointer call_data, XtPointer client_data)
static void
AutoCallback(Widget w, XtPointer call_data, XtPointer client_data)
{
- autoflag = (Bool)client_data;
+ autoflag = (Bool)(long)client_data;
XtSetSensitive(apply, !autoflag);
}
@@ -970,7 +975,7 @@ SelectCallback(Widget w, XtPointer call_data, XtPointer client_data)
static void
SwitchCallback(Widget w, XtPointer call_data, XtPointer client_data)
{
- int direction = (int)call_data;
+ int direction = (long)call_data;
Arg args[1];
Bool result;
char label[32];
@@ -1021,7 +1026,7 @@ ChangeScreenCallback(Widget w, XtPointer call_data, XtPointer client_data)
{
Arg args[1];
- screenno = (int)call_data;
+ screenno = (long)call_data;
if (screenno > computer.num_vidmodes || screenno < 0 ||
vidtune == computer.vidmodes[screenno])
return;
@@ -1069,13 +1074,19 @@ GetModes(void)
int i;
char label[32];
Arg args[1];
+ static char menuName[16];
+ static int menuN;
XFree(vidtune->infos);
XF86VidModeGetAllModeLines(XtDisplay(toplevel), vidtune->screen,
&vidtune->num_infos, &vidtune->infos);
- for (i = 0; i < ((CompositeWidget)menu)->composite.num_children; i++)
- XtDestroyWidget(((CompositeWidget)menu)->composite.children[i]);
+ XmuSnprintf(menuName, sizeof(menuName), "menu%d", menuN);
+ menuN = !menuN;
+ if (menu)
+ XtDestroyWidget(menu);
+ menu = XtCreatePopupShell(menuName, simpleMenuWidgetClass, vtune, NULL, 0);
+ XtVaSetValues(mode, XtNmenuName, menuName, NULL, 0);
for (i = 0; i < vidtune->num_infos; i++) {
Widget sme;
@@ -1105,7 +1116,7 @@ PopdownForce(Widget w, XtPointer user_data, XtPointer call_data)
{
asking_force = 0;
XtPopdown(forceshell);
- do_force = (int)user_data;
+ do_force = (long)user_data;
}
void
@@ -1155,7 +1166,7 @@ AddModeCallback(Widget w, XtPointer call_data, XtPointer client_data)
XBell(XtDisplay(w), 80);
return;
}
- if (xf86FindModeLine(label, vidtune->monitor->mon_modeline_lst)
+ if (xf86findModeLine(label, vidtune->monitor->mon_modeline_lst)
!= NULL && !ForceAddMode())
return;
@@ -1174,7 +1185,7 @@ AddModeCallback(Widget w, XtPointer call_data, XtPointer client_data)
mode->ml_flags = modeline.flags;
mode->ml_hskew = modeline.hskew;
vidtune->monitor->mon_modeline_lst =
- xf86AddModeLine(vidtune->monitor->mon_modeline_lst, mode);
+ xf86addModeLine(vidtune->monitor->mon_modeline_lst, mode);
}
else
XBell(XtDisplay(w), 80);
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c
index 33c32019c..908568967 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c,v 1.2 2000/05/18 16:30:01 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c,v 1.3 2000/10/20 14:59:08 alanh Exp $
*/
#include "xf86config.h"
@@ -35,31 +35,7 @@
* Implementation
*/
int
-ErrorF(const char *fmt, ...)
-{
- int retval;
- va_list ap;
-
- Va_start(ap, fmt);
- retval = vfprintf(stderr, fmt, ap);
-
- va_end(ap);
-
- return (retval);
-}
-
-int
-VErrorF(const char *fmt, va_list ap)
-{
- int retval;
-
- retval = vfprintf(stderr, fmt, ap);
-
- return (retval);
-}
-
-int
-xf86RemoveOption(XF86OptionPtr *options, char *name)
+xf86removeOption(XF86OptionPtr *options, char *name)
{
XF86OptionPtr opt = *options, prev = opt;
@@ -85,7 +61,7 @@ xf86RemoveOption(XF86OptionPtr *options, char *name)
}
int
-xf86RemoveInput(XF86ConfigPtr config, XF86ConfInputPtr input)
+xf86removeInput(XF86ConfigPtr config, XF86ConfInputPtr input)
{
XF86ConfInputPtr prev, inp = config->conf_input_lst;
XF86ConfLayoutPtr lay = config->conf_layout_lst;
@@ -109,21 +85,21 @@ xf86RemoveInput(XF86ConfigPtr config, XF86ConfInputPtr input)
/* remove references */
while (lay != NULL) {
- xf86RemoveInputRef(lay, inp);
+ xf86removeInputRef(lay, inp);
lay = (XF86ConfLayoutPtr)(lay->list.next);
}
XtFree(inp->inp_identifier);
XtFree(inp->inp_driver);
XtFree(inp->inp_comment);
- xf86OptionListFree(inp->inp_option_lst);
+ xf86optionListFree(inp->inp_option_lst);
XtFree((XtPointer)inp);
return (True);
}
int
-xf86RemoveInputRef(XF86ConfLayoutPtr layout, XF86ConfInputPtr input)
+xf86removeInputRef(XF86ConfLayoutPtr layout, XF86ConfInputPtr input)
{
XF86ConfInputrefPtr prev, iref = layout->lay_input_lst;
@@ -131,7 +107,7 @@ xf86RemoveInputRef(XF86ConfLayoutPtr layout, XF86ConfInputPtr input)
while (iref != NULL) {
if (iref->iref_inputdev == input) {
XtFree(iref->iref_inputdev_str);
- xf86OptionListFree(iref->iref_option_lst);
+ xf86optionListFree(iref->iref_option_lst);
if (prev == iref)
layout->lay_input_lst =
(XF86ConfInputrefPtr)(iref->list.next);
@@ -149,7 +125,7 @@ xf86RemoveInputRef(XF86ConfLayoutPtr layout, XF86ConfInputPtr input)
}
int
-xf86RemoveDevice(XF86ConfigPtr config, XF86ConfDevicePtr device)
+xf86removeDevice(XF86ConfigPtr config, XF86ConfDevicePtr device)
{
XF86ConfDevicePtr prev, dev = config->conf_device_lst;
XF86ConfScreenPtr psc, scr = config->conf_screen_lst;
@@ -175,7 +151,7 @@ xf86RemoveDevice(XF86ConfigPtr config, XF86ConfDevicePtr device)
psc = scr;
while (scr != NULL) {
if (scr->scrn_device == device) {
- xf86RemoveScreen(config, scr);
+ xf86removeScreen(config, scr);
if (scr == psc)
scr = config->conf_screen_lst;
else
@@ -196,14 +172,14 @@ xf86RemoveDevice(XF86ConfigPtr config, XF86ConfDevicePtr device)
XtFree(dev->dev_ramdac);
XtFree(dev->dev_clockchip);
XtFree(dev->dev_comment);
- xf86OptionListFree(dev->dev_option_lst);
+ xf86optionListFree(dev->dev_option_lst);
XtFree((XtPointer)dev);
return (True);
}
int
-xf86RemoveMonitor(XF86ConfigPtr config, XF86ConfMonitorPtr monitor)
+xf86removeMonitor(XF86ConfigPtr config, XF86ConfMonitorPtr monitor)
{
XF86ConfMonitorPtr prev, mon = config->conf_monitor_lst;
XF86ConfScreenPtr psc, scr = config->conf_screen_lst;
@@ -229,7 +205,7 @@ xf86RemoveMonitor(XF86ConfigPtr config, XF86ConfMonitorPtr monitor)
psc = scr;
while (scr != NULL) {
if (scr->scrn_monitor == monitor) {
- xf86RemoveScreen(config, scr);
+ xf86removeScreen(config, scr);
if (scr == psc)
scr = config->conf_screen_lst;
else
@@ -244,14 +220,14 @@ xf86RemoveMonitor(XF86ConfigPtr config, XF86ConfMonitorPtr monitor)
XtFree(mon->mon_vendor);
XtFree(mon->mon_modelname);
XtFree(mon->mon_comment);
- xf86OptionListFree(mon->mon_option_lst);
+ xf86optionListFree(mon->mon_option_lst);
XtFree((XtPointer)mon);
return (True);
}
int
-xf86RemoveScreen(XF86ConfigPtr config, XF86ConfScreenPtr screen)
+xf86removeScreen(XF86ConfigPtr config, XF86ConfScreenPtr screen)
{
XF86ConfScreenPtr prev, scrn;
XF86ConfLayoutPtr lay;
@@ -338,14 +314,14 @@ xf86RemoveScreen(XF86ConfigPtr config, XF86ConfScreenPtr screen)
XtFree(screen->scrn_obso_driver);
XtFree(screen->scrn_monitor_str);
XtFree(screen->scrn_device_str);
- xf86OptionListFree(screen->scrn_option_lst);
+ xf86optionListFree(screen->scrn_option_lst);
XtFree((XtPointer)screen);
return (True);
}
int
-xf86RemoveAdjacency(XF86ConfLayoutPtr layout, XF86ConfAdjacencyPtr adjacency)
+xf86removeAdjacency(XF86ConfLayoutPtr layout, XF86ConfAdjacencyPtr adjacency)
{
XF86ConfAdjacencyPtr prev, adj = layout->lay_adjacency_lst;
@@ -378,7 +354,7 @@ xf86RemoveAdjacency(XF86ConfLayoutPtr layout, XF86ConfAdjacencyPtr adjacency)
}
int
-xf86RemoveInactive(XF86ConfLayoutPtr layout, XF86ConfInactivePtr inactive)
+xf86removeInactive(XF86ConfLayoutPtr layout, XF86ConfInactivePtr inactive)
{
XF86ConfInactivePtr prev, inac = layout->lay_inactive_lst;
@@ -406,7 +382,7 @@ xf86RemoveInactive(XF86ConfLayoutPtr layout, XF86ConfInactivePtr inactive)
}
int
-xf86RemoveLayout(XF86ConfigPtr config, XF86ConfLayoutPtr layout)
+xf86removeLayout(XF86ConfigPtr config, XF86ConfLayoutPtr layout)
{
XF86ConfLayoutPtr prev, lay = config->conf_layout_lst;
XF86ConfAdjacencyPtr adj, nadj;
@@ -430,25 +406,25 @@ xf86RemoveLayout(XF86ConfigPtr config, XF86ConfLayoutPtr layout)
adj = lay->lay_adjacency_lst;
while (adj != NULL) {
nadj = (XF86ConfAdjacencyPtr)(adj->list.next);
- xf86RemoveAdjacency(lay, adj);
+ xf86removeAdjacency(lay, adj);
adj = nadj;
}
inac = lay->lay_inactive_lst;
while (inac != NULL) {
ninac = (XF86ConfInactivePtr)(inac->list.next);
- xf86RemoveInactive(lay, inac);
+ xf86removeInactive(lay, inac);
inac = ninac;
}
iref = lay->lay_input_lst;
while (iref != NULL) {
niref = (XF86ConfInputrefPtr)(iref->list.next);
- xf86RemoveInputRef(lay, iref->iref_inputdev);
+ xf86removeInputRef(lay, iref->iref_inputdev);
iref = niref;
}
- xf86OptionListFree(lay->lay_option_lst);
+ xf86optionListFree(lay->lay_option_lst);
if (prev == lay)
config->conf_layout_lst = (XF86ConfLayoutPtr)(lay->list.next);
@@ -461,7 +437,7 @@ xf86RemoveLayout(XF86ConfigPtr config, XF86ConfLayoutPtr layout)
}
int
-xf86RenameInput(XF86ConfigPtr config, XF86ConfInputPtr input, char *name)
+xf86renameInput(XF86ConfigPtr config, XF86ConfInputPtr input, char *name)
{
XF86ConfLayoutPtr lay = config->conf_layout_lst;
@@ -488,7 +464,7 @@ xf86RenameInput(XF86ConfigPtr config, XF86ConfInputPtr input, char *name)
}
int
-xf86RenameDevice(XF86ConfigPtr config, XF86ConfDevicePtr dev, char *name)
+xf86renameDevice(XF86ConfigPtr config, XF86ConfDevicePtr dev, char *name)
{
XF86ConfScreenPtr scr = config->conf_screen_lst;
@@ -511,7 +487,7 @@ xf86RenameDevice(XF86ConfigPtr config, XF86ConfDevicePtr dev, char *name)
}
int
-xf86RenameMonitor(XF86ConfigPtr config, XF86ConfMonitorPtr mon, char *name)
+xf86renameMonitor(XF86ConfigPtr config, XF86ConfMonitorPtr mon, char *name)
{
XF86ConfScreenPtr scr = config->conf_screen_lst;
@@ -534,7 +510,7 @@ xf86RenameMonitor(XF86ConfigPtr config, XF86ConfMonitorPtr mon, char *name)
}
int
-xf86RenameLayout(XF86ConfigPtr config, XF86ConfLayoutPtr layout, char *name)
+xf86renameLayout(XF86ConfigPtr config, XF86ConfLayoutPtr layout, char *name)
{
if (config == NULL || layout == NULL || name == NULL || *name == '\0')
return (False);
@@ -546,7 +522,7 @@ xf86RenameLayout(XF86ConfigPtr config, XF86ConfLayoutPtr layout, char *name)
}
int
-xf86RenameScreen(XF86ConfigPtr config, XF86ConfScreenPtr scrn, char *name)
+xf86renameScreen(XF86ConfigPtr config, XF86ConfScreenPtr scrn, char *name)
{
XF86ConfLayoutPtr lay = config->conf_layout_lst;
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.h b/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.h
index ee8747246..4392a53db 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.h
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.h
@@ -26,44 +26,44 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.h,v 1.2 2000/05/18 16:30:01 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.h,v 1.3 2000/10/20 14:59:08 alanh Exp $
*/
#include "config.h"
-#define xf86OptionListFree OptionListFree
-#define xf86AddInput(head, ptr) \
- (XF86ConfInputPtr)addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
-#define xf86AddInputref(head, ptr) \
- (XF86ConfInputrefPtr)addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
-#define xf86AddDevice(head, ptr) \
- (XF86ConfDevicePtr)addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
-#define xf86AddMonitor(head, ptr) \
- (XF86ConfMonitorPtr)addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
-#define xf86AddScreen(head, ptr) \
- (XF86ConfScreenPtr)addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
-#define xf86AddLayout(head, ptr) \
- (XF86ConfLayoutPtr)addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
-#define xf86AddModeLine(head, ptr) \
- (XF86ConfModeLinePtr)addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
-#define xf86NewOption NewOption
-#define xf86addNewOption addNewOption
-#define xf86FindOption FindOption
+#ifndef _xf86cfg_xf86config_h
+#define _xf86cfg_xf86config_h
-int ErrorF(const char*, ...);
-int VErrorF(const char*, va_list);
-int xf86RemoveOption(XF86OptionPtr*, char*);
-int xf86RemoveInput(XF86ConfigPtr, XF86ConfInputPtr);
-int xf86RemoveInputRef(XF86ConfLayoutPtr, XF86ConfInputPtr);
-int xf86RemoveDevice(XF86ConfigPtr, XF86ConfDevicePtr);
-int xf86RemoveMonitor(XF86ConfigPtr, XF86ConfMonitorPtr);
-int xf86RemoveScreen(XF86ConfigPtr, XF86ConfScreenPtr);
-int xf86RemoveAdjacency(XF86ConfLayoutPtr, XF86ConfAdjacencyPtr);
-int xf86RemoveInactive(XF86ConfLayoutPtr, XF86ConfInactivePtr);
-int xf86RemoveLayout(XF86ConfigPtr, XF86ConfLayoutPtr);
+#define xf86addInput(head, ptr) \
+ (XF86ConfInputPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+#define xf86addInputref(head, ptr) \
+ (XF86ConfInputrefPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+#define xf86addDevice(head, ptr) \
+ (XF86ConfDevicePtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+#define xf86addMonitor(head, ptr) \
+ (XF86ConfMonitorPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+#define xf86addScreen(head, ptr) \
+ (XF86ConfScreenPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+#define xf86addLayout(head, ptr) \
+ (XF86ConfLayoutPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+#define xf86addModeLine(head, ptr) \
+ (XF86ConfModeLinePtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
+
+int xf86removeOption(XF86OptionPtr*, char*);
+int xf86removeInput(XF86ConfigPtr, XF86ConfInputPtr);
+int xf86removeInputRef(XF86ConfLayoutPtr, XF86ConfInputPtr);
+int xf86removeDevice(XF86ConfigPtr, XF86ConfDevicePtr);
+int xf86removeMonitor(XF86ConfigPtr, XF86ConfMonitorPtr);
+int xf86removeScreen(XF86ConfigPtr, XF86ConfScreenPtr);
+int xf86removeAdjacency(XF86ConfLayoutPtr, XF86ConfAdjacencyPtr);
+int xf86removeInactive(XF86ConfLayoutPtr, XF86ConfInactivePtr);
+int xf86removeLayout(XF86ConfigPtr, XF86ConfLayoutPtr);
+
+int xf86renameInput(XF86ConfigPtr, XF86ConfInputPtr, char*);
+int xf86renameDevice(XF86ConfigPtr, XF86ConfDevicePtr, char*);
+int xf86renameMonitor(XF86ConfigPtr, XF86ConfMonitorPtr, char*);
+int xf86renameLayout(XF86ConfigPtr, XF86ConfLayoutPtr, char*);
+int xf86renameScreen(XF86ConfigPtr, XF86ConfScreenPtr, char*);
+
+#endif /* _xf86cfg_xf86config_h */
-int xf86RenameInput(XF86ConfigPtr, XF86ConfInputPtr, char*);
-int xf86RenameDevice(XF86ConfigPtr, XF86ConfDevicePtr, char*);
-int xf86RenameMonitor(XF86ConfigPtr, XF86ConfMonitorPtr, char*);
-int xf86RenameLayout(XF86ConfigPtr, XF86ConfLayoutPtr, char*);
-int xf86RenameScreen(XF86ConfigPtr, XF86ConfScreenPtr, char*);