? 20040814duoview.diff
? Makefile
? savage.4.html
? savage._man
? savage_streams.c
? savage_streams.h
Index: Imakefile
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile,v
retrieving revision 1.2
diff -u -r1.2 Imakefile
--- Imakefile 22 Feb 2004 16:14:42 -0000 1.2
+++ Imakefile 15 Aug 2004 19:18:35 -0000
@@ -28,8 +28,8 @@
#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
+DRIINCLUDES = -I$(SERVERSRC)/GL/dri -I$(LIBSRC)/GL/dri -I$(LIBSRC)/GL/dri/drm \
+ -I$(XF86OSSRC)/linux/drm/kernel -I$(TOP)/include -I$(DRMSRCDIR)/shared
DRIDEFINES = $(GLX_DEFINES)
#endif
@@ -42,6 +42,7 @@
savage_shadow.c \
savage_vbe.c \
savage_video.c \
+ savage_streams.c \
savage_hwmc.c \
$(DRISRCS)
@@ -54,6 +55,7 @@
savage_shadow.o \
savage_vbe.o \
savage_video.o \
+ savage_streams.o \
savage_hwmc.o \
$(DRIOBJS)
@@ -98,8 +100,8 @@
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_dri.c,$(DRIVERSDKDIR)/drivers/savage)
+InstallDriverSDKNonExecFile(savage_dri.h,$(DRIVERSDKDIR)/drivers/savage)
InstallDriverSDKNonExecFile(savage_i2c.c,$(DRIVERSDKDIR)/drivers/savage)
InstallDriverSDKNonExecFile(savage_image.c,$(DRIVERSDKDIR)/drivers/savage)
InstallDriverSDKNonExecFile(savage_regs.h,$(DRIVERSDKDIR)/drivers/savage)
@@ -107,6 +109,8 @@
InstallDriverSDKNonExecFile(savage_vbe.c,$(DRIVERSDKDIR)/drivers/savage)
InstallDriverSDKNonExecFile(savage_vbe.h,$(DRIVERSDKDIR)/drivers/savage)
InstallDriverSDKNonExecFile(savage_video.c,$(DRIVERSDKDIR)/drivers/savage)
+InstallDriverSDKNonExecFile(savage_streams.h,$(DRIVERSDKDIR)/drivers/savage)
+InstallDriverSDKNonExecFile(savage_streams.c,$(DRIVERSDKDIR)/drivers/savage)
InstallDriverSDKNonExecFile(savage_hwmc.c,$(DRIVERSDKDIR)/drivers/savage)
InstallDriverSDKNonExecFile(savage.cpp,$(DRIVERSDKDIR)/drivers/savage)
Index: savage.man
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man,v
retrieving revision 1.3
diff -u -r1.3 savage.man
--- savage.man 23 Mar 2004 21:11:37 -0000 1.3
+++ savage.man 15 Aug 2004 19:18:36 -0000
@@ -1,4 +1,4 @@
-.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man,v 1.6 2002/05/14 20:19:51 alanh Exp $
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man,v 1.7 2003/11/09 20:43:57 dawes Exp $
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
.TH SAVAGE __drivermansuffix__ __vendorversion__
@@ -14,7 +14,7 @@
.fi
.SH DESCRIPTION
.B savage
-is an XFree86 driver for the S3 Savage family video accelerator chips. 2D, 3D, and Xv acceleration
+is an __xservername__ driver for the S3 Savage family video accelerator chips. 2D, 3D, and Xv acceleration
is supported on all chips except the Savage2000 (2D only). The
.B savage
driver supports PCI and AGP boards with the following chips:
@@ -58,7 +58,7 @@
.B ProSavage DDR-K
(8d04) (2D, 3D)
.SH CONFIGURATION DETAILS
-Please refer to XF86Config(__filemansuffix__) for general configuration
+Please refer to __xconfigfile__(__filemansuffix__) for general configuration
details. This section only covers configuration details specific to this
driver.
.PP
@@ -88,8 +88,7 @@
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. This option
+Enable or disable use of the shadow framebuffer layer. This option
disables acceleration. Default: off.
.TP
.BI "Option \*qLCDClock\*q \*q" frequency \*q
@@ -109,7 +108,7 @@
knows how to handle the critical but unusual timing requirements of the
various LCD panels supported by the chip. To do this, the driver searches
through the BIOS mode list, looking for the mode which most closely matches
-the XF86Config mode line. Some purists find this scheme objectionable. If
+the __xconfigfile__ mode line. Some purists find this scheme objectionable. If
you would rather have the
.B savage
driver use your mode line timing exactly, turn off the UseBios option.
@@ -153,8 +152,8 @@
.SH FILES
savage_drv.o
.SH "SEE ALSO"
-XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__)
+__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__)
.SH AUTHORS
Authors include Tim Roberts (timr@probo.com) and Ani Joshi (ajoshi@unixbox.com)
-for the 4.0 version, and Tim Roberts and S. Marineau for the 3.3 driver from
+for this version, and Tim Roberts and S. Marineau for the original driver from
which this was derived.
Index: savage_accel.c
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c,v
retrieving revision 1.19
diff -u -r1.19 savage_accel.c
--- savage_accel.c 26 Mar 2004 17:09:04 -0000 1.19
+++ savage_accel.c 15 Aug 2004 19:18:37 -0000
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c,v 1.14 2001/12/13 18:01:50 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c,v 1.23 2003/12/22 17:48:10 tsi Exp $ */
/*
*
@@ -24,7 +24,7 @@
#include "savage_driver.h"
#include "savage_regs.h"
#include "savage_bci.h"
-#include "savage_dri.h"
+#include "savage_streams.h"
#ifdef XF86DRI
#define _XF86DRI_SERVER_
@@ -54,7 +54,7 @@
ScrnInfoPtr pScrn,
int color,
int rop,
- unsigned planemask);
+ unsigned int planemask);
static void SavageSubsequentSolidFillRect(
ScrnInfoPtr pScrn,
@@ -72,6 +72,7 @@
int err,
int length,
int octant);
+
#if 0
static void SavageSubsequentSolidTwoPointLine(
ScrnInfoPtr pScrn,
@@ -81,13 +82,14 @@
int y2,
int bias);
#endif
+
#if 0
static void SavageSetupForScreenToScreenColorExpand(
ScrnInfoPtr pScrn,
int bg,
int fg,
int rop,
- unsigned planemask);
+ unsigned int planemask);
static void SavageSubsequentScreenToScreenColorExpand(
ScrnInfoPtr pScrn,
@@ -103,7 +105,7 @@
int fg,
int bg,
int rop,
- unsigned planemask);
+ unsigned int planemask);
static void SavageSubsequentScanlineCPUToScreenColorExpandFill(
ScrnInfoPtr pScrn,
@@ -124,7 +126,7 @@
int fg,
int bg,
int rop,
- unsigned planemask);
+ unsigned int planemask);
static void SavageSubsequentMono8x8PatternFillRect(
ScrnInfoPtr pScrn,
@@ -135,6 +137,7 @@
int w,
int h);
+#if 0
static void SavageSetupForColor8x8PatternFill(
ScrnInfoPtr pScrn,
int patternx,
@@ -151,6 +154,7 @@
int y,
int w,
int h);
+#endif
static void SavageSetClippingRectangle(
ScrnInfoPtr pScrn,
@@ -477,8 +481,8 @@
if (psav->Chipset == S3_SAVAGE4) {
bci_enable = BCI_ENABLE;
- tile16 = TILE_FORMAT_DESTINATION16;
- tile32 = TILE_FORMAT_DESTINATION32;
+ tile16 = TILE_FORMAT_16BPP;
+ tile32 = TILE_FORMAT_32BPP;
} else {
bci_enable = BCI_ENABLE_TWISTER;
tile16 = TILE_DESTINATION;
@@ -644,8 +648,8 @@
int bci_enable, tile16, tile32;
bci_enable = BCI_ENABLE;
- tile16 = TILE_FORMAT_DESTINATION16;
- tile32 = TILE_FORMAT_DESTINATION32;
+ tile16 = TILE_FORMAT_16BPP;
+ tile32 = TILE_FORMAT_32BPP;
/* following is the enable case */
@@ -701,11 +705,11 @@
#endif
/* MM81C0 and 81C4 are used to control primary stream. */
- OUTREG32(PRI_STREAM_FBUF_ADDR0,0x00000000);
- OUTREG32(PRI_STREAM_FBUF_ADDR1,0x00000000);
- OUTREG32(PRI_STREAM2_FBUF_ADDR0,0x00000000);
- OUTREG32(PRI_STREAM2_FBUF_ADDR1,0x00000000);
-
+ OUTREG32(PRI_STREAM_FBUF_ADDR0,pScrn->fbOffset | 0x80000000);
+ OUTREG32(PRI_STREAM_FBUF_ADDR1,pScrn->fbOffset);
+ OUTREG32(PRI_STREAM2_FBUF_ADDR0,pScrn->fbOffset | 0x80000000);
+ OUTREG32(PRI_STREAM2_FBUF_ADDR1,pScrn->fbOffset);
+
/*
* Program Primary Stream Stride Register.
*
@@ -924,12 +928,11 @@
}
/* MM81C0 and 81C4 are used to control primary stream. */
- /*OUTREG32(PRI_STREAM_FBUF_ADDR0,0x80000000);*/
- OUTREG32(PRI_STREAM_FBUF_ADDR0,0x00000000);
- OUTREG32(PRI_STREAM_FBUF_ADDR1,0x00000000);
- /*OUTREG32(PRI_STREAM2_FBUF_ADDR0,0x80000000);*/
- OUTREG32(PRI_STREAM2_FBUF_ADDR0,0x00000000);
- OUTREG32(PRI_STREAM2_FBUF_ADDR1,0x00000000);
+ OUTREG32(PRI_STREAM_FBUF_ADDR0,pScrn->fbOffset | 0x80000000);
+ OUTREG32(PRI_STREAM_FBUF_ADDR1,pScrn->fbOffset);
+ OUTREG32(PRI_STREAM2_FBUF_ADDR0,pScrn->fbOffset | 0x80000000);
+ OUTREG32(PRI_STREAM2_FBUF_ADDR1,pScrn->fbOffset);
+
OUTREG32(0x8128, 0xFFFFFFFFL);
OUTREG32(0x812C, 0xFFFFFFFFL);
@@ -1096,7 +1099,10 @@
#if 1
xaaptr->SetupForScreenToScreenCopy = SavageSetupForScreenToScreenCopy;
xaaptr->SubsequentScreenToScreenCopy = SavageSubsequentScreenToScreenCopy;
- xaaptr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | ROP_NEEDS_SOURCE;
+ xaaptr->ScreenToScreenCopyFlags = 0
+ | NO_TRANSPARENCY
+ | NO_PLANEMASK
+ | ROP_NEEDS_SOURCE;
#endif
@@ -1137,7 +1143,7 @@
* error, it seems hardly worth the trouble.
*/
-#if 1
+#if 0
if( (psav->Chipset == S3_SAVAGE3D) || (psav->Chipset == S3_SAVAGE4) )
{
xaaptr->SetupForColor8x8PatternFill =
@@ -1158,12 +1164,11 @@
xaaptr->SolidLineFlags = NO_PLANEMASK;
xaaptr->SetupForSolidLine = SavageSetupForSolidFill;
xaaptr->SubsequentSolidBresenhamLine = SavageSubsequentSolidBresenhamLine;
- /*xaaptr->SubsequentSolidTwoPointLine = SavageSubsequentSolidTwoPointLine;*/
#if 0
xaaptr->SubsequentSolidFillTrap = SavageSubsequentSolidFillTrap;
#endif
- xaaptr->SolidBresenhamLineErrorTermBits = 14;
+ xaaptr->SolidBresenhamLineErrorTermBits = 13;
#endif
/* ImageWrite */
@@ -1541,7 +1546,7 @@
*/
static int
-SavageHelpPatternROP(ScrnInfoPtr pScrn, int *fg, int *bg, int pm, int *rop)
+SavageHelpPatternROP(ScrnInfoPtr pScrn, int *fg, int *bg, unsigned int pm, int *rop)
{
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
int ret = 0;
@@ -1576,7 +1581,7 @@
static int
-SavageHelpSolidROP(ScrnInfoPtr pScrn, int *fg, int pm, int *rop)
+SavageHelpSolidROP(ScrnInfoPtr pScrn, int *fg, unsigned int pm, int *rop)
{
XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
int ret = 0;
@@ -1669,7 +1674,7 @@
psav->WaitQueue(psav,6);
BCI_SEND(psav->SavedBciCmd);
- if (psav->SavedBgColor != -1)
+ if (psav->SavedBgColor != 0xffffffff)
BCI_SEND(psav->SavedBgColor);
BCI_SEND(BCI_X_Y(x1, y1));
BCI_SEND(BCI_X_Y(x2, y2));
@@ -1686,7 +1691,7 @@
ScrnInfoPtr pScrn,
int color,
int rop,
- unsigned planemask)
+ unsigned int planemask)
{
SavagePtr psav = SAVPTR(pScrn);
XAAInfoRecPtr xaaptr = GET_XAAINFORECPTR_FROM_SCRNINFOPTR( pScrn );
@@ -1703,7 +1708,7 @@
{
if( color == 0 )
rop = GXclear;
- else if( color == xaaptr->FullPlanemask )
+ else if( (unsigned int)color == xaaptr->FullPlanemask )
rop = GXset;
}
@@ -1749,7 +1754,7 @@
int bg,
int fg,
int rop,
- unsigned planemask)
+ unsigned int planemask)
{
/* SavagePtr psav = SAVPTR(pScrn); */
}
@@ -1774,7 +1779,7 @@
int fg,
int bg,
int rop,
- unsigned planemask)
+ unsigned int planemask)
{
SavagePtr psav = SAVPTR(pScrn);
int cmd;
@@ -1824,7 +1829,7 @@
w = (w + 31) & ~31;
if( psav->SavedBciCmd & BCI_CMD_SEND_COLOR )
BCI_SEND(psav->SavedFgColor);
- if( psav->SavedBgColor != -1 )
+ if( psav->SavedBgColor != 0xffffffff )
BCI_SEND(psav->SavedBgColor);
BCI_SEND(BCI_X_Y(x, y));
BCI_SEND(BCI_W_H(w, 1));
@@ -1876,7 +1881,7 @@
int fg,
int bg,
int rop,
- unsigned planemask)
+ unsigned int planemask)
{
SavagePtr psav = SAVPTR(pScrn);
int cmd;
@@ -1927,7 +1932,7 @@
BCI_SEND(psav->SavedBciCmd);
if( psav->SavedBciCmd & BCI_CMD_SEND_COLOR )
BCI_SEND(psav->SavedFgColor);
- if( psav->SavedBgColor != -1 )
+ if( psav->SavedBgColor != 0xffffffff )
BCI_SEND(psav->SavedBgColor);
BCI_SEND(BCI_X_Y(x, y));
BCI_SEND(BCI_W_H(w, h));
@@ -1939,6 +1944,7 @@
}
+#if 0
static void
SavageSetupForColor8x8PatternFill(
ScrnInfoPtr pScrn,
@@ -1951,7 +1957,6 @@
SavagePtr psav = SAVPTR(pScrn);
int cmd;
- int mix;
unsigned int bd;
int pat_offset;
@@ -1963,8 +1968,7 @@
cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP
| BCI_CMD_DEST_GBD | BCI_CMD_PAT_PBD_COLOR_NEW;
- /*mix = XAAHelpSolidROP( pScrn, &trans_col, planemask, &rop );*/
- mix = SavageHelpSolidROP( pScrn, &trans_col, planemask, &rop );
+ (void) XAAHelpSolidROP( pScrn, &trans_col, planemask, &rop );
BCI_CMD_SET_ROP(cmd, rop);
bd = BCI_BD_BW_DISABLE;
@@ -2002,6 +2006,7 @@
BCI_SEND(BCI_X_Y(x, y));
BCI_SEND(BCI_W_H(w, h));
}
+#endif
static void
Index: savage_bci.h
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h,v
retrieving revision 1.2
diff -u -r1.2 savage_bci.h
--- savage_bci.h 22 Feb 2004 16:14:42 -0000 1.2
+++ savage_bci.h 15 Aug 2004 19:18:37 -0000
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h,v 1.2 2001/10/01 13:44:09 eich Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_bci.h,v 1.3 2002/05/14 20:19:51 alanh Exp $ */
#ifndef _S3BCI_H_
#define _S3BCI_H_
@@ -15,19 +15,17 @@
*/
-
#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
+#define TILE_FORMAT_16BPP 2
+#define TILE_FORMAT_32BPP 3
/* BD - BCI enable */
/* savage4, MX, IX, 3D */
#define BCI_ENABLE 8
-/* twister, prosavage */
-/* not sure which one supersavage fits into */
+/* twister, prosavage, DDR, supersavage, 2000? */
#define BCI_ENABLE_TWISTER 0
#define S3_BIG_ENDIAN 4
@@ -47,10 +45,10 @@
dword |= (temp & 0xFF0000) >> 8; \
dword |= (temp & 0xFF000000) >> 24; }
-#define BCI_GET_PTR volatile unsigned int * bci_ptr = (unsigned int *) psav->BciMem
-#define BCI_RESET bci_ptr = (unsigned int *) psav->BciMem
+#define BCI_GET_PTR volatile CARD32 * bci_ptr = (CARD32 *) psav->BciMem
+#define BCI_RESET bci_ptr = (CARD32 *) psav->BciMem
-#define BCI_SEND(dw) (*bci_ptr++ = (unsigned int)(dw))
+#define BCI_SEND(dw) (*bci_ptr++ = (CARD32)(dw))
#define BCI_CMD_NOP 0x40000000
#define BCI_CMD_RECT 0x48000000
Index: savage_cursor.c
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c,v
retrieving revision 1.2
diff -u -r1.2 savage_cursor.c
--- savage_cursor.c 22 Feb 2004 16:14:42 -0000 1.2
+++ savage_cursor.c 15 Aug 2004 19:18:37 -0000
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c,v 1.6 2001/11/02 16:24:51 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c,v 1.7 2002/05/14 20:19:51 alanh Exp $ */
/*
* Hardware cursor support for S3 Savage 4.0 driver. Taken with
@@ -62,7 +62,7 @@
HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
HARDWARE_CURSOR_BIT_ORDER_MSBFIRST |
HARDWARE_CURSOR_INVERT_MASK;
-
+#if 0
/*
* The /MX family is apparently unique among the Savages, in that
* the cursor color is always straight RGB. The rest of the Savages
@@ -75,7 +75,10 @@
||
S3_SAVAGE_MOBILE_SERIES(psav->Chipset)
)
- infoPtr->Flags |= HARDWARE_CURSOR_TRUECOLOR_AT_8BPP;
+ infoPtr->Flags |= HARDWARE_CURSOR_TRUECOLOR_AT_8BPP;
+#endif
+ /* With streams engine the Cursor seems to be ALWAYS TrueColor */
+ infoPtr->Flags |= HARDWARE_CURSOR_TRUECOLOR_AT_8BPP;
infoPtr->SetCursorColors = SavageSetCursorColors;
infoPtr->SetCursorPosition = SavageSetCursorPosition;
@@ -120,8 +123,8 @@
SavagePtr psav = SAVPTR(pScrn);
/* Set cursor location in frame buffer. */
- outCRReg( 0x4d, (0xff & psav->CursorKByte));
- outCRReg( 0x4c, (0xff00 & psav->CursorKByte) >> 8);
+ outCRReg( 0x4d, (0xff & (CARD32)psav->CursorKByte));
+ outCRReg( 0x4c, (0xff00 & (CARD32)psav->CursorKByte) >> 8);
/* Upload the cursor image to the frame buffer. */
memcpy(psav->FBBase + psav->CursorKByte * 1024, src, 1024);
@@ -201,11 +204,14 @@
bNeedExtra =
(psav->CursorInfoRec->Flags & HARDWARE_CURSOR_TRUECOLOR_AT_8BPP);
- if(
- S3_SAVAGE_MOBILE_SERIES(psav->Chipset) ||
- (pScrn->depth == 24) ||
- ((pScrn->depth == 8) && bNeedExtra)
- )
+ /* With the streams engine on HW Cursor seems to be 24bpp ALWAYS */
+ if( 1
+#if 0
+ || S3_SAVAGE_MOBILE_SERIES(psav->Chipset) ||
+ (pScrn->depth == 24) ||
+ ((pScrn->depth == 8) && bNeedExtra)
+#endif
+ )
{
/* Do it straight, full 24 bit color. */
@@ -223,6 +229,7 @@
outCRReg(0x4b, bg >> 16);
return;
}
+#if 0
else if( (pScrn->depth == 15) || (pScrn->depth == 16) )
{
if (pScrn->depth == 15) {
@@ -272,4 +279,5 @@
outCRReg(0x4b, bg);
outCRReg(0x4b, bg);
}
+#endif
}
Index: savage_dri.c
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dri.c,v
retrieving revision 1.3
diff -u -r1.3 savage_dri.c
--- savage_dri.c 23 Mar 2004 21:11:37 -0000 1.3
+++ savage_dri.c 15 Aug 2004 19:18:38 -0000
@@ -51,6 +51,7 @@
#include "savage_regs.h"
#include "savage_driver.h"
#include "savage_bci.h"
+#include "savage_streams.h"
#define _XF86DRI_SERVER_
#include "GL/glxtokens.h"
@@ -324,7 +325,7 @@
}
static Bool SAVAGECreateContext( ScreenPtr pScreen, VisualPtr visual,
- drmContext hwContext, void *pVisualConfigPriv,
+ drm_context_t hwContext, void *pVisualConfigPriv,
DRIContextType contextStore )
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
@@ -390,7 +391,7 @@
}
-static void SAVAGEDestroyContext( ScreenPtr pScreen, drmContext hwContext,
+static void SAVAGEDestroyContext( ScreenPtr pScreen, drm_context_t hwContext,
DRIContextType contextStore )
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
@@ -823,7 +824,7 @@
pSAVAGEDRIServer->registers.size = SAVAGEIOMAPSIZE;
if ( drmAddMap( psav->drmFD,
- (drmHandle)psav->MmioBase,
+ (drm_handle_t)psav->MmioBase,
pSAVAGEDRIServer->registers.size,
DRM_REGISTERS,0,
&pSAVAGEDRIServer->registers.handle ) < 0 ) {
@@ -835,7 +836,7 @@
pSAVAGEDRIServer->aperture.size = 5 * 0x01000000;
if ( drmAddMap( psav->drmFD,
- (drmHandle)(psav->ApertureBase),
+ (drm_handle_t)(psav->ApertureBase),
pSAVAGEDRIServer->aperture.size,
DRM_FRAME_BUFFER,0,
&pSAVAGEDRIServer->aperture.handle ) < 0 ) {
@@ -1303,98 +1304,81 @@
pSAVAGEDRI->frontPitch = pSAVAGEDRIServer->frontPitch;
pSAVAGEDRI->IsfrontTiled = psav->bTiled; /* AGD: was 0 */
+ if(pSAVAGEDRI->cpp==2)
+ TileStride = (pSAVAGEDRI->width+63)&(~63);
+ else
+ TileStride = (pSAVAGEDRI->width+31)&(~31);
+
if(pSAVAGEDRI->IsfrontTiled)
{
- if(pSAVAGEDRI->cpp==2)
- TileStride = (pSAVAGEDRI->width+63)&(~63);
- else
- TileStride = (pSAVAGEDRI->width+31)&(~31);
if ((psav->Chipset == S3_TWISTER)
|| (psav->Chipset == S3_PROSAVAGE)
|| (psav->Chipset == S3_PROSAVAGEDDR)
|| (psav->Chipset == S3_SUPERSAVAGE))
{
- pSAVAGEDRI->frontBitmapDesc = 0x10000000 | /* block write disabled */
+ pSAVAGEDRI->frontBitmapDesc = BCI_BD_BW_DISABLE | /* block write disabled */
(1<<24) | /* destination tile format */
(pScrn->bitsPerPixel<<16) | /* bpp */
TileStride; /* stride */
+ pSAVAGEDRI->frontPitch = TileStride; /* is this needed? */
} else {
- pSAVAGEDRI->frontBitmapDesc = 0x10000000 | /* block write disabled */
+ pSAVAGEDRI->frontBitmapDesc = BCI_BD_BW_DISABLE | /* block write disabled */
((pSAVAGEDRI->cpp==2)?
BCI_BD_TILE_16:BCI_BD_TILE_32) | /*16/32 bpp tile format */
(pScrn->bitsPerPixel<<16) | /* bpp */
TileStride; /* stride */
- pSAVAGEDRI->frontPitch = TileStride;
+ pSAVAGEDRI->frontPitch = TileStride; /* is this needed? */
}
}
else
{
- pSAVAGEDRI->frontBitmapDesc = 0x10000000 | /* AGD: block write should be disabled: was 0x00000000 */
+ pSAVAGEDRI->frontBitmapDesc = BCI_BD_BW_DISABLE |
pScrn->bitsPerPixel<<16 |
pSAVAGEDRI->width;
}
-
- pSAVAGEDRI->backOffset = pSAVAGEDRIServer->backOffset;
- pSAVAGEDRI->backbufferSize = pSAVAGEDRIServer->backbufferSize;
- pSAVAGEDRI->backbuffer = psav->FrameBufferBase +
- pSAVAGEDRI->backOffset;
- pSAVAGEDRI->backPitch = pSAVAGEDRIServer->backPitch;
{
- if(pSAVAGEDRI->cpp==2)
- TileStride = (pSAVAGEDRI->width+63)&(~63);
- else
- TileStride = (pSAVAGEDRI->width+31)&(~31);
if ((psav->Chipset == S3_TWISTER)
|| (psav->Chipset == S3_PROSAVAGE)
|| (psav->Chipset == S3_PROSAVAGEDDR)
- || (psav->Chipset == S3_SUPERSAVAGE)) /* AGD: supersavage may work like savage4/MX/IX, I just don't know. */
- { /* It's here since the 2D driver sets it up like prosavage */
- pSAVAGEDRI->backBitmapDesc = 0x10000000 |
+ || (psav->Chipset == S3_SUPERSAVAGE))
+ {
+ pSAVAGEDRI->backBitmapDesc = BCI_BD_BW_DISABLE |
(1<<24) |
(pScrn->bitsPerPixel<<16) |
TileStride;
+ pSAVAGEDRI->depthBitmapDesc = BCI_BD_BW_DISABLE |
+ (1<<24) |
+ (pScrn->bitsPerPixel<<16) |
+ TileStride;
} else {
- pSAVAGEDRI->backBitmapDesc = 0x10000000 |
+ pSAVAGEDRI->backBitmapDesc = BCI_BD_BW_DISABLE |
((pSAVAGEDRI->cpp==2)?
BCI_BD_TILE_16:BCI_BD_TILE_32) |
(pScrn->bitsPerPixel<<16) |
TileStride;
+ pSAVAGEDRI->depthBitmapDesc = BCI_BD_BW_DISABLE |
+ ((pSAVAGEDRI->zpp==2)?
+ BCI_BD_TILE_16:BCI_BD_TILE_32) |
+ (pScrn->bitsPerPixel<<16) |
+ TileStride;
}
}
+ pSAVAGEDRI->backOffset = pSAVAGEDRIServer->backOffset;
+ pSAVAGEDRI->backbufferSize = pSAVAGEDRIServer->backbufferSize;
+ pSAVAGEDRI->backbuffer = psav->FrameBufferBase +
+ pSAVAGEDRI->backOffset;
+ pSAVAGEDRI->backPitch = pSAVAGEDRIServer->backPitch;
+
pSAVAGEDRI->depthOffset = pSAVAGEDRIServer->depthOffset;
pSAVAGEDRI->depthbufferSize = pSAVAGEDRIServer->depthbufferSize;
pSAVAGEDRI->depthbuffer = psav->FrameBufferBase +
pSAVAGEDRI->depthOffset;
pSAVAGEDRI->depthPitch = pSAVAGEDRIServer->depthPitch;
- {
- if(pSAVAGEDRI->zpp==2)
- TileStride = (pSAVAGEDRI->width+63)&(~63);
- else
- TileStride = (pSAVAGEDRI->width+31)&(~31);
-
- if ((psav->Chipset == S3_TWISTER)
- || (psav->Chipset == S3_PROSAVAGE)
- || (psav->Chipset == S3_PROSAVAGEDDR)
- || (psav->Chipset == S3_SUPERSAVAGE))
- {
- pSAVAGEDRI->depthBitmapDesc = 0x10000000 |
- (1<<24) |
- (pScrn->bitsPerPixel<<16) |
- TileStride;
- } else {
- pSAVAGEDRI->depthBitmapDesc = 0x10000000 |
- ((pSAVAGEDRI->zpp==2)?
- BCI_BD_TILE_16:BCI_BD_TILE_32) |
- (pScrn->bitsPerPixel<<16) |
- TileStride;
- }
- }
-
pSAVAGEDRI->textureOffset = pSAVAGEDRIServer->textureOffset;
pSAVAGEDRI->textures = psav->FrameBufferBase +
pSAVAGEDRI->textureOffset;
Index: savage_dri.h
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dri.h,v
retrieving revision 1.2
diff -u -r1.2 savage_dri.h
--- savage_dri.h 22 Feb 2004 16:14:42 -0000 1.2
+++ savage_dri.h 15 Aug 2004 19:18:38 -0000
@@ -40,7 +40,7 @@
#define SAVAGE_BUFFER_ALIGN 0x00000fff
typedef struct{
- drmContext ctxOwner;
+ drm_context_t ctxOwner;
unsigned long agp_offset;
unsigned long agp_handle;
unsigned long map_handle;
@@ -116,20 +116,20 @@
int agpMode;
- drmHandle frontbuffer;
+ drm_handle_t frontbuffer;
unsigned int frontbufferSize;
unsigned int frontOffset;
unsigned int frontPitch;
unsigned int frontBitmapDesc; /*Bitmap Descriptior*/
unsigned int IsfrontTiled;
- drmHandle backbuffer;
+ drm_handle_t backbuffer;
unsigned int backbufferSize;
unsigned int backOffset;
unsigned int backPitch;
unsigned int backBitmapDesc; /*Bitmap Descriptior*/
- drmHandle depthbuffer;
+ drm_handle_t depthbuffer;
unsigned int depthbufferSize;
unsigned int depthOffset;
unsigned int depthPitch;
@@ -137,8 +137,8 @@
- drmHandle textures;
- drmHandle xvmcSurfHandle;
+ drm_handle_t textures;
+ drm_handle_t xvmcSurfHandle;
unsigned int textureOffset;
unsigned int textureSize;
int logTextureGranularity;
Index: savage_driver.c
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v
retrieving revision 1.22
diff -u -r1.22 savage_driver.c
--- savage_driver.c 26 Mar 2004 22:20:40 -0000 1.22
+++ savage_driver.c 15 Aug 2004 19:18:40 -0000
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v 1.24 2001/11/02 16:24:51 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v 1.48tsi Exp $ */
/*
* vim: sw=4 ts=8 ai ic:
*
@@ -27,6 +27,9 @@
#include "savage_driver.h"
#include "savage_regs.h"
#include "savage_bci.h"
+#include "savage_streams.h"
+
+#define TRANSPARENCY_KEY 0xff;
#ifdef XF86DRI
#define _XF86DRI_SERVER_
@@ -69,6 +72,7 @@
static void SavageLoadPaletteSavage4(ScrnInfoPtr pScrn, int numColors,
int *indicies, LOCO *colors,
VisualPtr pVisual);
+static void SavageUpdateKey(ScrnInfoPtr pScrn, int r, int g, int b);
static void SavageCalcClock(long freq, int min_m, int min_n1, int max_n1,
int min_n2, int max_n2, long freq_min,
long freq_max, unsigned int *mdiv,
@@ -86,7 +90,6 @@
extern ScrnInfoPtr gpScrn;
-#define iabs(a) ((int)(a)>0?(a):(-(a)))
#define DRIVER_NAME "savage"
#define DRIVER_VERSION "1.1.27a"
@@ -207,12 +210,19 @@
,OPTION_TV_ON
,OPTION_TV_PAL
,OPTION_FORCE_INIT
+ ,OPTION_OVERLAY
+ ,OPTION_T_KEY
,OPTION_DISABLE_XVMC
,OPTION_DISABLE_TILE
,OPTION_DISABLE_COB
,OPTION_BCI_FOR_XV
,OPTION_AGP_MODE
,OPTION_AGP_SIZE
+ ,OPTION_DUOVIEW
+ ,OPTION_CRT2REFRESH
+ ,OPTION_CRT2XRES
+ ,OPTION_CRT2YRES
+ ,OPTION_CRT2REL
} SavageOpts;
@@ -230,6 +240,9 @@
{ OPTION_CRT_ONLY, "CrtOnly", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_TV_ON, "TvOn", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_TV_PAL, "PAL", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_FORCE_INIT,"ForceInit", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_OVERLAY, "Overlay", OPTV_ANYSTR, {0}, FALSE },
+ { OPTION_T_KEY, "TransparencyKey", OPTV_ANYSTR, {0}, FALSE },
{ OPTION_FORCE_INIT, "ForceInit", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_DISABLE_XVMC, "DisableXVMC", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_DISABLE_TILE, "DisableTile", OPTV_BOOLEAN, {0}, FALSE },
@@ -237,6 +250,11 @@
{ OPTION_BCI_FOR_XV, "BCIforXv", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_AGP_MODE, "AGPMode", OPTV_INTEGER, {0}, FALSE },
{ OPTION_AGP_SIZE, "AGPSize", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_DUOVIEW, "Duoview", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_CRT2REFRESH, "CRT2Refresh", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_CRT2XRES, "CRT2XRes", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_CRT2YRES, "CRT2YRes", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_CRT2REL, "CRT2Rel", OPTV_INTEGER, {0}, FALSE },
{ -1, NULL, OPTV_NONE, {0}, FALSE }
};
@@ -329,6 +347,13 @@
NULL
};
+static const char *int10Symbols[] = {
+ "xf86ExecX86int10",
+ "xf86Int10AllocPages",
+ "xf86int10Addr",
+ "xf86Int10FreePages"
+};
+
static const char *vbeSymbols[] = {
"VBEInit",
"vbeDoEDID",
@@ -388,18 +413,6 @@
NULL
};
-static const char *int10Symbols[] = {
- "xf86ExecX86int10",
-#if 0
- "xf86FreeInt10",
-#endif
- "xf86InitInt10",
- "xf86Int10AllocPages",
- "xf86Int10FreePages",
- "xf86int10Addr",
- NULL
-};
-
static const char *fbSymbols[] = {
"fbPictureInit",
"fbScreenInit",
@@ -468,7 +481,8 @@
! (ALT_STATUS_WORD0 & 0x00200000)
)
{
- ErrorF( "Resetting BCI, stat = %08x...\n", ALT_STATUS_WORD0);
+ ErrorF( "Resetting BCI, stat = %08lx...\n",
+ (unsigned long) ALT_STATUS_WORD0);
/* Turn off BCI */
OUTREG( 0x48c18, cob & ~8 );
usleep(10000);
@@ -492,7 +506,7 @@
BCI_SEND( 0x98000000 + psav->ShadowCounter );
while(
- (psav->ShadowVirtual[1] & 0x7fff) != psav->ShadowCounter &&
+ (int)(psav->ShadowVirtual[1] & 0x7fff) != psav->ShadowCounter &&
(loop++ < MAXLOOP)
)
;
@@ -513,7 +527,7 @@
WaitQueue3D( SavagePtr psav, int v )
{
int loop = 0;
- int slots = MAXFIFO - v;
+ CARD32 slots = MAXFIFO - v;
mem_barrier();
if( psav->ShadowVirtual )
@@ -534,7 +548,7 @@
WaitQueue4( SavagePtr psav, int v )
{
int loop = 0;
- int slots = MAXFIFO - v;
+ CARD32 slots = MAXFIFO - v;
if( !psav->NoPCIRetry )
return 0;
@@ -553,7 +567,7 @@
WaitQueue2K( SavagePtr psav, int v )
{
int loop = 0;
- int slots = MAXFIFO - v;
+ CARD32 slots = MAXFIFO - v;
if( !psav->NoPCIRetry )
return 0;
@@ -735,7 +749,7 @@
for (i=0; idriverVersion = (int)DRIVER_VERSION;
+ pScrn->driverVersion = SAVAGE_VERSION;
pScrn->driverName = DRIVER_NAME;
pScrn->name = "SAVAGE";
pScrn->Probe = SavageProbe;
@@ -916,6 +930,8 @@
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: shadow FB enabled\n");
}
+ psav->primStreamBpp = pScrn->bitsPerPixel;
+
if ((s = xf86GetOptValString(psav->Options, OPTION_ROTATE))) {
if(!xf86NameCmp(s, "CW")) {
/* accel is disabled below for shadowFB */
@@ -946,6 +962,48 @@
psav->NoAccel = TRUE;
}
+ if ((s = xf86GetOptValString(psav->Options, OPTION_OVERLAY))) {
+
+ if (psav->shadowFB) {
+ xf86DrvMsg(pScrn->scrnIndex,X_INFO,
+ "Option \"Overlay\" not supported with shadowFB\n");
+ } else {
+ if (pScrn->depth == 8) {
+ if (!*s || !xf86NameCmp(s, "24")) {
+ psav->overlayDepth = 24;
+ psav->NoAccel = TRUE; /* Preliminary */
+ pScrn->colorKey = TRANSPARENCY_KEY;
+ pScrn->overlayFlags = OVERLAY_8_32_DUALFB;
+ } else if (!xf86NameCmp(s, "16")) {
+ psav->overlayDepth = 16;
+ psav->NoAccel = TRUE; /* Preliminary */
+ pScrn->colorKey = TRANSPARENCY_KEY;
+ pScrn->overlayFlags = OVERLAY_8_32_DUALFB;
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex,X_WARNING,"Wrong argument: "
+ "\"%s\" Ingnoring\n",s);
+ }
+ } else if (pScrn->depth != 15) {
+ psav->overlayDepth = 8;
+ psav->NoAccel = TRUE; /* Preliminary */
+ pScrn->colorKey = TRANSPARENCY_KEY;
+ pScrn->overlayFlags = OVERLAY_8_32_DUALFB;
+ if (*s && (xf86NameCmp(s, "8")))
+ xf86DrvMsg(pScrn->scrnIndex,X_WARNING,"Wrong argument: "
+ "\"%s\" for depth %i overlay depth must be 8\n",
+ s,pScrn->depth);
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex,X_WARNING,"Overlay not "
+ "supported for depth 15\n");
+ }
+ if (psav->overlayDepth) {
+ xf86DrvMsg(pScrn->scrnIndex,X_INFO,"%i/%i Overlay enabled\n",
+ pScrn->depth,psav->overlayDepth);
+ psav->primStreamBpp = 8;
+ }
+ }
+ }
+
if (pScrn->bitsPerPixel == 24 && !psav->NoAccel) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"HW acceleration not possible with depth 32 and bpp 24.\n");
@@ -1098,6 +1156,44 @@
"Option: %s use of the BCI for Xv\n",(psav->BCIforXv?"Enable":"Disable"));
}
+ psav->Duoview = FALSE;
+ if( xf86GetOptValBool( psav->Options, OPTION_DUOVIEW, &psav->Duoview)) {
+ if (!psav->UseBIOS) {
+ psav->Duoview = FALSE;
+ xf86DrvMsg( pScrn->scrnIndex, X_ERROR,
+ "Duoview requires BIOS mode setting\n" );
+ } else {
+ xf86DrvMsg( pScrn->scrnIndex, X_CONFIG,
+ "Option: Duoview enabled\n" );
+ }
+ }
+
+ psav->CRT2Refresh = 60;
+ if( xf86GetOptValInteger( psav->Options, OPTION_CRT2REFRESH, &psav->CRT2Refresh)) {
+ if ((psav->CRT2Refresh > 100) ||(psav->CRT2Refresh < 0)) {
+ psav->CRT2Refresh = 60;
+ xf86DrvMsg( pScrn->scrnIndex, X_ERROR,
+ "CRT2 Refresh rate out of range: default 60\n" );
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "CRT2 Refresh rate: %d\n", psav->CRT2Refresh);
+ }
+ }
+ psav->CRT2XRes = 640;
+ psav->CRT2YRes = 480;
+ if( xf86GetOptValInteger( psav->Options, OPTION_CRT2XRES, &psav->CRT2XRes)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Option: CRT2 Mode X res: %d\n", psav->CRT2XRes);
+ }
+ if( xf86GetOptValInteger( psav->Options, OPTION_CRT2YRES, &psav->CRT2YRes)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Option: CRT2 Mode Y res: %d\n", psav->CRT2YRes);
+ }
+ if( xf86GetOptValInteger( psav->Options, OPTION_CRT2REL, &psav->CRT2Relation)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Option: CRT2 relation: %d\n", psav->CRT2Relation);
+ }
+
/* Add more options here. */
if (pScrn->numEntities > 1) {
@@ -1112,15 +1208,10 @@
return FALSE;
}
psav->EntityIndex = pEnt->index;
-
- if (xf86LoadSubModule(pScrn, "int10")) {
- xf86LoaderReqSymLists(int10Symbols, NULL);
- psav->pInt10 = xf86InitInt10(pEnt->index);
- }
-
+
if (xf86LoadSubModule(pScrn, "vbe")) {
xf86LoaderReqSymLists(vbeSymbols, NULL);
- psav->pVbe = VBEInit(psav->pInt10, pEnt->index);
+ psav->pVbe = VBEInit(NULL, pEnt->index);
}
@@ -1173,6 +1264,7 @@
if (!SavageMapMMIO(pScrn)) {
vbeFree(psav->pVbe);
+ psav->pVbe = NULL;
return FALSE;
}
@@ -1203,6 +1295,8 @@
if (!xf86SetGamma(pScrn, zeros)) {
vbeFree(psav->pVbe);
+ psav->pVbe = NULL;
+ SavageFreeRec(pScrn);
return FALSE;
}
}
@@ -1275,6 +1369,7 @@
pScrn->videoRam);
}
+ /* Get video RAM */
if( !pScrn->videoRam && psav->pVbe )
{
/* If VBE is available, ask it about onboard memory. */
@@ -1310,10 +1405,6 @@
* The Savage4 and ProSavage have COB coherency bugs which render
* the buffer useless.
*/
- /*
- psav->cobIndex = 2;
- psav->cobSize = 0x8000 << psav->cobIndex;
- */
psav->cobIndex = 0;
psav->cobSize = 0;
} else {
@@ -1540,39 +1631,6 @@
}
#endif
- clockRanges = xnfalloc(sizeof(ClockRange));
- clockRanges->next = NULL;
- clockRanges->minClock = psav->minClock;
- clockRanges->maxClock = psav->maxClock;
- clockRanges->clockIndex = -1;
- clockRanges->interlaceAllowed = TRUE;
- clockRanges->doubleScanAllowed = TRUE;
- clockRanges->ClockDivFactor = 1.0;
- clockRanges->ClockMulFactor = 1.0;
-
- i = xf86ValidateModes(pScrn, pScrn->monitor->Modes,
- pScrn->display->modes, clockRanges, NULL,
- 256, 2048, 16 * pScrn->bitsPerPixel,
- 128, 2048,
- pScrn->virtualX, pScrn->virtualY,
- psav->videoRambytes, LOOKUP_BEST_REFRESH);
-
- if (i == -1) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "xf86ValidateModes failure\n");
- SavageFreeRec(pScrn);
- vbeFree(psav->pVbe);
- return FALSE;
- }
-
- xf86PruneDriverModes(pScrn);
-
- if (i == 0 || pScrn->modes == NULL) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n");
- SavageFreeRec(pScrn);
- vbeFree(psav->pVbe);
- return FALSE;
- }
-
if( psav->UseBIOS )
{
/* Go probe the BIOS for all the modes and refreshes at this depth. */
@@ -1582,7 +1640,7 @@
SavageFreeBIOSModeTable( psav, &psav->ModeTable );
}
- psav->ModeTable = SavageGetBIOSModeTable( psav, pScrn->bitsPerPixel );
+ psav->ModeTable = SavageGetBIOSModeTable( psav, psav->primStreamBpp );
if( !psav->ModeTable || !psav->ModeTable->NumModes ) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
@@ -1615,6 +1673,41 @@
}
}
+ clockRanges = xnfalloc(sizeof(ClockRange));
+ clockRanges->next = NULL;
+ clockRanges->minClock = psav->minClock;
+ clockRanges->maxClock = psav->maxClock;
+ clockRanges->clockIndex = -1;
+ clockRanges->interlaceAllowed = TRUE;
+ clockRanges->doubleScanAllowed = TRUE;
+ clockRanges->ClockDivFactor = 1.0;
+ clockRanges->ClockMulFactor = 1.0;
+
+ i = xf86ValidateModes(pScrn, pScrn->monitor->Modes,
+ pScrn->display->modes, clockRanges, NULL,
+ 256, 2048, 16 * pScrn->bitsPerPixel,
+ 128, 2048,
+ pScrn->virtualX, pScrn->virtualY,
+ psav->videoRambytes, LOOKUP_BEST_REFRESH);
+
+ if (i == -1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "xf86ValidateModes failure\n");
+ SavageFreeRec(pScrn);
+ vbeFree(psav->pVbe);
+ psav->pVbe = NULL;
+ return FALSE;
+ }
+
+ xf86PruneDriverModes(pScrn);
+
+ if (i == 0 || pScrn->modes == NULL) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n");
+ SavageFreeRec(pScrn);
+ vbeFree(psav->pVbe);
+ psav->pVbe = NULL;
+ return FALSE;
+ }
+
xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V);
pScrn->currentMode = pScrn->modes;
xf86PrintModes(pScrn);
@@ -1623,6 +1716,7 @@
if (xf86LoadSubModule(pScrn, "fb") == NULL) {
SavageFreeRec(pScrn);
vbeFree(psav->pVbe);
+ psav->pVbe = NULL;
return FALSE;
}
@@ -1632,6 +1726,7 @@
if( !xf86LoadSubModule(pScrn, "xaa") ) {
SavageFreeRec(pScrn);
vbeFree(psav->pVbe);
+ psav->pVbe = NULL;
return FALSE;
}
xf86LoaderReqSymLists(xaaSymbols, NULL );
@@ -1641,6 +1736,7 @@
if (!xf86LoadSubModule(pScrn, "ramdac")) {
SavageFreeRec(pScrn);
vbeFree(psav->pVbe);
+ psav->pVbe = NULL;
return FALSE;
}
xf86LoaderReqSymLists(ramdacSymbols, NULL);
@@ -1650,12 +1746,15 @@
if (!xf86LoadSubModule(pScrn, "shadowfb")) {
SavageFreeRec(pScrn);
vbeFree(psav->pVbe);
+ psav->pVbe = NULL;
return FALSE;
}
xf86LoaderReqSymLists(shadowSymbols, NULL);
}
vbeFree(psav->pVbe);
+ psav->pVbe = NULL;
+
return TRUE;
}
@@ -1682,7 +1781,13 @@
#endif
SavageSave(pScrn);
- return SavageModeInit(pScrn, pScrn->currentMode);
+ if(SavageModeInit(pScrn, pScrn->currentMode)) {
+ /* some BIOSes seem to enable HW cursor on PM resume */
+ if (!SAVPTR(pScrn)->hwc_on)
+ SavageHideCursor( pScrn );
+ return TRUE;
+ }
+ return FALSE;
}
@@ -1707,7 +1812,7 @@
psav->LockHeld = 1;
}
#endif
-
+ SavageStreamsOff(pScrn);
SavageWriteMode(pScrn, vgaSavePtr, SavageSavePtr, FALSE);
SavageResetStreams(pScrn);
SavageDisableMMIO(pScrn);
@@ -1900,7 +2005,7 @@
static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr,
SavageRegPtr restore, Bool Entering)
{
- unsigned char tmp, cr3a, cr66, cr67;
+ unsigned char tmp, cr3a, cr66;
vgaHWPtr hwp = VGAHWPTR(pScrn);
SavagePtr psav = SAVPTR(pScrn);
int vgaCRIndex, vgaCRReg, vgaIOBase;
@@ -1963,6 +2068,10 @@
VGAOUT8(vgaCRIndex, 0x53);
VGAOUT8(vgaCRReg, VGAIN8(vgaCRReg) & ~0x10);
+ /* Disable HW cursor */
+
+ VGAOUT16(vgaCRIndex, 0x0045);
+
/* Set the color mode. */
VGAOUT8(vgaCRIndex, 0x67);
@@ -1971,7 +2080,8 @@
/* Enable gamma correction. */
VGAOUT8(0x3c4, 0x1b);
- if( (pScrn->bitsPerPixel == 32) && !psav->DGAactive )
+ if( (pScrn->bitsPerPixel == 32) && !psav->DGAactive
+ && ! psav->FBStart2nd )
VGAOUT8(0x3c5, 0x28 );
else
VGAOUT8(0x3c5, 0x00 );
@@ -1993,7 +2103,7 @@
if( pScrn->displayWidth >= 1024 )
{
- if(pScrn->bitsPerPixel == 32 )
+ if(psav->primStreamBpp == 32 )
{
if( restore->refresh >= 130 )
cr79 = 0x03;
@@ -2010,7 +2120,7 @@
cr79 = 0x08;
}
}
- else if( pScrn->bitsPerPixel == 16)
+ else if( psav->primStreamBpp == 16)
{
/* The windows driver uses 0x13 for 16-bit 130Hz, but I see terrible
@@ -2047,10 +2157,22 @@
VGAOUT8(vgaCRIndex, 0x50);
VGAOUT8(vgaCRReg, VGAIN8(vgaCRReg) | 0xC1);
- width = (pScrn->displayWidth * (pScrn->bitsPerPixel / 8)) >> 3;
+ width = (pScrn->displayWidth * (psav->primStreamBpp / 8)) >> 3;
VGAOUT16(vgaCRIndex, ((width & 0xff) << 8) | 0x13 );
VGAOUT16(vgaCRIndex, ((width & 0x300) << 4) | 0x51 );
+ if (psav->Duoview) {
+ SelectIGA2();
+ VGAOUT8(vgaCRIndex, 0x50);
+ VGAOUT8(vgaCRReg, VGAIN8(vgaCRReg) | 0xC1);
+/* FIXME - change pitch to CRT2XRes - is this reg paired??? */
+ width = (pScrn->displayWidth * (pScrn->bitsPerPixel / 8)) >> 3;
+ VGAOUT16(vgaCRIndex, ((width & 0xff) << 8) | 0x13 );
+ VGAOUT16(vgaCRIndex, ((width & 0x300) << 4) | 0x51 );
+ SelectIGA1();
+ }
+
+
/* Some non-S3 BIOSes enable block write even on non-SGRAM devices. */
switch( psav->Chipset )
@@ -2124,14 +2246,14 @@
* switch to mode 3 here seems to eliminate the issue.
*/
- if( ((restore->CR31 & 0x0a) == 0) && psav->pInt10 ) {
+ if( ((restore->CR31 & 0x0a) == 0) && psav->pVbe ) {
SavageSetTextMode( psav );
}
VGAOUT8(vgaCRIndex, 0x67);
- cr67 = VGAIN8(vgaCRReg);
+ (void) VGAIN8(vgaCRReg);
/*VGAOUT8(vgaCRReg, restore->CR67 & ~0x0c);*/ /* no STREAMS yet */
- VGAOUT8(vgaCRReg, restore->CR67 & ~0xf1); /* no streams for new and old streams engines */
+ VGAOUT8(vgaCRReg, restore->CR67 & ~0x0e); /* no STREAMS yet old and new */
/* restore extended regs */
VGAOUT8(vgaCRIndex, 0x66);
@@ -2195,7 +2317,7 @@
/* restore the desired video mode with cr67 */
VGAOUT8(vgaCRIndex, 0x67);
/*VGAOUT8(vgaCRReg, restore->CR67 & ~0x0c);*/ /* no STREAMS yet */
- VGAOUT8(vgaCRReg, restore->CR67 & ~0xf1); /* no streams for new and old streams engines */
+ VGAOUT8(vgaCRReg, restore->CR67 & ~0x0e); /* no streams for new and old streams engines */
/* other mode timing and extended regs */
VGAOUT8(vgaCRIndex, 0x34);
@@ -2377,7 +2499,7 @@
}
xf86DrvMsg( pScrn->scrnIndex, X_PROBED,
- "mapping MMIO @ 0x%x with size 0x%x\n",
+ "mapping MMIO @ 0x%lx with size 0x%x\n",
psav->MmioBase, SAVAGE_NEWMMIO_REGSIZE);
psav->MapBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, psav->PciTag,
@@ -2402,6 +2524,7 @@
return TRUE;
}
+#define TRANSPARENCY_KEY 0xff;
static Bool SavageMapFB(ScrnInfoPtr pScrn)
{
@@ -2410,7 +2533,7 @@
TRACE(("SavageMapFB()\n"));
xf86DrvMsg( pScrn->scrnIndex, X_PROBED,
- "mapping framebuffer @ 0x%x with size 0x%x\n",
+ "mapping framebuffer @ 0x%lx with size 0x%x\n",
psav->FrameBufferBase, psav->videoRambytes);
if (psav->videoRambytes) {
@@ -2536,6 +2659,7 @@
SavagePtr psav;
EntityInfoPtr pEnt;
int ret;
+ int colormapFlags;
TRACE(("SavageScreenInit()\n"));
@@ -2543,13 +2667,27 @@
psav = SAVPTR(pScrn);
pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
- psav->pVbe = VBEInit(NULL, pEnt->index);
+ if (!psav->pVbe)
+ psav->pVbe = VBEInit(NULL, pEnt->index);
SavageEnableMMIO(pScrn);
if (!SavageMapFB(pScrn))
return FALSE;
+ psav->FBStart2nd = 0;
+
+ if (psav->overlayDepth) {
+ if ((pScrn->virtualX * pScrn->virtualY *
+ (DEPTH_BPP(DEPTH_2ND(pScrn))) >> 3)
+ > (psav->CursorKByte * 1024))
+ xf86DrvMsg(pScrn->scrnIndex,X_WARNING,
+ "Not enough memory for overlay mode: disabling\n");
+ else psav->FBStart2nd = psav->FBStart
+ + ((pScrn->virtualX * pScrn->virtualY + 0xff) & ~0xff);
+
+ }
+
if( psav->ShadowStatus ) {
psav->ShadowPhysical =
psav->FrameBufferBase + psav->CursorKByte*1024 + 4096 - 32;
@@ -2558,8 +2696,8 @@
(psav->FBBase + psav->CursorKByte*1024 + 4096 - 32);
xf86DrvMsg( pScrn->scrnIndex, X_PROBED,
- "Shadow area physical %08x, linear %08x\n",
- psav->ShadowPhysical, psav->ShadowVirtual );
+ "Shadow area physical %08lx, linear %p\n",
+ psav->ShadowPhysical, (void *)psav->ShadowVirtual );
psav->WaitQueue = ShadowWait1;
psav->WaitIdle = ShadowWait;
@@ -2604,19 +2742,27 @@
miClearVisualTypes();
- if (pScrn->bitsPerPixel == 16) {
- if (!miSetVisualTypes(pScrn->depth, TrueColorMask,
- pScrn->rgbBits, pScrn->defaultVisual))
- return FALSE;
- if (!miSetPixmapDepths ())
- return FALSE;
- } else {
- if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth),
- pScrn->rgbBits, pScrn->defaultVisual))
- return FALSE;
- if (!miSetPixmapDepths ())
- return FALSE;
- }
+ {
+ int visual;
+
+ visual = ((psav->FBStart2nd && pScrn->bitsPerPixel > 8)
+ || pScrn->bitsPerPixel == 16) ? TrueColorMask
+ : miGetDefaultVisualMask(DEPTH_BPP(pScrn->depth));
+ if (!miSetVisualTypes(pScrn->depth, visual,
+ pScrn->rgbBits, pScrn->defaultVisual))
+ return FALSE;
+
+ if (psav->FBStart2nd) {/* we have overlay */
+ visual = psav->overlayDepth > 8 ? TrueColorMask :
+ miGetDefaultVisualMask(DEPTH_BPP(psav->overlayDepth));
+ if (!miSetVisualTypes(psav->overlayDepth, visual,
+ psav->overlayDepth > 8 ? 8 : 6,
+ pScrn->defaultVisual))
+ return FALSE;
+ }
+ }
+ if (!miSetPixmapDepths ())
+ return FALSE;
ret = SavageInternalScreenInit(scrnIndex, pScreen);
if (!ret)
@@ -2624,18 +2770,61 @@
xf86SetBlackWhitePixels(pScreen);
- if (pScrn->bitsPerPixel > 8) {
+ {
VisualPtr visual;
-
visual = pScreen->visuals + pScreen->numVisuals;
while (--visual >= pScreen->visuals) {
- 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;
+ if ((visual->class | DynamicClass) == DirectColor
+ && visual->nplanes > MAX_PSEUDO_DEPTH) {
+ if (visual->nplanes == pScrn->depth) {
+ 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;
+ } else if (visual->offsetRed > 8
+ || visual->offsetGreen > 8
+ || visual->offsetBlue > 8) {
+ /*
+ * mi has set these wrong. fix it here -- we cannot use pScrn
+ * as this is set up for the default depth 8.
+ */
+ int tmp;
+ int c_s = 0;
+
+ tmp = visual->offsetBlue;
+ visual->offsetBlue = visual->offsetRed;
+ visual->offsetRed = tmp;
+ tmp = visual->blueMask;
+ visual->blueMask = visual->redMask;
+ visual->redMask = tmp;
+ switch (DEPTH_2ND(pScrn)) {
+ case 16:
+ visual->offsetRed = 11;
+ visual->offsetGreen = 5;
+ visual->offsetBlue = 0;
+ visual->redMask = 0xF800;
+ visual->greenMask = 0x7E0;
+ visual->blueMask = 0x1F;
+ break;
+ case 24:
+ visual->offsetRed = 16;
+ visual->offsetGreen = 8;
+ visual->offsetBlue = 0;
+ visual->redMask = 0xFF0000;
+ visual->greenMask = 0xFF00;
+ visual->blueMask = 0xFF;
+ c_s = 2;
+ break;
+ }
+ psav->overlay.redMask = visual->redMask;
+ psav->overlay.greenMask = visual->greenMask;
+ psav->overlay.blueMask = visual->blueMask;
+ psav->overlay.redShift = visual->offsetRed + c_s;
+ psav->overlay.greenShift = visual->offsetGreen + c_s;
+ psav->overlay.blueShift = visual->offsetBlue + c_s;
+ }
}
}
}
@@ -2683,19 +2872,17 @@
if (!miCreateDefColormap(pScreen))
return FALSE;
+ colormapFlags = CMAP_RELOAD_ON_MODE_SWITCH
+ | ((psav->FBStart2nd) ? 0 : CMAP_PALETTED_TRUECOLOR);
+
if (psav->Chipset == S3_SAVAGE4) {
if (!xf86HandleColormaps(pScreen, 256, 6, SavageLoadPaletteSavage4,
- NULL,
- CMAP_RELOAD_ON_MODE_SWITCH
- | CMAP_PALETTED_TRUECOLOR
- ))
+ NULL, colormapFlags ))
return FALSE;
} else {
if (!xf86HandleColormaps(pScreen, 256, 6, SavageLoadPalette, NULL,
- CMAP_RELOAD_ON_MODE_SWITCH
- | CMAP_PALETTED_TRUECOLOR
- ))
- return FALSE;
+ colormapFlags ))
+ return FALSE;
}
vgaHWBlankScreen(pScrn, FALSE);
@@ -2720,7 +2907,7 @@
#endif
#ifdef XvExtension
- if( !psav->NoAccel && !SavagePanningCheck(pScrn) )
+ if( !psav->FBStart2nd && !psav->NoAccel && !SavagePanningCheck(pScrn) )
SavageInitVideo( pScreen );
#endif
@@ -2772,10 +2959,45 @@
FBStart = psav->FBStart;
}
- ret = fbScreenInit(pScreen, FBStart, width, height,
- pScrn->xDpi, pScrn->yDpi,
- psav->ulAperturePitch / (pScrn->bitsPerPixel >> 3), /*displayWidth,*/
- pScrn->bitsPerPixel);
+ if (!psav->FBStart2nd) {
+#if 0
+ ret = fbScreenInit(pScreen, FBStart, width, height,
+ pScrn->xDpi, pScrn->yDpi,
+ displayWidth,
+ pScrn->bitsPerPixel);
+#endif
+ ret = fbScreenInit(pScreen, FBStart, width, height,
+ pScrn->xDpi, pScrn->yDpi,
+ psav->ulAperturePitch / (pScrn->bitsPerPixel >> 3), /*displayWidth,*/
+ pScrn->bitsPerPixel);
+
+ } else {
+ FbOverlayScrPrivPtr pScrPriv;
+ int Depth2nd = DEPTH_2ND(pScrn);
+ if (!fbSetupScreen (pScreen, FBStart, width, height,
+ pScrn->xDpi, pScrn->yDpi, displayWidth, 8))
+ return FALSE;
+ if (pScrn->depth == 8) {
+ ret = fbOverlayFinishScreenInit (pScreen, FBStart,
+ psav->FBStart2nd, width,
+ height,pScrn->xDpi, pScrn->yDpi,
+ displayWidth,displayWidth,
+ 8, DEPTH_BPP(Depth2nd),
+ 8, Depth2nd);
+ pScrPriv = fbOverlayGetScrPriv(pScreen);
+ pScrPriv->layer[0].key = pScrn->colorKey;
+ } else {
+ ret = fbOverlayFinishScreenInit (pScreen, psav->FBStart2nd,
+ FBStart,
+ width, height,pScrn->xDpi,
+ pScrn->yDpi,
+ displayWidth,displayWidth,
+ DEPTH_BPP(Depth2nd), 8,
+ Depth2nd, 8);
+ pScrPriv = fbOverlayGetScrPriv(pScreen);
+ pScrPriv->layer[1].key = pScrn->colorKey;
+ }
+ }
return ret;
}
@@ -2785,6 +3007,7 @@
{
ScrnInfoPtr pScrn = xf86Screens[index];
SavagePtr psav = SAVPTR(pScrn);
+ int refresh;
TRACE(("SavageValidMode\n"));
@@ -2810,6 +3033,13 @@
)
return MODE_PANEL;
+ if (psav->UseBIOS) {
+ refresh = (pMode->Clock * 1000) / (pMode->HTotal * pMode->VTotal);
+ return (SavageMatchBiosMode(pScrn,pMode->HDisplay,
+ pMode->VDisplay,
+ refresh,NULL,NULL));
+ }
+
return MODE_OK;
}
@@ -2905,7 +3135,7 @@
new->CR67 = 0x40; /* 16bpp, 1 pixels/clock */
break;
case 24:
- if (pScrn->bitsPerPixel == 24 )
+ if (psav->primStreamBpp == 24 )
new->CR67 = 0x70;
else
new->CR67 = 0xd0;
@@ -2915,63 +3145,23 @@
if( psav->UseBIOS ) {
int refresh;
- SavageModeEntryPtr pmt;
-
- /* Scan through our BIOS list to locate the closest valid mode. */
-
- /* If we ever break 4GHz clocks on video boards, we'll need to
- * change this.
- */
-
+ unsigned int newmode=0, newrefresh=0;
refresh = (mode->Clock * 1000) / (mode->HTotal * mode->VTotal);
-#ifdef EXTENDED_DEBUG
- ErrorF( "Desired refresh rate = %dHz\n", refresh );
-#endif
-
- for( i = 0, pmt = psav->ModeTable->Modes;
- i < psav->ModeTable->NumModes;
- i++, pmt++ )
- {
- if( (pmt->Width == mode->HDisplay) &&
- (pmt->Height == mode->VDisplay) )
- {
- int jDelta = 99;
- int jBest = 0;
-
- /* We have an acceptable mode. Find a refresh rate. */
-
- new->mode = pmt->VesaMode;
- for( j = 0; j < pmt->RefreshCount; j++ )
- {
- if( pmt->RefreshRate[j] == refresh )
- {
- /* Exact match. */
- jBest = j;
- break;
- }
- else if( iabs(pmt->RefreshRate[j] - refresh) < jDelta )
- {
- jDelta = iabs(pmt->RefreshRate[j] - refresh);
- jBest = j;
- }
- }
-
- new->refresh = pmt->RefreshRate[jBest];
- break;
- }
- }
-
- if( new->mode ) {
- /* Success: we found a match in the BIOS. */
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Chose mode %x at %dHz.\n", new->mode, new->refresh );
- }
- else {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "No suitable BIOS mode found for %dx%d %dMHz.\n",
- mode->HDisplay, mode->VDisplay, mode->Clock/1000 );
- }
+ SavageMatchBiosMode(pScrn,mode->HDisplay,mode->VDisplay,refresh,
+ &newmode,&newrefresh);
+ new->mode = newmode;
+ new->refresh = newrefresh;
+
+ if (psav->Duoview) {
+ newmode = 0;
+ newrefresh = 0;
+ refresh = psav->CRT2Refresh;
+ SavageMatchBiosMode(pScrn,psav->CRT2XRes,psav->CRT2YRes,refresh,
+ &newmode,&newrefresh);
+ psav->CRT2BIOSMode = newmode;
+ psav->CRT2Refresh = newrefresh;
+ }
}
if( !new->mode ) {
@@ -3047,12 +3237,12 @@
new->SR29 = (r & 4) | (m & 0x100) >> 5 | (n & 0x40) >> 2;
if (psav->fifo_moderate) {
- if (pScrn->bitsPerPixel < 24)
+ if (psav->primStreamBpp < 24)
new->MMPR0 -= 0x8000;
else
new->MMPR0 -= 0x4000;
} else if (psav->fifo_aggressive) {
- if (pScrn->bitsPerPixel < 24)
+ if (psav->primStreamBpp < 24)
new->MMPR0 -= 0xc000;
else
new->MMPR0 -= 0x6000;
@@ -3092,7 +3282,7 @@
(((mode->CrtcVDisplay - 1) & 0x400) >> 9) |
(((mode->CrtcVSyncStart) & 0x400) >> 8) |
(((mode->CrtcVSyncStart) & 0x400) >> 6) | 0x40;
- width = (pScrn->displayWidth * (pScrn->bitsPerPixel / 8)) >> 3;
+ width = (pScrn->displayWidth * (psav->primStreamBpp / 8)) >> 3;
new->CR91 = vganew->CRTC[19] = 0xff & width;
new->CR51 = (0x300 & width) >> 4;
new->CR90 = 0x80 | (width >> 8);
@@ -3100,9 +3290,9 @@
/* Set frame buffer description. */
- if (pScrn->bitsPerPixel <= 8)
+ if (psav->primStreamBpp <= 8)
new->CR50 = 0;
- else if (pScrn->bitsPerPixel <= 16)
+ else if (psav->primStreamBpp <= 16)
new->CR50 = 0x10;
else
new->CR50 = 0x30;
@@ -3151,6 +3341,11 @@
/* do it! */
SavageWriteMode(pScrn, vganew, new, TRUE);
+ SavageStreamsOn(pScrn);
+
+ if (psav->FBStart2nd)
+ SavageInitSecondaryStream(pScrn);
+
SavageAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
return TRUE;
@@ -3190,6 +3385,7 @@
}
if (pScrn->vtSema) {
+ SavageStreamsOff(pScrn);
SavageWriteMode(pScrn, vgaSavePtr, SavageSavePtr, FALSE);
SavageResetStreams(pScrn);
vgaHWLock(hwp);
@@ -3205,19 +3401,19 @@
static Bool SavageSaveScreen(ScreenPtr pScreen, int mode)
{
-#if 0
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
-#endif
+
TRACE(("SavageSaveScreen(0x%x)\n", mode));
-#if 0
- if( pScrn->vtSema && SAVPTR(pScrn)->hwcursor )
+
+ if( pScrn->vtSema && SAVPTR(pScrn)->hwcursor && SAVPTR(pScrn)->hwc_on )
{
if( xf86IsUnblank(mode) )
SavageShowCursor( pScrn );
else
SavageHideCursor( pScrn );
+ SAVPTR(pScrn)->hwc_on = TRUE; /*restore */
}
-#endif
+
return vgaHWSaveScreen(pScreen, mode);
}
@@ -3228,8 +3424,14 @@
SavagePtr psav = SAVPTR(pScrn);
DisplayModePtr currentMode = pScrn->currentMode;
int address=0,top=0,left=0;
+ int address2=0,top2=0,left2=0,x2=0,y2=0,crtc1_base=0,crtc2_base=0;
TRACE(("SavageAdjustFrame(%d,%d,%x)\n", x, y, flags));
+
+ if (psav->Duoview) {
+ x = 0;
+ y = 0;
+ }
if (!psav->bTiled) {
left = x - x % 64;
@@ -3246,6 +3448,66 @@
address = top * psav->lDelta + left * TILE_SIZE_BYTE / TILEWIDTH_32BPP;
}
}
+
+ if (psav->Duoview) {
+ if (psav->CRT2Relation == 0) { /* left */
+ x2 = x + psav->CRT2XRes;
+ y2 = y;
+ } else if (psav->CRT2Relation == 1) { /* right */
+ x2 = x + psav->CRT2XRes;
+ y2 = y;
+ } else if (psav->CRT2Relation == 2) { /* above */
+ x2 = x;
+ y2 = y + psav->CRT2YRes;
+ } else if (psav->CRT2Relation == 3) { /* below */
+ x2 = x;
+ y2 = y + psav->CRT2YRes;
+ } else if (psav->CRT2Relation == 4) { /* clone */
+ x2 = x;
+ y2 = y;
+ }
+ if (!psav->bTiled) {
+ left2 = x2 - x2 % 64;
+ top2 = y2;
+ address2 = (top2 * psav->lDelta) + left2 * (pScrn->bitsPerPixel >> 3);
+ address2 = (address2 >> 5) << 5;
+ } else {
+ top2 = y2 - y2 % TILEHEIGHT;
+ if (pScrn->bitsPerPixel == 16) {
+ left2 = x2 - x2 % TILEWIDTH_16BPP;
+ address2 = top2 * psav->lDelta + left2 * TILE_SIZE_BYTE / TILEWIDTH_16BPP;
+ } else if (pScrn->bitsPerPixel == 32) {
+ left = x2 - x2 % TILEWIDTH_32BPP;
+ address2 = top2 * psav->lDelta + left2 * TILE_SIZE_BYTE / TILEWIDTH_32BPP;
+ }
+ }
+ }
+
+ address += pScrn->fbOffset;
+ address2 += pScrn->fbOffset;
+
+ if (psav->Duoview) {
+ if (psav->CRT2Relation == 0) { /* left */
+ crtc1_base = address2;
+ crtc2_base = address;
+ } else if (psav->CRT2Relation == 1) { /* right */
+ crtc1_base = address;
+ crtc2_base = address2;
+ } else if (psav->CRT2Relation == 2) { /* above */
+ crtc1_base = address2;
+ crtc2_base = address;
+ } else if (psav->CRT2Relation == 3) { /* below */
+ crtc1_base = address;
+ crtc2_base = address2;
+ } else if (psav->CRT2Relation == 4) { /* clone */
+ crtc1_base = address;
+ crtc2_base = address2;
+ }
+ } else {
+ crtc1_base = address;
+ crtc2_base = address;
+ }
+
/*
* because we align the viewport to the width and height of one tile
@@ -3254,8 +3516,26 @@
pScrn->frameX0 = left;
pScrn->frameY0 = top;
pScrn->frameX1 = left + currentMode->HDisplay - 1;
- pScrn->frameY1 = top+ currentMode->VDisplay - 1;
+ pScrn->frameY1 = top + currentMode->VDisplay - 1;
+
+ if (psav->Chipset == S3_SAVAGE_MX) {
+ OUTREG32(PRI_STREAM_FBUF_ADDR0, crtc1_base | 0xFFFFFFFC);
+ OUTREG32(PRI_STREAM_FBUF_ADDR1, crtc1_base & 0xFFFFFFFC);/* IGA1 */
+ OUTREG32(PRI_STREAM2_FBUF_ADDR0, ((crtc2_base & 0x01FFFFFF) | 0x80000000));/* IGA2 */
+ OUTREG32(PRI_STREAM2_FBUF_ADDR1, ((crtc2_base & 0x01FFFFFF) | 0x80000000));
+ } else if (psav->Chipset == S3_SUPERSAVAGE) {
+ /* IGA1 */
+ OUTREG32(PRI_STREAM_FBUF_ADDR0, crtc1_base | 0xFFFFFFF8);
+ OUTREG32(PRI_STREAM_FBUF_ADDR1, crtc1_base & 0xFFFFFFF8);
+ /* IGA2 */
+ OUTREG32(PRI_STREAM2_FBUF_ADDR0, ((crtc2_base & 0xFFFFFFF8) | 0x80000000));
+ OUTREG32(PRI_STREAM2_FBUF_ADDR1, crtc2_base & 0xFFFFFFF8);
+ } else {
+ OUTREG32(PRI_STREAM_FBUF_ADDR0, crtc1_base | 0xFFFFFFFC);
+ OUTREG32(PRI_STREAM_FBUF_ADDR1, crtc1_base | 0x80000000);
+ }
+#if 0
if (S3_SAVAGE_MOBILE_SERIES(psav->Chipset)) {
OUTREG32(PRI_STREAM_FBUF_ADDR0,address | 0xFFFFFFFC); /* IGA1 */
OUTREG32(PRI_STREAM_FBUF_ADDR1,address | 0x80000000);
@@ -3265,7 +3545,7 @@
OUTREG32(PRI_STREAM_FBUF_ADDR0,address | 0xFFFFFFFC);
OUTREG32(PRI_STREAM_FBUF_ADDR1,address | 0x80000000);
}
-
+#endif
return;
}
@@ -3287,7 +3567,7 @@
y += pScrn->virtualY - 1;
Base = ((y * pScrn->displayWidth + (x&~1)) *
- (pScrn->bitsPerPixel / 8)) >> 2;
+ (psav->primStreamBpp / 8)) >> 2;
/* now program the start address registers */
VGAOUT16(vgaCRIndex, (Base & 0x00ff00) | 0x0c);
VGAOUT16(vgaCRIndex, ((Base & 0x00ff) << 8) | 0x0d);
@@ -3301,6 +3581,7 @@
Bool SavageSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
{
TRACE(("SavageSwitchMode\n"));
+ SavageStreamsOff(xf86Screens[scrnIndex]);
return SavageModeInit(xf86Screens[scrnIndex], mode);
}
@@ -3363,14 +3644,48 @@
{
SavagePtr psav = SAVPTR(pScrn);
int i, index;
-
+ int updateKey = -1;
+
for (i=0; icolorKey) updateKey = index;
VGAOUT8(0x3c8, index);
VGAOUT8(0x3c9, colors[index].red);
VGAOUT8(0x3c9, colors[index].green);
VGAOUT8(0x3c9, colors[index].blue);
}
+ if (updateKey != -1)
+ SavageUpdateKey(pScrn, colors[updateKey].red, colors[updateKey].green,
+ colors[updateKey].blue);
+}
+
+#define Shift(v,d) ((d) < 0 ? ((v) >> (-d)) : ((v) << (d)))
+
+static void
+SavageUpdateKey(ScrnInfoPtr pScrn, int r, int g, int b)
+{
+ ScreenPtr pScreen;
+ SavagePtr psav = SAVPTR(pScrn);
+ FbOverlayScrPrivPtr pScrOvlPriv;
+ CARD32 key;
+ int ul = 0, ol = 1;
+
+ if (pScrn->depth != 8) {
+ ul = 1;
+ ol = 0;
+ }
+ if (!(pScreen = pScrn->pScreen)
+ || !(pScrOvlPriv = fbOverlayGetScrPriv(pScreen)))
+ return;
+ key = ((Shift(r,psav->overlay.redShift) & psav->overlay.redMask)
+ | (Shift(g,psav->overlay.greenShift) & psav->overlay.greenMask)
+ | (Shift(b,psav->overlay.blueShift) & psav->overlay.blueMask));
+ if (pScrOvlPriv->layer[ol].key != key) {
+ pScrOvlPriv->layer[ol].key = key;
+ (*pScrOvlPriv->PaintKey) (&pScrOvlPriv->layer[ol].u.run.pixmap->drawable,
+ &pScrOvlPriv->layer[ul].u.run.region,
+ pScrOvlPriv->layer[ol].key, ol);
+ }
}
#if 0
@@ -3382,12 +3697,9 @@
{
SavagePtr psav = SAVPTR(pScrn);
int i, index;
-
+ int updateKey = -1;
+
vgaHWPtr hwp = VGAHWPTR(pScrn);
- int vgaCRIndex, vgaCRReg, vgaIOBase;
- vgaIOBase = hwp->IOBase;
- vgaCRIndex = vgaIOBase + 4;
- vgaCRReg = vgaIOBase + 5;
VerticalRetraceWait();
for (i=0; icolorKey) updateKey = index;
}
+ if (updateKey != -1)
+ SavageUpdateKey(pScrn, colors[updateKey].red, colors[updateKey].green,
+ colors[updateKey].blue);
}
-
-
static void SavageCalcClock(long freq, int min_m, int min_n1, int max_n1,
/* Make sure linear addressing is enabled after the BIOS call. */
@@ -3619,11 +3933,8 @@
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Invalid DPMS mode %d\n", mode);
break;
}
-
- if ( (!psav->CrtOnly) && psav->UseBIOS && psav->PanelX ) {
- SavageSetPanelEnabled(psav, (mode == DPMSModeOn));
- }
- else if ((!psav->CrtOnly) && psav->PanelX) {
+
+ if ((!psav->CrtOnly) && psav->PanelX) {
switch (mode) {
case DPMSModeOn:
VGAOUT8(0x3c4, 0x31); /* SR31 bit 4 - FP enable */
Index: savage_driver.h
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h,v
retrieving revision 1.12
diff -u -r1.12 savage_driver.h
--- savage_driver.h 23 Mar 2004 21:11:37 -0000 1.12
+++ savage_driver.h 15 Aug 2004 19:18:41 -0000
@@ -1,8 +1,10 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h,v 1.11 2001/08/09 19:14:13 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h,v 1.16 2003/01/18 15:22:30 eich Exp $ */
#ifndef SAVAGE_VGAHWMMIO_H
#define SAVAGE_VGAHWMMIO_H
+#define MODE_24 24
+
#include "xf86_ansic.h"
#include "compiler.h"
#include "vgaHW.h"
@@ -15,6 +17,7 @@
#include "mipointer.h"
#include "micmap.h"
#include "fb.h"
+#include "fboverlay.h"
#include "xf86cmap.h"
#include "vbe.h"
#include "xaa.h"
@@ -110,6 +113,11 @@
unsigned int MMPR0, MMPR1, MMPR2, MMPR3;
} SavageRegRec, *SavageRegPtr;
+typedef struct {
+ CARD32 redMask, greenMask, blueMask;
+ int redShift, greenShift, blueShift;
+} savageOverlayRec;
+
/* Tiling defines */
#define TILE_SIZE_BYTE 2048 /* 0x800, 2K */
@@ -169,8 +177,8 @@
int videoRambytes;
int videoRamKbytes;
int MemOffScreen;
- int endfb;
- CARD32 CursorKByte;
+ int CursorKByte;
+ int endfb;
/* These are physical addresses. */
unsigned long FrameBufferBase;
@@ -205,6 +213,7 @@
Bool fifo_moderate;
Bool fifo_aggressive;
Bool hwcursor;
+ Bool hwc_on;
Bool NoAccel;
Bool shadowFB;
Bool UseBIOS;
@@ -265,8 +274,6 @@
unsigned int SavedSbdOffset;
unsigned int SavedSbd;
- /* Support for Int10 processing */
- xf86Int10InfoPtr pInt10;
SavageModeTablePtr ModeTable;
/* Support for the Savage command overflow buffer. */
@@ -290,6 +297,12 @@
int dwBCIWait2DIdle;
XF86OffscreenImagePtr offscreenImages;
+ /* Support for Overlays */
+ unsigned char * FBStart2nd;
+ savageOverlayRec overlay;
+ int overlayDepth;
+ int primStreamBpp;
+
#ifdef XF86DRI
int LockHeld;
Bool directRenderingEnabled;
@@ -348,6 +361,18 @@
StatInfoRec StatInfo; /* save the SVGA state */
+ Bool Duoview;
+ int CRT2Refresh;
+ int CRT2BIOSMode;
+ int CRT2XRes;
+ int CRT2YRes;
+ int CRT2Relation; /* 0 = left of crtc1
+ 1 = right
+ 2 = above
+ 3 = below
+ 4 = clone
+ */
+
} SavageRec, *SavagePtr;
/* Video flags. */
@@ -356,6 +381,14 @@
#define SAVPTR(p) ((SavagePtr)((p)->driverPrivate))
+/* Make the names of these externals driver-unique */
+#define gpScrn savagegpScrn
+#define readdw savagereaddw
+#define readfb savagereadfb
+#define writedw savagewritedw
+#define writefb savagewritefb
+#define writescan savagewritescan
+
/* add for support DRI */
#ifdef XF86DRI
@@ -431,9 +464,10 @@
void SavageSetTextMode( SavagePtr psav );
void SavageSetVESAMode( SavagePtr psav, int n, int Refresh );
-void SavageSetPanelEnabled( SavagePtr psav, Bool active );
void SavageFreeBIOSModeTable( SavagePtr psav, SavageModeTablePtr* ppTable );
SavageModeTablePtr SavageGetBIOSModeTable( SavagePtr psav, int iDepth );
+ModeStatus SavageMatchBiosMode(ScrnInfoPtr pScrn,int width,int height,int refresh,
+ unsigned int *vesaMode,unsigned int *newRefresh);
unsigned short SavageGetBIOSModes(
SavagePtr psav,
@@ -444,5 +478,22 @@
void SavageInitVideo( ScreenPtr pScreen );
+/* In savage_streams.c */
+
+void SavageStreamsOn(ScrnInfoPtr pScrn);
+void SavageStreamsOff(ScrnInfoPtr pScrn);
+void SavageInitSecondaryStream(ScrnInfoPtr pScrn);
+
+#if (MODE_24 == 32)
+# define BYTES_PP24 4
+#else
+# define BYTES_PP24 3
+#endif
+
+
+#define DEPTH_BPP(depth) (depth == 24 ? (BYTES_PP24 << 3) : (depth + 7) & ~0x7)
+#define DEPTH_2ND(pScrn) (pScrn->depth > 8 ? pScrn->depth\
+ : SAVPTR(pScrn)->overlayDepth)
+
#endif /* SAVAGE_VGAHWMMIO_H */
Index: savage_hwmc.c
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_hwmc.c,v
retrieving revision 1.3
diff -u -r1.3 savage_hwmc.c
--- savage_hwmc.c 2 Mar 2004 18:15:45 -0000 1.3
+++ savage_hwmc.c 15 Aug 2004 19:18:41 -0000
@@ -64,7 +64,7 @@
typedef struct {
- drmContext drmcontext;
+ drm_context_t drmcontext;
unsigned int fbBase;
unsigned int MMIOHandle;
unsigned int MMIOSize;
Index: savage_image.c
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 savage_image.c
--- savage_image.c 22 Oct 2002 13:40:42 -0000 1.1.1.5
+++ savage_image.c 15 Aug 2004 19:18:41 -0000
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c,v 1.6 2002/05/14 20:19:52 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c,v 1.4 2001/05/18 23:35:32 dawes Exp $ */
#include "savage_driver.h"
#include "xaarop.h"
@@ -181,13 +181,11 @@
{
SavagePtr psav = SAVPTR(pScrn);
BCI_GET_PTR;
- int count;
- count = ((w * pScrn->bitsPerPixel + 31) / 32) * h;
- psav->WaitQueue( psav, count );
+ psav->WaitQueue( psav, 6 );
BCI_SEND(psav->SavedBciCmd);
BCI_SEND(BCI_CLIP_LR(x+skipleft, x+w-1));
- if( psav->SavedBgColor != -1 )
+ if( psav->SavedBgColor != 0xffffffff )
BCI_SEND(psav->SavedBgColor);
BCI_SEND(BCI_X_Y(x, y));
BCI_SEND(BCI_W_H(w, h));
Index: savage_regs.h
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h,v
retrieving revision 1.10
diff -u -r1.10 savage_regs.h
--- savage_regs.h 2 Mar 2004 18:15:45 -0000 1.10
+++ savage_regs.h 15 Aug 2004 19:18:41 -0000
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h,v 1.10 2001/11/04 22:17:48 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h,v 1.11 2002/05/14 20:19:52 alanh Exp $ */
#ifndef _SAVAGE_REGS_H
#define _SAVAGE_REGS_H
@@ -159,168 +159,26 @@
#define S3_SEC_BD_LOW 0X8178
#define S3_SEC_BD_HIGH 0X817c
-
-/**** S3 streams processor*****/
-
-#define EXT_MISC_CTRL2 0x67
-/* CR67[2] = 1 : enable stream 1 */
-#define ENABLE_STREAM1 0x04
-/* CR67[1] = 1 : enable stream 2 */
-#define ENABLE_STREAM2 0x02
-/* mask to clear CR67[2,1] */
-#define NO_STREAMS 0xF9
-/* CR67[3] = 1 : Mem-mapped regs */
-#define USE_MM_FOR_PRI_STREAM 0x08
-#define HDM_SHIFT 16
-#define HDSCALE_4 (2 << HDM_SHIFT)
-#define HDSCALE_8 (3 << HDM_SHIFT)
-#define HDSCALE_16 (4 << HDM_SHIFT)
-#define HDSCALE_32 (5 << HDM_SHIFT)
-#define HDSCALE_64 (6 << HDM_SHIFT)
-
-/* Old Streams */
-
-#define ENABLE_STREAMS_OLD 0x0c
-#define NO_STREAMS_OLD 0xf3
-/* CR69[0] = 1 : Mem-mapped regs */
-#define USE_MM_FOR_PRI_STREAM_OLD 0x01
-
+/* duoview */
#define SELECT_IGA1 0x4026
#define SELECT_IGA2_READS_WRITES 0x4f26
+#define SelectIGA1() \
+do { \
+ OUTREG16(SEQ_ADDRESS_REG,SELECT_IGA1); \
+} while (0)
+
+#define SelectIGA2() \
+do { \
+ OUTREG16(SEQ_ADDRESS_REG,SELECT_IGA2_READS_WRITES); \
+} while (0)
+
#define MEM_PS1 0x10 /*CRCA_4 :Primary stream 1*/
#define MEM_PS2 0x20 /*CRCA_5 :Primary stream 2*/
#define MEM_SS1 0x40 /*CRCA_6 :Secondary stream 1*/
#define MEM_SS2 0x80 /*CRCA_7 :Secondary stream 2*/
-/*
- * There are two different streams engines used in the Savage line.
- * The old engine is in the 3D, 4, Pro, and Twister.
- * The new engine is in the 2000, MX, IX, and Super.
- */
-
-/* Stream Processor 1 */
-
-/* Primary Stream 1 Frame Buffer Address 0 */
-#define PRI_STREAM_FBUF_ADDR0 0x81c0
-/* Primary Stream 1 Frame Buffer Address 0 */
-#define PRI_STREAM_FBUF_ADDR1 0x81c4
-/* Primary Stream 1 Stride */
-#define PRI_STREAM_STRIDE 0x81c8
-/* Primary Stream 1 Frame Buffer Size */
-#define PRI_STREAM_BUFFERSIZE 0x8214
-
-/* Secondary stream 1 Color/Chroma Key Control */
-#define SEC_STREAM_CKEY_LOW 0x8184
-/* Secondary stream 1 Chroma Key Upper Bound */
-#define SEC_STREAM_CKEY_UPPER 0x8194
-/* Blend Control of Secondary Stream 1 & 2 */
-#define BLEND_CONTROL 0x8190
-/* Secondary Stream 1 Color conversion/Adjustment 1 */
-#define SEC_STREAM_COLOR_CONVERT1 0x8198
-/* Secondary Stream 1 Color conversion/Adjustment 2 */
-#define SEC_STREAM_COLOR_CONVERT2 0x819c
-/* Secondary Stream 1 Color conversion/Adjustment 3 */
-#define SEC_STREAM_COLOR_CONVERT3 0x81e4
-/* Secondary Stream 1 Horizontal Scaling */
-#define SEC_STREAM_HSCALING 0x81a0
-/* Secondary Stream 1 Frame Buffer Size */
-#define SEC_STREAM_BUFFERSIZE 0x81a8
-/* Secondary Stream 1 Horizontal Scaling Normalization (2K only) */
-#define SEC_STREAM_HSCALE_NORMALIZE 0x81ac
-/* Secondary Stream 1 Horizontal Scaling */
-#define SEC_STREAM_VSCALING 0x81e8
-/* Secondary Stream 1 Frame Buffer Address 0 */
-#define SEC_STREAM_FBUF_ADDR0 0x81d0
-/* Secondary Stream 1 Frame Buffer Address 1 */
-#define SEC_STREAM_FBUF_ADDR1 0x81d4
-/* Secondary Stream 1 Frame Buffer Address 2 */
-#define SEC_STREAM_FBUF_ADDR2 0x81ec
-/* Secondary Stream 1 Stride */
-#define SEC_STREAM_STRIDE 0x81d8
-/* Secondary Stream 1 Window Start Coordinates */
-#define SEC_STREAM_WINDOW_START 0x81f8
-/* Secondary Stream 1 Window Size */
-#define SEC_STREAM_WINDOW_SZ 0x81fc
-/* Secondary Streams Tile Offset */
-#define SEC_STREAM_TILE_OFF 0x821c
-/* Secondary Stream 1 Opaque Overlay Control */
-#define SEC_STREAM_OPAQUE_OVERLAY 0x81dc
-
-
-/* Stream Processor 2 */
-
-/* Primary Stream 2 Frame Buffer Address 0 */
-#define PRI_STREAM2_FBUF_ADDR0 0x81b0
-/* Primary Stream 2 Frame Buffer Address 1 */
-#define PRI_STREAM2_FBUF_ADDR1 0x81b4
-/* Primary Stream 2 Stride */
-#define PRI_STREAM2_STRIDE 0x81b8
-/* Primary Stream 2 Frame Buffer Size */
-#define PRI_STREAM2_BUFFERSIZE 0x8218
-
-/* Secondary Stream 2 Color/Chroma Key Control */
-#define SEC_STREAM2_CKEY_LOW 0x8188
-/* Secondary Stream 2 Chroma Key Upper Bound */
-#define SEC_STREAM2_CKEY_UPPER 0x818c
-/* Secondary Stream 2 Horizontal Scaling */
-#define SEC_STREAM2_HSCALING 0x81a4
-/* Secondary Stream 2 Horizontal Scaling */
-#define SEC_STREAM2_VSCALING 0x8204
-/* Secondary Stream 2 Frame Buffer Size */
-#define SEC_STREAM2_BUFFERSIZE 0x81ac
-/* Secondary Stream 2 Frame Buffer Address 0 */
-#define SEC_STREAM2_FBUF_ADDR0 0x81bc
-/* Secondary Stream 2 Frame Buffer Address 1 */
-#define SEC_STREAM2_FBUF_ADDR1 0x81e0
-/* Secondary Stream 2 Frame Buffer Address 2 */
-#define SEC_STREAM2_FBUF_ADDR2 0x8208
-/* Multiple Buffer/LPB and Secondary Stream 2 Stride */
-#define SEC_STREAM2_STRIDE_LPB 0x81cc
-/* Secondary Stream 2 Color conversion/Adjustment 1 */
-#define SEC_STREAM2_COLOR_CONVERT1 0x81f0
-/* Secondary Stream 2 Color conversion/Adjustment 2 */
-#define SEC_STREAM2_COLOR_CONVERT2 0x81f4
-/* Secondary Stream 2 Color conversion/Adjustment 3 */
-#define SEC_STREAM2_COLOR_CONVERT3 0x8200
-/* Secondary Stream 2 Window Start Coordinates */
-#define SEC_STREAM2_WINDOW_START 0x820c
-/* Secondary Stream 2 Window Size */
-#define SEC_STREAM2_WINDOW_SZ 0x8210
-/* Secondary Stream 2 Opaque Overlay Control */
-#define SEC_STREAM2_OPAQUE_OVERLAY 0x8180
-
-/* streams registers for old engine */
-#define PSTREAM_CONTROL_REG 0x8180
-#define COL_CHROMA_KEY_CONTROL_REG 0x8184
-#define SSTREAM_CONTROL_REG 0x8190
-#define CHROMA_KEY_UPPER_BOUND_REG 0x8194
-#define SSTREAM_STRETCH_REG 0x8198
-#define COLOR_ADJUSTMENT_REG 0x819C
-#define BLEND_CONTROL_REG 0x81A0
-#define PSTREAM_FBADDR0_REG 0x81C0
-#define PSTREAM_FBADDR1_REG 0x81C4
-#define PSTREAM_STRIDE_REG 0x81C8
-#define DOUBLE_BUFFER_REG 0x81CC
-/* updated by peterzhu,original define is DOUBLE_BUFFER_REG*/
-#define MULTIPLE_BUFFER_REG 0x81CC
-#define SSTREAM_FBADDR0_REG 0x81D0
-#define SSTREAM_FBADDR1_REG 0x81D4
-#define SSTREAM_STRIDE_REG 0x81D8
-#define SSTREAM_VSCALE_REG 0x81E0
-#define SSTREAM_VINITIAL_REG 0x81E4
-#define SSTREAM_LINES_REG 0x81E8
-#define STREAMS_FIFO_REG 0x81EC
-#define PSTREAM_WINDOW_START_REG 0x81F0
-#define PSTREAM_WINDOW_SIZE_REG 0x81F4
-#define SSTREAM_WINDOW_START_REG 0x81F8
-#define SSTREAM_WINDOW_SIZE_REG 0x81FC
-#define FIFO_CONTROL 0x8200
-#define PSTREAM_FBSIZE_REG 0x8300
-#define SSTREAM_FBSIZE_REG 0x8304
-#define SSTREAM_FBADDR2_REG 0x8308
-
#define SUBSYS_STAT_REG 0x8504
#define SRC_BASE 0xa4d4
@@ -342,21 +200,6 @@
#define TILED_SURF_BPP16 0x80000000 /* bits 31-30=10 for 16 bits/pixel */
#define TILED_SURF_BPP32 0xC0000000 /* bits 31-30=11 for 32 bits/pixel */
-/* Streams Processor macros */
-#define H_Shift 0
-#define H_Mask (((1L << 11) - 1) << H_Shift)
-#define W_Shift 16
-#define W_Mask (((1L << 11) - 1) << W_Shift)
-
-#define Y_Shift 0
-#define Y_Mask (((1L << 11) - 1) << Y_Shift)
-#define X_Shift 16
-#define X_Mask (((1L << 11) - 1) << X_Shift)
-
-#define XY(x,y) ((((x+1)<vgaIOBase+4); \
- VGAOUT8(psav->vgaIOBase+4, 0x17); \
- if (VGAIN8(psav->vgaIOBase+5) & 0x80) { \
- while ((VGAIN8(psav->vgaIOBase + 0x0a) & 0x08) == 0x08) ; \
- while ((VGAIN8(psav->vgaIOBase + 0x0a) & 0x08) == 0x00) ; \
- } \
-}
-#endif /* tim's code */
#define HZEXP_COMP_1 0x54
#define HZEXP_BORDER 0x58
Index: savage_shadow.c
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_shadow.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 savage_shadow.c
--- savage_shadow.c 22 Oct 2002 13:40:42 -0000 1.1.1.2
+++ savage_shadow.c 15 Aug 2004 19:18:41 -0000
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_shadow.c,v 1.2 2002/05/14 20:19:52 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_shadow.c,v 1.3 2000/03/31 20:13:33 dawes Exp $ */
/*
Copyright (c) 1999,2000 The XFree86 Project Inc.
Index: savage_vbe.c
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c,v
retrieving revision 1.3
diff -u -r1.3 savage_vbe.c
--- savage_vbe.c 22 Feb 2004 16:14:42 -0000 1.3
+++ savage_vbe.c 15 Aug 2004 19:18:41 -0000
@@ -1,8 +1,10 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c,v 1.9 2001/05/19 02:05:55 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c,v 1.11 2002/05/14 20:19:52 alanh Exp $ */
#include "savage_driver.h"
#include "savage_vbe.h"
+#define iabs(a) ((int)(a)>0?(a):(-(a)))
+
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
#define B_O16(x) (x)
#define B_O32(x) (x)
@@ -16,6 +18,8 @@
Bool vbeModeInit( vbeInfoPtr, int );
static int SavageGetDevice( SavagePtr psav );
/*static int SavageGetTVType( SavagePtr psav );*/
+void SavageSetVESAModeCrtc1( SavagePtr psav, int n, int Refresh );
+void SavageSetVESAModeCrtc2( SavagePtr psav, int n, int Refresh );
static void
SavageClearVM86Regs( xf86Int10InfoPtr pInt )
@@ -35,20 +39,81 @@
{
/* Restore display device if changed. */
if( psav->iDevInfo != psav->iDevInfoPrim ) {
- SavageClearVM86Regs( psav->pInt10 );
- psav->pInt10->ax = 0x4f14;
- psav->pInt10->bx = 0x0003;
- psav->pInt10->cx = psav->iDevInfoPrim;
- xf86ExecX86int10( psav->pInt10 );
+ SavageClearVM86Regs( psav->pVbe->pInt10 );
+ psav->pVbe->pInt10->ax = 0x4f14;
+ psav->pVbe->pInt10->bx = 0x0003;
+ psav->pVbe->pInt10->cx = psav->iDevInfoPrim;
+ xf86ExecX86int10( psav->pVbe->pInt10 );
}
- SavageClearVM86Regs( psav->pInt10 );
+ SavageClearVM86Regs( psav->pVbe->pInt10 );
- psav->pInt10->ax = 0x83;
+ psav->pVbe->pInt10->ax = 0x83;
- xf86ExecX86int10( psav->pInt10 );
+ xf86ExecX86int10( psav->pVbe->pInt10 );
}
+void
+SavageSetVESAModeCrtc1(SavagePtr psav, int n, int refresh)
+{
+ unsigned char byte;
+
+ xf86Msg(X_INFO,"SavageSetVESAMode:mode=0x%x,refresh=%dHZ\n",n,refresh);
+
+ SavageClearVM86Regs(psav->pVbe->pInt10);
+
+ /* set active displays. */
+ psav->pVbe->pInt10->ax = S3_EXTBIOS_INFO;
+ psav->pVbe->pInt10->bx = S3_SET_ACTIVE_DISP;
+ psav->pVbe->pInt10->cx = 0x83; /* lcd, crt, duoview */
+ xf86ExecX86int10(psav->pVbe->pInt10);
+
+ SavageClearVM86Regs(psav->pVbe->pInt10);
+
+ /* Establish the refresh rate for this mode. */
+ psav->pVbe->pInt10->ax = S3_EXTBIOS_INFO;
+ psav->pVbe->pInt10->bx = S3_SET_REFRESH;
+ psav->pVbe->pInt10->cx = n & 0x1ff;
+ psav->pVbe->pInt10->di = refresh & 0xffff;
+ xf86ExecX86int10(psav->pVbe->pInt10);
+
+ /* SR01:turn off screen */
+ OUTREG8 (SEQ_ADDRESS_REG,0x01);
+ byte = INREG8(SEQ_DATA_REG) | 0x20;
+ OUTREG8(SEQ_DATA_REG,byte);
+
+ psav->pVbe->pInt10->ax = BIOS_SET_VBE_MODE;
+ psav->pVbe->pInt10->bx = n;
+ xf86ExecX86int10(psav->pVbe->pInt10);
+
+}
+
+void
+SavageSetVESAModeCrtc2( SavagePtr psav, int n, int refresh )
+{
+ SavageClearVM86Regs(psav->pVbe->pInt10);
+
+ UnLockExtRegs();
+
+ psav->pVbe->pInt10->ax = S3_EXTBIOS_INFO;
+ psav->pVbe->pInt10->bx = S3_ALT_SET_ACTIVE_DISP;
+ psav->pVbe->pInt10->cx = 0x83; /* lcd, crt, duoview */
+ psav->pVbe->pInt10->dx = n & 0x1ff;
+ psav->pVbe->pInt10->di = refresh & 0xffff;
+ xf86ExecX86int10(psav->pVbe->pInt10);
+
+}
+
+#if 0
+void
+SavageSetVESAMode(SavagePtr psav, int n, int refresh)
+{
+
+ SavageSetVESAModeCrtc1(psav, n, refresh);
+ SavageSetVESAModeCrtc2(psav, psav->CRT2BIOSMode, psav->CRT2Refresh);
+
+}
+#endif
void
SavageSetVESAMode( SavagePtr psav, int n, int Refresh )
@@ -56,6 +121,12 @@
int iDevInfo;
static int iCount = 0;
+ if (psav->Duoview) {
+ SavageSetVESAModeCrtc1(psav, n, Refresh);
+ SavageSetVESAModeCrtc2(psav, psav->CRT2BIOSMode, psav->CRT2Refresh);
+ return;
+ }
+
/* Get current display device status. */
iDevInfo = SavageGetDevice(psav);
@@ -69,31 +140,31 @@
/* Establish the refresh rate for this mode. */
- SavageClearVM86Regs( psav->pInt10 );
- psav->pInt10->ax = 0x4f14; /* S3 extensions */
- psav->pInt10->bx = 0x0001; /* Set default refresh rate */
- psav->pInt10->cx = n & 0x3fff;
- psav->pInt10->di = Refresh & 0xffff;
+ SavageClearVM86Regs( psav->pVbe->pInt10 );
+ psav->pVbe->pInt10->ax = 0x4f14; /* S3 extensions */
+ psav->pVbe->pInt10->bx = 0x0001; /* Set default refresh rate */
+ psav->pVbe->pInt10->cx = n & 0x3fff;
+ psav->pVbe->pInt10->di = Refresh & 0xffff;
- xf86ExecX86int10( psav->pInt10 );
+ xf86ExecX86int10( psav->pVbe->pInt10 );
/* Set TV type if TV is on. */
if( psav->TvOn ) {
- SavageClearVM86Regs( psav->pInt10 );
- psav->pInt10->ax = 0x4f14; /* S3 extensions */
- psav->pInt10->bx = 0x0007; /* TV extensions */
- psav->pInt10->cx = psav->PAL ? 0x08 : 0x04;
- psav->pInt10->dx = 0x0c;
- xf86ExecX86int10( psav->pInt10 );
+ SavageClearVM86Regs( psav->pVbe->pInt10 );
+ psav->pVbe->pInt10->ax = 0x4f14; /* S3 extensions */
+ psav->pVbe->pInt10->bx = 0x0007; /* TV extensions */
+ psav->pVbe->pInt10->cx = psav->PAL ? 0x08 : 0x04;
+ psav->pVbe->pInt10->dx = 0x0c;
+ xf86ExecX86int10( psav->pVbe->pInt10 );
}
/* Manipulate output device set. */
if( psav->iDevInfo != iDevInfo ) {
- SavageClearVM86Regs( psav->pInt10 );
- psav->pInt10->ax = 0x4f14; /* S3 extensions */
- psav->pInt10->bx = 0x0003; /* set active devices */
- psav->pInt10->cx = psav->iDevInfo;
- xf86ExecX86int10( psav->pInt10 );
+ SavageClearVM86Regs( psav->pVbe->pInt10 );
+ psav->pVbe->pInt10->ax = 0x4f14; /* S3 extensions */
+ psav->pVbe->pInt10->bx = 0x0003; /* set active devices */
+ psav->pVbe->pInt10->cx = psav->PAL ? 0x08 : 0x04;
+ xf86ExecX86int10( psav->pVbe->pInt10 );
/* Re-fetch actual device set. */
psav->iDevInfo = SavageGetDevice( psav );
@@ -123,36 +194,17 @@
}
-void
-SavageSetPanelEnabled( SavagePtr psav, Bool active )
-{
- int iDevInfo;
- if( !psav->PanelX )
- return; /* no panel */
- iDevInfo = SavageGetDevice( psav );
- if( active )
- iDevInfo |= LCD_ACTIVE;
- else
- iDevInfo &= ~LCD_ACTIVE;
- SavageClearVM86Regs( psav->pInt10 );
- psav->pInt10->ax = 0x4f14; /* S3 extensions */
- psav->pInt10->bx = 0x0003; /* set active devices */
- psav->pInt10->cx = iDevInfo;
- xf86ExecX86int10( psav->pInt10 );
-}
-
-
/* Function to get supported device list. */
static int SavageGetDevice( SavagePtr psav )
{
- SavageClearVM86Regs( psav->pInt10 );
- psav->pInt10->ax = 0x4f14; /* S3 extensions */
- psav->pInt10->bx = 0x0103; /* get active devices */
+ SavageClearVM86Regs( psav->pVbe->pInt10 );
+ psav->pVbe->pInt10->ax = 0x4f14; /* S3 extensions */
+ psav->pVbe->pInt10->bx = 0x0103; /* get active devices */
- xf86ExecX86int10( psav->pInt10 );
+ xf86ExecX86int10( psav->pVbe->pInt10 );
- return ((psav->pInt10->cx) & 0xf);
+ return ((psav->pVbe->pInt10->cx) & 0xf);
}
@@ -202,15 +254,14 @@
unsigned short iModeCount = 0;
unsigned short int *mode_list;
pointer vbeLinear = NULL;
- vbeControllerInfoPtr vbe = NULL;
+ VbeInfoBlock *vbe;
int vbeReal;
struct vbe_mode_info_block * vmib;
if( !psav->pVbe )
return 0;
- vbe = (vbeControllerInfoPtr) psav->pVbe->memory;
- vbeLinear = xf86Int10AllocPages( psav->pInt10, 1, &vbeReal );
+ vbeLinear = xf86Int10AllocPages( psav->pVbe->pInt10, 1, &vbeReal );
if( !vbeLinear )
{
ErrorF( "Cannot allocate scratch page in real mode memory." );
@@ -218,12 +269,11 @@
}
vmib = (struct vbe_mode_info_block *) vbeLinear;
- for (
- mode_list = xf86int10Addr( psav->pInt10, L_ADD(vbe->VideoModePtr) );
- *mode_list != 0xffff;
- mode_list++
- )
- {
+ if (!(vbe = VBEGetVBEInfo(psav->pVbe)))
+ return 0;
+
+ for (mode_list = vbe->VideoModePtr; *mode_list != 0xffff; mode_list++) {
+
/*
* This is a HACK to work around what I believe is a BUG in the
* Toshiba Satellite BIOSes in 08/2000 and 09/2000. The BIOS
@@ -239,15 +289,15 @@
if( *mode_list >= 0x0200 )
continue;
- SavageClearVM86Regs( psav->pInt10 );
+ SavageClearVM86Regs( psav->pVbe->pInt10 );
- psav->pInt10->ax = 0x4f01;
- psav->pInt10->cx = *mode_list;
- psav->pInt10->es = SEG_ADDR(vbeReal);
- psav->pInt10->di = SEG_OFF(vbeReal);
- psav->pInt10->num = 0x10;
+ psav->pVbe->pInt10->ax = 0x4f01;
+ psav->pVbe->pInt10->cx = *mode_list;
+ psav->pVbe->pInt10->es = SEG_ADDR(vbeReal);
+ psav->pVbe->pInt10->di = SEG_OFF(vbeReal);
+ psav->pVbe->pInt10->num = 0x10;
- xf86ExecX86int10( psav->pInt10 );
+ xf86ExecX86int10( psav->pVbe->pInt10 );
if(
(vmib->bits_per_pixel == iDepth) &&
@@ -274,8 +324,8 @@
/* Query the refresh rates at this mode. */
- psav->pInt10->cx = *mode_list;
- psav->pInt10->dx = 0;
+ psav->pVbe->pInt10->cx = *mode_list;
+ psav->pVbe->pInt10->dx = 0;
do
{
@@ -299,14 +349,14 @@
}
}
- psav->pInt10->ax = 0x4f14; /* S3 extended functions */
- psav->pInt10->bx = 0x0201; /* query refresh rates */
- psav->pInt10->num = 0x10;
- xf86ExecX86int10( psav->pInt10 );
+ psav->pVbe->pInt10->ax = 0x4f14; /* S3 extended functions */
+ psav->pVbe->pInt10->bx = 0x0201; /* query refresh rates */
+ psav->pVbe->pInt10->num = 0x10;
+ xf86ExecX86int10( psav->pVbe->pInt10 );
- s3vModeTable->RefreshRate[iRefresh++] = psav->pInt10->di;
+ s3vModeTable->RefreshRate[iRefresh++] = psav->pVbe->pInt10->di;
}
- while( psav->pInt10->dx );
+ while( psav->pVbe->pInt10->dx );
s3vModeTable->RefreshCount = iRefresh;
@@ -315,7 +365,73 @@
}
}
- xf86Int10FreePages( psav->pInt10, vbeLinear, 1 );
+ VBEFreeVBEInfo(vbe);
+
+ xf86Int10FreePages( psav->pVbe->pInt10, vbeLinear, 1 );
return iModeCount;
}
+
+ModeStatus SavageMatchBiosMode(ScrnInfoPtr pScrn,int width,int height,int refresh,
+ unsigned int *vesaMode,unsigned int *newRefresh)
+{
+ SavageModeEntryPtr pmt;
+ Bool found = FALSE;
+ SavagePtr psav = SAVPTR(pScrn);
+ int i,j;
+
+ /* Scan through our BIOS list to locate the closest valid mode. */
+
+ /*
+ * If we ever break 4GHz clocks on video boards, we'll need to
+ * change this.
+ * refresh = (mode->Clock * 1000) / (mode->HTotal * mode->VTotal);
+ * now we use VRefresh directly,instead of by calculating from dot clock
+ */
+
+ for( i = 0, pmt = psav->ModeTable->Modes;
+ i < psav->ModeTable->NumModes;
+ i++, pmt++ )
+ {
+ if( (pmt->Width == width) &&
+ (pmt->Height == height) )
+ {
+ int jDelta = 99;
+ int jBest = 0;
+
+ /* We have an acceptable mode. Find a refresh rate. */
+ if (vesaMode)
+ *vesaMode = pmt->VesaMode;
+ for( j = 0; j < pmt->RefreshCount; j++ )
+ {
+ if( pmt->RefreshRate[j] == refresh )
+ {
+ /* Exact match. */
+ jBest = j;
+ break;
+ }
+ else if( iabs(pmt->RefreshRate[j] - refresh) < jDelta )
+ {
+ jDelta = iabs(pmt->RefreshRate[j] - refresh);
+ jBest = j;
+ }
+ }
+ if (newRefresh)
+ *newRefresh = pmt->RefreshRate[jBest];
+ found = TRUE;
+ break;
+ }
+ }
+
+ if( found ) {
+ /* Success: we found a match in the BIOS. */
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Chose mode %x at %dHz.\n", vesaMode, newRefresh );
+ return MODE_OK;
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "No suitable BIOS mode found for %dx%d %dHz.\n",
+ width, height, refresh);
+ return MODE_NOMODE;
+ }
+}
Index: savage_vbe.h
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.h,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 savage_vbe.h
--- savage_vbe.h 22 Oct 2002 13:40:41 -0000 1.1.1.2
+++ savage_vbe.h 15 Aug 2004 19:18:42 -0000
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.h,v 1.3 2002/05/14 20:19:52 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.h,v 1.1 2000/12/02 01:16:15 dawes Exp $ */
/*
This file was originally part of the Linux Real-Mode Interface, or LRMI.
@@ -16,6 +16,58 @@
#ifndef _SAVAGEVBE_H
#define _SAVAGEVBE_H
+/*
+ * Common BIOS functions
+ */
+
+#define BIOS_SET_VBE_MODE 0x4F02
+#define BIOS_GET_VBE_MODE 0x4F03
+#define BIOS_SVGA_STATE 0x4F04
+#define BIOS_LOG_SCANLINE 0x4F06
+#define BIOS_VBE_PM_SERVICE 0x4F10
+#define S3_EXTBIOS_INFO 0x4F14 /* S3 Extended BIOS services */
+#define BIOS_VBE_DDC 0x4F15
+
+/*************************************************************************
+ * Defines for BIOS compliant with S3 (Mobile and Desktop) PCI Video
+ * Bios External Interface Specification, Core Revision 3.02+
+ *
+ * e.g. used by Trio3D, GX-3
+ *************************************************************************/
+
+#define S3_GET_SVGA_BUF 0x0000
+#define S3_SAVE_SVGA_STATE 0x0001
+#define S3_RESTORE_SVGA_STATE 0x0002
+/*
+ * For S3_EXTBIOS_INFO (0x4F14) services
+ */
+#define S3_VBE_INFO 0x0000 /* fn0: Query S3/VBE info */
+
+#define S3_SET_REFRESH 0x0001 /* fn1,sub0: Set Refresh Rate for Mode */
+#define S3_GET_REFRESH 0x0101 /* fn1,sub1: Get Refresh Rate for Mode */
+#define S3_QUERY_REFRESH 0x0201 /* fn1,sub2: Query Refresh Rates for Mode */
+
+#define S3_QUERY_MODELIST 0x0202 /* fn2,sub2: Query Mode List */
+#define S3_GET_EXT_MODEINFO 0x0302 /* fn2,sub3: Get Extended Mode Info */
+
+#define S3_QUERY_ATTACHED 0x0004 /* fn4,sub0: Query detected displays */
+
+#define S3_GET_ACTIVE_DISP 0x0103 /* fn3,sub1: Get Active Display */
+#define S3_SET_ACTIVE_DISP 0x0003 /* fn3,sub0: Set Active Display */
+#define S3_ALT_SET_ACTIVE_DISP 0x8003 /* fn8003,sub0: Alternate Set Active Display */
+
+#define S3_SET_TV_CONFIG 0x0007 /* fn7,sub0: Set TV Configuration */
+#define S3_GET_TV_CONFIG 0x0107 /* fn7,sub1: Get TV Configuration */
+
+
+#define BIOS_CRT1_ONLY 0x01
+#define BIOS_LCD_ONLY 0x02
+#define BIOS_TV_NTSC 0x04
+#define BIOS_TV_PAL 0x08
+#define BIOS_TV_ONLY 0x0c
+#define BIOS_DVI_ONLY 0x20
+#define BIOS_DEVICE_MASK (BIOS_CRT1_ONLY|BIOS_LCD_ONLY|BIOS_TV_ONLY|BIOS_DVI_ONLY)
+
/* structures for vbe 2.0 */
#ifndef __GNUC__
Index: savage_video.c
===================================================================
RCS file: /cvs/dri/xc/xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c,v
retrieving revision 1.8
diff -u -r1.8 savage_video.c
--- savage_video.c 26 Mar 2004 17:09:05 -0000 1.8
+++ savage_video.c 15 Aug 2004 19:18:42 -0000
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c,v 1.7 2001/11/21 22:43:01 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c,v 1.17tsi Exp $ */
#include "Xv.h"
#include "dix.h"
@@ -6,10 +6,10 @@
#include "fourcc.h"
#include "savage_driver.h"
+#include "savage_streams.h"
#include "savage_regs.h"
#include "savage_bci.h"
-
#define OFF_DELAY 200 /* milliseconds */
#define FREE_DELAY 60000
@@ -19,24 +19,7 @@
#define TIMER_MASK (OFF_TIMER | FREE_TIMER)
-#define HSCALING_Shift 0
-#define HSCALING_Mask (((1L << 16)-1) << HSCALING_Shift)
-#define HSCALING(w0,w1) ((((unsigned int)(((double)w0/(double)w1) * (1 << 15))) \
- << HSCALING_Shift) \
- & HSCALING_Mask)
-
-#define VSCALING_Shift 0
-#define VSCALING_Mask (((1L << 20)-1) << VSCALING_Shift)
-#define VSCALING(h0,h1) ((((unsigned int) (((double)h0/(double)h1) * (1 << 15))) \
- << VSCALING_Shift) \
- & VSCALING_Mask)
-
-#ifndef XvExtension
-void SavageInitVideo(ScreenPtr pScreen) {}
-void SavageResetVideo(ScrnInfoPtr pScrn) {}
-#else
-
-void myOUTREG( SavagePtr psav, unsigned long offset, unsigned long value );
+void savageOUTREG( SavagePtr psav, unsigned long offset, unsigned long value );
static XF86VideoAdaptorPtr SavageSetupImageVideo(ScreenPtr);
static void SavageInitOffscreenImages(ScreenPtr);
@@ -51,14 +34,8 @@
static int SavageQueryImageAttributes(ScrnInfoPtr,
int, unsigned short *, unsigned short *, int *, int *);
-void SavageStreamsOn(ScrnInfoPtr pScrn, int id);
-void SavageStreamsOff(ScrnInfoPtr pScrn);
void SavageResetVideo(ScrnInfoPtr pScrn);
-static void SavageInitStreamsOld(ScrnInfoPtr pScrn);
-static void SavageInitStreamsNew(ScrnInfoPtr pScrn);
-static void (*SavageInitStreams)(ScrnInfoPtr pScrn) = NULL;
-
static void SavageSetColorKeyOld(ScrnInfoPtr pScrn);
static void SavageSetColorKeyNew(ScrnInfoPtr pScrn);
static void (*SavageSetColorKey)(ScrnInfoPtr pScrn) = NULL;
@@ -92,10 +69,6 @@
short drw_w, short drw_h
) = NULL;
-static void OverlayTwisterInit(ScrnInfoPtr pScrn);
-static void OverlayParamInit(ScrnInfoPtr pScrn);
-static void InitStreamsForExpansion(ScrnInfoPtr pScrn);
-
/*static void SavageBlockHandler(int, pointer, pointer, pointer);*/
#define XVTRACE 4
@@ -227,17 +200,6 @@
#define GET_PORT_PRIVATE(pScrn) \
(SavagePortPrivPtr)((SAVPTR(pScrn))->adaptor->pPortPrivates[0].ptr)
-
-/*
- * There are two different streams engines used in the Savage line.
- * The old engine is in the 3D, 4, Pro, and Twister.
- * The new engine is in the 2000, MX, IX, and Super.
- */
-
-
-#define OS_XY(x,y) (((x+1)<<16)|(y+1))
-#define OS_WH(x,y) (((x-1)<<16)|(y))
-
static
unsigned int GetBlendForFourCC( int id )
{
@@ -257,280 +219,28 @@
}
}
-void myOUTREG( SavagePtr psav, unsigned long offset, unsigned long value )
+void savageOUTREG( SavagePtr psav, unsigned long offset, unsigned long value )
{
- ErrorF( "MMIO %04x, was %08x, want %08x,",
- offset, MMIO_IN32( psav->MapBase, offset ), value );
+ ErrorF( "MMIO %08lx, was %08lx, want %08lx,",
+ offset, (CARD32)MMIO_IN32( psav->MapBase, offset ), value );
MMIO_OUT32( psav->MapBase, offset, value );
- ErrorF( " now %08x\n", MMIO_IN32( psav->MapBase, offset ) );
-}
-
-void SavageInitStreamsOld(ScrnInfoPtr pScrn)
-{
- SavagePtr psav = SAVPTR(pScrn);
- /*unsigned long jDelta;*/
- unsigned long format = 0;
-
- /*
- * For the OLD streams engine, several of these registers
- * cannot be touched unless streams are on. Seems backwards to me;
- * I'd want to set 'em up, then cut 'em loose.
- */
-
- xf86ErrorFVerb(XVTRACE, "SavageInitStreams\n" );
-
- /* Primary stream reflects the frame buffer. */
-
-/* I don't know if these are needed here or not. seems to work either way
- * and the stride should have already been set properly in SavageSetGBD()
- */
- if (!psav->bTiled) {
- OUTREG(PRI_STREAM_STRIDE,
- (((psav->lDelta * 2) << 16) & 0x3FFFE000) |
- (psav->lDelta & 0x00001fff));
- }
- else if (pScrn->bitsPerPixel == 16) {
- /* Scanline-length-in-bytes/128-bytes-per-tile * 256 Qwords/tile */
- OUTREG(PRI_STREAM_STRIDE,
- (((psav->lDelta * 2) << 16) & 0x3FFFE000)
- | 0x80000000 | (psav->lDelta & 0x00001fff));
- }
- else if (pScrn->bitsPerPixel == 32) {
- OUTREG(PRI_STREAM_STRIDE,
- (((psav->lDelta * 2) << 16) & 0x3FFFE000)
- | 0xC0000000 | (psav->lDelta & 0x00001fff));
- }
- OUTREG(PSTREAM_FBSIZE_REG,
- pScrn->virtualY * pScrn->virtualX * (pScrn->bitsPerPixel >> 3));
-
- switch( pScrn->depth ) {
- case 8: format = 0 << 24; break;
- case 15: format = 3 << 24; break;
- case 16: format = 5 << 24; break;
- case 24: format = 7 << 24; break;
- }
-
- /*jDelta = pScrn->displayWidth * pScrn->bitsPerPixel / 8;*/
- OUTREG( PSTREAM_WINDOW_START_REG, OS_XY(0,0) );
- OUTREG( PSTREAM_WINDOW_SIZE_REG, OS_WH(pScrn->displayWidth, pScrn->virtualY) );
- OUTREG( PSTREAM_FBADDR0_REG, pScrn->fbOffset );
- OUTREG( PSTREAM_FBADDR1_REG, 0 );
- /*OUTREG( PSTREAM_STRIDE_REG, jDelta );*/
- OUTREG( PSTREAM_CONTROL_REG, format );
- /*OUTREG( PSTREAM_FBSIZE_REG, jDelta * pScrn->virtualY >> 3 );*/
-
- OUTREG( COL_CHROMA_KEY_CONTROL_REG, 0 );
- OUTREG( SSTREAM_CONTROL_REG, 0 );
- OUTREG( CHROMA_KEY_UPPER_BOUND_REG, 0 );
- OUTREG( SSTREAM_STRETCH_REG, 0 );
- OUTREG( COLOR_ADJUSTMENT_REG, 0 );
- OUTREG( BLEND_CONTROL_REG, 1 << 24 );
- OUTREG( DOUBLE_BUFFER_REG, 0 );
- OUTREG( SSTREAM_FBADDR0_REG, 0 );
- OUTREG( SSTREAM_FBADDR1_REG, 0 );
- OUTREG( SSTREAM_FBADDR2_REG, 0 );
-/* OUTREG( SSTREAM_FBSIZE_REG, 0 ); */
- OUTREG( SSTREAM_STRIDE_REG, 0 );
- OUTREG( SSTREAM_VSCALE_REG, 0 );
- OUTREG( SSTREAM_LINES_REG, 0 );
- OUTREG( SSTREAM_VINITIAL_REG, 0 );
- OUTREG( SSTREAM_WINDOW_START_REG, OS_XY(0xfffe, 0xfffe) );
- OUTREG( SSTREAM_WINDOW_SIZE_REG, OS_WH(10,2) );
-
- if (S3_MOBILE_TWISTER_SERIES(psav->Chipset) &&
- psav->FPExpansion) {
- OverlayTwisterInit(pScrn);
- }
-
-}
-
-void SavageInitStreamsNew(ScrnInfoPtr pScrn)
-{
- SavagePtr psav = SAVPTR(pScrn);
- /*unsigned long jDelta;*/
-
- xf86ErrorFVerb(XVTRACE, "SavageInitStreams\n" );
-
- if(
- S3_SAVAGE_MOBILE_SERIES(psav->Chipset) &&
- !psav->CrtOnly &&
- !psav->TvOn
- ) {
- OverlayParamInit( pScrn );
- }
-
-/* I don't know if these are needed here or not. seems to work either way
- * and the stride should have already been set properly in SavageSetGBD()
- */
- /* Primary stream reflects the frame buffer. */
- OUTREG32(PRI_STREAM_FBUF_ADDR0, pScrn->fbOffset);
- if (!psav->bTiled) {
- OUTREG(PRI_STREAM_STRIDE,
- (((psav->lDelta * 2) << 16) & 0x3FFFE000) |
- (psav->lDelta & 0x00001fff));
- }
- else if (pScrn->bitsPerPixel == 16) {
- /* Scanline-length-in-bytes/128-bytes-per-tile * 256 Qwords/tile */
- OUTREG(PRI_STREAM_STRIDE,
- (((psav->lDelta * 2) << 16) & 0x3FFFE000)
- | 0x80000000 | (psav->lDelta & 0x00001fff));
- }
- else if (pScrn->bitsPerPixel == 32) {
- OUTREG(PRI_STREAM_STRIDE,
- (((psav->lDelta * 2) << 16) & 0x3FFFE000)
- | 0xC0000000 | (psav->lDelta & 0x00001fff));
- }
- OUTREG(PSTREAM_FBSIZE_REG,
- pScrn->virtualX * pScrn->virtualY * (pScrn->bitsPerPixel >> 3));
- /* Primary stream reflects the frame buffer. */
-#if 0
- jDelta = pScrn->displayWidth * pScrn->bitsPerPixel / 8;
- OUTREG( PRI_STREAM_BUFFERSIZE, jDelta * pScrn->virtualY >> 3 );
- OUTREG( PRI_STREAM_FBUF_ADDR0, pScrn->fbOffset );
- OUTREG( PRI_STREAM_STRIDE, jDelta );
-#endif
- OUTREG( SEC_STREAM_CKEY_LOW, 0 );
- OUTREG( SEC_STREAM_CKEY_UPPER, 0 );
- OUTREG( SEC_STREAM_HSCALING, 0 );
- OUTREG( SEC_STREAM_VSCALING, 0 );
- OUTREG( BLEND_CONTROL, 0 );
- OUTREG( SEC_STREAM_FBUF_ADDR0, 0 );
- OUTREG( SEC_STREAM_FBUF_ADDR1, 0 );
- OUTREG( SEC_STREAM_FBUF_ADDR2, 0 );
- OUTREG( SEC_STREAM_WINDOW_START, 0 );
- OUTREG( SEC_STREAM_WINDOW_SZ, 0 );
-/* OUTREG( SEC_STREAM_BUFFERSIZE, 0 ); */
- OUTREG( SEC_STREAM_TILE_OFF, 0 );
- OUTREG( SEC_STREAM_OPAQUE_OVERLAY, 0 );
- OUTREG( SEC_STREAM_STRIDE, 0 );
-
- /* These values specify brightness, contrast, saturation and hue. */
- OUTREG( SEC_STREAM_COLOR_CONVERT1, 0x0000C892 );
- OUTREG( SEC_STREAM_COLOR_CONVERT2, 0x00039F9A );
- OUTREG( SEC_STREAM_COLOR_CONVERT3, 0x01F1547E );
+ ErrorF( " now %08lx\n", (CARD32)MMIO_IN32( psav->MapBase, offset ) );
}
-void SavageStreamsOn(ScrnInfoPtr pScrn, int id)
+static void
+SavageClipVWindow(ScrnInfoPtr pScrn)
{
SavagePtr psav = SAVPTR(pScrn);
- unsigned char jStreamsControl;
- unsigned short vgaCRIndex = psav->vgaIOBase + 4;
- unsigned short vgaCRReg = psav->vgaIOBase + 5;
-
- xf86ErrorFVerb(XVTRACE, "SavageStreamsOn\n" );
-
- /* Sequence stolen from streams.c in M7 NT driver */
-
- xf86EnableIO();
-
- /* Unlock extended registers. */
-
- VGAOUT16(vgaCRIndex, 0x4838);
- VGAOUT16(vgaCRIndex, 0xa039);
- VGAOUT16(0x3c4, 0x0608);
-
- if(
- S3_SAVAGE_MOBILE_SERIES(psav->Chipset) &&
- !psav->CrtOnly &&
- !psav->TvOn
- ) {
- OverlayParamInit( pScrn );
- }
-
- VGAOUT8( vgaCRIndex, EXT_MISC_CTRL2 );
-
- if( S3_SAVAGE_MOBILE_SERIES(psav->Chipset) ||
- (psav->Chipset == S3_SAVAGE2000) )
- {
- jStreamsControl = VGAIN8( vgaCRReg ) | ENABLE_STREAM1;
-
- /* Wait for VBLANK. */
-
- VerticalRetraceWait();
-
- /* Fire up streams! */
-
- VGAOUT16( vgaCRIndex, (jStreamsControl << 8) | EXT_MISC_CTRL2 );
-
- psav->blendBase = GetBlendForFourCC( id ) << 9;
- xf86ErrorFVerb(XVTRACE+1,"Format %4.4s, blend is %08x\n", &id, psav->blendBase );
- OUTREG( BLEND_CONTROL, psav->blendBase | 0x08 );
-
- /* These values specify brightness, contrast, saturation and hue. */
- OUTREG( SEC_STREAM_COLOR_CONVERT1, 0x0000C892 );
- OUTREG( SEC_STREAM_COLOR_CONVERT2, 0x00039F9A );
- OUTREG( SEC_STREAM_COLOR_CONVERT3, 0x01F1547E );
- }
- else
- {
- if (S3_MOBILE_TWISTER_SERIES(psav->Chipset)
- && psav->FPExpansion) {
- jStreamsControl = VGAIN8( vgaCRReg ) | ENABLE_STREAMS_OLD; /* tim */
- /*jStreamsControl = VGAIN8( vgaCRReg ) | 0x8c;*/ /* S3 */
- } else {
- jStreamsControl = VGAIN8( vgaCRReg ) | ENABLE_STREAMS_OLD; /* tim */
- /*jStreamsControl = VGAIN8( vgaCRReg ) | 0x04;*/ /* S3 */
- }
- /* Wait for VBLANK. */
-
- VerticalRetraceWait();
-
- /* Fire up streams! */
-
- VGAOUT16( vgaCRIndex, (jStreamsControl << 8) | EXT_MISC_CTRL2 );
-
- SavageInitStreamsOld( pScrn );
+
+ if( (psav->Chipset == S3_SAVAGE_MX) ||
+ (psav->Chipset == S3_SUPERSAVAGE) ||
+ (psav->Chipset == S3_SAVAGE2000) ) {
+ OUTREG(SEC_STREAM_WINDOW_SZ, 0);
+
+ } else {
+ OUTREG( SSTREAM_WINDOW_SIZE_REG, 1);
+ OUTREG( SSTREAM_WINDOW_START_REG, 0x03ff03ff);
}
-
- /* Wait for VBLANK. */
-
- VerticalRetraceWait();
-
- /* Turn on secondary stream TV flicker filter, once we support TV. */
-
- /* SR70 |= 0x10 */
-
- psav->videoFlags |= VF_STREAMS_ON;
- psav->videoFourCC = id;
-}
-
-void SavageStreamsOff(ScrnInfoPtr pScrn)
-{
- SavagePtr psav = SAVPTR(pScrn);
- unsigned char jStreamsControl;
- unsigned short vgaCRIndex = psav->vgaIOBase + 4;
- unsigned short vgaCRReg = psav->vgaIOBase + 5;
-
- xf86ErrorFVerb(XVTRACE, "SavageStreamsOff\n" );
-
- xf86EnableIO();
-
- /* Unlock extended registers. */
-
- VGAOUT16(vgaCRIndex, 0x4838);
- VGAOUT16(vgaCRIndex, 0xa039);
- VGAOUT16(0x3c4, 0x0608);
-
- VGAOUT8( vgaCRIndex, EXT_MISC_CTRL2 );
- if( S3_SAVAGE_MOBILE_SERIES(psav->Chipset) ||
- (psav->Chipset == S3_SAVAGE2000) )
- jStreamsControl = VGAIN8( vgaCRReg ) & NO_STREAMS;
- else
- jStreamsControl = VGAIN8( vgaCRReg ) & NO_STREAMS_OLD;
-
- /* Wait for VBLANK. */
-
- VerticalRetraceWait();
-
- /* Kill streams. */
-
- VGAOUT16( vgaCRIndex, (jStreamsControl << 8) | EXT_MISC_CTRL2 );
-
- VGAOUT16( vgaCRIndex, 0x0093 );
- VGAOUT8( vgaCRIndex, 0x92 );
- VGAOUT8( vgaCRReg, VGAIN8(vgaCRReg) & 0x40 );
-
- psav->videoFlags &= ~VF_STREAMS_ON;
}
void SavageInitVideo(ScreenPtr pScreen)
@@ -550,7 +260,6 @@
newAdaptor = SavageSetupImageVideo(pScreen);
SavageInitOffscreenImages(pScreen);
- SavageInitStreams = SavageInitStreamsNew;
SavageSetColor = SavageSetColorNew;
SavageSetColorKey = SavageSetColorKeyNew;
SavageDisplayVideo = SavageDisplayVideoNew;
@@ -561,7 +270,6 @@
SavageInitOffscreenImages(pScreen);
/*DELETENEXTLINE*/
/* Since newAdaptor is still NULL, these are still disabled for now. */
- SavageInitStreams = SavageInitStreamsOld;
SavageSetColor = SavageSetColorOld;
SavageSetColorKey = SavageSetColorKeyOld;
SavageDisplayVideo = SavageDisplayVideoOld;
@@ -594,9 +302,6 @@
if( newAdaptor )
{
- if( SavageInitStreams == SavageInitStreamsNew )
- SavageInitStreams(pScrn);
- psav->videoFlags = 0;
psav->videoFourCC = 0;
}
}
@@ -709,7 +414,7 @@
SavagePortPrivPtr pPriv = psav->adaptor->pPortPrivates[0].ptr;
xf86ErrorFVerb(XVTRACE, "bright %d, contrast %d, saturation %d, hue %d\n",
- pPriv->brightness, pPriv->contrast, pPriv->saturation, pPriv->hue );
+ pPriv->brightness, (int)pPriv->contrast, (int)pPriv->saturation, pPriv->hue );
if(
(psav->videoFourCC == FOURCC_RV15) ||
@@ -751,7 +456,7 @@
unsigned long assembly;
xf86ErrorFVerb(XVTRACE, "bright %d, contrast %d, saturation %d, hue %d\n",
- pPriv->brightness, pPriv->contrast, pPriv->saturation, pPriv->hue );
+ pPriv->brightness, (int)pPriv->contrast, (int)pPriv->saturation, pPriv->hue );
if( psav->videoFourCC == FOURCC_Y211 )
k = 1.0; /* YUV */
@@ -779,20 +484,20 @@
k2 = (int)(dk2+0.5) & 0x1ff;
k3 = (int)(dk3+0.5) & 0x1ff;
assembly = (k3<<18) | (k2<<9) | k1;
- xf86ErrorFVerb(XVTRACE+1, "CC1 = %08x ", assembly );
+ xf86ErrorFVerb(XVTRACE+1, "CC1 = %08lx ", assembly );
OUTREG( SEC_STREAM_COLOR_CONVERT1, assembly );
k4 = (int)(dk4+0.5) & 0x1ff;
k5 = (int)(dk5+0.5) & 0x1ff;
k6 = (int)(dk6+0.5) & 0x1ff;
assembly = (k6<<18) | (k5<<9) | k4;
- xf86ErrorFVerb(XVTRACE+1, "CC2 = %08x ", assembly );
+ xf86ErrorFVerb(XVTRACE+1, "CC2 = %08lx ", assembly );
OUTREG( SEC_STREAM_COLOR_CONVERT2, assembly );
k7 = (int)(dk7+0.5) & 0x1ff;
kb = (int)(dkb+0.5) & 0xffff;
assembly = (kb<<9) | k7;
- xf86ErrorFVerb(XVTRACE+1, "CC3 = %08x\n", assembly );
+ xf86ErrorFVerb(XVTRACE+1, "CC3 = %08lx\n", assembly );
OUTREG( SEC_STREAM_COLOR_CONVERT3, assembly );
}
@@ -873,7 +578,7 @@
pPriv->lastKnownPitch = 0;
/* gotta uninit this someplace */
- REGION_INIT(pScreen, &pPriv->clip, NullBox, 0);
+ REGION_INIT(pScreen, &pPriv->clip, NullBox, 0);
psav->adaptor = adapt;
@@ -971,7 +676,8 @@
REGION_EMPTY(pScrn->pScreen, &pPriv->clip);
if(shutdown) {
- SavageStreamsOff( pScrn );
+ SavageClipVWindow(pScrn);
+/* SavageStreamsOff( pScrn ); */
if(pPriv->area) {
xf86FreeOffscreenArea(pPriv->area);
pPriv->area = NULL;
@@ -1265,6 +971,22 @@
}
static void
+SavageSetBlend(ScrnInfoPtr pScrn, int id)
+{
+ SavagePtr psav = SAVPTR(pScrn);
+
+ if( S3_SAVAGE_MOBILE_SERIES(psav->Chipset) ||
+ (psav->Chipset == S3_SUPERSAVAGE) ||
+ (psav->Chipset == S3_SAVAGE2000) )
+ {
+ psav->blendBase = GetBlendForFourCC( id ) << 9;
+ xf86ErrorFVerb(XVTRACE+1,"Format %4.4s, blend is %08x\n", (char*)&id, psav->blendBase );
+ OUTREG( BLEND_CONTROL, psav->blendBase | 0x08 );
+ }
+ psav->videoFourCC = id;
+}
+
+static void
SavageDisplayVideoOld(
ScrnInfoPtr pScrn,
int id,
@@ -1281,7 +1003,7 @@
SavagePortPrivPtr pPriv = psav->adaptor->pPortPrivates[0].ptr;
/*DisplayModePtr mode = pScrn->currentMode;*/
int vgaCRIndex, vgaCRReg, vgaIOBase;
- unsigned int ssControl;
+ CARD32 ssControl;
int scalratio;
@@ -1289,12 +1011,8 @@
vgaCRIndex = vgaIOBase + 4;
vgaCRReg = vgaIOBase + 5;
- if( psav->videoFourCC != id )
- SavageStreamsOff(pScrn);
-
- if( !psav->videoFlags & VF_STREAMS_ON )
- {
- SavageStreamsOn(pScrn, id);
+ if ( psav->videoFourCC != id ) {
+ SavageSetBlend(pScrn,id);
SavageResetVideo(pScrn);
}
@@ -1311,9 +1029,9 @@
}
/* Set surface format. */
-
- OUTREG(SSTREAM_CONTROL_REG,
- (GetBlendForFourCC(psav->videoFourCC) << 24) + src_w );
+ ssControl = (GetBlendForFourCC(psav->videoFourCC) << 24) | src_w;
+
+ OUTREG(SSTREAM_CONTROL_REG, ssControl);
/* Calculate horizontal scale factor. */
@@ -1334,13 +1052,12 @@
/* Set surface location and stride. */
- OUTREG(SSTREAM_FBADDR0_REG, (offset + (x1>>15)) & 0x3ffff0 );
- OUTREG(SSTREAM_FBADDR1_REG, 0 );
-
+ OUTREG(SSTREAM_FBADDR0_REG, (offset + (x1>>15)) & (0x1ffffff & ~BASE_PAD) );
OUTREG(SSTREAM_STRIDE_REG, pitch & 0xfff );
OUTREG(SSTREAM_WINDOW_START_REG, OS_XY(dstBox->x1, dstBox->y1) );
- OUTREG(SSTREAM_WINDOW_SIZE_REG, OS_WH(drw_w, drw_h) );
+ OUTREG(SSTREAM_WINDOW_SIZE_REG, OS_WH(dstBox->x2-dstBox->x1,
+ dstBox->y2-dstBox->y1));
/*
* Process horizontal scaling
@@ -1410,7 +1127,7 @@
VGAOUT8(vgaCRIndex, 0x93);
VGAOUT8(vgaCRReg, pitch);
}
-
+ OUTREG(STREAMS_FIFO_REG, 0x2 | 25 << 5 | 32 << 11);
}
static void
@@ -1436,12 +1153,8 @@
vgaCRIndex = vgaIOBase + 4;
vgaCRReg = vgaIOBase + 5;
- if( psav->videoFourCC != id )
- SavageStreamsOff(pScrn);
-
- if( !psav->videoFlags & VF_STREAMS_ON )
- {
- SavageStreamsOn(pScrn, id);
+ if ( psav->videoFourCC != id ) {
+ SavageSetBlend(pScrn,id);
SavageResetVideo(pScrn);
}
@@ -1486,10 +1199,12 @@
* are 2 bytes/pixel.
*/
- OUTREG(SEC_STREAM_FBUF_ADDR0, (offset + (x1>>15)) & 0x7ffff0 );
+ OUTREG(SEC_STREAM_FBUF_ADDR0, (offset + (x1>>15))
+ & (0x7ffffff & ~BASE_PAD));
OUTREG(SEC_STREAM_STRIDE, pitch & 0xfff );
OUTREG(SEC_STREAM_WINDOW_START, ((dstBox->x1+1) << 16) | (dstBox->y1+1) );
- OUTREG(SEC_STREAM_WINDOW_SZ, ((drw_w) << 16) | drw_h );
+ OUTREG(SEC_STREAM_WINDOW_SZ, ((dstBox->x2-dstBox->x1) << 16)
+ | (dstBox->x2-dstBox->x1) );
#if 0
/* Set color key on primary. */
@@ -1527,6 +1242,7 @@
){
SavagePortPrivPtr pPriv = (SavagePortPrivPtr)data;
SavagePtr psav = SAVPTR(pScrn);
+ ScreenPtr pScreen = pScrn->pScreen;
INT32 x1, x2, y1, y2;
unsigned char *dst_start;
int pitch, new_h, offset, offsetV=0, offsetU=0;
@@ -1535,20 +1251,6 @@
BoxRec dstBox;
CARD32 tmp;
/* xf86ErrorFVerb(XVTRACE,"SavagePutImage\n"); */
-
- if( psav->cxScreen != pScrn->currentMode->HDisplay )
- {
- /* The mode has changed. Recompute the offsets. */
-
- if(
- S3_SAVAGE_MOBILE_SERIES(psav->Chipset) &&
- !psav->CrtOnly &&
- !psav->TvOn
- ) {
- OverlayParamInit( pScrn );
- }
- }
-
if(drw_w > 16384) drw_w = 16384;
/* Clip */
@@ -1616,8 +1318,8 @@
npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left;
left <<= 1;
- offset = (pPriv->area->box.y1 * pitch) + (top * dstPitch);
- dst_start = psav->FBBase + offset + left;
+ offset = ((pPriv->area->box.y1 * pitch)) + (top * dstPitch);
+ dst_start = (psav->FBBase + ((offset + left) & ~BASE_PAD));
switch(id) {
case FOURCC_YV12: /* YV12 */
@@ -1791,7 +1493,7 @@
if(pPriv->isOn) {
/*SavagePtr psav = SAVPTR(surface->pScrn);*/
- SavageStreamsOff( surface->pScrn );
+ SavageClipVWindow(surface->pScrn);
pPriv->isOn = FALSE;
}
@@ -1847,6 +1549,7 @@
){
OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr;
ScrnInfoPtr pScrn = surface->pScrn;
+ ScreenPtr pScreen = pScrn->pScreen;
SavagePortPrivPtr portPriv = GET_PORT_PRIVATE(pScrn);
INT32 x1, y1, x2, y2;
BoxRec dstBox;
@@ -1883,7 +1586,7 @@
pPriv->isOn = TRUE;
#if 0
if(portPriv->videoStatus & CLIENT_VIDEO_ON) {
- REGION_EMPTY(pScrn->pScreen, &portPriv->clip);
+ REGION_EMPTY(pScreen, &portPriv->clip);
UpdateCurrentTime();
portPriv->videoStatus = FREE_TIMER;
portPriv->freeTime = currentTime.milliseconds + FREE_DELAY;
@@ -1926,143 +1629,3 @@
xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1);
}
-static
-void PatchEnableSPofPanel(ScrnInfoPtr pScrn)
-{
- SavagePtr psav = SAVPTR(pScrn);
-
- UnLockExtRegs();
-
- if (pScrn->bitsPerPixel == 8) {
- OUTREG8(CRT_ADDRESS_REG,0x90);
- OUTREG8(CRT_DATA_REG,INREG8(CRT_DATA_REG)|0x40);
- }
- else {
- OUTREG8(CRT_ADDRESS_REG,0x90);
- OUTREG8(CRT_DATA_REG,INREG8(CRT_DATA_REG)|0x48);
- }
-
- VerticalRetraceWait();
-
- OUTREG8(CRT_ADDRESS_REG,0x67);
- OUTREG8(CRT_DATA_REG,(INREG8(CRT_DATA_REG)&0xf3)|0x04);
-
- OUTREG8(CRT_ADDRESS_REG,0x65);
- OUTREG8(CRT_DATA_REG,INREG8(CRT_DATA_REG)|0xC0);
-
- if (pScrn->bitsPerPixel == 8) {
- OUTREG32(PSTREAM_CONTROL_REG,0x00000000);
- } else {
- OUTREG32(PSTREAM_CONTROL_REG,0x02000000);
- }
- OUTREG32(PSTREAM_WINDOW_SIZE_REG, 0x0);
-
-}
-
-/*
- * Function to get lcd factor, display offset for overlay use
- * Input: pScrn; Output: x,yfactor, displayoffset in pScrn
- */
-static void OverlayTwisterInit(ScrnInfoPtr pScrn)
-{
- SavagePtr psav = SAVPTR(pScrn);
-
- psav->cxScreen = psav->iResX;
- InitStreamsForExpansion(pScrn);
- PatchEnableSPofPanel(pScrn);
-}
-
-/* Function to get lcd factor, display offset for overlay use
- * Input: pScrn; Output: x,yfactor, displayoffset in pScrn
- */
-static void OverlayParamInit(ScrnInfoPtr pScrn)
-{
- SavagePtr psav = SAVPTR(pScrn);
-
- psav = SAVPTR(pScrn);
- psav->cxScreen = pScrn->currentMode->HDisplay;
- InitStreamsForExpansion(pScrn);
-}
-
-/* Function to calculate lcd expansion x,y factor and offset for overlay
- */
-static void InitStreamsForExpansion(ScrnInfoPtr pScrn)
-{
- SavagePtr psav = SAVPTR(pScrn);
- int PanelSizeX,PanelSizeY;
- int ViewPortWidth,ViewPortHeight;
- int XExpansion, YExpansion;
- int XFactor, YFactor;
- int Hstate, Vstate;
-
- static CARD32 Xfactors[] = {
- 0x00010001,
- 0x00010001, /* 1 */
- 0,
- 0x00090008, /* 3 */
- 0x00050004, /* 4 */
- 0,
- 0x00030002, /* 6 */
- 0x00020001 /* 7 */
- };
-
- static CARD32 Yfactors[] = {
- 0x00010001, 0x00010001,
- 0, 0x00060005,
- 0x00050004, 0x00040003,
- 0, 0x00030002,
- 0x00020001, 0x00050002,
- 0x000C0005, 0x00080003,
- 0x00090004, 0,
- 0x00030001, 0x00040001,
- };
-
-
-
- PanelSizeX = psav->PanelX;
- PanelSizeY = psav->PanelY;
- ViewPortWidth = pScrn->currentMode->HDisplay;
- ViewPortHeight = pScrn->currentMode->VDisplay;
-
- if( PanelSizeX == 1408 )
- PanelSizeX = 1400;
-
- XExpansion = 0x00010001;
- YExpansion = 0x00010001;
-
- psav->displayXoffset = 0;
- psav->displayYoffset = 0;
-
- VGAOUT8(0x3C4, HZEXP_COMP_1);
- Hstate = VGAIN8(0x3C5);
- VGAOUT8(0x3C4, VTEXP_COMP_1);
- Vstate = VGAIN8(0x3C5);
- VGAOUT8(0x3C4, HZEXP_FACTOR_IGA1);
- XFactor = VGAIN8(0x3C5);
- VGAOUT8(0x3C4, VTEXP_FACTOR_IGA1);
- YFactor = VGAIN8(0x3C5);
-
- if( Hstate & EC1_EXPAND_ON )
- {
- XExpansion = Xfactors[XFactor>>4];
- }
-
- if( Vstate & EC1_EXPAND_ON )
- {
- YExpansion = Yfactors[YFactor>>4];
- }
-
- psav->XExp1 = XExpansion >> 16;
- psav->XExp2 = XExpansion & 0xFFFF;
-
- psav->YExp1 = YExpansion >> 16;
- psav->YExp2 = YExpansion & 0xFFFF;
-
- psav->displayXoffset =
- ((PanelSizeX - (psav->XExp1 * ViewPortWidth) / psav->XExp2) / 2 + 7) & 0xfff8;
- psav->displayYoffset =
- ((PanelSizeY - (psav->YExp1 * ViewPortHeight) / psav->YExp2) / 2);
-
-} /* InitStreamsForExpansionPM */
-
-#endif /* XvExtension */