Commit cbc0b022 authored by idr's avatar idr
Browse files

Merge changes from DRI trunk.

Obtained from: DRI trunk
parent 12f89c73
......@@ -32,14 +32,6 @@ XKBUILIBDIR = xkbui
THRSTUBLIBDIR = XThrStub
#endif
#if BuildXIElib
XIELIBDIR = XIE
#endif
#if BuildPexLib
PEX5LIBDIR = PEX5
#endif
#if BuildXInputLib
XINPUTLIBDIR = Xi
#endif
......@@ -204,8 +196,8 @@ LINTSUBDIRS = $(XAULIBDIR) $(XDMCPLIBDIR) $(THRSTUBLIBDIR) $(X11LIBDIR) \
$(OLDXLIBDIR) $(ICELIBDIR) $(SMLIBDIR) $(XEXTLIBDIR) $(XTLIBDIR) \
$(SSLIBDIR) $(XF86MISCLIBDIR) $(XF86VMLIBDIR) $(XF86DGALIBDIR) \
$(XF86RUSHLIBDIR) $(XMULIBDIR) $(XMUULIBDIR) $(XPMLIBDIR) \
$(XAW6LIBDIR) $(XAWLIBDIR) $(XIELIBDIR) $(XINPUTLIBDIR) \
$(XTSTLIBDIR) $(FSLIBDIR) $(PEX5LIBDIR) $(XKBLIBDIR) \
$(XAW6LIBDIR) $(XAWLIBDIR) $(XINPUTLIBDIR) \
$(XTSTLIBDIR) $(FSLIBDIR) $(XKBLIBDIR) \
$(XKBUILIBDIR) $(LBXUTILDIR) $(XALIBDIR) $(XPRINTLIBDIR) \
$(XVLIBDIR) $(GLXLIBDIR) $(GLULIBDIR) $(GLWLIBDIR) \
$(DPSLIBDIR) $(DPSTKLIBDIR) $(PSRESLIBDIR) $(XINERAMADIR) \
......
......@@ -25,7 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/* $XFree86: xc/lib/font/fontfile/dirfile.c,v 3.15 2002/05/31 18:45:50 dawes Exp $ */
/* $XFree86: xc/lib/font/fontfile/dirfile.c,v 3.16 2003/04/07 16:23:31 eich Exp $ */
/*
* Author: Keith Packard, MIT X Consortium
......@@ -68,6 +68,9 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir)
FontDirectoryPtr dir = NullFontDirectory;
if (strlen(directory) + 1 + sizeof(FontDirFile) > sizeof(dir_file))
return BadFontPath;
#ifdef FONTDIRATTRIB
/* Check for font directory attributes */
#ifndef __UNIXOS2__
......@@ -90,6 +93,8 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir)
strcat(dir_file, FontDirFile);
file = fopen(dir_file, "r");
if (file) {
Bool found_font = FALSE;
if (fstat (fileno(file), &statb) == -1)
return BadFontPath;
count = fscanf(file, "%d\n", &i);
......@@ -106,6 +111,7 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir)
if (format[0] == '\0')
sprintf(format, "%%%ds %%%d[^\n]\n",
MAXFONTFILENAMELEN-1, MAXFONTNAMELEN-1);
while ((count = fscanf(file, format, file_name, font_name)) != EOF) {
#ifdef __UNIXOS2__
/* strip any existing trailing CR */
......@@ -118,14 +124,16 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir)
fclose(file);
return BadFontPath;
}
if (!FontFileAddFontFile (dir, font_name, file_name))
{
FontFileFreeDir (dir);
fclose(file);
return BadFontPath;
}
if (FontFileAddFontFile (dir, font_name, file_name))
found_font = TRUE;
}
if (!found_font) {
FontFileFreeDir (dir);
fclose(file);
return BadFontPath;
}
fclose(file);
} else if (errno != ENOENT) {
return BadFontPath;
}
......@@ -154,6 +162,9 @@ FontFileDirectoryChanged(FontDirectoryPtr dir)
char dir_file[MAXFONTFILENAMELEN];
struct stat statb;
if (strlen(dir->directory) + sizeof(FontDirFile) > sizeof(dir_file))
return FALSE;
strcpy (dir_file, dir->directory);
strcat (dir_file, FontDirFile);
if (stat (dir_file, &statb) == -1)
......@@ -202,6 +213,8 @@ AddFileNameAliases(FontDirectoryPtr dir)
continue;
len = strlen (fileName) - renderer->fileSuffixLen;
if (len >= sizeof(copy))
continue;
CopyISOLatin1Lowered (copy, fileName, len);
copy[len] = '\0';
name.name = copy;
......@@ -251,9 +264,13 @@ ReadFontAlias(char *directory, Bool isFile, FontDirectoryPtr *pdir)
int status = Successful;
struct stat statb;
if (strlen(directory) >= sizeof(alias_file))
return BadFontPath;
dir = *pdir;
strcpy(alias_file, directory);
if (!isFile) {
if (strlen(directory) + 1 + sizeof(FontAliasFile) > sizeof(alias_file))
return BadFontPath;
if (directory[strlen(directory) - 1] != '/')
strcat(alias_file, "/");
strcat(alias_file, FontAliasFile);
......@@ -286,6 +303,10 @@ ReadFontAlias(char *directory, Bool isFile, FontDirectoryPtr *pdir)
status = AllocError;
break;
case NAME:
if (strlen(lexToken) >= sizeof(alias)) {
status = BadFontPath;
break;
}
strcpy(alias, lexToken);
token = lexAlias(file, &lexToken);
switch (token) {
......@@ -302,6 +323,10 @@ ReadFontAlias(char *directory, Bool isFile, FontDirectoryPtr *pdir)
status = AllocError;
break;
case NAME:
if (strlen(lexToken) >= sizeof(font_name)) {
status = BadFontPath;
break;
}
CopyISOLatin1Lowered(alias, alias, strlen(alias));
CopyISOLatin1Lowered(font_name, lexToken, strlen(lexToken));
if (!FontFileAddFontAlias (dir, alias, font_name))
......
......@@ -833,6 +833,7 @@ FontEncReallyReallyLoad(const char *charset,
char file_name[MAXFONTFILENAMELEN], encoding_name[MAXFONTNAMELEN],
buf[MAXFONTFILENAMELEN];
int count, n;
static char format[24] = "";
/* As we don't really expect to open encodings that often, we don't
take the trouble of caching encodings directories. */
......@@ -848,8 +849,12 @@ FontEncReallyReallyLoad(const char *charset,
}
encoding = NULL;
if (!format[0]) {
sprintf(format, "%%%ds %%%d[^\n]\n", sizeof(encoding_name) - 1,
sizeof(file_name) - 1);
}
for(;;) {
count = fscanf(file, "%s %[^\n]\n", encoding_name, file_name);
count = fscanf(file, format, encoding_name, file_name);
if(count == EOF)
break;
if(count != 2)
......
......@@ -25,7 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
/* $XFree86: xc/lib/font/fontfile/fontfile.c,v 3.16 2002/05/31 18:45:50 dawes Exp $ */
/* $XFree86: xc/lib/font/fontfile/fontfile.c,v 3.18 2003/07/07 16:40:11 eich Exp $ */
/*
* Author: Keith Packard, MIT X Consortium
......@@ -424,11 +424,16 @@ FontFileOpenFont (pointer client, FontPathElementPtr fpe, Mask flags,
vals.ranges = ranges;
vals.nranges = nranges;
strcpy (fileName, dir->directory);
strcat (fileName, scalable->fileName);
ret = (*scalable->renderer->OpenScalable) (fpe, pFont,
if (strlen(dir->directory) + strlen(scalable->fileName) >=
sizeof(fileName)) {
ret = BadFontName;
} else {
strcpy (fileName, dir->directory);
strcat (fileName, scalable->fileName);
ret = (*scalable->renderer->OpenScalable) (fpe, pFont,
flags, entry, fileName, &vals, format, fmask,
non_cachable_font);
}
/* In case rasterizer does something bad because of
charset subsetting... */
......@@ -497,6 +502,8 @@ FontFileOpenBitmapNCF (FontPathElementPtr fpe, FontPtr *pFont,
dir = (FontDirectoryPtr) fpe->private;
bitmap = &entry->u.bitmap;
if(!bitmap || !bitmap->renderer->OpenBitmap)
return BadFontName;
strcpy (fileName, dir->directory);
strcat (fileName, bitmap->fileName);
ret = (*bitmap->renderer->OpenBitmap)
......@@ -530,6 +537,10 @@ FontFileGetInfoBitmap (FontPathElementPtr fpe, FontInfoPtr pFontInfo,
dir = (FontDirectoryPtr) fpe->private;
bitmap = &entry->u.bitmap;
if (strlen(dir->directory) + strlen(bitmap->fileName) >= sizeof(fileName))
return BadFontName;
if (strlen(dir->directory) + strlen(bitmap->fileName) >= sizeof(fileName))
return BadFontName;
strcpy (fileName, dir->directory);
strcat (fileName, bitmap->fileName);
ret = (*bitmap->renderer->GetInfoBitmap) (fpe, pFontInfo, entry, fileName);
......@@ -891,10 +902,15 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe,
vals.ranges = FontParseRanges(origName, &vals.nranges);
ranges = vals.ranges;
/* Make a new scaled instance */
strcpy (fileName, dir->directory);
strcat (fileName, scalable->fileName);
ret = (*scalable->renderer->GetInfoScalable)
(fpe, *pFontInfo, entry, &tmpName, fileName, &vals);
if (strlen(dir->directory) + strlen(scalable->fileName) >=
sizeof(fileName)) {
ret = BadFontName;
} else {
strcpy (fileName, dir->directory);
strcat (fileName, scalable->fileName);
ret = (*scalable->renderer->GetInfoScalable)
(fpe, *pFontInfo, entry, &tmpName, fileName, &vals);
}
if (ranges) xfree(ranges);
}
}
......@@ -931,10 +947,15 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe,
bc = &entry->u.bc;
entry = bc->entry;
/* Make a new scaled instance */
strcpy (fileName, dir->directory);
strcat (fileName, scalable->fileName);
ret = (*scalable->renderer->GetInfoScalable)
if (strlen(dir->directory) + strlen(scalable->fileName) >=
sizeof(fileName)) {
ret = BadFontName;
} else {
strcpy (fileName, dir->directory);
strcat (fileName, scalable->fileName);
ret = (*scalable->renderer->GetInfoScalable)
(fpe, *pFontInfo, entry, tmpName, fileName, &bc->vals);
}
break;
#endif
default:
......@@ -1048,26 +1069,22 @@ FontFileListNextFontOrAlias(pointer client, FontPathElementPtr fpe,
return ret;
}
typedef int (*IntFunc) (void);
static int font_file_type;
void
FontFileRegisterLocalFpeFunctions (void)
{
font_file_type = RegisterFPEFunctions(FontFileNameCheck,
FontFileInitFPE,
FontFileFreeFPE,
FontFileResetFPE,
FontFileOpenFont,
FontFileCloseFont,
FontFileListFonts,
FontFileStartListFontsWithInfo,
FontFileListNextFontWithInfo,
NULL,
NULL,
NULL,
FontFileStartListFontsAndAliases,
FontFileListNextFontOrAlias,
FontFileEmptyBitmapSource);
RegisterFPEFunctions(FontFileNameCheck,
FontFileInitFPE,
FontFileFreeFPE,
FontFileResetFPE,
FontFileOpenFont,
FontFileCloseFont,
FontFileListFonts,
FontFileStartListFontsWithInfo,
FontFileListNextFontWithInfo,
NULL,
NULL,
NULL,
FontFileStartListFontsAndAliases,
FontFileListNextFontOrAlias,
FontFileEmptyBitmapSource);
}
XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile,v 1.8 2003/02/17 17:06:44 dawes Exp $
/*
* Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
* Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
*
* Copyright 1995-1998 The XFree86 Project, Inc.
* 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, 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
* VIA, S3 GRAPHICS, AND/OR ITS 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.
*/
#define IHaveModules
#include <Server.tmpl>
#if BuildXF86DRI
DRISRCS = savage_dri.c
DRIOBJS = savage_dri.o
DRIINCLUDES = -I$(SERVERSRC)/GL/dri -I$(LIBSRC)/GL/dri \
-I$(XF86OSSRC)/linux/drm/kernel -I$(TOP)/include
DRIDEFINES = $(GLX_DEFINES)
#endif
SRCS = savage_driver.c \
savage_accel.c \
savage_cursor.c \
......@@ -16,7 +41,9 @@ SRCS = savage_driver.c \
savage_image.c \
savage_shadow.c \
savage_vbe.c \
savage_video.c
savage_video.c \
savage_hwmc.c \
$(DRISRCS)
OBJS = savage_driver.o \
savage_accel.o \
......@@ -26,9 +53,11 @@ OBJS = savage_driver.o \
savage_image.o \
savage_shadow.o \
savage_vbe.o \
savage_video.o
savage_video.o \
savage_hwmc.o \
$(DRIOBJS)
DEFINES = -DPSZ=8
DEFINES = -DPSZ=8 $(DRIDEFINES)
#if defined(XF86DriverSDK)
INCLUDES = -I. -I../../include
......@@ -42,7 +71,7 @@ INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \
-I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \
-I$(XF86SRC)/rac -I$(XF86SRC)/int10 -I$(SERVERSRC)/render \
-I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(FONTINCSRC) \
-I$(EXTINCSRC) -I$(XF86SRC)/vbe -I$(XF86SRC)/shadowfb
-I$(EXTINCSRC) -I$(XF86SRC)/vbe -I$(XF86SRC)/shadowfb $(DRIINCLUDES)
#endif
#if MakeHasPosixVariableSubstitutions
......@@ -69,6 +98,8 @@ InstallDriverSDKNonExecFile(savage_cursor.c,$(DRIVERSDKDIR)/drivers/savage)
InstallDriverSDKNonExecFile(savage_dga.c,$(DRIVERSDKDIR)/drivers/savage)
InstallDriverSDKNonExecFile(savage_driver.c,$(DRIVERSDKDIR)/drivers/savage)
InstallDriverSDKNonExecFile(savage_driver.h,$(DRIVERSDKDIR)/drivers/savage)
InstallDriverSDKNonExecFile(savage_dri.c,$(DRIVERSDKDIR)/drivers/i810)
InstallDriverSDKNonExecFile(savage_dri.h,$(DRIVERSDKDIR)/drivers/i810)
InstallDriverSDKNonExecFile(savage_i2c.c,$(DRIVERSDKDIR)/drivers/savage)
InstallDriverSDKNonExecFile(savage_image.c,$(DRIVERSDKDIR)/drivers/savage)
InstallDriverSDKNonExecFile(savage_regs.h,$(DRIVERSDKDIR)/drivers/savage)
......@@ -76,5 +107,7 @@ InstallDriverSDKNonExecFile(savage_shadow.c,$(DRIVERSDKDIR)/drivers/savage)
InstallDriverSDKNonExecFile(savage_vbe.c,$(DRIVERSDKDIR)/drivers/savage)
InstallDriverSDKNonExecFile(savage_vbe.h,$(DRIVERSDKDIR)/drivers/savage)
InstallDriverSDKNonExecFile(savage_video.c,$(DRIVERSDKDIR)/drivers/savage)
InstallDriverSDKNonExecFile(savage_hwmc.c,$(DRIVERSDKDIR)/drivers/savage)
InstallDriverSDKNonExecFile(savage.cpp,$(DRIVERSDKDIR)/drivers/savage)
InstallDriverSDKObjectModule(savage,$(DRIVERSDKMODULEDIR),drivers)
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h,v 1.4 2002/10/02 20:39:54 alanh Exp $ */
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h,v 1.2 2001/10/01 13:44:09 eich Exp $ */
#ifndef _S3BCI_H_
#define _S3BCI_H_
/* BCI Control Register */
#define S3_BCI_CONTROL 0x816C
/*
* High 8 bit of primary bitmap descriptor 2 register.
* Bits 25-24: Tile Format 00 = Linear ; 10 = 16 bits; 11 = 32 bits (Savage4)
* 00 = Linear ; 01 = Tile; 10 = Texture tiling format/ Destination Tiling format
* 11 = Reserved/Destination tiling format.
*/
#define TILE_LINEAR 0
#define TILE_FORMAT_LINEAR 0
#define TILE_TEXTURE 2
#define TILE_DESTINATION 1
#define TILE_FORMAT_DESTINATION16 2
#define TILE_FORMAT_DESTINATION32 3
/* BD - BCI enable */
/* savage4, MX, IX, 3D */
#define BCI_ENABLE 8
/* twister, prosavage */
/* not sure which one supersavage fits into */
#define BCI_ENABLE_TWISTER 0
#define S3_BIG_ENDIAN 4
#define S3_LITTLE_ENDIAN 0
#define S3_BD64 1
/* Global Bitmap Descriptor */
#define S3_BCI_GLB_BD_LOW 0x8168
#define S3_BCI_GLB_BD_HIGH 0x816C
#define REVERSE_BYTE_ORDER32(dword) {\
unsigned int temp; \
dword = (temp & 0xFF) << 24; \
......@@ -71,7 +108,7 @@
#define BCI_BD_TILE_MASK 0x03000000
#define BCI_BD_TILE_NONE 0x00000000
#define BCI_BD_TILE_16 0x02000000
#define BCI_BD_TILE_32 0x04000000
#define BCI_BD_TILE_32 0x03000000
#define BCI_BD_GET_BPP(bd) (((bd) >> 16) & 0xFF)
#define BCI_BD_SET_BPP(bd, bpp) ((bd) |= (((bpp) & 0xFF) << 16))
#define BCI_BD_GET_STRIDE(bd) ((bd) & 0xFFFF)
......
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c,v 1.9 2003/01/18 15:22:29 eich Exp $ */
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c,v 1.6 2001/11/02 16:24:51 alanh Exp $ */
/*
* Hardware cursor support for S3 Savage 4.0 driver. Taken with
......@@ -24,7 +24,9 @@ static void SavageSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg);
#define outCRReg(reg, val) (VGAHWPTR(pScrn))->writeCrtc( VGAHWPTR(pScrn), reg, val )
#define inSRReg(reg) (VGAHWPTR(pScrn))->readSeq( VGAHWPTR(pScrn), reg )
#define outSRReg(reg, val) (VGAHWPTR(pScrn))->writeSeq( VGAHWPTR(pScrn), reg, val )
#if 0
#define inStatus1() (VGAHWPTR(pScrn))->readST01( VGAHWPTR(pScrn) )
#endif
/*
* certain HW cursor operations seem
......@@ -39,27 +41,6 @@ static void SavageSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg);
}
#define MAX_CURS 64
/*
* Disable HW Cursor on stretched LCDs. We don't know how to
* detect if display is stretched. Therefore we cannot rescale
* the HW cursor position.
*/
static Bool
SavageUseHWCursor(ScreenPtr pScr, CursorPtr pCurs)
{
ScrnInfoPtr pScrn = xf86Screens[pScr->myNum];
SavagePtr psav = SAVPTR(pScrn);
if (psav->PanelX != pScrn->currentMode->HDisplay
|| psav->PanelY != pScrn->currentMode->VDisplay) {
/* BIT 1 : CRT is active, BIT 2 : LCD is active */
unsigned char cr6d = inCRReg( 0x6d );
if (cr6d & 0x02)
return FALSE;
}
return TRUE;
}
Bool
SavageHWCursorInit(ScreenPtr pScreen)
......@@ -101,12 +82,8 @@ SavageHWCursorInit(ScreenPtr pScreen)
infoPtr->LoadCursorImage = SavageLoadCursorImage;
infoPtr->HideCursor = SavageHideCursor;
infoPtr->ShowCursor = SavageShowCursor;
infoPtr->UseHWCursor = NULL;
if ((S3_SAVAGE_MOBILE_SERIES(psav->Chipset)
|| (psav->Chipset == S3_PROSAVAGE)) && !psav->CrtOnly)
infoPtr->UseHWCursor = SavageUseHWCursor;
else
infoPtr->UseHWCursor = NULL;
if( !psav->CursorKByte )
psav->CursorKByte = pScrn->videoRam - 4;
......@@ -118,9 +95,8 @@ SavageHWCursorInit(ScreenPtr pScreen)
void
SavageShowCursor(ScrnInfoPtr pScrn)
{
/* Turn cursor on. */
/* Turn cursor on. */
outCRReg( 0x45, inCRReg(0x45) | 0x01 );
SAVPTR(pScrn)->hwc_on = TRUE;
}
......@@ -128,12 +104,12 @@ void
SavageHideCursor(ScrnInfoPtr pScrn)
{
/* Turn cursor off. */
if( S3_SAVAGE4_SERIES( SAVPTR(pScrn)->Chipset ) )
{
waitHSync(5);
}
outCRReg( 0x45, inCRReg(0x45) & 0xfe );
SAVPTR(pScrn)->hwc_on = FALSE;
}
static void
......
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c,v 1.6 2003/01/18 15:22:29 eich Exp $ */
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c,v 1.3 2001/05/18 23:35:32 dawes Exp $ */
/*
Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
......@@ -275,7 +275,7 @@ Savage_SetMode(
psav->DGAactive = FALSE;
SavageSwitchMode(index, pScrn->currentMode, 0);
if( psav->hwcursor && psav->hwc_on )
if( psav->hwcursor )
SavageShowCursor(pScrn);
} else {
Bool holdBIOS = psav->UseBIOS;
......@@ -289,11 +289,8 @@ Savage_SetMode(
pMode->bitsPerPixel, pMode->depth);
#endif
if( psav->hwcursor && psav->hwc_on) {
if( psav->hwcursor )
SavageHideCursor(pScrn);
psav->hwc_on = TRUE; /* save for later restauration */
}
if(!psav->DGAactive) { /* save the old parameters */
OldDisplayWidth[index] = pScrn->displayWidth;
......
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h,v 1.16 2003/01/18 15:22:30 eich Exp $ */
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h,v 1.11 2001/08/09 19:14:13 dawes Exp $ */
#ifndef SAVAGE_VGAHWMMIO_H
#define SAVAGE_VGAHWMMIO_H
......@@ -21,6 +21,30 @@
#include "xf86xv.h"
#include "savage_regs.h"
#include "savage_vbe.h"
#ifdef XF86DRI
#define _XF86DRI_SERVER_
#include "savage_dripriv.h"
#include "savage_dri.h"
#include "savage_drm.h"
#include "dri.h"
#include "GL/glxint.h"
#endif
#ifndef uint
typedef unsigned int uint;
#endif
#ifndef ulong
typedef unsigned long ulong;
#endif
#ifndef ushort
typedef unsigned short ushort;
#endif
#ifndef uchar
typedef unsigned char uchar;
#endif
#define VGAIN8(addr) MMIO_IN8(psav->MapBase+0x8000, addr)
#define VGAIN16(addr) MMIO_IN16(psav->MapBase+0x8000, addr)
......@@ -30,10 +54,26 @@
#define VGAOUT16(addr,val) MMIO_OUT16(psav->MapBase+0x8000, addr, val)
#define VGAOUT(addr,val) MMIO_OUT32(psav->MapBase+0x8000, addr, val)
#define INREG(addr) MMIO_IN32(psav->MapBase, addr)
#define OUTREG(addr,val) MMIO_OUT32(psav->MapBase, addr, val)
#define INREG8(addr) MMIO_IN8(psav->MapBase, addr)
#define INREG16(addr) MMIO_IN16(psav->MapBase, addr)
#define INREG32(addr) MMIO_IN32(psav->MapBase, addr)
#define OUTREG8(addr,val) MMIO_OUT8(psav->MapBase, addr, val)
#define OUTREG16(addr,val) MMIO_OUT16(psav->MapBase, addr, val)
#define OUTREG32(addr,val) MMIO_OUT32(psav->MapBase, addr, val)
#define INREG(addr) INREG32(addr)
#define OUTREG(addr,val) OUTREG32(addr,val)
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
#define B_O16(x) (x)
#define B_O32(x) (x)
#else
#define B_O16(x) ((((x) & 0xff) << 8) | (((x) & 0xff) >> 8))
#define B_O32(x) ((((x) & 0xff) << 24) | (((x) & 0xff00) << 8) \
| (((x) & 0xff0000) >> 8) | (((x) & 0xff000000) >> 24))
#endif
#define L_ADD(x) (B_O32(x) & 0xffff) + ((B_O32(x) >> 12) & 0xffff00)
#define SAVAGEIOMAPSIZE 0x80000
#define SAVAGE_CRT_ON 1
#define SAVAGE_LCD_ON 2
......@@ -70,6 +110,47 @@ typedef struct {
unsigned int MMPR0, MMPR1, MMPR2, MMPR3;
} SavageRegRec, *SavageRegPtr;
/* Tiling defines */
#define TILE_SIZE_BYTE 2048 /* 0x800, 2K */
#define TILEHEIGHT_16BPP 16
#define TILEHEIGHT_32BPP 16
#define TILEHEIGHT 16 /* all 16 and 32bpp tiles are 16 lines high */