diff options
Diffstat (limited to 'src/sis.h')
-rw-r--r-- | src/sis.h | 506 |
1 files changed, 328 insertions, 178 deletions
@@ -1,46 +1,52 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h,v 1.60 2003/09/09 10:29:01 twini Exp $ */ +/* $XFree86$ */ +/* $XdotOrg$ */ /* * Main global data and definitions * - * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of the copyright holder not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. The copyright holder makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1) Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2) Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3) The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. * - * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * Authors: - * - * ? - * Thomas Winischhofer <thomas@winischhofer.net> + * Authors: Thomas Winischhofer <thomas@winischhofer.net> + * others (old code base) * */ + #ifndef _SIS_H #define _SIS_H_ /* Always unlock the registers (should be set!) */ #define UNLOCK_ALWAYS -#define SISDRIVERVERSIONYEAR 3 -#define SISDRIVERVERSIONMONTH 9 -#define SISDRIVERVERSIONDAY 9 +#define SISDRIVERVERSIONYEAR 4 +#define SISDRIVERVERSIONMONTH 6 +#define SISDRIVERVERSIONDAY 16 #define SISDRIVERREVISION 1 -#define SISDRIVERIVERSION (SISDRIVERVERSIONYEAR << 16) | (SISDRIVERVERSIONMONTH << 8) \ - | SISDRIVERVERSIONDAY | (SISDRIVERREVISION << 24) +#define SISDRIVERIVERSION (SISDRIVERVERSIONYEAR << 16) | \ + (SISDRIVERVERSIONMONTH << 8) | \ + SISDRIVERVERSIONDAY | \ + (SISDRIVERREVISION << 24) #if 0 #define TWDEBUG /* for debugging */ @@ -60,17 +66,22 @@ #include "xaa.h" #include "vgaHW.h" #include "vbe.h" + #include "osdef.h" #include "vgatypes.h" #include "vstruct.h" +#ifdef XORG_VERSION_CURRENT +#define SISMYSERVERNAME "X.org" +#else +#define SISMYSERVERNAME "XFree86" +#endif + #ifdef XF86DRI #undef SISNEWDRI -#if 0 /* Need to wait for the DRI merge */ -#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,99,??,0) +#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,99,14,0) #define SISNEWDRI #endif -#endif #include "xf86drm.h" #include "sarea.h" #define _XF86DRI_SERVER_ @@ -80,36 +91,32 @@ #include "sis_dri.h" #endif -#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,0,0,0) -typedef unsigned long IOADDRESS; -#endif - #if 1 -#define SISDUALHEAD /* Include Dual Head code */ +#define SISDUALHEAD /* Include Dual Head code */ #endif #if 1 -#define SISMERGED /* Include Merged-FB mode */ +#define SISMERGED /* Include Merged-FB mode */ #endif #ifdef SISMERGED #if 1 -#define SISXINERAMA /* Include SiS Pseudo-Xinerama for MergedFB mode */ +#define SISXINERAMA /* Include SiS Pseudo-Xinerama for MergedFB mode */ #define SIS_XINERAMA_MAJOR_VERSION 1 #define SIS_XINERAMA_MINOR_VERSION 1 #endif #endif -#if 0 /* Include code for cycling CRT2 type via keyboard */ -#define CYCLECRT2 /* (not functional yet) */ +#if 1 /* Include code for gamma correction */ +#define SISGAMMA #endif -#if 1 -#define SISGAMMA /* Include code for gamma correction */ +#if 1 /* Include code for color hardware cursors */ +#define SIS_ARGB_CURSOR #endif -#if 1 /* Include code for color hardware cursors */ -#define SIS_ARGB_CURSOR +#if 1 /* Include YPbPr support on SiS bridges (315 series and 661/741/760) */ +#define ENABLE_YPBPR #endif #ifdef SISMERGED @@ -125,29 +132,40 @@ typedef unsigned long IOADDRESS; #define SISVRAMQ /* Use VRAM queue mode on 315 series */ #endif +/* Include support for YUV->RGB blit adaptors (VRAM queue mode only) */ +#undef INCL_YUV_BLIT_ADAPTOR +#ifdef SISVRAMQ +#if 1 +#define INCL_YUV_BLIT_ADAPTOR +#endif +#endif + #undef SIS315DRI /* define this if dri is adapted for 315/330 series */ /* For SiS315/550/650/740/330/660 - these should be moved elsewhere! */ #ifndef PCI_CHIP_SIS315H -#define PCI_CHIP_SIS315H 0x0310 +#define PCI_CHIP_SIS315H 0x0310 #endif #ifndef PCI_CHIP_SIS315 -#define PCI_CHIP_SIS315 0x0315 +#define PCI_CHIP_SIS315 0x0315 #endif #ifndef PCI_CHIP_SIS315PRO -#define PCI_CHIP_SIS315PRO 0x0325 +#define PCI_CHIP_SIS315PRO 0x0325 #endif #ifndef PCI_CHIP_SIS550 -#define PCI_CHIP_SIS550 0x5315 /* 550_VGA */ +#define PCI_CHIP_SIS550 0x5315 /* 550_VGA */ #endif #ifndef PCI_CHIP_SIS650 -#define PCI_CHIP_SIS650 0x6325 /* 650_VGA and 740_VGA */ +#define PCI_CHIP_SIS650 0x6325 /* 650_VGA and 740_VGA */ #endif #ifndef PCI_CHIP_SIS330 -#define PCI_CHIP_SIS330 0x0330 +#define PCI_CHIP_SIS330 0x0330 #endif #ifndef PCI_CHIP_SIS660 -#define PCI_CHIP_SIS660 0x6330 /* 660_VGA and 760_VGA (obviously DOA) */ +#define PCI_CHIP_SIS660 0x6330 /* 661_VGA, 741_VGA, 760_VGA */ +#endif +#ifndef PCI_CHIP_SIS340 +#define PCI_CHIP_SIS340 0x0340 #endif #define SIS_NAME "SIS" @@ -179,28 +197,28 @@ typedef unsigned long IOADDRESS; /* VBFlags - if anything is changed here, increase VBFlagsVersion! */ #define CRT2_DEFAULT 0x00000001 -#define CRT2_LCD 0x00000002 /* TW: Never change the order of the CRT2_XXX entries */ -#define CRT2_TV 0x00000004 /* (see SISCycleCRT2Type()) */ +#define CRT2_LCD 0x00000002 /* Never change the order of the CRT2_XXX entries */ +#define CRT2_TV 0x00000004 #define CRT2_VGA 0x00000008 -#define CRT2_ENABLE (CRT2_LCD | CRT2_TV | CRT2_VGA) -#define DISPTYPE_DISP2 CRT2_ENABLE #define TV_NTSC 0x00000010 #define TV_PAL 0x00000020 #define TV_HIVISION 0x00000040 -#define TV_HIVISION_LV 0x00000080 -#define TV_TYPE (TV_NTSC | TV_PAL | TV_HIVISION | TV_HIVISION_LV) +#define TV_YPBPR 0x00000080 #define TV_AVIDEO 0x00000100 #define TV_SVIDEO 0x00000200 #define TV_SCART 0x00000400 -#define TV_INTERFACE (TV_AVIDEO | TV_SVIDEO | TV_SCART | TV_CHSCART | TV_CHHDTV) -#define VB_USELCDA 0x00000800 +#define VB_CONEXANT 0x00000800 /* 661 series only */ +#define VB_TRUMPION VB_CONEXANT /* 300 series only */ #define TV_PALM 0x00001000 #define TV_PALN 0x00002000 +#define TV_NTSCJ 0x00001000 +#define VB_302ELV 0x00004000 #define TV_CHSCART 0x00008000 -#define TV_CHHDTV 0x00010000 +#define TV_CHYPBPR525I 0x00010000 +#define CRT1_VGA 0x00000000 +#define CRT1_LCDA 0x00020000 #define VGA2_CONNECTED 0x00040000 #define DISPTYPE_CRT1 0x00080000 /* CRT1 connected and used */ -#define DISPTYPE_DISP1 DISPTYPE_CRT1 #define VB_301 0x00100000 /* Video bridge type */ #define VB_301B 0x00200000 #define VB_302B 0x00400000 @@ -209,22 +227,43 @@ typedef unsigned long IOADDRESS; #define VB_CHRONTEL 0x02000000 #define VB_301LV 0x04000000 #define VB_302LV 0x08000000 -#define VB_30xLV VB_301LV -#define VB_30xLVX VB_302LV #define VB_301C 0x10000000 -#define VB_VIDEOBRIDGE (VB_301|VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV| \ - VB_LVDS|VB_CHRONTEL) -#define VB_SISBRIDGE (VB_301|VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV) #define SINGLE_MODE 0x20000000 /* CRT1 or CRT2; determined by DISPTYPE_CRTx */ -#define VB_DISPMODE_SINGLE SINGLE_MODE /* alias */ #define MIRROR_MODE 0x40000000 /* CRT1 + CRT2 identical (mirror mode) */ -#define VB_DISPMODE_MIRROR MIRROR_MODE /* alias */ #define DUALVIEW_MODE 0x80000000 /* CRT1 + CRT2 independent (dual head mode) */ + +/* Aliases: */ +#define CRT2_ENABLE (CRT2_LCD | CRT2_TV | CRT2_VGA) +#define TV_STANDARD (TV_NTSC | TV_PAL | TV_PALM | TV_PALN | TV_NTSCJ) +#define TV_INTERFACE (TV_AVIDEO|TV_SVIDEO|TV_SCART|TV_HIVISION|TV_YPBPR) + +/* Only if TV_YPBPR is set: */ +#define TV_YPBPR525I TV_NTSC +#define TV_YPBPR525P TV_PAL +#define TV_YPBPR750P TV_PALM +#define TV_YPBPR1080I TV_PALN +#define TV_YPBPRALL (TV_YPBPR525I | TV_YPBPR525P | TV_YPBPR750P | TV_YPBPR1080I) + +#define TV_YPBPR43LB TV_CHSCART +#define TV_YPBPR43 TV_CHYPBPR525I +#define TV_YPBPR169 (TV_CHSCART | TV_CHYPBPR525I) +#define TV_YPBPRAR (TV_CHSCART | TV_CHYPBPR525I) + +#define VB_SISBRIDGE (VB_301|VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV|VB_302ELV) +#define VB_SISTVBRIDGE (VB_301|VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV) +#define VB_VIDEOBRIDGE (VB_SISBRIDGE | VB_LVDS | VB_CHRONTEL | VB_CONEXANT) +#define VB_SISLVDSBRIDGE (VB_301LV|VB_302LV|VB_302ELV) +#define VB_SISTMDSBRIDGE (VB_301|VB_301B|VB_301C|VB_302B) + +#define DISPTYPE_DISP2 CRT2_ENABLE +#define DISPTYPE_DISP1 DISPTYPE_CRT1 +#define VB_DISPMODE_SINGLE SINGLE_MODE /* alias */ +#define VB_DISPMODE_MIRROR MIRROR_MODE /* alias */ #define VB_DISPMODE_DUAL DUALVIEW_MODE /* alias */ -#define DISPLAY_MODE (SINGLE_MODE | MIRROR_MODE | DUALVIEW_MODE) /* TW */ +#define DISPLAY_MODE (SINGLE_MODE | MIRROR_MODE | DUALVIEW_MODE) -/* TW: pSiS->VBLCDFlags */ -#define VB_LCD_320x480 0x00000001 /* TW: DSTN/FSTN for 550 */ +/* pSiS->VBLCDFlags */ +#define VB_LCD_320x480 0x00000001 /* DSTN/FSTN for 550 */ #define VB_LCD_640x480 0x00000002 #define VB_LCD_800x600 0x00000004 #define VB_LCD_1024x768 0x00000008 @@ -240,28 +279,23 @@ typedef unsigned long IOADDRESS; #define VB_LCD_640x480_2 0x00002000 /* DSTN/FSTN */ #define VB_LCD_640x480_3 0x00004000 /* DSTN/FSTN */ #define VB_LCD_848x480 0x00008000 /* LVDS only, otherwise handled as custom */ +#define VB_LCD_1280x800 0x00010000 +#define VB_LCD_1680x1050 0x00020000 +#define VB_LCD_1280x720 0x00040000 #define VB_LCD_BARCO1366 0x20000000 #define VB_LCD_CUSTOM 0x40000000 #define VB_LCD_EXPANDING 0x80000000 +/* PresetMode argument */ +#define SIS_MODE_SIMU 0 +#define SIS_MODE_CRT1 1 +#define SIS_MODE_CRT2 2 + /* pSiS->MiscFlags */ #define MISC_CRT1OVERLAY 0x00000001 /* Current display mode supports overlay */ #define MISC_PANELLINKSCALER 0x00000002 /* Panel link is currently scaling */ - -/* More or less useful macros (although we often use pSiS->VGAEngine instead) */ -#define SIS_IS_300_CHIPSET (pSiS->Chipset == PCI_CHIP_SIS300) || \ - (pSiS->Chipset == PCI_CHIP_SIS630) || \ - (pSiS->Chipset == PCI_CHIP_SIS540) || \ - (pSiS->Chipset == PCI_CHIP_SIS730) - -#define SIS_IS_315_CHIPSET (pSiS->Chipset == PCI_CHIP_SIS315) || \ - (pSiS->Chipset == PCI_CHIP_SIS315H) || \ - (pSiS->Chipset == PCI_CHIP_SIS315PRO) || \ - (pSiS->Chipset == PCI_CHIP_SIS550) || \ - (pSiS->Chipset == PCI_CHIP_SIS650) || \ - (pSiS->Chipset == PCI_CHIP_SIS330) || \ - (pSiS->Chipset == PCI_CHIP_SIS660) || \ - (pSiS->Chipset == PCI_CHIP_SIS760) +#define MISC_CRT1OVERLAYGAMMA 0x00000004 /* Current display mode supports overlay gamma corr on CRT1 */ +#define MISC_TVNTSC1024 0x00000008 /* Current display mode is TV NTSC/PALM/YPBPR525I 1024x768 */ /* SiS6326Flags */ #define SIS6326_HASTV 0x00000001 @@ -271,7 +305,7 @@ typedef unsigned long IOADDRESS; #define SIS6326_TVDETECTED 0x00000010 #define SIS6326_TVON 0x80000000 -#define HW_DEVICE_EXTENSION SIS_HW_DEVICE_INFO +#define HW_DEVICE_EXTENSION SIS_HW_INFO #ifdef DEBUG #define PDEBUG(p) p @@ -291,19 +325,19 @@ typedef unsigned char UChar; #define SIS_530_VGA 1 #define SIS_OLD_VGA 2 #define SIS_300_VGA 3 -#define SIS_315_VGA 4 /* Includes Xabre; see ChipFlags */ +#define SIS_315_VGA 4 /* Includes 330/660/661/741/760 and M versions thereof */ /* oldChipset */ -#define OC_UNKNOWN 0 -#define OC_SIS86201 1 -#define OC_SIS86202 2 -#define OC_SIS6205A 3 -#define OC_SIS6205B 4 -#define OC_SIS82204 5 -#define OC_SIS6205C 6 -#define OC_SIS6225 7 -#define OC_SIS5597 8 -#define OC_SIS6326 9 +#define OC_UNKNOWN 0 +#define OC_SIS86201 1 +#define OC_SIS86202 2 +#define OC_SIS6205A 3 +#define OC_SIS6205B 4 +#define OC_SIS82204 5 +#define OC_SIS6205C 6 +#define OC_SIS6225 7 +#define OC_SIS5597 8 +#define OC_SIS6326 9 #define OC_SIS530A 11 #define OC_SIS530B 12 #define OC_SIS620 13 @@ -314,53 +348,113 @@ typedef unsigned char UChar; /* ChipFlags */ /* Use only lower 16 bit for chip id! (sisctrl) */ -#define SiSCF_LARGEOVERLAY 0x00000001 -#define SiSCF_Is651 0x00000002 -#define SiSCF_IsM650 0x00000004 -#define SiSCF_IsM652 0x00000008 -#define SiSCF_IsM653 0x00000010 -#define SiSCF_Is652 0x00000020 -#define SiSCF_Is661FX 0x00000040 -#define SiSCF_IsM661FX 0x00000080 -#define SiSCF_Is661 (SiSCF_Is661FX | SiSCF_IsM661FX) -#define SiSCF_Is741 0x00000100 -#define SiSCF_Is65x (SiSCF_Is651|SiSCF_IsM650|SiSCF_IsM652|SiSCF_IsM653| \ - SiSCF_Is652|SiSCF_Is661FX|SiSCF_IsM661FX|SiSCF_Is741) -#define SiSCF_IsM660 0x00000200 -#define SiSCF_IsM760 0x00000400 -#define SiSCF_Is66x (SiSCF_IsM660 | SiSCF_IsM760) -#define SiSCF_XabreCore 0x00010000 -#define SiSCF_Glamour3 0x40000000 -#define SiSCF_Integrated 0x80000000 - +#define SiSCF_LARGEOVERLAY 0x00000001 +#define SiSCF_Is651 0x00000002 +#define SiSCF_IsM650 0x00000004 +#define SiSCF_IsM652 0x00000008 +#define SiSCF_IsM653 0x00000010 +#define SiSCF_Is652 0x00000020 +#define SiSCF_Is65x (SiSCF_Is651|SiSCF_IsM650|SiSCF_IsM652|SiSCF_IsM653|SiSCF_Is652) +#define SiSCF_IsM661 0x00000100 /* M661FX */ +#define SiSCF_IsM741 0x00000200 +#define SiSCF_IsM760 0x00000400 +#define SiSCF_IsM661M 0x00000800 /* M661MX */ +#define SiSCF_IsM66x (SiSCF_IsM661 | SiSCF_IsM741 | SiSCF_IsM760 | SiSCF_IsM661M) +#define SiSCF_315Core 0x00010000 /* 3D: Real 315 */ +#define SiSCF_Real256ECore 0x00020000 /* 3D: Similar to 315 core, no T&L? (65x, 661, 740, 741) */ +#define SiSCF_XabreCore 0x00040000 /* 3D: Real Xabre */ +#define SiSCF_Ultra256Core 0x00080000 /* 3D: aka "Mirage 2"; similar to Xabre, no T&L?, no P:Shader? (760) */ +#define SiSCF_UseLCDA 0x01000000 +#define SiSCF_760LFB 0x08000000 /* 760: LFB active (if not set, UMA only) */ +#define SiSCF_760UMA 0x10000000 /* 760: UMA active (if not set, LFB only) */ +#define SiSCF_CRT2HWCKaputt 0x20000000 /* CRT2 Mono HWCursor engine buggy (SiS 330) */ +#define SiSCF_Glamour3 0x40000000 +#define SiSCF_Integrated 0x80000000 /* SiS Direct Xv-API */ -#define SiS_SD_IS300SERIES 0x00000001 -#define SiS_SD_IS315SERIES 0x00000002 -#define SiS_SD_IS330SERIES 0x00000004 -#define SiS_SD_SUPPORTPALMN 0x00000008 /* tv chip supports pal-m, pal-n */ -#define SiS_SD_SUPPORT2OVL 0x00000010 /* set = 2 overlays, 1 = support SWITCHCRT xv prop */ -#define SiS_SD_SUPPORTTVPOS 0x00000020 /* supports changing tv position */ -#define SiS_SD_ISDUALHEAD 0x00000040 /* Driver is in dual head mode */ -#define SiS_SD_ISMERGEDFB 0x00000080 /* Driver is in merged fb mode */ -#define SiS_SD_ISDHSECONDHEAD 0x00000100 /* Dual head: This is CRT1 (=second head) */ -#define SiS_SD_ISDHXINERAMA 0x00000200 /* Dual head: We are running Xinerama */ -#define SiS_SD_VBHASSCART 0x00000400 /* videobridge has SCART instead of VGA2 */ -#define SiS_SD_ISDEPTH8 0x00000800 /* Depth is 8, no independent gamma correction */ -#define SiS_SD_SUPPORTSOVER 0x00001000 /* Support for Chrontel Super Overscan */ -#define SiS_SD_ENABLED 0x00002000 /* sisctrl is enabled (by option) */ -#define SiS_SD_PSEUDOXINERAMA 0x00004000 /* pseudo xinerama is active */ - -#define SIS_DIRECTKEY 0x3145792 +#define SiS_SD_IS300SERIES 0x00000001 +#define SiS_SD_IS315SERIES 0x00000002 +#define SiS_SD_IS330SERIES 0x00000004 +#define SiS_SD_SUPPORTPALMN 0x00000008 /* tv chip supports pal-m, pal-n */ +#define SiS_SD_SUPPORT2OVL 0x00000010 /* set = 2 overlays, clear = support SWITCHCRT xv prop */ +#define SiS_SD_SUPPORTTVPOS 0x00000020 /* supports changing tv position */ +#define SiS_SD_ISDUALHEAD 0x00000040 /* Driver is in dual head mode */ +#define SiS_SD_ISMERGEDFB 0x00000080 /* Driver is in merged fb mode */ +#define SiS_SD_ISDHSECONDHEAD 0x00000100 /* Dual head: This is CRT1 (=second head) */ +#define SiS_SD_ISDHXINERAMA 0x00000200 /* Dual head: We are running Xinerama */ +#define SiS_SD_VBHASSCART 0x00000400 /* videobridge has SCART instead of VGA2 */ +#define SiS_SD_ISDEPTH8 0x00000800 /* Depth is 8, no independent gamma correction */ +#define SiS_SD_SUPPORTSOVER 0x00001000 /* Support for Chrontel Super Overscan */ +#define SiS_SD_ENABLED 0x00002000 /* sisctrl is enabled (by option) */ +#define SiS_SD_PSEUDOXINERAMA 0x00004000 /* pseudo xinerama is active */ +#define SiS_SD_SUPPORTLCDA 0x00008000 /* Support LCD Channel A */ +#define SiS_SD_SUPPORTNTSCJ 0x00010000 /* tv chip supports ntsc-j */ +#define SiS_SD_ADDLSUPFLAG 0x00020000 /* 1 = the following flags are valid */ +#define SiS_SD_SUPPORTVGA2 0x00040000 /* CRT2=VGA supported */ +#define SiS_SD_SUPPORTSCART 0x00080000 /* CRT2=SCART supported */ +#define SiS_SD_SUPPORTOVERSCAN 0x00100000 /* Overscan flag supported */ +#define SiS_SD_SUPPORTXVGAMMA1 0x00200000 /* Xv Gamma correction for CRT1 supported */ +#define SiS_SD_SUPPORTTV 0x00400000 /* CRT2=TV supported */ +#define SiS_SD_SUPPORTYPBPR 0x00800000 /* CRT2=YPbPr (525i, 525p, 750p, 1080i) is supported */ +#define SiS_SD_SUPPORTHIVISION 0x01000000 /* CRT2=HiVision is supported */ +#define SiS_SD_SUPPORTYPBPRAR 0x02000000 /* YPbPr aspect ratio is supported */ +#define SiS_SD_SUPPORTSCALE 0x04000000 /* Scaling of LCD panel supported */ +#define SiS_SD_SUPPORTCENTER 0x08000000 /* If scaling supported: Centering of screen [NOT] supported (TMDS only) */ +#define SiS_SD_SUPPORTREDETECT 0x10000000 /* Support re-detection of CRT2 devices */ +#define SiS_SD_IS340SERIES 0x20000000 + +#define SIS_DIRECTKEY 0x03145792 /* SiSCtrl: Check mode for CRT2 */ -#define SiS_CF2_LCD 0x01 -#define SiS_CF2_TV 0x02 -#define SiS_CF2_VGA2 0x04 -#define SiS_CF2_TVPAL 0x08 -#define SiS_CF2_TVNTSC 0x10 -#define SiS_CF2_TVPALM 0x20 -#define SiS_CF2_TVPALN 0x40 +#define SiS_CF2_LCD 0x01 +#define SiS_CF2_TV 0x02 +#define SiS_CF2_VGA2 0x04 +#define SiS_CF2_TVPAL 0x08 +#define SiS_CF2_TVNTSC 0x10 /* + NTSC-J */ +#define SiS_CF2_TVPALM 0x20 +#define SiS_CF2_TVPALN 0x40 +#define SiS_CF2_CRT1LCDA 0x80 +#define SiS_CF2_TYPEMASK (SiS_CF2_LCD | SiS_CF2_TV | SiS_CF2_VGA2 | SiS_CF2_CRT1LCDA) +#define SiS_CF2_TVSPECIAL (SiS_CF2_LCD | SiS_CF2_TV) +#define SiS_CF2_TVSPECMASK (SiS_CF2_TVPAL | SiS_CF2_TVNTSC | SiS_CF2_TVPALM | SiS_CF2_TVPALN) +#define SiS_CF2_TVHIVISION SiS_CF2_TVPAL +#define SiS_CF2_TVYPBPR525I SiS_CF2_TVNTSC +#define SiS_CF2_TVYPBPR525P (SiS_CF2_TVPAL | SiS_CF2_TVNTSC) +#define SiS_CF2_TVYPBPR750P SiS_CF2_TVPALM +#define SiS_CF2_TVYPBPR1080I (SiS_CF2_TVPALM | SiS_CF2_TVPAL) + +/* AGP stuff for DRI */ +#define AGP_PAGE_SIZE 4096 +#define AGP_PAGES 2048 /* Default: 2048 pages @ 4096 = 8MB */ +/* 300 */ +#define AGP_CMDBUF_PAGES 256 +#define AGP_CMDBUF_SIZE (AGP_PAGE_SIZE * AGP_CMDBUF_PAGES) +/* 315/330 */ +#define AGP_VTXBUF_PAGES 512 +#define AGP_VTXBUF_SIZE (AGP_PAGE_SIZE * AGP_VTXBUF_PAGES) + +/* Used for mapping a0000 and saving/restoring fonts (or not doing so) */ +/* List of architectures likely to be incomplete */ +#define SIS_PC_PLATFORM +#if defined(__powerpc__) || defined(__mips__) || defined(__arm32__) +#undef SIS_PC_PLATFORM +#endif + +#if 0 +/* Used for mapping i/o port area to virtual memory (or not doing so) */ +/* List of architectures likely to be incomplete */ +/* BROKEN, see comment in sis_driver.c */ +#undef SIS_NEED_MAP_IOP +#if defined(__arm32__) || defined(__mips__) +#define SIS_NEED_MAP_IOP +#endif +#endif + +/* Used for makeing use of the BIOS scratch area (save/restore mode number) */ +#undef SIS_USE_BIOS_SCRATCH +#if (defined(i386) || defined(__i386) || defined(__i386__) || defined(__AMD64__)) +#define SIS_USE_BIOS_SCRATCH +#endif /* For backup of register contents */ typedef struct { @@ -370,7 +464,7 @@ typedef struct { unsigned char sisCapt[0x60]; unsigned char sisVid[0x50]; unsigned char VBPart1[0x50]; - unsigned char VBPart2[0x50]; + unsigned char VBPart2[0x100]; unsigned char VBPart3[0x50]; unsigned char VBPart4[0x50]; unsigned short ch70xx[64]; @@ -408,14 +502,16 @@ typedef struct { unsigned char * BIOS; SiS_Private * SiS_Pr; unsigned long agpHandle; - CARD32 agpAddr; + unsigned long agpAddr; unsigned char *agpBase; unsigned int agpSize; - CARD32 agpCmdBufAddr; /* 300 series */ + unsigned int agpWantedSize; + unsigned int agpWantedPages; + unsigned long agpCmdBufAddr; /* 300 series */ unsigned char *agpCmdBufBase; unsigned int agpCmdBufSize; unsigned int agpCmdBufFree; - CARD32 agpVtxBufAddr; /* 315 series */ + unsigned long agpVtxBufAddr; /* 315 series */ unsigned char *agpVtxBufBase; unsigned int agpVtxBufSize; unsigned int agpVtxBufFree; @@ -428,20 +524,22 @@ typedef struct { DisplayModePtr CRT1DMode; /* Current display mode for CRT1 */ int CRT2ModeNo; /* Current display mode for CRT2 */ DisplayModePtr CRT2DMode; /* Current display mode for CRT2 */ + Bool CRT2ModeSet; /* CRT2 mode has been set */ Bool CRT2IsCustom; + unsigned char CRT2CR30, CRT2CR31, CRT2CR35, CRT2CR38; int refCount; int lastInstance; /* number of entities */ Bool DisableDual; /* Emergency flag */ Bool ErrorAfterFirst; /* Emergency flag: Error after first init -> Abort second */ Bool HWCursor; /* Backup master settings for use on slave */ Bool TurboQueue; + int ForceCRT1Type; int ForceCRT2Type; int OptTVStand; int OptTVOver; int OptTVSOver; int OptROMUsage; int OptUseOEM; - int PDC; Bool NoAccel; int forceCRT1; int DSTN, FSTN; @@ -479,24 +577,40 @@ typedef struct { int sistvyfilter; int tvxpos, tvypos; int tvxscale, tvyscale; - int ForceTVType; + int ForceTVType, SenseYPbPr; + unsigned long ForceYPbPrType, ForceYPbPrAR; int chtvtype; - int NonDefaultPAL; + int NonDefaultPAL, NonDefaultNTSC; unsigned short tvx, tvy; - unsigned char p2_01, p2_02, p2_1f, p2_20; + unsigned char p2_01, p2_02, p2_1f, p2_20, p2_43, p2_42, p2_2b; unsigned char p2_44, p2_45, p2_46; unsigned long sistvccbase; unsigned char p2_35, p2_36, p2_37, p2_38, p2_48, p2_49, p2_4a; unsigned char p2_0a, p2_2f, p2_30, p2_47; - unsigned char scalingp1[9], scalingp4[9]; + unsigned char scalingp1[9], scalingp4[9], scalingp2[64]; unsigned short cursorBufferNum; BOOLEAN restorebyset; - BOOLEAN CRT1gamma, CRT2gamma; + BOOLEAN CRT1gamma, CRT1gammaGiven, CRT2gamma, XvGamma, XvGammaGiven, XvDefAdaptorBlit; + int XvGammaRed, XvGammaGreen, XvGammaBlue; + int GammaBriR, GammaBriG, GammaBriB; /* strictly for Xinerama */ + int GammaPBriR, GammaPBriG, GammaPBriB; /* strictly for Xinerama */ int curxvcrtnum; - int UsePanelScaler; + int UsePanelScaler, CenterLCD; int AllowHotkey; BOOLEAN enablesisctrl; unsigned long cmdQ_SharedWritePort_2D; + unsigned char *RenderAccelArray; + unsigned char * FbBase1; + unsigned long OnScreenSize1; + unsigned char OldMode; + int HWCursorMBufNum, HWCursorCBufNum; + BOOLEAN ROM661New; +#ifdef SIS_NEED_MAP_IOP + CARD32 IOPAddress; /* I/O port physical address */ + unsigned char * IOPBase; /* I/O port linear address */ + unsigned short MapCountIOPBase; /* map/unmap queue counter */ + Bool forceUnmapIOPBase; /* ignore counter and unmap */ +#endif #ifdef SIS_CP SIS_CP_H_ENT #endif @@ -536,7 +650,7 @@ typedef struct { #ifdef __alpha__ unsigned char * IOBaseDense; /* MMIO for Alpha platform */ #endif - CARD16 RelIO; /* Relocated IO Ports baseaddress */ + SISIOADDRESS RelIO; /* Relocated IO Ports baseaddress */ unsigned char * BIOS; int MemClock; int BusWidth; @@ -562,6 +676,7 @@ typedef struct { Bool UsePCIRetry; Bool TurboQueue; int VESA; + int ForceCRT1Type; int ForceCRT2Type; int OptTVStand; int OptTVOver; @@ -572,13 +687,14 @@ typedef struct { int forceCRT1; Bool CRT1changed; unsigned char oldCR17, oldCR63, oldSR1F; - unsigned char oldCR32; + unsigned char oldCR32, oldCR36, oldCR37; + unsigned char myCR32, myCR36, myCR37, myCR63; unsigned char newCR32; unsigned long VBFlags; /* Video bridge configuration */ unsigned long VBFlags_backup; /* Backup for SlaveMode-modes */ unsigned long VBLCDFlags; /* Moved LCD panel size bits here */ int ChrontelType; /* CHRONTEL_700x or CHRONTEL_701x */ - int PDC; /* PanelDelayCompensation */ + unsigned int PDC, PDCA; /* PanelDelayCompensation */ short scrnOffset; /* Screen pitch (data) */ short scrnPitch; /* Screen pitch (display; regarding interlace) */ short DstColor; @@ -608,7 +724,6 @@ typedef struct { xf86CursorInfoPtr CursorInfoPtr; XAAInfoRecPtr AccelInfoPtr; CloseScreenProcPtr CloseScreen; - unsigned int (*ddc1Read)(ScrnInfoPtr); Bool (*ModeInit)(ScrnInfoPtr pScrn, DisplayModePtr mode); void (*SiSSave)(ScrnInfoPtr pScrn, SISRegPtr sisreg); void (*SiSSave2)(ScrnInfoPtr pScrn, SISRegPtr sisreg); @@ -618,8 +733,6 @@ typedef struct { void (*SiSRestore2)(ScrnInfoPtr pScrn, SISRegPtr sisreg); void (*SiSRestore3)(ScrnInfoPtr pScrn, SISRegPtr sisreg); void (*SiSRestoreLVDSChrontel)(ScrnInfoPtr pScrn, SISRegPtr sisreg); - void (*SetThreshold)(ScrnInfoPtr pScrn, DisplayModePtr mode, - unsigned short *Low, unsigned short *High); void (*LoadCRT2Palette)(ScrnInfoPtr pScrn, int numColors, int *indicies, LOCO *colors, VisualPtr pVisual); @@ -639,14 +752,16 @@ typedef struct { unsigned int cmdQueueSize_div4; unsigned int cmdQueueSize_4_3; unsigned long agpHandle; - CARD32 agpAddr; + unsigned long agpAddr; unsigned char *agpBase; unsigned int agpSize; - CARD32 agpCmdBufAddr; /* 300 series */ + unsigned int agpWantedSize; + unsigned int agpWantedPages; + unsigned long agpCmdBufAddr; /* 300 series */ unsigned char *agpCmdBufBase; unsigned int agpCmdBufSize; unsigned int agpCmdBufFree; - CARD32 agpVtxBufAddr; /* 315 series */ + unsigned long agpVtxBufAddr; /* 315 series */ unsigned char *agpVtxBufBase; unsigned int agpVtxBufSize; unsigned int agpVtxBufFree; @@ -658,6 +773,7 @@ typedef struct { int irq; Bool IsAGPCard; unsigned long DRIheapstart, DRIheapend; + Bool NeedFlush; /* Need to flush cmd buf mem (760) */ void (*RenderCallback)(ScrnInfoPtr); Time RenderTime; @@ -670,8 +786,8 @@ typedef struct { int ColorExpandBufferNumber; int ColorExpandBufferCountMask; unsigned char *ColorExpandBufferAddr[32]; - int ColorExpandBufferScreenOffset[32]; - long ColorExpandBase; + CARD32 ColorExpandBufferScreenOffset[32]; + CARD32 ColorExpandBase; int ImageWriteBufferSize; unsigned char *ImageWriteBufferAddr; @@ -683,6 +799,8 @@ typedef struct { unsigned char *ShadowPtr; int ShadowPitch; + Bool loadDRI; + #ifdef XF86DRI Bool directRenderingEnabled; DRIInfoPtr pDRIInfo; @@ -694,8 +812,12 @@ typedef struct { #endif XF86VideoAdaptorPtr adaptor; + XF86VideoAdaptorPtr blitadaptor; + void * blitPriv; ScreenBlockHandlerProcPtr BlockHandler; void (*VideoTimerCallback)(ScrnInfoPtr, Time); + void (*ResetXv)(ScrnInfoPtr); + void (*ResetXvGamma)(ScrnInfoPtr); OptionInfoPtr Options; unsigned char LCDon; @@ -728,15 +850,13 @@ typedef struct { BOOL SiSXinerama; /* Do we use Xinerama mode? */ #endif SISFBLayout CurrentLayout; /* Current framebuffer layout */ - Bool (*i2cInit)(ScrnInfoPtr);/* I2C stuff (unused) */ - I2CBusPtr I2C; USHORT SiS_DDC2_Index; USHORT SiS_DDC2_Data; USHORT SiS_DDC2_Clk; BOOL Primary; /* Display adapter is primary */ xf86Int10InfoPtr pInt; /* Our int10 */ int oldChipset; /* Type of old chipset */ - CARD32 RealVideoRam; /* 6326 can only address 4MB, but TQ can be above */ + int RealVideoRam; /* 6326 can only address 4MB, but TQ can be above */ CARD32 CmdQueLenMask; /* Mask of queue length in MMIO register */ CARD32 CmdQueLenFix; /* Fix value to subtract from QueLen (530/620) */ CARD32 CmdQueMaxLen; /* (6326/5597/5598) Amount of cmds the queue can hold */ @@ -770,24 +890,30 @@ typedef struct { int sis6326fscadjust; BOOL sisfbfound; BOOL donttrustpdc; /* Don't trust the detected PDC */ - unsigned char sisfbpdc; + unsigned char sisfbpdc, sisfbpdca; unsigned char sisfblcda; int sisfbscalelcd; unsigned long sisfbspecialtiming; + BOOL sisfb_haveemi, sisfb_haveemilcd, sisfb_tvposvalid, sisfb_havelock; + unsigned char sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33; + int sisfb_tvxpos, sisfb_tvypos; + char sisfbdevname[16]; + int EMI; int NoYV12; /* Disable Xv YV12 support (old series) */ unsigned char postVBCR32; int newFastVram; /* Replaces FastVram */ - int ForceTVType; - int NonDefaultPAL; + int ForceTVType, SenseYPbPr; + int NonDefaultPAL, NonDefaultNTSC; + unsigned long ForceYPbPrType, ForceYPbPrAR; unsigned long lockcalls; /* Count unlock calls for debug */ unsigned short tvx, tvy; /* Backup TV position registers */ - unsigned char p2_01, p2_02, p2_1f, p2_20; /* Backup TV position registers */ + unsigned char p2_01, p2_02, p2_1f, p2_20, p2_43, p2_42, p2_2b; /* Backup TV position registers */ unsigned short tvx1, tvx2, tvx3, tvy1; /* Backup TV position registers */ unsigned char p2_44, p2_45, p2_46; unsigned long sistvccbase; unsigned char p2_35, p2_36, p2_37, p2_38, p2_48, p2_49, p2_4a; unsigned char p2_0a, p2_2f, p2_30, p2_47; - unsigned char scalingp1[9], scalingp4[9]; + unsigned char scalingp1[9], scalingp4[9], scalingp2[64]; BOOLEAN ForceCursorOff; BOOLEAN HaveCustomModes; BOOLEAN IsCustom; @@ -797,12 +923,17 @@ typedef struct { Atom xvAutopaintColorKey, xvSetDefaults, xvSwitchCRT; Atom xvDisableGfx, xvDisableGfxLR, xvTVXPosition, xvTVYPosition; Atom xvDisableColorkey, xvUseChromakey, xvChromaMin, xvChromaMax; - Atom xvInsideChromakey, xvYUVChromakey; + Atom xvInsideChromakey, xvYUVChromakey, xvVSync; + Atom xvGammaRed, xvGammaGreen, xvGammaBlue; Atom xv_QVF, xv_QVV, xv_USD, xv_SVF, xv_QDD, xv_TAF, xv_TSA, xv_TEE, xv_GSF; Atom xv_TTE, xv_TCO, xv_TCC, xv_TCF, xv_TLF, xv_CMD, xv_CMDR, xv_CT1, xv_SGA; Atom xv_GDV, xv_GHI, xv_OVR, xv_GBI, xv_TXS, xv_TYS, xv_CFI, xv_COC, xv_COF; Atom xv_YFI, xv_GSS, xv_BRR, xv_BRG, xv_BRB, xv_PBR, xv_PBG, xv_PBB, xv_SHC; - BOOLEAN xv_sisdirectunlocked; + Atom xv_BRR2, xv_BRG2, xv_BRB2, xv_PBR2, xv_PBG2, xv_PBB2, xv_PMD, xv_RDT; +#ifdef TWDEBUG + Atom xv_STR; +#endif + int xv_sisdirectunlocked; unsigned long xv_sd_result; int CRT1isoff; #ifdef SIS_CP @@ -819,17 +950,20 @@ typedef struct { BOOLEAN restorebyset; BOOLEAN nocrt2ddcdetection; BOOLEAN forcecrt2redetection; - BOOLEAN CRT1gamma, CRT2gamma; + BOOLEAN CRT1gamma, CRT1gammaGiven, CRT2gamma, XvGamma, XvGammaGiven; int XvDefCon, XvDefBri, XvDefHue, XvDefSat; - BOOLEAN XvDefDisableGfx, XvDefDisableGfxLR; + BOOLEAN XvDefDisableGfx, XvDefDisableGfxLR, XvDefAdaptorBlit; BOOLEAN XvUseMemcpy; BOOLEAN XvUseChromaKey, XvDisableColorKey; BOOLEAN XvInsideChromaKey, XvYUVChromaKey; int XvChromaMin, XvChromaMax; + int XvGammaRed, XvGammaGreen, XvGammaBlue; + int XvGammaRedDef, XvGammaGreenDef, XvGammaBlueDef; + CARD8 XvGammaRampRed[256], XvGammaRampGreen[256], XvGammaRampBlue[256]; BOOLEAN disablecolorkeycurrent; CARD32 colorKey; CARD32 MiscFlags; - int UsePanelScaler; + int UsePanelScaler, CenterLCD; FBLinearPtr AccelLinearScratch; void (*AccelRenderCallback)(ScrnInfoPtr); float zClearVal; @@ -847,8 +981,13 @@ typedef struct { int GammaPBriR, GammaPBriG, GammaPBriB; Bool HideHWCursor; /* Custom application */ Bool HWCursorIsVisible; + unsigned long HWCursorBackup[16]; + int HWCursorMBufNum, HWCursorCBufNum; + unsigned long mmioSize; + BOOLEAN ROM661New; + BOOLEAN NewCRLayout; #ifdef SISMERGED - Bool MergedFB; + Bool MergedFB, MergedFBAuto; SiSScrn2Rel CRT2Position; char * CRT2HSync; char * CRT2VRefresh; @@ -866,6 +1005,12 @@ typedef struct { int maxCRT1_X1, maxCRT1_X2, maxCRT1_Y1, maxCRT1_Y2; int maxCRT2_X1, maxCRT2_X2, maxCRT2_Y1, maxCRT2_Y2; int maxClone_X1, maxClone_X2, maxClone_Y1, maxClone_Y2; + int MergedFBXDPI, MergedFBYDPI; + IOADDRESS MyPIOOffset; +#ifdef SIS_NEED_MAP_IOP + CARD32 IOPAddress; /* I/O port physical address */ + unsigned char * IOPBase; /* I/O port linear address */ +#endif #ifdef SISXINERAMA Bool UseSiSXinerama; Bool CRT2IsScrn0; @@ -946,7 +1091,7 @@ typedef struct _customttable { unsigned short chipID; char *biosversion; char *biosdate; - unsigned long bioschksum; + CARD32 bioschksum; unsigned short biosFootprintAddr[5]; unsigned char biosFootprintData[5]; unsigned short pcisubsysvendor; @@ -1029,8 +1174,10 @@ extern void SiS_SetTVyposoffset(ScrnInfoPtr pScrn, int val); extern void SiS_SetTVxscale(ScrnInfoPtr pScrn, int val); extern void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val); extern Bool SISSwitchCRT2Type(ScrnInfoPtr pScrn, unsigned long newvbflags); -extern Bool SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned short index, Bool quiet); +extern int SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, + unsigned short index, Bool quiet); extern Bool SISSwitchCRT1Status(ScrnInfoPtr pScrn, int onoff); +extern Bool SISRedetectCRT2Devices(ScrnInfoPtr pScrn); extern int SiS_GetCHTVlumabandwidthcvbs(ScrnInfoPtr pScrn); extern int SiS_GetCHTVlumabandwidthsvideo(ScrnInfoPtr pScrn); extern int SiS_GetCHTVlumaflickerfilter(ScrnInfoPtr pScrn); @@ -1053,3 +1200,6 @@ extern int SiS_GetTVyposoffset(ScrnInfoPtr pScrn); extern int SiS_GetTVxscale(ScrnInfoPtr pScrn); extern int SiS_GetTVyscale(ScrnInfoPtr pScrn); #endif + + + |