Commit c8abdb74 authored by Thomas Winischhofer's avatar Thomas Winischhofer

SiS driver:

- Added initial support for XGI chipsets (V3XT, V5, V8, Z7). Z7 and V5 are
    untested. All features supported (Xv, HWCursor, DPMS, etc.). The binary
    XGI DRI driver is not supported.
- Ported driver to EXA 0.1.0. Known problems still to solve at this time
    are:
EXA's deinitialisation routine "DriverFini()" does not unwrap
    pScreen->DestroyPixmap (and others), leading to a crash on machines
    where the SWCursor is being used (SWCursor pixmaps are destroyed after
    EXA has destroyed the offscreen memory manager).
EXA does not work correctly with 24bpp framebuffers. For some reason, all
    pixmaps handed to the drawing primitives are 32bpp, despite the correct
    24bpp-flag handed to xf86SetDepthBpp().
parent 1db609b2
/* $XFree86$ */
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/300vtbl.h,v 1.11 2005/06/27 15:56:52 twini Exp $ */
/* $XdotOrg$ */
/*
* Register settings for SiS 300 series
*
......
/* $XFree86$ */
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/310vtbl.h,v 1.18 2005/06/27 15:56:52 twini Exp $ */
/* $XdotOrg$ */
/*
* Register settings for SiS 315/330/340 series
*
......
This diff is collapsed.
/* $XFree86$ */
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/init.h,v 1.20 2005/06/27 15:56:52 twini Exp $ */
/* $XdotOrg$ */
/*
* Data and prototypes for init.c
*
......
/* $XFree86$ */
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c,v 1.23 2005/06/27 15:56:52 twini Exp $ */
/* $XdotOrg$ */
/*
* Mode initializing code (CRT2 section)
for SiS 300/305/540/630/730 and
......@@ -54,14 +54,6 @@
* Formerly based on non-functional code-fragements for 300 series by SiS, Inc.
* Used by permission.
*
* TW says: This code looks awful, I know. But please don't do anything about
* this otherwise debugging will be hell.
* The code is extremely fragile as regards the different chipsets, different
* video bridges and combinations thereof. If anything is changed, extreme
* care has to be taken that that change doesn't break it for other chipsets,
* bridges or combinations thereof.
* All comments in this file are by me, regardless if marked TW or not.
*
*/
#if 1
......@@ -101,7 +93,9 @@ static void SiS_SetCH70xx(struct SiS_Private *SiS_Pr, unsigned short reg, unsig
void
SiS_UnLockCRT2(struct SiS_Private *SiS_Pr)
{
if(SiS_Pr->ChipType >= SIS_315H)
if(SiS_Pr->ChipType == XGI_20)
return;
else if(SiS_Pr->ChipType >= SIS_315H)
SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2f,0x01);
else
SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x24,0x01);
......@@ -113,7 +107,9 @@ static
void
SiS_LockCRT2(struct SiS_Private *SiS_Pr)
{
if(SiS_Pr->ChipType >= SIS_315H)
if(SiS_Pr->ChipType == XGI_20)
return;
else if(SiS_Pr->ChipType >= SIS_315H)
SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2F,0xFE);
else
SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x24,0xFE);
......@@ -957,19 +953,19 @@ void
SiS_GetVBInfo(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
unsigned short ModeIdIndex, int checkcrt2mode)
{
unsigned short tempax,tempbx, temp;
unsigned short tempax, tempbx, temp;
unsigned short modeflag, resinfo = 0;
SiS_Pr->SiS_SetFlag = 0;
modeflag = SiS_GetModeFlag(SiS_Pr, ModeNo, ModeIdIndex);
SiS_Pr->SiS_ModeType = modeflag & ModeTypeMask;
if((ModeNo > 0x13) && (!SiS_Pr->UseCustomMode)) {
resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
}
SiS_Pr->SiS_SetFlag = 0;
SiS_Pr->SiS_ModeType = modeflag & ModeTypeMask;
tempbx = 0;
if(SiS_HaveBridge(SiS_Pr)) {
......@@ -3980,11 +3976,11 @@ SiS_DisableBridge(struct SiS_Private *SiS_Pr)
}
if(!(SiS_IsNotM650orLater(SiS_Pr))) {
if(SiS_Pr->ChipType < SIS_340) {
/* if(SiS_Pr->ChipType < SIS_340) {*/
tempah = 0xef;
if(SiS_IsVAMode(SiS_Pr)) tempah = 0xf7;
SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x4c,tempah);
}
/*}*/
}
if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
......@@ -4153,9 +4149,9 @@ SiS_DisableBridge(struct SiS_Private *SiS_Pr)
#ifdef SIS315H /* 315 series */
if(!(SiS_IsNotM650orLater(SiS_Pr))) {
if(SiS_Pr->ChipType < SIS_340) {
/*if(SiS_Pr->ChipType < SIS_340) { */ /* XGI needs this */
SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x4c,~0x18);
}
/* } */
}
if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
......@@ -4381,14 +4377,14 @@ SiS_EnableBridge(struct SiS_Private *SiS_Pr)
}
if(!(SiS_IsNotM650orLater(SiS_Pr))) {
if(SiS_Pr->ChipType < SIS_340) {
/*if(SiS_Pr->ChipType < SIS_340) { */
tempah = 0x10;
if(SiS_LCDAEnabled(SiS_Pr)) {
if(SiS_TVEnabled(SiS_Pr)) tempah = 0x18;
else tempah = 0x08;
}
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x4c,tempah);
}
/*}*/
}
if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
......@@ -4449,6 +4445,16 @@ SiS_EnableBridge(struct SiS_Private *SiS_Pr)
SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x00,0x1f,0x20);
SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x80);
if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV | VB_SIS301C)) {
if( (SiS_LCDAEnabled(SiS_Pr)) ||
(SiS_CRT2IsLCD(SiS_Pr)) ) {
/* Enable "LVDS PLL power on" (even on 301C) */
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x2a,0x7f);
/* Enable "LVDS Driver Power on" (even on 301C) */
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x7f);
}
}
tempah = 0xc0;
if(SiS_IsDualEdge(SiS_Pr)) {
tempah = 0x80;
......@@ -4741,9 +4747,9 @@ SiS_EnableBridge(struct SiS_Private *SiS_Pr)
#ifdef SIS315H /* 315 series */
if(!(SiS_IsNotM650orLater(SiS_Pr))) {
if(SiS_Pr->ChipType < SIS_340) {
/*if(SiS_Pr->ChipType < SIS_340) {*/ /* XGI needs this */
SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x4c,0x18);
}
/*}*/
}
if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) {
......@@ -9377,10 +9383,12 @@ SiS_HandleDDC(struct SiS_Private *SiS_Pr, unsigned int VBFlags, int VGAEngine,
(buffer[4] == 0xff) && (buffer[5] == 0xff) &&
(buffer[6] == 0xff) && (buffer[7] == 0x00) &&
(buffer[0x12] == 1)) {
if(adaptnum == 1) {
if(!(buffer[0x14] & 0x80)) result = 0xFFFE;
} else {
if(buffer[0x14] & 0x80) result = 0xFFFE;
if(!SiS_Pr->DDCPortMixup) {
if(adaptnum == 1) {
if(!(buffer[0x14] & 0x80)) result = 0xFFFE;
} else {
if(buffer[0x14] & 0x80) result = 0xFFFE;
}
}
}
}
......@@ -10293,7 +10301,16 @@ SetDelayComp661(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
else delay = (SiS_Pr->SiS_RefIndex[RTI].Ext_PDC >> 4);
delay |= (delay << 8);
if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
if(SiS_Pr->ChipType >= XGI_20) {
delay = 0x0606;
} else if(SiS_Pr->ChipType >= SIS_340) {
delay = 0x0606;
/* TODO (eventually) */
} else if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
/* 3. TV */
......@@ -10425,6 +10442,10 @@ SetPanelParms661(struct SiS_Private *SiS_Pr)
unsigned char *ROMAddr = SiS_Pr->VirtualRomBase;
unsigned short romptr, temp1, temp2;
if(SiS_Pr->SiS_VBType & (VB_SIS301LV | VB_SIS302LV | VB_SIS302ELV | VB_SIS301C)) {
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x24,0x0f);
}
if(SiS_Pr->SiS_VBType & (VB_SIS301LV | VB_SIS302LV | VB_SIS302ELV)) {
if(SiS_Pr->LVDSHL != -1) {
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x24,0xfc,SiS_Pr->LVDSHL);
......@@ -10476,23 +10497,24 @@ SiS_OEM310Setting(struct SiS_Private *SiS_Pr, unsigned short ModeNo, unsigned sh
}
static void
SiS_OEM661Setting(struct SiS_Private *SiS_Pr, unsigned short ModeNo,unsigned short ModeIdIndex, unsigned short RRTI)
SiS_OEM661Setting(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
unsigned short ModeIdIndex, unsigned short RRTI)
{
if(SiS_Pr->SiS_VBType & VB_SISVB) {
SetDelayComp661(SiS_Pr,ModeNo,ModeIdIndex,RRTI);
SetDelayComp661(SiS_Pr, ModeNo, ModeIdIndex, RRTI);
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
SetCRT2SyncDither661(SiS_Pr,ModeNo,RRTI);
SetCRT2SyncDither661(SiS_Pr, ModeNo, RRTI);
SetPanelParms661(SiS_Pr);
}
if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
SetPhaseIncr(SiS_Pr,ModeNo,ModeIdIndex);
SetYFilter(SiS_Pr,ModeNo,ModeIdIndex);
SetAntiFlicker(SiS_Pr,ModeNo,ModeIdIndex);
SetPhaseIncr(SiS_Pr, ModeNo, ModeIdIndex);
SetYFilter(SiS_Pr, ModeNo, ModeIdIndex);
SetAntiFlicker(SiS_Pr, ModeNo, ModeIdIndex);
if(SiS_Pr->SiS_VBType & VB_SIS301) {
SetEdgeEnhance(SiS_Pr,ModeNo,ModeIdIndex);
SetEdgeEnhance(SiS_Pr, ModeNo, ModeIdIndex);
}
}
}
......
/* $XFree86$ */
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h,v 1.16 2005/06/27 15:56:52 twini Exp $ */
/* $XdotOrg$ */
/*
* Data and prototypes for init301.c
*
......
/* $XFree86$ */
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h,v 1.18 2005/06/27 15:56:52 twini Exp $ */
/* $XdotOrg$ */
/*
* Global definitions for init.c and init301.c
*
......
/* $XFree86$ */
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/initextx.c,v 1.1 2005/06/27 15:56:52 twini Exp $ */
/* $XdotOrg$ */
/*
* X.org/XFree86 specific extensions to init.c/init301.c
*
......@@ -736,7 +736,7 @@ SiS_FindPanelFromDB(SISPtr pSiS, unsigned short panelvendor, unsigned short pane
unsigned short
SiS_SenseLCDDDC(struct SiS_Private *SiS_Pr, SISPtr pSiS)
{
unsigned short DDCdatatype, paneltype, flag, xres=0, yres=0;
unsigned short DDCdatatype, paneltype, adapternum, flag, xres=0, yres=0;
unsigned short index, myindex, lumsize, numcodes, panelvendor, panelproduct;
int maxx=0, maxy=0, prefx=0, prefy=0;
unsigned char cr37=0, seekcode;
......@@ -758,7 +758,18 @@ SiS_SenseLCDDDC(struct SiS_Private *SiS_Pr, SISPtr pSiS)
if(!(pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B))) return 0;
if(pSiS->VBFlags & VB_30xBDH) return 0;
if(SiS_InitDDCRegs(SiS_Pr, pSiS->VBFlags, pSiS->VGAEngine, 1, 0, FALSE) == 0xFFFF) return 0;
/* Specific for XGI_40/Rev 2 (XGI V3XT): This card has CRT1's
* and CRT2's DDC ports physically connected to each other. There
* is no connection to the video bridge's DDC port, both DDC
* channels are routed to the GPU. Smart. If both CRT1 (CRT) and
* CRT2 (VGA or LCD) are connected, DDC will fail. Hence, no
* reliable panel detection here...
*/
adapternum = 1;
if(SiS_Pr->DDCPortMixup) adapternum = 0;
if(SiS_InitDDCRegs(SiS_Pr, pSiS->VBFlags, pSiS->VGAEngine, adapternum, 0, FALSE) == 0xFFFF)
return 0;
SiS_Pr->SiS_DDC_SecAddr = 0x00;
......@@ -1374,14 +1385,27 @@ SiS_SenseLCDDDC(struct SiS_Private *SiS_Pr, SISPtr pSiS)
unsigned short
SiS_SenseVGA2DDC(struct SiS_Private *SiS_Pr, SISPtr pSiS)
{
unsigned short DDCdatatype,flag;
unsigned short DDCdatatype, flag;
BOOLEAN foundcrt = FALSE;
int retry;
unsigned char buffer[256];
if(!(pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B))) return 0;
if(!(pSiS->VBFlags & VB_SISVGA2BRIDGE)) return 0;
/* Specific for XGI_40/Rev 2 (XGI V3XT): This card has CRT1's
* and CRT2's DDC ports physically connected to each other. There
* is no connection to the video bridge's DDC port, both DDC
* channels are routed to the GPU. Smart. If both CRT1 (CRT) and
* CRT2 (VGA or LCD) are connected, DDC will fail. If a CRT is
* connected to the DVI-I port, it will report "analog" as well,
* so we never know if the monitor is connected to CRT1 or CRT2.
* Hence, no reliable CRT detection here... we need to fall back to
* the sensing stuff in sis_vb.c.
*/
if(SiS_Pr->DDCPortMixup) return 0;
if(SiS_InitDDCRegs(SiS_Pr, pSiS->VBFlags, pSiS->VGAEngine, 2, 0, FALSE) == 0xFFFF) return 0;
if(SiS_InitDDCRegs(SiS_Pr, pSiS->VBFlags, pSiS->VGAEngine, 2, 0, FALSE) == 0xFFFF)
return 0;
SiS_Pr->SiS_DDC_SecAddr = 0x00;
......
/* $XFree86$ */
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/initextx.h,v 1.1 2005/06/27 15:56:52 twini Exp $ */
/* $XdotOrg$ */
/*
* X.org/XFree86 specific supplements to init.c/init301.c
*
......
/* $XFree86$ */
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/oem300.h,v 1.9 2005/06/27 15:56:52 twini Exp $ */
/* $XdotOrg$ */
/*
* OEM Data for 300 series
*
......
/* $XFree86$ */
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/oem310.h,v 1.8 2005/06/27 15:56:52 twini Exp $ */
/* $XdotOrg$ */
/*
* OEM Data for 315/330 series
*
......
/* $XFree86$ */
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/osdef.h,v 1.8 2005/06/27 15:56:53 twini Exp $ */
/* $XdotOrg$ */
/*
* OS depending defines
*
......
This diff is collapsed.
This diff is collapsed.
/* $XFree86$ */
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h,v 1.6 2005/01/19 16:19:39 twini Exp $ */
/* $XdotOrg$ */
/*
* 2D Acceleration for SiS 530, 620, 300, 540, 630, 730.
* Definitions for the SIS engine communication
......
This diff is collapsed.
/* $XFree86$ */
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.h,v 1.7 2005/03/11 14:39:48 twini Exp $ */
/* $XdotOrg$ */
/*
* 2D Acceleration for SiS 315 and Xabre series
* Definitions for the SIS engine communication.
......@@ -293,6 +293,8 @@
{ \
while( (SIS_MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) {}; \
while( (SIS_MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) {}; \
while( (SIS_MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) {}; \
while( (SIS_MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) {}; \
}
#define SiSSetupSRCDSTBase(srcbase,dstbase) \
......@@ -583,6 +585,20 @@
SiSSetHwWP(ttt); \
}
#define SiSDualPipe(disable) \
{ \
CARD32 ttt = SiSGetSwWP(); \
CARD32 _tmp = SIS_MMIO_IN32(pSiS->IOBase, FIRE_TRIGGER) & ~(1 << 10); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + FIRE_TRIGGER); \
SIS_WQINDEX(1) = (CARD32)(_tmp | ((disable & 1) << 10)); \
SIS_WQINDEX(2) = (CARD32)(SIS_NIL_CMD); \
SIS_WQINDEX(3) = (CARD32)(SIS_NIL_CMD); \
if(pSiS->NeedFlush) dummybuf = SIS_RQINDEX(3); \
SiSUpdateQueue \
SiSSetHwWP(ttt); \
}
/* Line */
#define SiSSetupX0Y0X1Y1(x1,y1,x2,y2) \
......
/* $XFree86$ */
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis6326_video.c,v 1.15 2005/04/21 21:30:56 twini Exp $ */
/* $XdotOrg$ */
/*
* Xv driver for SiS 5597/5598, 6326 and 530/620.
*
......@@ -33,7 +33,9 @@
#include "sis.h"
#ifdef SIS_USE_XAA
#include "xf86fbman.h"
#endif
#include "xf86xv.h"
#include "regionstr.h"
#include <X11/extensions/Xv.h>
......@@ -71,7 +73,8 @@ static int SIS6326QueryImageAttributes(ScrnInfoPtr,
static void SIS6326VideoTimerCallback(ScrnInfoPtr pScrn, Time now);
static void SIS6326InitOffscreenImages(ScreenPtr pScrn);
extern FBLinearPtr SISAllocateOverlayMemory(ScrnInfoPtr pScrn, FBLinearPtr linear, int size);
extern unsigned int SISAllocateFBMemory(ScrnInfoPtr pScrn, void **handle, int bytesize);
extern void SISFreeFBMemory(ScrnInfoPtr pScrn, void **handle);
#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
......@@ -342,7 +345,7 @@ typedef struct {
} SISOverlayRec, *SISOverlayPtr;
typedef struct {
FBLinearPtr linear;
void * handle;
CARD32 bufAddr[2];
unsigned char currentBuf;
......@@ -568,7 +571,7 @@ SIS6326SetupImageVideo(ScreenPtr pScreen)
pPriv->videoStatus = 0;
pPriv->currentBuf = 0;
pPriv->linear = NULL;
pPriv->handle = NULL;
pPriv->grabbedByV4L= FALSE;
SIS6326SetPortDefaults(pScrn, pPriv);
......@@ -1186,17 +1189,6 @@ SIS6326DisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
pPriv->mustwait = 0;
}
static void
SIS6326FreeOverlayMemory(ScrnInfoPtr pScrn)
{
SISPortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn);
if(pPriv->linear) {
xf86FreeOffscreenLinear(pPriv->linear);
pPriv->linear = NULL;
}
}
static void
SIS6326StopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
{
......@@ -1212,7 +1204,7 @@ SIS6326StopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
close_overlay(pSiS, pPriv);
pPriv->mustwait = 1;
}
SIS6326FreeOverlayMemory(pScrn);
SISFreeFBMemory(pScrn, &pPriv->handle);
pPriv->videoStatus = 0;
pSiS->VideoTimerCallback = NULL;
} else {
......@@ -1239,7 +1231,6 @@ SIS6326PutImage(
SISPtr pSiS = SISPTR(pScrn);
SISPortPrivPtr pPriv = (SISPortPrivPtr)data;
int totalSize=0;
int depth = pSiS->CurrentLayout.bitsPerPixel >> 3;
CARD32 *src, *dest;
unsigned long i;
......@@ -1304,13 +1295,10 @@ SIS6326PutImage(
pPriv->totalSize = totalSize;
/* allocate memory (we do doublebuffering) - size is in pixels */
if(!(pPriv->linear = SISAllocateOverlayMemory(pScrn, pPriv->linear,
((totalSize + depth - 1) / depth) << 1)))
/* allocate memory (we do doublebuffering) - size is in bytes */
if(!(pPriv->bufAddr[0] = SISAllocateFBMemory(pScrn, &pPriv->handle, totalSize << 1)))
return BadAlloc;
/* fixup pointers */
pPriv->bufAddr[0] = (pPriv->linear->offset * depth);
pPriv->bufAddr[1] = pPriv->bufAddr[0] + totalSize;
/* copy data */
......@@ -1448,7 +1436,7 @@ SIS6326VideoTimerCallback(ScrnInfoPtr pScrn, Time now)
}
} else if(pPriv->videoStatus & FREE_TIMER) {
if(pPriv->freeTime < now) {
SIS6326FreeOverlayMemory(pScrn);
SISFreeFBMemory(pScrn, &pPriv->handle);
pPriv->mustwait = 1;
pPriv->videoStatus = 0;
}
......@@ -1471,7 +1459,7 @@ SIS6326AllocSurface (
{
SISPtr pSiS = SISPTR(pScrn);
SISPortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn);
int size, depth;
int size;
if((w < IMAGE_MIN_WIDTH) || (h < IMAGE_MIN_HEIGHT))
return BadValue;
......@@ -1487,19 +1475,14 @@ SIS6326AllocSurface (
if(pPriv->grabbedByV4L)
return BadAlloc;
depth = pSiS->CurrentLayout.bitsPerPixel >> 3;
w = (w + 1) & ~1;
pPriv->pitch = ((w << 1) + 63) & ~63; /* Only packed pixel modes supported */
size = h * pPriv->pitch;
pPriv->linear = SISAllocateOverlayMemory(pScrn, pPriv->linear, ((size + depth - 1) / depth));
if(!pPriv->linear)
if(!(pPriv->offset = SISAllocateFBMemory(pScrn, &pPriv->handle, size)))
return BadAlloc;
pPriv->totalSize = size;
pPriv->offset = pPriv->linear->offset * depth;
surface->width = w;
surface->height = h;
surface->pScrn = pScrn;
......@@ -1537,7 +1520,7 @@ SIS6326FreeSurface (XF86SurfacePtr surface)
if(pPriv->grabbedByV4L) {
SIS6326StopSurface(surface);
SIS6326FreeOverlayMemory(surface->pScrn);
SISFreeFBMemory(surface->pScrn, &pPriv->handle);
pPriv->grabbedByV4L = FALSE;
}
return Success;
......
This diff is collapsed.
/* $XFree86$ */
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.h,v 1.6 2005/01/19 16:19:39 twini Exp $ */
/* $XdotOrg$ */
/*
* 2D acceleration for 5597/5598 and 6326
* Definitions for the SIS engine communication
......
/* $XFree86$ */
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_common.h,v 1.5 2005/03/11 14:39:48 twini Exp $ */
/* $XdotOrg$ */
/*
* Common header definitions for SiS 2D/3D/DRM suite
*
......
/* $XFree86$ */
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c,v 1.8 2005/03/11 14:39:48 twini Exp $ */
/* $XdotOrg$ */
/*
* SiS hardware cursor handling
*
......@@ -932,6 +932,8 @@ SiS300UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
case PCI_CHIP_SIS330:
case PCI_CHIP_SIS660:
case PCI_CHIP_SIS340:
case PCI_CHIP_XGIXG20:
case PCI_CHIP_XGIXG40:
if(mode->Flags & V_INTERLACE)
return FALSE;
if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32))
......@@ -1008,6 +1010,8 @@ SiSUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs)
case PCI_CHIP_SIS330:
case PCI_CHIP_SIS660:
case PCI_CHIP_SIS340:
case PCI_CHIP_XGIXG20:
case PCI_CHIP_XGIXG40:
if(mode->Flags & V_INTERLACE)
return FALSE;
if((pCurs->bits->height > 64) || (pCurs->bits->width > 64))
......@@ -1344,6 +1348,8 @@ SiSHWCursorInit(ScreenPtr pScreen)
case PCI_CHIP_SIS330:
case PCI_CHIP_SIS660:
case PCI_CHIP_SIS340:
case PCI_CHIP_XGIXG20:
case PCI_CHIP_XGIXG40:
infoPtr->MaxWidth = 64;
infoPtr->MaxHeight = 64;
infoPtr->ShowCursor = SiS310ShowCursor;
......
/* $XFree86$ */
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.h,v 1.8 2005/06/27 15:56:53 twini Exp $ */
/* $XdotOrg$ */
/*
* SiS hardware cursor handling
* Definitions
......
/* $XFree86$ */
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c,v 1.16 2005/06/27 15:56:53 twini Exp $ */
/* $XdotOrg$ */
/*
* DAC helper functions (Save/Restore, MemClk, etc)
*
......@@ -732,7 +732,7 @@ SiS315Save(ScrnInfoPtr pScrn, SISRegPtr sisReg)
#endif
/* Save SR registers */
for(i = 0x00; i <= 0x3F; i++) {
for(i = 0x00; i <= 0x60; i++) {
inSISIDXREG(SISSR, i, sisReg->sisRegs3C4[i]);
#ifdef TWDEBUG
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
......@@ -1044,7 +1044,7 @@ SiS301BSave(ScrnInfoPtr pScrn, SISRegPtr sisReg)
SISPtr pSiS = SISPTR(pScrn);
int Part1max, Part2max, Part3max, Part4max;
Part1max = 0x4c;
Part1max = 0x60;
Part2max = 0x4d;
Part3max = 0x3e;
Part4max = 0x23;
......@@ -1297,6 +1297,8 @@ SiSMclk(SISPtr pSiS)
case PCI_CHIP_SIS330:
case PCI_CHIP_SIS660:
case PCI_CHIP_SIS340:
case PCI_CHIP_XGIXG20:
case PCI_CHIP_XGIXG40:
/* Numerator */
inSISIDXREG(SISSR, 0x28, Num);
......@@ -1487,6 +1489,8 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, Bool IsForCRT2)
case PCI_CHIP_SIS330:
case PCI_CHIP_SIS660:
case PCI_CHIP_SIS340:
case PCI_CHIP_XGIXG20:
case PCI_CHIP_XGIXG40:
switch(pSiS->Chipset) {
case PCI_CHIP_SIS300:
magic = magicDED[bus/64];
......@@ -1521,6 +1525,8 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, Bool IsForCRT2)
}
max = 680000;
case PCI_CHIP_SIS340:
case PCI_CHIP_XGIXG20:
case PCI_CHIP_XGIXG40:
magic = magicDED[bus/64];
max = 800000;
break;
......@@ -1962,6 +1968,8 @@ SISDACPreInit(ScrnInfoPtr pScrn)
case PCI_CHIP_SIS330:
case PCI_CHIP_SIS660:
case PCI_CHIP_SIS340:
case PCI_CHIP_XGIXG20:
case PCI_CHIP_XGIXG40:
pSiS->SiSSave = SiS315Save;
pSiS->SiSRestore = SiS315Restore;
break;
......
/* $XFree86$ */
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h,v 1.10 2005/06/27 15:56:53 twini Exp $ */
/* $XdotOrg$ */
/*
* DAC helper functions (Save/Restore, MemClk, etc)
* Definitions and prototypes
......
/* $XFree86$ */
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c,v 1.8 2005/03/11 14:39:48 twini Exp $ */
/* $XdotOrg$ */
/*
* SiS DGA handling
*
......@@ -35,26 +35,24 @@
*/
#include "sis.h"
#include "xaa.h"
#include "dgaproc.h"
#include "sis_regs.h"
#ifndef NEW_DGAOPENFRAMEBUFFER
static Bool SIS_OpenFramebuffer(ScrnInfoPtr, char **, UChar **,
int *, int *, int *);
int *, int *, int *);
#else
static Bool SIS_OpenFramebuffer(ScrnInfoPtr, char **, unsigned int *,
unsigned int *, unsigned int *, unsigned int *);
unsigned int *, unsigned int *, unsigned int *);
#endif
static Bool SIS_SetMode(ScrnInfoPtr, DGAModePtr);
static void SIS_Sync(ScrnInfoPtr);
static int SIS_GetViewport(ScrnInfoPtr);
static void SIS_SetViewport(ScrnInfoPtr, int, int, int);
static void SIS_FillRect(ScrnInfoPtr, int, int, int, int, ULong);
static void SIS_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long);
static void SIS_BlitRect(ScrnInfoPtr, int, int, int, int, int, int);
static void SIS_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int,
ULong);
static void SIS_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int, unsigned long);
static
DGAFunctionRec SISDGAFuncs = {
......@@ -317,6 +315,41 @@ SISDGAInit(ScreenPtr pScreen)
}
}
static Bool
SIS_OpenFramebuffer(
ScrnInfoPtr pScrn,
char **name,
#ifndef NEW_DGAOPENFRAMEBUFFER
UChar **mem,
int *size,
int *offset,
int *flags
#else
unsigned int *mem,
unsigned int *size,
unsigned int *offset,
unsigned int *flags
#endif
){
SISPtr pSiS = SISPTR(pScrn);
*name = NULL; /* no special device */
#ifndef NEW_DGAOPENFRAMEBUFFER
*mem = (UChar *)pSiS->FbAddress;
#else
*mem = pSiS->FbAddress;
#endif
*size = pSiS->maxxfbmem;
*offset = 0;
#ifndef NEW_DGAOPENFRAMEBUFFER
*flags = DGA_NEED_ROOT;
#else
*flags = 0;
#endif
return TRUE;
}
static Bool
SIS_SetMode(
ScrnInfoPtr pScrn,
......@@ -386,28 +419,29 @@ SIS_SetViewport(
}