diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2012-05-06 16:01:14 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2012-05-06 16:01:14 +0000 |
commit | d3de76d2381656ccb405336a3383e0a2ce1dd6f0 (patch) | |
tree | 5cd165176426b502ffa1055cbea2745d7a7b84f8 /driver/xf86-video-savage/src | |
parent | 5bb827c38bdc7c11019e98b8e161accbd98ee34f (diff) |
Update to xf86-video-savage 2.3.4
Diffstat (limited to 'driver/xf86-video-savage/src')
23 files changed, 429 insertions, 421 deletions
diff --git a/driver/xf86-video-savage/src/Makefile.am b/driver/xf86-video-savage/src/Makefile.am index 8ae805117..e980c1a6a 100644 --- a/driver/xf86-video-savage/src/Makefile.am +++ b/driver/xf86-video-savage/src/Makefile.am @@ -40,6 +40,7 @@ savage_drv_la_SOURCES = \ savage_driver.h \ savage_drm.h \ savage_i2c.c \ + savage_pciids.h \ savage_regs.h \ savage_sarea.h \ savage_shadow.c \ diff --git a/driver/xf86-video-savage/src/Makefile.in b/driver/xf86-video-savage/src/Makefile.in index 0ef5bb79d..6925977f5 100644 --- a/driver/xf86-video-savage/src/Makefile.in +++ b/driver/xf86-video-savage/src/Makefile.in @@ -43,9 +43,9 @@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c +install_sh_DATA = ${SHELL} $(install_sh) -c -m 644 +install_sh_PROGRAM = ${SHELL} $(install_sh) -c +install_sh_SCRIPT = ${SHELL} $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : @@ -84,10 +84,10 @@ savage_drv_la_LIBADD = am__savage_drv_la_SOURCES_DIST = savage_accel.c savage_xaa.c \ savage_exa.c savage_bci.h savage_common.h savage_cursor.c \ savage_dga.c savage_driver.c savage_driver.h savage_drm.h \ - savage_i2c.c savage_regs.h savage_sarea.h savage_shadow.c \ - savage_streams.c savage_streams.h savage_vbe.c savage_vbe.h \ - savage_video.c savage_hwmc.c savage_dri.c savage_dri.h \ - savage_dripriv.h + savage_i2c.c savage_pciids.h savage_regs.h savage_sarea.h \ + savage_shadow.c savage_streams.c savage_streams.h savage_vbe.c \ + savage_vbe.h savage_video.c savage_hwmc.c savage_dri.c \ + savage_dri.h savage_dripriv.h @DRI_TRUE@am__objects_1 = savage_hwmc.lo savage_dri.lo am_savage_drv_la_OBJECTS = savage_accel.lo savage_xaa.lo savage_exa.lo \ savage_cursor.lo savage_dga.lo savage_driver.lo savage_i2c.lo \ @@ -124,6 +124,7 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BASE_CFLAGS = @BASE_CFLAGS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ @@ -131,13 +132,10 @@ CHANGELOG_CMD = @CHANGELOG_CMD@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CWARNFLAGS = @CWARNFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ DRIVER_NAME = @DRIVER_NAME@ @@ -146,14 +144,13 @@ DRI_FALSE = @DRI_FALSE@ DRI_LIBS = @DRI_LIBS@ DRI_TRUE = @DRI_TRUE@ DSYMUTIL = @DSYMUTIL@ -ECHO = @ECHO@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ FILE_MAN_DIR = @FILE_MAN_DIR@ FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ GREP = @GREP@ @@ -164,23 +161,30 @@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MAN_SUBSTS = @MAN_SUBSTS@ MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ +NM = @NM@ NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -195,6 +199,7 @@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +STRICT_CFLAGS = @STRICT_CFLAGS@ STRIP = @STRIP@ VERSION = @VERSION@ XEXT_CFLAGS = @XEXT_CFLAGS@ @@ -204,13 +209,11 @@ XORG_LIBS = @XORG_LIBS@ XORG_MAN_PAGE = @XORG_MAN_PAGE@ XSERVER_LIBPCIACCESS_FALSE = @XSERVER_LIBPCIACCESS_FALSE@ XSERVER_LIBPCIACCESS_TRUE = @XSERVER_LIBPCIACCESS_TRUE@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ @@ -265,9 +268,9 @@ savage_drv_ladir = @moduledir@/drivers savage_drv_la_SOURCES = savage_accel.c savage_xaa.c savage_exa.c \ savage_bci.h savage_common.h savage_cursor.c savage_dga.c \ savage_driver.c savage_driver.h savage_drm.h savage_i2c.c \ - savage_regs.h savage_sarea.h savage_shadow.c savage_streams.c \ - savage_streams.h savage_vbe.c savage_vbe.h savage_video.c \ - $(am__append_1) + savage_pciids.h savage_regs.h savage_sarea.h savage_shadow.c \ + savage_streams.c savage_streams.h savage_vbe.c savage_vbe.h \ + savage_video.c $(am__append_1) all: all-am .SUFFIXES: diff --git a/driver/xf86-video-savage/src/savage_accel.c b/driver/xf86-video-savage/src/savage_accel.c index 73c2d9040..0920e22f9 100644 --- a/driver/xf86-video-savage/src/savage_accel.c +++ b/driver/xf86-video-savage/src/savage_accel.c @@ -24,7 +24,7 @@ #include "savage_bci.h" #include "savage_streams.h" -#ifdef XF86DRI +#ifdef SAVAGEDRI #define _XF86DRI_SERVER_ #include "savage_dri.h" #endif @@ -1257,6 +1257,7 @@ void SavageSetGBD_2000(ScrnInfoPtr pScrn) OUTREG8(SEQ_DATA_REG,byte); } +#if 0 static void SavageRestoreAccelState(ScrnInfoPtr pScrn) { @@ -1266,6 +1267,7 @@ void SavageRestoreAccelState(ScrnInfoPtr pScrn) return; } +#endif /* Acceleration init function, sets up pointers to our accelerated functions */ @@ -1275,10 +1277,9 @@ SavageInitAccel(ScreenPtr pScreen) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SavagePtr psav = SAVPTR(pScrn); -#ifdef XF86DRI +#ifdef SAVAGEDRI if (psav->directRenderingEnabled) { SAVAGEDRIServerPrivatePtr pSAVAGEDRIServer = psav->DRIServerInfo; - BoxRec MemBox; int cpp = pScrn->bitsPerPixel / 8; int widthBytes = psav->lDelta; int bufferSize = ((pScrn->virtualY * widthBytes + SAVAGE_BUFFER_ALIGN) diff --git a/driver/xf86-video-savage/src/savage_bci.h b/driver/xf86-video-savage/src/savage_bci.h index 174a26b03..9d8d65633 100644 --- a/driver/xf86-video-savage/src/savage_bci.h +++ b/driver/xf86-video-savage/src/savage_bci.h @@ -1,6 +1,6 @@ -#ifndef _S3BCI_H_ -#define _S3BCI_H_ +#ifndef S3BCI_H +#define S3BCI_H /* BCI Control Register */ @@ -140,5 +140,4 @@ ((yp) ? 1<<15 : 0) | \ ((err) << 16)) - -#endif /* _S3BCI_H_ */ +#endif /* S3BCI_H */ diff --git a/driver/xf86-video-savage/src/savage_common.h b/driver/xf86-video-savage/src/savage_common.h index 9dbd3cbba..966430419 100644 --- a/driver/xf86-video-savage/src/savage_common.h +++ b/driver/xf86-video-savage/src/savage_common.h @@ -23,8 +23,8 @@ * DEALINGS IN THE SOFTWARE. */ -#ifndef __SAVAGE_COMMON_H__ -#define __SAVAGE_COMMON_H__ +#ifndef SAVAGE_COMMON_H +#define SAVAGE_COMMON_H #include <inttypes.h> @@ -174,4 +174,4 @@ union drmSAVAGECmdHeader { } clear1; /* SAVAGE_CMD_CLEAR data */ }; -#endif /* __SAVAGE_COMMON_H__ */ +#endif /* SAVAGE_COMMON_H */ diff --git a/driver/xf86-video-savage/src/savage_cursor.c b/driver/xf86-video-savage/src/savage_cursor.c index 1af244986..63642936b 100644 --- a/driver/xf86-video-savage/src/savage_cursor.c +++ b/driver/xf86-video-savage/src/savage_cursor.c @@ -67,8 +67,8 @@ static void SavageSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg); #define waitHSync(n) { \ int num = n; \ while (num--) { \ - while ((inStatus1()) & 0x01){};\ - while (!(inStatus1()) & 0x01){};\ + while (inStatus1() & 0x01){};\ + while (!(inStatus1() & 0x01)){};\ } \ } #define MAX_CURS 64 @@ -79,6 +79,7 @@ static void SavageSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg); * the HW cursor position. */ +#if 0 static Bool SavageUseHWCursor(ScreenPtr pScr, CursorPtr pCurs) { @@ -94,6 +95,7 @@ SavageUseHWCursor(ScreenPtr pScr, CursorPtr pCurs) } return TRUE; } +#endif Bool SavageHWCursorInit(ScreenPtr pScreen) diff --git a/driver/xf86-video-savage/src/savage_dga.c b/driver/xf86-video-savage/src/savage_dga.c index eb1c5d25e..1c4d884d6 100644 --- a/driver/xf86-video-savage/src/savage_dga.c +++ b/driver/xf86-video-savage/src/savage_dga.c @@ -107,15 +107,15 @@ SavageSetupDGAMode( otherPitch = secondPitch ? secondPitch : pMode->HDisplay; if(pMode->HDisplay != otherPitch) { - newmodes = xrealloc(modes, (*num + 2) * sizeof(DGAModeRec)); + newmodes = realloc(modes, (*num + 2) * sizeof(DGAModeRec)); oneMore = TRUE; } else { - newmodes = xrealloc(modes, (*num + 1) * sizeof(DGAModeRec)); + newmodes = realloc(modes, (*num + 1) * sizeof(DGAModeRec)); oneMore = FALSE; } if(!newmodes) { - xfree(modes); + free(modes); return NULL; } modes = newmodes; @@ -390,7 +390,7 @@ Savage_OpenFramebuffer( SavagePtr psav = SAVPTR(pScrn); *name = NULL; /* no special device */ - *mem = (unsigned char*)psav->FbRegion.base; + *mem = (unsigned char*)(uintptr_t) psav->FbRegion.base; *size = psav->videoRambytes; *offset = 0; *flags = DGA_NEED_ROOT; diff --git a/driver/xf86-video-savage/src/savage_dri.c b/driver/xf86-video-savage/src/savage_dri.c index 190e8ee13..38d2a860a 100644 --- a/driver/xf86-video-savage/src/savage_dri.c +++ b/driver/xf86-video-savage/src/savage_dri.c @@ -26,16 +26,14 @@ #include "config.h" #endif -#ifdef XF86DRI +#ifdef SAVAGEDRI #include "xf86.h" #include "xf86_OSproc.h" -#include "xf86Priv.h" #include "xaalocal.h" #include "xaarop.h" -#include "xf86PciInfo.h" #include "xf86Pci.h" #include "xf86fbman.h" @@ -55,6 +53,23 @@ #include "savage_dri.h" #include "savage_sarea.h" +static struct { + int bpp; + int redSize; + int greenSize; + int blueSize; + int alphaSize; + int redMask; + int greenMask; + int blueMask; + int alphaMask; + int depthSize; +} SAVAGEVisuals[] = { + { 16, 5, 6, 5, 0, 0x0000F800, 0x000007E0, 0x0000001F, 0, 16 }, + { 32, 8, 8, 8, 0, 0x00FF0000, 0x0000FF00, 0x000000FF, 0, 24 }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } +}; + static char SAVAGEKernelDriverName[] = "savage"; static char SAVAGEClientDriverName[] = "savage"; @@ -95,7 +110,7 @@ static Bool SAVAGEInitVisualConfigs( ScreenPtr pScreen ) __GLXvisualConfig *pConfigs = 0; SAVAGEConfigPrivPtr pSAVAGEConfigs = 0; SAVAGEConfigPrivPtr *pSAVAGEConfigPtrs = 0; - int i, db, depth, stencil, accum; + int i, db, stencil, accum, visNum; switch ( pScrn->bitsPerPixel ) { case 8: @@ -103,26 +118,27 @@ static Bool SAVAGEInitVisualConfigs( ScreenPtr pScreen ) break; case 16: + case 32: numConfigs = 8; - pConfigs = (__GLXvisualConfig*)xcalloc( sizeof(__GLXvisualConfig), + pConfigs = (__GLXvisualConfig*)calloc( sizeof(__GLXvisualConfig), numConfigs ); if ( !pConfigs ) { return FALSE; } - pSAVAGEConfigs = (SAVAGEConfigPrivPtr)xcalloc( sizeof(SAVAGEConfigPrivRec), + pSAVAGEConfigs = (SAVAGEConfigPrivPtr)calloc( sizeof(SAVAGEConfigPrivRec), numConfigs ); if ( !pSAVAGEConfigs ) { - xfree( pConfigs ); + free( pConfigs ); return FALSE; } - pSAVAGEConfigPtrs = (SAVAGEConfigPrivPtr*)xcalloc( sizeof(SAVAGEConfigPrivPtr), + pSAVAGEConfigPtrs = (SAVAGEConfigPrivPtr*)calloc( sizeof(SAVAGEConfigPrivPtr), numConfigs ); if ( !pSAVAGEConfigPtrs ) { - xfree( pConfigs ); - xfree( pSAVAGEConfigs ); + free( pConfigs ); + free( pSAVAGEConfigs ); return FALSE; } @@ -130,117 +146,32 @@ static Bool SAVAGEInitVisualConfigs( ScreenPtr pScreen ) pSAVAGEConfigPtrs[i] = &pSAVAGEConfigs[i]; } - i = 0; - depth = 1; - for ( accum = 0 ; accum <= 1 ; accum++ ) { - for ( stencil = 0 ; stencil <= 1 ; stencil++ ) { - for ( db = 1 ; db >= 0 ; db-- ) { - pConfigs[i].vid = -1; - pConfigs[i].class = -1; - pConfigs[i].rgba = TRUE; - pConfigs[i].redSize = 5; - pConfigs[i].greenSize = 6; - pConfigs[i].blueSize = 5; - pConfigs[i].alphaSize = 0; - pConfigs[i].redMask = 0x0000F800; - pConfigs[i].greenMask = 0x000007E0; - pConfigs[i].blueMask = 0x0000001F; - pConfigs[i].alphaMask = 0; - if ( accum ) { - pConfigs[i].accumRedSize = 16; - pConfigs[i].accumGreenSize = 16; - pConfigs[i].accumBlueSize = 16; - pConfigs[i].accumAlphaSize = 0; - } else { - pConfigs[i].accumRedSize = 0; - pConfigs[i].accumGreenSize = 0; - pConfigs[i].accumBlueSize = 0; - pConfigs[i].accumAlphaSize = 0; - } - if ( db ) { - pConfigs[i].doubleBuffer = TRUE; - } else { - pConfigs[i].doubleBuffer = FALSE; - } - pConfigs[i].stereo = FALSE; - pConfigs[i].bufferSize = 16; - if ( depth ) { - pConfigs[i].depthSize = 16; - } else { - pConfigs[i].depthSize = 0; - } - if ( stencil ) { - pConfigs[i].stencilSize = 8; - } else { - pConfigs[i].stencilSize = 0; - } - pConfigs[i].auxBuffers = 0; - pConfigs[i].level = 0; - if ( accum || stencil ) { - pConfigs[i].visualRating = GLX_SLOW_CONFIG; - } else { - pConfigs[i].visualRating = GLX_NONE; - } - pConfigs[i].transparentPixel = GLX_NONE; - pConfigs[i].transparentRed = 0; - pConfigs[i].transparentGreen = 0; - pConfigs[i].transparentBlue = 0; - pConfigs[i].transparentAlpha = 0; - pConfigs[i].transparentIndex = 0; - i++; - } - } + for (visNum = 0; SAVAGEVisuals[visNum].bpp != 0; visNum++) { + if ( SAVAGEVisuals[visNum].bpp == pScrn->bitsPerPixel ) + break; } - if ( i != numConfigs ) { - xf86DrvMsg( pScrn->scrnIndex, X_ERROR, - "[drm] Incorrect initialization of visuals\n" ); + if ( SAVAGEVisuals[visNum].bpp == 0 ) { + free( pConfigs ); + free( pSAVAGEConfigs ); return FALSE; } - break; - - case 32: - numConfigs = 8; - - pConfigs = (__GLXvisualConfig*)xcalloc( sizeof(__GLXvisualConfig), - numConfigs ); - if ( !pConfigs ) { - return FALSE; - } - - pSAVAGEConfigs = (SAVAGEConfigPrivPtr)xcalloc( sizeof(SAVAGEConfigPrivRec), - numConfigs ); - if ( !pSAVAGEConfigs ) { - xfree( pConfigs ); - return FALSE; - } - - pSAVAGEConfigPtrs = (SAVAGEConfigPrivPtr*)xcalloc( sizeof(SAVAGEConfigPrivPtr), - numConfigs ); - if ( !pSAVAGEConfigPtrs ) { - xfree( pConfigs ); - xfree( pSAVAGEConfigs ); - return FALSE; - } - - for ( i = 0 ; i < numConfigs ; i++ ) { - pSAVAGEConfigPtrs[i] = &pSAVAGEConfigs[i]; - } i = 0; for ( accum = 0 ; accum <= 1 ; accum++ ) { for ( stencil = 0 ; stencil <= 1 ; stencil++ ) { for ( db = 1 ; db >= 0 ; db-- ) { - pConfigs[i].vid = -1; - pConfigs[i].class = -1; - pConfigs[i].rgba = TRUE; - pConfigs[i].redSize = 8; - pConfigs[i].greenSize = 8; - pConfigs[i].blueSize = 8; - pConfigs[i].alphaSize = 0; - pConfigs[i].redMask = 0x00FF0000; - pConfigs[i].greenMask = 0x0000FF00; - pConfigs[i].blueMask = 0x000000FF; - pConfigs[i].alphaMask = 0; + pConfigs[i].vid = -1; + pConfigs[i].class = -1; + pConfigs[i].rgba = TRUE; + pConfigs[i].redSize = SAVAGEVisuals[visNum].redSize; + pConfigs[i].greenSize = SAVAGEVisuals[visNum].greenSize; + pConfigs[i].blueSize = SAVAGEVisuals[visNum].blueSize; + pConfigs[i].alphaSize = SAVAGEVisuals[visNum].alphaSize; + pConfigs[i].redMask = SAVAGEVisuals[visNum].redMask; + pConfigs[i].greenMask = SAVAGEVisuals[visNum].greenMask; + pConfigs[i].blueMask = SAVAGEVisuals[visNum].blueMask; + pConfigs[i].alphaMask = SAVAGEVisuals[visNum].alphaMask; + if ( accum ) { pConfigs[i].accumRedSize = 16; pConfigs[i].accumGreenSize = 16; @@ -256,24 +187,27 @@ static Bool SAVAGEInitVisualConfigs( ScreenPtr pScreen ) pConfigs[i].doubleBuffer = TRUE; } else { pConfigs[i].doubleBuffer = FALSE; - } + } pConfigs[i].stereo = FALSE; - pConfigs[i].bufferSize = 32; + pConfigs[i].bufferSize = pScrn->bitsPerPixel; + pConfigs[i].depthSize = SAVAGEVisuals[visNum].depthSize; if ( stencil ) { - pConfigs[i].depthSize = 24; - pConfigs[i].stencilSize = 8; - } - else { - pConfigs[i].depthSize = 24; - pConfigs[i].stencilSize = 0; + pConfigs[i].stencilSize = 8; + } else { + pConfigs[i].stencilSize = 0; } + pConfigs[i].auxBuffers = 0; pConfigs[i].level = 0; - if ( accum ) { + + pConfigs[i].visualRating = GLX_NONE; + if ( pScrn->bitsPerPixel == 16 ) { + if ( accum || stencil ) { + pConfigs[i].visualRating = GLX_SLOW_CONFIG; + } + } else if ( accum ) { pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; - } else { - pConfigs[i].visualRating = GLX_NONE; - } + } pConfigs[i].transparentPixel = GLX_NONE; pConfigs[i].transparentRed = 0; pConfigs[i].transparentGreen = 0; @@ -386,7 +320,7 @@ static void SAVAGEBlockHandler( int screenNum, pointer blockData, psav->pDRIInfo->wrap.BlockHandler = SAVAGEBlockHandler; } -void SAVAGESelectBuffer( ScrnInfoPtr pScrn, int which ) +static void SAVAGESelectBuffer( ScrnInfoPtr pScrn, int which ) { SavagePtr psav = SAVPTR(pScrn); SAVAGEDRIServerPrivatePtr pSAVAGEDRIServer = psav->DRIServerInfo; @@ -426,29 +360,11 @@ static unsigned int mylog2( unsigned int n ) return log2; } -static Bool SAVAGEDRIAgpInit(ScreenPtr pScreen) +static Bool SAVAGESetAgpMode(SavagePtr psav, ScreenPtr pScreen) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - SavagePtr psav = SAVPTR(pScrn); - SAVAGEDRIServerPrivatePtr pSAVAGEDRIServer = psav->DRIServerInfo; - unsigned long mode; - unsigned int vendor, device; - unsigned int offset; - int ret; - - if (psav->agpSize < 2) psav->agpSize = 2; /* at least 2MB for DMA buffers */ - - pSAVAGEDRIServer->agp.size = psav->agpSize * 1024 * 1024; - pSAVAGEDRIServer->agp.offset = pSAVAGEDRIServer->agp.size; /* ? */ - - if ( drmAgpAcquire( psav->drmFD ) < 0 ) { - xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] AGP not available\n" ); - return FALSE; - } - - mode = drmAgpGetMode( psav->drmFD ); /* Default mode */ - vendor = drmAgpVendorId( psav->drmFD ); - device = drmAgpDeviceId( psav->drmFD ); + unsigned long mode = drmAgpGetMode( psav->drmFD ); /* Default mode */ + unsigned int vendor = drmAgpVendorId( psav->drmFD ); + unsigned int device = drmAgpDeviceId( psav->drmFD ); mode &= ~SAVAGE_AGP_MODE_MASK; @@ -462,8 +378,6 @@ static Bool SAVAGEDRIAgpInit(ScreenPtr pScreen) mode |= SAVAGE_AGP_1X_MODE; } - /* mode |= SAVAGE_AGP_1X_MODE;*/ - xf86DrvMsg( pScreen->myNum, X_INFO, "[agp] Mode 0x%08lx [AGP 0x%04x/0x%04x; Card 0x%04x/0x%04x]\n", mode, vendor, device, @@ -473,6 +387,32 @@ static Bool SAVAGEDRIAgpInit(ScreenPtr pScreen) if ( drmAgpEnable( psav->drmFD, mode ) < 0 ) { xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] AGP not enabled\n" ); drmAgpRelease( psav->drmFD ); + return FALSE; + } + + return TRUE; +} + +static Bool SAVAGEDRIAgpInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + SavagePtr psav = SAVPTR(pScrn); + SAVAGEDRIServerPrivatePtr pSAVAGEDRIServer = psav->DRIServerInfo; + unsigned int offset; + int ret; + + if (psav->agpSize < 2) + psav->agpSize = 2; /* at least 2MB for DMA buffers */ + + pSAVAGEDRIServer->agp.size = psav->agpSize * 1024 * 1024; + pSAVAGEDRIServer->agp.offset = pSAVAGEDRIServer->agp.size; /* ? */ + + if ( drmAgpAcquire( psav->drmFD ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] AGP not available\n" ); + return FALSE; + } + + if (!SAVAGESetAgpMode(psav, pScreen)) { pSAVAGEDRIServer->agp.handle = 0; /* indicate that AGP init failed */ return FALSE; } @@ -487,7 +427,8 @@ static Bool SAVAGEDRIAgpInit(ScreenPtr pScreen) } xf86DrvMsg( pScreen->myNum, X_INFO, "[agp] %d kB allocated with handle 0x%08lx\n", - pSAVAGEDRIServer->agp.size/1024, pSAVAGEDRIServer->agp.handle ); + pSAVAGEDRIServer->agp.size/1024, + (unsigned long)pSAVAGEDRIServer->agp.handle ); if ( drmAgpBind( psav->drmFD, pSAVAGEDRIServer->agp.handle, 0 ) < 0 ) { xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] Could not bind memory\n" ); @@ -547,7 +488,7 @@ static Bool SAVAGEDRIAgpInit(ScreenPtr pScreen) } xf86DrvMsg( pScreen->myNum, X_INFO, "[agp] command DMA handle = 0x%08lx\n", - pSAVAGEDRIServer->cmdDma.handle ); + (unsigned long)pSAVAGEDRIServer->cmdDma.handle ); /* not needed in the server if ( drmMap( psav->drmFD, pSAVAGEDRIServer->cmdDma.handle, @@ -573,7 +514,7 @@ static Bool SAVAGEDRIAgpInit(ScreenPtr pScreen) } xf86DrvMsg( pScreen->myNum, X_INFO, "[agp] DMA buffers handle = 0x%08lx\n", - pSAVAGEDRIServer->buffers.handle ); + (unsigned long)pSAVAGEDRIServer->buffers.handle ); /* not needed in the server if ( drmMap( psav->drmFD, pSAVAGEDRIServer->buffers.handle, @@ -605,7 +546,7 @@ static Bool SAVAGEDRIAgpInit(ScreenPtr pScreen) } else { xf86DrvMsg( pScreen->myNum, X_INFO, "[agp] agpXVideo handle = 0x%08lx\n", - pSAVAGEDRIServer->agpXVideo.handle ); + (unsigned long)pSAVAGEDRIServer->agpXVideo.handle ); } } @@ -623,7 +564,7 @@ static Bool SAVAGEDRIAgpInit(ScreenPtr pScreen) /* pSAVAGEDRIServer->agp_offset=pSAVAGEDRIServer->agpTexture.size;*/ xf86DrvMsg( pScreen->myNum, X_INFO, "[agp] agpTextures handle = 0x%08lx\n", - pSAVAGEDRIServer->agpTextures.handle ); + (unsigned long)pSAVAGEDRIServer->agpTextures.handle ); /* not needed in the server if ( drmMap( psav->drmFD, @@ -675,7 +616,7 @@ static Bool SAVAGEDRIMapInit( ScreenPtr pScreen ) xf86DrvMsg( pScreen->myNum, X_INFO, "[drm] aperture handle = 0x%08lx\n", - pSAVAGEDRIServer->aperture.handle ); + (unsigned long)pSAVAGEDRIServer->aperture.handle ); /*if(drmMap(psav->drmFD, pSAVAGEDRIServer->registers.handle, @@ -700,7 +641,7 @@ static Bool SAVAGEDRIMapInit( ScreenPtr pScreen ) } else xf86DrvMsg( pScreen->myNum, X_INFO, "[drm] PCI command DMA handle = 0x%08lx\n", - pSAVAGEDRIServer->cmdDma.handle ); + (unsigned long)pSAVAGEDRIServer->cmdDma.handle ); } /* Enable ShadowStatus by default for direct rendering. */ @@ -724,7 +665,7 @@ static Bool SAVAGEDRIMapInit( ScreenPtr pScreen ) } xf86DrvMsg( pScreen->myNum, X_INFO, "[drm] Status handle = 0x%08lx\n", - pSAVAGEDRIServer->status.handle ); + (unsigned long)pSAVAGEDRIServer->status.handle ); if ( drmMap( psav->drmFD, pSAVAGEDRIServer->status.handle, @@ -906,7 +847,7 @@ Bool SAVAGEDRIScreenInit( ScreenPtr pScreen ) if (xf86LoaderCheckSymbol("DRICreatePCIBusID")) { pDRIInfo->busIdString = DRICreatePCIBusID(psav->PciInfo); } else { - pDRIInfo->busIdString = xalloc(64); + pDRIInfo->busIdString = malloc(64); sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d", psav->PciInfo->bus, @@ -921,7 +862,7 @@ Bool SAVAGEDRIScreenInit( ScreenPtr pScreen ) pDRIInfo->ddxDriverMinorVersion = SAVAGE_VERSION_MINOR; pDRIInfo->ddxDriverPatchVersion = SAVAGE_PATCHLEVEL; - pDRIInfo->frameBufferPhysicalAddress = (pointer) psav->FbRegion.base; + pDRIInfo->frameBufferPhysicalAddress = (pointer)(uintptr_t) psav->FbRegion.base; pDRIInfo->frameBufferSize = psav->videoRambytes; pDRIInfo->frameBufferStride = pScrn->displayWidth*(pScrn->bitsPerPixel/8); pDRIInfo->ddxDrawableTableEntry = SAVAGE_MAX_DRAWABLES; @@ -960,7 +901,7 @@ Bool SAVAGEDRIScreenInit( ScreenPtr pScreen ) pDRIInfo->SAREASize = SAREA_MAX; - pSAVAGEDRI = (SAVAGEDRIPtr)xcalloc( sizeof(SAVAGEDRIRec), 1 ); + pSAVAGEDRI = (SAVAGEDRIPtr)calloc( sizeof(SAVAGEDRIRec), 1 ); if ( !pSAVAGEDRI ) { DRIDestroyInfoRec( psav->pDRIInfo ); psav->pDRIInfo = 0; @@ -970,9 +911,9 @@ Bool SAVAGEDRIScreenInit( ScreenPtr pScreen ) } pSAVAGEDRIServer = (SAVAGEDRIServerPrivatePtr) - xcalloc( sizeof(SAVAGEDRIServerPrivateRec), 1 ); + calloc( sizeof(SAVAGEDRIServerPrivateRec), 1 ); if ( !pSAVAGEDRIServer ) { - xfree( pSAVAGEDRI ); + free( pSAVAGEDRI ); DRIDestroyInfoRec( psav->pDRIInfo ); psav->pDRIInfo = 0; xf86DrvMsg( pScrn->scrnIndex, X_ERROR, @@ -998,9 +939,9 @@ Bool SAVAGEDRIScreenInit( ScreenPtr pScreen ) pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; if ( !DRIScreenInit( pScreen, pDRIInfo, &psav->drmFD ) ) { - xfree( pSAVAGEDRIServer ); + free( pSAVAGEDRIServer ); psav->DRIServerInfo = 0; - xfree( pDRIInfo->devPrivate ); + free( pDRIInfo->devPrivate ); pDRIInfo->devPrivate = 0; DRIDestroyInfoRec( psav->pDRIInfo ); psav->pDRIInfo = 0; @@ -1063,6 +1004,11 @@ Bool SAVAGEDRIScreenInit( ScreenPtr pScreen ) return FALSE; } + /* Linux kernel DRM broken in 2.6.30 through 2.6.39 */ + if (pDRIInfo->hFrameBuffer == pSAVAGEDRIServer->aperture.handle) + xf86DrvMsg( pScrn->scrnIndex, X_WARNING, + "[drm] Detected broken drm maps. Please upgrade to linux kernel 3.x\n"); + if ( !SAVAGEDRIBuffersInit( pScreen ) ) { SAVAGEDRICloseScreen( pScreen ); return FALSE; @@ -1077,6 +1023,49 @@ Bool SAVAGEDRIScreenInit( ScreenPtr pScreen ) return TRUE; } +static void SAVAGEDRISetupTiledSurfaceRegs( SavagePtr psav ) +{ + SAVAGEDRIPtr pSAVAGEDRI = (SAVAGEDRIPtr)psav->pDRIInfo->devPrivate; + unsigned int value = 0; + + OUTREG(0x850C,(INREG(0x850C) | 0x00008000)); /* AGD: I don't think this does anything on 3D/MX/IX */ + /* maybe savage4 too... */ + /* we don't use Y range flag,so comment it */ + /* + if(pSAVAGEDRI->width <= 1024) + value |= (1<<29); + */ + if ((psav->Chipset == S3_SAVAGE_MX) /* 3D/MX/IX seem to set up the tile stride differently */ + || (psav->Chipset == S3_SAVAGE3D)) { + if(pSAVAGEDRI->cpp == 2) + { + value |= ((psav->lDelta / 4) >> 5) << 24; + value |= 2<<30; + } else { + value |= ((psav->lDelta / 4) >> 5) << 24; + value |= 3<<30; + } + + OUTREG(TILED_SURFACE_REGISTER_0, value|(pSAVAGEDRI->frontOffset) ); /* front */ + OUTREG(TILED_SURFACE_REGISTER_1, value|(pSAVAGEDRI->backOffset) ); /* back */ + OUTREG(TILED_SURFACE_REGISTER_2, value|(pSAVAGEDRI->depthOffset) ); /* depth */ + } else { + int offset_shift = 5; + if(pSAVAGEDRI->cpp == 2) + { + value |= (((pSAVAGEDRI->width + 0x3F) & 0xFFC0) >> 6) << 20; + value |= 2<<30; + } else { + value |= (((pSAVAGEDRI->width + 0x1F) & 0xFFE0) >> 5) << 20; + value |= 3<<30; + } + if (psav->Chipset == S3_SUPERSAVAGE) /* supersavages have a different shift */ + offset_shift = 6; + OUTREG(TILED_SURFACE_REGISTER_0, value|(pSAVAGEDRI->frontOffset >> offset_shift) ); /* front */ + OUTREG(TILED_SURFACE_REGISTER_1, value|(pSAVAGEDRI->backOffset >> offset_shift) ); /* back */ + OUTREG(TILED_SURFACE_REGISTER_2, value|(pSAVAGEDRI->depthOffset >> offset_shift) ); /* depth */ + } +} Bool SAVAGEDRIFinishScreenInit( ScreenPtr pScreen ) { @@ -1148,48 +1137,6 @@ Bool SAVAGEDRIFinishScreenInit( ScreenPtr pScreen ) pSAVAGEDRI->apertureHandle = pSAVAGEDRIServer->aperture.handle; pSAVAGEDRI->apertureSize = pSAVAGEDRIServer->aperture.size; pSAVAGEDRI->aperturePitch = psav->ulAperturePitch; - - { - unsigned int value = 0; - - OUTREG(0x850C,(INREG(0x850C) | 0x00008000)); /* AGD: I don't think this does anything on 3D/MX/IX */ - /* maybe savage4 too... */ - /* we don't use Y range flag,so comment it */ - /* - if(pSAVAGEDRI->width <= 1024) - value |= (1<<29); - */ - if ((psav->Chipset == S3_SAVAGE_MX) /* 3D/MX/IX seem to set up the tile stride differently */ - || (psav->Chipset == S3_SAVAGE3D)) { - if(pSAVAGEDRI->cpp == 2) - { - value |= ((psav->lDelta / 4) >> 5) << 24; - value |= 2<<30; - } else { - value |= ((psav->lDelta / 4) >> 5) << 24; - value |= 3<<30; - } - - OUTREG(TILED_SURFACE_REGISTER_0, value|(pSAVAGEDRI->frontOffset) ); /* front */ - OUTREG(TILED_SURFACE_REGISTER_1, value|(pSAVAGEDRI->backOffset) ); /* back */ - OUTREG(TILED_SURFACE_REGISTER_2, value|(pSAVAGEDRI->depthOffset) ); /* depth */ - } else { - int offset_shift = 5; - if(pSAVAGEDRI->cpp == 2) - { - value |= (((pSAVAGEDRI->width + 0x3F) & 0xFFC0) >> 6) << 20; - value |= 2<<30; - } else { - value |= (((pSAVAGEDRI->width + 0x1F) & 0xFFE0) >> 5) << 20; - value |= 3<<30; - } - if (psav->Chipset == S3_SUPERSAVAGE) /* supersavages have a different shift */ - offset_shift = 6; - OUTREG(TILED_SURFACE_REGISTER_0, value|(pSAVAGEDRI->frontOffset >> offset_shift) ); /* front */ - OUTREG(TILED_SURFACE_REGISTER_1, value|(pSAVAGEDRI->backOffset >> offset_shift) ); /* back */ - OUTREG(TILED_SURFACE_REGISTER_2, value|(pSAVAGEDRI->depthOffset >> offset_shift) ); /* depth */ - } - } pSAVAGEDRI->statusHandle = pSAVAGEDRIServer->status.handle; pSAVAGEDRI->statusSize = pSAVAGEDRIServer->status.size; @@ -1216,29 +1163,29 @@ Bool SAVAGEDRIFinishScreenInit( ScreenPtr pScreen ) xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] textureSize:0x%08x\n",pSAVAGEDRIServer->textureSize); xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] logTextureGranularity:0x%08x\n",pSAVAGEDRIServer->logTextureGranularity); - xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] agp:handle:0x%08lx\n",pSAVAGEDRIServer->agp.handle); + xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] agp:handle:0x%08lx\n",(unsigned long)pSAVAGEDRIServer->agp.handle); xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] agp:offset:0x%08x\n",pSAVAGEDRIServer->agp.offset); xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] agp:size:0x%08x\n",pSAVAGEDRIServer->agp.size); xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] agp:map:0x%08lx\n",(unsigned long)pSAVAGEDRIServer->agp.map); - xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] registers:handle:0x%08lx\n",pSAVAGEDRIServer->registers.handle); + xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] registers:handle:0x%08lx\n",(unsigned long)pSAVAGEDRIServer->registers.handle); xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] registers:offset:0x%08x\n",pSAVAGEDRIServer->registers.offset); xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] registers:size:0x%08x\n",pSAVAGEDRIServer->registers.size); xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] registers:map:0x%08lx\n",(unsigned long)pSAVAGEDRIServer->registers.map); - xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] status:handle:0x%08lx\n",pSAVAGEDRIServer->status.handle); + xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] status:handle:0x%08lx\n",(unsigned long)pSAVAGEDRIServer->status.handle); xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] status:offset:0x%08x\n",pSAVAGEDRIServer->status.offset); xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] status:size:0x%08x\n",pSAVAGEDRIServer->status.size); xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] status:map:0x%08lx\n",(unsigned long)pSAVAGEDRIServer->status.map); - xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] agpTextures:handle:0x%08lx\n",pSAVAGEDRIServer->agpTextures.handle); + xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] agpTextures:handle:0x%08lx\n",(unsigned long)pSAVAGEDRIServer->agpTextures.handle); xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] agpTextures:offset:0x%08x\n",pSAVAGEDRIServer->agpTextures.offset); xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] agpTextures:size:0x%08x\n",pSAVAGEDRIServer->agpTextures.size); xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] apgTextures:map:0x%08lx\n",(unsigned long)pSAVAGEDRIServer->agpTextures.map); xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] logAgpTextureGranularity:0x%08x\n",pSAVAGEDRIServer->logAgpTextureGranularity); - xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] cmdDma:handle:0x%08lx\n",pSAVAGEDRIServer->cmdDma.handle); + xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] cmdDma:handle:0x%08lx\n",(unsigned long)pSAVAGEDRIServer->cmdDma.handle); xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] cmdDma:offset:0x%08x\n",pSAVAGEDRIServer->cmdDma.offset); xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] cmdDma:size:0x%08x\n",pSAVAGEDRIServer->cmdDma.size); xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] cmdDma:map:0x%08lx\n",(unsigned long)pSAVAGEDRIServer->cmdDma.map); @@ -1268,22 +1215,38 @@ Bool SAVAGEDRIFinishScreenInit( ScreenPtr pScreen ) xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] textureSize:0x%08x\n",pSAVAGEDRI->textureSize ); xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] logTextureGranularity:0x%08x\n",pSAVAGEDRI->logTextureGranularity ); - xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] agpTextureHandle:0x%08lx\n",pSAVAGEDRI->agpTextureHandle ); + xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] agpTextureHandle:0x%08lx\n",(unsigned long)pSAVAGEDRI->agpTextureHandle ); xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] agpTextureSize:0x%08x\n",pSAVAGEDRI->agpTextureSize ); xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] logAgpTextureGranularity:0x%08x\n",pSAVAGEDRI->logAgpTextureGranularity ); - xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] apertureHandle:0x%08lx\n",pSAVAGEDRI->apertureHandle); + xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] apertureHandle:0x%08lx\n",(unsigned long)pSAVAGEDRI->apertureHandle); xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] apertureSize:0x%08x\n",pSAVAGEDRI->apertureSize); xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] aperturePitch:0x%08x\n",pSAVAGEDRI->aperturePitch); - xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] statusHandle:0x%08lx\n",pSAVAGEDRI->statusHandle); + xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] statusHandle:0x%08lx\n",(unsigned long)pSAVAGEDRI->statusHandle); xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] statusSize:0x%08x\n",pSAVAGEDRI->statusSize); xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[junkers] sarea_priv_offset:0x%08x\n",pSAVAGEDRI->sarea_priv_offset); + SAVAGEDRISetupTiledSurfaceRegs( psav ); return TRUE; } +void SAVAGEDRIResume(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + SavagePtr psav = SAVPTR(pScrn); + SAVAGESAREAPrivPtr pSAREAPriv = + (SAVAGESAREAPrivPtr)DRIGetSAREAPrivate(pScreen); + + if (!psav->IsPCI) { + SAVAGESetAgpMode(psav, pScreen); + } + SAVAGEDRISetupTiledSurfaceRegs(psav); + /* Assume that 3D state was clobbered, invalidate it by + * changing ctxOwner in the sarea. */ + pSAREAPriv->ctxOwner = DRIGetContext(pScreen); +} void SAVAGEDRICloseScreen( ScreenPtr pScreen ) { @@ -1361,21 +1324,21 @@ void SAVAGEDRICloseScreen( ScreenPtr pScreen ) if ( psav->pDRIInfo ) { if ( psav->pDRIInfo->devPrivate ) { - xfree( psav->pDRIInfo->devPrivate ); + free( psav->pDRIInfo->devPrivate ); psav->pDRIInfo->devPrivate = 0; } DRIDestroyInfoRec( psav->pDRIInfo ); psav->pDRIInfo = 0; } if ( psav->DRIServerInfo ) { - xfree( psav->DRIServerInfo ); + free( psav->DRIServerInfo ); psav->DRIServerInfo = 0; } if ( psav->pVisualConfigs ) { - xfree( psav->pVisualConfigs ); + free( psav->pVisualConfigs ); } if ( psav->pVisualConfigsPriv ) { - xfree( psav->pVisualConfigsPriv ); + free( psav->pVisualConfigsPriv ); } } @@ -1454,7 +1417,7 @@ SAVAGEDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, pboxNew1 = 0; pptNew1 = 0; pboxNew2 = 0; - pboxNew2 = 0; + pptNew2 = 0; pptSrc = &ptOldOrg; dx = pParent->drawable.x - ptOldOrg.x; @@ -1466,11 +1429,11 @@ SAVAGEDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, if (nbox>1) { /* Keep ordering in each band, reverse order of bands */ - pboxNew1 = xalloc(sizeof(BoxRec)*nbox); + pboxNew1 = malloc(sizeof(BoxRec)*nbox); if (!pboxNew1) return; - pptNew1 = xalloc(sizeof(DDXPointRec)*nbox); + pptNew1 = malloc(sizeof(DDXPointRec)*nbox); if (!pptNew1) { - xfree(pboxNew1); + free(pboxNew1); return; } pboxBase = pboxNext = pbox+nbox-1; @@ -1501,14 +1464,14 @@ SAVAGEDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, if (nbox > 1) { /*reverse orderof rects in each band */ - pboxNew2 = xalloc(sizeof(BoxRec)*nbox); - pptNew2 = xalloc(sizeof(DDXPointRec)*nbox); + pboxNew2 = malloc(sizeof(BoxRec)*nbox); + pptNew2 = malloc(sizeof(DDXPointRec)*nbox); if (!pboxNew2 || !pptNew2) { - if (pptNew2) xfree(pptNew2); - if (pboxNew2) xfree(pboxNew2); + if (pptNew2) free(pptNew2); + if (pboxNew2) free(pboxNew2); if (pboxNew1) { - xfree(pptNew1); - xfree(pboxNew1); + free(pptNew1); + free(pboxNew1); } return; } @@ -1563,12 +1526,12 @@ SAVAGEDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, SAVAGESelectBuffer(pScrn, SAVAGE_FRONT); if (pboxNew2) { - xfree(pptNew2); - xfree(pboxNew2); + free(pptNew2); + free(pboxNew2); } if (pboxNew1) { - xfree(pptNew1); - xfree(pboxNew1); + free(pptNew1); + free(pboxNew1); } BCI_SEND(0xc0020000); /* wait for 2D idle */ diff --git a/driver/xf86-video-savage/src/savage_dri.h b/driver/xf86-video-savage/src/savage_dri.h index 214d9851a..36377c929 100644 --- a/driver/xf86-video-savage/src/savage_dri.h +++ b/driver/xf86-video-savage/src/savage_dri.h @@ -23,8 +23,8 @@ */ -#ifndef __SAVAGE_DRI_H__ -#define __SAVAGE_DRI_H__ +#ifndef SAVAGE_DRI_H +#define SAVAGE_DRI_H #include "drm.h" @@ -73,4 +73,4 @@ typedef struct { drm_handle_t xvmcSurfHandle; /* ? */ } SAVAGEDRIRec, *SAVAGEDRIPtr; -#endif +#endif /* SAVAGE_DRI_H */ diff --git a/driver/xf86-video-savage/src/savage_dripriv.h b/driver/xf86-video-savage/src/savage_dripriv.h index 19e44876f..4206a9f99 100644 --- a/driver/xf86-video-savage/src/savage_dripriv.h +++ b/driver/xf86-video-savage/src/savage_dripriv.h @@ -22,8 +22,8 @@ * DEALINGS IN THE SOFTWARE. */ -#ifndef __SAVAGE_DRIPRIV_H__ -#define __SAVAGE_DRIPRIV_H__ +#ifndef SAVAGE_DRIPRIV_H +#define SAVAGE_DRIPRIV_H #include "GL/glxint.h" @@ -43,4 +43,4 @@ typedef struct { int dummy; } SAVAGEDRIContextRec, *SAVAGEDRIContextPtr; -#endif +#endif /* SAVAGE_DRIPRIV_H */ diff --git a/driver/xf86-video-savage/src/savage_driver.c b/driver/xf86-video-savage/src/savage_driver.c index b71f239e7..f3480b40f 100644 --- a/driver/xf86-video-savage/src/savage_driver.c +++ b/driver/xf86-video-savage/src/savage_driver.c @@ -56,6 +56,7 @@ #include "xf86xv.h" #include "savage_driver.h" +#include "savage_pciids.h" #include "savage_regs.h" #include "savage_bci.h" #include "savage_streams.h" @@ -66,7 +67,7 @@ #define TRANSPARENCY_KEY 0xff; -#ifdef XF86DRI +#ifdef SAVAGEDRI #define _XF86DRI_SERVER_ #include "savage_dri.h" #include "savage_sarea.h" @@ -129,7 +130,7 @@ static unsigned int SavageDDC1Read(ScrnInfoPtr pScrn); static void SavageProbeDDC(ScrnInfoPtr pScrn, int index); static void SavageGetTvMaxSize(SavagePtr psav); static Bool SavagePanningCheck(ScrnInfoPtr pScrn, DisplayModePtr pMode); -#ifdef XF86DRI +#ifdef SAVAGEDRI static Bool SavageCheckAvailableRamFor3D(ScrnInfoPtr pScrn); #endif static void SavageResetStreams(ScrnInfoPtr pScrn); @@ -314,7 +315,7 @@ static const OptionInfoRec SavageOptions[] = { OPTION_BCI_FOR_XV, "BCIforXv", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_DVI, "DVI", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_IGNORE_EDID, "IgnoreEDID", OPTV_BOOLEAN, {0}, FALSE }, -#ifdef XF86DRI +#ifdef SAVAGEDRI { OPTION_BUS_TYPE, "BusType", OPTV_ANYSTR, {0}, FALSE }, { OPTION_DMA_TYPE, "DmaType", OPTV_ANYSTR, {0}, FALSE }, { OPTION_DMA_MODE, "DmaMode", OPTV_ANYSTR, {0}, FALSE }, @@ -648,11 +649,11 @@ static Bool SavageGetRec(ScrnInfoPtr pScrn) static void SavageFreeRec(ScrnInfoPtr pScrn) { - TRACE(( "SavageFreeRec(%x)\n", pScrn->driverPrivate )); + TRACE(( "SavageFreeRec(%p)\n", pScrn->driverPrivate )); if (!pScrn->driverPrivate) return; SavageUnmapMem(pScrn, 1); - xfree(pScrn->driverPrivate); + free(pScrn->driverPrivate); pScrn->driverPrivate = NULL; } @@ -761,7 +762,7 @@ static Bool SavageProbe(DriverPtr drv, int flags) return FALSE; if (xf86GetPciVideoInfo() == NULL) { if (devSections) - xfree(devSections); + free(devSections); return FALSE; } @@ -770,7 +771,7 @@ static Bool SavageProbe(DriverPtr drv, int flags) devSections, numDevSections, drv, &usedChips); if (devSections) - xfree(devSections); + free(devSections); devSections = NULL; if (numUsed <= 0) return FALSE; @@ -850,11 +851,11 @@ static Bool SavageProbe(DriverPtr drv, int flags) pSavageEnt->HasSecondary = TRUE; } } - xfree(pEnt); + free(pEnt); } - xfree(usedChips); + free(usedChips); return foundScreen; } @@ -1060,7 +1061,7 @@ static void SavageGetPanelInfo(ScrnInfoPtr pScrn) if (!pScrn->monitor->maxPixClock) pScrn->monitor->maxPixClock = native->Clock; - xfree(native); + free(native); } while (0); if( psav->LCDClock > 0.0 ) @@ -1188,6 +1189,7 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) psav = SAVPTR(pScrn); hwp = VGAHWPTR(pScrn); + vgaHWSetStdFuncs(hwp); vgaHWGetIOBase(hwp); psav->vgaIOBase = hwp->IOBase; @@ -1196,7 +1198,7 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) if (pScrn->depth == 8) pScrn->rgbBits = 8; - if (!(psav->Options = xalloc(sizeof(SavageOptions)))) + if (!(psav->Options = malloc(sizeof(SavageOptions)))) return FALSE; memcpy(psav->Options, SavageOptions, sizeof(SavageOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, psav->Options); @@ -1398,7 +1400,7 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) pEnt = xf86GetEntityInfo(pScrn->entityList[0]); #ifndef XSERVER_LIBPCIACCESS if (pEnt->resources) { - xfree(pEnt); + free(pEnt); SavageFreeRec(pScrn); return FALSE; } @@ -1449,7 +1451,7 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) if (pEnt->device->videoRam != 0) pScrn->videoRam = pEnt->device->videoRam; - xfree(pEnt); + free(pEnt); #ifndef XSERVER_LIBPCIACCESS psav->PciTag = pciTag(psav->PciInfo->bus, psav->PciInfo->device, @@ -1459,7 +1461,7 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) /* Set AGP Mode from config */ /* We support 1X 2X and 4X */ -#ifdef XF86DRI +#ifdef SAVAGEDRI #ifdef XSERVER_LIBPCIACCESS /* Try to read the AGP capabilty block from the device. If there is * no AGP info, the device is PCI. @@ -1670,7 +1672,7 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) "Option: %s Tile Mode and Program it \n",(psav->bDisableTile?"Disable":"Enable")); } -#ifdef XF86DRI +#ifdef SAVAGEDRI /* disabled by default...doesn't seem to work */ psav->bDisableXvMC = TRUE; /* if you want to free up more mem for DRI,etc. */ if (xf86GetOptValBool(psav->Options, OPTION_DISABLE_XVMC, &psav->bDisableXvMC)) { @@ -1700,7 +1702,7 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) "%s DVI port support (Savage4 only)\n",(psav->dvi?"Force":"Disable")); } -#ifdef XF86DRI +#ifdef SAVAGEDRI psav->AGPforXv = FALSE; if (xf86GetOptValBool(psav->Options, OPTION_AGP_FOR_XV, &psav->AGPforXv)) { if (psav->AGPforXv) { @@ -2163,10 +2165,10 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) } else { modName = "xaa"; if( !xf86LoadSubModule(pScrn, modName) ) { - SavageFreeRec(pScrn); - vbeFree(psav->pVbe); - psav->pVbe = NULL; - return FALSE; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Falling back to shadowfb\n"); + psav->NoAccel = 1; + psav->shadowFB = 1; } } } @@ -2199,10 +2201,9 @@ static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags) static Bool SavageEnterVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; -#ifdef XF86DRI - SavagePtr psav= SAVPTR(pScrn); +#ifdef SAVAGEDRI + SavagePtr psav = SAVPTR(pScrn); ScreenPtr pScreen; - SAVAGESAREAPrivPtr pSAREAPriv; #endif TRACE(("SavageEnterVT(%d)\n", flags)); @@ -2210,13 +2211,10 @@ static Bool SavageEnterVT(int scrnIndex, int flags) gpScrn = pScrn; SavageEnableMMIO(pScrn); -#ifdef XF86DRI +#ifdef SAVAGEDRI if (psav->directRenderingEnabled) { pScreen = screenInfo.screens[scrnIndex]; - pSAREAPriv = (SAVAGESAREAPrivPtr)DRIGetSAREAPrivate(pScreen); - /* Assume that 3D state was clobbered, invalidate it by - * changing ctxOwner in the sarea. */ - pSAREAPriv->ctxOwner = DRIGetContext(pScreen); + SAVAGEDRIResume(pScreen); DRIUnlock(pScreen); psav->LockHeld = 0; } @@ -2241,14 +2239,14 @@ static void SavageLeaveVT(int scrnIndex, int flags) SavagePtr psav = SAVPTR(pScrn); vgaRegPtr vgaSavePtr = &hwp->SavedReg; SavageRegPtr SavageSavePtr = &psav->SavedReg; -#ifdef XF86DRI +#ifdef SAVAGEDRI ScreenPtr pScreen; #endif TRACE(("SavageLeaveVT(%d)\n", flags)); gpScrn = pScrn; -#ifdef XF86DRI +#ifdef SAVAGEDRI if (psav->directRenderingEnabled) { pScreen = screenInfo.screens[scrnIndex]; DRILock(pScreen, 0); @@ -2461,7 +2459,7 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, TRACE(("SavageWriteMode(%x)\n", restore->mode)); -#ifdef XF86DRI +#ifdef SAVAGEDRI if (psav->directRenderingEnabled) { DRILock(screenInfo.screens[pScrn->scrnIndex], 0); psav->LockHeld = 1; @@ -2565,7 +2563,7 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, (restore->refresh >= 75) ) { - if( cr6d && LCD_ACTIVE ) + if( cr6d & LCD_ACTIVE ) cr79 = 0x05; else cr79 = 0x08; @@ -2582,7 +2580,7 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, */ if( pScrn->displayWidth == 1024 ) { - if( cr6d && LCD_ACTIVE ) + if( cr6d & LCD_ACTIVE ) cr79 = 0x08; else cr79 = 0x0e; @@ -2654,7 +2652,7 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, SavageSetGBD(pScrn); -#ifdef XF86DRI +#ifdef SAVAGEDRI if (psav->directRenderingEnabled) DRIUnlock(screenInfo.screens[pScrn->scrnIndex]); psav->LockHeld = 0; @@ -2910,7 +2908,7 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, vgaHWProtect(pScrn, FALSE); -#ifdef XF86DRI +#ifdef SAVAGEDRI if (psav->directRenderingEnabled) DRIUnlock(screenInfo.screens[pScrn->scrnIndex]); psav->LockHeld = 0; @@ -3061,7 +3059,7 @@ static void SavageUnmapMem(ScrnInfoPtr pScrn, int All) { SavagePtr psav = SAVPTR(pScrn); - TRACE(("SavageUnmapMem(%x,%x)\n", psav->MapBase, psav->FBBase)); + TRACE(("SavageUnmapMem(%p,%p)\n", psav->MapBase, psav->FBBase)); if (psav->PrimaryVidMapped) { vgaHWUnmapMem(pScrn); @@ -3116,7 +3114,7 @@ static void SavageUnmapMem(ScrnInfoPtr pScrn, int All) return; } -#ifdef XF86DRI +#ifdef SAVAGEDRI static Bool SavageCheckAvailableRamFor3D(ScrnInfoPtr pScrn) { SavagePtr psav = SAVPTR(pScrn); @@ -3260,7 +3258,7 @@ static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen, vgaHWBlankScreen(pScrn, TRUE); -#ifdef XF86DRI +#ifdef SAVAGEDRI if (!xf86ReturnOptValBool(psav->Options, OPTION_DRI, TRUE)) { psav->directRenderingEnabled = FALSE; xf86DrvMsg(pScrn->scrnIndex, X_INFO, @@ -3474,7 +3472,7 @@ static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen, if (xf86DPMSInit(pScreen, SavageDPMS, 0) == FALSE) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "DPMS initialization failed\n"); -#ifdef XF86DRI +#ifdef SAVAGEDRI if (psav->directRenderingEnabled) { /* complete the DRI setup.*/ psav->directRenderingEnabled = SAVAGEDRIFinishScreenInit(pScreen); @@ -3505,7 +3503,7 @@ static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen, } #endif -#ifdef XF86DRI +#ifdef SAVAGEDRI if ((psav->directRenderingEnabled) && (!psav->bDisableXvMC)) { if (SAVAGEInitMC(pScreen)) xf86DrvMsg(pScrn->scrnIndex,X_CONFIG,"XvMC is enabled\n"); @@ -3552,7 +3550,7 @@ static int SavageInternalScreenInit(int scrnIndex, ScreenPtr pScreen) if(psav->shadowFB) { psav->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width); - psav->ShadowPtr = xalloc(psav->ShadowPitch * height); + psav->ShadowPtr = malloc(psav->ShadowPitch * height); displayWidth = psav->ShadowPitch / (pScrn->bitsPerPixel >> 3); FBStart = psav->ShadowPtr; } else { @@ -3665,7 +3663,7 @@ static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) vgaCRIndex = vgaIOBase + 4; vgaCRReg = vgaIOBase + 5; - TRACE(("SavageModeInit(%dx%d, %dHz)\n", + TRACE(("SavageModeInit(%dx%d, %dkHz)\n", mode->HDisplay, mode->VDisplay, mode->Clock)); #if 0 @@ -3983,7 +3981,7 @@ static Bool SavageCloseScreen(int scrnIndex, ScreenPtr pScreen) TRACE(("SavageCloseScreen\n")); -#ifdef XF86DRI +#ifdef SAVAGEDRI if (psav->directRenderingEnabled) { SAVAGEDRICloseScreen(pScreen); /* reset shadow values */ @@ -4003,7 +4001,7 @@ static Bool SavageCloseScreen(int scrnIndex, ScreenPtr pScreen) } if( psav->DGAModes ) { - xfree( psav->DGAModes ); + free( psav->DGAModes ); psav->DGAModes = NULL; psav->numDGAModes = 0; } @@ -4065,7 +4063,7 @@ SavageDoAdjustFrame(ScrnInfoPtr pScrn, int x, int y, int crtc2) SavagePtr psav = SAVPTR(pScrn); int address=0,top=0,left=0,tile_height,tile_size; - TRACE(("SavageDoAdjustFrame(%d,%d,%x)\n", x, y, flags)); + TRACE(("SavageDoAdjustFrame(%d,%d,%d)\n", x, y, crtc2)); if (psav->Chipset == S3_SAVAGE2000) { tile_height = TILEHEIGHT_2000; /* 32 */ @@ -4297,7 +4295,7 @@ void SavageLoadPaletteSavage4(ScrnInfoPtr pScrn, int numColors, int *indicies, VerticalRetraceWait(); for (i=0; i<numColors; i++) { - if (!(inStatus1()) & 0x08) + if (!(inStatus1() & 0x08)) VerticalRetraceWait(); index = indicies[i]; VGAOUT8(0x3c8, index); diff --git a/driver/xf86-video-savage/src/savage_driver.h b/driver/xf86-video-savage/src/savage_driver.h index 9c0ba5875..7b7e01dfc 100644 --- a/driver/xf86-video-savage/src/savage_driver.h +++ b/driver/xf86-video-savage/src/savage_driver.h @@ -55,7 +55,6 @@ #include "xf86Resources.h" #endif #include "xf86Pci.h" -#include "xf86PciInfo.h" #include "xf86_OSproc.h" #include "xf86Cursor.h" #include "mipointer.h" @@ -71,7 +70,11 @@ #include "savage_regs.h" #include "savage_vbe.h" -#ifdef XF86DRI +#ifndef XF86DRI +#undef SAVAGEDRI +#endif + +#ifdef SAVAGEDRI #define _XF86DRI_SERVER_ #include "savage_dripriv.h" #include "savage_dri.h" @@ -458,7 +461,7 @@ typedef struct _Savage { int overlayDepth; int primStreamBpp; -#ifdef XF86DRI +#ifdef SAVAGEDRI int LockHeld; Bool directRenderingEnabled; DRIInfoPtr pDRIInfo; @@ -548,7 +551,7 @@ typedef struct _Savage { #define writescan savagewritescan /* add for support DRI */ -#ifdef XF86DRI +#ifdef SAVAGEDRI #define SAVAGE_FRONT 0x1 #define SAVAGE_BACK 0x2 @@ -559,20 +562,7 @@ Bool SAVAGEDRIScreenInit( ScreenPtr pScreen ); Bool SAVAGEInitMC(ScreenPtr pScreen); void SAVAGEDRICloseScreen( ScreenPtr pScreen ); Bool SAVAGEDRIFinishScreenInit( ScreenPtr pScreen ); - -Bool SAVAGELockUpdate( ScrnInfoPtr pScrn, drmLockFlags flags ); - -#if 0 -void SAVAGEGetQuiescence( ScrnInfoPtr pScrn ); -void SAVAGEGetQuiescenceShared( ScrnInfoPtr pScrn ); -#endif - -void SAVAGESelectBuffer(ScrnInfoPtr pScrn, int which); - -#if 0 -Bool SAVAGECleanupDma(ScrnInfoPtr pScrn); -Bool SAVAGEInitDma(ScrnInfoPtr pScrn, int prim_size); -#endif +void SAVAGEDRIResume( ScreenPtr pScreen ); #define SAVAGE_AGP_1X_MODE 0x01 #define SAVAGE_AGP_2X_MODE 0x02 diff --git a/driver/xf86-video-savage/src/savage_drm.h b/driver/xf86-video-savage/src/savage_drm.h index 62bd49b3e..7d624b566 100644 --- a/driver/xf86-video-savage/src/savage_drm.h +++ b/driver/xf86-video-savage/src/savage_drm.h @@ -22,11 +22,11 @@ * DEALINGS IN THE SOFTWARE. */ -#ifndef __SAVAGE_DRM_H__ -#define __SAVAGE_DRM_H__ +#ifndef SAVAGE_DRM_H +#define SAVAGE_DRM_H -#ifndef __SAVAGE_SAREA_DEFINES__ -#define __SAVAGE_SAREA_DEFINES__ +#ifndef SAVAGE_SAREA_DEFINES +#define SAVAGE_SAREA_DEFINES #define DRM_SAVAGE_MEM_PAGE (1UL<<12) #define DRM_SAVAGE_MEM_WORK 32 @@ -96,7 +96,7 @@ typedef struct drm_savage_get_physcis_address #define SAVAGE_NR_TEX_REGIONS 16 /* num. of global texture manage list element*/ #define SAVAGE_LOG_MIN_TEX_REGION_SIZE 16 /* each region 64K, Jiayo Hsu */ -#endif /* __SAVAGE_SAREA_DEFINES__ */ +#endif /* SAVAGE_SAREA_DEFINES */ /* drm_tex_region_t define in drm.h */ @@ -245,4 +245,4 @@ typedef struct _drm_savage_blit { int source_pitch, dest_pitch; } drm_savage_blit_t; -#endif +#endif /* SAVAGE_DRM_H */ diff --git a/driver/xf86-video-savage/src/savage_exa.c b/driver/xf86-video-savage/src/savage_exa.c index 841129807..613100bb1 100644 --- a/driver/xf86-video-savage/src/savage_exa.c +++ b/driver/xf86-video-savage/src/savage_exa.c @@ -15,7 +15,7 @@ #include "savage_bci.h" #include "savage_streams.h" -#ifdef XF86DRI +#ifdef SAVAGEDRI #define _XF86DRI_SERVER_ #include "savage_dri.h" #endif @@ -441,7 +441,7 @@ SavageUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src, int int i, j, dwords, queue, Bpp; unsigned int cmd; CARD32 * srcp; -#ifdef XF86DRI +#ifdef SAVAGEDRI unsigned int dst_pitch; unsigned int dst_yoffset; int agp_possible; @@ -451,7 +451,7 @@ SavageUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src, int Bpp = pDst->drawable.bitsPerPixel / 8; -#ifdef XF86DRI +#ifdef SAVAGEDRI /* Test for conditions for AGP Mastered Image Transfer (MIT). AGP memory needs to be available, the XVideo AGP needs to be enabled, the framebuffer destination must be a multiple of 32 bytes, and the source @@ -508,7 +508,7 @@ SavageUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src, int return TRUE; } } -#endif /* XF86DRI */ +#endif /* SAVAGEDRI */ /* If we reach here, AGP transfer is not possible, or failed to drmMap() */ psav->sbd_offset = exaGetPixmapOffset(pDst); @@ -542,7 +542,7 @@ SavageUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src, int if (4 * dwords <= queue) { /* WARNING: breaking BCI_PTR abstraction here */ - memcpy(bci_ptr, srcp, 4 * dwords); + memcpy((CARD32 *)bci_ptr, srcp, 4 * dwords); bci_ptr += dwords; queue -= 4 * dwords; } else { @@ -567,7 +567,6 @@ SavageUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src, int Bool SavageDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, char *dst, int dst_pitch) { - ScrnInfoPtr pScrn = xf86Screens[pSrc->drawable.pScreen->myNum]; unsigned char *src = pSrc->devPrivate.ptr; int src_pitch = exaGetPixmapPitch(pSrc); int bpp = pSrc->drawable.bitsPerPixel; diff --git a/driver/xf86-video-savage/src/savage_hwmc.c b/driver/xf86-video-savage/src/savage_hwmc.c index abfe805cb..ed881b4db 100644 --- a/driver/xf86-video-savage/src/savage_hwmc.c +++ b/driver/xf86-video-savage/src/savage_hwmc.c @@ -29,7 +29,6 @@ #include "xf86.h" #include "xf86_OSproc.h" #include "compiler.h" -#include "xf86PciInfo.h" #include "xf86Pci.h" #include "xf86fbman.h" #include "regionstr.h" @@ -224,7 +223,7 @@ Bool SAVAGEInitMC(ScreenPtr pScreen) * Set *num_priv to the number of 32bit words that make up the size of * of the data that priv will point to. * - * *priv = (long *) xcalloc (elements, sizeof(element)) + * *priv = (long *) calloc (elements, sizeof(element)) * *num_priv = (elements * sizeof(element)) >> 2; * **************************************************************************/ @@ -253,7 +252,7 @@ int SAVAGEXvMCCreateContext (ScrnInfoPtr pScrn, XvMCContextPtr pContext, return BadAlloc; } - *priv = xcalloc(1,sizeof(SAVAGEXvMCCreateContextRec)); + *priv = calloc(1,sizeof(SAVAGEXvMCCreateContextRec)); contextRec = (SAVAGEXvMCCreateContextRec *)*priv; if(!*priv) { @@ -266,7 +265,7 @@ int SAVAGEXvMCCreateContext (ScrnInfoPtr pScrn, XvMCContextPtr pContext, if(drmCreateContext(pSAVAGE->drmFD, &(contextRec->drmcontext) ) < 0) { xf86DrvMsg(X_ERROR, pScrn->scrnIndex, "SAVAGEXvMCCreateContext: Unable to create DRMContext!\n"); - xfree(*priv); + free(*priv); return(BadAlloc); } @@ -310,7 +309,7 @@ int SAVAGEXvMCCreateSurface (ScrnInfoPtr pScrn, XvMCSurfacePtr pSurf, /* This size is used for flip, mixer, subpicture and palette buffers*/ unsigned int offset = ((786*576*2 + 2048)*5 + 2048) & 0xfffff800; - *priv = (long *)xcalloc(2,sizeof(long)); + *priv = (long *)calloc(2,sizeof(long)); if(!*priv) { xf86DrvMsg(X_ERROR, pScrn->scrnIndex, @@ -340,7 +339,7 @@ int SAVAGEXvMCCreateSubpicture (ScrnInfoPtr pScrn, XvMCSubpicturePtr pSubp, SavagePtr pSAVAGE = SAVPTR(pScrn); int i; - *priv = (long *)xcalloc(1,sizeof(long)); + *priv = (long *)calloc(1,sizeof(long)); if(!*priv) { xf86DrvMsg(X_ERROR, pScrn->scrnIndex, diff --git a/driver/xf86-video-savage/src/savage_i2c.c b/driver/xf86-video-savage/src/savage_i2c.c index d8eb46b4c..b5739a29d 100644 --- a/driver/xf86-video-savage/src/savage_i2c.c +++ b/driver/xf86-video-savage/src/savage_i2c.c @@ -32,11 +32,6 @@ in this Software without prior written authorization from the XFree86 Project. #include "xf86_OSproc.h" #include "compiler.h" -#include "xf86Pci.h" -#include "xf86PciInfo.h" - -#include "vgaHW.h" - #include "savage_driver.h" static void diff --git a/driver/xf86-video-savage/src/savage_pciids.h b/driver/xf86-video-savage/src/savage_pciids.h new file mode 100644 index 000000000..cad51723a --- /dev/null +++ b/driver/xf86-video-savage/src/savage_pciids.h @@ -0,0 +1,55 @@ +/* + * Copyright 2011 X.Org Foundation + * + * 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, + * FITESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + +#ifndef SAVAGE_PCIIDS_H +#define SAVAGE_PCIIDS_H + +#define PCI_CHIP_SAVAGE3D 0x8A20 +#define PCI_CHIP_SAVAGE3D_MV 0x8A21 +#define PCI_CHIP_SAVAGE4 0x8A22 +#define PCI_CHIP_PROSAVAGE_PM 0x8A25 +#define PCI_CHIP_PROSAVAGE_KM 0x8A26 +#define PCI_CHIP_SAVAGE_MX_MV 0x8C10 +#define PCI_CHIP_SAVAGE_MX 0x8C11 +#define PCI_CHIP_SAVAGE_IX_MV 0x8C12 +#define PCI_CHIP_SAVAGE_IX 0x8C13 +#define PCI_CHIP_SUPSAV_MX128 0x8C22 +#define PCI_CHIP_SUPSAV_MX64 0x8C24 +#define PCI_CHIP_SUPSAV_MX64C 0x8C26 +#define PCI_CHIP_SUPSAV_IX128SDR 0x8C2A +#define PCI_CHIP_SUPSAV_IX128DDR 0x8C2B +#define PCI_CHIP_SUPSAV_IX64SDR 0x8C2C +#define PCI_CHIP_SUPSAV_IX64DDR 0x8C2D +#define PCI_CHIP_SUPSAV_IXCSDR 0x8C2E +#define PCI_CHIP_SUPSAV_IXCDDR 0x8C2F +#define PCI_CHIP_S3TWISTER_P 0x8D01 +#define PCI_CHIP_S3TWISTER_K 0x8D02 +#define PCI_CHIP_PROSAVAGE_DDR 0x8D03 +#define PCI_CHIP_PROSAVAGE_DDRK 0x8D04 +#define PCI_CHIP_SAVAGE2000 0x9102 + +#endif /* SAVAGE_PCIIDS_H */ diff --git a/driver/xf86-video-savage/src/savage_regs.h b/driver/xf86-video-savage/src/savage_regs.h index 26cc2da44..1a71c4e42 100644 --- a/driver/xf86-video-savage/src/savage_regs.h +++ b/driver/xf86-video-savage/src/savage_regs.h @@ -1,6 +1,6 @@ -#ifndef _SAVAGE_REGS_H -#define _SAVAGE_REGS_H +#ifndef SAVAGE_REGS_H +#define SAVAGE_REGS_H /* Copied and renamed from radeon_reg.h for AGP/PCI detection. */ #define SAVAGE_STATUS_PCI_CONFIG 0x06 @@ -285,4 +285,4 @@ do { \ #define EC1_CENTER_ON 0x10 #define EC1_EXPAND_ON 0x0c -#endif /* _SAVAGE_REGS_H */ +#endif /* SAVAGE_REGS_H */ diff --git a/driver/xf86-video-savage/src/savage_sarea.h b/driver/xf86-video-savage/src/savage_sarea.h index 1debc6dcf..e2ea3e551 100644 --- a/driver/xf86-video-savage/src/savage_sarea.h +++ b/driver/xf86-video-savage/src/savage_sarea.h @@ -23,11 +23,11 @@ * DEALINGS IN THE SOFTWARE. */ -#ifndef __SAVAGE_SAREA_H__ -#define __SAVAGE_SAREA_H__ +#ifndef SAVAGE_SAREA_H +#define SAVAGE_SAREA_H -#ifndef __SAVAGE_SAREA_DEFINES__ -#define __SAVAGE_SAREA_DEFINES__ +#ifndef SAVAGE_SAREA_DEFINES +#define SAVAGE_SAREA_DEFINES /* 2 heaps (1 for card, 1 for agp), each divided into upto 128 * regions, subject to a minimum region size of (1<<16) == 64k. @@ -42,7 +42,7 @@ #define SAVAGE_NR_TEX_REGIONS 16 #define SAVAGE_LOG_MIN_TEX_REGION_SIZE 16 -#endif /* __SAVAGE_SAREA_DEFINES__ */ +#endif /* SAVAGE_SAREA_DEFINES */ typedef struct { /* LRU lists for texture memory in agp space and on the card. @@ -55,4 +55,4 @@ typedef struct { int ctxOwner; } SAVAGESAREAPrivRec, *SAVAGESAREAPrivPtr; -#endif /* __SAVAGE_SAREA_H__ */ +#endif /* SAVAGE_SAREA_H */ diff --git a/driver/xf86-video-savage/src/savage_streams.h b/driver/xf86-video-savage/src/savage_streams.h index ad16ad757..9968a1a47 100644 --- a/driver/xf86-video-savage/src/savage_streams.h +++ b/driver/xf86-video-savage/src/savage_streams.h @@ -1,6 +1,5 @@ -#ifndef __SAVAGE_STREAMS_H__ - -# define __SAVAGE_STREAMS_H__ +#ifndef SAVAGE_STREAMS_H +#define SAVAGE_STREAMS_H /************************************** S3 streams processor @@ -220,4 +219,4 @@ #define SSTREAMS_MODE(bpp) (bpp > 16 ? (bpp > 24 ? STREAMS_MODE32 :\ STREAMS_MODE24) : STREAMS_MODE16) -#endif /*__SAVAGE_STREAMS_H__*/ +#endif /* SAVAGE_STREAMS_H */ diff --git a/driver/xf86-video-savage/src/savage_vbe.c b/driver/xf86-video-savage/src/savage_vbe.c index afbaa8f93..d24da2433 100644 --- a/driver/xf86-video-savage/src/savage_vbe.c +++ b/driver/xf86-video-savage/src/savage_vbe.c @@ -229,13 +229,13 @@ SavageFreeBIOSModeTable( SavagePtr psav, SavageModeTablePtr* ppTable ) { if( pMode->RefreshRate ) { - xfree( pMode->RefreshRate ); + free( pMode->RefreshRate ); pMode->RefreshRate = NULL; } pMode++; } - xfree( *ppTable ); + free( *ppTable ); } @@ -246,7 +246,7 @@ SavageGetBIOSModeTable( SavagePtr psav, int iDepth ) SavageModeTablePtr pTable; pTable = (SavageModeTablePtr) - xcalloc( 1, sizeof(SavageModeTableRec) + + calloc( 1, sizeof(SavageModeTableRec) + (nModes-1) * sizeof(SavageModeEntry) ); if( pTable ) { pTable->NumModes = nModes; @@ -346,7 +346,7 @@ SavageGetBIOSModes( if( s3vModeTable->RefreshRate ) { s3vModeTable->RefreshRate = (unsigned char *) - xrealloc( + realloc( s3vModeTable->RefreshRate, (iRefresh+8) * sizeof(unsigned char) ); @@ -354,7 +354,7 @@ SavageGetBIOSModes( else { s3vModeTable->RefreshRate = (unsigned char *) - xcalloc( + calloc( sizeof(unsigned char), (iRefresh+8) ); diff --git a/driver/xf86-video-savage/src/savage_vbe.h b/driver/xf86-video-savage/src/savage_vbe.h index 9b06e0cb4..45d4a5144 100644 --- a/driver/xf86-video-savage/src/savage_vbe.h +++ b/driver/xf86-video-savage/src/savage_vbe.h @@ -12,8 +12,8 @@ versions as being modified. This software has NO WARRANTY. Use it at your own risk. */ -#ifndef _SAVAGEVBE_H -#define _SAVAGEVBE_H +#ifndef SAVAGEVBE_H +#define SAVAGEVBE_H /* * Common BIOS functions @@ -161,4 +161,4 @@ struct vbe_palette_entry unsigned char align; } __attribute__ ((packed)); -#endif +#endif /* SAVAGEVBE_H */ diff --git a/driver/xf86-video-savage/src/savage_video.c b/driver/xf86-video-savage/src/savage_video.c index 3b991e89b..b5a633053 100644 --- a/driver/xf86-video-savage/src/savage_video.c +++ b/driver/xf86-video-savage/src/savage_video.c @@ -247,7 +247,7 @@ typedef struct { void *video_planarmem; /* opaque memory management information structure */ CARD32 video_planarbuf; /* offset in video memory of planar YV12 buffer */ -#ifdef XF86DRI +#ifdef SAVAGEDRI Bool tried_agp; /* TRUE if AGP allocation has been tried */ CARD32 agpBase; /* Physical address of aperture base */ CARD32 agpBufferOffset; /* Offset of buffer in AGP memory, or 0 if unavailable */ @@ -384,7 +384,7 @@ void SavageInitVideo(ScreenPtr pScreen) adaptors = &newAdaptor; } else { newAdaptors = /* need to free this someplace */ - xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); + malloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); if(newAdaptors) { memcpy(newAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr)); @@ -399,7 +399,7 @@ void SavageInitVideo(ScreenPtr pScreen) xf86XVScreenInit(pScreen, adaptors, num_adaptors); if(newAdaptors) - xfree(newAdaptors); + free(newAdaptors); if( newAdaptor ) { @@ -884,7 +884,7 @@ SavageSetupImageVideo(ScreenPtr pScreen) xf86ErrorFVerb(XVTRACE,"SavageSetupImageVideo\n"); - if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + + if(!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec) + sizeof(SavagePortPrivRec) + sizeof(DevUnion)))) return NULL; @@ -1038,7 +1038,6 @@ SavageStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown) { SavagePortPrivPtr pPriv = (SavagePortPrivPtr)data; SavagePtr psav = SAVPTR(pScrn); - ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; xf86ErrorFVerb(XVTRACE,"SavageStopVideo\n"); @@ -1048,7 +1047,7 @@ SavageStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown) /*SavageClipVWindow(pScrn);*/ SavageStreamsOff( pScrn ); -#ifdef XF86DRI +#ifdef SAVAGEDRI if (pPriv->agpBufferMap != NULL) { SAVAGEDRIServerPrivatePtr pSAVAGEDRIServer = psav->DRIServerInfo; @@ -1214,7 +1213,6 @@ SavageCopyPlanarDataBCI( unsigned long offsetV = offsetY + srcPitch * h; unsigned long offsetU = offsetV + srcPitch2 * (h>>1); unsigned long dstOffset = (unsigned long)dst - (unsigned long)psav->FBBase; - int i; unsigned char memType; BCI_GET_PTR; @@ -1505,14 +1503,17 @@ SavageDisplayVideoOld( } if (S3_MOBILE_TWISTER_SERIES(psav->Chipset) - && psav->FPExpansion) { - drw_w = (((float)(drw_w * psav->XExp1)/(float)psav->XExp2)+1); - drw_h = (float)(drw_h * psav->YExp1)/(float)psav->YExp2+1; - dstBox->x1 = (float)(dstBox->x1 * psav->XExp1)/(float)psav->XExp2; - dstBox->y1 = (float)(dstBox->y1 * psav->YExp1)/(float)psav->YExp2; - - dstBox->x1 += psav->displayXoffset; - dstBox->y1 += psav->displayYoffset; + && psav->FPExpansion) { + drw_w = (drw_w * psav->XExp1) / psav->XExp2 + 1; + drw_h = (drw_h * psav->YExp1) / psav->YExp2 + 1; + dstBox->x1 = (dstBox->x1 * psav->XExp1) / psav->XExp2; + dstBox->y1 = (dstBox->y1 * psav->YExp1) / psav->YExp2; + dstBox->x2 = (dstBox->x2 * psav->XExp1) / psav->XExp2; + dstBox->y2 = (dstBox->y2 * psav->YExp1) / psav->YExp2; + dstBox->x1 += psav->displayXoffset; + dstBox->y1 += psav->displayYoffset; + dstBox->x2 += psav->displayXoffset; + dstBox->y2 += psav->displayYoffset; } /* @@ -1666,12 +1667,16 @@ SavageDisplayVideoNew( !psav->CrtOnly && !psav->TvOn) { - drw_w = (drw_w * psav->XExp1)/psav->XExp2 + 1; - drw_h = (drw_h * psav->YExp1)/psav->YExp2 + 1; - dstBox->x1 = (dstBox->x1 * psav->XExp1)/psav->XExp2; - dstBox->y1 = (dstBox->y1 * psav->YExp1)/psav->YExp2; + drw_w = (drw_w * psav->XExp1) / psav->XExp2 + 1; + drw_h = (drw_h * psav->YExp1) / psav->YExp2 + 1; + dstBox->x1 = (dstBox->x1 * psav->XExp1) / psav->XExp2; + dstBox->y1 = (dstBox->y1 * psav->YExp1) / psav->YExp2; + dstBox->x2 = (dstBox->x2 * psav->XExp1) / psav->XExp2; + dstBox->y2 = (dstBox->y2 * psav->YExp1) / psav->YExp2; dstBox->x1 += psav->displayXoffset; dstBox->y1 += psav->displayYoffset; + dstBox->x2 += psav->displayXoffset; + dstBox->y2 += psav->displayYoffset; } if (psav->IsSecondary) { @@ -1973,9 +1978,8 @@ SavagePutImage( /* Check whether AGP buffers can be allocated. If not, fall back to ordinary upload to framebuffer (slower) */ -#ifdef XF86DRI +#ifdef SAVAGEDRI if (!pPriv->tried_agp && !psav->IsPCI && psav->drmFD > 0 && psav->DRIServerInfo != NULL) { - int ret; SAVAGEDRIServerPrivatePtr pSAVAGEDRIServer = psav->DRIServerInfo; pPriv->tried_agp = TRUE; @@ -2003,14 +2007,14 @@ SavagePutImage( /* This situation is expected if AGPforXv is disabled, otherwise report. */ if (pSAVAGEDRIServer->agpXVideo.size > 0) { xf86DrvMsg( pScreen->myNum, X_ERROR, - "[agp] XVideo: not enough space in buffer (got %ld bytes, required %ld bytes).\n", - pSAVAGEDRIServer->agpXVideo.size, max(new_size, planarFrameSize)); + "[agp] XVideo: not enough space in buffer (got %ld bytes, required %d bytes).\n", + (long int)pSAVAGEDRIServer->agpXVideo.size, max(new_size, planarFrameSize)); } pPriv->agpBufferMap = NULL; pPriv->agpBufferOffset = 0; } } -#endif /* XF86DRI */ +#endif /* SAVAGEDRI */ /* Buffer for final packed frame */ @@ -2056,7 +2060,7 @@ SavagePutImage( offsetV += tmp; nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top; if (S3_SAVAGE4_SERIES(psav->Chipset) && psav->BCIforXv && (npixels & 0xF) == 0 && pPriv->video_planarbuf != 0) { -#ifdef XF86DRI +#ifdef SAVAGEDRI if (pPriv->agpBufferMap != NULL) { /* Using copy to AGP memory */ SavageCopyPlanarDataBCI( @@ -2069,7 +2073,7 @@ SavagePutImage( pPriv->agpBase + pPriv->agpBufferOffset, srcPitch, srcPitch2, dstPitch, nlines, npixels, TRUE); } else -#endif /* XF86DRI */ +#endif /* SAVAGEDRI */ { /* Using ordinary copy to framebuffer */ SavageCopyPlanarDataBCI( @@ -2208,18 +2212,18 @@ SavageAllocateSurface( surface->width = w; surface->height = h; - if(!(surface->pitches = xalloc(sizeof(int)))) { + if(!(surface->pitches = malloc(sizeof(int)))) { SavageFreeMemory(pScrn, surface_memory); return BadAlloc; } - if(!(surface->offsets = xalloc(sizeof(int)))) { - xfree(surface->pitches); + if(!(surface->offsets = malloc(sizeof(int)))) { + free(surface->pitches); SavageFreeMemory(pScrn, surface_memory); return BadAlloc; } - if(!(pPriv = xalloc(sizeof(OffscreenPrivRec)))) { - xfree(surface->pitches); - xfree(surface->offsets); + if(!(pPriv = malloc(sizeof(OffscreenPrivRec)))) { + free(surface->pitches); + free(surface->offsets); SavageFreeMemory(pScrn, surface_memory); return BadAlloc; } @@ -2264,9 +2268,9 @@ SavageFreeSurface( if(pPriv->isOn) SavageStopSurface(surface); SavageFreeMemory(pScrn, pPriv->surface_memory); - xfree(surface->pitches); - xfree(surface->offsets); - xfree(surface->devPrivate.ptr); + free(surface->pitches); + free(surface->offsets); + free(surface->devPrivate.ptr); return Success; } @@ -2335,7 +2339,7 @@ SavageDisplaySurface( surface->width, surface->height, surface->pitches[0], x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); - xf86XVFillKeyHelper(pScrn->pScreen, portPriv->colorKey, clipBoxes); + xf86XVFillKeyHelper(pScreen, portPriv->colorKey, clipBoxes); pPriv->isOn = TRUE; #if 0 @@ -2359,7 +2363,7 @@ SavageInitOffscreenImages(ScreenPtr pScreen) /* need to free this someplace */ if (!psav->offscreenImages) { - if(!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) + if(!(offscreenImages = malloc(sizeof(XF86OffscreenImageRec)))) return; psav->offscreenImages = offscreenImages; } else { |