diff options
author | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-03-17 20:30:58 +0000 |
---|---|---|
committer | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-03-17 20:30:58 +0000 |
commit | b9efa3c0a76993101e2655bdefc7a8a32f43cb53 (patch) | |
tree | 845c121a2f896d7b98c380990b1abfeac576c0c6 | |
parent | 358bf68d49977ee48bdbc0aabec6a2f827dfbf4c (diff) |
merge with XORG-RELEASE-1 (tag XORG-CYGWIN-LAST-MERGE)CYGWIN-RELEASE-1-MERGE
39 files changed, 9376 insertions, 10039 deletions
diff --git a/README.sgml b/README.sgml index ec5b209..215ffb3 100644 --- a/README.sgml +++ b/README.sgml @@ -167,7 +167,7 @@ XF86Config file for this card. amount of total video RAM available. However, the X driver needs to know about the amount of RAM sisfb reserved. For this purpose, the Option "MaxXFBMem" exists. - XFree 4.3.0 disabled SiS DRI support due to a lack of maintainance of the SiS DRI + XFree 4.3.0 disabled SiS DRI support due to a lack of maintenance of the SiS DRI driver. XFree86 4.4 contains a newly written SiS DRI driver by Eric Anholt. If you intend to use DRI, I recommend setting the total video memory in the BIOS diff --git a/man/sis.man b/man/sis.man index ec4aee8..ae13b1d 100644 --- a/man/sis.man +++ b/man/sis.man @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man,v 1.14 2003/11/12 16:50:36 twini Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man,v 1.5 2001/12/17 20:52:34 dawes Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH SIS __drivermansuffix__ __vendorversion__ diff --git a/src/300vtbl.h b/src/300vtbl.h index 6227235..5c418bd 100644 --- a/src/300vtbl.h +++ b/src/300vtbl.h @@ -1,52 +1,55 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/300vtbl.h,v 1.20 2003/11/19 00:49:02 twini Exp $ */ +/* $XFree86$ */ /* * Register settings for SiS 300 series * - * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria * - * If distributed as part of the linux kernel, the contents of this file - * is entirely covered by the GPL. + * If distributed as part of the Linux kernel, the following license terms + * apply: * - * Otherwise, the following terms apply: + * * This program is free software; you can redistribute it and/or modify + * * it under the terms of the GNU General Public License as published by + * * the Free Software Foundation; either version 2 of the named License, + * * or any later version. + * * + * * This program is distributed in the hope that it will be useful, + * * but WITHOUT ANY WARRANTY; without even the implied warranty of + * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * * GNU General Public License for more details. + * * + * * You should have received a copy of the GNU General Public License + * * along with this program; if not, write to the Free Software + * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * - * 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. + * Otherwise, the following license terms apply: * - * 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. + * * 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. + * * + * * 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. * * Author: Thomas Winischhofer <thomas@winischhofer.net> * - * Based on code by Silicon Intergrated Systems - * */ -typedef struct _SiS300_StStruct -{ - UCHAR St_ModeID; - USHORT St_ModeFlag; - UCHAR St_StTableIndex; - UCHAR St_CRT2CRTC; - UCHAR St_ResInfo; - UCHAR VB_StTVFlickerIndex; - UCHAR VB_StTVEdgeIndex; - UCHAR VB_StTVYFilterIndex; - UCHAR St_PDC; -} SiS300_StStruct; - -static const SiS300_StStruct SiS300_SModeIDTable[] = +static const SiS_StStruct SiS300_SModeIDTable[] = { {0x01,0x9208,0x01,0x00,0x00,0x00,0x00,0x00, 0}, {0x01,0x1210,0x14,0x01,0x01,0x00,0x00,0x00, 0}, @@ -70,206 +73,168 @@ static const SiS300_StStruct SiS300_SModeIDTable[] = {0xff, 0, 0, 0, 0, 0, 0, 0, 0} }; -typedef struct _SiS300_ExtStruct -{ - UCHAR Ext_ModeID; - USHORT Ext_ModeFlag; - UCHAR Ext_ModeOffset; - USHORT Ext_VESAID; - UCHAR Ext_RESINFO; - UCHAR VB_ExtTVFlickerIndex; - UCHAR VB_ExtTVEdgeIndex; - UCHAR VB_ExtTVYFilterIndex; - UCHAR VB_ExtTVYFilterIndexROM661; - UCHAR REFindex; -} SiS300_ExtStruct; - -static const SiS300_ExtStruct SiS300_EModeIDTable[] = -{ - {0x6a,0x2212,0x04,0x0102,SIS_RI_800x600, 0x00,0x00,0x00,0x00,0x00}, /* 800x600x? */ - {0x2e,0x0a1b,0x03,0x0101,SIS_RI_640x480, 0x00,0x00,0x00,0x00,0x08}, - {0x2f,0x021b,0x03,0x0100,SIS_RI_640x400, 0x00,0x00,0x00,0x00,0x10}, /* 640x400x8 */ - {0x30,0x2a1b,0x04,0x0103,SIS_RI_800x600, 0x00,0x00,0x00,0x00,0x00}, - {0x31,0x0a1b,0x0a,0x0000,SIS_RI_720x480, 0x00,0x00,0x00,0x00,0x11}, /* 720x480x8 */ - {0x32,0x2a1b,0x0a,0x0000,SIS_RI_720x576, 0x00,0x00,0x00,0x00,0x12}, /* 720x576x8 */ - {0x33,0x0a1d,0x0a,0x0000,SIS_RI_720x480, 0x00,0x00,0x00,0x00,0x11}, /* 720x480x16 */ - {0x34,0x2a1d,0x0a,0x0000,SIS_RI_720x576, 0x00,0x00,0x00,0x00,0x12}, /* 720x576x16 */ - {0x35,0x0a1f,0x0a,0x0000,SIS_RI_720x480, 0x00,0x00,0x00,0x00,0x11}, /* 720x480x32 */ - {0x36,0x2a1f,0x0a,0x0000,SIS_RI_720x576, 0x00,0x00,0x00,0x00,0x12}, /* 720x576x32 */ - {0x37,0x0212,0x05,0x0104,SIS_RI_1024x768, 0x00,0x00,0x00,0x00,0x13}, /* 1024x768x? */ - {0x38,0x0a1b,0x05,0x0105,SIS_RI_1024x768, 0x00,0x00,0x00,0x00,0x13}, /* 1024x768x8 */ - {0x3a,0x0e3b,0x06,0x0107,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a}, /* 1280x1024x8 */ - {0x3c,0x063b,0x07,0x0130,SIS_RI_1600x1200,0x00,0x00,0x00,0x00,0x1e}, - {0x3d,0x067d,0x07,0x0131,SIS_RI_1600x1200,0x00,0x00,0x00,0x00,0x1e}, - {0x40,0x921c,0x00,0x010d,SIS_RI_320x200, 0x00,0x00,0x00,0x00,0x23}, /* 320x200x15 */ - {0x41,0x921d,0x00,0x010e,SIS_RI_320x200, 0x00,0x00,0x00,0x00,0x23}, /* 320x200x16 */ - {0x43,0x0a1c,0x03,0x0110,SIS_RI_640x480, 0x00,0x00,0x00,0x00,0x08}, - {0x44,0x0a1d,0x03,0x0111,SIS_RI_640x480, 0x00,0x00,0x00,0x00,0x08}, - {0x46,0x2a1c,0x04,0x0113,SIS_RI_800x600, 0x00,0x00,0x00,0x00,0x00}, /* 800x600x15 */ - {0x47,0x2a1d,0x04,0x0114,SIS_RI_800x600, 0x00,0x00,0x00,0x00,0x00}, /* 800x600x16 */ - {0x49,0x0a3c,0x05,0x0116,SIS_RI_1024x768, 0x00,0x00,0x00,0x00,0x13}, - {0x4a,0x0a3d,0x05,0x0117,SIS_RI_1024x768, 0x00,0x00,0x00,0x00,0x13}, - {0x4c,0x0e7c,0x06,0x0119,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a}, - {0x4d,0x0e7d,0x06,0x011a,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a}, - {0x50,0x921b,0x00,0x0132,SIS_RI_320x240, 0x00,0x00,0x00,0x00,0x24}, /* 320x240x8 */ - {0x51,0xb21b,0x01,0x0133,SIS_RI_400x300, 0x00,0x00,0x00,0x00,0x25}, /* 400x300x8 */ - {0x52,0x921b,0x02,0x0134,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x26}, /* 512x384x8 */ - {0x56,0x921d,0x00,0x0135,SIS_RI_320x240, 0x00,0x00,0x00,0x00,0x24}, /* 320x240x16 */ - {0x57,0xb21d,0x01,0x0136,SIS_RI_400x300, 0x00,0x00,0x00,0x00,0x25}, /* 400x300x16 */ - {0x58,0x921d,0x02,0x0137,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x26}, /* 512x384x16 */ - {0x59,0x921b,0x00,0x0138,SIS_RI_320x200, 0x00,0x00,0x00,0x00,0x23}, /* 320x200x8 */ - {0x5c,0x921f,0x02,0x0000,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x26}, /* 512x384x32 */ - {0x5d,0x021d,0x03,0x0139,SIS_RI_640x400, 0x00,0x00,0x00,0x00,0x10}, /* 640x400x16 */ - {0x5e,0x021f,0x03,0x0000,SIS_RI_640x400, 0x00,0x00,0x00,0x00,0x10}, /* 640x400x32 */ - {0x62,0x0a3f,0x03,0x013a,SIS_RI_640x480, 0x00,0x00,0x00,0x00,0x08}, - {0x63,0x2a3f,0x04,0x013b,SIS_RI_800x600, 0x00,0x00,0x00,0x00,0x00}, /* 800x600x32 */ - {0x64,0x0a7f,0x05,0x013c,SIS_RI_1024x768, 0x00,0x00,0x00,0x00,0x13}, - {0x65,0x0eff,0x06,0x013d,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a}, - {0x66,0x06ff,0x07,0x013e,SIS_RI_1600x1200,0x00,0x00,0x00,0x00,0x1e}, - {0x68,0x067b,0x08,0x013f,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x27}, - {0x69,0x06fd,0x08,0x0140,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x27}, - {0x6b,0x07ff,0x08,0x0000,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x27}, - {0x6c,0x067b,0x09,0x0000,SIS_RI_2048x1536,0x00,0x00,0x00,0x00,0x28}, /* 2048x1536x8 - not in BIOS! */ - {0x6d,0x06fd,0x09,0x0000,SIS_RI_2048x1536,0x00,0x00,0x00,0x00,0x28}, /* 2048x1536x16 - not in BIOS! */ - {0x70,0x2a1b,0x04,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x00,0x2d}, /* 800x480x8 */ - {0x71,0x0a1b,0x05,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x30}, /* 1024x576x8 */ - {0x74,0x0a1d,0x05,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x30}, /* 1024x576x16 */ - {0x75,0x0e3d,0x06,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x33}, /* 1280x720x16 */ - {0x76,0x2a1f,0x04,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x00,0x2d}, /* 800x480x32 */ - {0x77,0x0a3f,0x05,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x30}, /* 1024x576x32 */ - {0x78,0x0eff,0x06,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x33}, /* 1280x720x32 */ - {0x79,0x0e3b,0x06,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x33}, /* 1280x720x8 */ - {0x7a,0x2a1d,0x04,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x00,0x2d}, /* 800x480x16 */ - {0x7c,0x0a3b,0x06,0x0000,SIS_RI_1280x960, 0x00,0x00,0x00,0x00,0x29}, /* 1280x960x8 */ - {0x7d,0x0a7d,0x06,0x0000,SIS_RI_1280x960, 0x00,0x00,0x00,0x00,0x29}, /* 1280x960x16 */ - {0x7e,0x0aff,0x06,0x0000,SIS_RI_1280x960, 0x00,0x00,0x00,0x00,0x29}, /* 1280x960x32 */ - {0x20,0x0a1b,0x05,0x0000,SIS_RI_1024x600, 0x00,0x00,0x00,0x00,0x2b}, /* 1024x600 */ - {0x21,0x0a3d,0x05,0x0000,SIS_RI_1024x600, 0x00,0x00,0x00,0x00,0x2b}, - {0x22,0x0a7f,0x05,0x0000,SIS_RI_1024x600, 0x00,0x00,0x00,0x00,0x2b}, - {0x23,0x0a1b,0x0c,0x0000,SIS_RI_1152x768, 0x00,0x00,0x00,0x00,0x2c}, /* 1152x768 */ - {0x24,0x0a3d,0x0c,0x0000,SIS_RI_1152x768, 0x00,0x00,0x00,0x00,0x2c}, - {0x25,0x0a7f,0x0c,0x0000,SIS_RI_1152x768, 0x00,0x00,0x00,0x00,0x2c}, - {0x29,0x0e1b,0x0c,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x36}, /* 1152x864 */ - {0x2a,0x0e3d,0x0c,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x36}, - {0x2b,0x0e7f,0x0c,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x36}, - {0x39,0x2a1b,0x0d,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x38}, /* 848x480 */ - {0x3b,0x2a3d,0x0d,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x38}, - {0x3e,0x2a7f,0x0d,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x38}, - {0x3f,0x2a1b,0x0d,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x3a}, /* 856x480 */ - {0x42,0x2a3d,0x0d,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x3a}, - {0x45,0x2a7f,0x0d,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x3a}, - {0x48,0x223b,0x0e,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x3c}, /* 1360x768 */ - {0x4b,0x227d,0x0e,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x3c}, - {0x4e,0x22ff,0x0e,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x3c}, - {0x4f,0x921f,0x00,0x0000,SIS_RI_320x200, 0x00,0x00,0x00,0x00,0x23}, /* 320x200x32 */ - {0x53,0x921f,0x00,0x0000,SIS_RI_320x240, 0x00,0x00,0x00,0x00,0x24}, /* 320x240x32 */ - {0x54,0xb21f,0x01,0x0000,SIS_RI_400x300, 0x00,0x00,0x00,0x00,0x25}, /* 400x300x32 */ - {0x55,0x2e3b,0x06,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x3d}, /* 1280x768 */ - {0x5a,0x2e7d,0x06,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x3d}, - {0x5b,0x2eff,0x06,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x3d}, - {0x5f,0x2a1b,0x0f,0x0000,SIS_RI_768x576, 0x00,0x00,0x00,0x00,0x3e}, /* 768x576x8 */ - {0x60,0x2a1d,0x0f,0x0000,SIS_RI_768x576, 0x00,0x00,0x00,0x00,0x3e}, /* 768x576x16 */ - {0x61,0x2a1f,0x0f,0x0000,SIS_RI_768x576, 0x00,0x00,0x00,0x00,0x3e}, /* 768x576x32 */ - {0x67,0x2e3b,0x0e,0x0000,SIS_RI_1360x1024,0x00,0x00,0x00,0x00,0x3f}, /* 1360x1024x8 (BARCO) */ - {0x6f,0x2e7d,0x0e,0x0000,SIS_RI_1360x1024,0x00,0x00,0x00,0x00,0x3f}, /* 1360x1024x16 (BARCO) */ - {0x72,0x2eff,0x0e,0x0000,SIS_RI_1360x1024,0x00,0x00,0x00,0x00,0x3f}, /* 1360x1024x32 (BARCO) */ - {0xff,0x0000,0x00,0xffff,0, 0x00,0x00,0x00,0x00,0x00} -}; - -typedef struct _SiS300_Ext2Struct -{ - USHORT Ext_InfoFlag; - UCHAR Ext_CRT1CRTC; /* Index in SiS300_CRT1Table */ - UCHAR Ext_CRTVCLK; /* Index in VCLK array */ - UCHAR Ext_CRT2CRTC; /* Index in LCD Paneltype arrays (&3f) */ - UCHAR ModeID; - USHORT XRes; - USHORT YRes; - UCHAR Ext_PDC; -} SiS300_Ext2Struct; - -static const SiS300_Ext2Struct SiS300_RefIndex[] = +static const SiS_ExtStruct SiS300_EModeIDTable[] = +{ + {0x6a,0x2212,0x0102,SIS_RI_800x600, 0x00,0x00,0x00,0x00,0x00}, /* 800x600x? */ + {0x2e,0x0a1b,0x0101,SIS_RI_640x480, 0x00,0x00,0x00,0x00,0x08}, + {0x2f,0x021b,0x0100,SIS_RI_640x400, 0x00,0x00,0x00,0x00,0x10}, /* 640x400x8 */ + {0x30,0x2a1b,0x0103,SIS_RI_800x600, 0x00,0x00,0x00,0x00,0x00}, + {0x31,0x0a1b,0x0000,SIS_RI_720x480, 0x00,0x00,0x00,0x00,0x11}, /* 720x480x8 */ + {0x32,0x2a1b,0x0000,SIS_RI_720x576, 0x00,0x00,0x00,0x00,0x12}, /* 720x576x8 */ + {0x33,0x0a1d,0x0000,SIS_RI_720x480, 0x00,0x00,0x00,0x00,0x11}, /* 720x480x16 */ + {0x34,0x2a1d,0x0000,SIS_RI_720x576, 0x00,0x00,0x00,0x00,0x12}, /* 720x576x16 */ + {0x35,0x0a1f,0x0000,SIS_RI_720x480, 0x00,0x00,0x00,0x00,0x11}, /* 720x480x32 */ + {0x36,0x2a1f,0x0000,SIS_RI_720x576, 0x00,0x00,0x00,0x00,0x12}, /* 720x576x32 */ + {0x37,0x0212,0x0104,SIS_RI_1024x768, 0x00,0x00,0x00,0x00,0x13}, /* 1024x768x? */ + {0x38,0x0a1b,0x0105,SIS_RI_1024x768, 0x00,0x00,0x00,0x00,0x13}, /* 1024x768x8 */ + {0x3a,0x0e3b,0x0107,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a}, /* 1280x1024x8 */ + {0x3c,0x063b,0x0130,SIS_RI_1600x1200,0x00,0x00,0x00,0x00,0x1e}, + {0x3d,0x067d,0x0131,SIS_RI_1600x1200,0x00,0x00,0x00,0x00,0x1e}, + {0x40,0x921c,0x010d,SIS_RI_320x200, 0x00,0x00,0x00,0x00,0x23}, /* 320x200x15 */ + {0x41,0x921d,0x010e,SIS_RI_320x200, 0x00,0x00,0x00,0x00,0x23}, /* 320x200x16 */ + {0x43,0x0a1c,0x0110,SIS_RI_640x480, 0x00,0x00,0x00,0x00,0x08}, + {0x44,0x0a1d,0x0111,SIS_RI_640x480, 0x00,0x00,0x00,0x00,0x08}, + {0x46,0x2a1c,0x0113,SIS_RI_800x600, 0x00,0x00,0x00,0x00,0x00}, /* 800x600x15 */ + {0x47,0x2a1d,0x0114,SIS_RI_800x600, 0x00,0x00,0x00,0x00,0x00}, /* 800x600x16 */ + {0x49,0x0a3c,0x0116,SIS_RI_1024x768, 0x00,0x00,0x00,0x00,0x13}, + {0x4a,0x0a3d,0x0117,SIS_RI_1024x768, 0x00,0x00,0x00,0x00,0x13}, + {0x4c,0x0e7c,0x0119,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a}, + {0x4d,0x0e7d,0x011a,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a}, + {0x50,0x921b,0x0132,SIS_RI_320x240, 0x00,0x00,0x00,0x00,0x24}, /* 320x240x8 */ + {0x51,0xb21b,0x0133,SIS_RI_400x300, 0x00,0x00,0x00,0x00,0x25}, /* 400x300x8 */ + {0x52,0x921b,0x0134,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x26}, /* 512x384x8 */ + {0x56,0x921d,0x0135,SIS_RI_320x240, 0x00,0x00,0x00,0x00,0x24}, /* 320x240x16 */ + {0x57,0xb21d,0x0136,SIS_RI_400x300, 0x00,0x00,0x00,0x00,0x25}, /* 400x300x16 */ + {0x58,0x921d,0x0137,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x26}, /* 512x384x16 */ + {0x59,0x921b,0x0138,SIS_RI_320x200, 0x00,0x00,0x00,0x00,0x23}, /* 320x200x8 */ + {0x5c,0x921f,0x0000,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x26}, /* 512x384x32 */ + {0x5d,0x021d,0x0139,SIS_RI_640x400, 0x00,0x00,0x00,0x00,0x10}, /* 640x400x16 */ + {0x5e,0x021f,0x0000,SIS_RI_640x400, 0x00,0x00,0x00,0x00,0x10}, /* 640x400x32 */ + {0x62,0x0a3f,0x013a,SIS_RI_640x480, 0x00,0x00,0x00,0x00,0x08}, + {0x63,0x2a3f,0x013b,SIS_RI_800x600, 0x00,0x00,0x00,0x00,0x00}, /* 800x600x32 */ + {0x64,0x0a7f,0x013c,SIS_RI_1024x768, 0x00,0x00,0x00,0x00,0x13}, + {0x65,0x0eff,0x013d,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a}, + {0x66,0x06ff,0x013e,SIS_RI_1600x1200,0x00,0x00,0x00,0x00,0x1e}, + {0x68,0x067b,0x013f,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x27}, + {0x69,0x06fd,0x0140,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x27}, + {0x6b,0x07ff,0x0000,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x27}, + {0x6c,0x067b,0x0000,SIS_RI_2048x1536,0x00,0x00,0x00,0x00,0x28}, /* 2048x1536x8 - not in BIOS! */ + {0x6d,0x06fd,0x0000,SIS_RI_2048x1536,0x00,0x00,0x00,0x00,0x28}, /* 2048x1536x16 - not in BIOS! */ + {0x70,0x2a1b,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x00,0x2d}, /* 800x480x8 */ + {0x71,0x0a1b,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x30}, /* 1024x576x8 */ + {0x74,0x0a1d,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x30}, /* 1024x576x16 */ + {0x75,0x0e3d,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x33}, /* 1280x720x16 */ + {0x76,0x2a1f,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x00,0x2d}, /* 800x480x32 */ + {0x77,0x0a3f,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x30}, /* 1024x576x32 */ + {0x78,0x0eff,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x33}, /* 1280x720x32 */ + {0x79,0x0e3b,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x33}, /* 1280x720x8 */ + {0x7a,0x2a1d,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x00,0x2d}, /* 800x480x16 */ + {0x7c,0x0a3b,0x0000,SIS_RI_1280x960, 0x00,0x00,0x00,0x00,0x29}, /* 1280x960x8 */ + {0x7d,0x0a7d,0x0000,SIS_RI_1280x960, 0x00,0x00,0x00,0x00,0x29}, /* 1280x960x16 */ + {0x7e,0x0aff,0x0000,SIS_RI_1280x960, 0x00,0x00,0x00,0x00,0x29}, /* 1280x960x32 */ + {0x20,0x0a1b,0x0000,SIS_RI_1024x600, 0x00,0x00,0x00,0x00,0x2b}, /* 1024x600 */ + {0x21,0x0a3d,0x0000,SIS_RI_1024x600, 0x00,0x00,0x00,0x00,0x2b}, + {0x22,0x0a7f,0x0000,SIS_RI_1024x600, 0x00,0x00,0x00,0x00,0x2b}, + {0x23,0x0a1b,0x0000,SIS_RI_1152x768, 0x00,0x00,0x00,0x00,0x2c}, /* 1152x768 */ + {0x24,0x0a3d,0x0000,SIS_RI_1152x768, 0x00,0x00,0x00,0x00,0x2c}, + {0x25,0x0a7f,0x0000,SIS_RI_1152x768, 0x00,0x00,0x00,0x00,0x2c}, + {0x29,0x0e1b,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x36}, /* 1152x864 */ + {0x2a,0x0e3d,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x36}, + {0x2b,0x0e7f,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x36}, + {0x39,0x2a1b,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x38}, /* 848x480 */ + {0x3b,0x2a3d,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x38}, + {0x3e,0x2a7f,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x38}, + {0x3f,0x2a1b,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x3a}, /* 856x480 */ + {0x42,0x2a3d,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x3a}, + {0x45,0x2a7f,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x3a}, + {0x48,0x223b,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x3c}, /* 1360x768 */ + {0x4b,0x227d,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x3c}, + {0x4e,0x22ff,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x3c}, + {0x4f,0x921f,0x0000,SIS_RI_320x200, 0x00,0x00,0x00,0x00,0x23}, /* 320x200x32 */ + {0x53,0x921f,0x0000,SIS_RI_320x240, 0x00,0x00,0x00,0x00,0x24}, /* 320x240x32 */ + {0x54,0xb21f,0x0000,SIS_RI_400x300, 0x00,0x00,0x00,0x00,0x25}, /* 400x300x32 */ + {0x55,0x2e3b,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x3d}, /* 1280x768 */ + {0x5a,0x2e7d,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x3d}, + {0x5b,0x2eff,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x3d}, + {0x5f,0x2a1b,0x0000,SIS_RI_768x576, 0x00,0x00,0x00,0x00,0x3e}, /* 768x576x8 */ + {0x60,0x2a1d,0x0000,SIS_RI_768x576, 0x00,0x00,0x00,0x00,0x3e}, /* 768x576x16 */ + {0x61,0x2a1f,0x0000,SIS_RI_768x576, 0x00,0x00,0x00,0x00,0x3e}, /* 768x576x32 */ + {0x67,0x2e3b,0x0000,SIS_RI_1360x1024,0x00,0x00,0x00,0x00,0x3f}, /* 1360x1024x8 (BARCO) */ + {0x6f,0x2e7d,0x0000,SIS_RI_1360x1024,0x00,0x00,0x00,0x00,0x3f}, /* 1360x1024x16 (BARCO) */ + {0x72,0x2eff,0x0000,SIS_RI_1360x1024,0x00,0x00,0x00,0x00,0x3f}, /* 1360x1024x32 (BARCO) */ + {0xff,0x0000,0xffff,0, 0x00,0x00,0x00,0x00,0x00} +}; + +static const SiS_Ext2Struct SiS300_RefIndex[] = { - {0x085f,0x0d,0x03,0x05,0x6a, 800, 600, 0}, /* 00 */ - {0x0467,0x0e,0x44,0x05,0x6a, 800, 600, 0}, /* 01 */ - {0x0067,0x0f,0x07,0x48,0x6a, 800, 600, 0}, /* 02 - CRT1CRTC was 0x4f */ - {0x0067,0x10,0x06,0x8b,0x6a, 800, 600, 0}, /* 03 */ - {0x0147,0x11,0x08,0x00,0x6a, 800, 600, 0}, /* 04 */ - {0x0147,0x12,0x0c,0x00,0x6a, 800, 600, 0}, /* 05 */ - {0x0047,0x11,0x4e,0x00,0x6a, 800, 600, 0}, /* 06 - CRT1CRTC was 0x51 */ - {0x0047,0x11,0x13,0x00,0x6a, 800, 600, 0}, /* 07 */ - {0xc85f,0x05,0x00,0x04,0x2e, 640, 480, 0}, /* 08 */ - {0xc067,0x06,0x02,0x04,0x2e, 640, 480, 0}, /* 09 */ - {0xc067,0x07,0x02,0x47,0x2e, 640, 480, 0}, /* 0a */ - {0xc067,0x08,0x03,0x8a,0x2e, 640, 480, 0}, /* 0b */ - {0xc047,0x09,0x05,0x00,0x2e, 640, 480, 0}, /* 0c */ - {0xc047,0x0a,0x08,0x00,0x2e, 640, 480, 0}, /* 0d */ - {0xc047,0x0b,0x0a,0x00,0x2e, 640, 480, 0}, /* 0e */ - {0xc047,0x0c,0x10,0x00,0x2e, 640, 480, 0}, /* 0f */ - {0x487f,0x04,0x00,0x00,0x2f, 640, 400, 0}, /* 10 */ - {0xc04f,0x31,0x01,0x06,0x31, 720, 480, 0}, /* 11 */ - {0x004f,0x32,0x03,0x06,0x32, 720, 576, 0}, /* 12 */ - {0x0187,0x15,0x05,0x00,0x37,1024, 768, 0}, /* 13 */ - {0xc877,0x16,0x09,0x06,0x37,1024, 768, 0}, /* 14 */ - {0xc067,0x17,0x0b,0x49,0x37,1024, 768, 0}, /* 15 - CRT1CRTC was 0x97 */ - {0x0267,0x18,0x0d,0x00,0x37,1024, 768, 0}, /* 16 */ - {0x0047,0x19,0x11,0x8c,0x37,1024, 768, 0}, /* 17 - CRT1CRTC was 0x59 */ - {0x0047,0x1a,0x52,0x00,0x37,1024, 768, 0}, /* 18 */ - {0x0007,0x1b,0x16,0x00,0x37,1024, 768, 0}, /* 19 - CRT1CRTC was 0x5b */ - {0x0387,0x1c,0x4d,0x00,0x3a,1280,1024, 0}, /* 1a - CRT1CRTC was 0x5c */ - {0x0077,0x1d,0x14,0x07,0x3a,1280,1024, 0}, /* 1b */ - {0x0047,0x1e,0x17,0x00,0x3a,1280,1024, 0}, /* 1c */ - {0x0007,0x1f,0x98,0x00,0x3a,1280,1024, 0}, /* 1d */ - {0x0007,0x20,0x59,0x00,0x3c,1600,1200, 0}, /* 1e - CRT1CRTC was 0x60 */ - {0x0007,0x21,0x5a,0x00,0x3c,1600,1200, 0}, /* 1f */ - {0x0007,0x22,0x1b,0x00,0x3c,1600,1200, 0}, /* 20 */ - {0x0007,0x23,0x1d,0x00,0x3c,1600,1200, 0}, /* 21 - CRT1CRTC was 0x63 */ - {0x0007,0x24,0x1e,0x00,0x3c,1600,1200, 0}, /* 22 */ - {0x407f,0x00,0x00,0x00,0x40, 320, 200, 0}, /* 23 */ - {0xc07f,0x01,0x00,0x04,0x50, 320, 240, 0}, /* 24 */ - {0x0077,0x02,0x04,0x05,0x51, 400, 300, 0}, /* 25 */ - {0xc877,0x03,0x09,0x06,0x52, 512, 384, 0}, /* 26 */ /* was c077 */ - {0x8207,0x25,0x1f,0x00,0x68,1920,1440, 0}, /* 27 */ - {0x0007,0x26,0x20,0x00,0x6c,2048,1536, 0}, /* 28 */ - {0x0067,0x27,0x14,0x08,0x6e,1280, 960, 0}, /* 29 - TW: 1280x960-60 */ - {0x0027,0x45,0x3c,0x08,0x6e,1280, 960, 0}, /* 2a - TW: 1280x960-85 */ - {0xc077,0x33,0x09,0x06,0x20,1024, 600, 0}, /* 2b */ - {0xc077,0x34,0x0b,0x06,0x23,1152, 768, 0}, /* 2c */ /* VCLK 0x09 */ - {0x0057,0x35,0x27,0x08,0x70, 800, 480, 0}, /* 2d */ - {0x0047,0x36,0x37,0x08,0x70, 800, 480, 0}, /* 2e */ - {0x0047,0x37,0x08,0x08,0x70, 800, 480, 0}, /* 2f */ - {0x0057,0x38,0x09,0x09,0x71,1024, 576, 0}, /* 30 */ - {0x0047,0x39,0x38,0x09,0x71,1024, 576, 0}, /* 31 */ - {0x0047,0x3a,0x11,0x09,0x71,1024, 576, 0}, /* 32 */ - {0x0057,0x3b,0x39,0x0a,0x75,1280, 720, 0}, /* 33 */ - {0x0047,0x3c,0x3a,0x0a,0x75,1280, 720, 0}, /* 34 */ - {0x0007,0x3d,0x3b,0x0a,0x75,1280, 720, 0}, /* 35 */ - {0x0047,0x3e,0x34,0x06,0x29,1152, 864, 0}, /* 36 1152x864-75Hz */ - {0x0047,0x44,0x3a,0x06,0x29,1152, 864, 0}, /* 37 1152x864-85Hz */ - {0x00c7,0x3f,0x28,0x00,0x39, 848, 480, 0}, /* 38 848x480-38Hzi */ - {0xc067,0x40,0x3d,0x0b,0x39, 848, 480, 0}, /* 39 848x480-60Hz */ - {0x00c7,0x41,0x28,0x00,0x3f, 856, 480, 0}, /* 3a 856x480-38Hzi */ - {0xc047,0x42,0x28,0x00,0x3f, 856, 480, 0}, /* 3b 856x480-60Hz */ - {0x0067,0x43,0x3e,0x0c,0x48,1360, 768, 0}, /* 3c 1360x768-60Hz */ - {0x0077,0x46,0x3f,0x08,0x55,1280, 768, 0}, /* 3d 1280x768-60Hz */ - {0x004f,0x47,0x03,0x06,0x5f, 768, 576, 0}, /* 3e 768x576 */ - {0x0027,0x48,0x13,0x08,0x67,1360,1024, 0}, /* 3f 1360x1024-59Hz (BARCO1366 only) */ - {0xffff, 0, 0, 0, 0, 0, 0, 0} -}; - -typedef struct _SiS_VBModeIDTableStruct -{ - UCHAR ModeID; - UCHAR VB_TVDelayIndex; - UCHAR VB_TVFlickerIndex; - UCHAR VB_TVPhaseIndex; - UCHAR VB_TVYFilterIndex; - UCHAR VB_LCDDelayIndex; - UCHAR _VB_LCDHIndex; - UCHAR _VB_LCDVIndex; -}SiS_VBModeIDTableStruct; - -static const SiS_VBModeIDTableStruct SiS300_VBModeIDTable[] = + {0x085f,0x0d,0x03,0x05,0x05,0x6a, 800, 600, 0}, /* 00 */ + {0x0467,0x0e,0x44,0x05,0x05,0x6a, 800, 600, 0}, /* 01 */ + {0x0067,0x0f,0x07,0x48,0x00,0x6a, 800, 600, 0}, /* 02 - CRT1CRTC was 0x4f */ + {0x0067,0x10,0x06,0x8b,0x00,0x6a, 800, 600, 0}, /* 03 */ + {0x0147,0x11,0x08,0x00,0x00,0x6a, 800, 600, 0}, /* 04 */ + {0x0147,0x12,0x0c,0x00,0x00,0x6a, 800, 600, 0}, /* 05 */ + {0x0047,0x11,0x4e,0x00,0x00,0x6a, 800, 600, 0}, /* 06 - CRT1CRTC was 0x51 */ + {0x0047,0x11,0x13,0x00,0x00,0x6a, 800, 600, 0}, /* 07 */ + {0xc85f,0x05,0x00,0x04,0x04,0x2e, 640, 480, 0}, /* 08 */ + {0xc067,0x06,0x02,0x04,0x04,0x2e, 640, 480, 0}, /* 09 */ + {0xc067,0x07,0x02,0x47,0x04,0x2e, 640, 480, 0}, /* 0a */ + {0xc067,0x08,0x03,0x8a,0x04,0x2e, 640, 480, 0}, /* 0b */ + {0xc047,0x09,0x05,0x00,0x00,0x2e, 640, 480, 0}, /* 0c */ + {0xc047,0x0a,0x08,0x00,0x00,0x2e, 640, 480, 0}, /* 0d */ + {0xc047,0x0b,0x0a,0x00,0x00,0x2e, 640, 480, 0}, /* 0e */ + {0xc047,0x0c,0x10,0x00,0x00,0x2e, 640, 480, 0}, /* 0f */ + {0x487f,0x04,0x00,0x00,0x00,0x2f, 640, 400, 0}, /* 10 */ + {0xc04f,0x31,0x01,0x06,0x00,0x31, 720, 480, 0}, /* 11 */ + {0x004f,0x32,0x03,0x06,0x00,0x32, 720, 576, 0}, /* 12 */ + {0x0187,0x15,0x05,0x00,0x00,0x37,1024, 768, 0}, /* 13 */ + {0xc877,0x16,0x09,0x06,0x06,0x37,1024, 768, 0}, /* 14 */ + {0xc067,0x17,0x0b,0x49,0x06,0x37,1024, 768, 0}, /* 15 - CRT1CRTC was 0x97 */ + {0x0267,0x18,0x0d,0x00,0x06,0x37,1024, 768, 0}, /* 16 */ + {0x0047,0x19,0x11,0x8c,0x00,0x37,1024, 768, 0}, /* 17 - CRT1CRTC was 0x59 */ + {0x0047,0x1a,0x52,0x00,0x00,0x37,1024, 768, 0}, /* 18 */ + {0x0007,0x1b,0x16,0x00,0x00,0x37,1024, 768, 0}, /* 19 - CRT1CRTC was 0x5b */ + {0x0387,0x1c,0x4d,0x00,0x00,0x3a,1280,1024, 0}, /* 1a - CRT1CRTC was 0x5c */ + {0x0077,0x1d,0x14,0x07,0x00,0x3a,1280,1024, 0}, /* 1b */ + {0x0047,0x1e,0x17,0x00,0x00,0x3a,1280,1024, 0}, /* 1c */ + {0x0007,0x1f,0x98,0x00,0x00,0x3a,1280,1024, 0}, /* 1d */ + {0x0007,0x20,0x59,0x00,0x00,0x3c,1600,1200, 0}, /* 1e - CRT1CRTC was 0x60 */ + {0x0007,0x21,0x5a,0x00,0x00,0x3c,1600,1200, 0}, /* 1f */ + {0x0007,0x22,0x1b,0x00,0x00,0x3c,1600,1200, 0}, /* 20 */ + {0x0007,0x23,0x1d,0x00,0x00,0x3c,1600,1200, 0}, /* 21 - CRT1CRTC was 0x63 */ + {0x0007,0x24,0x1e,0x00,0x00,0x3c,1600,1200, 0}, /* 22 */ + {0x407f,0x00,0x00,0x00,0x00,0x40, 320, 200, 0}, /* 23 */ + {0xc07f,0x01,0x00,0x04,0x04,0x50, 320, 240, 0}, /* 24 */ + {0x0077,0x02,0x04,0x05,0x05,0x51, 400, 300, 0}, /* 25 */ + {0xc877,0x03,0x09,0x06,0x06,0x52, 512, 384, 0}, /* 26 */ /* was c077 */ + {0x8207,0x25,0x1f,0x00,0x00,0x68,1920,1440, 0}, /* 27 */ + {0x0007,0x26,0x20,0x00,0x00,0x6c,2048,1536, 0}, /* 28 */ + {0x0067,0x27,0x14,0x08,0x0a,0x6e,1280, 960, 0}, /* 29 - 1280x960-60 */ + {0x0027,0x45,0x3c,0x08,0x0a,0x6e,1280, 960, 0}, /* 2a - 1280x960-85 */ + {0xc077,0x33,0x09,0x06,0x00,0x20,1024, 600, 0}, /* 2b */ + {0xc077,0x34,0x0b,0x06,0x00,0x23,1152, 768, 0}, /* 2c */ /* VCLK 0x09 */ + {0x0057,0x35,0x27,0x08,0x00,0x70, 800, 480, 0}, /* 2d */ + {0x0047,0x36,0x37,0x08,0x00,0x70, 800, 480, 0}, /* 2e */ + {0x0047,0x37,0x08,0x08,0x00,0x70, 800, 480, 0}, /* 2f */ + {0x0057,0x38,0x09,0x09,0x00,0x71,1024, 576, 0}, /* 30 */ + {0x0047,0x39,0x38,0x09,0x00,0x71,1024, 576, 0}, /* 31 */ + {0x0047,0x3a,0x11,0x09,0x00,0x71,1024, 576, 0}, /* 32 */ + {0x0057,0x3b,0x39,0x0a,0x00,0x75,1280, 720, 0}, /* 33 */ + {0x0047,0x3c,0x3a,0x0a,0x00,0x75,1280, 720, 0}, /* 34 */ + {0x0007,0x3d,0x3b,0x0a,0x00,0x75,1280, 720, 0}, /* 35 */ + {0x0047,0x3e,0x34,0x06,0x00,0x29,1152, 864, 0}, /* 36 1152x864-75Hz */ + {0x0047,0x44,0x3a,0x06,0x00,0x29,1152, 864, 0}, /* 37 1152x864-85Hz */ + {0x00c7,0x3f,0x28,0x00,0x00,0x39, 848, 480, 0}, /* 38 848x480-38Hzi */ + {0xc067,0x40,0x3d,0x0b,0x0b,0x39, 848, 480, 0}, /* 39 848x480-60Hz */ + {0x00c7,0x41,0x28,0x00,0x00,0x3f, 856, 480, 0}, /* 3a 856x480-38Hzi */ + {0xc047,0x42,0x28,0x00,0x00,0x3f, 856, 480, 0}, /* 3b 856x480-60Hz */ + {0x0067,0x43,0x3e,0x0c,0x0b,0x48,1360, 768, 0}, /* 3c 1360x768-60Hz */ + {0x0077,0x46,0x3f,0x08,0x00,0x55,1280, 768, 0}, /* 3d 1280x768-60Hz */ + {0x004f,0x47,0x03,0x06,0x00,0x5f, 768, 576, 0}, /* 3e 768x576 */ + {0x0027,0x48,0x13,0x08,0x08,0x67,1360,1024, 0}, /* 3f 1360x1024-59Hz (BARCO1366 only) */ + {0xffff, 0, 0, 0, 0, 0, 0, 0, 0} +}; + +static const SiS_VBModeStruct SiS300_VBModeIDTable[] = { {0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, {0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01}, @@ -336,12 +301,7 @@ static const SiS_VBModeIDTableStruct SiS300_VBModeIDTable[] = {0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00} }; -typedef struct _SiS300_CRT1TableStruct -{ - UCHAR CR[17]; -} SiS300_CRT1TableStruct; - -static const SiS300_CRT1TableStruct SiS300_CRT1Table[] = +static const SiS_CRT1TableStruct SiS300_CRT1Table[] = { #if 1 {{0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, /* 0x00 - 320x200 */ @@ -606,13 +566,7 @@ static const SiS300_CRT1TableStruct SiS300_CRT1Table[] = 0x00}} /* 0x48 */ }; -typedef struct _SiS300_MCLKDataStruct -{ - UCHAR SR28,SR29,SR2A; - USHORT CLOCK; -} SiS300_MCLKDataStruct; - -static const SiS300_MCLKDataStruct SiS300_MCLKData_630[] = +static const SiS_MCLKDataStruct SiS300_MCLKData_630[] = { { 0x5a,0x64,0x80, 66}, { 0xb3,0x45,0x80, 83}, @@ -624,7 +578,7 @@ static const SiS300_MCLKDataStruct SiS300_MCLKData_630[] = { 0x37,0x61,0x80,100} }; -static const SiS300_MCLKDataStruct SiS300_MCLKData_300[] = +static const SiS_MCLKDataStruct SiS300_MCLKData_300[] = { { 0x68,0x43,0x80,125}, { 0x68,0x43,0x80,125}, @@ -636,13 +590,7 @@ static const SiS300_MCLKDataStruct SiS300_MCLKData_300[] = { 0x37,0x61,0x80,100} }; -typedef struct _SiS300_VCLKDataStruct -{ - UCHAR SR2B,SR2C; - USHORT CLOCK; -} SiS300_VCLKDataStruct; - -static const SiS300_VCLKDataStruct SiS300_VCLKData[] = +static SiS_VCLKDataStruct SiS300_VCLKData[] = { { 0x1b,0xe1, 25}, /* 0x00 */ { 0x4e,0xe4, 28}, /* 0x01 */ @@ -717,14 +665,7 @@ static const SiS300_VCLKDataStruct SiS300_VCLKData[] = { 0x37,0x61,100}, /* 0x43 */ /* 1280x960 LCD */ { 0xe3,0x9a,106}, /* 0x44 */ /* 1360x1024 - special for Barco iQ R300 */ { 0xe2,0x46,135}, /* 0x45 */ /* 1280x1024-75, better clock for VGA2 */ - { 0xff,0x00, 0} -}; - -static const UCHAR SiS300_ScreenOffset[] = -{ - 0x14,0x19,0x20,0x28,0x32,0x40,0x50, - 0x64,0x78,0x80,0x2d,0x35,0x48,0x35, - 0x55,0x30,0xff + { 0, 0, 0} /* 0x46 custom (will be filled out) */ }; #ifndef LINUX_XF86 @@ -770,12 +711,7 @@ static const DRAM4Type SiS300_CR40[5]; static UCHAR SiS300_CR49[2]; #endif -typedef struct _SiS300_PanelDelayTblStruct -{ - UCHAR timer[2]; -} SiS300_PanelDelayTblStruct; - -static const SiS300_PanelDelayTblStruct SiS300_PanelDelayTbl[] = +static const SiS_PanelDelayTblStruct SiS300_PanelDelayTbl[] = { {{0x05,0xaa}}, {{0x05,0x14}}, @@ -796,7 +732,7 @@ static const SiS300_PanelDelayTblStruct SiS300_PanelDelayTbl[] = }; #if 0 -static const SiS300_PanelDelayTblStruct SiS300_PanelDelayTblLVDS[] = +static const SiS_PanelDelayTblStruct SiS300_PanelDelayTblLVDS[] = { {{0x05,0xaa}}, {{0x05,0x14}}, @@ -821,28 +757,18 @@ static const SiS300_PanelDelayTblStruct SiS300_PanelDelayTblLVDS[] = /* SIS VIDEO BRIDGE ----------------------------------------- */ /**************************************************************/ -typedef struct _SiS300_LCDDataStruct -{ - USHORT RVBHCMAX; - USHORT RVBHCFACT; - USHORT VGAHT; - USHORT VGAVT; - USHORT LCDHT; - USHORT LCDVT; -} SiS300_LCDDataStruct; - -static const SiS300_LCDDataStruct SiS300_StLCD1024x768Data[] = +static const SiS_LCDDataStruct SiS300_St2LCD1024x768Data[] = { - { 66, 31, 992, 510,1320, 816}, - { 66, 31, 992, 510,1320, 816}, - { 176, 75, 900, 510,1320, 816}, - { 176, 75, 900, 510,1320, 816}, - { 66, 31, 992, 510,1320, 816}, - { 27, 16,1024, 650,1350, 832}, + { 62, 25, 800, 546,1344, 806}, + { 32, 15, 930, 546,1344, 806}, + { 32, 15, 930, 546,1344, 806}, + { 104, 45, 945, 496,1344, 806}, + { 62, 25, 800, 546,1344, 806}, + { 31, 18,1008, 624,1344, 806}, { 1, 1,1344, 806,1344, 806} }; -static const SiS300_LCDDataStruct SiS300_ExtLCD1024x768Data[] = +static const SiS_LCDDataStruct SiS300_ExtLCD1024x768Data[] = { { 12, 5, 896, 512,1344, 806}, { 12, 5, 896, 510,1344, 806}, @@ -859,30 +785,19 @@ static const SiS300_LCDDataStruct SiS300_ExtLCD1024x768Data[] = { 1, 1,1344, 806,1344, 806} }; -static const SiS300_LCDDataStruct SiS300_St2LCD1024x768Data[] = +static const SiS_LCDDataStruct SiS300_St2LCD1280x1024Data[] = { - { 62, 25, 800, 546,1344, 806}, - { 32, 15, 930, 546,1344, 806}, - { 32, 15, 930, 546,1344, 806}, - { 104, 45, 945, 496,1344, 806}, - { 62, 25, 800, 546,1344, 806}, - { 31, 18,1008, 624,1344, 806}, - { 1, 1,1344, 806,1344, 806} -}; - -static const SiS300_LCDDataStruct SiS300_StLCD1280x1024Data[] = -{ - { 4, 1, 880, 510,1650,1088}, - { 4, 1, 880, 510,1650,1088}, + { 22, 5, 800, 510,1650,1088}, + { 22, 5, 800, 510,1650,1088}, { 176, 45, 900, 510,1650,1088}, { 176, 45, 900, 510,1650,1088}, - { 4, 1, 880, 510,1650,1088}, + { 22, 5, 800, 510,1650,1088}, { 13, 5,1024, 675,1560,1152}, { 16, 9,1266, 804,1688,1072}, { 1, 1,1688,1066,1688,1066} }; -static const SiS300_LCDDataStruct SiS300_ExtLCD1280x1024Data[] = +static const SiS_LCDDataStruct SiS300_ExtLCD1280x1024Data[] = { { 211, 60,1024, 501,1688,1066}, { 211, 60,1024, 508,1688,1066}, @@ -894,74 +809,18 @@ static const SiS300_LCDDataStruct SiS300_ExtLCD1280x1024Data[] = { 1, 1,1688,1066,1688,1066} }; -static const SiS300_LCDDataStruct SiS300_St2LCD1280x1024Data[] = -{ - { 22, 5, 800, 510,1650,1088}, - { 22, 5, 800, 510,1650,1088}, - { 176, 45, 900, 510,1650,1088}, - { 176, 45, 900, 510,1650,1088}, - { 22, 5, 800, 510,1650,1088}, - { 13, 5,1024, 675,1560,1152}, - { 16, 9,1266, 804,1688,1072}, - { 1, 1,1688,1066,1688,1066} -}; - -static const SiS300_LCDDataStruct SiS300_NoScaleData1024x768[] = -{ - { 1, 1, 800, 449, 800, 449}, - { 1, 1, 800, 449, 800, 449}, - { 1, 1, 900, 449, 900, 449}, - { 1, 1, 900, 449, 900, 449}, - { 1, 1, 800, 525, 800, 525}, - { 1, 1,1056, 628,1056, 628}, - { 1, 1,1344, 806,1344, 806}, - { 1, 1,1688,1066,1688,1066} -}; - -static const SiS300_LCDDataStruct SiS300_NoScaleData1280x1024[] = /* TW: Fake */ -{ - { 1, 1, 800, 449, 800, 449}, - { 1, 1, 800, 449, 800, 449}, - { 1, 1, 900, 449, 900, 449}, - { 1, 1, 900, 449, 900, 449}, - { 1, 1, 800, 525, 800, 525}, - { 1, 1,1056, 628,1056, 628}, - { 1, 1,1344, 806,1344, 806}, - { 1, 1,1688,1066,1688,1066} -}; - -typedef struct _SiS300_Part2PortTblStruct -{ - UCHAR CR[12]; -} SiS300_Part2PortTblStruct; - -static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1024x768_1[] = +static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1024x768_1[] = { /* VESA Timing */ - {{0x21,0x12,0xbf,0xe4,0xc0,0x21,0x45,0x09,0x00,0xa9,0x09,0x04}}, - {{0x2c,0x12,0x9a,0xae,0x88,0x21,0x45,0x09,0x00,0xa9,0x09,0x04}}, - {{0x21,0x12,0xbf,0xe4,0xc0,0x21,0x45,0x09,0x00,0xa9,0x09,0x04}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x22,0x13,0xfe,0x25,0xff,0x21,0x45,0x0a,0x00,0xa9,0x0d,0x04}}, - {{0x22,0x13,0xfe,0x25,0xff,0x21,0x45,0x0a,0x00,0xa9,0x0d,0x04}}, - {{0x22,0x13,0xfe,0x25,0xff,0x21,0x45,0x0a,0x00,0xa9,0x0d,0x04}} -}; - -static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_1[] = -{ /* TW: Temporary data, invalid */ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} -}; - -static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1400x1050_1[] = -{ /* TW: Temporary data, invalid */ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} -}; - -static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1600x1200_1[] = -{ /* TW: Temporary data, invalid */ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} + {{0x21,0x12,0xbf,0xe4,0xc0,0x21,0x45,0x09,0x00,0xa9,0x09,0x04}}, + {{0x2c,0x12,0x9a,0xae,0x88,0x21,0x45,0x09,0x00,0xa9,0x09,0x04}}, + {{0x21,0x12,0xbf,0xe4,0xc0,0x21,0x45,0x09,0x00,0xa9,0x09,0x04}}, + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, + {{0x22,0x13,0xfe,0x25,0xff,0x21,0x45,0x0a,0x00,0xa9,0x0d,0x04}}, + {{0x22,0x13,0xfe,0x25,0xff,0x21,0x45,0x0a,0x00,0xa9,0x0d,0x04}}, + {{0x22,0x13,0xfe,0x25,0xff,0x21,0x45,0x0a,0x00,0xa9,0x0d,0x04}} }; -static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1024x768_2[] = +static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1024x768_2[] = { /* Non-VESA */ {{0x28,0x12,0xa3,0xd0,0xaa,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, {{0x2c,0x12,0x9a,0xae,0x88,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, @@ -972,38 +831,23 @@ static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1024x768_2[] = {{0x36,0x13,0x13,0x25,0xff,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}} }; -static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_2[] = -{ +static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1024x768_3[] = +{ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} }; -static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1400x1050_2[] = +static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_1[] = { - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} -}; - -static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1600x1200_2[] = -{ /* TW: Temporary data, invalid */ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} -}; - -static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1024x768_3[] = -{ /* TW: Temporary data, invalid */ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} -}; - -static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_3[] = -{ /* TW: Temporary data, invalid */ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} }; -static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1400x1050_3[] = -{ /* TW: Temporary data, invalid */ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} +static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_2[] = +{ + {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} }; -static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1600x1200_3[] = -{ /* TW: Temporary data, invalid */ +static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_3[] = +{ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} }; @@ -1011,15 +855,7 @@ static const SiS300_Part2PortTblStruct SiS300_CRT2Part2_1600x1200_3[] = /* LVDS/Chrontel -------------------------------------------- */ /**************************************************************/ -typedef struct _SiS300_LVDSDataStruct -{ - USHORT VGAHT; - USHORT VGAVT; - USHORT LCDHT; - USHORT LCDVT; -} SiS300_LVDSDataStruct; - -static const SiS300_LVDSDataStruct SiS300_CHTVUPALData[] = +static const SiS_LVDSDataStruct SiS300_CHTVUPALData[] = { {1008, 625,1008, 625}, {1008, 625,1008, 625}, @@ -1029,7 +865,7 @@ static const SiS300_LVDSDataStruct SiS300_CHTVUPALData[] = { 936, 836, 936, 836} }; -static const SiS300_LVDSDataStruct SiS300_CHTVOPALData[] = +static const SiS_LVDSDataStruct SiS300_CHTVOPALData[] = { {1008, 625,1008, 625}, {1008, 625,1008, 625}, @@ -1039,7 +875,7 @@ static const SiS300_LVDSDataStruct SiS300_CHTVOPALData[] = { 960, 750, 960, 750} }; -static const SiS300_LVDSDataStruct SiS300_CHTVSOPALData[] = +static const SiS_LVDSDataStruct SiS300_CHTVSOPALData[] = { {1008, 625,1008, 625}, {1008, 625,1008, 625}, @@ -1049,13 +885,8 @@ static const SiS300_LVDSDataStruct SiS300_CHTVSOPALData[] = { 944, 625, 944, 625} }; -typedef struct _SiS300_LVDSDesStruct -{ - USHORT LCDHDES; - USHORT LCDVDES; -} SiS300_LVDSDesStruct; -static const SiS300_LVDSDesStruct SiS300_PanelType00_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType00_1[] = { { 1059, 626 }, /* 2.08 */ { 1059, 624 }, @@ -1079,7 +910,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType00_1[] = #endif }; -static const SiS300_LVDSDesStruct SiS300_PanelType01_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType01_1[] = { { 0, 0 }, /* 2.08 */ { 0, 0 }, @@ -1103,7 +934,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType01_1[] = #endif }; -static const SiS300_LVDSDesStruct SiS300_PanelType02_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType02_1[] = { { 1059, 626 }, /* 2.08 */ { 1059, 624 }, @@ -1127,7 +958,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType02_1[] = #endif }; -static const SiS300_LVDSDesStruct SiS300_PanelType03_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType03_1[] = { { 8, 436}, { 8, 440}, @@ -1140,7 +971,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType03_1[] = {1343, 794} }; -static const SiS300_LVDSDesStruct SiS300_PanelType04_1[] = /* 1280x1024 */ +static const SiS_LVDSDesStruct SiS300_PanelType04_1[] = /* 1280x1024 */ { {1343, 798}, {1343, 794}, @@ -1153,7 +984,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType04_1[] = /* 1280x1024 */ { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType05_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType05_1[] = { {1343, 798}, {1343, 794}, @@ -1166,7 +997,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType05_1[] = { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType06_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType06_1[] = /* Clevo Trumpion 1024x768 */ { {1343, 798}, {1343, 794}, @@ -1179,7 +1010,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType06_1[] = { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType07_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType07_1[] = { {1343, 798}, {1343, 794}, @@ -1192,7 +1023,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType07_1[] = { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType08_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType08_1[] = { {1059, 626}, {1059, 624}, @@ -1205,7 +1036,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType08_1[] = { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType09_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType09_1[] = { {1343, 798}, {1343, 794}, @@ -1218,7 +1049,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType09_1[] = { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType0a_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType0a_1[] = { {1059, 626}, {1059, 624}, @@ -1231,7 +1062,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType0a_1[] = { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType0b_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType0b_1[] = { {1343, 0}, {1343, 0}, @@ -1244,7 +1075,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType0b_1[] = { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType0c_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType0c_1[] = { {1343, 798}, {1343, 794}, @@ -1257,7 +1088,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType0c_1[] = { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType0d_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType0d_1[] = { {1343, 798}, {1343, 794}, @@ -1270,7 +1101,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType0d_1[] = { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType0e_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType0e_1[] = { {1343, 798}, {1343, 794}, @@ -1283,7 +1114,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType0e_1[] = { 0, 0} /* 1280x960 - not applicable */ }; -static const SiS300_LVDSDesStruct SiS300_PanelType0f_1[] = +static const SiS_LVDSDesStruct SiS300_PanelType0f_1[] = { {1343, 798}, {1343, 794}, @@ -1296,7 +1127,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType0f_1[] = { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType00_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType00_2[] = { {976, 527}, {976, 502}, @@ -1309,7 +1140,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType00_2[] = { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType01_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType01_2[] = { {1152, 622}, {1152, 597}, @@ -1322,7 +1153,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType01_2[] = { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType02_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType02_2[] = { {976, 527}, {976, 502}, @@ -1335,7 +1166,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType02_2[] = { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType03_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType03_2[] = { {1152, 622}, {1152, 597}, @@ -1348,7 +1179,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType03_2[] = {1152, 597} }; -static const SiS300_LVDSDesStruct SiS300_PanelType04_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType04_2[] = { {1152, 622}, {1152, 597}, @@ -1361,7 +1192,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType04_2[] = { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType05_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType05_2[] = { {1152, 622}, {1152, 597}, @@ -1374,7 +1205,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType05_2[] = { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType06_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType06_2[] = { {1152, 622}, {1152, 597}, @@ -1387,7 +1218,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType06_2[] = { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType07_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType07_2[] = { {1152, 622}, {1152, 597}, @@ -1400,7 +1231,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType07_2[] = { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType08_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType08_2[] = { {976, 527}, {976, 502}, @@ -1413,7 +1244,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType08_2[] = { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType09_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType09_2[] = { {1152, 622}, {1152, 597}, @@ -1426,7 +1257,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType09_2[] = { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType0a_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType0a_2[] = { {976, 527}, {976, 502}, @@ -1439,7 +1270,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType0a_2[] = { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType0b_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType0b_2[] = { { 1152, 700}, { 1152, 675}, @@ -1452,7 +1283,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType0b_2[] = { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType0c_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType0c_2[] = { {1152, 622}, {1152, 597}, @@ -1465,7 +1296,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType0c_2[] = { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType0d_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType0d_2[] = { {1152, 622}, {1152, 597}, @@ -1478,7 +1309,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType0d_2[] = { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType0e_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType0e_2[] = { {1152, 622}, {1152, 597}, @@ -1491,7 +1322,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType0e_2[] = { 0, 0} }; -static const SiS300_LVDSDesStruct SiS300_PanelType0f_2[] = +static const SiS_LVDSDesStruct SiS300_PanelType0f_2[] = { {1152, 622}, {1152, 597}, @@ -1504,8 +1335,36 @@ static const SiS300_LVDSDesStruct SiS300_PanelType0f_2[] = { 0, 0} }; +static const SiS_LVDSDesStruct SiS300_PanelTypeNS_1[]= +{ + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 805}, + { 0, 0}, + { 0, 0}, + { 0, 0} +}; + +static const SiS_LVDSDesStruct SiS300_PanelTypeNS_2[] = +{ + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0} +}; + /* Custom data for Barco iQ R200/300/400 (BIOS 2.00.07) */ -static const SiS300_LVDSDesStruct SiS300_PanelType04_1a[] = /* 1280x1024 (1366x1024) */ +static const SiS_LVDSDesStruct SiS300_PanelType04_1a[] = /* 1280x1024 (1366x1024) */ { {1330, 798}, /* 320x200 */ {1330, 794}, @@ -1518,7 +1377,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType04_1a[] = /* 1280x1024 (1366x { 0, 0} /* 1360x1024 */ }; -static const SiS300_LVDSDesStruct SiS300_PanelType04_2a[] = +static const SiS_LVDSDesStruct SiS300_PanelType04_2a[] = { {1152, 622}, {1152, 597}, @@ -1532,7 +1391,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType04_2a[] = }; /* Custom data for Barco iQ G200/300/400 (BIOS 2.00.07) */ -static const SiS300_LVDSDesStruct SiS300_PanelType04_1b[] = /* 1024x768 */ +static const SiS_LVDSDesStruct SiS300_PanelType04_1b[] = /* 1024x768 */ { {1330, 798}, /* 320x200 */ {1330, 794}, @@ -1543,7 +1402,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType04_1b[] = /* 1024x768 */ { 0, 805} /* 1024x768 / 512x384 */ }; -static const SiS300_LVDSDesStruct SiS300_PanelType04_2b[] = +static const SiS_LVDSDesStruct SiS300_PanelType04_2b[] = { {1152, 622}, {1152, 597}, @@ -1556,12 +1415,7 @@ static const SiS300_LVDSDesStruct SiS300_PanelType04_2b[] = /* CRT1 CRTC for slave modes */ -typedef struct _SiS300_LVDSCRT1DataStruct -{ -UCHAR CR[15]; -} SiS300_LVDSCRT1DataStruct; - -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_1[] = +static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_1[] = { {{0x65,0x4f,0x89,0x56,0x83,0xaf,0x1f, 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, @@ -1583,7 +1437,7 @@ static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_1[] = 0x01 }} }; -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_1_H[] = +static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_1_H[] = { {{0x30,0x27,0x94,0x2c,0x92,0xaf,0x1f, 0x90,0x85,0x8f,0xab,0x30,0x00,0x04, @@ -1605,7 +1459,7 @@ static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_1_H[] = 0x01 }} }; -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_1[] = +static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_1[] = { {{0x64,0x4f,0x88,0x54,0x9f,0xc4,0x1f, 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, @@ -1630,7 +1484,7 @@ static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_1[] = 0x01}} }; -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_1_H[] = +static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_1_H[] = { {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, @@ -1679,7 +1533,7 @@ static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_1_H[] = #endif }; -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_1[] = +static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_1[] = { {{0x63,0x4f,0x87,0x54,0x9f,0xb4,0x1f, 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, @@ -1704,7 +1558,7 @@ static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_1[] = 0x01 }} }; -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_1_H[] = +static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_1_H[] = { {{0x2f,0x27,0x93,0x2b,0x90,0xb4,0x1f, 0x92,0x89,0x8f,0xb5,0x30,0x00,0x04, @@ -1729,7 +1583,7 @@ static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_1_H[] = 0x01 }} }; -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_2[] = +static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_2[] = { {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, 0xf4,0x88,0x8f,0x73,0x20,0x00,0x06, @@ -1751,7 +1605,7 @@ static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_2[] = 0x01 }} }; -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_2_H[] = +static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_2_H[] = { {{0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e, 0xf4,0x88,0x8f,0x73,0x20,0x00,0x05, @@ -1773,7 +1627,7 @@ static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_2_H[] = 0x01 }} }; -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_2[] = +static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_2[] = { {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, @@ -1798,7 +1652,7 @@ static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_2[] = 0x01 }} }; -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_2_H[] = +static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_2_H[] = { {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, @@ -1823,7 +1677,7 @@ static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_2_H[] = 0x01 }} }; -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_2[] = +static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_2[] = { {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, @@ -1848,7 +1702,7 @@ static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_2[] = 0x01 }} }; -static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_2_H[] = +static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_2_H[] = { {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, @@ -1873,7 +1727,64 @@ static const SiS300_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_2_H[] = 0x01}} }; -static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1UNTSC[] = +static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT1XXXxXXX_1[] = +{ + {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, + 0x00}}, + {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, + 0x00}}, + {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, + 0x00}}, + {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, + 0x00}}, + {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e, + 0xe9,0x8b,0xe7,0x04,0x00,0x00,0x05, + 0x00}}, + {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, + 0x01}}, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01}}, + {{0xce,0x9f,0x92,0xa8,0x14,0x28,0x5a, + 0x00,0x84,0xff,0x29,0x09,0x00,0x07, + 0x01}}, + {{0xce,0x9f,0x92,0xa9,0x17,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x07, + 0x01}} +}; + +static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT1XXXxXXX_1_H[] = +{ + {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, + 0x00}}, + {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, + 0x00}}, + {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, + 0x00}}, + {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, + 0x00}}, + {{0x38,0x27,0x9c,0x2c,0x80,0x0b,0x3e, + 0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00, + 0x00}}, + {{0x4d,0x31,0x91,0x3b,0x03,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x01, + 0x01}}, + {{0x63,0x3f,0x87,0x4a,0x92,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01}} +}; + + +static const SiS_LVDSCRT1DataStruct SiS300_CHTVCRT1UNTSC[] = { {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e, 0xe8,0x84,0x8f,0x57,0x20,0x00,0x01, @@ -1895,7 +1806,7 @@ static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1UNTSC[] = 0x01 }} }; -static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1ONTSC[] = +static const SiS_LVDSCRT1DataStruct SiS300_CHTVCRT1ONTSC[] = { {{0x64,0x4f,0x88,0x5a,0x9f,0x0b,0x3e, 0xc0,0x84,0x8f,0x0c,0x20,0x00,0x01, @@ -1917,7 +1828,7 @@ static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1ONTSC[] = 0x01 }} }; -static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1UPAL[] = +static const SiS_LVDSCRT1DataStruct SiS300_CHTVCRT1UPAL[] = { {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, 0xf8,0x83,0x8f,0x70,0x20,0x00,0x05, @@ -1939,7 +1850,7 @@ static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1UPAL[] = 0x01 }} }; -static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1OPAL[] = +static const SiS_LVDSCRT1DataStruct SiS300_CHTVCRT1OPAL[] = { {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05, @@ -1961,7 +1872,7 @@ static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1OPAL[] = 0x01 }} }; -static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1SOPAL[] = +static const SiS_LVDSCRT1DataStruct SiS300_CHTVCRT1SOPAL[] = { {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05, @@ -1983,12 +1894,7 @@ static const SiS300_LVDSCRT1DataStruct SiS300_CHTVCRT1SOPAL[] = 0x01 }} }; -typedef struct _SiS300_CHTVRegDataStruct -{ - UCHAR Reg[16]; -} SiS300_CHTVRegDataStruct; - -static const SiS300_CHTVRegDataStruct SiS300_CHTVReg_UNTSC[] = +static const SiS_CHTVRegDataStruct SiS300_CHTVReg_UNTSC[] = { {{0x4a,0x94,0x00,0x48,0xfe,0,0,0,0,0,0,0,0,0,0,0}}, {{0x4a,0x94,0x00,0x48,0xfe,0,0,0,0,0,0,0,0,0,0,0}}, @@ -1998,7 +1904,7 @@ static const SiS300_CHTVRegDataStruct SiS300_CHTVReg_UNTSC[] = {{0x8d,0xc4,0x00,0x3b,0xfb,0,0,0,0,0,0,0,0,0,0,0}} /* Mode 24: 800x600 NTSC 7/10 */ }; -static const SiS300_CHTVRegDataStruct SiS300_CHTVReg_ONTSC[] = +static const SiS_CHTVRegDataStruct SiS300_CHTVReg_ONTSC[] = { {{0x49,0x94,0x00,0x34,0xfe,0,0,0,0,0,0,0,0,0,0,0}}, {{0x49,0x94,0x00,0x34,0xfe,0,0,0,0,0,0,0,0,0,0,0}}, @@ -2008,7 +1914,7 @@ static const SiS300_CHTVRegDataStruct SiS300_CHTVReg_ONTSC[] = {{0x8c,0xb4,0x00,0x32,0xf9,0,0,0,0,0,0,0,0,0,0,0}} /* Mode 23: 800x600 NTSC 3/4 */ }; -static const SiS300_CHTVRegDataStruct SiS300_CHTVReg_UPAL[] = +static const SiS_CHTVRegDataStruct SiS300_CHTVReg_UPAL[] = { {{0x41,0x12,0x01,0x50,0x34,0,0,0,0,0,0,0,0,0,0,0}}, {{0x41,0x12,0x00,0x50,0x00,0,0,0,0,0,0,0,0,0,0,0}}, @@ -2019,7 +1925,7 @@ static const SiS300_CHTVRegDataStruct SiS300_CHTVReg_UPAL[] = }; -static const SiS300_CHTVRegDataStruct SiS300_CHTVReg_OPAL[] = +static const SiS_CHTVRegDataStruct SiS300_CHTVReg_OPAL[] = { {{0x41,0x12,0x01,0x50,0x34,0,0,0,0,0,0,0,0,0,0,0}}, /* Mode 9: 640x400 PAL 1/1 */ {{0x41,0x12,0x00,0x50,0x00,0,0,0,0,0,0,0,0,0,0,0}}, @@ -2030,7 +1936,7 @@ static const SiS300_CHTVRegDataStruct SiS300_CHTVReg_OPAL[] = }; -static const SiS300_CHTVRegDataStruct SiS300_CHTVReg_SOPAL[] = +static const SiS_CHTVRegDataStruct SiS300_CHTVReg_SOPAL[] = { {{0x41,0x12,0x01,0x50,0x34,0,0,0,0,0,0,0,0,0,0,0}}, /* Mode 9: 640x400 PAL 1/1 */ {{0x41,0x12,0x00,0x50,0x00,0,0,0,0,0,0,0,0,0,0,0}}, diff --git a/src/310vtbl.h b/src/310vtbl.h index 1dcff00..764a5f6 100644 --- a/src/310vtbl.h +++ b/src/310vtbl.h @@ -1,52 +1,55 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/310vtbl.h,v 1.20 2003/11/19 00:49:02 twini Exp $ */ +/* $XFree86$ */ /* * Register settings for SiS 315/330 series * - * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria * - * If distributed as part of the linux kernel, the contents of this file - * is entirely covered by the GPL. + * If distributed as part of the Linux kernel, the following license terms + * apply: * - * Otherwise, the following terms apply: + * * This program is free software; you can redistribute it and/or modify + * * it under the terms of the GNU General Public License as published by + * * the Free Software Foundation; either version 2 of the named License, + * * or any later version. + * * + * * This program is distributed in the hope that it will be useful, + * * but WITHOUT ANY WARRANTY; without even the implied warranty of + * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * * GNU General Public License for more details. + * * + * * You should have received a copy of the GNU General Public License + * * along with this program; if not, write to the Free Software + * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * - * 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. + * Otherwise, the following license terms apply: * - * 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. + * * 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. + * * + * * 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. * * Author: Thomas Winischhofer <thomas@winischhofer.net> * - * Based on code by Silicon Intergrated Systems - * */ -typedef struct _SiS310_StStruct -{ - UCHAR St_ModeID; - USHORT St_ModeFlag; - UCHAR St_StTableIndex; - UCHAR St_CRT2CRTC; - UCHAR St_ResInfo; - UCHAR VB_StTVFlickerIndex; - UCHAR VB_StTVEdgeIndex; - UCHAR VB_StTVYFilterIndex; - UCHAR St_PDC; -} SiS310_StStruct; - -static const SiS310_StStruct SiS310_SModeIDTable[]= +static const SiS_StStruct SiS310_SModeIDTable[]= { {0x01,0x9208,0x01,0x00,0x00,0x00,0x01,0x00, 0x40}, {0x01,0x1210,0x14,0x01,0x01,0x00,0x01,0x00, 0x40}, @@ -70,207 +73,184 @@ static const SiS310_StStruct SiS310_SModeIDTable[]= {0xff,0x0000,0x00,0x00,0x00,0x00,0x00,0x00, 0x40} }; -typedef struct _SiS310_ExtStruct -{ - UCHAR Ext_ModeID; - USHORT Ext_ModeFlag; - UCHAR Ext_ModeOffset; - USHORT Ext_VESAID; - UCHAR Ext_RESINFO; - UCHAR VB_ExtTVFlickerIndex; - UCHAR VB_ExtTVEdgeIndex; - UCHAR VB_ExtTVYFilterIndex; - UCHAR VB_ExtTVYFilterIndexROM661; - UCHAR REFindex; -} SiS310_ExtStruct; - -static const SiS310_ExtStruct SiS310_EModeIDTable[]= -{ - {0x6a,0x2212,0x04,0x0102,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00}, /* 800x600x? */ - {0x2e,0x0a1b,0x03,0x0101,SIS_RI_640x480, 0x00,0x00,0x05,0x05,0x08}, /* 640x480x8 */ - {0x2f,0x0a1b,0x03,0x0100,SIS_RI_640x400, 0x00,0x00,0x05,0x05,0x10}, /* 640x400x8 */ - {0x30,0x2a1b,0x04,0x0103,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00}, /* 800x600x8 */ - {0x31,0x0a1b,0x0a,0x0000,SIS_RI_720x480, 0x00,0x00,0x06,0x06,0x11}, /* 720x480x8 */ - {0x32,0x0a1b,0x0a,0x0000,SIS_RI_720x576, 0x00,0x00,0x06,0x06,0x12}, /* 720x576x8 */ - {0x33,0x0a1d,0x0a,0x0000,SIS_RI_720x480, 0x00,0x00,0x06,0x06,0x11}, /* 720x480x16 */ - {0x34,0x2a1d,0x0a,0x0000,SIS_RI_720x576, 0x00,0x00,0x06,0x06,0x12}, /* 720x576x16 */ - {0x35,0x0a1f,0x0a,0x0000,SIS_RI_720x480, 0x00,0x00,0x06,0x06,0x11}, /* 720x480x32 */ - {0x36,0x2a1f,0x0a,0x0000,SIS_RI_720x576, 0x00,0x00,0x06,0x06,0x12}, /* 720x576x32 */ - {0x37,0x0212,0x05,0x0104,SIS_RI_1024x768, 0x00,0x00,0x08,0x07,0x13}, /* 1024x768x? */ - {0x38,0x0a1b,0x05,0x0105,SIS_RI_1024x768, 0x00,0x00,0x08,0x07,0x13}, /* 1024x768x8 */ - {0x3a,0x0e3b,0x06,0x0107,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a}, /* 1280x1024x8 */ - {0x3c,0x0e3b,0x07,0x0130,SIS_RI_1600x1200,0x00,0x00,0x00,0x00,0x1e}, /* 1600x1200x8 */ - {0x3d,0x0e7d,0x07,0x0131,SIS_RI_1600x1200,0x00,0x00,0x00,0x00,0x1e}, /* 1600x1200x16 */ - {0x40,0x9a1c,0x00,0x010d,SIS_RI_320x200, 0x00,0x00,0x04,0x04,0x25}, /* 320x200x15 */ - {0x41,0x9a1d,0x00,0x010e,SIS_RI_320x200, 0x00,0x00,0x04,0x04,0x25}, /* 320x200x16 */ - {0x43,0x0a1c,0x03,0x0110,SIS_RI_640x480, 0x00,0x00,0x05,0x05,0x08}, - {0x44,0x0a1d,0x03,0x0111,SIS_RI_640x480, 0x00,0x00,0x05,0x05,0x08}, /* 640x480x16 */ - {0x46,0x2a1c,0x04,0x0113,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00}, - {0x47,0x2a1d,0x04,0x0114,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00}, /* 800x600x16 */ - {0x49,0x0a3c,0x05,0x0116,SIS_RI_1024x768, 0x00,0x00,0x00,0x07,0x13}, - {0x4a,0x0a3d,0x05,0x0117,SIS_RI_1024x768, 0x00,0x00,0x08,0x07,0x13}, /* 1024x768x16 */ - {0x4c,0x0e7c,0x06,0x0119,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a}, - {0x4d,0x0e7d,0x06,0x011a,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a}, /* 1280x1024x16 */ - {0x50,0x9a1b,0x00,0x0132,SIS_RI_320x240, 0x00,0x00,0x04,0x04,0x26}, /* 320x240x8 */ - {0x51,0xba1b,0x01,0x0133,SIS_RI_400x300, 0x00,0x00,0x07,0x07,0x27}, /* 400x300x8 */ - {0x52,0xba1b,0x02,0x0134,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x28}, /* 512x384x8 */ - {0x56,0x9a1d,0x00,0x0135,SIS_RI_320x240, 0x00,0x00,0x04,0x04,0x26}, /* 320x240x16 */ - {0x57,0xba1d,0x01,0x0136,SIS_RI_400x300, 0x00,0x00,0x07,0x07,0x27}, /* 400x300x16 */ - {0x58,0xba1d,0x02,0x0137,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x28}, /* 512x384x16 */ - {0x59,0x9a1b,0x00,0x0138,SIS_RI_320x200, 0x00,0x00,0x04,0x04,0x25}, /* 320x200x8 */ - {0x5a,0x021b,0x00,0x0138,SIS_RI_320x240, 0x00,0x00,0x00,0x00,0x3f}, /* 320x240x8 fstn */ - {0x5b,0x0a1d,0x00,0x0135,SIS_RI_320x240, 0x00,0x00,0x00,0x00,0x3f}, /* 320x240x16 fstn */ - {0x5c,0xba1f,0x02,0x0000,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x28}, /* 512x384x32 */ - {0x5d,0x0a1d,0x03,0x0139,SIS_RI_640x400, 0x00,0x00,0x05,0x07,0x10}, - {0x5e,0x0a1f,0x03,0x0000,SIS_RI_640x400, 0x00,0x00,0x05,0x07,0x10}, /* 640x400x32 */ - {0x62,0x0a3f,0x03,0x013a,SIS_RI_640x480, 0x00,0x00,0x05,0x05,0x08}, /* 640x480x32 */ - {0x63,0x2a3f,0x04,0x013b,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00}, /* 800x600x32 */ - {0x64,0x0a7f,0x05,0x013c,SIS_RI_1024x768, 0x00,0x00,0x08,0x07,0x13}, /* 1024x768x32 */ - {0x65,0x0eff,0x06,0x013d,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a}, /* 1280x1024x32 */ - {0x66,0x0eff,0x07,0x013e,SIS_RI_1600x1200,0x00,0x00,0x00,0x00,0x1e}, /* 1600x1200x32 */ - {0x68,0x067b,0x08,0x013f,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x29}, /* 1920x1440x8 */ - {0x69,0x06fd,0x08,0x0140,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x29}, /* 1920x1440x16 */ - {0x6b,0x07ff,0x08,0x0141,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x29}, /* 1920x1440x32 */ - {0x6c,0x067b,0x09,0x0000,SIS_RI_2048x1536,0x00,0x00,0x00,0x00,0x2f}, /* 2048x1536x8 */ - {0x6d,0x06fd,0x09,0x0000,SIS_RI_2048x1536,0x00,0x00,0x00,0x00,0x2f}, /* 2048x1536x16 */ - {0x6e,0x07ff,0x09,0x0000,SIS_RI_2048x1536,0x00,0x00,0x00,0x00,0x2f}, /* 2048x1536x32 */ - {0x70,0x2a1b,0x04,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x07,0x34}, /* 800x480x8 */ - {0x71,0x0a1b,0x05,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x37}, /* 1024x576x8 */ - {0x74,0x0a1d,0x05,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x37}, /* 1024x576x16 */ - {0x75,0x0a3d,0x06,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x3a}, /* 1280x720x16 */ - {0x76,0x2a1f,0x04,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x07,0x34}, /* 800x480x32 */ - {0x77,0x0a1f,0x05,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x37}, /* 1024x576x32 */ - {0x78,0x0a3f,0x06,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x3a}, /* 1280x720x32 */ - {0x79,0x0a3b,0x06,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x3a}, /* 1280x720x8 */ - {0x7a,0x2a1d,0x04,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x07,0x34}, /* 800x480x16 */ - {0x7c,0x0e3b,0x06,0x0000,SIS_RI_1280x960, 0x00,0x00,0x00,0x00,0x3d}, /* 1280x960x8 */ - {0x7d,0x0e7d,0x06,0x0000,SIS_RI_1280x960, 0x00,0x00,0x00,0x00,0x3d}, /* 1280x960x16 */ - {0x7e,0x0eff,0x06,0x0000,SIS_RI_1280x960, 0x00,0x00,0x00,0x00,0x3d}, /* 1280x960x32 */ - {0x23,0x0e3b,0x06,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x40}, /* 1280x768x8 */ - {0x24,0x0e7d,0x06,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x40}, /* 1280x768x16 */ - {0x25,0x0eff,0x06,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x40}, /* 1280x768x32 */ - {0x26,0x0e3b,0x0c,0x0000,SIS_RI_1400x1050,0x00,0x00,0x00,0x00,0x41}, /* 1400x1050x8 */ - {0x27,0x0e7d,0x0c,0x0000,SIS_RI_1400x1050,0x00,0x00,0x00,0x00,0x41}, /* 1400x1050x16 */ - {0x28,0x0eff,0x0c,0x0000,SIS_RI_1400x1050,0x00,0x00,0x00,0x00,0x41}, /* 1400x1050x32*/ - {0x29,0x0e1b,0x0d,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x43}, /* 1152x864 */ - {0x2a,0x0e3d,0x0d,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x43}, - {0x2b,0x0e7f,0x0d,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x43}, - {0x39,0x2a1b,0x0b,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x45}, /* 848x480 */ - {0x3b,0x2a3d,0x0b,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x45}, - {0x3e,0x2a7f,0x0b,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x45}, - {0x3f,0x2a1b,0x0b,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x47}, /* 856x480 */ - {0x42,0x2a3d,0x0b,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x47}, - {0x45,0x2a7f,0x0b,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x47}, - {0x48,0x2a1b,0x0e,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x49}, /* 1360x768 */ - {0x4b,0x2a3d,0x0e,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x49}, - {0x4e,0x2a7f,0x0e,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x49}, - {0x4f,0x9a1f,0x00,0x0000,SIS_RI_320x200, 0x00,0x00,0x04,0x04,0x25}, /* 320x200x32 */ - {0x53,0x9a1f,0x00,0x0000,SIS_RI_320x240, 0x00,0x00,0x04,0x04,0x26}, /* 320x240x32 */ - {0x54,0xba1f,0x01,0x0000,SIS_RI_400x300, 0x00,0x00,0x07,0x07,0x27}, /* 400x300x32 */ - {0x5f,0x2a1b,0x0f,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4a}, /* 768x576x8 */ - {0x60,0x2a1d,0x0f,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4a}, /* 768x576x16 */ - {0x61,0x2a1f,0x0f,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4a}, /* 768x576x32 */ - {0xff,0x0000,0x00,0x0000,0, 0x00,0x00,0x00,0x00,0x00} -}; - -typedef struct _SiS310_Ext2Struct -{ - USHORT Ext_InfoFlag; - UCHAR Ext_CRT1CRTC; - UCHAR Ext_CRTVCLK; - UCHAR Ext_CRT2CRTC; - UCHAR ModeID; - USHORT XRes; - USHORT YRes; - UCHAR Ext_PDC; -} SiS310_Ext2Struct; - -static const SiS310_Ext2Struct SiS310_RefIndex[]= -{ - {0x085f,0x0d,0x03,0x05,0x6a, 800, 600, 0x40}, /* 0x0 */ - {0x0067,0x0e,0x04,0x05,0x6a, 800, 600, 0x40}, /* 0x1 */ - {0x0067,0x0f,0x08,0x48,0x6a, 800, 600, 0x40}, /* 0x2 */ - {0x0067,0x10,0x07,0x8b,0x6a, 800, 600, 0x40}, /* 0x3 */ - {0x0047,0x11,0x0a,0x00,0x6a, 800, 600, 0x40}, /* 0x4 */ - {0x0047,0x12,0x0d,0x00,0x6a, 800, 600, 0x40}, /* 0x5 */ - {0x0047,0x13,0x13,0x00,0x6a, 800, 600, 0x20}, /* 0x6 */ - {0x0107,0x14,0x1c,0x00,0x6a, 800, 600, 0x20}, /* 0x7 */ - {0xc85f,0x05,0x00,0x04,0x2e, 640, 480, 0x40}, /* 0x8 */ - {0xc067,0x06,0x02,0x04,0x2e, 640, 480, 0x40}, /* 0x9 */ - {0xc067,0x07,0x02,0x47,0x2e, 640, 480, 0x40}, /* 0xa */ - {0xc067,0x08,0x03,0x8a,0x2e, 640, 480, 0x40}, /* 0xb */ - {0xc047,0x09,0x05,0x00,0x2e, 640, 480, 0x40}, /* 0xc */ - {0xc047,0x0a,0x09,0x00,0x2e, 640, 480, 0x40}, /* 0xd */ - {0xc047,0x0b,0x0e,0x00,0x2e, 640, 480, 0x40}, /* 0xe */ - {0xc047,0x0c,0x15,0x00,0x2e, 640, 480, 0x40}, /* 0xf */ - {0x487f,0x04,0x00,0x00,0x2f, 640, 400, 0x30}, /* 0x10 */ - {0xc04f,0x3c,0x01,0x06,0x31, 720, 480, 0x30}, /* 0x11 */ - {0x004f,0x3d,0x03,0x06,0x32, 720, 576, 0x30}, /* 0x12 */ - {0x0087,0x15,0x06,0x00,0x37,1024, 768, 0x30}, /* 0x13 */ - {0xc877,0x16,0x0b,0x06,0x37,1024, 768, 0x20}, /* 0x14 */ - {0xc067,0x17,0x0f,0x49,0x37,1024, 768, 0x20}, /* 0x15 */ - {0x0067,0x18,0x11,0x00,0x37,1024, 768, 0x20}, /* 0x16 */ - {0x0047,0x19,0x16,0x8c,0x37,1024, 768, 0x20}, /* 0x17 */ - {0x0107,0x1a,0x1b,0x00,0x37,1024, 768, 0x10}, /* 0x18 */ - {0x0107,0x1b,0x1f,0x00,0x37,1024, 768, 0x10}, /* 0x19 */ - {0x0087,0x1c,0x11,0x00,0x3a,1280,1024, 0x30}, /* 0x1a */ - {0x0137,0x1d,0x19,0x07,0x3a,1280,1024, 0x00}, /* 0x1b */ - {0x0107,0x1e,0x1e,0x00,0x3a,1280,1024, 0x00}, /* 0x1c */ - {0x0207,0x1f,0x20,0x00,0x3a,1280,1024, 0x00}, /* 0x1d */ - {0x0227,0x20,0x21,0x09,0x3c,1600,1200, 0x00}, /* 0x1e */ - {0x0407,0x21,0x22,0x00,0x3c,1600,1200, 0x00}, /* 0x1f */ - {0x0407,0x22,0x23,0x00,0x3c,1600,1200, 0x00}, /* 0x20 */ - {0x0407,0x23,0x25,0x00,0x3c,1600,1200, 0x00}, /* 0x21 */ - {0x0007,0x24,0x26,0x00,0x3c,1600,1200, 0x00}, /* 0x22 */ - {0x0007,0x25,0x2c,0x00,0x3c,1600,1200, 0x00}, /* 0x23 */ - {0x0007,0x26,0x34,0x00,0x3c,1600,1200, 0x00}, /* 0x24 */ - {0x407f,0x00,0x00,0x00,0x40, 320, 200, 0x30}, /* 0x25 */ - {0xc07f,0x01,0x00,0x04,0x50, 320, 240, 0x30}, /* 0x26 */ - {0x007f,0x02,0x04,0x05,0x51, 400, 300, 0x30}, /* 0x27 */ - {0xc077,0x03,0x0b,0x06,0x52, 512, 384, 0x30}, /* 0x28 */ - {0x8007,0x27,0x27,0x00,0x68,1920,1440, 0x00}, /* 0x29 */ - {0x4007,0x28,0x29,0x00,0x68,1920,1440, 0x00}, /* 0x2a */ - {0x4007,0x29,0x2e,0x00,0x68,1920,1440, 0x00}, /* 0x2b */ - {0x4007,0x2a,0x30,0x00,0x68,1920,1440, 0x00}, /* 0x2c */ - {0x4007,0x2b,0x35,0x00,0x68,1920,1440, 0x00}, /* 0x2d */ - {0x4005,0x2c,0x39,0x00,0x68,1920,1440, 0x00}, /* 0x2e */ - {0x4007,0x2d,0x2b,0x00,0x6c,2048,1536, 0x00}, /* 0x2f */ - {0x4007,0x2e,0x31,0x00,0x6c,2048,1536, 0x00}, /* 0x30 */ - {0x4007,0x2f,0x33,0x00,0x6c,2048,1536, 0x00}, /* 0x31 */ - {0x4007,0x30,0x37,0x00,0x6c,2048,1536, 0x00}, /* 0x32 */ - {0x4005,0x31,0x38,0x00,0x6c,2048,1536, 0x00}, /* 0x33 */ - {0x0057,0x32,0x40,0x08,0x70, 800, 480, 0x30}, /* 0x34 */ - {0x0047,0x33,0x07,0x08,0x70, 800, 480, 0x30}, /* 0x35 */ - {0x0047,0x34,0x0a,0x08,0x70, 800, 480, 0x30}, /* 0x36 */ - {0x0057,0x35,0x0b,0x09,0x71,1024, 576, 0x30}, /* 0x37 */ - {0x0047,0x36,0x11,0x09,0x71,1024, 576, 0x30}, /* 0x38 */ - {0x0047,0x37,0x16,0x09,0x71,1024, 576, 0x30}, /* 0x39 */ - {0x0117,0x38,0x19,0x0a,0x75,1280, 720, 0x30}, /* 0x3a */ - {0x0107,0x39,0x1e,0x0a,0x75,1280, 720, 0x30}, /* 0x3b */ - {0x0207,0x3a,0x20,0x0a,0x75,1280, 720, 0x30}, /* 0x3c */ - {0x0127,0x3b,0x19,0x08,0x7c,1280, 960, 0x30}, /* 0x3d */ - {0x0227,0x4c,0x59,0x08,0x7c,1280, 960, 0x20}, /* 0x3e */ - {0xc07f,0x4e,0x00,0x06,0x5a, 320, 240, 0x30}, /* 0x3f */ /* FSTN 320x240 */ - {0x0077,0x42,0x5b,0x08,0x23,1280, 768, 0x30}, /* 0x40 */ /* TW: 0x5b was 0x12 */ - {0x0127,0x43,0x4d,0x08,0x26,1400,1050, 0x30}, /* 0x41 */ - {0x0207,0x4b,0x5a,0x08,0x26,1400,1050, 0x30}, /* 0x42 Non-BIOS, new */ - {0x0107,0x44,0x19,0x00,0x29,1152, 864, 0x30}, /* 0x43 Non-BIOS, new */ - {0x0107,0x4a,0x1e,0x00,0x29,1152, 864, 0x30}, /* 0x44 Non-BIOS, new */ - {0x0087,0x45,0x57,0x00,0x39, 848, 480, 0x30}, /* 0x45 848x480-38Hzi - Non-BIOS, new */ - {0xc067,0x46,0x55,0x0b,0x39, 848, 480, 0x30}, /* 0x46 848x480-60Hz - Non-BIOS, new */ - {0x0087,0x47,0x57,0x00,0x3f, 856, 480, 0x30}, /* 0x47 856x480-38Hzi - Non-BIOS, new */ - {0xc047,0x48,0x57,0x00,0x3f, 856, 480, 0x30}, /* 0x48 856x480-60Hz - Non-BIOS, new */ - {0x0067,0x49,0x58,0x0c,0x48,1360, 768, 0x30}, /* 0x49 1360x768-60Hz - Non-BIOS, new */ - {0x004f,0x4d,0x03,0x06,0x5f, 768, 576, 0x30}, /* 0x4a 768x576 */ - {0xffff,0x00,0x00,0x00,0x00, 0, 0, 0} -}; - -typedef struct _SiS310_CRT1TableStruct -{ - UCHAR CR[17]; -} SiS310_CRT1TableStruct; - -static const SiS310_CRT1TableStruct SiS310_CRT1Table[]= +static const SiS_ExtStruct SiS310_EModeIDTable[]= +{ + {0x6a,0x2212,0x0102,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00}, /* 800x600x? */ + {0x2e,0x0a1b,0x0101,SIS_RI_640x480, 0x00,0x00,0x05,0x05,0x08}, /* 640x480x8 */ + {0x2f,0x0a1b,0x0100,SIS_RI_640x400, 0x00,0x00,0x05,0x05,0x10}, /* 640x400x8 */ + {0x30,0x2a1b,0x0103,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00}, /* 800x600x8 */ + {0x31,0x0a1b,0x0000,SIS_RI_720x480, 0x00,0x00,0x06,0x06,0x11}, /* 720x480x8 */ + {0x32,0x0a1b,0x0000,SIS_RI_720x576, 0x00,0x00,0x06,0x06,0x12}, /* 720x576x8 */ + {0x33,0x0a1d,0x0000,SIS_RI_720x480, 0x00,0x00,0x06,0x06,0x11}, /* 720x480x16 */ + {0x34,0x2a1d,0x0000,SIS_RI_720x576, 0x00,0x00,0x06,0x06,0x12}, /* 720x576x16 */ + {0x35,0x0a1f,0x0000,SIS_RI_720x480, 0x00,0x00,0x06,0x06,0x11}, /* 720x480x32 */ + {0x36,0x2a1f,0x0000,SIS_RI_720x576, 0x00,0x00,0x06,0x06,0x12}, /* 720x576x32 */ + {0x37,0x0212,0x0104,SIS_RI_1024x768, 0x00,0x00,0x08,0x07,0x13}, /* 1024x768x? */ + {0x38,0x0a1b,0x0105,SIS_RI_1024x768, 0x00,0x00,0x08,0x07,0x13}, /* 1024x768x8 */ + {0x3a,0x0e3b,0x0107,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a}, /* 1280x1024x8 */ + {0x3c,0x0e3b,0x0130,SIS_RI_1600x1200,0x00,0x00,0x00,0x00,0x1e}, /* 1600x1200x8 */ + {0x3d,0x0e7d,0x0131,SIS_RI_1600x1200,0x00,0x00,0x00,0x00,0x1e}, /* 1600x1200x16 */ + {0x40,0x9a1c,0x010d,SIS_RI_320x200, 0x00,0x00,0x04,0x04,0x25}, /* 320x200x15 */ + {0x41,0x9a1d,0x010e,SIS_RI_320x200, 0x00,0x00,0x04,0x04,0x25}, /* 320x200x16 */ + {0x43,0x0a1c,0x0110,SIS_RI_640x480, 0x00,0x00,0x05,0x05,0x08}, + {0x44,0x0a1d,0x0111,SIS_RI_640x480, 0x00,0x00,0x05,0x05,0x08}, /* 640x480x16 */ + {0x46,0x2a1c,0x0113,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00}, + {0x47,0x2a1d,0x0114,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00}, /* 800x600x16 */ + {0x49,0x0a3c,0x0116,SIS_RI_1024x768, 0x00,0x00,0x00,0x07,0x13}, + {0x4a,0x0a3d,0x0117,SIS_RI_1024x768, 0x00,0x00,0x08,0x07,0x13}, /* 1024x768x16 */ + {0x4c,0x0e7c,0x0119,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a}, + {0x4d,0x0e7d,0x011a,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a}, /* 1280x1024x16 */ + {0x50,0x9a1b,0x0132,SIS_RI_320x240, 0x00,0x00,0x04,0x04,0x26}, /* 320x240x8 */ + {0x51,0xba1b,0x0133,SIS_RI_400x300, 0x00,0x00,0x07,0x07,0x27}, /* 400x300x8 */ + {0x52,0xba1b,0x0134,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x28}, /* 512x384x8 */ + {0x56,0x9a1d,0x0135,SIS_RI_320x240, 0x00,0x00,0x04,0x04,0x26}, /* 320x240x16 */ + {0x57,0xba1d,0x0136,SIS_RI_400x300, 0x00,0x00,0x07,0x07,0x27}, /* 400x300x16 */ + {0x58,0xba1d,0x0137,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x28}, /* 512x384x16 */ + {0x59,0x9a1b,0x0138,SIS_RI_320x200, 0x00,0x00,0x04,0x04,0x25}, /* 320x200x8 */ + {0x5a,0x021b,0x0138,SIS_RI_320x240, 0x00,0x00,0x00,0x00,0x3f}, /* 320x240x8 fstn */ + {0x5b,0x0a1d,0x0135,SIS_RI_320x240, 0x00,0x00,0x00,0x00,0x3f}, /* 320x240x16 fstn */ + {0x5c,0xba1f,0x0000,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x28}, /* 512x384x32 */ + {0x5d,0x0a1d,0x0139,SIS_RI_640x400, 0x00,0x00,0x05,0x07,0x10}, + {0x5e,0x0a1f,0x0000,SIS_RI_640x400, 0x00,0x00,0x05,0x07,0x10}, /* 640x400x32 */ + {0x62,0x0a3f,0x013a,SIS_RI_640x480, 0x00,0x00,0x05,0x05,0x08}, /* 640x480x32 */ + {0x63,0x2a3f,0x013b,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00}, /* 800x600x32 */ + {0x64,0x0a7f,0x013c,SIS_RI_1024x768, 0x00,0x00,0x08,0x07,0x13}, /* 1024x768x32 */ + {0x65,0x0eff,0x013d,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a}, /* 1280x1024x32 */ + {0x66,0x0eff,0x013e,SIS_RI_1600x1200,0x00,0x00,0x00,0x00,0x1e}, /* 1600x1200x32 */ + {0x68,0x067b,0x013f,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x29}, /* 1920x1440x8 */ + {0x69,0x06fd,0x0140,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x29}, /* 1920x1440x16 */ + {0x6b,0x07ff,0x0141,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x29}, /* 1920x1440x32 */ + {0x6c,0x067b,0x0000,SIS_RI_2048x1536,0x00,0x00,0x00,0x00,0x2f}, /* 2048x1536x8 */ + {0x6d,0x06fd,0x0000,SIS_RI_2048x1536,0x00,0x00,0x00,0x00,0x2f}, /* 2048x1536x16 */ + {0x6e,0x07ff,0x0000,SIS_RI_2048x1536,0x00,0x00,0x00,0x00,0x2f}, /* 2048x1536x32 */ + {0x70,0x2a1b,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x07,0x34}, /* 800x480x8 */ + {0x71,0x0a1b,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x37}, /* 1024x576x8 */ + {0x74,0x0a1d,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x37}, /* 1024x576x16 */ + {0x75,0x0a3d,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x3a}, /* 1280x720x16 */ + {0x76,0x2a1f,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x07,0x34}, /* 800x480x32 */ + {0x77,0x0a1f,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x37}, /* 1024x576x32 */ + {0x78,0x0a3f,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x3a}, /* 1280x720x32 */ + {0x79,0x0a3b,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x3a}, /* 1280x720x8 */ + {0x7a,0x2a1d,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x07,0x34}, /* 800x480x16 */ + {0x7c,0x0e3b,0x0000,SIS_RI_1280x960, 0x00,0x00,0x00,0x00,0x3d}, /* 1280x960x8 */ + {0x7d,0x0e7d,0x0000,SIS_RI_1280x960, 0x00,0x00,0x00,0x00,0x3d}, /* 1280x960x16 */ + {0x7e,0x0eff,0x0000,SIS_RI_1280x960, 0x00,0x00,0x00,0x00,0x3d}, /* 1280x960x32 */ + {0x23,0x0e3b,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x40}, /* 1280x768x8 */ + {0x24,0x0e7d,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x40}, /* 1280x768x16 */ + {0x25,0x0eff,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x40}, /* 1280x768x32 */ + {0x26,0x0e3b,0x0000,SIS_RI_1400x1050,0x00,0x00,0x00,0x00,0x41}, /* 1400x1050x8 */ + {0x27,0x0e7d,0x0000,SIS_RI_1400x1050,0x00,0x00,0x00,0x00,0x41}, /* 1400x1050x16 */ + {0x28,0x0eff,0x0000,SIS_RI_1400x1050,0x00,0x00,0x00,0x00,0x41}, /* 1400x1050x32*/ + {0x29,0x0e1b,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x43}, /* 1152x864 */ + {0x2a,0x0e3d,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x43}, + {0x2b,0x0e7f,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x43}, + {0x39,0x2a1b,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x45}, /* 848x480 */ + {0x3b,0x2a3d,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x45}, + {0x3e,0x2a7f,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x45}, + {0x3f,0x2a1b,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x47}, /* 856x480 */ + {0x42,0x2a3d,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x47}, + {0x45,0x2a7f,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x47}, + {0x48,0x2a1b,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x49}, /* 1360x768 */ + {0x4b,0x2a3d,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x49}, + {0x4e,0x2a7f,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x49}, + {0x4f,0x9a1f,0x0000,SIS_RI_320x200, 0x00,0x00,0x04,0x04,0x25}, /* 320x200x32 */ + {0x53,0x9a1f,0x0000,SIS_RI_320x240, 0x00,0x00,0x04,0x04,0x26}, /* 320x240x32 */ + {0x54,0xba1f,0x0000,SIS_RI_400x300, 0x00,0x00,0x07,0x07,0x27}, /* 400x300x32 */ + {0x5f,0x2a1b,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4a}, /* 768x576 */ + {0x60,0x2a1d,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4a}, + {0x61,0x2a1f,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4a}, + {0x14,0x0e1b,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4b}, /* 1280x800 */ + {0x15,0x0e3d,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4b}, + {0x16,0x0e7f,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4b}, + {0x17,0x0e1b,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x4c}, /* 1680x1050 */ + {0x18,0x0e3d,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x4c}, + {0x19,0x0e7f,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x4c}, + {0xff,0x0000,0x0000,0, 0x00,0x00,0x00,0x00,0x00} +}; + +static const SiS_Ext2Struct SiS310_RefIndex[]= +{ + {0x085f,0x0d,0x03,0x05,0x05,0x6a, 800, 600, 0x40}, /* 0x0 */ + {0x0067,0x0e,0x04,0x05,0x05,0x6a, 800, 600, 0x40}, /* 0x1 */ + {0x0067,0x0f,0x08,0x48,0x05,0x6a, 800, 600, 0x40}, /* 0x2 */ + {0x0067,0x10,0x07,0x8b,0x05,0x6a, 800, 600, 0x40}, /* 0x3 */ + {0x0047,0x11,0x0a,0x00,0x05,0x6a, 800, 600, 0x40}, /* 0x4 */ + {0x0047,0x12,0x0d,0x00,0x05,0x6a, 800, 600, 0x40}, /* 0x5 */ + {0x0047,0x13,0x13,0x00,0x05,0x6a, 800, 600, 0x20}, /* 0x6 */ + {0x0107,0x14,0x1c,0x00,0x05,0x6a, 800, 600, 0x20}, /* 0x7 */ + {0xc85f,0x05,0x00,0x04,0x04,0x2e, 640, 480, 0x40}, /* 0x8 */ + {0xc067,0x06,0x02,0x04,0x04,0x2e, 640, 480, 0x40}, /* 0x9 */ + {0xc067,0x07,0x02,0x47,0x04,0x2e, 640, 480, 0x40}, /* 0xa */ + {0xc067,0x08,0x03,0x8a,0x04,0x2e, 640, 480, 0x40}, /* 0xb */ + {0xc047,0x09,0x05,0x00,0x04,0x2e, 640, 480, 0x40}, /* 0xc */ + {0xc047,0x0a,0x09,0x00,0x04,0x2e, 640, 480, 0x40}, /* 0xd */ + {0xc047,0x0b,0x0e,0x00,0x04,0x2e, 640, 480, 0x40}, /* 0xe */ + {0xc047,0x0c,0x15,0x00,0x04,0x2e, 640, 480, 0x40}, /* 0xf */ + {0x487f,0x04,0x00,0x00,0x00,0x2f, 640, 400, 0x30}, /* 0x10 */ + {0xc04f,0x3c,0x01,0x06,0x00,0x31, 720, 480, 0x30}, /* 0x11 */ + {0x004f,0x3d,0x03,0x06,0x00,0x32, 720, 576, 0x30}, /* 0x12 */ + {0x0087,0x15,0x06,0x00,0x06,0x37,1024, 768, 0x30}, /* 0x13 */ + {0xc877,0x16,0x0b,0x06,0x06,0x37,1024, 768, 0x20}, /* 0x14 */ + {0xc067,0x17,0x0f,0x49,0x06,0x37,1024, 768, 0x20}, /* 0x15 */ + {0x0067,0x18,0x11,0x00,0x06,0x37,1024, 768, 0x20}, /* 0x16 */ + {0x0047,0x19,0x16,0x8c,0x06,0x37,1024, 768, 0x20}, /* 0x17 */ + {0x0107,0x1a,0x1b,0x00,0x06,0x37,1024, 768, 0x10}, /* 0x18 */ + {0x0107,0x1b,0x1f,0x00,0x06,0x37,1024, 768, 0x10}, /* 0x19 */ + {0x0087,0x1c,0x11,0x00,0x07,0x3a,1280,1024, 0x30}, /* 0x1a */ + {0x0137,0x1d,0x19,0x07,0x07,0x3a,1280,1024, 0x00}, /* 0x1b */ + {0x0107,0x1e,0x1e,0x00,0x07,0x3a,1280,1024, 0x00}, /* 0x1c */ + {0x0207,0x1f,0x20,0x00,0x07,0x3a,1280,1024, 0x00}, /* 0x1d */ + {0x0227,0x20,0x21,0x09,0x09,0x3c,1600,1200, 0x00}, /* 0x1e */ + {0x0407,0x21,0x22,0x00,0x09,0x3c,1600,1200, 0x00}, /* 0x1f */ + {0x0407,0x22,0x23,0x00,0x09,0x3c,1600,1200, 0x00}, /* 0x20 */ + {0x0407,0x23,0x25,0x00,0x09,0x3c,1600,1200, 0x00}, /* 0x21 */ + {0x0007,0x24,0x26,0x00,0x09,0x3c,1600,1200, 0x00}, /* 0x22 */ + {0x0007,0x25,0x2c,0x00,0x09,0x3c,1600,1200, 0x00}, /* 0x23 */ + {0x0007,0x26,0x34,0x00,0x09,0x3c,1600,1200, 0x00}, /* 0x24 */ + {0x407f,0x00,0x00,0x00,0x00,0x40, 320, 200, 0x30}, /* 0x25 */ + {0xc07f,0x01,0x00,0x04,0x04,0x50, 320, 240, 0x30}, /* 0x26 */ + {0x007f,0x02,0x04,0x05,0x05,0x51, 400, 300, 0x30}, /* 0x27 */ + {0xc077,0x03,0x0b,0x06,0x06,0x52, 512, 384, 0x30}, /* 0x28 */ + {0x8007,0x27,0x27,0x00,0x00,0x68,1920,1440, 0x00}, /* 0x29 */ + {0x4007,0x28,0x29,0x00,0x00,0x68,1920,1440, 0x00}, /* 0x2a */ + {0x4007,0x29,0x2e,0x00,0x00,0x68,1920,1440, 0x00}, /* 0x2b */ + {0x4007,0x2a,0x30,0x00,0x00,0x68,1920,1440, 0x00}, /* 0x2c */ + {0x4007,0x2b,0x35,0x00,0x00,0x68,1920,1440, 0x00}, /* 0x2d */ + {0x4005,0x2c,0x39,0x00,0x00,0x68,1920,1440, 0x00}, /* 0x2e */ + {0x4007,0x2d,0x2b,0x00,0x00,0x6c,2048,1536, 0x00}, /* 0x2f */ + {0x4007,0x2e,0x31,0x00,0x00,0x6c,2048,1536, 0x00}, /* 0x30 */ + {0x4007,0x2f,0x33,0x00,0x00,0x6c,2048,1536, 0x00}, /* 0x31 */ + {0x4007,0x30,0x37,0x00,0x00,0x6c,2048,1536, 0x00}, /* 0x32 */ + {0x4005,0x31,0x38,0x00,0x00,0x6c,2048,1536, 0x00}, /* 0x33 */ + {0x0057,0x32,0x40,0x08,0x00,0x70, 800, 480, 0x30}, /* 0x34 */ + {0x0047,0x33,0x07,0x08,0x00,0x70, 800, 480, 0x30}, /* 0x35 */ + {0x0047,0x34,0x0a,0x08,0x00,0x70, 800, 480, 0x30}, /* 0x36 */ + {0x0057,0x35,0x0b,0x09,0x00,0x71,1024, 576, 0x30}, /* 0x37 */ + {0x0047,0x36,0x11,0x09,0x00,0x71,1024, 576, 0x30}, /* 0x38 */ + {0x0047,0x37,0x16,0x09,0x00,0x71,1024, 576, 0x30}, /* 0x39 */ + {0x1137,0x38,0x19,0x0a,0x0c,0x75,1280, 720, 0x30}, /* 0x3a */ + {0x1107,0x39,0x1e,0x0a,0x0c,0x75,1280, 720, 0x30}, /* 0x3b */ + {0x1307,0x3a,0x20,0x0a,0x0c,0x75,1280, 720, 0x30}, /* 0x3c */ + {0x0127,0x3b,0x19,0x08,0x0a,0x7c,1280, 960, 0x30}, /* 0x3d */ + {0x0227,0x4c,0x59,0x08,0x0a,0x7c,1280, 960, 0x20}, /* 0x3e */ + {0xc07f,0x4e,0x00,0x06,0x04,0x5a, 320, 240, 0x30}, /* 0x3f */ /* FSTN 320x240 */ + {0x0077,0x42,0x5b,0x08,0x11,0x23,1280, 768, 0x30}, /* 0x40 */ /* 0x5b was 0x12 */ + {0x0127,0x43,0x4d,0x08,0x0b,0x26,1400,1050, 0x30}, /* 0x41 */ + {0x0207,0x4b,0x5a,0x08,0x0b,0x26,1400,1050, 0x30}, /* 0x42 1400x1050-75Hz */ + {0x0107,0x44,0x19,0x00,0x00,0x29,1152, 864, 0x30}, /* 0x43 1152x864-75Hz */ + {0x0107,0x4a,0x1e,0x00,0x00,0x29,1152, 864, 0x30}, /* 0x44 1152x864-85Hz */ + {0x0087,0x45,0x57,0x00,0x00,0x39, 848, 480, 0x30}, /* 0x45 848x480-38Hzi */ + {0xc067,0x46,0x55,0x0b,0x00,0x39, 848, 480, 0x30}, /* 0x46 848x480-60Hz */ + {0x0087,0x47,0x57,0x00,0x00,0x3f, 856, 480, 0x30}, /* 0x47 856x480-38Hzi */ + {0xc047,0x48,0x57,0x00,0x00,0x3f, 856, 480, 0x30}, /* 0x48 856x480-60Hz */ + {0x0067,0x49,0x58,0x0c,0x00,0x48,1360, 768, 0x30}, /* 0x49 1360x768-60Hz */ + {0x004f,0x4d,0x03,0x06,0x00,0x5f, 768, 576, 0x30}, /* 0x4a 768x576-56Hz */ + {0x0067,0x4f,0x5c,0x08,0x0d,0x14,1280, 800, 0x30}, /* 0x4b 1280x800-60Hz */ + {0x0067,0x50,0x5d,0x0c,0x0e,0x17,1680,1050, 0x30}, /* 0x4c 1680x1050-60Hz */ + {0xffff,0x00,0x00,0x00,0x00,0x00, 0, 0, 0} +}; + +static const SiS_CRT1TableStruct SiS310_CRT1Table[]= { {{0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f, 0x9c,0x8e,0x8f,0x96,0xb9,0x30,0x00,0x00, @@ -291,7 +271,7 @@ static const SiS310_CRT1TableStruct SiS310_CRT1Table[]= {{0x5f,0x4f,0x50,0x82,0x55,0x81,0x0b,0x3e, 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x05, 0x00}}, /* 0x5 */ -#endif +#endif {{0x5f,0x4f,0x4f,0x83,0x55,0x81,0x0b,0x3e, /* 0x05 - corrected 640x480-60 */ 0xe9,0x8b,0xdf,0xe8,0x0c,0x00,0x00,0x05, 0x00}}, @@ -310,16 +290,16 @@ static const SiS310_CRT1TableStruct SiS310_CRT1Table[]= 0xe0,0x83,0xdf,0xdf,0xfc,0x10,0x00,0x05, 0x00}}, /* 0x8 */ {{0x65,0x4f,0x4f,0x89,0x58,0x80,0xfb,0x1f, - 0xe0,0x83,0xdf,0xdf,0xfc,0x10,0x00,0x05, /* TW: Corrected VBE */ + 0xe0,0x83,0xdf,0xdf,0xfc,0x10,0x00,0x05, /* Corrected VBE */ 0x61}}, /* 0x9 */ {{0x65,0x4f,0x4f,0x89,0x58,0x80,0x01,0x3e, 0xe0,0x83,0xdf,0xdf,0x02,0x00,0x00,0x05, 0x61}}, /* 0xa */ {{0x67,0x4f,0x4f,0x8b,0x58,0x81,0x0d,0x3e, - 0xe0,0x83,0xdf,0xdf,0x0e,0x00,0x00,0x05, /* TW: Corrected VBE */ + 0xe0,0x83,0xdf,0xdf,0x0e,0x00,0x00,0x05, /* Corrected VBE */ 0x61}}, /* 0xb */ {{0x65,0x4f,0x4f,0x89,0x57,0x9f,0xfb,0x1f, - 0xe6,0x8a,0xdf,0xdf,0xfc,0x10,0x00,0x01, /* TW: Corrected VDE, VBE */ + 0xe6,0x8a,0xdf,0xdf,0xfc,0x10,0x00,0x01, /* Corrected VDE, VBE */ 0x00}}, /* 0xc */ {{0x7b,0x63,0x63,0x9f,0x6a,0x93,0x6f,0xf0, 0x58,0x8a,0x57,0x57,0x70,0x20,0x00,0x05, @@ -447,7 +427,7 @@ static const SiS310_CRT1TableStruct SiS310_CRT1Table[]= {{0x9f,0x7f,0x7f,0x83,0x85,0x91,0x1e,0xf1, 0xad,0x81,0x3f,0x3f,0x1f,0x30,0x00,0x02, 0x01}}, /* 0x36 */ - {{0xa7,0x7f,0x7f,0x88,0x89,0x95,0x26,0xf1, /* TW: 95 was 15 - illegal HBE! */ + {{0xa7,0x7f,0x7f,0x88,0x89,0x95,0x26,0xf1, /* 95 was 15 - illegal HBE! */ 0xb1,0x85,0x3f,0x3f,0x27,0x30,0x00,0x02, 0x01}}, /* 0x37 */ {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0xc4, @@ -479,7 +459,7 @@ static const SiS310_CRT1TableStruct SiS310_CRT1Table[]= {{0x81,0x6a,0x6a,0x85,0x70,0x00,0x0f,0x3e, 0xeb,0x8e,0xdf,0xdf,0x10,0x00,0x00,0x02, 0x00}}, /* 0x3f */ - {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x1e,0xf1, /* TW: The following from 650/LVDS BIOS */ + {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x1e,0xf1, 0xae,0x85,0x57,0x57,0x1f,0x30,0x00,0x02, 0x01}}, /* 0x40 */ {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, @@ -491,31 +471,31 @@ static const SiS310_CRT1TableStruct SiS310_CRT1Table[]= {{0xe6,0xae,0xae,0x8a,0xbd,0x90,0x3d,0x10, 0x1a,0x8d,0x19,0x19,0x3e,0x2f,0x00,0x03, 0x00}}, /* 0x43 */ - {{0xc3,0x8f,0x8f,0x87,0x9b,0x0b,0x82,0xef, /* New, 1152x864-75, not in BIOS */ + {{0xc3,0x8f,0x8f,0x87,0x9b,0x0b,0x82,0xef, /* 1152x864-75 */ 0x60,0x83,0x5f,0x5f,0x83,0x10,0x00,0x07, 0x01}}, /* 0x44 */ - {{0x86,0x69,0x69,0x8A,0x74,0x06,0x8C,0x15, /* New, 848x480-38i, not in BIOS */ + {{0x86,0x69,0x69,0x8A,0x74,0x06,0x8C,0x15, /* 848x480-38i */ 0x4F,0x83,0xEF,0xEF,0x8D,0x30,0x00,0x02, 0x00}}, /* 0x45 */ - {{0x83,0x69,0x69,0x87,0x6f,0x1d,0x03,0x3E, /* New, 848x480-60, not in BIOS */ + {{0x83,0x69,0x69,0x87,0x6f,0x1d,0x03,0x3E, /* 848x480-60 */ 0xE5,0x8d,0xDF,0xe4,0x04,0x00,0x00,0x06, 0x00}}, /* 0x46 */ - {{0x86,0x6A,0x6A,0x8A,0x74,0x06,0x8C,0x15, /* New, 856x480-38i, not in BIOS */ + {{0x86,0x6A,0x6A,0x8A,0x74,0x06,0x8C,0x15, /* 856x480-38i */ 0x4F,0x83,0xEF,0xEF,0x8D,0x30,0x00,0x02, 0x00}}, /* 0x47 */ - {{0x81,0x6A,0x6A,0x85,0x70,0x00,0x0F,0x3E, /* New, 856x480-60, not in BIOS */ + {{0x81,0x6A,0x6A,0x85,0x70,0x00,0x0F,0x3E, /* 856x480-60 */ 0xEB,0x8E,0xDF,0xDF,0x10,0x00,0x00,0x02, 0x00}}, /* 0x48 */ - {{0xdd,0xa9,0xa9,0x81,0xb4,0x97,0x26,0xfd, /* New, 1360x768-60, not in BIOS */ + {{0xdd,0xa9,0xa9,0x81,0xb4,0x97,0x26,0xfd, /* 1360x768-60 */ 0x01,0x8d,0xff,0x00,0x27,0x10,0x00,0x03, 0x01}}, /* 0x49 */ - {{0xd9,0x8f,0x8f,0x9d,0xba,0x0a,0x8a,0xff, /* New, 1152x864-84, not in any BIOS */ + {{0xd9,0x8f,0x8f,0x9d,0xba,0x0a,0x8a,0xff, /* 1152x864-84 */ 0x60,0x8b,0x5f,0x5f,0x8b,0x10,0x00,0x03, 0x01}}, /* 0x4a */ - {{0xea,0xae,0xae,0x8e,0xba,0x82,0x40,0x10, /* New, 1400x1050-75, not in any BIOS */ + {{0xea,0xae,0xae,0x8e,0xba,0x82,0x40,0x10, /* 1400x1050-75 */ 0x1b,0x87,0x19,0x1a,0x41,0x0f,0x00,0x03, 0x00}}, /* 0x4b */ - {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0xf1,0xff, /* New, 1280x960-85, not in any BIOS */ + {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0xf1,0xff, /* 1280x960-85 */ 0xc0,0x83,0xbf,0xbf,0xf2,0x10,0x00,0x07, 0x01}}, /* 0x4c */ {{0x7b,0x5f,0x63,0x9f,0x6a,0x93,0x6f,0xf0, /* 768x576 */ @@ -523,16 +503,16 @@ static const SiS310_CRT1TableStruct SiS310_CRT1Table[]= 0x01}}, /* 0x4d */ {{0x2d,0x27,0x28,0x90,0x2c,0x80,0x0b,0x3e, /* FSTN 320x480, TEMP - possibly invalid */ 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x00, - 0x00}} /* 0x4e */ + 0x00}}, /* 0x4e */ + {{0xcd,0x9f,0x9f,0x91,0xab,0x1c,0x3a,0xff, /* 1280x800-60 */ + 0x20,0x83,0x1f,0x1f,0x3b,0x10,0x00,0x07, + 0x21}}, /* 0x4f */ + {{0x15,0xd1,0xd1,0x99,0xe2,0x19,0x3d,0x10, /* 1680x1050-60 */ + 0x1a,0x8d,0x19,0x19,0x3e,0x2f,0x01,0x0c, + 0x20}} /* 0x50 */ }; -typedef struct _SiS310_MCLKDataStruct -{ - UCHAR SR28,SR29,SR2A; - USHORT CLOCK; -} SiS310_MCLKDataStruct; - -static const SiS310_MCLKDataStruct SiS310_MCLKData_0_315[] = +static const SiS_MCLKDataStruct SiS310_MCLKData_0_315[] = { { 0x3b,0x22,0x01,143}, { 0x5c,0x23,0x01,166}, @@ -544,7 +524,7 @@ static const SiS310_MCLKDataStruct SiS310_MCLKData_0_315[] = { 0x5c,0x23,0x01,166} }; -static const SiS310_MCLKDataStruct SiS310_MCLKData_0_650[] = +static const SiS_MCLKDataStruct SiS310_MCLKData_0_650[] = { { 0x5a,0x64,0x82, 66}, { 0xb3,0x45,0x82, 83}, @@ -556,7 +536,7 @@ static const SiS310_MCLKDataStruct SiS310_MCLKData_0_650[] = { 0x37,0x22,0x82,133} }; -static const SiS310_MCLKDataStruct SiS310_MCLKData_0_330[] = +static const SiS_MCLKDataStruct SiS310_MCLKData_0_330[] = { { 0x5c,0x23,0x01,166}, { 0x5c,0x23,0x01,166}, @@ -568,7 +548,7 @@ static const SiS310_MCLKDataStruct SiS310_MCLKData_0_330[] = { 0x79,0x06,0x01,250} }; -static const SiS310_MCLKDataStruct SiS310_MCLKData_0_660[] = /* TODO */ +static const SiS_MCLKDataStruct SiS310_MCLKData_0_660[] = { { 0x5c,0x23,0x82,166}, { 0x5c,0x23,0x82,166}, @@ -580,7 +560,19 @@ static const SiS310_MCLKDataStruct SiS310_MCLKData_0_660[] = /* TODO */ { 0x37,0x21,0x82,200} }; -static const SiS310_MCLKDataStruct SiS310_MCLKData_1[] = +static const SiS_MCLKDataStruct SiS310_MCLKData_0_760[] = +{ + { 0x37,0x22,0x82,133}, + { 0x5c,0x23,0x82,166}, + { 0x65,0x23,0x82,183}, + { 0x7c,0x08,0x82,200}, + { 0x29,0x21,0x82,150}, + { 0x5c,0x23,0x82,166}, + { 0x65,0x23,0x82,183}, + { 0x37,0x21,0x82,200} +}; + +static const SiS_MCLKDataStruct SiS310_MCLKData_1[] = /* ECLK */ { { 0x29,0x21,0x82,150}, { 0x5c,0x23,0x82,166}, @@ -592,13 +584,7 @@ static const SiS310_MCLKDataStruct SiS310_MCLKData_1[] = { 0x37,0x22,0x82,133} }; -typedef struct _SiS310_VCLKDataStruct -{ - UCHAR SR2B,SR2C; - USHORT CLOCK; -} SiS310_VCLKDataStruct; - -static const SiS310_VCLKDataStruct SiS310_VCLKData[]= +static SiS_VCLKDataStruct SiS310_VCLKData[]= { { 0x1b,0xe1, 25}, /* 0x00 */ { 0x4e,0xe4, 28}, /* 0x01 */ @@ -611,7 +597,7 @@ static const SiS310_VCLKDataStruct SiS310_VCLKData[]= { 0x53,0xe2, 50}, /* 0x08 */ { 0x74,0x67, 52}, /* 0x09 */ { 0x6d,0x66, 56}, /* 0x0a */ - { 0x5a,0x64, 65}, /* 0x0b */ /* TW: was 6c c3 - WRONG */ + { 0x5a,0x64, 65}, /* 0x0b */ /* was 6c c3 - WRONG */ { 0x46,0x44, 67}, /* 0x0c */ { 0xb1,0x46, 68}, /* 0x0d */ { 0xd3,0x4a, 72}, /* 0x0e */ @@ -625,7 +611,7 @@ static const SiS310_VCLKDataStruct SiS310_VCLKData[]= { 0x62,0x44, 94}, /* 0x16 */ { 0x2b,0x41,104}, /* 0x17 */ { 0x3a,0x23,105}, /* 0x18 */ - { 0x70,0x44,108}, /* 0x19 */ + { 0x70,0x44,108}, /* 0x19 */ { 0x3c,0x23,109}, /* 0x1a */ { 0x5e,0x43,113}, /* 0x1b */ { 0xbc,0x44,116}, /* 0x1c */ @@ -658,49 +644,51 @@ static const SiS310_VCLKDataStruct SiS310_VCLKData[]= { 0xea,0x08,340}, /* 0x37 */ { 0xe8,0x07,376}, /* 0x38 */ { 0xde,0x06,389}, /* 0x39 */ - { 0x52,0x2a, 54}, /* 0x3a */ /* 301 TV */ - { 0x52,0x6a, 27}, /* 0x3b */ /* 301 TV */ - { 0x62,0x24, 70}, /* 0x3c */ /* 301 TV */ - { 0x62,0x64, 70}, /* 0x3d */ /* 301 TV */ - { 0xa8,0x4c, 30}, /* 0x3e */ /* 301 TV */ - { 0x20,0x26, 33}, /* 0x3f */ /* 301 TV */ + { 0x52,0x2a, 54}, /* 0x3a 301 TV */ + { 0x52,0x6a, 27}, /* 0x3b 301 TV */ + { 0x62,0x24, 70}, /* 0x3c 301 TV */ + { 0x62,0x64, 70}, /* 0x3d 301 TV */ + { 0xa8,0x4c, 30}, /* 0x3e 301 TV */ + { 0x20,0x26, 33}, /* 0x3f 301 TV */ { 0x31,0xc2, 39}, /* 0x40 */ - { 0x60,0x36, 30}, /* 0x41 */ /* Chrontel */ - { 0x40,0x4a, 28}, /* 0x42 */ /* Chrontel */ - { 0x9f,0x46, 44}, /* 0x43 */ /* Chrontel */ + { 0x60,0x36, 30}, /* 0x41 Chrontel */ + { 0x40,0x4a, 28}, /* 0x42 Chrontel */ + { 0x9f,0x46, 44}, /* 0x43 Chrontel */ { 0x97,0x2c, 26}, /* 0x44 */ - { 0x44,0xe4, 25}, /* 0x45 */ /* Chrontel */ - { 0x7e,0x32, 47}, /* 0x46 */ /* Chrontel */ - { 0x8a,0x24, 31}, /* 0x47 */ /* Chrontel */ - { 0x97,0x2c, 26}, /* 0x48 */ /* Chrontel */ + { 0x44,0xe4, 25}, /* 0x45 Chrontel */ + { 0x7e,0x32, 47}, /* 0x46 Chrontel */ + { 0x8a,0x24, 31}, /* 0x47 Chrontel */ + { 0x97,0x2c, 26}, /* 0x48 Chrontel */ { 0xce,0x3c, 39}, /* 0x49 */ - { 0x52,0x4a, 36}, /* 0x4a */ /* Chrontel */ + { 0x52,0x4a, 36}, /* 0x4a Chrontel */ { 0x34,0x61, 95}, /* 0x4b */ { 0x78,0x27,108}, /* 0x4c - was 102 */ - { 0x66,0x43,123}, /* 0x4d */ /* Modes 0x26-0x28 (1400x1050) */ + { 0x66,0x43,123}, /* 0x4d Modes 0x26-0x28 (1400x1050) */ { 0x41,0x4e, 21}, /* 0x4e */ - { 0xa1,0x4a, 29}, /* 0x4f */ /* Chrontel */ + { 0xa1,0x4a, 29}, /* 0x4f Chrontel */ { 0x19,0x42, 42}, /* 0x50 */ - { 0x54,0x46, 58}, /* 0x51 */ /* Chrontel */ + { 0x54,0x46, 58}, /* 0x51 Chrontel */ { 0x25,0x42, 61}, /* 0x52 */ - { 0x44,0x44, 66}, /* 0x53 */ /* Chrontel */ - { 0x3a,0x62, 70}, /* 0x54 */ /* Chrontel */ - { 0x62,0xc6, 34}, /* 0x55 - added for 848x480-60 (not in any BIOS) */ - { 0x6a,0xc6, 37}, /* 0x56 - added for 848x480-75 (not in any BIOS) - TEMP */ - { 0xbf,0xc8, 35}, /* 0x57 - added for 856x480-38i,60 (not in any BIOS) */ - { 0x30,0x23, 88}, /* 0x58 - added for 1360x768-62 (is 60Hz!) (not in any BIOS) */ - { 0x52,0x07,149}, /* 0x59 - added for 1280x960-85 (Not in any BIOS) */ - { 0x56,0x07,156}, /* 0x5a - added for 1400x1050-75 */ - { 0x70,0x29, 81} /* 0x5b - added for 1280x768 LCD */ -}; - -typedef struct _SiS310_VBVCLKDataStruct -{ - UCHAR Part4_A,Part4_B; - USHORT CLOCK; -} SiS310_VBVCLKDataStruct; - -static const SiS310_VBVCLKDataStruct SiS310_VBVCLKData[]= + { 0x44,0x44, 66}, /* 0x53 Chrontel */ + { 0x3a,0x62, 70}, /* 0x54 Chrontel */ + { 0x62,0xc6, 34}, /* 0x55 848x480-60 */ + { 0x6a,0xc6, 37}, /* 0x56 848x480-75 - TEMP */ + { 0xbf,0xc8, 35}, /* 0x57 856x480-38i,60 */ + { 0x30,0x23, 88}, /* 0x58 1360x768-62 (is 60Hz!) */ + { 0x52,0x07,149}, /* 0x59 1280x960-85 */ + { 0x56,0x07,156}, /* 0x5a 1400x1050-75 */ + { 0x70,0x29, 81}, /* 0x5b 1280x768 LCD */ + { 0x45,0x25, 83}, /* 0x5c 1280x800 */ + { 0x70,0x0a,147}, /* 0x5d 1680x1050 */ + { 0x70,0x24,162}, /* 0x5e 1600x1200 */ + { 0x5a,0x64, 65}, /* 0x5f 1280x720 - temp */ + { 0x63,0x46, 68}, /* 0x60 1280x768_2 */ + { 0x31,0x42, 79}, /* 0x61 1280x768_3 - temp */ + { 0, 0, 0}, /* 0x62 - custom (will be filled out at run-time) */ + { 0x5a,0x64, 65} /* 0x63 1280x720 (LCD LVDS) */ +}; + +static SiS_VBVCLKDataStruct SiS310_VBVCLKData[]= { { 0x1b,0xe1, 25}, /* 0x00 */ { 0x4e,0xe4, 28}, /* 0x01 */ @@ -713,7 +701,7 @@ static const SiS310_VBVCLKDataStruct SiS310_VBVCLKData[]= { 0x53,0x47, 50}, /* 0x08 */ { 0x74,0x67, 52}, /* 0x09 */ { 0x6d,0x66, 56}, /* 0x0a */ - { 0x35,0x62, 65}, /* 0x0b */ /* Was 0x5a,0x64 - 650/LVDS+301 bios: 35,62 */ + { 0x35,0x62, 65}, /* 0x0b */ /* Was 0x5a,0x64 - 650/LVDS+301: 35,62 */ { 0x46,0x44, 67}, /* 0x0c */ { 0xb1,0x46, 68}, /* 0x0d */ { 0xd3,0x4a, 72}, /* 0x0e */ @@ -766,47 +754,48 @@ static const SiS310_VBVCLKDataStruct SiS310_VBVCLKData[]= { 0xea,0x08,340}, /* 0x37 */ { 0xe8,0x07,376}, /* 0x38 */ { 0xde,0x06,389}, /* 0x39 */ - { 0x52,0x2a, 54}, /* 0x3a */ /* 301 TV */ - { 0x52,0x6a, 27}, /* 0x3b */ /* 301 TV */ - { 0x62,0x24, 70}, /* 0x3c */ /* 301 TV */ - { 0x62,0x64, 70}, /* 0x3d */ /* 301 TV */ - { 0xa8,0x4c, 30}, /* 0x3e */ /* 301 TV */ - { 0x20,0x26, 33}, /* 0x3f */ /* 301 TV */ + { 0x52,0x2a, 54}, /* 0x3a 301 TV - start */ + { 0x52,0x6a, 27}, /* 0x3b 301 TV */ + { 0x62,0x24, 70}, /* 0x3c 301 TV */ + { 0x62,0x64, 70}, /* 0x3d 301 TV */ + { 0xa8,0x4c, 30}, /* 0x3e 301 TV */ + { 0x20,0x26, 33}, /* 0x3f 301 TV */ { 0x31,0xc2, 39}, /* 0x40 */ - { 0x2e,0x48, 25}, /* 0x41 */ /* Replacement for LCD on 315 for index 0 */ - { 0x24,0x46, 25}, /* 0x42 */ /* Replacement for LCD on 315 for modes 0x01, 0x03, 0x0f, 0x10, 0x12 */ - { 0x26,0x64, 28}, /* 0x43 */ /* Replacement for LCD on 315 for index 1 */ - { 0x37,0x64, 40}, /* 0x44 */ /* Replacement for LCD on 315 for index 4 */ - { 0xa1,0x42,108}, /* 0x45 */ /* 1280x960 LCD */ - { 0x37,0x61,100}, /* 0x46 */ /* 1280x960 LCD */ + { 0x2e,0x48, 25}, /* 0x41 Replacement for LCD on 315 for index 0 */ + { 0x24,0x46, 25}, /* 0x42 Replacement for LCD on 315 for modes 0x01, 0x03, 0x0f, 0x10, 0x12 */ + { 0x26,0x64, 28}, /* 0x43 Replacement for LCD on 315 for index 1 */ + { 0x37,0x64, 40}, /* 0x44 Replacement for LCD on 315 for index 4 */ + { 0xa1,0x42,108}, /* 0x45 1280x960 LCD */ + { 0x37,0x61,100}, /* 0x46 1280x960 LCD */ { 0x78,0x27,108}, /* 0x47 */ - { 0x97,0x2c, 26}, /* 0x48 */ /* UNUSED - Entries from here new, not in any BIOS */ - { 0xce,0x3c, 39}, /* 0x49 */ /* UNUSED */ - { 0x52,0x4a, 36}, /* 0x4a */ /* UNUSED */ - { 0x34,0x61, 95}, /* 0x4b */ /* UNUSED */ - { 0x78,0x27,108}, /* 0x4c */ /* UNUSED */ - { 0x66,0x43,123}, /* 0x4d */ /* 1400x1050-60 */ - { 0x41,0x4e, 21}, /* 0x4e */ /* UNUSED */ - { 0xa1,0x4a, 29}, /* 0x4f */ /* UNUSED */ - { 0x19,0x42, 42}, /* 0x50 */ /* UNUSED */ - { 0x54,0x46, 58}, /* 0x51 */ /* UNUSED */ - { 0x25,0x42, 61}, /* 0x52 */ /* UNUSED */ - { 0x44,0x44, 66}, /* 0x53 */ /* UNUSED */ - { 0x3a,0x62, 70}, /* 0x54 */ /* UNUSED */ - { 0x62,0xc6, 34}, /* 0x55 */ /* 848x480-60 */ - { 0x6a,0xc6, 37}, /* 0x56 */ /* 848x480-75 - TEMP, UNUSED */ - { 0xbf,0xc8, 35}, /* 0x57 */ /* 856x480-38i,60 */ - { 0x30,0x23, 88}, /* 0x58 */ /* 1360x768-62 (is 60Hz!) TEMP, UNUSED */ - { 0x52,0x07,149}, /* 0x59 */ /* 1280x960-85 */ - { 0x56,0x07,156}, /* 0x5a */ /* 1400x1050-75 */ - { 0x70,0x29, 81} /* 0x5b */ /* 1280x768 LCD */ -}; - -static const UCHAR SiS310_ScreenOffset[] = -{ - 0x14,0x19,0x20,0x28,0x32,0x40,0x50,0x64, - 0x78,0x80,0x2d,0x35,0x57,0x48,0x55,0x30, - 0xff + { 0x97,0x2c, 26}, /* 0x48 UNUSED */ + { 0xce,0x3c, 39}, /* 0x49 UNUSED */ + { 0x52,0x4a, 36}, /* 0x4a UNUSED */ + { 0x34,0x61, 95}, /* 0x4b UNUSED */ + { 0x78,0x27,108}, /* 0x4c UNUSED */ + { 0x66,0x43,123}, /* 0x4d 1400x1050-60 */ + { 0x41,0x4e, 21}, /* 0x4e UNUSED */ + { 0xa1,0x4a, 29}, /* 0x4f UNUSED */ + { 0x19,0x42, 42}, /* 0x50 UNUSED */ + { 0x54,0x46, 58}, /* 0x51 UNUSED */ + { 0x25,0x42, 61}, /* 0x52 UNUSED */ + { 0x44,0x44, 66}, /* 0x53 UNUSED */ + { 0x3a,0x62, 70}, /* 0x54 UNUSED */ + { 0x62,0xc6, 34}, /* 0x55 848x480-60 */ + { 0x6a,0xc6, 37}, /* 0x56 848x480-75 - TEMP, UNUSED */ + { 0xbf,0xc8, 35}, /* 0x57 856x480-38i,60 */ + { 0x30,0x23, 88}, /* 0x58 1360x768-62 (is 60Hz!) TEMP, UNUSED */ + { 0x52,0x07,149}, /* 0x59 1280x960-85 */ + { 0x56,0x07,156}, /* 0x5a 1400x1050-75 */ + { 0x70,0x29, 81}, /* 0x5b 1280x768 LCD */ + { 0x9c,0x62, 69}, /* 0x5c 1280x800 LCD - wrong? */ + { 0xbe,0x44,121}, /* 0x5d 1680x1050 LCD */ + { 0x70,0x24,162}, /* 0x5e 1600x1200 LCD */ + { 0x52,0x27, 75}, /* 0x5f 1280x720 LCD TMDS + HDTV (correct) */ + { 0x63,0x46, 68}, /* 0x60 1280x768_2 */ + { 0x31,0x42, 79}, /* 0x61 1280x768_3 - temp */ + { 0, 0, 0}, /* 0x62 - custom (will be filled out at run-time) */ + { 0x5a,0x64, 65} /* 0x63 1280x720 (LCD LVDS) */ }; static const DRAM4Type SiS310_SR15[8] = { @@ -854,12 +843,7 @@ static const USHORT SiS310_VideoSenseData2 = 0x0174; static const USHORT SiS310_YCSenseData2 = 0x016b; #endif -typedef struct _SiS310_PanelDelayTblStruct -{ - UCHAR timer[2]; -} SiS310_PanelDelayTblStruct; - -static const SiS310_PanelDelayTblStruct SiS310_PanelDelayTbl[]= +static const SiS_PanelDelayTblStruct SiS310_PanelDelayTbl[]= { {{0x10,0x40}}, {{0x10,0x40}}, @@ -879,7 +863,7 @@ static const SiS310_PanelDelayTblStruct SiS310_PanelDelayTbl[]= {{0x10,0x40}} }; -static const SiS310_PanelDelayTblStruct SiS310_PanelDelayTblLVDS[]= +static const SiS_PanelDelayTblStruct SiS310_PanelDelayTblLVDS[]= { {{0x28,0xc8}}, {{0x28,0xc8}}, @@ -903,28 +887,18 @@ static const SiS310_PanelDelayTblStruct SiS310_PanelDelayTblLVDS[]= /* SIS VIDEO BRIDGE ----------------------------------------- */ /**************************************************************/ -typedef struct _SiS310_LCDDataStruct -{ - USHORT RVBHCMAX; - USHORT RVBHCFACT; - USHORT VGAHT; - USHORT VGAVT; - USHORT LCDHT; - USHORT LCDVT; -} SiS310_LCDDataStruct; - -static const SiS310_LCDDataStruct SiS310_StLCD1024x768Data[]= +static const SiS_LCDDataStruct SiS310_St2LCD1024x768Data[] = { { 62, 25, 800, 546,1344, 806}, { 32, 15, 930, 546,1344, 806}, - { 32, 15, 930, 546,1344, 806}, + { 62, 25, 800, 546,1344, 806}, { 104, 45, 945, 496,1344, 806}, { 62, 25, 800, 546,1344, 806}, { 31, 18,1008, 624,1344, 806}, { 1, 1,1344, 806,1344, 806} }; -static const SiS310_LCDDataStruct SiS310_ExtLCD1024x768Data[] = +static const SiS_LCDDataStruct SiS310_ExtLCD1024x768Data[] = { { 42, 25,1536, 419,1344, 806}, { 48, 25,1536, 369,1344, 806}, @@ -932,28 +906,10 @@ static const SiS310_LCDDataStruct SiS310_ExtLCD1024x768Data[] = { 48, 25,1536, 369,1344, 806}, { 12, 5, 896, 500,1344, 806}, { 42, 25,1024, 625,1344, 806}, - { 1, 1,1344, 806,1344, 806}, - { 12, 5, 896, 500,1344, 806}, - { 42, 25,1024, 625,1344, 806}, - { 1, 1,1344, 806,1344, 806}, - { 12, 5, 896, 500,1344, 806}, - { 42, 25,1024, 625,1344, 806}, - { 1, 1,1344, 806,1344, 806} - -}; - -static const SiS310_LCDDataStruct SiS310_St2LCD1024x768Data[] = -{ - { 62, 25, 800, 546,1344, 806}, - { 32, 15, 930, 546,1344, 806}, - { 62, 25, 800, 546,1344, 806}, - { 104, 45, 945, 496,1344, 806}, - { 62, 25, 800, 546,1344, 806}, - { 31, 18,1008, 624,1344, 806}, { 1, 1,1344, 806,1344, 806} }; -static const SiS310_LCDDataStruct SiS310_StLCD1280x1024Data[] = +static const SiS_LCDDataStruct SiS310_St2LCD1280x1024Data[] = { { 22, 5, 800, 510,1650,1088}, { 22, 5, 800, 510,1650,1088}, @@ -965,7 +921,7 @@ static const SiS310_LCDDataStruct SiS310_StLCD1280x1024Data[] = { 1, 1,1688,1066,1688,1066} }; -static const SiS310_LCDDataStruct SiS310_ExtLCD1280x1024Data[] = +static const SiS_LCDDataStruct SiS310_ExtLCD1280x1024Data[] = { { 211, 60,1024, 501,1688,1066}, { 211, 60,1024, 508,1688,1066}, @@ -974,53 +930,10 @@ static const SiS310_LCDDataStruct SiS310_ExtLCD1280x1024Data[] = { 211, 60,1024, 500,1688,1066}, { 211, 75,1024, 625,1688,1066}, { 211, 120,1280, 798,1688,1066}, - { 1, 1,1688,1066,1688,1066}, - { 1, 1,1800,1000,1688,1066} /* 1280x960 - does not work, use panel scaler instead */ -}; - -static const SiS310_LCDDataStruct SiS310_St2LCD1280x1024Data[] = -{ - { 22, 5, 800, 510,1650,1088}, - { 22, 5, 800, 510,1650,1088}, - { 176, 45, 900, 510,1650,1088}, - { 176, 45, 900, 510,1650,1088}, - { 22, 5, 800, 510,1650,1088}, - { 13, 5,1024, 675,1560,1152}, - { 16, 9,1266, 804,1688,1072}, { 1, 1,1688,1066,1688,1066} }; -static const SiS310_LCDDataStruct SiS310_NoScaleData1024x768[] = -{ - { 1, 1,1344, 806,1344, 806}, - { 1, 1,1344, 806,1344, 806}, - { 1, 1,1344, 806,1344, 806}, - { 1, 1,1344, 806,1344, 806}, /* 640x400 - does not work */ - { 1, 1,1344, 806,1344, 806}, /* 640x480 - does not work */ - { 1, 1,1344, 806,1344, 806}, - { 1, 1,1344, 806,1344, 806}, - { 1, 1,1344, 806,1344, 806} -}; - -static const SiS310_LCDDataStruct SiS310_NoScaleData1280x1024[] = -{ - { 1, 1,1688,1066,1688,1066}, - { 1, 1,1688,1066,1688,1066}, - { 1, 1,1688,1066,1688,1066}, - { 1, 1,1688,1066,1688,1066}, - { 1, 1,1688,1066,1688,1066}, - { 1, 1,1688,1066,1688,1066}, - { 1, 1,1688,1066,1688,1066}, - { 1, 1,1688,1066,1688,1066}, - { 1, 1,1688,1066,1688,1066} -}; - -typedef struct _SiS310_Part2PortTblStruct -{ - UCHAR CR[12]; -} SiS310_Part2PortTblStruct; - -static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1024x768_1[] = +static const SiS_Part2PortTblStruct SiS310_CRT2Part2_1024x768_1[] = { {{0x25,0x12,0xc9,0xdc,0xb6,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, {{0x2c,0x12,0x9a,0xae,0x88,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, @@ -1028,646 +941,37 @@ static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1024x768_1[] = {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, {{0x38,0x13,0x16,0x0c,0xe6,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, {{0x38,0x18,0x16,0x00,0x00,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x36,0x13,0x13,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x25,0x12,0xc9,0xdc,0xb6,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}} + {{0x36,0x13,0x13,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}} }; -static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1024x768_2[] = -{ - {{0x25,0x12,0x51,0x6e,0x48,0x99,0x35,0x89,0x47,0xc1,0x49,0x33}}, - {{0x2c,0x12,0x38,0x55,0x2f,0x99,0x35,0x89,0x47,0xc1,0x49,0x33}}, - {{0x25,0x12,0x51,0x6e,0x48,0x99,0x35,0x89,0x47,0xc1,0x49,0x33}}, - {{0x2c,0x12,0x38,0x55,0x2f,0xc1,0x35,0xb1,0x47,0xe9,0x71,0x33}}, - {{0x2d,0x12,0x79,0x96,0x70,0x99,0x35,0x89,0x47,0xc1,0x49,0x33}}, - {{0x29,0x12,0xb5,0xd2,0xac,0xe9,0x35,0xd9,0x47,0x11,0x99,0x33}}, - {{0x36,0x13,0x13,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, /* others */ -/* 0x36,0x13,0x02,0x25,0xff,0x03,0x45,0x09,0x07,0xf9,0x00,0x24 my */ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} -}; +/* *** LCDA *** */ -static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1024x768_3[] = -{ -#if 1 /* Data from 650/301LVx 1.10.6s and others */ - {{0x25,0x13,0xc9,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x2c,0x13,0x9a,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x25,0x13,0xc9,0x24,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x38,0x13,0x13,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x38,0x18,0x16,0x00,0x00,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x36,0x13,0x13,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x25,0x13,0xc9,0x25,0xff,0xf9,0x45,0x09,0x07,0xf9,0x09,0x24}} +#if 0 +static const SiS_LVDSDataStruct SiS_LCDA1600x1200Data_1[]= +{ /* Clevo, 651+301C */ + {1200, 450, 2048,1250}, + {1200, 400, 2048,1250}, + {1280, 450, 2048,1250}, + {1280, 400, 2048,1250}, + {1200, 530, 2048,1250}, + {1360, 650, 2048,1250}, + {1584, 818, 2048,1250}, + {1688,1066, 2048,1250}, + {1688,1066, 2048,1250}, +#if 0 + {2048,1250, 2048,1250} /* this should be correct */ #endif -#if 0 /* Data from my 301LV */ - {{0x36,0x13,0x02,0x25,0xff,0x21,0x45,0x09,0x07,0x88,0x09,0x24}}, /* TEST */ - {{0x36,0x13,0x02,0x25,0xff,0x21,0x45,0x09,0x07,0x88,0x09,0x24}}, - {{0x36,0x13,0x02,0x25,0xff,0x21,0x45,0x09,0x07,0x88,0x09,0x24}}, - {{0x36,0x13,0x02,0x25,0xff,0x21,0x45,0x09,0x07,0x88,0x09,0x24}}, - {{0x36,0x13,0x02,0x25,0xff,0x21,0x45,0x09,0x07,0x88,0x09,0x24}}, - {{0x36,0x13,0x02,0x25,0xff,0x21,0x45,0x09,0x07,0x88,0x09,0x24}}, - {{0x36,0x13,0x02,0x25,0xff,0x21,0x45,0x09,0x07,0x88,0x09,0x24}}, - {{0x36,0x13,0x02,0x25,0xff,0x21,0x45,0x09,0x07,0x88,0x09,0x24}}, - {{0x36,0x13,0x02,0x25,0xff,0x21,0x45,0x09,0x07,0x88,0x09,0x24}} +#if 1 + {2160,1250, 2048,1250} /* ? */ #endif }; - -static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1280x1024_1[] = -{ /* Acer; BIOS data invalid, last row taken from _3 */ - {{0x25,0x12,0x51,0x6E,0x48,0x99,0x35,0x89,0x47,0xC1,0x49,0x33}}, - {{0x2C,0x12,0x38,0x55,0x2F,0x99,0x35,0x89,0x47,0xC1,0x49,0x33}}, - {{0x25,0x12,0x51,0x6E,0x48,0x99,0x35,0x89,0x47,0xC1,0x49,0x33}}, - {{0x2C,0x12,0x38,0x55,0x2F,0xC1,0x35,0xB1,0x47,0xE9,0x71,0x33}}, - {{0x2D,0x12,0x79,0x96,0x70,0x99,0x35,0x89,0x47,0xC1,0x49,0x33}}, - {{0x29,0x12,0xB5,0xD2,0xAC,0xE9,0x35,0xD9,0x47,0x11,0x99,0x33}}, - {{0x36,0x13,0x02,0x25,0xFF,0x03,0x45,0x09,0x07,0xF9,0x00,0x24}}, - {{0x47,0x1C,0x14,0x29,0xFF,0xBD,0x23,0x0A,0x07,0x23,0x8A,0x12}} -}; - -static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1280x1024_2[] = -{ /* Acer */ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} -}; - -/* 1 2 4 5 6 1c 1d 1f 20 21 23 25 */ -static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1280x1024_3[] = -{ /* Acer */ - {{0x31,0x1B,0xC4,0xDA,0xB0,0xBD,0x23,0x0A,0x07,0x23,0x8A,0x12}}, - {{0x34,0x1B,0x9F,0xC0,0x80,0xB8,0x23,0x0A,0x07,0x14,0x8A,0x12}}, - {{0x3E,0x1B,0xCF,0xF0,0xB0,0xB8,0x23,0x0A,0x07,0x14,0x8A,0x12}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x48,0x1C,0x15,0x29,0xFF,0xBD,0x23,0x0A,0x07,0x23,0x8A,0x12}}, - {{0x48,0x1C,0x15,0x29,0xFF,0xBD,0x23,0x0A,0x07,0x23,0x8A,0x12}}, - {{0x48,0x1C,0x15,0x29,0xFF,0xBD,0x23,0x0A,0x07,0x23,0x8A,0x12}}, - {{0x47,0x1C,0x14,0x29,0xFF,0xBD,0x23,0x0A,0x07,0x23,0x8A,0x12}} -}; - -static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1400x1050_1[] = -{ - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}} -}; - -static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1400x1050_2[] = -{ - {{0x2b,0x12,0xd9,0xe5,0xd5,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, - {{0x22,0x12,0xc0,0xcc,0xbc,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, - {{0x2b,0x12,0xd9,0xe5,0xd5,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, - {{0x22,0x12,0xc0,0xcc,0xbc,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, - {{0x33,0x13,0x01,0x0d,0xfd,0x2c,0x23,0x98,0x27,0x3e,0x08,0x42}}, - {{0x3f,0x1b,0x3d,0x49,0x39,0x54,0x23,0xc0,0x27,0x66,0x30,0x42}}, - {{0x33,0x1b,0x91,0x9d,0x8d,0x8c,0x23,0xf8,0x27,0x9e,0x68,0x42}}, - {{0x43,0x24,0x11,0x1d,0x0d,0xcc,0x23,0x38,0x37,0xde,0xa8,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}} -}; - -static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1400x1050_3[] = -{ - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}}, - {{0x43,0x24,0x21,0x29,0x19,0xea,0x23,0x0a,0x07,0x32,0xc6,0x32}} -}; - -static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1600x1200_1[] = -{ - {{0x4C,0x24,0xC8,0xE1,0xAF,0x70,0x34,0x0A,0x07,0xFC,0x2A,0x53}}, - {{0x4C,0x24,0xC8,0xE1,0xAF,0x70,0x34,0x0A,0x07,0xFC,0x2A,0x53}}, - {{0x4C,0x24,0xC8,0xE1,0xAF,0x70,0x34,0x0A,0x07,0xFC,0x2A,0x53}}, - {{0x4C,0x24,0xC8,0xE1,0xAF,0x70,0x34,0x0A,0x07,0xFC,0x2A,0x53}}, - {{0x4C,0x24,0xC8,0xE1,0xAF,0x70,0x34,0x0A,0x07,0xFC,0x2A,0x53}}, - {{0x4C,0x24,0xC8,0xE1,0xAF,0x70,0x34,0x0A,0x07,0xFC,0x2A,0x53}}, - {{0x4C,0x24,0xC8,0xE1,0xAF,0x70,0x34,0x0A,0x07,0xFC,0x2A,0x53}}, - {{0x4C,0x24,0xC8,0xE1,0xAF,0x70,0x34,0x0A,0x07,0xFC,0x2A,0x53}}, - {{0x4C,0x24,0xC8,0xE1,0xAF,0x70,0x34,0x0A,0x07,0xFC,0x2A,0x53}}, - {{0x4C,0x24,0xC8,0xE1,0xAF,0x70,0x34,0x0A,0x07,0xFC,0x2A,0x53}} -}; - -static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1600x1200_2[] = -{ - {{0x32,0x1B,0x2C,0x52,0x20,0x80,0x20,0x52,0x30,0xA3,0x3A,0x02}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x32,0x1B,0x2C,0x52,0x20,0x80,0x20,0x52,0x30,0xA3,0x3A,0x02}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x3A,0x1B,0x54,0x7A,0x48,0x80,0x24,0x52,0x30,0xA3,0x3A,0x02}}, - {{0x36,0x1B,0x90,0xB6,0x84,0xA8,0x24,0x7A,0x30,0xCB,0x62,0x02}}, - {{0x3A,0x1C,0xE4,0x0A,0xD8,0xE0,0x24,0xB2,0x30,0x03,0x9A,0x02}}, - {{0x4A,0x24,0x64,0x8A,0x58,0x20,0x34,0xF2,0x30,0x43,0xDA,0x52}}, - {{0x47,0x24,0x71,0x97,0x65,0x3E,0x34,0x10,0x40,0x61,0xF8,0x02}}, - {{0x4C,0x24,0xC8,0xE1,0xAF,0x70,0x34,0x0A,0x07,0xFC,0x2A,0x53}} -}; - -static const SiS310_Part2PortTblStruct SiS310_CRT2Part2_1600x1200_3[] = -{ - {{0x4C,0x24,0xC8,0xE1,0xAF,0x70,0x34,0x0A,0x07,0xFC,0x2A,0x53}}, - {{0x4C,0x24,0xC8,0xE1,0xAF,0x70,0x34,0x0A,0x07,0xFC,0x2A,0x53}}, - {{0x4C,0x24,0xC8,0xE1,0xAF,0x70,0x34,0x0A,0x07,0xFC,0x2A,0x53}}, - {{0x4C,0x24,0xC8,0xE1,0xAF,0x70,0x34,0x0A,0x07,0xFC,0x2A,0x53}}, - {{0x4C,0x24,0xC8,0xE1,0xAF,0x70,0x34,0x0A,0x07,0xFC,0x2A,0x53}}, - {{0x4C,0x24,0xC8,0xE1,0xAF,0x70,0x34,0x0A,0x07,0xFC,0x2A,0x53}}, - {{0x4C,0x24,0xC8,0xE1,0xAF,0x70,0x34,0x0A,0x07,0xFC,0x2A,0x53}}, - {{0x4C,0x24,0xC8,0xE1,0xAF,0x70,0x34,0x0A,0x07,0xFC,0x2A,0x53}}, - {{0x4C,0x24,0xC8,0xE1,0xAF,0x70,0x34,0x0A,0x07,0xFC,0x2A,0x53}}, - {{0x4C,0x24,0xC8,0xE1,0xAF,0x70,0x34,0x0A,0x07,0xFC,0x2A,0x53}} -}; - -/* CRT1 CRTC for LCDA */ - -typedef struct _SiS310_LCDACRT1DataStruct -{ - UCHAR CR[17]; -}SiS310_LCDACRT1DataStruct; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_1[]= -{ - {{0x73,0x4f,0x4f,0x97,0x59,0x84,0xb4,0x1f, - 0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x05, - 0x00}}, - {{0x73,0x4f,0x4f,0x97,0x59,0x84,0x82,0x1f, - 0x60,0x87,0x5d,0x5d,0x83,0x10,0x00,0x05, - 0x00}}, - {{0x73,0x4f,0x4f,0x97,0x59,0x84,0xb4,0x1f, - 0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x05, - 0x00}}, - {{0x73,0x4f,0x4f,0x97,0x59,0x84,0x82,0x1f, - 0x60,0x87,0x5d,0x5d,0x83,0x10,0x00,0x05, - 0x00}}, - {{0x73,0x4f,0x4f,0x97,0x59,0x84,0x04,0x3e, - 0xE2,0x89,0xdf,0xdf,0x05,0x00,0x00,0x05, - 0x00}}, - {{0x87,0x63,0x63,0x8B,0x6D,0x18,0x7c,0xf0, - 0x5A,0x81,0x57,0x57,0x7D,0x00,0x00,0x06, - 0x01}}, - {{0xA3,0x7f,0x7f,0x87,0x89,0x94,0x24,0xf5, - 0x02,0x89,0xff,0xff,0x25,0x10,0x00,0x02, - 0x01}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_1_H[]= -{ - {{0x4b,0x27,0x27,0x8f,0x31,0x1c,0xb4,0x1f, - 0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x05, - 0x00}}, - {{0x4b,0x27,0x27,0x8f,0x31,0x1c,0x82,0x1f, - 0x60,0x87,0x5D,0x5D,0x83,0x10,0x00,0x05, - 0x00}}, - {{0x4b,0x27,0x27,0x8f,0x31,0x1c,0xb4,0x1f, - 0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x05, - 0x00}}, - {{0x4b,0x27,0x27,0x8f,0x31,0x1c,0x82,0x1f, - 0x60,0x87,0x5D,0x5D,0x83,0x10,0x00,0x05, - 0x00}}, - {{0x4b,0x27,0x27,0x8f,0x31,0x1c,0x04,0x3e, - 0xE2,0x89,0xDf,0xDf,0x05,0x00,0x00,0x05, - 0x00}}, - {{0x55,0x31,0x31,0x99,0x3b,0x06,0x7c,0xf0, - 0x5A,0x81,0x57,0x57,0x7D,0x00,0x00,0x01, - 0x01}}, - {{0x63,0x3F,0x3F,0x87,0x49,0x94,0x24,0xF5, - 0x02,0x89,0xFF,0xFF,0x25,0x10,0x00,0x01, - 0x01}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_2[]= -{ - {{0xa3,0x4f,0x4f,0x0f,0x6e,0x1f,0x24,0xbb, - 0x4a,0x81,0x8f,0xdb,0xda,0x20,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x4f,0x0f,0x6e,0x1f,0x24,0xbb, - 0x31,0x88,0x5d,0xc2,0xc1,0x20,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x4f,0x0f,0x6e,0x1f,0x24,0xbb, - 0x4a,0x81,0x8f,0xdb,0xda,0x20,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x4f,0x0f,0x6e,0x1f,0x24,0xbb, - 0x31,0x88,0x5d,0xc2,0xc1,0x20,0x00,0x06, - 0x01}}, - {{0xa3,0x4f,0x4f,0x0f,0x6e,0x1f,0x24,0xb3, - 0x72,0x89,0xdf,0x03,0x02,0x30,0x00,0x06, - 0x01}}, - {{0xa3,0x63,0x63,0x98,0x78,0x19,0x24,0xf1, - 0xbb,0x82,0x57,0x57,0x25,0x10,0x00,0x02, - 0x01}}, - {{0xa3,0x7f,0x7f,0x87,0x89,0x94,0x24,0xf5, - 0x02,0x89,0xff,0xff,0x25,0x10,0x00,0x02, - 0x01}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11024x768_2_H[]= -{ - {{0x7b,0x27,0x27,0x0f,0x46,0x97,0x24,0xbb, - 0x4a,0x81,0x8f,0xdb,0xda,0x20,0x00,0x01, - 0x00 }}, - {{0x7b,0x27,0x27,0x0f,0x46,0x97,0x24,0xbb, - 0x31,0x88,0x5d,0xc2,0xc1,0x20,0x00,0x01, - 0x00 }}, - {{0x7b,0x27,0x27,0x0f,0x46,0x97,0x24,0xbb, - 0x4a,0x81,0x8f,0xdb,0xda,0x20,0x00,0x01, - 0x00 }}, - {{0x7b,0x27,0x27,0x0f,0x46,0x97,0x24,0xbb, - 0x31,0x88,0x5d,0xc2,0xc1,0x20,0x00,0x01, - 0x00 }}, - {{0x7b,0x27,0x27,0x0f,0x46,0x97,0x24,0xb3, - 0x72,0x89,0xdf,0x03,0x02,0x30,0x00,0x01, - 0x01 }}, - {{0x71,0x31,0x31,0x98,0x46,0x17,0x24,0xf1, - 0xbb,0x82,0x57,0x57,0x25,0x10,0x00,0x02, - 0x01 }}, - {{0x63,0x3f,0x3f,0x87,0x4c,0x97,0x24,0xf5, - 0x0f,0x86,0xff,0xff,0x25,0x30,0x00,0x01, - 0x01 }} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11280x1024_1[]= -{ /* Acer */ - {{0x7e,0x4f,0x4f,0x82,0x58,0x04,0xb8,0x1f, - 0x90,0x84,0x8f,0x8f,0xb9,0x30,0x00,0x06, - 0x00}}, - {{0x7e,0x4f,0x4f,0x82,0x58,0x04,0x86,0x1f, - 0x5e,0x82,0x5d,0x5d,0x87,0x10,0x00,0x06, - 0x00}}, - {{0x7e,0x4f,0x4f,0x82,0x58,0x04,0xb8,0x1f, - 0x90,0x84,0x8f,0x8f,0xb9,0x30,0x00,0x06, - 0x00}}, - {{0x7e,0x4f,0x4f,0x82,0x58,0x04,0x86,0x1f, - 0x5e,0x82,0x5d,0x5d,0x87,0x10,0x00,0x06, - 0x00}}, - {{0x7e,0x4f,0x4f,0x82,0x58,0x04,0x08,0x3e, - 0xe0,0x84,0xdf,0xdf,0x09,0x00,0x00,0x06, - 0x00}}, - {{0x92,0x63,0x63,0x96,0x6c,0x18,0x80,0xf0, - 0x58,0x8c,0x57,0x57,0x81,0x20,0x00,0x06, - 0x01}}, - {{0xae,0x7f,0x7f,0x92,0x88,0x94,0x28,0xf5, - 0x00,0x84,0xff,0xff,0x29,0x10,0x00,0x02, - 0x01}}, - {{0xce,0x9f,0x9f,0x92,0xa8,0x14,0x28,0x5a, - 0x00,0x84,0xff,0xff,0x29,0x01,0x00,0x07, - 0x01}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11280x1024_1_H[]= -{ /* Acer */ - {{0x56,0x27,0x27,0x9a,0x31,0x1c,0xb8,0x1f, - 0x90,0x84,0x8f,0x8f,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x56,0x27,0x27,0x9a,0x31,0x1c,0x86,0x1f, - 0x5e,0x82,0x5d,0x5d,0x87,0x10,0x00,0x05, - 0x00}}, - {{0x56,0x27,0x27,0x9a,0x31,0x1c,0xb8,0x1f, - 0x90,0x84,0x8f,0x8f,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x56,0x27,0x27,0x9a,0x31,0x1c,0x86,0x1f, - 0x5e,0x82,0x5d,0x5d,0x87,0x10,0x00,0x05, - 0x01}}, - {{0x56,0x27,0x27,0x9a,0x31,0x1c,0x08,0x3e, - 0xe0,0x84,0xdf,0xdf,0x09,0x00,0x00,0x05, - 0x00}}, - {{0x60,0x31,0x31,0x84,0x3a,0x86,0x80,0xf0, - 0x58,0x8c,0x57,0x57,0x81,0x20,0x00,0x01, - 0x01}}, - {{0x6e,0x3f,0x3f,0x92,0x48,0x94,0x28,0xf5, - 0x00,0x84,0xff,0xff,0x29,0x10,0x00,0x01, - 0x01}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11280x1024_2[]= -{ /* Illegal data in BIOS (Acer, Compaq) */ - {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x72,0x88,0xdf,0xdf,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x63,0x63,0x87,0x78,0x89,0x24,0xf1, - 0xae,0x84,0x57,0x57,0x25,0x30,0x00,0x02, - 0x01}}, - {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, - 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, - 0x01}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11280x1024_2_H[]= -{ /* Illegal data in BIOS (Acer, Compaq) */ - {{0x4f,0x27,0x27,0x93,0x39,0x81,0x24,0xbb, - 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x4f,0x27,0x27,0x93,0x39,0x81,0x24,0xbb, - 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x4f,0x27,0x27,0x93,0x39,0x81,0x24,0xbb, - 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x4f,0x27,0x27,0x93,0x39,0x81,0x24,0xbb, - 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x4f,0x27,0x27,0x93,0x39,0x81,0x24,0xbb, - 0x72,0x88,0xdf,0xdf,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x4f,0x31,0x31,0x93,0x3e,0x86,0x24,0xf1, - 0xae,0x84,0x57,0x57,0x25,0x30,0x00,0x01, - 0x01 }}, - {{0x4f,0x3f,0x3f,0x93,0x45,0x0d,0x24,0xf5, - 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x01, - 0x01 }} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11400x1050_1[]= -{ - {{0x6f,0x4f,0x4f,0x93,0x54,0x82,0x9e,0x1f, - 0x93,0x86,0x8f,0x8f,0x9f,0x30,0x00,0x05, - 0x00}}, - {{0x6f,0x4f,0x4f,0x93,0x54,0x82,0x6c,0x1f, - 0x60,0x84,0x5d,0x5d,0x6d,0x10,0x00,0x05, - 0x00}}, - {{0x6f,0x4f,0x4f,0x93,0x54,0x82,0x9e,0x1f, - 0x93,0x86,0x8f,0x8f,0x9f,0x30,0x00,0x05, - 0x00}}, - {{0x6f,0x4f,0x4f,0x93,0x54,0x82,0x6c,0x1f, - 0x60,0x84,0x5d,0x5d,0x6d,0x10,0x00,0x05, - 0x00}}, - {{0x6f,0x4f,0x4f,0x93,0x54,0x82,0xee,0x1f, - 0xe2,0x86,0xdf,0xdf,0xef,0x10,0x00,0x05, - 0x00}}, - {{0x83,0x63,0x63,0x87,0x68,0x16,0x66,0xf0, - 0x5a,0x8e,0x57,0x57,0x67,0x20,0x00,0x06, - 0x01}}, - {{0x9f,0x7f,0x7f,0x83,0x84,0x92,0x0e,0xf5, - 0x02,0x86,0xff,0xff,0x0f,0x10,0x00,0x02, - 0x01}}, - {{0xbf,0x9f,0x9f,0x83,0xa4,0x12,0x0e,0x5a, - 0x02,0x86,0xff,0xff,0x0f,0x09,0x00,0x07, - 0x01}}, - {{0xce,0xae,0xae,0x92,0xb3,0x01,0x28,0x10, - 0x1a,0x80,0x19,0x19,0x29,0x0f,0x00,0x03, - 0x00}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11400x1050_1_H[]= -{ - {{0x47,0x27,0x27,0x8b,0x2c,0x1a,0x9e,0x1f, - 0x93,0x86,0x8f,0x8f,0x9f,0x30,0x00,0x05, - 0x00}}, - {{0x47,0x27,0x27,0x8b,0x2c,0x1a,0x6c,0x1f, - 0x60,0x84,0x5d,0x5d,0x6d,0x10,0x00,0x05, - 0x00}}, - {{0x47,0x27,0x27,0x8b,0x30,0x1e,0x9e,0x1f, - 0x92,0x86,0x8f,0x8f,0x9f,0x30,0x00,0x05, - 0x00}}, - {{0x47,0x27,0x27,0x8b,0x2c,0x1a,0x6c,0x1f, - 0x60,0x84,0x5d,0x5d,0x6d,0x10,0x00,0x05, - 0x00}}, - {{0x47,0x27,0x27,0x8b,0x2c,0x1a,0xee,0x1f, - 0xe2,0x86,0xdf,0xdf,0xef,0x10,0x00,0x05, - 0x00}}, - {{0x51,0x31,0x31,0x95,0x36,0x04,0x66,0xf0, - 0x5a,0x8e,0x57,0x57,0x67,0x20,0x00,0x01, - 0x01}}, - {{0x5f,0x3f,0x3f,0x83,0x44,0x92,0x0e,0xf5, - 0x02,0x86,0xff,0xff,0x0f,0x10,0x00,0x01, - 0x01}}, - {{0x6f,0x4f,0x4f,0x93,0x54,0x82,0x0e,0x5a, - 0x02,0x86,0xff,0xff,0x0f,0x09,0x00,0x05, - 0x01}}, - {{0x76,0x56,0x56,0x9a,0x5b,0x89,0x28,0x10, - 0x1c,0x80,0x19,0x19,0x29,0x0b,0x00,0x05, - 0x00}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11400x1050_2[]= -{ - {{0xce,0x4f,0x4f,0x92,0x8c,0x1a,0x28,0x9a, - 0xdb,0x8f,0x8f,0x8f,0x29,0x21,0x00,0x03, - 0x00}}, - {{0xce,0x4f,0x4f,0x92,0x8c,0x1a,0x28,0x9a, - 0xc2,0x86,0x5d,0x5d,0x29,0x01,0x00,0x03, - 0x01}}, - {{0xce,0x4f,0x4f,0x92,0x8c,0x1a,0x28,0x9a, - 0xdb,0x8f,0x8f,0x8f,0x29,0x21,0x00,0x03, - 0x00}}, - {{0xce,0x4f,0x4f,0x92,0x8c,0x1a,0x28,0x9a, - 0xc2,0x86,0x5d,0x5d,0x29,0x01,0x00,0x03, - 0x00}}, - {{0xce,0x4f,0x4f,0x92,0x8c,0x1a,0x28,0x9e, - 0x03,0x87,0xdf,0xdf,0x29,0x01,0x00,0x03, - 0x00}}, - {{0xce,0x63,0x63,0x92,0x96,0x04,0x28,0xd4, - 0x3f,0x83,0x57,0x57,0x29,0x01,0x00,0x07, - 0x01}}, - {{0xce,0x7f,0x7f,0x92,0xa4,0x12,0x28,0xd4, - 0x93,0x87,0xff,0xff,0x29,0x21,0x00,0x07, - 0x01}}, - {{0xce,0x9f,0x9f,0x92,0xb4,0x02,0x28,0x5a, - 0x13,0x87,0xff,0xff,0x29,0x29,0x00,0x03, - 0x01}}, - {{0xce,0xae,0xae,0x92,0xbc,0x0a,0x28,0x10, - 0x20,0x84,0x19,0x19,0x29,0x0f,0x00,0x03, - 0x00}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11400x1050_2_H[]= -{ - {{0xa6,0x27,0x27,0x8a,0x64,0x92,0x28,0x9a, - 0xdb,0x8f,0x8f,0x8f,0x29,0x21,0x00,0x06, - 0x00}}, - {{0xa6,0x27,0x27,0x8a,0x64,0x92,0x28,0x9a, - 0xc2,0x86,0x5d,0x5d,0x29,0x01,0x00,0x06, - 0x00}}, - {{0xa6,0x27,0x27,0x8a,0x64,0x92,0x28,0x9a, - 0xdb,0x8f,0x8f,0x8f,0x29,0x21,0x00,0x06, - 0x00}}, - {{0xa6,0x27,0x27,0x8a,0x64,0x92,0x28,0x9a, - 0xc2,0x86,0x5d,0x5d,0x29,0x01,0x00,0x06, - 0x00}}, - {{0xa6,0x27,0x27,0x8a,0x64,0x92,0x28,0x9e, - 0x03,0x87,0xdf,0xdf,0x29,0x01,0x00,0x06, - 0x00}}, - {{0x9c,0x31,0x31,0x80,0x64,0x92,0x28,0xd4, - 0x3f,0x83,0x57,0x57,0x29,0x01,0x00,0x06, - 0x01}}, - {{0x8e,0x3f,0x3f,0x92,0x64,0x12,0x28,0xd4, - 0x93,0x87,0xff,0xff,0x29,0x21,0x00,0x06, - 0x01}}, - {{0x7e,0x4f,0x4f,0x82,0x64,0x12,0x28,0x5a, - 0x13,0x87,0xff,0xff,0x29,0x29,0x00,0x06, - 0x01}}, - {{0x76,0x56,0x56,0x9a,0x64,0x92,0x28,0x10, - 0x20,0x84,0x19,0x19,0x29,0x0f,0x00,0x05, - 0x00}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11600x1200_1[]= -{ - {{0x83,0x4F,0x4F,0x87,0x51,0x09,0xC0,0x1F, - 0x90,0x84,0x8F,0x8F,0xC1,0x30,0x00,0x06, - 0x00}}, - {{0x83,0x4F,0x4F,0x87,0x51,0x09,0x8E,0x1F, - 0x5E,0x82,0x5D,0x5D,0x8F,0x10,0x00,0x06, - 0x00}}, - {{0x83,0x4F,0x4F,0x87,0x51,0x09,0xC0,0x1F, - 0x90,0x84,0x8F,0x8F,0xC1,0x30,0x00,0x06, - 0x00}}, - {{0x83,0x4F,0x4F,0x87,0x51,0x09,0x8E,0x1F, - 0x5E,0x82,0x5D,0x5D,0x8F,0x10,0x00,0x06, - 0x00}}, - {{0x83,0x4F,0x4F,0x87,0x51,0x09,0x10,0x3E, - 0xE0,0x84,0xDF,0xDF,0x11,0x00,0x00,0x06, - 0x00}}, - {{0x97,0x63,0x63,0x9B,0x65,0x1D,0x88,0xF0, - 0x58,0x8C,0x57,0x57,0x89,0x20,0x00,0x06, - 0x01}}, - {{0xB3,0x7F,0x7F,0x97,0x81,0x99,0x30,0xF5, - 0x00,0x84,0xFF,0xFF,0x31,0x10,0x00,0x02, - 0x01}}, - {{0xD3,0x9F,0x9F,0x97,0xA1,0x19,0x30,0x5A, - 0x00,0x84,0xFF,0xFF,0x31,0x09,0x00,0x07, - 0x01}}, - {{0xE2,0xAE,0xAE,0x86,0xB0,0x88,0x4A,0x10, - 0x1A,0x8E,0x19,0x19,0x4B,0x2F,0x00,0x03, - 0x00}}, - {{0xFB,0xC7,0xC7,0x9F,0xC9,0x81,0xE0,0x10, - 0xB0,0x84,0xAF,0xAF,0xE1,0x2F,0x00,0x07, - 0x00}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11600x1200_1_H[]= -{ - {{0x69,0x27,0x27,0x8D,0x30,0x88,0xC0,0x1F, - 0x90,0x84,0x8F,0x8F,0xC1,0x30,0x00,0x01, - 0x00}}, - {{0x69,0x27,0x27,0x8D,0x30,0x88,0x8E,0x1F, - 0x5E,0x82,0x5D,0x5D,0x87,0x10,0x00,0x01, - 0x00}}, - {{0x69,0x27,0x27,0x8D,0x30,0x88,0xC0,0x1F, - 0x90,0x84,0x8F,0x8F,0xC1,0x30,0x00,0x01, - 0x00}}, - {{0x69,0x27,0x27,0x8D,0x30,0x88,0x8E,0x1F, - 0x5E,0x82,0x5D,0x5D,0x87,0x10,0x00,0x01, - 0x00}}, - {{0x69,0x27,0x27,0x8D,0x30,0x88,0x10,0x3E, - 0xE0,0x84,0xDF,0xDF,0x11,0x00,0x00,0x01, - 0x00}}, - {{0x73,0x31,0x31,0x97,0x3A,0x92,0x88,0xF0, - 0x58,0x8C,0x57,0x57,0x89,0x20,0x00,0x01, - 0x01}}, - {{0x81,0x3F,0x3F,0x85,0x48,0x00,0x30,0xF5, - 0x00,0x84,0xFF,0xFF,0x31,0x10,0x00,0x06, - 0x01}}, - {{0x91,0x4F,0x4F,0x95,0x58,0x10,0x30,0x5A, - 0x00,0x84,0xFF,0xFF,0x31,0x09,0x00,0x06, - 0x01}}, - {{0xD4,0x9F,0x9F,0x98,0xA8,0x00,0x30,0x5A, - 0x00,0x84,0xFF,0xFF,0x31,0x09,0x00,0x03, - 0x01}}, - {{0xA5,0x63,0x63,0x89,0x6C,0x84,0xE0,0x10, - 0xB0,0x84,0xAF,0xAF,0xE1,0x2F,0x00,0x02, - 0x00}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11600x1200_2[]= -{ - {{0x09,0x4F,0x4F,0x8D,0xA3,0x1B,0xE0,0x9E, - 0x37,0x8B,0x8F,0x8F,0xE1,0x21,0x01,0x04, - 0x00}}, - {{0x09,0x4F,0x4F,0x8D,0xA3,0x1B,0xE0,0x9E, - 0x1E,0x82,0x5D,0x5D,0xE1,0x01,0x01,0x04, - 0x00}}, - {{0x09,0x4F,0x4F,0x8D,0xA3,0x1B,0xE0,0x9E, - 0x37,0x8B,0x8F,0x8F,0xE1,0x21,0x01,0x04, - 0x00}}, - {{0x09,0x4F,0x4F,0x8D,0xA3,0x1B,0xE0,0x9E, - 0x1E,0x82,0x5D,0x5D,0xE1,0x01,0x01,0x04, - 0x00}}, - {{0x09,0x4F,0x4F,0x8D,0xA3,0x1B,0xE0,0x9E, - 0x5F,0x83,0xDF,0xDF,0xE1,0x01,0x01,0x04, - 0x00}}, - {{0x09,0x63,0x63,0x8D,0xAD,0x05,0xE0,0xD4, - 0x9B,0x8F,0x57,0x57,0xE1,0x21,0x01,0x00, - 0x01}}, - {{0x09,0x7F,0x7F,0x8D,0xBB,0x13,0xE0,0xD4, - 0xEF,0x83,0xFF,0xFF,0xE1,0x21,0x01,0x00, - 0x01}}, - {{0x09,0x9F,0x9F,0x8D,0xCB,0x03,0xE0,0x5A, - 0x6F,0x83,0xFF,0xFF,0xE1,0x29,0x01,0x04, - 0x01}}, - {{0xD4,0x9F,0x9F,0x98,0xA8,0x00,0x30,0x5A, - 0x00,0x84,0xFF,0xFF,0x31,0x09,0x00,0x03, - 0x01}}, - {{0x09,0xC7,0xC7,0x8D,0xDF,0x17,0xE0,0x10, - 0xC7,0x8B,0xAF,0xAF,0xE1,0x0F,0x01,0x04, - 0x00}} -}; - -static const SiS310_LCDACRT1DataStruct SiS310_LCDACRT11600x1200_2_H[]= -{ - {{0xE1,0x27,0x27,0x85,0x7B,0x93,0xE0,0x9E, - 0x37,0x8B,0x8F,0x8F,0xE1,0x21,0x00,0x03, - 0x00}}, - {{0xE1,0x27,0x27,0x85,0x7B,0x93,0xE0,0x9E, - 0x1E,0x82,0x5D,0x5D,0xE1,0x01,0x00,0x03, - 0x00}}, - {{0xE1,0x27,0x27,0x85,0x7B,0x93,0xE0,0x9E, - 0x37,0x8B,0x8F,0x8F,0xE1,0x21,0x00,0x03, - 0x00}}, - {{0xE1,0x27,0x27,0x85,0x7B,0x93,0xE0,0x9E, - 0x1E,0x82,0x5D,0x5D,0xE1,0x01,0x00,0x03, - 0x00}}, - {{0xE1,0x27,0x27,0x85,0x7B,0x93,0xE0,0x9E, - 0x5F,0x83,0xDF,0xDF,0xE1,0x01,0x00,0x03, - 0x00}}, - {{0xD7,0x31,0x31,0x9B,0x7B,0x13,0xE0,0xD4, - 0x9B,0x8F,0x57,0x57,0xE1,0x21,0x00,0x03, - 0x01}}, - {{0xC9,0x3F,0x3F,0x8D,0x7B,0x13,0xE0,0xD4, - 0xEF,0x83,0xFF,0xFF,0xE1,0x21,0x00,0x03, - 0x01}}, - {{0xB9,0x4F,0x4F,0x9D,0x7B,0x93,0xE0,0x5A, - 0x6F,0x83,0xFF,0xFF,0xE1,0x29,0x00,0x02, - 0x01}}, - {{0xD4,0x9F,0x9F,0x98,0xA8,0x00,0x30,0x5A, - 0x00,0x84,0xFF,0xFF,0x31,0x09,0x00,0x03, - 0x01}}, - {{0xA5,0x63,0x63,0x89,0x7B,0x93,0xE0,0x10, - 0xC7,0x8B,0xAF,0xAF,0xE1,0x0F,0x00,0x02, - 0x00}} -}; - +#endif /**************************************************************/ /* LVDS, CHRONTEL ------------------------------------------- */ /**************************************************************/ -typedef struct _SiS310_LVDSDataStruct -{ - USHORT VGAHT; - USHORT VGAVT; - USHORT LCDHT; - USHORT LCDVT; -} SiS310_LVDSDataStruct; - -static const SiS310_LVDSDataStruct SiS310_CHTVUPALData[]= +static const SiS_LVDSDataStruct SiS310_CHTVUPALData[]= { {1008, 625,1008, 625}, {1008, 625,1008, 625}, @@ -1678,7 +982,7 @@ static const SiS310_LVDSDataStruct SiS310_CHTVUPALData[]= {1400,1000,1400,1000} }; -static const SiS310_LVDSDataStruct SiS310_CHTVOPALData[]= +static const SiS_LVDSDataStruct SiS310_CHTVOPALData[]= { {1008, 625,1008, 625}, {1008, 625,1008, 625}, @@ -1689,7 +993,7 @@ static const SiS310_LVDSDataStruct SiS310_CHTVOPALData[]= {1400, 875,1400, 875} }; -static const SiS310_LVDSDataStruct SiS310_CHTVUPALMData[]= +static const SiS_LVDSDataStruct SiS310_CHTVUPALMData[]= { { 840, 600, 840, 600}, { 840, 600, 840, 600}, @@ -1700,7 +1004,7 @@ static const SiS310_LVDSDataStruct SiS310_CHTVUPALMData[]= {1160, 945,1160, 945} }; -static const SiS310_LVDSDataStruct SiS310_CHTVOPALMData[]= +static const SiS_LVDSDataStruct SiS310_CHTVOPALMData[]= { { 840, 525, 840, 525}, { 840, 525, 840, 525}, @@ -1711,7 +1015,7 @@ static const SiS310_LVDSDataStruct SiS310_CHTVOPALMData[]= {1160, 840,1160, 840} }; -static const SiS310_LVDSDataStruct SiS310_CHTVUPALNData[]= +static const SiS_LVDSDataStruct SiS310_CHTVUPALNData[]= { {1008, 625,1008, 625}, {1008, 625,1008, 625}, @@ -1722,7 +1026,7 @@ static const SiS310_LVDSDataStruct SiS310_CHTVUPALNData[]= {1400,1000,1400,1000} }; -static const SiS310_LVDSDataStruct SiS310_CHTVOPALNData[]= +static const SiS_LVDSDataStruct SiS310_CHTVOPALNData[]= { {1008, 625,1008, 625}, {1008, 625,1008, 625}, @@ -1733,7 +1037,7 @@ static const SiS310_LVDSDataStruct SiS310_CHTVOPALNData[]= {1400, 875,1400, 875} }; -static const SiS310_LVDSDataStruct SiS310_CHTVSOPALData[]= /* TW: (super overscan - no effect on 7019) */ +static const SiS_LVDSDataStruct SiS310_CHTVSOPALData[]= /* (super overscan - no effect on 7019) */ { {1008, 625,1008, 625}, {1008, 625,1008, 625}, @@ -1744,13 +1048,8 @@ static const SiS310_LVDSDataStruct SiS310_CHTVSOPALData[]= /* TW: (super over {1400, 875,1400, 875} }; -typedef struct _SiS310_LVDSDesStruct -{ - USHORT LCDHDES; - USHORT LCDVDES; -} SiS310_LVDSDesStruct; -static const SiS310_LVDSDesStruct SiS310_PanelType00_1[]= /* 800x600 */ +static const SiS_LVDSDesStruct SiS310_PanelType00_1[]= /* 800x600 */ { { 0, 0}, { 0, 0}, @@ -1763,7 +1062,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType00_1[]= /* 800x600 */ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType01_1[]= /* 1024x768 */ +static const SiS_LVDSDesStruct SiS310_PanelType01_1[]= /* 1024x768 */ { { 0, 0}, { 0, 0}, @@ -1776,7 +1075,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType01_1[]= /* 1024x768 */ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType02_1[]= /* 1280x1024 */ +static const SiS_LVDSDesStruct SiS310_PanelType02_1[]= /* 1280x1024 */ { { 0, 0}, { 0, 0}, @@ -1791,7 +1090,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType02_1[]= /* 1280x1024 */ }; -static const SiS310_LVDSDesStruct SiS310_PanelType03_1[]= +static const SiS_LVDSDesStruct SiS310_PanelType03_1[]= { { 0, 0}, { 0, 0}, @@ -1804,7 +1103,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType03_1[]= { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType04_1[]= +static const SiS_LVDSDesStruct SiS310_PanelType04_1[]= { {1343, 798}, {1343, 794}, @@ -1817,7 +1116,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType04_1[]= { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType05_1[]= +static const SiS_LVDSDesStruct SiS310_PanelType05_1[]= { {1343, 798}, {1343, 794}, @@ -1830,7 +1129,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType05_1[]= { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType06_1[]= +static const SiS_LVDSDesStruct SiS310_PanelType06_1[]= { {1343, 798}, {1343, 794}, @@ -1843,7 +1142,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType06_1[]= { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType07_1[]= +static const SiS_LVDSDesStruct SiS310_PanelType07_1[]= { {1343, 798}, {1343, 794}, @@ -1856,7 +1155,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType07_1[]= { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType08_1[]= /* 1400x1050 */ +static const SiS_LVDSDesStruct SiS310_PanelType08_1[]= /* 1400x1050 */ { { 0, 0}, { 0, 0}, @@ -1871,7 +1170,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType08_1[]= /* 1400x1050 */ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType09_1[]= /* 1280x768 */ +static const SiS_LVDSDesStruct SiS310_PanelType09_1[]= /* 1280x768 */ { { 0, 0}, { 0, 0}, @@ -1886,7 +1185,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType09_1[]= /* 1280x768 */ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType0a_1[]= /* 1600x1200 */ +static const SiS_LVDSDesStruct SiS310_PanelType0a_1[]= /* 1600x1200 */ { { 0, 0}, { 0, 0}, @@ -1901,7 +1200,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType0a_1[]= /* 1600x1200 */ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType0b_1[]= /* 640x480_2 */ +static const SiS_LVDSDesStruct SiS310_PanelType0b_1[]= /* 640x480_2 */ { { 0, 524}, { 0, 524}, @@ -1913,7 +1212,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType0b_1[]= /* 640x480_2 */ { 0, 524} }; -static const SiS310_LVDSDesStruct SiS310_PanelType0c_1[]= /* 640x480_3 */ +static const SiS_LVDSDesStruct SiS310_PanelType0c_1[]= /* 640x480_3 */ { { 0, 524}, { 0, 524}, @@ -1925,7 +1224,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType0c_1[]= /* 640x480_3 */ { 0, 524} }; -static const SiS310_LVDSDesStruct SiS310_PanelType0d_1[]= +static const SiS_LVDSDesStruct SiS310_PanelType0d_1[]= { {1343, 798}, {1343, 794}, @@ -1938,7 +1237,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType0d_1[]= { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType0e_1[]= +static const SiS_LVDSDesStruct SiS310_PanelType0e_1[]= { {1343, 798}, {1343, 794}, @@ -1951,7 +1250,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType0e_1[]= { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType0f_1[]= +static const SiS_LVDSDesStruct SiS310_PanelType0f_1[]= { {1343, 798}, {1343, 794}, @@ -1964,7 +1263,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType0f_1[]= { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType00_2[]= +static const SiS_LVDSDesStruct SiS310_PanelType00_2[]= { {980, 528}, {980, 503}, @@ -1977,7 +1276,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType00_2[]= { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType01_2[]= +static const SiS_LVDSDesStruct SiS310_PanelType01_2[]= { {1152, 622}, {1152, 597}, @@ -1990,7 +1289,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType01_2[]= { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType02_2[]= +static const SiS_LVDSDesStruct SiS310_PanelType02_2[]= { {1368, 754}, {1368, 729}, @@ -2005,7 +1304,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType02_2[]= { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType03_2[]= +static const SiS_LVDSDesStruct SiS310_PanelType03_2[]= { { 0, 0}, { 0, 0}, @@ -2016,7 +1315,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType03_2[]= { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType04_2[]= +static const SiS_LVDSDesStruct SiS310_PanelType04_2[]= { { 0, 0}, { 0, 0}, @@ -2029,7 +1328,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType04_2[]= { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType05_2[]= +static const SiS_LVDSDesStruct SiS310_PanelType05_2[]= { {1152, 622}, {1152, 597}, @@ -2042,7 +1341,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType05_2[]= { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType06_2[]= +static const SiS_LVDSDesStruct SiS310_PanelType06_2[]= { {1152, 622}, {1152, 597}, @@ -2055,7 +1354,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType06_2[]= { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType07_2[]= +static const SiS_LVDSDesStruct SiS310_PanelType07_2[]= { {1152, 622}, {1152, 597}, @@ -2068,7 +1367,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType07_2[]= { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType08_2[]= /* 1400x1050 */ +static const SiS_LVDSDesStruct SiS310_PanelType08_2[]= /* 1400x1050 */ { {1308, 741}, {1308, 716}, @@ -2083,7 +1382,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType08_2[]= /* 1400x1050 */ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType09_2[]= /* 1280x768 */ +static const SiS_LVDSDesStruct SiS310_PanelType09_2[]= /* 1280x768 */ { {1083, 622}, {1083, 597}, @@ -2096,7 +1395,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType09_2[]= /* 1280x768 */ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType0a_2[]= /* 1600x1200 */ +static const SiS_LVDSDesStruct SiS310_PanelType0a_2[]= /* 1600x1200 */ { {1568, 920}, {1568, 895}, @@ -2122,7 +1421,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType0a_2[]= /* 1600x1200 */ #endif }; -static const SiS310_LVDSDesStruct SiS310_PanelType0b_2[]= /* 640x480_2 */ +static const SiS_LVDSDesStruct SiS310_PanelType0b_2[]= /* 640x480_2 */ { {1152, 622}, {1152, 597}, @@ -2135,7 +1434,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType0b_2[]= /* 640x480_2 */ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType0c_2[]= /* 640x480_3 */ +static const SiS_LVDSDesStruct SiS310_PanelType0c_2[]= /* 640x480_3 */ { {1152, 622}, {1152, 597}, @@ -2148,7 +1447,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType0c_2[]= /* 640x480_3 */ { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType0d_2[]= +static const SiS_LVDSDesStruct SiS310_PanelType0d_2[]= { {1152, 622}, {1152, 597}, @@ -2161,7 +1460,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType0d_2[]= { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType0e_2[]= +static const SiS_LVDSDesStruct SiS310_PanelType0e_2[]= { {1152, 622}, {1152, 597}, @@ -2174,7 +1473,7 @@ static const SiS310_LVDSDesStruct SiS310_PanelType0e_2[]= { 0, 0} }; -static const SiS310_LVDSDesStruct SiS310_PanelType0f_2[] = +static const SiS_LVDSDesStruct SiS310_PanelType0f_2[] = { {1152, 622}, {1152, 597}, @@ -2187,14 +1486,37 @@ static const SiS310_LVDSDesStruct SiS310_PanelType0f_2[] = { 0, 0} }; -/* CRT1 CRTC for SlaveModes and LCDA */ +static const SiS_LVDSDesStruct SiS310_PanelTypeNS_1[]= +{ + { 8, 0}, + { 8, 0}, + { 8, 0}, + { 8, 0}, + { 8, 0}, + { 0, 0}, + { 0, 0}, + { 0, 0}, + { 0, 806}, + { 0, 0} +}; -typedef struct _SiS310_LVDSCRT1DataStruct +static const SiS_LVDSDesStruct SiS310_PanelTypeNS_2[] = { - UCHAR CR[15]; -} SiS310_LVDSCRT1DataStruct; + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0}, + { 0 , 0} +}; + +/* CRT1 CRTC for SlaveModes and LCDA */ -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1[] = +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1[] = { {{0x6b,0x4f,0x8f,0x55,0x85,0xaa,0x1f, 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, @@ -2216,7 +1538,7 @@ static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1[] = 0x01 }} }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1_H[] = +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1_H[] = { {{0x43,0x27,0x87,0x2d,0x1d,0xaa,0x1f, 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, @@ -2238,7 +1560,7 @@ static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1_H[] = 0x01 }} }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2[]= +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2[]= { {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, 0xff,0x84,0x8f,0x73,0x00,0x00,0x06, @@ -2260,7 +1582,7 @@ static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2[]= 0x01 }} }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2_H[] = +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2_H[] = { {{0x57,0x27,0x9b,0x3a,0x0a,0x72,0x3e, 0xff,0x84,0x8f,0x73,0x00,0x00,0x01, @@ -2282,7 +1604,7 @@ static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2_H[] = 0x01 }} }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1[] = +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1[] = { {{0x73,0x4f,0x97,0x53,0x84,0xb4,0x1f, 0x92,0x89,0x8f,0xb5,0x30,0x00,0x05, @@ -2307,7 +1629,7 @@ static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1[] = 0x01}} }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1_H[] = +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1_H[] = { {{0x4b,0x27,0x8f,0x2b,0x1c,0xb4,0x1f, 0x92,0x89,0x8f,0xb5,0x30,0x00,0x05, @@ -2332,7 +1654,7 @@ static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1_H[] = 0x01 }} }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2[] = +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2[] = { {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, 0x57,0x8e,0x8f,0x25,0x30,0x00,0x06, @@ -2357,7 +1679,7 @@ static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2[] = 0x01 }} }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2_H[] = +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2_H[] = { {{0x7b,0x27,0x9f,0x46,0x97,0x24,0xbb, 0x57,0x8e,0x8f,0x25,0x30,0x00,0x01, @@ -2382,7 +1704,7 @@ static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2_H[] = 0x01 }} }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1[] = +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1[] = { {{0x7e,0x4f,0x82,0x58,0x04,0xb8,0x1f, 0x90,0x84,0x8f,0xb9,0x30,0x00,0x06, @@ -2410,7 +1732,7 @@ static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1[] = 0x01}} }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1_H[] = +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1_H[] = { {{0x56,0x27,0x9a,0x31,0x1c,0xb8,0x1f, 0x90,0x84,0x8f,0xb9,0x30,0x00,0x05, @@ -2435,7 +1757,7 @@ static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1_H[] = 0x01}} }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2[] = +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2[] = { {{0xce,0x72,0x91,0x81,0x8f,0x28,0x92, 0xc8,0x8c,0x5d,0x5c,0x01,0x00,0x02, @@ -2463,7 +1785,7 @@ static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2[] = 0x01}} }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2_H[] = +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2_H[] = { {{0xa6,0x4a,0x89,0x59,0x07,0x28,0x92, 0xc8,0x8c,0x5d,0x5c,0x01,0x00,0x06, @@ -2488,7 +1810,7 @@ static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2_H[] = 0x01}} }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_1[] = +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_1[] = { {{0x6f,0x4f,0x93,0x54,0x82,0x9e,0x1f, 0x8f,0x81,0x8f,0x9f,0x30,0x00,0x05, @@ -2548,7 +1870,7 @@ static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_1[] = #endif }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_1_H[] = +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_1_H[] = { {{0x47,0x27,0x8b,0x2c,0x1a,0x9e,0x1f, 0x8f,0x81,0x8f,0x9f,0x30,0x00,0x05, @@ -2608,7 +1930,7 @@ static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_1_H[] = #endif }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_2[] = +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_2[] = { {{0xce,0x72,0x91,0x84,0x92,0x28,0x92, 0xd7,0x8b,0x5d,0x5c,0x21,0x00,0x02, @@ -2668,7 +1990,7 @@ static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_2[] = #endif }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_2_H[] = +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_2_H[] = { {{0xa6,0x4a,0x89,0x5c,0x0a,0x28,0x92, 0xd7,0x8b,0x5d,0x5c,0x21,0x00,0x06, @@ -2728,7 +2050,7 @@ static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_2_H[] = #endif }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_1[] = +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_1[] = { {{0x83,0x4F,0x87,0x5B,0x13,0x06,0x3E, 0xB3,0x86,0x8F,0x07,0x20,0x00,0x06, @@ -2794,7 +2116,7 @@ static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_1[] = #endif }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_1_H[] = +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_1_H[] = { {{0x5B,0x27,0x9F,0x33,0x0B,0x06,0x2E, 0xB3,0x86,0x8F,0x07,0x20,0x00,0x01, @@ -2860,7 +2182,7 @@ static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_1_H[] = #endif }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_2[] = +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_2[] = { {{0xFB,0x87,0x86,0x97,0x0F,0x26,0x97, 0x43,0x86,0xDB,0xDA,0x11,0x00,0x07, @@ -2926,7 +2248,7 @@ static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_2[] = #endif }; -static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_2_H[] = +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_2_H[] = { {{0xD3,0x5F,0x9E,0x6F,0x07,0x26,0x97, 0x43,0x86,0xDB,0xDA,0x11,0x00,0x02, @@ -2992,9 +2314,66 @@ static const SiS310_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_2_H[] = #endif }; +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT1XXXxXXX_1[] = +{ + {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, + 0x00}}, + {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, + 0x00}}, + {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, + 0x00}}, + {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, + 0x00}}, + {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e, + 0xe9,0x8b,0xe7,0x04,0x00,0x00,0x05, + 0x00}}, + {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, + 0x01}}, + {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x02, + 0x01}}, + {{0xce,0x9f,0x92,0xa8,0x14,0x28,0x5a, + 0x00,0x84,0xff,0x29,0x09,0x00,0x07, + 0x01}}, + {{0xce,0x9f,0x92,0xa9,0x17,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x07, + 0x01}} +}; + +static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT1XXXxXXX_1_H[] = +{ + {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, + 0x00}}, + {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, + 0x00}}, + {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, + 0x00}}, + {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, + 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, + 0x00}}, + {{0x38,0x27,0x9c,0x2c,0x80,0x0b,0x3e, + 0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00, + 0x00}}, + {{0x4d,0x31,0x91,0x3b,0x03,0x72,0xf0, + 0x58,0x8c,0x57,0x73,0x20,0x00,0x01, + 0x01}}, + {{0x63,0x3f,0x87,0x4a,0x92,0x24,0xf5, + 0x02,0x88,0xff,0x25,0x10,0x00,0x01, + 0x01}} +}; + + /* CRT1 CRTC for Chrontel TV slave modes */ -static const SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1UNTSC[] = +static const SiS_LVDSCRT1DataStruct SiS310_CHTVCRT1UNTSC[] = { {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e, 0xe8,0x84,0x8f,0x57,0x20,0x00,0x01, @@ -3019,7 +2398,7 @@ static const SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1UNTSC[] = 0x01}} }; -static const SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1ONTSC[] = +static const SiS_LVDSCRT1DataStruct SiS310_CHTVCRT1ONTSC[] = { {{0x63,0x4f,0x87,0x5a,0x9f,0x0b,0x3e, 0xc0,0x84,0x8f,0x0c,0x20,0x00,0x01, @@ -3044,7 +2423,7 @@ static const SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1ONTSC[] = 0x01 }} }; -static const SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1UPAL[] = +static const SiS_LVDSCRT1DataStruct SiS310_CHTVCRT1UPAL[] = { {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, 0xf8,0x83,0x8f,0x70,0x20,0x00,0x05, @@ -3069,7 +2448,7 @@ static const SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1UPAL[] = 0x01}} }; -static const SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1OPAL[] = +static const SiS_LVDSCRT1DataStruct SiS310_CHTVCRT1OPAL[] = { {{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e, 0xf0,0x83,0x8f,0x70,0x20,0x00,0x05, @@ -3094,12 +2473,8 @@ static const SiS310_LVDSCRT1DataStruct SiS310_CHTVCRT1OPAL[] = 0x01 }} }; -typedef struct _SiS310_CHTVRegDataStruct -{ - UCHAR Reg[16]; -} SiS310_CHTVRegDataStruct; -static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_UNTSC[] = +static const SiS_CHTVRegDataStruct SiS310_CHTVReg_UNTSC[] = { {{0x4a,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, {{0x4a,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, @@ -3119,7 +2494,7 @@ static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_UNTSC[] = for PAL-M and PAL-N all above is corrected. */ -static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_ONTSC[] = +static const SiS_CHTVRegDataStruct SiS310_CHTVReg_ONTSC[] = { {{0x49,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, {{0x49,0x77,0xbb,0x7b,0x84,0x34,0x00,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, @@ -3130,7 +2505,7 @@ static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_ONTSC[] = {{0xed,0x77,0xbb,0x66,0x8c,0x21,0x02,0x5a,0x04,0x00,0x80,0x1f,0x9f,0xc1,0x0c,0x00}} }; -static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_UPAL[] = +static const SiS_CHTVRegDataStruct SiS310_CHTVReg_UPAL[] = { {{0x41,0x7f,0xb7,0x34,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, {{0x41,0x7f,0xb7,0x80,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, @@ -3141,7 +2516,7 @@ static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_UPAL[] = {{0xe5,0x7f,0xb7,0x1d,0xa7,0x3e,0x04,0x5a,0x05,0x00,0x80,0x20,0x3e,0xe4,0x22,0x00}} }; -static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_OPAL[] = +static const SiS_CHTVRegDataStruct SiS310_CHTVReg_OPAL[] = { {{0x41,0x7f,0xb7,0x36,0xad,0x50,0x34,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, {{0x41,0x7f,0xb7,0x86,0x85,0x50,0x00,0x83,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, @@ -3152,7 +2527,7 @@ static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_OPAL[] = {{0xe4,0x7f,0xb7,0x1e,0xaf,0x29,0x37,0x5a,0x05,0x00,0x80,0x25,0x8c,0xb2,0x2a,0x00}} }; -static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_UPALM[] = +static const SiS_CHTVRegDataStruct SiS310_CHTVReg_UPALM[] = { {{0x52,0x77,0xbb,0x94,0x84,0x48,0xfe,0x83,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, {{0x52,0x77,0xbb,0x94,0x84,0x48,0xfe,0x83,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, @@ -3168,7 +2543,7 @@ static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_UPALM[] = #endif }; -static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_OPALM[] = +static const SiS_CHTVRegDataStruct SiS310_CHTVReg_OPALM[] = { {{0x51,0x77,0xbb,0x7b,0x84,0x34,0x00,0x83,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, {{0x51,0x77,0xbb,0x7b,0x84,0x34,0x00,0x83,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, @@ -3184,7 +2559,7 @@ static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_OPALM[] = #endif }; -static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_UPALN[] = +static const SiS_CHTVRegDataStruct SiS310_CHTVReg_UPALN[] = { {{0x41,0x7f,0xb7,0x34,0xad,0x50,0x34,0x6e,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x03}}, {{0x41,0x7f,0xb7,0x80,0x85,0x50,0x00,0x6e,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x03}}, @@ -3200,7 +2575,7 @@ static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_UPALN[] = #endif }; -static const SiS310_CHTVRegDataStruct SiS310_CHTVReg_OPALN[] = +static const SiS_CHTVRegDataStruct SiS310_CHTVReg_OPALN[] = { {{0x41,0x7f,0xb7,0x36,0xad,0x50,0x34,0x6e,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x03}}, {{0x41,0x7f,0xb7,0x86,0x85,0x50,0x00,0x6e,0x05,0x00,0x80,0x00,0x00,0x00,0x00,0x03}}, @@ -1,36 +1,57 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.c,v 1.37 2003/11/20 19:53:20 twini Exp $ */ +/* $XFree86$ */ /* * Mode initializing code (CRT1 section) for * for SiS 300/305/540/630/730 and - * SiS 315/550/650/M650/651/661FX/M661FX/740/741/330/660/M660/760/M760 + * SiS 315/550/650/M650/651/661FX/M661FX/740/741/M741/330/660/M660/760/M760 * (Universal module for Linux kernel framebuffer and XFree86 4.x) * - * Assembler-To-C translation - * Copyright 2002, 2003 by Thomas Winischhofer <thomas@winischhofer.net> - * Formerly based on non-functional code-fragements by SiS, Inc. + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria * - * If distributed as part of the linux kernel, the contents of this file - * is entirely covered by the GPL. + * If distributed as part of the Linux kernel, the following license terms + * apply: * - * Otherwise, the following terms apply: + * * This program is free software; you can redistribute it and/or modify + * * it under the terms of the GNU General Public License as published by + * * the Free Software Foundation; either version 2 of the named License, + * * or any later version. + * * + * * This program is distributed in the hope that it will be useful, + * * but WITHOUT ANY WARRANTY; without even the implied warranty of + * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * * GNU General Public License for more details. + * * + * * You should have received a copy of the GNU General Public License + * * along with this program; if not, write to the Free Software + * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * - * 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. + * Otherwise, the following license terms apply: * - * 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. + * * 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. + * * + * * 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. + * + * Author: Thomas Winischhofer <thomas@winischhofer.net> + * + * 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. @@ -54,7 +75,6 @@ #if defined(ALLOC_PRAGMA) #pragma alloc_text(PAGE,SiSSetMode) -#pragma alloc_text(PAGE,SiSInit) #endif /*********************************************/ @@ -68,49 +88,59 @@ InitCommonPointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_Pr->SiS_ModeResInfo = SiS_ModeResInfo; SiS_Pr->SiS_StandTable = SiS_StandTable; - SiS_Pr->SiS_NTSCPhase = SiS_NTSCPhase; - SiS_Pr->SiS_PALPhase = SiS_PALPhase; - SiS_Pr->SiS_NTSCPhase2 = SiS_NTSCPhase2; - SiS_Pr->SiS_PALPhase2 = SiS_PALPhase2; - SiS_Pr->SiS_PALMPhase = SiS_PALMPhase; - SiS_Pr->SiS_PALNPhase = SiS_PALNPhase; - SiS_Pr->SiS_PALMPhase2 = SiS_PALMPhase2; - SiS_Pr->SiS_PALNPhase2 = SiS_PALNPhase2; - SiS_Pr->SiS_SpecialPhase = SiS_SpecialPhase; - SiS_Pr->SiS_SpecialPhaseM= SiS_SpecialPhaseM; - SiS_Pr->SiS_SpecialPhaseJ= SiS_SpecialPhaseJ; + SiS_Pr->SiS_NTSCPhase = SiS_NTSCPhase; + SiS_Pr->SiS_PALPhase = SiS_PALPhase; + SiS_Pr->SiS_NTSCPhase2 = SiS_NTSCPhase2; + SiS_Pr->SiS_PALPhase2 = SiS_PALPhase2; + SiS_Pr->SiS_PALMPhase = SiS_PALMPhase; + SiS_Pr->SiS_PALNPhase = SiS_PALNPhase; + SiS_Pr->SiS_PALMPhase2 = SiS_PALMPhase2; + SiS_Pr->SiS_PALNPhase2 = SiS_PALNPhase2; + SiS_Pr->SiS_SpecialPhase = SiS_SpecialPhase; + SiS_Pr->SiS_SpecialPhaseM = SiS_SpecialPhaseM; + SiS_Pr->SiS_SpecialPhaseJ = SiS_SpecialPhaseJ; SiS_Pr->SiS_NTSCTiming = SiS_NTSCTiming; SiS_Pr->SiS_PALTiming = SiS_PALTiming; SiS_Pr->SiS_HiTVSt1Timing = SiS_HiTVSt1Timing; SiS_Pr->SiS_HiTVSt2Timing = SiS_HiTVSt2Timing; - SiS_Pr->SiS_HiTVTextTiming = SiS_HiTVTextTiming; + SiS_Pr->SiS_HiTVExtTiming = SiS_HiTVExtTiming; SiS_Pr->SiS_HiTVGroup3Data = SiS_HiTVGroup3Data; SiS_Pr->SiS_HiTVGroup3Simu = SiS_HiTVGroup3Simu; +#if 0 + SiS_Pr->SiS_HiTVTextTiming = SiS_HiTVTextTiming; SiS_Pr->SiS_HiTVGroup3Text = SiS_HiTVGroup3Text; +#endif SiS_Pr->SiS_StPALData = SiS_StPALData; SiS_Pr->SiS_ExtPALData = SiS_ExtPALData; SiS_Pr->SiS_StNTSCData = SiS_StNTSCData; SiS_Pr->SiS_ExtNTSCData = SiS_ExtNTSCData; -/* SiS_Pr->SiS_St1HiTVData = SiS_St1HiTVData; */ + SiS_Pr->SiS_St1HiTVData = SiS_StHiTVData; SiS_Pr->SiS_St2HiTVData = SiS_St2HiTVData; SiS_Pr->SiS_ExtHiTVData = SiS_ExtHiTVData; + SiS_Pr->SiS_St525iData = SiS_StNTSCData; + SiS_Pr->SiS_St525pData = SiS_St525pData; + SiS_Pr->SiS_St750pData = SiS_St750pData; + SiS_Pr->SiS_Ext525iData = SiS_ExtNTSCData; + SiS_Pr->SiS_Ext525pData = SiS_ExtNTSCData; + SiS_Pr->SiS_Ext750pData = SiS_Ext750pData; SiS_Pr->pSiS_OutputSelect = &SiS_OutputSelect; SiS_Pr->pSiS_SoftSetting = &SiS_SoftSetting; + SiS_Pr->SiS_LCD1280x720Data = SiS_LCD1280x720Data; + SiS_Pr->SiS_StLCD1280x768_2Data = SiS_StLCD1280x768_2Data; + SiS_Pr->SiS_ExtLCD1280x768_2Data = SiS_ExtLCD1280x768_2Data; + SiS_Pr->SiS_LCD1280x768_3Data = SiS_LCD1280x768_3Data; + SiS_Pr->SiS_LCD1280x800Data = SiS_LCD1280x800Data; SiS_Pr->SiS_LCD1280x960Data = SiS_LCD1280x960Data; - SiS_Pr->SiS_ExtLCD1400x1050Data = SiS_ExtLCD1400x1050Data; - SiS_Pr->SiS_ExtLCD1600x1200Data = SiS_ExtLCD1600x1200Data; SiS_Pr->SiS_StLCD1400x1050Data = SiS_StLCD1400x1050Data; + SiS_Pr->SiS_ExtLCD1400x1050Data = SiS_ExtLCD1400x1050Data; + SiS_Pr->SiS_LCD1680x1050Data = SiS_LCD1680x1050Data; SiS_Pr->SiS_StLCD1600x1200Data = SiS_StLCD1600x1200Data; - SiS_Pr->SiS_NoScaleData1400x1050 = SiS_NoScaleData1400x1050; - SiS_Pr->SiS_NoScaleData1600x1200 = SiS_NoScaleData1600x1200; - SiS_Pr->SiS_ExtLCD1280x768Data = SiS_ExtLCD1280x768Data; - SiS_Pr->SiS_StLCD1280x768Data = SiS_StLCD1280x768Data; - SiS_Pr->SiS_NoScaleData1280x768 = SiS_NoScaleData1280x768; + SiS_Pr->SiS_ExtLCD1600x1200Data = SiS_ExtLCD1600x1200Data; SiS_Pr->SiS_NoScaleData = SiS_NoScaleData; SiS_Pr->SiS_LVDS320x480Data_1 = SiS_LVDS320x480Data_1; @@ -139,41 +169,12 @@ InitCommonPointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_Pr->SiS_LVDS640x480Data_1 = SiS_LVDS640x480Data_1; SiS_Pr->SiS_LVDS640x480Data_2 = SiS_LVDS640x480Data_2; - SiS_Pr->SiS_LVDSBARCO1366Data_1 = SiS_LVDSBARCO1366Data_1; - SiS_Pr->SiS_LVDSBARCO1366Data_2 = SiS_LVDSBARCO1366Data_2; - SiS_Pr->SiS_LVDSBARCO1024Data_1 = SiS_LVDSBARCO1024Data_1; - SiS_Pr->SiS_LVDSBARCO1024Data_2 = SiS_LVDSBARCO1024Data_2; SiS_Pr->SiS_LVDS848x480Data_1 = SiS_LVDS848x480Data_1; SiS_Pr->SiS_LVDS848x480Data_2 = SiS_LVDS848x480Data_2; - - SiS_Pr->SiS_CHTVUNTSCData = SiS_CHTVUNTSCData; - SiS_Pr->SiS_CHTVONTSCData = SiS_CHTVONTSCData; - - SiS_Pr->SiS_LCDA1024x768Data_1 = SiS_LCDA1024x768Data_1; - SiS_Pr->SiS_LCDA1024x768Data_2 = SiS_LCDA1024x768Data_2; - SiS_Pr->SiS_LCDA1280x1024Data_1 = SiS_LCDA1280x1024Data_1; - SiS_Pr->SiS_LCDA1280x1024Data_2 = SiS_LCDA1280x1024Data_2; - SiS_Pr->SiS_LCDA1400x1050Data_1 = SiS_LCDA1400x1050Data_1; - SiS_Pr->SiS_LCDA1400x1050Data_2 = SiS_LCDA1400x1050Data_2; - SiS_Pr->SiS_LCDA1600x1200Data_1 = SiS_LCDA1600x1200Data_1; - SiS_Pr->SiS_LCDA1600x1200Data_2 = SiS_LCDA1600x1200Data_2; - - SiS_Pr->LVDS1024x768Des_1 = SiS_PanelType1076_1; - SiS_Pr->LVDS1280x1024Des_1 = SiS_PanelType1210_1; - SiS_Pr->LVDS1400x1050Des_1 = SiS_PanelType1296_1; - SiS_Pr->LVDS1600x1200Des_1 = SiS_PanelType1600_1; - SiS_Pr->LVDS1024x768Des_2 = SiS_PanelType1076_2; - SiS_Pr->LVDS1280x1024Des_2 = SiS_PanelType1210_2; - SiS_Pr->LVDS1400x1050Des_2 = SiS_PanelType1296_2; - SiS_Pr->LVDS1600x1200Des_2 = SiS_PanelType1600_2; - - SiS_Pr->SiS_PanelTypeNS_1 = SiS_PanelTypeNS_1; - SiS_Pr->SiS_PanelTypeNS_2 = SiS_PanelTypeNS_2; - - SiS_Pr->SiS_CHTVUNTSCDesData = SiS_CHTVUNTSCDesData; - SiS_Pr->SiS_CHTVONTSCDesData = SiS_CHTVONTSCDesData; - SiS_Pr->SiS_CHTVUPALDesData = SiS_CHTVUPALDesData; - SiS_Pr->SiS_CHTVOPALDesData = SiS_CHTVOPALDesData; + SiS_Pr->SiS_LVDSBARCO1024Data_1 = SiS_LVDSBARCO1024Data_1; + SiS_Pr->SiS_LVDSBARCO1024Data_2 = SiS_LVDSBARCO1024Data_2; + SiS_Pr->SiS_LVDSBARCO1366Data_1 = SiS_LVDSBARCO1366Data_1; + SiS_Pr->SiS_LVDSBARCO1366Data_2 = SiS_LVDSBARCO1366Data_2; SiS_Pr->SiS_LVDSCRT11280x768_1 = SiS_LVDSCRT11280x768_1; SiS_Pr->SiS_LVDSCRT11024x600_1 = SiS_LVDSCRT11024x600_1; @@ -188,14 +189,23 @@ InitCommonPointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_Pr->SiS_LVDSCRT11024x600_2_H = SiS_LVDSCRT11024x600_2_H; SiS_Pr->SiS_LVDSCRT11152x768_2_H = SiS_LVDSCRT11152x768_2_H; SiS_Pr->SiS_LVDSCRT1320x480_1 = SiS_LVDSCRT1320x480_1; - SiS_Pr->SiS_LVDSCRT1XXXxXXX_1 = SiS_LVDSCRT1XXXxXXX_1; - SiS_Pr->SiS_LVDSCRT1XXXxXXX_1_H = SiS_LVDSCRT1XXXxXXX_1_H; SiS_Pr->SiS_LVDSCRT1640x480_1 = SiS_LVDSCRT1640x480_1; SiS_Pr->SiS_LVDSCRT1640x480_1_H = SiS_LVDSCRT1640x480_1_H; SiS_Pr->SiS_LVDSCRT1640x480_2 = SiS_LVDSCRT1640x480_2; SiS_Pr->SiS_LVDSCRT1640x480_2_H = SiS_LVDSCRT1640x480_2_H; SiS_Pr->SiS_LVDSCRT1640x480_3 = SiS_LVDSCRT1640x480_3; SiS_Pr->SiS_LVDSCRT1640x480_3_H = SiS_LVDSCRT1640x480_3_H; + + SiS_Pr->SiS_CHTVUNTSCData = SiS_CHTVUNTSCData; + SiS_Pr->SiS_CHTVONTSCData = SiS_CHTVONTSCData; + + SiS_Pr->SiS_CHTVUNTSCDesData = SiS_CHTVUNTSCDesData; + SiS_Pr->SiS_CHTVONTSCDesData = SiS_CHTVONTSCDesData; + SiS_Pr->SiS_CHTVUPALDesData = SiS_CHTVUPALDesData; + SiS_Pr->SiS_CHTVOPALDesData = SiS_CHTVOPALDesData; + + SiS_Pr->SiS_PanelMinLVDS = Panel_800x600; /* lowest value LVDS/LCDA */ + SiS_Pr->SiS_PanelMin301 = Panel_1024x768; /* lowest value 301 */ } #ifdef SIS300 @@ -232,19 +242,18 @@ InitTo300Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_StandTable[0x1c].CRTC[4] = 0x54; SiS_StandTable[0x1c].CRTC[5] = 0x80; - SiS_Pr->SiS_SModeIDTable = (SiS_StStruct *)SiS300_SModeIDTable; - SiS_Pr->SiS_VBModeIDTable = (SiS_VBModeStruct *)SiS300_VBModeIDTable; - SiS_Pr->SiS_EModeIDTable = (SiS_ExtStruct *)SiS300_EModeIDTable; - SiS_Pr->SiS_RefIndex = (SiS_Ext2Struct *)SiS300_RefIndex; - SiS_Pr->SiS_CRT1Table = (SiS_CRT1TableStruct *)SiS300_CRT1Table; + SiS_Pr->SiS_SModeIDTable = SiS300_SModeIDTable; + SiS_Pr->SiS_VBModeIDTable = SiS300_VBModeIDTable; + SiS_Pr->SiS_EModeIDTable = SiS300_EModeIDTable; + SiS_Pr->SiS_RefIndex = SiS300_RefIndex; + SiS_Pr->SiS_CRT1Table = SiS300_CRT1Table; if(HwInfo->jChipType == SIS_300) { - SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS300_MCLKData_300; /* 300 */ + SiS_Pr->SiS_MCLKData_0 = SiS300_MCLKData_300; /* 300 */ } else { - SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS300_MCLKData_630; /* 630, 730 */ + SiS_Pr->SiS_MCLKData_0 = SiS300_MCLKData_630; /* 630, 730 */ } - SiS_Pr->SiS_VCLKData = (SiS_VCLKDataStruct *)SiS300_VCLKData; + SiS_Pr->SiS_VCLKData = SiS300_VCLKData; SiS_Pr->SiS_VBVCLKData = (SiS_VBVCLKDataStruct *)SiS300_VCLKData; - SiS_Pr->SiS_ScreenOffset = SiS300_ScreenOffset; SiS_Pr->SiS_SR15 = SiS300_SR15; @@ -273,97 +282,102 @@ InitTo300Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_Pr->pSiS_YCSenseData2 = &SiS300_YCSenseData2; #endif - SiS_Pr->SiS_StLCD1024x768Data = (SiS_LCDDataStruct *)SiS300_StLCD1024x768Data; - SiS_Pr->SiS_ExtLCD1024x768Data = (SiS_LCDDataStruct *)SiS300_ExtLCD1024x768Data; - SiS_Pr->SiS_St2LCD1024x768Data = (SiS_LCDDataStruct *)SiS300_St2LCD1024x768Data; - SiS_Pr->SiS_StLCD1280x1024Data = (SiS_LCDDataStruct *)SiS300_StLCD1280x1024Data; - SiS_Pr->SiS_ExtLCD1280x1024Data = (SiS_LCDDataStruct *)SiS300_ExtLCD1280x1024Data; - SiS_Pr->SiS_St2LCD1280x1024Data = (SiS_LCDDataStruct *)SiS300_St2LCD1280x1024Data; - SiS_Pr->SiS_NoScaleData1024x768 = (SiS_LCDDataStruct *)SiS300_NoScaleData1024x768; - SiS_Pr->SiS_NoScaleData1280x1024 = (SiS_LCDDataStruct *)SiS300_NoScaleData1280x1024; - - SiS_Pr->SiS_PanelDelayTbl = (SiS_PanelDelayTblStruct *)SiS300_PanelDelayTbl; - SiS_Pr->SiS_PanelDelayTblLVDS = (SiS_PanelDelayTblStruct *)SiS300_PanelDelayTbl; -#if 0 - SiS_Pr->SiS_PanelDelayTblLVDS = (SiS_PanelDelayTblStruct *)SiS300_PanelDelayTblLVDS; -#endif - - SiS_Pr->SiS_CHTVUPALData = (SiS_LVDSDataStruct *)SiS300_CHTVUPALData; - SiS_Pr->SiS_CHTVOPALData = (SiS_LVDSDataStruct *)SiS300_CHTVOPALData; - SiS_Pr->SiS_CHTVUPALMData = SiS_CHTVUNTSCData; /* not supported on 300 series */ - SiS_Pr->SiS_CHTVOPALMData = SiS_CHTVONTSCData; /* not supported on 300 series */ - SiS_Pr->SiS_CHTVUPALNData = (SiS_LVDSDataStruct *)SiS300_CHTVUPALData; /* not supported on 300 series */ - SiS_Pr->SiS_CHTVOPALNData = (SiS_LVDSDataStruct *)SiS300_CHTVOPALData; /* not supported on 300 series */ - SiS_Pr->SiS_CHTVSOPALData = (SiS_LVDSDataStruct *)SiS300_CHTVSOPALData; - - SiS_Pr->SiS_PanelType00_1 = (SiS_LVDSDesStruct *)SiS300_PanelType00_1; - SiS_Pr->SiS_PanelType01_1 = (SiS_LVDSDesStruct *)SiS300_PanelType01_1; - SiS_Pr->SiS_PanelType02_1 = (SiS_LVDSDesStruct *)SiS300_PanelType02_1; - SiS_Pr->SiS_PanelType03_1 = (SiS_LVDSDesStruct *)SiS300_PanelType03_1; - SiS_Pr->SiS_PanelType04_1 = (SiS_LVDSDesStruct *)SiS300_PanelType04_1; - SiS_Pr->SiS_PanelType05_1 = (SiS_LVDSDesStruct *)SiS300_PanelType05_1; - SiS_Pr->SiS_PanelType06_1 = (SiS_LVDSDesStruct *)SiS300_PanelType06_1; - SiS_Pr->SiS_PanelType07_1 = (SiS_LVDSDesStruct *)SiS300_PanelType07_1; - SiS_Pr->SiS_PanelType08_1 = (SiS_LVDSDesStruct *)SiS300_PanelType08_1; - SiS_Pr->SiS_PanelType09_1 = (SiS_LVDSDesStruct *)SiS300_PanelType09_1; - SiS_Pr->SiS_PanelType0a_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0a_1; - SiS_Pr->SiS_PanelType0b_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0b_1; - SiS_Pr->SiS_PanelType0c_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0c_1; - SiS_Pr->SiS_PanelType0d_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0d_1; - SiS_Pr->SiS_PanelType0e_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0e_1; - SiS_Pr->SiS_PanelType0f_1 = (SiS_LVDSDesStruct *)SiS300_PanelType0f_1; - SiS_Pr->SiS_PanelType00_2 = (SiS_LVDSDesStruct *)SiS300_PanelType00_2; - SiS_Pr->SiS_PanelType01_2 = (SiS_LVDSDesStruct *)SiS300_PanelType01_2; - SiS_Pr->SiS_PanelType02_2 = (SiS_LVDSDesStruct *)SiS300_PanelType02_2; - SiS_Pr->SiS_PanelType03_2 = (SiS_LVDSDesStruct *)SiS300_PanelType03_2; - SiS_Pr->SiS_PanelType04_2 = (SiS_LVDSDesStruct *)SiS300_PanelType04_2; - SiS_Pr->SiS_PanelType05_2 = (SiS_LVDSDesStruct *)SiS300_PanelType05_2; - SiS_Pr->SiS_PanelType06_2 = (SiS_LVDSDesStruct *)SiS300_PanelType06_2; - SiS_Pr->SiS_PanelType07_2 = (SiS_LVDSDesStruct *)SiS300_PanelType07_2; - SiS_Pr->SiS_PanelType08_2 = (SiS_LVDSDesStruct *)SiS300_PanelType08_2; - SiS_Pr->SiS_PanelType09_2 = (SiS_LVDSDesStruct *)SiS300_PanelType09_2; - SiS_Pr->SiS_PanelType0a_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0a_2; - SiS_Pr->SiS_PanelType0b_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0b_2; - SiS_Pr->SiS_PanelType0c_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0c_2; - SiS_Pr->SiS_PanelType0d_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0d_2; - SiS_Pr->SiS_PanelType0e_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0e_2; - SiS_Pr->SiS_PanelType0f_2 = (SiS_LVDSDesStruct *)SiS300_PanelType0f_2; + SiS_Pr->SiS_PanelDelayTbl = SiS300_PanelDelayTbl; + SiS_Pr->SiS_PanelDelayTblLVDS = SiS300_PanelDelayTbl; + + SiS_Pr->SiS_ExtLCD1024x768Data = SiS300_ExtLCD1024x768Data; + SiS_Pr->SiS_St2LCD1024x768Data = SiS300_St2LCD1024x768Data; + SiS_Pr->SiS_ExtLCD1280x1024Data = SiS300_ExtLCD1280x1024Data; + SiS_Pr->SiS_St2LCD1280x1024Data = SiS300_St2LCD1280x1024Data; + + SiS_Pr->SiS_CRT2Part2_1024x768_1 = SiS300_CRT2Part2_1024x768_1; + SiS_Pr->SiS_CRT2Part2_1280x1024_1 = SiS300_CRT2Part2_1280x1024_1; + SiS_Pr->SiS_CRT2Part2_1024x768_2 = SiS300_CRT2Part2_1024x768_2; + SiS_Pr->SiS_CRT2Part2_1280x1024_2 = SiS300_CRT2Part2_1280x1024_2; + SiS_Pr->SiS_CRT2Part2_1024x768_3 = SiS300_CRT2Part2_1024x768_3; + SiS_Pr->SiS_CRT2Part2_1280x1024_3 = SiS300_CRT2Part2_1280x1024_3; + + SiS_Pr->SiS_CHTVUPALData = SiS300_CHTVUPALData; + SiS_Pr->SiS_CHTVOPALData = SiS300_CHTVOPALData; + SiS_Pr->SiS_CHTVUPALMData = SiS_CHTVUNTSCData; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVOPALMData = SiS_CHTVONTSCData; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVUPALNData = SiS300_CHTVUPALData; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVOPALNData = SiS300_CHTVOPALData; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVSOPALData = SiS300_CHTVSOPALData; + + SiS_Pr->SiS_PanelType00_1 = SiS300_PanelType00_1; + SiS_Pr->SiS_PanelType01_1 = SiS300_PanelType01_1; + SiS_Pr->SiS_PanelType02_1 = SiS300_PanelType02_1; + SiS_Pr->SiS_PanelType03_1 = SiS300_PanelType03_1; + SiS_Pr->SiS_PanelType04_1 = SiS300_PanelType04_1; + SiS_Pr->SiS_PanelType05_1 = SiS300_PanelType05_1; + SiS_Pr->SiS_PanelType06_1 = SiS300_PanelType06_1; + SiS_Pr->SiS_PanelType07_1 = SiS300_PanelType07_1; + SiS_Pr->SiS_PanelType08_1 = SiS300_PanelType08_1; + SiS_Pr->SiS_PanelType09_1 = SiS300_PanelType09_1; + SiS_Pr->SiS_PanelType0a_1 = SiS300_PanelType0a_1; + SiS_Pr->SiS_PanelType0b_1 = SiS300_PanelType0b_1; + SiS_Pr->SiS_PanelType0c_1 = SiS300_PanelType0c_1; + SiS_Pr->SiS_PanelType0d_1 = SiS300_PanelType0d_1; + SiS_Pr->SiS_PanelType0e_1 = SiS300_PanelType0e_1; + SiS_Pr->SiS_PanelType0f_1 = SiS300_PanelType0f_1; + SiS_Pr->SiS_PanelType00_2 = SiS300_PanelType00_2; + SiS_Pr->SiS_PanelType01_2 = SiS300_PanelType01_2; + SiS_Pr->SiS_PanelType02_2 = SiS300_PanelType02_2; + SiS_Pr->SiS_PanelType03_2 = SiS300_PanelType03_2; + SiS_Pr->SiS_PanelType04_2 = SiS300_PanelType04_2; + SiS_Pr->SiS_PanelType05_2 = SiS300_PanelType05_2; + SiS_Pr->SiS_PanelType06_2 = SiS300_PanelType06_2; + SiS_Pr->SiS_PanelType07_2 = SiS300_PanelType07_2; + SiS_Pr->SiS_PanelType08_2 = SiS300_PanelType08_2; + SiS_Pr->SiS_PanelType09_2 = SiS300_PanelType09_2; + SiS_Pr->SiS_PanelType0a_2 = SiS300_PanelType0a_2; + SiS_Pr->SiS_PanelType0b_2 = SiS300_PanelType0b_2; + SiS_Pr->SiS_PanelType0c_2 = SiS300_PanelType0c_2; + SiS_Pr->SiS_PanelType0d_2 = SiS300_PanelType0d_2; + SiS_Pr->SiS_PanelType0e_2 = SiS300_PanelType0e_2; + SiS_Pr->SiS_PanelType0f_2 = SiS300_PanelType0f_2; + SiS_Pr->SiS_PanelTypeNS_1 = SiS300_PanelTypeNS_1; + SiS_Pr->SiS_PanelTypeNS_2 = SiS300_PanelTypeNS_2; if(SiS_Pr->SiS_CustomT == CUT_BARCO1366) { - SiS_Pr->SiS_PanelType04_1 = (SiS_LVDSDesStruct *)SiS300_PanelType04_1a; - SiS_Pr->SiS_PanelType04_2 = (SiS_LVDSDesStruct *)SiS300_PanelType04_2a; + SiS_Pr->SiS_PanelType04_1 = SiS300_PanelType04_1a; + SiS_Pr->SiS_PanelType04_2 = SiS300_PanelType04_2a; } if(SiS_Pr->SiS_CustomT == CUT_BARCO1024) { - SiS_Pr->SiS_PanelType04_1 = (SiS_LVDSDesStruct *)SiS300_PanelType04_1b; - SiS_Pr->SiS_PanelType04_2 = (SiS_LVDSDesStruct *)SiS300_PanelType04_2b; + SiS_Pr->SiS_PanelType04_1 = SiS300_PanelType04_1b; + SiS_Pr->SiS_PanelType04_2 = SiS300_PanelType04_2b; } - SiS_Pr->SiS_LVDSCRT1800x600_1 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT1800x600_1; - SiS_Pr->SiS_LVDSCRT11024x768_1 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x768_1; - SiS_Pr->SiS_LVDSCRT11280x1024_1 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11280x1024_1; - SiS_Pr->SiS_LVDSCRT1800x600_1_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT1800x600_1_H; - SiS_Pr->SiS_LVDSCRT11024x768_1_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x768_1_H; - SiS_Pr->SiS_LVDSCRT11280x1024_1_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11280x1024_1_H; - SiS_Pr->SiS_LVDSCRT1800x600_2 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT1800x600_2; - SiS_Pr->SiS_LVDSCRT11024x768_2 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x768_2; - SiS_Pr->SiS_LVDSCRT11280x1024_2 = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11280x1024_2; - SiS_Pr->SiS_LVDSCRT1800x600_2_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT1800x600_2_H; - SiS_Pr->SiS_LVDSCRT11024x768_2_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11024x768_2_H; - SiS_Pr->SiS_LVDSCRT11280x1024_2_H = (SiS_LVDSCRT1DataStruct *)SiS300_LVDSCRT11280x1024_2_H; - SiS_Pr->SiS_CHTVCRT1UNTSC = (SiS_LVDSCRT1DataStruct *)SiS300_CHTVCRT1UNTSC; - SiS_Pr->SiS_CHTVCRT1ONTSC = (SiS_LVDSCRT1DataStruct *)SiS300_CHTVCRT1ONTSC; - SiS_Pr->SiS_CHTVCRT1UPAL = (SiS_LVDSCRT1DataStruct *)SiS300_CHTVCRT1UPAL; - SiS_Pr->SiS_CHTVCRT1OPAL = (SiS_LVDSCRT1DataStruct *)SiS300_CHTVCRT1OPAL; - SiS_Pr->SiS_CHTVCRT1SOPAL = (SiS_LVDSCRT1DataStruct *)SiS300_CHTVCRT1SOPAL; - SiS_Pr->SiS_CHTVReg_UNTSC = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_UNTSC; - SiS_Pr->SiS_CHTVReg_ONTSC = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_ONTSC; - SiS_Pr->SiS_CHTVReg_UPAL = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_UPAL; - SiS_Pr->SiS_CHTVReg_OPAL = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_OPAL; - SiS_Pr->SiS_CHTVReg_UPALM = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_UNTSC; /* not supported on 300 series */ - SiS_Pr->SiS_CHTVReg_OPALM = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_ONTSC; /* not supported on 300 series */ - SiS_Pr->SiS_CHTVReg_UPALN = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_UPAL; /* not supported on 300 series */ - SiS_Pr->SiS_CHTVReg_OPALN = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_OPAL; /* not supported on 300 series */ - SiS_Pr->SiS_CHTVReg_SOPAL = (SiS_CHTVRegDataStruct *)SiS300_CHTVReg_SOPAL; + SiS_Pr->SiS_LVDSCRT1800x600_1 = SiS300_LVDSCRT1800x600_1; + SiS_Pr->SiS_LVDSCRT1800x600_1_H = SiS300_LVDSCRT1800x600_1_H; + SiS_Pr->SiS_LVDSCRT1800x600_2 = SiS300_LVDSCRT1800x600_2; + SiS_Pr->SiS_LVDSCRT1800x600_2_H = SiS300_LVDSCRT1800x600_2_H; + SiS_Pr->SiS_LVDSCRT11024x768_1 = SiS300_LVDSCRT11024x768_1; + SiS_Pr->SiS_LVDSCRT11024x768_1_H = SiS300_LVDSCRT11024x768_1_H; + SiS_Pr->SiS_LVDSCRT11024x768_2 = SiS300_LVDSCRT11024x768_2; + SiS_Pr->SiS_LVDSCRT11024x768_2_H = SiS300_LVDSCRT11024x768_2_H; + SiS_Pr->SiS_LVDSCRT11280x1024_1 = SiS300_LVDSCRT11280x1024_1; + SiS_Pr->SiS_LVDSCRT11280x1024_1_H = SiS300_LVDSCRT11280x1024_1_H; + SiS_Pr->SiS_LVDSCRT11280x1024_2 = SiS300_LVDSCRT11280x1024_2; + SiS_Pr->SiS_LVDSCRT11280x1024_2_H = SiS300_LVDSCRT11280x1024_2_H; + SiS_Pr->SiS_LVDSCRT1XXXxXXX_1 = SiS300_LVDSCRT1XXXxXXX_1; + SiS_Pr->SiS_LVDSCRT1XXXxXXX_1_H = SiS300_LVDSCRT1XXXxXXX_1_H; + + SiS_Pr->SiS_CHTVCRT1UNTSC = SiS300_CHTVCRT1UNTSC; + SiS_Pr->SiS_CHTVCRT1ONTSC = SiS300_CHTVCRT1ONTSC; + SiS_Pr->SiS_CHTVCRT1UPAL = SiS300_CHTVCRT1UPAL; + SiS_Pr->SiS_CHTVCRT1OPAL = SiS300_CHTVCRT1OPAL; + SiS_Pr->SiS_CHTVCRT1SOPAL = SiS300_CHTVCRT1SOPAL; + SiS_Pr->SiS_CHTVReg_UNTSC = SiS300_CHTVReg_UNTSC; + SiS_Pr->SiS_CHTVReg_ONTSC = SiS300_CHTVReg_ONTSC; + SiS_Pr->SiS_CHTVReg_UPAL = SiS300_CHTVReg_UPAL; + SiS_Pr->SiS_CHTVReg_OPAL = SiS300_CHTVReg_OPAL; + SiS_Pr->SiS_CHTVReg_UPALM = SiS300_CHTVReg_UNTSC; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVReg_OPALM = SiS300_CHTVReg_ONTSC; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVReg_UPALN = SiS300_CHTVReg_UPAL; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVReg_OPALN = SiS300_CHTVReg_OPAL; /* not supported on 300 series */ + SiS_Pr->SiS_CHTVReg_SOPAL = SiS300_CHTVReg_SOPAL; SiS_Pr->SiS_CHTVVCLKUNTSC = SiS300_CHTVVCLKUNTSC; SiS_Pr->SiS_CHTVVCLKONTSC = SiS300_CHTVVCLKONTSC; SiS_Pr->SiS_CHTVVCLKUPAL = SiS300_CHTVVCLKUPAL; @@ -373,40 +387,6 @@ InitTo300Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_Pr->SiS_CHTVVCLKUPALN = SiS300_CHTVVCLKUPAL; /* not supported on 300 series */ SiS_Pr->SiS_CHTVVCLKOPALN = SiS300_CHTVVCLKOPAL; /* not supported on 300 series */ SiS_Pr->SiS_CHTVVCLKSOPAL = SiS300_CHTVVCLKSOPAL; - - SiS_Pr->SiS_CRT2Part2_1024x768_1 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1024x768_1; - SiS_Pr->SiS_CRT2Part2_1280x1024_1 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1280x1024_1; - SiS_Pr->SiS_CRT2Part2_1400x1050_1 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1400x1050_1; - SiS_Pr->SiS_CRT2Part2_1600x1200_1 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1600x1200_1; - SiS_Pr->SiS_CRT2Part2_1024x768_2 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1024x768_2; - SiS_Pr->SiS_CRT2Part2_1280x1024_2 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1280x1024_2; - SiS_Pr->SiS_CRT2Part2_1400x1050_2 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1400x1050_2; - SiS_Pr->SiS_CRT2Part2_1600x1200_2 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1600x1200_2; - SiS_Pr->SiS_CRT2Part2_1024x768_3 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1024x768_3; - SiS_Pr->SiS_CRT2Part2_1280x1024_3 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1280x1024_3; - SiS_Pr->SiS_CRT2Part2_1400x1050_3 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1400x1050_3; - SiS_Pr->SiS_CRT2Part2_1600x1200_3 = (SiS_Part2PortTblStruct *)SiS300_CRT2Part2_1600x1200_3; - - /* LCDResInfo will on 300 series be translated to 315 series definitions */ - SiS_Pr->SiS_Panel320x480 = Panel_320x480; - SiS_Pr->SiS_Panel640x480 = Panel_640x480; - SiS_Pr->SiS_Panel800x600 = Panel_800x600; - SiS_Pr->SiS_Panel1024x768 = Panel_1024x768; - SiS_Pr->SiS_Panel1280x1024 = Panel_1280x1024; - SiS_Pr->SiS_Panel1280x960 = Panel_1280x960; - SiS_Pr->SiS_Panel1024x600 = Panel_1024x600; - SiS_Pr->SiS_Panel1152x768 = Panel_1152x768; - SiS_Pr->SiS_Panel1280x768 = Panel_1280x768; - SiS_Pr->SiS_Panel1600x1200 = 255; /* Something illegal */ - SiS_Pr->SiS_Panel1400x1050 = 255; - SiS_Pr->SiS_Panel640x480_2 = 255; - SiS_Pr->SiS_Panel640x480_3 = 255; - SiS_Pr->SiS_Panel1152x864 = 255; - SiS_Pr->SiS_PanelMax = Panel_320x480; /* highest value */ - SiS_Pr->SiS_PanelMinLVDS = Panel_800x600; /* Lowest value LVDS */ - SiS_Pr->SiS_PanelMin301 = Panel_1024x768; /* lowest value 301 */ - SiS_Pr->SiS_PanelCustom = Panel_Custom; - SiS_Pr->SiS_PanelBarco1366 = Panel_Barco1366; } #endif @@ -444,23 +424,24 @@ InitTo310Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_StandTable[0x1c].CRTC[4] = 0x55; SiS_StandTable[0x1c].CRTC[5] = 0x81; - SiS_Pr->SiS_SModeIDTable = (SiS_StStruct *)SiS310_SModeIDTable; - SiS_Pr->SiS_EModeIDTable = (SiS_ExtStruct *)SiS310_EModeIDTable; + SiS_Pr->SiS_SModeIDTable = SiS310_SModeIDTable; + SiS_Pr->SiS_EModeIDTable = SiS310_EModeIDTable; SiS_Pr->SiS_RefIndex = (SiS_Ext2Struct *)SiS310_RefIndex; - SiS_Pr->SiS_CRT1Table = (SiS_CRT1TableStruct *)SiS310_CRT1Table; - if(HwInfo->jChipType >= SIS_661) { - SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS310_MCLKData_0_660; /* 661/741/760 */ + SiS_Pr->SiS_CRT1Table = SiS310_CRT1Table; + if(HwInfo->jChipType >= SIS_760) { + SiS_Pr->SiS_MCLKData_0 = SiS310_MCLKData_0_760; /* 760 */ + } else if(HwInfo->jChipType >= SIS_661) { + SiS_Pr->SiS_MCLKData_0 = SiS310_MCLKData_0_660; /* 661/741 */ } else if(HwInfo->jChipType == SIS_330) { - SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS310_MCLKData_0_330; /* 330 */ + SiS_Pr->SiS_MCLKData_0 = SiS310_MCLKData_0_330; /* 330 */ } else if(HwInfo->jChipType > SIS_315PRO) { - SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS310_MCLKData_0_650; /* 550, 650, 740 */ + SiS_Pr->SiS_MCLKData_0 = SiS310_MCLKData_0_650; /* 550, 650, 740 */ } else { - SiS_Pr->SiS_MCLKData_0 = (SiS_MCLKDataStruct *)SiS310_MCLKData_0_315; /* 315 */ + SiS_Pr->SiS_MCLKData_0 = SiS310_MCLKData_0_315; /* 315 */ } - SiS_Pr->SiS_MCLKData_1 = (SiS_MCLKDataStruct *)SiS310_MCLKData_1; - SiS_Pr->SiS_VCLKData = (SiS_VCLKDataStruct *)SiS310_VCLKData; - SiS_Pr->SiS_VBVCLKData = (SiS_VBVCLKDataStruct *)SiS310_VBVCLKData; - SiS_Pr->SiS_ScreenOffset = SiS310_ScreenOffset; + SiS_Pr->SiS_MCLKData_1 = SiS310_MCLKData_1; + SiS_Pr->SiS_VCLKData = SiS310_VCLKData; + SiS_Pr->SiS_VBVCLKData = SiS310_VBVCLKData; SiS_Pr->SiS_SR15 = SiS310_SR15; @@ -489,124 +470,96 @@ InitTo310Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_Pr->pSiS_YCSenseData2 = &SiS310_YCSenseData2; #endif - SiS_Pr->SiS_StLCD1024x768Data = (SiS_LCDDataStruct *)SiS310_StLCD1024x768Data; - SiS_Pr->SiS_ExtLCD1024x768Data = (SiS_LCDDataStruct *)SiS310_ExtLCD1024x768Data; - SiS_Pr->SiS_St2LCD1024x768Data = (SiS_LCDDataStruct *)SiS310_St2LCD1024x768Data; - SiS_Pr->SiS_StLCD1280x1024Data = (SiS_LCDDataStruct *)SiS310_StLCD1280x1024Data; - SiS_Pr->SiS_ExtLCD1280x1024Data = (SiS_LCDDataStruct *)SiS310_ExtLCD1280x1024Data; - SiS_Pr->SiS_St2LCD1280x1024Data = (SiS_LCDDataStruct *)SiS310_St2LCD1280x1024Data; - SiS_Pr->SiS_NoScaleData1024x768 = (SiS_LCDDataStruct *)SiS310_NoScaleData1024x768; - SiS_Pr->SiS_NoScaleData1280x1024 = (SiS_LCDDataStruct *)SiS310_NoScaleData1280x1024; - - SiS_Pr->SiS_PanelDelayTbl = (SiS_PanelDelayTblStruct *)SiS310_PanelDelayTbl; - SiS_Pr->SiS_PanelDelayTblLVDS = (SiS_PanelDelayTblStruct *)SiS310_PanelDelayTblLVDS; - - SiS_Pr->SiS_CHTVUPALData = (SiS_LVDSDataStruct *)SiS310_CHTVUPALData; - SiS_Pr->SiS_CHTVOPALData = (SiS_LVDSDataStruct *)SiS310_CHTVOPALData; - SiS_Pr->SiS_CHTVUPALMData = (SiS_LVDSDataStruct *)SiS310_CHTVUPALMData; - SiS_Pr->SiS_CHTVOPALMData = (SiS_LVDSDataStruct *)SiS310_CHTVOPALMData; - SiS_Pr->SiS_CHTVUPALNData = (SiS_LVDSDataStruct *)SiS310_CHTVUPALNData; - SiS_Pr->SiS_CHTVOPALNData = (SiS_LVDSDataStruct *)SiS310_CHTVOPALNData; - SiS_Pr->SiS_CHTVSOPALData = (SiS_LVDSDataStruct *)SiS310_CHTVSOPALData; - - SiS_Pr->SiS_PanelType00_1 = (SiS_LVDSDesStruct *)SiS310_PanelType00_1; - SiS_Pr->SiS_PanelType01_1 = (SiS_LVDSDesStruct *)SiS310_PanelType01_1; - SiS_Pr->SiS_PanelType02_1 = (SiS_LVDSDesStruct *)SiS310_PanelType02_1; - SiS_Pr->SiS_PanelType03_1 = (SiS_LVDSDesStruct *)SiS310_PanelType03_1; - SiS_Pr->SiS_PanelType04_1 = (SiS_LVDSDesStruct *)SiS310_PanelType04_1; - SiS_Pr->SiS_PanelType05_1 = (SiS_LVDSDesStruct *)SiS310_PanelType05_1; - SiS_Pr->SiS_PanelType06_1 = (SiS_LVDSDesStruct *)SiS310_PanelType06_1; - SiS_Pr->SiS_PanelType07_1 = (SiS_LVDSDesStruct *)SiS310_PanelType07_1; - SiS_Pr->SiS_PanelType08_1 = (SiS_LVDSDesStruct *)SiS310_PanelType08_1; - SiS_Pr->SiS_PanelType09_1 = (SiS_LVDSDesStruct *)SiS310_PanelType09_1; - SiS_Pr->SiS_PanelType0a_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0a_1; - SiS_Pr->SiS_PanelType0b_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0b_1; - SiS_Pr->SiS_PanelType0c_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0c_1; - SiS_Pr->SiS_PanelType0d_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0d_1; - SiS_Pr->SiS_PanelType0e_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0e_1; - SiS_Pr->SiS_PanelType0f_1 = (SiS_LVDSDesStruct *)SiS310_PanelType0f_1; - SiS_Pr->SiS_PanelType00_2 = (SiS_LVDSDesStruct *)SiS310_PanelType00_2; - SiS_Pr->SiS_PanelType01_2 = (SiS_LVDSDesStruct *)SiS310_PanelType01_2; - SiS_Pr->SiS_PanelType02_2 = (SiS_LVDSDesStruct *)SiS310_PanelType02_2; - SiS_Pr->SiS_PanelType03_2 = (SiS_LVDSDesStruct *)SiS310_PanelType03_2; - SiS_Pr->SiS_PanelType04_2 = (SiS_LVDSDesStruct *)SiS310_PanelType04_2; - SiS_Pr->SiS_PanelType05_2 = (SiS_LVDSDesStruct *)SiS310_PanelType05_2; - SiS_Pr->SiS_PanelType06_2 = (SiS_LVDSDesStruct *)SiS310_PanelType06_2; - SiS_Pr->SiS_PanelType07_2 = (SiS_LVDSDesStruct *)SiS310_PanelType07_2; - SiS_Pr->SiS_PanelType08_2 = (SiS_LVDSDesStruct *)SiS310_PanelType08_2; - SiS_Pr->SiS_PanelType09_2 = (SiS_LVDSDesStruct *)SiS310_PanelType09_2; - SiS_Pr->SiS_PanelType0a_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0a_2; - SiS_Pr->SiS_PanelType0b_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0b_2; - SiS_Pr->SiS_PanelType0c_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0c_2; - SiS_Pr->SiS_PanelType0d_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0d_2; - SiS_Pr->SiS_PanelType0e_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0e_2; - SiS_Pr->SiS_PanelType0f_2 = (SiS_LVDSDesStruct *)SiS310_PanelType0f_2; - - SiS_Pr->SiS_CRT2Part2_1024x768_1 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1024x768_1; - SiS_Pr->SiS_CRT2Part2_1280x1024_1 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1280x1024_1; - SiS_Pr->SiS_CRT2Part2_1400x1050_1 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1400x1050_1; - SiS_Pr->SiS_CRT2Part2_1600x1200_1 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1600x1200_1; - SiS_Pr->SiS_CRT2Part2_1024x768_2 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1024x768_2; - SiS_Pr->SiS_CRT2Part2_1280x1024_2 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1280x1024_2; - SiS_Pr->SiS_CRT2Part2_1400x1050_2 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1400x1050_2; - SiS_Pr->SiS_CRT2Part2_1600x1200_2 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1600x1200_2; - SiS_Pr->SiS_CRT2Part2_1024x768_3 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1024x768_3; - SiS_Pr->SiS_CRT2Part2_1280x1024_3 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1280x1024_3; - SiS_Pr->SiS_CRT2Part2_1400x1050_3 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1400x1050_3; - SiS_Pr->SiS_CRT2Part2_1600x1200_3 = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_1600x1200_3; - - SiS_Pr->SiS_LVDSCRT1800x600_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1800x600_1; - SiS_Pr->SiS_LVDSCRT11024x768_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x768_1; - SiS_Pr->SiS_LVDSCRT11280x1024_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x1024_1; - SiS_Pr->SiS_LVDSCRT11400x1050_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11400x1050_1; - SiS_Pr->SiS_LVDSCRT11600x1200_1 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11600x1200_1; - SiS_Pr->SiS_LVDSCRT1800x600_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1800x600_1_H; - SiS_Pr->SiS_LVDSCRT11024x768_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x768_1_H; - SiS_Pr->SiS_LVDSCRT11280x1024_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x1024_1_H; - SiS_Pr->SiS_LVDSCRT11400x1050_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11400x1050_1_H; - SiS_Pr->SiS_LVDSCRT11600x1200_1_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11600x1200_1_H; - SiS_Pr->SiS_LVDSCRT1800x600_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1800x600_2; - SiS_Pr->SiS_LVDSCRT11024x768_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x768_2; - SiS_Pr->SiS_LVDSCRT11280x1024_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x1024_2; - SiS_Pr->SiS_LVDSCRT11400x1050_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11400x1050_2; - SiS_Pr->SiS_LVDSCRT11600x1200_2 = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11600x1200_2; - SiS_Pr->SiS_LVDSCRT1800x600_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT1800x600_2_H; - SiS_Pr->SiS_LVDSCRT11024x768_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11024x768_2_H; - SiS_Pr->SiS_LVDSCRT11280x1024_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11280x1024_2_H; - SiS_Pr->SiS_LVDSCRT11400x1050_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11400x1050_2_H; - SiS_Pr->SiS_LVDSCRT11600x1200_2_H = (SiS_LVDSCRT1DataStruct *)SiS310_LVDSCRT11600x1200_2_H; - SiS_Pr->SiS_CHTVCRT1UNTSC = (SiS_LVDSCRT1DataStruct *)SiS310_CHTVCRT1UNTSC; - SiS_Pr->SiS_CHTVCRT1ONTSC = (SiS_LVDSCRT1DataStruct *)SiS310_CHTVCRT1ONTSC; - SiS_Pr->SiS_CHTVCRT1UPAL = (SiS_LVDSCRT1DataStruct *)SiS310_CHTVCRT1UPAL; - SiS_Pr->SiS_CHTVCRT1OPAL = (SiS_LVDSCRT1DataStruct *)SiS310_CHTVCRT1OPAL; - SiS_Pr->SiS_CHTVCRT1SOPAL = (SiS_LVDSCRT1DataStruct *)SiS310_CHTVCRT1OPAL; - - SiS_Pr->SiS_CHTVReg_UNTSC = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_UNTSC; - SiS_Pr->SiS_CHTVReg_ONTSC = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_ONTSC; - SiS_Pr->SiS_CHTVReg_UPAL = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_UPAL; - SiS_Pr->SiS_CHTVReg_OPAL = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_OPAL; - SiS_Pr->SiS_CHTVReg_UPALM = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_UPALM; - SiS_Pr->SiS_CHTVReg_OPALM = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_OPALM; - SiS_Pr->SiS_CHTVReg_UPALN = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_UPALN; - SiS_Pr->SiS_CHTVReg_OPALN = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_OPALN; - SiS_Pr->SiS_CHTVReg_SOPAL = (SiS_CHTVRegDataStruct *)SiS310_CHTVReg_OPAL; - - SiS_Pr->SiS_LCDACRT11024x768_1 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11024x768_1; - SiS_Pr->SiS_LCDACRT11280x1024_1 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11280x1024_1; - SiS_Pr->SiS_LCDACRT11400x1050_1 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11400x1050_1; - SiS_Pr->SiS_LCDACRT11600x1200_1 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11600x1200_1; - SiS_Pr->SiS_LCDACRT11024x768_1_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11024x768_1_H; - SiS_Pr->SiS_LCDACRT11280x1024_1_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11280x1024_1_H; - SiS_Pr->SiS_LCDACRT11400x1050_1_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11400x1050_1_H; - SiS_Pr->SiS_LCDACRT11600x1200_1_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11600x1200_1_H; - SiS_Pr->SiS_LCDACRT11024x768_2 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11024x768_2; - SiS_Pr->SiS_LCDACRT11280x1024_2 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11280x1024_2; - SiS_Pr->SiS_LCDACRT11400x1050_2 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11400x1050_2; - SiS_Pr->SiS_LCDACRT11600x1200_2 = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11600x1200_2; - SiS_Pr->SiS_LCDACRT11024x768_2_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11024x768_2_H; - SiS_Pr->SiS_LCDACRT11280x1024_2_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11280x1024_2_H; - SiS_Pr->SiS_LCDACRT11400x1050_2_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11400x1050_2_H; - SiS_Pr->SiS_LCDACRT11600x1200_2_H = (SiS_LCDACRT1DataStruct *)SiS310_LCDACRT11600x1200_2_H; + SiS_Pr->SiS_PanelDelayTbl = SiS310_PanelDelayTbl; + SiS_Pr->SiS_PanelDelayTblLVDS = SiS310_PanelDelayTblLVDS; + + SiS_Pr->SiS_St2LCD1024x768Data = SiS310_St2LCD1024x768Data; + SiS_Pr->SiS_ExtLCD1024x768Data = SiS310_ExtLCD1024x768Data; + SiS_Pr->SiS_St2LCD1280x1024Data = SiS310_St2LCD1280x1024Data; + SiS_Pr->SiS_ExtLCD1280x1024Data = SiS310_ExtLCD1280x1024Data; + + SiS_Pr->SiS_CRT2Part2_1024x768_1 = SiS310_CRT2Part2_1024x768_1; + + SiS_Pr->SiS_PanelType00_1 = SiS310_PanelType00_1; + SiS_Pr->SiS_PanelType01_1 = SiS310_PanelType01_1; + SiS_Pr->SiS_PanelType02_1 = SiS310_PanelType02_1; + SiS_Pr->SiS_PanelType03_1 = SiS310_PanelType03_1; + SiS_Pr->SiS_PanelType04_1 = SiS310_PanelType04_1; + SiS_Pr->SiS_PanelType05_1 = SiS310_PanelType05_1; + SiS_Pr->SiS_PanelType06_1 = SiS310_PanelType06_1; + SiS_Pr->SiS_PanelType07_1 = SiS310_PanelType07_1; + SiS_Pr->SiS_PanelType08_1 = SiS310_PanelType08_1; + SiS_Pr->SiS_PanelType09_1 = SiS310_PanelType09_1; + SiS_Pr->SiS_PanelType0a_1 = SiS310_PanelType0a_1; + SiS_Pr->SiS_PanelType0b_1 = SiS310_PanelType0b_1; + SiS_Pr->SiS_PanelType0c_1 = SiS310_PanelType0c_1; + SiS_Pr->SiS_PanelType0d_1 = SiS310_PanelType0d_1; + SiS_Pr->SiS_PanelType0e_1 = SiS310_PanelType0e_1; + SiS_Pr->SiS_PanelType0f_1 = SiS310_PanelType0f_1; + SiS_Pr->SiS_PanelType00_2 = SiS310_PanelType00_2; + SiS_Pr->SiS_PanelType01_2 = SiS310_PanelType01_2; + SiS_Pr->SiS_PanelType02_2 = SiS310_PanelType02_2; + SiS_Pr->SiS_PanelType03_2 = SiS310_PanelType03_2; + SiS_Pr->SiS_PanelType04_2 = SiS310_PanelType04_2; + SiS_Pr->SiS_PanelType05_2 = SiS310_PanelType05_2; + SiS_Pr->SiS_PanelType06_2 = SiS310_PanelType06_2; + SiS_Pr->SiS_PanelType07_2 = SiS310_PanelType07_2; + SiS_Pr->SiS_PanelType08_2 = SiS310_PanelType08_2; + SiS_Pr->SiS_PanelType09_2 = SiS310_PanelType09_2; + SiS_Pr->SiS_PanelType0a_2 = SiS310_PanelType0a_2; + SiS_Pr->SiS_PanelType0b_2 = SiS310_PanelType0b_2; + SiS_Pr->SiS_PanelType0c_2 = SiS310_PanelType0c_2; + SiS_Pr->SiS_PanelType0d_2 = SiS310_PanelType0d_2; + SiS_Pr->SiS_PanelType0e_2 = SiS310_PanelType0e_2; + SiS_Pr->SiS_PanelType0f_2 = SiS310_PanelType0f_2; + SiS_Pr->SiS_PanelTypeNS_1 = SiS310_PanelTypeNS_1; + SiS_Pr->SiS_PanelTypeNS_2 = SiS310_PanelTypeNS_2; + + SiS_Pr->SiS_CHTVUPALData = SiS310_CHTVUPALData; + SiS_Pr->SiS_CHTVOPALData = SiS310_CHTVOPALData; + SiS_Pr->SiS_CHTVUPALMData = SiS310_CHTVUPALMData; + SiS_Pr->SiS_CHTVOPALMData = SiS310_CHTVOPALMData; + SiS_Pr->SiS_CHTVUPALNData = SiS310_CHTVUPALNData; + SiS_Pr->SiS_CHTVOPALNData = SiS310_CHTVOPALNData; + SiS_Pr->SiS_CHTVSOPALData = SiS310_CHTVSOPALData; + + SiS_Pr->SiS_LVDSCRT1800x600_1 = SiS310_LVDSCRT1800x600_1; + SiS_Pr->SiS_LVDSCRT11024x768_1 = SiS310_LVDSCRT11024x768_1; + SiS_Pr->SiS_LVDSCRT11280x1024_1 = SiS310_LVDSCRT11280x1024_1; + SiS_Pr->SiS_LVDSCRT11400x1050_1 = SiS310_LVDSCRT11400x1050_1; + SiS_Pr->SiS_LVDSCRT11600x1200_1 = SiS310_LVDSCRT11600x1200_1; + SiS_Pr->SiS_LVDSCRT1800x600_1_H = SiS310_LVDSCRT1800x600_1_H; + SiS_Pr->SiS_LVDSCRT11024x768_1_H = SiS310_LVDSCRT11024x768_1_H; + SiS_Pr->SiS_LVDSCRT11280x1024_1_H = SiS310_LVDSCRT11280x1024_1_H; + SiS_Pr->SiS_LVDSCRT11400x1050_1_H = SiS310_LVDSCRT11400x1050_1_H; + SiS_Pr->SiS_LVDSCRT11600x1200_1_H = SiS310_LVDSCRT11600x1200_1_H; + SiS_Pr->SiS_LVDSCRT1800x600_2 = SiS310_LVDSCRT1800x600_2; + SiS_Pr->SiS_LVDSCRT11024x768_2 = SiS310_LVDSCRT11024x768_2; + SiS_Pr->SiS_LVDSCRT11280x1024_2 = SiS310_LVDSCRT11280x1024_2; + SiS_Pr->SiS_LVDSCRT11400x1050_2 = SiS310_LVDSCRT11400x1050_2; + SiS_Pr->SiS_LVDSCRT11600x1200_2 = SiS310_LVDSCRT11600x1200_2; + SiS_Pr->SiS_LVDSCRT1800x600_2_H = SiS310_LVDSCRT1800x600_2_H; + SiS_Pr->SiS_LVDSCRT11024x768_2_H = SiS310_LVDSCRT11024x768_2_H; + SiS_Pr->SiS_LVDSCRT11280x1024_2_H = SiS310_LVDSCRT11280x1024_2_H; + SiS_Pr->SiS_LVDSCRT11400x1050_2_H = SiS310_LVDSCRT11400x1050_2_H; + SiS_Pr->SiS_LVDSCRT11600x1200_2_H = SiS310_LVDSCRT11600x1200_2_H; + SiS_Pr->SiS_LVDSCRT1XXXxXXX_1 = SiS310_LVDSCRT1XXXxXXX_1; + SiS_Pr->SiS_LVDSCRT1XXXxXXX_1_H = SiS310_LVDSCRT1XXXxXXX_1_H; + SiS_Pr->SiS_CHTVCRT1UNTSC = SiS310_CHTVCRT1UNTSC; + SiS_Pr->SiS_CHTVCRT1ONTSC = SiS310_CHTVCRT1ONTSC; + SiS_Pr->SiS_CHTVCRT1UPAL = SiS310_CHTVCRT1UPAL; + SiS_Pr->SiS_CHTVCRT1OPAL = SiS310_CHTVCRT1OPAL; + SiS_Pr->SiS_CHTVCRT1SOPAL = SiS310_CHTVCRT1OPAL; + + SiS_Pr->SiS_CHTVReg_UNTSC = SiS310_CHTVReg_UNTSC; + SiS_Pr->SiS_CHTVReg_ONTSC = SiS310_CHTVReg_ONTSC; + SiS_Pr->SiS_CHTVReg_UPAL = SiS310_CHTVReg_UPAL; + SiS_Pr->SiS_CHTVReg_OPAL = SiS310_CHTVReg_OPAL; + SiS_Pr->SiS_CHTVReg_UPALM = SiS310_CHTVReg_UPALM; + SiS_Pr->SiS_CHTVReg_OPALM = SiS310_CHTVReg_OPALM; + SiS_Pr->SiS_CHTVReg_UPALN = SiS310_CHTVReg_UPALN; + SiS_Pr->SiS_CHTVReg_OPALN = SiS310_CHTVReg_OPALN; + SiS_Pr->SiS_CHTVReg_SOPAL = SiS310_CHTVReg_OPAL; SiS_Pr->SiS_CHTVVCLKUNTSC = SiS310_CHTVVCLKUNTSC; SiS_Pr->SiS_CHTVVCLKONTSC = SiS310_CHTVVCLKONTSC; @@ -615,28 +568,8 @@ InitTo310Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_Pr->SiS_CHTVVCLKUPALM = SiS310_CHTVVCLKUPALM; SiS_Pr->SiS_CHTVVCLKOPALM = SiS310_CHTVVCLKOPALM; SiS_Pr->SiS_CHTVVCLKUPALN = SiS310_CHTVVCLKUPALN; - SiS_Pr->SiS_CHTVVCLKOPALN = SiS310_CHTVVCLKOPALN; + SiS_Pr->SiS_CHTVVCLKOPALN = SiS310_CHTVVCLKOPALN; SiS_Pr->SiS_CHTVVCLKSOPAL = SiS310_CHTVVCLKOPAL; - - SiS_Pr->SiS_Panel320x480 = Panel_320x480; - SiS_Pr->SiS_Panel640x480 = Panel_640x480; - SiS_Pr->SiS_Panel800x600 = Panel_800x600; - SiS_Pr->SiS_Panel1024x768 = Panel_1024x768; - SiS_Pr->SiS_Panel1280x1024 = Panel_1280x1024; - SiS_Pr->SiS_Panel1280x960 = Panel_1280x960; - SiS_Pr->SiS_Panel1600x1200 = Panel_1600x1200; - SiS_Pr->SiS_Panel1400x1050 = Panel_1400x1050; - SiS_Pr->SiS_Panel1152x768 = Panel_1152x768; - SiS_Pr->SiS_Panel1152x864 = Panel_1152x864; - SiS_Pr->SiS_Panel1280x768 = Panel_1280x768; - SiS_Pr->SiS_Panel1024x600 = Panel_1024x600; - SiS_Pr->SiS_Panel640x480_2 = Panel_640x480_2; - SiS_Pr->SiS_Panel640x480_3 = Panel_640x480_3; - SiS_Pr->SiS_PanelMax = Panel_320x480; /* highest value */ - SiS_Pr->SiS_PanelMinLVDS = Panel_800x600; /* lowest value LVDS/LCDA */ - SiS_Pr->SiS_PanelMin301 = Panel_1024x768; /* lowest value 301 */ - SiS_Pr->SiS_PanelCustom = Panel_Custom; - SiS_Pr->SiS_PanelBarco1366 = 255; } #endif @@ -677,7 +610,8 @@ SiSInitPtr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) /*********************************************/ USHORT -SiS_GetModeID(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth, BOOLEAN FSTN) +SiS_GetModeID(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, + int Depth, BOOLEAN FSTN, int LCDwidth, int LCDheight) { USHORT ModeIndex = 0; @@ -745,10 +679,23 @@ SiS_GetModeID(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Dept } break; case 1280: - if(VDisplay == 1024) ModeIndex = ModeIndex_1280x1024[Depth]; - else if(!(VBFlags & CRT1_LCDA)) { + if(VDisplay == 1024) ModeIndex = ModeIndex_1280x1024[Depth]; + else if(VDisplay == 800) { + if(VGAEngine == SIS_315_VGA) { + if((VBFlags & CRT1_LCDA) && (LCDwidth == 1280) && (LCDheight == 800)) { + ModeIndex = ModeIndex_1280x800[Depth]; + } else if(!(VBFlags & CRT1_LCDA)) { + ModeIndex = ModeIndex_1280x800[Depth]; + } + } + } else if(VDisplay == 720) { + if((VBFlags & CRT1_LCDA) && (LCDwidth == 1280) && (LCDheight == 720)) { + ModeIndex = ModeIndex_1280x720[Depth]; + } else if(!(VBFlags & CRT1_LCDA)) { + ModeIndex = ModeIndex_1280x720[Depth]; + } + } else if(!(VBFlags & CRT1_LCDA)) { if(VDisplay == 960) ModeIndex = ModeIndex_1280x960[Depth]; - else if(VDisplay == 720) ModeIndex = ModeIndex_1280x720[Depth]; else if(VDisplay == 768) { if(VGAEngine == SIS_300_VGA) { ModeIndex = ModeIndex_300_1280x768[Depth]; @@ -768,12 +715,25 @@ SiS_GetModeID(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Dept break; case 1400: if(VGAEngine == SIS_315_VGA) { - if(VDisplay == 1050) ModeIndex = ModeIndex_1400x1050[Depth]; + if(VDisplay == 1050) { + if((VBFlags & CRT1_LCDA) && + (((LCDwidth == 1400) && (LCDheight == 1050)) || + ((LCDwidth == 1600) && (LCDheight == 1200)))) { + ModeIndex = ModeIndex_1400x1050[Depth]; + } else if(!(VBFlags & CRT1_LCDA)) { + ModeIndex = ModeIndex_1400x1050[Depth]; + } + } } break; case 1600: if(VDisplay == 1200) ModeIndex = ModeIndex_1600x1200[Depth]; break; + case 1680: + if(VGAEngine == SIS_315_VGA) { + if(VDisplay == 1050) ModeIndex = ModeIndex_1680x1050[Depth]; + } + break; case 1920: if(!(VBFlags & CRT1_LCDA)) { if(VDisplay == 1440) ModeIndex = ModeIndex_1920x1440[Depth]; @@ -818,14 +778,18 @@ SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, break; case 400: if(CustomT != CUT_PANEL848) { - if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth]; + if(!((VGAEngine == SIS_300_VGA) && (VBFlags & VB_TRUMPION))) { + if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth]; + } } break; case 512: if(CustomT != CUT_PANEL848) { - if(VDisplay == 384) { + if(!((VGAEngine == SIS_300_VGA) && (VBFlags & VB_TRUMPION))) { if(LCDwidth != 1024 || LCDheight != 600) { - ModeIndex = ModeIndex_512x384[Depth]; + if(VDisplay == 384) { + ModeIndex = ModeIndex_512x384[Depth]; + } } } } @@ -865,6 +829,9 @@ SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, if((VDisplay == 768) && (LCDheight == 768)) { ModeIndex = ModeIndex_310_1280x768[Depth]; } + if((VDisplay == 800) && (LCDheight == 800)) { + ModeIndex = ModeIndex_310_1280x768[Depth]; + } } break; case 1360: @@ -887,7 +854,7 @@ SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, if(VDisplay == 1200) ModeIndex = ModeIndex_1600x1200[Depth]; } break; - } + } } else if(VBFlags & VB_SISBRIDGE) { @@ -916,7 +883,8 @@ SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, case 1280: if(VDisplay == 1024) ModeIndex = ModeIndex_1280x1024[Depth]; else if(VDisplay == 768) { - if((LCDheight != 1050) && (LCDheight != 960)) { + if((LCDheight == 768) || (LCDwidth == 1680) || + ((LCDheight == 1024) && (VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)))) { if(VGAEngine == SIS_300_VGA) { ModeIndex = ModeIndex_300_1280x768[Depth]; } else { @@ -924,21 +892,45 @@ SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, } } } else if(VDisplay == 960) { - if((LCDheight != 1050) && (LCDheight != 768)) { + if((LCDheight == 960) || + ((LCDheight == 1024) && (VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)))) { ModeIndex = ModeIndex_1280x960[Depth]; } + } else if(VGAEngine == SIS_315_VGA) { + if(VDisplay == 800) { + if((LCDheight == 800) || (LCDwidth == 1680) || + ((LCDheight == 1024) && (VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)))) { + ModeIndex = ModeIndex_1280x800[Depth]; + } + } else if(VDisplay == 720) { + if((LCDheight == 720) || (LCDwidth == 1680) || + ((LCDheight == 1024) && (VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)))) { + ModeIndex = ModeIndex_1280x720[Depth]; + } + } } break; case 1400: if(VGAEngine == SIS_315_VGA) { if(VBFlags & (VB_301B | VB_301C | VB_302B | VB_302LV | VB_302ELV)) { - if(VDisplay == 1050) ModeIndex = ModeIndex_1400x1050[Depth]; + if((LCDwidth == 1400) || (LCDwidth == 1600) || (LCDwidth == 1680)) { + ModeIndex = ModeIndex_1400x1050[Depth]; + } } } break; case 1600: - if(VBFlags & (VB_301C | VB_302B | VB_302LV | VB_302ELV)) { - if(VDisplay == 1200) ModeIndex = ModeIndex_1600x1200[Depth]; + if(VGAEngine == SIS_315_VGA) { + if(VBFlags & (VB_301C | VB_302B | VB_302LV | VB_302ELV)) { + if(VDisplay == 1200) ModeIndex = ModeIndex_1600x1200[Depth]; + } + } + break; + case 1680: + if(VGAEngine == SIS_315_VGA) { + if(VBFlags & (VB_301C | VB_302B | VB_302LV | VB_302ELV)) { + if(VDisplay == 1050) ModeIndex = ModeIndex_1680x1050[Depth]; + } } break; } @@ -987,7 +979,9 @@ SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int D if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth]; break; case 512: - if((VBFlags & TV_PAL) && (!(VBFlags & TV_PALM))) { + if( ((VBFlags & TV_YPBPR) && (VBFlags & (TV_YPBPR750P | TV_YPBPR1080I))) || + (VBFlags & TV_HIVISION) || + ((!(VBFlags & (TV_YPBPR | TV_PALM))) && (VBFlags & TV_PAL)) ) { if(VDisplay == 384) ModeIndex = ModeIndex_512x384[Depth]; } break; @@ -996,19 +990,19 @@ SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int D else if(VDisplay == 400) ModeIndex = ModeIndex_640x400[Depth]; break; case 720: - if(!(VBFlags & (TV_HIVISION | TV_HIVISION_LV))) { + if((!(VBFlags & TV_HIVISION)) && (!((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I)))) { if(VDisplay == 480) { - if((VBFlags & TV_NTSC) || (VBFlags & TV_PALM)) + if((VBFlags & TV_YPBPR) || (VBFlags & (TV_NTSC | TV_PALM))) ModeIndex = ModeIndex_720x480[Depth]; } else if(VDisplay == 576) { - if((VBFlags & TV_PAL) && (!(VBFlags & TV_PALM))) + if((!(VBFlags & (TV_YPBPR | TV_PALM))) && (VBFlags & TV_PAL)) ModeIndex = ModeIndex_720x576[Depth]; } } break; case 768: - if(!(VBFlags & (TV_HIVISION | TV_HIVISION_LV))) { - if((VBFlags & TV_PAL) && (!(VBFlags & TV_PALM))) { + if((!(VBFlags & TV_HIVISION)) && (!((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I)))) { + if((!(VBFlags & (TV_YPBPR | TV_PALM))) && (VBFlags & TV_PAL)) { if(VDisplay == 576) ModeIndex = ModeIndex_768x576[Depth]; } } @@ -1016,8 +1010,8 @@ SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int D case 800: if(VDisplay == 600) ModeIndex = ModeIndex_800x600[Depth]; else if(VDisplay == 480) { - if(VBFlags & (TV_HIVISION | TV_HIVISION_LV)) { - ModeIndex = ModeIndex_800x480[Depth]; + if((VBFlags & TV_HIVISION) || ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I))) { + ModeIndex = ModeIndex_800x480[Depth]; } } break; @@ -1027,15 +1021,22 @@ SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int D ModeIndex = ModeIndex_1024x768[Depth]; } } else if(VDisplay == 576) { - if(VBFlags & (TV_HIVISION | TV_HIVISION_LV)) { + if((VBFlags & TV_HIVISION) || ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I))) { ModeIndex = ModeIndex_1024x576[Depth]; } } break; case 1280: - if(VBFlags & (TV_HIVISION | TV_HIVISION_LV)) { - if(VDisplay == 720) ModeIndex = ModeIndex_1280x720[Depth]; - else if(VDisplay == 1024) ModeIndex = ModeIndex_1280x1024[Depth]; + if(VDisplay == 720) { + if((VBFlags & TV_HIVISION) || + ((VBFlags & TV_YPBPR) && (VBFlags & (TV_YPBPR1080I | TV_YPBPR750P)))) { + ModeIndex = ModeIndex_1280x720[Depth]; + } + } else if(VDisplay == 1024) { + if((VBFlags & TV_HIVISION) || + ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I))) { + ModeIndex = ModeIndex_1280x1024[Depth]; + } } break; } @@ -1102,6 +1103,7 @@ SiS_GetModeID_VGA2(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int } } else if(VDisplay == 1024) ModeIndex = ModeIndex_1280x1024[Depth]; else if(VDisplay == 720) ModeIndex = ModeIndex_1280x720[Depth]; + else if(VDisplay == 800) ModeIndex = ModeIndex_1280x800[Depth]; else if(VDisplay == 960) ModeIndex = ModeIndex_1280x960[Depth]; break; case 1360: @@ -1119,6 +1121,13 @@ SiS_GetModeID_VGA2(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int } } break; + case 1680: + if(VGAEngine == SIS_315_VGA) { + if(VBFlags & (VB_301B|VB_301C|VB_302B)) { + if(VDisplay == 1050) ModeIndex = ModeIndex_1680x1050[Depth]; + } + } + break; } return ModeIndex; @@ -1216,13 +1225,13 @@ SiS_SetRegOR(SISIOADDRESS Port,USHORT Index,USHORT DataOR) void SiS_DisplayOn(SiS_Private *SiS_Pr) { - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x01,0xDF,0x00); + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x01,0xDF); } void SiS_DisplayOff(SiS_Private *SiS_Pr) { - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x01,0xDF,0x20); + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x01,0x20); } @@ -1265,6 +1274,15 @@ SiS_GetSysFlags(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { unsigned char cr5f, temp1, temp2; + /* 661 and newer: NEVER write non-zero to SR11[7:4] */ + /* (SR11 is used for DDC and in enable/disablebridge) */ + SiS_Pr->SiS_SensibleSR11 = FALSE; + SiS_Pr->SiS_MyCR63 = 0x63; + if(HwInfo->jChipType >= SIS_661) { + SiS_Pr->SiS_SensibleSR11 = TRUE; + SiS_Pr->SiS_MyCR63 = 0x53; + } + /* You should use the macros, not these flags directly */ SiS_Pr->SiS_SysFlags = 0; @@ -1302,6 +1320,10 @@ SiS_GetSysFlags(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) } } } + if(HwInfo->jChipType == SIS_760) { + temp1 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x78); + if(temp1 & 0x30) SiS_Pr->SiS_SysFlags |= SF_760UMA; + } } /*********************************************/ @@ -1368,25 +1390,25 @@ SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_Pr->SiS_IF_DEF_LVDS = 0; SiS_Pr->SiS_IF_DEF_TRUMPION = 0; SiS_Pr->SiS_IF_DEF_CH70xx = 0; - SiS_Pr->SiS_IF_DEF_HiVision = 0; SiS_Pr->SiS_IF_DEF_DSTN = 0; SiS_Pr->SiS_IF_DEF_FSTN = 0; SiS_Pr->SiS_IF_DEF_CONEX = 0; SiS_Pr->SiS_ChrontelInit = 0; + /* Check for SiS30x first */ + temp = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x00); + if((temp == 1) || (temp == 2)) return; + switch(HwInfo->jChipType) { #ifdef SIS300 case SIS_540: case SIS_630: case SIS_730: - /* Check for SiS30x first */ - temp = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x00); - if((temp == 1) || (temp == 2)) return; temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x37); temp = (temp & 0x0E) >> 1; - if((temp >= 2) && (temp <= 5)) SiS_Pr->SiS_IF_DEF_LVDS = 1; - if(temp == 3) SiS_Pr->SiS_IF_DEF_TRUMPION = 1; + if((temp >= 2) && (temp <= 5)) SiS_Pr->SiS_IF_DEF_LVDS = 1; + if(temp == 3) SiS_Pr->SiS_IF_DEF_TRUMPION = 1; if((temp == 4) || (temp == 5)) { /* Save power status (and error check) - UNUSED */ SiS_Pr->SiS_Backup70xx = SiS_GetCH700x(SiS_Pr, 0x0e); @@ -1401,8 +1423,8 @@ SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) case SIS_330: temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x37); temp = (temp & 0x0E) >> 1; - if((temp >= 2) && (temp <= 3)) SiS_Pr->SiS_IF_DEF_LVDS = 1; - if(temp == 3) SiS_Pr->SiS_IF_DEF_CH70xx = 2; + if((temp >= 2) && (temp <= 3)) SiS_Pr->SiS_IF_DEF_LVDS = 1; + if(temp == 3) SiS_Pr->SiS_IF_DEF_CH70xx = 2; break; case SIS_661: case SIS_741: @@ -1410,9 +1432,9 @@ SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) case SIS_760: temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); temp = (temp & 0xe0) >> 5; - if((temp >= 2) && (temp <= 3)) SiS_Pr->SiS_IF_DEF_LVDS = 1; - if(temp == 3) SiS_Pr->SiS_IF_DEF_CH70xx = 2; - if(temp == 4) SiS_Pr->SiS_IF_DEF_CONEX = 1; /* Not yet supported */ + if((temp >= 2) && (temp <= 3)) SiS_Pr->SiS_IF_DEF_LVDS = 1; + if(temp == 3) SiS_Pr->SiS_IF_DEF_CH70xx = 2; + if(temp == 4) SiS_Pr->SiS_IF_DEF_CONEX = 1; /* Not yet supported */ break; #endif default: @@ -1440,44 +1462,72 @@ SiS_SetEnableFstn(SiS_Private *SiS_Pr, int enable) /* HELPER: Determine ROM usage */ /*********************************************/ +BOOLEAN +SiSDetermineROMLayout661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +{ + UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; + USHORT romversoffs, romvmaj = 1, romvmin = 0; + + if(HwInfo->jChipType >= SIS_661) { + romversoffs = ROMAddr[0x16] | (ROMAddr[0x17] << 8); + if(romversoffs) { + if((ROMAddr[romversoffs+1] == '.') || (ROMAddr[romversoffs+4] == '.')) { + romvmaj = ROMAddr[romversoffs] - '0'; + romvmin = ((ROMAddr[romversoffs+2] -'0') * 10) + (ROMAddr[romversoffs+3] - '0'); + } + } + if((romvmaj != 0) || (romvmin >= 92)) { + return TRUE; + } + } else if(IS_SIS650740) { + if((ROMAddr[0x1a] == 'N') && + (ROMAddr[0x1b] == 'e') && + (ROMAddr[0x1c] == 'w') && + (ROMAddr[0x1d] == 'V')) { + return TRUE; + } + } + return FALSE; +} + static void SiSDetermineROMUsage(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; + USHORT romptr = 0; + + SiS_Pr->SiS_UseROM = FALSE; + SiS_Pr->SiS_ROMNew = FALSE; if((ROMAddr) && (HwInfo->UseROM)) { - if((ROMAddr[0x00] != 0x55) || (ROMAddr[0x01] != 0xAA)) { - SiS_Pr->SiS_UseROM = FALSE; - } else if(HwInfo->jChipType == SIS_300) { - /* 300: We check if the code starts below 0x220 by - * checking the jmp instruction at the beginning - * of the BIOS image. - */ - if((ROMAddr[3] == 0xe9) && - ((ROMAddr[5] << 8) | ROMAddr[4]) > 0x21a) + if(HwInfo->jChipType == SIS_300) { + /* 300: We check if the code starts below 0x220 by + * checking the jmp instruction at the beginning + * of the BIOS image. + */ + if((ROMAddr[3] == 0xe9) && ((ROMAddr[5] << 8) | ROMAddr[4]) > 0x21a) SiS_Pr->SiS_UseROM = TRUE; - else - SiS_Pr->SiS_UseROM = FALSE; } else if(HwInfo->jChipType < SIS_315H) { -#if 0 - /* Rest of 300 series: We don't use the ROM image if - * the BIOS version < 2.0.0 as such old BIOSes don't - * have the needed data at the expected locations. - */ - if(ROMAddr[0x06] < '2') SiS_Pr->SiS_UseROM = FALSE; - else SiS_Pr->SiS_UseROM = TRUE; -#else - /* Sony's VAIO BIOS 1.09 follows the standard, so perhaps - * the others do as well - */ + /* Sony's VAIO BIOS 1.09 follows the standard, so perhaps + * the others do as well + */ SiS_Pr->SiS_UseROM = TRUE; -#endif } else { /* 315/330 series stick to the standard */ SiS_Pr->SiS_UseROM = TRUE; + if((SiS_Pr->SiS_ROMNew = SiSDetermineROMLayout661(SiS_Pr, HwInfo))) { + /* Find out about LCD data table entry size */ + if((romptr = SISGETROMW(0x0102))) { + if(ROMAddr[romptr + (32 * 16)] == 0xff) + SiS_Pr->SiS661LCD2TableSize = 32; + else if(ROMAddr[romptr + (34 * 16)] == 0xff) + SiS_Pr->SiS661LCD2TableSize = 34; + else if(ROMAddr[romptr + (36 * 16)] == 0xff) + SiS_Pr->SiS661LCD2TableSize = 36; + } + } } - } else SiS_Pr->SiS_UseROM = FALSE; - + } } /*********************************************/ @@ -1562,7 +1612,8 @@ SiS_GetVBType(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_Pr->SiS_VBType = 0; - if(SiS_Pr->SiS_IF_DEF_LVDS == 1) return; + if((SiS_Pr->SiS_IF_DEF_LVDS) || (SiS_Pr->SiS_IF_DEF_CONEX)) + return; flag = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x00); @@ -1573,7 +1624,6 @@ SiS_GetVBType(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if(flag >= 2) { SiS_Pr->SiS_VBType = VB_SIS302B; } else if(flag == 1) { - SiS_Pr->SiS_VBType = VB_SIS301; if(rev >= 0xC0) { SiS_Pr->SiS_VBType = VB_SIS301C; } else if(rev >= 0xB0) { @@ -1581,20 +1631,17 @@ SiS_GetVBType(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) /* Check if 30xB DH version (no LCD support, use Panel Link instead) */ nolcd = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x23); if(!(nolcd & 0x02)) SiS_Pr->SiS_VBType |= VB_NoLCD; + } else { + SiS_Pr->SiS_VBType = VB_SIS301; } } if(SiS_Pr->SiS_VBType & (VB_SIS301B | VB_SIS301C | VB_SIS302B)) { - if(rev >= 0xD0) { - SiS_Pr->SiS_VBType &= ~(VB_SIS301B | VB_SIS301C | VB_SIS302B | VB_NoLCD); - if(rev >= 0xE0) { - flag = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x39); - if(flag == 0xff) - SiS_Pr->SiS_VBType |= VB_SIS302LV; - else - SiS_Pr->SiS_VBType |= VB_SIS302ELV; - } else { - SiS_Pr->SiS_VBType |= VB_SIS301LV; - } + if(rev >= 0xE0) { + flag = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x39); + if(flag == 0xff) SiS_Pr->SiS_VBType = VB_SIS302LV; + else SiS_Pr->SiS_VBType = VB_SIS302ELV; + } else if(rev >= 0xD0) { + SiS_Pr->SiS_VBType = VB_SIS301LV; } } } @@ -1650,12 +1697,24 @@ GetDRAMSize(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) case SIS_661: case SIS_741: - case SIS_660: - case SIS_760: counter = (SiS_GetReg(SiS_Pr->SiS_P3c4,0x79) & 0xf0) >> 4; AdapterMemorySize = 1 << counter; AdapterMemorySize *= (1024*1024); break; + + case SIS_660: + case SIS_760: + counter = (SiS_GetReg(SiS_Pr->SiS_P3c4,0x79) & 0xf0) >> 4; + if(counter) { + AdapterMemorySize = 1 << counter; + AdapterMemorySize *= (1024*1024); + } + counter = SiS_GetReg(SiS_Pr->SiS_P3c4,0x78) & 0x30; + if(counter) { + if(counter == 0x10) AdapterMemorySize += (32 * 1024 * 1024); + else AdapterMemorySize += (64 * 1024 * 1024); + } + break; #endif #ifdef SIS300 @@ -1723,7 +1782,10 @@ SiS_Get310DRAMType(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if(*SiS_Pr->pSiS_SoftSetting & SoftDRAMType) { data = *SiS_Pr->pSiS_SoftSetting & 0x03; } else { - if(HwInfo->jChipType >= SIS_661) { + if(HwInfo->jChipType >= SIS_660) { + /* data = SiS_GetReg(SiS_Pr->SiS_P3d4,0x78) & 0x07; */ + data = ((SiS_GetReg(SiS_Pr->SiS_P3d4,0x78) & 0xc0) >> 6); + } else if(HwInfo->jChipType >= SIS_661) { data = SiS_GetReg(SiS_Pr->SiS_P3d4,0x78) & 0x07; } else if(IS_SIS550650740) { data = SiS_GetReg(SiS_Pr->SiS_P3c4,0x13) & 0x07; @@ -1897,6 +1959,43 @@ SiS_SetLowModeTest(SiS_Private *SiS_Pr, USHORT ModeNo, PSIS_HW_INFO HwInfo) } /*********************************************/ +/* HELPER: ENABLE CRT1 */ +/*********************************************/ + +static void +SiS_SetupCR5x(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +{ + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(IS_SIS650) { + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x51,0x1f); + if(IS_SIS651) SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x51,0x20); + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x56,0xe7); + } else if(IS_SIS661741660760) { + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x61,0xf7); + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x51,0x1f); + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x56,0xe7); + if(!SiS_Pr->SiS_ROMNew) { + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x3a,0xef); + } + } + } +} + +static void +SiS_HandleCRT1(SiS_Private *SiS_Pr) +{ + SiS_SetRegAND(SiS_Pr->SiS_P3d4,SiS_Pr->SiS_MyCR63,0xbf); +#if 0 + if(!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x15) & 0x01)) { + if((SiS_GetReg(SiS_Pr->SiS_P3c4,0x15) & 0x0a) || + (SiS_GetReg(SiS_Pr->SiS_P3c4,0x16) & 0x01)) { + SiS_SetRegOR(SiS_Pr->SiS_P3d4,SiS_Pr->SiS_MyCR63,0x40); + } + } +#endif +} + +/*********************************************/ /* HELPER: GetColorDepth */ /*********************************************/ @@ -1930,28 +2029,22 @@ USHORT SiS_GetOffset(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, USHORT RefreshRateTableIndex,PSIS_HW_INFO HwInfo) { - USHORT temp,colordepth,infoflag; + USHORT xres, temp, colordepth, infoflag; if(SiS_Pr->UseCustomMode) { infoflag = SiS_Pr->CInfoFlag; - temp = SiS_Pr->CHDisplay / 16; + xres = SiS_Pr->CHDisplay; } else { infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag; - temp = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeOffset; - temp = SiS_Pr->SiS_ScreenOffset[temp]; + xres = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].XRes; } colordepth = SiS_GetColorDepth(SiS_Pr,ModeNo,ModeIdIndex); + temp = xres / 16; if(infoflag & InterlaceMode) temp <<= 1; - temp *= colordepth; - - if( ( ((ModeNo >= 0x26) && (ModeNo <= 0x28)) || - ModeNo == 0x3f || - ModeNo == 0x42 || - ModeNo == 0x45 ) || - (SiS_Pr->UseCustomMode && (SiS_Pr->CHDisplay % 16)) ) { + if(xres % 16) { colordepth >>= 1; temp += colordepth; } @@ -2056,9 +2149,15 @@ SiS_SetCRTCRegs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, CRTCdata = SiS_Pr->SiS_StandTable[StandTableIndex].CRTC[i]; SiS_SetReg(SiS_Pr->SiS_P3d4,i,CRTCdata); /* Set CRTC(3d4) */ } - if( ( (HwInfo->jChipType == SIS_630) || - (HwInfo->jChipType == SIS_730) ) && - (HwInfo->jChipRevision >= 0x30) ) { /* for 630S0 */ + if(HwInfo->jChipType >= SIS_661) { + SiS_SetupCR5x(SiS_Pr, HwInfo); + for(i = 0x13; i <= 0x14; i++) { + CRTCdata = SiS_Pr->SiS_StandTable[StandTableIndex].CRTC[i]; + SiS_SetReg(SiS_Pr->SiS_P3d4,i,CRTCdata); + } + } else if( ( (HwInfo->jChipType == SIS_630) || + (HwInfo->jChipType == SIS_730) ) && + (HwInfo->jChipRevision >= 0x30) ) { /* for 630S0 */ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToTV)) { SiS_SetReg(SiS_Pr->SiS_P3d4,0x18,0xFE); @@ -2159,7 +2258,7 @@ SiS_SetGRCRegs(SiS_Private *SiS_Pr, USHORT StandTableIndex) /*********************************************/ static void -SiS_ClearExt1Regs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +SiS_ClearExt1Regs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) { USHORT i; @@ -2169,6 +2268,11 @@ SiS_ClearExt1Regs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if(HwInfo->jChipType >= SIS_315H) { SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x37,0xFE); + if(ModeNo <= 0x13) { + if(ModeNo == 0x06 || ModeNo >= 0x0e) { + SiS_SetReg(SiS_Pr->SiS_P3c4,0x0e,0x20); + } + } } } @@ -2232,45 +2336,6 @@ SiS_SetCRT1Sync(SiS_Private *SiS_Pr, USHORT RefreshRateTableIndex) /* CRTC/2 */ /*********************************************/ -#ifdef SIS315H -static void -SiS_GetLCDACRT1Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, USHORT *ResIndex, - USHORT *DisplayType) - { - USHORT modeflag = 0; - - if(ModeNo <= 0x13) { - modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - *ResIndex = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; - } else { - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - *ResIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; - } - - *ResIndex &= 0x3F; - - *DisplayType = SiS_Pr->SiS_LCDResInfo; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) *DisplayType += 32; - if(modeflag & HalfDCLK) *DisplayType += 16; - - if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { - *DisplayType = 100; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) *DisplayType += 2; - if(modeflag & HalfDCLK) *DisplayType += 1; - } - } else if(SiS_Pr->SiS_CustomT == CUT_CLEVO1024) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { - *DisplayType = 104; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) *DisplayType += 2; - if(modeflag & HalfDCLK) *DisplayType += 1; - } - } - -} -#endif - static void SiS_SetCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, @@ -2278,10 +2343,6 @@ SiS_SetCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, { UCHAR index; USHORT temp,i,j,modeflag; -#ifdef SIS315H - USHORT ResIndex,DisplayType; - const SiS_LCDACRT1DataStruct *LCDACRT1Ptr = NULL; -#endif SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); /* unlock cr0-7 */ @@ -2289,7 +2350,7 @@ SiS_SetCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, modeflag = SiS_Pr->CModeFlag; - for(i=0,j=0;i<=07;i++,j++) { + for(i=0,j=0;i<=7;i++,j++) { SiS_SetReg(SiS_Pr->SiS_P3d4,j,SiS_Pr->CCRT1CRTC[i]); } for(j=0x10;i<=10;i++,j++) { @@ -2307,7 +2368,7 @@ SiS_SetCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, temp = (SiS_Pr->CCRT1CRTC[16] & 0x01) << 5; if(modeflag & DoubleScanMode) temp |= 0x80; - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0xDF,temp); + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0x5F,temp); } else { @@ -2317,87 +2378,28 @@ SiS_SetCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; } - if((SiS_Pr->SiS_VBType & VB_SISVB) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { - -#ifdef SIS315H - - SiS_GetLCDACRT1Ptr(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, &ResIndex, &DisplayType); - - switch(DisplayType) { - case Panel_1024x768 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11024x768_1; break; - case Panel_1280x1024 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11280x1024_1; break; - case Panel_1400x1050 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11400x1050_1; break; - case Panel_1600x1200 : LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11600x1200_1; break; - case Panel_1024x768 + 16: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11024x768_1_H; break; - case Panel_1280x1024 + 16: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11280x1024_1_H; break; - case Panel_1400x1050 + 16: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11400x1050_1_H; break; - case Panel_1600x1200 + 16: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11600x1200_1_H; break; - case Panel_1024x768 + 32: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11024x768_2; break; - case Panel_1280x1024 + 32: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11280x1024_2; break; - case Panel_1400x1050 + 32: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11400x1050_2; break; - case Panel_1600x1200 + 32: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11600x1200_2; break; - case Panel_1024x768 + 48: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11024x768_2_H; break; - case Panel_1280x1024 + 48: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11280x1024_2_H; break; - case Panel_1400x1050 + 48: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11400x1050_2_H; break; - case Panel_1600x1200 + 48: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11600x1200_2_H; break; - case 100: LCDACRT1Ptr = Compaq1280x1024_LCDACRT1_1; break; - case 101: LCDACRT1Ptr = Compaq1280x1024_LCDACRT1_1_H; break; - case 102: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11280x1024_2; break; - case 103: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11280x1024_2_H; break; - case 104: LCDACRT1Ptr = Clevo1024x768_LCDACRT1_1; break; - case 105: LCDACRT1Ptr = Clevo1024x768_LCDACRT1_1_H; break; - case 106: LCDACRT1Ptr = Clevo1024x768_LCDACRT1_2; break; - case 107: LCDACRT1Ptr = Clevo1024x768_LCDACRT1_2_H; break; - default: LCDACRT1Ptr = SiS_Pr->SiS_LCDACRT11024x768_1; break; - } - - for(i=0, j=0; i<=0x07; i++, j++) { - SiS_SetReg(SiS_Pr->SiS_P3d4,i,(LCDACRT1Ptr+ResIndex)->CR[j]); - } - for(i=0x10, j=8; i<=0x12; i++, j++) { - SiS_SetReg(SiS_Pr->SiS_P3d4,i,(LCDACRT1Ptr+ResIndex)->CR[j]); - } - for(i=0x15, j=11; i<=0x16; i++, j++) { - SiS_SetReg(SiS_Pr->SiS_P3d4,i,(LCDACRT1Ptr+ResIndex)->CR[j]); - } - for(i=0x0A, j=13; i<=0x0C; i++, j++) { - SiS_SetReg(SiS_Pr->SiS_P3c4,i,(LCDACRT1Ptr+ResIndex)->CR[j]); - } - - temp = (LCDACRT1Ptr+ResIndex)->CR[16] & 0xE0; - SiS_SetReg(SiS_Pr->SiS_P3c4,0x0E,temp); - - temp = ((LCDACRT1Ptr+ResIndex)->CR[16] & 0x01) << 5; - if(modeflag & DoubleScanMode) temp |= 0x80; - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0xDF,temp); - -#endif - - } else { - - index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; + index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; - for(i=0,j=0;i<=07;i++,j++) { - SiS_SetReg(SiS_Pr->SiS_P3d4,j,SiS_Pr->SiS_CRT1Table[index].CR[i]); - } - for(j=0x10;i<=10;i++,j++) { - SiS_SetReg(SiS_Pr->SiS_P3d4,j,SiS_Pr->SiS_CRT1Table[index].CR[i]); - } - for(j=0x15;i<=12;i++,j++) { - SiS_SetReg(SiS_Pr->SiS_P3d4,j,SiS_Pr->SiS_CRT1Table[index].CR[i]); - } - for(j=0x0A;i<=15;i++,j++) { - SiS_SetReg(SiS_Pr->SiS_P3c4,j,SiS_Pr->SiS_CRT1Table[index].CR[i]); - } + for(i=0,j=0;i<=7;i++,j++) { + SiS_SetReg(SiS_Pr->SiS_P3d4,j,SiS_Pr->SiS_CRT1Table[index].CR[i]); + } + for(j=0x10;i<=10;i++,j++) { + SiS_SetReg(SiS_Pr->SiS_P3d4,j,SiS_Pr->SiS_CRT1Table[index].CR[i]); + } + for(j=0x15;i<=12;i++,j++) { + SiS_SetReg(SiS_Pr->SiS_P3d4,j,SiS_Pr->SiS_CRT1Table[index].CR[i]); + } + for(j=0x0A;i<=15;i++,j++) { + SiS_SetReg(SiS_Pr->SiS_P3c4,j,SiS_Pr->SiS_CRT1Table[index].CR[i]); + } - temp = SiS_Pr->SiS_CRT1Table[index].CR[16] & 0xE0; - SiS_SetReg(SiS_Pr->SiS_P3c4,0x0E,temp); + temp = SiS_Pr->SiS_CRT1Table[index].CR[16] & 0xE0; + SiS_SetReg(SiS_Pr->SiS_P3c4,0x0E,temp); - temp = ((SiS_Pr->SiS_CRT1Table[index].CR[16]) & 0x01) << 5; - if(modeflag & DoubleScanMode) temp |= 0x80; - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0xDF,temp); + temp = ((SiS_Pr->SiS_CRT1Table[index].CR[16]) & 0x01) << 5; + if(modeflag & DoubleScanMode) temp |= 0x80; + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0x5F,temp); - } } if(SiS_Pr->SiS_ModeType > ModeVGA) SiS_SetReg(SiS_Pr->SiS_P3d4,0x14,0x4F); @@ -2435,7 +2437,7 @@ SiS_SetCRT1Offset(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, DisplayUnit <<= 5; temp = (DisplayUnit & 0xff00) >> 8; - if (DisplayUnit & 0xff) temp++; + if(DisplayUnit & 0xff) temp++; temp++; SiS_SetReg(SiS_Pr->SiS_P3c4,0x10,temp); } @@ -2870,7 +2872,8 @@ SiS_SetCRT1FIFO_310(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, { USHORT modeflag; - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x3D,0xFE); /* disable auto-threshold */ + /* disable auto-threshold */ + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x3D,0xFE); if(SiS_Pr->UseCustomMode) { modeflag = SiS_Pr->CModeFlag; @@ -2878,30 +2881,19 @@ SiS_SetCRT1FIFO_310(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; } - if(HwInfo->jChipType >= SIS_661) { - SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,0xAE); - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x09,0xF0); - if(ModeNo > 0x13) { + SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,0xAE); + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x09,0xF0); + if(ModeNo > 0x13) { + if(HwInfo->jChipType >= SIS_661) { if(!(modeflag & HalfDCLK)) { SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,0x34); - if(ModeNo != 0x38) { - SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x3D,0x01); - } + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x3D,0x01); } - } - } else { - if(ModeNo > 0x13) { - if( (!(modeflag & DoubleScanMode)) || (!(modeflag & HalfDCLK))) { + } else { + if((!(modeflag & DoubleScanMode)) || (!(modeflag & HalfDCLK))) { SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,0x34); - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x09,0xF0); SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x3D,0x01); - } else { - SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,0xAE); - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x09,0xF0); - } - } else { - SiS_SetReg(SiS_Pr->SiS_P3c4,0x08,0xAE); - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x09,0xF0); + } } } } @@ -2916,33 +2908,29 @@ SiS_SetVCLKState(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo, USHORT RefreshRateTableIndex, USHORT ModeIdIndex) { - USHORT data, data2=0; - USHORT VCLK, index=0; + USHORT data=0, VCLK=0, index=0; - if(ModeNo <= 0x13) VCLK = 0; - else { + if(ModeNo > 0x13) { if(SiS_Pr->UseCustomMode) { VCLK = SiS_Pr->CSRClock; } else { index = SiS_GetVCLK2Ptr(SiS_Pr,ModeNo,ModeIdIndex, - RefreshRateTableIndex,HwInfo); + RefreshRateTableIndex,HwInfo); VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; } } - if(HwInfo->jChipType < SIS_315H) { /* 300 series */ + if(HwInfo->jChipType < SIS_315H) { - data2 = 0x00; - if(VCLK > 150) data2 |= 0x80; - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0x7B,data2); + if(VCLK > 150) data |= 0x80; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0x7B,data); - data2 = 0x00; - if(VCLK >= 150) data2 |= 0x08; - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xF7,data2); + data = 0x00; + if(VCLK >= 150) data |= 0x08; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xF7,data); - } else { /* 315 series */ + } else { - data = 0; if(VCLK >= 166) data |= 0x0c; SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x32,0xf3,data); @@ -2951,23 +2939,31 @@ SiS_SetVCLKState(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, } } - data2 = 0x03; - if((VCLK >= 135) && (VCLK < 160)) data2 = 0x02; - else if((VCLK >= 160) && (VCLK < 260)) data2 = 0x01; - else if(VCLK >= 260) data2 = 0x00; + /* DAC speed */ + if(HwInfo->jChipType >= SIS_661) { - if(HwInfo->jChipType == SIS_540) { - if((VCLK == 203) || (VCLK < 234)) data2 = 0x02; - } + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0xE8,0x10); - if(HwInfo->jChipType < SIS_315H) { - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0xFC,data2); /* DAC speed */ } else { - if(HwInfo->jChipType > SIS_315PRO) { - /* This "if" is done in 330 and 650/LVDS/301LV BIOSes; Not in 315 BIOS */ - if(ModeNo > 0x13) data2 &= 0xfc; + + data = 0x03; + if((VCLK >= 135) && (VCLK < 160)) data = 0x02; + else if((VCLK >= 160) && (VCLK < 260)) data = 0x01; + else if(VCLK >= 260) data = 0x00; + + if(HwInfo->jChipType == SIS_540) { + if((VCLK == 203) || (VCLK < 234)) data = 0x02; + } + + if(HwInfo->jChipType < SIS_315H) { + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0xFC,data); + } else { + if(HwInfo->jChipType > SIS_315PRO) { + if(ModeNo > 0x13) data &= 0xfc; + } + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0xF8,data); } - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x07,0xF8,data2); /* DAC speed */ + } } @@ -2975,75 +2971,51 @@ static void SiS_SetCRT1ModeRegs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRateTableIndex) { - USHORT data,data2; - USHORT infoflag=0,modeflag; + USHORT data,infoflag=0,modeflag; USHORT resindex,xres; #ifdef SIS315H - USHORT data3; + USHORT data2,data3; ULONG longdata; -#if 0 - resinfo = 0; -#endif + UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; #endif if(SiS_Pr->UseCustomMode) { modeflag = SiS_Pr->CModeFlag; infoflag = SiS_Pr->CInfoFlag; + xres = SiS_Pr->CHDisplay; } else { + resindex = SiS_GetResInfo(SiS_Pr,ModeNo,ModeIdIndex); if(ModeNo > 0x13) { modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag; -#ifdef SIS315H -#if 0 - resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; -#endif -#endif + xres = SiS_Pr->SiS_ModeResInfo[resindex].HTotal; } else { modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + xres = SiS_Pr->SiS_StResInfo[resindex].HTotal; } } /* Disable DPMS */ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1F,0x3F); - if(ModeNo > 0x13) data = infoflag; - else data = 0; - - data2 = 0; + data = 0; if(ModeNo > 0x13) { if(SiS_Pr->SiS_ModeType > 0x02) { - data2 |= 0x02; - data2 |= ((SiS_Pr->SiS_ModeType - ModeVGA) << 2); - } - } - -#ifdef TWDEBUG - xf86DrvMsg(0, X_INFO, "Debug: Mode infoflag = %x, Chiptype %d\n", - data, HwInfo->jChipType); -#endif - - if(data & InterlaceMode) data2 |= 0x20; - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x06,0xC0,data2); - - if(SiS_Pr->UseCustomMode) { - xres = SiS_Pr->CHDisplay; - } else { - resindex = SiS_GetResInfo(SiS_Pr,ModeNo,ModeIdIndex); - if(ModeNo <= 0x13) { - xres = SiS_Pr->SiS_StResInfo[resindex].HTotal; - } else { - xres = SiS_Pr->SiS_ModeResInfo[resindex].HTotal; + data |= 0x02; + data |= ((SiS_Pr->SiS_ModeType - ModeVGA) << 2); } + if(infoflag & InterlaceMode) data |= 0x20; } + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x06,0xC0,data); if(HwInfo->jChipType != SIS_300) { - data = 0x0000; + data = 0; if(infoflag & InterlaceMode) { - if(xres <= 800) data = 0x0020; + if(xres <= 800) data = 0x0020; else if(xres <= 1024) data = 0x0035; - else data = 0x0048; + else data = 0x0048; } - SiS_SetReg(SiS_Pr->SiS_P3d4,0x19,(data & 0x00FF)); + SiS_SetReg(SiS_Pr->SiS_P3d4,0x19,(data & 0xFF)); SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x1a,0xFC,(data >> 8)); } @@ -3051,18 +3023,12 @@ SiS_SetCRT1ModeRegs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x01,0x08); } + data = 0; + if(modeflag & LineCompareOff) data = 0x08; if(HwInfo->jChipType == SIS_300) { - if(modeflag & LineCompareOff) { - SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x0F,0x08); - } else { - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x0F,0xF7); - } + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xF7,data); } else { - if(modeflag & LineCompareOff) { - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xB7,0x08); - } else { - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x0F,0xB7); - } + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0F,0xB7,data); if(SiS_Pr->SiS_ModeType == ModeEGA) { if(ModeNo > 0x13) { SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x0F,0x40); @@ -3070,9 +3036,13 @@ SiS_SetCRT1ModeRegs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, } } + if(HwInfo->jChipType >= SIS_661) { + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x31,0xfb); + } + #ifdef SIS315H - /* 315 BIOS sets SR17 at this point */ if(HwInfo->jChipType == SIS_315PRO) { + data = SiS_Get310DRAMType(SiS_Pr, HwInfo); data = SiS_Pr->SiS_SR15[2][data]; if(SiS_Pr->SiS_ModeType == ModeText) { @@ -3091,12 +3061,18 @@ SiS_SetCRT1ModeRegs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, } } SiS_SetReg(SiS_Pr->SiS_P3c4,0x17,data); - } - /* 330 BIOS sets SR17 at this point */ - if(HwInfo->jChipType == SIS_330) { + } else if( (HwInfo->jChipType == SIS_330) || + ((HwInfo->jChipType == SIS_760) && (SiS_Pr->SiS_SysFlags & SF_760UMA))) { + data = SiS_Get310DRAMType(SiS_Pr, HwInfo); - data = SiS_Pr->SiS_SR15[2][data]; + if(HwInfo->jChipType == SIS_330) { + data = SiS_Pr->SiS_SR15[2][data]; + } else { + if(SiS_Pr->SiS_ROMNew) data = ROMAddr[0xf6]; + else if(SiS_Pr->SiS_UseROM) data = ROMAddr[0x100 + data]; + else data = 0xba; + } if(SiS_Pr->SiS_ModeType <= ModeEGA) { data &= 0xc7; } else { @@ -3109,31 +3085,38 @@ SiS_SetCRT1ModeRegs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, } data3 = SiS_GetColorDepth(SiS_Pr,ModeNo,ModeIdIndex) >> 1; - if(!data3) data3++; - - data2 *= data3; + if(data3) data2 *= data3; longdata = SiS_GetMCLK(SiS_Pr, HwInfo) * 1024; data2 = longdata / data2; - if(SiS_Pr->SiS_ModeType != Mode16Bpp) { - if(data2 >= 0x19c) data = 0xba; - else if(data2 >= 0x140) data = 0x7a; - else if(data2 >= 0x101) data = 0x3a; - else if(data2 >= 0xf5) data = 0x32; - else if(data2 >= 0xe2) data = 0x2a; - else if(data2 >= 0xc4) data = 0x22; - else if(data2 >= 0xac) data = 0x1a; - else if(data2 >= 0x9e) data = 0x12; - else if(data2 >= 0x8e) data = 0x0a; + if(HwInfo->jChipType == SIS_330) { + if(SiS_Pr->SiS_ModeType != Mode16Bpp) { + if (data2 >= 0x19c) data = 0xba; + else if(data2 >= 0x140) data = 0x7a; + else if(data2 >= 0x101) data = 0x3a; + else if(data2 >= 0xf5) data = 0x32; + else if(data2 >= 0xe2) data = 0x2a; + else if(data2 >= 0xc4) data = 0x22; + else if(data2 >= 0xac) data = 0x1a; + else if(data2 >= 0x9e) data = 0x12; + else if(data2 >= 0x8e) data = 0x0a; + else data = 0x02; + } else { + if(data2 >= 0x127) data = 0xba; + else data = 0x7a; + } + } else { + if (data2 >= 0x190) data = 0xba; + else if(data2 >= 0xff) data = 0x7a; + else if(data2 >= 0xd3) data = 0x3a; + else if(data2 >= 0xa9) data = 0x1a; + else if(data2 >= 0x93) data = 0x0a; else data = 0x02; - } else { - if(data2 >= 0x127) data = 0xba; - else data = 0x7a; - } - } - SiS_SetReg(SiS_Pr->SiS_P3c4,0x17,data); + } + } + SiS_SetReg(SiS_Pr->SiS_P3c4,0x17,data); } #endif @@ -3155,46 +3138,6 @@ SiS_SetCRT1ModeRegs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, } else { SiS_SetReg(SiS_Pr->SiS_P3d4,0x52,0x6c); } -#if 0 /* What is SR0E[D5:6]? */ - if(HwInfo->jChipType >= SIS_661) { - data = 0; - if((ModeNo == 6) || ((ModeNo >= 0x0e) && (ModeNo <= 0x13))) { - data |= 0x20; - } - if(SiS_Pr->SiS_ModeType != ModeVGA) { - if(SiS_Pr->UseCustomMode) { - if((xres >= 640) && (SiS_Pr->CVDisplay >= 480)) { - data |= 0x40; - } - if((xres > 1280) && (SiS_Pr->CVDisplay > 1024)) { - data |= 0x60; - } - } - } else if(ModeNo > 0x13) { /* These are in the CRT1 table, and set by CRT1CRTC */ - if(resinfo >= SIS_RI_640x480) { - if(resinfo <= SIS_RI_2048x1536) { - data |= 0x40; - if(resinfo > SIS_RI_1280x1024) { - data |= 0x60; - if(resinfo != SIS_RI_1600x1200) { - data = SiS_GetReg(SiS_Pr->SiS_P3c4,0x0e); - data += 0x60; - SiS_SetReg(SiS_Pr->SiS_P3c4,0x0e); - data = 0; - } - } - } - if(resinfo == SIS_RI_1152x864) { - data = 0x40; - } - if(resinfo == SIS_RI_1400x1050) { /* TW */ - data = 0x60; - } - } - } - SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x0e,data); - } -#endif } #endif } @@ -3369,7 +3312,7 @@ SiS_SetCRT1Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, SiS_SetCRTCRegs(SiS_Pr, HwInfo, StandTableIndex); SiS_SetATTRegs(SiS_Pr, StandTableIndex, HwInfo); SiS_SetGRCRegs(SiS_Pr, StandTableIndex); - SiS_ClearExt1Regs(SiS_Pr,HwInfo); + SiS_ClearExt1Regs(SiS_Pr, HwInfo, ModeNo); SiS_ResetCRT1VCLK(SiS_Pr, HwInfo); SiS_Pr->SiS_SelectCRT2Rate = 0; @@ -3434,22 +3377,31 @@ SiS_SetCRT1Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, } } + + /*********************************************/ -/* HELPER: ENABLE CRT1 */ +/* HELPER: RESET VIDEO BRIDGE */ /*********************************************/ static void -SiS_HandleCRT1(SiS_Private *SiS_Pr) +SiS_ResetVB(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x63,0xbf); -#if 0 - if(!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x15) & 0x01)) { - if((SiS_GetReg(SiS_Pr->SiS_P3c4,0x15) & 0x0a) || - (SiS_GetReg(SiS_Pr->SiS_P3c4,0x16) & 0x01)) { - SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x63,0x40); - } - } -#endif + UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; + USHORT temp; + + if(SiS_Pr->SiS_UseROM) { + if(HwInfo->jChipType < SIS_330) { + temp = ROMAddr[VB310Data_1_2_Offset] | 0x40; + if(SiS_Pr->SiS_ROMNew) temp = ROMAddr[0x80] | 0x40; + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x02,temp); + } else if(HwInfo->jChipType >= SIS_661) { + temp = ROMAddr[0x7e]; + if(SiS_Pr->SiS_ROMNew) temp = ROMAddr[0x80]; + if(HwInfo->jChipType >= SIS_660) temp |= 0x40; + else if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x7b) >= 100) temp |= 0x40; + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x02,temp); + } + } } /*********************************************/ @@ -3538,13 +3490,12 @@ BOOLEAN SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo) #endif { - ULONG temp; USHORT ModeIdIndex; - UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; SISIOADDRESS BaseAddr = HwInfo->ulIOAddress; - unsigned char backupreg=0, tempr1, tempr2; + unsigned char backupreg=0; #ifndef LINUX_XF86 USHORT KeepLockReg; + ULONG temp; SiS_Pr->UseCustomMode = FALSE; SiS_Pr->CRT1UsesCustomMode = FALSE; @@ -3555,37 +3506,26 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo) } SiSInitPtr(SiS_Pr, HwInfo); - SiSRegInit(SiS_Pr, BaseAddr); - SiS_GetSysFlags(SiS_Pr, HwInfo); -#ifdef LINUX_XF86 +#if defined(LINUX_XF86) && (defined(i386) || defined(__i386) || defined(__i386__) || defined(__AMD64__)) if(pScrn) SiS_Pr->SiS_VGAINFO = SiS_GetSetBIOSScratch(pScrn, 0x489, 0xff); else #endif SiS_Pr->SiS_VGAINFO = 0x11; SiSInitPCIetc(SiS_Pr, HwInfo); - SiSSetLVDSetc(SiS_Pr, HwInfo); - SiSDetermineROMUsage(SiS_Pr, HwInfo); - if(!SiS_Pr->UseCustomMode) { - ModeNo = ((ModeNo & 0x80) << 8) | (ModeNo & 0x7f); - } + SiS_Pr->SiS_flag_clearbuffer = 0; -#ifdef LINUX_XF86 - /* We never clear the buffer in X */ - ModeNo |= 0x8000; + if(!SiS_Pr->UseCustomMode) { +#ifndef LINUX_XF86 + if(!(ModeNo & 0x80)) SiS_Pr->SiS_flag_clearbuffer = 1; #endif - - if(ModeNo & 0x8000) { - ModeNo &= 0x7fff; - SiS_Pr->SiS_flag_clearbuffer = 0; - } else { - SiS_Pr->SiS_flag_clearbuffer = 1; + ModeNo &= 0x7f; } #ifndef LINUX_XF86 @@ -3604,20 +3544,12 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo) SiS_GetVBType(SiS_Pr, HwInfo); /* Init/restore some VB registers */ + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { if(HwInfo->jChipType >= SIS_315H) { - SiS_UnLockCRT2(SiS_Pr,HwInfo); - if(HwInfo->jChipType < SIS_330) { - if(ROMAddr && SiS_Pr->SiS_UseROM) { - temp = ROMAddr[VB310Data_1_2_Offset]; - temp |= 0x40; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x02,temp); - } - } + SiS_ResetVB(SiS_Pr, HwInfo); SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x32,0x10); - SiS_SetRegOR(SiS_Pr->SiS_Part2Port,0x00,0x0c); - backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); } else { backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35); @@ -3626,7 +3558,7 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo) /* Get VB information (connectors, connected devices) */ SiS_GetVBInfo(SiS_Pr, ModeNo, ModeIdIndex, HwInfo, (SiS_Pr->UseCustomMode) ? 0 : 1); - SiS_SetHiVision(SiS_Pr, HwInfo); + SiS_SetYPbPr(SiS_Pr, HwInfo); SiS_SetTVMode(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); SiS_GetLCDResInfo(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); SiS_SetLowModeTest(SiS_Pr, ModeNo, HwInfo); @@ -3638,23 +3570,7 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo) #endif if(HwInfo->jChipType >= SIS_315H) { -#if 0 - if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x17) & 0x08) { - if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { - if(ModeNo != 0x10) SiS_Pr->SiS_SetFlag |= SetDOSMode; - } else if((IS_SIS651) && (SiS_Pr->SiS_VBType & VB_NoLCD)) { - SiS_Pr->SiS_SetFlag |= SetDOSMode; - } - } -#endif - - if(IS_SIS650) { - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x51,0x1f); - if(IS_SIS651) SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x51,0x20); - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x56,0xe7); - } - } + SiS_SetupCR5x(SiS_Pr, HwInfo); } if(SiS_Pr->UseCustomMode) { @@ -3698,7 +3614,7 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo) if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { if(HwInfo->jChipType >= SIS_315H) { - if(HwInfo->jChipType < SIS_661) { + if(!SiS_Pr->SiS_ROMNew) { if(SiS_IsVAMode(SiS_Pr,HwInfo)) { SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01); } else { @@ -3708,14 +3624,6 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo) SiS_SetReg(SiS_Pr->SiS_P3d4,0x38,backupreg); - tempr1 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30); - tempr2 = SiS_GetReg(SiS_Pr->SiS_Part2Port,0x00); - if(tempr1 & SetCRT2ToAVIDEO) tempr2 &= 0xF7; - else tempr2 |= 0x08; - if(tempr1 & SetCRT2ToSVIDEO) tempr2 &= 0xFB; - else tempr2 |= 0x04; - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x00,tempr2); - if((IS_SIS650) && (SiS_GetReg(SiS_Pr->SiS_P3d4,0x30) & 0xfc)) { if((ModeNo == 0x03) || (ModeNo == 0x10)) { SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x51,0x80); @@ -3723,7 +3631,7 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo) } } - if(tempr1 & SetCRT2ToLCD) { + if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x30) & SetCRT2ToLCD) { SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xfc); } } else if((HwInfo->jChipType == SIS_630) || @@ -3795,12 +3703,10 @@ BOOLEAN SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, DisplayModePtr mode, BOOLEAN IsCustom) { - ULONG temp; USHORT ModeIdIndex; - UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; SISIOADDRESS BaseAddr = HwInfo->ulIOAddress; UShort ModeNo = 0; - unsigned char tempr1, tempr2, backupreg=0; + unsigned char backupreg=0; SISPtr pSiS = SISPTR(pScrn); #ifdef SISDUALHEAD SISEntPtr pSiSEnt = pSiS->entityPrivate; @@ -3832,17 +3738,15 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, } SiSRegInit(SiS_Pr, BaseAddr); - SiSInitPtr(SiS_Pr, HwInfo); - SiS_GetSysFlags(SiS_Pr, HwInfo); - +#if (defined(i386) || defined(__i386) || defined(__i386__) || defined(__AMD64__)) SiS_Pr->SiS_VGAINFO = SiS_GetSetBIOSScratch(pScrn, 0x489, 0xff); - +#else + SiS_Pr->SiS_VGAINFO = 0x11; +#endif SiSInitPCIetc(SiS_Pr, HwInfo); - SiSSetLVDSetc(SiS_Pr, HwInfo); - SiSDetermineROMUsage(SiS_Pr, HwInfo); /* Save mode info so we can set it from within SetMode for CRT1 */ @@ -3902,18 +3806,9 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { if(HwInfo->jChipType >= SIS_315H) { - SiS_UnLockCRT2(SiS_Pr,HwInfo); - if(HwInfo->jChipType < SIS_330) { - if(ROMAddr && SiS_Pr->SiS_UseROM) { - temp = ROMAddr[VB310Data_1_2_Offset]; - temp |= 0x40; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x02,temp); - } - } + SiS_ResetVB(SiS_Pr, HwInfo); SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x32,0x10); - SiS_SetRegOR(SiS_Pr->SiS_Part2Port,0x00,0x0c); - backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); } else { backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35); @@ -3927,7 +3822,7 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, /* If this is a custom mode, we don't check the modeflag for CRT2Mode */ SiS_GetVBInfo(SiS_Pr, ModeNo, ModeIdIndex, HwInfo, 0); } - SiS_SetHiVision(SiS_Pr, HwInfo); + SiS_SetYPbPr(SiS_Pr, HwInfo); SiS_SetTVMode(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); SiS_GetLCDResInfo(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); SiS_SetLowModeTest(SiS_Pr, ModeNo, HwInfo); @@ -3955,7 +3850,7 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { if(HwInfo->jChipType >= SIS_315H) { - if(HwInfo->jChipType < SIS_661) { + if(!SiS_Pr->SiS_ROMNew) { if(SiS_IsVAMode(SiS_Pr,HwInfo)) { SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01); } else { @@ -3965,15 +3860,7 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, SiS_SetReg(SiS_Pr->SiS_P3d4,0x38,backupreg); - tempr1 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30); - tempr2 = SiS_GetReg(SiS_Pr->SiS_Part2Port,0x00); - if(tempr1 & SetCRT2ToAVIDEO) tempr2 &= 0xF7; - else tempr2 |= 0x08; - if(tempr1 & SetCRT2ToSVIDEO) tempr2 &= 0xFB; - else tempr2 |= 0x04; - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x00,tempr2); - - if(tempr1 & SetCRT2ToLCD) { + if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x30) & SetCRT2ToLCD) { SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xfc); } } else if((HwInfo->jChipType == SIS_630) || @@ -4031,17 +3918,15 @@ SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, } SiSInitPtr(SiS_Pr, HwInfo); - SiSRegInit(SiS_Pr, BaseAddr); - SiS_GetSysFlags(SiS_Pr, HwInfo); - +#if (defined(i386) || defined(__i386) || defined(__i386__) || defined(__AMD64__)) SiS_Pr->SiS_VGAINFO = SiS_GetSetBIOSScratch(pScrn, 0x489, 0xff); - +#else + SiS_Pr->SiS_VGAINFO = 0x11; +#endif SiSInitPCIetc(SiS_Pr, HwInfo); - SiSSetLVDSetc(SiS_Pr, HwInfo); - SiSDetermineROMUsage(SiS_Pr, HwInfo); /* We don't clear the buffer under X */ @@ -4071,29 +3956,13 @@ SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, /* Get VB information (connectors, connected devices) */ /* (We don't care if the current mode is a CRT2 mode) */ SiS_GetVBInfo(SiS_Pr, ModeNo, ModeIdIndex, HwInfo, 0); - SiS_SetHiVision(SiS_Pr, HwInfo); + SiS_SetYPbPr(SiS_Pr, HwInfo); SiS_SetTVMode(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); SiS_GetLCDResInfo(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); SiS_SetLowModeTest(SiS_Pr, ModeNo, HwInfo); if(HwInfo->jChipType >= SIS_315H) { -#if 0 - if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x17) & 0x08) { - if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { - if(ModeNo != 0x10) SiS_Pr->SiS_SetFlag |= SetDOSMode; - } else if((IS_SIS651) && (SiS_Pr->SiS_VBType & VB_NoLCD)) { - SiS_Pr->SiS_SetFlag |= SetDOSMode; - } - } -#endif - - if(IS_SIS650) { - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x51,0x1f); - if(IS_SIS651) SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x51,0x20); - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x56,0xe7); - } - } + SiS_SetupCR5x(SiS_Pr, HwInfo); } /* Set mode on CRT1 */ @@ -4262,12 +4131,188 @@ SiS_GetPanelID(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) } #endif +#ifndef GETBITSTR +#define BITMASK(h,l) (((unsigned)(1U << ((h)-(l)+1))-1)<<(l)) +#define GENMASK(mask) BITMASK(1?mask,0?mask) +#define GETBITS(var,mask) (((var) & GENMASK(mask)) >> (0?mask)) +#define GETBITSTR(val,from,to) ((GETBITS(val,from)) << (0?to)) +#endif + +static void +SiS_CalcCRRegisters(SiS_Private *SiS_Pr, int depth) +{ + SiS_Pr->CCRT1CRTC[0] = ((SiS_Pr->CHTotal >> 3) - 5) & 0xff; /* CR0 */ + SiS_Pr->CCRT1CRTC[1] = (SiS_Pr->CHDisplay >> 3) - 1; /* CR1 */ + SiS_Pr->CCRT1CRTC[2] = (SiS_Pr->CHBlankStart >> 3) - 1; /* CR2 */ + SiS_Pr->CCRT1CRTC[3] = (((SiS_Pr->CHBlankEnd >> 3) - 1) & 0x1F) | 0x80; /* CR3 */ + SiS_Pr->CCRT1CRTC[4] = (SiS_Pr->CHSyncStart >> 3) + 3; /* CR4 */ + SiS_Pr->CCRT1CRTC[5] = ((((SiS_Pr->CHBlankEnd >> 3) - 1) & 0x20) << 2) | /* CR5 */ + (((SiS_Pr->CHSyncEnd >> 3) + 3) & 0x1F); + + SiS_Pr->CCRT1CRTC[6] = (SiS_Pr->CVTotal - 2) & 0xFF; /* CR6 */ + SiS_Pr->CCRT1CRTC[7] = (((SiS_Pr->CVTotal - 2) & 0x100) >> 8) /* CR7 */ + | (((SiS_Pr->CVDisplay - 1) & 0x100) >> 7) + | ((SiS_Pr->CVSyncStart & 0x100) >> 6) + | (((SiS_Pr->CVBlankStart - 1) & 0x100) >> 5) + | 0x10 + | (((SiS_Pr->CVTotal - 2) & 0x200) >> 4) + | (((SiS_Pr->CVDisplay - 1) & 0x200) >> 3) + | ((SiS_Pr->CVSyncStart & 0x200) >> 2); + + SiS_Pr->CCRT1CRTC[16] = ((((SiS_Pr->CVBlankStart - 1) & 0x200) >> 4) >> 5); /* CR9 */ + + if(depth != 8) { + if(SiS_Pr->CHDisplay >= 1600) SiS_Pr->CCRT1CRTC[16] |= 0x60; /* SRE */ + else if(SiS_Pr->CHDisplay >= 640) SiS_Pr->CCRT1CRTC[16] |= 0x40; + } + +#if 0 + if (mode->VScan >= 32) + regp->CRTC[9] |= 0x1F; + else if (mode->VScan > 1) + regp->CRTC[9] |= mode->VScan - 1; +#endif + + SiS_Pr->CCRT1CRTC[8] = (SiS_Pr->CVSyncStart ) & 0xFF; /* CR10 */ + SiS_Pr->CCRT1CRTC[9] = ((SiS_Pr->CVSyncEnd ) & 0x0F) | 0x80; /* CR11 */ + SiS_Pr->CCRT1CRTC[10] = (SiS_Pr->CVDisplay - 1) & 0xFF; /* CR12 */ + SiS_Pr->CCRT1CRTC[11] = (SiS_Pr->CVBlankStart - 1) & 0xFF; /* CR15 */ + SiS_Pr->CCRT1CRTC[12] = (SiS_Pr->CVBlankEnd - 1) & 0xFF; /* CR16 */ + + SiS_Pr->CCRT1CRTC[13] = /* SRA */ + GETBITSTR((SiS_Pr->CVTotal -2), 10:10, 0:0) | + GETBITSTR((SiS_Pr->CVDisplay -1), 10:10, 1:1) | + GETBITSTR((SiS_Pr->CVBlankStart-1), 10:10, 2:2) | + GETBITSTR((SiS_Pr->CVSyncStart ), 10:10, 3:3) | + GETBITSTR((SiS_Pr->CVBlankEnd -1), 8:8, 4:4) | + GETBITSTR((SiS_Pr->CVSyncEnd ), 4:4, 5:5) ; + + SiS_Pr->CCRT1CRTC[14] = /* SRB */ + GETBITSTR((SiS_Pr->CHTotal >> 3) - 5, 9:8, 1:0) | + GETBITSTR((SiS_Pr->CHDisplay >> 3) - 1, 9:8, 3:2) | + GETBITSTR((SiS_Pr->CHBlankStart >> 3) - 1, 9:8, 5:4) | + GETBITSTR((SiS_Pr->CHSyncStart >> 3) + 3, 9:8, 7:6) ; + + + SiS_Pr->CCRT1CRTC[15] = /* SRC */ + GETBITSTR((SiS_Pr->CHBlankEnd >> 3) - 1, 7:6, 1:0) | + GETBITSTR((SiS_Pr->CHSyncEnd >> 3) + 3, 5:5, 2:2) ; +} + +void +SiS_CalcLCDACRT1Timing(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex) +{ + USHORT modeflag, tempax, tempbx, VGAHDE = SiS_Pr->SiS_VGAHDE; + int i,j; + + /* 1:1 data: use data set by setcrt1crtc() */ + if(SiS_Pr->SiS_LCDInfo & LCDPass11) return; + + if(ModeNo <= 0x13) { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } else if(SiS_Pr->UseCustomMode) { + modeflag = SiS_Pr->CModeFlag; + } else { + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + } + + if(modeflag & HalfDCLK) VGAHDE >>= 1; + + SiS_Pr->CHDisplay = VGAHDE; + SiS_Pr->CHBlankStart = VGAHDE; + + SiS_Pr->CVDisplay = SiS_Pr->SiS_VGAVDE; + SiS_Pr->CVBlankStart = SiS_Pr->SiS_VGAVDE; + + tempbx = SiS_Pr->PanelHT - SiS_Pr->PanelXRes; + tempax = SiS_Pr->SiS_VGAHDE; /* not /2 ! */ + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + tempax = SiS_Pr->PanelXRes; + } + tempbx += tempax; + if(modeflag & HalfDCLK) tempbx -= VGAHDE; + SiS_Pr->CHTotal = SiS_Pr->CHBlankEnd = tempbx; + + tempax = VGAHDE; + tempbx = SiS_Pr->CHTotal; + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + tempbx = SiS_Pr->PanelXRes; + if(modeflag & HalfDCLK) tempbx >>= 1; + tempax += ((tempbx - tempax) >> 1); + } + + tempax += SiS_Pr->PanelHRS; + SiS_Pr->CHSyncStart = tempax; + tempax += SiS_Pr->PanelHRE; + SiS_Pr->CHSyncEnd = tempax; + + tempbx = SiS_Pr->PanelVT - SiS_Pr->PanelYRes; + tempax = SiS_Pr->SiS_VGAVDE; + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + tempax = SiS_Pr->PanelYRes; + } + SiS_Pr->CVTotal = SiS_Pr->CVBlankEnd = tempbx + tempax; + + tempax = SiS_Pr->SiS_VGAVDE; + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + tempax += (SiS_Pr->PanelYRes - tempax) >> 1; + } + tempax += SiS_Pr->PanelVRS; + SiS_Pr->CVSyncStart = tempax; + tempax += SiS_Pr->PanelVRE; + SiS_Pr->CVSyncEnd = tempax; + + SiS_CalcCRRegisters(SiS_Pr, 8); + SiS_Pr->CCRT1CRTC[16] &= ~0xE0; + + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); + + for(i=0,j=0;i<=7;i++,j++) { + SiS_SetReg(SiS_Pr->SiS_P3d4,j,SiS_Pr->CCRT1CRTC[i]); + } + for(j=0x10;i<=10;i++,j++) { + SiS_SetReg(SiS_Pr->SiS_P3d4,j,SiS_Pr->CCRT1CRTC[i]); + } + for(j=0x15;i<=12;i++,j++) { + SiS_SetReg(SiS_Pr->SiS_P3d4,j,SiS_Pr->CCRT1CRTC[i]); + } + for(j=0x0A;i<=15;i++,j++) { + SiS_SetReg(SiS_Pr->SiS_P3c4,j,SiS_Pr->CCRT1CRTC[i]); + } + + tempax = SiS_Pr->CCRT1CRTC[16] & 0xE0; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0E,0x1F,tempax); + + tempax = (SiS_Pr->CCRT1CRTC[16] & 0x01) << 5; + if(modeflag & DoubleScanMode) tempax |= 0x80; + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,0x5F,tempax); + +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "%d %d %d %d %d %d %d %d (%d %d %d %d)\n", + SiS_Pr->CHDisplay, SiS_Pr->CHSyncStart, SiS_Pr->CHSyncEnd, SiS_Pr->CHTotal, + SiS_Pr->CVDisplay, SiS_Pr->CVSyncStart, SiS_Pr->CVSyncEnd, SiS_Pr->CVTotal, + SiS_Pr->CHBlankStart, SiS_Pr->CHBlankEnd, SiS_Pr->CVBlankStart, SiS_Pr->CVBlankEnd); + + xf86DrvMsg(0, X_INFO, " {{0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,\n", + SiS_Pr->CCRT1CRTC[0], SiS_Pr->CCRT1CRTC[1], + SiS_Pr->CCRT1CRTC[2], SiS_Pr->CCRT1CRTC[3], + SiS_Pr->CCRT1CRTC[4], SiS_Pr->CCRT1CRTC[5], + SiS_Pr->CCRT1CRTC[6], SiS_Pr->CCRT1CRTC[7]); + xf86DrvMsg(0, X_INFO, " 0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,\n", + SiS_Pr->CCRT1CRTC[8], SiS_Pr->CCRT1CRTC[9], + SiS_Pr->CCRT1CRTC[10], SiS_Pr->CCRT1CRTC[11], + SiS_Pr->CCRT1CRTC[12], SiS_Pr->CCRT1CRTC[13], + SiS_Pr->CCRT1CRTC[14], SiS_Pr->CCRT1CRTC[15]); + xf86DrvMsg(0, X_INFO, " 0x%02x}},\n", SiS_Pr->CCRT1CRTC[16]); +#endif +} /* ================ XFREE86 ================= */ /* Helper functions */ #ifdef LINUX_XF86 + USHORT SiS_CheckBuildCustomMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags) { @@ -4348,73 +4393,16 @@ SiS_CheckBuildCustomMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags) pSiS->SiS_Pr->CSRClock = (pSiS->SiS_Pr->CDClock / 1000) + 1; - pSiS->SiS_Pr->CCRT1CRTC[0] = ((pSiS->SiS_Pr->CHTotal >> 3) - 5) & 0xff; - pSiS->SiS_Pr->CCRT1CRTC[1] = (pSiS->SiS_Pr->CHDisplay >> 3) - 1; - pSiS->SiS_Pr->CCRT1CRTC[2] = (pSiS->SiS_Pr->CHBlankStart >> 3) - 1; - pSiS->SiS_Pr->CCRT1CRTC[3] = (((pSiS->SiS_Pr->CHBlankEnd >> 3) - 1) & 0x1F) | 0x80; - pSiS->SiS_Pr->CCRT1CRTC[4] = (pSiS->SiS_Pr->CHSyncStart >> 3) + 3; - pSiS->SiS_Pr->CCRT1CRTC[5] = ((((pSiS->SiS_Pr->CHBlankEnd >> 3) - 1) & 0x20) << 2) | - (((pSiS->SiS_Pr->CHSyncEnd >> 3) + 3) & 0x1F); - - pSiS->SiS_Pr->CCRT1CRTC[6] = (pSiS->SiS_Pr->CVTotal - 2) & 0xFF; - pSiS->SiS_Pr->CCRT1CRTC[7] = (((pSiS->SiS_Pr->CVTotal - 2) & 0x100) >> 8) - | (((pSiS->SiS_Pr->CVDisplay - 1) & 0x100) >> 7) - | ((pSiS->SiS_Pr->CVSyncStart & 0x100) >> 6) - | (((pSiS->SiS_Pr->CVBlankStart - 1) & 0x100) >> 5) - | 0x10 - | (((pSiS->SiS_Pr->CVTotal - 2) & 0x200) >> 4) - | (((pSiS->SiS_Pr->CVDisplay - 1) & 0x200) >> 3) - | ((pSiS->SiS_Pr->CVSyncStart & 0x200) >> 2); - - pSiS->SiS_Pr->CCRT1CRTC[16] = ((((pSiS->SiS_Pr->CVBlankStart - 1) & 0x200) >> 4) >> 5); /* cr9 */ - -#if 0 - if (mode->VScan >= 32) - regp->CRTC[9] |= 0x1F; - else if (mode->VScan > 1) - regp->CRTC[9] |= mode->VScan - 1; -#endif - - pSiS->SiS_Pr->CCRT1CRTC[8] = (pSiS->SiS_Pr->CVSyncStart ) & 0xFF; /* cr10 */ - pSiS->SiS_Pr->CCRT1CRTC[9] = ((pSiS->SiS_Pr->CVSyncEnd ) & 0x0F) | 0x80; /* cr11 */ - pSiS->SiS_Pr->CCRT1CRTC[10] = (pSiS->SiS_Pr->CVDisplay - 1) & 0xFF; /* cr12 */ - pSiS->SiS_Pr->CCRT1CRTC[11] = (pSiS->SiS_Pr->CVBlankStart - 1) & 0xFF; /* cr15 */ - pSiS->SiS_Pr->CCRT1CRTC[12] = (pSiS->SiS_Pr->CVBlankEnd - 1) & 0xFF; /* cr16 */ - - pSiS->SiS_Pr->CCRT1CRTC[13] = - GETBITSTR((pSiS->SiS_Pr->CVTotal -2), 10:10, 0:0) | - GETBITSTR((pSiS->SiS_Pr->CVDisplay -1), 10:10, 1:1) | - GETBITSTR((pSiS->SiS_Pr->CVBlankStart-1), 10:10, 2:2) | - GETBITSTR((pSiS->SiS_Pr->CVSyncStart ), 10:10, 3:3) | - GETBITSTR((pSiS->SiS_Pr->CVBlankEnd -1), 8:8, 4:4) | - GETBITSTR((pSiS->SiS_Pr->CVSyncEnd ), 4:4, 5:5) ; - - pSiS->SiS_Pr->CCRT1CRTC[14] = - GETBITSTR((pSiS->SiS_Pr->CHTotal >> 3) - 5, 9:8, 1:0) | - GETBITSTR((pSiS->SiS_Pr->CHDisplay >> 3) - 1, 9:8, 3:2) | - GETBITSTR((pSiS->SiS_Pr->CHBlankStart >> 3) - 1, 9:8, 5:4) | - GETBITSTR((pSiS->SiS_Pr->CHSyncStart >> 3) + 3, 9:8, 7:6) ; - - - pSiS->SiS_Pr->CCRT1CRTC[15] = - GETBITSTR((pSiS->SiS_Pr->CHBlankEnd >> 3) - 1, 7:6, 1:0) | - GETBITSTR((pSiS->SiS_Pr->CHSyncEnd >> 3) + 3, 5:5, 2:2) ; + SiS_CalcCRRegisters(pSiS->SiS_Pr, depth); switch(depth) { - case 8: - pSiS->SiS_Pr->CModeFlag |= 0x223b; - break; - case 16: - pSiS->SiS_Pr->CModeFlag |= 0x227d; - break; - case 32: - pSiS->SiS_Pr->CModeFlag |= 0x22ff; - break; - default: - return 0; - } - - if(pSiS->SiS_Pr->CFlags & V_DBLSCAN) + case 8: pSiS->SiS_Pr->CModeFlag |= 0x223b; break; + case 16: pSiS->SiS_Pr->CModeFlag |= 0x227d; break; + case 32: pSiS->SiS_Pr->CModeFlag |= 0x22ff; break; + default: return 0; + } + + if(pSiS->SiS_Pr->CFlags & V_DBLSCAN) pSiS->SiS_Pr->CModeFlag |= DoubleScanMode; if((pSiS->SiS_Pr->CVDisplay >= 1024) || @@ -4438,33 +4426,23 @@ SiS_CheckBuildCustomMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags) pSiS->SiS_Pr->UseCustomMode = TRUE; #ifdef TWDEBUG - xf86DrvMsg(0, X_INFO, "Custom mode %dx%d:\n", + xf86DrvMsg(0, X_INFO, "Custom mode %dx%d:\n", pSiS->SiS_Pr->CHDisplay,pSiS->SiS_Pr->CVDisplay); xf86DrvMsg(0, X_INFO, "Modeflag %04x, Infoflag %04x\n", pSiS->SiS_Pr->CModeFlag, pSiS->SiS_Pr->CInfoFlag); xf86DrvMsg(0, X_INFO, " {{0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,\n", - pSiS->SiS_Pr->CCRT1CRTC[0], - pSiS->SiS_Pr->CCRT1CRTC[1], - pSiS->SiS_Pr->CCRT1CRTC[2], - pSiS->SiS_Pr->CCRT1CRTC[3], - pSiS->SiS_Pr->CCRT1CRTC[4], - pSiS->SiS_Pr->CCRT1CRTC[5], - pSiS->SiS_Pr->CCRT1CRTC[6], - pSiS->SiS_Pr->CCRT1CRTC[7]); + pSiS->SiS_Pr->CCRT1CRTC[0], pSiS->SiS_Pr->CCRT1CRTC[1], + pSiS->SiS_Pr->CCRT1CRTC[2], pSiS->SiS_Pr->CCRT1CRTC[3], + pSiS->SiS_Pr->CCRT1CRTC[4], pSiS->SiS_Pr->CCRT1CRTC[5], + pSiS->SiS_Pr->CCRT1CRTC[6], pSiS->SiS_Pr->CCRT1CRTC[7]); xf86DrvMsg(0, X_INFO, " 0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,\n", - pSiS->SiS_Pr->CCRT1CRTC[8], - pSiS->SiS_Pr->CCRT1CRTC[9], - pSiS->SiS_Pr->CCRT1CRTC[10], - pSiS->SiS_Pr->CCRT1CRTC[11], - pSiS->SiS_Pr->CCRT1CRTC[12], - pSiS->SiS_Pr->CCRT1CRTC[13], - pSiS->SiS_Pr->CCRT1CRTC[14], - pSiS->SiS_Pr->CCRT1CRTC[15]); + pSiS->SiS_Pr->CCRT1CRTC[8], pSiS->SiS_Pr->CCRT1CRTC[9], + pSiS->SiS_Pr->CCRT1CRTC[10], pSiS->SiS_Pr->CCRT1CRTC[11], + pSiS->SiS_Pr->CCRT1CRTC[12], pSiS->SiS_Pr->CCRT1CRTC[13], + pSiS->SiS_Pr->CCRT1CRTC[14], pSiS->SiS_Pr->CCRT1CRTC[15]); xf86DrvMsg(0, X_INFO, " 0x%02x}},\n", pSiS->SiS_Pr->CCRT1CRTC[16]); xf86DrvMsg(0, X_INFO, "Clock: 0x%02x, 0x%02x, %d\n", - pSiS->SiS_Pr->CSR2B, - pSiS->SiS_Pr->CSR2C, - pSiS->SiS_Pr->CSRClock); + pSiS->SiS_Pr->CSR2B, pSiS->SiS_Pr->CSR2C, pSiS->SiS_Pr->CSRClock); #endif return 1; } @@ -4581,7 +4559,7 @@ SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN isfo /* Horizontal display enable end */ HDE = (cr_data & 0xff) | ((unsigned short) (sr_data & 0x0C) << 6); - E = HDE + 1; + E = HDE + 1; /* 0x80 0x64 */ cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[4]; /* inSISIDXREG(SISCR, 0x04, cr_data); */ @@ -4589,7 +4567,7 @@ SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN isfo /* Horizontal retrace (=sync) start */ HRS = (cr_data & 0xff) | ((unsigned short) (sr_data & 0xC0) << 2); - F = HRS - E - 3; + F = HRS - E - 3; /* 0x06 0x06 */ cr_data = pSiS->SiS_Pr->SiS_CRT1Table[index].CR[2]; /* inSISIDXREG(SISCR, 0x02, cr_data); */ @@ -4619,7 +4597,7 @@ SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN isfo B = (temp > 0) ? temp : (temp + 256); temp = HRE - ((E + F + 3) & 63); - C = (temp > 0) ? temp : (temp + 64); + C = (temp > 0) ? temp : (temp + 64); /* 0x0b 0x0b */ D = B - F - C; @@ -5151,7 +5129,7 @@ sisfb_mode_rate_to_ddata(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, return 0; #endif } - + if(!(SiS_SearchModeID(SiS_Pr, &ModeNo, &ModeIdIndex))) return 0; RefreshRateTableIndex = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].REFindex; @@ -1,36 +1,52 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init.h,v 1.35 2003/11/20 19:53:21 twini Exp $ */ +/* $XFree86$ */ /* * Data and prototypes for init.c * - * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria * - * If distributed as part of the linux kernel, the contents of this file - * is entirely covered by the GPL. + * If distributed as part of the Linux kernel, the following license terms + * apply: * - * Otherwise, the following terms apply: + * * This program is free software; you can redistribute it and/or modify + * * it under the terms of the GNU General Public License as published by + * * the Free Software Foundation; either version 2 of the named License, + * * or any later version. + * * + * * This program is distributed in the hope that it will be useful, + * * but WITHOUT ANY WARRANTY; without even the implied warranty of + * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * * GNU General Public License for more details. + * * + * * You should have received a copy of the GNU General Public License + * * along with this program; if not, write to the Free Software + * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * - * 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. + * Otherwise, the following license terms apply: * - * 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. + * * 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. + * * + * * 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. * * Author: Thomas Winischhofer <thomas@winischhofer.net> * - * Based on code by Silicon Intergrated Systems - * */ #ifndef _INIT_ @@ -92,9 +108,11 @@ const USHORT ModeIndex_1152x864[] = {0x29, 0x2a, 0x00, 0x2b}; const USHORT ModeIndex_300_1280x768[] = {0x55, 0x5a, 0x00, 0x5b}; const USHORT ModeIndex_310_1280x768[] = {0x23, 0x24, 0x00, 0x25}; const USHORT ModeIndex_1280x720[] = {0x79, 0x75, 0x00, 0x78}; +const USHORT ModeIndex_1280x800[] = {0x14, 0x15, 0x00, 0x16}; const USHORT ModeIndex_1360x768[] = {0x48, 0x4b, 0x00, 0x4e}; const USHORT ModeIndex_300_1360x1024[]= {0x67, 0x6f, 0x00, 0x72}; /* 300 series, BARCO only */ const USHORT ModeIndex_1400x1050[] = {0x26, 0x27, 0x00, 0x28}; /* 315 series only */ +const USHORT ModeIndex_1680x1050[] = {0x17, 0x18, 0x00, 0x19}; /* 315 series only */ const USHORT ModeIndex_1600x1200[] = {0x3c, 0x3d, 0x00, 0x66}; const USHORT ModeIndex_1920x1440[] = {0x68, 0x69, 0x00, 0x6b}; const USHORT ModeIndex_300_2048x1536[]= {0x6c, 0x6d, 0x00, 0x00}; @@ -234,7 +252,9 @@ static const SiS_ModeResInfoStruct SiS_ModeResInfo[] = { 1024, 600, 8,16}, /* 0x19 */ { 1152, 768, 8,16}, /* 0x1a */ { 768, 576, 8,16}, /* 0x1b */ - { 1360,1024, 8,16} /* 0x1c */ + { 1360,1024, 8,16}, /* 0x1c */ + { 1280, 800, 8,16}, /* 0x1d */ + { 1680,1050, 8,16} /* 0x1e */ }; static SiS_StandTableStruct SiS_StandTable[]= @@ -739,6 +759,7 @@ static const UCHAR SiS_HiTVSt2Timing[] = { 0x63,0x4f,0x27,0x00,0xfc,0xff,0x6a,0x00 }; +#if 0 static const UCHAR SiS_HiTVTextTiming[] = { 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x65, 0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d, @@ -749,6 +770,7 @@ static const UCHAR SiS_HiTVTextTiming[] = { 0x60,0x80,0x14,0x90,0x8c,0x60,0x04,0x96, 0x72,0x5c,0x11,0x00,0xfc,0xff,0x32,0x00 }; +#endif static const UCHAR SiS_HiTVGroup3Data[] = { 0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0x5f, @@ -772,6 +794,7 @@ static const UCHAR SiS_HiTVGroup3Simu[] = { 0x18,0x05,0x18,0x05,0x4c,0xa8,0x01 }; +#if 0 static const UCHAR SiS_HiTVGroup3Text[] = { 0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0xa7, 0xf5,0x20,0xce,0xce,0x55,0x47,0x2a,0xa6, @@ -782,6 +805,7 @@ static const UCHAR SiS_HiTVGroup3Text[] = { 0x01,0x05,0x03,0x7e,0x65,0x31,0x14,0x75, 0x18,0x05,0x18,0x05,0x4c,0xa8,0x01 }; +#endif static const UCHAR SiS_NTSCPhase[] = {0x21,0xed,0xba,0x08}; static const UCHAR SiS_PALPhase[] = {0x2a,0x05,0xe3,0x00}; @@ -795,7 +819,7 @@ static const UCHAR SiS_SpecialPhase[] = {0x1e,0x8c,0x5c,0x7a}; static const UCHAR SiS_SpecialPhaseM[]= {0x1e,0x83,0x0a,0xe0}; static const UCHAR SiS_SpecialPhaseJ[]= {0x25,0xd4,0xfd,0x5e}; -static const SiS_TVDataStruct SiS_StPALData[]= +static const SiS_TVDataStruct SiS_StPALData[] = { { 1, 1, 864, 525,1270, 400, 100, 0, 760,0xf4,0xff,0x1c,0x22}, { 1, 1, 864, 525,1270, 350, 100, 0, 760,0xf4,0xff,0x1c,0x22}, @@ -815,10 +839,11 @@ static const SiS_TVDataStruct SiS_ExtPALData[] = /*{ 36, 25,1060, 648,1316, 530, 438, 0, 438,0xeb,0x05,0x25,0x16},*//* 800x600, 400x300 */ { 36, 25,1060, 648,1270, 530, 438, 0, 438,0xeb,0x05,0x25,0x16}, /* 800x600, 400x300 - better */ { 3, 2,1080, 619,1270, 540, 438, 0, 438,0xf3,0x00,0x1d,0x20}, /* 720x576 */ - { 1, 1,1170, 821,1270, 520, 686, 0, 686,0xF3,0x00,0x1D,0x20} /* 1024x768 */ + { 1, 1,1170, 821,1270, 520, 686, 0, 686,0xF3,0x00,0x1D,0x20}, /* 1024x768 */ + { 1, 1,1170, 821,1270, 520, 686, 0, 686,0xF3,0x00,0x1D,0x20} /* 1024x768 (for NTSC equ) */ }; -static const SiS_TVDataStruct SiS_StNTSCData[]= +static const SiS_TVDataStruct SiS_StNTSCData[] = { { 1, 1, 858, 525,1270, 400, 50, 0, 760,0xf1,0x04,0x1f,0x18}, { 1, 1, 858, 525,1270, 350, 50, 0, 640,0xf1,0x04,0x1f,0x18}, @@ -827,7 +852,7 @@ static const SiS_TVDataStruct SiS_StNTSCData[]= { 1, 1, 858, 525,1270, 480, 0, 0, 760,0xf1,0x04,0x1f,0x18} }; -static const SiS_TVDataStruct SiS_ExtNTSCData[]= +static const SiS_TVDataStruct SiS_ExtNTSCData[] = { { 143, 65, 858, 443,1270, 440, 171, 0, 171,0xf1,0x04,0x1f,0x18}, /* 640x400, 320x200 */ { 88, 35, 858, 393,1270, 440, 171, 0, 171,0xf1,0x04,0x1f,0x18}, @@ -835,87 +860,163 @@ static const SiS_TVDataStruct SiS_ExtNTSCData[]= { 143, 70, 924, 393,1270, 440, 92, 0, 92,0xf4,0x0b,0x1c,0x0a}, { 143, 76, 836, 523,1270, 440, 224, 0, 0,0xf1,0x05,0x1f,0x16}, /* 640x480, 320x240 */ { 143, 120,1056, 643,1270, 440, 0, 128, 0,0xf4,0x10,0x1c,0x00}, /* 800x600, 400x300 */ - { 143, 76, 836, 523,1270, 440, 0, 128, 0,0xee,0x0c,0x22,0x08}, /* 720x480 - BETTER (from 300 series) */ /*{ 2, 1, 858, 503,1270, 480, 0, 128, 0,0xee,0x0c,0x22,0x08},*/ /* 720x480 (old, from 650) */ - { 1, 1,1100, 811,1412, 440, 0, 128, 0,0xee,0x0c,0x22,0x08} /* 1024x768 CORRECTED */ -/*{ 65, 64,1056, 791,1270, 480, 638, 0, 0,0xEE,0x0C,0x22,0x08} */ /* 1024x768 */ + { 143, 76, 836, 523,1270, 440, 0, 128, 0,0xee,0x0c,0x22,0x08}, /* 720x480 - BETTER (from 300 series) */ +/*{ 65, 64,1056, 791,1270, 480, 638, 0, 0,0xEE,0x0C,0x22,0x08} */ /* 1024x768 (525i) */ + { 1, 1,1100, 811,1412, 440, 0, 128, 0,0xee,0x0c,0x22,0x08}, /* 1024x768 (525i) CORRECTED */ + { 65, 64,1056, 791,1270, 480, 455, 0, 0,0x00,0x00,0x00,0x00} /* 1024x768 (525p) */ }; -static const SiS_TVDataStruct SiS_St2HiTVData[]= +static const SiS_TVDataStruct SiS_StHiTVData[] = /* Slave + TVSimu */ +{ + { 1, 1, 0x37c,0x233,0x2b2,0x320, 0, 0, 0, 0x00,0x00,0x00,0x00}, + { 1, 1, 0x37c,0x233,0x2b2,0x2bc, 0, 0, 0, 0x00,0x00,0x00,0x00}, + { 1, 1, 0x37c,0x233,0x2b2,0x320, 0, 0, 0, 0x00,0x00,0x00,0x00}, + { 1, 1, 0x37c,0x233,0x2b2,0x2bc, 0, 0, 0, 0x00,0x00,0x00,0x00}, + { 1, 1, 0x37c,0x233,0x2b2,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00}, + { 8, 5, 0x41a,0x2ab,0x670,0x3c0,0x150,128, 0, 0x00,0x00,0x00,0x00} +}; + +static const SiS_TVDataStruct SiS_St2HiTVData[] = /* Slave */ { { 3, 1, 0x348,0x1e3,0x670,0x3c0,0x032, 0, 0, 0x00,0x00,0x00,0x00}, { 1, 1, 0x37c,0x233,0x2b2,0x2bc, 0, 0, 0, 0x00,0x00,0x00,0x00}, { 3, 1, 0x348,0x1e3,0x670,0x3c0,0x032, 0, 0, 0x00,0x00,0x00,0x00}, - { 1, 1, 0x3e8,0x233,0x311,0x2bc, 0, 0, 0, 0x00,0x00,0x00,0x00}, + { 1, 1, 0x37c,0x233,0x2b2,0x2bc, 0, 0, 0, 0x00,0x00,0x00,0x00}, { 5, 2, 0x348,0x233,0x670,0x3c0,0x08d,128, 0, 0x00,0x00,0x00,0x00}, { 8, 5, 0x41a,0x2ab,0x670,0x3c0,0x17c,128, 0, 0x00,0x00,0x00,0x00} }; -static const SiS_TVDataStruct SiS_ExtHiTVData[]= +static const SiS_TVDataStruct SiS_ExtHiTVData[] = { { 6, 1, 0x348,0x233,0x660,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00}, { 3, 1, 0x3c0,0x233,0x660,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00}, - { 3, 1, 0x348,0x1e3,0x660,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00}, + { 6, 1, 0x348,0x233,0x660,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00}, { 3, 1, 0x3c0,0x233,0x660,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00}, { 5, 1, 0x348,0x233,0x670,0x3c0,0x166,128, 0, 0x00,0x00,0x00,0x00}, /* 640x480 */ { 16, 5, 0x41a,0x2ab,0x670,0x3c0,0x143,128, 0, 0x00,0x00,0x00,0x00}, /* 800x600 */ { 25, 12, 0x4ec,0x353,0x670,0x3c0,0x032, 0, 0, 0x00,0x00,0x00,0x00}, /* 1024x768 */ { 5, 4, 0x627,0x464,0x670,0x3c0,0x128, 0, 0, 0x00,0x00,0x00,0x00}, /* 1280x1024 */ - { 4, 1, 0x41a,0x233,0x670,0x3c0,0x143,128, 0, 0x00,0x00,0x00,0x00}, /* 800x480 */ + { 4, 1, 0x41a,0x233,0x60c,0x3c0,0x143,128, 0, 0x00,0x00,0x00,0x00}, /* 800x480 */ { 5, 2, 0x578,0x293,0x670,0x3c0,0x032, 0, 0, 0x00,0x00,0x00,0x00}, /* 1024x576 */ { 8, 5, 0x6d6,0x323,0x670,0x3c0,0x128, 0, 0, 0x00,0x00,0x00,0x00} /* 1280x720 */ }; +static const SiS_TVDataStruct SiS_St525pData[] = +{ + { 1, 1, 0x6b4,0x20d,0x4f6,0x190, 50, 0, 0x2f8, 0x00,0x00,0x00,0x00}, + { 1, 1, 0x6b4,0x20d,0x4f6,0x15e, 50, 0, 0x280, 0x00,0x00,0x00,0x00}, + { 1, 1, 0x6b4,0x20d,0x4f6,0x190, 50, 0, 0x2f8, 0x00,0x00,0x00,0x00}, + { 1, 1, 0x6b4,0x20d,0x4f6,0x15e, 50, 0, 0x280, 0x00,0x00,0x00,0x00}, + { 1, 1, 0x6b4,0x20d,0x4f6,0x1e0, 0, 0, 0x2f8, 0x00,0x00,0x00,0x00} +}; + +static const SiS_TVDataStruct SiS_St750pData[] = +{ + { 1, 1, 0x672,0x2ee,0x500,0x190, 50, 0, 0x2f8, 0x00,0x00,0x00,0x00}, + { 1, 1, 0x672,0x2ee,0x500,0x15e, 50, 0, 0x280, 0x00,0x00,0x00,0x00}, + { 1, 1, 0x672,0x2ee,0x500,0x190, 0, 0, 0x2d0, 0x00,0x00,0x00,0x00}, + { 1, 1, 0x672,0x2ee,0x500,0x15e, 0, 0, 0x2d0, 0x00,0x00,0x00,0x00}, + { 1, 1, 0x672,0x2ee,0x500,0x1e0, 0, 0, 0x2f8, 0x00,0x00,0x00,0x00} +}; + +static const SiS_TVDataStruct SiS_Ext750pData[] = +{ + { 3, 1, 0x3a7,0x1d6,0x500,0x2a8, 50, 0, 0, 0x00,0x00,0x00,0x00}, + { 24, 7, 0x3a7,0x1a4,0x500,0x2a8, 50, 0, 0, 0x00,0x00,0x00,0x00}, + { 3, 1, 0x3a7,0x1d6,0x500,0x2a8, 50, 0, 0, 0x00,0x00,0x00,0x00}, + { 24, 7, 0x3a7,0x1a4,0x500,0x2a8, 50, 0, 0, 0x00,0x00,0x00,0x00}, + { 99, 32, 0x320,0x1fe,0x500,0x2d0, 50, 0, 0, 0x00,0x00,0x00,0x00}, /* 640x480 */ + { 5, 4, 0x5d8,0x29e,0x500,0x2a8, 50, 0, 0, 0x00,0x00,0x00,0x00}, /* 800x600 */ + { 2, 1, 0x35a,0x1f7,0x4f6,0x1e0, 0,128, 0, 0x00,0x00,0x00,0x00}, /* 720x480 */ + { 68, 64, 0x55f,0x346,0x500,0x2a8,0x27e, 0, 0, 0x00,0x00,0x00,0x00}, /* 1024x768 */ + { 25, 24, 0x5d8,0x2f3,0x460,0x2a8, 50, 0, 0, 0x00,0x00,0x00,0x00} /* 1280x720 */ +}; + +static const SiS_LCDDataStruct SiS_LCD1280x720Data[] = +{ + { 14, 5, 864, 432, 1344, 806 }, /* 640x400 */ + { 16, 5, 864, 378, 1344, 806 }, + { 14, 5, 864, 432, 1344, 806 }, + { 16, 5, 864, 378, 1344, 806 }, + { 24, 11, 924, 523, 1344, 806 }, /* 640x480 */ + { 7, 5, 1152, 664, 1344, 806 }, /* 800x600 */ + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0, 0 }, + { 1, 1, 1344, 806, 1344, 806 } /* 1280x720 */ +}; + +/* About 1280x768: For TMDS, Panel_1280x768 will only be set if + * the panel is a Fujitsu 7911 (VL-17WDX8) (with clock 81, 1688x802) + * Other TMDS panels of this resolution will be treated as custom. + * For LVDS, we know two types. Data follows: + */ + +static const SiS_LCDDataStruct SiS_StLCD1280x768_2Data[] = +{ + { 64, 21, 858, 434, 1408, 806 }, /* 640x400 */ + { 32, 9, 858, 372, 1408, 806 }, + { 64, 21, 858, 434, 1408, 806 }, + { 32, 9, 858, 372, 1408, 806 }, + { 143, 68, 1024, 527, 1408, 806 }, /* 640x480 */ + { 64, 51, 1364, 663, 1408, 806 }, /* 800x600 */ + { 88, 81, 1296, 806, 1408, 806 }, /* 1024x768 */ + { 0, 0, 0, 0, 0, 0 }, + { 1, 1, 1408, 806, 1408, 806 } /* 1280x768 */ +}; + +static const SiS_LCDDataStruct SiS_ExtLCD1280x768_2Data[] = +{ + { 64, 25, 1056, 422, 1408, 806 }, /*, 664 */ + { 128, 39, 884, 396, 1408, 806 }, /*, 640 */ + { 64, 25, 1056, 422, 1408, 806 }, /*, 664 */ + { 128, 39, 884, 396, 1408, 806 }, /*, 640 */ + { 32, 15, 1056, 513, 1408, 806 }, /*, 664 */ + { 176, 125, 1280, 640, 1408, 806 }, /*, 768 */ + { 88, 81, 1296, 806, 1408, 806 }, + { 0, 0, 0, 0, 0, 0 }, + { 1, 1, 1408, 806, 1408, 806 } +}; + +static const SiS_LCDDataStruct SiS_LCD1280x768_3Data[] = +{ + { 64, 25, 1056, 422, 1664, 798 }, /* 640x400 */ + { 128, 39, 884, 396, 1408, 806 }, /* ,640 */ + { 64, 25, 1056, 422, 1664, 798 }, /* 640x400 */ + { 128, 39, 884, 396, 1408, 806 }, /* ,640 */ + { 32, 15, 1056, 513, 1408, 806 }, /* ,664 */ /* 640x480 */ + { 176, 125, 1280, 640, 1408, 806 }, /* ,768 */ /* 800x600 */ + { 64, 61, 1342, 806, 1408, 806 }, /* 1024x768 */ + { 0, 0, 0, 0, 0, 0 }, + { 1, 1, 1408, 806, 1408, 806 } /* 1280x768 */ +}; + +static const SiS_LCDDataStruct SiS_LCD1280x800Data[] = +{ + { 128, 51, 1122, 412, 1408, 816 }, /* 640x400 */ + { 128, 49, 1232, 361, 1408, 816 }, + { 128, 51, 1122, 412, 1408, 816 }, + { 128, 49, 1232, 361, 1408, 816 }, + { 8, 3, 880, 491, 1408, 816 }, /* 640x480 */ + { 11, 6, 1024, 612, 1408, 816 }, /* 800x600 */ + { 22, 21, 1400, 784, 1408, 816 }, /* 1024x768 */ + { 0, 0, 0, 0, 0, 0 }, + { 1, 1, 1408, 816, 1408, 816 } /* 1280x800 */ +}; + static const SiS_LCDDataStruct SiS_LCD1280x960Data[] = { - { 9, 2, 800, 500,1800,1000}, - { 9, 2, 800, 500,1800,1000}, - { 4, 1, 900, 500,1800,1000}, - { 4, 1, 900, 500,1800,1000}, - { 9, 2, 800, 500,1800,1000}, - { 30, 11,1056, 625,1800,1000}, - { 5, 3,1350, 800,1800,1000}, - { 1, 1,1576,1050,1576,1050}, - { 1, 1,1800,1000,1800,1000} -}; - -static const SiS_LCDDataStruct SiS_StLCD1280x768Data[] = -{ - { 211, 100, 2100, 408, 1688, 802 }, /* These values are *wrong* */ - { 211, 64, 1536, 358, 1688, 802 }, /* (which is why they aren't used yet) */ - { 211, 100, 2100, 408, 1688, 802 }, - { 211, 64, 1536, 358, 1688, 802 }, - { 211, 48, 840, 488, 1688, 802 }, - { 211, 72, 1008, 609, 1688, 802 }, - { 211, 128, 1400, 776, 1688, 802 }, - { 211, 205, 1680, 1041, 1688, 802 }, - { 1, 1, 1688, 802, 1688, 802 } /* That's the only one that *might* be correct */ -}; - -static const SiS_LCDDataStruct SiS_ExtLCD1280x768Data[] = -{ - { 211, 100, 2100, 408, 1688, 802 }, /* These values are *wrong* */ - { 211, 64, 1536, 358, 1688, 802 }, /* (which is why they aren't used yet) */ - { 211, 100, 2100, 408, 1688, 802 }, - { 211, 64, 1536, 358, 1688, 802 }, - { 211, 48, 840, 488, 1688, 802 }, - { 211, 72, 1008, 609, 1688, 802 }, - { 211, 128, 1400, 776, 1688, 802 }, - { 211, 205, 1680, 1041, 1688, 802 }, - { 1, 1, 1688, 802, 1688, 802 } /* That's the only one that *might* be correct */ -}; - -static const SiS_LCDDataStruct SiS_NoScaleData1280x768[] = -{ /* All values guessed */ - { 1, 1, 1688, 802, 1688, 802}, - { 1, 1, 1688, 802, 1688, 802}, - { 1, 1, 1688, 802, 1688, 802}, - { 1, 1, 1688, 802, 1688, 802}, - { 1, 1, 1688, 802, 1688, 802}, - { 1, 1, 1688, 802, 1688, 802}, - { 1, 1, 1688, 802, 1688, 802}, - { 1, 1, 1688, 802, 1688, 802}, - { 1, 1, 1688, 802, 1688, 802} + { 9, 2, 800, 500, 1800, 1000 }, + { 9, 2, 800, 500, 1800, 1000 }, + { 4, 1, 900, 500, 1800, 1000 }, + { 4, 1, 900, 500, 1800, 1000 }, + { 9, 2, 800, 500, 1800, 1000 }, + { 30, 11, 1056, 625, 1800, 1000 }, + { 5, 3, 1350, 800, 1800, 1000 }, + { 1, 1, 1576, 1050, 1576, 1050 }, + { 1, 1, 1800, 1000, 1800, 1000 } }; static const SiS_LCDDataStruct SiS_StLCD1400x1050Data[] = @@ -933,28 +1034,32 @@ static const SiS_LCDDataStruct SiS_StLCD1400x1050Data[] = static const SiS_LCDDataStruct SiS_ExtLCD1400x1050Data[] = { - { 211, 100, 2100, 408, 1688, 1066 }, + { 211, 100, 2100, 408, 1688, 1066 }, /* 640x400 */ { 211, 64, 1536, 358, 1688, 1066 }, { 211, 100, 2100, 408, 1688, 1066 }, { 211, 64, 1536, 358, 1688, 1066 }, - { 211, 48, 840, 488, 1688, 1066 }, - { 211, 72, 1008, 609, 1688, 1066 }, + { 211, 48, 840, 488, 1688, 1066 }, /* 640x480 */ + { 211, 72, 1008, 609, 1688, 1066 }, /* 800x600 */ { 211, 128, 1400, 776, 1688, 1066 }, { 211, 205, 1680, 1041, 1688, 1066 }, { 1, 1, 1688, 1066, 1688, 1066 } }; -static const SiS_LCDDataStruct SiS_NoScaleData1400x1050[] = +static const SiS_LCDDataStruct SiS_LCD1680x1050Data[] = { - { 1, 1, 1688, 1066, 1688, 1066 }, - { 1, 1, 1688, 1066, 1688, 1066 }, - { 1, 1, 1688, 1066, 1688, 1066 }, - { 1, 1, 1688, 1066, 1688, 1066 }, - { 1, 1, 1688, 1066, 1688, 1066 }, - { 1, 1, 1688, 1066, 1688, 1066 }, - { 1, 1, 1688, 1066, 1688, 1066 }, - { 1, 1, 1688, 1066, 1688, 1066 }, - { 1, 1, 1688, 1066, 1688, 1066 } + { 95, 24, 1260, 410, 1900, 1066 }, /* 0 640x400 */ + { 10, 3, 1710, 362, 1900, 1066 }, + { 95, 24, 1260, 410, 1900, 1066 }, + { 10, 3, 1710, 362, 1900, 1066 }, + { 95, 32, 1400, 490, 1900, 1066 }, /* 4 640x480 */ + { 95, 42, 1470, 610, 1900, 1066 }, /* 5 800x600 */ + { 95, 64, 1750, 784, 1900, 1066 }, /* 6 1024x768 */ + { 95, 94, 1900, 1055, 1900, 1066 }, /* 7 1280x1024 */ + { 41, 31, 1900, 806, 1900, 1066 }, /* 8 1280x768 */ + { 95, 69, 1800, 817, 1900, 1066 }, /* 9 1280x800 patch */ + { 13, 9, 1900, 739, 1900, 1066 }, /* 10 1280x720 */ + { 95, 94, 1880, 1066, 1900, 1066 }, /* 11 1400x1050 patch */ + { 1, 1, 1900, 1066, 1900, 1066 } /* 12 1680x1050 */ }; static const SiS_LCDDataStruct SiS_StLCD1600x1200Data[] = @@ -985,422 +1090,29 @@ static const SiS_LCDDataStruct SiS_ExtLCD1600x1200Data[] = { 1, 1,2160,1250, 2160, 1250 } }; -static const SiS_LCDDataStruct SiS_NoScaleData1600x1200[] = -{ - {1, 1, 2160, 1250, 2048, 1250}, - {1, 1, 2160, 1250, 2048, 1250}, - {1, 1, 2160, 1250, 2048, 1250}, - {1, 1, 2160, 1250, 2048, 1250}, - {1, 1, 2160, 1250, 2048, 1250}, - {1, 1, 2160, 1250, 2048, 1250}, - {1, 1, 2160, 1250, 2048, 1250}, - {1, 1, 2160, 1250, 2048, 1250}, - {1, 1, 2160, 1250, 2048, 1250}, - {1, 1, 2160, 1250, 2048, 1250}, -}; - static const SiS_LCDDataStruct SiS_NoScaleData[] = { - { 1, 1, 800, 449, 800, 449 }, + { 1, 1, 800, 449, 800, 449 }, /* 0x00: 320x200, 640x400 */ { 1, 1, 800, 449, 800, 449 }, { 1, 1, 900, 449, 900, 449 }, { 1, 1, 900, 449, 900, 449 }, - { 1, 1, 800, 525, 800, 525 }, - { 1, 1,1056, 628,1056, 628 }, - { 1, 1,1344, 806,1344, 806 }, - { 1, 1,1688,1066,1688,1066 }, - { 1, 1,1688, 802,1688, 802 }, /* 1280x768: 802 was 806 in both cases */ - { 1, 1,2160,1250,2160,1250 }, /* 1600x1200 */ - { 1, 1,1800,1000,1800,1000 } /* 1280x960 */ -}; - -/* *** LCDA *** */ - -static const SiS_LVDSDataStruct SiS_LCDA1024x768Data_1[]= -{ - { 960, 438,1344, 806}, - { 960, 388,1344, 806}, - { 1040, 438,1344, 806}, - { 1040, 388,1344, 806}, - { 960, 518,1344, 806}, /* 640x480 */ - { 1120, 638,1344, 806}, /* 800x600 */ - { 1344, 806,1344, 806}, /* 1024x768 */ -#if 0 - { 840, 438,1344, 806}, - { 840, 409,1344, 806}, - { 840, 438,1344, 806}, - { 840, 409,1344, 806}, - { 840, 518,1344, 806}, /* 640x480 */ - {1050, 638,1344, 806}, /* 800x600 */ - {1344, 806,1344, 806}, /* 1024x768 */ -#endif -}; - -static const SiS_LVDSDataStruct SiS_LCDA1024x768Data_2[]= -{ - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, -}; - -static const SiS_LVDSDataStruct SiS_LCDA1280x1024Data_1[]= -{ /* Acer, Compaq */ - {1048, 442,1688,1066}, - {1048, 392,1688,1066}, - {1128, 442,1688,1066}, - {1128, 392,1688,1066}, - {1048, 522,1688,1066}, - {1208, 642,1688,1066}, - {1432, 810,1688,1066}, - {1688,1066,1688,1066} -}; - -static const SiS_LVDSDataStruct SiS_LCDA1280x1024Data_2[]= -{ /* Corrected (illegal in Acer, correct in Compaq) */ - {1688,1066,1688,1066}, - {1688,1066,1688,1066}, - {1688,1066,1688,1066}, - {1688,1066,1688,1066}, - {1688,1066,1688,1066}, - {1688,1066,1688,1066}, - {1688,1066,1688,1066}, - {1688,1066,1688,1066} + { 1, 1, 800, 525, 800, 525 }, /* 0x04: 320x240, 640x480 */ + { 1, 1,1056, 628,1056, 628 }, /* 0x05: 400x300, 800x600 */ + { 1, 1,1344, 806,1344, 806 }, /* 0x06: 512x384, 1024x768 */ + { 1, 1,1688,1066,1688,1066 }, /* 0x07: 1280x1024 */ + { 1, 1,1688, 802,1688, 802 }, /* 0x08: 1280x768: Fujitsu, TMDS only */ + { 1, 1,2160,1250,2160,1250 }, /* 0x09: 1600x1200 */ + { 1, 1,1800,1000,1800,1000 }, /* 0x0a: 1280x960 */ + { 1, 1,1688,1066,1688,1066 }, /* 0x0b: 1400x1050 */ + { 1, 1,1650, 750,1650, 750 }, /* 0x0c: 1280x720 (TMDS) */ + { 1, 1,1408, 816,1408, 816 }, /* 0x0d: 1280x800 */ + { 1, 1,1900,1066,1900,1066 }, /* 0x0e: 1680x1050 (LVDS) */ + { 1, 1,1408, 806,1408, 806 }, /* 0x0f: 1280x768_2 */ + { 1, 1,1664, 798,1664, 798 }, /* 0x10: 1280x768_3 */ + { 1, 1,1688, 802,1688, 802 }, /* 0x11: 1280x768: Std, TMDS only */ + { 1, 1,1344, 806,1344, 806 } /* 0x12: 1280x720 (LVDS) */ }; -static const SiS_LVDSDataStruct SiS_LCDA1400x1050Data_1[]= -{ /* Clevo */ - { 928, 416, 1688,1066}, - { 928, 366, 1688,1066}, - {1008, 416, 1688,1066}, - {1008, 366, 1688,1066}, - {1200, 530, 1688,1066}, - {1088, 616, 1688,1066}, - {1312, 784, 1688,1066}, - {1568,1040, 1688,1066}, - {1688,1066, 1688,1066} -}; - -static const SiS_LVDSDataStruct SiS_LCDA1400x1050Data_2[]= -{ /* Clevo */ - {1688,1066, 1688,1066}, - {1688,1066, 1688,1066}, - {1688,1066, 1688,1066}, - {1688,1066, 1688,1066}, - {1688,1066, 1688,1066}, - {1688,1066, 1688,1066}, - {1688,1066, 1688,1066}, - {1688,1066, 1688,1066}, - {1688,1066, 1688,1066} -}; - -static const SiS_LVDSDataStruct SiS_LCDA1600x1200Data_1[]= -{ /* Clevo (Temporary data) */ - {1200, 450, 2048,1250}, - {1200, 400, 2048,1250}, - {1280, 450, 2048,1250}, - {1280, 400, 2048,1250}, - {1200, 530, 2048,1250}, - {1360, 650, 2048,1250}, - {1584, 818, 2048,1250}, - {1688,1066, 2048,1250}, - {1688,1066, 2048,1250}, - {2048,1250, 2048,1250} /* this should be correct */ -#if 0 - {2160,1250, 2048,1250} /* ? */ -#endif -}; - -static const SiS_LVDSDataStruct SiS_LCDA1600x1200Data_2[]= -{ /* Clevo (Temporary data. Seems invalid.) */ - {2160,1250, 2160,1250}, - {2160,1250, 2160,1250}, - {2160,1250, 2160,1250}, - {2160,1250, 2160,1250}, - {2160,1250, 2160,1250}, - {2160,1250, 2160,1250}, - {2160,1250, 2160,1250}, - {2160,1250, 2160,1250}, - {2160,1250, 2160,1250}, - {2160,1250, 2160,1250} -}; - -/* LVDS SKEW for LCDA */ - -static const SiS_LVDSDesStruct SiS_PanelType1076_1[]= -{ /* 1024x768 */ - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, /* 805; was 0, 0 -> top line cut away (26/09/03) */ -}; - -static const SiS_LVDSDesStruct SiS_PanelType1076_2[]= -{ /* 1024x768; not expanded */ - { 1184, 622 }, - { 1184, 597 }, - { 1184, 622 }, - { 1184, 597 }, - { 1152, 650 }, /* 622 */ - { 1232, 722 }, - { 0, 0 }, /* 805; was 0, 0 -> top line cut away (26/09/03) */ -}; - -static const SiS_LVDSDesStruct SiS_PanelType1210_1[]= -{ /* 1280x1024 */ - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 1065}, /* Acer */ - { 0 , 0} -}; - -static const SiS_LVDSDesStruct SiS_PanelType1210_2[]= -{ /* 1280x1024; not expanded */ - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0} -}; - -static const SiS_LVDSDesStruct SiS_PanelType1296_1[]= -{ /* 1400x1050 */ - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 1065} /* Was 0,0 */ -}; - -static const SiS_LVDSDesStruct SiS_PanelType1296_2[]= -{ /* 1400x1050; not expanded */ - { 1308, 741 }, - { 1308, 716 }, - { 1308, 741 }, - { 1308, 716 }, - { 1308, 781 }, - { 1388, 841 }, - { 1500, 925 }, - { 1628,1053 }, - { 0,1065 } -#if 0 - { 808 , 740}, - { 0 , 715}, - { 632 , 740}, - { 632 , 715}, - { 1307, 780}, - { 1387,1157}, - { 1499, 924}, - { 1627,1052}, - { 0 , 0} -#endif -}; - -static const SiS_LVDSDesStruct SiS_PanelType1600_1[]= -{ /* 1600x1200 */ - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0} -}; - -static const SiS_LVDSDesStruct SiS_PanelType1600_2[]= -{ /* 1600x1200; not expanded */ - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0} -}; - -#ifdef SIS315H - -/* LCDA CRT1 custom data */ - -static const SiS_LCDACRT1DataStruct Compaq1280x1024_LCDACRT1_1[]= -{ - {{0x7e,0x4f,0x4f,0x82,0x58,0x06,0xb8,0x1f, - 0x90,0x84,0x8f,0x8f,0xb9,0x30,0x00,0x06, - 0x00}}, - {{0x7e,0x4f,0x4f,0x82,0x58,0x06,0x86,0x1f, - 0x5e,0x82,0x5d,0x5d,0x87,0x10,0x00,0x06, - 0x00}}, - {{0x7e,0x4f,0x4f,0x82,0x58,0x06,0xb8,0x1f, - 0x90,0x84,0x8f,0x8f,0xb9,0x30,0x00,0x06, - 0x00}}, - {{0x7e,0x4f,0x4f,0x82,0x58,0x06,0x86,0x1f, - 0x5e,0x82,0x5d,0x5d,0x87,0x10,0x00,0x06, - 0x00}}, - {{0x7e,0x4f,0x4f,0x82,0x58,0x06,0x08,0x3e, - 0xe0,0x84,0xdf,0xdf,0x09,0x00,0x00,0x06, - 0x00}}, - {{0x92,0x63,0x63,0x96,0x6c,0x1a,0x80,0xf0, - 0x58,0x8c,0x57,0x57,0x81,0x20,0x00,0x06, - 0x01}}, - {{0xae,0x7f,0x7f,0x92,0x88,0x96,0x28,0xf5, - 0x00,0x84,0xff,0xff,0x29,0x10,0x00,0x02, - 0x01}}, - {{0xce,0x9f,0x9f,0x92,0xa8,0x16,0x28,0x5a, - 0x00,0x84,0xff,0xff,0x29,0x01,0x00,0x07, - 0x01}} -}; - -static const SiS_LCDACRT1DataStruct Compaq1280x1024_LCDACRT1_1_H[]= -{ - {{0x56,0x27,0x27,0x9a,0x30,0x1e,0xb8,0x1f, - 0x90,0x84,0x8f,0x8f,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x3c,0x4f,0x4f,0x82,0x58,0x06,0x86,0xd1, - 0xbc,0x80,0xbb,0xbb,0xe5,0x00,0x00,0x06, - 0x01}}, - {{0x56,0x27,0x27,0x9a,0x30,0x1e,0xb8,0x1f, - 0x90,0x84,0x8f,0x8f,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x3c,0x4f,0x4f,0x82,0x58,0x06,0x86,0xd1, - 0xbc,0x80,0xbb,0xbb,0xe5,0x00,0x00,0x06, - 0x01}}, - {{0x56,0x27,0x27,0x9a,0x30,0x1e,0x08,0x3e, - 0xe0,0x84,0xdf,0xdf,0x09,0x00,0x00,0x05, - 0x00}}, - {{0x60,0x31,0x31,0x84,0x3a,0x88,0x80,0xf0, - 0x58,0x8c,0x57,0x57,0x81,0x20,0x00,0x01, - 0x01}}, - {{0x6e,0x3f,0x3f,0x92,0x48,0x96,0x28,0xf5, - 0x00,0x84,0xff,0xff,0x29,0x10,0x00,0x01, - 0x01}} -}; - -static const SiS_LCDACRT1DataStruct Clevo1024x768_LCDACRT1_1[]= -{ - {{0x73,0x4f,0x4f,0x97,0x55,0x86,0xc4,0x1f, - 0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x05, - 0x00}}, - {{0x73,0x4f,0x4f,0x97,0x55,0x86,0x97,0x1f, - 0x60,0x87,0x5d,0x5d,0x83,0x10,0x00,0x05, - 0x00}}, - {{0x73,0x4f,0x4f,0x97,0x55,0x86,0xc4,0x1f, - 0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x05, - 0x00}}, - {{0x73,0x4f,0x4f,0x97,0x55,0x86,0x97,0x1f, - 0x60,0x87,0x5d,0x5d,0x83,0x10,0x00,0x05, - 0x00}}, - {{0x73,0x4f,0x4f,0x97,0x55,0x86,0x04,0x3e, - 0xE2,0x89,0xDf,0xDf,0x05,0x00,0x00,0x05, - 0x00}}, - {{0x87,0x63,0x63,0x8B,0x69,0x1A,0x7c,0xf0, - 0x5A,0x8F,0x57,0x57,0x7D,0x20,0x00,0x26, - 0x01}}, - {{0xA3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, - 0x02,0x88,0xFf,0xFf,0x25,0x10,0x00,0x02, - 0x01}} -}; - -static const SiS_LCDACRT1DataStruct Clevo1024x768_LCDACRT1_1_H[]= -{ - {{0x4b,0x27,0x27,0x8f,0x2b,0x03,0xc4,0x1f, - 0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x44, - 0x00}}, - {{0x4b,0x27,0x27,0x8f,0x2b,0x03,0x97,0x1f, - 0x60,0x87,0x5D,0x5D,0x83,0x01,0x00,0x44, - 0x00}}, - {{0x4b,0x27,0x27,0x8f,0x2b,0x03,0xc4,0x1f, - 0x92,0x89,0x8f,0x8f,0xb5,0x30,0x00,0x44, - 0x00}}, - {{0x4b,0x27,0x27,0x8f,0x2b,0x03,0x97,0x1f, - 0x60,0x87,0x5D,0x5D,0x83,0x01,0x00,0x44, - 0x00}}, - {{0x4b,0x27,0x27,0x8f,0x32,0x1b,0x04,0x3e, - 0xE2,0x89,0xDf,0xDf,0x05,0x00,0x00,0x45, - 0x00}}, - {{0x55,0x31,0x31,0x99,0x46,0x1d,0x7c,0xf0, - 0x5A,0x8F,0x57,0x57,0x7D,0x20,0x00,0x55, - 0x01}}, - {{0x63,0x3F,0x3F,0x87,0x4A,0x93,0x24,0xF5, - 0x02,0x88,0xFF,0xFF,0x25,0x10,0x00,0x01, - 0x01}} -}; - -static const SiS_LCDACRT1DataStruct Clevo1024x768_LCDACRT1_2[]= -{ - {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x4a,0x80,0x8f,0x8f,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x31,0x87,0x5d,0x5d,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x72,0x88,0xdf,0xdf,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x63,0x63,0x87,0x78,0x89,0x24,0xf1, - 0xae,0x84,0x57,0x57,0x25,0x30,0x00,0x02, - 0x01}}, - {{0xa3,0x7f,0x7f,0x87,0x86,0x97,0x24,0xf5, - 0x02,0x88,0xff,0xff,0x25,0x10,0x00,0x02, - 0x01}} -}; - -static const SiS_LCDACRT1DataStruct Clevo1024x768_LCDACRT1_2_H[]= -{ - {{0x7b,0x27,0x27,0x9f,0x46,0x97,0x24,0xbb, - 0x57,0x8e,0x8f,0x8f,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x7b,0x27,0x27,0x9f,0x46,0x97,0x24,0xbb, - 0x3e,0x85,0x5d,0x5d,0x25,0x10,0x00,0x01, - 0x00 }}, - {{0x7b,0x27,0x27,0x9f,0x46,0x97,0x24,0xbb, - 0x57,0x8e,0x8f,0x8f,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x7b,0x27,0x27,0x9f,0x46,0x97,0x24,0xbb, - 0x3e,0x85,0x5d,0x5d,0x25,0x10,0x00,0x01, - 0x00 }}, - {{0x7b,0x27,0x27,0x9f,0x46,0x97,0x24,0xbb, - 0x7f,0x86,0xdf,0xdf,0x25,0x10,0x00,0x01, - 0x00 }}, - {{0x71,0x31,0x31,0x95,0x46,0x97,0x24,0xf1, - 0xbb,0x82,0x57,0x57,0x25,0x10,0x00,0x01, - 0x01 }}, - {{0x63,0x3f,0x3f,0x87,0x46,0x97,0x24,0xf5, - 0x0f,0x86,0xff,0xff,0x25,0x30,0x00,0x01, - 0x01 }} -}; - -#endif /* 315 */ /**************************************************************/ /* LVDS ----------------------------------------------------- */ @@ -1451,9 +1163,7 @@ static const SiS_LVDSDataStruct SiS_LVDS800x600Data_1[]= { 848, 389,1060, 629}, { 848, 518,1060, 629}, {1056, 628,1056, 628}, - {1056, 628,1056, 628}, - { 800, 449,1000, 644}, - { 800, 525,1000, 635} + {1056, 628,1056, 628} }; static const SiS_LVDSDataStruct SiS_LVDS800x600Data_2[]= @@ -1464,9 +1174,7 @@ static const SiS_LVDSDataStruct SiS_LVDS800x600Data_2[]= {1056, 628,1056, 628}, {1056, 628,1056, 628}, {1056, 628,1056, 628}, - {1056, 628,1056, 628}, - { 800, 449,1000, 644}, - { 800, 525,1000, 635} + {1056, 628,1056, 628} }; static const SiS_LVDSDataStruct SiS_LVDS1024x768Data_1[]= @@ -1478,8 +1186,6 @@ static const SiS_LVDSDataStruct SiS_LVDS1024x768Data_1[]= { 840, 518,1344, 806}, /* 640x480 */ {1050, 638,1344, 806}, /* 800x600 */ {1344, 806,1344, 806}, /* 1024x768 */ - { 800, 449,1280, 801}, - { 800, 525,1280, 813} }; static const SiS_LVDSDataStruct SiS_LVDS1024x768Data_2[]= @@ -1491,11 +1197,8 @@ static const SiS_LVDSDataStruct SiS_LVDS1024x768Data_2[]= {1344, 806,1344, 806}, {1344, 806,1344, 806}, {1344, 806,1344, 806}, - { 800, 449,1280, 801}, - { 800, 525,1280, 813} }; - static const SiS_LVDSDataStruct SiS_LVDS1280x1024Data_1[]= { {1048, 442,1688,1066}, @@ -1646,9 +1349,7 @@ static const SiS_LVDSDataStruct SiS_LVDS1024x600Data_1[] = { 840, 560,1344, 800}, { 840, 689,1344, 800}, {1050, 800,1344, 800}, - {1344, 800,1344, 800}, - { 800, 449,1280, 789}, - { 800, 525,1280, 785} + {1344, 800,1344, 800} }; static const SiS_LVDSDataStruct SiS_LVDS1024x600Data_2[] = @@ -1659,9 +1360,7 @@ static const SiS_LVDSDataStruct SiS_LVDS1024x600Data_2[] = {1344, 800,1344, 800}, {1344, 800,1344, 800}, {1344, 800,1344, 800}, - {1344, 800,1344, 800}, - { 800, 449,1280, 801}, - { 800, 525,1280, 813} + {1344, 800,1344, 800} }; static const SiS_LVDSDataStruct SiS_LVDS1152x768Data_1[] = @@ -1672,9 +1371,7 @@ static const SiS_LVDSDataStruct SiS_LVDS1152x768Data_1[] = { 840, 409,1344, 806}, { 840, 518,1344, 806}, {1050, 638,1344, 806}, - {1344, 806,1344, 806}, - { 800, 449,1280, 801}, - { 800, 525,1280, 813} + {1344, 806,1344, 806} }; static const SiS_LVDSDataStruct SiS_LVDS1152x768Data_2[] = @@ -1685,9 +1382,7 @@ static const SiS_LVDSDataStruct SiS_LVDS1152x768Data_2[] = {1344, 806,1344, 806}, {1344, 806,1344, 806}, {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - { 800, 449,1280, 801}, - { 800, 525,1280, 813} + {1344, 806,1344, 806} }; /* Pass 1:1 data */ @@ -1700,7 +1395,7 @@ static const SiS_LVDSDataStruct SiS_LVDSXXXxXXXData_1[]= { 800, 525, 800, 525}, /* 640x480 */ {1056, 628, 1056, 628}, /* 800x600 */ {1344, 806, 1344, 806}, /* 1024x768 */ - {1344,1066, 1344,1066}, /* 1280x1024 */ /* INSERTED ! */ + {1688,1066, 1688,1066}, /* 1280x1024 */ /* INSERTED ! */ {1688, 806, 1688, 806}, /* 1280x768 */ /* No other panels ! */ }; @@ -1815,36 +1510,6 @@ static const SiS_LVDSDataStruct SiS_CHTVONTSCData[]= {1160, 840,1160, 840} }; -/* LVDS Skew */ - -static const SiS_LVDSDesStruct SiS_PanelTypeNS_1[]= -{ - { 8, 0}, - { 8, 0}, - { 8, 0}, - { 8, 0}, - { 8, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 806}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS_PanelTypeNS_2[] = -{ - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0} -}; - /* Chrontel TV Skew */ static const SiS_LVDSDesStruct SiS_CHTVUNTSCDesData[]= @@ -2383,63 +2048,6 @@ static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT11280x768_2_H[] = 0x01}} }; -static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT1XXXxXXX_1[] = -{ - {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e, - 0xe9,0x8b,0xe7,0x04,0x00,0x00,0x05, - 0x00}}, - {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0, - 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, - 0x01}}, - {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x02, - 0x01}}, - {{0xce,0x9f,0x92,0xa8,0x14,0x28,0x5a, - 0x00,0x84,0xff,0x29,0x09,0x00,0x07, - 0x01}}, - {{0xce,0x9f,0x92,0xa9,0x17,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x07, - 0x01}} -}; - -static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT1XXXxXXX_1_H[] = -{ - {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, - 0x00}}, - {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, - 0x00}}, - {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, - 0x00}}, - {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, - 0x00}}, - {{0x38,0x27,0x9c,0x2c,0x80,0x0b,0x3e, - 0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00, - 0x00}}, - {{0x4d,0x31,0x91,0x3b,0x03,0x72,0xf0, - 0x58,0x8c,0x57,0x73,0x20,0x00,0x01, - 0x01}}, - {{0x63,0x3f,0x87,0x4a,0x92,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x01, - 0x01}} -}; - - /**************************************************************/ /* COMMON --------------------------------------------------- */ /**************************************************************/ @@ -2700,7 +2308,8 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = { { 0x0000 } }; -USHORT SiS_GetModeID(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth, BOOLEAN FSTN); +USHORT SiS_GetModeID(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, + int Depth, BOOLEAN FSTN, int LCDwith, int LCDheight); USHORT SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth, BOOLEAN FSTN, USHORT CustomT, int LCDwith, int LCDheight); USHORT SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth); @@ -2721,6 +2330,7 @@ void SiS_DisplayOn(SiS_Private *SiS_Pr); void SiS_DisplayOff(SiS_Private *SiS_Pr); void SiSRegInit(SiS_Private *SiS_Pr, SISIOADDRESS BaseAddr); void SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo); +BOOLEAN SiSDetermineROMLayout661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo); void SiS_SetEnableDstn(SiS_Private *SiS_Pr, int enable); void SiS_SetEnableFstn(SiS_Private *SiS_Pr, int enable); void SiS_GetVBType(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo); @@ -2731,6 +2341,7 @@ USHORT SiS_GetColorDepth(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex) USHORT SiS_GetOffset(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, USHORT RefreshRateTableIndex,PSIS_HW_INFO HwInfo); void SiS_LoadDAC(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo, USHORT ModeIdIndex); +void SiS_CalcLCDACRT1Timing(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex); #ifdef LINUX_XF86 BOOLEAN SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,ScrnInfoPtr pScrn,USHORT ModeNo, BOOLEAN dosetpitch); BOOLEAN SiSBIOSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, @@ -2763,7 +2374,7 @@ extern void SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeId PSIS_HW_INFO HwInfo, int chkcrt2mode); extern void SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, PSIS_HW_INFO HwInfo); -extern void SiS_SetHiVision(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo); +extern void SiS_SetYPbPr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo); extern void SiS_SetTVMode(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, PSIS_HW_INFO HwInfo); extern void SiS_UnLockCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo); extern void SiS_LockCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo); diff --git a/src/init301.c b/src/init301.c index 3b88a8d..ab20ab6 100644 --- a/src/init301.c +++ b/src/init301.c @@ -1,35 +1,57 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c,v 1.52 2003/11/20 19:53:22 twini Exp $ */ +/* $XFree86$ */ /* * Mode initializing code (CRT2 section) * for SiS 300/305/540/630/730 and - * SiS 315/550/650/M650/651/661FX/M661xX/740/741/330/660/M660/760/M760 + * SiS 315/550/650/M650/651/661FX/M661xX/740/741/M741/330/660/M660/760/M760 * (Universal module for Linux kernel framebuffer and XFree86 4.x) * - * Copyright 2002, 2003 by Thomas Winischhofer <thomas@winischhofer.net> - * Formerly based on non-functional code-fragements for 300 series by SiS, Inc. + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * + * If distributed as part of the Linux kernel, the following license terms + * apply: * - * If distributed as part of the linux kernel, the contents of this file - * is entirely covered by the GPL. + * * This program is free software; you can redistribute it and/or modify + * * it under the terms of the GNU General Public License as published by + * * the Free Software Foundation; either version 2 of the named License, + * * or any later version. + * * + * * This program is distributed in the hope that it will be useful, + * * but WITHOUT ANY WARRANTY; without even the implied warranty of + * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * * GNU General Public License for more details. + * * + * * You should have received a copy of the GNU General Public License + * * along with this program; if not, write to the Free Software + * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * - * Otherwise, the following terms apply: + * Otherwise, the following license terms apply: * - * 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. + * * + * * 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. * - * 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. + * Author: Thomas Winischhofer <thomas@winischhofer.net> + * + * 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. @@ -40,20 +62,16 @@ * All comments in this file are by me, regardless if marked TW or not. * */ - -#if 0 -#define SET_EMI -#endif #if 1 -#define SET_EMI_CPQ +#define SET_EMI /* 302LV/ELV: Set EMI values */ #endif -#include "init301.h" +#define COMPAL_HACK /* Needed for Compal 1400x1050 (EMI) */ +#define COMPAQ_HACK /* Needed for Inventec/Compaq 1280x1024 (EMI) */ +#define ASUS_HACK /* Needed for Asus A2H 1024x768 (EMI) */ -#if 0 -#define TWNEWPANEL -#endif +#include "init301.h" #ifdef SIS300 #include "oem300.h" @@ -66,6 +84,8 @@ #define SiS_I2CDELAY 1000 #define SiS_I2CDELAYSHORT 150 +static USHORT SiS_GetBIOSLCDResInfo(SiS_Private *SiS_Pr); + /*********************************************/ /* HELPER: Lock/Unlock CRT2 */ /*********************************************/ @@ -73,146 +93,75 @@ void SiS_UnLockCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { - if(HwInfo->jChipType >= SIS_315H) - SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2f,0x01); - else - SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x24,0x01); + if(HwInfo->jChipType >= SIS_315H) + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2f,0x01); + else + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x24,0x01); } void SiS_LockCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { - if(HwInfo->jChipType >= SIS_315H) - SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2F,0xFE); - else - SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x24,0xFE); + if(HwInfo->jChipType >= SIS_315H) + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2F,0xFE); + else + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x24,0xFE); } /*********************************************/ -/* HELPER: Enable CRT2 */ +/* HELPER: Write SR11 */ /*********************************************/ -void -SiS_EnableCRT2(SiS_Private *SiS_Pr) +static void +SiS_SetRegSR11ANDOR(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT DataAND, USHORT DataOR) { - SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); + if(HwInfo->jChipType >= SIS_661) DataAND &= 0x0f; + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,DataAND,DataOR); } /*********************************************/ /* HELPER: Get Pointer to LCD structure */ /*********************************************/ -/* For 661 series only */ #ifdef SIS315H -#if 0 /* Need to wait until hardware using this really exists */ static UCHAR * -GetLCDPtr661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, int tabletype, - USHORT ModeNo, USHORT ModeIdIndex, USHORT RRTI) +GetLCDStructPtr661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { - UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; - UCHAR *tableptr = NULL; - UCHAR tablelengths[] = { 8, 7, 6, 6, 8, 6, 0, 0, 0 }; - USHORT modeflag, CRT2Index, tablelength, lcdid, myid, tableptri; - - if(ModeNo <= 0x13) { - modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - CRT2Index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; - } else { - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - CRT2Index = SiS_Pr->SiS_RefIndex[RRTI].Ext_CRT2CRTC; - /* This is total bullshit: */ - if(SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO == SIS_RI_720x576) CRT2Index = 10; - } - - if(tabletype <= 1) { -#if 0 /* Not yet implemented */ - if(ModeNo <= 0x13) { - CRT2Index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex]. + 5; - } else { - CRT2Index = SiS_Pr->SiS_RefIndex[RRTI]. + 5; - } - if(tabletype & 1) CRT2Index >>= 4; -#endif - } - - CRT2Index &= 0x0f; - - tablelength = tablelengths[tabletype]; - if(SiS_Pr->SiS_LCDInfo & LCDPass11) { - if((tabletype == 5) || (tabletype == 7)) tablelength = 8; - if((tabletype == 3) || (tabletype == 8)) tablelength = 8; - } - - if(!tablelength) return NULL; - - tableptri = ROMAddr[0x222] | (ROMAddr[0x223] << 8); - tableptri += (tabletype << 1); - if(!tableptri) return NULL; - tableptr = &ROMAddr[tableptri]; - - do { - lcdid = tableptr[0]; - if(lcdid == 0xff) break; - myid = SiS_Pr->SiS_LCDResInfo; - if((lcdid & 0x80) && (lcdid != 0x80)) { - lcdid &= 0x7f; - myid = SiS_Pr->SiS_LCDTypeInfo; - } - if(SiS_Pr->SiS_LCDInfo & LCDPass11) myid &= ~0x1f; - - if(myid == lcdid) { - lcdid = tableptr[1] | (tableptr[2] << 8); - myid = SiS_Pr->SiS_LCDInfo661; - if(modeflag & HalfDCLK) myid |= 0x200; - if(ModeNo <= 0x13) myid |= 0x400; - lcdid &= myid; - myid = tableptr[3] | (tableptr[4] << 8); - if(lcdid == myid) break; - } - tableptr += 7; - } while (1); + UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; + UCHAR *myptr = NULL; + USHORT romindex = 0; - if(lcdid == myid) { - lcdid = tableptr[5] | (tableptr[6] << 8); - lcdid += (tablelength * CRT2Index); - return((UCHAR *)&ROMAddr[lcdid]); - } + /* Use the BIOS tables only for LVDS panels; DVI is unreliable + * due to the variaty of panels the BIOS doesn't know about. + */ - return NULL; + if((SiS_Pr->SiS_ROMNew) && (SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) { + myptr = (UCHAR *)SiS_LCDStruct661; + romindex = SISGETROMW(0x100); /* 10c, 0.93: 10e */ + if(romindex) { + romindex += ((SiS_GetReg(SiS_Pr->SiS_P3d4,0x7d) & 0x1f) * 26); + myptr = &ROMAddr[romindex]; + } + } + return myptr; } -#endif -static UCHAR * -GetLCDStructPtr661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +static USHORT +GetLCDStructPtr661_2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; - USHORT lcdres = SiS_Pr->SiS_LCDResInfo; - USHORT lcdtype = SiS_Pr->SiS_LCDTypeInfo; - USHORT romindex=0; - UCHAR *myptr = NULL; - UCHAR lcdid; + USHORT romptr = 0; - if((ROMAddr) && SiS_Pr->SiS_UseROM) { - romindex = ROMAddr[0x256] | (ROMAddr[0x257] << 8); - } - if(romindex) { - myptr = &ROMAddr[romindex]; - } else { - myptr = (UCHAR *)SiS_LCDStruct661; - } + /* Use the BIOS tables only for LVDS panels; DVI is unreliable + * due to the variaty of panels the BIOS doesn't know about. + */ - while(myptr[0] != 0xff) { - lcdid = myptr[0]; - if((lcdid & 0x80) && (lcdid != 0x80)) { - lcdres = lcdtype; - lcdid &= 0x7f; - } - if(lcdid == lcdres) break; - myptr += 26; + if((SiS_Pr->SiS_ROMNew) && (SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) { + romptr = SISGETROMW(0x102); /* 2ad */ + romptr += ((SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) >> 4) * SiS_Pr->SiS661LCD2TableSize); } - if(myptr[0] == 0xff) return NULL; - return myptr; + return(romptr); } #endif @@ -225,76 +174,72 @@ SiS_AdjustCRT2Rate(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, USHORT *i, PSIS_HW_INFO HwInfo) { - USHORT tempax,tempbx,resinfo; - USHORT modeflag,infoflag; + USHORT checkmask=0,modeid,infoflag; - if(ModeNo <= 0x13) { - modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - resinfo = 0; - } else { - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; - } - - tempbx = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].ModeID; - - tempax = 0; + modeid = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].ModeID; if(SiS_Pr->SiS_VBType & VB_SISVB) { if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) { - tempax |= SupportRAMDAC2; + checkmask |= SupportRAMDAC2; if(HwInfo->jChipType >= SIS_315H) { - tempax |= SupportRAMDAC2_135; - /* if((HwInfo->jChipType >= SIS_661) && (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) { */ + checkmask |= SupportRAMDAC2_135; if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - tempax |= SupportRAMDAC2_162; + checkmask |= SupportRAMDAC2_162; if(SiS_Pr->SiS_VBType & VB_SIS301C) { - tempax |= SupportRAMDAC2_202; + checkmask |= SupportRAMDAC2_202; } } } } else if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { - tempax |= SupportLCD; + checkmask |= SupportLCD; + if(HwInfo->jChipType >= SIS_315H) { + if(SiS_Pr->SiS_VBType & VB_SISVB) { + if((SiS_Pr->SiS_LCDInfo & DontExpandLCD) && (SiS_Pr->SiS_LCDInfo & LCDPass11)) { + if(modeid == 0x2e) checkmask |= Support64048060Hz; + } + } + } - } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { + } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) { - if(SiS_Pr->SiS_HiVision == 3) { - tempax |= SupportHiVisionTV2; - } else { - tempax |= SupportHiVisionTV; - } + checkmask |= SupportHiVision; - } else if(SiS_Pr->SiS_VBInfo & (SetCRT2ToAVIDEO | SetCRT2ToSVIDEO | SetCRT2ToSCART)) { + } else if(SiS_Pr->SiS_VBInfo & (SetCRT2ToYPbPr525750|SetCRT2ToAVIDEO|SetCRT2ToSVIDEO|SetCRT2ToSCART)) { - tempax |= SupportTV; + checkmask |= SupportTV; if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - tempax |= SupportTV1024; + checkmask |= SupportTV1024; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) { + if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) { + checkmask |= SupportYPbPr750p; + } + } } } - } else { /* for LVDS */ + } else { /* LVDS */ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { - tempax |= SupportCHTV; + checkmask |= SupportCHTV; } } if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - tempax |= SupportLCD; + checkmask |= SupportLCD; } } /* Look backwards in table for matching CRT2 mode */ - for(; SiS_Pr->SiS_RefIndex[RefreshRateTableIndex+(*i)].ModeID == tempbx; (*i)--) { + for(; SiS_Pr->SiS_RefIndex[RefreshRateTableIndex+(*i)].ModeID == modeid; (*i)--) { infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].Ext_InfoFlag; - if(infoflag & tempax) return(1); + if(infoflag & checkmask) return TRUE; if((*i) == 0) break; } @@ -302,17 +247,17 @@ SiS_AdjustCRT2Rate(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, * for a matching CRT2 mode if no mode was found yet. */ for((*i) = 0; ; (*i)++) { - if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].ModeID != tempbx) { - return(0); + if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].ModeID != modeid) { + return FALSE; } infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].Ext_InfoFlag; - if(infoflag & tempax) return(1); + if(infoflag & checkmask) return TRUE; } - return(1); + return TRUE; } /*********************************************/ -/* Get rate pointer */ +/* Get rate index */ /*********************************************/ USHORT @@ -337,17 +282,11 @@ SiS_GetRatePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { - if(modeflag & HalfDCLK) return(0); + if(modeflag & HalfDCLK) return 0; } } - if(ModeNo < 0x14) return(0xFFFF); - - /* CR33 holds refresh rate index for CRT1 [3:0] and CRT2 [7:4]. - * On LVDS machines, CRT2 index is always 0 and will be - * set to 0 by the following code; this causes the function - * to take the first non-interlaced mode in SiS_Ext2Struct - */ + if(ModeNo < 0x14) return 0xFFFF; index = (SiS_GetReg(SiS_Pr->SiS_P3d4,0x33) >> SiS_Pr->SiS_SelectCRT2Rate) & 0x0F; backupindex = index; @@ -362,7 +301,7 @@ SiS_GetRatePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { if(!(SiS_Pr->SiS_VBType & VB_NoLCD)) { - temp = LCDRefreshIndex[SiS_Pr->SiS_LCDResInfo]; + temp = LCDRefreshIndex[SiS_GetBIOSLCDResInfo(SiS_Pr)]; if(index > temp) index = temp; } } @@ -412,8 +351,6 @@ SiS_GetRatePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } } - - return(RefreshRateTableIndex + i); } @@ -437,37 +374,39 @@ SiS_SaveCRT2Info(SiS_Private *SiS_Pr, USHORT ModeNo) /* HELPER: GET SOME DATA FROM BIOS ROM */ /*********************************************/ +#ifdef SIS300 static BOOLEAN SiS_CR36BIOSWord23b(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { + UCHAR *ROMAddr = (UCHAR *)HwInfo->pjVirtualRomBase; USHORT temp,temp1; - UCHAR *ROMAddr; - if((ROMAddr = (UCHAR *)HwInfo->pjVirtualRomBase) && SiS_Pr->SiS_UseROM) { + if(SiS_Pr->SiS_UseROM) { if((ROMAddr[0x233] == 0x12) && (ROMAddr[0x234] == 0x34)) { temp = 1 << ((SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) & 0xff) >> 4); - temp1 = (ROMAddr[0x23c] << 8) | ROMAddr[0x23b]; - if(temp1 & temp) return(1); + temp1 = SISGETROMW(0x23b); + if(temp1 & temp) return TRUE; } } - return(0); + return FALSE; } static BOOLEAN SiS_CR36BIOSWord23d(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { + UCHAR *ROMAddr = (UCHAR *)HwInfo->pjVirtualRomBase; USHORT temp,temp1; - UCHAR *ROMAddr; - if((ROMAddr = (UCHAR *)HwInfo->pjVirtualRomBase) && SiS_Pr->SiS_UseROM) { + if(SiS_Pr->SiS_UseROM) { if((ROMAddr[0x233] == 0x12) && (ROMAddr[0x234] == 0x34)) { temp = 1 << ((SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) & 0xff) >> 4); - temp1 = (ROMAddr[0x23e] << 8) | ROMAddr[0x23d]; - if(temp1 & temp) return(1); + temp1 = SISGETROMW(0x23d); + if(temp1 & temp) return TRUE; } } - return(0); + return FALSE; } +#endif /*********************************************/ /* HELPER: DELAY FUNCTIONS */ @@ -476,10 +415,10 @@ SiS_CR36BIOSWord23d(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) void SiS_DDC2Delay(SiS_Private *SiS_Pr, USHORT delaytime) { - USHORT i; + USHORT i, j; for(i=0; i<delaytime; i++) { - SiS_GetReg(SiS_Pr->SiS_P3c4,0x05); + j += SiS_GetReg(SiS_Pr->SiS_P3c4,0x05); } } @@ -541,7 +480,7 @@ SiS_PanelDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT DelayTime) } else { Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[1]; } - if((ROMAddr) && (SiS_Pr->SiS_UseROM)) { + if(SiS_Pr->SiS_UseROM) { if(ROMAddr[0x220] & 0x40) { if(!(DelayTime & 0x01)) { Delay = (USHORT)ROMAddr[0x225]; @@ -559,7 +498,15 @@ SiS_PanelDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT DelayTime) #ifdef SIS315H - if(HwInfo->jChipType >= SIS_330) return; + if(HwInfo->jChipType >= SIS_661) { + + if(!(DelayTime & 0x01)) { + SiS_DDC2Delay(SiS_Pr, 0x1000); + } else { + SiS_DDC2Delay(SiS_Pr, 0x4000); + } + + } else if(HwInfo->jChipType >= SIS_330) return; if((SiS_Pr->SiS_IF_DEF_LVDS == 1) || (SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) || @@ -584,7 +531,7 @@ SiS_PanelDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT DelayTime) } else { Delay = SiS_Pr->SiS_PanelDelayTblLVDS[DelayIndex].timer[1]; } - if((ROMAddr) && (SiS_Pr->SiS_UseROM)) { + if((SiS_Pr->SiS_UseROM) && (!(SiS_Pr->SiS_ROMNew))) { if(ROMAddr[0x13c] & 0x40) { if(!(DelayTime & 0x01)) { Delay = (USHORT)ROMAddr[0x17e]; @@ -597,16 +544,16 @@ SiS_PanelDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT DelayTime) SiS_ShortDelay(SiS_Pr,Delay); } - } else if(SiS_Pr->SiS_VBType & VB_SISVB) { /* 315 series, 301(B) */ + } else if(SiS_Pr->SiS_VBType & VB_SISVB) { /* 315 series, all bridges */ - PanelID = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36); - DelayIndex = PanelID >> 4; + DelayIndex = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) >> 4; if(!(DelayTime & 0x01)) { Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[0]; } else { Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[1]; } - SiS_DDC2Delay(SiS_Pr, Delay * 4); + Delay <<= 8; + SiS_DDC2Delay(SiS_Pr, Delay); } @@ -720,11 +667,8 @@ SiS_VBLongWait(SiS_Private *SiS_Pr) static BOOLEAN SiS_Is301B(SiS_Private *SiS_Pr) { - USHORT flag; - - flag = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x01); - if(flag >= 0xb0) return TRUE; - else return FALSE; + if(SiS_GetReg(SiS_Pr->SiS_Part4Port,0x01) >= 0xb0) return TRUE; + return FALSE; } static BOOLEAN @@ -787,6 +731,27 @@ SiS_IsDualLink(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) #ifdef SIS315H static BOOLEAN +SiS_TVEnabled(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +{ + if((SiS_GetReg(SiS_Pr->SiS_Part2Port,0x00) & 0x0f) != 0x0c) return TRUE; + if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS301LV302LV)) { + if(SiS_GetReg(SiS_Pr->SiS_Part2Port,0x4d) & 0x10) return TRUE; + } + return FALSE; +} +#endif + +#ifdef SIS315H +static BOOLEAN +SiS_LCDAEnabled(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +{ + if(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x13) & 0x04) return TRUE; + return FALSE; +} +#endif + +#ifdef SIS315H +static BOOLEAN SiS_WeHaveBacklightCtrl(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { USHORT flag; @@ -811,7 +776,6 @@ SiS_IsNotM650orLater(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) /* Check for revision != A0 only */ if((flag == 0xe0) || (flag == 0xc0) || (flag == 0xb0) || (flag == 0x90)) return FALSE; - else return TRUE; } else if(HwInfo->jChipType >= SIS_661) return FALSE; return TRUE; } @@ -825,7 +789,7 @@ SiS_IsYPbPr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if(HwInfo->jChipType >= SIS_315H) { flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); - if(flag & EnableLVDSHiVision) return TRUE; /* = YPrPb = 0x08 */ + if(flag & EnableCHYPbPr) return TRUE; /* = YPrPb = 0x08 */ } return FALSE; } @@ -839,7 +803,7 @@ SiS_IsChScart(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if(HwInfo->jChipType >= SIS_315H) { flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); - if(flag & EnableLVDSScart) return TRUE; /* = Scart = 0x04 */ + if(flag & EnableCHScart) return TRUE; /* = Scart = 0x04 */ } return FALSE; } @@ -855,11 +819,11 @@ SiS_IsTVOrYPbPrOrScart(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30); if(flag & SetCRT2ToTV) return TRUE; flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); - if(flag & EnableLVDSHiVision) return TRUE; /* = YPrPb = 0x08 */ - if(flag & EnableLVDSScart) return TRUE; /* = Scart = 0x04 - TW */ + if(flag & EnableCHYPbPr) return TRUE; /* = YPrPb = 0x08 */ + if(flag & EnableCHScart) return TRUE; /* = Scart = 0x04 - TW */ } else { flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30); - if(flag & SetCRT2ToTV) return TRUE; + if(flag & SetCRT2ToTV) return TRUE; } return FALSE; } @@ -878,7 +842,7 @@ SiS_IsLCDOrLCDA(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if(flag & SetToLCDA) return TRUE; } else { flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30); - if(flag & SetCRT2ToLCD) return TRUE; + if(flag & SetCRT2ToLCD) return TRUE; } return FALSE; } @@ -894,7 +858,6 @@ SiS_BridgeIsOn(SiS_Private *SiS_Pr) } else if(SiS_Pr->SiS_VBType & VB_SISVB) { flag = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x00); if((flag == 1) || (flag == 2)) return FALSE; - else return TRUE; } return TRUE; } @@ -941,7 +904,7 @@ SiS_SetChrontelGPIO(SiS_Private *SiS_Pr, USHORT myvbinfo) if(!(SiS_Pr->SiS_ChSW)) return; #ifndef LINUX_XF86 - SiS_SetRegLong(0xcf8,0x80000874); /* get ACPI base */ + SiS_SetRegLong(0xcf8,0x80000874); /* get ACPI base */ acpibase = SiS_GetRegLong(0xcfc); #else acpibase = pciReadLong(0x00000800, 0x74); @@ -953,30 +916,25 @@ SiS_SetChrontelGPIO(SiS_Private *SiS_Pr, USHORT myvbinfo) temp = SiS_GetRegShort((USHORT)(acpibase + 0x3c)); temp = SiS_GetRegShort((USHORT)(acpibase + 0x3a)); /* ACPI register 0x3a: GP Pin Level (low/high) */ temp &= 0xFEFF; - if(!(myvbinfo & SetCRT2ToTV)) { - temp |= 0x0100; - } + if(!(myvbinfo & SetCRT2ToTV)) temp |= 0x0100; SiS_SetRegShort((USHORT)(acpibase + 0x3a), temp); temp = SiS_GetRegShort((USHORT)(acpibase + 0x3a)); } void -SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, - USHORT ModeIdIndex,PSIS_HW_INFO HwInfo, - int checkcrt2mode) +SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, + PSIS_HW_INFO HwInfo, int checkcrt2mode) { USHORT tempax,tempbx,temp; USHORT modeflag, resinfo=0; if(ModeNo <= 0x13) { modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } else if(SiS_Pr->UseCustomMode) { + modeflag = SiS_Pr->CModeFlag; } else { - if(SiS_Pr->UseCustomMode) { - modeflag = SiS_Pr->CModeFlag; - } else { - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; - } + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; } SiS_Pr->SiS_SetFlag = 0; @@ -987,27 +945,26 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, if(SiS_BridgeIsOn(SiS_Pr) == 0) { temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30); #if 0 - /* SiS_HiVision is only used on 315/330+30xLV */ - if(SiS_Pr->SiS_VBType & (VB_SIS301LV302LV)) { - if(SiS_Pr->SiS_HiVision & 0x03) { /* New from 650/30xLV 1.10.6s */ - temp &= (SetCRT2ToHiVisionTV | SwitchCRT2 | SetSimuScanMode); /* 0x83 */ - temp |= SetCRT2ToHiVisionTV; /* 0x80 */ - } - if(SiS_Pr->SiS_HiVision & 0x04) { /* New from 650/30xLV 1.10.6s */ - temp &= (SetCRT2ToHiVisionTV | SwitchCRT2 | SetSimuScanMode); /* 0x83 */ + if(HwInfo->jChipType < SIS_661) { + /* NO - YPbPr not set yet ! */ + if(SiS_Pr->SiS_YPbPr & <all ypbpr except 525i>) { + temp &= (SetCRT2ToHiVision | SwitchCRT2 | SetSimuScanMode); /* 0x83 */ + temp |= SetCRT2ToHiVision; /* 0x80 */ + } + if(SiS_Pr->SiS_YPbPr & <ypbpr525i>) { + temp &= (SetCRT2ToHiVision | SwitchCRT2 | SetSimuScanMode); /* 0x83 */ temp |= SetCRT2ToSVIDEO; /* 0x08 */ } } #endif tempbx |= temp; tempax = SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) << 8; - tempax &= (LoadDACFlag | DriverMode | SetDispDevSwitch | SetNotSimuMode | SetPALTV); + tempax &= (DriverMode | LoadDACFlag | SetNotSimuMode | SetPALTV); tempbx |= tempax; - tempbx &= ~(SetCHTVOverScan | SetInSlaveMode | DisableCRT2Display);; #ifdef SIS315H if(HwInfo->jChipType >= SIS_315H) { - if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302B | VB_SIS301LV | VB_SIS302LV | VB_SIS302ELV)) { + if(SiS_Pr->SiS_VBType & (VB_SIS301C|VB_SIS302B|VB_SIS301LV|VB_SIS302LV|VB_SIS302ELV)) { if(ModeNo == 0x03) { /* Mode 0x03 is never in driver mode */ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x31,0xbf); @@ -1029,7 +986,28 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, if((temp & (EnableDualEdge | SetToLCDA)) == (EnableDualEdge | SetToLCDA)) { tempbx |= SetCRT2ToLCDA; } - } + } + + if(SiS_Pr->SiS_VBType & (VB_SIS301LV|VB_SIS302LV|VB_SIS302ELV)) { + tempbx &= ~(SetCRT2ToRAMDAC); + } + + if(HwInfo->jChipType >= SIS_661) { + tempbx &= ~(SetCRT2ToYPbPr525750 | SetCRT2ToHiVision); + temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); + if(SiS_Pr->SiS_VBType & (VB_SIS301C|VB_SIS301LV|VB_SIS302LV|VB_SIS302ELV)) { + if(temp & 0x04) { + temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35) & 0xe0; + if(temp == 0x60) tempbx |= SetCRT2ToHiVision; + else tempbx |= SetCRT2ToYPbPr525750; + } + } else if(SiS_Pr->SiS_VBType & (VB_SIS301 | VB_SIS301B | VB_SIS302B)) { + if(temp & 0x04) { + temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35) & 0xe0; + if(temp == 0x60) tempbx |= SetCRT2ToHiVision; + } + } + } if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); @@ -1037,8 +1015,8 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, tempbx |= SetCRT2ToLCDA; } if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { - if(temp & EnableLVDSHiVision) { - tempbx |= SetCRT2ToHiVisionTV; + if(temp & EnableCHYPbPr) { + tempbx |= SetCRT2ToCHYPbPr; } } } @@ -1047,13 +1025,14 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, #endif /* SIS315H */ if(SiS_Pr->SiS_VBType & VB_SISVB) { - temp = SetCRT2ToSVIDEO | - SetCRT2ToAVIDEO | - SetCRT2ToSCART | - SetCRT2ToLCDA | - SetCRT2ToLCD | - SetCRT2ToRAMDAC | - SetCRT2ToHiVisionTV; + temp = SetCRT2ToSVIDEO | + SetCRT2ToAVIDEO | + SetCRT2ToSCART | + SetCRT2ToLCDA | + SetCRT2ToLCD | + SetCRT2ToRAMDAC | + SetCRT2ToHiVision | + SetCRT2ToYPbPr525750; } else { if(HwInfo->jChipType >= SIS_315H) { if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { @@ -1062,7 +1041,7 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, SetCRT2ToSCART | SetCRT2ToLCDA | SetCRT2ToLCD | - SetCRT2ToHiVisionTV; + SetCRT2ToCHYPbPr; } else { temp = SetCRT2ToLCDA | SetCRT2ToLCD; @@ -1082,21 +1061,20 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, } if(SiS_Pr->SiS_VBType & VB_SISVB) { - if(tempbx & SetCRT2ToLCDA) { - tempbx &= (0xFF00|SwitchCRT2|SetSimuScanMode); - } - if(tempbx & SetCRT2ToRAMDAC) { - tempbx &= (0xFF00|SetCRT2ToRAMDAC|SwitchCRT2|SetSimuScanMode); - } - if(tempbx & SetCRT2ToLCD) { - tempbx &= (0xFF00|SetCRT2ToLCD|SwitchCRT2|SetSimuScanMode); - } - if(tempbx & SetCRT2ToSCART) { - tempbx &= (0xFF00|SetCRT2ToSCART|SwitchCRT2|SetSimuScanMode); - } - if(tempbx & SetCRT2ToHiVisionTV) { - tempbx &= (0xFF00|SetCRT2ToHiVisionTV|SwitchCRT2|SetSimuScanMode); - } + USHORT clearmask = ( DriverMode | + DisableCRT2Display | + LoadDACFlag | + SetNotSimuMode | + SetInSlaveMode | + SetPALTV | + SwitchCRT2 | + SetSimuScanMode ); + if(tempbx & SetCRT2ToLCDA) tempbx &= (clearmask | SetCRT2ToLCDA); + if(tempbx & SetCRT2ToRAMDAC) tempbx &= (clearmask | SetCRT2ToRAMDAC); + if(tempbx & SetCRT2ToLCD) tempbx &= (clearmask | SetCRT2ToLCD); + if(tempbx & SetCRT2ToSCART) tempbx &= (clearmask | SetCRT2ToSCART); + if(tempbx & SetCRT2ToHiVision) tempbx &= (clearmask | SetCRT2ToHiVision); + if(tempbx & SetCRT2ToYPbPr525750) tempbx &= (clearmask | SetCRT2ToYPbPr525750); } else { if(HwInfo->jChipType >= SIS_315H) { if(tempbx & SetCRT2ToLCDA) { @@ -1124,14 +1102,12 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, } } - if(!(tempbx & DriverMode)){ - tempbx |= SetSimuScanMode; - } + if(!(tempbx & DriverMode)) tempbx |= SetSimuScanMode; /* LVDS/CHRONTEL (LCD/TV) and 301BDH (LCD) can only be slave in 8bpp modes */ if(SiS_Pr->SiS_ModeType <= ModeVGA) { if( (SiS_Pr->SiS_IF_DEF_LVDS == 1) || - ((tempbx & SetCRT2ToLCD) && (SiS_Pr->SiS_VBType & VB_NoLCD)) ) { + ((SiS_Pr->SiS_VBType & VB_NoLCD) && (tempbx & SetCRT2ToLCD)) ) { modeflag &= (~CRT2Mode); } } @@ -1199,32 +1175,46 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, } /*********************************************/ -/* DETERMINE HiVision MODE */ +/* DETERMINE YPbPr MODE */ /*********************************************/ void -SiS_SetHiVision(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +SiS_SetYPbPr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { -#ifdef SIS315H - USHORT temp; -#endif + + UCHAR temp; /* Note: This variable is only used on 30xLV systems. - CR38 has a different meaning on LVDS/CH7019 systems. + * CR38 has a different meaning on LVDS/CH7019 systems. + * On 661 and later, these bits moved to CR35. + * + * On 301, 301B, only HiVision 1080i is supported. + * On 30xLV, 301C, only YPbPr 1080i is supported. */ - SiS_Pr->SiS_HiVision = 0; -#ifdef SIS315H - if((HwInfo->jChipType >= SIS_315H) && (HwInfo->jChipType < SIS_661)) { - if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { - temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); - temp &= 0x38; - SiS_Pr->SiS_HiVision = (temp >> 3); + SiS_Pr->SiS_YPbPr = 0; + if(HwInfo->jChipType >= SIS_661) return; + + if(SiS_Pr->SiS_VBType) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) { + SiS_Pr->SiS_YPbPr = YPbPrHiVision; + } + } + + if(HwInfo->jChipType >= SIS_315H) { + if(SiS_Pr->SiS_VBType & (VB_SIS301LV302LV | VB_SIS301C)) { + temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); + if(temp & 0x08) { + switch((temp >> 4)) { + case 0x00: SiS_Pr->SiS_YPbPr = YPbPr525i; break; + case 0x01: SiS_Pr->SiS_YPbPr = YPbPr525p; break; + case 0x02: SiS_Pr->SiS_YPbPr = YPbPr750p; break; + case 0x03: SiS_Pr->SiS_YPbPr = YPbPrHiVision; break; + } } } } -#endif /* SIS315H */ + } /*********************************************/ @@ -1250,6 +1240,7 @@ SiS_SetTVMode(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, PSIS_HW_IN if(HwInfo->jChipType < SIS_661) { if(SiS_Pr->SiS_VBInfo & SetPALTV) SiS_Pr->SiS_TVMode |= TVSetPAL; + if(SiS_Pr->SiS_VBType & VB_SISVB) { temp = 0; if((HwInfo->jChipType == SIS_630) || @@ -1262,7 +1253,7 @@ SiS_SetTVMode(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, PSIS_HW_IN if(HwInfo->jChipType >= SIS_330) romindex = 0x11b; } if(temp) { - if(romindex && ROMAddr && SiS_Pr->SiS_UseROM) { + if(romindex && SiS_Pr->SiS_UseROM && (!(SiS_Pr->SiS_ROMNew))) { OutputSelect = ROMAddr[romindex]; if(!(OutputSelect & EnablePALMN)) { SiS_SetRegAND(SiS_Pr->SiS_P3d4,temp,0x3F); @@ -1282,6 +1273,19 @@ SiS_SetTVMode(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, PSIS_HW_IN } } } + /* Translate HiVision/YPbPr to our new flags */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) { + if(SiS_Pr->SiS_YPbPr == YPbPr750p) SiS_Pr->SiS_TVMode |= TVSetYPbPr750p; + else if(SiS_Pr->SiS_YPbPr == YPbPr525p) SiS_Pr->SiS_TVMode |= TVSetYPbPr525p; + else if(SiS_Pr->SiS_YPbPr == YPbPrHiVision) SiS_Pr->SiS_TVMode |= TVSetHiVision; + else SiS_Pr->SiS_TVMode |= TVSetYPbPr525i; + if(SiS_Pr->SiS_TVMode & (TVSetYPbPr750p | TVSetYPbPr525p | TVSetYPbPr525i)) { + SiS_Pr->SiS_VBInfo &= ~SetCRT2ToHiVision; + SiS_Pr->SiS_VBInfo |= SetCRT2ToYPbPr525750; + } else if(SiS_Pr->SiS_TVMode & TVSetHiVision) { + SiS_Pr->SiS_TVMode |= TVSetPAL; + } + } } else if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { if(SiS_Pr->SiS_CHOverScan) { if(SiS_Pr->SiS_IF_DEF_CH70xx == 1) { @@ -1337,11 +1341,47 @@ SiS_SetTVMode(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, PSIS_HW_IN } } } + if(SiS_Pr->SiS_VBType & VB_SISVB) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) { + temp1 &= 0xe0; + if(temp1 == 0x00) SiS_Pr->SiS_TVMode |= TVSetYPbPr525i; + else if(temp1 == 0x20) SiS_Pr->SiS_TVMode |= TVSetYPbPr525p; + else if(temp1 == 0x40) SiS_Pr->SiS_TVMode |= TVSetYPbPr750p; + } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) { + SiS_Pr->SiS_TVMode |= (TVSetHiVision | TVSetPAL); + } + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToYPbPr525750 | SetCRT2ToHiVision)) { + if(resinfo == SIS_RI_800x480 || resinfo == SIS_RI_1024x576 || resinfo == SIS_RI_1280x720) { + SiS_Pr->SiS_TVMode |= TVAspect169; + } else { + temp1 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x39); + if(temp1 & 0x02) { + if(SiS_Pr->SiS_TVMode & (TVSetYPbPr750p | TVSetHiVision)) { + SiS_Pr->SiS_TVMode |= TVAspect169; + } else { + SiS_Pr->SiS_TVMode |= TVAspect43LB; + } + } else { + SiS_Pr->SiS_TVMode |= TVAspect43; + } + } + } + } } if(SiS_Pr->SiS_VBInfo & SetCRT2ToSCART) SiS_Pr->SiS_TVMode |= TVSetPAL; if(SiS_Pr->SiS_VBType & VB_SISVB) { + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) { + SiS_Pr->SiS_TVMode |= TVSetPAL; + SiS_Pr->SiS_TVMode &= ~(TVSetPALM | TVSetPALN | TVSetNTSCJ); + } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) { + if(SiS_Pr->SiS_TVMode & (TVSetYPbPr525i | TVSetYPbPr525p | TVSetYPbPr750p)) { + SiS_Pr->SiS_TVMode &= ~(TVSetPAL | TVSetNTSCJ | TVSetPALM | TVSetPALN); + } + } + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) { SiS_Pr->SiS_TVMode |= TVSetTVSimuMode; @@ -1349,31 +1389,73 @@ SiS_SetTVMode(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, PSIS_HW_IN } if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) { - if(resinfo == SIS_RI_1024x768) { - SiS_Pr->SiS_TVMode |= TVSetNTSC1024; + /* BIOS sets TVNTSC1024 without checking 525p here. Wrong? */ + if(!(SiS_Pr->SiS_TVMode & (TVSetHiVision | TVSetYPbPr525p | TVSetYPbPr750p))) { + if(resinfo == SIS_RI_1024x768) { + SiS_Pr->SiS_TVMode |= TVSetNTSC1024; + } } } SiS_Pr->SiS_TVMode |= TVRPLLDIV2XO; - if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) { + if((SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) && + (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { + SiS_Pr->SiS_TVMode &= ~TVRPLLDIV2XO; + } else if(SiS_Pr->SiS_TVMode & (TVSetYPbPr525p | TVSetYPbPr750p)) { + SiS_Pr->SiS_TVMode &= ~TVRPLLDIV2XO; + } else if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) { if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) { SiS_Pr->SiS_TVMode &= ~TVRPLLDIV2XO; } } + } SiS_Pr->SiS_VBInfo &= ~SetPALTV; #ifdef TWDEBUG - xf86DrvMsg(0, X_INFO, "(init301.c: TVMode %x)\n", SiS_Pr->SiS_TVMode); + xf86DrvMsg(0, X_INFO, "(init301: TVMode %x, VBInfo %x)\n", SiS_Pr->SiS_TVMode, SiS_Pr->SiS_VBInfo); #endif - } /*********************************************/ /* GET LCD INFO */ /*********************************************/ +static USHORT +SiS_GetBIOSLCDResInfo(SiS_Private *SiS_Pr) +{ + USHORT temp = SiS_Pr->SiS_LCDResInfo; + /* Translate my LCDResInfo to BIOS value */ + if(temp == Panel_1280x768_2) temp = Panel_1280x768; + if(temp == Panel_1280x768_3) temp = Panel_1280x768; + return temp; +} + +static void +SiS_GetLCDInfoBIOS(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) +{ +#ifdef SIS315H + UCHAR *ROMAddr; + + if((ROMAddr = GetLCDStructPtr661(SiS_Pr, HwInfo))) { + SiS_Pr->PanelHT = SISGETROMW(6); + SiS_Pr->PanelVT = SISGETROMW(8); + SiS_Pr->PanelHRS = SISGETROMW(10); + SiS_Pr->PanelHRE = SISGETROMW(12); + SiS_Pr->PanelVRS = SISGETROMW(14); + SiS_Pr->PanelVRE = SISGETROMW(16); + SiS_Pr->PanelVCLKIdx315 = VCLK_CUSTOM_315; + SiS_Pr->SiS_VCLKData[VCLK_CUSTOM_315].CLOCK = + SiS_Pr->SiS_VBVCLKData[VCLK_CUSTOM_315].CLOCK = (USHORT)ROMAddr[18]; + SiS_Pr->SiS_VCLKData[VCLK_CUSTOM_315].SR2B = + SiS_Pr->SiS_VBVCLKData[VCLK_CUSTOM_315].Part4_A = ROMAddr[19]; + SiS_Pr->SiS_VCLKData[VCLK_CUSTOM_315].SR2B = + SiS_Pr->SiS_VBVCLKData[VCLK_CUSTOM_315].Part4_B = ROMAddr[20]; + } +#endif +} + void SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, PSIS_HW_INFO HwInfo) @@ -1389,49 +1471,57 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, { 0, 1, 2, 3, 7, 4, 5, 8, 0, 0, 10, 0, 0, 0, 0, 15 }; - SiS_Pr->SiS_LCDResInfo = 0; + SiS_Pr->SiS_LCDResInfo = 0; SiS_Pr->SiS_LCDTypeInfo = 0; - SiS_Pr->SiS_LCDInfo = 0; + SiS_Pr->SiS_LCDInfo = 0; + SiS_Pr->PanelHRS = 999; /* HSync start */ + SiS_Pr->PanelHRE = 999; /* HSync end */ + SiS_Pr->PanelVRS = 999; /* VSync start */ + SiS_Pr->PanelVRE = 999; /* VSync end */ - if(SiS_Pr->UseCustomMode) { + if(!(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))) return; + + if(ModeNo <= 0x13) { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } else if(SiS_Pr->UseCustomMode) { modeflag = SiS_Pr->CModeFlag; } else { - if(ModeNo <= 0x13) { - modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - } else { - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; - } + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; } - if(!(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))) return; - temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36); - if((HwInfo->jChipType < SIS_315H) || (HwInfo->jChipType >= SIS_661)) { + if((HwInfo->jChipType >= SIS_661) || (SiS_Pr->SiS_ROMNew)) { + SiS_Pr->SiS_LCDTypeInfo = (SiS_GetReg(SiS_Pr->SiS_P3d4,0x39) & 0x7c) >> 2; + } else if((HwInfo->jChipType < SIS_315H) || (HwInfo->jChipType >= SIS_661)) { SiS_Pr->SiS_LCDTypeInfo = temp >> 4; } else { SiS_Pr->SiS_LCDTypeInfo = (temp & 0x0F) - 1; } temp &= 0x0f; if(HwInfo->jChipType < SIS_315H) { - /* Translate 300 series LCDRes to 315 series for unified usage */ - temp = SiS300SeriesLCDRes[temp]; + /* Translate 300 series LCDRes to 315 series for unified usage */ + temp = SiS300SeriesLCDRes[temp]; } - SiS_Pr->SiS_LCDResInfo = temp; - if(SiS_Pr->SiS_VBType & VB_SISVB) { - if(SiS_Pr->SiS_LCDResInfo < SiS_Pr->SiS_PanelMin301) - SiS_Pr->SiS_LCDResInfo = SiS_Pr->SiS_PanelMin301; - } else { - if(SiS_Pr->SiS_LCDResInfo < SiS_Pr->SiS_PanelMinLVDS) - SiS_Pr->SiS_LCDResInfo = SiS_Pr->SiS_PanelMinLVDS; + if(HwInfo->jChipType == SIS_550) { + if(temp == Panel310_640x480_2) temp = Panel_640x480_2; + if(temp == Panel310_640x480_3) temp = Panel_640x480_3; } - if((!SiS_Pr->CP_HaveCustomData) || (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_PanelCustom)) { - if(SiS_Pr->SiS_LCDResInfo > SiS_Pr->SiS_PanelMax) - SiS_Pr->SiS_LCDResInfo = SiS_Pr->SiS_Panel1024x768; - } + if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { /* SiS LVDS */ + if(temp == Panel310_1280x768) { + temp = Panel_1280x768_2; +#ifdef SIS315H + if((myptr = GetLCDStructPtr661(SiS_Pr, HwInfo))) { + if((myptr[8] | (myptr[9] << 8)) == 798) temp = Panel_1280x768_3; + } +#endif + } + } + + SiS_Pr->SiS_LCDResInfo = temp; if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { if(SiS_Pr->SiS_CustomT == CUT_BARCO1366) { @@ -1441,108 +1531,285 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } } + if(SiS_Pr->SiS_VBType & VB_SISVB) { + if(SiS_Pr->SiS_LCDResInfo < SiS_Pr->SiS_PanelMin301) + SiS_Pr->SiS_LCDResInfo = SiS_Pr->SiS_PanelMin301; + } else { + if(SiS_Pr->SiS_LCDResInfo < SiS_Pr->SiS_PanelMinLVDS) + SiS_Pr->SiS_LCDResInfo = SiS_Pr->SiS_PanelMinLVDS; + } + + SiS_Pr->PanelVCLKIdx300 = VCLK65_300; + SiS_Pr->PanelVCLKIdx315 = VCLK108_2_315; + switch(SiS_Pr->SiS_LCDResInfo) { - case Panel_800x600: SiS_Pr->PanelXRes = 800; SiS_Pr->PanelYRes = 600; break; - case Panel_1024x768: SiS_Pr->PanelXRes = 1024; SiS_Pr->PanelYRes = 768; break; - case Panel_1280x1024: SiS_Pr->PanelXRes = 1280; SiS_Pr->PanelYRes = 1024; break; - case Panel_640x480_3: + case Panel_320x480: SiS_Pr->PanelXRes = 320; SiS_Pr->PanelYRes = 480; + SiS_Pr->PanelHT = 400; SiS_Pr->PanelVT = 525; + SiS_Pr->PanelVCLKIdx300 = VCLK28; + SiS_Pr->PanelVCLKIdx315 = VCLK28; + break; case Panel_640x480_2: - case Panel_640x480: SiS_Pr->PanelXRes = 640; SiS_Pr->PanelYRes = 480; break; - case Panel_1024x600: SiS_Pr->PanelXRes = 1024; SiS_Pr->PanelYRes = 600; break; - case Panel_1152x864: SiS_Pr->PanelXRes = 1152; SiS_Pr->PanelYRes = 864; break; - case Panel_1280x960: SiS_Pr->PanelXRes = 1280; SiS_Pr->PanelYRes = 960; break; - case Panel_1152x768: SiS_Pr->PanelXRes = 1152; SiS_Pr->PanelYRes = 768; break; - case Panel_1400x1050: SiS_Pr->PanelXRes = 1400; SiS_Pr->PanelYRes = 1050; break; - case Panel_1280x768: SiS_Pr->PanelXRes = 1280; SiS_Pr->PanelYRes = 768; break; - case Panel_1600x1200: SiS_Pr->PanelXRes = 1600; SiS_Pr->PanelYRes = 1200; break; - case Panel_320x480: SiS_Pr->PanelXRes = 320; SiS_Pr->PanelYRes = 480; break; - case Panel_Custom: SiS_Pr->PanelXRes = SiS_Pr->CP_MaxX; - SiS_Pr->PanelYRes = SiS_Pr->CP_MaxY; - break; - case Panel_Barco1366: SiS_Pr->PanelXRes = 1360; SiS_Pr->PanelYRes = 1024; break; - case Panel_848x480: SiS_Pr->PanelXRes = 848; SiS_Pr->PanelYRes = 480; break; - default: SiS_Pr->PanelXRes = 1024; SiS_Pr->PanelYRes = 768; break; + case Panel_640x480_3: SiS_Pr->PanelXRes = 640; SiS_Pr->PanelYRes = 480; + SiS_Pr->PanelVRS = 24; SiS_Pr->PanelVRE = 3; + SiS_Pr->PanelVCLKIdx300 = VCLK28; + SiS_Pr->PanelVCLKIdx315 = VCLK28; + break; + case Panel_640x480: SiS_Pr->PanelXRes = 640; SiS_Pr->PanelYRes = 480; + SiS_Pr->PanelVRE = 3; + SiS_Pr->PanelVCLKIdx300 = VCLK28; + SiS_Pr->PanelVCLKIdx315 = VCLK28; + break; + case Panel_800x600: SiS_Pr->PanelXRes = 800; SiS_Pr->PanelYRes = 600; + SiS_Pr->PanelHT = 1056; SiS_Pr->PanelVT = 628; + SiS_Pr->PanelHRS = 40; SiS_Pr->PanelHRE = 128; + SiS_Pr->PanelVRS = 1; SiS_Pr->PanelVRE = 4; + SiS_Pr->PanelVCLKIdx300 = VCLK40; + SiS_Pr->PanelVCLKIdx315 = VCLK40; + break; + case Panel_1024x600: SiS_Pr->PanelXRes = 1024; SiS_Pr->PanelYRes = 600; + SiS_Pr->PanelHT = 1344; SiS_Pr->PanelVT = 800; + SiS_Pr->PanelHRS = 24; SiS_Pr->PanelHRE = 136; + SiS_Pr->PanelVRS = 88; SiS_Pr->PanelVRE = 6; + SiS_Pr->PanelVCLKIdx300 = VCLK65_300; + SiS_Pr->PanelVCLKIdx315 = VCLK65_315; + break; + case Panel_1024x768: SiS_Pr->PanelXRes = 1024; SiS_Pr->PanelYRes = 768; + SiS_Pr->PanelHT = 1344; SiS_Pr->PanelVT = 806; + SiS_Pr->PanelHRS = 24; SiS_Pr->PanelHRE = 136; + SiS_Pr->PanelVRS = 3; SiS_Pr->PanelVRE = 6; + if(HwInfo->jChipType < SIS_315H) { + SiS_Pr->PanelHRS = 23; + SiS_Pr->PanelVRE = 5; + } + SiS_Pr->PanelVCLKIdx300 = VCLK65_300; + SiS_Pr->PanelVCLKIdx315 = VCLK65_315; + SiS_GetLCDInfoBIOS(SiS_Pr, HwInfo); + break; + case Panel_1152x768: SiS_Pr->PanelXRes = 1152; SiS_Pr->PanelYRes = 768; + SiS_Pr->PanelHT = 1344; SiS_Pr->PanelVT = 806; + SiS_Pr->PanelHRS = 24; + SiS_Pr->PanelVRS = 3; SiS_Pr->PanelVRE = 6; + if(HwInfo->jChipType < SIS_315H) { + SiS_Pr->PanelHRS = 23; + SiS_Pr->PanelVRE = 5; + } + SiS_Pr->PanelVCLKIdx300 = VCLK65_300; + SiS_Pr->PanelVCLKIdx315 = VCLK65_315; + break; + case Panel_1152x864: SiS_Pr->PanelXRes = 1152; SiS_Pr->PanelYRes = 864; + break; + case Panel_1280x720: SiS_Pr->PanelXRes = 1280; SiS_Pr->PanelYRes = 720; + SiS_Pr->PanelHT = 1650; SiS_Pr->PanelVT = 750; + SiS_Pr->PanelHRS = 110; SiS_Pr->PanelHRE = 40; + SiS_Pr->PanelVRS = 5; SiS_Pr->PanelVRE = 5; + SiS_Pr->PanelVCLKIdx315 = VCLK_1280x720; + /* Data above for TMDS (projector); get from BIOS for LVDS */ + SiS_GetLCDInfoBIOS(SiS_Pr, HwInfo); + break; + case Panel_1280x768: SiS_Pr->PanelXRes = 1280; SiS_Pr->PanelYRes = 768; + SiS_Pr->PanelHT = 1688; SiS_Pr->PanelVT = 802; + SiS_Pr->PanelHRS = 48; SiS_Pr->PanelHRS = 112; + SiS_Pr->PanelVRS = 3; SiS_Pr->PanelVRE = 6; + SiS_Pr->PanelVCLKIdx300 = VCLK81_300; + SiS_Pr->PanelVCLKIdx315 = VCLK81_315; + break; + case Panel_1280x768_2: SiS_Pr->PanelXRes = 1280; SiS_Pr->PanelYRes = 768; + SiS_Pr->PanelHT = 1408; SiS_Pr->PanelVT = 806; + SiS_Pr->PanelHRS = 16; SiS_Pr->PanelHRE = 64; + SiS_Pr->PanelVRS = 3; SiS_Pr->PanelVRE = 6; + SiS_Pr->PanelVCLKIdx315 = VCLK_1280x768_2; + SiS_GetLCDInfoBIOS(SiS_Pr, HwInfo); + break; + case Panel_1280x768_3: SiS_Pr->PanelXRes = 1280; SiS_Pr->PanelYRes = 768; + SiS_Pr->PanelHT = 1664; SiS_Pr->PanelVT = 798; + SiS_Pr->PanelHRS = 64; SiS_Pr->PanelHRE = 128; + SiS_Pr->PanelVRS = 3; SiS_Pr->PanelVRE = 7; + SiS_Pr->PanelVCLKIdx315 = VCLK_1280x768_3; + SiS_GetLCDInfoBIOS(SiS_Pr, HwInfo); + break; + case Panel_1280x800: SiS_Pr->PanelXRes = 1280; SiS_Pr->PanelYRes = 800; + SiS_Pr->PanelHT = 1408; SiS_Pr->PanelVT = 816; + SiS_Pr->PanelHRS = 21; SiS_Pr->PanelHRE = 24; + SiS_Pr->PanelVRS = 4; SiS_Pr->PanelVRE = 3; + SiS_Pr->PanelVCLKIdx315 = VCLK69_315; + SiS_GetLCDInfoBIOS(SiS_Pr, HwInfo); + break; + case Panel_1280x960: SiS_Pr->PanelXRes = 1280; SiS_Pr->PanelYRes = 960; + SiS_Pr->PanelHT = 1800; SiS_Pr->PanelVT = 1000; + SiS_Pr->PanelVCLKIdx300 = VCLK108_3_300; + SiS_Pr->PanelVCLKIdx315 = VCLK108_3_315; + if(resinfo == SIS_RI_1280x1024) { + SiS_Pr->PanelVCLKIdx300 = VCLK100_300; + SiS_Pr->PanelVCLKIdx315 = VCLK100_315; + } + break; + case Panel_1280x1024: SiS_Pr->PanelXRes = 1280; SiS_Pr->PanelYRes = 1024; + SiS_Pr->PanelHT = 1688; SiS_Pr->PanelVT = 1066; + SiS_Pr->PanelHRS = 48; SiS_Pr->PanelHRE = 112; + SiS_Pr->PanelVRS = 1; SiS_Pr->PanelVRE = 3; + SiS_Pr->PanelVCLKIdx300 = VCLK108_3_300; + SiS_Pr->PanelVCLKIdx315 = VCLK108_2_315; + SiS_GetLCDInfoBIOS(SiS_Pr, HwInfo); + break; + case Panel_1400x1050: SiS_Pr->PanelXRes = 1400; SiS_Pr->PanelYRes = 1050; + SiS_Pr->PanelHT = 1688; SiS_Pr->PanelVT = 1066; + SiS_Pr->PanelHRS = 48; SiS_Pr->PanelHRE = 112; /* HRE OK for LVDS, not for LCDA */ + SiS_Pr->PanelVRS = 1; SiS_Pr->PanelVRE = 3; + SiS_Pr->PanelVCLKIdx315 = VCLK108_2_315; + SiS_GetLCDInfoBIOS(SiS_Pr, HwInfo); + break; + case Panel_1600x1200: SiS_Pr->PanelXRes = 1600; SiS_Pr->PanelYRes = 1200; + SiS_Pr->PanelHT = 2160; SiS_Pr->PanelVT = 1250; + SiS_Pr->PanelHRS = 64; SiS_Pr->PanelHRE = 192; + SiS_Pr->PanelVRS = 1; SiS_Pr->PanelVRE = 3; + SiS_Pr->PanelVCLKIdx315 = VCLK162_315; + SiS_GetLCDInfoBIOS(SiS_Pr, HwInfo); + break; + case Panel_1680x1050: SiS_Pr->PanelXRes = 1680; SiS_Pr->PanelYRes = 1050; + SiS_Pr->PanelHT = 1900; SiS_Pr->PanelVT = 1066; + SiS_Pr->PanelHRS = 26; SiS_Pr->PanelHRE = 76; + SiS_Pr->PanelVRS = 3; SiS_Pr->PanelVRE = 6; + SiS_Pr->PanelVCLKIdx315 = VCLK121_315; + SiS_GetLCDInfoBIOS(SiS_Pr, HwInfo); + break; + case Panel_Custom: SiS_Pr->PanelXRes = SiS_Pr->CP_MaxX; + SiS_Pr->PanelYRes = SiS_Pr->CP_MaxY; + SiS_Pr->PanelHT = SiS_Pr->CHTotal; + SiS_Pr->PanelVT = SiS_Pr->CVTotal; + if(SiS_Pr->CP_PreferredIndex != -1) { + SiS_Pr->PanelXRes = SiS_Pr->CP_HDisplay[SiS_Pr->CP_PreferredIndex]; + SiS_Pr->PanelYRes = SiS_Pr->CP_VDisplay[SiS_Pr->CP_PreferredIndex]; + SiS_Pr->PanelHT = SiS_Pr->CP_HTotal[SiS_Pr->CP_PreferredIndex]; + SiS_Pr->PanelVT = SiS_Pr->CP_VTotal[SiS_Pr->CP_PreferredIndex]; + SiS_Pr->PanelHRS = SiS_Pr->CP_HSyncStart[SiS_Pr->CP_PreferredIndex]; + SiS_Pr->PanelHRE = SiS_Pr->CP_HSyncEnd[SiS_Pr->CP_PreferredIndex]; + SiS_Pr->PanelVRS = SiS_Pr->CP_VSyncStart[SiS_Pr->CP_PreferredIndex]; + SiS_Pr->PanelVRE = SiS_Pr->CP_VSyncEnd[SiS_Pr->CP_PreferredIndex]; + SiS_Pr->PanelHRS -= SiS_Pr->PanelXRes; + SiS_Pr->PanelHRE -= SiS_Pr->PanelHRS; + SiS_Pr->PanelVRS -= SiS_Pr->PanelYRes; + SiS_Pr->PanelVRE -= SiS_Pr->PanelVRS; + } + break; + case Panel_Barco1366: SiS_Pr->PanelXRes = 1360; SiS_Pr->PanelYRes = 1024; + SiS_Pr->PanelHT = 1688; SiS_Pr->PanelVT = 1066; + break; + case Panel_848x480: SiS_Pr->PanelXRes = 848; SiS_Pr->PanelYRes = 480; + SiS_Pr->PanelHT = 1088; SiS_Pr->PanelVT = 525; + break; + default: SiS_Pr->PanelXRes = 1024; SiS_Pr->PanelYRes = 768; + SiS_Pr->PanelHT = 1344; SiS_Pr->PanelVT = 806; + break; } temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x37); - if(HwInfo->jChipType < SIS_661) { - temp &= ~0xe; - } else { + SiS_Pr->SiS_LCDInfo = temp & ~0x000e; + + if(!(SiS_Pr->UsePanelScaler)) SiS_Pr->SiS_LCDInfo &= ~DontExpandLCD; + else if(SiS_Pr->UsePanelScaler == 1) SiS_Pr->SiS_LCDInfo |= DontExpandLCD; + #ifdef SIS315H - if(!(temp & 0x10)) { - if(temp & 0x08) temp |= LCDPass11; + if(HwInfo->jChipType >= SIS_661) { + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + if(temp & 0x08) SiS_Pr->SiS_LCDInfo |= LCDPass11; } - temp &= ~0xe; if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { - myptr = GetLCDStructPtr661(SiS_Pr, HwInfo); - if(myptr) { - if(myptr[2] & 0x01) temp |= LCDDualLink; - } + if(SiS_Pr->SiS_ROMNew) { + if(temp & 0x02) SiS_Pr->SiS_LCDInfo |= LCDDualLink; + } else if((myptr = GetLCDStructPtr661(SiS_Pr, HwInfo))) { + if(myptr[2] & 0x01) SiS_Pr->SiS_LCDInfo |= LCDDualLink; + } + } + } else if(HwInfo->jChipType >= SIS_315H) { + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x39) & 0x01) SiS_Pr->SiS_LCDInfo |= LCDPass11; } + if((SiS_Pr->SiS_ROMNew) && (!(SiS_Pr->PanelSelfDetected))) { + SiS_Pr->SiS_LCDInfo &= ~(LCDRGB18Bit); + temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35); + if(temp & 0x01) SiS_Pr->SiS_LCDInfo |= LCDRGB18Bit; + if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { + if(temp & 0x02) SiS_Pr->SiS_LCDInfo |= LCDDualLink; + } + } + } #endif + + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + /* Always center screen on LVDS (if scaling is disabled) */ + SiS_Pr->SiS_LCDInfo &= ~LCDPass11; + } else if(SiS_Pr->SiS_VBType & VB_SISVB) { + if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { + /* Always center screen on SiS LVDS (if scaling is disabled) */ + SiS_Pr->SiS_LCDInfo &= ~LCDPass11; + } else { + /* By default, pass 1:1 on SiS TMDS (if scaling is disabled) */ + SiS_Pr->SiS_LCDInfo |= LCDPass11; + if(SiS_Pr->CenterScreen == 1) SiS_Pr->SiS_LCDInfo &= ~LCDPass11; + } } - SiS_Pr->SiS_LCDInfo = temp; if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { if(SiS_Pr->SiS_CustomT == CUT_PANEL848) { - SiS_Pr->SiS_LCDInfo = 0x80 | 0x40 | 0x20; /* neg sync, RGB24 */ + SiS_Pr->SiS_LCDInfo = 0x80 | 0x40 | 0x20; /* neg h/v sync, RGB24(D0 = 0) */ } } - if(!(SiS_Pr->UsePanelScaler)) SiS_Pr->SiS_LCDInfo &= ~DontExpandLCD; - else if(SiS_Pr->UsePanelScaler == 1) SiS_Pr->SiS_LCDInfo |= DontExpandLCD; - if(SiS_Pr->SiS_VBType & VB_SISVB) { if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_PanelCustom) { - /* For non-standard LCD resolution, we let the panel scale */ - SiS_Pr->SiS_LCDInfo |= DontExpandLCD; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { - if(ModeNo == 0x7c || ModeNo == 0x7d || ModeNo == 0x7e) { - /* We do not scale to 1280x960 (B/C bridges only) */ - SiS_Pr->SiS_LCDInfo |= DontExpandLCD; - } - if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { - /* No non-scaling data available for LV bridges */ - SiS_Pr->SiS_LCDInfo &= ~DontExpandLCD; - } - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) { - /* No idea about the timing and zoom factors */ - SiS_Pr->SiS_LCDInfo |= DontExpandLCD; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { - if(ModeNo == 0x3a || ModeNo == 0x4d || ModeNo == 0x65) { - /* We do not scale to 1280x1024 (all bridges) */ - SiS_Pr->SiS_LCDInfo |= DontExpandLCD; - } - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) { - if(SiS_Pr->SiS_VBType & VB_SIS301B302B) { - /* No idea about the timing and zoom factors (C bridge only) */ - SiS_Pr->SiS_LCDInfo |= DontExpandLCD; - } - } - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - if(SiS_Pr->SiS_CustomT == CUT_CLEVO1024) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { - SiS_Pr->SiS_LCDInfo &= ~DontExpandLCD; - } - } + switch(SiS_Pr->SiS_LCDResInfo) { + case Panel_Custom: + /* For non-standard LCD resolution, we let the panel scale */ + SiS_Pr->SiS_LCDInfo |= DontExpandLCD; + break; + case Panel_1280x720: + if(SiS_Pr->PanelHT == 1650) { + SiS_Pr->SiS_LCDInfo |= DontExpandLCD; + } + case Panel_1280x768: /* TMDS only */ + /* No idea about the timing and zoom factors */ + SiS_Pr->SiS_LCDInfo |= DontExpandLCD; + break; + case Panel_1280x960: + SiS_Pr->SiS_LCDInfo &= ~DontExpandLCD; + break; + case Panel_1280x1024: + if(SiS_Pr->SiS_VBType & VB_SIS301B302B) { + if(ModeNo == 0x7c || ModeNo == 0x7d || ModeNo == 0x7e || + ModeNo == 0x79 || ModeNo == 0x75 || ModeNo == 0x78 || + ModeNo == 0x14 || ModeNo == 0x15 || ModeNo == 0x16) { + /* We do not scale to 1280x720/800/960 (B/C bridges only) */ + SiS_Pr->SiS_LCDInfo |= DontExpandLCD; + } + if(((HwInfo->jChipType >= SIS_315H) && + (ModeNo == 0x23 || ModeNo == 0x24 || ModeNo == 0x25)) || + ((HwInfo->jChipType < SIS_315H) && + (ModeNo == 0x55 || ModeNo == 0x5a || ModeNo == 0x5b))) { + /* We do not scale to 1280x768 (B/C bridges only) */ + SiS_Pr->SiS_LCDInfo |= DontExpandLCD; + } + } + break; + case Panel_1400x1050: + if(ModeNo == 0x3a || ModeNo == 0x4d || ModeNo == 0x65) { + /* We do not scale to 1280x1024 (all bridges) */ + SiS_Pr->SiS_LCDInfo |= DontExpandLCD; + } + break; + case Panel_1600x1200: + if(SiS_Pr->SiS_VBType & VB_SIS301B302B) { + /* No idea about the timing and zoom factors (C bridge only) */ + SiS_Pr->SiS_LCDInfo |= DontExpandLCD; + } + break; } } } - if(HwInfo->jChipType >= SIS_315H) { -#ifdef SIS315H - if(HwInfo->jChipType < SIS_661) { - if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x39) & 0x01) { - SiS_Pr->SiS_LCDInfo &= (~DontExpandLCD); - SiS_Pr->SiS_LCDInfo |= LCDPass11; - } - } -#endif - } else { #ifdef SIS300 + if(HwInfo->jChipType < SIS_315H) { if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { - if((ROMAddr) && SiS_Pr->SiS_UseROM) { + if(SiS_Pr->SiS_UseROM) { if((ROMAddr[0x233] == 0x12) && (ROMAddr[0x234] == 0x34)) { if(!(ROMAddr[0x235] & 0x02)) { SiS_Pr->SiS_LCDInfo &= (~DontExpandLCD); @@ -1554,34 +1821,59 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, SiS_Pr->SiS_LCDInfo &= (~DontExpandLCD); } } + } #endif + + /* Special cases */ + if(SiS_Pr->SiS_IF_DEF_TRUMPION) { + SiS_Pr->SiS_LCDInfo |= (DontExpandLCD | LCDPass11); + } + + if(SiS_Pr->SiS_LCDResInfo == Panel_640x480) { + SiS_Pr->SiS_LCDInfo |= LCDPass11; } - /* Trumpion: Assume non-expanding */ - if(SiS_Pr->SiS_IF_DEF_TRUMPION != 0) { - SiS_Pr->SiS_LCDInfo &= (~DontExpandLCD); + /* (In)validate LCDPass11 flag */ + if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) { + SiS_Pr->SiS_LCDInfo &= ~LCDPass11; } - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { - SiS_Pr->SiS_LCDInfo &= (~LCDPass11); + /* Special cases */ + if( (SiS_Pr->SiS_IF_DEF_FSTN) || + (SiS_Pr->SiS_IF_DEF_DSTN) || + (SiS_Pr->SiS_CustomT == CUT_BARCO1366) || + (SiS_Pr->SiS_CustomT == CUT_BARCO1024) || + (SiS_Pr->SiS_CustomT == CUT_PANEL848) ) { + SiS_Pr->PanelHRS = 999; + SiS_Pr->PanelHRE = 999; + } + + if( (SiS_Pr->SiS_CustomT == CUT_BARCO1366) || + (SiS_Pr->SiS_CustomT == CUT_BARCO1024) || + (SiS_Pr->SiS_CustomT == CUT_PANEL848) ) { + SiS_Pr->PanelVRS = 999; + SiS_Pr->PanelVRE = 999; } #ifdef SIS315H if((HwInfo->jChipType >= SIS_315H) && (HwInfo->jChipType < SIS_661)) { - if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { - /* Enable 302LV/302ELV dual link mode. - * For 661, this is done above. - */ - if((SiS_Pr->SiS_CustomT == CUT_CLEVO1024) && - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768)) { - /* (Sets this in SenseLCD; new paneltypes) */ - SiS_Pr->SiS_LCDInfo |= LCDDualLink; - } - if((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) || - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) || - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200)) { - SiS_Pr->SiS_LCDInfo |= LCDDualLink; - } + if(!(SiS_Pr->SiS_ROMNew)) { + if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { + /* Enable 302LV/302ELV dual link mode. + * For 661, this is done above. + */ + if((SiS_Pr->SiS_CustomT == CUT_CLEVO1024) && + (SiS_Pr->SiS_LCDResInfo == Panel_1024x768)) { + /* (Sets this in SenseLCD; new paneltypes) */ + SiS_Pr->SiS_LCDInfo |= LCDDualLink; + } + if((SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) || + (SiS_Pr->SiS_LCDResInfo == Panel_1400x1050) || + (SiS_Pr->SiS_LCDResInfo == Panel_1600x1200) || + (SiS_Pr->SiS_LCDResInfo == Panel_1680x1050)) { + SiS_Pr->SiS_LCDInfo |= LCDDualLink; + } + } } } #endif @@ -1589,37 +1881,31 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, if(!((HwInfo->jChipType < SIS_315H) && (SiS_Pr->SiS_SetFlag & SetDOSMode))) { if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) { - if(ModeNo > 0x13) { - if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) { - if((resinfo == SIS_RI_800x600) || (resinfo == SIS_RI_400x300)) { - SiS_Pr->SiS_SetFlag |= EnableLVDSDDA; - } - } - } - } - if(ModeNo == 0x12) { - if(SiS_Pr->SiS_LCDInfo & LCDPass11) { - SiS_Pr->SiS_SetFlag |= EnableLVDSDDA; + if(SiS_Pr->SiS_IF_DEF_TRUMPION == 0) { + if(ModeNo == 0x12) { + if(SiS_Pr->SiS_LCDInfo & LCDPass11) { + SiS_Pr->SiS_SetFlag |= EnableLVDSDDA; + } } } } if(modeflag & HalfDCLK) { - if(SiS_Pr->SiS_IF_DEF_TRUMPION == 0) { - if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) { - if(!(((SiS_Pr->SiS_IF_DEF_LVDS == 1) || (HwInfo->jChipType < SIS_315H)) && - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480))) { - if(ModeNo > 0x13) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { - if(resinfo == SIS_RI_512x384) SiS_Pr->SiS_SetFlag |= EnableLVDSDDA; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) { - if(resinfo == SIS_RI_400x300) SiS_Pr->SiS_SetFlag |= EnableLVDSDDA; - } - } - } else SiS_Pr->SiS_SetFlag |= EnableLVDSDDA; - } else SiS_Pr->SiS_SetFlag |= EnableLVDSDDA; - } else SiS_Pr->SiS_SetFlag |= EnableLVDSDDA; + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + SiS_Pr->SiS_SetFlag |= EnableLVDSDDA; + } else if(SiS_Pr->SiS_LCDResInfo == Panel_640x480) { + SiS_Pr->SiS_SetFlag |= EnableLVDSDDA; + } else if(ModeNo > 0x13) { + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { + if(resinfo == SIS_RI_512x384) SiS_Pr->SiS_SetFlag |= EnableLVDSDDA; + } else if(SiS_Pr->SiS_LCDResInfo == Panel_1024x600) { + if((resinfo == SIS_RI_800x600) || (resinfo == SIS_RI_400x300)) { + SiS_Pr->SiS_SetFlag |= EnableLVDSDDA; + } + } else if(SiS_Pr->SiS_LCDResInfo == Panel_800x600) { + if(resinfo == SIS_RI_400x300) SiS_Pr->SiS_SetFlag |= EnableLVDSDDA; + } + } } } @@ -1632,14 +1918,6 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, SiS_Pr->SiS_SetFlag |= LCDVESATiming; } - SiS_Pr->SiS_LCDInfo661 = 0; - if(SiS_Pr->SiS_SetFlag & LCDVESATiming) SiS_Pr->SiS_LCDInfo661 |= 0x0001; - if(SiS_Pr->SiS_SetFlag & EnableLVDSDDA) SiS_Pr->SiS_LCDInfo661 |= 0x0002; - if(SiS_Pr->SiS_LCDInfo & LCDPass11) SiS_Pr->SiS_LCDInfo661 |= 0x0008; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) SiS_Pr->SiS_LCDInfo661 |= 0x0010; - SiS_Pr->SiS_LCDInfo661 |= (SiS_Pr->SiS_LCDInfo & 0xe0); - if(SiS_Pr->SiS_LCDInfo & LCDDualLink) SiS_Pr->SiS_LCDInfo661 |= 0x0100; - #ifdef LINUX_KERNEL #ifdef TWDEBUG printk(KERN_DEBUG "sisfb: (LCDInfo=0x%04x LCDResInfo=0x%02x LCDTypeInfo=0x%02x)\n", @@ -1661,54 +1939,21 @@ USHORT SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PSIS_HW_INFO HwInfo) { - USHORT tempbx; - const USHORT LCDXlat0VCLK[4] = {VCLK40, VCLK40, VCLK40, VCLK40}; - const USHORT LVDSXlat1VCLK[4] = {VCLK40, VCLK40, VCLK40, VCLK40}; - const USHORT LVDSXlat4VCLK[4] = {VCLK28, VCLK28, VCLK28, VCLK28}; -#ifdef SIS300 - const USHORT LCDXlat1VCLK300[4] = {VCLK65_300, VCLK65_300, VCLK65_300, VCLK65_300}; - const USHORT LCDXlat2VCLK300[4] = {VCLK108_2_300,VCLK108_2_300,VCLK108_2_300,VCLK108_2_300}; - const USHORT LVDSXlat2VCLK300[4]= {VCLK65_300, VCLK65_300, VCLK65_300, VCLK65_300}; - const USHORT LVDSXlat3VCLK300[4]= {VCLK65_300, VCLK65_300, VCLK65_300, VCLK65_300}; -#endif -#ifdef SIS315H - const USHORT LCDXlat1VCLK310[4] = {VCLK65_315, VCLK65_315, VCLK65_315, VCLK65_315}; - const USHORT LCDXlat2VCLK310[4] = {VCLK108_2_315,VCLK108_2_315,VCLK108_2_315,VCLK108_2_315}; - const USHORT LVDSXlat2VCLK310[4]= {VCLK65_315, VCLK65_315, VCLK65_315, VCLK65_315}; - const USHORT LVDSXlat3VCLK310[4]= {VCLK108_2_315,VCLK108_2_315,VCLK108_2_315,VCLK108_2_315}; -#endif - USHORT CRT2Index,VCLKIndex=0; - USHORT modeflag,resinfo; - const UCHAR *CHTVVCLKPtr = NULL; - const USHORT *LCDXlatVCLK1 = NULL; - const USHORT *LCDXlatVCLK2 = NULL; - const USHORT *LVDSXlatVCLK2 = NULL; - const USHORT *LVDSXlatVCLK3 = NULL; - - if(HwInfo->jChipType >= SIS_315H) { -#ifdef SIS315H - LCDXlatVCLK1 = LCDXlat1VCLK310; - LCDXlatVCLK2 = LCDXlat2VCLK310; - LVDSXlatVCLK2 = LVDSXlat2VCLK310; - LVDSXlatVCLK3 = LVDSXlat3VCLK310; -#endif - } else { -#ifdef SIS300 - LCDXlatVCLK1 = LCDXlat1VCLK300; - LCDXlatVCLK2 = LCDXlat2VCLK300; - LVDSXlatVCLK2 = LVDSXlat2VCLK300; - LVDSXlatVCLK3 = LVDSXlat3VCLK300; -#endif - } + USHORT CRT2Index,VCLKIndex=0,VCLKIndexGEN=0; + USHORT modeflag,resinfo,tempbx; + const UCHAR *CHTVVCLKPtr = NULL; if(ModeNo <= 0x13) { modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo; CRT2Index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + VCLKIndexGEN = (SiS_GetRegByte((SiS_Pr->SiS_P3ca+0x02)) >> 2) & 0x03; } else { modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; CRT2Index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; + VCLKIndexGEN = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; + if(HwInfo->jChipType < SIS_315H) VCLKIndexGEN &= 0x3f; } if(SiS_Pr->SiS_VBType & VB_SISVB) { /* 30x/B/LV */ @@ -1716,50 +1961,18 @@ SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, if(SiS_Pr->SiS_SetFlag & ProgrammingCRT2) { CRT2Index >>= 6; - if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { /* LCD */ + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { /* LCD */ if(HwInfo->jChipType < SIS_315H) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) { - VCLKIndex = LCDXlat0VCLK[CRT2Index]; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { - VCLKIndex = LCDXlatVCLK1[CRT2Index]; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) { - VCLKIndex = LCDXlatVCLK1[CRT2Index]; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) { - VCLKIndex = LCDXlatVCLK1[CRT2Index]; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) { - VCLKIndex = VCLK81_300; /* guessed */ - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) { - VCLKIndex = VCLK108_3_300; - if(resinfo == SIS_RI_1280x1024) VCLKIndex = VCLK100_300; - } else { - VCLKIndex = LCDXlatVCLK2[CRT2Index]; - } + VCLKIndex = SiS_Pr->PanelVCLKIdx300; } else { - if( (SiS_Pr->SiS_VBType & VB_SIS301LV302LV) || - (!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) ) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { - VCLKIndex = VCLK108_2_315; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) { - VCLKIndex = VCLK81_315; /* guessed */ - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { - VCLKIndex = VCLK108_2_315; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) { - VCLKIndex = VCLK162_315; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) { - VCLKIndex = VCLK108_3_315; - if(resinfo == SIS_RI_1280x1024) VCLKIndex = VCLK100_315; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { - VCLKIndex = LCDXlatVCLK1[CRT2Index]; - } else { - VCLKIndex = LCDXlatVCLK2[CRT2Index]; - } - } else { - VCLKIndex = (UCHAR)SiS_GetRegByte((USHORT)(SiS_Pr->SiS_P3ca+0x02)); /* Port 3cch */ - VCLKIndex = ((VCLKIndex >> 2) & 0x03); - if(ModeNo > 0x13) { - VCLKIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; - } + VCLKIndex = SiS_Pr->PanelVCLKIdx315; + if((SiS_Pr->SiS_LCDInfo & DontExpandLCD) && (SiS_Pr->SiS_LCDInfo & LCDPass11)) { + VCLKIndex = VCLKIndexGEN; + if(resinfo == SIS_RI_1280x720) VCLKIndex = VCLK_1280x720; + if(SiS_Pr->SiS_LCDResInfo == Panel_1280x720) { + if(SiS_Pr->PanelHT == 1344) VCLKIndex = VCLK_1280x720_2; + } if(ModeNo <= 0x13) { if(HwInfo->jChipType <= SIS_315PRO) { if(SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC == 1) VCLKIndex = 0x42; @@ -1775,34 +1988,28 @@ SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } } - } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { /* TV */ + } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { /* TV */ - if( (SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) && - (!(SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) ) { - if(SiS_Pr->SiS_TVMode & TVRPLLDIV2XO) VCLKIndex = HiTVVCLKDIV2; - else VCLKIndex = HiTVVCLK; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) { + if(SiS_Pr->SiS_TVMode & TVRPLLDIV2XO) VCLKIndex = HiTVVCLKDIV2; + else VCLKIndex = HiTVVCLK; if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) { - if(modeflag & Charx8Dot) VCLKIndex = HiTVSimuVCLK; - else VCLKIndex = HiTVTextVCLK; + if(modeflag & Charx8Dot) VCLKIndex = HiTVSimuVCLK; + else VCLKIndex = HiTVTextVCLK; } - } else { - if(SiS_Pr->SiS_TVMode & TVRPLLDIV2XO) VCLKIndex = TVVCLKDIV2; - else VCLKIndex = TVVCLK; - } - if(HwInfo->jChipType < SIS_315H) { - VCLKIndex += TVCLKBASE_300; - } else { - VCLKIndex += TVCLKBASE_315; - } + } else if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) VCLKIndex = YPbPr750pVCLK; + else if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) VCLKIndex = TVVCLKDIV2; + else if(SiS_Pr->SiS_TVMode & TVRPLLDIV2XO) VCLKIndex = TVVCLKDIV2; + else VCLKIndex = TVVCLK; - } else { /* VGA2 */ + if(HwInfo->jChipType < SIS_315H) VCLKIndex += TVCLKBASE_300; + else VCLKIndex += TVCLKBASE_315; - VCLKIndex = (UCHAR)SiS_GetRegByte((USHORT)(SiS_Pr->SiS_P3ca+0x02)); - VCLKIndex = ((VCLKIndex >> 2) & 0x03); - if(ModeNo > 0x13) { - VCLKIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; - if(HwInfo->jChipType < SIS_315H) { - VCLKIndex &= 0x3f; + } else { /* VGA2 */ + + VCLKIndex = VCLKIndexGEN; + if(HwInfo->jChipType < SIS_315H) { + if(ModeNo > 0x13) { if( (HwInfo->jChipType == SIS_630) && (HwInfo->jChipRevision >= 0x30)) { if(VCLKIndex == 0x14) VCLKIndex = 0x34; @@ -1815,12 +2022,9 @@ SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } else { /* If not programming CRT2 */ - VCLKIndex = (UCHAR)SiS_GetRegByte((USHORT)(SiS_Pr->SiS_P3ca+0x02)); - VCLKIndex = ((VCLKIndex >> 2) & 0x03); - if(ModeNo > 0x13) { - VCLKIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; - if(HwInfo->jChipType < SIS_315H) { - VCLKIndex &= 0x3f; + VCLKIndex = VCLKIndexGEN; + if(HwInfo->jChipType < SIS_315H) { + if(ModeNo > 0x13) { if( (HwInfo->jChipType != SIS_630) && (HwInfo->jChipType != SIS_300) ) { if(VCLKIndex == 0x1b) VCLKIndex = 0x35; @@ -1833,7 +2037,7 @@ SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, VCLKIndex = CRT2Index; - if(SiS_Pr->SiS_SetFlag & ProgrammingCRT2) { /* programming CRT2 */ + if(SiS_Pr->SiS_SetFlag & ProgrammingCRT2) { if( (SiS_Pr->SiS_IF_DEF_CH70xx != 0) && (SiS_Pr->SiS_VBInfo & SetCRT2ToTV) ) { @@ -1869,32 +2073,16 @@ SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - VCLKIndex >>= 6; - if((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) || - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel320x480)) - VCLKIndex = LVDSXlat1VCLK[VCLKIndex]; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480 || - SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480_2 || - SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480_3) - VCLKIndex = LVDSXlat4VCLK[VCLKIndex]; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) - VCLKIndex = LVDSXlatVCLK2[VCLKIndex]; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) - VCLKIndex = LVDSXlatVCLK2[VCLKIndex]; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) - VCLKIndex = LVDSXlatVCLK2[VCLKIndex]; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) - VCLKIndex = VCLK68_315; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) - VCLKIndex = VCLK162_315; - else - VCLKIndex = LVDSXlatVCLK3[VCLKIndex]; - - if(SiS_Pr->SiS_CustomT == CUT_BARCO1366) { - /* Special Timing: Barco iQ Pro R series */ - VCLKIndex = 0x44; + if(HwInfo->jChipType < SIS_315H) { + VCLKIndex = SiS_Pr->PanelVCLKIdx300; + } else { + VCLKIndex = SiS_Pr->PanelVCLKIdx315; } + /* Special Timing: Barco iQ Pro R series */ + if(SiS_Pr->SiS_CustomT == CUT_BARCO1366) VCLKIndex = 0x44; + + /* Special Timing: 848x480 parallel lvds */ if(SiS_Pr->SiS_CustomT == CUT_PANEL848) { if(HwInfo->jChipType < SIS_315H) { VCLKIndex = VCLK34_300; @@ -1907,28 +2095,22 @@ SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } else { - VCLKIndex = (UCHAR)SiS_GetRegByte((USHORT)(SiS_Pr->SiS_P3ca+0x02)); - VCLKIndex = ((VCLKIndex >> 2) & 0x03); - if(ModeNo > 0x13) { - VCLKIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; - if(HwInfo->jChipType < SIS_315H) { - VCLKIndex &= 0x3F; + VCLKIndex = VCLKIndexGEN; + if(HwInfo->jChipType < SIS_315H) { + if(ModeNo > 0x13) { + if( (HwInfo->jChipType == SIS_630) && + (HwInfo->jChipRevision >= 0x30) ) { + if(VCLKIndex == 0x14) VCLKIndex = 0x2e; + } } - if( (HwInfo->jChipType == SIS_630) && - (HwInfo->jChipRevision >= 0x30) ) { - if(VCLKIndex == 0x14) VCLKIndex = 0x2e; - } } } } else { /* if not programming CRT2 */ - VCLKIndex = (UCHAR)SiS_GetRegByte((USHORT)(SiS_Pr->SiS_P3ca+0x02)); - VCLKIndex = ((VCLKIndex >> 2) & 0x03); - if(ModeNo > 0x13) { - VCLKIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; - if(HwInfo->jChipType < SIS_315H) { - VCLKIndex &= 0x3F; + VCLKIndex = VCLKIndexGEN; + if(HwInfo->jChipType < SIS_315H) { + if(ModeNo > 0x13) { if( (HwInfo->jChipType != SIS_630) && (HwInfo->jChipType != SIS_300) ) { if(VCLKIndex == 0x1b) VCLKIndex = 0x35; @@ -1972,21 +2154,19 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, if(ModeNo <= 0x13) { modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } else if(SiS_Pr->UseCustomMode) { + modeflag = SiS_Pr->CModeFlag; } else { - if(SiS_Pr->UseCustomMode) { - modeflag = SiS_Pr->CModeFlag; - } else { - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - } + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; } /* BIOS does not do this (neither 301 nor LVDS) */ - /* (But it's harmless; see SetCRT2Offset) */ + /* (But it's harmless; see SetCRT2Offset) */ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x03,0x00); /* fix write part1 index 0 BTDRAM bit Bug */ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { - SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x00,0xAF,0x40); /* FUNCTION CONTROL */ + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x00,0xAF,0x40); SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2E,0xF7); } else { @@ -2027,7 +2207,7 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, #ifdef SIS315H /* ------- 315/330 series ------ */ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - if(SiS_Pr->SiS_VBInfo & CRT2DisplayFlag) { + if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) { SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x08); } } @@ -2041,13 +2221,13 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } } else tempah = 0x40; - if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) tempah ^= 0x50; + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) tempah ^= 0x50; #endif /* SIS315H */ } - if(SiS_Pr->SiS_VBInfo & CRT2DisplayFlag) tempah = 0; + if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) tempah = 0; if(HwInfo->jChipType < SIS_315H) { SiS_SetReg(SiS_Pr->SiS_Part1Port,0x00,tempah); @@ -2076,7 +2256,7 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } } - if(SiS_Pr->SiS_VBInfo & CRT2DisplayFlag) tempah = 0; + if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) tempah = 0; if(HwInfo->jChipType < SIS_315H) { @@ -2095,18 +2275,18 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } if((HwInfo->jChipType < SIS_315H) && (SiS_Pr->SiS_VBType & VB_SIS301)) { - if((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) || - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960)) { + if((SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) || + (SiS_Pr->SiS_LCDResInfo == Panel_1280x960)) { tempah |= 0x80; } } else { tempah |= 0x80; } - if(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV - SetCRT2ToHiVisionTV)) { - if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { - if(!(SiS_Pr->SiS_HiVision & 0x03)) { - tempah |= 0x20; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + if(!(SiS_Pr->SiS_TVMode & (TVSetYPbPr750p | TVSetYPbPr525p))) { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + tempah |= 0x20; } } } @@ -2114,22 +2294,18 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x0D,0x40,tempah); tempah = 0; + + if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempah |= 0x40; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { if(SiS_Pr->SiS_TVMode & TVRPLLDIV2XO) { tempah |= 0x40; } } - /* For 302LV dual-channel */ - if(HwInfo->jChipType >= SIS_315H) { - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempah |= 0x40; - } - } - - if((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) || - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) || - ((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_PanelCustom) && + if((SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) || + (SiS_Pr->SiS_LCDResInfo == Panel_1280x960) || + ((SiS_Pr->SiS_LCDResInfo == Panel_Custom) && (SiS_Pr->CP_MaxX >= 1280) && (SiS_Pr->CP_MaxY >= 960))) { tempah |= 0x80; } @@ -2213,8 +2389,8 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, /* The following two are responsible for eventually wrong colors * in TV output. The DH (VB_NoLCD) conditions are unknown; the - * b0 was found in some 651 machine (Pim); the b1 version in a - * 650 box (Jake). What is the criteria? + * b0 was found in some 651 machine (Pim; P4_23=0xe5); the b1 version + * in a 650 box (Jake). What is the criteria? */ if((IS_SIS740) || (HwInfo->jChipType >= SIS_661)) { @@ -2267,7 +2443,7 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x23,tempbl,tempah); } - /* 661: Sets p4 27 and 34 here, done in SetGroup4 here */ + /* 661: Sets p4 27 and 34 here, done in SetGroup4 here (old BIOS) */ #endif /* SIS315H */ @@ -2329,14 +2505,8 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, USHORT SiS_GetResInfo(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex) { - USHORT resindex; - - if(ModeNo <= 0x13) - resindex = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo; - else - resindex = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; - - return(resindex); + if(ModeNo <= 0x13) return((USHORT)SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo); + else return((USHORT)SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO); } static void @@ -2346,8 +2516,12 @@ SiS_GetCRT2ResInfo(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, USHORT xres,yres,modeflag=0,resindex; if(SiS_Pr->UseCustomMode) { - SiS_Pr->SiS_VGAHDE = SiS_Pr->SiS_HDE = SiS_Pr->CHDisplay; - SiS_Pr->SiS_VGAVDE = SiS_Pr->SiS_VDE = SiS_Pr->CVDisplay; + xres = SiS_Pr->CHDisplay; + if(SiS_Pr->CModeFlag & HalfDCLK) xres *= 2; + SiS_Pr->SiS_VGAHDE = SiS_Pr->SiS_HDE = xres; + yres = SiS_Pr->CVDisplay; + if(SiS_Pr->CModeFlag & DoubleScanMode) yres *= 2; + SiS_Pr->SiS_VGAVDE = SiS_Pr->SiS_VDE = yres; return; } @@ -2362,7 +2536,7 @@ SiS_GetCRT2ResInfo(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; } - if((!SiS_Pr->SiS_IF_DEF_DSTN) && (!SiS_Pr->SiS_IF_DEF_FSTN)) { + if(!SiS_Pr->SiS_IF_DEF_DSTN && !SiS_Pr->SiS_IF_DEF_FSTN) { if((HwInfo->jChipType >= SIS_315H) && (SiS_Pr->SiS_IF_DEF_LVDS == 1)) { if((ModeNo != 0x03) && (SiS_Pr->SiS_SetFlag & SetDOSMode)) { @@ -2373,72 +2547,64 @@ SiS_GetCRT2ResInfo(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, } } - if(ModeNo > 0x13) { - if(modeflag & HalfDCLK) xres *= 2; - if(modeflag & DoubleScanMode) yres *= 2; - } + if(modeflag & HalfDCLK) xres *= 2; + if(modeflag & DoubleScanMode) yres *= 2; } - if(SiS_Pr->SiS_VBType & VB_SISVB) { - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + if((SiS_Pr->SiS_VBType & VB_SISVB) && (!(SiS_Pr->SiS_VBType & VB_NoLCD))) { + + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCDA | SetCRT2ToLCD | SetCRT2ToHiVision)) { if(xres == 720) xres = 640; - } else { - if(SiS_Pr->SiS_VBType & VB_NoLCD) { /* 301BDH */ - if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToHiVisionTV)) { - if(xres == 720) xres = 640; - } - if(SiS_Pr->SiS_SetFlag & SetDOSMode) { - yres = 400; - if(HwInfo->jChipType >= SIS_315H) { - if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x17) & 0x80) yres = 480; - } else { - if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x13) & 0x80) yres = 480; - } - } - } else { - if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToHiVisionTV)) { - if(xres == 720) xres = 640; - } - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) { - if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) { - if(yres == 1024) yres = 1056; - } - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { - if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) { - /* BIOS bug - does this regardless of scaling */ - if(yres == 400) yres = 405; - } - if(yres == 350) yres = 360; - if(SiS_Pr->SiS_SetFlag & LCDVESATiming) { - if(yres == 360) yres = 375; - } - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { - if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) { - if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) { - if(yres == 350) yres = 357; - if(yres == 400) yres = 420; - if(yres == 480) yres = 525; - } - } - } + } + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + switch(SiS_Pr->SiS_LCDResInfo) { + case Panel_1024x768: + if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) { + if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) { + if(yres == 350) yres = 357; + if(yres == 400) yres = 420; + if(yres == 480) yres = 525; + } + } + break; + case Panel_1280x1024: + if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) { + /* BIOS bug - does this regardless of scaling */ + if(yres == 400) yres = 405; } + if(yres == 350) yres = 360; + if(SiS_Pr->SiS_SetFlag & LCDVESATiming) { + if(yres == 360) yres = 375; + } + break; + case Panel_1600x1200: + if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) { + if(yres == 1024) yres = 1056; + } + break; } } + } else { - if(xres == 720) xres = 640; - if(SiS_Pr->SiS_SetFlag & SetDOSMode) { - yres = 400; - if(HwInfo->jChipType >= SIS_315H) { - if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x17) & 0x80) yres = 480; - } else { - if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x13) & 0x80) yres = 480; - } - if(SiS_Pr->SiS_IF_DEF_DSTN || SiS_Pr->SiS_IF_DEF_FSTN) { - yres = 480; - } + + if(SiS_Pr->SiS_VBType & VB_SISVB) { + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToHiVision)) { + if(xres == 720) xres = 640; } + } else if(xres == 720) xres = 640; + + if(SiS_Pr->SiS_SetFlag & SetDOSMode) { + yres = 400; + if(HwInfo->jChipType >= SIS_315H) { + if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x17) & 0x80) yres = 480; + } else { + if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x13) & 0x80) yres = 480; + } + if(SiS_Pr->SiS_IF_DEF_DSTN || SiS_Pr->SiS_IF_DEF_FSTN) yres = 480; + } + } SiS_Pr->SiS_VGAHDE = SiS_Pr->SiS_HDE = xres; SiS_Pr->SiS_VGAVDE = SiS_Pr->SiS_VDE = yres; @@ -2453,103 +2619,84 @@ SiS_GetLVDSCRT1Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, USHORT *ResIndex, USHORT *DisplayType) { - USHORT tempbx,modeflag=0; - USHORT Flag,CRT2CRTC; + USHORT modeflag=0; if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) return FALSE; } } else if(SiS_Pr->SiS_VBType & VB_SISVB) { - if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) return FALSE; + if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) return FALSE; } else return FALSE; if(ModeNo <= 0x13) { modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - CRT2CRTC = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + (*ResIndex) = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; } else { modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - CRT2CRTC = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; + (*ResIndex) = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; } - Flag = 1; - tempbx = 0; - if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { - if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) { - Flag = 0; - tempbx = 18; - if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) tempbx++; - if(SiS_Pr->SiS_TVMode & TVSetPAL) { - tempbx += 2; - if(SiS_Pr->SiS_ModeType > ModeVGA) { - if(SiS_Pr->SiS_CHSOverScan) tempbx = 99; - } - if(SiS_Pr->SiS_TVMode & TVSetPALM) { - tempbx = 18; /* PALM uses NTSC data */ - if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) tempbx++; - } else if(SiS_Pr->SiS_TVMode & TVSetPALN) { - tempbx = 20; /* PALN uses PAL data */ - if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) tempbx++; - } - } - } - } - if(Flag) { - tempbx = SiS_Pr->SiS_LCDResInfo; - tempbx -= SiS_Pr->SiS_PanelMinLVDS; - if(SiS_Pr->SiS_LCDResInfo <= SiS_Pr->SiS_Panel1280x1024) { - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 6; - if(modeflag & HalfDCLK) tempbx += 3; - } else { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { - tempbx = 14; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 2; - if(modeflag & HalfDCLK) tempbx++; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) { - tempbx = 23; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 2; - if(modeflag & HalfDCLK) tempbx++; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) { - tempbx = 27; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 2; - if(modeflag & HalfDCLK) tempbx++; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) { - tempbx = 36; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 2; - if(modeflag & HalfDCLK) tempbx++; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) { - tempbx = 40; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 2; - if(modeflag & HalfDCLK) tempbx++; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480_3) { - tempbx = 54; - if(modeflag & HalfDCLK) tempbx++; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480_2) { - tempbx = 52; - if(modeflag & HalfDCLK) tempbx++; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) { - tempbx = 50; - if(modeflag & HalfDCLK) tempbx++; - } + (*ResIndex) &= 0x3F; + if((SiS_Pr->SiS_IF_DEF_CH70xx) && (SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) { + (*DisplayType) = 18; + if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) (*DisplayType)++; + if(SiS_Pr->SiS_TVMode & TVSetPAL) { + (*DisplayType) += 2; + if(SiS_Pr->SiS_ModeType > ModeVGA) { + if(SiS_Pr->SiS_CHSOverScan) (*DisplayType) = 99; + } + if(SiS_Pr->SiS_TVMode & TVSetPALM) { + (*DisplayType) = 18; /* PALM uses NTSC data */ + if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) (*DisplayType)++; + } else if(SiS_Pr->SiS_TVMode & TVSetPALN) { + (*DisplayType) = 20; /* PALN uses PAL data */ + if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) (*DisplayType)++; + } + } + } else { + switch(SiS_Pr->SiS_LCDResInfo) { + case Panel_640x480: (*DisplayType) = 50; break; + case Panel_640x480_2: (*DisplayType) = 52; break; + case Panel_640x480_3: (*DisplayType) = 54; break; + case Panel_800x600: (*DisplayType) = 0; break; + case Panel_1024x600: (*DisplayType) = 23; break; + case Panel_1024x768: (*DisplayType) = 4; break; + case Panel_1152x768: (*DisplayType) = 27; break; + case Panel_1280x768: (*DisplayType) = 40; break; + case Panel_1280x1024: (*DisplayType) = 8; break; + case Panel_1400x1050: (*DisplayType) = 14; break; + case Panel_1600x1200: (*DisplayType) = 36; break; + default: return FALSE; + } + + if(modeflag & HalfDCLK) (*DisplayType)++; + + switch(SiS_Pr->SiS_LCDResInfo) { + case Panel_640x480: + case Panel_640x480_2: + case Panel_640x480_3: + break; + default: + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) (*DisplayType) += 2; } + if(SiS_Pr->SiS_LCDInfo & LCDPass11) { - tempbx = 12; - if(modeflag & HalfDCLK) tempbx++; + (*DisplayType) = 12; + if(modeflag & HalfDCLK) (*DisplayType)++; } } #if 0 if(SiS_Pr->SiS_IF_DEF_FSTN) { if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel320x480){ - tempbx = 22; + (*DisplayType) = 22; } } #endif - *ResIndex = CRT2CRTC & 0x3F; - *DisplayType = tempbx; return TRUE; } @@ -2558,8 +2705,7 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, USHORT RefreshRateTableIndex,USHORT *CRT2Index,USHORT *ResIndex, PSIS_HW_INFO HwInfo) { - USHORT tempbx=0,tempal=0; - USHORT Flag,resinfo=0; + USHORT tempbx=0,tempal=0,resinfo=0; if(ModeNo <= 0x13) { tempal = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; @@ -2572,86 +2718,74 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { /* LCD */ - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) { - tempbx = 15; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { - tempbx = 20; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx = 21; - else if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) tempbx = 22; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) { - tempbx = 23; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx = 24; - else if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) tempbx = 25; -#if 0 - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) { - tempbx = 26; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx = 27; - else if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) tempbx = 28; -#endif - } else if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { - if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempbx = 13; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempbx = 14; - else { - tempbx = 29; - if(ModeNo >= 0x13) { - /* see below */ - if(resinfo == SIS_RI_1280x960) tempal = 10; - } - } - } else { - tempbx = 29; - if(ModeNo >= 0x13) { - /* 1280x768 and 1280x960 have same CRT2CRTC, - * so we change it here if 1280x960 is chosen - */ - if(resinfo == SIS_RI_1280x960) tempal = 10; + tempbx = SiS_Pr->SiS_LCDResInfo; + if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) tempbx += 32; + + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { /* Pass 1:1 only (center-screen handled outside) */ + tempbx = 100; + if(ModeNo >= 0x13) { + tempal = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC_NS; + if((SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].XRes == 1280) && + (SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].YRes == 768)) { + /* Special for Fujitsu 7911 (VL-17WDX8), others custom */ + if(SiS_Pr->SiS_LCDResInfo == Panel_1280x768) tempal = 0x08; + else if(SiS_Pr->SiS_LCDResInfo == Panel_1280x768_2) tempal = 0x0f; + else if(SiS_Pr->SiS_LCDResInfo == Panel_1280x768_3) tempal = 0x10; } - } - } else { - tempbx = SiS_Pr->SiS_LCDResInfo - SiS_Pr->SiS_Panel1024x768; - if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) { - tempbx += 10; - } + } } #ifdef SIS315H if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { - tempbx = 50; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx = 51; - else if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) tempbx = 52; + if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) { + if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) { + tempbx = 200; + if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) tempbx++; + } } } #endif } else { /* TV */ - if((SiS_Pr->SiS_VBType & VB_SIS301B302B) && - (SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV)) { - if(SiS_Pr->SiS_VGAVDE > 480) SiS_Pr->SiS_TVMode &= (~TVSetTVSimuMode); + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) { + /* if(SiS_Pr->SiS_VGAVDE > 480) SiS_Pr->SiS_TVMode &= (~TVSetTVSimuMode); */ tempbx = 2; if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { - if(!(SiS_Pr->SiS_TVMode & TVSetTVSimuMode)) tempbx = 12; + tempbx = 13; + if(!(SiS_Pr->SiS_TVMode & TVSetTVSimuMode)) tempbx = 14; } + } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) { + if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) tempbx = 7; + else if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) tempbx = 6; + else tempbx = 5; + if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) tempbx += 5; } else { - if(SiS_Pr->SiS_TVMode & TVSetPAL) tempbx = 3; - else tempbx = 4; - if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) tempbx += 5; + if(SiS_Pr->SiS_TVMode & TVSetPAL) tempbx = 3; + else tempbx = 4; + if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) tempbx += 5; } } tempal &= 0x3F; - if(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV - SetCRT2ToHiVisionTV)) { - if(ModeNo > 0x13) { + if(ModeNo > 0x13) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoHiVision) { if(tempal == 6) tempal = 7; if((resinfo == SIS_RI_720x480) || (resinfo == SIS_RI_720x576) || (resinfo == SIS_RI_768x576)) { tempal = 6; } + if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) { + if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) { + if(resinfo == SIS_RI_1024x768) tempal = 8; + } + if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) { + if(resinfo == SIS_RI_1280x720) tempal = 8; + } + } } } @@ -2660,70 +2794,54 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, } else { /* LVDS, 301B-DH (if running on LCD) */ - Flag = 1; tempbx = 0; - if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { - if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) { - Flag = 0; - tempbx = 10; - if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) tempbx += 1; - if(SiS_Pr->SiS_TVMode & TVSetPAL) { - tempbx += 2; - if(SiS_Pr->SiS_ModeType > ModeVGA) { - if(SiS_Pr->SiS_CHSOverScan) tempbx = 99; - } - if(SiS_Pr->SiS_TVMode & TVSetPALM) { - tempbx = 90; - if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) tempbx += 1; - } else if(SiS_Pr->SiS_TVMode & TVSetPALN) { - tempbx = 92; - if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) tempbx += 1; - } - } + if((SiS_Pr->SiS_IF_DEF_CH70xx) && (SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) { + tempbx = 10; + if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) tempbx += 1; + if(SiS_Pr->SiS_TVMode & TVSetPAL) { + tempbx += 2; + if(SiS_Pr->SiS_ModeType > ModeVGA) { + if(SiS_Pr->SiS_CHSOverScan) tempbx = 99; + } + if(SiS_Pr->SiS_TVMode & TVSetPALM) { + tempbx = 90; + if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) tempbx += 1; + } else if(SiS_Pr->SiS_TVMode & TVSetPALN) { + tempbx = 92; + if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) tempbx += 1; + } } - } - - if(Flag) { - - if(SiS_Pr->SiS_LCDResInfo <= SiS_Pr->SiS_Panel1280x1024) { - tempbx = SiS_Pr->SiS_LCDResInfo - SiS_Pr->SiS_PanelMinLVDS; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 3; + } else { + switch(SiS_Pr->SiS_LCDResInfo) { + case Panel_640x480: tempbx = 6; break; + case Panel_640x480_2: tempbx = 30; break; + case Panel_640x480_3: tempbx = 30; break; + case Panel_800x600: tempbx = 0; break; + case Panel_1024x600: tempbx = 15; break; + case Panel_1024x768: tempbx = 2; break; + case Panel_1152x768: tempbx = 17; break; + case Panel_1280x768: tempbx = 18; break; + case Panel_1280x1024: tempbx = 4; break; + case Panel_1400x1050: tempbx = 8; break; + case Panel_1600x1200: tempbx = 21; break; + case Panel_Barco1366: tempbx = 80; break; + } - if(SiS_Pr->SiS_CustomT == CUT_BARCO1024) { - tempbx = 82; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++; - } - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) { - tempbx = 18; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) { - tempbx = 6; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480_2) { - tempbx = 30; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480_3) { - tempbx = 30; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) { - tempbx = 15; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 2; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) { - tempbx = 16; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 2; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { - tempbx = 8; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) { - tempbx = 21; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_PanelBarco1366) { - tempbx = 80; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++; + switch(SiS_Pr->SiS_LCDResInfo) { + case Panel_640x480: + case Panel_640x480_2: + case Panel_640x480_3: + break; + default: + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++; } - if(SiS_Pr->SiS_LCDInfo & LCDPass11) { - tempbx = 7; - } + if(SiS_Pr->SiS_LCDInfo & LCDPass11) tempbx = 7; - if(SiS_Pr->SiS_CustomT == CUT_PANEL848) { + if(SiS_Pr->SiS_CustomT == CUT_BARCO1024) { + tempbx = 82; + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++; + } else if(SiS_Pr->SiS_CustomT == CUT_PANEL848) { tempbx = 84; if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++; } @@ -2731,45 +2849,17 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, } if(SiS_Pr->SiS_SetFlag & SetDOSMode) { - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) tempal = 7; + if(SiS_Pr->SiS_LCDResInfo != Panel_640x480) tempal = 7; if(HwInfo->jChipType < SIS_315H) { if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x13) & 0x80) tempal++; } } - *CRT2Index = tempbx; - *ResIndex = tempal & 0x1F; + (*CRT2Index) = tempbx; + (*ResIndex) = tempal & 0x1F; } } -#ifdef SIS315H -static void -SiS_GetCRT2PtrA(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, - USHORT RefreshRateTableIndex,USHORT *CRT2Index, - USHORT *ResIndex) -{ - USHORT tempbx,tempal; - - tempbx = SiS_Pr->SiS_LCDResInfo; - - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempbx = 4; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempbx = 3; - else tempbx -= SiS_Pr->SiS_Panel1024x768; - - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 5; - - if(ModeNo <= 0x13) - tempal = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; - else - tempal = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; - - /* No customs required yet (Clevo, Compaq, etc) */ - - *CRT2Index = tempbx; - *ResIndex = tempal & 0x1F; -} -#endif - static void SiS_GetRAMDAC2DATA(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, USHORT RefreshRateTableIndex,PSIS_HW_INFO HwInfo) @@ -2830,8 +2920,7 @@ SiS_GetRAMDAC2DATA(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, static void SiS_GetCRT2DataLVDS(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, - PSIS_HW_INFO HwInfo) + USHORT RefreshRateTableIndex, PSIS_HW_INFO HwInfo) { USHORT CRT2Index, ResIndex; const SiS_LVDSDataStruct *LVDSData = NULL; @@ -2849,23 +2938,55 @@ SiS_GetCRT2DataLVDS(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, SiS_Pr->SiS_RY4COE = 0; } - if((SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { + if((SiS_Pr->SiS_VBType & VB_SISVB) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { #ifdef SIS315H - SiS_GetCRT2PtrA(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex, - &CRT2Index,&ResIndex); - - switch (CRT2Index) { - case 0: LVDSData = SiS_Pr->SiS_LCDA1024x768Data_1; break; - case 1: LVDSData = SiS_Pr->SiS_LCDA1280x1024Data_1; break; - case 3: LVDSData = SiS_Pr->SiS_LCDA1400x1050Data_1; break; - case 4: LVDSData = SiS_Pr->SiS_LCDA1600x1200Data_1; break; - case 5: LVDSData = SiS_Pr->SiS_LCDA1024x768Data_2; break; - case 6: LVDSData = SiS_Pr->SiS_LCDA1280x1024Data_2; break; - case 8: LVDSData = SiS_Pr->SiS_LCDA1400x1050Data_2; break; - case 9: LVDSData = SiS_Pr->SiS_LCDA1600x1200Data_2; break; - default: LVDSData = SiS_Pr->SiS_LCDA1024x768Data_1; break; + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + if(SiS_Pr->SiS_LCDInfo & LCDPass11) { + if(SiS_Pr->UseCustomMode) { + SiS_Pr->SiS_VGAHT = SiS_Pr->SiS_HT = SiS_Pr->CHTotal; + SiS_Pr->SiS_VGAVT = SiS_Pr->SiS_VT = SiS_Pr->CVTotal; + } else { + if(ModeNo < 0x13) { + ResIndex = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + } else { + ResIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC_NS; + /* Special for our 3 types, others custom (works with default) */ + if((SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].XRes == 1280) && + (SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].YRes == 768)) { + if(SiS_Pr->SiS_LCDResInfo == Panel_1280x768) ResIndex = 0x08; + else if(SiS_Pr->SiS_LCDResInfo == Panel_1280x768_2) ResIndex = 0x0f; + else if(SiS_Pr->SiS_LCDResInfo == Panel_1280x768_3) ResIndex = 0x10; + } + /* Special for 1280x720 TMDS <> LVDS */ + if((SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].XRes == 1280) && + (SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].YRes == 720)) { + if(SiS_Pr->SiS_LCDResInfo == Panel_1280x720) { + if(SiS_Pr->PanelHT == 1344) ResIndex = 0x12; + } + } + } + SiS_Pr->SiS_VGAHT = SiS_Pr->SiS_NoScaleData[ResIndex].VGAHT; + SiS_Pr->SiS_VGAVT = SiS_Pr->SiS_NoScaleData[ResIndex].VGAVT; + SiS_Pr->SiS_HT = SiS_Pr->SiS_NoScaleData[ResIndex].LCDHT; + SiS_Pr->SiS_VT = SiS_Pr->SiS_NoScaleData[ResIndex].LCDVT; + } + } else { + SiS_Pr->SiS_VGAHT = SiS_Pr->SiS_HT = SiS_Pr->PanelHT; + SiS_Pr->SiS_VGAVT = SiS_Pr->SiS_VT = SiS_Pr->PanelVT; + } + } else { + /* This handles custom modes and custom panels */ + SiS_Pr->SiS_HDE = SiS_Pr->PanelXRes; + SiS_Pr->SiS_VDE = SiS_Pr->PanelYRes; + SiS_Pr->SiS_HT = SiS_Pr->PanelHT; + SiS_Pr->SiS_VT = SiS_Pr->PanelVT; + SiS_Pr->SiS_VGAHT = SiS_Pr->PanelHT - (SiS_Pr->PanelXRes - SiS_Pr->SiS_VGAHDE); + SiS_Pr->SiS_VGAVT = SiS_Pr->PanelVT - (SiS_Pr->PanelYRes - SiS_Pr->SiS_VGAVDE); } + + SiS_CalcLCDACRT1Timing(SiS_Pr,ModeNo,ModeIdIndex); + #endif } else { @@ -2876,7 +2997,7 @@ SiS_GetCRT2DataLVDS(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, } SiS_GetCRT2Ptr(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, - &CRT2Index, &ResIndex, HwInfo); + &CRT2Index, &ResIndex, HwInfo); /* 301BDH needs LVDS Data */ if((SiS_Pr->SiS_VBType & VB_NoLCD) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) { @@ -2884,72 +3005,59 @@ SiS_GetCRT2DataLVDS(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, } switch (CRT2Index) { - case 0: LVDSData = SiS_Pr->SiS_LVDS800x600Data_1; break; - case 1: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_1; break; - case 2: LVDSData = SiS_Pr->SiS_LVDS1280x1024Data_1; break; - case 3: LVDSData = SiS_Pr->SiS_LVDS800x600Data_2; break; - case 4: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_2; break; - case 5: LVDSData = SiS_Pr->SiS_LVDS1280x1024Data_2; break; - case 6: LVDSData = SiS_Pr->SiS_LVDS640x480Data_1; break; - case 7: LVDSData = SiS_Pr->SiS_LVDSXXXxXXXData_1; break; - case 8: LVDSData = SiS_Pr->SiS_LVDS1400x1050Data_1; break; - case 9: LVDSData = SiS_Pr->SiS_LVDS1400x1050Data_2; break; - case 10: LVDSData = SiS_Pr->SiS_CHTVUNTSCData; break; - case 11: LVDSData = SiS_Pr->SiS_CHTVONTSCData; break; - case 12: LVDSData = SiS_Pr->SiS_CHTVUPALData; break; - case 13: LVDSData = SiS_Pr->SiS_CHTVOPALData; break; - case 14: LVDSData = SiS_Pr->SiS_LVDS320x480Data_1; break; - case 15: LVDSData = SiS_Pr->SiS_LVDS1024x600Data_1; break; - case 16: LVDSData = SiS_Pr->SiS_LVDS1152x768Data_1; break; - case 17: LVDSData = SiS_Pr->SiS_LVDS1024x600Data_2; break; - case 18: LVDSData = SiS_Pr->SiS_LVDS1152x768Data_2; break; - case 19: LVDSData = SiS_Pr->SiS_LVDS1280x768Data_1; break; - case 20: LVDSData = SiS_Pr->SiS_LVDS1280x768Data_2; break; - case 21: LVDSData = SiS_Pr->SiS_LVDS1600x1200Data_1; break; - case 22: LVDSData = SiS_Pr->SiS_LVDS1600x1200Data_2; break; - case 30: LVDSData = SiS_Pr->SiS_LVDS640x480Data_2; break; - case 80: LVDSData = SiS_Pr->SiS_LVDSBARCO1366Data_1; break; - case 81: LVDSData = SiS_Pr->SiS_LVDSBARCO1366Data_2; break; - case 82: LVDSData = SiS_Pr->SiS_LVDSBARCO1024Data_1; break; - case 83: LVDSData = SiS_Pr->SiS_LVDSBARCO1024Data_2; break; - case 84: LVDSData = SiS_Pr->SiS_LVDS848x480Data_1; break; - case 85: LVDSData = SiS_Pr->SiS_LVDS848x480Data_2; break; - case 90: LVDSData = SiS_Pr->SiS_CHTVUPALMData; break; - case 91: LVDSData = SiS_Pr->SiS_CHTVOPALMData; break; - case 92: LVDSData = SiS_Pr->SiS_CHTVUPALNData; break; - case 93: LVDSData = SiS_Pr->SiS_CHTVOPALNData; break; - case 99: LVDSData = SiS_Pr->SiS_CHTVSOPALData; break; /* Super Overscan */ - default: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_1; break; + case 0: LVDSData = SiS_Pr->SiS_LVDS800x600Data_1; break; + case 1: LVDSData = SiS_Pr->SiS_LVDS800x600Data_2; break; + case 2: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_1; break; + case 3: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_2; break; + case 4: LVDSData = SiS_Pr->SiS_LVDS1280x1024Data_1; break; + case 5: LVDSData = SiS_Pr->SiS_LVDS1280x1024Data_2; break; + case 6: LVDSData = SiS_Pr->SiS_LVDS640x480Data_1; break; + case 7: LVDSData = SiS_Pr->SiS_LVDSXXXxXXXData_1; break; + case 8: LVDSData = SiS_Pr->SiS_LVDS1400x1050Data_1; break; + case 9: LVDSData = SiS_Pr->SiS_LVDS1400x1050Data_2; break; + case 10: LVDSData = SiS_Pr->SiS_CHTVUNTSCData; break; + case 11: LVDSData = SiS_Pr->SiS_CHTVONTSCData; break; + case 12: LVDSData = SiS_Pr->SiS_CHTVUPALData; break; + case 13: LVDSData = SiS_Pr->SiS_CHTVOPALData; break; + case 14: LVDSData = SiS_Pr->SiS_LVDS320x480Data_1; break; + case 15: LVDSData = SiS_Pr->SiS_LVDS1024x600Data_1; break; + case 16: LVDSData = SiS_Pr->SiS_LVDS1024x600Data_2; break; + case 17: LVDSData = SiS_Pr->SiS_LVDS1152x768Data_1; break; + case 18: LVDSData = SiS_Pr->SiS_LVDS1152x768Data_2; break; + case 19: LVDSData = SiS_Pr->SiS_LVDS1280x768Data_1; break; + case 20: LVDSData = SiS_Pr->SiS_LVDS1280x768Data_2; break; + case 21: LVDSData = SiS_Pr->SiS_LVDS1600x1200Data_1; break; + case 22: LVDSData = SiS_Pr->SiS_LVDS1600x1200Data_2; break; + case 30: LVDSData = SiS_Pr->SiS_LVDS640x480Data_2; break; + case 80: LVDSData = SiS_Pr->SiS_LVDSBARCO1366Data_1; break; + case 81: LVDSData = SiS_Pr->SiS_LVDSBARCO1366Data_2; break; + case 82: LVDSData = SiS_Pr->SiS_LVDSBARCO1024Data_1; break; + case 83: LVDSData = SiS_Pr->SiS_LVDSBARCO1024Data_2; break; + case 84: LVDSData = SiS_Pr->SiS_LVDS848x480Data_1; break; + case 85: LVDSData = SiS_Pr->SiS_LVDS848x480Data_2; break; + case 90: LVDSData = SiS_Pr->SiS_CHTVUPALMData; break; + case 91: LVDSData = SiS_Pr->SiS_CHTVOPALMData; break; + case 92: LVDSData = SiS_Pr->SiS_CHTVUPALNData; break; + case 93: LVDSData = SiS_Pr->SiS_CHTVOPALNData; break; + case 99: LVDSData = SiS_Pr->SiS_CHTVSOPALData; break; /* Super Overscan */ + default: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_1; break; } - } - SiS_Pr->SiS_VGAHT = (LVDSData+ResIndex)->VGAHT; - SiS_Pr->SiS_VGAVT = (LVDSData+ResIndex)->VGAVT; - SiS_Pr->SiS_HT = (LVDSData+ResIndex)->LCDHT; - SiS_Pr->SiS_VT = (LVDSData+ResIndex)->LCDVT; + SiS_Pr->SiS_VGAHT = (LVDSData+ResIndex)->VGAHT; + SiS_Pr->SiS_VGAVT = (LVDSData+ResIndex)->VGAVT; + SiS_Pr->SiS_HT = (LVDSData+ResIndex)->LCDHT; + SiS_Pr->SiS_VT = (LVDSData+ResIndex)->LCDVT; - if(SiS_Pr->SiS_VBType & VB_SISVB) { - - if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) { - SiS_Pr->SiS_HDE = SiS_Pr->PanelXRes; - SiS_Pr->SiS_VDE = SiS_Pr->PanelYRes; - } - - } else { - - if(SiS_Pr->SiS_IF_DEF_TRUMPION == 0) { + if(!(SiS_Pr->SiS_VBType & VB_SISVB)) { if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) && (!(SiS_Pr->SiS_LCDInfo & LCDPass11))) { - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) { - if((!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) || (SiS_Pr->SiS_SetFlag & SetDOSMode)) { - SiS_Pr->SiS_HDE = SiS_Pr->PanelXRes; - SiS_Pr->SiS_VDE = SiS_Pr->PanelYRes; - - if(SiS_Pr->SiS_CustomT == CUT_BARCO1366) { - if(ResIndex < 0x08) { - SiS_Pr->SiS_HDE = 1280; - SiS_Pr->SiS_VDE = 1024; - } - } + if((!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) || (SiS_Pr->SiS_SetFlag & SetDOSMode)) { + SiS_Pr->SiS_HDE = SiS_Pr->PanelXRes; + SiS_Pr->SiS_VDE = SiS_Pr->PanelYRes; + if(SiS_Pr->SiS_CustomT == CUT_BARCO1366) { + if(ResIndex < 0x08) { + SiS_Pr->SiS_HDE = 1280; + SiS_Pr->SiS_VDE = 1024; + } } } } @@ -2971,14 +3079,12 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, if(ModeNo <= 0x13) { modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo; + } else if(SiS_Pr->UseCustomMode) { + modeflag = SiS_Pr->CModeFlag; + resinfo = 0; } else { - if(SiS_Pr->UseCustomMode) { - modeflag = SiS_Pr->CModeFlag; - resinfo = 0; - } else { - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; - } + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; } SiS_Pr->SiS_NewFlickerMode = 0; @@ -3006,102 +3112,114 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, } else { SiS_GetRAMDAC2DATA(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo); + } } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { - SiS_GetCRT2Ptr(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex, - &CRT2Index,&ResIndex,HwInfo); - - switch(CRT2Index) { - case 2: TVPtr = SiS_Pr->SiS_ExtHiTVData; break; -/* case 7: TVPtr = SiS_Pr->SiS_St1HiTVData; break; */ - case 12: TVPtr = SiS_Pr->SiS_St2HiTVData; break; - case 3: TVPtr = SiS_Pr->SiS_ExtPALData; break; - case 4: TVPtr = SiS_Pr->SiS_ExtNTSCData; break; - case 8: TVPtr = SiS_Pr->SiS_StPALData; break; - case 9: TVPtr = SiS_Pr->SiS_StNTSCData; break; - default: TVPtr = SiS_Pr->SiS_StPALData; break; - } + SiS_GetCRT2Ptr(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex, + &CRT2Index,&ResIndex,HwInfo); + + switch(CRT2Index) { + case 2: TVPtr = SiS_Pr->SiS_ExtHiTVData; break; + case 3: TVPtr = SiS_Pr->SiS_ExtPALData; break; + case 4: TVPtr = SiS_Pr->SiS_ExtNTSCData; break; + case 5: TVPtr = SiS_Pr->SiS_Ext525iData; break; + case 6: TVPtr = SiS_Pr->SiS_Ext525pData; break; + case 7: TVPtr = SiS_Pr->SiS_Ext750pData; break; + case 8: TVPtr = SiS_Pr->SiS_StPALData; break; + case 9: TVPtr = SiS_Pr->SiS_StNTSCData; break; + case 10: TVPtr = SiS_Pr->SiS_St525iData; break; + case 11: TVPtr = SiS_Pr->SiS_St525pData; break; + case 12: TVPtr = SiS_Pr->SiS_St750pData; break; + case 13: TVPtr = SiS_Pr->SiS_St1HiTVData; break; + case 14: TVPtr = SiS_Pr->SiS_St2HiTVData; break; + default: TVPtr = SiS_Pr->SiS_StPALData; break; + } + + SiS_Pr->SiS_RVBHCMAX = (TVPtr+ResIndex)->RVBHCMAX; + SiS_Pr->SiS_RVBHCFACT = (TVPtr+ResIndex)->RVBHCFACT; + SiS_Pr->SiS_VGAHT = (TVPtr+ResIndex)->VGAHT; + SiS_Pr->SiS_VGAVT = (TVPtr+ResIndex)->VGAVT; + SiS_Pr->SiS_HDE = (TVPtr+ResIndex)->TVHDE; + SiS_Pr->SiS_VDE = (TVPtr+ResIndex)->TVVDE; + SiS_Pr->SiS_RVBHRS = (TVPtr+ResIndex)->RVBHRS; + SiS_Pr->SiS_NewFlickerMode = (TVPtr+ResIndex)->FlickerMode; + if(modeflag & HalfDCLK) { + SiS_Pr->SiS_RVBHRS = (TVPtr+ResIndex)->HALFRVBHRS; + } - SiS_Pr->SiS_RVBHCMAX = (TVPtr+ResIndex)->RVBHCMAX; - SiS_Pr->SiS_RVBHCFACT = (TVPtr+ResIndex)->RVBHCFACT; - SiS_Pr->SiS_VGAHT = (TVPtr+ResIndex)->VGAHT; - SiS_Pr->SiS_VGAVT = (TVPtr+ResIndex)->VGAVT; - SiS_Pr->SiS_HDE = (TVPtr+ResIndex)->TVHDE; - SiS_Pr->SiS_VDE = (TVPtr+ResIndex)->TVVDE; - SiS_Pr->SiS_RVBHRS = (TVPtr+ResIndex)->RVBHRS; - SiS_Pr->SiS_NewFlickerMode = (TVPtr+ResIndex)->FlickerMode; - if(modeflag & HalfDCLK) { - SiS_Pr->SiS_RVBHRS = (TVPtr+ResIndex)->HALFRVBHRS; - } + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) { - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { - - if(SiS_Pr->SiS_HiVision != 3) { - if(resinfo == SIS_RI_1024x768) SiS_Pr->SiS_NewFlickerMode = 0x40; - if(resinfo == SIS_RI_1280x1024) SiS_Pr->SiS_NewFlickerMode = 0x40; - if(resinfo == SIS_RI_1280x720) SiS_Pr->SiS_NewFlickerMode = 0x40; - } - - switch(SiS_Pr->SiS_HiVision) { - case 2: - case 1: - case 0: - SiS_Pr->SiS_HT = 0x6b4; - SiS_Pr->SiS_VT = 0x20d; - /* Don't care about TVSimuMode */ - break; - default: - if(SiS_Pr->SiS_VGAVDE == 350) SiS_Pr->SiS_TVMode |= TVSetTVSimuMode; - - SiS_Pr->SiS_HT = ExtHiTVHT; - SiS_Pr->SiS_VT = ExtHiTVVT; - if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { - if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) { - SiS_Pr->SiS_HT = StHiTVHT; - SiS_Pr->SiS_VT = StHiTVVT; - if(!(modeflag & Charx8Dot)){ - SiS_Pr->SiS_HT = StHiTextTVHT; - SiS_Pr->SiS_VT = StHiTextTVVT; - } - } - } - } + if((resinfo == SIS_RI_1024x768) || + (resinfo == SIS_RI_1280x1024) || + (resinfo == SIS_RI_1280x720)) { + SiS_Pr->SiS_NewFlickerMode = 0x40; + } - } else { + if(SiS_Pr->SiS_VGAVDE == 350) SiS_Pr->SiS_TVMode |= TVSetTVSimuMode; - SiS_Pr->SiS_RY1COE = (TVPtr+ResIndex)->RY1COE; - SiS_Pr->SiS_RY2COE = (TVPtr+ResIndex)->RY2COE; - SiS_Pr->SiS_RY3COE = (TVPtr+ResIndex)->RY3COE; - SiS_Pr->SiS_RY4COE = (TVPtr+ResIndex)->RY4COE; + SiS_Pr->SiS_HT = ExtHiTVHT; + SiS_Pr->SiS_VT = ExtHiTVVT; + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) { + SiS_Pr->SiS_HT = StHiTVHT; + SiS_Pr->SiS_VT = StHiTVVT; +#if 0 + if(!(modeflag & Charx8Dot)) { + SiS_Pr->SiS_HT = StHiTextTVHT; + SiS_Pr->SiS_VT = StHiTextTVVT; + } +#endif + } + } - if(modeflag & HalfDCLK) { - SiS_Pr->SiS_RY1COE = 0x00; - SiS_Pr->SiS_RY2COE = 0xf4; - SiS_Pr->SiS_RY3COE = 0x10; - SiS_Pr->SiS_RY4COE = 0x38; - } + } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) { - if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) { - SiS_Pr->SiS_HT = NTSCHT; - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - if((ModeNo == 0x64) || (ModeNo == 0x4a) || (ModeNo == 0x38)) SiS_Pr->SiS_HT = NTSC2HT; - } - SiS_Pr->SiS_VT = NTSCVT; - } else { - SiS_Pr->SiS_HT = PALHT; - SiS_Pr->SiS_VT = PALVT; - } + if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) { + SiS_Pr->SiS_HT = 1650; + SiS_Pr->SiS_VT = 750; + } else if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) { + SiS_Pr->SiS_HT = NTSCHT; + SiS_Pr->SiS_VT = NTSCVT; + } else { + SiS_Pr->SiS_HT = NTSCHT; + if(SiS_Pr->SiS_TVMode & TVSetNTSC1024) SiS_Pr->SiS_HT = NTSC2HT; + SiS_Pr->SiS_VT = NTSCVT; + } - } + } else { + + SiS_Pr->SiS_RY1COE = (TVPtr+ResIndex)->RY1COE; + SiS_Pr->SiS_RY2COE = (TVPtr+ResIndex)->RY2COE; + SiS_Pr->SiS_RY3COE = (TVPtr+ResIndex)->RY3COE; + SiS_Pr->SiS_RY4COE = (TVPtr+ResIndex)->RY4COE; + + if(modeflag & HalfDCLK) { + SiS_Pr->SiS_RY1COE = 0x00; + SiS_Pr->SiS_RY2COE = 0xf4; + SiS_Pr->SiS_RY3COE = 0x10; + SiS_Pr->SiS_RY4COE = 0x38; + } + + if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) { + SiS_Pr->SiS_HT = NTSCHT; + if(SiS_Pr->SiS_TVMode & TVSetNTSC1024) SiS_Pr->SiS_HT = NTSC2HT; + SiS_Pr->SiS_VT = NTSCVT; + } else { + SiS_Pr->SiS_HT = PALHT; + SiS_Pr->SiS_VT = PALVT; + } + + } } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + SiS_Pr->SiS_RVBHCMAX = 1; + SiS_Pr->SiS_RVBHCFACT = 1; + if(SiS_Pr->UseCustomMode) { - SiS_Pr->SiS_RVBHCMAX = 1; - SiS_Pr->SiS_RVBHCFACT = 1; SiS_Pr->SiS_VGAHT = SiS_Pr->CHTotal; SiS_Pr->SiS_VGAVT = SiS_Pr->CVTotal; SiS_Pr->SiS_HT = SiS_Pr->CHTotal; @@ -3111,58 +3229,68 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, } else { - SiS_GetCRT2Ptr(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex, - &CRT2Index,&ResIndex,HwInfo); - - switch(CRT2Index) { - case 0: LCDPtr = SiS_Pr->SiS_ExtLCD1024x768Data; break; /* VESA Timing */ - case 1: LCDPtr = SiS_Pr->SiS_ExtLCD1280x1024Data; break; /* VESA Timing */ - case 5: LCDPtr = SiS_Pr->SiS_StLCD1024x768Data; break; /* Obviously unused */ - case 6: LCDPtr = SiS_Pr->SiS_StLCD1280x1024Data; break; /* Obviously unused */ - case 10: LCDPtr = SiS_Pr->SiS_St2LCD1024x768Data; break; /* Non-VESA Timing */ - case 11: LCDPtr = SiS_Pr->SiS_St2LCD1280x1024Data; break; /* Non-VESA Timing */ - case 13: LCDPtr = SiS_Pr->SiS_NoScaleData1024x768; break; /* Non-expanding */ - case 14: LCDPtr = SiS_Pr->SiS_NoScaleData1280x1024; break; /* Non-expanding */ - case 15: LCDPtr = SiS_Pr->SiS_LCD1280x960Data; break; /* 1280x960 */ - case 20: LCDPtr = SiS_Pr->SiS_ExtLCD1400x1050Data; break; /* VESA Timing */ - case 21: LCDPtr = SiS_Pr->SiS_NoScaleData1400x1050; break; /* Non-expanding (let panel scale) */ - case 22: LCDPtr = SiS_Pr->SiS_StLCD1400x1050Data; break; /* Non-VESA Timing (let panel scale) */ - case 23: LCDPtr = SiS_Pr->SiS_ExtLCD1600x1200Data; break; /* VESA Timing */ - case 24: LCDPtr = SiS_Pr->SiS_NoScaleData1600x1200; break; /* Non-expanding */ - case 25: LCDPtr = SiS_Pr->SiS_StLCD1600x1200Data; break; /* Non-VESA Timing */ - case 26: LCDPtr = SiS_Pr->SiS_ExtLCD1280x768Data; break; /* VESA Timing */ - case 27: LCDPtr = SiS_Pr->SiS_NoScaleData1280x768; break; /* Non-expanding */ - case 28: LCDPtr = SiS_Pr->SiS_StLCD1280x768Data; break; /* Non-VESA Timing */ - case 29: LCDPtr = SiS_Pr->SiS_NoScaleData; break; /* Generic no-scale data */ + if((SiS_Pr->SiS_LCDInfo & DontExpandLCD) && (!(SiS_Pr->SiS_LCDInfo & LCDPass11))) { + + SiS_Pr->SiS_VGAHT = SiS_Pr->PanelHT; + SiS_Pr->SiS_VGAVT = SiS_Pr->PanelVT; + SiS_Pr->SiS_HT = SiS_Pr->PanelHT; + SiS_Pr->SiS_VT = SiS_Pr->PanelVT; + + } else { + + SiS_GetCRT2Ptr(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex, + &CRT2Index,&ResIndex,HwInfo); + + switch(CRT2Index) { + case Panel_1024x768 : LCDPtr = SiS_Pr->SiS_ExtLCD1024x768Data; break; + case Panel_1024x768 + 32: LCDPtr = SiS_Pr->SiS_St2LCD1024x768Data; break; + case Panel_1280x720 : + case Panel_1280x720 + 32: LCDPtr = SiS_Pr->SiS_LCD1280x720Data; break; + case Panel_1280x768_2 : LCDPtr = SiS_Pr->SiS_ExtLCD1280x768_2Data; break; + case Panel_1280x768_2+ 32: LCDPtr = SiS_Pr->SiS_StLCD1280x768_2Data; break; + case Panel_1280x768_3 : + case Panel_1280x768_3+ 32: LCDPtr = SiS_Pr->SiS_LCD1280x768_3Data; break; + case Panel_1280x800 : + case Panel_1280x800 + 32: LCDPtr = SiS_Pr->SiS_LCD1280x800Data; break; + case Panel_1280x960 : + case Panel_1280x960 + 32: LCDPtr = SiS_Pr->SiS_LCD1280x960Data; break; + case Panel_1280x1024 : LCDPtr = SiS_Pr->SiS_ExtLCD1280x1024Data; break; + case Panel_1280x1024 + 32: LCDPtr = SiS_Pr->SiS_St2LCD1280x1024Data; break; + case Panel_1400x1050 : LCDPtr = SiS_Pr->SiS_ExtLCD1400x1050Data; break; + case Panel_1400x1050 + 32: LCDPtr = SiS_Pr->SiS_StLCD1400x1050Data; break; + case Panel_1600x1200 : LCDPtr = SiS_Pr->SiS_ExtLCD1600x1200Data; break; + case Panel_1600x1200 + 32: LCDPtr = SiS_Pr->SiS_StLCD1600x1200Data; break; + case Panel_1680x1050 : + case Panel_1680x1050 + 32: LCDPtr = SiS_Pr->SiS_LCD1680x1050Data; break; + case 100 : LCDPtr = SiS_Pr->SiS_NoScaleData; break; #ifdef SIS315H - case 50: LCDPtr = (SiS_LCDDataStruct *)SiS310_ExtCompaq1280x1024Data; break; - case 51: LCDPtr = SiS_Pr->SiS_NoScaleData1280x1024; break; - case 52: LCDPtr = SiS_Pr->SiS_St2LCD1280x1024Data; break; + case 200 : LCDPtr = SiS310_ExtCompaq1280x1024Data; break; + case 201 : LCDPtr = SiS_Pr->SiS_St2LCD1280x1024Data; break; #endif - default: LCDPtr = SiS_Pr->SiS_ExtLCD1024x768Data; break; - } - - SiS_Pr->SiS_RVBHCMAX = (LCDPtr+ResIndex)->RVBHCMAX; - SiS_Pr->SiS_RVBHCFACT = (LCDPtr+ResIndex)->RVBHCFACT; - SiS_Pr->SiS_VGAHT = (LCDPtr+ResIndex)->VGAHT; - SiS_Pr->SiS_VGAVT = (LCDPtr+ResIndex)->VGAVT; - SiS_Pr->SiS_HT = (LCDPtr+ResIndex)->LCDHT; - SiS_Pr->SiS_VT = (LCDPtr+ResIndex)->LCDVT; + default : LCDPtr = SiS_Pr->SiS_ExtLCD1024x768Data; break; + } #ifdef TWDEBUG - xf86DrvMsg(0, X_INFO, - "GetCRT2Data: Index %d ResIndex %d\n", CRT2Index, ResIndex); + xf86DrvMsg(0, X_INFO, "GetCRT2Data: Index %d ResIndex %d\n", CRT2Index, ResIndex); #endif - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { - tempax = 1024; + SiS_Pr->SiS_RVBHCMAX = (LCDPtr+ResIndex)->RVBHCMAX; + SiS_Pr->SiS_RVBHCFACT = (LCDPtr+ResIndex)->RVBHCFACT; + SiS_Pr->SiS_VGAHT = (LCDPtr+ResIndex)->VGAHT; + SiS_Pr->SiS_VGAVT = (LCDPtr+ResIndex)->VGAVT; + SiS_Pr->SiS_HT = (LCDPtr+ResIndex)->LCDHT; + SiS_Pr->SiS_VT = (LCDPtr+ResIndex)->LCDVT; + + } + + tempax = SiS_Pr->PanelXRes; + tempbx = SiS_Pr->PanelYRes; + + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { if(SiS_Pr->SiS_SetFlag & LCDVESATiming) { if(HwInfo->jChipType < SIS_315H) { if (SiS_Pr->SiS_VGAVDE == 350) tempbx = 560; else if(SiS_Pr->SiS_VGAVDE == 400) tempbx = 640; - else tempbx = 768; - } else { - tempbx = 768; } } else { if (SiS_Pr->SiS_VGAVDE == 357) tempbx = 527; @@ -3171,43 +3299,27 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, else if(SiS_Pr->SiS_VGAVDE == 600) tempbx = 775; else if(SiS_Pr->SiS_VGAVDE == 350) tempbx = 560; else if(SiS_Pr->SiS_VGAVDE == 400) tempbx = 640; - else tempbx = 768; } - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { - tempax = 1280; - if (SiS_Pr->SiS_VGAVDE == 360) tempbx = 768; - else if(SiS_Pr->SiS_VGAVDE == 375) tempbx = 800; - else if(SiS_Pr->SiS_VGAVDE == 405) tempbx = 864; - else tempbx = 1024; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) { - tempax = 1280; + } else if(SiS_Pr->SiS_LCDResInfo == Panel_1280x960) { if (SiS_Pr->SiS_VGAVDE == 350) tempbx = 700; else if(SiS_Pr->SiS_VGAVDE == 400) tempbx = 800; else if(SiS_Pr->SiS_VGAVDE == 1024) tempbx = 960; - else tempbx = 960; - } else if((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) && - (HwInfo->jChipType >= SIS_661)) { - tempax = 1400; - tempbx = 1050; - if(SiS_Pr->SiS_VGAVDE == 1024) { - tempax = 1280; - tempbx = 1024; - } - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) { - tempax = 1600; - tempbx = 1200; - if((HwInfo->jChipType < SIS_661) || (!(SiS_Pr->SiS_SetFlag & LCDVESATiming))) { + } else if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) { + if (SiS_Pr->SiS_VGAVDE == 360) tempbx = 768; + else if(SiS_Pr->SiS_VGAVDE == 375) tempbx = 800; + else if(SiS_Pr->SiS_VGAVDE == 405) tempbx = 864; + } else if(SiS_Pr->SiS_LCDResInfo == Panel_1600x1200) { + if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) { if (SiS_Pr->SiS_VGAVDE == 350) tempbx = 875; else if(SiS_Pr->SiS_VGAVDE == 400) tempbx = 1000; } - } else { - tempax = SiS_Pr->PanelXRes; - tempbx = SiS_Pr->PanelYRes; - } + } + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { tempax = SiS_Pr->SiS_VGAHDE; tempbx = SiS_Pr->SiS_VGAVDE; } + SiS_Pr->SiS_HDE = tempax; SiS_Pr->SiS_VDE = tempbx; } @@ -3221,31 +3333,15 @@ SiS_GetCRT2Data(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, if(SiS_Pr->SiS_VBType & VB_SISVB) { - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { - - SiS_GetCRT2DataLVDS(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo); - - } else { - - if((SiS_Pr->SiS_VBType & VB_NoLCD) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) { - - /* Need LVDS Data for LCD on 301B-DH */ - SiS_GetCRT2DataLVDS(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo); - - } else { - - SiS_GetCRT2Data301(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo); - - } - - } - + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + SiS_GetCRT2DataLVDS(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo); } else { - - SiS_GetCRT2Data301(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo); - + if((SiS_Pr->SiS_VBType & VB_NoLCD) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) { + /* Need LVDS Data for LCD on 301B-DH */ + SiS_GetCRT2DataLVDS(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo); + } else { + SiS_GetCRT2Data301(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo); + } } } else { @@ -3256,7 +3352,7 @@ SiS_GetCRT2Data(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } /*********************************************/ -/* GET LVDS DES DATA */ +/* GET LVDS DES (SKEW) DATA */ /*********************************************/ static void @@ -3264,100 +3360,55 @@ SiS_GetLVDSDesPtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, USHORT *PanelIndex, USHORT *ResIndex, PSIS_HW_INFO HwInfo) { - USHORT tempbx,tempal,modeflag; + USHORT modeflag; if(ModeNo <= 0x13) { modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - tempal = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + (*ResIndex) = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; } else { modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - tempal = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; + (*ResIndex) = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; } - tempbx = 0; + (*ResIndex) &= 0x1F; + (*PanelIndex) = 0; + if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { - tempbx = 50; - if((SiS_Pr->SiS_TVMode & TVSetPAL) && (!(SiS_Pr->SiS_TVMode & TVSetPALM))) tempbx += 2; - if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) tempbx += 1; + (*PanelIndex) = 50; + if((SiS_Pr->SiS_TVMode & TVSetPAL) && (!(SiS_Pr->SiS_TVMode & TVSetPALM))) (*PanelIndex) += 2; + if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) (*PanelIndex) += 1; /* Nothing special needed for SOverscan */ - /* PALM uses NTSC data, PALN uses PAL data */ + /* PALM uses NTSC data, PALN uses PAL data */ } } if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - tempbx = SiS_Pr->SiS_LCDTypeInfo; + *PanelIndex = SiS_Pr->SiS_LCDTypeInfo; if(HwInfo->jChipType >= SIS_661) { /* As long as we don's use the BIOS tables, we * need to convert the TypeInfo as for 315 series */ - tempbx = SiS_Pr->SiS_LCDResInfo - 1; + (*PanelIndex) = SiS_Pr->SiS_LCDResInfo - 1; } - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 16; - if(SiS_Pr->SiS_LCDInfo & LCDPass11) { - tempbx = 32; - if(modeflag & HalfDCLK) tempbx++; + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + (*PanelIndex) += 16; + if(SiS_Pr->SiS_LCDInfo & LCDPass11) { + (*PanelIndex) = 32; + if(modeflag & HalfDCLK) (*PanelIndex)++; + } } } if(SiS_Pr->SiS_SetFlag & SetDOSMode) { - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) { - tempal = 0x07; + if(SiS_Pr->SiS_LCDResInfo != Panel_640x480) { + (*ResIndex) = 7; if(HwInfo->jChipType < SIS_315H) { - if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x13) & 0x80) tempal++; + if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x13) & 0x80) (*ResIndex)++; } } } - - *PanelIndex = tempbx; - *ResIndex = tempal & 0x1F; -} - -#ifdef SIS315H -static void -SiS_GetLVDSDesPtrA(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, USHORT *PanelIndex, USHORT *ResIndex, - PSIS_HW_INFO HwInfo) -{ - USHORT tempbx=0,tempal; - - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempbx = 2; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempbx = 3; - else tempbx = SiS_Pr->SiS_LCDResInfo - 2; - - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 4; - - if(SiS_Pr->SiS_CustomT == CUT_CLEVO1024) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { - if(SiS_IsDualLink(SiS_Pr, HwInfo)) { - tempbx = 80; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++; - } - } - } - if((SiS_Pr->SiS_CustomT == CUT_UNIWILL1024) || - (SiS_Pr->SiS_CustomT == CUT_UNIWILL10242)) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { - tempbx = 82; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++; - } - } - if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { - tempbx = 84; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++; - } - } - - if(ModeNo <= 0x13) - tempal = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; - else - tempal = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; - - *PanelIndex = tempbx; - *ResIndex = tempal & 0x1F; } -#endif static void SiS_GetLVDSDesData(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex, @@ -3367,37 +3418,43 @@ SiS_GetLVDSDesData(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex, USHORT PanelIndex,ResIndex; const SiS_LVDSDesStruct *PanelDesPtr = NULL; - if((SiS_Pr->UseCustomMode) || - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_PanelCustom) || - (SiS_Pr->SiS_CustomT == CUT_PANEL848)) { - SiS_Pr->SiS_LCDHDES = 0; - SiS_Pr->SiS_LCDVDES = 0; + SiS_Pr->SiS_LCDHDES = 0; + SiS_Pr->SiS_LCDVDES = 0; + + if( (SiS_Pr->UseCustomMode) || + (SiS_Pr->SiS_LCDResInfo == Panel_Custom) || + (SiS_Pr->SiS_CustomT == CUT_PANEL848) || + ((SiS_Pr->SiS_VBType & VB_SISVB) && + (SiS_Pr->SiS_LCDInfo & DontExpandLCD) && + (SiS_Pr->SiS_LCDInfo & LCDPass11)) ) { return; } if((SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { #ifdef SIS315H - SiS_GetLVDSDesPtrA(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, - &PanelIndex, &ResIndex, HwInfo); - - switch (PanelIndex) - { - case 0: PanelDesPtr = SiS_Pr->LVDS1024x768Des_1; break; /* --- expanding --- */ - case 1: PanelDesPtr = SiS_Pr->LVDS1280x1024Des_1; break; - case 2: PanelDesPtr = SiS_Pr->LVDS1400x1050Des_1; break; - case 3: PanelDesPtr = SiS_Pr->LVDS1600x1200Des_1; break; - case 4: PanelDesPtr = SiS_Pr->LVDS1024x768Des_2; break; /* --- non expanding --- */ - case 5: PanelDesPtr = SiS_Pr->LVDS1280x1024Des_2; break; - case 6: PanelDesPtr = SiS_Pr->LVDS1400x1050Des_2; break; - case 7: PanelDesPtr = SiS_Pr->LVDS1600x1200Des_2; break; - case 80: PanelDesPtr = (SiS_LVDSDesStruct *)Clevo1024x768Des_1; break; /* custom */ - case 81: PanelDesPtr = (SiS_LVDSDesStruct *)Clevo1024x768Des_2; break; - case 82: PanelDesPtr = (SiS_LVDSDesStruct *)Uniwill1024x768Des_1; break; - case 83: PanelDesPtr = (SiS_LVDSDesStruct *)Uniwill1024x768Des_2; break; - case 84: PanelDesPtr = (SiS_LVDSDesStruct *)Compaq1280x1024Des_1; break; - case 85: PanelDesPtr = (SiS_LVDSDesStruct *)Compaq1280x1024Des_2; break; - default: PanelDesPtr = SiS_Pr->LVDS1024x768Des_1; break; + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + /* non-pass 1:1 only, see above */ + if(SiS_Pr->SiS_VGAVDE != SiS_Pr->PanelYRes) { + SiS_Pr->SiS_LCDHDES = SiS_Pr->SiS_HT - ((SiS_Pr->PanelXRes - SiS_Pr->SiS_VGAHDE) / 2); + SiS_Pr->SiS_LCDVDES = SiS_Pr->SiS_VT - ((SiS_Pr->PanelYRes - SiS_Pr->SiS_VGAVDE) / 2); + } + } + if(SiS_Pr->SiS_VGAVDE == SiS_Pr->PanelYRes) { + switch(SiS_Pr->SiS_CustomT) { + case CUT_UNIWILL1024: + case CUT_UNIWILL10242: + case CUT_CLEVO1400: + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { + SiS_Pr->SiS_LCDVDES = SiS_Pr->PanelVT - 1; + } + break; + } + if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) { + if(SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) { + SiS_Pr->SiS_LCDVDES = SiS_Pr->PanelVT - 1; + } + } } #endif @@ -3406,88 +3463,68 @@ SiS_GetLVDSDesData(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex, SiS_GetLVDSDesPtr(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, &PanelIndex, &ResIndex, HwInfo); - switch (PanelIndex) - { - case 0: PanelDesPtr = SiS_Pr->SiS_PanelType00_1; break; /* --- */ - case 1: PanelDesPtr = SiS_Pr->SiS_PanelType01_1; break; - case 2: PanelDesPtr = SiS_Pr->SiS_PanelType02_1; break; - case 3: PanelDesPtr = SiS_Pr->SiS_PanelType03_1; break; - case 4: PanelDesPtr = SiS_Pr->SiS_PanelType04_1; break; - case 5: PanelDesPtr = SiS_Pr->SiS_PanelType05_1; break; - case 6: PanelDesPtr = SiS_Pr->SiS_PanelType06_1; break; - case 7: PanelDesPtr = SiS_Pr->SiS_PanelType07_1; break; - case 8: PanelDesPtr = SiS_Pr->SiS_PanelType08_1; break; - case 9: PanelDesPtr = SiS_Pr->SiS_PanelType09_1; break; - case 10: PanelDesPtr = SiS_Pr->SiS_PanelType0a_1; break; - case 11: PanelDesPtr = SiS_Pr->SiS_PanelType0b_1; break; - case 12: PanelDesPtr = SiS_Pr->SiS_PanelType0c_1; break; - case 13: PanelDesPtr = SiS_Pr->SiS_PanelType0d_1; break; - case 14: PanelDesPtr = SiS_Pr->SiS_PanelType0e_1; break; - case 15: PanelDesPtr = SiS_Pr->SiS_PanelType0f_1; break; - case 16: PanelDesPtr = SiS_Pr->SiS_PanelType00_2; break; /* --- */ - case 17: PanelDesPtr = SiS_Pr->SiS_PanelType01_2; break; - case 18: PanelDesPtr = SiS_Pr->SiS_PanelType02_2; break; - case 19: PanelDesPtr = SiS_Pr->SiS_PanelType03_2; break; - case 20: PanelDesPtr = SiS_Pr->SiS_PanelType04_2; break; - case 21: PanelDesPtr = SiS_Pr->SiS_PanelType05_2; break; - case 22: PanelDesPtr = SiS_Pr->SiS_PanelType06_2; break; - case 23: PanelDesPtr = SiS_Pr->SiS_PanelType07_2; break; - case 24: PanelDesPtr = SiS_Pr->SiS_PanelType08_2; break; - case 25: PanelDesPtr = SiS_Pr->SiS_PanelType09_2; break; - case 26: PanelDesPtr = SiS_Pr->SiS_PanelType0a_2; break; - case 27: PanelDesPtr = SiS_Pr->SiS_PanelType0b_2; break; - case 28: PanelDesPtr = SiS_Pr->SiS_PanelType0c_2; break; - case 29: PanelDesPtr = SiS_Pr->SiS_PanelType0d_2; break; - case 30: PanelDesPtr = SiS_Pr->SiS_PanelType0e_2; break; - case 31: PanelDesPtr = SiS_Pr->SiS_PanelType0f_2; break; - case 32: PanelDesPtr = SiS_Pr->SiS_PanelTypeNS_1; break; /* pass 1:1 */ - case 33: PanelDesPtr = SiS_Pr->SiS_PanelTypeNS_2; break; - case 50: PanelDesPtr = SiS_Pr->SiS_CHTVUNTSCDesData; break; /* TV */ - case 51: PanelDesPtr = SiS_Pr->SiS_CHTVONTSCDesData; break; - case 52: PanelDesPtr = SiS_Pr->SiS_CHTVUPALDesData; break; - case 53: PanelDesPtr = SiS_Pr->SiS_CHTVOPALDesData; break; - default: - if(HwInfo->jChipType < SIS_315H) - PanelDesPtr = SiS_Pr->SiS_PanelType0e_1; - else - PanelDesPtr = SiS_Pr->SiS_PanelType01_1; - break; - } - } - SiS_Pr->SiS_LCDHDES = (PanelDesPtr+ResIndex)->LCDHDES; - SiS_Pr->SiS_LCDVDES = (PanelDesPtr+ResIndex)->LCDVDES; - - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD){ - if((SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { - if(ModeNo <= 0x13) { - modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - if(!(modeflag & HalfDCLK)) { - SiS_Pr->SiS_LCDHDES = 632; - } - } - } else { - if(!(SiS_Pr->SiS_SetFlag & SetDOSMode)) { - if( (HwInfo->jChipType < SIS_315H) || - (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x1024) ) { - if(SiS_Pr->SiS_LCDResInfo >= SiS_Pr->SiS_Panel1024x768){ - if(ModeNo <= 0x13) { - modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - if(HwInfo->jChipType < SIS_315H) { - if(!(modeflag & HalfDCLK)) SiS_Pr->SiS_LCDHDES = 320; - } else { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) - SiS_Pr->SiS_LCDHDES = 480; - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) - SiS_Pr->SiS_LCDHDES = 804; - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) - SiS_Pr->SiS_LCDHDES = 704; - if(!(modeflag & HalfDCLK)) { - SiS_Pr->SiS_LCDHDES = 320; - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) - SiS_Pr->SiS_LCDHDES = 632; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) - SiS_Pr->SiS_LCDHDES = 542; - } + switch(PanelIndex) { + case 0: PanelDesPtr = SiS_Pr->SiS_PanelType00_1; break; /* --- */ + case 1: PanelDesPtr = SiS_Pr->SiS_PanelType01_1; break; + case 2: PanelDesPtr = SiS_Pr->SiS_PanelType02_1; break; + case 3: PanelDesPtr = SiS_Pr->SiS_PanelType03_1; break; + case 4: PanelDesPtr = SiS_Pr->SiS_PanelType04_1; break; + case 5: PanelDesPtr = SiS_Pr->SiS_PanelType05_1; break; + case 6: PanelDesPtr = SiS_Pr->SiS_PanelType06_1; break; + case 7: PanelDesPtr = SiS_Pr->SiS_PanelType07_1; break; + case 8: PanelDesPtr = SiS_Pr->SiS_PanelType08_1; break; + case 9: PanelDesPtr = SiS_Pr->SiS_PanelType09_1; break; + case 10: PanelDesPtr = SiS_Pr->SiS_PanelType0a_1; break; + case 11: PanelDesPtr = SiS_Pr->SiS_PanelType0b_1; break; + case 12: PanelDesPtr = SiS_Pr->SiS_PanelType0c_1; break; + case 13: PanelDesPtr = SiS_Pr->SiS_PanelType0d_1; break; + case 14: PanelDesPtr = SiS_Pr->SiS_PanelType0e_1; break; + case 15: PanelDesPtr = SiS_Pr->SiS_PanelType0f_1; break; + case 16: PanelDesPtr = SiS_Pr->SiS_PanelType00_2; break; /* --- */ + case 17: PanelDesPtr = SiS_Pr->SiS_PanelType01_2; break; + case 18: PanelDesPtr = SiS_Pr->SiS_PanelType02_2; break; + case 19: PanelDesPtr = SiS_Pr->SiS_PanelType03_2; break; + case 20: PanelDesPtr = SiS_Pr->SiS_PanelType04_2; break; + case 21: PanelDesPtr = SiS_Pr->SiS_PanelType05_2; break; + case 22: PanelDesPtr = SiS_Pr->SiS_PanelType06_2; break; + case 23: PanelDesPtr = SiS_Pr->SiS_PanelType07_2; break; + case 24: PanelDesPtr = SiS_Pr->SiS_PanelType08_2; break; + case 25: PanelDesPtr = SiS_Pr->SiS_PanelType09_2; break; + case 26: PanelDesPtr = SiS_Pr->SiS_PanelType0a_2; break; + case 27: PanelDesPtr = SiS_Pr->SiS_PanelType0b_2; break; + case 28: PanelDesPtr = SiS_Pr->SiS_PanelType0c_2; break; + case 29: PanelDesPtr = SiS_Pr->SiS_PanelType0d_2; break; + case 30: PanelDesPtr = SiS_Pr->SiS_PanelType0e_2; break; + case 31: PanelDesPtr = SiS_Pr->SiS_PanelType0f_2; break; + case 32: PanelDesPtr = SiS_Pr->SiS_PanelTypeNS_1; break; /* pass 1:1 */ + case 33: PanelDesPtr = SiS_Pr->SiS_PanelTypeNS_2; break; + case 50: PanelDesPtr = SiS_Pr->SiS_CHTVUNTSCDesData; break; /* TV */ + case 51: PanelDesPtr = SiS_Pr->SiS_CHTVONTSCDesData; break; + case 52: PanelDesPtr = SiS_Pr->SiS_CHTVUPALDesData; break; + case 53: PanelDesPtr = SiS_Pr->SiS_CHTVOPALDesData; break; + default: return; + } + + SiS_Pr->SiS_LCDHDES = (PanelDesPtr+ResIndex)->LCDHDES; + SiS_Pr->SiS_LCDVDES = (PanelDesPtr+ResIndex)->LCDVDES; + + if((ModeNo <= 0x13) && (SiS_Pr->SiS_LCDInfo & DontExpandLCD)) { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + if((SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { + if(!(modeflag & HalfDCLK)) SiS_Pr->SiS_LCDHDES = 632; + } else if(!(SiS_Pr->SiS_SetFlag & SetDOSMode)) { + if(SiS_Pr->SiS_LCDResInfo != Panel_1280x1024) { + if(SiS_Pr->SiS_LCDResInfo >= Panel_1024x768) { + if(HwInfo->jChipType < SIS_315H) { + if(!(modeflag & HalfDCLK)) SiS_Pr->SiS_LCDHDES = 320; + } else { + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) SiS_Pr->SiS_LCDHDES = 480; + if(SiS_Pr->SiS_LCDResInfo == Panel_1400x1050) SiS_Pr->SiS_LCDHDES = 804; + if(SiS_Pr->SiS_LCDResInfo == Panel_1600x1200) SiS_Pr->SiS_LCDHDES = 704; + if(!(modeflag & HalfDCLK)) { + SiS_Pr->SiS_LCDHDES = 320; + if(SiS_Pr->SiS_LCDResInfo == Panel_1400x1050) SiS_Pr->SiS_LCDHDES = 632; + if(SiS_Pr->SiS_LCDResInfo == Panel_1600x1200) SiS_Pr->SiS_LCDHDES = 542; } } } @@ -3498,18 +3535,6 @@ SiS_GetLVDSDesData(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex, } /*********************************************/ -/* SET CRT2 AUTO-THRESHOLD */ -/*********************************************/ - -#ifdef SIS315H -static void -SiS_CRT2AutoThreshold(SiS_Private *SiS_Pr) -{ - SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x01,0x40); -} -#endif - -/*********************************************/ /* DISABLE VIDEO BRIDGE */ /*********************************************/ @@ -3525,7 +3550,6 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) #endif USHORT temp=0; - if(SiS_Pr->SiS_VBType & VB_SISVB) { if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { /* ===== For 30xB/LV ===== */ @@ -3559,7 +3583,7 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) } else { if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwInfo))) { - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF7,0x08); + SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x08); SiS_PanelDelay(SiS_Pr, HwInfo, 3); } if(SiS_Is301B(SiS_Pr)) { @@ -3576,7 +3600,7 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if( (!(SiS_CRT2IsLCD(SiS_Pr, HwInfo))) || (!(SiS_CR36BIOSWord23d(SiS_Pr, HwInfo))) ) { SiS_PanelDelay(SiS_Pr, HwInfo, 2); - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xFB,0x04); + SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x04); } } @@ -3588,22 +3612,16 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if(IS_SIS550650740660) { /* 550, 650, 740, 660 */ - modenum = SiS_GetReg(SiS_Pr->SiS_P3d4,0x34); + modenum = SiS_GetReg(SiS_Pr->SiS_P3d4,0x34) & 0x7f; if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { /* LV */ - - if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { - if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) { -#ifdef SET_EMI_CPQ - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x30,0x00); -#endif - } else if(SiS_Pr->SiS_CustomT != CUT_CLEVO1400) { #ifdef SET_EMI - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x30,0x00); -#endif + if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { + if(SiS_Pr->SiS_CustomT != CUT_CLEVO1400) { + SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c); } } - +#endif if( (modenum <= 0x13) || (!(SiS_IsDualEdge(SiS_Pr,HwInfo))) || (SiS_IsVAMode(SiS_Pr,HwInfo)) ) { @@ -3718,7 +3736,7 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) (SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) && (SiS_Pr->SiS_CustomT != CUT_CLEVO1400)) { - SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,~0x10); /* 1.10.8r, 8m */ + SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,~0x10); tempah = 0x3f; if(SiS_IsDualEdge(SiS_Pr,HwInfo)) { @@ -3729,15 +3747,12 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) } SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1F,tempah); - if(SiS_IsNotM650orLater(SiS_Pr,HwInfo)) { /* 1.10.8r, 8m */ + if(SiS_IsNotM650orLater(SiS_Pr,HwInfo)) { SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0x7f); - } /* 1.10.8r, 8m */ + } if(!(SiS_IsVAMode(SiS_Pr,HwInfo))) { SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xdf); - } - - if(!(SiS_IsVAMode(SiS_Pr,HwInfo))) { if(!(SiS_CRT2IsLCD(SiS_Pr,HwInfo))) { if(!(SiS_IsDualEdge(SiS_Pr,HwInfo))) { SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFD); @@ -3747,6 +3762,13 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_SetReg(SiS_Pr->SiS_P3c4,0x06,pushax); + if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { + if( (SiS_IsVAMode(SiS_Pr, HwInfo)) || + (SiS_CRT2IsLCD(SiS_Pr, HwInfo)) ) { + SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 20); + } + } + } else if(SiS_Pr->SiS_VBType & VB_NoLCD) { /* NIL */ @@ -3826,10 +3848,12 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) } else { /* ============ For 301 ================ */ if(HwInfo->jChipType < SIS_315H) { +#ifdef SIS300 if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwInfo))) { - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF7,0x08); + SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x08); SiS_PanelDelay(SiS_Pr, HwInfo, 3); } +#endif } SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xDF); /* disable VB */ @@ -3847,12 +3871,14 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); SiS_SetReg(SiS_Pr->SiS_Part1Port,0x00,temp); } else { +#ifdef SIS300 SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF); /* disable CRT2 */ if( (!(SiS_CRT2IsLCD(SiS_Pr, HwInfo))) || (!(SiS_CR36BIOSWord23d(SiS_Pr,HwInfo))) ) { SiS_PanelDelay(SiS_Pr, HwInfo, 2); - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xFB,0x04); + SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x04); } +#endif } } @@ -3872,7 +3898,7 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_WaitVBRetrace(SiS_Pr,HwInfo); } if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwInfo))) { - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF7,0x08); + SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x08); SiS_PanelDelay(SiS_Pr, HwInfo, 3); } } else { @@ -3883,7 +3909,7 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if(!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x06) & 0x1c)) { SiS_DisplayOff(SiS_Pr); } - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF7,0x08); + SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x08); SiS_PanelDelay(SiS_Pr, HwInfo, 3); } } @@ -3902,7 +3928,7 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if( (!(SiS_CRT2IsLCD(SiS_Pr, HwInfo))) || (!(SiS_CR36BIOSWord23d(SiS_Pr,HwInfo))) ) { SiS_PanelDelay(SiS_Pr, HwInfo, 2); - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xFB,0x04); + SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x04); } #endif /* SIS300 */ @@ -3942,7 +3968,7 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) } if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) { - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF7,0x08); + SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x08); SiS_PanelDelay(SiS_Pr, HwInfo, 3); } @@ -4011,14 +4037,14 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if(SiS_CRT2IsLCD(SiS_Pr, HwInfo)) { if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwInfo))) { SiS_PanelDelay(SiS_Pr, HwInfo, 2); - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xFB,0x04); + SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x04); } } } #endif /* SIS315H */ - } /* 310 series */ + } /* 315 series */ } /* LVDS */ @@ -4086,7 +4112,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if((SiS_Pr->SiS_VBType & VB_NoLCD) && (SiS_CRT2IsLCD(SiS_Pr, HwInfo))) { /* This is only for LCD output on 301B-DH via LVDS */ - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x11,0xFB); + SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x00); if(!(SiS_CR36BIOSWord23d(SiS_Pr,HwInfo))) { SiS_PanelDelay(SiS_Pr, HwInfo, 0); } @@ -4105,7 +4131,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_PanelDelay(SiS_Pr, HwInfo, 1); } SiS_WaitVBRetrace(SiS_Pr,HwInfo); - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,0xF7,0x00); + SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x00); } } } else { @@ -4130,36 +4156,27 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if(IS_SIS550650740660) { /* 550, 650, 740, 660 */ + UCHAR r30=0, r31=0, r32=0, r33=0, cr36=0; + if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { if((SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) && (SiS_Pr->SiS_CustomT != CUT_CLEVO1400)) { - SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,0xef); /* 1.10.7u */ + SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,0xef); #ifdef SET_EMI if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x30,0x00); /* 1.10.7u */ + SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c); } #endif } if(!(SiS_IsNotM650orLater(SiS_Pr,HwInfo))) { tempah = 0x10; - if((SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) || - (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) { - if(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x13) & 0x04) { - if((SiS_GetReg(SiS_Pr->SiS_Part2Port,0x00) & 0x0f) == 0x0c) { - tempah = 0x08; - } else { - tempah = 0x18; - } - } - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x4c,tempah); - } else { - if(SiS_IsVAMode(SiS_Pr,HwInfo)) { - tempah = 0x08; - } - SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x4c,tempah); + if(SiS_LCDAEnabled(SiS_Pr, HwInfo)) { + if(SiS_TVEnabled(SiS_Pr, HwInfo)) tempah = 0x18; + else tempah = 0x08; } + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x4c,tempah); } if((SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) && @@ -4179,6 +4196,9 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) (SiS_Pr->SiS_CustomT != CUT_CLEVO1400)) { SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 2); SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x02); + if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { + SiS_GenericDelay(SiS_Pr, 0x4500); + } SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 2); } else { SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x02); @@ -4205,13 +4225,11 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if(!(SiS_IsNotM650orLater(SiS_Pr,HwInfo))) { tempah = 0x10; - if(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x13) & 0x04) { - tempah = 0x18; - if((SiS_GetReg(SiS_Pr->SiS_Part2Port,0x00) & 0x0f) == 0x0c) { - tempah = 0x08; - } + if(SiS_LCDAEnabled(SiS_Pr, HwInfo)) { + if(SiS_TVEnabled(SiS_Pr, HwInfo)) tempah = 0x18; + else tempah = 0x08; } - SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x4c,tempah); + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x4c,tempah); } } @@ -4221,10 +4239,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if(SiS_BridgeInSlave(SiS_Pr)) { tempah = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30); if(!(tempah & SetCRT2ToRAMDAC)) { - if((SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) || - (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) { - if(!(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x13) & 0x04)) temp |= 0x20; - } else temp |= 0x20; + if(!(SiS_LCDAEnabled(SiS_Pr, HwInfo))) temp |= 0x20; } } SiS_SetReg(SiS_Pr->SiS_P3c4,0x32,temp); @@ -4275,62 +4290,156 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { + if((SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) && + (SiS_Pr->SiS_CustomT != CUT_CLEVO1400)) { + SiS_PanelDelay(SiS_Pr, HwInfo, 2); + } +#ifdef COMPAQ_HACK if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) { -#ifdef SET_EMI_CPQ - if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x30,0x00); - SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x0c); - SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x20); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x31,0x08); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x32,0x10); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x33,0x4d); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10); - if((SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) & 0x0f) != 0x02) { - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x31,0x0d); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x32,0x70); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x33,0x6b); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10); - } - } + SiS_PanelDelay(SiS_Pr, HwInfo, 2); + } #endif - } else if(SiS_Pr->SiS_CustomT != CUT_CLEVO1400) { + + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1f,0x10); + + if(SiS_Pr->SiS_CustomT != CUT_CLEVO1400) { #ifdef SET_EMI if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x30,0x00); /* All this from 1.10.7u */ + SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c); } #endif SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x0c); #ifdef SET_EMI if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { - SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x20); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x31,0x12); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x32,0xd0); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x33,0x6b); - if((SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) & 0x0f) == 0x02) { /* Acer */ - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x31,0x0d); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x32,0x70); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x33,0x40); - if(((SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) & 0xf0) != 0x30)) { /* Acer */ - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x31,0x05); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x32,0x60); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x33,0x33); /* 00 */ + + cr36 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36); + + /* (P4_30|0x40) */ + /* Compal 1400x1050: 0x05, 0x60, 0x00 YES (1.10.7w; CR36=69) */ + /* Compal 1400x1050: 0x0d, 0x70, 0x40 YES (1.10.7x; CR36=69) */ + /* Acer 1280x1024: 0x12, 0xd0, 0x6b NO (1.10.9k; CR36=73) */ + /* Compaq 1280x1024: 0x0d, 0x70, 0x6b YES (1.12.04b; CR36=03) */ + /* Clevo 1024x768: 0x05, 0x60, 0x33 NO (1.10.8e; CR36=12, DL!) */ + /* Clevo 1024x768: 0x0d, 0x70, 0x40 (if type == 3) YES (1.10.8y; CR36=?2) */ + /* Clevo 1024x768: 0x05, 0x60, 0x33 (if type != 3) YES (1.10.8y; CR36=?2) */ + /* Asus 1024x768: ? ? (1.10.8o; CR36=?2) */ + /* Asus 1024x768: 0x08, 0x10, 0x3c (problematic) YES (1.10.8q; CR36=22) */ + + if(SiS_Pr->HaveEMI) { + r30 = SiS_Pr->EMI_30; + r31 = SiS_Pr->EMI_31; + r32 = SiS_Pr->EMI_32; + r33 = SiS_Pr->EMI_33; + } else { + r30 = 0; + } + + /* EMI_30 is read at driver start; however, the BIOS sets this + * (if it is used) only if the LCD is in use. In case we caught + * the machine while on TV output, this bit is not set and we + * don't know if it should be set - hence our detection is wrong. + * Work-around this here: + */ + + if((!SiS_Pr->HaveEMI) || (!SiS_Pr->HaveEMILCD)) { + if((cr36 & 0x0f) == 0x02) { /* 1024x768 */ + r30 |= 0x40; + if(SiS_Pr->SiS_CustomT == CUT_CLEVO1024) { + r30 &= ~0x40; + } + } else if((cr36 & 0x0f) == 0x03) { /* 1280x1024 */ + r30 |= 0x40; + if(SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) { + r30 &= ~0x40; + } + } else if((cr36 & 0x0f) == 0x09) { /* 1400x1050 */ + r30 |= 0x40; + } else if((cr36 & 0x0f) == 0x0b) { /* 1600x1200 - unknown */ + r30 |= 0x40; } - } - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10); - if((SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) & 0x0f) != 0x03) { - SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x40); - } + } + + if(!SiS_Pr->HaveEMI) { + if((cr36 & 0x0f) == 0x02) { + if((cr36 & 0xf0) == 0x30) { + r31 = 0x0d; r32 = 0x70; r33 = 0x40; + } else { + r31 = 0x05; r32 = 0x60; r33 = 0x33; + } + } else if((cr36 & 0x0f) == 0x03) { + if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) { + r31 = 0x0d; r32 = 0x70; r33 = 0x6b; + } else { + r31 = 0x12; r32 = 0xd0; r33 = 0x6b; + } + } else if((cr36 & 0x0f) == 0x09) { + if(SiS_Pr->SiS_CustomT == CUT_COMPAL1400_2) { + r31 = 0x0d; r32 = 0x70; r33 = 0x40; /* BIOS values */ + } else { + r31 = 0x05; r32 = 0x60; r33 = 0x00; + } + } else { + r31 = 0x05; r32 = 0x60; r33 = 0x00; + } + } + + /* BIOS values don't work so well sometimes */ + if(!SiS_Pr->OverruleEMI) { +#ifdef COMPAL_HACK + if(SiS_Pr->SiS_CustomT == CUT_COMPAL1400_2) { + if((cr36 & 0x0f) == 0x09) { + r30 = 0x60; r31 = 0x05; r32 = 0x60; r33 = 0x00; + } + } +#endif +#ifdef COMPAQ_HACK + if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) { + if((cr36 & 0x0f) == 0x03) { + r30 = 0x20; r31 = 0x12; r32 = 0xd0; r33 = 0x6b; /* rev 1 */ + } + } +#endif +#ifdef ASUS_HACK + if(SiS_Pr->SiS_CustomT == CUT_ASUSA2H_2) { + if((cr36 & 0x0f) == 0x02) { + /* r30 = 0x60; r31 = 0x05; r32 = 0x60; r33 = 0x33; */ /* rev 2 */ + /* r30 = 0x20; r31 = 0x05; r32 = 0x60; r33 = 0x33; */ /* rev 3 */ + /* r30 = 0x60; r31 = 0x0d; r32 = 0x70; r33 = 0x40; */ /* rev 4 */ + /* r30 = 0x20; r31 = 0x0d; r32 = 0x70; r33 = 0x40; */ /* rev 5 */ + } + } +#endif + } + if(!(SiS_Pr->OverruleEMI && (!r30) && (!r31) && (!r32) && (!r33))) { + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x20); + } + SiS_SetReg(SiS_Pr->SiS_Part4Port,0x31,r31); + SiS_SetReg(SiS_Pr->SiS_Part4Port,0x32,r32); + SiS_SetReg(SiS_Pr->SiS_Part4Port,0x33,r33); + if(!(SiS_Pr->OverruleEMI && (!r30) && (!r31) && (!r32) && (!r33))) { + SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10); + } else { + SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x00); + } + if( (SiS_IsVAMode(SiS_Pr,HwInfo)) || + (SiS_CRT2IsLCD(SiS_Pr, HwInfo)) ) { + if(r30 & 0x40) { + SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 5); + if(delaylong) { + SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 5); + delaylong = FALSE; + } + SiS_WaitVBRetrace(SiS_Pr,HwInfo); + if(SiS_Pr->SiS_CustomT == CUT_ASUSA2H_2) { + SiS_GenericDelay(SiS_Pr, 0x500); + } + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x40); + } + } } #endif } - if((SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) && - (SiS_Pr->SiS_CustomT != CUT_CLEVO1400)) { - SiS_PanelDelay(SiS_Pr, HwInfo, 2); - } - - SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1f,0x10); - if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) { if( (SiS_IsVAMode(SiS_Pr,HwInfo)) || @@ -4339,11 +4448,6 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_PanelDelay(SiS_Pr, HwInfo, 1); SiS_WaitVBRetrace(SiS_Pr, HwInfo); SiS_PanelDelay(SiS_Pr, HwInfo, 3); -#ifdef SET_EMI_CPQ - if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { - SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x40); - } -#endif if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwInfo))) { SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x01); } @@ -4364,7 +4468,6 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) } else { SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x80); - if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwInfo))) { if( (SiS_IsVAMode(SiS_Pr,HwInfo)) || ((SiS_CRT2IsLCD(SiS_Pr, HwInfo))) ) { @@ -4373,6 +4476,9 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 10); } SiS_WaitVBRetrace(SiS_Pr,HwInfo); + if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { + SiS_GenericDelay(SiS_Pr, 0x500); + } SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x01); } } @@ -4444,7 +4550,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if(HwInfo->jChipType < SIS_315H) { if(SiS_CRT2IsLCD(SiS_Pr, HwInfo)) { - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x11,0xFB); + SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x00); SiS_PanelDelay(SiS_Pr, HwInfo, 0); } } @@ -4477,7 +4583,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if(HwInfo->jChipType < SIS_315H) { if(SiS_CRT2IsLCD(SiS_Pr, HwInfo)) { SiS_PanelDelay(SiS_Pr, HwInfo, 1); - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x11,0xF7); + SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x00); } } @@ -4495,13 +4601,13 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_PanelDelay(SiS_Pr, HwInfo, 1); SiS_PanelDelay(SiS_Pr, HwInfo, 1); } - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x11,0xFB); + SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x00); if(!(SiS_CR36BIOSWord23d(SiS_Pr,HwInfo))) { SiS_PanelDelay(SiS_Pr, HwInfo, 0); } } - SiS_EnableCRT2(SiS_Pr); + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); SiS_DisplayOn(SiS_Pr); SiS_UnLockCRT2(SiS_Pr,HwInfo); SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x02,0xBF); @@ -4526,7 +4632,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_PanelDelay(SiS_Pr, HwInfo, 1); } SiS_WaitVBRetrace(SiS_Pr, HwInfo); - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x11,0xF7); + SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x00); } } } @@ -4539,12 +4645,12 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) { if(SiS_CRT2IsLCD(SiS_Pr, HwInfo)) { - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x11,0xFB); + SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x00); SiS_PanelDelay(SiS_Pr, HwInfo, 0); } } - SiS_EnableCRT2(SiS_Pr); + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); SiS_UnLockCRT2(SiS_Pr,HwInfo); SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0xf7); @@ -4618,7 +4724,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwInfo))) { if(SiS_CRT2IsLCD(SiS_Pr, HwInfo)) { SiS_PanelDelay(SiS_Pr, HwInfo, 1); - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x11,0xF7); + SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x00); } } } @@ -4635,32 +4741,31 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) /* SET PART 1 REGISTER GROUP */ /*********************************************/ -/********** Set CRT2 OFFSET / PITCH **********/ +/* Set CRT2 OFFSET / PITCH */ static void -SiS_SetCRT2Offset(SiS_Private *SiS_Pr,USHORT ModeNo, - USHORT ModeIdIndex ,USHORT RefreshRateTableIndex, - PSIS_HW_INFO HwInfo) +SiS_SetCRT2Offset(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, + USHORT RRTI, PSIS_HW_INFO HwInfo) { USHORT offset; UCHAR temp; if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) return; - offset = SiS_GetOffset(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, - HwInfo); + offset = SiS_GetOffset(SiS_Pr,ModeNo,ModeIdIndex,RRTI,HwInfo); - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480_2 || - SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480_3) offset >>= 1; + if((SiS_Pr->SiS_LCDResInfo == Panel_640x480_2) || + (SiS_Pr->SiS_LCDResInfo == Panel_640x480_3)) { + offset >>= 1; + } - temp = (UCHAR)(offset & 0xFF); - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x07,temp); - temp = (UCHAR)(offset >> 8); - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x09,temp); + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x07,(offset & 0xFF)); + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x09,(offset >> 8)); temp = (UCHAR)(((offset >> 3) & 0xFF) + 1); + if(offset % 8) temp++; SiS_SetReg(SiS_Pr->SiS_Part1Port,0x03,temp); } -/************* Set CRT2 Sync *************/ +/* Set CRT2 sync and PanelLink mode */ static void SiS_SetCRT2Sync(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT RefreshRateTableIndex, PSIS_HW_INFO HwInfo) @@ -4682,23 +4787,27 @@ SiS_SetCRT2Sync(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT RefreshRateTableIndex } else if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) && (SiS_Pr->SiS_LCDInfo & LCDSync)) { tempah = SiS_Pr->SiS_LCDInfo; } else tempah = infoflag >> 8; - tempah &= 0xC0; - tempah |= 0x20; if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) tempah |= 0x10; - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { if((SiS_Pr->SiS_CustomT == CUT_BARCO1366) || (SiS_Pr->SiS_CustomT == CUT_BARCO1024)) { - tempah |= 0xc0; + tempah |= 0xf0; + } + if( (SiS_Pr->SiS_IF_DEF_FSTN) || + (SiS_Pr->SiS_IF_DEF_DSTN) || + (SiS_Pr->SiS_IF_DEF_TRUMPION) || + (SiS_Pr->SiS_CustomT == CUT_PANEL848) ) { + tempah |= 0x30; } } - if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { if(HwInfo->jChipType >= SIS_315H) { tempah >>= 3; + tempah &= 0x18; SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,0xE7,tempah); + /* Don't care about 12/18/24 bit mode - TV is via VGA, not PL */ } else { SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,0xe0); } @@ -4715,19 +4824,21 @@ SiS_SetCRT2Sync(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT RefreshRateTableIndex if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { /* 630 - 301B(-DH) */ tempah = infoflag >> 8; + tempbl = 0; if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { if(SiS_Pr->SiS_LCDInfo & LCDSync) { tempah = SiS_Pr->SiS_LCDInfo; + tempbl = (tempah >> 6) & 0x03; } } tempah &= 0xC0; - tempah |= 0x20; if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) tempah |= 0x10; - - tempah &= 0x3f; - tempah |= tempbl; + tempah |= 0xc0; SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,tempah); + if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) && (!(SiS_Pr->SiS_VBType & VB_NoLCD))) { + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1a,0xf0,tempbl); + } } else { /* 630 - 301 */ @@ -4745,43 +4856,72 @@ SiS_SetCRT2Sync(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT RefreshRateTableIndex #ifdef SIS315H /* ------- 315 series ------ */ - if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { /* 315 - 30xLV */ + if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { /* 315 - LVDS */ - if(((SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) && - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024)) || - ((SiS_Pr->SiS_CustomT == CUT_CLEVO1400) && - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050))) { + tempbl = 0; + if((SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) && + (SiS_Pr->SiS_LCDResInfo == Panel_1280x1024)) { tempah = infoflag >> 8; + if(SiS_Pr->SiS_LCDInfo & LCDSync) { + tempbl = ((SiS_Pr->SiS_LCDInfo & 0xc0) >> 6); + } + } else if((SiS_Pr->SiS_CustomT == CUT_CLEVO1400) && + (SiS_Pr->SiS_LCDResInfo == Panel_1400x1050)) { + tempah = infoflag >> 8; + tempbl = 0x03; } else { tempah = SiS_GetReg(SiS_Pr->SiS_P3d4,0x37); + tempbl = (tempah >> 6) & 0x03; + tempbl |= 0x08; + if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) tempbl |= 0x04; } tempah &= 0xC0; - tempah |= 0x20; if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) tempah |= 0x10; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) tempah |= 0xc0; SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,tempah); + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1a,0xf0,tempbl); + } + } - } else { /* 315 - 301, 301B */ + } else { /* 315 - TMDS */ - tempah = infoflag >> 8; + tempah = tempbl = infoflag >> 8; if(!SiS_Pr->UseCustomMode) { - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + tempbl = 0; + if((SiS_Pr->SiS_VBType & VB_SIS301C) && (SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC)) { + if(ModeNo <= 0x13) { + tempah = SiS_GetRegByte((SiS_Pr->SiS_P3ca+0x02)); + } + } + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { if(SiS_Pr->SiS_LCDInfo & LCDSync) { tempah = SiS_Pr->SiS_LCDInfo; + tempbl = (tempah >> 6) & 0x03; } } } tempah &= 0xC0; - tempah |= 0x20; if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) tempah |= 0x10; - - if(SiS_Pr->SiS_VBType & VB_NoLCD) { /* TEST, imitate BIOS bug */ - if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { - tempah |= 0xc0; + if(SiS_Pr->SiS_VBType & VB_NoLCD) { + /* Imitate BIOS bug */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) tempah |= 0xc0; + } + if((SiS_Pr->SiS_VBType & VB_SIS301C) && (SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC)) { + tempah >>= 3; + tempah &= 0x18; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,0xe7,tempah); + } else { + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,tempah); + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1a,0xf0,tempbl); + } } } - SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,tempah); } #endif /* SIS315H */ @@ -4789,7 +4929,7 @@ SiS_SetCRT2Sync(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT RefreshRateTableIndex } } -/******** Set CRT2 FIFO on 300/630/730 *******/ +/* Set CRT2 FIFO on 300/630/730 */ #ifdef SIS300 static void SiS_SetCRT2FIFO_300(SiS_Private *SiS_Pr,USHORT ModeNo, @@ -4844,7 +4984,7 @@ SiS_SetCRT2FIFO_300(SiS_Private *SiS_Pr,USHORT ModeNo, if(!SiS_Pr->CRT1UsesCustomMode) { - CRT1ModeNo = SiS_Pr->SiS_CRT1Mode; /* get CRT1 ModeNo */ + CRT1ModeNo = SiS_Pr->SiS_CRT1Mode; /* get CRT1 ModeNo */ SiS_SearchModeID(SiS_Pr, &CRT1ModeNo, &modeidindex); SiS_Pr->SiS_SetFlag &= (~ProgrammingCRT2); SiS_Pr->SiS_SelectCRT2Rate = 0; @@ -4853,7 +4993,7 @@ SiS_SetCRT2FIFO_300(SiS_Private *SiS_Pr,USHORT ModeNo, if(CRT1ModeNo >= 0x13) { index = SiS_Pr->SiS_RefIndex[refreshratetableindex].Ext_CRTVCLK; index &= 0x3F; - VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; /* Get VCLK */ + VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; /* Get VCLK */ colorth = SiS_GetColorDepth(SiS_Pr,CRT1ModeNo,modeidindex); /* Get colordepth */ colorth >>= 1; @@ -4863,9 +5003,9 @@ SiS_SetCRT2FIFO_300(SiS_Private *SiS_Pr,USHORT ModeNo, } else { CRT1ModeNo = 0xfe; - VCLK = SiS_Pr->CSRClock_CRT1; /* Get VCLK */ + VCLK = SiS_Pr->CSRClock_CRT1; /* Get VCLK */ data2 = (SiS_Pr->CModeFlag_CRT1 & ModeInfoFlag) - 2; - switch(data2) { /* Get color depth */ + switch(data2) { /* Get color depth */ case 0 : colorth = 1; break; case 1 : colorth = 1; break; case 2 : colorth = 2; break; @@ -5012,10 +5152,10 @@ SiS_SetCRT2FIFO_300(SiS_Private *SiS_Pr,USHORT ModeNo, index = SiS_GetVCLK2Ptr(SiS_Pr,CRT2ModeNo,modeidindex, refreshratetableindex,HwInfo); - VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; /* Get VCLK */ + VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; /* Get VCLK */ if((SiS_Pr->SiS_CustomT == CUT_BARCO1366) || (SiS_Pr->SiS_CustomT == CUT_BARCO1024)) { - if((ROMAddr) && SiS_Pr->SiS_UseROM) { + if(SiS_Pr->SiS_UseROM) { if(ROMAddr[0x220] & 0x01) { VCLK = ROMAddr[0x229] | (ROMAddr[0x22a] << 8); } @@ -5025,11 +5165,11 @@ SiS_SetCRT2FIFO_300(SiS_Private *SiS_Pr,USHORT ModeNo, } else { CRT2ModeNo = 0xfe; - VCLK = SiS_Pr->CSRClock; /* Get VCLK */ + VCLK = SiS_Pr->CSRClock; /* Get VCLK */ } - colorth = SiS_GetColorDepth(SiS_Pr,CRT2ModeNo,modeidindex); /* Get colordepth */ + colorth = SiS_GetColorDepth(SiS_Pr,CRT2ModeNo,modeidindex); /* Get colordepth */ colorth >>= 1; if(!colorth) colorth++; @@ -5048,8 +5188,8 @@ SiS_SetCRT2FIFO_300(SiS_Private *SiS_Pr,USHORT ModeNo, if(HwInfo->jChipType == SIS_300) { if(data <= 0x0f) temp = (temp & (~0x1F)) | 0x13; else temp = (temp & (~0x1F)) | 0x16; - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { - temp = (temp & (~0x1F)) | 0x13; + if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) { + temp = (temp & (~0x1F)) | 0x13; } } else { if( ( (HwInfo->jChipType == SIS_630) || @@ -5079,280 +5219,21 @@ SiS_SetCRT2FIFO_300(SiS_Private *SiS_Pr,USHORT ModeNo, } #endif -/**** Set CRT2 FIFO on 315/330 series ****/ -#ifdef SIS315H -static void -SiS_SetCRT2FIFO_310(SiS_Private *SiS_Pr) -{ - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x01,0x3B); - SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x02,~0x3F,0x04); -} -#endif - -/*************** Set LCD-A ***************/ +/* Set CRT2 FIFO on 315/330 series */ #ifdef SIS315H static void -SiS_SetGroup1_LCDA(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, - PSIS_HW_INFO HwInfo, USHORT RefreshRateTableIndex) +SiS_SetCRT2FIFO_310(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { - USHORT modeflag,resinfo; - USHORT push2,tempax,tempbx,tempcx,temp; - ULONG tempeax=0,tempebx,tempecx,tempvcfact; - - /* This is not supported with LCDA */ - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_PanelCustom) return; - if(SiS_Pr->UseCustomMode) return; - - if(IS_SIS330) { - SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x10); /* Xabre 1.01.03 */ - } else if(IS_SIS740) { - if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { /* 740/LVDS */ - SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,0xfb,0x04); /* 740/LVDS */ - SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x03); - } else if(SiS_Pr->SiS_VBType & VB_SISVB) { - SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x10); /* 740/301LV, 301BDH */ - } - } else { - if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { /* 650/LVDS */ - SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,0xfb,0x04); /* 650/LVDS */ - SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x00); /* 650/LVDS 1.10.07 */ - } else if(SiS_Pr->SiS_VBType & VB_SISVB) { - SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2D,0x0f); /* 650/30xLv 1.10.6s */ - } - } - - if(ModeNo <= 0x13) { - modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo; - } else { - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; - } - - tempax = SiS_Pr->SiS_LCDHDES; - - temp = (tempax & 0x0007); /* BPLHDESKEW[2:0] */ - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1A,temp); /* Part1_1Ah */ - temp = (tempax >> 3) & 0x00FF; /* BPLHDESKEW[10:3] */ - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x16,temp); /* Part1_16h */ - - tempbx = SiS_Pr->SiS_HDE; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { - tempbx = SiS_Pr->PanelXRes; - } - - tempax += tempbx; /* HDE + HSKEW = lcdhdee */ - if(tempax >= SiS_Pr->SiS_HT) tempax -= SiS_Pr->SiS_HT; - - temp = tempax; - if(SiS_Pr->SiS_VBType & VB_SISVB) { - if(temp & 0x07) temp += 8; - } - temp >>= 3; /* BPLHDEE */ - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x17,temp); /* Part1_17h */ - - tempcx = (SiS_Pr->SiS_HT - tempbx) >> 2; /* (HT-HDE) / 4 */ - - /* 650/30xLV 1.10.6s, 740/LVDS */ - if( ((SiS_Pr->SiS_VBType & VB_SISVB) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) || - ((SiS_Pr->SiS_IF_DEF_LVDS == 1) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) ) { - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempcx = 0x28; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempcx = 0x18; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempcx = 0x30; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempcx = 0x40; - else tempcx = 0x30; - } - } - - tempcx += tempax; /* lcdhrs */ - if(tempcx >= SiS_Pr->SiS_HT) tempcx -= SiS_Pr->SiS_HT; - - temp = (tempcx >> 3) & 0x00FF; /* BPLHRS */ - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x14,temp); /* Part1_14h */ - - temp += 10; - if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) { - temp += 6; - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel800x600) { - temp++; - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1024x768) { - temp += 7; - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1600x1200) { - temp -= 10; - } - } - } - } - } - } - temp &= 0x1F; - temp |= ((tempcx & 0x07) << 5); - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x15,temp); /* Part1_15h */ - - if(SiS_Pr->SiS_IF_DEF_TRUMPION == 0) { - tempax = SiS_Pr->PanelYRes; - } else { - tempax = SiS_Pr->SiS_VGAVDE; - } - - tempbx = SiS_Pr->SiS_LCDVDES + tempax; - if(tempbx >= SiS_Pr->SiS_VT) tempbx -= SiS_Pr->SiS_VT; - push2 = tempbx; - - tempcx = (SiS_Pr->SiS_VGAVT - SiS_Pr->SiS_VGAVDE) >> 2; - - if( ((SiS_Pr->SiS_VBType & VB_SISVB) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) || - ((SiS_Pr->SiS_IF_DEF_LVDS == 1) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) ) { - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempcx = 1; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempcx = 3; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) tempcx = 3; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempcx = 1; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempcx = 1; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempcx = 1; - else tempcx = 0x0057; - } - } - - tempbx += tempcx; - if(SiS_Pr->SiS_VBType & VB_SISVB) { - tempbx++; /* BPLVRS */ - } - if(tempbx >= SiS_Pr->SiS_VT) tempbx -= SiS_Pr->SiS_VT; - temp = tempbx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x18,temp); /* Part1_18h */ - - tempcx >>= 3; - if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempcx = 3; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempcx = 5; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) tempcx = 5; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempcx = 5; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempcx = 2; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempcx = 2; - } - } - } - tempcx += tempbx; - tempcx++; /* BPLVRE */ - temp = tempcx & 0x000F; - if(SiS_Pr->SiS_VBType & VB_SISVB) { - temp |= 0xC0; - SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0xF0,temp); /* Part1_19h */ - } else { - SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0xF0,temp); - } - - temp = ((tempbx >> 8) & 0x07) << 3; - if(SiS_Pr->SiS_VGAVDE != SiS_Pr->SiS_VDE) temp |= 0x40; - if(SiS_Pr->SiS_SetFlag & EnableLVDSDDA) temp |= 0x40; - if(SiS_Pr->SiS_VBType & VB_SISVB) { - /* Don't check Part1Port,0x00 -> is not being set if LCDA! */ - /* We check SR06 instead here: */ - if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) { - if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x06) & 0x10) temp |= 0x80; - } - } else { - if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) { - if(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00) & 0x01) temp |= 0x80; - } - } - SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x1A,0x07,temp); /* Part1_1Ah */ - - tempbx = push2; /* BPLVDEE */ - - tempcx = SiS_Pr->SiS_LCDVDES; /* NPLVDES */ - if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) { - if(resinfo == SIS_RI_800x600) tempcx++; - } - } - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) { - tempbx = tempcx = SiS_Pr->SiS_VGAVDE; - tempbx--; - } - - temp = ((tempbx >> 8) & 0x07) << 3; - temp = temp | ((tempcx >> 8) & 0x07); - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1D,temp); /* Part1_1Dh */ - temp = tempbx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1C,temp); /* Part1_1Ch */ - temp = tempcx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1B,temp); /* Part1_1Bh */ - - tempeax = SiS_Pr->SiS_VGAVDE << 18; - tempebx = SiS_Pr->SiS_VDE; - temp = (USHORT)(tempeax % tempebx); - tempeax = tempeax / tempebx; - if(temp) tempeax++; - tempvcfact = tempeax; - - temp = (USHORT)(tempeax & 0x00FF); - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x37,temp); - - temp = (USHORT)((tempeax & 0x00FF00) >> 8); - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x36,temp); - - temp = (USHORT)((tempeax & 0x00030000) >> 16); - if(SiS_Pr->SiS_VDE == SiS_Pr->SiS_VGAVDE) temp |= 0x04; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x35,temp); - - if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302ELV)) { - temp = (USHORT)(tempeax & 0x00FF); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x3c,temp); - temp = (USHORT)((tempeax & 0x00FF00) >> 8); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x3b,temp); - temp = (USHORT)(((tempeax & 0x00030000) >> 16) << 6); - SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x3a,0x3f,temp); - temp = 0; - if(SiS_Pr->SiS_VDE != SiS_Pr->SiS_VGAVDE) temp |= 0x08; - SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x30,0xf3,temp); - } - - tempeax = SiS_Pr->SiS_VGAHDE << 16; - tempebx = SiS_Pr->SiS_HDE; - temp = tempeax % tempebx; - tempeax /= tempebx; - if(temp) tempeax++; - if(tempebx == SiS_Pr->SiS_VGAHDE) tempeax = 0xFFFF; - tempecx = tempeax; - tempeax = ((SiS_Pr->SiS_VGAHDE << 16) / tempecx) - 1; - tempecx = (tempecx << 16) | (tempeax & 0xFFFF); - temp = (USHORT)(tempecx & 0x00FF); - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1F,temp); /* Part1_1Fh */ - - tempeax = (SiS_Pr->SiS_VGAVDE << 18) / tempvcfact; - tempbx = (USHORT)(tempeax & 0x0FFFF); - - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempbx--; - - if(SiS_Pr->SiS_SetFlag & EnableLVDSDDA) tempbx = 1; - - temp = ((tempbx >> 8) & 0x07) << 3; - temp = temp | ((tempecx >> 8) & 0x07); - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x20,temp); /* Part1_20h */ - - temp = tempbx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x21,temp); /* Part1_21h */ - - tempecx >>= 16; /* BPLHCFACT */ - if(modeflag & HalfDCLK) tempecx >>= 1; - temp = (USHORT)((tempecx & 0x0000FF00) >> 8); - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x22,temp); /* Part1_22h */ - - temp = (USHORT)(tempecx & 0x000000FF); - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x23,temp); + USHORT temp; - if((SiS_Pr->SiS_IF_DEF_LVDS == 1) || (SiS_Pr->SiS_VBInfo & VB_SIS301LV302LV)) { - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1e,0x20); + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x01,0x3B); + temp = 0x04; + if(HwInfo->jChipType >= SIS_661) { + if((SiS_GetReg(SiS_Pr->SiS_P3d4,0x5c) & 0xf8) == 0x80) temp = 0x44; } + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x02,~0x3f,temp); } -#endif /* SIS 315 */ +#endif static USHORT SiS_GetVGAHT2(SiS_Private *SiS_Pr) @@ -5365,73 +5246,73 @@ SiS_GetVGAHT2(SiS_Private *SiS_Pr) return((USHORT) tempax); } -/******* Set Part 1 / SiS bridge *********/ +/* Set Part 1 / SiS bridge slave mode */ static void SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex, PSIS_HW_INFO HwInfo,USHORT RefreshRateTableIndex) { USHORT push1,push2; USHORT tempax,tempbx,tempcx,temp; - USHORT resinfo,modeflag; + USHORT resinfo,modeflag,xres=0; unsigned char p1_7, p1_8; if(ModeNo <= 0x13) { modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo; + } else if(SiS_Pr->UseCustomMode) { + modeflag = SiS_Pr->CModeFlag; + resinfo = 0; + xres = SiS_Pr->CHDisplay; } else { - if(SiS_Pr->UseCustomMode) { - modeflag = SiS_Pr->CModeFlag; - resinfo = 0; - } else { - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; - } + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + xres = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].XRes; } /* The following is only done if bridge is in slave mode: */ - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x03,0xff); /* set MAX HT */ + if((HwInfo->jChipType >= SIS_661) && (ModeNo > 0x13)) { + if(xres >= 1600) { + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x31,0x04); + } + } - tempax = 0xFFFF; - if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) tempax = SiS_GetVGAHT2(SiS_Pr); + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x03,0xff); /* set MAX HT */ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) modeflag |= Charx8Dot; if(modeflag & Charx8Dot) tempcx = 0x08; else tempcx = 0x09; - if(tempax >= SiS_Pr->SiS_VGAHT) tempax = SiS_Pr->SiS_VGAHT; - - if(modeflag & HalfDCLK) tempax >>= 1; - - tempax = (tempax / tempcx) - 5; - tempbx = tempax & 0x00FF; - tempax = SiS_Pr->SiS_VGAHDE; /* 0x04 Horizontal Display End */ if(modeflag & HalfDCLK) tempax >>= 1; - tempax = (tempax / tempcx) - 1; - tempbx |= ((tempax & 0x00FF) << 8); - temp = tempax & 0x00FF; + tempax = ((tempax / tempcx) - 1) & 0xff; + tempbx = tempax; + + temp = tempax; SiS_SetReg(SiS_Pr->SiS_Part1Port,0x04,temp); - temp = (tempbx & 0xFF00) >> 8; if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) { temp += 2; } } - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { - if(SiS_Pr->SiS_HiVision == 3) { - if(resinfo == SIS_RI_800x600) temp -= 2; - } + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) { + if(resinfo == SIS_RI_800x600) temp -= 2; } SiS_SetReg(SiS_Pr->SiS_Part1Port,0x05,temp); /* 0x05 Horizontal Display Start */ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x06,0x03); /* 0x06 Horizontal Blank end */ - if((SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) && - (SiS_Pr->SiS_HiVision == 3)) { - temp = (tempbx & 0x00FF) - 1; + tempax = 0xFFFF; + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) tempax = SiS_GetVGAHT2(SiS_Pr); + if(tempax >= SiS_Pr->SiS_VGAHT) tempax = SiS_Pr->SiS_VGAHT; + if(modeflag & HalfDCLK) tempax >>= 1; + tempax = (tempax / tempcx) - 5; + tempcx = tempax; + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) { + temp = tempcx - 1; if(!(modeflag & HalfDCLK)) { temp -= 6; if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) { @@ -5440,8 +5321,6 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex, } } } else { - tempcx = tempbx & 0x00FF; - tempbx = (tempbx & 0xFF00) >> 8; tempcx = (tempcx + tempbx) >> 1; temp = (tempcx & 0x00FF) + 2; if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { @@ -5458,21 +5337,23 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex, } else { if(!(modeflag & HalfDCLK)) { temp -= 4; - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x960) { + if((SiS_Pr->SiS_LCDResInfo != Panel_1280x960) && + (SiS_Pr->SiS_LCDResInfo != Panel_1600x1200)) { if(SiS_Pr->SiS_VGAHDE >= 800) { temp -= 7; if(HwInfo->jChipType < SIS_315H) { - /* 650/301LV(x) does not do this, 630/301B, 300/301LV do */ if(SiS_Pr->SiS_ModeType == ModeEGA) { if(SiS_Pr->SiS_VGAVDE == 1024) { temp += 15; - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x1024) + if(SiS_Pr->SiS_LCDResInfo != Panel_1280x1024) temp += 7; } } } - if(SiS_Pr->SiS_VGAHDE >= 1280) { - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) temp += 28; + if(SiS_Pr->SiS_LCDResInfo != Panel_1400x1050) { + if(SiS_Pr->SiS_VGAHDE >= 1280) { + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) temp += 28; + } } } } @@ -5521,11 +5402,21 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex, } } - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { - if(SiS_Pr->SiS_HiVision & 0x03) { - p1_7 = 0xb2; - if(SiS_Pr->SiS_HiVision & 0x02) { - p1_7 = 0xab; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) { + if(SiS_Pr->SiS_TVMode & (TVSetYPbPr525p|TVSetYPbPr750p)) { + p1_7 = 0x63; + if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) p1_7 = 0x55; + } + if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) { + if(!(modeflag & HalfDCLK)) { + p1_7 = 0xb2; + if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) { + p1_7 = 0xab; + } + } + } else { + if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) { + if(modeflag & HalfDCLK) p1_7 = 0x30; } } } @@ -5549,7 +5440,7 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex, else if(tempbx == 525) tempbx = 480; push2 = tempbx; if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) { if (tempbx == 350) tempbx += 5; else if(tempbx == 480) tempbx += 5; @@ -5571,18 +5462,21 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex, #endif SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0E,temp); - if(tempbx & 0x0100) tempcx |= 0x0002; - - tempax = 0x000B; - if(modeflag & DoubleScanMode) tempax |= 0x8000; + temp = 0; + if(modeflag & DoubleScanMode) temp |= 0x80; + if(HwInfo->jChipType >= SIS_661) { + if(tempbx & 0x0200) temp |= 0x20; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x0B,0x5F,temp); + if(tempbx & 0x0100) tempcx |= 0x000a; + if(tempbx & 0x0400) tempcx |= 0x1200; + } else { + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0B,temp); + if(tempbx & 0x0100) tempcx |= 0x0002; + if(tempbx & 0x0400) tempcx |= 0x0600; + } if(tempbx & 0x0200) tempcx |= 0x0040; - temp = (tempax & 0xFF00) >> 8; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0B,temp); - - if(tempbx & 0x0400) tempcx |= 0x0600; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x11,0x00); /* 0x11 Vertical Blank End */ tempax = (SiS_Pr->SiS_VGAVT - tempbx) >> 2; @@ -5592,23 +5486,20 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex, tempbx += (tempax << 1); } } else if(HwInfo->jChipType >= SIS_315H) { - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1400x1050) { + if(SiS_Pr->SiS_LCDResInfo != Panel_1400x1050) { tempbx += (tempax << 1); } } - if((SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) && - (SiS_Pr->SiS_HiVision == 3)) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) { tempbx -= 10; } else { if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) { if(SiS_Pr->SiS_TVMode & TVSetPAL) { - if(!(SiS_Pr->SiS_HiVision & 0x03)) { - tempbx += 40; - if(HwInfo->jChipType >= SIS_315H) { - if(SiS_Pr->SiS_VGAHDE == 800) tempbx += 10; - } - } + tempbx += 40; + if(HwInfo->jChipType >= SIS_315H) { + if(SiS_Pr->SiS_VGAHDE == 800) tempbx += 10; + } } } } @@ -5638,8 +5529,9 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex, if(tempbx & 0x0100) tempcx |= 0x0004; if(tempbx & 0x0200) tempcx |= 0x0080; if(tempbx & 0x0400) { - if(SiS_Pr->SiS_VBType & VB_SIS301) tempcx |= 0x0800; - else tempcx |= 0x0C00; + if(HwInfo->jChipType >= SIS_661) tempcx |= 0x0800; + else if(SiS_Pr->SiS_VBType & VB_SIS301) tempcx |= 0x0800; + else tempcx |= 0x0C00; } tempbx = push1; @@ -5657,10 +5549,7 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex, tempax = modeflag; temp = (tempax & 0xFF00) >> 8; temp = (temp >> 1) & 0x09; - if(!(SiS_Pr->SiS_VBType & VB_SIS301)) { - /* Only use 8 dot clock */ - temp |= 0x01; - } + if(!(SiS_Pr->SiS_VBType & VB_SIS301)) temp |= 0x01; /* Always 8 dotclock */ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x16,temp); /* 0x16 SR01 */ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0F,0x00); /* 0x0F CR14 */ @@ -5674,521 +5563,478 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex, } } SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1A,temp); /* 0x1A SR0E */ + + temp = SiS_GetRegByte((SiS_Pr->SiS_P3ca+0x02)); + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1b,temp); } -/*********** Set Part 1 / LVDS ***********/ +/* Setup panel link + * This is used for LVDS, LCDA and Chrontel TV output + * 300/LVDS+TV, 300/301B-DH, 315/LVDS+TV, 315/LCDA + */ static void SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, - PSIS_HW_INFO HwInfo, USHORT RefreshRateTableIndex) + PSIS_HW_INFO HwInfo, USHORT RefreshRateTableIndex) { - USHORT modeflag, resinfo; - USHORT push1, push2, tempax, tempbx, tempcx, temp; + USHORT modeflag,resinfo; + USHORT push2,tempax,tempbx,tempcx,temp; + ULONG tempeax=0,tempebx,tempecx,tempvcfact=0; + BOOLEAN islvds = FALSE, issis = FALSE, chkdclkfirst = FALSE; +#ifdef SIS300 + USHORT crt2crtc; +#endif #ifdef SIS315H USHORT pushcx; #endif - ULONG tempeax=0, tempebx, tempecx, tempvcfact=0; - - /* This is not supported on LVDS */ - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_PanelCustom) return; - if(SiS_Pr->UseCustomMode) return; if(ModeNo <= 0x13) { modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo; +#ifdef SIS300 + crt2crtc = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; +#endif + } else if(SiS_Pr->UseCustomMode) { + modeflag = SiS_Pr->CModeFlag; + resinfo = 0; +#ifdef SIS300 + crt2crtc = 0; +#endif } else { modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; +#ifdef SIS300 + crt2crtc = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; +#endif } - /* Set up Panel Link */ - - /* 1. Horizontal setup */ - - tempax = SiS_Pr->SiS_LCDHDES; - - if((!SiS_Pr->SiS_IF_DEF_FSTN) && (!SiS_Pr->SiS_IF_DEF_DSTN)) { - if( (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) && - (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) ) { - tempax -= 8; - } + /* is lvds if really LVDS, or SiS 301B-DH with external LVDS transmitter */ + if((SiS_Pr->SiS_IF_DEF_LVDS == 1) || + ((SiS_Pr->SiS_VBType & VB_SISVB) && (SiS_Pr->SiS_VBType & VB_NoLCD))) { + islvds = TRUE; } - tempcx = SiS_Pr->SiS_HT; /* Horiz. Total */ - - tempbx = SiS_Pr->SiS_HDE; /* Horiz. Display End */ + /* is really sis if sis bridge, but not 301B-DH */ + if((SiS_Pr->SiS_VBType & VB_SISVB) && (!(SiS_Pr->SiS_VBType & VB_NoLCD))) { + issis = TRUE; + } - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480_2 || - SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480_3) { - tempbx >>= 1; + if((HwInfo->jChipType >= SIS_315H) && (islvds) && (!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA))) { + if((!SiS_Pr->SiS_IF_DEF_FSTN) && (!SiS_Pr->SiS_IF_DEF_DSTN)) { + chkdclkfirst = TRUE; + } } - if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) { - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { - if(SiS_Pr->SiS_IF_DEF_FSTN || SiS_Pr->SiS_IF_DEF_DSTN) { - tempbx = SiS_Pr->PanelXRes; - } else if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) { - tempbx = SiS_Pr->PanelXRes; - if(SiS_Pr->SiS_CustomT == CUT_BARCO1024) { - tempbx = 800; - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel800x600) { - tempbx = 1024; +#ifdef SIS315H + if((HwInfo->jChipType >= SIS_315H) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { + if(IS_SIS330) { + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x10); + } else if(IS_SIS740) { + if(islvds) { + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,0xfb,0x04); + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x03); + } else if(SiS_Pr->SiS_VBType & VB_SISVB) { + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x10); + } + } else { + if(islvds) { + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,0xfb,0x04); + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x00); + } else if(SiS_Pr->SiS_VBType & VB_SISVB) { + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2D,0x0f); + if(SiS_Pr->SiS_VBType & VB_SIS301C) { + if((SiS_Pr->SiS_LCDResInfo == Panel_1024x768) || + (SiS_Pr->SiS_LCDResInfo == Panel_1280x1024)) { + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2D,0x20); } } } } } - tempcx = (tempcx - tempbx) >> 2; /* HT-HDE / 4 */ - - push1 = tempax; - - tempax += tempbx; - - if(tempax >= SiS_Pr->SiS_HT) tempax -= SiS_Pr->SiS_HT; +#endif - push2 = tempax; + /* Horizontal */ - if((!SiS_Pr->SiS_IF_DEF_FSTN) && - (!SiS_Pr->SiS_IF_DEF_DSTN) && - (SiS_Pr->SiS_CustomT != CUT_BARCO1366) && - (SiS_Pr->SiS_CustomT != CUT_BARCO1024) && - (SiS_Pr->SiS_CustomT != CUT_PANEL848)) { - if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) { - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempcx = 0x0028; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) tempcx = 0x0018; - else if( (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) || - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) ) { - if(HwInfo->jChipType < SIS_315H) { - if(SiS_Pr->SiS_VBType & VB_SISVB) { - tempcx = 0x0017; /* A901; sometimes 0x0018; */ - } else { - tempcx = 0x0017; -#ifdef TWNEWPANEL - tempcx = 0x0018; -#endif - } - } else { - tempcx = 0x0018; - } - } - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) tempcx = 0x0028; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempcx = 0x0030; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempcx = 0x0030; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempcx = 0x0040; + tempax = SiS_Pr->SiS_LCDHDES; + if(islvds) { + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { + if((!SiS_Pr->SiS_IF_DEF_FSTN) && (!SiS_Pr->SiS_IF_DEF_DSTN)) { + if((SiS_Pr->SiS_LCDResInfo == Panel_640x480) && + (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode))) { + tempax -= 8; } - } + } } } - tempcx += tempax; /* lcdhrs */ - if(tempcx >= SiS_Pr->SiS_HT) tempcx -= SiS_Pr->SiS_HT; - - tempax = tempcx >> 3; /* BPLHRS */ - temp = tempax & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x14,temp); /* Part1_14h; Panel Link Horizontal Retrace Start */ + temp = (tempax & 0x0007); + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1A,temp); /* BPLHDESKEW[2:0] */ + temp = (tempax >> 3) & 0x00FF; + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x16,temp); /* BPLHDESKEW[10:3] */ - if(SiS_Pr->SiS_LCDInfo & LCDPass11) { - temp = (tempax & 0x00FF) + 2; - } else { - temp = (tempax & 0x00FF) + 10; - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - if((!SiS_Pr->SiS_IF_DEF_DSTN) && - (!SiS_Pr->SiS_IF_DEF_FSTN) && - (SiS_Pr->SiS_CustomT != CUT_BARCO1366) && - (SiS_Pr->SiS_CustomT != CUT_BARCO1024) && - (SiS_Pr->SiS_CustomT != CUT_PANEL848)) { - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) { - temp += 6; - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel800x600) { - temp++; - if(HwInfo->jChipType >= SIS_315H) { - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1024x768) { - temp += 7; - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1600x1200) { - temp -= 0x14; - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x768) { - temp -= 10; - } - } - } - } - } - } - } + tempbx = SiS_Pr->SiS_HDE; + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { + if((SiS_Pr->SiS_LCDResInfo == Panel_640x480_2) || + (SiS_Pr->SiS_LCDResInfo == Panel_640x480_3)) { + tempbx >>= 1; + } + if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) { + tempbx = SiS_Pr->PanelXRes; } } - temp &= 0x1F; - temp |= ((tempcx & 0x0007) << 5); + tempax += tempbx; + if(tempax >= SiS_Pr->SiS_HT) tempax -= SiS_Pr->SiS_HT; + + temp = tempax; #if 0 - if(SiS_Pr->SiS_IF_DEF_FSTN) temp = 0x20; /* WRONG? BIOS loads cl, not ah */ + /* TEST 2 */ + if((HwInfo->jChipType >= SIS_315H) && (islvds) && (SiS_Pr->SiS_LCDResInfo == Panel_1400x1050)) { + } else + /* /TEST2 */ #endif - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x15,temp); /* Part1_15h; Panel Link Horizontal Retrace End/Skew */ - - tempbx = push2; - tempcx = push1; /* lcdhdes */ - - temp = (tempcx & 0x0007); /* BPLHDESKEW */ - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1A,temp); /* Part1_1Ah; Panel Link Vertical Retrace Start (2:0) */ + if(temp & 0x07) temp += 8; + temp >>= 3; + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x17,temp); /* BPLHDEE */ - tempcx >>= 3; /* BPLHDES */ - temp = (tempcx & 0x00FF); -#if 0 /* Not 550 FSTN */ - if(HwInfo->jChipType >= SIS_315H) { - if(ModeNo == 0x5b) temp--; */ - } -#endif - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x16,temp); /* Part1_16h; Panel Link Horizontal Display Enable Start */ + tempcx = (SiS_Pr->SiS_HT - tempbx) >> 2; - if((HwInfo->jChipType < SIS_315H) || - (SiS_Pr->SiS_IF_DEF_FSTN) || - (SiS_Pr->SiS_IF_DEF_DSTN)) { - if(tempbx & 0x07) tempbx += 8; - } - tempbx >>= 3; /* BPLHDEE */ - temp = tempbx & 0x00FF; -#if 0 /* Not 550 FSTN */ - if(HwInfo->jChipType >= SIS_315H) { - if(ModeNo == 0x5b) temp--; + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { + if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) { + if(SiS_Pr->PanelHRS != 999) tempcx = SiS_Pr->PanelHRS; + } } -#endif - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x17,temp); /* Part1_17h; Panel Link Horizontal Display Enable End */ - /* 2. Vertical setup */ + tempcx += tempax; + if(tempcx >= SiS_Pr->SiS_HT) tempcx -= SiS_Pr->SiS_HT; - if(HwInfo->jChipType < SIS_315H) { - tempcx = SiS_Pr->SiS_VGAVT; - tempbx = SiS_Pr->SiS_VGAVDE; - if((SiS_Pr->SiS_CustomT != CUT_BARCO1366) && (SiS_Pr->SiS_CustomT != CUT_BARCO1024)) { - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) { - tempbx = SiS_Pr->PanelYRes; + temp = (tempcx >> 3) & 0x00FF; + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { + if(SiS_Pr->SiS_IF_DEF_TRUMPION) { + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { + switch(ModeNo) { + case 0x04: + case 0x05: + case 0x0d: temp = 0x56; break; + case 0x10: temp = 0x60; break; + case 0x13: temp = 0x5f; break; + case 0x40: + case 0x41: + case 0x4f: + case 0x43: + case 0x44: + case 0x62: + case 0x56: + case 0x53: + case 0x5d: + case 0x5e: temp = 0x54; break; } - } + } } - tempcx -= tempbx; + } + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x14,temp); /* BPLHRS */ + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { + temp += 2; + if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) { + temp += 8; +#if 0 + /* TEST 1 */ + if((HwInfo->jChipType >= SIS_315H) && (islvds) && (SiS_Pr->SiS_LCDResInfo == Panel_1400x1050)) { + temp -= 16; + } else + /* /test1 */ +#endif + if(SiS_Pr->PanelHRE != 999) { + temp = tempcx + SiS_Pr->PanelHRE; + if(temp >= SiS_Pr->SiS_HT) temp -= SiS_Pr->SiS_HT; + temp >>= 3; + } + } } else { - - tempcx = SiS_Pr->SiS_VGAVT - SiS_Pr->SiS_VGAVDE; /* VGAVT-VGAVDE */ - + temp += 10; } - tempbx = SiS_Pr->SiS_LCDVDES; /* VGAVDES */ - push1 = tempbx; + temp &= 0x1F; + temp |= ((tempcx & 0x07) << 5); +#if 0 + if(SiS_Pr->SiS_IF_DEF_FSTN) temp = 0x20; /* WRONG? BIOS loads cl, not ah */ +#endif + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x15,temp); /* BPLHRE */ + + /* Vertical */ tempax = SiS_Pr->SiS_VGAVDE; - - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - if((SiS_Pr->SiS_CustomT == CUT_BARCO1366) || (SiS_Pr->SiS_CustomT == CUT_BARCO1024)) { - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) { - tempax = 600; - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel800x600) { - tempax = 768; - } - } - } else if( (SiS_Pr->SiS_IF_DEF_TRUMPION == 0) && - (!(SiS_Pr->SiS_LCDInfo & LCDPass11)) && - ((SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) || - (SiS_Pr->SiS_IF_DEF_FSTN) || - (SiS_Pr->SiS_IF_DEF_DSTN)) ) { + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { + if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) { tempax = SiS_Pr->PanelYRes; } } - tempbx += tempax; + tempbx = SiS_Pr->SiS_LCDVDES + tempax; if(tempbx >= SiS_Pr->SiS_VT) tempbx -= SiS_Pr->SiS_VT; push2 = tempbx; - tempcx >>= 1; - - if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) && - (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) && - (SiS_Pr->SiS_CustomT != CUT_BARCO1366) && - (SiS_Pr->SiS_CustomT != CUT_BARCO1024) && - (SiS_Pr->SiS_CustomT != CUT_PANEL848)) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480_2 || - SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480_3) { - tempcx = 0x0017; - } else if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) { - if(SiS_Pr->SiS_IF_DEF_FSTN || SiS_Pr->SiS_IF_DEF_DSTN) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempcx = 0x0003; - else if((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) || - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768)) tempcx = 0x0003; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempcx = 0x0001; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempcx = 0x0001; - else tempcx = 0x0057; - } else { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempcx = 0x0001; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) tempcx = 0x0001; - else if((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) || - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768)) { - if(HwInfo->jChipType < SIS_315H) { - if(SiS_Pr->SiS_VBType & VB_SISVB) { - tempcx = 0x0002; /* A901; sometimes 0x0003; */ - } else { - tempcx = 0x0002; -#ifdef TWNEWPANEL - tempcx = 0x0003; -#endif - } - } else tempcx = 0x0003; - } - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) tempcx = 0x0003; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempcx = 0x0001; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempcx = 0x0001; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempcx = 0x0001; - else tempcx = 0x0057; + tempcx = SiS_Pr->SiS_VGAVT - SiS_Pr->SiS_VGAVDE; + if(HwInfo->jChipType < SIS_315H) { + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { + if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) { + tempcx = SiS_Pr->SiS_VGAVT - SiS_Pr->PanelYRes; } } } + if(islvds) tempcx >>= 1; + else tempcx >>= 2; - tempbx += tempcx; /* BPLVRS */ - - if((HwInfo->jChipType < SIS_315H) || - (SiS_Pr->SiS_IF_DEF_FSTN) || - (SiS_Pr->SiS_IF_DEF_DSTN)) { - tempbx++; + if( (SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) && + (!(SiS_Pr->SiS_LCDInfo & LCDPass11)) && + (SiS_Pr->PanelVRS != 999) ) { + tempcx = SiS_Pr->PanelVRS; + tempbx += tempcx; + if(issis) tempbx++; + } else { + tempbx += tempcx; + if(HwInfo->jChipType < SIS_315H) tempbx++; + else if(issis) tempbx++; } - if(tempbx >= SiS_Pr->SiS_VT) tempbx -= SiS_Pr->SiS_VT; + if(tempbx >= SiS_Pr->SiS_VT) tempbx -= SiS_Pr->SiS_VT; /* BPLVRS */ temp = tempbx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x18,temp); /* Part1_18h; Panel Link Vertical Retrace Start */ + if(SiS_Pr->SiS_IF_DEF_TRUMPION) { + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { + if(ModeNo == 0x10) temp = 0xa9; + } + } + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x18,temp); tempcx >>= 3; + tempcx++; - if((!(SiS_Pr->SiS_LCDInfo & LCDPass11)) && - (SiS_Pr->SiS_CustomT != CUT_BARCO1366) && - (SiS_Pr->SiS_CustomT != CUT_BARCO1024) && - (SiS_Pr->SiS_CustomT != CUT_PANEL848)) { - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - if( (HwInfo->jChipType < SIS_315H) && - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) ) tempcx = 0x0001; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480_2) tempcx = 0x0002; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480_3) tempcx = 0x0002; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) tempcx = 0x0003; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) tempcx = 0x0005; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1152x768) tempcx = 0x0005; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x768) tempcx = 0x0011; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) tempcx = 0x0005; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) tempcx = 0x0002; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) tempcx = 0x0011; - else if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) { - if(HwInfo->jChipType < SIS_315H) { - if(SiS_Pr->SiS_VBType & VB_SISVB) { - tempcx = 0x0004; /* A901; Other BIOS sets 0x0005; */ - } else { - tempcx = 0x0004; -#ifdef TWNEWPANEL - tempcx = 0x0005; -#endif - } - } else { - tempcx = 0x0005; - } - } + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { + if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) { + if(SiS_Pr->PanelVRE != 999) tempcx = SiS_Pr->PanelVRE; } } - tempcx = tempcx + tempbx + 1; /* BPLVRE */ + tempcx += tempbx; temp = tempcx & 0x000F; - if(SiS_Pr->SiS_IF_DEF_FSTN || - SiS_Pr->SiS_IF_DEF_DSTN || - (SiS_Pr->SiS_CustomT == CUT_BARCO1366) || - (SiS_Pr->SiS_CustomT == CUT_BARCO1024) || - (SiS_Pr->SiS_CustomT == CUT_PANEL848)) { - temp |= 0x30; - } - SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0xf0,temp); /* Part1_19h; Panel Link Vertical Retrace End (3:0); Misc. */ + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0xF0,temp); /* BPLVRE */ - temp = ((tempbx & 0x0700) >> 8) << 3; /* BPLDESKEW =0 */ + temp = ((tempbx >> 8) & 0x07) << 3; if(SiS_Pr->SiS_IF_DEF_FSTN || SiS_Pr->SiS_IF_DEF_DSTN) { if(SiS_Pr->SiS_HDE != 640) { - if(SiS_Pr->SiS_VGAVDE != SiS_Pr->SiS_VDE) temp |= 0x40; + if(SiS_Pr->SiS_VGAVDE != SiS_Pr->SiS_VDE) temp |= 0x40; + } + } else if(SiS_Pr->SiS_VGAVDE != SiS_Pr->SiS_VDE) temp |= 0x40; + if(SiS_Pr->SiS_SetFlag & EnableLVDSDDA) temp |= 0x40; + tempbx = 0x87; + if((HwInfo->jChipType >= SIS_315H) || + (HwInfo->jChipRevision >= 0x30)) { + tempbx = 0x07; + if((SiS_Pr->SiS_IF_DEF_CH70xx == 1) && (SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) { + if(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00) & 0x03) temp |= 0x80; + } + /* Chrontel 701x operates in 24bit mode (8-8-8, 2x12bit mutliplexed) via VGA2 */ + if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x06) & 0x10) temp |= 0x80; + } else { + if(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00) & 0x01) temp |= 0x80; + } } - } else if(SiS_Pr->SiS_VGAVDE != SiS_Pr->SiS_VDE) temp |= 0x40; - if(SiS_Pr->SiS_SetFlag & EnableLVDSDDA) temp |= 0x40; - if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) { - if(HwInfo->jChipType >= SIS_315H) { - if(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00) & 0x01) { - temp |= 0x80; + } + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x1A,tempbx,temp); + + tempbx = push2; /* BPLVDEE */ + + tempcx = SiS_Pr->SiS_LCDVDES; /* BPLVDES */ + + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { + switch(SiS_Pr->SiS_LCDResInfo) { + case Panel_640x480: + tempbx = SiS_Pr->SiS_VGAVDE - 1; + tempcx = SiS_Pr->SiS_VGAVDE; + break; + case Panel_800x600: + if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { + if(resinfo == SIS_RI_800x600) tempcx++; } - } else { - if( (HwInfo->jChipType == SIS_630) || - (HwInfo->jChipType == SIS_730) ) { - if(HwInfo->jChipRevision >= 0x30) { - temp |= 0x80; + break; + case Panel_1024x600: + if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { + if(resinfo == SIS_RI_1024x600) tempcx++; + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + if(resinfo == SIS_RI_800x600) tempcx++; } - } + } + break; + case Panel_1024x768: + if(HwInfo->jChipType < SIS_315H) { + if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { + if(resinfo == SIS_RI_1024x768) tempcx++; + } + } + break; } } - SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x1A,0x87,temp); /* Part1_1Ah; Panel Link Control Signal (7:3); Vertical Retrace Start (2:0) */ - if (HwInfo->jChipType < SIS_315H) { + temp = ((tempbx >> 8) & 0x07) << 3; + temp = temp | ((tempcx >> 8) & 0x07); + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1D,temp); + /* if(SiS_Pr->SiS_IF_DEF_FSTN) tempbx++; */ + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1C,tempbx); + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1B,tempcx); -#ifdef SIS300 /* 300 series */ + /* Vertical scaling */ - tempeax = SiS_Pr->SiS_VGAVDE << 6; - temp = (USHORT)(tempeax % (ULONG)SiS_Pr->SiS_VDE); - tempeax = tempeax / (ULONG)SiS_Pr->SiS_VDE; - if(temp != 0) tempeax++; - tempebx = tempeax; /* BPLVCFACT */ + if(HwInfo->jChipType < SIS_315H) { - if(SiS_Pr->SiS_SetFlag & EnableLVDSDDA) { - tempebx = 0x003F; - } +#ifdef SIS300 /* 300 series */ + tempeax = SiS_Pr->SiS_VGAVDE << 6; + temp = (tempeax % (ULONG)SiS_Pr->SiS_VDE); + tempeax = tempeax / (ULONG)SiS_Pr->SiS_VDE; + if(temp) tempeax++; - temp = (USHORT)(tempebx & 0x00FF); - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1E,temp); /* Part1_1Eh; Panel Link Vertical Scaling Factor */ + if(SiS_Pr->SiS_SetFlag & EnableLVDSDDA) tempeax = 0x3F; + temp = (USHORT)(tempeax & 0x00FF); + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1E,temp); /* BPLVCFACT */ + tempvcfact = temp; #endif /* SIS300 */ } else { #ifdef SIS315H /* 315 series */ + tempeax = SiS_Pr->SiS_VGAVDE << 18; + tempebx = SiS_Pr->SiS_VDE; + temp = (tempeax % tempebx); + tempeax = tempeax / tempebx; + if(temp) tempeax++; + tempvcfact = tempeax; - if(HwInfo->jChipType == SIS_740) { - SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x1E,0x03); - } else { - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1E,0x23); - } - - tempeax = SiS_Pr->SiS_VGAVDE << 18; - temp = (USHORT)(tempeax % (ULONG)SiS_Pr->SiS_VDE); - tempeax = tempeax / SiS_Pr->SiS_VDE; - if(temp != 0) tempeax++; - tempebx = tempeax; /* BPLVCFACT */ - tempvcfact = tempeax; - temp = (USHORT)(tempebx & 0x00FF); - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x37,temp); /* Part1_37h; Panel Link Vertical Scaling Factor */ - temp = (USHORT)((tempebx & 0x00FF00) >> 8); - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x36,temp); /* Part1_36h; Panel Link Vertical Scaling Factor */ - temp = (USHORT)((tempebx & 0x00030000) >> 16); - temp &= 0x03; - if(SiS_Pr->SiS_VDE == SiS_Pr->SiS_VGAVDE) temp |= 0x04; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x35,temp); /* Part1_35h; Panel Link Vertical Scaling Factor */ - -#endif /* SIS315H */ - - } - - tempbx = push2; /* BPLVDEE */ - tempcx = push1; - - push1 = temp; - - if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { - if(!SiS_Pr->SiS_IF_DEF_FSTN && !SiS_Pr->SiS_IF_DEF_DSTN) { - if(HwInfo->jChipType < SIS_315H) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x600) { - if(resinfo == SIS_RI_1024x600) tempcx++; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { - if(resinfo == SIS_RI_800x600) tempcx++; - } - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) { - if(resinfo == SIS_RI_800x600) tempcx++; - if(resinfo == SIS_RI_1024x768) tempcx++; /* Doesnt make sense anyway... */ - } else if(resinfo == SIS_RI_1024x768) tempcx++; - } else { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel800x600) { - if(resinfo == SIS_RI_800x600) tempcx++; - } - } - } - } - - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) { - if((!SiS_Pr->SiS_IF_DEF_FSTN) && (!SiS_Pr->SiS_IF_DEF_DSTN)) { - tempcx = SiS_Pr->SiS_VGAVDE; - tempbx = SiS_Pr->SiS_VGAVDE - 1; + temp = (USHORT)(tempeax & 0x00FF); + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x37,temp); + temp = (USHORT)((tempeax & 0x00FF00) >> 8); + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x36,temp); + temp = (USHORT)((tempeax & 0x00030000) >> 16); + if(SiS_Pr->SiS_VDE == SiS_Pr->SiS_VGAVDE) temp |= 0x04; + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x35,temp); + + if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302ELV)) { + temp = (USHORT)(tempeax & 0x00FF); + SiS_SetReg(SiS_Pr->SiS_Part4Port,0x3c,temp); + temp = (USHORT)((tempeax & 0x00FF00) >> 8); + SiS_SetReg(SiS_Pr->SiS_Part4Port,0x3b,temp); + temp = (USHORT)(((tempeax & 0x00030000) >> 16) << 6); + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x3a,0x3f,temp); + temp = 0; + if(SiS_Pr->SiS_VDE != SiS_Pr->SiS_VGAVDE) temp |= 0x08; + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x30,0xf3,temp); } - } - - temp = ((tempbx & 0x0700) >> 8) << 3; - temp |= ((tempcx & 0x0700) >> 8); - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1D,temp); /* Part1_1Dh; Vertical Display Overflow; Control Signal */ - - temp = tempbx & 0x00FF; - /* if(SiS_Pr->SiS_IF_DEF_FSTN) temp++; */ - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1C,temp); /* Part1_1Ch; Panel Link Vertical Display Enable End */ +#endif - temp = tempcx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1B,temp); /* Part1_1Bh; Panel Link Vertical Display Enable Start */ + } - /* 3. Additional horizontal setup (scaling, etc) */ + /* Horizontal scaling */ - tempecx = SiS_Pr->SiS_VGAHDE; - if(HwInfo->jChipType >= SIS_315H) { - if((!SiS_Pr->SiS_IF_DEF_FSTN) && (!SiS_Pr->SiS_IF_DEF_DSTN)) { - if(modeflag & HalfDCLK) tempecx >>= 1; - } + tempeax = SiS_Pr->SiS_VGAHDE; /* 1f = ( (VGAHDE * 65536) / ( (VGAHDE * 65536) / HDE ) ) - 1*/ + if(chkdclkfirst) { + if(modeflag & HalfDCLK) tempeax >>= 1; } - tempebx = SiS_Pr->SiS_HDE; - if(tempecx == tempebx) tempeax = 0xFFFF; - else { - tempeax = tempecx; - tempeax <<= 16; - temp = (USHORT)(tempeax % tempebx); - tempeax = tempeax / tempebx; + tempebx = tempeax << 16; + if(SiS_Pr->SiS_HDE == tempeax) { + tempecx = 0xFFFF; + } else { + tempecx = tempebx / SiS_Pr->SiS_HDE; if(HwInfo->jChipType >= SIS_315H) { - if(temp) tempeax++; + if(tempebx % SiS_Pr->SiS_HDE) tempecx++; } } - tempecx = tempeax; if(HwInfo->jChipType >= SIS_315H) { - tempeax = SiS_Pr->SiS_VGAHDE; - if((!SiS_Pr->SiS_IF_DEF_FSTN) && (!SiS_Pr->SiS_IF_DEF_DSTN)) { - if(modeflag & HalfDCLK) tempeax >>= 1; - } - tempeax <<= 16; - tempeax = (tempeax / tempecx) - 1; + tempeax = (tempebx / tempecx) - 1; } else { tempeax = ((SiS_Pr->SiS_VGAHT << 16) / tempecx) - 1; } - tempecx <<= 16; - tempecx |= (tempeax & 0xFFFF); + tempecx = (tempecx << 16) | (tempeax & 0xFFFF); temp = (USHORT)(tempecx & 0x00FF); - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1F,temp); /* Part1_1Fh; Panel Link DDA Operational Number in each horiz. line */ + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1F,temp); - tempbx = SiS_Pr->SiS_VDE; if(HwInfo->jChipType >= SIS_315H) { tempeax = (SiS_Pr->SiS_VGAVDE << 18) / tempvcfact; - tempbx = (USHORT)(tempeax & 0x0FFFF); + tempbx = (USHORT)(tempeax & 0xFFFF); } else { tempeax = SiS_Pr->SiS_VGAVDE << 6; - tempbx = push1 & 0x3f; + tempbx = tempvcfact & 0x3f; if(tempbx == 0) tempbx = 64; tempeax /= tempbx; - tempbx = (USHORT)(tempeax & 0x0FFFF); + tempbx = (USHORT)(tempeax & 0xFFFF); } - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) tempbx--; + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) tempbx--; if(SiS_Pr->SiS_SetFlag & EnableLVDSDDA) { if((!SiS_Pr->SiS_IF_DEF_FSTN) && (!SiS_Pr->SiS_IF_DEF_DSTN)) tempbx = 1; - else if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) tempbx = 1; + else if(SiS_Pr->SiS_LCDResInfo != Panel_640x480) tempbx = 1; } - temp = ((tempbx & 0xFF00) >> 8) << 3; - temp |= (USHORT)((tempecx & 0x0700) >> 8); - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x20,temp); /* Part1_20h; Overflow register */ - - temp = tempbx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x21,temp); /* Part1_21h; Panel Link Vertical Accumulator Register */ + temp = ((tempbx >> 8) & 0x07) << 3; + temp = temp | ((tempecx >> 8) & 0x07); + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x20,temp); + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x21,tempbx); - tempecx >>= 16; /* BPLHCFACT */ - if((HwInfo->jChipType < SIS_315H) || (SiS_Pr->SiS_IF_DEF_FSTN) || (SiS_Pr->SiS_IF_DEF_DSTN)) { + tempecx >>= 16; /* BPLHCFACT */ + if(!chkdclkfirst) { if(modeflag & HalfDCLK) tempecx >>= 1; } temp = (USHORT)((tempecx & 0xFF00) >> 8); - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x22,temp); /* Part1_22h; Panel Link Horizontal Scaling Factor High */ - + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x22,temp); temp = (USHORT)(tempecx & 0x00FF); - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x23,temp); /* Part1_22h; Panel Link Horizontal Scaling Factor Low */ + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x23,temp); - /* 630/301B and 630/LVDS do something for 640x480 panels here */ +#ifdef SIS315H + if(HwInfo->jChipType >= SIS_315H) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + if((islvds) || (SiS_Pr->SiS_VBInfo & VB_SIS301LV302LV)) { + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1e,0x20); + } + } else { + if(islvds) { + if(HwInfo->jChipType == SIS_740) { + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x1e,0x03); + } else { + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1e,0x23); + } + } + } + } +#endif + +#ifdef SIS300 + if(SiS_Pr->SiS_IF_DEF_TRUMPION) { + int i; + UCHAR TrumpMode13[4] = { 0x01, 0x10, 0x2c, 0x00 }; + UCHAR TrumpMode10_1[4] = { 0x01, 0x10, 0x27, 0x00 }; + UCHAR TrumpMode10_2[4] = { 0x01, 0x16, 0x10, 0x00 }; + + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x02,0xbf); + for(i=0; i<5; i++) { + SiS_SetTrumpionBlock(SiS_Pr, &SiS300_TrumpionData[crt2crtc][0]); + } + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { + if(ModeNo == 0x13) { + for(i=0; i<4; i++) { + SiS_SetTrumpionBlock(SiS_Pr, &TrumpMode13[0]); + } + } else if(ModeNo == 0x10) { + for(i=0; i<4; i++) { + SiS_SetTrumpionBlock(SiS_Pr, &TrumpMode10_1[0]); + SiS_SetTrumpionBlock(SiS_Pr, &TrumpMode10_2[0]); + } + } + } + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x02,0x40); + } +#endif #ifdef SIS315H if(SiS_Pr->SiS_IF_DEF_FSTN || SiS_Pr->SiS_IF_DEF_DSTN) { @@ -6198,10 +6044,10 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, SiS_SetReg(SiS_Pr->SiS_Part1Port,0x28,0x87); SiS_SetReg(SiS_Pr->SiS_Part1Port,0x29,0x5A); SiS_SetReg(SiS_Pr->SiS_Part1Port,0x2A,0x4B); - SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x44,~0x007,0x03); + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x44,~0x07,0x03); tempax = SiS_Pr->SiS_HDE; /* Blps = lcdhdee(lcdhdes+HDE) + 64 */ - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480_2 || - SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480_3) tempax >>= 1; + if(SiS_Pr->SiS_LCDResInfo == Panel_640x480_2 || + SiS_Pr->SiS_LCDResInfo == Panel_640x480_3) tempax >>= 1; tempax += 64; temp = tempax & 0x00FF; SiS_SetReg(SiS_Pr->SiS_Part1Port,0x38,temp); @@ -6215,8 +6061,8 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x3C,~0x007,0x00); tempax = SiS_Pr->SiS_VDE; - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480_2 || - SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480_3) tempax >>= 1; + if(SiS_Pr->SiS_LCDResInfo == Panel_640x480_2 || + SiS_Pr->SiS_LCDResInfo == Panel_640x480_3) tempax >>= 1; tempax >>= 1; temp = tempax & 0x00FF; SiS_SetReg(SiS_Pr->SiS_Part1Port,0x3B,temp); @@ -6224,8 +6070,8 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x3C,~0x038,temp); tempeax = SiS_Pr->SiS_HDE; - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480_2 || - SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480_3) tempeax >>= 1; + if(SiS_Pr->SiS_LCDResInfo == Panel_640x480_2 || + SiS_Pr->SiS_LCDResInfo == Panel_640x480_3) tempeax >>= 1; tempeax <<= 2; /* BDxFIFOSTOP = (HDE*4)/128 */ tempebx = 128; temp = (USHORT)(tempeax % tempebx); @@ -6239,8 +6085,8 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x3C,~0x040,0x00); tempax = SiS_Pr->SiS_HDE; - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480_2 || - SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480_3) tempax >>= 1; + if(SiS_Pr->SiS_LCDResInfo == Panel_640x480_2 || + SiS_Pr->SiS_LCDResInfo == Panel_640x480_3) tempax >>= 1; tempax >>= 4; /* BDxWadroff = HDE*4/8/8 */ pushcx = tempax; temp = tempax & 0x00FF; @@ -6249,8 +6095,8 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x44,~0x0F8,temp); tempax = SiS_Pr->SiS_VDE; /* BDxWadrst1 = BDxWadrst0 + BDxWadroff * VDE */ - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480_2 || - SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480_3) tempax >>= 1; + if(SiS_Pr->SiS_LCDResInfo == Panel_640x480_2 || + SiS_Pr->SiS_LCDResInfo == Panel_640x480_3) tempax >>= 1; tempeax = (tempax * pushcx); tempebx = 0x00100000 + tempeax; temp = (USHORT)tempebx & 0x000000FF; @@ -6292,508 +6138,422 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } } #endif /* SIS315H */ - } -/************** Set Part 1 ***************/ +/* Set Part 1 */ static void SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, PSIS_HW_INFO HwInfo, USHORT RefreshRateTableIndex) { - UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; + UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; USHORT temp=0, tempax=0, tempbx=0, tempcx=0; - USHORT pushbx=0, CRT1Index=0; + USHORT pushbx=0, CRT1Index=0, modeflag, resinfo=0; #ifdef SIS315H USHORT tempbl=0; #endif - USHORT modeflag, resinfo=0; + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + SiS_SetGroup1_LVDS(SiS_Pr, ModeNo, ModeIdIndex, HwInfo, RefreshRateTableIndex); + return; + } if(ModeNo <= 0x13) { modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } else if(SiS_Pr->UseCustomMode) { + modeflag = SiS_Pr->CModeFlag; } else { - if(SiS_Pr->UseCustomMode) { - modeflag = SiS_Pr->CModeFlag; - } else { - CRT1Index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; - resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - } + CRT1Index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; + resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; } - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + SiS_SetCRT2Offset(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo); -#ifdef SIS315H - SiS_SetCRT2Sync(SiS_Pr, ModeNo, RefreshRateTableIndex, HwInfo); - SiS_SetGroup1_LCDA(SiS_Pr, ModeNo, ModeIdIndex, HwInfo, RefreshRateTableIndex); -#endif - - } else { - - if( (HwInfo->jChipType >= SIS_315H) && + if( ! ((HwInfo->jChipType >= SIS_315H) && (SiS_Pr->SiS_IF_DEF_LVDS == 1) && - (SiS_Pr->SiS_VBInfo & SetInSlaveMode) ) { - - SiS_SetCRT2Sync(SiS_Pr, ModeNo, RefreshRateTableIndex, HwInfo); - - } else { - - SiS_SetCRT2Offset(SiS_Pr, ModeNo, ModeIdIndex, - RefreshRateTableIndex, HwInfo); + (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) ) { - if (HwInfo->jChipType < SIS_315H ) { + if(HwInfo->jChipType < SIS_315H ) { #ifdef SIS300 - SiS_SetCRT2FIFO_300(SiS_Pr, ModeNo, HwInfo); + SiS_SetCRT2FIFO_300(SiS_Pr, ModeNo, HwInfo); #endif - } else { + } else { #ifdef SIS315H - SiS_SetCRT2FIFO_310(SiS_Pr); + SiS_SetCRT2FIFO_310(SiS_Pr, HwInfo); #endif - } - - SiS_SetCRT2Sync(SiS_Pr, ModeNo, RefreshRateTableIndex, HwInfo); + } - /* 1. Horizontal setup */ + /* 1. Horizontal setup */ - if(HwInfo->jChipType < SIS_315H ) { + if(HwInfo->jChipType < SIS_315H ) { #ifdef SIS300 /* ------------- 300 series --------------*/ - temp = (SiS_Pr->SiS_VGAHT - 1) & 0x0FF; /* BTVGA2HT 0x08,0x09 */ - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x08,temp); /* CRT2 Horizontal Total */ + temp = (SiS_Pr->SiS_VGAHT - 1) & 0x0FF; /* BTVGA2HT 0x08,0x09 */ + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x08,temp); /* CRT2 Horizontal Total */ - temp = (((SiS_Pr->SiS_VGAHT - 1) & 0xFF00) >> 8) << 4; - SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x09,0x0f,temp); /* CRT2 Horizontal Total Overflow [7:4] */ + temp = (((SiS_Pr->SiS_VGAHT - 1) & 0xFF00) >> 8) << 4; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x09,0x0f,temp); /* CRT2 Horizontal Total Overflow [7:4] */ - temp = (SiS_Pr->SiS_VGAHDE + 12) & 0x0FF; /* BTVGA2HDEE 0x0A,0x0C */ - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0A,temp); /* CRT2 Horizontal Display Enable End */ + temp = (SiS_Pr->SiS_VGAHDE + 12) & 0x0FF; /* BTVGA2HDEE 0x0A,0x0C */ + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0A,temp); /* CRT2 Horizontal Display Enable End */ - pushbx = SiS_Pr->SiS_VGAHDE + 12; /* bx BTVGA@HRS 0x0B,0x0C */ - tempcx = (SiS_Pr->SiS_VGAHT - SiS_Pr->SiS_VGAHDE) >> 2; - tempbx = pushbx + tempcx; - tempcx <<= 1; - tempcx += tempbx; + pushbx = SiS_Pr->SiS_VGAHDE + 12; /* bx BTVGA2HRS 0x0B,0x0C */ + tempcx = (SiS_Pr->SiS_VGAHT - SiS_Pr->SiS_VGAHDE) >> 2; + tempbx = pushbx + tempcx; + tempcx <<= 1; + tempcx += tempbx; - if(SiS_Pr->SiS_VBType & VB_SISVB) { + if(SiS_Pr->SiS_VBType & VB_SISVB) { - if(SiS_Pr->UseCustomMode) { - tempbx = SiS_Pr->CHSyncStart + 12; - tempcx = SiS_Pr->CHSyncEnd + 12; - } + if(SiS_Pr->UseCustomMode) { + tempbx = SiS_Pr->CHSyncStart + 12; + tempcx = SiS_Pr->CHSyncEnd + 12; + } - if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) { - unsigned char cr4, cr14, cr5, cr15; - if(SiS_Pr->UseCustomMode) { - cr4 = SiS_Pr->CCRT1CRTC[4]; - cr14 = SiS_Pr->CCRT1CRTC[14]; - cr5 = SiS_Pr->CCRT1CRTC[5]; - cr15 = SiS_Pr->CCRT1CRTC[15]; - } else { - cr4 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[4]; - cr14 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[14]; - cr5 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[5]; - cr15 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[15]; - } - tempbx = ((cr4 | ((cr14 & 0xC0) << 2)) - 1) << 3; - tempcx = (((cr5 & 0x1F) | ((cr15 & 0x04) << (6-2))) - 1) << 3; - } - - if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (resinfo == SIS_RI_1024x768)){ - if(!(SiS_Pr->SiS_TVMode & TVSetPAL)){ - tempbx = 1040; - tempcx = 1042; - } - } - } + if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) { + unsigned char cr4, cr14, cr5, cr15; + if(SiS_Pr->UseCustomMode) { + cr4 = SiS_Pr->CCRT1CRTC[4]; + cr14 = SiS_Pr->CCRT1CRTC[14]; + cr5 = SiS_Pr->CCRT1CRTC[5]; + cr15 = SiS_Pr->CCRT1CRTC[15]; + } else { + cr4 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[4]; + cr14 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[14]; + cr5 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[5]; + cr15 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[15]; + } + tempbx = ((cr4 | ((cr14 & 0xC0) << 2)) - 1) << 3; + tempcx = (((cr5 & 0x1F) | ((cr15 & 0x04) << (6-2))) - 1) << 3; + } + + if(SiS_Pr->SiS_TVMode & TVSetNTSC1024) { + tempbx = 1040; + tempcx = 1044; + } + + } + + temp = tempbx & 0x00FF; + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0B,temp); /* CRT2 Horizontal Retrace Start */ - temp = tempbx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0B,temp); /* CRT2 Horizontal Retrace Start */ #endif /* SIS300 */ - } else { + } else { #ifdef SIS315H /* ------------------- 315/330 series --------------- */ - tempcx = SiS_Pr->SiS_VGAHT; /* BTVGA2HT 0x08,0x09 */ - if(modeflag & HalfDCLK) { - if(SiS_Pr->SiS_VBType & VB_SISVB) { - tempcx >>= 1; - } else { - tempax = SiS_Pr->SiS_VGAHDE >> 1; - tempcx = SiS_Pr->SiS_HT - SiS_Pr->SiS_HDE + tempax; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { - tempcx = SiS_Pr->SiS_HT - tempax; - } - } - } - tempcx--; + tempcx = SiS_Pr->SiS_VGAHT; /* BTVGA2HT 0x08,0x09 */ + if(modeflag & HalfDCLK) { + if(SiS_Pr->SiS_VBType & VB_SISVB) { + tempcx >>= 1; + } else { + tempax = SiS_Pr->SiS_VGAHDE >> 1; + tempcx = SiS_Pr->SiS_HT - SiS_Pr->SiS_HDE + tempax; + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + tempcx = SiS_Pr->SiS_HT - tempax; + } + } + } + tempcx--; - temp = tempcx & 0xff; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x08,temp); /* CRT2 Horizontal Total */ + temp = tempcx & 0xff; + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x08,temp); /* CRT2 Horizontal Total */ - temp = ((tempcx & 0xff00) >> 8) << 4; - SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x09,0x0F,temp); /* CRT2 Horizontal Total Overflow [7:4] */ + temp = ((tempcx & 0xff00) >> 8) << 4; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x09,0x0F,temp); /* CRT2 Horizontal Total Overflow [7:4] */ - tempcx = SiS_Pr->SiS_VGAHT; /* BTVGA2HDEE 0x0A,0x0C */ - tempbx = SiS_Pr->SiS_VGAHDE; - tempcx -= tempbx; - tempcx >>= 2; - if(modeflag & HalfDCLK) { - tempbx >>= 1; - tempcx >>= 1; - } - tempbx += 16; - - temp = tempbx & 0xff; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0A,temp); /* CRT2 Horizontal Display Enable End */ - - pushbx = tempbx; - tempcx >>= 1; - tempbx += tempcx; - tempcx += tempbx; - - if(SiS_Pr->SiS_VBType & VB_SISVB) { - - if(HwInfo->jChipType >= SIS_661) { - if((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) || - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024)) { - if(resinfo == SIS_RI_1280x1024) { - tempcx = 0x30; - } else if(resinfo == SIS_RI_1600x1200) { - tempcx = 0xff; - } - } - } + tempcx = SiS_Pr->SiS_VGAHT; /* BTVGA2HDEE 0x0A,0x0C */ + tempbx = SiS_Pr->SiS_VGAHDE; + tempcx -= tempbx; + tempcx >>= 2; + if(modeflag & HalfDCLK) { + tempbx >>= 1; + tempcx >>= 1; + } + tempbx += 16; - if(SiS_Pr->UseCustomMode) { - tempbx = SiS_Pr->CHSyncStart + 16; - tempcx = SiS_Pr->CHSyncEnd + 16; - tempax = SiS_Pr->SiS_VGAHT; - if(modeflag & HalfDCLK) tempax >>= 1; - tempax--; - if(tempcx > tempax) tempcx = tempax; - } + temp = tempbx & 0xff; + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0A,temp); /* CRT2 Horizontal Display Enable End */ - if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) { - unsigned char cr4, cr14, cr5, cr15; - if(SiS_Pr->UseCustomMode) { - cr4 = SiS_Pr->CCRT1CRTC[4]; - cr14 = SiS_Pr->CCRT1CRTC[14]; - cr5 = SiS_Pr->CCRT1CRTC[5]; - cr15 = SiS_Pr->CCRT1CRTC[15]; - } else { - cr4 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[4]; - cr14 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[14]; - cr5 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[5]; - cr15 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[15]; - } - tempbx = ((cr4 | ((cr14 & 0xC0) << 2)) - 3) << 3; /* (VGAHRS-3)*8 */ - tempcx = (((cr5 & 0x1f) | ((cr15 & 0x04) << (5-2))) - 3) << 3; /* (VGAHRE-3)*8 */ - tempcx &= 0x00FF; - tempcx |= (tempbx & 0xFF00); - tempbx += 16; - tempcx += 16; - tempax = SiS_Pr->SiS_VGAHT; - if(modeflag & HalfDCLK) tempax >>= 1; - tempax--; - if(tempcx > tempax) tempcx = tempax; - } - - if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { - if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) { - if(resinfo == SIS_RI_1024x768) { - tempbx = 1040; - tempcx = 1042; - } - } - } + pushbx = tempbx; + tempcx >>= 1; + tempbx += tempcx; + tempcx += tempbx; - } + if(SiS_Pr->SiS_VBType & VB_SISVB) { - temp = tempbx & 0xff; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0B,temp); /* CRT2 Horizontal Retrace Start */ -#endif /* SIS315H */ + if(HwInfo->jChipType >= SIS_661) { + if((SiS_Pr->SiS_LCDResInfo == Panel_1600x1200) || + (SiS_Pr->SiS_LCDResInfo == Panel_1280x1024)) { + if(resinfo == SIS_RI_1280x1024) { + tempcx = 0x30; + } else if(resinfo == SIS_RI_1600x1200) { + tempcx = 0xff; + } + } + } - } /* 315/330 series */ + if(SiS_Pr->UseCustomMode) { + tempbx = SiS_Pr->CHSyncStart + 16; + tempcx = SiS_Pr->CHSyncEnd + 16; + tempax = SiS_Pr->SiS_VGAHT; + if(modeflag & HalfDCLK) tempax >>= 1; + tempax--; + if(tempcx > tempax) tempcx = tempax; + } - /* The following is done for all bridge/chip types/series */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) { + unsigned char cr4, cr14, cr5, cr15; + if(SiS_Pr->UseCustomMode) { + cr4 = SiS_Pr->CCRT1CRTC[4]; + cr14 = SiS_Pr->CCRT1CRTC[14]; + cr5 = SiS_Pr->CCRT1CRTC[5]; + cr15 = SiS_Pr->CCRT1CRTC[15]; + } else { + cr4 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[4]; + cr14 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[14]; + cr5 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[5]; + cr15 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[15]; + } + tempbx = ((cr4 | ((cr14 & 0xC0) << 2)) - 3) << 3; /* (VGAHRS-3)*8 */ + tempcx = (((cr5 & 0x1f) | ((cr15 & 0x04) << (5-2))) - 3) << 3; /* (VGAHRE-3)*8 */ + tempcx &= 0x00FF; + tempcx |= (tempbx & 0xFF00); + tempbx += 16; + tempcx += 16; + tempax = SiS_Pr->SiS_VGAHT; + if(modeflag & HalfDCLK) tempax >>= 1; + tempax--; + if(tempcx > tempax) tempcx = tempax; + } - tempax = tempbx & 0xFF00; - tempbx = pushbx; - tempbx = (tempbx & 0x00FF) | ((tempbx & 0xFF00) << 4); - tempax |= (tempbx & 0xFF00); - temp = (tempax & 0xFF00) >> 8; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0C,temp); /* Overflow */ + if(SiS_Pr->SiS_TVMode & TVSetNTSC1024) { + tempbx = 1040; + tempcx = 1044; /* HWCursor bug! */ + } - temp = tempcx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0D,temp); /* CRT2 Horizontal Retrace End */ + } - /* 2. Vertical setup */ + temp = tempbx & 0xff; + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0B,temp); /* CRT2 Horizontal Retrace Start */ +#endif /* SIS315H */ - tempcx = SiS_Pr->SiS_VGAVT - 1; - temp = tempcx & 0x00FF; + } /* 315/330 series */ - if(HwInfo->jChipType < SIS_661) { - if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { - if(HwInfo->jChipType < SIS_315H) { - if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { - if(SiS_Pr->SiS_VBInfo & (SetCRT2ToSVIDEO | SetCRT2ToAVIDEO)) { - temp--; - } - } - } else { - temp--; + tempax = tempbx & 0xFF00; + tempbx = pushbx; + tempbx = (tempbx & 0x00FF) | ((tempbx & 0xFF00) << 4); + tempax |= (tempbx & 0xFF00); + temp = (tempax & 0xFF00) >> 8; + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0C,temp); + + temp = tempcx & 0x00FF; + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0D,temp); /* CRT2 Horizontal Retrace End */ + + /* 2. Vertical setup */ + + tempcx = SiS_Pr->SiS_VGAVT - 1; + temp = tempcx & 0x00FF; + + if(HwInfo->jChipType < SIS_661) { + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + if(HwInfo->jChipType < SIS_315H) { + if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToSVIDEO | SetCRT2ToAVIDEO)) { + temp--; + } } - } else if(HwInfo->jChipType >= SIS_315H) { - temp--; - } - } - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0E,temp); /* CRT2 Vertical Total */ - - tempbx = SiS_Pr->SiS_VGAVDE - 1; - temp = tempbx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0F,temp); /* CRT2 Vertical Display Enable End */ - - temp = ((tempbx & 0xFF00) << 3) >> 8; - temp |= ((tempcx & 0xFF00) >> 8); - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x12,temp); /* Overflow (and HWCursor Test Mode) */ - - if((HwInfo->jChipType >= SIS_315H) && (HwInfo->jChipType < SIS_661)) { - tempbx++; - tempax = tempbx; - tempcx++; - tempcx -= tempax; - tempcx >>= 2; - tempbx += tempcx; - if(tempcx < 4) tempcx = 4; - tempcx >>= 2; - tempcx += tempbx; - tempcx++; - } else { - tempbx = (SiS_Pr->SiS_VGAVT + SiS_Pr->SiS_VGAVDE) >> 1; /* BTVGA2VRS 0x10,0x11 */ - tempcx = ((SiS_Pr->SiS_VGAVT - SiS_Pr->SiS_VGAVDE) >> 4) + tempbx + 1; /* BTVGA2VRE 0x11 */ + } else { + temp--; + } + } else if(HwInfo->jChipType >= SIS_315H) { + temp--; } + } + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0E,temp); /* CRT2 Vertical Total */ + + tempbx = SiS_Pr->SiS_VGAVDE - 1; + temp = tempbx & 0x00FF; + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0F,temp); /* CRT2 Vertical Display Enable End */ + + temp = ((tempbx & 0xFF00) << 3) >> 8; + temp |= ((tempcx & 0xFF00) >> 8); + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x12,temp); /* Overflow (and HWCursor Test Mode) */ + + if((HwInfo->jChipType >= SIS_315H) && (HwInfo->jChipType < SIS_661)) { + tempbx++; + tempax = tempbx; + tempcx++; + tempcx -= tempax; + tempcx >>= 2; + tempbx += tempcx; + if(tempcx < 4) tempcx = 4; + tempcx >>= 2; + tempcx += tempbx; + tempcx++; + } else { + tempbx = (SiS_Pr->SiS_VGAVT + SiS_Pr->SiS_VGAVDE) >> 1; /* BTVGA2VRS 0x10,0x11 */ + tempcx = ((SiS_Pr->SiS_VGAVT - SiS_Pr->SiS_VGAVDE) >> 4) + tempbx + 1; /* BTVGA2VRE 0x11 */ + } + + if(SiS_Pr->SiS_VBType & VB_SISVB) { - if(SiS_Pr->SiS_VBType & VB_SISVB) { + if(SiS_Pr->UseCustomMode) { + tempbx = SiS_Pr->CVSyncStart; + tempcx = (tempcx & 0xFF00) | (SiS_Pr->CVSyncEnd & 0x00FF); + } + if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) { + unsigned char cr8, cr7, cr13, cr9; if(SiS_Pr->UseCustomMode) { - tempbx = SiS_Pr->CVSyncStart; - tempcx = (tempcx & 0xFF00) | (SiS_Pr->CVSyncEnd & 0x00FF); + cr8 = SiS_Pr->CCRT1CRTC[8]; + cr7 = SiS_Pr->CCRT1CRTC[7]; + cr13 = SiS_Pr->CCRT1CRTC[13]; + cr9 = SiS_Pr->CCRT1CRTC[9]; + } else { + cr8 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[8]; + cr7 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[7]; + cr13 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[13]; + cr9 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[9]; } + tempbx = cr8; + if(cr7 & 0x04) tempbx |= 0x0100; + if(cr7 & 0x80) tempbx |= 0x0200; + if(cr13 & 0x08) tempbx |= 0x0400; + tempcx = (tempcx & 0xFF00) | (cr9 & 0x00FF); + } + } + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x10,tempbx); /* CRT2 Vertical Retrace Start */ - if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) { - unsigned char cr8, cr7, cr13, cr9; - if(SiS_Pr->UseCustomMode) { - cr8 = SiS_Pr->CCRT1CRTC[8]; - cr7 = SiS_Pr->CCRT1CRTC[7]; - cr13 = SiS_Pr->CCRT1CRTC[13]; - cr9 = SiS_Pr->CCRT1CRTC[9]; - } else { - cr8 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[8]; - cr7 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[7]; - cr13 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[13]; - cr9 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[9]; - } - tempbx = cr8; - if(cr7 & 0x04) tempbx |= 0x0100; - if(cr7 & 0x80) tempbx |= 0x0200; - if(cr13 & 0x08) tempbx |= 0x0400; - tempcx = (tempcx & 0xFF00) | (cr9 & 0x00FF); - } - } - temp = tempbx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x10,temp); /* CRT2 Vertical Retrace Start */ - - temp = ((tempbx & 0xFF00) >> 8) << 4; - temp |= (tempcx & 0x000F); - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x11,temp); /* CRT2 Vert. Retrace End; Overflow; "Enable CRTC Check" */ + temp = ((tempbx & 0xFF00) >> 8) << 4; + temp |= (tempcx & 0x000F); + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x11,temp); /* CRT2 Vert. Retrace End; Overflow; "Enable CRTC Check" */ - /* 3. Panel compensation delay */ + /* 3. Panel delay compensation */ - if(HwInfo->jChipType < SIS_315H) { + if(HwInfo->jChipType < SIS_315H) { #ifdef SIS300 /* ---------- 300 series -------------- */ - if(SiS_Pr->SiS_VBType & VB_SISVB) { - temp = 0x20; + if(SiS_Pr->SiS_VBType & VB_SISVB) { + temp = 0x20; - if(HwInfo->jChipType == SIS_300) { - temp = 0x10; - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) temp = 0x2c; - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) temp = 0x20; - } - if(SiS_Pr->SiS_VBType & VB_SIS301) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) temp = 0x20; - } - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) temp = 0x24; - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_PanelCustom) temp = 0x2c; - if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) temp = 0x08; - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { - if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) temp = 0x2c; - else temp = 0x20; - } - if((ROMAddr) && (SiS_Pr->SiS_UseROM)) { - if(ROMAddr[0x220] & 0x80) { - if(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV-SetCRT2ToHiVisionTV)) - temp = ROMAddr[0x221]; - else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) - temp = ROMAddr[0x222]; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) - temp = ROMAddr[0x223]; - else - temp = ROMAddr[0x224]; - temp &= 0x3c; - } - } - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - if(HwInfo->pdc) { - temp = HwInfo->pdc & 0x3c; - } - } - } else { - temp = 0x20; - if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) temp = 0x04; - } - if((ROMAddr) && SiS_Pr->SiS_UseROM) { - if(ROMAddr[0x220] & 0x80) { - temp = ROMAddr[0x220] & 0x3c; - } - } - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - if(HwInfo->pdc) { - temp = HwInfo->pdc & 0x3c; - } - } + if(HwInfo->jChipType == SIS_300) { + temp = 0x10; + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) temp = 0x2c; + if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) temp = 0x20; + } + if(SiS_Pr->SiS_VBType & VB_SIS301) { + if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) temp = 0x20; + } + if(SiS_Pr->SiS_LCDResInfo == Panel_1280x960) temp = 0x24; + if(SiS_Pr->SiS_LCDResInfo == Panel_Custom) temp = 0x2c; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) temp = 0x08; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) temp = 0x2c; + else temp = 0x20; + } + if(SiS_Pr->SiS_UseROM) { + if(ROMAddr[0x220] & 0x80) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoYPbPrHiVision) + temp = ROMAddr[0x221]; + else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) + temp = ROMAddr[0x222]; + else if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) + temp = ROMAddr[0x223]; + else + temp = ROMAddr[0x224]; + temp &= 0x3c; + } + } + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + if(SiS_Pr->PDC != -1) temp = SiS_Pr->PDC & 0x3c; } - SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,~0x03C,temp); /* Panel Link Delay Compensation; (Software Command Reset; Power Saving) */ + } else { + temp = 0x20; + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) { + if(SiS_Pr->SiS_LCDResInfo == Panel_640x480) temp = 0x04; + } + if(SiS_Pr->SiS_UseROM) { + if(ROMAddr[0x220] & 0x80) { + temp = ROMAddr[0x220] & 0x3c; + } + } + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + if(SiS_Pr->PDC != -1) temp = SiS_Pr->PDC & 0x3c; + } + } + + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,~0x3C,temp); /* Panel Link Delay Compensation; (Software Command Reset; Power Saving) */ #endif /* SIS300 */ - } else { + } else { #ifdef SIS315H /* --------------- 315/330 series ---------------*/ - if(HwInfo->jChipType < SIS_661) { - - if(SiS_Pr->SiS_VBType & VB_SISVB) { + if(HwInfo->jChipType < SIS_661) { - temp = 0x10; - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) temp = 0x2c; - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) temp = 0x20; - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x960) temp = 0x24; - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_PanelCustom) temp = 0x2c; - if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { - temp = 0x08; - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { - switch(SiS_Pr->SiS_HiVision) { - case 2: - case 1: - case 0: - temp = 0x08; - break; - default: - if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) temp = 0x2c; - else temp = 0x20; - } - } - } - if((SiS_Pr->SiS_VBType & VB_SIS301B302B) && (!(SiS_Pr->SiS_VBType & VB_NoLCD))) { - tempbl = 0x00; - if((ROMAddr) && (SiS_Pr->SiS_UseROM)) { - if(HwInfo->jChipType < SIS_330) { - if(ROMAddr[0x13c] & 0x80) tempbl = 0xf0; - } else { - if(ROMAddr[0x1bc] & 0x80) tempbl = 0xf0; - } - } - } else { /* LV (550/301LV checks ROM byte, other LV BIOSes do not) */ - tempbl = 0xF0; - } - if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD|SetCRT2ToLCDA)) { - if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { - if(HwInfo->pdc) { - temp = HwInfo->pdc; - tempbl = 0; - } - } - } + if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { - } else { /* LVDS */ + if(HwInfo->jChipType == SIS_740) temp = 0x03; + else temp = 0x00; - if(HwInfo->jChipType == SIS_740) { - temp = 0x03; - } else { - temp = 0x00; - } - if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) temp = 0x0a; - tempbl = 0xF0; - if(HwInfo->jChipType == SIS_650) { - if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { - if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) tempbl = 0x0F; - } + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) temp = 0x0a; + tempbl = 0xF0; + if(HwInfo->jChipType == SIS_650) { + if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) tempbl = 0x0F; } + } - if(SiS_Pr->SiS_IF_DEF_DSTN || SiS_Pr->SiS_IF_DEF_FSTN) { - temp = 0x08; - tempbl = 0; - if((ROMAddr) && (SiS_Pr->SiS_UseROM)) { - if(ROMAddr[0x13c] & 0x80) tempbl = 0xf0; - } + if(SiS_Pr->SiS_IF_DEF_DSTN || SiS_Pr->SiS_IF_DEF_FSTN) { + temp = 0x08; + tempbl = 0; + if((SiS_Pr->SiS_UseROM) && (!(SiS_Pr->SiS_ROMNew))) { + if(ROMAddr[0x13c] & 0x80) tempbl = 0xf0; } } SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2D,tempbl,temp); /* Panel Link Delay Compensation */ + } - } /* < 661 */ + } /* < 661 */ - tempax = 0; - if (modeflag & DoubleScanMode) tempax |= 0x80; - if (modeflag & HalfDCLK) tempax |= 0x40; - SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2C,0x3f,tempax); + tempax = 0; + if (modeflag & DoubleScanMode) tempax |= 0x80; + if (modeflag & HalfDCLK) tempax |= 0x40; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2C,0x3f,tempax); #endif /* SIS315H */ - } - - } /* Slavemode */ + } - if(SiS_Pr->SiS_VBType & VB_SISVB) { + } /* Slavemode */ + if(SiS_Pr->SiS_VBType & VB_SISVB) { + if((SiS_Pr->SiS_VBType & VB_NoLCD) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) { /* For 301BDH with LCD, we set up the Panel Link */ - if( (SiS_Pr->SiS_VBType & VB_NoLCD) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) ) { - - SiS_SetGroup1_LVDS(SiS_Pr, ModeNo, ModeIdIndex, - HwInfo, RefreshRateTableIndex); - - } else if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { - - SiS_SetGroup1_301(SiS_Pr, ModeNo, ModeIdIndex, - HwInfo, RefreshRateTableIndex); - } - + SiS_SetGroup1_LVDS(SiS_Pr, ModeNo, ModeIdIndex, HwInfo, RefreshRateTableIndex); + } else if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + SiS_SetGroup1_301(SiS_Pr, ModeNo, ModeIdIndex, HwInfo, RefreshRateTableIndex); + } + } else { + if(HwInfo->jChipType < SIS_315H) { + SiS_SetGroup1_LVDS(SiS_Pr, ModeNo, ModeIdIndex, HwInfo, RefreshRateTableIndex); } else { - - if(HwInfo->jChipType < SIS_315H) { - - SiS_SetGroup1_LVDS(SiS_Pr, ModeNo, ModeIdIndex, - HwInfo, RefreshRateTableIndex); + if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { + if((!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) || (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { + SiS_SetGroup1_LVDS(SiS_Pr, ModeNo,ModeIdIndex, HwInfo,RefreshRateTableIndex); + } } else { - - if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { - if((!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) || (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { - SiS_SetGroup1_LVDS(SiS_Pr, ModeNo,ModeIdIndex, - HwInfo,RefreshRateTableIndex); - } - } else { - SiS_SetGroup1_LVDS(SiS_Pr, ModeNo,ModeIdIndex, - HwInfo,RefreshRateTableIndex); - } - + SiS_SetGroup1_LVDS(SiS_Pr, ModeNo,ModeIdIndex, HwInfo,RefreshRateTableIndex); } - } - } /* LCDA */ + } } /*********************************************/ @@ -6804,9 +6564,8 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, static UCHAR * SiS_GetGroup2CLVXPtr(SiS_Private *SiS_Pr, int tabletype, PSIS_HW_INFO HwInfo) { - UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; const UCHAR *tableptr = NULL; - USHORT a, b, p = 0; + USHORT a, b, p = 0; a = SiS_Pr->SiS_VGAHDE; b = SiS_Pr->SiS_HDE; @@ -6815,48 +6574,32 @@ SiS_GetGroup2CLVXPtr(SiS_Private *SiS_Pr, int tabletype, PSIS_HW_INFO HwInfo) b = SiS_Pr->SiS_VDE; } - if((ROMAddr = (UCHAR *)HwInfo->pjVirtualRomBase) && SiS_Pr->SiS_UseROM) { - - if(a < b) { - p = ROMAddr[0x278] | (ROMAddr[0x279] << 8); - } else if(a == b) { - p = ROMAddr[0x27a] | (ROMAddr[0x27b] << 8); + if(a < b) { + tableptr = SiS_Part2CLVX_1; + } else if(a == b) { + tableptr = SiS_Part2CLVX_2; + } else { + if(SiS_Pr->SiS_TVMode & TVSetPAL) { + tableptr = SiS_Part2CLVX_4; } else { - if(SiS_Pr->SiS_TVMode & TVSetPAL) { - p = ROMAddr[0x27e] | (ROMAddr[0x27f] << 8); - } else { - p = ROMAddr[0x27c] | (ROMAddr[0x27d] << 8); - } - do { - if((ROMAddr[p] | ROMAddr[p+1] << 8) == a) break; - p += 0x42; - } while((ROMAddr[p] | ROMAddr[p+1] << 8) != 0xffff); - if((ROMAddr[p] | ROMAddr[p+1] << 8) == 0xffff) p -= 0x42; + tableptr = SiS_Part2CLVX_3; } - p += 2; - return(&ROMAddr[p]); - - } else { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) { + if(SiS_Pr->SiS_TVMode & TVSetYPbPr525i) tableptr = SiS_Part2CLVX_3; + else if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) tableptr = SiS_Part2CLVX_3; + else tableptr = SiS_Part2CLVX_5; - if(a < b) { - tableptr = SiS_Part2CLVX_1; - } else if(a == b) { - tableptr = SiS_Part2CLVX_2; - } else { - if(SiS_Pr->SiS_TVMode & TVSetPAL) { - tableptr = SiS_Part2CLVX_4; - } else { - tableptr = SiS_Part2CLVX_3; - } - do { - if((tableptr[p] | tableptr[p+1] << 8) == a) break; - p += 0x42; - } while((tableptr[p] | tableptr[p+1] << 8) != 0xffff); - if((tableptr[p] | tableptr[p+1] << 8) == 0xffff) p -= 0x42; + } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) { + tableptr = SiS_Part2CLVX_6; } - p += 2; - return((UCHAR *)&tableptr[p]); + do { + if((tableptr[p] | tableptr[p+1] << 8) == a) break; + p += 0x42; + } while((tableptr[p] | tableptr[p+1] << 8) != 0xffff); + if((tableptr[p] | tableptr[p+1] << 8) == 0xffff) p -= 0x42; } + p += 2; + return((UCHAR *)&tableptr[p]); } static void @@ -6867,7 +6610,7 @@ SiS_SetGroup2_C_ELV(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, int i, j; UCHAR temp; - if(!(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302ELV))) return; + if(!(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302ELV))) return; tableptr = SiS_GetGroup2CLVXPtr(SiS_Pr, 0, HwInfo); for(i = 0x80, j = 0; i <= 0xbf; i++, j++) { @@ -6884,45 +6627,97 @@ SiS_SetGroup2_C_ELV(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x4e,0xeb,temp); } -static void +static BOOLEAN SiS_GetCRT2Part2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, USHORT RefreshRateTableIndex,USHORT *CRT2Index, USHORT *ResIndex,PSIS_HW_INFO HwInfo) { - USHORT tempbx,tempal; - + + if(HwInfo->jChipType < SIS_315H) return FALSE; + if(ModeNo <= 0x13) - tempal = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + (*ResIndex) = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; else - tempal = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; + (*ResIndex) = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; - tempbx = SiS_Pr->SiS_LCDResInfo; + (*ResIndex) &= 0x3f; + (*CRT2Index) = 0; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 16; - else if(SiS_Pr->SiS_SetFlag & LCDVESATiming) tempbx += 32; - - if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { - tempbx = 100; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx = 101; - else if(SiS_Pr->SiS_SetFlag & LCDVESATiming) tempbx = 102; - } - } else if(SiS_Pr->SiS_CustomT == CUT_CLEVO1024) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { - if(SiS_IsDualLink(SiS_Pr, HwInfo)) { - tempbx = 103; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx = 104; - else if(SiS_Pr->SiS_SetFlag & LCDVESATiming) tempbx = 105; - } + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { + if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) { + (*CRT2Index) = 200; } } - *CRT2Index = tempbx; - *ResIndex = tempal & 0x3F; + if(SiS_Pr->SiS_CustomT == CUT_ASUSA2H_2) { + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { + if(SiS_Pr->SiS_SetFlag & LCDVESATiming) (*CRT2Index) = 206; + } + } + return(((*CRT2Index) != 0)); } #endif #ifdef SIS300 +static void +SiS_Group2LCDSpecial(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo, USHORT crt2crtc) +{ + USHORT tempcx; + const UCHAR atable[] = { + 0xc3,0x9e,0xc3,0x9e,0x02,0x02,0x02, + 0xab,0x87,0xab,0x9e,0xe7,0x02,0x02 + }; + + if(!SiS_Pr->UseCustomMode) { + if( ( ( (HwInfo->jChipType == SIS_630) || + (HwInfo->jChipType == SIS_730) ) && + (HwInfo->jChipRevision > 2) ) && + (SiS_Pr->SiS_LCDResInfo == Panel_1024x768) && + (!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) && + (!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) ) { + if(ModeNo == 0x13) { + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x04,0xB9); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x05,0xCC); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x06,0xA6); + } else { + if((crt2crtc & 0x3F) == 4) { + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x2B); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x13); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x04,0xE5); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x05,0x08); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x06,0xE2); + } + } + } + + if(HwInfo->jChipType < SIS_315H) { + if(SiS_Pr->SiS_LCDTypeInfo == 0x0c) { + crt2crtc &= 0x1f; + tempcx = 0; + if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + tempcx += 7; + } + } + tempcx += crt2crtc; + if(crt2crtc >= 4) { + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x06,0xff); + } + + if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + if(crt2crtc == 4) { + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x28); + } + } + } + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x18); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x04,atable[tempcx]); + } + } + } +} + /* For ECS A907. Highly preliminary. */ static void SiS_Set300Part2Regs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, @@ -6972,139 +6767,190 @@ SiS_Set300Part2Regs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, static void SiS_SetTVSpecial(SiS_Private *SiS_Pr, USHORT ModeNo) { - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) { - if(SiS_Pr->SiS_TVMode & TVSetNTSC1024) { - UCHAR specialtv[] = { + if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) return; + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoHiVision)) return; + if(SiS_Pr->SiS_TVMode & (TVSetYPbPr525p | TVSetYPbPr750p)) return; + + if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) { + if(SiS_Pr->SiS_TVMode & TVSetNTSC1024) { + const UCHAR specialtv[] = { 0xa7,0x07,0xf2,0x6e,0x17,0x8b,0x73,0x53, 0x13,0x40,0x34,0xf4,0x63,0xbb,0xcc,0x7a, 0x58,0xe4,0x73,0xda,0x13 - }; - int i, j; - for(i = 0x1c, j = 0; i <= 0x30; i++, j++) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,i,specialtv[j]); - } + }; + int i, j; + for(i = 0x1c, j = 0; i <= 0x30; i++, j++) { + SiS_SetReg(SiS_Pr->SiS_Part2Port,i,specialtv[j]); + } + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x43,0x72); + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750)) { if(SiS_Pr->SiS_TVMode & TVSetPALM) { SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x14); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x1b); } else { - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x15); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x14); /* 15 */ + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x1a); /* 1b */ } - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x1b); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x43,0x72); } + } + } else { + if((ModeNo == 0x38) || (ModeNo == 0x4a) || (ModeNo == 0x64) || + (ModeNo == 0x52) || (ModeNo == 0x58) || (ModeNo == 0x5c)) { + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x1b); /* 21 */ + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x54); /* 5a */ } else { - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x21); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x5a); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x1a); /* 21 */ + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x53); /* 5a */ } } } -/* Set 301 TV Encoder (and some LCD relevant) registers */ +static void +SiS_SetGroup2_Tail(SiS_Private *SiS_Pr, USHORT ModeNo) +{ + USHORT temp; + + if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) { + if(SiS_Pr->SiS_VGAVDE == 525) { + temp = 0xc3; + if(SiS_Pr->SiS_ModeType <= ModeVGA) { + temp++; + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) temp += 2; + } + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2f,temp); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x30,0xb3); + } else if(SiS_Pr->SiS_VGAVDE == 420) { + temp = 0x4d; + if(SiS_Pr->SiS_ModeType <= ModeVGA) { + temp++; + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) temp++; + } + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2f,temp); + } + } + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + if(SiS_Pr->SiS_LCDResInfo == Panel_1400x1050) { + if(SiS_Pr->SiS_VBType & VB_SIS301B302B) { + SiS_SetRegOR(SiS_Pr->SiS_Part2Port,0x1a,0x03); + /* Not always for LV, see SetGrp2 */ + } + temp = 1; + if(ModeNo <= 0x13) temp = 3; + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x0b,temp); + } +#if 0 + /* 651+301C, for 1280x768 - do I really need that? */ + if((SiS_Pr->SiS_PanelXRes == 1280) && (SiS_Pr->SiS_PanelYRes == 768)) { + if(SiS_Pr->SiS_VBInfo & SetSimuScanMode) { + if(((SiS_Pr->SiS_HDE == 640) && (SiS_Pr->SiS_VDE == 480)) || + ((SiS_Pr->SiS_HDE == 320) && (SiS_Pr->SiS_VDE == 240))) { + SiS_SetReg(SiS_Part2Port,0x01,0x2b); + SiS_SetReg(SiS_Part2Port,0x02,0x13); + SiS_SetReg(SiS_Part2Port,0x04,0xe5); + SiS_SetReg(SiS_Part2Port,0x05,0x08); + SiS_SetReg(SiS_Part2Port,0x06,0xe2); + SiS_SetReg(SiS_Part2Port,0x1c,0x21); + SiS_SetReg(SiS_Part2Port,0x1d,0x45); + SiS_SetReg(SiS_Part2Port,0x1f,0x0b); + SiS_SetReg(SiS_Part2Port,0x20,0x00); + SiS_SetReg(SiS_Part2Port,0x21,0xa9); + SiS_SetReg(SiS_Part2Port,0x23,0x0b); + SiS_SetReg(SiS_Part2Port,0x25,0x04); + } + } + } +#endif + } +} + static void SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT RefreshRateTableIndex, PSIS_HW_INFO HwInfo) { -#if 0 - UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; -#endif USHORT i, j, tempax, tempbx, tempcx, temp; - USHORT push1, push2; + USHORT push1, push2, modeflag, crt2crtc, bridgeoffset; + ULONG longtemp, tempeax; const UCHAR *PhasePoint; const UCHAR *TimingPoint; #ifdef SIS315H - const SiS_Part2PortTblStruct *CRT2Part2Ptr = NULL; USHORT resindex, CRT2Index; -#endif - USHORT modeflag, crt2crtc; - ULONG longtemp, tempeax; -#ifdef SIS300 - const UCHAR atable[] = { - 0xc3,0x9e,0xc3,0x9e,0x02,0x02,0x02, - 0xab,0x87,0xab,0x9e,0xe7,0x02,0x02 - }; -#endif + const SiS_Part2PortTblStruct *CRT2Part2Ptr = NULL; -#ifdef SIS315H if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) return; #endif if(ModeNo <= 0x13) { modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; crt2crtc = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + } else if(SiS_Pr->UseCustomMode) { + modeflag = SiS_Pr->CModeFlag; + crt2crtc = 0; } else { - if(SiS_Pr->UseCustomMode) { - modeflag = SiS_Pr->CModeFlag; - crt2crtc = 0; - } else { - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - crt2crtc = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; - } + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + crt2crtc = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; } temp = 0; if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToAVIDEO)) temp |= 0x08; if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToSVIDEO)) temp |= 0x04; if(SiS_Pr->SiS_VBInfo & SetCRT2ToSCART) temp |= 0x02; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) temp |= 0x01; - /* Disables SVIDEO and CVBS signal */ - if((SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) && - (SiS_Pr->SiS_CustomT != CUT_CLEVO1400)) { - if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { - temp |= 0x0c; - } - } + if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) temp |= 0x10; + + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x00,temp); PhasePoint = SiS_Pr->SiS_PALPhase; TimingPoint = SiS_Pr->SiS_PALTiming; - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) { - temp ^= 0x01; + TimingPoint = SiS_Pr->SiS_HiTVExtTiming; if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { TimingPoint = SiS_Pr->SiS_HiTVSt2Timing; if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) { - if(modeflag & Charx8Dot) TimingPoint = SiS_Pr->SiS_HiTVSt1Timing; - else TimingPoint = SiS_Pr->SiS_HiTVTextTiming; + TimingPoint = SiS_Pr->SiS_HiTVSt1Timing; +#if 0 + if(!(modeflag & Charx8Dot)) TimingPoint = SiS_Pr->SiS_HiTVTextTiming; +#endif } - } else TimingPoint = SiS_Pr->SiS_HiTVExtTiming; + } - if(SiS_Pr->SiS_HiVision & 0x03) temp &= 0xfe; + } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) { - } else { + if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) TimingPoint = &SiS_YPbPrTable[2][0]; + else if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) TimingPoint = &SiS_YPbPrTable[1][0]; + else TimingPoint = &SiS_YPbPrTable[0][0]; - if(SiS_Pr->SiS_TVMode & TVSetPAL) { + PhasePoint = SiS_Pr->SiS_NTSCPhase; - TimingPoint = SiS_Pr->SiS_PALTiming; - PhasePoint = SiS_Pr->SiS_PALPhase; + } else if(SiS_Pr->SiS_TVMode & TVSetPAL) { - if( (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && - ( (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) || - (SiS_Pr->SiS_TVMode & TVSetTVSimuMode) ) ) { - PhasePoint = SiS_Pr->SiS_PALPhase2; - } + if( (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && + ( (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) || + (SiS_Pr->SiS_TVMode & TVSetTVSimuMode) ) ) { + PhasePoint = SiS_Pr->SiS_PALPhase2; + } - } else { + } else { - temp |= 0x10; - TimingPoint = SiS_Pr->SiS_NTSCTiming; - PhasePoint = SiS_Pr->SiS_NTSCPhase; + TimingPoint = SiS_Pr->SiS_NTSCTiming; + PhasePoint = SiS_Pr->SiS_NTSCPhase; + if(SiS_Pr->SiS_TVMode & TVSetNTSCJ) { + PhasePoint = SiS_Pr->SiS_PALPhase; + } + + if( (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && + ( (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) || + (SiS_Pr->SiS_TVMode & TVSetTVSimuMode) ) ) { + PhasePoint = SiS_Pr->SiS_NTSCPhase2; if(SiS_Pr->SiS_TVMode & TVSetNTSCJ) { - PhasePoint = SiS_Pr->SiS_PALPhase; + PhasePoint = SiS_Pr->SiS_PALPhase2; } - - if( (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && - ( (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) || - (SiS_Pr->SiS_TVMode & TVSetTVSimuMode) ) ) { - PhasePoint = SiS_Pr->SiS_NTSCPhase2; - if(SiS_Pr->SiS_TVMode & TVSetNTSCJ) { - PhasePoint = SiS_Pr->SiS_PALPhase2; - } - } - } } - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x00,temp); if(SiS_Pr->SiS_TVMode & TVSetPALM) { PhasePoint = SiS_Pr->SiS_PALMPhase; @@ -7114,6 +6960,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr PhasePoint = SiS_Pr->SiS_PALMPhase2; } } + if(SiS_Pr->SiS_TVMode & TVSetPALN) { PhasePoint = SiS_Pr->SiS_PALNPhase; if( (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && @@ -7156,17 +7003,13 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr SiS_SetReg(SiS_Pr->SiS_Part2Port,0x37,SiS_Pr->SiS_RY3COE); SiS_SetReg(SiS_Pr->SiS_Part2Port,0x38,SiS_Pr->SiS_RY4COE); - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { - if(SiS_Pr->SiS_HiVision == 3) tempax = 950; - else tempax = 440; - } else { - if(SiS_Pr->SiS_TVMode & TVSetPAL) tempax = 520; - else tempax = 440; - } + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) tempax = 950; + else if(SiS_Pr->SiS_TVMode & TVSetPAL) tempax = 520; + else tempax = 440; - if( ( ( (!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) || (SiS_Pr->SiS_HiVision == 3) ) && (SiS_Pr->SiS_VDE <= tempax) ) || - ( (SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (SiS_Pr->SiS_HiVision != 3) && - ( (SiS_Pr->SiS_VGAHDE == 1024) || ((SiS_Pr->SiS_VGAHDE != 1024) && (SiS_Pr->SiS_VDE <= tempax)) ) ) ) { + if( ( (!(SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoHiVision)) && (SiS_Pr->SiS_VDE <= tempax) ) || + ( (SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoHiVision) && + ((SiS_Pr->SiS_VGAHDE == 1024) || (SiS_Pr->SiS_VDE <= tempax)) ) ) { tempax -= SiS_Pr->SiS_VDE; tempax >>= 2; @@ -7178,20 +7021,13 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr temp = tempax + (USHORT)TimingPoint[1]; SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,temp); - if( (SiS_Pr->SiS_VBInfo & (SetCRT2ToTV - SetCRT2ToHiVisionTV)) && - (SiS_Pr->SiS_HiVision != 3) && - (SiS_Pr->SiS_VGAHDE >= 1024) ) { + if((SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoHiVision) && (SiS_Pr->SiS_VGAHDE >= 1024)) { if(SiS_Pr->SiS_TVMode & TVSetPAL) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x19); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x52); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x1b); /* 19 */ + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x54); /* 52 */ } else { - if(HwInfo->jChipType >= SIS_315H) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x17); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x1d); - } else { - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x0b); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x11); - } + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x17); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x1d); } } @@ -7201,10 +7037,8 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempcx >>= 1; tempcx--; if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) tempcx--; - temp = tempcx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x1B,temp); - temp = (tempcx & 0xFF00) >> 8; - SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1D,0xF0,temp); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x1B,(tempcx & 0xff)); + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1D,0xF0,((tempcx >> 8) & 0x0f)); tempcx++; if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) tempcx++; @@ -7213,28 +7047,18 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr push1 = tempcx; tempcx += 7; - if((SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) && - (SiS_Pr->SiS_HiVision == 3)) { - tempcx -= 4; - } - temp = (tempcx & 0x00FF) << 4; - SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x22,0x0F,temp); + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) tempcx -= 4; + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x22,0x0F,((tempcx << 4) & 0xf0)); - tempbx = TimingPoint[j] | ((TimingPoint[j+1]) << 8); + tempbx = TimingPoint[j] | (TimingPoint[j+1] << 8); tempbx += tempcx; - push2 = tempbx; - - temp = tempbx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x24,temp); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x24,tempbx); temp = ((tempbx & 0xFF00) >> 8) << 4; SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x25,0x0F,temp); - tempbx = push2; - tempbx += 8; - if((SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) && - (SiS_Pr->SiS_HiVision == 3)) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) { tempbx -= 4; tempcx = tempbx; } @@ -7242,33 +7066,27 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x29,0x0F,temp); j += 2; - tempcx += ((TimingPoint[j] | ((TimingPoint[j+1]) << 8))); + tempcx += (TimingPoint[j] | (TimingPoint[j+1] << 8)); temp = tempcx & 0x00FF; SiS_SetReg(SiS_Pr->SiS_Part2Port,0x27,temp); temp = ((tempcx & 0xFF00) >> 8) << 4; SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x28,0x0F,temp); tempcx += 8; - if((SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) && - (SiS_Pr->SiS_HiVision == 3)) { - tempcx -= 4; - } - temp = (tempcx & 0x00FF) << 4; - SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x2A,0x0F,temp); + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) tempcx -= 4; + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x2A,0x0F,((tempcx << 4) & 0xf0)); tempcx = push1; j += 2; tempcx -= (TimingPoint[j] | ((TimingPoint[j+1]) << 8)); - temp = (tempcx & 0x00FF) << 4; - SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x2D,0x0F,temp); + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x2D,0x0F,((tempcx << 4) & 0xf0)); tempcx -= 11; if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) { tempcx = SiS_GetVGAHT2(SiS_Pr) - 1; } - temp = tempcx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2E,temp); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2E,tempcx); tempbx = SiS_Pr->SiS_VDE; if(SiS_Pr->SiS_VGAVDE == 360) tempbx = 746; @@ -7277,26 +7095,23 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr if(HwInfo->jChipType < SIS_315H) { if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) tempbx >>= 1; } else { - if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (!(SiS_Pr->SiS_HiVision & 0x03))) { + if( (SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && + (!(SiS_Pr->SiS_TVMode & (TVSetYPbPr525p|TVSetYPbPr750p))) ) { tempbx >>= 1; if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) { if(ModeNo <= 0x13) { - if(crt2crtc == 1) { - tempbx++; - } + if(crt2crtc == 1) tempbx++; } - } else { - if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { - if(crt2crtc == 4) /* BIOS calls GetRatePtrCRT2 here - does not make sense */ - if(SiS_Pr->SiS_ModeType <= 3) tempbx++; + } else if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + if(crt2crtc == 4) { + if(SiS_Pr->SiS_ModeType <= 3) tempbx++; } } } } tempbx -= 2; temp = tempbx & 0x00FF; - if((SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) && - (SiS_Pr->SiS_HiVision == 3)) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) { if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { if((ModeNo == 0x2f) || (ModeNo == 0x5d) || (ModeNo == 0x5e)) temp++; } @@ -7307,9 +7122,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) { - if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) { /* SetFlag?? */ - if(ModeNo == 0x03) temp++; - } + if(ModeNo == 0x03) temp++; } } } @@ -7318,64 +7131,41 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr temp = (tempcx >> 8) & 0x0F; temp |= (((tempbx >> 8) << 6) & 0xC0); - if(!(SiS_Pr->SiS_VBInfo & (SetCRT2ToHiVisionTV | SetCRT2ToSCART))) { + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToSVIDEO | SetCRT2ToAVIDEO)) { temp |= 0x10; - if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToSVIDEO)) temp |= 0x20; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToAVIDEO) temp |= 0x20; } SiS_SetReg(SiS_Pr->SiS_Part2Port,0x30,temp); - if((HwInfo->jChipType > SIS_315H) && (HwInfo->jChipType < SIS_661)) { - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302LV | VB_SIS302ELV)) { - if( (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) || - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) ) { - SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x10,0x60); - } - } - } - } - - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { - if(SiS_Pr->SiS_HiVision != 3) { - for(i=0, j=0; i<=0x2d; i++, j++) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,i,SiS_HiVisionTable[SiS_Pr->SiS_HiVision][j]); - } - for(i=0x39; i<=0x45; i++, j++) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,i,SiS_HiVisionTable[SiS_Pr->SiS_HiVision][j]); - } - } - } - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { tempbx = SiS_Pr->SiS_VDE; - if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && (!(SiS_Pr->SiS_HiVision & 0x03))) { - tempbx >>= 1; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + if(!(SiS_Pr->SiS_TVMode & (TVSetYPbPr525p | TVSetYPbPr750p))) { + tempbx >>= 1; + } } tempbx -= 3; - if(HwInfo->jChipType >= SIS_661) { - if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302LV | VB_SIS302ELV)) { /* Why not 301B/LV? */ + if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302LV | VB_SIS302ELV)) { /* Why not 301B/LV? */ + if(HwInfo->jChipType >= SIS_661) { temp = 0; if(tempcx & 0x0400) temp |= 0x20; if(tempbx & 0x0400) temp |= 0x40; SiS_SetReg(SiS_Pr->SiS_Part4Port,0x10,temp); + } else { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + if((SiS_Pr->SiS_LCDResInfo == Panel_1400x1050) || + (SiS_Pr->SiS_LCDResInfo == Panel_1600x1200) || + (SiS_Pr->SiS_LCDResInfo == Panel_1680x1050)) { + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x10,0x60); + } + } } } tempbx &= 0x03ff; temp = ((tempbx & 0xFF00) >> 8) << 5; temp |= 0x18; SiS_SetReg(SiS_Pr->SiS_Part2Port,0x46,temp); - temp = tempbx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x47,temp); - - temp = 0; - if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { - if(SiS_Pr->SiS_HiVision & 0x03) { - temp = 0x30; - if(SiS_Pr->SiS_HiVision & 0x01) temp = 0x50; - } - } - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x4d,temp); - + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x47,tempbx); } tempbx = 0; @@ -7387,15 +7177,13 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr } tempcx = 0x0101; - if(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV - SetCRT2ToHiVisionTV)) { - if(!(SiS_Pr->SiS_HiVision & 0x03)) { - if(SiS_Pr->SiS_VGAHDE >= 1024) { - if((!(modeflag & HalfDCLK)) || (HwInfo->jChipType < SIS_315H)) { - tempcx = 0x1920; - if(SiS_Pr->SiS_VGAHDE >= 1280) { - tempcx = 0x1420; - tempbx &= ~0x2000; - } + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + if(SiS_Pr->SiS_VGAHDE >= 1024) { + if((!(modeflag & HalfDCLK)) || (HwInfo->jChipType < SIS_315H)) { + tempcx = 0x1920; + if(SiS_Pr->SiS_VGAHDE >= 1280) { + tempcx = 0x1420; + tempbx &= ~0x2000; } } } @@ -7436,20 +7224,21 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr tempbx = 0x0369; tempcx = 0x0061; } - temp = (tempbx & 0x00FF) ; - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x4B,temp); - temp = (tempcx & 0x00FF) ; - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x4C,temp); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x4B,tempbx); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x4C,tempcx); temp = (tempcx & 0x0300) >> (8 - 2); temp |= ((tempbx >> 8) & 0x03); - SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x4D,0xF0,temp); + if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) { + temp |= 0x10; + if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) temp |= 0x20; + else if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) temp |= 0x40; + } + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x4D,temp); temp = SiS_GetReg(SiS_Pr->SiS_Part2Port,0x43); SiS_SetReg(SiS_Pr->SiS_Part2Port,0x43,(USHORT)(temp - 3)); - if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { - SiS_SetTVSpecial(SiS_Pr, ModeNo); - } + SiS_SetTVSpecial(SiS_Pr, ModeNo); if(SiS_Pr->SiS_VBType & VB_SIS301C) { temp = 0; @@ -7467,11 +7256,9 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xEF); } - if(HwInfo->jChipType >= SIS_315H) { - if((SiS_Pr->SiS_VBType & VB_SIS301B302B) && (!(SiS_Pr->SiS_VBType & VB_NoLCD))) { - if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x0B,0x00); - } + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) { + if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) { + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x0B,0x00); } } @@ -7482,13 +7269,12 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr tempbx = SiS_Pr->SiS_HDE; if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempbx >>= 1; tempbx--; /* RHACTE = HDE - 1 */ - temp = tempbx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2C,temp); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2C,tempbx); temp = (tempbx & 0xFF00) >> 4; SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x2B,0x0F,temp); temp = 0x01; - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { + if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) { if(SiS_Pr->SiS_ModeType == ModeEGA) { if(SiS_Pr->SiS_VGAHDE >= 1024) { temp = 0x02; @@ -7503,14 +7289,12 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr SiS_SetReg(SiS_Pr->SiS_Part2Port,0x0B,temp); tempbx = SiS_Pr->SiS_VDE - 1; - temp = tempbx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x03,temp); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x03,tempbx); temp = ((tempbx & 0xFF00) >> 8) & 0x07; SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x0C,0xF8,temp); tempcx = SiS_Pr->SiS_VT - 1; - temp = tempcx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x19,temp); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x19,tempcx); temp = ((tempcx & 0xFF00) >> 8) << 5; @@ -7521,31 +7305,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr } } - /* Must do special for Compaq1280; Acer1280 OK, Clevo1400 OK, ECS1400 OK */ - /* Compaq1280 panel loses sync if using CR37 sync info. */ - if((SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) { - if((HwInfo->jChipType >= SIS_315H) && (SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) { - if((SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) && - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024)) { - if(SiS_Pr->SiS_LCDInfo & LCDSync) { - temp |= ((SiS_Pr->SiS_LCDInfo & 0xc0) >> 6); - } - } else if((SiS_Pr->SiS_CustomT == CUT_CLEVO1400) && - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050)) { - temp |= 0x03; - } else { - temp |= (SiS_GetReg(SiS_Pr->SiS_P3d4,0x37) >> 6); - temp |= 0x08; - if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) temp |= 0x04; - } - } else { - if(SiS_Pr->SiS_LCDInfo & LCDSync) { - temp |= ((SiS_Pr->SiS_LCDInfo & 0xc0) >> 6); - } - } - } - - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x1A,temp); + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1A,0x0f,temp); SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x09,0xF0); SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x0A,0xF0); @@ -7553,153 +7313,13 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x17,0xFB); SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x18,0xDF); -#if 0 /* Use the 315/330 series code for now */ - if((HwInfo->jChipType >= SIS_661) && - (SiS_Pr->SiS_VBType & VB_SIS301LV302LV) && - (ROMAddr && SiS_Pr->SiS_UseROM)) { - - /* This is done for the LVDS bridges only, since - * the TMDS panels already work correctly with - * the old code. Besides, we only do that if - * we can get the data from the ROM, I am tired - * of carrying a lot of tables around. - */ - -#ifdef SIS315H /* ------------ 661/741/760 series --------- */ - UCHAR *myptr = NULL, myptr1 = NULL; - - myptr = (UCHAR *)GetLCDPtr661(SiS_Pr, HwInfo, 6, ModeNo, ModeIdIndex, RefreshRateTableIndex); - myptr1 = (UCHAR *)GetLCDStructPtr661(SiS_Pr, HwInfo); - - tempbx = (myptr[3] | (myptr[4] << 8)) & 0x0fff; - tempcx = SiS_Pr->PanelYRes; - if(SiS_Pr->SiS_LCDInfo & LCDPass11) { - tempcx = SiS_Pr->SiS_VDE; - } - - tempcx += tempbx; - if(tempcx >= SiS_Pr->SiS_VT) tempcx -= SiS_Pr->SiS_VT; - - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x05,tempbx); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x06,tempcx); - - tempcx &= 0x07ff; - tempbx &= 0x07ff; - temp = (tempcx >> 8) << 3; - temp |= (tempbx >> 8); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,temp); - - tempbx = (myptr[4] | (myptr[5] << 8)) >> 4; - tempcx = myptr1[6]; - if(SiS_Pr->SiS_LCDInfo & LCDPass11) tempcx = myptr[7]; - - tempcx += tempbx; - if(tempcx >= SiS_Pr->SiS_VT) tempcx -= SiS_Pr->SiS_VT; - - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x04,tempbx); - temp = tempcx & 0x000f; - temp |= ((tempbx & 0x0f00) >> 4); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,temp); - - tempax = SiS_Pr->SiS_HT; - tempbx = (myptr[0] | (myptr[1] << 8)) & 0x0fff; - tempcx = SiS_Pr->PanelXRes; - if(SiS_Pr->SiS_LCDInfo & LCDPass11) tempcx = SiS_Pr->SiS_HDE; - - if(SiS_IsDualLink(SiS_Pr, HwInfo)) { - tempax >>= 1; - tempbx >>= 1; - tempcx >>= 1; - } - if(SiS_Pr->SiS_VBType & VB_SIS302LV) tempbx++; - if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302ELV)) tempbx++; - - tempcx += tempbx; - if(tempcx >= tempax) tempcx -= tempax; - - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x1f,tempbx); - temp = ((tempbx & 0xff00) >> 8) << 4; - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x20,temp); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x23,tempcx); - temp = tempcx >> 8; - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x25,temp); - - tempax = SiS_Pr->SiS_HT; - tempbx = (myptr[1] | (myptr[2] << 8)) >> 4; - tempcx = myptr1[5]; - if(SiS_Pr->SiS_LCDInfo & LCDPass11) { - tempcx = myptr[6]; - } - if(SiS_IsDualLink(SiS_Pr, HwInfo)) { - tempax >>= 1; - tempbx >>= 1; - tempcx >>= 1; - } - if(SiS_Pr->SiS_VBType & VB_SIS302LV) tempbx++; - - tempcx += tempbx; - if(tempcx >= tempax) tempcx -= tempax; - - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x1c,tempbx); - temp = (tempbx & 0x0f00) >> 4; - SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1d,0x0f,temp); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x21,tempcx); - - if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) { - if(SiS_Pr->SiS_VGAVDE == 525) { - temp = 0xc3; - if(SiS_Pr->SiS_ModeType <= ModeVGA) { - temp++; - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) temp += 2; - } - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2f,temp); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x30,0xb3); - } else if(SiS_Pr->SiS_VGAVDE == 420) { - temp = 0x4d; - if(SiS_Pr->SiS_ModeType <= ModeVGA) { - temp++; - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) temp++; - } - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2f,temp); - } - } - -#endif - - } else -#endif - if((HwInfo->jChipType >= SIS_315H) && - (SiS_Pr->SiS_VBType & VB_SIS301LV302LV) && - ((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) || - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) || - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) || - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200)) ) { - -#ifdef SIS315H /* ------------- 315/330 series ------------ */ - - SiS_GetCRT2Part2Ptr(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, - &CRT2Index, &resindex, HwInfo); - +#ifdef SIS315H + if(SiS_GetCRT2Part2Ptr(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, + &CRT2Index, &resindex, HwInfo)) { switch(CRT2Index) { - case Panel_1024x768 : CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1024x768_1; break; /* "Normal" */ - case Panel_1280x1024 : CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1280x1024_1; break; - case Panel_1400x1050 : CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1400x1050_1; break; - case Panel_1600x1200 : CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1600x1200_1; break; - case Panel_1024x768 + 16: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1024x768_2; break; /* Non-Expanding */ - case Panel_1280x1024 + 16: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1280x1024_2; break; - case Panel_1400x1050 + 16: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1400x1050_2; break; - case Panel_1600x1200 + 16: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1600x1200_2; break; - case Panel_1024x768 + 32: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1024x768_3; break; /* VESA Timing */ - case Panel_1280x1024 + 32: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1280x1024_3; break; - case Panel_1400x1050 + 32: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1400x1050_3; break; - case Panel_1600x1200 + 32: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1600x1200_3; break; - case 100: CRT2Part2Ptr = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_Compaq1280x1024_1; break; /* Custom */ - case 101: CRT2Part2Ptr = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_Compaq1280x1024_2; break; - case 102: CRT2Part2Ptr = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_Compaq1280x1024_3; break; - case 103: CRT2Part2Ptr = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_Clevo1024x768_1; break; /* Custom */ - case 104: CRT2Part2Ptr = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_Clevo1024x768_2; break; - case 105: CRT2Part2Ptr = (SiS_Part2PortTblStruct *)SiS310_CRT2Part2_Clevo1024x768_3; break; - default: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1024x768_3; break; + case 200: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1024x768_1; break; + case 206: CRT2Part2Ptr = SiS310_CRT2Part2_Asus1024x768_3; break; + default: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1024x768_3; break; } SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x01,0x80,(CRT2Part2Ptr+resindex)->CR[0]); @@ -7716,58 +7336,34 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr SiS_SetReg(SiS_Pr->SiS_Part2Port,0x23,(CRT2Part2Ptr+resindex)->CR[10]); SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x25,0x0f,(CRT2Part2Ptr+resindex)->CR[11]); - if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) { - if(SiS_Pr->SiS_VGAVDE == 525) { - temp = 0xc3; - if(SiS_Pr->SiS_ModeType <= ModeVGA) { - temp++; - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) temp += 2; - } - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2f,temp); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x30,0xb3); - } else if(SiS_Pr->SiS_VGAVDE == 420) { - temp = 0x4d; - if(SiS_Pr->SiS_ModeType <= ModeVGA) { - temp++; - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) temp++; - } - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2f,temp); - } - } + SiS_SetGroup2_Tail(SiS_Pr, ModeNo); - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { - /* See Sync above, 0x1a */ - temp = 1; - if(ModeNo <= 0x13) temp = 3; - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x0b,temp); - } - } + + } else { #endif - - } else { /* ------ 300 series and other bridges, other LCD resolutions ------ */ - - /* Using this on the 301B with an auto-expanding 1024 panel (CR37=1) makes - * the panel scale at modes < 1024 (no black bars); if the panel is non-expanding, - * the bridge scales all modes to 1024. - * !!! Malfunction at 640x480 and 640x400 when panel is auto-expanding - black screen !!! - */ - - tempcx = SiS_Pr->SiS_VT; - tempbx = SiS_Pr->PanelYRes; + + /* Checked for 1024x768, 1280x1024, 1400x1050, 1600x1200 */ + /* Clevo dual-link 1024x768 */ + /* Compaq 1280x1024 has HT 1696 sometimes (calculation OK, if given HT is correct) */ + /* Acer: OK, but uses different setting for VESA timing at 640/800/1024 and 640x400 */ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { - tempbx = SiS_Pr->SiS_VDE - 1; - tempcx--; - } - - tempax = 1; - if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) { - if(tempbx != SiS_Pr->SiS_VDE) { - tempax = tempbx; - if(tempax < SiS_Pr->SiS_VDE) { - tempax = 0; - tempcx = 0; + if((SiS_Pr->SiS_LCDInfo & LCDPass11) || (SiS_Pr->PanelYRes == SiS_Pr->SiS_VDE)) { + tempbx = SiS_Pr->SiS_VDE - 1; + tempcx = SiS_Pr->SiS_VT - 1; + } else { + tempbx = SiS_Pr->SiS_VDE + ((SiS_Pr->PanelYRes - SiS_Pr->SiS_VDE) / 2); + tempcx = SiS_Pr->SiS_VT - ((SiS_Pr->PanelYRes - SiS_Pr->SiS_VDE) / 2); + } + } else { + tempbx = SiS_Pr->PanelYRes; + tempcx = SiS_Pr->SiS_VT; + tempax = 1; + if(SiS_Pr->PanelYRes != SiS_Pr->SiS_VDE) { + tempax = SiS_Pr->PanelYRes; + /* if(SiS_Pr->SiS_VGAVDE == 525) tempax += 0x3c; */ /* 651+301C */ + if(SiS_Pr->PanelYRes < SiS_Pr->SiS_VDE) { + tempax = tempcx = 0; } else { tempax -= SiS_Pr->SiS_VDE; } @@ -7783,23 +7379,46 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr xf86DrvMsg(0, X_INFO, "lcdvdes 0x%x lcdvdee 0x%x\n", tempcx, tempbx); #endif - temp = tempcx & 0x00FF; /* RVEQ1EQ=lcdvdes */ - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x05,temp); - temp = tempbx & 0x00FF; /* RVEQ2EQ=lcdvdee */ - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x06,temp); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x05,tempcx); /* lcdvdes */ + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x06,tempbx); /* lcdvdee */ temp = ((tempbx & 0xFF00) >> 8) << 3; temp |= ((tempcx & 0xFF00) >> 8); SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,temp); - tempbx = SiS_Pr->SiS_VT; /* push2; */ - tempax = SiS_Pr->SiS_VDE; /* push1; */ - tempcx = (tempbx - tempax) >> 4; - tempbx += tempax; - tempbx >>= 1; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx -= 10; + tempax = SiS_Pr->SiS_VDE; + if((SiS_Pr->SiS_LCDInfo & DontExpandLCD) && (!(SiS_Pr->SiS_LCDInfo & LCDPass11))) { + tempax = SiS_Pr->PanelYRes; + } + tempcx = (SiS_Pr->SiS_VT - tempax) >> 4; + if((SiS_Pr->SiS_LCDInfo & DontExpandLCD) && (!(SiS_Pr->SiS_LCDInfo & LCDPass11))) { + if(SiS_Pr->PanelYRes != SiS_Pr->SiS_VDE) { + tempcx = (SiS_Pr->SiS_VT - tempax) / 10; + } + } - /* non-expanding: lcdvrs = tempbx = ((VT + VDE) / 2) - 10 */ + tempbx = ((SiS_Pr->SiS_VT + SiS_Pr->SiS_VDE) >> 1) - 1; + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + if(SiS_Pr->PanelYRes != SiS_Pr->SiS_VDE) { + if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) { /* ? */ + tempax = SiS_Pr->SiS_VT - SiS_Pr->PanelYRes; + if(tempax % 4) { tempax >>= 2; tempax++; } + else { tempax >>= 2; } + tempbx -= (tempax - 1); + } else tempbx -= 10; + } + } + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { + tempbx++; + if((!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) || (crt2crtc == 6)) { + if(SiS_Pr->SiS_SetFlag & LCDVESATiming) { + tempbx = 770; + tempcx = 3; + } + } + } + + /* non-expanding: lcdvrs = ((VT + VDE) / 2) - 10 */ if(SiS_Pr->UseCustomMode) { tempbx = SiS_Pr->CVSyncStart; @@ -7809,8 +7428,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr xf86DrvMsg(0, X_INFO, "lcdvrs 0x%x\n", tempbx); #endif - temp = tempbx & 0x00FF; /* RTVACTEE = lcdvrs */ - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x04,temp); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x04,tempbx); /* lcdvrs */ temp = ((tempbx & 0xFF00) >> 8) << 4; tempbx += (tempcx + 1); @@ -7827,149 +7445,106 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,temp); - /* Code from 630/301B (I+II) BIOS */ - #ifdef SIS300 - if(!SiS_Pr->UseCustomMode) { - if( ( ( (HwInfo->jChipType == SIS_630) || - (HwInfo->jChipType == SIS_730) ) && - (HwInfo->jChipRevision > 2) ) && - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) && - (!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) && - (!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) ) { - if(ModeNo == 0x13) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x04,0xB9); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x05,0xCC); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x06,0xA6); - } else { - if((crt2crtc & 0x3F) == 4) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x2B); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x13); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x04,0xE5); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x05,0x08); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x06,0xE2); - } - } - } + SiS_Group2LCDSpecial(SiS_Pr, HwInfo, ModeNo, crt2crtc); +#endif - if(HwInfo->jChipType < SIS_315H) { - if(SiS_Pr->SiS_LCDTypeInfo == 0x0c) { - crt2crtc &= 0x1f; - tempcx = 0; - if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) { - if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { - tempcx += 7; - } - } - tempcx += crt2crtc; - if(crt2crtc >= 4) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x06,0xff); - } + bridgeoffset = 7; + if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) bridgeoffset += 2; + if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302ELV)) bridgeoffset++; + if(SiS_IsDualLink(SiS_Pr, HwInfo)) bridgeoffset++; - if(!(SiS_Pr->SiS_VBInfo & SetNotSimuMode)) { - if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { - if(crt2crtc == 4) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x28); - } - } - } - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x18); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x04,atable[tempcx]); - } + temp = 0; + if((SiS_Pr->SiS_LCDInfo & DontExpandLCD) && (!(SiS_Pr->SiS_LCDInfo & LCDPass11))) { + if(SiS_Pr->PanelXRes != SiS_Pr->SiS_HDE) { + temp = SiS_Pr->SiS_HT - ((SiS_Pr->PanelXRes - SiS_Pr->SiS_HDE) / 2); + if(SiS_IsDualLink(SiS_Pr, HwInfo)) temp >>= 1; } } -#endif - - tempcx = (SiS_Pr->SiS_HT - SiS_Pr->SiS_HDE) >> 2; /* (HT - HDE) >> 2 */ - tempbx = SiS_Pr->SiS_HDE + 7; /* lcdhdee */ - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - tempbx += 2; + temp += bridgeoffset; + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x1F,temp); /* lcdhdes[7:0] */ + temp = (temp >> 4) & 0xf0; + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x20,0x0F,temp); /* lcdhdes [11:8] */ + + tempcx = SiS_Pr->SiS_HT; + tempax = tempbx = SiS_Pr->SiS_HDE; + if((SiS_Pr->SiS_LCDInfo & DontExpandLCD) && (!(SiS_Pr->SiS_LCDInfo & LCDPass11))) { + if(SiS_Pr->PanelXRes != SiS_Pr->SiS_HDE) { + tempax = SiS_Pr->PanelXRes; + tempbx = SiS_Pr->PanelXRes - ((SiS_Pr->PanelXRes - SiS_Pr->SiS_HDE) / 2); + } + } + if(SiS_IsDualLink(SiS_Pr, HwInfo)) { + tempcx >>= 1; + tempbx >>= 1; + tempax >>= 1; } - push1 = tempbx; #ifdef TWDEBUG xf86DrvMsg(0, X_INFO, "lcdhdee 0x%x\n", tempbx); #endif - temp = tempbx & 0x00FF; /* RHEQPLE = lcdhdee */ - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x23,temp); - temp = (tempbx & 0xFF00) >> 8; + tempbx += bridgeoffset; + + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x23,tempbx); /* lcdhdee */ + temp = (tempbx >> 8) & 0x0f; SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x25,0xF0,temp); - temp = 7; - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - temp += 2; - } - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x1F,temp); /* RHBLKE = lcdhdes[7:0] */ - SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x20,0x0F); /* lcdhdes [11:8] */ + tempcx = (tempcx - tempax) >> 2; tempbx += tempcx; push2 = tempbx; - if(SiS_Pr->UseCustomMode) { - tempbx = SiS_Pr->CHSyncStart + 7; - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - tempbx += 2; + if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) { + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + if(SiS_Pr->SiS_LCDInfo & LCDPass11) { + if(SiS_Pr->SiS_HDE == 1280) tempbx = (tempbx & 0xff00) | 0x47; + } } } + if(SiS_Pr->UseCustomMode) { + tempbx = SiS_Pr->CHSyncStart; + if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempbx >>= 1; + tempbx += bridgeoffset; + } + #ifdef TWDEBUG xf86DrvMsg(0, X_INFO, "lcdhrs 0x%x\n", tempbx); #endif - temp = tempbx & 0x00FF; /* RHBURSTS = lcdhrs */ - if(!SiS_Pr->UseCustomMode) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { - if(SiS_Pr->SiS_HDE == 1280) temp = 0x47; - } - } - } - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x1C,temp); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x1C,tempbx); /* lcdhrs */ temp = (tempbx & 0x0F00) >> 4; SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1D,0x0F,temp); tempbx = push2; + tempcx <<= 1; + if((SiS_Pr->SiS_LCDInfo & DontExpandLCD) && (!(SiS_Pr->SiS_LCDInfo & LCDPass11))) { + if(SiS_Pr->PanelXRes != SiS_Pr->SiS_HDE) tempcx >>= 2; + } tempbx += tempcx; if(SiS_Pr->UseCustomMode) { - tempbx = SiS_Pr->CHSyncEnd + 7; - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - tempbx += 2; - } + tempbx = SiS_Pr->CHSyncEnd; + if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempbx >>= 1; + tempbx += bridgeoffset; } #ifdef TWDEBUG xf86DrvMsg(0, X_INFO, "lcdhre 0x%x\n", tempbx); #endif - temp = tempbx & 0x00FF; /* RHSYEXP2S = lcdhre */ - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x21,temp); - - if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) { - if(SiS_Pr->SiS_VGAVDE == 525) { - if(SiS_Pr->SiS_ModeType <= ModeVGA) - temp=0xC6; - else - temp=0xC3; - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2f,temp); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x30,0xB3); - } else if(SiS_Pr->SiS_VGAVDE == 420) { - if(SiS_Pr->SiS_ModeType <= ModeVGA) - temp=0x4F; - else - temp=0x4D; - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2f,temp); - } - } + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x21,tempbx); /* lcdhre */ + + SiS_SetGroup2_Tail(SiS_Pr, ModeNo); #ifdef SIS300 - SiS_Set300Part2Regs(SiS_Pr, HwInfo, ModeIdIndex, - RefreshRateTableIndex, ModeNo); + SiS_Set300Part2Regs(SiS_Pr, HwInfo, ModeIdIndex, RefreshRateTableIndex, ModeNo); #endif - - } /* HwInfo */ +#ifdef SIS315H + } /* CRT2-LCD from table */ +#endif } /*********************************************/ @@ -7987,12 +7562,10 @@ SiS_SetGroup3(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, if(ModeNo<=0x13) { modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + } else if(SiS_Pr->UseCustomMode) { + modeflag = SiS_Pr->CModeFlag; } else { - if(SiS_Pr->UseCustomMode) { - modeflag = SiS_Pr->CModeFlag; - } else { - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - } + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; } #ifndef SIS_CP @@ -8017,33 +7590,120 @@ SiS_SetGroup3(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, SiS_SetReg(SiS_Pr->SiS_Part3Port,0x3D,0xA8); } - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { + tempdi = NULL; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) { tempdi = SiS_Pr->SiS_HiTVGroup3Data; if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) { tempdi = SiS_Pr->SiS_HiTVGroup3Simu; +#if 0 if(!(modeflag & Charx8Dot)) { tempdi = SiS_Pr->SiS_HiTVGroup3Text; } +#endif } - if(SiS_Pr->SiS_HiVision & 0x03) { + } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) { + if(!(SiS_Pr->SiS_TVMode & TVSetYPbPr525i)) { tempdi = SiS_HiTVGroup3_1; - if(SiS_Pr->SiS_HiVision & 0x02) tempdi = SiS_HiTVGroup3_2; + if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) tempdi = SiS_HiTVGroup3_2; } - for(i=0; i<=0x3E; i++){ + } + if(tempdi) { + for(i=0; i<=0x3E; i++) { SiS_SetReg(SiS_Pr->SiS_Part3Port,i,tempdi[i]); } + if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302ELV)) { + if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) { + SiS_SetReg(SiS_Pr->SiS_Part3Port,0x28,0x3f); + } + } } #ifdef SIS_CP SIS_CP_INIT301_CP2 #endif - } /*********************************************/ /* SET PART 4 REGISTER GROUP */ /*********************************************/ +#ifdef SIS315H +static void +SiS_ShiftXPos(SiS_Private *SiS_Pr, int shift) +{ + USHORT temp, temp1, temp2; + + temp1 = SiS_GetReg(SiS_Pr->SiS_Part2Port,0x1f); + temp2 = SiS_GetReg(SiS_Pr->SiS_Part2Port,0x20); + temp = (USHORT)((int)((temp1 | ((temp2 & 0xf0) << 4))) + shift); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x1f,temp); + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x20,0x0f,((temp >> 4) & 0xf0)); + temp = SiS_GetReg(SiS_Pr->SiS_Part2Port,0x2b) & 0x0f; + temp = (USHORT)((int)(temp) + shift); + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x2b,0xf0,(temp & 0x0f)); + temp1 = SiS_GetReg(SiS_Pr->SiS_Part2Port,0x43); + temp2 = SiS_GetReg(SiS_Pr->SiS_Part2Port,0x42); + temp = (USHORT)((int)((temp1 | ((temp2 & 0xf0) << 4))) + shift); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x43,temp); + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x42,0x0f,((temp >> 4) & 0xf0)); +} + +static void +SiS_SetGroup4_C_ELV(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, + USHORT ModeNo, USHORT ModeIdIndex) +{ + USHORT temp, temp1, resinfo = 0; + + if(!(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302ELV))) return; + + if(ModeNo > 0x13) { + resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; + } + + SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x3a,0x08); + temp = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x3a); + if(!(temp & 0x01)) { + SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x3a,0xdf); + SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x25,0xfc); + if(HwInfo->jChipType < SIS_661) { + SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x25,0xf8); + } + SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x0f,0xfb); + if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) temp = 0x0000; + else if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) temp = 0x0002; + else if(SiS_Pr->SiS_TVMode & TVSetHiVision) temp = 0x0400; + else temp = 0x0402; + if(HwInfo->jChipType >= SIS_661) { + temp1 = 0; + if(SiS_Pr->SiS_TVMode & TVAspect43) temp1 = 4; + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x0f,0xfb,temp1); + if(SiS_Pr->SiS_TVMode & TVAspect43LB) temp |= 0x01; + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0x7c,(temp & 0xff)); + } else { + temp1 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x3b) & 0x03; + if(temp1 == 0x01) temp |= 0x01; + if(temp1 == 0x03) temp |= 0x04; /* ? why not 0x10? */ + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0xf8,(temp & 0xff)); + } + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x3a,0xfb,(temp >> 8)); + + if(HwInfo->jChipType >= SIS_661) { /* ? */ + if(SiS_Pr->SiS_TVMode & TVAspect43) { + if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) { + if(resinfo == SIS_RI_1024x768) { + SiS_ShiftXPos(SiS_Pr, 97); + } else { + SiS_ShiftXPos(SiS_Pr, 111); + } + } else if(SiS_Pr->SiS_TVMode & TVSetHiVision) { + SiS_ShiftXPos(SiS_Pr, 136); + } + } + } + } +} +#endif + static void SiS_SetCRT2VCLK(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PSIS_HW_INFO HwInfo) @@ -8081,7 +7741,6 @@ SiS_SetCRT2VCLK(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x12,temp); } -/* Set 301 VGA2 registers */ static void SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PSIS_HW_INFO HwInfo) @@ -8092,14 +7751,12 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, if(ModeNo <= 0x13) { modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo; + } else if(SiS_Pr->UseCustomMode) { + modeflag = SiS_Pr->CModeFlag; + resinfo = 0; } else { - if(SiS_Pr->UseCustomMode) { - modeflag = SiS_Pr->CModeFlag; - resinfo = 0; - } else { - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; - } + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; } if(HwInfo->jChipType >= SIS_315H) { @@ -8122,21 +7779,13 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, if(SiS_IsDualLink(SiS_Pr, HwInfo)) { SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x2c); } - if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) { -#ifdef SET_EMI_CPQ - if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x2a,0x00); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x30,0x00); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10); - } -#endif - } else if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { #ifdef SET_EMI + if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { SiS_SetReg(SiS_Pr->SiS_Part4Port,0x2a,0x00); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x30,0x00); + SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c); SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10); -#endif } +#endif } return; } @@ -8146,35 +7795,30 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, SiS_SetReg(SiS_Pr->SiS_Part4Port,0x13,temp); tempbx = SiS_Pr->SiS_RVBHCMAX; - temp = tempbx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x14,temp); + SiS_SetReg(SiS_Pr->SiS_Part4Port,0x14,tempbx); - temp2 = (((tempbx & 0xFF00) >> 8) << 7) & 0x00ff; + temp2 = (tempbx >> 1) & 0x0080; tempcx = SiS_Pr->SiS_VGAHT - 1; - temp = tempcx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x16,temp); + SiS_SetReg(SiS_Pr->SiS_Part4Port,0x16,tempcx); - temp = (((tempcx & 0xFF00) >> 8) << 3) & 0x00ff; - temp2 |= temp; + temp2 |= (((tempcx & 0xFF00) >> 8) << 3) & 0x00ff; tempcx = SiS_Pr->SiS_VGAVT - 1; - if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) tempcx -= 5; + if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) tempcx -= 5; + SiS_SetReg(SiS_Pr->SiS_Part4Port,0x17,tempcx); - temp = tempcx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x17,temp); - - temp = temp2 | ((tempcx & 0xFF00) >> 8); + temp = temp2 | (tempcx >> 8); SiS_SetReg(SiS_Pr->SiS_Part4Port,0x15,temp); tempbx = SiS_Pr->SiS_VGAHDE; - if(modeflag & HalfDCLK) tempbx >>= 1; + if(modeflag & HalfDCLK) tempbx >>= 1; if(HwInfo->jChipType >= SIS_661) { if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempbx >>= 1; } temp = 0xA0; - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) { temp = 0; if(tempbx > 800) { temp = 0xA0; @@ -8195,7 +7839,7 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } } - if(SiS_Pr->SiS_HiVision & 0x03) { + if(SiS_Pr->SiS_TVMode & (TVSetYPbPr525p | TVSetYPbPr750p)) { temp = 0; if(SiS_Pr->SiS_VGAHDE == 1024) temp = 0x20; } @@ -8205,7 +7849,7 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } if(SiS_Pr->SiS_VBType & VB_SIS301) { - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x1024) + if(SiS_Pr->SiS_LCDResInfo != Panel_1280x1024) temp |= 0x0A; } @@ -8213,7 +7857,7 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, tempebx = SiS_Pr->SiS_VDE; - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) { + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) { if(!(temp & 0xE0)) tempebx >>=1; } @@ -8251,24 +7895,15 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, tempbx = 0; tempax = SiS_Pr->SiS_VGAHDE; - if(modeflag & HalfDCLK) tempax >>= 1; - if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) || (SiS_Pr->SiS_HiVision & 0x03)) { - if(HwInfo->jChipType >= SIS_315H) { - if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempax >>= 1; - else if(tempax > 800) tempax -= 800; - } else { - if(tempax > 800) tempax -= 800; - } - } - - if((SiS_Pr->SiS_VBInfo & (SetCRT2ToTV - SetCRT2ToHiVisionTV)) && (!(SiS_Pr->SiS_HiVision & 0x03))) { + if(modeflag & HalfDCLK) tempax >>= 1; + if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempax >>= 1; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + if(tempax > 800) tempax -= 800; + } else /* if(SiS_Pr->SiS_VBInfo & TvNoHiviNoYPbPr) */ { /* 651+301C */ if(tempax > 800) { tempbx = 8; - if(tempax == 1024) - tempax *= 25; - else - tempax *= 20; - + if(tempax == 1024) tempax *= 25; + else tempax *= 20; temp = tempax % 32; tempax /= 32; tempax--; @@ -8276,11 +7911,11 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } } tempax--; - temp = (tempax & 0xFF00) >> 8; - temp &= 0x03; - if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { /* From 1.10.7w */ + temp = ((tempax & 0xFF00) >> 8) & 0x03; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoYPbPrHiVision) { /* From 1.10.7w */ if(ModeNo > 0x13) { /* From 1.10.7w */ if(resinfo == SIS_RI_1024x768) tempax = 0x1f; /* From 1.10.7w */ + /* ax normally 0x1e */ /* From 1.10.7w */ } /* From 1.10.7w */ } /* From 1.10.7w */ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x1D,tempax & 0x00FF); @@ -8297,12 +7932,14 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } else { temp = 0x0036; } - if((SiS_Pr->SiS_VBInfo & (SetCRT2ToTV - SetCRT2ToHiVisionTV)) && - (!(SiS_Pr->SiS_HiVision & 0x03))) { - temp |= 0x01; - if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { - if(!(SiS_Pr->SiS_TVMode & TVSetTVSimuMode)) - temp &= 0xFE; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + if(!(SiS_Pr->SiS_TVMode & (TVSetNTSC1024 | TVSetHiVision | TVSetYPbPr750p | TVSetYPbPr525p))) { + temp |= 0x01; + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { + if(!(SiS_Pr->SiS_TVMode & TVSetTVSimuMode)) { + temp &= 0xFE; + } + } } } SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x1F,0xC0,temp); @@ -8326,21 +7963,13 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x2c); } } - if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) { -#ifdef SET_EMI_CPQ - if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x2a,0x00); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x30,0x00); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10); - } -#endif - } else if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { #ifdef SET_EMI + if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { SiS_SetReg(SiS_Pr->SiS_Part4Port,0x2a,0x00); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x30,0x00); + SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c); SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10); -#endif } +#endif } } /* 301B */ @@ -8352,7 +7981,6 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, /* SET PART 5 REGISTER GROUP */ /*********************************************/ -/* Set 301 Palette address port registers */ static void SiS_SetGroup5(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, PSIS_HW_INFO HwInfo) @@ -8361,8 +7989,8 @@ SiS_SetGroup5(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) return; if(SiS_Pr->SiS_ModeType == ModeVGA) { - if(!(SiS_Pr->SiS_VBInfo & (SetInSlaveMode | LoadDACFlag))){ - SiS_EnableCRT2(SiS_Pr); + if(!(SiS_Pr->SiS_VBInfo & (SetInSlaveMode | LoadDACFlag))) { + SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); SiS_LoadDAC(SiS_Pr, HwInfo, ModeNo, ModeIdIndex); } } @@ -8380,11 +8008,8 @@ SiS_ModCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, USHORT ResIndex,DisplayType; const SiS_LVDSCRT1DataStruct *LVDSCRT1Ptr=NULL; - if(ModeNo <= 0x13) { - modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - } else { - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - } + if(ModeNo <= 0x13) modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + else modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; if((SiS_Pr->SiS_CustomT == CUT_BARCO1366) || (SiS_Pr->SiS_CustomT == CUT_BARCO1024) || @@ -8392,7 +8017,9 @@ SiS_ModCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, return; if(!(SiS_GetLVDSCRT1Ptr(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, - &ResIndex, &DisplayType))) return; + &ResIndex, &DisplayType))) { + return; + } if(HwInfo->jChipType < SIS_315H) { if(SiS_Pr->SiS_SetFlag & SetDOSMode) return; @@ -8400,16 +8027,16 @@ SiS_ModCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, switch(DisplayType) { case 0 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_1; break; - case 1 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_1; break; - case 2 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_1; break; - case 3 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_1_H; break; - case 4 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_1_H; break; - case 5 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_1_H; break; - case 6 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_2; break; - case 7 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_2; break; - case 8 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_2; break; - case 9 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_2_H; break; - case 10: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_2_H; break; + case 1 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_1_H; break; + case 2 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_2; break; + case 3 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_2_H; break; + case 4 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_1; break; + case 5 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_1_H; break; + case 6 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_2; break; + case 7 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_2_H; break; + case 8 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_1; break; + case 9 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_1_H; break; + case 10: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_2; break; case 11: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_2_H; break; case 12: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1XXXxXXX_1; break; case 13: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1XXXxXXX_1_H; break; @@ -8448,7 +8075,7 @@ SiS_ModCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, default: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_1; break; } - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); /*unlock cr0-7 */ + SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); tempah = (LVDSCRT1Ptr + ResIndex)->CR[0]; SiS_SetReg(SiS_Pr->SiS_P3d4,0x00,tempah); @@ -8483,12 +8110,6 @@ SiS_ModCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, tempah <<= 5; if(modeflag & DoubleScanMode) tempah |= 0x080; SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,~0x020,tempah); - - /* 650/LVDS BIOS - doesn't make sense */ - if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { - if(modeflag & HalfDCLK) - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); - } } /*********************************************/ @@ -8503,7 +8124,7 @@ SiS_SetCRT2ECLK(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, USHORT clkbase, vclkindex=0; UCHAR sr2b, sr2c; - if((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel640x480) || (SiS_Pr->SiS_IF_DEF_TRUMPION == 1)) { + if((SiS_Pr->SiS_LCDResInfo == Panel_640x480) || (SiS_Pr->SiS_LCDInfo & LCDPass11)) { SiS_Pr->SiS_SetFlag &= (~ProgrammingCRT2); if((SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK & 0x3f) == 2) { RefreshRateTableIndex--; @@ -8520,7 +8141,7 @@ SiS_SetCRT2ECLK(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, sr2c = SiS_Pr->SiS_VCLKData[vclkindex].SR2C; if((SiS_Pr->SiS_CustomT == CUT_BARCO1366) || (SiS_Pr->SiS_CustomT == CUT_BARCO1024)) { - if((ROMAddr) && SiS_Pr->SiS_UseROM) { + if(SiS_Pr->SiS_UseROM) { if(ROMAddr[0x220] & 0x01) { sr2b = ROMAddr[0x227]; sr2c = ROMAddr[0x228]; @@ -8535,7 +8156,6 @@ SiS_SetCRT2ECLK(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } } - SiS_SetReg(SiS_Pr->SiS_P3c4,0x05,0x86); SiS_SetReg(SiS_Pr->SiS_P3c4,0x31,0x20); SiS_SetReg(SiS_Pr->SiS_P3c4,clkbase,sr2b); SiS_SetReg(SiS_Pr->SiS_P3c4,clkbase+1,sr2c); @@ -8560,9 +8180,9 @@ SiS_SetCHTVReg(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, const SiS_CHTVRegDataStruct *CHTVRegData = NULL; if(ModeNo <= 0x13) - tempcl = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + tempcl = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; else - tempcl = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; + tempcl = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; TVType = 0; if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) TVType += 1; @@ -8580,16 +8200,16 @@ SiS_SetCHTVReg(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } } switch(TVType) { - case 0: CHTVRegData = SiS_Pr->SiS_CHTVReg_UNTSC; break; - case 1: CHTVRegData = SiS_Pr->SiS_CHTVReg_ONTSC; break; - case 2: CHTVRegData = SiS_Pr->SiS_CHTVReg_UPAL; break; - case 3: CHTVRegData = SiS_Pr->SiS_CHTVReg_OPAL; break; - case 4: CHTVRegData = SiS_Pr->SiS_CHTVReg_UPALM; break; - case 5: CHTVRegData = SiS_Pr->SiS_CHTVReg_OPALM; break; - case 6: CHTVRegData = SiS_Pr->SiS_CHTVReg_UPALN; break; - case 7: CHTVRegData = SiS_Pr->SiS_CHTVReg_OPALN; break; - case 8: CHTVRegData = SiS_Pr->SiS_CHTVReg_SOPAL; break; - default: CHTVRegData = SiS_Pr->SiS_CHTVReg_OPAL; break; + case 0: CHTVRegData = SiS_Pr->SiS_CHTVReg_UNTSC; break; + case 1: CHTVRegData = SiS_Pr->SiS_CHTVReg_ONTSC; break; + case 2: CHTVRegData = SiS_Pr->SiS_CHTVReg_UPAL; break; + case 3: CHTVRegData = SiS_Pr->SiS_CHTVReg_OPAL; break; + case 4: CHTVRegData = SiS_Pr->SiS_CHTVReg_UPALM; break; + case 5: CHTVRegData = SiS_Pr->SiS_CHTVReg_OPALM; break; + case 6: CHTVRegData = SiS_Pr->SiS_CHTVReg_UPALN; break; + case 7: CHTVRegData = SiS_Pr->SiS_CHTVReg_OPALN; break; + case 8: CHTVRegData = SiS_Pr->SiS_CHTVReg_SOPAL; break; + default: CHTVRegData = SiS_Pr->SiS_CHTVReg_OPAL; break; } resindex = tempcl & 0x3F; @@ -8861,21 +8481,21 @@ SiS_ChrontelPowerSequencing(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) /* Set up Power up/down timing */ if(HwInfo->jChipType == SIS_740) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { if(SiS_Pr->SiS_CustomT == CUT_ASUSL3000D) tableptr = asus1024_740; else tableptr = table1024_740; - } else if((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) || - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) || - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200)) { + } else if((SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) || + (SiS_Pr->SiS_LCDResInfo == Panel_1400x1050) || + (SiS_Pr->SiS_LCDResInfo == Panel_1600x1200)) { if(SiS_Pr->SiS_CustomT == CUT_ASUSL3000D) tableptr = asus1400_740; else tableptr = table1400_740; } else return; } else { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { tableptr = table1024_650; - } else if((SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) || - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) || - (SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200)) { + } else if((SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) || + (SiS_Pr->SiS_LCDResInfo == Panel_1400x1050) || + (SiS_Pr->SiS_LCDResInfo == Panel_1600x1200)) { tableptr = table1400_650; } else return; } @@ -8911,45 +8531,35 @@ SiS_SetCH701xForLCD(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) int i; if(HwInfo->jChipType == SIS_740) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { - tableptr = table1024_740; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { - tableptr = table1280_740; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { - tableptr = table1400_740; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) { - tableptr = table1600_740; - } else return; + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) tableptr = table1024_740; + else if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) tableptr = table1280_740; + else if(SiS_Pr->SiS_LCDResInfo == Panel_1400x1050) tableptr = table1400_740; + else if(SiS_Pr->SiS_LCDResInfo == Panel_1600x1200) tableptr = table1600_740; + else return; } else { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { - tableptr = table1024_650; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { - tableptr = table1280_650; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { - tableptr = table1400_650; - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) { - tableptr = table1600_650; - } else return; + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) tableptr = table1024_650; + else if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) tableptr = table1280_650; + else if(SiS_Pr->SiS_LCDResInfo == Panel_1400x1050) tableptr = table1400_650; + else if(SiS_Pr->SiS_LCDResInfo == Panel_1600x1200) tableptr = table1600_650; + else return; } tempbh = SiS_GetCH701x(SiS_Pr,0x74); if((tempbh == 0xf6) || (tempbh == 0xc7)) { tempbh = SiS_GetCH701x(SiS_Pr,0x73); if(tempbh == 0xc8) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) return; + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) return; } else if(tempbh == 0xdb) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) return; - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) return; + if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) return; + if(SiS_Pr->SiS_LCDResInfo == Panel_1400x1050) return; } else if(tempbh == 0xde) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) return; + if(SiS_Pr->SiS_LCDResInfo == Panel_1600x1200) return; } } - if(HwInfo->jChipType == SIS_740) { - tempbh = 0x0d; - } else { - tempbh = 0x0c; - } + if(HwInfo->jChipType == SIS_740) tempbh = 0x0d; + else tempbh = 0x0c; + for(i = 0; i < tempbh; i++) { SiS_SetCH701x(SiS_Pr,(tableptr[i] << 8) | regtable[i]); } @@ -9329,16 +8939,6 @@ SiS_SetCRT2Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) } if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) { -#if 0 - /* RDirectLCDN */ - if( (SiS_IsVAMode(SiS_Pr, HwInfo)) || - (SiS_IsDualEdge(SiS_Pr, HwInfo)) ) { - temp = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x23); - SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x23,0x80); - SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x23,0x7f); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x23,temp); - } -#endif SiS_LockCRT2(SiS_Pr, HwInfo); SiS_DisplayOn(SiS_Pr); return TRUE; @@ -9346,13 +8946,12 @@ SiS_SetCRT2Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) SiS_GetCRT2Data(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo); - /* Set up Panel Link for LVDS, 301BDH and 30xLV(for LCDA) */ + /* Set up Panel Link for LVDS and LCDA */ + SiS_Pr->SiS_LCDHDES = SiS_Pr->SiS_LCDVDES = 0; if( (SiS_Pr->SiS_IF_DEF_LVDS == 1) || ((SiS_Pr->SiS_VBType & VB_NoLCD) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) || ((HwInfo->jChipType >= SIS_315H) && (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) ) { - SiS_GetLVDSDesData(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo); - } else { - SiS_Pr->SiS_LCDHDES = SiS_Pr->SiS_LCDVDES = 0; + SiS_GetLVDSDesData(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo); } #ifdef LINUX_XF86 @@ -9379,11 +8978,16 @@ SiS_SetCRT2Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) #endif SiS_SetGroup3(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); SiS_SetGroup4(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo); +#ifdef SIS315H + SiS_SetGroup4_C_ELV(SiS_Pr, HwInfo, ModeNo, ModeIdIndex); +#endif SiS_SetGroup5(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); + SiS_SetCRT2Sync(SiS_Pr, ModeNo, RefreshRateTableIndex, HwInfo); + /* For 301BDH (Panel link initialization): */ if((SiS_Pr->SiS_VBType & VB_NoLCD) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) { - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) { + if(SiS_Pr->SiS_LCDResInfo != Panel_640x480) { if(!((SiS_Pr->SiS_SetFlag & SetDOSMode) && ((ModeNo == 0x03) || (ModeNo == 0x10)))) { if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { SiS_ModCRT1CRTC(SiS_Pr,ModeNo,ModeIdIndex, @@ -9398,28 +9002,25 @@ SiS_SetCRT2Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) } else { - if(SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel640x480) { - if(SiS_Pr->SiS_IF_DEF_TRUMPION == 0) { - SiS_ModCRT1CRTC(SiS_Pr,ModeNo,ModeIdIndex, - RefreshRateTableIndex,HwInfo); - } + SiS_SetCRT2Sync(SiS_Pr, ModeNo, RefreshRateTableIndex, HwInfo); + + if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) { + SiS_ModCRT1CRTC(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwInfo); } - SiS_SetCRT2ECLK(SiS_Pr,ModeNo,ModeIdIndex, - RefreshRateTableIndex,HwInfo); + SiS_SetCRT2ECLK(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwInfo); if(SiS_Pr->SiS_SetFlag & LowModeTests) { if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) { -#ifdef SIS315H +#ifdef SIS315H SiS_SetCH701xForLCD(SiS_Pr,HwInfo); -#endif +#endif } } if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { - SiS_SetCHTVReg(SiS_Pr,ModeNo,ModeIdIndex, - RefreshRateTableIndex); + SiS_SetCHTVReg(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex); } } } @@ -9430,7 +9031,7 @@ SiS_SetCRT2Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) if(HwInfo->jChipType < SIS_315H) { if(SiS_Pr->SiS_SetFlag & LowModeTests) { if(SiS_Pr->SiS_UseOEM) { - if((SiS_Pr->SiS_UseROM) && ROMAddr && (SiS_Pr->SiS_UseOEM == -1)) { + if((SiS_Pr->SiS_UseROM) && (SiS_Pr->SiS_UseOEM == -1)) { if((ROMAddr[0x233] == 0x12) && (ROMAddr[0x234] == 0x34)) { SiS_OEM300Setting(SiS_Pr,HwInfo,ModeNo,ModeIdIndex, RefreshRateTableIndex); @@ -9463,13 +9064,11 @@ SiS_SetCRT2Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) if(SiS_Pr->SiS_SetFlag & LowModeTests) { if(HwInfo->jChipType < SIS_661) { SiS_FinalizeLCD(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); - if(SiS_Pr->SiS_UseOEM) { - SiS_OEM310Setting(SiS_Pr, HwInfo, ModeNo, ModeIdIndex); - } + SiS_OEM310Setting(SiS_Pr, HwInfo, ModeNo, ModeIdIndex); } else { SiS_OEM661Setting(SiS_Pr, HwInfo, ModeNo, ModeIdIndex, RefreshRateTableIndex); } - SiS_CRT2AutoThreshold(SiS_Pr); + SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x01,0x40); } } #endif @@ -9483,7 +9082,7 @@ SiS_SetCRT2Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) if(SiS_Pr->SiS_IF_DEF_CH70xx == 1) { if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { /* Disable LCD panel when using TV */ - SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x11,0x0C); + SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFF,0x0C); } else { /* Disable TV when using LCD */ SiS_SetCH70xxANDOR(SiS_Pr,0x010E,0xF8); @@ -9506,6 +9105,7 @@ void SiS_SiS30xBLOn(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { /* Switch on LCD backlight on SiS30xLV */ + SiS_DDC2Delay(SiS_Pr,0xff00); if(!(SiS_GetReg(SiS_Pr->SiS_Part4Port,0x26) & 0x02)) { SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x02); SiS_WaitVBRetrace(SiS_Pr,HwInfo); @@ -9521,12 +9121,81 @@ SiS_SiS30xBLOff(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) /* Switch off LCD backlight on SiS30xLV */ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFE); SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFD); + SiS_DDC2Delay(SiS_Pr,0xe000); } /*********************************************/ /* DDC RELATED FUNCTIONS */ /*********************************************/ +static void +SiS_SetupDDCN(SiS_Private *SiS_Pr) +{ + SiS_Pr->SiS_DDC_NData = ~SiS_Pr->SiS_DDC_Data; + SiS_Pr->SiS_DDC_NClk = ~SiS_Pr->SiS_DDC_Clk; + if((SiS_Pr->SiS_DDC_Index == 0x11) && (SiS_Pr->SiS_SensibleSR11)) { + SiS_Pr->SiS_DDC_NData &= 0x0f; + SiS_Pr->SiS_DDC_NClk &= 0x0f; + } +} + +#ifdef SIS300 +static UCHAR * +SiS_SetTrumpBlockLoop(SiS_Private *SiS_Pr, UCHAR *dataptr) +{ + int i, j, num; + USHORT tempah,temp; + UCHAR *mydataptr; + + for(i=0; i<20; i++) { /* Do 20 attempts to write */ + mydataptr = dataptr; + num = *mydataptr++; + if(!num) return mydataptr; + if(i) { + SiS_SetStop(SiS_Pr); + SiS_DDC2Delay(SiS_Pr,SiS_I2CDELAYSHORT*2); + } + if(SiS_SetStart(SiS_Pr)) continue; /* Set start condition */ + tempah = SiS_Pr->SiS_DDC_DeviceAddr; + temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* Write DAB (S0=0=write) */ + if(temp) continue; /* (ERROR: no ack) */ + tempah = *mydataptr++; + temp = SiS_WriteDDC2Data(SiS_Pr,tempah); /* Write register number */ + if(temp) continue; /* (ERROR: no ack) */ + for(j=0; j<num; j++) { + tempah = *mydataptr++; + temp = SiS_WriteDDC2Data(SiS_Pr,tempah);/* Write DAB (S0=0=write) */ + if(temp) break; + } + if(temp) continue; + if(SiS_SetStop(SiS_Pr)) continue; + return mydataptr; + } + return NULL; +} + +static BOOLEAN +SiS_SetTrumpionBlock(SiS_Private *SiS_Pr, UCHAR *dataptr) +{ + SiS_Pr->SiS_DDC_DeviceAddr = 0xF0; /* DAB (Device Address Byte) */ + SiS_Pr->SiS_DDC_Index = 0x11; /* Bit 0 = SC; Bit 1 = SD */ + SiS_Pr->SiS_DDC_Data = 0x02; /* Bitmask in IndexReg for Data */ + SiS_Pr->SiS_DDC_Clk = 0x01; /* Bitmask in IndexReg for Clk */ + SiS_SetupDDCN(SiS_Pr); + + SiS_SetSwitchDDC2(SiS_Pr); + + while(*dataptr) { + dataptr = SiS_SetTrumpBlockLoop(SiS_Pr, dataptr); + if(!dataptr) return FALSE; + } +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "Trumpion block success\n"); +#endif + return TRUE; +} +#endif + /* The Chrontel 700x is connected to the 630/730 via * the 630/730's DDC/I2C port. * @@ -9562,18 +9231,32 @@ SiS_SetChReg(SiS_Private *SiS_Pr, USHORT tempbx, USHORT myor) return FALSE; } +#ifdef SIS300 +/* Write Trumpion register */ +void +SiS_SetTrumpReg(SiS_Private *SiS_Pr, USHORT tempbx) +{ + SiS_Pr->SiS_DDC_DeviceAddr = 0xF0; /* DAB (Device Address Byte) */ + SiS_Pr->SiS_DDC_Index = 0x11; /* Bit 0 = SC; Bit 1 = SD */ + SiS_Pr->SiS_DDC_Data = 0x02; /* Bitmask in IndexReg for Data */ + SiS_Pr->SiS_DDC_Clk = 0x01; /* Bitmask in IndexReg for Clk */ + SiS_SetupDDCN(SiS_Pr); + SiS_SetChReg(SiS_Pr, tempbx, 0); +} +#endif + /* Write to Chrontel 700x */ /* Parameter is [Data (S15-S8) | Register no (S7-S0)] */ void SiS_SetCH700x(SiS_Private *SiS_Pr, USHORT tempbx) { - SiS_Pr->SiS_DDC_DataShift = 0x00; SiS_Pr->SiS_DDC_DeviceAddr = 0xEA; /* DAB (Device Address Byte) */ if(!(SiS_Pr->SiS_ChrontelInit)) { SiS_Pr->SiS_DDC_Index = 0x11; /* Bit 0 = SC; Bit 1 = SD */ SiS_Pr->SiS_DDC_Data = 0x02; /* Bitmask in IndexReg for Data */ SiS_Pr->SiS_DDC_Clk = 0x01; /* Bitmask in IndexReg for Clk */ + SiS_SetupDDCN(SiS_Pr); } if( (!(SiS_SetChReg(SiS_Pr, tempbx, 0x80))) && @@ -9581,6 +9264,7 @@ SiS_SetCH700x(SiS_Private *SiS_Pr, USHORT tempbx) SiS_Pr->SiS_DDC_Index = 0x0a; /* Bit 7 = SC; Bit 6 = SD */ SiS_Pr->SiS_DDC_Data = 0x80; /* Bitmask in IndexReg for Data */ SiS_Pr->SiS_DDC_Clk = 0x40; /* Bitmask in IndexReg for Clk */ + SiS_SetupDDCN(SiS_Pr); SiS_SetChReg(SiS_Pr, tempbx, 0x80); } @@ -9594,19 +9278,18 @@ SiS_SetCH701x(SiS_Private *SiS_Pr, USHORT tempbx) SiS_Pr->SiS_DDC_Index = 0x11; /* Bit 0 = SC; Bit 1 = SD */ SiS_Pr->SiS_DDC_Data = 0x08; /* Bitmask in IndexReg for Data */ SiS_Pr->SiS_DDC_Clk = 0x04; /* Bitmask in IndexReg for Clk */ - SiS_Pr->SiS_DDC_DataShift = 0x00; + SiS_SetupDDCN(SiS_Pr); SiS_Pr->SiS_DDC_DeviceAddr = 0xEA; /* DAB (Device Address Byte) */ - SiS_SetChReg(SiS_Pr, tempbx, 0); } void SiS_SetCH70xx(SiS_Private *SiS_Pr, USHORT tempbx) { - if(SiS_Pr->SiS_IF_DEF_CH70xx == 1) - SiS_SetCH700x(SiS_Pr,tempbx); - else - SiS_SetCH701x(SiS_Pr,tempbx); + if(SiS_Pr->SiS_IF_DEF_CH70xx == 1) + SiS_SetCH700x(SiS_Pr,tempbx); + else + SiS_SetCH701x(SiS_Pr,tempbx); } static USHORT @@ -9638,6 +9321,21 @@ SiS_GetChReg(SiS_Private *SiS_Pr, USHORT myor) return 0xFFFF; } +#ifdef SIS300 +/* Read from Trumpion */ +USHORT +SiS_GetTrumpReg(SiS_Private *SiS_Pr, USHORT tempbx) +{ + SiS_Pr->SiS_DDC_DeviceAddr = 0xF0; /* DAB */ + SiS_Pr->SiS_DDC_Index = 0x11; /* Bit 0 = SC; Bit 1 = SD */ + SiS_Pr->SiS_DDC_Data = 0x02; /* Bitmask in IndexReg for Data */ + SiS_Pr->SiS_DDC_Clk = 0x01; /* Bitmask in IndexReg for Clk */ + SiS_SetupDDCN(SiS_Pr); + SiS_Pr->SiS_DDC_ReadAddr = tempbx; + return(SiS_GetChReg(SiS_Pr,0)); +} +#endif + /* Read from Chrontel 700x */ /* Parameter is [Register no (S7-S0)] */ USHORT @@ -9645,13 +9343,13 @@ SiS_GetCH700x(SiS_Private *SiS_Pr, USHORT tempbx) { USHORT result; - SiS_Pr->SiS_DDC_DataShift = 0x00; SiS_Pr->SiS_DDC_DeviceAddr = 0xEA; /* DAB */ if(!(SiS_Pr->SiS_ChrontelInit)) { SiS_Pr->SiS_DDC_Index = 0x11; /* Bit 0 = SC; Bit 1 = SD */ SiS_Pr->SiS_DDC_Data = 0x02; /* Bitmask in IndexReg for Data */ SiS_Pr->SiS_DDC_Clk = 0x01; /* Bitmask in IndexReg for Clk */ + SiS_SetupDDCN(SiS_Pr); } SiS_Pr->SiS_DDC_ReadAddr = tempbx; @@ -9662,6 +9360,7 @@ SiS_GetCH700x(SiS_Private *SiS_Pr, USHORT tempbx) SiS_Pr->SiS_DDC_Index = 0x0a; SiS_Pr->SiS_DDC_Data = 0x80; SiS_Pr->SiS_DDC_Clk = 0x40; + SiS_SetupDDCN(SiS_Pr); result = SiS_GetChReg(SiS_Pr,0x80); } @@ -9676,7 +9375,7 @@ SiS_GetCH701x(SiS_Private *SiS_Pr, USHORT tempbx) SiS_Pr->SiS_DDC_Index = 0x11; /* Bit 0 = SC; Bit 1 = SD */ SiS_Pr->SiS_DDC_Data = 0x08; /* Bitmask in IndexReg for Data */ SiS_Pr->SiS_DDC_Clk = 0x04; /* Bitmask in IndexReg for Clk */ - SiS_Pr->SiS_DDC_DataShift = 0x00; + SiS_SetupDDCN(SiS_Pr); SiS_Pr->SiS_DDC_DeviceAddr = 0xEA; /* DAB */ SiS_Pr->SiS_DDC_ReadAddr = tempbx; @@ -9689,10 +9388,10 @@ SiS_GetCH701x(SiS_Private *SiS_Pr, USHORT tempbx) USHORT SiS_GetCH70xx(SiS_Private *SiS_Pr, USHORT tempbx) { - if(SiS_Pr->SiS_IF_DEF_CH70xx == 1) - return(SiS_GetCH700x(SiS_Pr, tempbx)); - else - return(SiS_GetCH701x(SiS_Pr, tempbx)); + if(SiS_Pr->SiS_IF_DEF_CH70xx == 1) + return(SiS_GetCH700x(SiS_Pr, tempbx)); + else + return(SiS_GetCH701x(SiS_Pr, tempbx)); } /* Our own DDC functions */ @@ -9800,6 +9499,8 @@ SiS_InitDDCRegs(SiS_Private *SiS_Pr, unsigned long VBFlags, int VGAEngine, SiS_Pr->SiS_DDC_Data = 0x02 << temp; SiS_Pr->SiS_DDC_Clk = 0x01 << temp; + SiS_SetupDDCN(SiS_Pr); + #ifdef TWDEBUG xf86DrvMsg(0, X_INFO, "DDC Port %x Index %x Shift %d\n", SiS_Pr->SiS_DDC_Port, SiS_Pr->SiS_DDC_Index, temp); @@ -9844,11 +9545,15 @@ SiS_SendACK(SiS_Private *SiS_Pr, USHORT yesno) { SiS_SetSCLKLow(SiS_Pr); if(yesno) { - SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port, SiS_Pr->SiS_DDC_Index, - ~SiS_Pr->SiS_DDC_Data, SiS_Pr->SiS_DDC_Data); + SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port, + SiS_Pr->SiS_DDC_Index, + SiS_Pr->SiS_DDC_NData, + SiS_Pr->SiS_DDC_Data); } else { - SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port, SiS_Pr->SiS_DDC_Index, - ~SiS_Pr->SiS_DDC_Data, 0); + SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port, + SiS_Pr->SiS_DDC_Index, + SiS_Pr->SiS_DDC_NData, + 0); } SiS_SetSCLKHigh(SiS_Pr); } @@ -10073,6 +9778,8 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) for(i=0; i<7; i++) SiS_Pr->CP_DataValid[i] = FALSE; SiS_Pr->CP_HaveCustomData = FALSE; SiS_Pr->CP_MaxX = SiS_Pr->CP_MaxY = SiS_Pr->CP_MaxClock = 0; + SiS_Pr->CP_PreferredX = SiS_Pr->CP_PreferredY = 0; + SiS_Pr->CP_PreferredIndex = -1; if(!(pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B))) return 0; if(pSiS->VBFlags & VB_30xBDH) return 0; @@ -10083,7 +9790,7 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) /* Probe supported DA's */ flag = SiS_ProbeDDC(SiS_Pr); -#ifdef TWDEBUG +#ifdef TWDEBUG xf86DrvMsg(pSiS->pScrn->scrnIndex, X_INFO, "CRT2 DDC capabilities 0x%x\n", flag); #endif @@ -10167,12 +9874,14 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) SiS_Pr->CP_PreferredY = yres; switch(xres) { +#if 0 /* Treat as custom */ case 800: if(yres == 600) { paneltype = Panel_800x600; checkexpand = TRUE; } break; +#endif case 1024: if(yres == 768) { paneltype = Panel_1024x768; @@ -10190,9 +9899,13 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) paneltype = Panel310_1280x960; } } else if(yres == 768) { - paneltype = Panel_1280x768; - checkexpand = FALSE; - cr37 |= 0x10; + if( ((buffer[0x36] | (buffer[0x37] << 8)) == 8100) && + ((buffer[0x39] | ((buffer[0x3a] & 0x0f) << 8)) == (1688 - 1280)) && + ((buffer[0x3c] | ((buffer[0x3d] & 0x0f) << 8)) == (802 - 768)) ) { + paneltype = Panel_1280x768; + checkexpand = FALSE; + cr37 |= 0x10; + } } break; case 1400: @@ -10206,9 +9919,11 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) #if 0 /* Treat this as custom, as we have no valid timing data yet */ case 1600: if(pSiS->VGAEngine == SIS_315_VGA) { - if(yres == 1200) { - paneltype = Panel310_1600x1200; - checkexpand = TRUE; + if(pSiS->VBFlags & VB_301C) { + if(yres == 1200) { + paneltype = Panel310_1600x1200; + checkexpand = TRUE; + } } } break; @@ -10222,6 +9937,7 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) /* What now? There is no digital separate output timing... */ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_WARNING, "CRT2: Unable to retrieve Sync polarity information\n"); + cr37 |= 0xc0; /* Default */ } } @@ -10248,6 +9964,7 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) }; paneltype = 0; + SiS_Pr->CP_Supports64048075 = TRUE; /* Find the maximum resolution */ @@ -10303,7 +10020,8 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) SiS_Pr->CP_DataValid[i] = TRUE; /* Sort out invalid timings, interlace and too high clocks */ - if((SiS_Pr->CP_HDisplay[i] > SiS_Pr->CP_HSyncStart[i]) || + if((SiS_Pr->CP_HDisplay[i] & 7) || + (SiS_Pr->CP_HDisplay[i] > SiS_Pr->CP_HSyncStart[i]) || (SiS_Pr->CP_HDisplay[i] >= SiS_Pr->CP_HSyncEnd[i]) || (SiS_Pr->CP_HDisplay[i] >= SiS_Pr->CP_HTotal[i]) || (SiS_Pr->CP_HSyncStart[i] >= SiS_Pr->CP_HSyncEnd[i]) || @@ -10316,7 +10034,7 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) (SiS_Pr->CP_VSyncStart[i] > SiS_Pr->CP_VTotal[i]) || (SiS_Pr->CP_VSyncEnd[i] > SiS_Pr->CP_VTotal[i]) || (((pSiS->VBFlags & VB_301C) && (SiS_Pr->CP_Clock[i] > 162500)) || - ((!(pSiS->VBFlags & VB_301C)) && (SiS_Pr->CP_Clock[i] > 108500))) || + ((!(pSiS->VBFlags & VB_301C)) && (SiS_Pr->CP_Clock[i] > 108200))) || (buffer[base+17] & 0x80)) { SiS_Pr->CP_DataValid[i] = FALSE; @@ -10331,9 +10049,18 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) if(yres > SiS_Pr->CP_MaxY) SiS_Pr->CP_MaxY = yres; if(SiS_Pr->CP_Clock[i] > SiS_Pr->CP_MaxClock) SiS_Pr->CP_MaxClock = SiS_Pr->CP_Clock[i]; + if((SiS_Pr->CP_PreferredX == xres) && (SiS_Pr->CP_PreferredY == yres)) { + SiS_Pr->CP_PreferredIndex = i; + } + SiS_Pr->CP_Vendor = buffer[9] | (buffer[8] << 8); SiS_Pr->CP_Product = buffer[10] | (buffer[11] << 8); + /* By default we drive the LCD at 75Hz in 640x480 mode; if + * the panel does not provide this mode, use 60hz + */ + if(!(buffer[0x23] & 0x04)) SiS_Pr->CP_Supports64048075 = FALSE; + /* We must assume the panel can scale, since we have * no scaling data */ @@ -10406,28 +10133,20 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) SiS_Pr->CP_MaxX = xres = buffer[0x76] | (buffer[0x77] << 8); SiS_Pr->CP_MaxY = yres = buffer[0x78] | (buffer[0x79] << 8); switch(xres) { +#if 0 case 800: if(yres == 600) { paneltype = Panel_800x600; checkexpand = TRUE; } break; +#endif case 1024: if(yres == 768) { paneltype = Panel_1024x768; checkexpand = TRUE; } break; - case 1152: - if(yres == 768) { - if(pSiS->VGAEngine == SIS_300_VGA) { - paneltype = Panel300_1152x768; - } else { - paneltype = Panel310_1152x768; - } - checkexpand = TRUE; - } - break; case 1280: if(yres == 960) { if(pSiS->VGAEngine == SIS_315_VGA) { @@ -10438,11 +10157,8 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) } else if(yres == 1024) { paneltype = Panel_1280x1024; checkexpand = TRUE; - } else if(yres == 768) { - paneltype = Panel_1280x768; - checkexpand = FALSE; - cr37 |= 0x10; } + /* 1280x768 treated as custom here */ break; case 1400: if(pSiS->VGAEngine == SIS_315_VGA) { @@ -10455,9 +10171,11 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) #if 0 /* Treat this one as custom since we have no timing data yet */ case 1600: if(pSiS->VGAEngine == SIS_315_VGA) { - if(yres == 1200) { - paneltype = Panel310_1600x1200; - checkexpand = TRUE; + if(pSiS->VBFlags & VB_301C) { + if(yres == 1200) { + paneltype = Panel310_1600x1200; + checkexpand = TRUE; + } } } break; @@ -10507,6 +10225,9 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) /* Now seek the detailed timing descriptions for custom panels */ if(paneltype == Panel_Custom) { + + SiS_Pr->CP_Supports64048075 = TRUE; + index += (numcodes * 4); numcodes = buffer[0x7f] & 0x07; for(i=0; i<numcodes; i++, index += 18) { @@ -10531,7 +10252,8 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) SiS_Pr->CP_DataValid[i] = TRUE; - if((SiS_Pr->CP_HDisplay[i] > SiS_Pr->CP_HSyncStart[i]) || + if((SiS_Pr->CP_HDisplay[i] & 7) || + (SiS_Pr->CP_HDisplay[i] > SiS_Pr->CP_HSyncStart[i]) || (SiS_Pr->CP_HDisplay[i] >= SiS_Pr->CP_HSyncEnd[i]) || (SiS_Pr->CP_HDisplay[i] >= SiS_Pr->CP_HTotal[i]) || (SiS_Pr->CP_HSyncStart[i] >= SiS_Pr->CP_HSyncEnd[i]) || @@ -10544,7 +10266,7 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) (SiS_Pr->CP_VSyncStart[i] > SiS_Pr->CP_VTotal[i]) || (SiS_Pr->CP_VSyncEnd[i] > SiS_Pr->CP_VTotal[i]) || (((pSiS->VBFlags & VB_301C) && (SiS_Pr->CP_Clock[i] > 162500)) || - ((!(pSiS->VBFlags & VB_301C)) && (SiS_Pr->CP_Clock[i] > 108500))) || + ((!(pSiS->VBFlags & VB_301C)) && (SiS_Pr->CP_Clock[i] > 108200))) || (buffer[index + 17] & 0x80)) { SiS_Pr->CP_DataValid[i] = FALSE; @@ -10555,6 +10277,10 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) if(SiS_Pr->CP_Clock[i] > SiS_Pr->CP_MaxClock) SiS_Pr->CP_MaxClock = SiS_Pr->CP_Clock[i]; + if((SiS_Pr->CP_MaxX == xres) && (SiS_Pr->CP_MaxY == yres)) { + SiS_Pr->CP_PreferredIndex = i; + } + SiS_Pr->CP_HSync_P[i] = (buffer[index + 17] & 0x02) ? TRUE : FALSE; SiS_Pr->CP_VSync_P[i] = (buffer[index + 17] & 0x04) ? TRUE : FALSE; SiS_Pr->CP_SyncValid[i] = TRUE; @@ -10609,11 +10335,12 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) if(paneltype) { if(!SiS_Pr->CP_PreferredX) SiS_Pr->CP_PreferredX = SiS_Pr->CP_MaxX; if(!SiS_Pr->CP_PreferredY) SiS_Pr->CP_PreferredY = SiS_Pr->CP_MaxY; - cr37 &= 0xf1; - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x36,0xf0,paneltype); - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,0xf1,cr37); SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x32,0x08); -#ifdef TWDEBUG + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x36,0xf0,paneltype); + cr37 &= 0xf1; + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,0xf3,cr37); + SiS_Pr->PanelSelfDetected = TRUE; +#ifdef TWDEBUG xf86DrvMsgVerb(pSiS->pScrn->scrnIndex, X_PROBED, 3, "CRT2: [DDC LCD results: 0x%02x, 0x%02x]\n", paneltype, cr37); #endif @@ -10706,7 +10433,7 @@ SiS_SenseVGA2DDC(SiS_Private *SiS_Pr, SISPtr pSiS) } if(foundcrt) { - SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x32,0x10); + SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x32,0x10); } return(0); } @@ -10748,11 +10475,15 @@ USHORT SiS_SetStart(SiS_Private *SiS_Pr) { if(SiS_SetSCLKLow(SiS_Pr)) return 0xFFFF; /* (SC->low) */ - SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index, - ~SiS_Pr->SiS_DDC_Data,SiS_Pr->SiS_DDC_Data); /* SD->high */ + SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port, + SiS_Pr->SiS_DDC_Index, + SiS_Pr->SiS_DDC_NData, + SiS_Pr->SiS_DDC_Data); /* SD->high */ if(SiS_SetSCLKHigh(SiS_Pr)) return 0xFFFF; /* SC->high */ - SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index, - ~SiS_Pr->SiS_DDC_Data,0x00); /* SD->low = start condition */ + SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port, + SiS_Pr->SiS_DDC_Index, + SiS_Pr->SiS_DDC_NData, + 0x00); /* SD->low = start condition */ if(SiS_SetSCLKHigh(SiS_Pr)) return 0xFFFF; /* (SC->low) */ return 0; } @@ -10763,11 +10494,15 @@ USHORT SiS_SetStop(SiS_Private *SiS_Pr) { if(SiS_SetSCLKLow(SiS_Pr)) return 0xFFFF; /* (SC->low) */ - SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index, - ~SiS_Pr->SiS_DDC_Data,0x00); /* SD->low */ + SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port, + SiS_Pr->SiS_DDC_Index, + SiS_Pr->SiS_DDC_NData, + 0x00); /* SD->low */ if(SiS_SetSCLKHigh(SiS_Pr)) return 0xFFFF; /* SC->high */ - SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index, - ~SiS_Pr->SiS_DDC_Data,SiS_Pr->SiS_DDC_Data); /* SD->high = stop condition */ + SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port, + SiS_Pr->SiS_DDC_Index, + SiS_Pr->SiS_DDC_NData, + SiS_Pr->SiS_DDC_Data); /* SD->high = stop condition */ if(SiS_SetSCLKHigh(SiS_Pr)) return 0xFFFF; /* (SC->high) */ return 0; } @@ -10782,11 +10517,15 @@ SiS_WriteDDC2Data(SiS_Private *SiS_Pr, USHORT tempax) for(i=0; i<8; i++) { SiS_SetSCLKLow(SiS_Pr); /* SC->low */ if(tempax & flag) { - SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index, - ~SiS_Pr->SiS_DDC_Data,SiS_Pr->SiS_DDC_Data); /* Write bit (1) to SD */ + SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port, + SiS_Pr->SiS_DDC_Index, + SiS_Pr->SiS_DDC_NData, + SiS_Pr->SiS_DDC_Data); /* Write bit (1) to SD */ } else { - SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index, - ~SiS_Pr->SiS_DDC_Data,0x00); /* Write bit (0) to SD */ + SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port, + SiS_Pr->SiS_DDC_Index, + SiS_Pr->SiS_DDC_NData, + 0x00); /* Write bit (0) to SD */ } SiS_SetSCLKHigh(SiS_Pr); /* SC->high */ flag >>= 1; @@ -10804,8 +10543,10 @@ SiS_ReadDDC2Data(SiS_Private *SiS_Pr, USHORT tempax) for(i=0; i<8; i++) { getdata <<= 1; SiS_SetSCLKLow(SiS_Pr); - SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index, - ~SiS_Pr->SiS_DDC_Data,SiS_Pr->SiS_DDC_Data); + SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port, + SiS_Pr->SiS_DDC_Index, + SiS_Pr->SiS_DDC_NData, + SiS_Pr->SiS_DDC_Data); SiS_SetSCLKHigh(SiS_Pr); temp = SiS_GetReg(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index); if(temp & SiS_Pr->SiS_DDC_Data) getdata |= 0x01; @@ -10816,8 +10557,10 @@ SiS_ReadDDC2Data(SiS_Private *SiS_Pr, USHORT tempax) USHORT SiS_SetSCLKLow(SiS_Private *SiS_Pr) { - SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index, - ~SiS_Pr->SiS_DDC_Clk,0x00); /* SetSCLKLow() */ + SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port, + SiS_Pr->SiS_DDC_Index, + SiS_Pr->SiS_DDC_NClk, + 0x00); /* SetSCLKLow() */ SiS_DDC2Delay(SiS_Pr,SiS_I2CDELAYSHORT); return 0; } @@ -10827,8 +10570,10 @@ SiS_SetSCLKHigh(SiS_Private *SiS_Pr) { USHORT temp, watchdog=1000; - SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index, - ~SiS_Pr->SiS_DDC_Clk,SiS_Pr->SiS_DDC_Clk); /* SetSCLKHigh() */ + SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port, + SiS_Pr->SiS_DDC_Index, + SiS_Pr->SiS_DDC_NClk, + SiS_Pr->SiS_DDC_Clk); /* SetSCLKHigh() */ do { temp = SiS_GetReg(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index); } while((!(temp & SiS_Pr->SiS_DDC_Clk)) && --watchdog); @@ -10850,10 +10595,12 @@ SiS_CheckACK(SiS_Private *SiS_Pr) USHORT tempah; SiS_SetSCLKLow(SiS_Pr); /* (SC->low) */ - SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index, - ~SiS_Pr->SiS_DDC_Data,SiS_Pr->SiS_DDC_Data); /* (SD->high) */ + SiS_SetRegANDOR(SiS_Pr->SiS_DDC_Port, + SiS_Pr->SiS_DDC_Index, + SiS_Pr->SiS_DDC_NData, + SiS_Pr->SiS_DDC_Data); /* (SD->high) */ SiS_SetSCLKHigh(SiS_Pr); /* SC->high = clock impulse for ack */ - tempah = SiS_GetReg(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index);/* Read SD */ + tempah = SiS_GetReg(SiS_Pr->SiS_DDC_Port,SiS_Pr->SiS_DDC_Index); /* Read SD */ SiS_SetSCLKLow(SiS_Pr); /* SC->low = end of clock impulse */ if(tempah & SiS_Pr->SiS_DDC_Data) return(1); /* Ack OK if bit = 0 */ else return(0); @@ -10873,13 +10620,13 @@ GetRAMDACromptr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) USHORT romptr; if(HwInfo->jChipType < SIS_330) { - romptr = ROMAddr[0x128] | (ROMAddr[0x129] << 8); + romptr = SISGETROMW(0x128); if(SiS_Pr->SiS_VBType & VB_SIS301B302B) - romptr = ROMAddr[0x12a] | (ROMAddr[0x12b] << 8); + romptr = SISGETROMW(0x12a); } else { - romptr = ROMAddr[0x1a8] | (ROMAddr[0x1a9] << 8); + romptr = SISGETROMW(0x1a8); if(SiS_Pr->SiS_VBType & VB_SIS301B302B) - romptr = ROMAddr[0x1aa] | (ROMAddr[0x1ab] << 8); + romptr = SISGETROMW(0x1aa); } return(romptr); } @@ -10891,13 +10638,13 @@ GetLCDromptr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) USHORT romptr; if(HwInfo->jChipType < SIS_330) { - romptr = ROMAddr[0x120] | (ROMAddr[0x121] << 8); + romptr = SISGETROMW(0x120); if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) - romptr = ROMAddr[0x122] | (ROMAddr[0x123] << 8); + romptr = SISGETROMW(0x122); } else { - romptr = ROMAddr[0x1a0] | (ROMAddr[0x1a1] << 8); + romptr = SISGETROMW(0x1a0); if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) - romptr = ROMAddr[0x1a2] | (ROMAddr[0x1a3] << 8); + romptr = SISGETROMW(0x1a2); } return(romptr); } @@ -10909,13 +10656,13 @@ GetTVromptr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) USHORT romptr; if(HwInfo->jChipType < SIS_330) { - romptr = ROMAddr[0x114] | (ROMAddr[0x115] << 8); + romptr = SISGETROMW(0x114); if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) - romptr = ROMAddr[0x11a] | (ROMAddr[0x11b] << 8); + romptr = SISGETROMW(0x11a); } else { - romptr = ROMAddr[0x194] | (ROMAddr[0x195] << 8); + romptr = SISGETROMW(0x194); if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) - romptr = ROMAddr[0x19a] | (ROMAddr[0x19b] << 8); + romptr = SISGETROMW(0x19a); } return(romptr); } @@ -10937,9 +10684,9 @@ GetLCDPtrIndexBIOS(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) } } - index = SiS_Pr->SiS_LCDResInfo & 0x0F; - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) index -= 5; - else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1600x1200) index -= 6; + index = SiS_GetBIOSLCDResInfo(SiS_Pr) & 0x0F; + if(SiS_Pr->SiS_LCDResInfo == Panel_1400x1050) index -= 5; + else if(SiS_Pr->SiS_LCDResInfo == Panel_1600x1200) index -= 6; index--; index *= 3; if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) index += 2; @@ -10952,12 +10699,9 @@ GetLCDPtrIndex(SiS_Private *SiS_Pr) { USHORT index; - index = SiS_Pr->SiS_LCDResInfo & 0x0F; - index--; - index *= 3; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) index += 2; + index = ((SiS_GetBIOSLCDResInfo(SiS_Pr) & 0x0F) - 1) * 3; + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) index += 2; else if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) index++; - return index; } @@ -10967,8 +10711,10 @@ GetTVPtrIndex(SiS_Private *SiS_Pr) USHORT index; index = 0; - if(SiS_Pr->SiS_TVMode & TVSetPAL) index++; - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) index++; /* Hivision TV use PAL */ + if(SiS_Pr->SiS_TVMode & TVSetPAL) index = 1; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) index = 2; + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) index = 0; index <<= 1; @@ -10981,7 +10727,7 @@ GetTVPtrIndex(SiS_Private *SiS_Pr) } static ULONG -GetOEMTVPtr661_2(SiS_Private *SiS_Pr) +GetOEMTVPtr661_2_GEN(SiS_Private *SiS_Pr, int addme) { USHORT index = 0, temp = 0; @@ -10998,7 +10744,7 @@ GetOEMTVPtr661_2(SiS_Private *SiS_Pr) if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { if((!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) || (SiS_Pr->SiS_TVMode & TVSetTVSimuMode)) { - index += 8; + index += addme; temp++; } temp += 0x0100; @@ -11006,18 +10752,37 @@ GetOEMTVPtr661_2(SiS_Private *SiS_Pr) return(ULONG)(index | (temp << 16)); } +static ULONG +GetOEMTVPtr661_2_OLD(SiS_Private *SiS_Pr) +{ + return(GetOEMTVPtr661_2_GEN(SiS_Pr, 8)); +} + +#if 0 +static ULONG +GetOEMTVPtr661_2_NEW(SiS_Private *SiS_Pr) +{ + return(GetOEMTVPtr661_2_GEN(SiS_Pr, 6)); +} +#endif + static int GetOEMTVPtr661(SiS_Private *SiS_Pr) { int index = 0; - if(SiS_Pr->SiS_TVMode & TVSetPAL) index = 2; -#if 0 - if(SiS_Pr->SiS_TVMode & 0x100?) index = 4; - if(SiS_Pr->SiS_TVMode & 0x20?) index = 6; - if(SiS_Pr->SiS_TVMode & 0x40?) index = 8; - if(SiS_Pr->SiS_TVMode & 0x80?) index = 10; -#endif + if(SiS_Pr->SiS_TVMode & TVSetPAL) index = 2; + if(SiS_Pr->SiS_ROMNew) { + if(SiS_Pr->SiS_TVMode & TVSetYPbPr525i) index = 4; + if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) index = 6; + if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) index = 8; + if(SiS_Pr->SiS_TVMode & TVSetHiVision) index = 10; + } else { + if(SiS_Pr->SiS_TVMode & TVSetHiVision) index = 4; + if(SiS_Pr->SiS_TVMode & TVSetYPbPr525i) index = 6; + if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) index = 8; + if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) index = 10; + } if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) index++; @@ -11031,15 +10796,21 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) USHORT delay=0,index,myindex,temp,romptr=0; BOOLEAN dochiptest = TRUE; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x20,0xbf); + } else { + SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x35,0x7f); + } + /* Find delay (from ROM, internal tables, PCI subsystem) */ if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) { /* ------------ VGA */ - if((ROMAddr) && SiS_Pr->SiS_UseROM) { + if((SiS_Pr->SiS_UseROM) && (!(SiS_Pr->SiS_ROMNew))) { romptr = GetRAMDACromptr(SiS_Pr, HwInfo); - if(!romptr) return; - delay = ROMAddr[romptr]; - } else { + } + if(romptr) delay = ROMAddr[romptr]; + else { delay = 0x04; if(SiS_Pr->SiS_VBType & VB_SIS301B302B) { if(IS_SIS650) { @@ -11051,8 +10822,7 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) } else { delay = 0x0c; } - } - if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { + } else if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { delay = 0x00; } } @@ -11061,13 +10831,39 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) BOOLEAN gotitfrompci = FALSE; - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_PanelCustom) return; + /* Could we detect a PDC for LCD or did we get a user-defined? If yes, use it */ - /* Could we detect a PDC for LCD? If yes, use it */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + if(SiS_Pr->PDC != -1) { + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2d,0xf0,((SiS_Pr->PDC >> 1) & 0x0f)); + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x35,0x7f,((SiS_Pr->PDC & 0x01) << 7)); + return; + } + } else { + if(SiS_Pr->PDCA != -1) { + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2d,0x0f,((SiS_Pr->PDCA << 3) & 0xf0)); + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x20,0xbf,((SiS_Pr->PDCA & 0x01) << 6)); + return; + } + } + + /* Custom Panel? */ - if(HwInfo->pdc) { + if(SiS_Pr->SiS_LCDResInfo == Panel_Custom) { if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { - SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2d,0x0f,((HwInfo->pdc & 0x0f) << 4)); + delay = 0x00; + if((SiS_Pr->PanelXRes <= 1280) && (SiS_Pr->PanelYRes <= 1024)) { + delay = 0x20; + } + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2d,0x0f,delay); + } else { + delay = 0x0c; + if(SiS_Pr->SiS_VBType & VB_SIS301C) delay = 0x03; + else if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { + if(IS_SIS740) delay = 0x01; + else delay = 0x03; + } + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2d,0xf0,delay); } return; } @@ -11080,7 +10876,7 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) switch(SiS_Pr->SiS_CustomT) { case CUT_COMPAQ1280: case CUT_COMPAQ12802: - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { + if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) { gotitfrompci = TRUE; dochiptest = FALSE; delay = 0x03; @@ -11088,15 +10884,13 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) break; case CUT_CLEVO1400: case CUT_CLEVO14002: - /* if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { */ - gotitfrompci = TRUE; - dochiptest = FALSE; - delay = 0x02; - /* } */ + gotitfrompci = TRUE; + dochiptest = FALSE; + delay = 0x02; break; case CUT_CLEVO1024: case CUT_CLEVO10242: - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { gotitfrompci = TRUE; dochiptest = FALSE; delay = 0x33; @@ -11117,21 +10911,16 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) if(SiS_IsNotM650orLater(SiS_Pr, HwInfo)) { - if((ROMAddr) && SiS_Pr->SiS_UseROM) { -#if 0 /* Always use the second pointer on 650; some BIOSes */ + if((SiS_Pr->SiS_UseROM) && (!(SiS_Pr->SiS_ROMNew))) { + /* Always use the second pointer on 650; some BIOSes */ /* still carry old 301 data at the first location */ - romptr = ROMAddr[0x120] | (ROMAddr[0x121] << 8); - if(SiS_Pr->SiS_VBType & VB_SIS302LV) -#endif - romptr = ROMAddr[0x122] | (ROMAddr[0x123] << 8); + /* romptr = SISGETROMW(0x120); */ + /* if(SiS_Pr->SiS_VBType & VB_SIS302LV) */ + romptr = SISGETROMW(0x122); if(!romptr) return; delay = ROMAddr[(romptr + index)]; } else { - delay = SiS310_LCDDelayCompensation_650301B[myindex]; -#if 0 - if(SiS_Pr->SiS_VBType & VB_SIS302LV) - delay = SiS310_LCDDelayCompensation_650301B[myindex]; -#endif + delay = SiS310_LCDDelayCompensation_650301LV[myindex]; } } else { @@ -11142,34 +10931,34 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) } - } else if((ROMAddr) && SiS_Pr->SiS_UseROM && - (SiS_Pr->SiS_LCDResInfo != SiS_Pr->SiS_Panel1280x1024)) { + } else if(SiS_Pr->SiS_UseROM && + (!(SiS_Pr->SiS_ROMNew)) && + (SiS_Pr->SiS_LCDResInfo != Panel_1280x1024) && + (SiS_Pr->SiS_LCDResInfo != Panel_1280x768) && + (SiS_Pr->SiS_LCDResInfo != Panel_1280x960)) { + /* Data for 1280x1024 wrong in 301B BIOS */ romptr = GetLCDromptr(SiS_Pr, HwInfo); if(!romptr) return; delay = ROMAddr[(romptr + index)]; } else if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { - if(IS_SIS650) { - delay = SiS310_LCDDelayCompensation_LVDS650[myindex]; - } else { - delay = SiS310_LCDDelayCompensation_LVDS740[myindex]; - } + if(IS_SIS740) delay = 0x03; + else delay = 0x00; } else { delay = SiS310_LCDDelayCompensation_301[myindex]; - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { -#if 0 /* This data is (like the one in the BIOS) wrong. */ - if(IS_SIS550650740660) { - delay = SiS310_LCDDelayCompensation_650301B[myindex]; - } else { -#endif - delay = SiS310_LCDDelayCompensation_3xx301B[myindex]; -#if 0 - } -#endif + if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { + if(IS_SIS740) delay = 0x01; + else delay = SiS310_LCDDelayCompensation_650301LV[myindex]; + } else if(SiS_Pr->SiS_VBType & VB_SIS301C) { + if(IS_SIS740) delay = 0x01; /* ? */ + else delay = 0x03; + } else if(SiS_Pr->SiS_VBType & VB_SIS301B302B) { + if(IS_SIS740) delay = 0x01; + else delay = SiS310_LCDDelayCompensation_3xx301B[myindex]; } } @@ -11189,23 +10978,19 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) if(SiS_IsNotM650orLater(SiS_Pr,HwInfo)) { - if((ROMAddr) && SiS_Pr->SiS_UseROM) { -#if 0 /* Always use the second pointer on 650; some BIOSes */ + if((SiS_Pr->SiS_UseROM) && (!(SiS_Pr->SiS_ROMNew))) { + /* Always use the second pointer on 650; some BIOSes */ /* still carry old 301 data at the first location */ - romptr = ROMAddr[0x114] | (ROMAddr[0x115] << 8); - if(SiS_Pr->SiS_VBType & VB_SIS302LV) -#endif - romptr = ROMAddr[0x11a] | (ROMAddr[0x11b] << 8); + /* romptr = SISGETROMW(0x114); */ + /* if(SiS_Pr->SiS_VBType & VB_SIS302LV) */ + romptr = SISGETROMW(0x11a); if(!romptr) return; delay = ROMAddr[romptr + index]; } else { delay = SiS310_TVDelayCompensation_301B[index]; -#if 0 - if(SiS_Pr->SiS_VBType & VB_SIS302LV) - delay = SiS310_TVDelayCompensation_301B[index]; -#endif + } } else { @@ -11231,7 +11016,7 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) } } - } else if((ROMAddr) && SiS_Pr->SiS_UseROM) { + } else if((SiS_Pr->SiS_UseROM) && (!(SiS_Pr->SiS_ROMNew))) { romptr = GetTVromptr(SiS_Pr, HwInfo); if(!romptr) return; @@ -11247,14 +11032,16 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { if(IS_SIS740) { delay = SiS310_TVDelayCompensation_740301B[index]; + /* LV: use 301 data? BIOS bug? */ } else { delay = SiS310_TVDelayCompensation_301B[index]; + if(SiS_Pr->SiS_VBType & VB_SIS301C) delay = 0x02; } } } - if(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x13) & 0x04) { /* LCDA */ + if(SiS_LCDAEnabled(SiS_Pr, HwInfo)) { delay &= 0x0f; dochiptest = FALSE; } @@ -11268,7 +11055,7 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) if(IS_SIS650 && (SiS_Pr->SiS_VBType & VB_SIS301LV302LV) && dochiptest) { temp = (SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) & 0xf0) >> 4; - if(temp == 8) { /* 1400x1050 BIOS (ECS) */ + if(temp == 8) { /* 1400x1050 BIOS (COMPAL) */ delay &= 0x0f; delay |= 0xb0; } else if(temp == 6) { @@ -11309,24 +11096,29 @@ SetAntiFlicker(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; USHORT index,temp,temp1,romptr=0; + if(SiS_Pr->SiS_TVMode & (TVSetYPbPr750p|TVSetYPbPr525p)) return; + if(ModeNo<=0x13) index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].VB_StTVFlickerIndex; else index = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].VB_ExtTVFlickerIndex; temp = GetTVPtrIndex(SiS_Pr); - temp >>= 1; /* 0: NTSC, 1: PAL, 2: HiTV */ + temp >>= 1; /* 0: NTSC/YPbPr, 1: PAL, 2: HiTV */ temp1 = temp; - if(ROMAddr && SiS_Pr->SiS_UseROM) { + if(SiS_Pr->SiS_UseROM && (!(SiS_Pr->SiS_ROMNew))) { if(HwInfo->jChipType >= SIS_661) { - romptr = ROMAddr[0x260] | (ROMAddr[0x261] << 8); - temp1 = GetOEMTVPtr661(SiS_Pr); + temp1 = GetOEMTVPtr661(SiS_Pr); temp1 >>= 1; + romptr = SISGETROMW(0x260); + if(HwInfo->jChipType >= SIS_760) { + romptr = SISGETROMW(0x360); + } } else if(HwInfo->jChipType >= SIS_330) { - romptr = ROMAddr[0x192] | (ROMAddr[0x193] << 8); + romptr = SISGETROMW(0x192); } else { - romptr = ROMAddr[0x112] | (ROMAddr[0x113] << 8); + romptr = SISGETROMW(0x112); } } @@ -11348,24 +11140,25 @@ SetEdgeEnhance(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; USHORT index,temp,temp1,romptr=0; - temp = GetTVPtrIndex(SiS_Pr); - temp >>= 1; /* 0: NTSC, 1: PAL, 2: HiTV */ - temp1 = temp; + temp = temp1 = GetTVPtrIndex(SiS_Pr) >> 1; /* 0: NTSC/YPbPr, 1: PAL, 2: HiTV */ - if(ModeNo<=0x13) + if(ModeNo <= 0x13) index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].VB_StTVEdgeIndex; else index = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].VB_ExtTVEdgeIndex; - if(ROMAddr && SiS_Pr->SiS_UseROM) { + if(SiS_Pr->SiS_UseROM && (!(SiS_Pr->SiS_ROMNew))) { if(HwInfo->jChipType >= SIS_661) { - romptr = ROMAddr[0x26c] | (ROMAddr[0x26d] << 8); + romptr = SISGETROMW(0x26c); + if(HwInfo->jChipType >= SIS_760) { + romptr = SISGETROMW(0x36c); + } temp1 = GetOEMTVPtr661(SiS_Pr); temp1 >>= 1; } else if(HwInfo->jChipType >= SIS_330) { - romptr = ROMAddr[0x1a4] | (ROMAddr[0x1a5] << 8); + romptr = SISGETROMW(0x1a4); } else { - romptr = ROMAddr[0x124] | (ROMAddr[0x125] << 8); + romptr = SISGETROMW(0x124); } } @@ -11383,67 +11176,20 @@ static void SetYFilter(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo,USHORT ModeIdIndex) { - UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; - USHORT index, myindex, oldindex,temp, i, j, flag1 = 0, flag2 = 0, romptr = 0; - ULONG lindex; + USHORT index, temp, i, j; - if(ModeNo<=0x13) { - index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].VB_StTVYFilterIndex; + if(ModeNo <= 0x13) { + index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].VB_StTVYFilterIndex; } else { - index = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].VB_ExtTVYFilterIndex; + index = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].VB_ExtTVYFilterIndex; } - oldindex = index; + temp = GetTVPtrIndex(SiS_Pr) >> 1; /* 0: NTSC/YPbPr, 1: PAL, 2: HiTV */ - if((HwInfo->jChipType >= SIS_661) && ROMAddr && SiS_Pr->SiS_UseROM) { - if(ModeNo > 0x13) { - index = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].VB_ExtTVYFilterIndexROM661; - } - lindex = GetOEMTVPtr661_2(SiS_Pr); - if(lindex & 0x00ff0000) flag1 = 1; - if(lindex & 0xff000000) flag2 = 1; - lindex &= 0xffff; - - /* NTSC-J: Use PAL filters */ - if(SiS_Pr->SiS_TVMode & TVSetNTSCJ) lindex = 1; - - romptr = ROMAddr[0x268] | (ROMAddr[0x269] << 8); - if(flag1) myindex = index * 7; - else myindex = index << 2; - - if(romptr) { - romptr += (lindex << 1); - romptr = (ROMAddr[romptr] | (ROMAddr[romptr+1] << 8)) + myindex; - if(romptr) { - if((!flag1) && (flag2)) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x35,0x00); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x36,0x00); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x37,0x00); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x38,ROMAddr[romptr++]); - } else { - for(i=0x35; i<=0x38; i++) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,i,ROMAddr[romptr++]); - } - } - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - for(j=0, i=0x48; i<=0x4a; i++, j++) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,i,ROMAddr[romptr++]); - } - } - return; - } - } - } - - index = oldindex; - - temp = GetTVPtrIndex(SiS_Pr); - temp >>= 1; /* 0: NTSC, 1: PAL, 2: HiTV */ - - if(SiS_Pr->SiS_TVMode & TVSetNTSCJ) temp = 1; /* NTSC-J uses PAL */ - else if(SiS_Pr->SiS_TVMode & TVSetPALM) temp = 3; /* PAL-M */ - else if(SiS_Pr->SiS_TVMode & TVSetPALN) temp = 4; /* PAL-N */ - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) temp = 1; /* Hivision TV uses PAL */ + if(SiS_Pr->SiS_TVMode & TVSetNTSCJ) temp = 1; /* NTSC-J uses PAL */ + else if(SiS_Pr->SiS_TVMode & TVSetPALM) temp = 3; /* PAL-M */ + else if(SiS_Pr->SiS_TVMode & TVSetPALN) temp = 4; /* PAL-N */ + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) temp = 1; /* HiVision uses PAL */ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { for(i=0x35, j=0; i<=0x38; i++, j++) { @@ -11472,21 +11218,11 @@ SetPhaseIncr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, /* NTSC-J data not in BIOS, and already set in SetGroup2 */ if(SiS_Pr->SiS_TVMode & TVSetNTSCJ) return; - if(HwInfo->jChipType >= SIS_661) { - lindex = GetOEMTVPtr661_2(SiS_Pr) & 0xffff; + if((HwInfo->jChipType >= SIS_661) || SiS_Pr->SiS_ROMNew) { + lindex = GetOEMTVPtr661_2_OLD(SiS_Pr) & 0xffff; lindex <<= 2; - if((ROMAddr) && SiS_Pr->SiS_UseROM) { - romptr = ROMAddr[0x264] | (ROMAddr[0x265] << 8); - } - if(romptr) { - romptr += lindex; - for(j=0, i=0x31; i<=0x34; i++, j++) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,i,ROMAddr[romptr + j]); - } - } else { - for(j=0, i=0x31; i<=0x34; i++, j++) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,i,SiS661_TVPhase[lindex + j]); - } + for(j=0, i=0x31; i<=0x34; i++, j++) { + SiS_SetReg(SiS_Pr->SiS_Part2Port,i,SiS661_TVPhase[lindex + j]); } return; } @@ -11504,20 +11240,20 @@ SetPhaseIncr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, /* 0: NTSC Graphics, 1: NTSC Text, 2: PAL Graphics, * 3: PAL Text, 4: HiTV Graphics 5: HiTV Text */ - if((ROMAddr) && SiS_Pr->SiS_UseROM) { - romptr = ROMAddr[0x116] | (ROMAddr[0x117] << 8); + if(SiS_Pr->SiS_UseROM) { + romptr = SISGETROMW(0x116); if(HwInfo->jChipType >= SIS_330) { - romptr = ROMAddr[0x196] | (ROMAddr[0x197] << 8); + romptr = SISGETROMW(0x196); } if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - romptr = ROMAddr[0x11c] | (ROMAddr[0x11d] << 8); + romptr = SISGETROMW(0x11c); if(HwInfo->jChipType >= SIS_330) { - romptr = ROMAddr[0x19c] | (ROMAddr[0x19d] << 8); + romptr = SISGETROMW(0x19c); } if((SiS_Pr->SiS_VBInfo & SetInSlaveMode) && (!(SiS_Pr->SiS_TVMode & TVSetTVSimuMode))) { - romptr = ROMAddr[0x116] | (ROMAddr[0x117] << 8); + romptr = SISGETROMW(0x116); if(HwInfo->jChipType >= SIS_330) { - romptr = ROMAddr[0x196] | (ROMAddr[0x197] << 8); + romptr = SISGETROMW(0x196); } } } @@ -11540,19 +11276,19 @@ SetPhaseIncr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, } } - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - if((!(SiS_Pr->SiS_TVMode & TVSetPAL)) && (ModeNo > 0x13)) { + if((SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (!(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision))) { + if((!(SiS_Pr->SiS_TVMode & (TVSetPAL | TVSetYPbPr525p | TVSetYPbPr750p))) && (ModeNo > 0x13)) { if((resinfo == SIS_RI_640x480) || (resinfo == SIS_RI_800x600)) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x31,0x21); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x32,0xf0); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x33,0xf5); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x34,0x7f); - } else if (resinfo == SIS_RI_1024x768) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x31,0x1e); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x32,0x8b); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x33,0xfb); - SiS_SetReg(SiS_Pr->SiS_Part2Port,0x34,0x7b); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x31,0x21); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x32,0xf0); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x33,0xf5); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x34,0x7f); + } else if(resinfo == SIS_RI_1024x768) { + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x31,0x1e); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x32,0x8b); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x33,0xfb); + SiS_SetReg(SiS_Pr->SiS_Part2Port,0x34,0x7b); } } } @@ -11567,12 +11303,12 @@ SiS_OEM310Setting(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, if(SiS_Pr->UseCustomMode) return; if((SiS_Pr->SiS_VBType & VB_SISVB) && (SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) { - SetAntiFlicker(SiS_Pr,HwInfo,ModeNo,ModeIdIndex); - SetPhaseIncr(SiS_Pr,HwInfo,ModeNo,ModeIdIndex); - SetYFilter(SiS_Pr,HwInfo,ModeNo,ModeIdIndex); - if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) { - SetEdgeEnhance(SiS_Pr,HwInfo,ModeNo,ModeIdIndex); - } + SetAntiFlicker(SiS_Pr,HwInfo,ModeNo,ModeIdIndex); + SetPhaseIncr(SiS_Pr,HwInfo,ModeNo,ModeIdIndex); + SetYFilter(SiS_Pr,HwInfo,ModeNo,ModeIdIndex); + if(SiS_Pr->SiS_VBType & VB_SIS301) { + SetEdgeEnhance(SiS_Pr,HwInfo,ModeNo,ModeIdIndex); + } } } @@ -11580,65 +11316,104 @@ static void SetDelayComp661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo, USHORT ModeIdIndex, USHORT RTI) { - UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; USHORT delay = 0, romptr = 0, index; - UCHAR *myptr = NULL; - UCHAR temp; + UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; if(!(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToLCDA | SetCRT2ToRAMDAC))) return; - delay = SiS_Pr->SiS_RefIndex[RTI].Ext_PDC; + /* 1. New ROM: VGA2 and LCD/LCDA-Pass1:1 */ + + if(SiS_Pr->SiS_ROMNew) { + if((SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) || + ((SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) && + (SiS_Pr->SiS_LCDInfo & LCDPass11))) { + index = 25; + if(SiS_Pr->UseCustomMode) { + index = SiS_Pr->CSRClock; + } else if(ModeNo > 0x13) { + index = SiS_GetVCLK2Ptr(SiS_Pr,ModeNo,ModeIdIndex,RTI,HwInfo); + index = SiS_Pr->SiS_VCLKData[index].CLOCK; + } + if(index < 25) index = 25; + index = ((index / 25) - 1) << 1; + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToLCD)) index++; + romptr = SISGETROMW(0x104); /* 0x4ae */ + delay = ROMAddr[romptr + index]; + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToLCD)) { + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2d,0xf0,((delay >> 1) & 0x0f)); + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x35,0x7f,((delay & 0x01) << 7)); + } else { + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2d,0x0f,((delay << 3) & 0xf0)); + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x20,0xbf,((delay & 0x01) << 6)); + } + return; + } + } + + /* 2. Old ROM: VGA2 and LCD/LCDA-Pass 1:1 */ - delay &= 0xf0; - delay >>= 4; - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) delay <<= 12; /* BIOS: 8, wrong */ + if(SiS_Pr->UseCustomMode) delay = 0x04; + else if(ModeNo <= 0x13) delay = 0x04; + else delay = (SiS_Pr->SiS_RefIndex[RTI].Ext_PDC >> 4); + delay |= (delay << 8); if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { + + /* 3. TV */ + index = GetOEMTVPtr661(SiS_Pr); - if((ROMAddr) && SiS_Pr->SiS_UseROM) { - romptr = ROMAddr[0x25c] | (ROMAddr[0x25d] << 8); - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - romptr = ROMAddr[0x25e] | (ROMAddr[0x25f] << 8); - } - } - if(romptr) myptr = &ROMAddr[romptr]; - if(!myptr) { - myptr = (UCHAR *)SiS_TVDelay661_301; - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - myptr = (UCHAR *)SiS_TVDelay661_301B; - } + if(SiS_Pr->SiS_ROMNew) { + romptr = SISGETROMW(0x106); /* 0x4ba */ + delay = ROMAddr[romptr + index]; + } else { + delay = 0x04; } - delay = myptr[index]; - if(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x13) & 0x04) delay >>= 4; /* Should test dual edge */ + } else if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { - if(HwInfo->pdc) { - delay = HwInfo->pdc & 0x0f; - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { - delay |= (delay << 12); - } - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_PanelCustom) { - delay = 0x4444; /* TEST THIS */ - } else if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) { - myptr = GetLCDStructPtr661(SiS_Pr, HwInfo); - if(myptr) delay = myptr[4]; - else delay = 0x44; - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { - delay |= (delay << 8); + + /* 4. LCD, LCDA (for new ROM only LV and non-Pass 1:1) */ + + if( (SiS_Pr->SiS_LCDResInfo != Panel_Custom) && + ((romptr = GetLCDStructPtr661_2(SiS_Pr, HwInfo))) ) { + + /* For LV, the BIOS must know about the correct value */ + delay = ROMAddr[romptr + 0x0d]; /* LCD */ + delay |= (ROMAddr[romptr + 0x0c] << 8); /* LCDA */ + + } else { + + /* TMDS: Set our own, since BIOS has no idea - TODO: Find out about values */ + if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) { + if((SiS_Pr->PanelXRes <= 1024) && (SiS_Pr->PanelYRes <= 768)) { + delay = 0x0404; + } else if((SiS_Pr->PanelXRes <= 1280) && (SiS_Pr->PanelYRes <= 1024)) { + delay = 0x0404; + } else if((SiS_Pr->PanelXRes <= 1400) && (SiS_Pr->PanelYRes <= 1050)) { + delay = 0x1004; + } else + delay = 0x0000; } + } - } - temp = SiS_GetReg(SiS_Pr->SiS_Part1Port,0x2d); - if(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToRAMDAC)) { - temp &= 0xf0; - temp |= (delay & 0x000f); + /* Override by detected or user-set values */ + if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) && (SiS_Pr->PDC != -1)) { + delay = SiS_Pr->PDC & 0x1f; + } + if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) && (SiS_Pr->PDCA != -1)) { + delay = (SiS_Pr->PDCA & 0x1f) << 8; + } } + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { - temp &= 0x0f; - temp |= ((delay & 0xf000) >> 8); + delay >>= 8; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2d,0x0f,((delay << 3) & 0xf0)); + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x20,0xbf,((delay & 0x01) << 6)); + } else { + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2d,0xf0,((delay >> 1) & 0x0f)); + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x35,0x7f,((delay & 0x01) << 7)); } - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x2d,temp); } static void @@ -11647,38 +11422,50 @@ SetCRT2SyncDither661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo, US USHORT infoflag; UCHAR temp; - infoflag = SiS_Pr->SiS_RefIndex[RTI].Ext_InfoFlag; - if(ModeNo <= 0x13) { - infoflag = SiS_GetRegByte(SiS_Pr->SiS_P3ca+2); - } - infoflag &= 0xc0; if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { + + if(ModeNo <= 0x13) { + infoflag = SiS_GetRegByte(SiS_Pr->SiS_P3ca+2); + } else if(SiS_Pr->UseCustomMode) { + infoflag = SiS_Pr->CInfoFlag; + } else { + infoflag = SiS_Pr->SiS_RefIndex[RTI].Ext_InfoFlag; + } + infoflag &= 0xc0; + temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x37); - if(temp & 0x20) infoflag = temp; + if(SiS_Pr->SiS_LCDInfo & LCDPass11) { + temp &= 0x3f; + temp |= infoflag; + } else { + if(temp & 0x20) infoflag = temp; + } if(temp & 0x01) infoflag |= 0x01; - } - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - temp = 0x0c; - if(infoflag & 0x01) temp ^= 0x14; /* BIOS: 18, wrong */ - temp |= (infoflag >> 6); - SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1a,0xe0,temp); - } - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { - temp = 0; - if(infoflag & 0x01) temp |= 0x80; - SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x1a,0x7f,temp); - temp = 0x30; - if(infoflag & 0x01) temp = 0x20; - infoflag &= 0xc0; - temp |= infoflag; - SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0f,temp); + + if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { + temp = 0x0c; + if(infoflag & 0x01) temp ^= 0x14; /* BIOS: 18, wrong */ + temp |= (infoflag >> 6); + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1a,0xe0,temp); + } else { + temp = 0; + if(infoflag & 0x01) temp |= 0x80; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x1a,0x7f,temp); + temp = 0x30; + if(infoflag & 0x01) temp = 0x20; + infoflag &= 0xc0; + temp |= infoflag; + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0f,temp); + } + } } static void SetPanelParms661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { - UCHAR *myptr; + UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; + USHORT romptr, temp1, temp2; if(SiS_Pr->SiS_VBType & (VB_SIS301LV | VB_SIS302LV | VB_SIS302ELV)) { if(SiS_Pr->LVDSHL != -1) { @@ -11686,16 +11473,22 @@ SetPanelParms661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) } } - myptr = GetLCDStructPtr661(SiS_Pr, HwInfo); - if(myptr) { - if(SiS_Pr->SiS_VBType & (VB_SIS301LV | VB_SIS302LV | VB_SIS302ELV)) { - if(SiS_Pr->LVDSHL == -1) { - SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x24,0xE0,myptr[1] & 0x1f); - } else { - SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x24,0xE3,myptr[1] & 0x1c); - } + if(SiS_Pr->SiS_ROMNew) { + + if((romptr = GetLCDStructPtr661_2(SiS_Pr, HwInfo))) { + if(SiS_Pr->SiS_VBType & (VB_SIS301LV | VB_SIS302LV | VB_SIS302ELV)) { + temp1 = (ROMAddr[romptr] & 0x03) | 0x0c; + temp2 = 0xfc; + if(SiS_Pr->LVDSHL != -1) { + temp1 &= 0xfc; + temp2 = 0xf3; + } + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x24,temp2,temp1); + } + temp1 = (ROMAddr[romptr + 1] & 0x80) >> 1; + SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x0d,0xbf,temp1); } - SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x0d,0x3f,myptr[2] & 0xc0); + } } @@ -11716,7 +11509,7 @@ SiS_OEM661Setting(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, SetPhaseIncr(SiS_Pr,HwInfo,ModeNo,ModeIdIndex); SetYFilter(SiS_Pr,HwInfo,ModeNo,ModeIdIndex); SetAntiFlicker(SiS_Pr,HwInfo,ModeNo,ModeIdIndex); - if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) { + if(SiS_Pr->SiS_VBType & VB_SIS301) { SetEdgeEnhance(SiS_Pr,HwInfo,ModeNo,ModeIdIndex); } } @@ -11745,7 +11538,7 @@ SiS_FinalizeLCD(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } } - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_PanelCustom) return; + if(SiS_Pr->SiS_LCDResInfo == Panel_Custom) return; if(SiS_Pr->UseCustomMode) return; switch(SiS_Pr->SiS_CustomT) { @@ -11775,7 +11568,7 @@ SiS_FinalizeLCD(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } if(SiS_Pr->SiS_CustomT == CUT_CLEVO1024) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { /* Maybe all panels? */ if(SiS_Pr->LVDSHL == -1) { SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x24,0xfc,0x01); @@ -11786,7 +11579,7 @@ SiS_FinalizeLCD(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, if(SiS_Pr->SiS_CustomT == CUT_CLEVO10242) { if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { if(SiS_Pr->LVDSHL == -1) { /* Maybe all panels? */ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x24,0xfc,0x01); @@ -11806,15 +11599,15 @@ SiS_FinalizeLCD(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { #ifdef SET_EMI if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) { SiS_SetReg(SiS_Pr->SiS_Part4Port,0x2a,0x00); - SiS_SetReg(SiS_Pr->SiS_Part4Port,0x30,0x00); + SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c); SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10); } #endif - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1280x1024) { + } else if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) { if(SiS_Pr->LVDSHL == -1) { /* Maybe ACER only? */ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x24,0xfc,0x01); @@ -11822,9 +11615,9 @@ SiS_FinalizeLCD(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } tempch = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) >> 4; if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1400x1050) { + if(SiS_Pr->SiS_LCDResInfo == Panel_1400x1050) { SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1f,0x76); - } else if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { + } else if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { if(tempch == 0x03) { SiS_SetReg(SiS_Pr->SiS_Part1Port,0x18,0x02); SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1b,0x25); @@ -11905,7 +11698,7 @@ SiS_FinalizeLCD(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, tempbh >>= 4; tempbl = SiS_GetReg(SiS_Pr->SiS_Part2Port,0x04); tempbx = (tempbh << 8) | tempbl; - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { if((resinfo == SIS_RI_1024x768) || (!(SiS_Pr->SiS_LCDInfo & DontExpandLCD))) { if(SiS_Pr->SiS_SetFlag & LCDVESATiming) { tempbx = 770; @@ -11996,19 +11789,16 @@ GetOEMLCDPtr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, int Flag) tempbx = (SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) & 0x0f) - 2; if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) tempbx += 4; - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel1024x768) { + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx += 3; } - if((ROMAddr) && SiS_Pr->SiS_UseROM) { + if(SiS_Pr->SiS_UseROM) { if(ROMAddr[0x235] & 0x80) { tempbx = SiS_Pr->SiS_LCDTypeInfo; if(Flag) { - romptr = ROMAddr[0x255] | (ROMAddr[0x256] << 8); - if(romptr) { - tempbx = ROMAddr[romptr + SiS_Pr->SiS_LCDTypeInfo]; - } else { - tempbx = customtable300[SiS_Pr->SiS_LCDTypeInfo]; - } + romptr = SISGETROMW(0x255); + if(romptr) tempbx = ROMAddr[romptr + SiS_Pr->SiS_LCDTypeInfo]; + else tempbx = customtable300[SiS_Pr->SiS_LCDTypeInfo]; if(tempbx == 0xFF) return 0xFFFF; } tempbx <<= 1; @@ -12019,13 +11809,10 @@ GetOEMLCDPtr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, int Flag) } else { if(Flag) { - if((ROMAddr) && SiS_Pr->SiS_UseROM) { - romptr = ROMAddr[0x255] | (ROMAddr[0x256] << 8); - if(romptr) { - tempbx = ROMAddr[romptr + SiS_Pr->SiS_LCDTypeInfo]; - } else { - tempbx = 0xff; - } + if(SiS_Pr->SiS_UseROM) { + romptr = SISGETROMW(0x255); + if(romptr) tempbx = ROMAddr[romptr + SiS_Pr->SiS_LCDTypeInfo]; + else tempbx = 0xff; } else { tempbx = customtable630[SiS_Pr->SiS_LCDTypeInfo]; } @@ -12049,12 +11836,12 @@ SetOEMLCDDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; USHORT index,temp,romptr=0; - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_PanelCustom) return; + if(SiS_Pr->SiS_LCDResInfo == Panel_Custom) return; - if((ROMAddr) && SiS_Pr->SiS_UseROM) { + if(SiS_Pr->SiS_UseROM) { if(!(ROMAddr[0x237] & 0x01)) return; if(!(ROMAddr[0x237] & 0x02)) return; - romptr = ROMAddr[0x24b] | (ROMAddr[0x24c] << 8); + romptr = SISGETROMW(0x24b); } /* The Panel Compensation Delay should be set according to tables @@ -12064,7 +11851,7 @@ SetOEMLCDDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, * Thus we don't set this if the user select a custom pdc or if * we otherwise detected a valid pdc. */ - if(HwInfo->pdc) return; + if(SiS_Pr->PDC != -1) return; temp = GetOEMLCDPtr(SiS_Pr,HwInfo, 0); @@ -12076,7 +11863,7 @@ SetOEMLCDDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, if(HwInfo->jChipType != SIS_300) { if(romptr) { romptr += (temp * 2); - romptr = ROMAddr[romptr] | (ROMAddr[romptr + 1] << 8); + romptr = SISGETROMW(romptr); romptr += index; temp = ROMAddr[romptr]; } else { @@ -12087,21 +11874,21 @@ SetOEMLCDDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, } } } else { - if((ROMAddr) && SiS_Pr->SiS_UseROM && (ROMAddr[0x235] & 0x80)) { + if(SiS_Pr->SiS_UseROM && (ROMAddr[0x235] & 0x80)) { if(romptr) { romptr += (temp * 2); - romptr = ROMAddr[romptr] | (ROMAddr[romptr + 1] << 8); + romptr = SISGETROMW(romptr); romptr += index; temp = ROMAddr[romptr]; } else { temp = SiS300_OEMLCDDelay5[temp][index]; } } else { - if((ROMAddr) && SiS_Pr->SiS_UseROM) { + if(SiS_Pr->SiS_UseROM) { romptr = ROMAddr[0x249] | (ROMAddr[0x24a] << 8); if(romptr) { romptr += (temp * 2); - romptr = ROMAddr[romptr] | (ROMAddr[romptr + 1] << 8); + romptr = SISGETROMW(romptr); romptr += index; temp = ROMAddr[romptr]; } else { @@ -12124,7 +11911,7 @@ SetOEMLCDData(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; USHORT index,temp; - if((ROMAddr) && SiS_Pr->SiS_UseROM) { + if((SiS_Pr->SiS_UseROM) { if(!(ROMAddr[0x237] & 0x01)) return; if(!(ROMAddr[0x237] & 0x04)) return; /* No rom pointer in BIOS header! */ @@ -12158,7 +11945,7 @@ GetOEMTVPtr(SiS_Private *SiS_Pr) if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) index += 4; if(SiS_Pr->SiS_VBType & VB_SISVB) { if(SiS_Pr->SiS_VBInfo & SetCRT2ToSCART) index += 2; - else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) index += 3; + else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) index += 3; else if(SiS_Pr->SiS_TVMode & TVSetPAL) index += 1; } else { if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) index += 2; @@ -12174,10 +11961,10 @@ SetOEMTVDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; USHORT index,temp,romptr=0; - if((ROMAddr) && SiS_Pr->SiS_UseROM) { + if(SiS_Pr->SiS_UseROM) { if(!(ROMAddr[0x238] & 0x01)) return; if(!(ROMAddr[0x238] & 0x02)) return; - romptr = ROMAddr[0x241] | (ROMAddr[0x242] << 8); + romptr = SISGETROMW(0x241); } temp = GetOEMTVPtr(SiS_Pr); @@ -12186,7 +11973,7 @@ SetOEMTVDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, if(romptr) { romptr += (temp * 2); - romptr = ROMAddr[romptr] | (ROMAddr[romptr + 1] << 8); + romptr = SISGETROMW(romptr); romptr += index; temp = ROMAddr[romptr]; } else { @@ -12197,7 +11984,7 @@ SetOEMTVDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, } } temp &= 0x3c; - SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,~0x3C,temp); /* index 0A D[6:4] */ + SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,~0x3C,temp); } static void @@ -12207,10 +11994,10 @@ SetOEMAntiFlicker(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; USHORT index,temp,romptr=0; - if((ROMAddr) && SiS_Pr->SiS_UseROM) { + if(SiS_Pr->SiS_UseROM) { if(!(ROMAddr[0x238] & 0x01)) return; if(!(ROMAddr[0x238] & 0x04)) return; - romptr = ROMAddr[0x243] | (ROMAddr[0x244] << 8); + romptr = SISGETROMW(0x243); } temp = GetOEMTVPtr(SiS_Pr); @@ -12219,14 +12006,14 @@ SetOEMAntiFlicker(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, if(romptr) { romptr += (temp * 2); - romptr = ROMAddr[romptr] | (ROMAddr[romptr + 1] << 8); + romptr = SISGETROMW(romptr); romptr += index; temp = ROMAddr[romptr]; } else { temp = SiS300_OEMTVFlicker[temp][index]; } temp &= 0x70; - SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x0A,0x8F,temp); /* index 0A D[6:4] */ + SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x0A,0x8F,temp); } static void @@ -12236,14 +12023,14 @@ SetOEMPhaseIncr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; USHORT index,i,j,temp,romptr=0; - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVisionTV) return; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) return; if(SiS_Pr->SiS_TVMode & (TVSetNTSC1024 | TVSetNTSCJ | TVSetPALM | TVSetPALN)) return; - if((ROMAddr) && SiS_Pr->SiS_UseROM) { + if(SiS_Pr->SiS_UseROM) { if(!(ROMAddr[0x238] & 0x01)) return; if(!(ROMAddr[0x238] & 0x08)) return; - romptr = ROMAddr[0x245] | (ROMAddr[0x246] << 8); + romptr = SISGETROMW(0x245); } temp = GetOEMTVPtr(SiS_Pr); @@ -12257,7 +12044,7 @@ SetOEMPhaseIncr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, } else { if(romptr) { romptr += (temp * 2); - romptr = ROMAddr[romptr] | (ROMAddr[romptr + 1] << 8); + romptr = SISGETROMW(romptr); romptr += (index * 4); for(i=0x31, j=0; i<=0x34; i++, j++) { SiS_SetReg(SiS_Pr->SiS_Part2Port,i,ROMAddr[romptr + j]); @@ -12277,12 +12064,12 @@ SetOEMYFilter(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, UCHAR *ROMAddr = HwInfo->pjVirtualRomBase; USHORT index,temp,i,j,romptr=0; - if(SiS_Pr->SiS_VBInfo & (SetCRT2ToSCART | SetCRT2ToHiVisionTV)) return; + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToSCART | SetCRT2ToHiVision | SetCRT2ToYPbPr525750)) return; - if((ROMAddr) && SiS_Pr->SiS_UseROM) { + if(SiS_Pr->SiS_UseROM) { if(!(ROMAddr[0x238] & 0x01)) return; if(!(ROMAddr[0x238] & 0x10)) return; - romptr = ROMAddr[0x247] | (ROMAddr[0x248] << 8); + romptr = SISGETROMW(0x247); } temp = GetOEMTVPtr(SiS_Pr); @@ -12303,7 +12090,7 @@ SetOEMYFilter(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, } else { if((romptr) && (!(SiS_Pr->SiS_TVMode & (TVSetPALM|TVSetPALN)))) { romptr += (temp * 2); - romptr = ROMAddr[romptr] | (ROMAddr[romptr + 1] << 8); + romptr = SISGETROMW(romptr); romptr += (index * 4); for(i=0x35, j=0; i<=0x38; i++, j++) { SiS_SetReg(SiS_Pr->SiS_Part2Port,i,ROMAddr[romptr + j]); diff --git a/src/init301.h b/src/init301.h index 757cc36..9e86ee1 100644 --- a/src/init301.h +++ b/src/init301.h @@ -1,36 +1,52 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h,v 1.33 2003/11/20 19:53:23 twini Exp $ */ +/* $XFree86$ */ /* * Data and prototypes for init301.c * - * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria * - * If distributed as part of the linux kernel, the contents of this file - * is entirely covered by the GPL. + * If distributed as part of the Linux kernel, the following license terms + * apply: * - * Otherwise, the following terms apply: + * * This program is free software; you can redistribute it and/or modify + * * it under the terms of the GNU General Public License as published by + * * the Free Software Foundation; either version 2 of the named License, + * * or any later version. + * * + * * This program is distributed in the hope that it will be useful, + * * but WITHOUT ANY WARRANTY; without even the implied warranty of + * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * * GNU General Public License for more details. + * * + * * You should have received a copy of the GNU General Public License + * * along with this program; if not, write to the Free Software + * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * - * 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. + * Otherwise, the following license terms apply: * - * 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. + * * 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. + * * + * * 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. * * Author: Thomas Winischhofer <thomas@winischhofer.net> * - * Based on code by Silicon Intergrated Systems - * */ #ifndef _INIT301_ @@ -65,36 +81,36 @@ #endif #endif -const UCHAR SiS_HiVisionTable[3][64] = { +const UCHAR SiS_YPbPrTable[3][64] = { { - 0x17, 0x1d, 0x03, 0x09, 0x05, 0x06, 0x0c, 0x0c, - 0x94, 0x49, 0x01, 0x0a, 0x06, 0x0d, 0x04, 0x0a, - 0x06, 0x14, 0x0d, 0x04, 0x0a, 0x00, 0x85, 0x1b, - 0x0c, 0x50, 0x00, 0x97, 0x00, 0xd4, 0x4a, 0x17, - 0x7d, 0x05, 0x4b, 0x00, 0x00, 0xe2, 0x00, 0x02, - 0x03, 0x0a, 0x65, 0x9d, 0x08, 0x92, 0x8f, 0x40, - 0x60, 0x80, 0x14, 0x90, 0x8c, 0x60, 0x14, 0x53, - 0x00, 0x40, 0x44, 0x00, 0xdb, 0x02, 0x3b, 0x00 + 0x17,0x1d,0x03,0x09,0x05,0x06,0x0c,0x0c, + 0x94,0x49,0x01,0x0a,0x06,0x0d,0x04,0x0a, + 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x1b, + 0x0c,0x50,0x00,0x97,0x00,0xda,0x4a,0x17, + 0x7d,0x05,0x4b,0x00,0x00,0xe2,0x00,0x02, + 0x03,0x0a,0x65,0x9d,0x08,0x92,0x8f,0x40, + 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x53, + 0x00,0x40,0x44,0x00,0xdb,0x02,0x3b,0x00 }, { - 0x1d, 0x1d, 0x06, 0x09, 0x0b, 0x0c, 0x0c, 0x0c, - 0x98, 0x0a, 0x01, 0x0d, 0x06, 0x0d, 0x04, 0x0a, - 0x06, 0x14, 0x0d, 0x04, 0x0a, 0x00, 0x85, 0x3f, - 0x0c, 0x50, 0xb2, 0x2e, 0x16, 0xb5, 0xf4, 0x03, - 0x7d, 0x11, 0x7d, 0xea, 0x30, 0x36, 0x18, 0x96, - 0x21, 0x0a, 0x58, 0xee, 0x42, 0x92, 0x0f, 0x40, - 0x60, 0x80, 0x14, 0x90, 0x8c, 0x60, 0x04, 0xf3, - 0x00, 0x40, 0x11, 0x00, 0xfc, 0xff, 0x32, 0x00 + 0x1d,0x11,0x06,0x09,0x0b,0x0c,0x0c,0x0c, + 0x98,0x0a,0x01,0x0d,0x06,0x0d,0x04,0x0a, + 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x3f, + 0x0c,0x50,0xb2,0x9f,0x16,0x59,0x4f,0x13, + 0xad,0x11,0xad,0x1d,0x40,0x8a,0x3d,0xb8, + 0x51,0x5e,0x60,0x49,0x7d,0x92,0x0f,0x40, + 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x4b, + 0x43,0x41,0x11,0x00,0xfc,0xff,0x32,0x00 }, { - 0x13, 0x1d, 0xe8, 0x09, 0x09, 0xed, 0x0c, 0x0c, - 0x98, 0x0a, 0x01, 0x0c, 0x06, 0x0d, 0x04, 0x0a, - 0x06, 0x14, 0x0d, 0x04, 0x0a, 0x00, 0x85, 0x3f, - 0xed, 0x50, 0x70, 0x9f, 0x16, 0x59, 0x2b, 0x13, - 0x27, 0x0b, 0x27, 0xfc, 0x30, 0x27, 0x1c, 0xb0, - 0x4b, 0x4b, 0x6f, 0x2f, 0x63, 0x92, 0x0f, 0x40, - 0x60, 0x80, 0x14, 0x90, 0x8c, 0x60, 0x14, 0x2a, - 0x00, 0x40, 0x11, 0x00, 0xfc, 0xff, 0x32, 0x00 + 0x13,0x1d,0xe8,0x09,0x09,0xed,0x0c,0x0c, + 0x98,0x0a,0x01,0x0c,0x06,0x0d,0x04,0x0a, + 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x3f, + 0xed,0x50,0x70,0x9f,0x16,0x59,0x2b,0x13, + 0x27,0x0b,0x27,0xfc,0x30,0x27,0x1c,0xb0, + 0x4b,0x4b,0x6f,0x2f,0x63,0x92,0x0f,0x40, + 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x27, + 0x00,0x40,0x11,0x00,0xfc,0xff,0x32,0x00 } }; @@ -138,7 +154,7 @@ static const UCHAR SiS_Part2CLVX_2[] = { 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E }; -static const UCHAR SiS_Part2CLVX_3[] = { /* NTSC */ +static const UCHAR SiS_Part2CLVX_3[] = { /* NTSC, 525i, 525p */ 0xE0,0x01, 0x04,0x1A,0x04,0x7E,0x03,0x1A,0x06,0x7D,0x01,0x1A,0x08,0x7D,0x00,0x19,0x0A,0x7D, 0x7F,0x19,0x0C,0x7C,0x7E,0x18,0x0E,0x7C,0x7E,0x17,0x10,0x7B,0x7D,0x15,0x12,0x7C, @@ -176,22 +192,102 @@ static const UCHAR SiS_Part2CLVX_4[] = { /* PAL */ 0xFF,0xFF }; +static const UCHAR SiS_Part2CLVX_5[] = { /* 750p */ + 0x00,0x03, + 0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x18,0x0A,0x7D, + 0x00,0x18,0x0C,0x7C,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x0F,0x7D,0x7E,0x14,0x11,0x7D, + 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x16,0x7E,0x7D,0x0E,0x17,0x7E, + 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04, + 0xFF,0xFF +}; + +static const UCHAR SiS_Part2CLVX_6[] = { /* 1080i */ + 0x00,0x04, + 0x04,0x1A,0x04,0x7E,0x02,0x1B,0x05,0x7E,0x01,0x1A,0x07,0x7E,0x00,0x1A,0x09,0x7D, + 0x7F,0x19,0x0B,0x7D,0x7E,0x18,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7D,0x15,0x12,0x7C, + 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x1D /* 0x7D? */ ,0x7C,0x0D,0x18,0x7F, + 0x7D,0x0B,0x19,0x7F,0x7D,0x09,0x1A,0x00,0x7D,0x07,0x1A,0x02,0x7E,0x05,0x1B,0x02, + 0xFF,0xFF, +}; + + #ifdef SIS315H /* 661 et al LCD data structure */ static const UCHAR SiS_LCDStruct661[] = { - /* 1600x1200 */ - 0x0B,0xEA,0x81,0x10,0x00,0xC0,0x03,0x21,0x5A,0x23,0x5A,0x23,0x02, - 0x14,0x0A,0x02,0x00,0x30,0x10,0x5A,0x10,0x10,0x0A,0xC0,0x30,0x10, - /* 1400x1050 */ - 0x09,0xEA,0x81,0x80,0xA3,0x70,0x03,0x19,0xD2,0x2A,0xF8,0x2F,0x02, - 0x14,0x0A,0x02,0x00,0x30,0x10,0x5A,0x10,0x10,0x0A,0xC0,0x30,0x10, - /* 1280x1024 */ - 0x03,0xEA,0x81,0x40,0xA1,0x70,0x03,0x19,0xD2,0x2A,0xF8,0x2F,0x02, - 0x14,0x0A,0x02,0x00,0x30,0x10,0x5A,0x10,0x10,0x0A,0xC0,0x30,0x10, /* 1024x768 */ - 0x02,0xEA,0x80,0x00,0x11,0x88,0x06,0x0B,0xF5,0x6C,0x35,0x62,0x02, - 0x14,0x0A,0x02,0x00,0x30,0x10,0x5A,0x10,0x10,0x0A,0xC0,0x28,0x10, - 0xFF, +/* type|CR37| HDE | VDE | HT | VT | hss | hse */ + 0x02,0xC0,0x00,0x04,0x00,0x03,0x40,0x05,0x26,0x03,0x10,0x00,0x88, + 0x00,0x02,0x00,0x06,0x00,0x41,0x5A,0x64,0x37,0x6E,0x05,0x6E,0x04, + /* | vss | vse |clck| clock |CRT2DataP|CRT2DataP|idx */ + /* VESA non-VESA noscale */ + /* 1280x1024 */ + 0x03,0xE0,0x00,0x05,0x00,0x04,0x98,0x06,0x2A,0x04,0x30,0x00,0x70, + 0x00,0x01,0x00,0x03,0x00,0x6C,0xF8,0x2F,0x5F,0x6F,0xDB,0x6F,0x08, + /* 1400x1050 */ + 0x09,0x20,0x78,0x05,0x1A,0x04,0x98,0x06,0x2A,0x04,0x18,0x00,0x38, + 0x00,0x01,0x00,0x03,0x00,0x6C,0xF8,0x2F,0x35,0x70,0x00,0x00,0x09, + /* 1600x1200 */ + 0x0B,0xE0,0x40,0x06,0xB0,0x04,0x70,0x08,0xE2,0x04,0x40,0x00,0xC0, + 0x00,0x01,0x00,0x03,0x00,0xA2,0x70,0x24,0x07,0x71,0x00,0x00,0x0B, + /* 1280x768 */ + 0x0A,0xC0,0x00,0x05,0x00,0x03,0x80,0x05,0x26,0x03,0x10,0x00,0x40, + 0x00,0x03,0x00,0x06,0x00,0x44,0x63,0x46,0xEB,0x6E,0xA5,0x6E,0x06, + /* 1280x720 */ + 0x0E,0xE0,0x00,0x05,0xD0,0x02,0x40,0x05,0x26,0x03,0x10,0x00,0x02, + 0x00,0x01,0x00,0x06,0x00,0x41,0x5A,0x64,0x69,0x6E,0x00,0x00,0x05, +#if 0 /* 0.92: */ + 0x0E,0xE0,0x00,0x05,0xD0,0x02,0x72,0x06,0xEE,0x02,0x2A,0x00,0x3F, + 0x00,0x01,0x00,0x06,0x00,0x41,0x00,0x00,0xA7,0x6A,0x00,0x00,0x05, +#endif + /* 1280x800 */ + 0x0C,0xE0,0x00,0x05,0x20,0x03,0x80,0x05,0x30,0x03,0x15,0x00,0x18, + 0x00,0x04,0x00,0x03,0x00,0x45,0x9C,0x62,0x31,0x6F,0x00,0x00,0x07, + /* 1680x1050 */ + 0x0D,0xE0,0x90,0x06,0x1A,0x04,0x6C,0x07,0x2A,0x04,0x1A,0x00,0x4C, + 0x00,0x03,0x00,0x06,0x00,0x79,0xBE,0x44,0x99,0x70,0x00,0x00,0x0A, /* 0.93: 0x0A=0x06 - WRONG? */ + /* 1280x768 (not in 0.93) */ + 0x0A,0xC0,0x00,0x05,0x00,0x03,0x80,0x06,0x1E,0x03,0x40,0x00,0x80, + 0x00,0x03,0x00,0x07,0x00,0x4F,0x00,0x00,0x6F,0x6B,0x00,0x00,0x06 +}; +#endif + +#ifdef SIS300 +static UCHAR SiS300_TrumpionData[7][80] = { + { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02, + 0x20,0x03,0x0B,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x10,0x00,0x00,0x04,0x23, + 0x00,0x00,0x03,0x28,0x03,0x10,0x05,0x08,0x40,0x10,0x00,0x10,0x04,0x23,0x00,0x23, + 0x03,0x11,0x60,0xBC,0x01,0xFF,0x03,0xFF,0x19,0x01,0x00,0x05,0x09,0x04,0x04,0x05, + 0x04,0x0C,0x09,0x05,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x5A,0x01,0xBE,0x01,0x00 }, + { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x27,0x00,0x80,0x02, + 0x20,0x03,0x07,0x00,0x5E,0x01,0x0D,0x02,0x60,0x0C,0x30,0x11,0x00,0x00,0x04,0x23, + 0x00,0x00,0x03,0x80,0x03,0x28,0x06,0x08,0x40,0x11,0x00,0x11,0x04,0x23,0x00,0x23, + 0x03,0x11,0x60,0x90,0x01,0xFF,0x0F,0xF4,0x19,0x01,0x00,0x05,0x01,0x00,0x04,0x05, + 0x04,0x0C,0x02,0x01,0x02,0xB0,0x00,0x00,0x02,0xBA,0xEC,0x57,0x01,0xBE,0x01,0x00 }, + { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x8A,0x00,0xD8,0x02, + 0x84,0x03,0x16,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x1C,0x00,0x20,0x04,0x23, + 0x00,0x01,0x03,0x53,0x03,0x28,0x06,0x08,0x40,0x1C,0x00,0x16,0x04,0x23,0x00,0x23, + 0x03,0x11,0x60,0xD9,0x01,0xFF,0x0F,0xF4,0x18,0x07,0x05,0x05,0x13,0x04,0x04,0x05, + 0x01,0x0B,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x59,0x01,0xBE,0x01,0x00 }, + { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x72,0x00,0xD8,0x02, + 0x84,0x03,0x16,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x1C,0x00,0x20,0x04,0x23, + 0x00,0x01,0x03,0x53,0x03,0x28,0x06,0x08,0x40,0x1C,0x00,0x16,0x04,0x23,0x00,0x23, + 0x03,0x11,0x60,0xDA,0x01,0xFF,0x0F,0xF4,0x18,0x07,0x05,0x05,0x13,0x04,0x04,0x05, + 0x01,0x0B,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 }, + { 0x02,0x0A,0x02,0x00,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02, + 0x20,0x03,0x16,0x00,0xE0,0x01,0x0D,0x02,0x60,0x0C,0x30,0x98,0x00,0x00,0x04,0x23, + 0x00,0x01,0x03,0x45,0x03,0x48,0x06,0x08,0x40,0x98,0x00,0x98,0x04,0x23,0x00,0x23, + 0x03,0x11,0x60,0xF4,0x01,0xFF,0x0F,0xF4,0x18,0x01,0x00,0x05,0x01,0x00,0x05,0x05, + 0x04,0x0C,0x08,0x05,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x5B,0x01,0xBE,0x01,0x00 }, + { 0x02,0x0A,0x02,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0xBF,0x00,0x20,0x03, + 0x20,0x04,0x0D,0x00,0x58,0x02,0x71,0x02,0x80,0x0C,0x30,0x9A,0x00,0xFA,0x03,0x1D, + 0x00,0x01,0x03,0x22,0x03,0x28,0x06,0x08,0x40,0x98,0x00,0x98,0x04,0x1D,0x00,0x1D, + 0x03,0x11,0x60,0x39,0x03,0x40,0x05,0xF4,0x18,0x07,0x02,0x06,0x04,0x01,0x06,0x0B, + 0x02,0x0A,0x20,0x19,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x5B,0x01,0xBE,0x01,0x00 }, + { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0xEF,0x00,0x00,0x04, + 0x40,0x05,0x13,0x00,0x00,0x03,0x26,0x03,0x88,0x0C,0x30,0x90,0x00,0x00,0x04,0x23, + 0x00,0x01,0x03,0x24,0x03,0x28,0x06,0x08,0x40,0x90,0x00,0x90,0x04,0x23,0x00,0x23, + 0x03,0x11,0x60,0x40,0x05,0xFF,0x0F,0xF4,0x18,0x01,0x00,0x08,0x01,0x00,0x08,0x01, + 0x00,0x08,0x01,0x01,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x5B,0x01,0xBE,0x01,0x00 } }; #endif @@ -206,7 +302,7 @@ void SiS_SetChrontelGPIO(SiS_Private *SiS_Pr, USHORT myvbinfo); void SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,PSIS_HW_INFO HwInfo, int checkcrt2mode); -void SiS_SetHiVision(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo); +void SiS_SetYPbPr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo); void SiS_SetTVMode(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, PSIS_HW_INFO HwInfo); void SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, PSIS_HW_INFO HwInfo); USHORT SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, @@ -233,6 +329,12 @@ void SiS_ChrontelDoSomething1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo); void SiS_Chrontel701xBLOn(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo); void SiS_Chrontel701xBLOff(SiS_Private *SiS_Pr); #endif /* 315 */ +#ifdef SIS300 +void SiS_SetTrumpReg(SiS_Private *SiS_Pr, USHORT tempbx); +USHORT SiS_GetTrumpReg(SiS_Private *SiS_Pr, USHORT tempbx); +static BOOLEAN SiS_SetTrumpionBlock(SiS_Private *SiS_Pr, UCHAR *dataptr); +#endif + USHORT SiS_ReadDDC1Bit(SiS_Private *SiS_Pr); void SiS_SetSwitchDDC2(SiS_Private *SiS_Pr); @@ -300,5 +402,6 @@ extern USHORT SiS_GetOffset(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdInd extern void SiS_LoadDAC(SiS_Private *SiS_Pr, PSIS_HW_INFO,USHORT ModeNo, USHORT ModeIdIndex); +extern void SiS_CalcLCDACRT1Timing(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex); #endif diff --git a/src/initdef.h b/src/initdef.h index 5dc509f..869364c 100644 --- a/src/initdef.h +++ b/src/initdef.h @@ -1,36 +1,52 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h,v 1.24 2003/11/19 00:49:03 twini Exp $ */ +/* $XFree86$ */ /* * Global definitions for init.c and init301.c * - * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria * - * If distributed as part of the linux kernel, the contents of this file - * is entirely covered by the GPL. + * If distributed as part of the Linux kernel, the following license terms + * apply: * - * Otherwise, the following terms apply: + * * This program is free software; you can redistribute it and/or modify + * * it under the terms of the GNU General Public License as published by + * * the Free Software Foundation; either version 2 of the named License, + * * or any later version. + * * + * * This program is distributed in the hope that it will be useful, + * * but WITHOUT ANY WARRANTY; without even the implied warranty of + * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * * GNU General Public License for more details. + * * + * * You should have received a copy of the GNU General Public License + * * along with this program; if not, write to the Free Software + * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * - * 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. + * Otherwise, the following license terms apply: * - * 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. + * * 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. + * * + * * 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. * * Author: Thomas Winischhofer <thomas@winischhofer.net> * - * Based on code by Silicon Integrated Systems - * */ #ifndef _INITDEF_ @@ -53,6 +69,8 @@ #define IS_SIS650740660 (IS_SIS650 || IS_SIS740 || IS_SIS661741660760) #define IS_SIS550650740660 (IS_SIS550 || IS_SIS650740660) +#define SISGETROMW(x) (ROMAddr[(x)] | (ROMAddr[(x)+1] << 8)) + /* SiS_VBType */ #define VB_SIS301 0x0001 #define VB_SIS301B 0x0002 @@ -75,22 +93,26 @@ #define SetCRT2ToSCART 0x0010 #define SetCRT2ToLCD 0x0020 #define SetCRT2ToRAMDAC 0x0040 -#define SetCRT2ToHiVisionTV 0x0080 -#define SetCRT2ToTV 0x009C /* alias */ +#define SetCRT2ToHiVision 0x0080 /* for SiS bridge */ +#define SetCRT2ToCHYPbPr SetCRT2ToHiVision /* for Chrontel */ #define SetNTSCTV 0x0000 /* CR 31 */ #define SetPALTV 0x0100 /* Deprecated here, now in TVMode */ #define SetInSlaveMode 0x0200 #define SetNotSimuMode 0x0400 -#define SetNotSimuTVMode 0x0400 +#define SetNotSimuTVMode SetNotSimuMode #define SetDispDevSwitch 0x0800 +#define SetCRT2ToYPbPr525750 0x0800 #define LoadDACFlag 0x1000 -#define SetCHTVOverScan 0x1000 /* Deprecated here, now in TVMode */ #define DisableCRT2Display 0x2000 -#define CRT2DisplayFlag 0x2000 #define DriverMode 0x4000 -#define HotKeySwitch 0x8000 +#define HotKeySwitch 0x8000 #define SetCRT2ToLCDA 0x8000 +/* v-- Needs change in sis_vga.c if changed (GPIO) --v */ +#define SetCRT2ToTV (SetCRT2ToYPbPr525750|SetCRT2ToHiVision|SetCRT2ToSCART|SetCRT2ToSVIDEO|SetCRT2ToAVIDEO) +#define SetCRT2ToTVNoYPbPrHiVision (SetCRT2ToSCART | SetCRT2ToSVIDEO | SetCRT2ToAVIDEO) +#define SetCRT2ToTVNoHiVision (SetCRT2ToYPbPr525750 | SetCRT2ToSCART | SetCRT2ToSVIDEO | SetCRT2ToAVIDEO) + /* SiS_ModeType */ #define ModeText 0x00 #define ModeCGA 0x01 @@ -120,8 +142,9 @@ #define SupportTV 0x0008 #define SupportTV1024 0x0800 #define SupportCHTV 0x0800 -#define SupportHiVisionTV 0x0010 -#define SupportHiVisionTV2 0x1000 +#define Support64048060Hz 0x0800 /* Special for 640x480 LCD */ +#define SupportHiVision 0x0010 +#define SupportYPbPr750p 0x1000 #define SupportLCD 0x0020 #define SupportRAMDAC2 0x0040 /* All (<= 100Mhz) */ #define SupportRAMDAC2_135 0x0100 /* All except DH (<= 135Mhz) */ @@ -150,9 +173,23 @@ #define TVSetPALM 0x0004 #define TVSetPALN 0x0008 #define TVSetCHOverScan 0x0010 -#define TVSetTVSimuMode 0x0800 -#define TVRPLLDIV2XO 0x1000 -#define TVSetNTSC1024 0x2000 +#define TVSetYPbPr525i 0x0020 /* new 0x10 */ +#define TVSetYPbPr525p 0x0040 /* new 0x20 */ +#define TVSetYPbPr750p 0x0080 /* new 0x40 */ +#define TVSetHiVision 0x0100 /* new 0x80; = 1080i, software-wise identical */ +#define TVSetTVSimuMode 0x0200 /* new 0x200, prev. 0x800 */ +#define TVRPLLDIV2XO 0x0400 /* prev 0x1000 */ +#define TVSetNTSC1024 0x0800 /* new 0x100, prev. 0x2000 */ +#define TVAspect43 0x2000 +#define TVAspect169 0x4000 +#define TVAspect43LB 0x8000 + +/* YPbPr flag (>=315, <661; converted to TVMode) */ +#define YPbPr525p 0x0001 +#define YPbPr750p 0x0002 +#define YPbPr525i 0x0004 +#define YPbPrHiVision 0x0008 +#define YPbPrModeMask (YPbPr750p | YPbPr525p | YPbPr525i | YPbPrHiVision) /* SysFlags (to identify special versions) */ #define SF_Is651 0x0001 @@ -163,6 +200,7 @@ #define SF_IsM661 0x0020 #define SF_IsM741 0x0040 #define SF_IsM760 0x0080 +#define SF_760UMA 0x8000 /* CR32 (Newer 630, and 315 series) @@ -188,10 +226,11 @@ [2] 1 = PALM (if D0 = 1) [3] 1 = PALN (if D0 = 1) [4] 1 = Overscan (Chrontel only) - [7:5] 000 525i (not supported yet) + [7:5] (only if D2 in CR38 is set) + 000 525i 001 525p 010 750p - 011 1080i + 011 1080i (or HiVision on 301, 301B) These bits are being translated to TVMode flag. @@ -233,7 +272,7 @@ #define LCDRGB18Bit 0x0001 #define LCDNonExpanding 0x0010 #define LCDSync 0x0020 -#define LCDPass11 0x0100 +#define LCDPass11 0x0100 /* 0: center screen, 1: Pass 1:1 data */ #define LCDDualLink 0x0200 #define DontExpandLCD LCDNonExpanding @@ -243,14 +282,15 @@ #define LCDSyncShift 6 /* CR38 (315 series) */ -#define EnableDualEdge 0x01 -#define SetToLCDA 0x02 /* LCD channel A (302B/30xLV and 650+LVDS only) */ -#define EnableSiSHiVision 0x04 /* HiVision (HDTV) on SiS bridge */ -#define EnableLVDSScart 0x04 /* Scart on Ch7019 (unofficial definition - TW) */ -#define EnableLVDSHiVision 0x08 /* YPbPr color format (480i HDTV); only on 650/Ch7019 systems */ -#define EnableHiVision750 0x08 /* Enable 750P HiVision mode (30xLV only) */ -#define EnableHiVision525 0x10 /* Enable 525P HiVision mode (30xLV only) */ -#define SiSHiVision2 0x20 /* ? - | --- mask 0x38 combinations have different meaning! */ +#define EnableDualEdge 0x01 +#define SetToLCDA 0x02 /* LCD channel A (301C/302B/30x(E)LV and 650+LVDS only) */ +#define EnableCHScart 0x04 /* Scart on Ch7019 (unofficial definition - TW) */ +#define EnableCHYPbPr 0x08 /* YPbPr on Ch7019 (480i HDTV); only on 650/Ch7019 systems */ +#define EnableSiSYPbPr 0x08 /* Enable YPbPr mode (30xLV/301C only) */ +#define EnableYPbPr525i 0x00 /* Enable 525i YPbPr mode (30xLV/301C only) (mask 0x30) */ +#define EnableYPbPr525p 0x10 /* Enable 525p YPbPr mode (30xLV/301C only) (mask 0x30) */ +#define EnableYPbPr750p 0x20 /* Enable 750p YPbPr mode (30xLV/301C only) (mask 0x30) */ +#define EnableYPbPr1080i 0x30 /* Enable 1080i YPbPr mode (30xLV/301C only) (mask 0x30) */ #define EnablePALM 0x40 /* 1 = Set PALM */ #define EnablePALN 0x80 /* 1 = Set PALN */ #define EnableNTSCJ EnablePALM /* Not BIOS */ @@ -261,14 +301,28 @@ 010 LVDS 011 Chrontel 7019 100 Conexant + D2 Enable YPbPr output (see CR35) + D[1:0] LCDA (like before) */ #define EnablePALMN 0x40 /* Romflag: 1 = Allow PALM/PALN */ /* CR39 (650 only) */ -#define LCDPass1_1 0x01 /* LVDS only; set by driver to pass 1:1 data to LVDS output */ +#define LCDPass1_1 0x01 /* 0: center screen, 1: pass 1:1 data output */ #define Enable302LV_DualLink 0x04 /* 302LV only; enable dual link */ +/* CR39 (661 and later) + D[1:0] YPbPr Aspect Ratio + 00 4:3 letterbox + 01 4:3 + 10 16:9 + 11 4:3 +*/ + +/* CR3B (651+301C) + D[1:0] YPbPr Aspect Ratio + ? +*/ /* CR79 (315/330 series only; not 661 and later) [3-0] Notify driver @@ -297,7 +351,7 @@ #define Panel300_1024x600 0x06 #define Panel300_1152x768 0x07 #define Panel300_1280x768 0x0a -#define Panel300_320x480 0x0e /* fstn - TW: This is fake, can be any */ +#define Panel300_320x480 0x0e /* fstn - This is fake, can be any */ #define Panel300_Custom 0x0f #define Panel300_Barco1366 0x10 @@ -317,8 +371,24 @@ #define Panel310_320x480 0x0e /* fstn - TW: This is fake, can be any */ #define Panel310_Custom 0x0f +#define Panel661_800x600 0x01 +#define Panel661_1024x768 0x02 +#define Panel661_1280x1024 0x03 +#define Panel661_640x480 0x04 +#define Panel661_1024x600 0x05 +#define Panel661_1152x864 0x06 +#define Panel661_1280x960 0x07 +#define Panel661_1152x768 0x08 +#define Panel661_1400x1050 0x09 +#define Panel661_1280x768 0x0a +#define Panel661_1600x1200 0x0b +#define Panel661_1280x800 0x0c +#define Panel661_1680x1050 0x0d +#define Panel661_1280x720 0x0e +#define Panel661_Custom 0x0f + #define Panel_800x600 0x01 /* Unified values */ -#define Panel_1024x768 0x02 +#define Panel_1024x768 0x02 /* MUST match BIOS values from 0-e */ #define Panel_1280x1024 0x03 #define Panel_640x480 0x04 #define Panel_1024x600 0x05 @@ -326,14 +396,19 @@ #define Panel_1280x960 0x07 #define Panel_1152x768 0x08 /* LVDS only */ #define Panel_1400x1050 0x09 -#define Panel_1280x768 0x0a /* LVDS only */ +#define Panel_1280x768 0x0a /* 30xB/C and LVDS only (BIOS: all) */ #define Panel_1600x1200 0x0b -#define Panel_640x480_2 0x0c -#define Panel_640x480_3 0x0d -#define Panel_320x480 0x0e /* fstn - TW: This is fake, can be any */ -#define Panel_Custom 0x0f -#define Panel_Barco1366 0x10 -#define Panel_848x480 0x11 +#define Panel_1280x800 0x0c /* 661etc */ +#define Panel_1680x1050 0x0d /* 661etc */ +#define Panel_1280x720 0x0e /* 661etc */ +#define Panel_Custom 0x0f /* MUST BE 0x0f (for DVI DDC detection */ +#define Panel_320x480 0x10 /* SiS 550 fstn - TW: This is fake, can be any */ +#define Panel_Barco1366 0x11 +#define Panel_848x480 0x12 +#define Panel_640x480_2 0x13 /* SiS 550 */ +#define Panel_640x480_3 0x14 /* SiS 550 */ +#define Panel_1280x768_2 0x15 /* 30xLV */ +#define Panel_1280x768_3 0x16 /* 30xLV */ /* Index in ModeResInfo table */ #define SIS_RI_320x200 0 @@ -365,6 +440,8 @@ #define SIS_RI_1152x768 26 #define SIS_RI_768x576 27 #define SIS_RI_1360x1024 28 +#define SIS_RI_1680x1050 29 +#define SIS_RI_1280x800 30 /* CR5F */ #define IsM650 0x80 @@ -392,14 +469,22 @@ #define VCLK108_3_300 0x42 /* Index in VCLKData table (300) */ #define VCLK100_300 0x43 /* Index in VCLKData table (300) */ #define VCLK34_300 0x3d /* Index in VCLKData table (300) */ +#define VCLK_CUSTOM_300 0x46 #define VCLK65_315 0x0b /* Index in (VB)VCLKData table (315) */ #define VCLK108_2_315 0x19 /* Index in (VB)VCLKData table (315) */ #define VCLK81_315 0x5b /* Index in (VB)VCLKData table (315) */ -#define VCLK162_315 0x21 /* Index in (VB)VCLKData table (315) */ +#define VCLK162_315 0x5e /* Index in (VB)VCLKData table (315) */ #define VCLK108_3_315 0x45 /* Index in VBVCLKData table (315) */ #define VCLK100_315 0x46 /* Index in VBVCLKData table (315) */ -#define VCLK34_315 0x55 /* Index in VBVCLKData table (315) */ +#define VCLK34_315 0x55 #define VCLK68_315 0x0d +#define VCLK69_315 0x5c /* Index in VBVCLKData table (315) */ +#define VCLK121_315 0x5d /* Index in VBVCLKData table (315) */ +#define VCLK_1280x720 0x5f +#define VCLK_1280x768_2 0x60 +#define VCLK_1280x768_3 0x61 +#define VCLK_CUSTOM_315 0x62 +#define VCLK_1280x720_2 0x63 #define TVCLKBASE_300 0x21 /* Indices on TV clocks in VCLKData table (300) */ #define TVCLKBASE_315 0x3a /* Indices on TV clocks in (VB)VCLKData table (315) */ @@ -409,6 +494,7 @@ #define HiTVVCLK 0x03 /* Index relative to TVCLKBASE */ #define HiTVSimuVCLK 0x04 /* Index relative to TVCLKBASE */ #define HiTVTextVCLK 0x05 /* Index relative to TVCLKBASE */ +#define YPbPr750pVCLK 0x25 /* Index relative to TVCLKBASE; was 0x0f NOT relative */ /* ------------------------------ */ diff --git a/src/oem300.h b/src/oem300.h index b594b4b..7995893 100644 --- a/src/oem300.h +++ b/src/oem300.h @@ -1,36 +1,52 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/oem300.h,v 1.11 2003/10/30 18:53:42 twini Exp $ */ +/* $XFree86$ */ /* * OEM Data for 300 series * - * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria * - * If distributed as part of the linux kernel, the contents of this file - * is entirely covered by the GPL. + * If distributed as part of the Linux kernel, the following license terms + * apply: * - * Otherwise, the following terms apply: + * * This program is free software; you can redistribute it and/or modify + * * it under the terms of the GNU General Public License as published by + * * the Free Software Foundation; either version 2 of the named License, + * * or any later version. + * * + * * This program is distributed in the hope that it will be useful, + * * but WITHOUT ANY WARRANTY; without even the implied warranty of + * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * * GNU General Public License for more details. + * * + * * You should have received a copy of the GNU General Public License + * * along with this program; if not, write to the Free Software + * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * - * 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. + * Otherwise, the following license terms apply: * - * 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. + * * 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. + * * + * * 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. * * Author: Thomas Winischhofer <thomas@winischhofer.net> * - * Based on code by Silicon Intergrated Systems - * */ const UCHAR SiS300_OEMTVDelay301[8][4] = diff --git a/src/oem310.h b/src/oem310.h index cc5e527..f76b136 100644 --- a/src/oem310.h +++ b/src/oem310.h @@ -1,36 +1,52 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/oem310.h,v 1.18 2003/10/30 18:53:42 twini Exp $ */ +/* $XFree86$ */ /* * OEM Data for 315/330 series * - * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria * - * If distributed as part of the linux kernel, the contents of this file - * is entirely covered by the GPL. + * If distributed as part of the Linux kernel, the following license terms + * apply: * - * Otherwise, the following terms apply: + * * This program is free software; you can redistribute it and/or modify + * * it under the terms of the GNU General Public License as published by + * * the Free Software Foundation; either version 2 of the named License, + * * or any later version. + * * + * * This program is distributed in the hope that it will be useful, + * * but WITHOUT ANY WARRANTY; without even the implied warranty of + * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * * GNU General Public License for more details. + * * + * * You should have received a copy of the GNU General Public License + * * along with this program; if not, write to the Free Software + * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * - * 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. + * Otherwise, the following license terms apply: * - * 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. + * * 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. + * * + * * 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. * * Author: Thomas Winischhofer <thomas@winischhofer.net> * - * Based on code by Silicon Intergrated Systems - * */ static const UCHAR SiS310_LCDDelayCompensation_301[] = /* 301 */ @@ -53,7 +69,7 @@ static const UCHAR SiS310_LCDDelayCompensation_301[] = /* 301 */ }; /* This is contained in 650+301B BIOSes, but it is wrong - so we don't use it */ -static const UCHAR SiS310_LCDDelayCompensation_650301B[] = /* 30xB,LV */ +static const UCHAR SiS310_LCDDelayCompensation_650301LV[] = /* 650 + 30xLV */ { 0x01,0x01,0x01, /* 800x600 */ 0x01,0x01,0x01, /* 1024x768 */ @@ -72,65 +88,7 @@ static const UCHAR SiS310_LCDDelayCompensation_650301B[] = /* 30xB,LV */ 0x02,0x02,0x02 }; -/* This data is correct, so we use it instead of the table above */ -static const UCHAR SiS310_LCDDelayCompensation_3xx301B[] = /* 30xB,LV */ -{ - 0x01,0x01,0x01, /* 800x600 */ - 0x0C,0x0C,0x0C, /* 1024x768 */ - 0x0C,0x0C,0x0C, /* 1280x1024 */ - 0x08,0x08,0x08, /* 640x480 */ - 0x0C,0x0C,0x0C, /* 1024x600 (guessed) */ - 0x0C,0x0C,0x0C, /* 1152x864 (guessed) */ - 0x0C,0x0C,0x0C, /* 1280x960 (guessed) */ - 0x0C,0x0C,0x0C, /* 1152x768 (guessed) */ - 0x0C,0x0C,0x0C, /* 1400x1050 (guessed) */ - 0x0C,0x0C,0x0C, /* 1280x768 (guessed) */ - 0x0C,0x0C,0x0C, /* 1600x1200 (guessed) */ - 0x02,0x02,0x02, - 0x02,0x02,0x02, - 0x02,0x02,0x02, - 0x02,0x02,0x02 -}; - -static const UCHAR SiS310_LCDDelayCompensation_LVDS650[] = /* LVDS */ -{ - 0x00,0x00,0x00, /* 800x600 */ - 0x00,0x00,0x00, /* 1024x768 */ - 0x00,0x00,0x00, /* 1280x1024 */ - 0x00,0x00,0x00, /* 640x480 (unknown) */ - 0x00,0x00,0x00, /* 1024x600 (unknown) */ - 0x00,0x00,0x00, /* 1152x864 (unknown) */ - 0x00,0x00,0x00, /* 1280x960 (guessed) */ - 0x00,0x00,0x00, /* 1152x768 (unknown) */ - 0x00,0x00,0x00, /* 1400x1050 */ - 0x00,0x00,0x00, /* 1280x768 (guessed) */ - 0x00,0x00,0x00, /* 1600x1200 */ - 0x00,0x00,0x00, - 0x00,0x00,0x00, - 0x00,0x00,0x00, - 0x00,0x00,0x00 -}; - -static const UCHAR SiS310_LCDDelayCompensation_LVDS740[] = /* LVDS */ -{ - 0x03,0x03,0x03, /* 800x600 */ - 0x03,0x03,0x03, /* 1024x768 */ - 0x03,0x03,0x03, /* 1280x1024 */ - 0x03,0x03,0x03, /* 640x480 (unknown) */ - 0x03,0x03,0x03, /* 1024x600 (unknown) */ - 0x03,0x03,0x03, /* 1152x864 (unknown) */ - 0x03,0x03,0x03, /* 1280x960 (guessed) */ - 0x03,0x03,0x03, /* 1152x768 (unknown) */ - 0x03,0x03,0x03, /* 1400x1050 */ - 0x03,0x03,0x03, /* 1280x768 (guessed) */ - 0x03,0x03,0x03, /* 1600x1200 */ - 0x00,0x00,0x00, - 0x00,0x00,0x00, - 0x00,0x00,0x00, - 0x00,0x00,0x00 -}; - -static const UCHAR SiS310_LCDDelayCompensation_651301LV[] = /* M650/651 301LV */ +static const UCHAR SiS310_LCDDelayCompensation_651301LV[] = /* M650/651 301LV */ { 0x33,0x33,0x33, /* 800x600 (guessed) - new: PanelType, not PanelRes ! */ 0x33,0x33,0x33, /* 1024x768 */ @@ -149,7 +107,7 @@ static const UCHAR SiS310_LCDDelayCompensation_651301LV[] = /* M650/651 301LV 0x33,0x33,0x33 }; -static const UCHAR SiS310_LCDDelayCompensation_651302LV[] = /* M650/651 302LV */ +static const UCHAR SiS310_LCDDelayCompensation_651302LV[] = /* M650/651 302LV */ { 0x33,0x33,0x33, /* 800x600 (guessed) */ 0x33,0x33,0x33, /* 1024x768 */ @@ -168,6 +126,25 @@ static const UCHAR SiS310_LCDDelayCompensation_651302LV[] = /* M650/651 302LV 0x33,0x33,0x33 }; +static const UCHAR SiS310_LCDDelayCompensation_3xx301B[] = /* 30xB,LV */ +{ + 0x01,0x01,0x01, /* 800x600 */ + 0x0C,0x0C,0x0C, /* 1024x768 */ + 0x0C,0x0C,0x0C, /* 1280x1024 */ + 0x08,0x08,0x08, /* 640x480 */ + 0x0C,0x0C,0x0C, /* 1024x600 (guessed) */ + 0x0C,0x0C,0x0C, /* 1152x864 (guessed) */ + 0x0C,0x0C,0x0C, /* 1280x960 (guessed) */ + 0x0C,0x0C,0x0C, /* 1152x768 (guessed) */ + 0x0C,0x0C,0x0C, /* 1400x1050 (guessed) */ + 0x0C,0x0C,0x0C, /* 1280x768 (guessed) */ + 0x0C,0x0C,0x0C, /* 1600x1200 (guessed) */ + 0x02,0x02,0x02, + 0x02,0x02,0x02, + 0x02,0x02,0x02, + 0x02,0x02,0x02 +}; + static const UCHAR SiS310_TVDelayCompensation_301[] = /* 301 */ { 0x02,0x02, /* NTSC Enhanced, Standard */ @@ -189,13 +166,6 @@ static const UCHAR SiS310_TVDelayCompensation_740301B[] = /* 740 + 30xB (30xLV?) 0x05,0x05 }; -static const UCHAR SiS310_TVDelayCompensation_LVDS[] = /* LVDS */ -{ - 0x0a,0x0a, - 0x0a,0x0a, - 0x0a,0x0a -}; - static const UCHAR SiS310_TVDelayCompensation_651301LV[] = /* M650, 651, 301LV */ { 0x33,0x33, @@ -230,17 +200,30 @@ static const UCHAR SiS_TVDelay661_301B[] = /* 661, 301B et al */ 0x44,0x44 }; -static const UCHAR SiS310_TVAntiFlick1[3][2] = +static const UCHAR SiS310_TVDelayCompensation_LVDS[] = /* LVDS */ +{ + 0x0a,0x0a, + 0x0a,0x0a, + 0x0a,0x0a +}; + +static const UCHAR SiS310_TVAntiFlick1[6][2] = { {0x4,0x0}, {0x4,0x8}, + {0x0,0x0}, + {0x0,0x0}, + {0x0,0x0}, {0x0,0x0} }; -static const UCHAR SiS310_TVEdge1[3][2] = +static const UCHAR SiS310_TVEdge1[6][2] = { {0x0,0x4}, {0x0,0x4}, + {0x0,0x0}, + {0x0,0x0}, + {0x0,0x0}, {0x0,0x0} }; @@ -426,163 +409,21 @@ static const SiS_LCDDataStruct SiS310_ExtCompaq1280x1024Data[] = { 1, 1,1696,1066,1696,1066} }; -static const SiS_Part2PortTblStruct SiS310_CRT2Part2_Compaq1280x1024_1[] = -{ - {{0x3F,0x1B,0xD0,0xF0,0xB0,0xB8,0x23,0x0A,0x07,0x14,0x8A,0x12}}, - {{0x35,0x1B,0xA0,0xC0,0x80,0xB8,0x23,0x0A,0x07,0x14,0x8A,0x12}}, - {{0x3F,0x1B,0xD0,0xF0,0xB0,0xB8,0x23,0x0A,0x07,0x14,0x8A,0x12}}, - {{0x3F,0x1B,0xD0,0xF0,0xB0,0xB8,0x23,0x0A,0x07,0x14,0x8A,0x12}}, - {{0x45,0x1C,0x20,0x3F,0xFF,0xB8,0x23,0x0A,0x07,0x14,0x8A,0x12}}, - {{0x49,0x1C,0x40,0x7F,0xFF,0xAD,0x23,0x0A,0x07,0xF3,0x8A,0x12}}, - {{0x4C,0x1C,0x18,0x2F,0xFF,0xBD,0x23,0x0A,0x07,0x23,0x8A,0x12}}, - {{0x48,0x1C,0x15,0x29,0xFF,0xBD,0x23,0x0A,0x07,0x23,0x8A,0x12}} -}; - -static const SiS_Part2PortTblStruct SiS310_CRT2Part2_Compaq1280x1024_2[] = -{ - {{0x2B,0x12,0xD9,0xE5,0xD5,0x2C,0x23,0x98,0x27,0x3E,0x08,0x42}}, - {{0x22,0x12,0xC0,0xCC,0xBC,0x2C,0x23,0x98,0x27,0x3E,0x08,0x42}}, - {{0x2B,0x12,0xD9,0xE5,0xD5,0x2C,0x23,0x98,0x27,0x3E,0x08,0x42}}, - {{0x22,0x12,0xC0,0xCC,0xBC,0x2C,0x23,0x98,0x27,0x3E,0x08,0x42}}, - {{0x33,0x13,0x01,0x0D,0xFD,0x2C,0x23,0x98,0x27,0x3E,0x08,0x42}}, - {{0x3F,0x1B,0x3D,0x49,0x39,0x54,0x23,0xC0,0x27,0x66,0x30,0x42}}, - {{0x33,0x1B,0x91,0x9D,0x8D,0x8C,0x23,0xF8,0x27,0x9E,0x68,0x42}}, - {{0x43,0x24,0x11,0x1D,0x0D,0xCC,0x23,0x38,0x37,0xDE,0xA8,0x42}}, - {{0x43,0x24,0x21,0x29,0x19,0xEA,0x23,0x0A,0x07,0x32,0xC6,0x42}} -}; - -static const SiS_Part2PortTblStruct SiS310_CRT2Part2_Compaq1280x1024_3[] = -{ - {{0x47,0x1C,0x14,0x29,0xFF,0xBD,0x23,0x0A,0x07,0x23,0x8A,0x12}}, - {{0x47,0x1C,0x14,0x29,0xFF,0xBD,0x23,0x0A,0x07,0x23,0x8A,0x12}}, - {{0x47,0x1C,0x14,0x29,0xFF,0xBD,0x23,0x0A,0x07,0x23,0x8A,0x12}}, - {{0x47,0x1C,0x14,0x29,0xFF,0xBD,0x23,0x0A,0x07,0x23,0x8A,0x12}}, - {{0x47,0x1C,0x14,0x29,0xFF,0xBE,0x23,0x0A,0x07,0x26,0x8A,0x42}}, - {{0x47,0x1C,0x14,0x29,0xFF,0xBE,0x23,0x0A,0x07,0x26,0x8A,0x42}}, - {{0x47,0x1C,0x14,0x29,0xFF,0xBE,0x23,0x0A,0x07,0x26,0x8A,0x42}}, - {{0x47,0x1C,0x14,0x29,0xFF,0xBE,0x23,0x0A,0x07,0x26,0x8A,0x42}} -}; - -/* LCDA CRT2 data is std */ +/* Asus A2xxxH _2 */ -static const SiS_LVDSDesStruct Compaq1280x1024Des_1[] = +static const SiS_Part2PortTblStruct SiS310_CRT2Part2_Asus1024x768_3[] = { - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 } -}; - -static const SiS_LVDSDesStruct Compaq1280x1024Des_2[] = -{ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 } -}; - -/* Clevo L285/287 (dual-link 1024x768) */ - -static const SiS_Part2PortTblStruct SiS310_CRT2Part2_Clevo1024x768_1[] = -{ - {{0x25,0x12,0xC9,0xDC,0xB6,0x59,0x45,0x09,0x07,0xF9,0x09,0x24}}, - {{0x2C,0x12,0x9A,0xAE,0x88,0x59,0x45,0x09,0x07,0xF9,0x09,0x24}}, - {{0x25,0x12,0xC9,0xDC,0xB6,0x59,0x45,0x09,0x07,0xF9,0x09,0x24}}, + {{0x25,0x13,0xc9,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x2c,0x13,0x9a,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x25,0x13,0xc9,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x38,0x13,0x16,0x0C,0xE6,0x59,0x45,0x09,0x07,0xF9,0x09,0x24}}, - {{0x38,0x18,0x16,0x00,0x00,0x59,0x45,0x09,0x07,0xF9,0x09,0x24}}, - {{0x36,0x13,0x13,0x25,0xFF,0x59,0x45,0x09,0x07,0xF9,0x09,0x24}}, + {{0x38,0x13,0x13,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}}, + {{0x38,0x13,0x16,0x25,0xff,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x36,0x13,0x13,0x25,0xff,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x25,0x12,0xC9,0xDC,0xB6,0x59,0x45,0x09,0x07,0xF9,0x09,0x24}} + {{0x25,0x13,0xc9,0x25,0xff,0x59,0x45,0x09,0x07,0xf9,0x09,0x24}} }; -static const SiS_Part2PortTblStruct SiS310_CRT2Part2_Clevo1024x768_2[] = -{ - {{0x25,0x12,0x51,0x6E,0x48,0xCC,0x12,0x89,0x47,0x1C,0x49,0x33}}, - {{0x2C,0x12,0x38,0x55,0x2F,0xCC,0x12,0x89,0x47,0x1C,0x49,0x33}}, - {{0x25,0x12,0x51,0x6E,0x48,0xCC,0x12,0x89,0x47,0x1C,0x49,0x33}}, - {{0x2C,0x12,0x38,0x55,0x2F,0xE0,0x12,0xB1,0x47,0x30,0x71,0x33}}, - {{0x2D,0x12,0x79,0x96,0x70,0xCC,0x12,0x89,0x47,0x1C,0x49,0x33}}, - {{0x29,0x12,0xB5,0xD2,0xAC,0xF4,0x12,0xD9,0x47,0x44,0x99,0x33}}, - {{0x36,0x13,0x13,0x25,0xFF,0x32,0x22,0x0A,0x07,0x82,0x0A,0x12}}, -#if 0 - {{0x25,0x12,0x51,0x6E,0x48,0x99,0x35,0x89,0x47,0xC1,0x49,0x33}}, - {{0x2C,0x12,0x38,0x55,0x2F,0x99,0x35,0x89,0x47,0xC1,0x49,0x33}}, - {{0x25,0x12,0x51,0x6E,0x48,0x99,0x35,0x89,0x47,0xC1,0x49,0x33}}, - {{0x2C,0x12,0x38,0x55,0x2F,0xC1,0x35,0xB1,0x47,0xE9,0x71,0x33}}, - {{0x2D,0x12,0x79,0x96,0x70,0x99,0x35,0x89,0x47,0xC1,0x49,0x33}}, - {{0x29,0x12,0xB5,0xD2,0xAC,0xE9,0x35,0xD9,0x47,0x11,0x99,0x33}}, - {{0x36,0x13,0x13,0x25,0xFF,0x59,0x45,0x09,0x07,0xF9,0x09,0x24}} -#endif -}; - -static const SiS_Part2PortTblStruct SiS310_CRT2Part2_Clevo1024x768_3[] = -{ - {{0x36,0x13,0x13,0x25,0xFF,0x32,0x22,0x0A,0x07,0x82,0x0A,0x12}}, /* Corrected */ - {{0x36,0x13,0x13,0x25,0xFF,0x32,0x22,0x0A,0x07,0x82,0x0A,0x12}}, - {{0x36,0x13,0x13,0x25,0xFF,0x32,0x22,0x0A,0x07,0x82,0x0A,0x12}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x36,0x13,0x13,0x25,0xFF,0x32,0x22,0x0A,0x07,0x82,0x0A,0x12}}, - {{0x36,0x13,0x13,0x25,0xFF,0x32,0x22,0x0A,0x07,0x82,0x0A,0x12}}, - {{0x36,0x13,0x13,0x25,0xFF,0x32,0x22,0x0A,0x07,0x82,0x0A,0x12}}, - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}, - {{0x25,0x13,0xC9,0x25,0xFF,0x59,0x45,0x09,0x07,0xF9,0x09,0x24}} -}; -/* CRT2 data is std */ - -static const SiS_LVDSDesStruct Clevo1024x768Des_1[] = -{ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 } -}; - -static const SiS_LVDSDesStruct Clevo1024x768Des_2[] = -{ - { 1184, 622 }, - { 1184, 597 }, - { 1184, 622 }, - { 1184, 597 }, - { 1152, 622 }, - { 1232, 722 }, - { 0, 0 } -}; - -/* Uniwill N243S9, ECS A928 */ - -static const SiS_LVDSDesStruct Uniwill1024x768Des_1[] = -{ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 805 } -}; - -static const SiS_LVDSDesStruct Uniwill1024x768Des_2[] = -{ - { 1184, 622 }, - { 1184, 597 }, - { 1184, 622 }, - { 1184, 597 }, - { 1152, 650 }, - { 1232, 722 }, - { 0, 805 }, -}; diff --git a/src/osdef.h b/src/osdef.h index 7e6f472..663b976 100644 --- a/src/osdef.h +++ b/src/osdef.h @@ -1,94 +1,126 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/osdef.h,v 1.5 2003/10/30 18:53:42 twini Exp $ */ - -/* OS depending defines */ +/* $XFree86$ */ +/* + * OS depending defines + * + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * + * If distributed as part of the Linux kernel, the following license terms + * apply: + * + * * This program is free software; you can redistribute it and/or modify + * * it under the terms of the GNU General Public License as published by + * * the Free Software Foundation; either version 2 of the named License, + * * or any later version. + * * + * * This program is distributed in the hope that it will be useful, + * * but WITHOUT ANY WARRANTY; without even the implied warranty of + * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * * GNU General Public License for more details. + * * + * * You should have received a copy of the GNU General Public License + * * along with this program; if not, write to the Free Software + * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA + * + * Otherwise, the following license terms apply: + * + * * 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. + * * + * * 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. + * + * Author: Thomas Winischhofer <thomas@winischhofer.net> + * Silicon Integrated Systems, Inc. (used by permission) + * + */ /* The choices are: */ /* #define LINUX_KERNEL */ /* Kernel framebuffer */ #define LINUX_XF86 /* XFree86 */ -/**********************************************************************/ -#ifdef LINUX_KERNEL /* ----------------------------*/ -#include <linux/config.h> - -#ifdef CONFIG_FB_SIS_300 -#define SIS300 -#endif - -#ifdef CONFIG_FB_SIS_315 -#define SIS315H -#endif - -#if 1 -#define SISFBACCEL /* Include 2D acceleration */ -#endif - -#endif - -#ifdef LINUX_XF86 /* ----------------------------- */ -#define SIS300 -#define SIS315H -#endif - -/**********************************************************************/ -#ifdef LINUX_KERNEL -#define SiS_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize) -#define SiS_MemoryCopy(Destination,Soruce,Length) memcpy(Destination,Soruce,Length) -#endif - -#ifdef LINUX_XF86 -#define SiS_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize) -#define SiS_MemoryCopy(Destination,Soruce,Length) memcpy(Destination,Soruce,Length) -#endif - -/**********************************************************************/ - #ifdef OutPortByte #undef OutPortByte -#endif /* OutPortByte */ +#endif #ifdef OutPortWord #undef OutPortWord -#endif /* OutPortWord */ +#endif #ifdef OutPortLong #undef OutPortLong -#endif /* OutPortLong */ +#endif #ifdef InPortByte #undef InPortByte -#endif /* InPortByte */ +#endif #ifdef InPortWord #undef InPortWord -#endif /* InPortWord */ +#endif #ifdef InPortLong #undef InPortLong -#endif /* InPortLong */ +#endif /**********************************************************************/ /* LINUX KERNEL */ /**********************************************************************/ #ifdef LINUX_KERNEL -#define OutPortByte(p,v) outb((u8)(v),(u16)(p)) -#define OutPortWord(p,v) outw((u16)(v),(u16)(p)) -#define OutPortLong(p,v) outl((u32)(v),(u16)(p)) -#define InPortByte(p) inb((u16)(p)) -#define InPortWord(p) inw((u16)(p)) -#define InPortLong(p) inl((u16)(p)) +#include <linux/config.h> +#include <linux/version.h> + +#ifdef CONFIG_FB_SIS_300 +#define SIS300 +#endif + +#ifdef CONFIG_FB_SIS_315 +#define SIS315H +#endif + +#if 1 +#define SISFBACCEL /* Include 2D acceleration */ +#endif + +#define OutPortByte(p,v) outb((u8)(v),(IOADDRESS)(p)) +#define OutPortWord(p,v) outw((u16)(v),(IOADDRESS)(p)) +#define OutPortLong(p,v) outl((u32)(v),(IOADDRESS)(p)) +#define InPortByte(p) inb((IOADDRESS)(p)) +#define InPortWord(p) inw((IOADDRESS)(p)) +#define InPortLong(p) inl((IOADDRESS)(p)) +#define SiS_SetMemory(MemoryAddress,MemorySize,value) memset_io(MemoryAddress, value, MemorySize) #endif /**********************************************************************/ -/* LINUX XF86 */ +/* XFree86 */ /**********************************************************************/ #ifdef LINUX_XF86 +#define SIS300 +#define SIS315H + #define OutPortByte(p,v) outb((IOADDRESS)(p),(CARD8)(v)) #define OutPortWord(p,v) outw((IOADDRESS)(p),(CARD16)(v)) #define OutPortLong(p,v) outl((IOADDRESS)(p),(CARD32)(v)) #define InPortByte(p) inb((IOADDRESS)(p)) #define InPortWord(p) inw((IOADDRESS)(p)) #define InPortLong(p) inl((IOADDRESS)(p)) +#define SiS_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize) #endif @@ -1,46 +1,51 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h,v 1.88 2003/11/20 19:53:23 twini Exp $ */ +/* $XFree86$ */ /* * 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 11 -#define SISDRIVERVERSIONDAY 19 +#define SISDRIVERVERSIONYEAR 4 +#define SISDRIVERVERSIONMONTH 2 +#define SISDRIVERVERSIONDAY 26 #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 */ @@ -107,6 +112,10 @@ #define SIS_ARGB_CURSOR #endif +#if 1 /* Include YPbPr support on SiS bridges (315 series and 661/741/760) */ +#define ENABLE_YPBPR +#endif + #ifdef SISMERGED #ifdef SISXINERAMA #define NEED_REPLIES /* ? */ @@ -174,32 +183,28 @@ /* 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_CONEXANT 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,14 +214,35 @@ #define VB_301LV 0x04000000 #define VB_302LV 0x08000000 #define VB_301C 0x10000000 +#define SINGLE_MODE 0x20000000 /* CRT1 or CRT2; determined by DISPTYPE_CRTx */ +#define MIRROR_MODE 0x40000000 /* CRT1 + CRT2 identical (mirror mode) */ +#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 SINGLE_MODE 0x20000000 /* CRT1 or CRT2; determined by DISPTYPE_CRTx */ +#define VB_VIDEOBRIDGE (VB_SISBRIDGE | VB_LVDS | VB_CHRONTEL | VB_CONEXANT) + +#define DISPTYPE_DISP2 CRT2_ENABLE +#define DISPTYPE_DISP1 DISPTYPE_CRT1 #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) */ #define VB_DISPMODE_DUAL DUALVIEW_MODE /* alias */ #define DISPLAY_MODE (SINGLE_MODE | MIRROR_MODE | DUALVIEW_MODE) @@ -237,6 +263,9 @@ #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 @@ -250,6 +279,7 @@ #define MISC_CRT1OVERLAY 0x00000001 /* Current display mode supports overlay */ #define MISC_PANELLINKSCALER 0x00000002 /* Panel link is currently scaling */ #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 @@ -329,7 +359,7 @@ typedef unsigned char UChar; #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_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 */ @@ -348,18 +378,31 @@ typedef unsigned char UChar; #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_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 /* + NTSC-J */ -#define SiS_CF2_TVPALM 0x20 -#define SiS_CF2_TVPALN 0x40 -#define SiS_CF2_CRT1LCDA 0x80 +#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 @@ -379,7 +422,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]; @@ -455,7 +498,6 @@ typedef struct { int OptTVSOver; int OptROMUsage; int OptUseOEM; - int PDC; Bool NoAccel; int forceCRT1; int DSTN, FSTN; @@ -493,16 +535,17 @@ typedef struct { int sistvyfilter; int tvxpos, tvypos; int tvxscale, tvyscale; - int ForceTVType; + int ForceTVType, SenseYPbPr; + unsigned long ForceYPbPrType, ForceYPbPrAR; int chtvtype; 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, CRT1gammaGiven, CRT2gamma, XvGamma, XvGammaGiven; @@ -510,13 +553,16 @@ typedef struct { 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_CP SIS_CP_H_ENT #endif @@ -593,13 +639,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; @@ -792,24 +839,28 @@ 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; + unsigned char sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33; + int EMI; int NoYV12; /* Disable Xv YV12 support (old series) */ unsigned char postVBCR32; int newFastVram; /* Replaces FastVram */ - int ForceTVType; + 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; @@ -825,7 +876,7 @@ typedef struct { 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; - Atom xv_BRR2, xv_BRG2, xv_BRB2, xv_PBR2, xv_PBG2, xv_PBB2; + Atom xv_BRR2, xv_BRG2, xv_BRB2, xv_PBR2, xv_PBG2, xv_PBB2, xv_PMD; #ifdef TWDEBUG Atom xv_STR; #endif @@ -859,7 +910,7 @@ typedef struct { BOOLEAN disablecolorkeycurrent; CARD32 colorKey; CARD32 MiscFlags; - int UsePanelScaler; + int UsePanelScaler, CenterLCD; FBLinearPtr AccelLinearScratch; void (*AccelRenderCallback)(ScrnInfoPtr); float zClearVal; @@ -877,6 +928,10 @@ typedef struct { int GammaPBriR, GammaPBriG, GammaPBriB; Bool HideHWCursor; /* Custom application */ Bool HWCursorIsVisible; + unsigned long HWCursorBackup[16]; + int HWCursorMBufNum, HWCursorCBufNum; + unsigned long mmioSize; + BOOLEAN ROM661New; #ifdef SISMERGED Bool MergedFB, MergedFBAuto; SiSScrn2Rel CRT2Position; @@ -1060,7 +1115,7 @@ 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, +extern int SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned short index, Bool quiet); extern Bool SISSwitchCRT1Status(ScrnInfoPtr pScrn, int onoff); extern int SiS_GetCHTVlumabandwidthcvbs(ScrnInfoPtr pScrn); diff --git a/src/sis300_accel.c b/src/sis300_accel.c index ee374d2..568fe63 100644 --- a/src/sis300_accel.c +++ b/src/sis300_accel.c @@ -1,32 +1,33 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c,v 1.23 2003/10/30 18:53:42 twini Exp $ */ +/* $XFree86$ */ /* - * 2D Acceleration for SiS300, SiS540, SiS630, SiS730, SiS530, SiS620 + * 2D Acceleration for SiS 530, 620, 300, 540, 630, 730. * - * Copyright Xavier Ducoin <x.ducoin@lectra.com> - * 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: - * - * Xavier Ducoin <x.ducoin@lectra.com> - * Thomas Winischhofer <thomas@winischhofer.net> + * Authors: Thomas Winischhofer <thomas@winischhofer.net> + * Can-Ru Yeou, SiS Inc. * */ @@ -42,6 +43,7 @@ #include "compiler.h" #include "xaa.h" #include "xaalocal.h" +#include "xaarop.h" #include "sis.h" #include "sis300_accel.h" @@ -371,46 +373,6 @@ SiSRestoreAccelState(ScrnInfoPtr pScrn) } #endif -static const int sisALUConv[] = -{ - 0x00, /* dest = 0; 0, GXclear, 0 */ - 0x88, /* dest &= src; DSa, GXand, 0x1 */ - 0x44, /* dest = src & ~dest; SDna, GXandReverse, 0x2 */ - 0xCC, /* dest = src; S, GXcopy, 0x3 */ - 0x22, /* dest &= ~src; DSna, GXandInverted, 0x4 */ - 0xAA, /* dest = dest; D, GXnoop, 0x5 */ - 0x66, /* dest = ^src; DSx, GXxor, 0x6 */ - 0xEE, /* dest |= src; DSo, GXor, 0x7 */ - 0x11, /* dest = ~src & ~dest; DSon, GXnor, 0x8 */ - 0x99, /* dest ^= ~src ; DSxn, GXequiv, 0x9 */ - 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */ - 0xDD, /* dest = src|~dest ; SDno, GXorReverse, 0xB */ - 0x33, /* dest = ~src; Sn, GXcopyInverted, 0xC */ - 0xBB, /* dest |= ~src; DSno, GXorInverted, 0xD */ - 0x77, /* dest = ~src|~dest; DSan, GXnand, 0xE */ - 0xFF, /* dest = 0xFF; 1, GXset, 0xF */ -}; -/* same ROP but with Pattern as Source */ -static const int sisPatALUConv[] = -{ - 0x00, /* dest = 0; 0, GXclear, 0 */ - 0xA0, /* dest &= src; DPa, GXand, 0x1 */ - 0x50, /* dest = src & ~dest; PDna, GXandReverse, 0x2 */ - 0xF0, /* dest = src; P, GXcopy, 0x3 */ - 0x0A, /* dest &= ~src; DPna, GXandInverted, 0x4 */ - 0xAA, /* dest = dest; D, GXnoop, 0x5 */ - 0x5A, /* dest = ^src; DPx, GXxor, 0x6 */ - 0xFA, /* dest |= src; DPo, GXor, 0x7 */ - 0x05, /* dest = ~src & ~dest; DPon, GXnor, 0x8 */ - 0xA5, /* dest ^= ~src ; DPxn, GXequiv, 0x9 */ - 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */ - 0xF5, /* dest = src|~dest ; PDno, GXorReverse, 0xB */ - 0x0F, /* dest = ~src; Pn, GXcopyInverted, 0xC */ - 0xAF, /* dest |= ~src; DPno, GXorInverted, 0xD */ - 0x5F, /* dest = ~src|~dest; DPan, GXnand, 0xE */ - 0xFF, /* dest = 0xFF; 1, GXset, 0xF */ -}; - static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, unsigned int planemask, int trans_color) @@ -429,7 +391,7 @@ static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, SiSSetupSRCTrans(trans_color) SiSSetupCMDFlag(TRANSPARENT_BITBLT) } else { - SiSSetupROP(sisALUConv[rop]) + SiSSetupROP(XAACopyROP[rop]) } if(xdir > 0) { SiSSetupCMDFlag(X_INC) @@ -499,7 +461,7 @@ SiSSetupForSolidFill(ScrnInfoPtr pScrn, SiSSetupPATFG(color) SiSSetupDSTRect(pSiS->scrnOffset, -1) SiSSetupDSTColorDepth(pSiS->DstColor); - SiSSetupROP(sisPatALUConv[rop]) + SiSSetupROP(XAAPatternROP[rop]) /* SiSSetupCMDFlag(PATFG) - is zero */ } @@ -657,7 +619,7 @@ SiSSetupForSolidLine(ScrnInfoPtr pScrn, SiSSetupPATFG(color) SiSSetupDSTRect(pSiS->scrnOffset, -1) SiSSetupDSTColorDepth(pSiS->DstColor); - SiSSetupROP(sisPatALUConv[rop]) + SiSSetupROP(XAAPatternROP[rop]) SiSSetupCMDFlag(PATFG | LINE) } @@ -746,7 +708,7 @@ SiSSetupForDashedLine(ScrnInfoPtr pScrn, SiSSetupStyleLow(*pattern) SiSSetupStyleHigh(*(pattern+4)) SiSSetupStylePeriod(length-1); - SiSSetupROP(sisPatALUConv[rop]) + SiSSetupROP(XAAPatternROP[rop]) SiSSetupPATFG(fg) SiSSetupCMDFlag(LINE | LINE_STYLE) if(bg != -1) { @@ -806,7 +768,7 @@ SiSSetupForMonoPatternFill(ScrnInfoPtr pScrn, SiSSetupDSTColorDepth(pSiS->DstColor); SiSSetupMONOPAT(patx,paty) SiSSetupPATFG(fg) - SiSSetupROP(sisPatALUConv[rop]) + SiSSetupROP(XAAPatternROP[rop]) SiSSetupCMDFlag(PATMONO) if(bg != -1) { SiSSetupPATBG(bg) @@ -940,7 +902,7 @@ SiSSetupForCPUToScreenColorExpand(ScrnInfoPtr pScrn, SiSSetupDSTColorDepth(pSiS->DstColor); SiSSetupSRCXY(0,0) SiSSetupSRCFG(fg) - SiSSetupROP(sisPatALUConv[rop]) + SiSSetupROP(XAAPatternROP[rop]) SiSSetupCMDFlag(X_INC | Y_INC | COLOREXP) if(bg == -1) { SiSSetupCMDFlag(TRANSPARENT) @@ -992,7 +954,7 @@ SiSSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn, SiSSetupDSTColorDepth(pSiS->DstColor) SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupROP(sisALUConv[rop]) + SiSSetupROP(XAACopyROP[rop]) SiSSetupSRCFG(fg) /* SiSSetupSRCXY(0,0) */ @@ -1158,7 +1120,7 @@ SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, while((MMIO_IN16(pSiS->IOBase, 0x8242) & 0x1F00) != 0) {} /* WDR: == 0x10 */ SiSSetupSRCXY(0,0); - SiSSetupROP(sisALUConv[rop]); + SiSSetupROP(XAACopyROP[rop]); SiSSetupSRCFG(fg); SiSSetupDSTRect(pSiS->scrnOffset, -1); SiSSetupDSTColorDepth(pSiS->DstColor); diff --git a/src/sis300_accel.h b/src/sis300_accel.h index e787005..e33fdbe 100644 --- a/src/sis300_accel.h +++ b/src/sis300_accel.h @@ -1,33 +1,34 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h,v 1.16 2003/11/03 17:02:52 twini Exp $ */ +/* $XFree86$ */ /* - * 2D Acceleration for SiS300, SiS540, SiS630, SiS730, SiS530, SiS620 + * 2D Acceleration for SiS 530, 620, 300, 540, 630, 730. * Definitions for the SIS engine communication * - * Copyright Xavier Ducoin <x.ducoin@lectra.com> - * 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: - * - * Xavier Ducoin <x.ducoin@lectra.com> - * Thomas Winischhofer <thomas@winischhofer.net> + * Authors: Thomas Winischhofer <thomas@winischhofer.net> + * Can-Ru Yeou, SiS Inc. (code base) * */ diff --git a/src/sis310_accel.c b/src/sis310_accel.c index 5db2d82..4f26e06 100644 --- a/src/sis310_accel.c +++ b/src/sis310_accel.c @@ -1,33 +1,36 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.c,v 1.32 2003/11/06 19:10:01 twini Exp $ */ +/* $XFree86$ */ /* * 2D Acceleration for SiS 315 and 330 series - * (315/550/650/740/M650/651/652/M652/330/660/661/M661/741/M741/760/M760) * - * 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. * - * Based on sis300_accel.c - * 2003/08/18: Rewritten for using VRAM command queue (TW) * * Author: Thomas Winischhofer <thomas@winischhofer.net> * + * 2003/08/18: Rewritten for using VRAM command queue + * */ #include "xf86.h" @@ -38,6 +41,7 @@ #include "compiler.h" #include "xaa.h" #include "xaalocal.h" +#include "xaarop.h" #include "sis.h" #include "sis310_accel.h" @@ -183,9 +187,9 @@ extern void SiSSubsequentCPUToScreenTexture(ScrnInfoPtr pScrn, int width, int height); extern CARD32 SiSAlphaTextureFormats[2]; -extern CARD32 SiSTextureFormats[2]; -CARD32 SiSAlphaTextureFormats[2] = { PICT_a8, 0 }; -CARD32 SiSTextureFormats[2] = { PICT_a8r8g8b8, 0 }; +extern CARD32 SiSTextureFormats[2]; +CARD32 SiSAlphaTextureFormats[2] = { PICT_a8 , 0 }; +CARD32 SiSTextureFormats[2] = { PICT_a8r8g8b8, 0 }; #endif #endif @@ -410,8 +414,7 @@ SiS315AccelInit(ScreenPtr pScreen) infoPtr->SetupForCPUToScreenAlphaTexture = SiSSetupForCPUToScreenAlphaTexture; infoPtr->SubsequentCPUToScreenAlphaTexture = SiSSubsequentCPUToScreenTexture; infoPtr->CPUToScreenAlphaTextureFormats = SiSAlphaTextureFormats; - infoPtr->CPUToScreenAlphaTextureFlags = XAA_RENDER_NO_TILE | - XAA_RENDER_NO_SRC_ALPHA; + infoPtr->CPUToScreenAlphaTextureFlags = XAA_RENDER_NO_TILE; infoPtr->SetupForCPUToScreenTexture = SiSSetupForCPUToScreenTexture; infoPtr->SubsequentCPUToScreenTexture = SiSSubsequentCPUToScreenTexture; @@ -522,47 +525,6 @@ SiSRestoreAccelState(ScrnInfoPtr pScrn) } #endif -static const int sisALUConv[] = -{ - 0x00, /* dest = 0; 0, GXclear, 0 */ - 0x88, /* dest &= src; DSa, GXand, 0x1 */ - 0x44, /* dest = src & ~dest; SDna, GXandReverse, 0x2 */ - 0xCC, /* dest = src; S, GXcopy, 0x3 */ - 0x22, /* dest &= ~src; DSna, GXandInverted, 0x4 */ - 0xAA, /* dest = dest; D, GXnoop, 0x5 */ - 0x66, /* dest = ^src; DSx, GXxor, 0x6 */ - 0xEE, /* dest |= src; DSo, GXor, 0x7 */ - 0x11, /* dest = ~src & ~dest; DSon, GXnor, 0x8 */ - 0x99, /* dest ^= ~src ; DSxn, GXequiv, 0x9 */ - 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */ - 0xDD, /* dest = src|~dest ; SDno, GXorReverse, 0xB */ - 0x33, /* dest = ~src; Sn, GXcopyInverted, 0xC */ - 0xBB, /* dest |= ~src; DSno, GXorInverted, 0xD */ - 0x77, /* dest = ~src|~dest; DSan, GXnand, 0xE */ - 0xFF, /* dest = 0xFF; 1, GXset, 0xF */ -}; - -/* same ROP but with Pattern as Source */ -static const int sisPatALUConv[] = -{ - 0x00, /* dest = 0; 0, GXclear, 0 */ - 0xA0, /* dest &= src; DPa, GXand, 0x1 */ - 0x50, /* dest = src & ~dest; PDna, GXandReverse, 0x2 */ - 0xF0, /* dest = src; P, GXcopy, 0x3 */ - 0x0A, /* dest &= ~src; DPna, GXandInverted, 0x4 */ - 0xAA, /* dest = dest; D, GXnoop, 0x5 */ - 0x5A, /* dest = ^src; DPx, GXxor, 0x6 */ - 0xFA, /* dest |= src; DPo, GXor, 0x7 */ - 0x05, /* dest = ~src & ~dest; DPon, GXnor, 0x8 */ - 0xA5, /* dest ^= ~src ; DPxn, GXequiv, 0x9 */ - 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */ - 0xF5, /* dest = src|~dest ; PDno, GXorReverse, 0xB */ - 0x0F, /* dest = ~src; Pn, GXcopyInverted, 0xC */ - 0xAF, /* dest |= ~src; DPno, GXorInverted, 0xD */ - 0x5F, /* dest = ~src|~dest; DPan, GXnand, 0xE */ - 0xFF, /* dest = 0xFF; 1, GXset, 0xF */ -}; - static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, unsigned int planemask, int trans_color) @@ -587,7 +549,7 @@ static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, SiSSetupSRCTrans(trans_color) SiSSetupCMDFlag(TRANSPARENT_BITBLT) } else { - SiSSetupROP(sisALUConv[rop]) + SiSSetupROP(XAACopyROP[rop]) /* Set command - not needed, both 0 */ /* SiSSetupCMDFlag(BITBLT | SRCVIDEO) */ } @@ -710,14 +672,14 @@ SiSSetupForSolidFill(ScrnInfoPtr pScrn, int color, SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth); SiSCheckQueue(16 * 1); SiSSetupPATFGDSTRect(color, pSiS->scrnOffset, -1) - SiSSetupROP(sisPatALUConv[rop]) + SiSSetupROP(XAAPatternROP[rop]) SiSSetupCMDFlag(PATFG) SiSSyncWP #else SiSSetupPATFG(color) SiSSetupDSTRect(pSiS->scrnOffset, -1) SiSSetupDSTColorDepth(pSiS->DstColor); - SiSSetupROP(sisPatALUConv[rop]) + SiSSetupROP(XAAPatternROP[rop]) SiSSetupCMDFlag(PATFG | pSiS->SiS310_AccelDepth) #endif } @@ -855,7 +817,7 @@ SiSSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, SiSCheckQueue(16 * 3); SiSSetupLineCountPeriod(1, 1) SiSSetupPATFGDSTRect(color, pSiS->scrnOffset, -1) - SiSSetupROP(sisPatALUConv[rop]) + SiSSetupROP(XAAPatternROP[rop]) SiSSetupCMDFlag(PATFG | LINE) SiSSyncWP #else @@ -863,7 +825,7 @@ SiSSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, SiSSetupPATFG(color) SiSSetupDSTRect(pSiS->scrnOffset, -1) SiSSetupDSTColorDepth(pSiS->DstColor) - SiSSetupROP(sisPatALUConv[rop]) + SiSSetupROP(XAAPatternROP[rop]) SiSSetupCMDFlag(PATFG | LINE | pSiS->SiS310_AccelDepth) #endif } @@ -974,7 +936,7 @@ SiSSetupForDashedLine(ScrnInfoPtr pScrn, SiSSetupPATFG(fg) #endif - SiSSetupROP(sisPatALUConv[rop]) + SiSSetupROP(XAAPatternROP[rop]) SiSSetupCMDFlag(LINE | LINE_STYLE) @@ -1054,7 +1016,7 @@ SiSSetupForMonoPatternFill(ScrnInfoPtr pScrn, SiSSetupMONOPAT(patx,paty) - SiSSetupROP(sisPatALUConv[rop]) + SiSSetupROP(XAAPatternROP[rop]) #ifdef SISVRAMQ SiSSetupCMDFlag(PATMONO) @@ -1213,7 +1175,7 @@ SiSSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, patadr += 16; /* = 64 due to (CARD32 *) */ } - SiSSetupROP(sisPatALUConv[rop]) + SiSSetupROP(XAAPatternROP[rop]) SiSSetupCMDFlag(PATPATREG) @@ -1272,7 +1234,7 @@ SiSSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, #ifdef SISVRAMQ SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth); - SiSSetupROP(sisALUConv[rop]); + SiSSetupROP(XAACopyROP[rop]); SiSSetupSRCFGDSTRect(fg, pSiS->scrnOffset, -1) if(bg == -1) { SiSSetupCMDFlag(TRANSPARENT | ENCOLOREXP | SRCVIDEO); @@ -1283,7 +1245,7 @@ SiSSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, SiSSyncWP #else SiSSetupSRCXY(0,0); - SiSSetupROP(sisALUConv[rop]); + SiSSetupROP(XAACopyROP[rop]); SiSSetupSRCFG(fg); SiSSetupDSTRect(pSiS->scrnOffset, -1); SiSSetupDSTColorDepth(pSiS->DstColor); @@ -1384,7 +1346,7 @@ SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, #endif SiSSetupSRCXY(0,0); - SiSSetupROP(sisALUConv[rop]); + SiSSetupROP(XAACopyROP[rop]); SiSSetupSRCFG(fg); SiSSetupDSTRect(pSiS->scrnOffset, -1); #ifndef SISVRAMQ @@ -1512,7 +1474,7 @@ SiSSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn, SiSSetupDSTColorDepth(pSiS->DstColor) #endif SiSSetupDSTRect(pSiS->scrnOffset, -1) - SiSSetupROP(sisALUConv[rop]) + SiSSetupROP(XAACopyROP[rop]) SiSSetupSRCFG(fg) /* SiSSetupSRCXY(0,0) */ @@ -1737,8 +1699,8 @@ SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn, unsigned char *renderaccelarray; #ifdef ACCELDEBUG - xf86DrvMsg(0, X_INFO, "AT: op %d RGB %x %x %x, w %d h %d A-pitch %d\n", - op, red, green, blue, width, height, alphaPitch); + xf86DrvMsg(0, X_INFO, "AT: op %d type %d ARGB %x %x %x %x, w %d h %d A-pitch %d\n", + op, alphaType, alpha, red, green, blue, width, height, alphaPitch); #endif if(op != PictOpOver) return FALSE; @@ -1749,16 +1711,16 @@ SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn, sizeNeeded = pitch * height; if(pScrn->bitsPerPixel == 16) sizeNeeded <<= 1; - red &= 0xff00; - green &= 0xff00; - blue &= 0xff00; - if(!((renderaccelarray = pSiS->RenderAccelArray))) return FALSE; if(!SiSAllocateLinear(pScrn, sizeNeeded)) return FALSE; + red &= 0xff00; + green &= 0xff00; + blue &= 0xff00; + #ifdef SISVRAMQ SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth); SiSSetupSRCPitchDSTRect((pitch << 2), pSiS->scrnOffset, -1); @@ -1782,17 +1744,38 @@ SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn, SiSIdle } - while(height--) { - for(x = 0; x < width; x++) { - myalpha = alphaPtr[x]; - dstPtr[x] = (renderaccelarray[red + myalpha] << 16) | - (renderaccelarray[green + myalpha] << 8) | - renderaccelarray[blue + myalpha] | - myalpha << 24; - } - dstPtr += pitch; - alphaPtr += alphaPitch; - } + + if(alpha == 0xffff) { + + while(height--) { + for(x = 0; x < width; x++) { + myalpha = alphaPtr[x]; + dstPtr[x] = (renderaccelarray[red + myalpha] << 16) | + (renderaccelarray[green + myalpha] << 8) | + renderaccelarray[blue + myalpha] | + myalpha << 24; + } + dstPtr += pitch; + alphaPtr += alphaPitch; + } + + } else { + + alpha &= 0xff00; + + while(height--) { + for(x = 0; x < width; x++) { + myalpha = alphaPtr[x]; + dstPtr[x] = (renderaccelarray[alpha + myalpha] << 24) | + (renderaccelarray[red + myalpha] << 16) | + (renderaccelarray[green + myalpha] << 8) | + renderaccelarray[blue + myalpha]; + } + dstPtr += pitch; + alphaPtr += alphaPitch; + } + + } return TRUE; } @@ -1869,8 +1852,7 @@ SiSSubsequentCPUToScreenTexture(ScrnInfoPtr pScrn, long srcbase, dstbase; srcbase = pSiS->AccelLinearScratch->offset << 1; - if(pScrn->bitsPerPixel == 32) - srcbase <<= 1; + if(pScrn->bitsPerPixel == 32) srcbase <<= 1; #ifdef ACCELDEBUG xf86DrvMsg(0, X_INFO, "FIRE: scrbase %x dx %d dy %d w %d h %d\n", diff --git a/src/sis310_accel.h b/src/sis310_accel.h index da85d67..d782cf5 100644 --- a/src/sis310_accel.h +++ b/src/sis310_accel.h @@ -1,33 +1,36 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.h,v 1.14 2003/10/30 18:53:42 twini Exp $ */ +/* $XFree86$ */ /* * 2D Acceleration for SiS 315 and Xabre series * Definitions for the SIS engine communication. * - * 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. - * - * Based on sis300_accel.h - * 2003/08/18: Added VRAM queue support + * 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. * * Author: Thomas Winischhofer <thomas@winischhofer.net> * + * 2003/08/18: Added VRAM queue support + * */ /* SiS315 and 330 engine commands */ diff --git a/src/sis6326_video.c b/src/sis6326_video.c index 15ee1eb..fa3b556 100644 --- a/src/sis6326_video.c +++ b/src/sis6326_video.c @@ -1,31 +1,33 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis6326_video.c,v 1.14 2003/11/11 18:04:30 twini Exp $ */ +/* $XFree86$ */ /* * Xv driver for SiS 5597/5598, 6236 and 530/620. * - * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria. + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria. * - * Based on sis_video.c which is - * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria. + * 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. * - * 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. - * - * 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. * * Author: Thomas Winischhofer <thomas@winischhofer.net> + * */ #include "sis.h" diff --git a/src/sis_accel.c b/src/sis_accel.c index 12ecb73..5a4488c 100644 --- a/src/sis_accel.c +++ b/src/sis_accel.c @@ -1,34 +1,36 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c,v 1.34 2003/11/03 17:02:52 twini Exp $ */ +/* $XFree86$ */ /* * 2D acceleration for SiS5597/5598 and 6326 * - * Copyright 1998,1999 by Alan Hourihane, Wigan, England. - * Parts Copyright 2002-2003 Thomas Winischhofer, Vienna, Austria. + * Copyright (C) 1998, 1999 by Alan Hourihane, Wigan, England. + * Parts Copyright (C) 2001-2004 Thomas Winischhofer, Vienna, Austria. + * + * Licensed under the following terms: * * 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 + * the above copyright notice appears in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * 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. + * "as is" without expressed or implied warranty. * * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * 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. * - * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk + * Authors: Alan Hourihane <alanh@fairlite.demon.co.uk>, * Mike Chapman <mike@paranoia.com>, * Juanjo Santamarta <santamarta@ctv.es>, - * Mitani Hiroshi <hmitani@drl.mei.co.jp> - * David Thomas <davtom@dream.org.uk> - * Thomas Winischhofer <thomas@winischhofer.net> + * Mitani Hiroshi <hmitani@drl.mei.co.jp>, + * David Thomas <davtom@dream.org.uk>, + * Thomas Winischhofer <thomas@winischhofer.net>. */ #if 0 @@ -242,7 +244,7 @@ SiSSync(ScrnInfoPtr pScrn) { } /* Clipping */ -static void SiSSetClippingRectangle ( ScrnInfoPtr pScrn, +static void SiSSetClippingRectangle( ScrnInfoPtr pScrn, int left, int top, int right, int bottom) { SISPtr pSiS = SISPTR(pScrn); @@ -253,54 +255,12 @@ static void SiSSetClippingRectangle ( ScrnInfoPtr pScrn, pSiS->ClipEnabled = TRUE; } -static void SiSDisableClipping (ScrnInfoPtr pScrn) +static void SiSDisableClipping(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); pSiS->ClipEnabled = FALSE; } -#ifdef CTSCE -static const int sisALUConv[] = -{ - 0x00, /* dest = 0; 0, GXclear, 0 */ - 0x88, /* dest &= src; DSa, GXand, 0x1 */ - 0x44, /* dest = src & ~dest; SDna, GXandReverse, 0x2 */ - 0xCC, /* dest = src; S, GXcopy, 0x3 */ - 0x22, /* dest &= ~src; DSna, GXandInverted, 0x4 */ - 0xAA, /* dest = dest; D, GXnoop, 0x5 */ - 0x66, /* dest = ^src; DSx, GXxor, 0x6 */ - 0xEE, /* dest |= src; DSo, GXor, 0x7 */ - 0x11, /* dest = ~src & ~dest; DSon, GXnor, 0x8 */ - 0x99, /* dest ^= ~src ; DSxn, GXequiv, 0x9 */ - 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */ - 0xDD, /* dest = src|~dest ; SDno, GXorReverse, 0xB */ - 0x33, /* dest = ~src; Sn, GXcopyInverted, 0xC */ - 0xBB, /* dest |= ~src; DSno, GXorInverted, 0xD */ - 0x77, /* dest = ~src|~dest; DSan, GXnand, 0xE */ - 0xFF, /* dest = 0xFF; 1, GXset, 0xF */ -}; -/* same ROP but with Pattern as Source */ -static const int sisPatALUConv[] = -{ - 0x00, /* dest = 0; 0, GXclear, 0 */ - 0xA0, /* dest &= src; DPa, GXand, 0x1 */ - 0x50, /* dest = src & ~dest; PDna, GXandReverse, 0x2 */ - 0xF0, /* dest = src; P, GXcopy, 0x3 */ - 0x0A, /* dest &= ~src; DPna, GXandInverted, 0x4 */ - 0xAA, /* dest = dest; D, GXnoop, 0x5 */ - 0x5A, /* dest = ^src; DPx, GXxor, 0x6 */ - 0xFA, /* dest |= src; DPo, GXor, 0x7 */ - 0x05, /* dest = ~src & ~dest; DPon, GXnor, 0x8 */ - 0xA5, /* dest ^= ~src ; DPxn, GXequiv, 0x9 */ - 0x55, /* dest = ~dest; Dn, GXInvert, 0xA */ - 0xF5, /* dest = src|~dest ; PDno, GXorReverse, 0xB */ - 0x0F, /* dest = ~src; Pn, GXcopyInverted, 0xC */ - 0xAF, /* dest |= ~src; DPno, GXorInverted, 0xD */ - 0x5F, /* dest = ~src|~dest; DPan, GXnand, 0xE */ - 0xFF, /* dest = 0xFF; 1, GXset, 0xF */ -}; -#endif - /* Screen to screen copy */ static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, @@ -417,7 +377,7 @@ SiSSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, patternRegPtr = (unsigned int *)sisSETPATREG(); pSiS->sisPatternReg[0] = pSiS->sisPatternReg[2] = patternx ; pSiS->sisPatternReg[1] = pSiS->sisPatternReg[3] = patterny ; - for ( i = 0 ; i < 16 /* sisPatternHeight */ ; ) { + for( i = 0 ; i < 16 /* sisPatternHeight */ ; ) { patternRegPtr[i++] = patternx ; patternRegPtr[i++] = patterny ; } @@ -578,11 +538,11 @@ SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, sisSETROPBG(0xAA); /* dst = dst (=noop) */ pSiS->CommandReg |= sisSRCFG; } else { - sisSETBGROPCOL(sisPatALUConv[rop], bg); + sisSETBGROPCOL(XAAPatternROP[rop], bg); pSiS->CommandReg |= sisSRCFG | sisPATBG; } - sisSETFGROPCOL(sisALUConv[rop], fg); + sisSETFGROPCOL(XAACopyROP[rop], fg); sisSETDSTPITCH(pSiS->scrnOffset); } diff --git a/src/sis_accel.h b/src/sis_accel.h index a5c59b5..cf37d91 100644 --- a/src/sis_accel.h +++ b/src/sis_accel.h @@ -1,35 +1,37 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.h,v 1.9 2003/11/03 17:02:53 twini Exp $ */ +/* $XFree86$ */ /* * 2D acceleration for 5597/5598 and 6326 * Definitions for the SIS engine communication * - * Copyright 1998,1999 by Alan Hourihane, Wigan, England. - * Parts Copyright 2002,2003 Thomas Winischhofer, Vienna, Austria. + * Copyright (C) 1998, 1999 by Alan Hourihane, Wigan, England. + * Parts Copyright (C) 2001-2004 Thomas Winischhofer, Vienna, Austria. + * + * Licensed under the following terms: * * 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 + * the above copyright notice appears in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * 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. + * "as is" without expressed or implied warranty. * * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * 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. * - * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk + * Authors: Alan Hourihane <alanh@fairlite.demon.co.uk>, * Mike Chapman <mike@paranoia.com>, * Juanjo Santamarta <santamarta@ctv.es>, - * Mitani Hiroshi <hmitani@drl.mei.co.jp> - * David Thomas <davtom@dream.org.uk> - * Thomas Winischhofer <thomas@winischhofer.net> + * Mitani Hiroshi <hmitani@drl.mei.co.jp>, + * David Thomas <davtom@dream.org.uk>, + * Thomas Winischhofer <thomas@winischhofer.net>. */ @@ -130,29 +132,17 @@ const int sisReg32MMIO[] = { /* background color */ #define sisSETBGCOLOR(bgColor) \ MMIO_OUT32(pSiS->IOBase, BR(5), (bgColor)); -#if 0 - *(volatile unsigned int *)(pSiS->IOBase + BR(5)) = (bgColor) -#endif /* foreground color */ #define sisSETFGCOLOR(fgColor) \ MMIO_OUT32(pSiS->IOBase, BR(4), (fgcolor)); -#if 0 - *(volatile unsigned int *)(pSiS->IOBase + BR(4)) = (fgColor) -#endif /* ROP */ #define sisSETROPFG(op) \ MMIO_OUT8(pSiS->IOBase, BR(4) + 3, op); -#if 0 - *(volatile unsigned int *)(pSiS->IOBase + BR(4)) = ((*(volatile unsigned int *)(pSiS->IOBase + BR(4)))&0xffffff) | (op<<24) -#endif #define sisSETROPBG(op) \ MMIO_OUT8(pSiS->IOBase, BR(5) + 3, op); -#if 0 - *(volatile unsigned int *)(pSiS->IOBase + BR(5)) = ((*(volatile unsigned int *)(pSiS->IOBase + BR(5)))&0xffffff) | (op<<24) -#endif #define sisSETROP(op) \ sisSETROPFG(op); sisSETROPBG(op); @@ -160,23 +150,13 @@ const int sisReg32MMIO[] = { /* source and dest address */ #define sisSETSRCADDR(srcAddr) \ MMIO_OUT32(pSiS->IOBase, BR(0), (srcAddr & 0x3FFFFFL)); -#if 0 - *(volatile unsigned int *)(pSiS->IOBase + BR(0)) = srcAddr & 0x3FFFFFL -#endif #define sisSETDSTADDR(dstAddr) \ MMIO_OUT32(pSiS->IOBase, BR(1), (dstAddr & 0x3FFFFFL)); -#if 0 - *(volatile unsigned int *)(pSiS->IOBase + BR(1)) = dstAddr & 0x3FFFFFL -#endif /* pitch */ #define sisSETPITCH(srcPitch,dstPitch) \ MMIO_OUT32(pSiS->IOBase, BR(2), ((((dstPitch) & 0xFFFF) << 16) | ((srcPitch) & 0xFFFF))); -#if 0 - *(volatile unsigned int *)(pSiS->IOBase + BR(2)) = ((dstPitch&0xFFFF)<<16)| \ - (srcPitch&0xFFFF) -#endif #define sisSETSRCPITCH(srcPitch) \ MMIO_OUT16(pSiS->IOBase, BR(2), ((srcPitch) & 0xFFFF)); @@ -190,54 +170,26 @@ const int sisReg32MMIO[] = { */ #define sisSETHEIGHTWIDTH(Height, Width) \ MMIO_OUT32(pSiS->IOBase, BR(3), ((((Height) & 0xFFFF) << 16) | ((Width) & 0xFFFF))); -#if 0 - *(volatile unsigned int *)(pSiS->IOBase + BR(3)) = (((Height)&0xFFFF)<<16)| \ - ((Width)&0xFFFF) -#endif /* Clipping */ #define sisSETCLIPTOP(x, y) \ MMIO_OUT32(pSiS->IOBase, BR(8), ((((y) & 0xFFFF) << 16) | ((x) & 0xFFFF))); -#if 0 - *(volatile unsigned int *)(pSiS->IOBase + BR(8)) = (((y)&0xFFFF)<<16)| \ - ((x)&0xFFFF) -#endif #define sisSETCLIPBOTTOM(x, y) \ MMIO_OUT32(pSiS->IOBase, BR(9), ((((y) & 0xFFFF) << 16) | ((x) & 0xFFFF))); -#if 0 - *(volatile unsigned int *)(pSiS->IOBase + BR(9)) = (((y)&0xFFFF)<<16)| \ - ((x)&0xFFFF) -#endif /* Line drawing */ #define sisSETXStart(XStart) \ MMIO_OUT32(pSiS->IOBase, BR(0), ((XStart) & 0xFFFF)); -#if 0 - *(volatile unsigned int *)(pSiS->IOBase + BR(0)) = XStart&0xFFFF -#endif #define sisSETYStart(YStart) \ MMIO_OUT32(pSiS->IOBase, BR(1), ((YStart) & 0xFFFF)); -#if 0 - *(volatile unsigned int *)(pSiS->IOBase + BR(1)) = YStart&0xFFFF -#endif #define sisSETLineMajorCount(MajorAxisCount) \ MMIO_OUT32(pSiS->IOBase, BR(3), ((MajorAxisCount) & 0xFFFF)); -#if 0 - *(volatile unsigned int *)(pSiS->IOBase + BR(3)) = MajorAxisCount&0xFFFF -#endif #define sisSETLineSteps(K1,K2) \ MMIO_OUT32(pSiS->IOBase, BR(6), ((((K1) & 0xFFFF) << 16) | ((K2) & 0xFFFF))); -#if 0 - *(volatile unsigned int *)(pSiS->IOBase + BR(6)) = (((K1)&0xFFFF)<<16)| \ - ((K2)&0xFFFF) -#endif #define sisSETLineErrorTerm(ErrorTerm) \ MMIO_OUT16(pSiS->IOBase, BR(7), (ErrorTerm)); -#if 0 - *(volatile unsigned short *)(pSiS->IOBase + BR(7)) = ErrorTerm -#endif diff --git a/src/sis_common.h b/src/sis_common.h index c5db1e8..dbca0fd 100644 --- a/src/sis_common.h +++ b/src/sis_common.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_common.h,v 1.2 2003/10/30 18:53:42 twini Exp $ */ +/* $XFree86$ */ /* * Common header definitions for SiS 2D/3D/DRM suite * @@ -6,16 +6,16 @@ * * 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 + * the above copyright notice appears in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * 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. + * "as is" without expressed or implied warranty. * * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * 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 diff --git a/src/sis_cursor.c b/src/sis_cursor.c index 122493f..0ebb44d 100644 --- a/src/sis_cursor.c +++ b/src/sis_cursor.c @@ -1,34 +1,35 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c,v 1.22 2003/11/03 17:02:53 twini Exp $ */ +/* $XFree86$ */ /* * SiS hardware cursor handling * - * Copyright 1998,1999 by Alan Hourihane, Wigan, England. - * Copyright 2001, 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 holders not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. The copyright holders make 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 HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS 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. + * + * Author: Thomas Winischhofer <thomas@winischhofer.net> + * + * Idea based on code by Can-Ru Yeou, SiS Inc. * - * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk - * Mike Chapman <mike@paranoia.com>, - * Juanjo Santamarta <santamarta@ctv.es>, - * Mitani Hiroshi <hmitani@drl.mei.co.jp> - * David Thomas <davtom@dream.org.uk>. - * Thomas Winischhofer <thomas@winischhofer.net> */ #include "xf86.h" @@ -48,7 +49,6 @@ extern void SISWaitRetraceCRT1(ScrnInfoPtr pScrn); extern void SISWaitRetraceCRT2(ScrnInfoPtr pScrn); -extern Bool InRegion(int x, int y, region r); /* Helper function for Xabre to convert mono image to ARGB */ /* The Xabre's cursor engine for CRT2 is buggy and can't @@ -67,8 +67,6 @@ SiSXConvertMono2ARGB(SISPtr pSiS) if(!dest || !src) return; - if(pSiS->UseHWARGBCursor) return; - for(i = 0; i < 64; i++) { for(j = 0; j < 8; j++) { chunk = *(src + 8); mask = *src++; @@ -106,23 +104,23 @@ SiS300HideCursor(ScrnInfoPtr pScrn) #ifdef SISDUALHEAD if(pSiS->DualHeadMode && (!pSiS->ForceCursorOff)) { - if(pSiS->SecondHead) { - /* TW: Head 2 is always CRT1 */ - sis300DisableHWCursor() - sis300SetCursorPositionY(2000, 0) - } else { - /* TW: Head 1 is always CRT2 */ - sis301DisableHWCursor() - sis301SetCursorPositionY(2000, 0) - } + if(pSiS->SecondHead) { + /* Head 2 is always CRT1 */ + sis300DisableHWCursor() + sis300SetCursorPositionY(2000, 0) + } else { + /* Head 1 is always CRT2 */ + sis301DisableHWCursor() + sis301SetCursorPositionY(2000, 0) + } } else { #endif - sis300DisableHWCursor() - sis300SetCursorPositionY(2000, 0) - if(pSiS->VBFlags & CRT2_ENABLE) { - sis301DisableHWCursor() - sis301SetCursorPositionY(2000, 0) - } + sis300DisableHWCursor() + sis300SetCursorPositionY(2000, 0) + if(pSiS->VBFlags & CRT2_ENABLE) { + sis301DisableHWCursor() + sis301SetCursorPositionY(2000, 0) + } #ifdef SISDUALHEAD } #endif @@ -137,33 +135,23 @@ SiS310HideCursor(ScrnInfoPtr pScrn) #ifdef SISDUALHEAD if(pSiS->DualHeadMode && (!pSiS->ForceCursorOff)) { - if(pSiS->SecondHead) { - /* TW: Head 2 is always CRT1 */ - sis310DisableHWCursor() - sis310SetCursorPositionY(2000, 0) - } else { - /* TW: Head 1 is always CRT2 */ - if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { - sis301DisableHWCursor330() - sis301SetCursorPositionY330(2000, 0) - } else { - sis301DisableHWCursor310() - sis301SetCursorPositionY310(2000, 0) - } - } + if(pSiS->SecondHead) { + /* Head 2 is always CRT1 */ + sis310DisableHWCursor() + sis310SetCursorPositionY(2000, 0) + } else { + /* Head 1 is always CRT2 */ + sis301DisableHWCursor310() + sis301SetCursorPositionY310(2000, 0) + } } else { #endif - sis310DisableHWCursor() - sis310SetCursorPositionY(2000, 0) - if(pSiS->VBFlags & VB_VIDEOBRIDGE) { - if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { - sis301DisableHWCursor330() - sis301SetCursorPositionY330(2000, 0) - } else { - sis301DisableHWCursor310() - sis301SetCursorPositionY310(2000, 0) - } - } + sis310DisableHWCursor() + sis310SetCursorPositionY(2000, 0) + if(pSiS->VBFlags & VB_VIDEOBRIDGE) { + sis301DisableHWCursor310() + sis301SetCursorPositionY310(2000, 0) + } #ifdef SISDUALHEAD } #endif @@ -196,50 +184,50 @@ SiS300ShowCursor(ScrnInfoPtr pScrn) #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { - if(pSiS->SecondHead) { - /* TW: Head 2 is always CRT1 */ - if(pSiS->UseHWARGBCursor) { -#ifdef SIS300_USE_ARGB16 - sis300EnableHWARGB16Cursor() + if(pSiS->SecondHead) { + /* Head 2 is always CRT1 */ + if(pSiS->UseHWARGBCursor) { +#ifdef SIS300_USE_ARGB16 + sis300EnableHWARGB16Cursor() #else - sis300EnableHWARGBCursor() -#endif - } else { - sis300EnableHWCursor() - } - } else { - /* TW: Head 1 is always CRT2 */ - if(pSiS->UseHWARGBCursor) { -#ifdef SIS300_USE_ARGB16 - sis301EnableHWARGB16Cursor() + sis300EnableHWARGBCursor() +#endif + } else { + sis300EnableHWCursor() + } + } else { + /* Head 1 is always CRT2 */ + if(pSiS->UseHWARGBCursor) { +#ifdef SIS300_USE_ARGB16 + sis301EnableHWARGB16Cursor() #else - sis301EnableHWARGBCursor() -#endif - } else { - sis301EnableHWCursor() - } - } + sis301EnableHWARGBCursor() +#endif + } else { + sis301EnableHWCursor() + } + } } else { #endif - if(pSiS->UseHWARGBCursor) { + if(pSiS->UseHWARGBCursor) { #ifdef SIS300_USE_ARGB16 - sis300EnableHWARGB16Cursor() + sis300EnableHWARGB16Cursor() #else - sis300EnableHWARGBCursor() -#endif - if(pSiS->VBFlags & CRT2_ENABLE) { -#ifdef SIS300_USE_ARGB16 - sis301EnableHWARGB16Cursor() + sis300EnableHWARGBCursor() +#endif + if(pSiS->VBFlags & CRT2_ENABLE) { +#ifdef SIS300_USE_ARGB16 + sis301EnableHWARGB16Cursor() #else - sis301EnableHWARGBCursor() -#endif - } - } else { - sis300EnableHWCursor() - if(pSiS->VBFlags & CRT2_ENABLE) { - sis301EnableHWCursor() - } - } + sis301EnableHWARGBCursor() +#endif + } + } else { + sis300EnableHWCursor() + if(pSiS->VBFlags & CRT2_ENABLE) { + sis301EnableHWCursor() + } + } #ifdef SISDUALHEAD } #endif @@ -260,49 +248,49 @@ SiS310ShowCursor(ScrnInfoPtr pScrn) #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { - if(pSiS->SecondHead) { - /* TW: Head 2 is always CRT1 */ - if(pSiS->UseHWARGBCursor) { - sis310EnableHWARGBCursor() - } else { - sis310EnableHWCursor() - } - } else { - /* TW: Head 1 is always CRT2 */ - if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { - sis301EnableHWCursor330() - } else { - if(pSiS->UseHWARGBCursor) { - sis301EnableHWARGBCursor310() - } else { - sis301EnableHWCursor310() - } - } - } + if(pSiS->SecondHead) { + /* Head 2 is always CRT1 */ + if(pSiS->UseHWARGBCursor) { + sis310EnableHWARGBCursor() + } else { + sis310EnableHWCursor() + } + } else { + /* Head 1 is always CRT2 */ + if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { + sis301EnableHWCursor330() + } else { + if(pSiS->UseHWARGBCursor) { + sis301EnableHWARGBCursor310() + } else { + sis301EnableHWCursor310() + } + } + } } else { #endif - if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { - if(pSiS->UseHWARGBCursor) { - sis310EnableHWARGBCursor() - } else { - sis310EnableHWCursor() - } - if(pSiS->VBFlags & CRT2_ENABLE) { - sis301EnableHWCursor330() - } - } else { - if(pSiS->UseHWARGBCursor) { - sis310EnableHWARGBCursor() - if(pSiS->VBFlags & CRT2_ENABLE) { - sis301EnableHWARGBCursor310() - } - } else { - sis310EnableHWCursor() - if(pSiS->VBFlags & CRT2_ENABLE) { - sis301EnableHWCursor310() - } - } - } + if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { + if(pSiS->UseHWARGBCursor) { + sis310EnableHWARGBCursor() + } else { + sis310EnableHWCursor() + } + if(pSiS->VBFlags & CRT2_ENABLE) { + sis301EnableHWCursor330() + } + } else { + if(pSiS->UseHWARGBCursor) { + sis310EnableHWARGBCursor() + if(pSiS->VBFlags & CRT2_ENABLE) { + sis301EnableHWARGBCursor310() + } + } else { + sis310EnableHWCursor() + if(pSiS->VBFlags & CRT2_ENABLE) { + sis301EnableHWCursor310() + } + } + } #ifdef SISDUALHEAD } #endif @@ -312,7 +300,7 @@ static void SiSSetCursorPosition(ScrnInfoPtr pScrn, int x, int y) { SISPtr pSiS = SISPTR(pScrn); - DisplayModePtr mode = pSiS->CurrentLayout.mode; /* pScrn->currentMode; */ + DisplayModePtr mode = pSiS->CurrentLayout.mode; unsigned char x_preset = 0; unsigned char y_preset = 0; int temp; @@ -324,14 +312,14 @@ SiSSetCursorPosition(ScrnInfoPtr pScrn, int x, int y) sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); #endif - if (x < 0) { - x_preset = (-x); - x = 0; + if(x < 0) { + x_preset = (-x); + x = 0; } - if (y < 0) { - y_preset = (-y); - y = 0; + if(y < 0) { + y_preset = (-y); + y = 0; } if(mode->Flags & V_INTERLACE) y /= 2; @@ -377,24 +365,24 @@ SiSSetCursorPositionMerged(ScrnInfoPtr pScrn1, int x, int y) if((pSiS->VGAEngine == SIS_300_VGA) && (pSiS->UseHWARGBCursor)) maxpreset = 31; if(x1 < 0) { - x1_preset = (-x1); - if(x1_preset > maxpreset) x1_preset = maxpreset; - x1 = 0; + x1_preset = (-x1); + if(x1_preset > maxpreset) x1_preset = maxpreset; + x1 = 0; } if(y1 < 0) { - y1_preset = (-y1); - if(y1_preset > maxpreset) y1_preset = maxpreset; - y1 = 0; + y1_preset = (-y1); + if(y1_preset > maxpreset) y1_preset = maxpreset; + y1 = 0; } if(x2 < 0) { - x2_preset = (-x2); - if(x2_preset > maxpreset) x2_preset = maxpreset; - x2 = 0; + x2_preset = (-x2); + if(x2_preset > maxpreset) x2_preset = maxpreset; + x2 = 0; } if(y2 < 0) { - y2_preset = (-y2); - if(y2_preset > maxpreset) y2_preset = maxpreset; - y2 = 0; + y2_preset = (-y2); + if(y2_preset > maxpreset) y2_preset = maxpreset; + y2 = 0; } if(mode1->Flags & V_INTERLACE) { y1 /= 2; y1_preset /= 2; } @@ -415,13 +403,8 @@ SiSSetCursorPositionMerged(ScrnInfoPtr pScrn1, int x, int y) } else { sis310SetCursorPositionX(x1, x1_preset) sis310SetCursorPositionY(y1, y1_preset) - if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { - sis301SetCursorPositionX330(x2 + 17, x2_preset) - sis301SetCursorPositionY330(y2, y2_preset) - } else { - sis301SetCursorPositionX310(x2 + 17, x2_preset) - sis301SetCursorPositionY310(y2, y2_preset) - } + sis301SetCursorPositionX310(x2 + 17, x2_preset) + sis301SetCursorPositionY310(y2, y2_preset) } } #endif @@ -441,13 +424,13 @@ SiS300SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) } #endif - if (x < 0) { - x_preset = (-x); - x = 0; + if(x < 0) { + x_preset = (-x); + x = 0; } - if (y < 0) { - y_preset = (-y); - y = 0; + if(y < 0) { + y_preset = (-y); + y = 0; } if(mode->Flags & V_INTERLACE) y /= 2; @@ -455,23 +438,23 @@ SiS300SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { - if(pSiS->SecondHead) { - /* TW: Head 2 is always CRT1 */ - sis300SetCursorPositionX(x, x_preset) - sis300SetCursorPositionY(y, y_preset) - } else { - /* TW: Head 1 is always CRT2 */ - sis301SetCursorPositionX(x + 13, x_preset) - sis301SetCursorPositionY(y, y_preset) - } + if(pSiS->SecondHead) { + /* Head 2 is always CRT1 */ + sis300SetCursorPositionX(x, x_preset) + sis300SetCursorPositionY(y, y_preset) + } else { + /* Head 1 is always CRT2 */ + sis301SetCursorPositionX(x + 13, x_preset) + sis301SetCursorPositionY(y, y_preset) + } } else { #endif - sis300SetCursorPositionX(x, x_preset) - sis300SetCursorPositionY(y, y_preset) - if(pSiS->VBFlags & CRT2_ENABLE) { - sis301SetCursorPositionX(x + 13, x_preset) - sis301SetCursorPositionY(y, y_preset) - } + sis300SetCursorPositionX(x, x_preset) + sis300SetCursorPositionY(y, y_preset) + if(pSiS->VBFlags & CRT2_ENABLE) { + sis301SetCursorPositionX(x + 13, x_preset) + sis301SetCursorPositionY(y, y_preset) + } #ifdef SISDUALHEAD } #endif @@ -492,13 +475,13 @@ SiS310SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) } #endif - if (x < 0) { - x_preset = (-x); - x = 0; + if(x < 0) { + x_preset = (-x); + x = 0; } - if (y < 0) { - y_preset = (-y); - y = 0; + if(y < 0) { + y_preset = (-y); + y = 0; } if(mode->Flags & V_INTERLACE) y /= 2; @@ -506,32 +489,22 @@ SiS310SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { - if(pSiS->SecondHead) { - /* TW: Head 2 is always CRT1 */ - sis310SetCursorPositionX(x, x_preset) - sis310SetCursorPositionY(y, y_preset) - } else { - /* TW: Head 1 is always CRT2 */ - if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { - sis301SetCursorPositionX330(x + 17, x_preset) - sis301SetCursorPositionY330(y, y_preset) - } else { - sis301SetCursorPositionX310(x + 17, x_preset) - sis301SetCursorPositionY310(y, y_preset) - } - } + if(pSiS->SecondHead) { + /* Head 2 is always CRT1 */ + sis310SetCursorPositionX(x, x_preset) + sis310SetCursorPositionY(y, y_preset) + } else { + /* Head 1 is always CRT2 */ + sis301SetCursorPositionX310(x + 17, x_preset) + sis301SetCursorPositionY310(y, y_preset) + } } else { #endif sis310SetCursorPositionX(x, x_preset) sis310SetCursorPositionY(y, y_preset) if(pSiS->VBFlags & CRT2_ENABLE) { - if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { - sis301SetCursorPositionX330(x + 17, x_preset) - sis301SetCursorPositionY330(y, y_preset) - } else { - sis301SetCursorPositionX310(x + 17, x_preset) - sis301SetCursorPositionY310(y, y_preset) - } + sis301SetCursorPositionX310(x + 17, x_preset) + sis301SetCursorPositionY310(y, y_preset) } #ifdef SISDUALHEAD } @@ -579,23 +552,23 @@ SiS300SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { - if(pSiS->SecondHead) { - /* TW: Head 2 is always CRT1 */ - sis300SetCursorBGColor(bg) - sis300SetCursorFGColor(fg) - } else { - /* TW: Head 1 is always CRT2 */ - sis301SetCursorBGColor(bg) - sis301SetCursorFGColor(fg) - } + if(pSiS->SecondHead) { + /* Head 2 is always CRT1 */ + sis300SetCursorBGColor(bg) + sis300SetCursorFGColor(fg) + } else { + /* Head 1 is always CRT2 */ + sis301SetCursorBGColor(bg) + sis301SetCursorFGColor(fg) + } } else { #endif - sis300SetCursorBGColor(bg) - sis300SetCursorFGColor(fg) - if(pSiS->VBFlags & CRT2_ENABLE) { - sis301SetCursorBGColor(bg) - sis301SetCursorFGColor(fg) - } + sis300SetCursorBGColor(bg) + sis300SetCursorFGColor(fg) + if(pSiS->VBFlags & CRT2_ENABLE) { + sis301SetCursorBGColor(bg) + sis301SetCursorFGColor(fg) + } #ifdef SISDUALHEAD } #endif @@ -611,39 +584,39 @@ SiS310SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { if(pSiS->SecondHead) { - /* TW: Head 2 is always CRT1 */ - sis310SetCursorBGColor(bg) - sis310SetCursorFGColor(fg) + /* Head 2 is always CRT1 */ + sis310SetCursorBGColor(bg) + sis310SetCursorFGColor(fg) } else { - /* TW: Head 1 is always CRT2 */ - if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { - if((fg != pSiS->CurFGCol) || (bg != pSiS->CurBGCol)) { - pSiS->CurFGCol = fg; - pSiS->CurBGCol = bg; - SiSXConvertMono2ARGB(pSiS); - } - } else { - sis301SetCursorBGColor310(bg) - sis301SetCursorFGColor310(fg) - } - } - } else { -#endif - sis310SetCursorBGColor(bg) - sis310SetCursorFGColor(fg) - - if(pSiS->VBFlags & CRT2_ENABLE) { + /* Head 1 is always CRT2 */ if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { if((fg != pSiS->CurFGCol) || (bg != pSiS->CurBGCol)) { - pSiS->CurFGCol = fg; - pSiS->CurBGCol = bg; - SiSXConvertMono2ARGB(pSiS); + pSiS->CurFGCol = fg; + pSiS->CurBGCol = bg; + SiSXConvertMono2ARGB(pSiS); } } else { sis301SetCursorBGColor310(bg) sis301SetCursorFGColor310(fg) } - } + } + } else { +#endif + sis310SetCursorBGColor(bg) + sis310SetCursorFGColor(fg) + + if(pSiS->VBFlags & CRT2_ENABLE) { + if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { + if((fg != pSiS->CurFGCol) || (bg != pSiS->CurBGCol)) { + pSiS->CurFGCol = fg; + pSiS->CurBGCol = bg; + SiSXConvertMono2ARGB(pSiS); + } + } else { + sis301SetCursorBGColor310(bg) + sis301SetCursorFGColor310(fg) + } + } #ifdef SISDUALHEAD } #endif @@ -743,35 +716,33 @@ SiS300LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) } if(pSiS->UseHWARGBCursor) { - if(pSiS->VBFlags & DISPTYPE_CRT1) { - status1 = sis300GetCursorStatus; - sis300DisableHWCursor() - if(pSiS->VBFlags & CRT2_ENABLE) { - status2 = sis301GetCursorStatus; - sis301DisableHWCursor() - } - SISWaitRetraceCRT1(pScrn); - sis300SwitchToMONOCursor(); - if(pSiS->VBFlags & CRT2_ENABLE) { - SISWaitRetraceCRT2(pScrn); - sis301SwitchToMONOCursor(); - } - } + if(pSiS->VBFlags & DISPTYPE_CRT1) { + status1 = sis300GetCursorStatus; + sis300DisableHWCursor() + if(pSiS->VBFlags & CRT2_ENABLE) { + status2 = sis301GetCursorStatus; + sis301DisableHWCursor() + } + SISWaitRetraceCRT1(pScrn); + sis300SwitchToMONOCursor(); + if(pSiS->VBFlags & CRT2_ENABLE) { + SISWaitRetraceCRT2(pScrn); + sis301SwitchToMONOCursor(); + } + } } sis300SetCursorAddress(cursor_addr); - sis300SetCursorPatternSelect(0); if(status1) sis300SetCursorStatus(status1) if(pSiS->VBFlags & CRT2_ENABLE) { - if((pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) { - status2 = sis301GetCursorStatus; - sis301DisableHWCursor() - SISWaitRetraceCRT2(pScrn); - sis301SwitchToMONOCursor(); - } - sis301SetCursorAddress(cursor_addr) - sis301SetCursorPatternSelect(0) - if(status2) sis301SetCursorStatus(status2) + if((pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) { + status2 = sis301GetCursorStatus; + sis301DisableHWCursor() + SISWaitRetraceCRT2(pScrn); + sis301SwitchToMONOCursor(); + } + sis301SetCursorAddress(cursor_addr) + if(status2) sis301SetCursorStatus(status2) } pSiS->UseHWARGBCursor = FALSE; @@ -785,8 +756,19 @@ SiS310LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) CARD32 status1 = 0, status2 = 0; unsigned char *dest = pSiS->FbBase; BOOLEAN sizedouble = FALSE; + int bufnum; #ifdef SISDUALHEAD SISEntPtr pSiSEnt = pSiS->entityPrivate; + + if(pSiS->DualHeadMode) { + pSiSEnt->HWCursorMBufNum ^= 1; + bufnum = 1 << pSiSEnt->HWCursorMBufNum; + } else { +#endif + pSiS->HWCursorMBufNum ^= 1; + bufnum = 1 << pSiS->HWCursorMBufNum; +#ifdef SISDUALHEAD + } #endif #ifdef SISMERGED @@ -800,13 +782,17 @@ SiS310LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) sizedouble = TRUE; } - cursor_addr = pScrn->videoRam - pSiS->cursorOffset - (pSiS->CursorSize/1024); /* 1K boundary */ - #ifdef SISDUALHEAD - /* TW: Use the global (real) FbBase in DHM */ + /* Use the global (real) FbBase in DHM */ if(pSiS->DualHeadMode) dest = pSiSEnt->FbBase; #endif + if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { + cursor_addr = pScrn->videoRam - pSiS->cursorOffset - (pSiS->CursorSize/1024); + } else { + cursor_addr = pScrn->videoRam - pSiS->cursorOffset - ((pSiS->CursorSize/1024) * bufnum); + } + if(sizedouble) { int i; for(i = 0; i < 32; i++) { @@ -831,46 +817,44 @@ SiS310LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) SiSXConvertMono2ARGB(pSiS); if(pSiS->UseHWARGBCursor) { - if(pSiS->VBFlags & DISPTYPE_CRT1) { - status1 = sis310GetCursorStatus; - sis310DisableHWCursor(); - SISWaitRetraceCRT1(pScrn); - sis310SwitchToMONOCursor(); - } - } + if(pSiS->VBFlags & DISPTYPE_CRT1) { + status1 = sis310GetCursorStatus; + sis310DisableHWCursor(); + SISWaitRetraceCRT1(pScrn); + sis310SwitchToMONOCursor(); + } + } } else { if(pSiS->UseHWARGBCursor) { - if(pSiS->VBFlags & DISPTYPE_CRT1) { - status1 = sis310GetCursorStatus; - sis310DisableHWCursor() - if(pSiS->VBFlags & CRT2_ENABLE) { - status2 = sis301GetCursorStatus310; - sis301DisableHWCursor310() - } - SISWaitRetraceCRT1(pScrn); - sis310SwitchToMONOCursor(); - if(pSiS->VBFlags & CRT2_ENABLE) { - SISWaitRetraceCRT2(pScrn); - sis301SwitchToMONOCursor310(); - } - } - } else if(pSiS->Chipset == PCI_CHIP_SIS315H) { - if(pSiS->VBFlags & DISPTYPE_CRT1) { - SISWaitRetraceCRT1(pScrn); - } - } + if(pSiS->VBFlags & DISPTYPE_CRT1) { + status1 = sis310GetCursorStatus; + sis310DisableHWCursor() + if(pSiS->VBFlags & CRT2_ENABLE) { + status2 = sis301GetCursorStatus310; + sis301DisableHWCursor310() + } + SISWaitRetraceCRT1(pScrn); + sis310SwitchToMONOCursor(); + if(pSiS->VBFlags & CRT2_ENABLE) { + SISWaitRetraceCRT2(pScrn); + sis301SwitchToMONOCursor310(); + } + } + } else if(pSiS->Chipset == PCI_CHIP_SIS315H) { + if(pSiS->VBFlags & DISPTYPE_CRT1) { + SISWaitRetraceCRT1(pScrn); + } + } } sis310SetCursorAddress(cursor_addr); - sis310SetCursorPatternSelect(0); if(status1) sis310SetCursorStatus(status1) if(pSiS->VBFlags & CRT2_ENABLE) { if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { - sis301SetCursorAddress330(cursor_addr2) - sis301SetCursorPatternSelect330(0) + sis301SetCursorAddress310(cursor_addr2) } else { if((pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) { status2 = sis301GetCursorStatus310; @@ -879,7 +863,6 @@ SiS310LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) sis301SwitchToMONOCursor310(); } sis301SetCursorAddress310(cursor_addr) - sis301SetCursorPatternSelect310(0) if(status2) sis301SetCursorStatus310(status2) } } @@ -892,15 +875,15 @@ SiSUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SISPtr pSiS = SISPTR(pScrn); - DisplayModePtr mode = pSiS->CurrentLayout.mode; /* pScrn->currentMode; */ - + DisplayModePtr mode = pSiS->CurrentLayout.mode; + if(pSiS->Chipset != PCI_CHIP_SIS6326) return TRUE; if(!(pSiS->SiS6326Flags & SIS6326_TVDETECTED)) return TRUE; if((strcmp(mode->name, "PAL800x600U") == 0) || (strcmp(mode->name, "NTSC640x480U") == 0)) - return FALSE; + return FALSE; else - return TRUE; + return TRUE; } static Bool @@ -908,7 +891,7 @@ SiS300UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SISPtr pSiS = SISPTR(pScrn); - DisplayModePtr mode = pSiS->CurrentLayout.mode; /* pScrn->currentMode; */ + DisplayModePtr mode = pSiS->CurrentLayout.mode; #ifdef SISMERGED DisplayModePtr mode2 = NULL; @@ -923,9 +906,9 @@ SiS300UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) case PCI_CHIP_SIS630: case PCI_CHIP_SIS540: if(mode->Flags & V_INTERLACE) - return FALSE; + return FALSE; if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32)) - return FALSE; + return FALSE; #ifdef SISMERGED if(pSiS->MergedFB) { if(mode2->Flags & V_INTERLACE) @@ -940,12 +923,12 @@ SiS300UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) case PCI_CHIP_SIS315: case PCI_CHIP_SIS315H: case PCI_CHIP_SIS315PRO: - case PCI_CHIP_SIS330: case PCI_CHIP_SIS660: + case PCI_CHIP_SIS330: if(mode->Flags & V_INTERLACE) - return FALSE; + return FALSE; if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32)) - return FALSE; + return FALSE; #ifdef SISMERGED if(pSiS->MergedFB) { if(mode2->Flags & V_INTERLACE) @@ -954,24 +937,12 @@ SiS300UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs) return FALSE; } #endif - if(pSiS->Chipset == PCI_CHIP_SIS330) { - if((pSiS->VBFlags & VB_SISBRIDGE) && - (pSiS->VBFlags & CRT2_TV) && - (pSiS->VBFlags & (TV_NTSC|TV_PALM))) { -#ifdef SISMERGED - if(pSiS->MergedFB) { - if(mode2->HDisplay == 1024) return FALSE; - } else -#endif - if(mode->HDisplay == 1024) return FALSE; - } - } break; default: if(mode->Flags & V_INTERLACE) - return FALSE; + return FALSE; if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32)) - return FALSE; + return FALSE; break; } return TRUE; @@ -985,7 +956,7 @@ SiSUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SISPtr pSiS = SISPTR(pScrn); - DisplayModePtr mode = pSiS->CurrentLayout.mode; /* pScrn->currentMode; */ + DisplayModePtr mode = pSiS->CurrentLayout.mode; #ifdef SISMERGED DisplayModePtr mode2 = NULL; @@ -1000,11 +971,11 @@ SiSUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs) case PCI_CHIP_SIS630: case PCI_CHIP_SIS540: if(mode->Flags & V_INTERLACE) - return FALSE; - if(pCurs->bits->height > 32 || pCurs->bits->width > 32) - return FALSE; + return FALSE; + if((pCurs->bits->height > 32) || (pCurs->bits->width > 32)) + return FALSE; if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 16)) - return FALSE; + return FALSE; #ifdef SISMERGED if(pSiS->MergedFB) { if(mode2->Flags & V_INTERLACE) @@ -1022,20 +993,13 @@ SiSUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs) case PCI_CHIP_SIS330: case PCI_CHIP_SIS660: if(mode->Flags & V_INTERLACE) - return FALSE; - if(pCurs->bits->height > 64 || pCurs->bits->width > 64) - return FALSE; - if(mode->Flags & V_DBLSCAN) { - if(pCurs->bits->height > 32) - return FALSE; -#ifdef SISDUALHEAD - if((!pSiS->DualHeadMode) || (pSiS->SecondHead)) -#endif - if(pSiS->VBFlags & CRT1_LCDA) - return FALSE; - } + return FALSE; + if((pCurs->bits->height > 64) || (pCurs->bits->width > 64)) + return FALSE; + if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32)) + return FALSE; if((pSiS->CurrentLayout.bitsPerPixel == 8) && (pSiS->VBFlags & CRT2_ENABLE)) - return FALSE; + return FALSE; #ifdef SISMERGED if(pSiS->MergedFB) { if(mode2->Flags & V_INTERLACE) @@ -1044,20 +1008,8 @@ SiSUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs) return FALSE; } #endif - if(pSiS->Chipset == PCI_CHIP_SIS330) { - if((pSiS->VBFlags & VB_SISBRIDGE) && - (pSiS->VBFlags & CRT2_TV) && - (pSiS->VBFlags & (TV_NTSC|TV_PALM))) { -#ifdef SISMERGED - if(pSiS->MergedFB) { - if(mode2->HDisplay == 1024) return FALSE; - } else -#endif - if(mode->HDisplay == 1024) return FALSE; - } - } break; - default: + default: return FALSE; } return TRUE; @@ -1109,10 +1061,10 @@ static void SiS300LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) dest = (MYSISPTRTYPE *)((unsigned char *)pSiS->FbBase + (cursor_addr * 1024)); if(sizedouble) { - if(srcheight > 16) srcheight = 16; - maxheight = 16; + if(srcheight > 16) srcheight = 16; + maxheight = 16; } - + #ifdef SIS300_USE_ARGB16 /* Use 16 Bit RGB pointer */ for(i = 0; i < srcheight; i++) { p = src; @@ -1192,35 +1144,34 @@ static void SiS300LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) #endif if(!pSiS->UseHWARGBCursor) { - if(pSiS->VBFlags & DISPTYPE_CRT1) { - status1 = sis300GetCursorStatus; - sis300DisableHWCursor() - if(pSiS->VBFlags & CRT2_ENABLE) { - status2 = sis301GetCursorStatus; - sis301DisableHWCursor() - } - SISWaitRetraceCRT1(pScrn); - sis300SwitchToRGBCursor(); - if(pSiS->VBFlags & CRT2_ENABLE) { - SISWaitRetraceCRT2(pScrn); - sis301SwitchToRGBCursor(); - } - } + if(pSiS->VBFlags & DISPTYPE_CRT1) { + status1 = sis300GetCursorStatus; + sis300DisableHWCursor() + if(pSiS->VBFlags & CRT2_ENABLE) { + status2 = sis301GetCursorStatus; + sis301DisableHWCursor() + } + SISWaitRetraceCRT1(pScrn); + sis300SwitchToRGBCursor(); + if(pSiS->VBFlags & CRT2_ENABLE) { + SISWaitRetraceCRT2(pScrn); + sis301SwitchToRGBCursor(); + } + } } + sis300SetCursorAddress(cursor_addr); - sis300SetCursorPatternSelect(0); if(status1) sis300SetCursorStatus(status1) - if(pSiS->VBFlags & CRT2_ENABLE) { - if((!pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) { - status2 = sis301GetCursorStatus; - sis301DisableHWCursor() - SISWaitRetraceCRT2(pScrn); - sis301SwitchToRGBCursor(); - } - sis301SetCursorAddress(cursor_addr) - sis301SetCursorPatternSelect(0) - if(status2) sis301SetCursorStatus(status2) + if(pSiS->VBFlags & CRT2_ENABLE) { + if((!pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) { + status2 = sis301GetCursorStatus; + sis301DisableHWCursor() + SISWaitRetraceCRT2(pScrn); + sis301SwitchToRGBCursor(); + } + sis301SetCursorAddress(cursor_addr) + if(status2) sis301SetCursorStatus(status2) } pSiS->UseHWARGBCursor = TRUE; @@ -1235,6 +1186,7 @@ static void SiS310LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) int srcheight = pCurs->bits->height; CARD32 status1 = 0, status2 = 0; BOOLEAN sizedouble = FALSE; + int bufnum; #ifdef SISDUALHEAD SISEntPtr pSiSEnt = pSiS->entityPrivate; #endif @@ -1250,44 +1202,61 @@ static void SiS310LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) sizedouble = TRUE; } - cursor_addr = pScrn->videoRam - pSiS->cursorOffset - ((pSiS->CursorSize/1024) * 2); +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + pSiSEnt->HWCursorCBufNum ^= 1; + bufnum = 1 << pSiSEnt->HWCursorCBufNum; + } else { +#endif + pSiS->HWCursorCBufNum ^= 1; + bufnum = 1 << pSiS->HWCursorCBufNum; +#ifdef SISDUALHEAD + } +#endif + + if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { + cursor_addr = pScrn->videoRam - pSiS->cursorOffset - ((pSiS->CursorSize/1024) * 2); + } else { + cursor_addr = pScrn->videoRam - pSiS->cursorOffset - ((pSiS->CursorSize/1024) * (2 + bufnum)); + } if(srcwidth > 64) srcwidth = 64; if(srcheight > 64) srcheight = 64; #ifdef SISDUALHEAD if(pSiS->DualHeadMode) - /* TW: Use the global (real) FbBase in DHM */ - dest = (CARD32 *)((unsigned char *)pSiSEnt->FbBase + (cursor_addr * 1024)); + /* Use the global (real) FbBase in DHM */ + dest = (CARD32 *)((unsigned char *)pSiSEnt->FbBase + (cursor_addr * 1024)); else #endif - dest = (CARD32 *)((unsigned char *)pSiS->FbBase + (cursor_addr * 1024)); + dest = (CARD32 *)((unsigned char *)pSiS->FbBase + (cursor_addr * 1024)); if(sizedouble) { - if(srcheight > 32) srcheight = 32; - maxheight = 32; + if(srcheight > 32) srcheight = 32; + maxheight = 32; } for(i = 0; i < srcheight; i++) { - p = src; - pb = dest; - src += pCurs->bits->width; - for(j = 0; j < srcwidth; j++) *dest++ = *p++; - if(srcwidth < 64) { - for(; j < 64; j++) *dest++ = 0; - } - if(sizedouble) { - for(j = 0; j < 64; j++) { - *dest++ = *pb++; - } - } + p = src; + pb = dest; + src += pCurs->bits->width; + for(j = 0; j < srcwidth; j++) *dest++ = *p++; + if(srcwidth < 64) { + for(; j < 64; j++) *dest++ = 0; + } + if(sizedouble) { + for(j = 0; j < 64; j++) { + *dest++ = *pb++; + } + } } if(srcheight < maxheight) { - for(; i < maxheight; i++) - for(j = 0; j < 64; j++) *dest++ = 0; - if(sizedouble) { - for(j = 0; j < 64; j++) *dest++ = 0; - } + for(; i < maxheight; i++) { + for(j = 0; j < 64; j++) *dest++ = 0; + if(sizedouble) { + for(j = 0; j < 64; j++) *dest++ = 0; + } + } } if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { @@ -1322,13 +1291,11 @@ static void SiS310LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) } sis310SetCursorAddress(cursor_addr); - sis310SetCursorPatternSelect(0); if(status1) sis310SetCursorStatus(status1) if(pSiS->VBFlags & CRT2_ENABLE) { if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { - sis301SetCursorAddress330(cursor_addr) - sis301SetCursorPatternSelect330(0) + sis301SetCursorAddress310(cursor_addr) } else { if((!pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) { status2 = sis301GetCursorStatus310; @@ -1337,7 +1304,6 @@ static void SiS310LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) sis301SwitchToRGBCursor310(); } sis301SetCursorAddress310(cursor_addr) - sis301SetCursorPatternSelect310(0) if(status2) sis301SetCursorStatus310(status2) } } @@ -1400,7 +1366,7 @@ SiSHWCursorInit(ScreenPtr pScreen) case PCI_CHIP_SIS315PRO: case PCI_CHIP_SIS330: case PCI_CHIP_SIS660: - infoPtr->MaxWidth = 64; + infoPtr->MaxWidth = 64; infoPtr->MaxHeight = 64; infoPtr->ShowCursor = SiS310ShowCursor; infoPtr->HideCursor = SiS310HideCursor; diff --git a/src/sis_cursor.h b/src/sis_cursor.h index 5de0070..c38d038 100644 --- a/src/sis_cursor.h +++ b/src/sis_cursor.h @@ -1,38 +1,39 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.h,v 1.11 2003/10/30 18:53:42 twini Exp $ */ +/* $XFree86$ */ /* * SiS hardware cursor handling * Definitions * - * Copyright 1998,1999 by Alan Hourihane, Wigan, England. - * Copyright 2001, 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 holders not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. The copyright holders make 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 HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS 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. + * + * Author: Thomas Winischhofer <thomas@winischhofer.net> + * + * Idea based on code by Can-Ru Yeou, SiS Inc. * - * Authors: Alan Hourihane, alanh@fairlite.demon.co.uk - * Mike Chapman <mike@paranoia.com>, - * Juanjo Santamarta <santamarta@ctv.es>, - * Mitani Hiroshi <hmitani@drl.mei.co.jp> - * David Thomas <davtom@dream.org.uk>. - * Thomas Winischhofer <thomas@winischhofer.net>: */ -#define CS(x) (0x8500+(x<<2)) +#define CS(x) (0x8500 + (x << 2)) /* 300 series, CRT1 */ @@ -118,20 +119,11 @@ { \ unsigned long temp; \ temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ - temp &= 0xFFFF0000; \ + temp &= 0xF0FF0000; \ temp |= address; \ MMIO_OUT32(pSiS->IOBase,CS(0),temp); \ } -#define sis300SetCursorPatternSelect(pat_id)\ - { \ - unsigned long temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ - temp &= 0xF0FFFFFF; \ - temp |= (pat_id) << 24; \ - MMIO_OUT32(pSiS->IOBase,CS(0),temp); \ - } - /* 300 series, CRT2 */ /* 80000000 = RGB(1) - MONO(0) @@ -216,20 +208,11 @@ { \ unsigned long temp; \ temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ - temp &= 0xFFFF0000; \ + temp &= 0xF0FF0000; \ temp |= address; \ MMIO_OUT32(pSiS->IOBase,CS(8),temp); \ } -#define sis301SetCursorPatternSelect(pat_id)\ - { \ - unsigned long temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ - temp &= 0xF0FFFFFF; \ - temp |= (pat_id) << 24; \ - MMIO_OUT32(pSiS->IOBase,CS(8),temp); \ - } - /* 315/330 series CRT1 */ /* 80000000 = RGB(1) - MONO(0) @@ -242,86 +225,69 @@ MMIO_IN32(pSiS->IOBase, CS(0)) & 0x40000000; #define sis310SetCursorStatus(status) \ - { \ - unsigned long temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ - temp &= 0xbfffffff; \ - temp |= status; \ - MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ - } + pSiS->HWCursorBackup[0] &= 0xbfffffff; \ + pSiS->HWCursorBackup[0] |= status; \ + MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \ + MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \ + MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]); #define sis310EnableHWCursor()\ - { \ - unsigned long temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ - temp &= 0x0fffffff; \ - temp |= 0x40000000; \ - MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ - } + pSiS->HWCursorBackup[0] &= 0x0fffffff; \ + pSiS->HWCursorBackup[0] |= 0x40000000; \ + MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \ + MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \ + MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]); #define sis310EnableHWARGBCursor()\ - { \ - unsigned long temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ - temp &= 0x0FFFFFFF; \ - temp |= 0xE0000000; \ - MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ - } + pSiS->HWCursorBackup[0] &= 0x0FFFFFFF; \ + pSiS->HWCursorBackup[0] |= 0xE0000000; \ + MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \ + MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \ + MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]); #define sis310SwitchToMONOCursor() \ - { \ - unsigned long temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ - temp &= 0x4fffffff; \ - MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ - } - + pSiS->HWCursorBackup[0] &= 0x4fffffff; \ + MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \ + MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \ + MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]); + #define sis310SwitchToRGBCursor() \ - { \ - unsigned long temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ - temp &= 0xBFFFFFFF; \ - temp |= 0xA0000000; \ - MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ - } - + pSiS->HWCursorBackup[0] &= 0xBFFFFFFF; \ + pSiS->HWCursorBackup[0] |= 0xA0000000; \ + MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \ + MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \ + MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]); + #define sis310DisableHWCursor()\ - { \ - unsigned long temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ - temp &= 0xBFFFFFFF; \ - MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ - } + pSiS->HWCursorBackup[0] &= 0xBFFFFFFF; \ + MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \ + MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \ + MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]); #define sis310SetCursorBGColor(color) \ - MMIO_OUT32(pSiS->IOBase, CS(1), (color)); + MMIO_OUT32(pSiS->IOBase, CS(1), (color)); \ + pSiS->HWCursorBackup[1] = color; #define sis310SetCursorFGColor(color)\ - MMIO_OUT32(pSiS->IOBase, CS(2), (color)); + MMIO_OUT32(pSiS->IOBase, CS(2), (color)); \ + pSiS->HWCursorBackup[2] = color; -#define sis310SetCursorPositionX(x,preset)\ - MMIO_OUT32(pSiS->IOBase, CS(3), ((x) | ((preset) << 16))); +#define sis310SetCursorPositionX(x,preset) \ + pSiS->HWCursorBackup[3] = ((x) | ((preset) << 16)); \ + MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); -#define sis310SetCursorPositionY(y,preset)\ - MMIO_OUT32(pSiS->IOBase, CS(4), ((y) | ((preset) << 16))); +#define sis310SetCursorPositionY(y,preset) \ + pSiS->HWCursorBackup[4] = ((y) | ((preset) << 16)); \ + MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]); #define sis310SetCursorAddress(address)\ - { \ - unsigned long temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ - temp &= 0xFFF00000; \ - temp |= address; \ - MMIO_OUT32(pSiS->IOBase,CS(0),temp); \ - } - -#define sis310SetCursorPatternSelect(pat_id)\ - { \ - unsigned long temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ - temp &= 0xF0FFFFFF; \ - temp |= (pat_id) << 24; \ - MMIO_OUT32(pSiS->IOBase,CS(0),temp); \ - } + pSiS->HWCursorBackup[0] &= 0xF0F00000; \ + pSiS->HWCursorBackup[0] |= address; \ + MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \ + MMIO_OUT32(pSiS->IOBase, CS(1), pSiS->HWCursorBackup[1]); \ + MMIO_OUT32(pSiS->IOBase, CS(2), pSiS->HWCursorBackup[2]); \ + MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \ + MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]); /* 315 series CRT2 */ @@ -335,78 +301,62 @@ MMIO_IN32(pSiS->IOBase, CS(8)) & 0x40000000; #define sis301SetCursorStatus310(status) \ - { \ - unsigned long temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ - temp &= 0xbfffffff; \ - temp |= status; \ - MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ - } + pSiS->HWCursorBackup[8] &= 0xbfffffff; \ + pSiS->HWCursorBackup[8] |= status; \ + MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \ + MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \ + MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); #define sis301EnableHWCursor310()\ - { \ - unsigned long temp, temp1, temp2; \ - temp1 = MMIO_IN32(pSiS->IOBase, CS(11)); \ - temp2 = MMIO_IN32(pSiS->IOBase, CS(12)); \ - temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ - temp &= 0x0fffffff; \ - temp |= 0x40000000; \ - MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ - MMIO_OUT32(pSiS->IOBase, CS(11), temp1); \ - MMIO_OUT32(pSiS->IOBase, CS(12), temp2); \ - } + pSiS->HWCursorBackup[8] &= 0x0fffffff; \ + pSiS->HWCursorBackup[8] |= 0x40000000; \ + MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \ + MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \ + MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); #define sis301EnableHWARGBCursor310()\ - { \ - unsigned long temp, temp1, temp2; \ - temp1 = MMIO_IN32(pSiS->IOBase, CS(11)); \ - temp2 = MMIO_IN32(pSiS->IOBase, CS(12)); \ - temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ - temp &= 0x0FFFFFFF; \ - temp |= 0xE0000000; \ - MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ - MMIO_OUT32(pSiS->IOBase, CS(11), temp1); \ - MMIO_OUT32(pSiS->IOBase, CS(12), temp2); \ - } + pSiS->HWCursorBackup[8] &= 0x0FFFFFFF; \ + pSiS->HWCursorBackup[8] |= 0xE0000000; \ + MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \ + MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \ + MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); #define sis301SwitchToRGBCursor310() \ - { \ - unsigned long temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ - temp &= 0xBFFFFFFF; \ - temp |= 0xA0000000; \ - MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ - } + pSiS->HWCursorBackup[8] &= 0xBFFFFFFF; \ + pSiS->HWCursorBackup[8] |= 0xA0000000; \ + MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \ + MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \ + MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); #define sis301SwitchToMONOCursor310() \ - { \ - unsigned long temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ - temp &= 0x4fffffff; \ - MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ - } + pSiS->HWCursorBackup[8] &= 0x4fffffff; \ + MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \ + MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \ + MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); #define sis301DisableHWCursor310()\ - { \ - unsigned long temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ - temp &= 0xBFFFFFFF; \ - MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ - } + pSiS->HWCursorBackup[8] &= 0xBFFFFFFF; \ + MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \ + MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \ + MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); -#define sis301SetCursorBGColor310(color)\ - MMIO_OUT32(pSiS->IOBase, CS(9), (color)); -#define sis301SetCursorFGColor310(color)\ - MMIO_OUT32(pSiS->IOBase, CS(10), (color)); +#define sis301SetCursorBGColor310(color) \ + MMIO_OUT32(pSiS->IOBase, CS(9), (color)); \ + pSiS->HWCursorBackup[9] = color; -#define sis301SetCursorPositionX310(x,preset)\ - MMIO_OUT32(pSiS->IOBase, CS(11), ((x) | ((preset) << 16))); -#define sis301SetCursorPositionY310(y,preset)\ - MMIO_OUT32(pSiS->IOBase, CS(12), ((y) | ((preset) << 16))); +#define sis301SetCursorFGColor310(color) \ + MMIO_OUT32(pSiS->IOBase, CS(10), (color)); \ + pSiS->HWCursorBackup[10] = color; -#define sis301SetCursorAddress310(address)\ - { \ - unsigned long temp; \ +#define sis301SetCursorPositionX310(x,preset) \ + pSiS->HWCursorBackup[11] = ((x) | ((preset) << 16)); \ + MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); + +#define sis301SetCursorPositionY310(y,preset) \ + pSiS->HWCursorBackup[12] = ((y) | ((preset) << 16)); \ + MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); + +#define sis301SetCursorAddress310(address) \ if(pSiS->sishw_ext.jChipType == SIS_315H) { \ if(address & 0x10000) { \ address &= ~0x10000; \ @@ -415,25 +365,18 @@ andSISIDXREG(SISSR, 0x37, 0x7f); \ } \ } \ - temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ - temp &= 0xFFF00000; \ - temp |= address; \ - MMIO_OUT32(pSiS->IOBase,CS(8),temp); \ - } - -#define sis301SetCursorPatternSelect310(pat_id)\ - { \ - unsigned long temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ - temp &= 0xF0FFFFFF; \ - temp |= (pat_id) << 24; \ - MMIO_OUT32(pSiS->IOBase,CS(8),temp); \ - } + pSiS->HWCursorBackup[8] &= 0xF0F00000; \ + pSiS->HWCursorBackup[8] |= address; \ + MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \ + MMIO_OUT32(pSiS->IOBase, CS(9), pSiS->HWCursorBackup[9]); \ + MMIO_OUT32(pSiS->IOBase, CS(10), pSiS->HWCursorBackup[10]); \ + MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \ + MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); /* 330 series CRT2 */ /* Mono cursor engine for CRT2 on SiS330 (Xabre) has bugs - * and cannot be used! + * and cannot be used! Will hang engine. */ /* 80000000 = RGB(1) - MONO(0) @@ -442,65 +385,14 @@ * 10000000 = "ghost"(1) - Alpha Blend(0) ? */ -#define sis301EnableHWCursor330()\ - { \ - unsigned long temp, temp1, temp2; \ - andSISIDXREG(SISCR,0x5b,~0x10); \ - temp1 = MMIO_IN32(pSiS->IOBase, CS(11)); \ - temp2 = MMIO_IN32(pSiS->IOBase, CS(12)); \ - temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ - temp &= 0x0fffffff; \ - temp |= 0xE0000000; \ - MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ - MMIO_OUT32(pSiS->IOBase, CS(11), temp1); \ - MMIO_OUT32(pSiS->IOBase, CS(12), temp2); \ - orSISIDXREG(SISCR,0x5b,0x10); \ - } - -#define sis301DisableHWCursor330()\ - { \ - unsigned long temp; \ - andSISIDXREG(SISCR,0x5b,~0x10); \ - temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ - temp &= 0xBFFFFFFF; \ - MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ - orSISIDXREG(SISCR,0x5b,0x10); \ - } - -#define sis301SetCursorPositionX330(x,preset)\ - andSISIDXREG(SISCR,0x5b,~0x10); \ - MMIO_OUT32(pSiS->IOBase, CS(11), ((x) | ((preset) << 16))); \ - orSISIDXREG(SISCR,0x5b,0x10); - -#define sis301SetCursorPositionY330(y,preset)\ - andSISIDXREG(SISCR,0x5b,~0x10); \ - MMIO_OUT32(pSiS->IOBase, CS(12), ((y) | ((preset) << 16))); \ - orSISIDXREG(SISCR,0x5b,0x10); \ - -#define sis301SetCursorAddress330(address)\ - { \ - unsigned long temp, temp1, temp2; \ - temp1 = MMIO_IN32(pSiS->IOBase, CS(11)); \ - temp2 = MMIO_IN32(pSiS->IOBase, CS(12)); \ - andSISIDXREG(SISCR,0x5b,~0x10); \ - temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ - temp &= 0xFFF00000; \ - temp |= address; \ - MMIO_OUT32(pSiS->IOBase,CS(8),temp); \ - MMIO_OUT32(pSiS->IOBase, CS(11), temp1); \ - MMIO_OUT32(pSiS->IOBase, CS(12), temp2); \ - orSISIDXREG(SISCR,0x5b,0x10); \ - } +#define sis301EnableHWCursor330() \ + /* andSISIDXREG(SISCR,0x5b,~0x10); */ \ + pSiS->HWCursorBackup[8] &= 0x0fffffff; \ + pSiS->HWCursorBackup[8] |= 0xE0000000; \ + MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \ + MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \ + MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); \ + /* orSISIDXREG(SISCR,0x5b,0x10); */ -#define sis301SetCursorPatternSelect330(pat_id)\ - { \ - unsigned long temp; \ - andSISIDXREG(SISCR,0x5b,~0x10); \ - temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ - temp &= 0xF0FFFFFF; \ - temp |= (pat_id) << 24; \ - MMIO_OUT32(pSiS->IOBase,CS(8),temp); \ - orSISIDXREG(SISCR,0x5b,0x10); \ - } diff --git a/src/sis_dac.c b/src/sis_dac.c index 6a429e7..296e808 100644 --- a/src/sis_dac.c +++ b/src/sis_dac.c @@ -1,36 +1,45 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c,v 1.49 2003/11/19 21:27:41 twini Exp $ */ +/* $XFree86$ */ /* * DAC helper functions (Save/Restore, MemClk, etc) * - * Copyright 2001, 2002, 2003 by Thomas Winischhofer, Vienna, Austria. - * Parts Copyright 1998,1999 by Alan Hourihane, Wigan, England. + * 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 provider not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. The provider 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 PROVIDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE PROVIDER 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. * * Author: Thomas Winischhofer <thomas@winischhofer.net> * - * MemClock functions by: - * Alan Hourihane <alanh@fairlite.demon.co.uk> - * Mike Chapman <mike@paranoia.com>, - * Juanjo Santamarta <santamarta@ctv.es>, - * Mitani Hiroshi <hmitani@drl.mei.co.jp> - * David Thomas <davtom@dream.org.uk>. + * SiS_compute_vclk(), SiSCalcClock() and parts of SiSMclk(): + * Copyright (C) 1998, 1999 by Alan Hourihane, Wigan, England + * Written by: + * Alan Hourihane <alanh@fairlite.demon.co.uk>, + * Mike Chapman <mike@paranoia.com>, + * Juanjo Santamarta <santamarta@ctv.es>, + * Mitani Hiroshi <hmitani@drl.mei.co.jp>, + * David Thomas <davtom@dream.org.uk>, + * Thomas Winischhofer <thomas@winischhofer.net>. + * Licensed under the terms of the XFree86 license + * (http://www.xfree86.org/current/LICENSE1.html) + * */ #include "xf86.h" @@ -73,7 +82,7 @@ static const unsigned short ch701xidx[] = { 0x1c,0x5f,0x64,0x6f,0x70,0x71,0x72,0x73,0x74,0x76,0x78,0x7d, 0x67,0x68,0x69,0x6a,0x6b,0x1e,0x00,0x01,0x02,0x04,0x03,0x05, 0x06,0x07,0x08,0x15,0x1f,0x0c,0x0d,0x0e,0x0f,0x10,0x66 - }; + }; int SiS_compute_vclk( int Clock, @@ -745,7 +754,7 @@ SiS315Save(ScrnInfoPtr pScrn, SISRegPtr sisReg) sisReg->sisMMIO85C0 = MMIO_IN32(pSiS->IOBase, 0x85C0); /* Save CR registers */ - for(i = 0x00; i <= 0x7a; i++) { + for(i = 0x00; i <= 0x7c; i++) { inSISIDXREG(SISCR, i, sisReg->sisRegs3D4[i]); #ifdef TWDEBUG xf86DrvMsg(pScrn->scrnIndex, X_INFO, @@ -838,7 +847,7 @@ SiS315Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg) if(pSiS->sishw_ext.jChipType < SIS_661) { outSISIDXREG(SISCR, 0x79, sisReg->sisRegs3D4[0x79]); } - outSISIDXREG(SISCR, 0x63, sisReg->sisRegs3D4[0x63]); + outSISIDXREG(SISCR, pSiS->myCR63, sisReg->sisRegs3D4[pSiS->myCR63]); /* Leave PCI_IO_ENABLE on if accelerators are on (Is this required?) */ if(sisReg->sisRegs3C4[0x1e] & 0x50) { /*0x40=2D, 0x10=3D*/ @@ -847,6 +856,9 @@ SiS315Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg) } /* Restore extended SR registers */ + if(pSiS->sishw_ext.jChipType >= SIS_661) { + sisReg->sisRegs3C4[0x11] &= 0x0f; + } for(i = 0x06; i <= 0x3F; i++) { outSISIDXREG(SISSR, i, sisReg->sisRegs3C4[i]); } @@ -1037,13 +1049,17 @@ SiS301BSave(ScrnInfoPtr pScrn, SISRegPtr sisReg) SISPtr pSiS = SISPTR(pScrn); int Part1max, Part2max, Part3max, Part4max; - Part1max = 0x37; /* 0x23, but we also need 2c-2e, 35-37 */ + Part1max = 0x4c; Part2max = 0x4d; Part3max = 0x3e; - if(pSiS->VBFlags & (VB_301LV|VB_302LV|VB_302ELV)) + Part4max = 0x23; + if(pSiS->VBFlags & (VB_301C|VB_302ELV)) { + Part2max = 0xff; + Part4max = 0x3c; + } + if(pSiS->VBFlags & (VB_301LV|VB_302LV)) { Part4max = 0x34; - else - Part4max = 0x23; + } SiSVBSave(pScrn, sisReg, Part1max, Part2max, Part3max, Part4max); @@ -1061,10 +1077,14 @@ SiS301BRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg) Part1max = 0x23; Part2max = 0x4d; Part3max = 0x3e; - if(pSiS->VBFlags & (VB_301LV|VB_302LV|VB_302ELV)) - Part4max = 0x24; - else - Part4max = 0x22; + Part4max = 0x22; + if(pSiS->VBFlags & (VB_301C|VB_302ELV)) { + Part2max = 0xff; + Part4max = 0x3c; + } + if(pSiS->VBFlags & (VB_301LV|VB_302LV)) { + Part4max = 0x34; + } SiS_DisableBridge(pSiS->SiS_Pr, &pSiS->sishw_ext); @@ -1243,79 +1263,24 @@ SiSRestoreBridge(ScrnInfoPtr pScrn, SISRegPtr sisReg) sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); #endif - for(i = 0x30; i <= 0x39; i++) { + for(i = 0x30; i <= 0x3b; i++) { if(i == 0x34) continue; outSISIDXREG(SISCR, i, sisReg->sisRegs3D4[i]); } if(pSiS->VGAEngine == SIS_315_VGA) { - outSISIDXREG(SISCR, 0x63, sisReg->sisRegs3D4[0x63]); + outSISIDXREG(SISCR, pSiS->myCR63, sisReg->sisRegs3D4[pSiS->myCR63]); if(pSiS->sishw_ext.jChipType < SIS_661) { outSISIDXREG(SISCR, 0x79, sisReg->sisRegs3D4[0x79]); } } } -#if 0 /* The following function should take a threshold value - * from predefined tables. This is only needed on some - * 530 boards, which have an ESS sound device on-board. - * However, I don't know how to calculate the index to - * be submitted to this function. - */ -unsigned short -SiS_CalcSpecial530Threshold(ScrnInfoPtr pScrn, DisplayModePtr mode, int index) -{ - SISPtr pSiS = SISPTR(pScrn); - static const unsigned char t640x480[3][24] = { - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,A9, /* b4 - 9d - depth 8 */ - 0, 0,11,14,14, 0, 0, 0, 0, 0, 0,9D }, - { 0, 0, 0, 0, 0,12,15, 0, 0, 0,92,91, /* 9c - 85 - depth 16 */ - 0,31,31,31,31, 0, 0, 0, 0, 0, 0,85 }, - { 0, 0, 0, 0, 0,17,22,25, 0, 0, 0,79, /* 84 - ? - depth 32 */ - 0,31,31, 0, 0, 0, 0, 0, 0, 0, 0,6d } - } - static const unsigned char t800x600[3][24] = { - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,61, - 0,18,25,30,27,31,31,31, 0, 0, 0, 0 }, - {55, 0, 0, 0, 0, 9,10,15,18,19, 0, 0, - ... to be continued - - depthindex = (pSiS->CurrentLayout.bitsPerPixel + 1) >> 3; - if(depthindex == 3) return(0); - if(depthindex == 4) depthindex--; - depthindex--; - - switch(mode->HDisplay) { - case 640: - if(mode->VDisplay == 480) { - return(t640x480[depthindex][index]; - } else return(0); - case 800: - if(mode->VDisplay == 600) { - return(t800x600[depthindex][index]; - } else return(0); - case 1024: - if(mode->VDisplay == 768) { - return(t1024x768[depthindex][index]; - } else return(0); - case 1280: - if(mode->VDisplay == 1024) { - return(t1280x1024[depthindex][index]; - } else return(0); - case 1600: - if(mode->VDisplay == 1200) { - return(t1600x1200[depthindex][index]; - } else return(0); - default: return(0); - } -} -#endif - /* Auxiliary function to find real memory clock (in Khz) */ /* Not for 530/620 if UMA (on these, the mclk is stored in SR10) */ int SiSMclk(SISPtr pSiS) -{ +{ int mclk; unsigned char Num, Denum, Base; @@ -1393,24 +1358,38 @@ SiSMclk(SISPtr pSiS) * For VGA2, we share the bandwith equally. */ static int -SiSEstimateCRT2Clock(ScrnInfoPtr pScrn) +SiSEstimateCRT2Clock(ScrnInfoPtr pScrn, BOOLEAN IsForMergedFBCRT2) { SISPtr pSiS = SISPTR(pScrn); if(pSiS->VBFlags & CRT2_LCD) { - if(pSiS->VBLCDFlags & (VB_LCD_320x480 | VB_LCD_800x600 | VB_LCD_640x480)) + if(pSiS->VBLCDFlags & (VB_LCD_320x480 | VB_LCD_800x600 | VB_LCD_640x480)) { return 40000; - else if(pSiS->VBLCDFlags & (VB_LCD_1024x768 | VB_LCD_1024x600 | VB_LCD_1152x768)) + } else if(pSiS->VBLCDFlags & (VB_LCD_1024x768 | VB_LCD_1024x600 | VB_LCD_1152x768)) { return 65000; - else if(pSiS->VBLCDFlags & VB_LCD_1280x768) + } else if(pSiS->VBLCDFlags & VB_LCD_1280x720) { + return 75000; + } else if(pSiS->VBLCDFlags & VB_LCD_1280x768) { return 81000; - else if(pSiS->VBLCDFlags & (VB_LCD_1280x1024 | VB_LCD_1280x960 | VB_LCD_1400x1050)) + } else if(pSiS->VBLCDFlags & VB_LCD_1280x800) { + /* Must fake clock; built-in mode shows 83 for VGA, but uses only 70 for LCD */ + if(IsForMergedFBCRT2) return 83000; + else return 70000; + } else if(pSiS->VBLCDFlags & VB_LCD_1400x1050) { + /* Must fake clock; built-in mode shows 122 for VGA, but uses only 108 for LCD */ + if(IsForMergedFBCRT2) return 123000; + else return 108000; + } else if(pSiS->VBLCDFlags & (VB_LCD_1280x1024 | VB_LCD_1280x960)) { return 108000; - else if(pSiS->VBLCDFlags & VB_LCD_1600x1200) + } else if(pSiS->VBLCDFlags & VB_LCD_1680x1050) { + /* Must fake clock; built-in mode shows 147 for VGA, but uses only 122 for LCD */ + if(IsForMergedFBCRT2) return 148000; + else return 122000; + } else if(pSiS->VBLCDFlags & VB_LCD_1600x1200) { return 162000; - else if((pSiS->VBLCDFlags & VB_LCD_CUSTOM) && (pSiS->SiS_Pr->CP_HaveCustomData)) + } else if((pSiS->VBLCDFlags & VB_LCD_CUSTOM) && (pSiS->SiS_Pr->CP_HaveCustomData)) { return pSiS->SiS_Pr->CP_MaxClock; - else + } else return 108000; } else if(pSiS->VBFlags & CRT2_TV) { if(pSiS->VBFlags & VB_CHRONTEL) { @@ -1422,7 +1401,10 @@ SiSEstimateCRT2Clock(ScrnInfoPtr pScrn) return 70000; } } else if(pSiS->VBFlags & VB_SISBRIDGE) { - return 70000; + if(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPR) + return 75000; + else + return 70000; } } @@ -1443,10 +1425,16 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, BOOLEAN IsForCRT2) int bytesperpixel = (bpp + 7) / 8; float magic=0.0, total, crt2used, maxcrt2; int crt2clock, max=0; +#ifdef __SUNPRO_C +#define const +#endif const float magic300[4] = { 1.2, 1.368421, 2.263158, 1.2}; const float magic630[4] = { 1.441177, 1.441177, 2.588235, 1.441177 }; const float magic315[4] = { 1.2, 1.368421, 1.368421, 1.2 }; const float magic550[4] = { 1.441177, 1.441177, 2.588235, 1.441177 }; +#ifdef __SUNPRO_C +#undef const +#endif BOOLEAN DHM, GetForCRT1; switch(pSiS->Chipset) { @@ -1538,7 +1526,7 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, BOOLEAN IsForCRT2) 301B anyway */ crt2used = 0.0; - crt2clock = SiSEstimateCRT2Clock(pScrn); + crt2clock = SiSEstimateCRT2Clock(pScrn, IsForCRT2); if(crt2clock) { crt2used = crt2clock + 2000; } diff --git a/src/sis_dac.h b/src/sis_dac.h index fec0643..cbce161 100644 --- a/src/sis_dac.h +++ b/src/sis_dac.h @@ -1,35 +1,32 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h,v 1.15 2003/10/30 18:53:42 twini Exp $ */ +/* $XFree86$ */ /* * DAC helper functions (Save/Restore, MemClk, etc) * Definitions and prototypes * - * Copyright 1998,1999 by Alan Hourihane, Wigan, England. - * Copyright 2001, 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 provider not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. The provider 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 PROVIDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE PROVIDER 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: Alan Hourihane <alanh@fairlite.demon.co.uk> - * Mike Chapman <mike@paranoia.com>, - * Juanjo Santamarta <santamarta@ctv.es>, - * Mitani Hiroshi <hmitani@drl.mei.co.jp> - * David Thomas <davtom@dream.org.uk>. - * Thomas Winischhofer <thomas@winischhofer.net> */ int SiS_compute_vclk(int Clock, int *out_n, int *out_dn, int *out_div, @@ -63,6 +60,8 @@ extern void SiS_SetCH701x(SiS_Private *SiS_Pr, USHORT tempbx); extern USHORT SiS_GetCH70xx(SiS_Private *SiS_Pr, USHORT tempbx); extern void SiS_SetCH70xx(SiS_Private *SiS_Pr, USHORT tempbx); extern void SiS_SetCH70xxANDOR(SiS_Private *SiS_Pr, USHORT tempax,USHORT tempbh); +extern void SiS_SetTrumpReg(SiS_Private *SiS_Pr, USHORT tempbx); +extern USHORT SiS_GetTrumpReg(SiS_Private *SiS_Pr, USHORT tempbx); extern void SiS_DDC2Delay(SiS_Private *SiS_Pr, USHORT delaytime); extern USHORT SiS_ReadDDC1Bit(SiS_Private *SiS_Pr); extern USHORT SiS_HandleDDC(SiS_Private *SiS_Pr, unsigned long VBFlags, int VGAEngine, @@ -72,10 +71,3 @@ extern void SiS_DisplayOn(SiS_Private *SiS_Pr); extern unsigned char SiS_GetSetModeID(ScrnInfoPtr pScrn, unsigned char id); extern void SiS_SetEnableDstn(SiS_Private *SiS_Pr, int enable); extern void SiS_SetEnableFstn(SiS_Private *SiS_Pr, int enable); - - - - - - - diff --git a/src/sis_dga.c b/src/sis_dga.c index 549ffbe..a806cec 100644 --- a/src/sis_dga.c +++ b/src/sis_dga.c @@ -1,14 +1,16 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c,v 1.11 2003/10/30 18:53:42 twini Exp $ */ +/* $XFree86$ */ /* * SiS DGA handling * - * Copyright 2000 by Alan Hourihane, Sychdyn, North Wales, UK. - * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2000 by Alan Hourihane, Sychdyn, North Wales, UK. + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria * * Portions from radeon_dga.c which is * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. * + * Licensed under the following terms: + * * 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 diff --git a/src/sis_dri.c b/src/sis_dri.c index 97be829..c143d2f 100644 --- a/src/sis_dri.c +++ b/src/sis_dri.c @@ -1,12 +1,38 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.39 2003/11/20 19:53:23 twini Exp $ */ +/* $XFree86$ */ /* - * DRI wrapper for 300 and 315 series + * DRI wrapper for 300 and 315 series * - * Preliminary 315/330 support by Thomas Winischhofer - * Mesa 4/5 changes by Eric Anholt + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria * - * Taken and modified from tdfx_dri.c, mga_dri.c + * Preliminary 315/330 support by Thomas Winischhofer + * Portions of Mesa 4/5 changes by Eric Anholt * + * Licensed under the following terms: + * + * 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 appears in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * 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 expressed or implied warranty. + * + * 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. + * + * Previously taken and modified from tdfx_dri.c, mga_dri.c + * + * Authors: Can-Ru Yeou, SiS Inc. + * Alan Hourihane, Wigan, England, + * Thomas Winischhofer <thomas@winischhofer.net> + * others. */ #include "xf86.h" diff --git a/src/sis_dri.h b/src/sis_dri.h index 90473a4..29ce331 100644 --- a/src/sis_dri.h +++ b/src/sis_dri.h @@ -1,6 +1,35 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h,v 1.10 2003/10/30 18:53:42 twini Exp $ */ - -/* modified from tdfx_dri.h */ +/* $XFree86$ */ +/* + * SiS DRI wrapper + * + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * + * Licensed under the following terms: + * + * 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 appears in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * 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 expressed or implied warranty. + * + * 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. + * + * Authors: Can-Ru Yeou, SiS Inc., + * Thomas Winischhofer <thomas@winischhofer.net>, + * others. + * + * Previously taken and modified from tdfx_dri.h + */ #ifndef _SIS_DRI_ #define _SIS_DRI_ diff --git a/src/sis_driver.c b/src/sis_driver.c index 833e3c3..1ea6621 100644 --- a/src/sis_driver.c +++ b/src/sis_driver.c @@ -1,59 +1,46 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.156 2003/11/20 19:53:23 twini Exp $ */ +/* $XFree86$ */ /* - * Copyright 2001, 2002, 2003 by Thomas Winischhofer, Vienna, Austria. + * SiS driver main code * - * Formerly based on old code which is - * Copyright 1998,1999 by Alan Hourihane, Wigan, England. + * 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. * * Author: Thomas Winischhofer <thomas@winischhofer.net> - * - driver entirely rewritten, only basic structure taken from old code - * (except sis_dri.c, sis_shadow.c and parts of sis_dga.c; - * these were taken over; sis_dri.c was slightly adapted): - * - rewritten for 5597/5598, 6326 and 530/620 chipsets, - * - rewritten for 300 series (300/540/630/730), - * - 315 series (315/550/650/651/M650/661FX/M661FX/M661MX/740/741) support - * - 330 series (330/760) support - * - dual head support for 300, 315 and 330 series - * - merged-framebuffer support for 300, 315 and 330 series - * - pseudo-xinerama extension for MergedFB mode - * - SiS video bridge support for 300, 315 and 330 series (LCD, TV, VGA2), - * - LVDS support for 300 and 315 series, - * - Chrontel 7019/LVDS support (650, 740; up to 1600x1200) - * - Chrontel 700x, 701x support for TV output - * - VESA mode switching (deprecated), - * - plasma panel support, - * - entirely rewritten Xv support for 300 series - * - Xv support for 5597/5598, 6326, 530/620, 315 and 330 series - * - TV and hi-res support for the 6326 - * - color HW cursor support for 300(emulated), 315 and 330 series - * - SiSCtrl interface for 300, 315 and 330 series - * - etc. etc. etc. + * - driver entirely rewritten since 2001, only basic structure taken from + * old code (except sis_dri.c, sis_shadow.c, sis_accel.c and parts of + * sis_dga.c; these were mostly taken over; sis_dri.c was changed for + * new versions of the DRI layer) * - * This notice covers the entire driver code + * This notice covers the entire driver code unless otherwise indicated. * - * Authors of old code: - * Alan Hourihane, alanh@fairlite.demon.co.uk + * Formerly based on code which is + * Copyright (C) 1998, 1999 by Alan Hourihane, Wigan, England. + * Written by: + * Alan Hourihane <alanh@fairlite.demon.co.uk>, * Mike Chapman <mike@paranoia.com>, * Juanjo Santamarta <santamarta@ctv.es>, - * Mitani Hiroshi <hmitani@drl.mei.co.jp> + * Mitani Hiroshi <hmitani@drl.mei.co.jp>, * David Thomas <davtom@dream.org.uk>. */ @@ -166,7 +153,7 @@ static SymTabRec SISChipsets[] = { { PCI_CHIP_SIS550, "SIS550" }, { PCI_CHIP_SIS650, "SIS650/M650/651/740" }, { PCI_CHIP_SIS330, "SIS330(Xabre)" }, - { PCI_CHIP_SIS660, "SIS660/661FX/M661FX/M661MX/741/760" }, + { PCI_CHIP_SIS660, "SIS660/661FX/M661FX/M661MX/741/741GX/M741/760/M760" }, { -1, NULL } }; @@ -496,10 +483,16 @@ SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int fla ((pSiS->VBFlags & (VB_LVDS | VB_CHRONTEL)) == VB_LVDS))) { #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { - if(!pSiS->BlankCRT2) inSISIDXREG(SISSR, 0x11, pSiS->LCDon); + if(!pSiS->BlankCRT2) { + inSISIDXREG(SISSR, 0x11, pSiS->LCDon); + if(pSiS->sishw_ext.jChipType >= SIS_661) pSiS->LCDon &= 0x0f; + } } else #endif - if(!pSiS->Blank) inSISIDXREG(SISSR, 0x11, pSiS->LCDon); + if(!pSiS->Blank) { + inSISIDXREG(SISSR, 0x11, pSiS->LCDon); + if(pSiS->sishw_ext.jChipType >= SIS_661) pSiS->LCDon &= 0x0f; + } } } } @@ -609,7 +602,7 @@ SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int fla break; case SIS_315_VGA: if((!pSiS->CRT1off) && ((!(pSiS->VBFlags & CRT1_LCDA)) || (pSiS->VBFlags & VB_301C))) { - setSISIDXREG(SISCR, 0x63, 0xbf, cr63); + setSISIDXREG(SISCR, pSiS->myCR63, 0xbf, cr63); setSISIDXREG(SISSR, 0x07, 0xef, sr7); } /* fall through */ @@ -633,7 +626,11 @@ SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int fla (pSiS->VBFlags & (VB_301|VB_30xBDH|VB_LVDS))) || ((pSiS->VGAEngine == SIS_315_VGA) && ((pSiS->VBFlags & (VB_LVDS | VB_CHRONTEL)) == VB_LVDS))) { - setSISIDXREG(SISSR, 0x11, ~0x0c, sr11); + if(pSiS->sishw_ext.jChipType >= SIS_661) { + setSISIDXREG(SISSR, 0x11, ~0xfc, sr11); + } else { + setSISIDXREG(SISSR, 0x11, ~0x0c, sr11); + } } if(pSiS->VGAEngine == SIS_300_VGA) { if((pSiS->VBFlags & (VB_301B|VB_301C|VB_302B)) && @@ -865,6 +862,7 @@ SISProbe(DriverPtr drv, int flags) pSiSEnt->FbBase = pSiSEnt->IOBase = NULL; pSiSEnt->forceUnmapIOBase = FALSE; pSiSEnt->forceUnmapFbBase = FALSE; + pSiSEnt->HWCursorCBufNum = pSiSEnt->HWCursorMBufNum = 0; #ifdef __alpha__ pSiSEnt->MapCountIOBaseDense = 0; pSiSEnt->IOBaseDense = NULL; @@ -1585,6 +1583,8 @@ SiSUpdateXineramaScreenInfo(ScrnInfoPtr pScrn1) /* Attention: Usage of RandR may lead into virtual X and Y values * actually smaller than our MetaModes! To avoid this, we calculate * the maxCRT fields here (and not somewhere else, like in CopyNLink) + * + * *** For now: RandR will be disabled if SiS pseudo-Xinerama is on */ if((pSiS->SiSXineramaVX != pScrn1->virtualX) || (pSiS->SiSXineramaVY != pScrn1->virtualY)) { @@ -2334,12 +2334,19 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) xf86LoaderReqSymLists(vgahwSymbols, NULL); + /* Due to the liberal license terms this is needed for + * keeping the copyright notice readable and intact in + * binary distributions. Removing this is a copyright + * infringement. Please read the license terms above. + */ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "SiS driver (%d/%02d/%02d-%d) by " - "Thomas Winischhofer <thomas@winischhofer.net>\n", + "SiS driver (%d/%02d/%02d-%d)\n", SISDRIVERVERSIONYEAR + 2000, SISDRIVERVERSIONMONTH, SISDRIVERVERSIONDAY, SISDRIVERREVISION); xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Copyright (C) 2001-2004 Thomas Winischhofer <thomas@winischhofer.net> and others\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Compiled for XFree86 %d.%d.%d.%d\n", XF86_VERSION_MAJOR, XF86_VERSION_MINOR, XF86_VERSION_PATCH, XF86_VERSION_SNAP); @@ -2553,12 +2560,14 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) /* Determine chipset and VGA engine type */ pSiS->ChipFlags = 0; pSiS->SiS_SD_Flags = 0; + pSiS->HWCursorMBufNum = pSiS->HWCursorCBufNum = 0; switch(pSiS->Chipset) { case PCI_CHIP_SIS300: pSiS->sishw_ext.jChipType = SIS_300; pSiS->VGAEngine = SIS_300_VGA; pSiS->SiS_SD_Flags |= SiS_SD_IS300SERIES; + pSiS->mmioSize = 128; break; case PCI_CHIP_SIS630: /* 630 + 730 */ pSiS->sishw_ext.jChipType = SIS_630; @@ -2567,17 +2576,21 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } pSiS->VGAEngine = SIS_300_VGA; pSiS->SiS_SD_Flags |= SiS_SD_IS300SERIES; + pSiS->mmioSize = 128; break; case PCI_CHIP_SIS540: pSiS->sishw_ext.jChipType = SIS_540; pSiS->VGAEngine = SIS_300_VGA; pSiS->SiS_SD_Flags |= SiS_SD_IS300SERIES; + pSiS->mmioSize = 128; break; case PCI_CHIP_SIS315H: pSiS->sishw_ext.jChipType = SIS_315H; pSiS->VGAEngine = SIS_315_VGA; pSiS->ChipFlags |= SiSCF_315Core; pSiS->SiS_SD_Flags |= SiS_SD_IS315SERIES; + pSiS->myCR63 = 0x63; + pSiS->mmioSize = 128; break; case PCI_CHIP_SIS315: /* Override for simplicity */ @@ -2586,6 +2599,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->ChipFlags |= SiSCF_315Core; pSiS->VGAEngine = SIS_315_VGA; pSiS->SiS_SD_Flags |= SiS_SD_IS315SERIES; + pSiS->myCR63 = 0x63; + pSiS->mmioSize = 128; break; case PCI_CHIP_SIS315PRO: /* Override for simplicity */ @@ -2594,12 +2609,16 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->ChipFlags |= SiSCF_315Core; pSiS->VGAEngine = SIS_315_VGA; pSiS->SiS_SD_Flags |= SiS_SD_IS315SERIES; + pSiS->myCR63 = 0x63; + pSiS->mmioSize = 128; break; case PCI_CHIP_SIS550: pSiS->sishw_ext.jChipType = SIS_550; pSiS->VGAEngine = SIS_315_VGA; pSiS->ChipFlags |= SiSCF_Integrated; pSiS->SiS_SD_Flags |= SiS_SD_IS315SERIES; + pSiS->myCR63 = 0x63; + pSiS->mmioSize = 128; break; case PCI_CHIP_SIS650: /* 650 + 740 */ pSiS->sishw_ext.jChipType = SIS_650; @@ -2609,12 +2628,16 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->VGAEngine = SIS_315_VGA; pSiS->ChipFlags |= (SiSCF_Integrated | SiSCF_Real256ECore); pSiS->SiS_SD_Flags |= SiS_SD_IS315SERIES; + pSiS->myCR63 = 0x63; + pSiS->mmioSize = 128; break; case PCI_CHIP_SIS330: pSiS->sishw_ext.jChipType = SIS_330; pSiS->VGAEngine = SIS_315_VGA; pSiS->ChipFlags |= SiSCF_XabreCore; pSiS->SiS_SD_Flags |= SiS_SD_IS330SERIES; + pSiS->myCR63 = 0x63; + pSiS->mmioSize = 256; break; case PCI_CHIP_SIS660: /* 660, 661, 741, 760 */ { @@ -2623,19 +2646,23 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) case 0x06601039: pSiS->sishw_ext.jChipType = SIS_660; pSiS->ChipFlags |= SiSCF_Ultra256Core; + pSiS->mmioSize = 256; break; case 0x07601039: pSiS->sishw_ext.jChipType = SIS_760; pSiS->ChipFlags |= SiSCF_Ultra256Core; + pSiS->mmioSize = 256; break; case 0x07411039: pSiS->sishw_ext.jChipType = SIS_741; pSiS->ChipFlags |= SiSCF_Real256ECore; + pSiS->mmioSize = 128; break; case 0x06611039: default: pSiS->sishw_ext.jChipType = SIS_661; pSiS->ChipFlags |= SiSCF_Real256ECore; + pSiS->mmioSize = 128; } /* Detection could also be done by CR5C & 0xf8: 0x10 = 661 (CR5F & 0xc0: 0x00 both A0 and A1) @@ -2646,15 +2673,18 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->VGAEngine = SIS_315_VGA; pSiS->ChipFlags |= SiSCF_Integrated; pSiS->SiS_SD_Flags |= SiS_SD_IS330SERIES; + pSiS->myCR63 = 0x53; /* Yes, 0x53 */ } break; case PCI_CHIP_SIS530: pSiS->sishw_ext.jChipType = SIS_530; pSiS->VGAEngine = SIS_530_VGA; + pSiS->mmioSize = 64; break; default: pSiS->sishw_ext.jChipType = SIS_OLD; pSiS->VGAEngine = SIS_OLD_VGA; + pSiS->mmioSize = 64; break; } @@ -2671,10 +2701,12 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) */ pSiS->donttrustpdc = FALSE; - pSiS->sisfbpdc = 0; + pSiS->sisfbpdc = 0xff; + pSiS->sisfbpdca = 0xff; pSiS->sisfblcda = 0xff; pSiS->sisfbscalelcd = -1; pSiS->sisfbspecialtiming = CUT_NONE; + pSiS->sisfb_haveemi = FALSE; pSiS->OldMode = 0; pSiS->sisfbfound = FALSE; @@ -2750,6 +2782,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) if(pSiS->VGAEngine == SIS_300_VGA) { /* As of 1.5.11, sisfb saved the register for us (300 series) */ pSiS->sisfbpdc = mysisfbinfo.sisfb_lcdpdc; + if(!pSiS->sisfbpdc) pSiS->sisfbpdc = 0xff; } } if(sisfbversion >= 0x01050E) { @@ -2764,6 +2797,27 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) if(pSiS->VGAEngine == SIS_315_VGA) { pSiS->donttrustpdc = FALSE; pSiS->sisfbpdc = mysisfbinfo.sisfb_lcdpdc; + if(sisfbversion >= 0x010618) { + pSiS->sisfb_haveemi = mysisfbinfo.sisfb_haveemi ? TRUE : FALSE; + pSiS->sisfb_haveemilcd = TRUE; /* will match most cases */ + pSiS->sisfb_emi30 = mysisfbinfo.sisfb_emi30; + pSiS->sisfb_emi31 = mysisfbinfo.sisfb_emi31; + pSiS->sisfb_emi32 = mysisfbinfo.sisfb_emi32; + pSiS->sisfb_emi33 = mysisfbinfo.sisfb_emi33; + } + if(sisfbversion >= 0x010619) { + pSiS->sisfb_haveemilcd = mysisfbinfo.sisfb_haveemilcd ? TRUE : FALSE; + } + if(sisfbversion >= 0x01061f) { + pSiS->sisfbpdca = mysisfbinfo.sisfb_lcdpdca; + } else { + if(pSiS->sisfbpdc) { + pSiS->sisfbpdca = (pSiS->sisfbpdc & 0xf0) >> 3; + pSiS->sisfbpdc = (pSiS->sisfbpdc & 0x0f) << 1; + } else { + pSiS->sisfbpdca = pSiS->sisfbpdc = 0xff; + } + } } } } @@ -2822,6 +2876,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->DualHeadMode = TRUE; pSiSEnt->DisableDual = FALSE; pSiSEnt->BIOS = NULL; + pSiSEnt->ROM661New = FALSE; pSiSEnt->SiS_Pr = NULL; pSiSEnt->RenderAccelArray = NULL; } else { @@ -2870,8 +2925,20 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->SiS_Pr->SiS_CHOverScan = -1; pSiS->SiS_Pr->SiS_ChSW = FALSE; pSiS->SiS_Pr->SiS_CustomT = CUT_NONE; + pSiS->SiS_Pr->PanelSelfDetected = FALSE; + pSiS->SiS_Pr->UsePanelScaler = -1; + pSiS->SiS_Pr->CenterScreen = -1; pSiS->SiS_Pr->CRT1UsesCustomMode = FALSE; + pSiS->SiS_Pr->PDC = pSiS->SiS_Pr->PDCA = -1; pSiS->SiS_Pr->LVDSHL = -1; + pSiS->SiS_Pr->HaveEMI = FALSE; + pSiS->SiS_Pr->HaveEMILCD = FALSE; + pSiS->SiS_Pr->OverruleEMI = FALSE; + pSiS->SiS_Pr->SiS_SensibleSR11 = FALSE; + if(pSiS->sishw_ext.jChipType >= SIS_661) { + pSiS->SiS_Pr->SiS_SensibleSR11 = TRUE; + } + pSiS->SiS_Pr->SiS_MyCR63 = pSiS->myCR63; } /* Get our relocated IO registers */ @@ -3105,13 +3172,15 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->sishw_ext.pjVirtualRomBase = NULL; pSiS->BIOS = NULL; pSiS->sishw_ext.UseROM = FALSE; + pSiS->ROM661New = FALSE; if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { #ifdef SISDUALHEAD if(pSiSEnt) { - if(pSiSEnt->BIOS) { + if(pSiSEnt->BIOS) { pSiS->BIOS = pSiSEnt->BIOS; pSiS->sishw_ext.pjVirtualRomBase = pSiS->BIOS; + pSiS->ROM661New = pSiSEnt->ROM661New; } } #endif @@ -3121,20 +3190,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) "Could not allocate memory for video BIOS image\n"); } else { unsigned long segstart; - unsigned short romptr; + unsigned short romptr, pciid; BOOLEAN found; - int i; - static const char sis_rom_sig[] = "Silicon Integrated Systems"; - static const char *sis_sig[15] = { - "300", "540", "630", "730", - "315", "315", "315", "5315", "6325", "6325", - "Xabre", "6330", "6330", "6330", "6330" - }; - static const unsigned short sis_nums[15] = { - SIS_300, SIS_540, SIS_630, SIS_730, - SIS_315PRO, SIS_315H, SIS_315, SIS_550, SIS_650, SIS_740, - SIS_330, SIS_661, SIS_741, SIS_660, SIS_760 - }; found = FALSE; for(segstart=BIOS_BASE; segstart<0x000f0000; segstart+=0x00001000) { @@ -3147,29 +3204,19 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) if((pSiS->BIOS[0] != 0x55) || (pSiS->BIOS[1] != 0xaa)) continue; - romptr = pSiS->BIOS[0x12] | (pSiS->BIOS[0x13] << 8); - if(romptr > (BIOS_SIZE - strlen(sis_rom_sig))) continue; - if(strncmp(sis_rom_sig, (char *)&pSiS->BIOS[romptr], strlen(sis_rom_sig)) != 0) continue; - - romptr = pSiS->BIOS[0x14] | (pSiS->BIOS[0x15] << 8); - if(romptr > (BIOS_SIZE - 5)) continue; - for(i = 0; (i < 15) && (!found); i++) { - if(strncmp(sis_sig[i], (char *)&pSiS->BIOS[romptr], strlen(sis_sig[i])) == 0) { - if(sis_nums[i] == pSiS->sishw_ext.jChipType) { - found = TRUE; - break; - } else { - if((pSiS->sishw_ext.jChipType != SIS_740) && - (pSiS->sishw_ext.jChipType != SIS_661) && - (pSiS->sishw_ext.jChipType != SIS_741) && - (pSiS->sishw_ext.jChipType != SIS_660)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Ignoring BIOS for SiS %s at 0x%lx\n", sis_sig[i], segstart); - } - } - } - } - if(found) break; + romptr = pSiS->BIOS[0x18] | (pSiS->BIOS[0x19] << 8); + if(romptr > (BIOS_SIZE - 8)) continue; + if((pSiS->BIOS[romptr] != 'P') || (pSiS->BIOS[romptr+1] != 'C') || + (pSiS->BIOS[romptr+2] != 'I') || (pSiS->BIOS[romptr+3] != 'R')) continue; + + pciid = pSiS->BIOS[romptr+4] | (pSiS->BIOS[romptr+5] << 8); + if(pciid != 0x1039) continue; + + pciid = pSiS->BIOS[romptr+6] | (pSiS->BIOS[romptr+7] << 8); + if(pciid != pSiS->Chipset) continue; + + found = TRUE; + break; } if(!found) { @@ -3178,14 +3225,18 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) xfree(pSiS->BIOS); pSiS->BIOS = NULL; } else { -#ifdef SISDUALHEAD - if(pSiSEnt) pSiSEnt->BIOS = pSiS->BIOS; -#endif pSiS->sishw_ext.pjVirtualRomBase = pSiS->BIOS; + pSiS->ROM661New = SiSDetermineROMLayout661(pSiS->SiS_Pr,&pSiS->sishw_ext); romptr = pSiS->BIOS[0x16] | (pSiS->BIOS[0x17] << 8); xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Video BIOS version \"%7s\" found at 0x%lx\n", - &pSiS->BIOS[romptr], segstart); + "Video BIOS version \"%7s\" found at 0x%lx (%s data layout)\n", + &pSiS->BIOS[romptr], segstart, pSiS->ROM661New ? "new" : "old"); +#ifdef SISDUALHEAD + if(pSiSEnt) { + pSiSEnt->BIOS = pSiS->BIOS; + pSiSEnt->ROM661New = pSiS->ROM661New; + } +#endif } } } @@ -3218,12 +3269,15 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiSEnt->ForceCRT1Type = pSiS->ForceCRT1Type; pSiSEnt->ForceCRT2Type = pSiS->ForceCRT2Type; pSiSEnt->ForceTVType = pSiS->ForceTVType; + pSiSEnt->ForceYPbPrType = pSiS->ForceYPbPrType; + pSiSEnt->ForceYPbPrAR = pSiS->ForceYPbPrAR; pSiSEnt->UsePanelScaler = pSiS->UsePanelScaler; - pSiSEnt->PDC = pSiS->PDC; + pSiSEnt->CenterLCD = pSiS->CenterLCD; pSiSEnt->DSTN = pSiS->DSTN; pSiSEnt->OptTVStand = pSiS->OptTVStand; pSiSEnt->NonDefaultPAL = pSiS->NonDefaultPAL; pSiSEnt->NonDefaultNTSC = pSiS->NonDefaultNTSC; + pSiSEnt->chtvtype = pSiS->chtvtype; pSiSEnt->OptTVOver = pSiS->OptTVOver; pSiSEnt->OptTVSOver = pSiS->OptTVSOver; pSiSEnt->chtvlumabandwidthcvbs = pSiS->chtvlumabandwidthcvbs; @@ -3256,6 +3310,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiSEnt->XvOnCRT2 = pSiS->XvOnCRT2; pSiSEnt->AllowHotkey = pSiS->AllowHotkey; pSiSEnt->enablesisctrl = pSiS->enablesisctrl; + pSiSEnt->SenseYPbPr = pSiS->SenseYPbPr; #ifdef SIS_CP SIS_CP_DRIVER_COPYOPTIONSENT #endif @@ -3279,7 +3334,6 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) "Master head ruled: Acceleration shall be %s\n", pSiS->NoAccel ? "disabled" : "enabled"); } - pSiS->TurboQueue = pSiSEnt->TurboQueue; pSiS->restorebyset = pSiSEnt->restorebyset; pSiS->AllowHotkey = pSiS->AllowHotkey; @@ -3291,13 +3345,15 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->ForceCRT1Type = pSiSEnt->ForceCRT1Type; pSiS->ForceCRT2Type = pSiSEnt->ForceCRT2Type; pSiS->UsePanelScaler = pSiSEnt->UsePanelScaler; - pSiS->PDC = pSiSEnt->PDC; + pSiS->CenterLCD = pSiSEnt->CenterLCD; pSiS->DSTN = pSiSEnt->DSTN; pSiS->OptTVStand = pSiSEnt->OptTVStand; pSiS->NonDefaultPAL = pSiSEnt->NonDefaultPAL; pSiS->NonDefaultNTSC = pSiSEnt->NonDefaultNTSC; pSiS->chtvtype = pSiSEnt->chtvtype; pSiS->ForceTVType = pSiSEnt->ForceTVType; + pSiS->ForceYPbPrType = pSiSEnt->ForceYPbPrType; + pSiS->ForceYPbPrAR = pSiSEnt->ForceYPbPrAR; pSiS->OptTVOver = pSiSEnt->OptTVOver; pSiS->OptTVSOver = pSiSEnt->OptTVSOver; pSiS->chtvlumabandwidthcvbs = pSiSEnt->chtvlumabandwidthcvbs; @@ -3319,6 +3375,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->tvypos = pSiSEnt->tvypos; pSiS->tvxscale = pSiSEnt->tvxscale; pSiS->tvyscale = pSiSEnt->tvyscale; + pSiS->SenseYPbPr = pSiSEnt->SenseYPbPr; if(!pSiS->CRT1gammaGiven) { if(pSiSEnt->CRT1gammaGiven) pSiS->CRT1gamma = pSiSEnt->CRT1gamma; @@ -3361,6 +3418,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, from, "Internal OEM LCD/TV/VGA2 data usage is disabled\n"); pSiS->SiS_Pr->UsePanelScaler = pSiS->UsePanelScaler; + pSiS->SiS_Pr->CenterScreen = pSiS->CenterLCD; } /* Do basic configuration */ @@ -3400,8 +3458,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->IOAddress = pSiS->PciInfo->memBase[1] & 0xFFFFFFF0; } - xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX\n", - (unsigned long)pSiS->IOAddress); + xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX (size %ldK)\n", + (unsigned long)pSiS->IOAddress, pSiS->mmioSize); pSiS->sishw_ext.bIntegratedMMEnabled = TRUE; /* Register the PCI-assigned resources. */ @@ -3484,7 +3542,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->cursorBufferNum = 0; #ifdef SISDUALHEAD if(pSiSEnt) pSiSEnt->cursorBufferNum = 0; -#endif +#endif break; case SIS_315_VGA: @@ -3506,8 +3564,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } #endif if(pSiS->HWCursor) { - pSiS->availMem -= pSiS->CursorSize; - if(pSiS->OptUseColorCursor) pSiS->availMem -= pSiS->CursorSize; + pSiS->availMem -= (pSiS->CursorSize * 2); + if(pSiS->OptUseColorCursor) pSiS->availMem -= (pSiS->CursorSize * 2); } pSiS->cursorBufferNum = 0; #ifdef SISDUALHEAD @@ -3747,10 +3805,15 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) /* Backup VB connection and CRT1 on/off register */ if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { - inSISIDXREG(SISCR, 0x32, pSiS->oldCR32); - inSISIDXREG(SISCR, 0x17, pSiS->oldCR17); - inSISIDXREG(SISCR, 0x63, pSiS->oldCR63); inSISIDXREG(SISSR, 0x1f, pSiS->oldSR1F); + inSISIDXREG(SISCR, 0x17, pSiS->oldCR17); + inSISIDXREG(SISCR, 0x32, pSiS->oldCR32); + inSISIDXREG(SISCR, 0x36, pSiS->oldCR36); + inSISIDXREG(SISCR, 0x37, pSiS->oldCR37); + if(pSiS->VGAEngine == SIS_315_VGA) { + inSISIDXREG(SISCR, pSiS->myCR63, pSiS->oldCR63); + } + pSiS->postVBCR32 = pSiS->oldCR32; } @@ -3858,13 +3921,43 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "No digitally connected LCD panel found, LCD-via-CRT1 disabled\n"); pSiS->ForceCRT1Type = CRT1_VGA; - } else if(!(pSiS->VBLCDFlags & (VB_LCD_1024x768|VB_LCD_1280x1024|VB_LCD_1400x1050|VB_LCD_1600x1200))) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "LCD-via-CRT1 not supported for this LCD resolution\n"); - pSiS->ForceCRT1Type = CRT1_VGA; } } + /* Setup SD flags */ + pSiS->SiS_SD_Flags |= SiS_SD_ADDLSUPFLAG; + + if(pSiS->VBFlags & (VB_SISTVBRIDGE | VB_CHRONTEL)) { + pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTTV; + } + +#ifdef ENABLE_YPBPR + if((pSiS->VGAEngine == SIS_315_VGA) && + (pSiS->VBFlags & (VB_301C|VB_301LV|VB_302LV|VB_302ELV))) { + pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTYPBPR; + if((pSiS->Chipset == PCI_CHIP_SIS660) || (pSiS->VBFlags & VB_301C)) { + pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTYPBPRAR; + } + } + if(pSiS->VBFlags & (VB_301|VB_301B|VB_302B)) { + pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTHIVISION; + } +#endif + + if(pSiS->VBFlags & CRT2_LCD) { + if((pSiS->VGAEngine != SIS_300_VGA) || (!(pSiS->VBFlags & VB_TRUMPION))) { + pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTSCALE; + if(pSiS->VBFlags & (VB_301|VB_301B|VB_302B|VB_301C)) { + pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTCENTER; + } + } + } + +#ifdef TWDEBUG /* @@@ TEST @@@ */ + pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTYPBPRAR; + xf86DrvMsg(0, X_INFO, "TEST: Support Aspect Ratio\n"); +#endif + /* Detect CRT2-TV and PAL/NTSC mode */ SISTVPreInit(pScrn); @@ -3872,13 +3965,20 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) SISCRT2PreInit(pScrn); /* Backup detected CRT2 devices */ - pSiS->detectedCRT2Devices = pSiS->VBFlags & (CRT2_LCD | CRT2_TV | CRT2_VGA | TV_AVIDEO | TV_SVIDEO | TV_SCART); + pSiS->detectedCRT2Devices = pSiS->VBFlags & (CRT2_LCD|CRT2_TV|CRT2_VGA|TV_AVIDEO|TV_SVIDEO|TV_SCART|TV_HIVISION|TV_YPBPR); - /* Setup SD flags */ - pSiS->SiS_SD_Flags |= SiS_SD_ADDLSUPFLAG; + if(!(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPR)) { + if((pSiS->ForceTVType != -1) && (pSiS->ForceTVType & TV_YPBPR)) { + pSiS->ForceTVType = -1; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "YPbPr TV output not supported\n"); + } + } - if(pSiS->VBFlags & (VB_SISTVBRIDGE | VB_CHRONTEL)) { - pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTTV; + if(!(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTHIVISION)) { + if((pSiS->ForceTVType != -1) && (pSiS->ForceTVType & TV_HIVISION)) { + pSiS->ForceTVType = -1; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "HiVision TV output not supported\n"); + } } if((pSiS->VBFlags & VB_SISTVBRIDGE) || @@ -3903,7 +4003,6 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) (pSiS->sishw_ext.jChipType >= SIS_661)) && (pSiS->VBFlags & (VB_301C | VB_302B | VB_301LV | VB_302LV)) && (pSiS->VBFlags & CRT2_LCD) && - (pSiS->VBLCDFlags & (VB_LCD_1024x768|VB_LCD_1280x1024|VB_LCD_1400x1050|VB_LCD_1600x1200)) && (pSiS->VESA != 1) ) { pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTLCDA; } else { @@ -3913,20 +4012,24 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->VBFlags |= pSiS->ForceCRT1Type; +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "SDFlags %lx\n", pSiS->SiS_SD_Flags); +#endif + /* Eventually overrule detected CRT2 type - * If no type forced, use the detected devices in the order VGA2->TV->LCD + * If no type forced, use the detected devices in the order TV->LCD->VGA2 * Since the Chrontel 7005 sometimes delivers wrong detection results, * we use a different order on such machines (LCD->TV) */ if(pSiS->ForceCRT2Type == CRT2_DEFAULT) { - if(pSiS->VBFlags & CRT2_VGA) - pSiS->ForceCRT2Type = CRT2_VGA; - else if((pSiS->VBFlags & CRT2_TV) && (!((pSiS->VBFlags & VB_CHRONTEL) && (pSiS->VGAEngine == SIS_300_VGA)))) + if((pSiS->VBFlags & CRT2_TV) && (!((pSiS->VBFlags & VB_CHRONTEL) && (pSiS->VGAEngine == SIS_300_VGA)))) pSiS->ForceCRT2Type = CRT2_TV; else if((pSiS->VBFlags & CRT2_LCD) && (pSiS->ForceCRT1Type == CRT1_VGA)) pSiS->ForceCRT2Type = CRT2_LCD; else if(pSiS->VBFlags & CRT2_TV) pSiS->ForceCRT2Type = CRT2_TV; + else if(pSiS->VBFlags & CRT2_VGA) + pSiS->ForceCRT2Type = CRT2_VGA; } switch(pSiS->ForceCRT2Type) { @@ -3999,11 +4102,20 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } } - /* Eventually overrule TV Type (SVIDEO, COMPOSITE, SCART) */ + /* Eventually overrule TV Type (SVIDEO, COMPOSITE, SCART, HIVISION, YPBPR) */ if(pSiS->VBFlags & VB_SISTVBRIDGE) { if(pSiS->ForceTVType != -1) { pSiS->VBFlags &= ~(TV_INTERFACE); + if(!(pSiS->VBFlags & VB_CHRONTEL)) { + pSiS->VBFlags &= ~(TV_CHSCART | TV_CHYPBPR525I); + } pSiS->VBFlags |= pSiS->ForceTVType; + if(pSiS->VBFlags & TV_YPBPR) { + pSiS->VBFlags &= ~(TV_STANDARD); + pSiS->VBFlags &= ~(TV_YPBPRAR); + pSiS->VBFlags |= pSiS->ForceYPbPrType; + pSiS->VBFlags |= pSiS->ForceYPbPrAR; + } } } @@ -4055,7 +4167,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) */ outSISIDXREG(SISCR, 0x17, usScratchCR17); if(pSiS->VGAEngine == SIS_315_VGA) { - outSISIDXREG(SISCR, 0x63, usScratchCR63); + outSISIDXREG(SISCR, pSiS->myCR63, usScratchCR63); } outSISIDXREG(SISCR, 0x32, usScratchCR32); if(pSiS->CRT1changed) { @@ -4112,7 +4224,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } if(pSiS->OptTVStand != -1) { if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { - if(!(pSiS->VBFlags & (TV_CHSCART | TV_CHHDTV))) { + if( (!((pSiS->VBFlags & VB_CHRONTEL) && (pSiS->VBFlags & (TV_CHSCART | TV_CHYPBPR525I)))) && + (!(pSiS->VBFlags & (TV_HIVISION | TV_YPBPR))) ) { pSiS->VBFlags &= ~(TV_PAL | TV_NTSC | TV_PALN | TV_PALM | TV_NTSCJ); if(pSiS->OptTVStand) { pSiS->VBFlags |= TV_PAL; @@ -4125,7 +4238,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } else { pSiS->OptTVStand = pSiS->NonDefaultPAL = -1; xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Option TVStandard ignored for SCART and 480i HDTV\n"); + "Option TVStandard ignored for YPbPr, HiVision and Chrontel-SCART\n"); } } else if(pSiS->Chipset == PCI_CHIP_SIS6326) { pSiS->SiS6326Flags &= ~SIS6326_TVPAL; @@ -4287,8 +4400,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->VBFlags |= (VB_DISPMODE_SINGLE | DISPTYPE_CRT1); } - if((pSiS->VGAEngine == SIS_315_VGA) || - (pSiS->VGAEngine == SIS_300_VGA) ) { + if((pSiS->VGAEngine == SIS_315_VGA) || (pSiS->VGAEngine == SIS_300_VGA)) { if((!pSiS->NoXvideo) && (!pSiS->hasTwoOverlays)) { xf86DrvMsg(pScrn->scrnIndex, from, "Using Xv overlay by default on CRT%d\n", @@ -4304,140 +4416,219 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) /* VBFlags are initialized now. Back them up for SlaveMode modes. */ pSiS->VBFlags_backup = pSiS->VBFlags; + /* Backup CR32,36,37 (in order to write them back after a VT switch) */ + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + inSISIDXREG(SISCR,0x32,pSiS->myCR32); + inSISIDXREG(SISCR,0x36,pSiS->myCR36); + inSISIDXREG(SISCR,0x37,pSiS->myCR37); + } + /* Find out about paneldelaycompensation and evaluate option */ - pSiS->sishw_ext.pdc = 0; - - if(pSiS->VGAEngine == SIS_300_VGA) { - if(pSiS->VBFlags & (VB_LVDS | VB_30xBDH)) { - /* Save the current PDC if the panel is used at the moment. - * This seems by far the safest way to find out about it. - * If the system is using an old version of sisfb, we can't - * trust the pdc register value. If sisfb saved the pdc for - * us, use it. - */ - if(pSiS->sisfbpdc) { - pSiS->sishw_ext.pdc = pSiS->sisfbpdc; - } else { - if(!(pSiS->donttrustpdc)) { - unsigned char tmp; - inSISIDXREG(SISCR, 0x30, tmp); - if(tmp & 0x20) { - inSISIDXREG(SISPART1, 0x13, pSiS->sishw_ext.pdc); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Unable to detect LCD PanelDelayCompensation, LCD is not active\n"); - } - } else { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Unable to detect LCD PanelDelayCompensation, please update sisfb\n"); - } - } - pSiS->sishw_ext.pdc &= 0x3c; - if(pSiS->sishw_ext.pdc) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected LCD PanelDelayCompensation %d\n", - pSiS->sishw_ext.pdc); - } +#ifdef SISDUALHEAD + if((!pSiS->DualHeadMode) || (!pSiS->SecondHead)) { +#endif + if(pSiS->VGAEngine == SIS_300_VGA) { - /* If we haven't been able to find out, use our other methods */ - if(pSiS->sishw_ext.pdc == 0) { + if(pSiS->VBFlags & (VB_LVDS | VB_30xBDH)) { + + /* Save the current PDC if the panel is used at the moment. + * This seems by far the safest way to find out about it. + * If the system is using an old version of sisfb, we can't + * trust the pdc register value. If sisfb saved the pdc for + * us, use it. + */ + if(pSiS->sisfbpdc != 0xff) { + pSiS->SiS_Pr->PDC = pSiS->sisfbpdc; + } else { + if(!(pSiS->donttrustpdc)) { + unsigned char tmp; + inSISIDXREG(SISCR, 0x30, tmp); + if(tmp & 0x20) { + inSISIDXREG(SISPART1, 0x13, pSiS->SiS_Pr->PDC); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Unable to detect LCD PanelDelayCompensation, LCD is not active\n"); + } + } else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Unable to detect LCD PanelDelayCompensation, please update sisfb\n"); + } + } + if(pSiS->SiS_Pr->PDC != -1) { + pSiS->SiS_Pr->PDC &= 0x3c; + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected LCD PanelDelayCompensation 0x%02x\n", + pSiS->SiS_Pr->PDC); + } - int i=0; - do { - if(mypdctable[i].subsysVendor == pSiS->PciInfo->subsysVendor && - mypdctable[i].subsysCard == pSiS->PciInfo->subsysCard) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, + /* If we haven't been able to find out, use our other methods */ + if(pSiS->SiS_Pr->PDC == -1) { + int i=0; + do { + if(mypdctable[i].subsysVendor == pSiS->PciInfo->subsysVendor && + mypdctable[i].subsysCard == pSiS->PciInfo->subsysCard) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "PCI card/vendor identified for non-default PanelDelayCompensation\n"); - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Vendor: %s, card: %s (ID %04x), PanelDelayCompensation: %d\n", + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Vendor: %s, card: %s (ID %04x), PanelDelayCompensation: 0x%02x\n", mypdctable[i].vendorName, mypdctable[i].cardName, pSiS->PciInfo->subsysCard, mypdctable[i].pdc); - if(pSiS->PDC == -1) { - pSiS->PDC = mypdctable[i].pdc; - } else { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + if(pSiS->PDC == -1) { + pSiS->PDC = mypdctable[i].pdc; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "PanelDelayCompensation overruled by option\n"); - } - break; - } - i++; - } while(mypdctable[i].subsysVendor != 0); - - } + } + break; + } + i++; + } while(mypdctable[i].subsysVendor != 0); + } - if(pSiS->PDC != -1) { - if(pSiS->BIOS) { - if(pSiS->VBFlags & VB_LVDS) { - if(pSiS->BIOS[0x220] & 0x80) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "BIOS contains custom LCD Panel Delay Compensation %d\n", + if(pSiS->PDC != -1) { + if(pSiS->BIOS) { + if(pSiS->VBFlags & VB_LVDS) { + if(pSiS->BIOS[0x220] & 0x80) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "BIOS contains custom LCD Panel Delay Compensation 0x%02x\n", pSiS->BIOS[0x220] & 0x3c); - pSiS->BIOS[0x220] &= 0x7f; - } - } - if(pSiS->VBFlags & (VB_301B|VB_302B)) { - if(pSiS->BIOS[0x220] & 0x80) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "BIOS contains custom LCD Panel Delay Compensation %d\n", + pSiS->BIOS[0x220] &= 0x7f; + } + } + if(pSiS->VBFlags & (VB_301B|VB_302B)) { + if(pSiS->BIOS[0x220] & 0x80) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "BIOS contains custom LCD Panel Delay Compensation 0x%02x\n", ( (pSiS->VBLCDFlags & VB_LCD_1280x1024) ? pSiS->BIOS[0x223] : pSiS->BIOS[0x224] ) & 0x3c); - pSiS->BIOS[0x220] &= 0x7f; - } - } - } - pSiS->sishw_ext.pdc = (pSiS->PDC & 0x3c); - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Using LCD Panel Delay Compensation %d\n", pSiS->PDC); - } - } - } - - if(pSiS->VGAEngine == SIS_315_VGA) { - if(pSiS->VBFlags & (VB_301LV | VB_302LV | VB_302ELV)) { - /* Save the current PDC if the panel is used at the moment. - * This seems by far the safest way to find out about it. - */ - if(pSiS->sisfbpdc) { - pSiS->sishw_ext.pdc = pSiS->sisfbpdc; - } else { - if(!(pSiS->donttrustpdc)) { - unsigned char tmp; - inSISIDXREG(SISCR, 0x30, tmp); - if(tmp & 0x20) { - inSISIDXREG(SISPART1, 0x2D, pSiS->sishw_ext.pdc); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Unable to detect LCD PanelDelayCompensation, LCD is not active\n"); + pSiS->BIOS[0x220] &= 0x7f; + } + } } + pSiS->SiS_Pr->PDC = (pSiS->PDC & 0x3c); + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Using LCD Panel Delay Compensation 0x%02x\n", pSiS->SiS_Pr->PDC); + } + } + + } /* SIS_300_VGA */ + + if(pSiS->VGAEngine == SIS_315_VGA) { + + unsigned char tmp, tmp2; + inSISIDXREG(SISCR, 0x30, tmp); + + /* Save the current PDC if the panel is used at the moment. */ + if(pSiS->VBFlags & (VB_301LV | VB_302LV | VB_302ELV)) { + + if(pSiS->sisfbpdc != 0xff) { + pSiS->SiS_Pr->PDC = pSiS->sisfbpdc; + } + if(pSiS->sisfbpdca != 0xff) { + pSiS->SiS_Pr->PDCA = pSiS->sisfbpdca; + } + + if(!pSiS->donttrustpdc) { + if((pSiS->sisfbpdc == 0xff) && (pSiS->sisfbpdca == 0xff)) { + CARD16 tempa, tempb; + inSISIDXREG(SISPART1,0x2d,tmp2); + tempa = (tmp2 & 0xf0) >> 3; + tempb = (tmp2 & 0x0f) << 1; + inSISIDXREG(SISPART1,0x20,tmp2); + tempa |= ((tmp2 & 0x40) >> 6); + inSISIDXREG(SISPART1,0x35,tmp2); + tempb |= ((tmp2 & 0x80) >> 7); + inSISIDXREG(SISPART1,0x13,tmp2); + if(!pSiS->ROM661New) { + if((tmp2 & 0x04) || (tmp & 0x20)) { + pSiS->SiS_Pr->PDCA = tempa; + pSiS->SiS_Pr->PDC = tempb; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Unable to detect PanelDelayCompensation, LCD is not active\n"); + } + } else { + if(tmp2 & 0x04) { + pSiS->SiS_Pr->PDCA = tempa; + } else if(tmp & 0x20) { + pSiS->SiS_Pr->PDC = tempb; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Unable to detect PanelDelayCompensation, LCD is not active\n"); + } + } + } } else { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Unable to detect LCD PanelDelayCompensation, please update sisfb\n"); + "Unable to detect PanelDelayCompensation, please update sisfb\n"); + } + if(pSiS->SiS_Pr->PDC != -1) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected LCD PanelDelayCompensation 0x%02x (for LCD=CRT2)\n", + pSiS->SiS_Pr->PDC); + } + if(pSiS->SiS_Pr->PDCA != -1) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Detected LCD PanelDelayCompensation1 0x%02x (for LCD=CRT1)\n", + pSiS->SiS_Pr->PDCA); } } - if(pSiS->sishw_ext.pdc) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected LCD PanelDelayCompensation %d\n", - pSiS->sishw_ext.pdc); - } - if(pSiS->PDC != -1) { - pSiS->sishw_ext.pdc = pSiS->PDC & 0xff; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Using LCD PanelDelayCompensation %d\n", - pSiS->sishw_ext.pdc); - } - } else if(pSiS->Chipset == PCI_CHIP_SIS660) { - /* Since I have no idea about the required PDC on - * the new chips, let the user specify one. But - * we only use the lower nibble. - */ - if(pSiS->PDC != -1) { - pSiS->sishw_ext.pdc = pSiS->PDC & 0x0f; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Using LCD PanelDelayCompensation %d\n", - pSiS->sishw_ext.pdc); + + /* Let user override (for all bridges) */ + if(pSiS->VBFlags & (VB_301B | VB_301C | VB_301LV | VB_302LV | VB_302ELV)) { + if(pSiS->PDC != -1) { + pSiS->SiS_Pr->PDC = pSiS->PDC & 0x1f; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Using LCD PanelDelayCompensation 0x%02x (for LCD=CRT2)\n", + pSiS->SiS_Pr->PDC); + } + if(pSiS->PDCA != -1) { + pSiS->SiS_Pr->PDCA = pSiS->PDCA & 0x1f; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Using LCD PanelDelayCompensation1 0x%02x (for LCD=CRT1)\n", + pSiS->SiS_Pr->PDCA); + } + } + + /* Read the current EMI (if not overruled) */ + if(pSiS->VBFlags & (VB_302LV | VB_302ELV)) { + MessageType from = X_PROBED; + if(pSiS->EMI != -1) { + pSiS->SiS_Pr->EMI_30 = (pSiS->EMI >> 24) & 0x60; + pSiS->SiS_Pr->EMI_31 = (pSiS->EMI >> 16) & 0xff; + pSiS->SiS_Pr->EMI_32 = (pSiS->EMI >> 8) & 0xff; + pSiS->SiS_Pr->EMI_33 = pSiS->EMI & 0xff; + pSiS->SiS_Pr->HaveEMI = pSiS->SiS_Pr->HaveEMILCD = TRUE; + pSiS->SiS_Pr->OverruleEMI = TRUE; + from = X_CONFIG; + } else if((pSiS->sisfbfound) && (pSiS->sisfb_haveemi)) { + pSiS->SiS_Pr->EMI_30 = pSiS->sisfb_emi30; + pSiS->SiS_Pr->EMI_31 = pSiS->sisfb_emi31; + pSiS->SiS_Pr->EMI_32 = pSiS->sisfb_emi32; + pSiS->SiS_Pr->EMI_33 = pSiS->sisfb_emi33; + pSiS->SiS_Pr->HaveEMI = TRUE; + if(pSiS->sisfb_haveemilcd) pSiS->SiS_Pr->HaveEMILCD = TRUE; + pSiS->SiS_Pr->OverruleEMI = FALSE; + } else { + inSISIDXREG(SISPART4, 0x30, pSiS->SiS_Pr->EMI_30); + inSISIDXREG(SISPART4, 0x31, pSiS->SiS_Pr->EMI_31); + inSISIDXREG(SISPART4, 0x32, pSiS->SiS_Pr->EMI_32); + inSISIDXREG(SISPART4, 0x33, pSiS->SiS_Pr->EMI_33); + pSiS->SiS_Pr->HaveEMI = TRUE; + if(tmp & 0x20) pSiS->SiS_Pr->HaveEMILCD = TRUE; + pSiS->SiS_Pr->OverruleEMI = FALSE; + } + xf86DrvMsg(pScrn->scrnIndex, from, + "302LV/302ELV: Using EMI 0x%02x%02x%02x%02x%s\n", + pSiS->SiS_Pr->EMI_30,pSiS->SiS_Pr->EMI_31, + pSiS->SiS_Pr->EMI_32,pSiS->SiS_Pr->EMI_33, + pSiS->SiS_Pr->HaveEMILCD ? " (LCD)" : ""); } - } + + } /* SIS_315_VGA */ +#ifdef SISDUALHEAD } +#endif #ifdef SISDUALHEAD /* In dual head mode, both heads (currently) share the maxxfbmem equally. @@ -5346,13 +5537,13 @@ SISMapMem(ScrnInfoPtr pScrn) if(!(pSiSEnt->IOBase)) { /* Only map if not mapped previously */ pSiSEnt->IOBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, - pSiS->PciTag, pSiS->IOAddress, 0x10000); + pSiS->PciTag, pSiS->IOAddress, (pSiS->mmioSize * 1024)); } pSiS->IOBase = pSiSEnt->IOBase; } else #endif pSiS->IOBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, - pSiS->PciTag, pSiS->IOAddress, 0x10000); + pSiS->PciTag, pSiS->IOAddress, (pSiS->mmioSize * 1024)); if(pSiS->IOBase == NULL) { SISErrorLog(pScrn, "Could not map MMIO area\n"); @@ -5370,13 +5561,13 @@ SISMapMem(ScrnInfoPtr pScrn) if(!(pSiSEnt->IOBaseDense)) { /* Only map if not mapped previously */ pSiSEnt->IOBaseDense = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, - pSiS->PciTag, pSiS->IOAddress, 0x10000); + pSiS->PciTag, pSiS->IOAddress, (pSiS->mmioSize * 1024)); } pSiS->IOBaseDense = pSiSEnt->IOBaseDense; } else #endif pSiS->IOBaseDense = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, - pSiS->PciTag, pSiS->IOAddress, 0x10000); + pSiS->PciTag, pSiS->IOAddress, (pSiS->mmioSize * 1024)); if(pSiS->IOBaseDense == NULL) { SISErrorLog(pScrn, "Could not map MMIO dense area\n"); @@ -5443,7 +5634,7 @@ SISUnmapMem(ScrnInfoPtr pScrn) if(pSiSEnt->MapCountIOBase) { pSiSEnt->MapCountIOBase--; if((pSiSEnt->MapCountIOBase == 0) || (pSiSEnt->forceUnmapIOBase)) { - xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOBase, 0x10000); + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOBase, (pSiS->mmioSize * 1024)); pSiSEnt->IOBase = NULL; pSiSEnt->MapCountIOBase = 0; pSiSEnt->forceUnmapIOBase = FALSE; @@ -5454,7 +5645,7 @@ SISUnmapMem(ScrnInfoPtr pScrn) if(pSiSEnt->MapCountIOBaseDense) { pSiSEnt->MapCountIOBaseDense--; if((pSiSEnt->MapCountIOBaseDense == 0) || (pSiSEnt->forceUnmapIOBaseDense)) { - xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOBaseDense, 0x10000); + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOBaseDense, (pSiS->mmioSize * 1024)); pSiSEnt->IOBaseDense = NULL; pSiSEnt->MapCountIOBaseDense = 0; pSiSEnt->forceUnmapIOBaseDense = FALSE; @@ -5475,10 +5666,10 @@ SISUnmapMem(ScrnInfoPtr pScrn) } } else { #endif - xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOBase, 0x10000); + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOBase, (pSiS->mmioSize * 1024)); pSiS->IOBase = NULL; #ifdef __alpha__ - xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOBaseDense, 0x10000); + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOBaseDense, (pSiS->mmioSize * 1024)); pSiS->IOBaseDense = NULL; #endif xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->FbBase, pSiS->FbMapSize); @@ -5533,12 +5724,14 @@ SISSave(ScrnInfoPtr pScrn) /* "Save" these again as they may have been changed prior to SISSave() call */ if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + sisReg->sisRegs3C4[0x1f] = pSiS->oldSR1F; sisReg->sisRegs3D4[0x17] = pSiS->oldCR17; if(vgaReg->numCRTC >= 0x17) vgaReg->CRTC[0x17] = pSiS->oldCR17; sisReg->sisRegs3D4[0x32] = pSiS->oldCR32; - sisReg->sisRegs3C4[0x1f] = pSiS->oldSR1F; + sisReg->sisRegs3D4[0x36] = pSiS->oldCR36; + sisReg->sisRegs3D4[0x37] = pSiS->oldCR37; if(pSiS->VGAEngine == SIS_315_VGA) { - sisReg->sisRegs3D4[0x63] = pSiS->oldCR63; + sisReg->sisRegs3D4[pSiS->myCR63] = pSiS->oldCR63; } } } @@ -5931,6 +6124,7 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) SiSPostSetMode(pScrn, &pSiS->ModeReg); #ifdef TWDEBUG + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VBFlags %lx\n", pSiS->VBFlags); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "REAL REGISTER CONTENTS AFTER SETMODE:\n"); (*pSiS->ModeInit)(pScrn, mode); @@ -6005,7 +6199,7 @@ SiSSetVESAMode(ScrnInfoPtr pScrn, DisplayModePtr pMode) if(!(mode = SiSCalcVESAModeIndex(pScrn, pMode))) return FALSE; mode |= (1 << 15); /* Don't clear framebuffer */ - mode |= (1 << 14); /* Use linear adressing */ + mode |= (1 << 14); /* Use linear adressing */ if(VBESetVBEMode(pSiS->pVbe, mode, NULL) == FALSE) { SISErrorLog(pScrn, "Setting VESA mode 0x%x failed\n", @@ -6048,6 +6242,7 @@ SISSpecialRestore(ScrnInfoPtr pScrn) if(!(pSiS->ChipFlags & SiSCF_Is65x)) return; inSISIDXREG(SISCR, 0x34, temp); + temp &= 0x7f; if(temp > 0x13) return; #ifdef UNLOCK_ALWAYS @@ -6132,7 +6327,7 @@ SISRestore(ScrnInfoPtr pScrn) /* First, restore CRT1 on/off and VB connection registers */ outSISIDXREG(SISCR, 0x32, pSiS->oldCR32); if(!(pSiS->oldCR17 & 0x80)) { /* CRT1 was off */ - if(!(SiSBridgeIsInSlaveMode(pScrn))) { /* Bridge is NOT in SlaveMode now -> do it */ + if(!(SiSBridgeIsInSlaveMode(pScrn))) { /* Bridge is NOT in SlaveMode now -> do it */ doit = TRUE; } else { doitlater = TRUE; @@ -6145,7 +6340,7 @@ SISRestore(ScrnInfoPtr pScrn) outSISIDXREG(SISCR, 0x17, pSiS->oldCR17); } if(pSiS->VGAEngine == SIS_315_VGA) { - outSISIDXREG(SISCR, 0x63, pSiS->oldCR63); + outSISIDXREG(SISCR, pSiS->myCR63, pSiS->oldCR63); } outSISIDXREG(SISSR, 0x1f, pSiS->oldSR1F); @@ -6187,6 +6382,7 @@ SISRestore(ScrnInfoPtr pScrn) if(vesasuccess == FALSE) { int backupscaler = pSiS->SiS_Pr->UsePanelScaler; + int backupcenter = pSiS->SiS_Pr->CenterScreen; unsigned long backupspecialtiming = pSiS->SiS_Pr->SiS_CustomT; if((pSiS->VBFlags & (VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV|VB_302ELV))) { @@ -6208,6 +6404,7 @@ SISRestore(ScrnInfoPtr pScrn) pSiS->SiS_Pr->UseCustomMode = FALSE; pSiS->SiS_Pr->CRT1UsesCustomMode = FALSE; pSiS->SiS_Pr->UsePanelScaler = pSiS->sisfbscalelcd; + pSiS->SiS_Pr->CenterScreen = 0; pSiS->SiS_Pr->SiS_CustomT = pSiS->sisfbspecialtiming; SiSSetMode(pSiS->SiS_Pr, &pSiS->sishw_ext, pScrn, pSiS->OldMode, FALSE); if(changedmode) { @@ -6217,13 +6414,14 @@ SISRestore(ScrnInfoPtr pScrn) SISSpecialRestore(pScrn); SiS_GetSetModeID(pScrn,pSiS->OldMode); pSiS->SiS_Pr->UsePanelScaler = backupscaler; + pSiS->SiS_Pr->CenterScreen = backupcenter; pSiS->SiS_Pr->SiS_CustomT = backupspecialtiming; } /* Restore CRT1 status */ if(pSiS->VGAEngine == SIS_315_VGA) { - outSISIDXREG(SISCR, 0x63, pSiS->oldCR63); + outSISIDXREG(SISCR, pSiS->myCR63, pSiS->oldCR63); } outSISIDXREG(SISSR, 0x1f, pSiS->oldSR1F); @@ -6231,15 +6429,19 @@ SISRestore(ScrnInfoPtr pScrn) /* Restore queue mode registers on 315/330 series */ /* (This became necessary due to the switch to VRAM queue) */ if(pSiS->VGAEngine == SIS_315_VGA) { - unsigned char tempCR55; - inSISIDXREG(SISCR,0x55,tempCR55); - andSISIDXREG(SISCR,0x55,0x33); + unsigned char tempCR55=0; + if(pSiS->sishw_ext.jChipType <= SIS_330) { + inSISIDXREG(SISCR,0x55,tempCR55); + andSISIDXREG(SISCR,0x55,0x33); + } outSISIDXREG(SISSR,0x26,0x01); MMIO_OUT32(pSiS->IOBase, 0x85c4, 0); outSISIDXREG(SISSR,0x27,sisReg->sisRegs3C4[0x27]); outSISIDXREG(SISSR,0x26,sisReg->sisRegs3C4[0x26]); MMIO_OUT32(pSiS->IOBase, 0x85C0, sisReg->sisMMIO85C0); - outSISIDXREG(SISCR,0x55,tempCR55); + if(pSiS->sishw_ext.jChipType <= SIS_330) { + outSISIDXREG(SISCR,0x55,tempCR55); + } } #endif @@ -6375,15 +6577,19 @@ SISVESARestore(ScrnInfoPtr pScrn) /* (This became necessary due to the switch to VRAM queue) */ if(pSiS->VGAEngine == SIS_315_VGA) { SISRegPtr sisReg = &pSiS->SavedReg; - unsigned char tempCR55; - inSISIDXREG(SISCR,0x55,tempCR55); - andSISIDXREG(SISCR,0x55,0x33); + unsigned char tempCR55=0; + if(pSiS->sishw_ext.jChipType <= SIS_330) { + inSISIDXREG(SISCR,0x55,tempCR55); + andSISIDXREG(SISCR,0x55,0x33); + } outSISIDXREG(SISSR,0x26,0x01); MMIO_OUT32(pSiS->IOBase, 0x85c4, 0); outSISIDXREG(SISSR,0x27,sisReg->sisRegs3C4[0x27]); outSISIDXREG(SISSR,0x26,sisReg->sisRegs3C4[0x26]); MMIO_OUT32(pSiS->IOBase, 0x85C0, sisReg->sisMMIO85C0); - outSISIDXREG(SISCR,0x55,tempCR55); + if(pSiS->sishw_ext.jChipType <= SIS_330) { + outSISIDXREG(SISCR,0x55,tempCR55); + } } #endif } @@ -6532,8 +6738,8 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* Read 0:449 which the BIOS sets to the current mode number * Unfortunately, this not reliable since the int10 emulation * does not change this. So if we call the VBE later, this - * byte won't be touched. (which is why we set this manually - * then) + * byte won't be touched (which is why we set this manually + * then). */ unsigned char myoldmode = SiS_GetSetModeID(pScrn,0xFF); unsigned char cr30, cr31; @@ -6560,12 +6766,15 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) * two is valid). */ if(pSiS->OldMode > 0x7f) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Previous video mode (%02x) invalid, using BIOS scratch (%02x)\n", - pSiS->OldMode, myoldmode); pSiS->OldMode = myoldmode; } } +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + if(!pSiS->SecondHead) pSiSEnt->OldMode = pSiS->OldMode; + else pSiS->OldMode = pSiSEnt->OldMode; + } +#endif } /* Initialise the first mode */ @@ -6894,6 +7103,11 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) SiSnoPanoramiXExtension = FALSE; SiSXineramaExtensionInit(pScrn); if(!SiSnoPanoramiXExtension) { +#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,0,0,0) + xf86DisableRandR(); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "SiS Pseudo-Xinerama enabled, RandR disabled\n"); +#endif pSiS->SiS_SD_Flags |= SiS_SD_PSEUDOXINERAMA; } } @@ -7007,7 +7221,9 @@ SISSwitchCRT2Type(ScrnInfoPtr pScrn, unsigned long newvbflags) if(pSiS->DualHeadMode) return FALSE; #endif -#define SiS_NewVBMask (CRT2_ENABLE|CRT1_LCDA|TV_PAL|TV_NTSC|TV_PALM|TV_PALN|TV_NTSCJ|TV_AVIDEO|TV_SVIDEO|TV_SCART) +#define SiS_NewVBMask (CRT2_ENABLE|CRT1_LCDA|TV_PAL|TV_NTSC|TV_PALM|TV_PALN|TV_NTSCJ| \ + TV_AVIDEO|TV_SVIDEO|TV_SCART|TV_HIVISION|TV_YPBPR|TV_YPBPRALL|\ + TV_YPBPRAR) newvbflags &= SiS_NewVBMask; newvbflags |= pSiS->VBFlags & ~SiS_NewVBMask; @@ -7015,6 +7231,12 @@ SISSwitchCRT2Type(ScrnInfoPtr pScrn, unsigned long newvbflags) if(!(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTLCDA)) { newvbflags &= ~CRT1_LCDA; } + if(!(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTHIVISION)) { + newvbflags &= ~TV_HIVISION; + } + if(!(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPR)) { + newvbflags &= ~TV_YPBPR; + } #ifdef SISMERGED if(pSiS->MergedFB) { @@ -7073,51 +7295,57 @@ SISSwitchCRT2Type(ScrnInfoPtr pScrn, unsigned long newvbflags) return TRUE; } -Bool +int SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned short index, Bool quiet) { SISPtr pSiS = SISPTR(pScrn); BOOLEAN hcm = pSiS->HaveCustomModes; DisplayModePtr mode = pScrn->modes, mastermode; - int i; + int i, result = 0; unsigned long vbflags = pSiS->VBFlags; - /* This has been extended to handle LCDA as well */ - - /* Only on 300 and 315/330 series */ - if(pSiS->VGAEngine != SIS_300_VGA && - pSiS->VGAEngine != SIS_315_VGA) return FALSE; + /* Not only CRT2, but also LCDA */ - /* Mode is OK if there is no video bridge */ - /* (Requires screen size check in app) */ - if(!(pSiS->VBFlags & VB_VIDEOBRIDGE)) return TRUE; + /* returns 0 if mode ok, + * 0x01 if mode not ok for CRT2 device, + * 0x02 if mode too large for current root window + * or combinations thereof + */ - /* No special treatment for NTSC-J here */ + /* No special treatment for NTSC-J here; conditions equal NTSC */ if(cond) { - vbflags &= ~(CRT2_ENABLE | TV_TYPE | TV_PALM | TV_PALN | CRT1_LCDA); - if(cond & SiS_CF2_LCD) { + vbflags &= ~(CRT2_ENABLE | CRT1_LCDA | TV_STANDARD | TV_INTERFACE); + if((cond & SiS_CF2_TYPEMASK) == SiS_CF2_LCD) { vbflags |= CRT2_LCD; - } else if(cond & SiS_CF2_TV) { - vbflags |= CRT2_TV; + } else if((cond & SiS_CF2_TYPEMASK) == SiS_CF2_TV) { + vbflags |= (CRT2_TV | TV_SVIDEO); if(cond & SiS_CF2_TVPAL) vbflags |= TV_PAL; else if(cond & SiS_CF2_TVPALM) vbflags |= (TV_PAL | TV_PALM); else if(cond & SiS_CF2_TVPALN) vbflags |= (TV_PAL | TV_PALN); else if(cond & SiS_CF2_TVNTSC) vbflags |= TV_NTSC; - } else if(cond & SiS_CF2_VGA2) { + } else if((cond & SiS_CF2_TYPEMASK) == SiS_CF2_TVSPECIAL) { + vbflags |= CRT2_TV; + if((cond & SiS_CF2_TVSPECMASK) == SiS_CF2_TVHIVISION) + vbflags |= TV_HIVISION; + else if((cond & SiS_CF2_TVSPECMASK) == SiS_CF2_TVYPBPR525I) + vbflags |= (TV_YPBPR | TV_YPBPR525I); + else if((cond & SiS_CF2_TVSPECMASK) == SiS_CF2_TVYPBPR525P) + vbflags |= (TV_YPBPR | TV_YPBPR525P); + else if((cond & SiS_CF2_TVSPECMASK) == SiS_CF2_TVYPBPR750P) + vbflags |= (TV_YPBPR | TV_YPBPR750P); + else if((cond & SiS_CF2_TVSPECMASK) == SiS_CF2_TVYPBPR1080I) + vbflags |= (TV_YPBPR | TV_YPBPR1080I); + } else if((cond & SiS_CF2_TYPEMASK) == SiS_CF2_VGA2) { vbflags |= CRT2_VGA; - } else if(cond & SiS_CF2_CRT1LCDA) { + } else if((cond & SiS_CF2_TYPEMASK) == SiS_CF2_CRT1LCDA) { vbflags |= CRT1_LCDA; } } - /* Mode is obviously OK if video bridge is disabled */ - /* (Requires extra check for eventual screen size problems in app) */ - if(!(vbflags & (CRT2_ENABLE | CRT1_LCDA))) return TRUE; - /* Find mode of given index */ if(index) { for(i = 0; i < index; i++) { - if(!mode) return FALSE; + if(!mode) return 0x03; mode = mode->next; } } @@ -7145,7 +7373,7 @@ SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned sh xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Desired mode too large for current screen size\n"); } - return FALSE; + result |= 0x02; } /* Check if the desired mode is suitable for current CRT2 output device */ @@ -7154,7 +7382,7 @@ SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned sh xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Desired mode not suitable for current CRT2 output device\n"); } - return FALSE; + result |= 0x01; } } @@ -7186,7 +7414,7 @@ SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned sh xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Desired mode too large for current screen size\n"); } - return FALSE; + result |= 0x02; } /* Check if the desired mode is suitable for current CRT1 output device */ @@ -7195,7 +7423,7 @@ SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned sh xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Desired mode not suitable for current CRT1 output device\n"); } - return FALSE; + result |= 0x01; } } @@ -7204,7 +7432,7 @@ SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned sh } #endif - return TRUE; + return result; } Bool @@ -7329,7 +7557,7 @@ SISSetStartAddressCRT2(SISPtr pSiS, unsigned long base) } #ifdef SISMERGED -Bool +static Bool InRegion(int x, int y, region r) { return (r.x0 <= x) && (x <= r.x1) && (r.y0 <= y) && (y <= r.y1); @@ -7676,6 +7904,12 @@ SISEnterVT(int scrnIndex, int flags) sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { + outSISIDXREG(SISCR,0x32,pSiS->myCR32); + outSISIDXREG(SISCR,0x36,pSiS->myCR36); + outSISIDXREG(SISCR,0x37,pSiS->myCR37); + } + if(!SISModeInit(pScrn, pScrn->currentMode)) { SISErrorLog(pScrn, "SiSEnterVT: SISModeInit() failed\n"); return FALSE; @@ -7684,7 +7918,6 @@ SISEnterVT(int scrnIndex, int flags) SISAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); #ifdef XF86DRI - /* this is to be done AFTER switching the mode */ if(pSiS->directRenderingEnabled) { DRIUnlock(screenInfo.screens[scrnIndex]); } @@ -7714,7 +7947,6 @@ SISLeaveVT(int scrnIndex, int flags) #ifdef XF86DRI ScreenPtr pScreen; - /* to be done before mode change */ if(pSiS->directRenderingEnabled) { pScreen = screenInfo.screens[scrnIndex]; DRILock(pScreen, 0); @@ -7763,7 +7995,7 @@ SISLeaveVT(int scrnIndex, int flags) } - /* We use this (otherwise unused) bit to indicate that we are running + /* We use (otherwise unused) bit 7 to indicate that we are running * to keep sisfb to change the displaymode (this would result in * lethal display corruption upon quitting X or changing to a VT * until a reboot) @@ -7839,12 +8071,16 @@ SISCloseScreen(int scrnIndex, ScreenPtr pScreen) } vgaHWLock(hwp); - } - if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) { - andSISIDXREG(SISCR,0x34,0x7f); } + /* We should restore the mode number in case vtsema = false as well, + * but since we haven't register access then we can't do it. I think + * I need to rework the save/restore stuff, like saving the video + * status when returning to the X server and by that save me the + * trouble if sisfb was started from a textmode VT while X was on. + */ + SISUnmapMem(pScrn); vgaHWUnmapMem(pScrn); @@ -7888,6 +8124,7 @@ SISCloseScreen(int scrnIndex, ScreenPtr pScreen) if(pSiS->adaptor) { xfree(pSiS->adaptor); pSiS->adaptor = NULL; + pSiS->ResetXv = pSiS->ResetXvGamma = NULL; } pScrn->vtSema = FALSE; @@ -8023,6 +8260,7 @@ SISSaveScreen(ScreenPtr pScreen, int mode) if(!pSiS->Blank) { inSISIDXREG(SISSR, 0x11, pSiS->LCDon); + if(pSiS->sishw_ext.jChipType >= SIS_661) pSiS->LCDon &= 0x0f; } if(pSiS->VBFlags & VB_CHRONTEL) { @@ -8117,6 +8355,7 @@ SISSaveScreenDH(ScreenPtr pScreen, int mode) if(!pSiS->BlankCRT2) { inSISIDXREG(SISSR, 0x11, pSiS->LCDon); + if(pSiS->sishw_ext.jChipType >= SIS_661) pSiS->LCDon &= 0x0f; } if(pSiS->VBFlags & VB_CHRONTEL) { @@ -8237,7 +8476,7 @@ SiSEnableTurboQueue(ScrnInfoPtr pScrn) */ #ifdef SISVRAMQ /* We use VRAM Cmd Queue, not MMIO or AGP */ - unsigned char tempCR55; + unsigned char tempCR55 = 0; #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { @@ -8250,8 +8489,10 @@ SiSEnableTurboQueue(ScrnInfoPtr pScrn) /* Set Command Queue Threshold to max value 11111b (?) */ outSISIDXREG(SISSR, 0x27, 0x1F); /* No idea what this does */ - inSISIDXREG(SISCR, 0x55, tempCR55) ; - andSISIDXREG(SISCR, 0x55, 0x33) ; + if(pSiS->sishw_ext.jChipType <= SIS_330) { + inSISIDXREG(SISCR, 0x55, tempCR55) ; + andSISIDXREG(SISCR, 0x55, 0x33) ; + } /* Syncronous reset for Command Queue */ outSISIDXREG(SISSR, 0x26, 0x01); MMIO_OUT32(pSiS->IOBase, 0x85c4, 0); @@ -8280,7 +8521,9 @@ SiSEnableTurboQueue(ScrnInfoPtr pScrn) #endif temp += pSiS->cmdQueueOffset; pSiS->cmdQueueBase = (unsigned long *)temp; - outSISIDXREG(SISCR, 0x55, tempCR55); + if(pSiS->sishw_ext.jChipType <= SIS_330) { + outSISIDXREG(SISCR, 0x55, tempCR55); + } #else /* For MMIO */ /* Set Command Queue Threshold to max value 11111b */ @@ -8313,8 +8556,8 @@ SiSEnableTurboQueue(ScrnInfoPtr pScrn) void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode) { SISPtr pSiS = SISPTR(pScrn); - unsigned char CR30, CR31; - unsigned char CR32, CR33; + unsigned char CR30, CR31, CR32, CR33; + unsigned char CR39 = 0, CR3B = 0; unsigned char CR17, CR38 = 0; unsigned char CR35 = 0, CR79 = 0; unsigned long vbflag; @@ -8447,25 +8690,24 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode) sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); /* Unlock Registers */ #endif + inSISIDXREG(SISCR, 0x30, CR30); + inSISIDXREG(SISCR, 0x31, CR31); + CR32 = pSiS->newCR32; + inSISIDXREG(SISCR, 0x33, CR33); + if(pSiS->Chipset == PCI_CHIP_SIS660) { - inSISIDXREG(SISCR, 0x30, CR30); - inSISIDXREG(SISCR, 0x31, CR31); - CR32 = pSiS->newCR32; - inSISIDXREG(SISCR, 0x33, CR33); inSISIDXREG(SISCR, 0x35, CR35); inSISIDXREG(SISCR, 0x38, CR38); + inSISIDXREG(SISCR, 0x39, CR39); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 4, "Before: CR30=0x%02x,CR31=0x%02x,CR32=0x%02x,CR33=0x%02x,CR35=0x%02x,CR38=0x%02x\n", CR30, CR31, CR32, CR33, CR35, CR38); - CR38 &= ~0x03; + CR38 &= ~0x07; } else { - inSISIDXREG(SISCR, 0x30, CR30); - inSISIDXREG(SISCR, 0x31, CR31); - CR32 = pSiS->newCR32; - inSISIDXREG(SISCR, 0x33, CR33); if(pSiS->Chipset != PCI_CHIP_SIS300) { switch(pSiS->VGAEngine) { case SIS_300_VGA: temp = 0x35; break; @@ -8475,8 +8717,9 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode) } if(pSiS->VGAEngine == SIS_315_VGA) { inSISIDXREG(SISCR, 0x79, CR79); - CR38 &= ~0x03; /* Clear LCDA/DualEdge bits */ + CR38 &= ~0x3b; /* Clear LCDA/DualEdge and YPbPr bits */ } + inSISIDXREG(SISCR, 0x3b, CR3B); xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 4, "Before: CR30=0x%02x, CR31=0x%02x, CR32=0x%02x, CR33=0x%02x, CR%02x=0x%02x\n", CR30, CR31, CR32, CR33, temp, CR38); @@ -8509,26 +8752,65 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode) case CRT2_TV: - CR38 &= ~0xC0; + CR38 &= ~0xC0; /* Clear Pal M/N bits */ - if(vbflag & TV_CHSCART) { + if((vbflag & VB_CHRONTEL) && (vbflag & TV_CHSCART)) { /* Chrontel */ CR30 |= 0x10; CR38 |= 0x04; + CR38 &= ~0x08; CR31 |= 0x01; - } else if(vbflag & TV_CHHDTV) { + } else if((vbflag & VB_CHRONTEL) && (vbflag & TV_CHYPBPR525I)) { /* Chrontel */ CR38 |= 0x08; + CR38 &= ~0x04; CR31 &= ~0x01; - } else if(vbflag & TV_HIVISION) - CR30 |= 0x80; - else if(vbflag & TV_SCART) - CR30 |= 0x10; - else { + } else if(vbflag & TV_HIVISION) { /* SiS bridge */ + if(pSiS->Chipset == PCI_CHIP_SIS660) { + CR38 |= 0x04; + CR35 |= 0x60; + } else { + CR30 |= 0x80; + if(pSiS->VGAEngine == SIS_315_VGA) { + if(vbflag & (VB_301LV | VB_302LV | VB_301C)) { + CR38 |= (0x08 | 0x30); + } + } + } + CR31 |= 0x01; + CR35 |= 0x01; + } else if(vbflag & TV_YPBPR) { /* SiS bridge */ + if(pSiS->Chipset == PCI_CHIP_SIS660) { + CR38 |= 0x04; + if(vbflag & TV_YPBPR525P) CR35 |= 0x20; + else if(vbflag & TV_YPBPR750P) CR35 |= 0x40; + else if(vbflag & TV_YPBPR1080I) CR35 |= 0x60; + CR31 &= ~0x01; + CR35 &= ~0x01; + CR39 &= ~0x03; + if((vbflag & TV_YPBPRAR) == TV_YPBPR43LB) CR39 |= 0x00; + else if((vbflag & TV_YPBPRAR) == TV_YPBPR43) CR39 |= 0x01; + else if((vbflag & TV_YPBPRAR) == TV_YPBPR169) CR39 |= 0x02; + else CR39 |= 0x03; + } else if(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPR) { + CR30 |= 0x80; + CR38 |= 0x08; + if(vbflag & TV_YPBPR525P) CR38 |= 0x10; + else if(vbflag & TV_YPBPR750P) CR38 |= 0x20; + else if(vbflag & TV_YPBPR1080I) CR38 |= 0x30; + CR31 &= ~0x01; + if(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPRAR) { + CR3B &= ~0x03; + if((vbflag & TV_YPBPRAR) == TV_YPBPR43LB) CR3B |= 0x00; + else if((vbflag & TV_YPBPRAR) == TV_YPBPR43) CR3B |= 0x03; + else if((vbflag & TV_YPBPRAR) == TV_YPBPR169) CR3B |= 0x01; + else CR3B |= 0x03; + } + } + } else { /* All */ + if(vbflag & TV_SCART) CR30 |= 0x10; if(vbflag & TV_SVIDEO) CR30 |= 0x08; if(vbflag & TV_AVIDEO) CR30 |= 0x04; - if(!(CR30 & 0x0c)) CR30 |= 0x08; /* default: SVIDEO */ - } + if(!(CR30 & 0x1C)) CR30 |= 0x08; /* default: SVIDEO */ - if(!(vbflag & (TV_CHSCART | TV_CHHDTV))) { if(vbflag & TV_PAL) { CR31 |= 0x01; CR35 |= 0x01; @@ -8550,6 +8832,10 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode) CR35 |= 0x02; } } + if(vbflag & TV_SCART) { + CR31 |= 0x01; + CR35 |= 0x01; + } } CR31 &= ~0x04; /* Clear NotSimuMode */ @@ -8678,12 +8964,13 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode) if(pSiS->Chipset == PCI_CHIP_SIS660) { CR31 &= 0xfe; /* Clear PAL flag (now in CR35) */ - CR38 &= 0x03; /* Use only LCDA bits */ + CR38 &= 0x07; /* Use only LCDA and HiVision/YPbPr bits */ outSISIDXREG(SISCR, 0x30, CR30); outSISIDXREG(SISCR, 0x31, CR31); outSISIDXREG(SISCR, 0x33, CR33); outSISIDXREG(SISCR, 0x35, CR35); - setSISIDXREG(SISCR, 0x38, 0xfc, CR38); + setSISIDXREG(SISCR, 0x38, 0xf8, CR38); + outSISIDXREG(SISCR, 0x39, CR39); xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, "After: CR30=0x%02x,CR31=0x%02x,CR33=0x%02x,CR35=0x%02x,CR38=%02x\n", CR30, CR31, CR33, CR35, CR38); @@ -8697,7 +8984,8 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode) outSISIDXREG(SISCR, temp, CR38); } if(pSiS->VGAEngine == SIS_315_VGA) { - outSISIDXREG(SISCR, 0x79, CR79); + outSISIDXREG(SISCR, 0x3b, CR3B); + outSISIDXREG(SISCR, 0x79, CR79); } xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, "After: CR30=0x%02x,CR31=0x%02x,CR33=0x%02x,CR%02x=%02x\n", @@ -8728,7 +9016,7 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode) /* Functions for adjusting various TV settings */ /* These are used by the PostSetMode() functions as well as - * the (hopefully) upcoming display properties extension/tool. + * the display properties tool SiSCtrl. * * There is each a Set and a Get routine. The Set functions * take a value of the same range as the corresponding option. @@ -8753,7 +9041,8 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode) * * All the routines are dual head aware. It does not matter * if the function is called from the CRT1 or CRT2 session. - * The values will be stored in pSiSEnt if we're running dual. + * The values will be in pSiSEnt anyway, and read from there + * if we're running dual head. */ void SiS_SetCHTVlumabandwidthcvbs(ScrnInfoPtr pScrn, int val) @@ -9282,42 +9571,39 @@ void SiS_SetSISTVedgeenhance(ScrnInfoPtr pScrn, int val) #ifdef SISDUALHEAD if(pSiSEnt) pSiSEnt->sistvedgeenhance = val; #endif - + + if(!(pSiS->VBFlags & VB_301)) return; if(!(pSiS->VBFlags & CRT2_TV)) return; - if(!(pSiS->VBFlags & VB_301)) return; - + #ifdef UNLOCK_ALWAYS sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); #endif val /= 2; if((val >= 0) && (val <= 7)) { - setSISIDXREG(SISPART2,0x3A, 0x1F, (val << 5)); + setSISIDXREG(SISPART2,0x3A, 0x1F, (val << 5)); } } int SiS_GetSISTVedgeenhance(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); + int result = pSiS->sistvedgeenhance; + unsigned char temp; #ifdef SISDUALHEAD SISEntPtr pSiSEnt = pSiS->entityPrivate; + + if(pSiSEnt && pSiS->DualHeadMode) result = pSiSEnt->sistvedgeenhance; #endif - if(!(pSiS->VBFlags & VB_301 && pSiS->VBFlags & CRT2_TV)) { -#ifdef SISDUALHEAD - if(pSiSEnt && pSiS->DualHeadMode) - return (int)pSiSEnt->sistvedgeenhance; - else -#endif - return (int)pSiS->sistvedgeenhance; - } else { - unsigned char temp; + if(!(pSiS->VBFlags & VB_301)) return result; + if(!(pSiS->VBFlags & CRT2_TV)) return result; + #ifdef UNLOCK_ALWAYS - sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); -#endif - inSISIDXREG(SISPART2, 0x3a, temp); - return(int)(((temp & 0xe0) >> 5) * 2); - } + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + inSISIDXREG(SISPART2, 0x3a, temp); + return(int)(((temp & 0xe0) >> 5) * 2); } void SiS_SetSISTVantiflicker(ScrnInfoPtr pScrn, int val) @@ -9332,9 +9618,12 @@ void SiS_SetSISTVantiflicker(ScrnInfoPtr pScrn, int val) if(pSiSEnt) pSiSEnt->sistvantiflicker = val; #endif - if(!(pSiS->VBFlags & CRT2_TV)) return; + if(!(pSiS->VBFlags & CRT2_TV)) return; if(!(pSiS->VBFlags & VB_SISBRIDGE)) return; - + if(pSiS->VBFlags & TV_HIVISION) return; + if((pSiS->VBFlags & TV_YPBPR) && + (pSiS->VBFlags & (TV_YPBPR525P | TV_YPBPR750P | TV_YPBPR1080I))) return; + #ifdef UNLOCK_ALWAYS sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); #endif @@ -9348,25 +9637,25 @@ void SiS_SetSISTVantiflicker(ScrnInfoPtr pScrn, int val) int SiS_GetSISTVantiflicker(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); + int result = pSiS->sistvantiflicker; + unsigned char temp; #ifdef SISDUALHEAD SISEntPtr pSiSEnt = pSiS->entityPrivate; + + if(pSiSEnt && pSiS->DualHeadMode) result = pSiSEnt->sistvantiflicker; #endif - if(!(pSiS->VBFlags & VB_SISBRIDGE && pSiS->VBFlags & CRT2_TV)) { -#ifdef SISDUALHEAD - if(pSiSEnt && pSiS->DualHeadMode) - return (int)pSiSEnt->sistvantiflicker; - else -#endif - return (int)pSiS->sistvantiflicker; - } else { - unsigned char temp; + if(!(pSiS->VBFlags & VB_SISBRIDGE)) return result; + if(!(pSiS->VBFlags & CRT2_TV)) return result; + if(pSiS->VBFlags & TV_HIVISION) return result; + if((pSiS->VBFlags & TV_YPBPR) && + (pSiS->VBFlags & (TV_YPBPR525P | TV_YPBPR750P | TV_YPBPR1080I))) return result; + #ifdef UNLOCK_ALWAYS - sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); -#endif - inSISIDXREG(SISPART2, 0x0a, temp); - return(int)((temp & 0x70) >> 4); - } + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); +#endif + inSISIDXREG(SISPART2, 0x0a, temp); + return(int)((temp & 0x70) >> 4); } void SiS_SetSISTVsaturation(ScrnInfoPtr pScrn, int val) @@ -9398,27 +9687,23 @@ void SiS_SetSISTVsaturation(ScrnInfoPtr pScrn, int val) int SiS_GetSISTVsaturation(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); + int result = pSiS->sistvsaturation; + unsigned char temp; #ifdef SISDUALHEAD SISEntPtr pSiSEnt = pSiS->entityPrivate; -#endif - if(!(pSiS->VBFlags & VB_SISBRIDGE && - (!(pSiS->VBFlags & VB_301)) && - pSiS->VBFlags & CRT2_TV)) { -#ifdef SISDUALHEAD - if(pSiSEnt && pSiS->DualHeadMode) - return (int)pSiSEnt->sistvsaturation; - else + if(pSiSEnt && pSiS->DualHeadMode) result = pSiSEnt->sistvsaturation; #endif - return (int)pSiS->sistvsaturation; - } else { - unsigned char temp; + + if(!(pSiS->VBFlags & VB_SISBRIDGE)) return result; + if(pSiS->VBFlags & VB_301) return result; + if(!(pSiS->VBFlags & CRT2_TV)) return result; + #ifdef UNLOCK_ALWAYS - sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); #endif - inSISIDXREG(SISPART4, 0x21, temp); - return(int)((temp & 0x07) * 2); - } + inSISIDXREG(SISPART4, 0x21, temp); + return(int)((temp & 0x07) * 2); } void SiS_SetSISTVcolcalib(ScrnInfoPtr pScrn, int val, Bool coarse) @@ -9431,7 +9716,7 @@ void SiS_SetSISTVcolcalib(ScrnInfoPtr pScrn, int val, Bool coarse) unsigned char temp; #ifdef SISDUALHEAD - if(pSiSEnt) cbase = pSiSEnt->sistvccbase; + if(pSiSEnt && pSiS->DualHeadMode) cbase = pSiSEnt->sistvccbase; #endif if(coarse) { @@ -9440,7 +9725,7 @@ void SiS_SetSISTVcolcalib(ScrnInfoPtr pScrn, int val, Bool coarse) #ifdef SISDUALHEAD if(pSiSEnt) { pSiSEnt->sistvcolcalibc = val; - cfine = pSiSEnt->sistvcolcalibf; + if(pSiS->DualHeadMode) cfine = pSiSEnt->sistvcolcalibf; } #endif } else { @@ -9449,13 +9734,14 @@ void SiS_SetSISTVcolcalib(ScrnInfoPtr pScrn, int val, Bool coarse) #ifdef SISDUALHEAD if(pSiSEnt) { pSiSEnt->sistvcolcalibf = val; - ccoarse = pSiSEnt->sistvcolcalibc; + if(pSiS->DualHeadMode) ccoarse = pSiSEnt->sistvcolcalibc; } #endif } - if(!(pSiS->VBFlags & CRT2_TV)) return; - if(!(pSiS->VBFlags & VB_SISBRIDGE)) return; + if(!(pSiS->VBFlags & CRT2_TV)) return; + if(!(pSiS->VBFlags & VB_SISBRIDGE)) return; + if(pSiS->VBFlags & (TV_HIVISION | TV_YPBPR)) return; #ifdef UNLOCK_ALWAYS sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); @@ -9487,16 +9773,12 @@ int SiS_GetSISTVcolcalib(ScrnInfoPtr pScrn, Bool coarse) SISEntPtr pSiSEnt = pSiS->entityPrivate; if(pSiSEnt && pSiS->DualHeadMode) - if(coarse) - return (int)pSiSEnt->sistvcolcalibc; - else - return (int)pSiSEnt->sistvcolcalibf; + if(coarse) return (int)pSiSEnt->sistvcolcalibc; + else return (int)pSiSEnt->sistvcolcalibf; else #endif - if(coarse) - return (int)pSiS->sistvcolcalibc; - else - return (int)pSiS->sistvcolcalibf; + if(coarse) return (int)pSiS->sistvcolcalibc; + else return (int)pSiS->sistvcolcalibf; } void SiS_SetSISTVcfilter(ScrnInfoPtr pScrn, int val) @@ -9511,8 +9793,9 @@ void SiS_SetSISTVcfilter(ScrnInfoPtr pScrn, int val) if(pSiSEnt) pSiSEnt->sistvcfilter = pSiS->sistvcfilter; #endif - if(!(pSiS->VBFlags & CRT2_TV)) return; - if(!(pSiS->VBFlags & VB_SISBRIDGE)) return; + if(!(pSiS->VBFlags & CRT2_TV)) return; + if(!(pSiS->VBFlags & VB_SISBRIDGE)) return; + if(pSiS->VBFlags & (TV_HIVISION | TV_YPBPR)) return; #ifdef UNLOCK_ALWAYS sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); @@ -9524,25 +9807,23 @@ void SiS_SetSISTVcfilter(ScrnInfoPtr pScrn, int val) int SiS_GetSISTVcfilter(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); + int result = pSiS->sistvcfilter; + unsigned char temp; #ifdef SISDUALHEAD SISEntPtr pSiSEnt = pSiS->entityPrivate; -#endif - if(!(pSiS->VBFlags & VB_SISBRIDGE && pSiS->VBFlags & CRT2_TV)) { -#ifdef SISDUALHEAD - if(pSiSEnt && pSiS->DualHeadMode) - return (int)pSiSEnt->sistvcfilter; - else + if(pSiSEnt && pSiS->DualHeadMode) result = pSiSEnt->sistvcfilter; #endif - return (int)pSiS->sistvcfilter; - } else { - unsigned char temp; + + if(!(pSiS->VBFlags & VB_SISBRIDGE)) return result; + if(!(pSiS->VBFlags & CRT2_TV)) return result; + if(pSiS->VBFlags & (TV_HIVISION | TV_YPBPR)) return result; + #ifdef UNLOCK_ALWAYS - sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); + sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); #endif - inSISIDXREG(SISPART2, 0x30, temp); - return(int)((temp & 0x10) ? 1 : 0); - } + inSISIDXREG(SISPART2, 0x30, temp); + return(int)((temp & 0x10) ? 1 : 0); } void SiS_SetSISTVyfilter(ScrnInfoPtr pScrn, int val) @@ -9559,15 +9840,16 @@ void SiS_SetSISTVyfilter(ScrnInfoPtr pScrn, int val) if(pSiSEnt) pSiSEnt->sistvyfilter = pSiS->sistvyfilter; #endif - if(!(pSiS->VBFlags & CRT2_TV)) return; - if(!(pSiS->VBFlags & VB_SISBRIDGE)) return; + if(!(pSiS->VBFlags & CRT2_TV)) return; + if(!(pSiS->VBFlags & VB_SISBRIDGE)) return; + if(pSiS->VBFlags & (TV_HIVISION | TV_YPBPR)) return; p35 = pSiS->p2_35; p36 = pSiS->p2_36; p37 = pSiS->p2_37; p38 = pSiS->p2_38; p48 = pSiS->p2_48; p49 = pSiS->p2_49; p4a = pSiS->p2_4a; p30 = pSiS->p2_30; #ifdef SISDUALHEAD - if(pSiSEnt) { + if(pSiSEnt && pSiS->DualHeadMode) { p35 = pSiSEnt->p2_35; p36 = pSiSEnt->p2_36; p37 = pSiSEnt->p2_37; p38 = pSiSEnt->p2_38; p48 = pSiSEnt->p2_48; p49 = pSiSEnt->p2_49; @@ -9876,63 +10158,38 @@ void SiS_SetTVxposoffset(ScrnInfoPtr pScrn, int val) if((val >= -32) && (val <= 32)) { - unsigned char p2_1f,p2_20,p2_2b,p2_43,p3d4_34; + unsigned char p2_1f,p2_20,p2_2b,p2_42,p2_43; unsigned short temp; - int myadd2, mysub; p2_1f = pSiS->p2_1f; p2_20 = pSiS->p2_20; + p2_2b = pSiS->p2_2b; + p2_42 = pSiS->p2_42; + p2_43 = pSiS->p2_43; #ifdef SISDUALHEAD if(pSiSEnt && pSiS->DualHeadMode) { p2_1f = pSiSEnt->p2_1f; p2_20 = pSiSEnt->p2_20; + p2_2b = pSiSEnt->p2_2b; + p2_42 = pSiSEnt->p2_42; + p2_43 = pSiSEnt->p2_43; } #endif - inSISIDXREG(SISCR,0x34,p3d4_34); - p3d4_34 &= 0x7f; temp = p2_1f | ((p2_20 & 0xf0) << 4); temp += (val * 2); - p2_1f = temp & 0xff; p2_20 = (temp & 0xf00) >> 4; - - if((pSiS->VBFlags & (TV_NTSC | TV_PALM)) && - ((p3d4_34 == 0x64) || (p3d4_34 == 0x4a) || (p3d4_34 == 0x38))) { - temp += 1514; - myadd2 = 4; - mysub = 4; - } else { - temp += 1363; - myadd2 = 3; - if(pSiS->VBFlags & VB_301) myadd2 += 3; - mysub = 5; - } - - p2_2b = ((temp & 0xf00) >> 4) | ((p2_1f - mysub) & 0x0f); - p2_43 = p2_1f + myadd2; - -#if 0 - p2_1f += (val * 2); - if((pSiS->VBFlags & (TV_NTSC | TV_PALM)) && - ((p3d4_34 == 0x64) || (p3d4_34 == 0x4a) || (p3d4_34 == 0x38))) { - p2_2b = ((p2_1f - 4) & 0x0f) | 0x70; - p2_2c = p2_1f - 22; - p2_2d = ((p2_2c - 4) & 0x0f) | 0xe0; - p2_43 = p2_1f + 4; - } else { - p2_2b = ((p2_1f - 5) & 0x0f) | 0x60; - p2_2c = p2_1f + 1; - p2_2d = ((p2_2c - 5) & 0x0f) | (pSiS->VBFlags & TV_PAL ? 0x80 : 0xf0); - p2_43 = p2_1f + 3; - if(pSiS->VBFlags & VB_301) p2_43 += 3; - } -#endif - + p2_2b = ((p2_2b & 0x0f) + (val * 2)) & 0x0f; + temp = p2_43 | ((p2_42 & 0xf0) << 4); + temp += (val * 2); + p2_43 = temp & 0xff; + p2_42 = (temp & 0xf00) >> 4; SISWaitRetraceCRT2(pScrn); outSISIDXREG(SISPART2,0x1f,p2_1f); setSISIDXREG(SISPART2,0x20,0x0F,p2_20); - outSISIDXREG(SISPART2,0x2b,p2_2b); + setSISIDXREG(SISPART2,0x2b,0xF0,p2_2b); + setSISIDXREG(SISPART2,0x42,0x0F,p2_42); outSISIDXREG(SISPART2,0x43,p2_43); } } @@ -9964,7 +10221,7 @@ void SiS_SetTVxposoffset(ScrnInfoPtr pScrn, int val) temp3 += (val * 4); while(temp3 > 0x03ff) { temp3 -= 4; - } + } } } SiS6326SetTVReg(pScrn,0x3a,(temp1 & 0xff)); @@ -10006,7 +10263,7 @@ void SiS_SetTVyposoffset(ScrnInfoPtr pScrn, int val) #ifdef SISDUALHEAD SISEntPtr pSiSEnt = pSiS->entityPrivate; #endif - + #ifdef UNLOCK_ALWAYS sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); #endif @@ -10044,7 +10301,7 @@ void SiS_SetTVyposoffset(ScrnInfoPtr pScrn, int val) if((val >= -32) && (val <= 32)) { char p2_01, p2_02; - val /= 4; + val /= 2; /* 4 */ p2_01 = pSiS->p2_01; p2_02 = pSiS->p2_02; #ifdef SISDUALHEAD @@ -10053,10 +10310,10 @@ void SiS_SetTVyposoffset(ScrnInfoPtr pScrn, int val) p2_02 = pSiSEnt->p2_02; } #endif - p2_01 += (val * 2); - p2_02 += (val * 2); + p2_01 += val; /* val * 2 */ + p2_02 += val; /* val * 2 */ while((p2_01 <= 0) || (p2_02 <= 0)) { - p2_01 += 2; + p2_01 += 2; p2_02 += 2; } SISWaitRetraceCRT2(pScrn); @@ -10064,9 +10321,9 @@ void SiS_SetTVyposoffset(ScrnInfoPtr pScrn, int val) outSISIDXREG(SISPART2,0x02,p2_02); } } - + } - + } else if(pSiS->Chipset == PCI_CHIP_SIS6326) { if(pSiS->SiS6326Flags & SIS6326_TVDETECTED) { @@ -10206,6 +10463,7 @@ int SiS_GetTVxscale(ScrnInfoPtr pScrn) void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val) { SISPtr pSiS = SISPTR(pScrn); + Bool usentsc = FALSE; #ifdef SISDUALHEAD SISEntPtr pSiSEnt = pSiS->entityPrivate; #endif @@ -10222,17 +10480,22 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val) if(pSiSEnt) pSiSEnt->tvyscale = val; #endif - if(pSiS->VBFlags & (TV_HIVISION | TV_HIVISION_LV)) return; - if(pSiS->VGAEngine == SIS_315_VGA || pSiS->VGAEngine == SIS_315_VGA) { if((pSiS->VBFlags & CRT2_TV) && (pSiS->VBFlags & VB_SISBRIDGE)) { - int srindex = -1; - int newvde, i=0, j, temp; - int vlimit = (pSiS->VBFlags & (TV_NTSC | TV_PALM)) ? 259 : 309; + int srindex = -1, newvde, i = 0, j, vlimit, temp; unsigned char p3d4_34; + if(pSiS->VBFlags & TV_HIVISION) return; + if((pSiS->VBFlags & TV_YPBPR) && + (pSiS->VBFlags & (TV_YPBPR1080I | TV_YPBPR750P | TV_YPBPR525P))) return; + + if(pSiS->VBFlags & TV_YPBPR) usentsc = TRUE; + else if(pSiS->VBFlags & (TV_NTSC | TV_PALM)) usentsc = TRUE; + + vlimit = usentsc ? 259 : 309; + inSISIDXREG(SISCR,0x34,p3d4_34); switch((p3d4_34 & 0x7f)) { @@ -10244,7 +10507,7 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val) case 0x2e: /* 640x480 */ case 0x44: case 0x62: - srindex = (pSiS->VBFlags & (TV_NTSC | TV_PALM)) ? 0 : 21; + srindex = usentsc ? 0 : 21; break; case 0x31: /* 720x480 */ case 0x33: @@ -10256,7 +10519,7 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val) case 0x60: case 0x61: if(pSiS->VGAEngine == SIS_315_VGA) { - srindex = (pSiS->VBFlags & (TV_NTSC | TV_PALM)) ? 7 : 28; + srindex = usentsc ? 7 : 28; } break; #if 0 @@ -10267,7 +10530,7 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val) case 0x30: /* 800x600 */ case 0x47: case 0x63: - srindex = (pSiS->VBFlags & (TV_NTSC | TV_PALM)) ? 14 : 35; + srindex = usentsc ? 14 : 35; } if(srindex >= 0) { @@ -10295,6 +10558,7 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val) unsigned char p2_46 = pSiS->p2_46; unsigned char p2_47 = pSiS->p2_47; unsigned char p1scaling[9], p4scaling[9]; + unsigned char *p2scaling; for(i=0; i<9; i++) { p1scaling[i] = pSiS->scalingp1[i]; @@ -10302,8 +10566,9 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val) for(i=0; i<9; i++) { p4scaling[i] = pSiS->scalingp4[i]; } + p2scaling = &pSiS->scalingp2[0]; #ifdef SISDUALHEAD - if(pSiSEnt) { + if(pSiSEnt && pSiS->DualHeadMode) { p2_0a = pSiSEnt->p2_0a; p2_2f = pSiSEnt->p2_2f; p2_30 = pSiSEnt->p2_30; @@ -10315,9 +10580,15 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val) for(i=0; i<9; i++) { p4scaling[i] = pSiSEnt->scalingp4[i]; } + p2scaling = &pSiSEnt->scalingp2[0]; } #endif SISWaitRetraceCRT2(pScrn); + if(pSiS->VBFlags & (VB_301C|VB_302ELV)) { + for(i=0; i<64; i++) { + outSISIDXREG(SISPART2,(0xc0 + i),p2scaling[i]); + } + } for(i=0; i<9; i++) { outSISIDXREG(SISPART1,SiSScalingP1Regs[i],p1scaling[i]); } @@ -10336,10 +10607,11 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val) } else { int so = (pSiS->VGAEngine == SIS_300_VGA) ? 12 : 0; - int realvde; + int realvde, j, srindex301c, myypos, watchdog = 32; unsigned long calctemp; srindex += i; + srindex301c = srindex * 64; newvde = SiSTVVScale[srindex].ScaleVDE; realvde = SiSTVVScale[srindex].RealVDE; @@ -10347,10 +10619,24 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val) inSISIDXREG(SISPART2,0x01,temp); temp = vlimit - (temp & 0x7f); if((temp - (((newvde >> 1) - 2) + 9)) > 0) break; - SiS_SetTVyposoffset(pScrn, pSiS->tvypos - 1); - } while(1); + myypos = pSiS->tvypos - 1; +#ifdef SISDUALHEAD + if(pSiSEnt && pSiS->DualHeadMode) myypos = pSiSEnt->tvypos - 1; +#endif + SiS_SetTVyposoffset(pScrn, myypos); + } while(watchdog--); SISWaitRetraceCRT2(pScrn); + + if(pSiS->VBFlags & (VB_301C|VB_302ELV)) { +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "301C scaler: Table index %d\n"); +#endif + for(j=0; j<64; j++) { + outSISIDXREG(SISPART2,(0xc0 + j), SiS301CScaling[srindex301c + j]); + } + } + if(!(pSiS->VBFlags & VB_301)) { temp = (newvde >> 1) - 3; setSISIDXREG(SISPART2,0x46,0x9f,((temp & 0x0300) >> 3)); @@ -10447,6 +10733,15 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg) sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); #endif + if(pSiS->sishw_ext.jChipType >= SIS_661) { + inSISIDXREG(SISSR,0x11,tmpreg); + if(tmpreg & 0x20) { + inSISIDXREG(SISSR,0x3e,tmpreg); + tmpreg = (tmpreg + 1) & 0xff; + outSISIDXREG(SISSR,0x3e,tmpreg); + } + } + if((!pSiS->UseVESA) && (pSiS->VBFlags & CRT2_ENABLE)) { if(pSiS->VBFlags != pSiS->VBFlags_backup) { @@ -10479,10 +10774,10 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg) if(pSiS->VGAEngine == SIS_315_VGA) { if((pSiS->CRT1off) && (doit)) { - orSISIDXREG(SISCR,0x63,0x40); + orSISIDXREG(SISCR,pSiS->myCR63,0x40); orSISIDXREG(SISSR,0x1f,0xc0); } else { - andSISIDXREG(SISCR,0x63,0xBF); + andSISIDXREG(SISCR,pSiS->myCR63,0xBF); andSISIDXREG(SISSR,0x1f,0x3f); } @@ -10591,10 +10886,32 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg) } } + /* Determine if our very special TV mode is active */ + pSiS->MiscFlags &= ~MISC_TVNTSC1024; + if((pSiS->VBFlags & VB_SISBRIDGE) && (pSiS->VBFlags & CRT2_TV) && (!(pSiS->VBFlags & TV_HIVISION))) { + if( ((pSiS->VBFlags & TV_YPBPR) && (pSiS->VBFlags & TV_YPBPR525I)) || + ((!(pSiS->VBFlags & TV_YPBPR)) && (pSiS->VBFlags & (TV_NTSC | TV_PALM))) ) { + inSISIDXREG(SISCR,0x34,tmpreg); + tmpreg &= 0x7f; + if((tmpreg == 0x64) || (tmpreg == 0x4a) || (tmpreg == 0x38)) { + pSiS->MiscFlags |= MISC_TVNTSC1024; + } + } + } + #ifdef SISVRAMQ if(pSiS->VGAEngine == SIS_315_VGA) { + int i; /* Re-Enable command queue */ SiSEnableTurboQueue(pScrn); + /* Get HWCursor register contents for backup */ + for(i = 0; i < 16; i++) { + pSiS->HWCursorBackup[i] = MMIO_IN32(pSiS->IOBase, 0x8500 + (i << 2)); + } + if(pSiS->sishw_ext.jChipType >= SIS_330) { + /* Enable HWCursor protection (Y pos as trigger) */ + andSISIDXREG(SISCR, 0x5b, ~0x30); + } } #endif @@ -10668,7 +10985,7 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg) pSiS->tvy = SiS_GetCH700x(pSiS->SiS_Pr, 0x0b); pSiS->tvy |= ((SiS_GetCH700x(pSiS->SiS_Pr, 0x08) & 0x01) << 8); #ifdef SISDUALHEAD - if(pSiSEnt && pSiS->DualHeadMode) { + if(pSiSEnt) { pSiSEnt->tvx = pSiS->tvx; pSiSEnt->tvy = pSiS->tvy; } @@ -10727,14 +11044,17 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg) /* Backup default TV position, scale and colcalib registers */ inSISIDXREG(SISPART2,0x1f,pSiS->p2_1f); inSISIDXREG(SISPART2,0x20,pSiS->p2_20); + inSISIDXREG(SISPART2,0x2b,pSiS->p2_2b); + inSISIDXREG(SISPART2,0x42,pSiS->p2_42); + inSISIDXREG(SISPART2,0x43,pSiS->p2_43); inSISIDXREG(SISPART2,0x01,pSiS->p2_01); inSISIDXREG(SISPART2,0x02,pSiS->p2_02); inSISIDXREG(SISPART2,0x44,pSiS->p2_44); inSISIDXREG(SISPART2,0x45,pSiS->p2_45); if(!(pSiS->VBFlags & VB_301)) { - inSISIDXREG(SISPART2,0x46,pSiS->p2_46); + inSISIDXREG(SISPART2,0x46,pSiS->p2_46); } else { - pSiS->p2_46 = 0; + pSiS->p2_46 = 0; } inSISIDXREG(SISPART2,0x0a,pSiS->p2_0a); inSISIDXREG(SISPART2,0x31,cbase); @@ -10763,24 +11083,36 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg) for(i=0; i<9; i++) { inSISIDXREG(SISPART4,SiSScalingP4Regs[i],pSiS->scalingp4[i]); } + if(pSiS->VBFlags & (VB_301C | VB_302ELV)) { + for(i=0; i<64; i++) { + inSISIDXREG(SISPART2,(0xc0 + i),pSiS->scalingp2[i]); + } + } #ifdef SISDUALHEAD - if(pSiSEnt && pSiS->DualHeadMode) { - pSiSEnt->p2_1f = pSiS->p2_1f; pSiSEnt->p2_20 = pSiS->p2_20; - pSiSEnt->p2_01 = pSiS->p2_01; pSiSEnt->p2_02 = pSiS->p2_02; - pSiSEnt->p2_44 = pSiS->p2_44; pSiSEnt->p2_45 = pSiS->p2_45; - pSiSEnt->p2_46 = pSiS->p2_46; pSiSEnt->p2_0a = pSiS->p2_0a; - pSiSEnt->sistvccbase = pSiS->sistvccbase; - pSiSEnt->p2_35 = pSiS->p2_35; pSiSEnt->p2_36 = pSiS->p2_36; - pSiSEnt->p2_37 = pSiS->p2_37; pSiSEnt->p2_38 = pSiS->p2_38; - pSiSEnt->p2_48 = pSiS->p2_48; pSiSEnt->p2_49 = pSiS->p2_49; - pSiSEnt->p2_4a = pSiS->p2_4a; pSiSEnt->p2_2f = pSiS->p2_2f; - pSiSEnt->p2_30 = pSiS->p2_30; pSiSEnt->p2_47 = pSiS->p2_47; - for(i=0; i<9; i++) { - pSiSEnt->scalingp1[i] = pSiS->scalingp1[i]; - } - for(i=0; i<9; i++) { - pSiSEnt->scalingp4[i] = pSiS->scalingp4[i]; - } + if(pSiSEnt) { + pSiSEnt->p2_1f = pSiS->p2_1f; pSiSEnt->p2_20 = pSiS->p2_20; + pSiSEnt->p2_42 = pSiS->p2_42; pSiSEnt->p2_43 = pSiS->p2_43; + pSiSEnt->p2_2b = pSiS->p2_2b; + pSiSEnt->p2_01 = pSiS->p2_01; pSiSEnt->p2_02 = pSiS->p2_02; + pSiSEnt->p2_44 = pSiS->p2_44; pSiSEnt->p2_45 = pSiS->p2_45; + pSiSEnt->p2_46 = pSiS->p2_46; pSiSEnt->p2_0a = pSiS->p2_0a; + pSiSEnt->sistvccbase = pSiS->sistvccbase; + pSiSEnt->p2_35 = pSiS->p2_35; pSiSEnt->p2_36 = pSiS->p2_36; + pSiSEnt->p2_37 = pSiS->p2_37; pSiSEnt->p2_38 = pSiS->p2_38; + pSiSEnt->p2_48 = pSiS->p2_48; pSiSEnt->p2_49 = pSiS->p2_49; + pSiSEnt->p2_4a = pSiS->p2_4a; pSiSEnt->p2_2f = pSiS->p2_2f; + pSiSEnt->p2_30 = pSiS->p2_30; pSiSEnt->p2_47 = pSiS->p2_47; + for(i=0; i<9; i++) { + pSiSEnt->scalingp1[i] = pSiS->scalingp1[i]; + } + for(i=0; i<9; i++) { + pSiSEnt->scalingp4[i] = pSiS->scalingp4[i]; + } + if(pSiS->VBFlags & (VB_301C | VB_302ELV)) { + for(i=0; i<64; i++) { + pSiSEnt->scalingp2[i] = pSiS->scalingp2[i]; + } + } } #endif if((val = mysistvantiflicker) != -1) { @@ -11034,7 +11366,8 @@ SiS_CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned long VBFlags, } } - return(SiS_GetModeID(pSiS->VGAEngine, VBFlags, mode->HDisplay, mode->VDisplay, i, pSiS->FSTN)); + return(SiS_GetModeID(pSiS->VGAEngine, VBFlags, mode->HDisplay, mode->VDisplay, + i, pSiS->FSTN, pSiS->LCDwidth, pSiS->LCDheight)); } USHORT @@ -11066,6 +11399,7 @@ SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned long VBF return 0xfe; if((havecustommodes) && + (pSiS->LCDwidth) && /* = test if LCD present */ (!(mode->type & M_T_DEFAULT)) && (!(mode->Flags & V_INTERLACE))) return 0xfe; @@ -11078,7 +11412,7 @@ SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned long VBF ((mode->HDisplay == 800) && (mode->HDisplay == 600)))) ) { ModeIndex = SiS_GetModeID_LCD(pSiS->VGAEngine, VBFlags, mode->HDisplay, mode->VDisplay, i, - pSiS->FSTN, pSiS->SiS_Pr->SiS_CustomT, pSiS->LCDwidth, pSiS->LCDheight); + pSiS->FSTN, pSiS->SiS_Pr->SiS_CustomT, pSiS->LCDwidth, pSiS->LCDheight); } @@ -11320,7 +11654,8 @@ SiS_GetSetModeID(ScrnInfoPtr pScrn, unsigned char id) unsigned char SiS_GetSetBIOSScratch(ScrnInfoPtr pScrn, USHORT offset, unsigned char value) { - unsigned char ret; + unsigned char ret = 0; +#if (defined(i386) || defined(__i386) || defined(__i386__) || defined(__AMD64__)) unsigned char *base; base = xf86MapVidMem(pScrn->scrnIndex, VIDMEM_MMIO, 0, 0x2000); @@ -11336,7 +11671,7 @@ SiS_GetSetBIOSScratch(ScrnInfoPtr pScrn, USHORT offset, unsigned char value) *(base + offset) = value; xf86UnMapVidMem(pScrn->scrnIndex, base, 0x2000); - +#endif return ret; } diff --git a/src/sis_driver.h b/src/sis_driver.h index 4c085ef..d76cde0 100644 --- a/src/sis_driver.h +++ b/src/sis_driver.h @@ -1,26 +1,30 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h,v 1.27 2003/11/19 00:49:05 twini Exp $ */ +/* $XFree86$ */ /* * 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. * * Author: Thomas Winischhofer <thomas@winischhofer.net> * @@ -80,14 +84,16 @@ static const struct _sis_vrate { {1, 1152, 864, 75, TRUE}, {2, 1152, 864, 84, FALSE}, {1, 1280, 720, 60, TRUE}, {2, 1280, 720, 75, FALSE}, {3, 1280, 720, 85, TRUE}, {1, 1280, 768, 60, TRUE}, + {1, 1280, 800, 60, TRUE}, {1, 1280, 960, 60, TRUE}, {2, 1280, 960, 85, TRUE}, {1, 1280, 1024, 43, FALSE}, {2, 1280, 1024, 60, TRUE}, {3, 1280, 1024, 75, FALSE}, {4, 1280, 1024, 85, TRUE}, {1, 1360, 768, 60, TRUE}, {1, 1400, 1050, 60, TRUE}, {2, 1400, 1050, 75, TRUE}, - {1, 1600, 1200, 60, TRUE}, {2, 1600, 1200, 65, TRUE}, {3, 1600, 1200, 70, TRUE}, - {4, 1600, 1200, 75, TRUE}, {5, 1600, 1200, 85, TRUE}, {6, 1600, 1200, 100, TRUE}, + {1, 1600, 1200, 60, TRUE}, {2, 1600, 1200, 65, TRUE}, {3, 1600, 1200, 70, TRUE}, + {4, 1600, 1200, 75, TRUE}, {5, 1600, 1200, 85, TRUE}, {6, 1600, 1200, 100, TRUE}, {7, 1600, 1200, 120, TRUE}, + {1, 1680, 1050, 60, TRUE}, {1, 1920, 1440, 60, TRUE}, {2, 1920, 1440, 65, TRUE}, {3, 1920, 1440, 70, TRUE}, {4, 1920, 1440, 75, TRUE}, {5, 1920, 1440, 85, TRUE}, {6, 1920, 1440, 100, TRUE}, {1, 2048, 1536, 60, TRUE}, {2, 2048, 1536, 65, TRUE}, {3, 2048, 1536, 70, TRUE}, @@ -141,24 +147,24 @@ const customttable mycustomttable[] = { "Inventec (Compaq)", "3017cl/3045US", CUT_COMPAQ12802, "COMPAQ_1280" }, { SIS_650, "", "", - 0, + 0, /* Special 1024x768 / dual link */ { 0x00c, 0, 0, 0, 0 }, { 'e' , 0, 0, 0, 0 }, 0x1558, 0x0287, "Clevo", "L285/L287 (Version 1)", CUT_CLEVO1024, "CLEVO_L28X_1" }, { SIS_650, "", "", - 0, + 0, /* Special 1024x768 / single link */ { 0x00c, 0, 0, 0, 0 }, { 'y' , 0, 0, 0, 0 }, 0x1558, 0x0287, "Clevo", "L285/L287 (Version 2)", CUT_CLEVO10242, "CLEVO_L28X_2" }, { SIS_650, "", "", - 0, + 0, /* Special 1400x1050 */ { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 }, - 0x1558, 0x0400, /* possibly 401 and 402 as well; not panelsize specific (?) */ + 0x1558, 0x0400, /* possibly 401 and 402 as well; not panelsize specific? */ "Clevo", "D400S/D410S/D400H/D410H", CUT_CLEVO1400, "CLEVO_D4X0" }, { SIS_650, "", "", @@ -196,6 +202,41 @@ const customttable mycustomttable[] = { 0x1043, 0x1612, "Asus", "L3000D/L3500D", CUT_ASUSL3000D, "ASUS_L3X00" }, + { SIS_650, "1.10.9k", "", + 0, /* For EMI */ + { 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0 }, + 0x1025, 0x0028, + "Acer", "Aspire 1700", CUT_ACER1280, "ACER_ASPIRE1700" + }, + { SIS_650, "1.10.7w", "", + 0, /* For EMI */ + { 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0 }, + 0x14c0, 0x0012, + "Compal", "??? (V1)", CUT_COMPAL1400_1, "COMPAL_1400_1" + }, + { SIS_650, "1.10.7x", "", /* New BIOS on its way (from BG.) */ + 0, /* For EMI */ + { 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0 }, + 0x14c0, 0x0012, + "Compal", "??? (V2)", CUT_COMPAL1400_2, "COMPAL_1400_2" + }, + { SIS_650, "1.10.8o", "", + 0, /* For EMI (unknown) */ + { 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0 }, + 0x1043, 0x1612, + "Asus", "A2H (V1)", CUT_ASUSA2H_1, "ASUS_A2H_1" + }, + { SIS_650, "1.10.8q", "", + 0, /* For EMI */ + { 0, 0, 0, 0, 0 }, + { 0, 0, 0, 0, 0 }, + 0x1043, 0x1612, + "Asus", "A2H (V2)", CUT_ASUSA2H_2, "ASUS_A2H_2" + }, { 4321, "", "", /* never autodetected */ 0, { 0, 0, 0, 0, 0 }, @@ -993,6 +1034,232 @@ unsigned const char SiSScalingP4Regs[] = { 0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b }; +static const unsigned char SiS301CScaling[] = { + + /* NTSC/PAL-M/525ip 640x480 */ + + 0x03,0x1C,0x03,0x7E,0x01,0x1C,0x05,0x7E,0x00,0x1C,0x06,0x7E,0x7F,0x1B,0x09,0x7D, + 0x7E,0x1A,0x0B,0x7D,0x7D,0x19,0x0D,0x7D,0x7D,0x18,0x0F,0x7C,0x7C,0x16,0x12,0x7C, + 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x16,0x7C,0x7C,0x0F,0x18,0x7D,0x7C,0x0D,0x19,0x7E, + 0x7D,0x0B,0x1A,0x7E,0x7D,0x09,0x1B,0x7F,0x7E,0x06,0x1C,0x00,0x7E,0x05,0x1C,0x01, + + 0x03,0x1B,0x03,0x7F,0x02,0x1B,0x05,0x7E,0x00,0x1B,0x07,0x7E,0x7F,0x1B,0x09,0x7D, + 0x7E,0x1A,0x0B,0x7D,0x7D,0x19,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7C,0x16,0x12,0x7C, + 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x16,0x7C,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x19,0x7E, + 0x7D,0x0B,0x1A,0x7E,0x7D,0x09,0x1B,0x7F,0x7E,0x07,0x1B,0x00,0x7E,0x05,0x1B,0x02, + + 0x04,0x1A,0x04,0x7E,0x02,0x1B,0x05,0x7E,0x01,0x1A,0x07,0x7E,0x00,0x1A,0x09,0x7D, + 0x7F,0x19,0x0B,0x7D,0x7E,0x18,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7D,0x15,0x12,0x7C, + 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x18,0x7F, + 0x7D,0x0B,0x19,0x7F,0x7D,0x09,0x1A,0x00,0x7D,0x07,0x1A,0x02,0x7E,0x05,0x1B,0x02, + + 0x04,0x1A,0x04,0x7E,0x03,0x1A,0x06,0x7D,0x01,0x1A,0x08,0x7D,0x00,0x19,0x0A,0x7D, + 0x7F,0x19,0x0C,0x7C,0x7E,0x18,0x0E,0x7C,0x7E,0x17,0x10,0x7B,0x7D,0x15,0x12,0x7C, + 0x7D,0x13,0x13,0x7D,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0E,0x18,0x7E, + 0x7D,0x0C,0x19,0x7E,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x1A,0x01,0x7E,0x06,0x1A,0x02, + + 0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x19,0x0A,0x7C, + 0x00,0x18,0x0C,0x7C,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x10,0x7C,0x7D,0x15,0x11,0x7D, + 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x15,0x7D,0x7D,0x10,0x16,0x7D,0x7D,0x0E,0x17,0x7E, + 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04, + + 0x05,0x18,0x05,0x7E,0x04,0x19,0x07,0x7C,0x02,0x18,0x08,0x7E,0x01,0x18,0x0A,0x7D, + 0x00,0x17,0x0C,0x7D,0x7F,0x17,0x0E,0x7C,0x7E,0x15,0x0F,0x7E,0x7E,0x14,0x11,0x7D, + 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x15,0x7F,0x7D,0x0E,0x17,0x7E, + 0x7D,0x0C,0x17,0x00,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x18,0x03,0x7D,0x07,0x19,0x03, + + 0x05,0x18,0x05,0x7E,0x04,0x18,0x07,0x7D,0x03,0x18,0x09,0x7C,0x02,0x17,0x0A,0x7D, + 0x01,0x17,0x0C,0x7C,0x00,0x16,0x0E,0x7C,0x7F,0x15,0x0F,0x7D,0x7E,0x14,0x11,0x7D, + 0x7E,0x12,0x12,0x7E,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x15,0x7F,0x7D,0x0E,0x16,0x7F, + 0x7D,0x0C,0x17,0x00,0x7D,0x0A,0x17,0x02,0x7D,0x09,0x18,0x02,0x7D,0x07,0x18,0x04, + + /* NTSC/PAL-M/525ip 720x480 */ + + 0x03,0x1C,0x03,0x7E,0x01,0x1C,0x05,0x7E,0x00,0x1C,0x06,0x7E,0x7F,0x1B,0x09,0x7D, + 0x7E,0x1A,0x0B,0x7D,0x7D,0x19,0x0D,0x7D,0x7D,0x18,0x0F,0x7C,0x7C,0x16,0x12,0x7C, + 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x16,0x7C,0x7C,0x0F,0x18,0x7D,0x7C,0x0D,0x19,0x7E, + 0x7D,0x0B,0x1A,0x7E,0x7D,0x09,0x1B,0x7F,0x7E,0x06,0x1C,0x00,0x7E,0x05,0x1C,0x01, + + 0x03,0x1B,0x03,0x7F,0x02,0x1B,0x05,0x7E,0x00,0x1B,0x07,0x7E,0x7F,0x1B,0x09,0x7D, + 0x7E,0x1A,0x0B,0x7D,0x7D,0x19,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7C,0x16,0x12,0x7C, + 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x16,0x7C,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x19,0x7E, + 0x7D,0x0B,0x1A,0x7E,0x7D,0x09,0x1B,0x7F,0x7E,0x07,0x1B,0x00,0x7E,0x05,0x1B,0x02, + + 0x04,0x1A,0x04,0x7E,0x02,0x1B,0x05,0x7E,0x01,0x1A,0x07,0x7E,0x00,0x1A,0x09,0x7D, + 0x7F,0x19,0x0B,0x7D,0x7E,0x18,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7D,0x15,0x12,0x7C, + 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x18,0x7F, + 0x7D,0x0B,0x19,0x7F,0x7D,0x09,0x1A,0x00,0x7D,0x07,0x1A,0x02,0x7E,0x05,0x1B,0x02, + + 0x04,0x1A,0x04,0x7E,0x03,0x1A,0x06,0x7D,0x01,0x1A,0x08,0x7D,0x00,0x19,0x0A,0x7D, + 0x7F,0x19,0x0C,0x7C,0x7E,0x18,0x0E,0x7C,0x7E,0x17,0x10,0x7B,0x7D,0x15,0x12,0x7C, + 0x7D,0x13,0x13,0x7D,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0E,0x18,0x7E, + 0x7D,0x0C,0x19,0x7E,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x1A,0x01,0x7E,0x06,0x1A,0x02, + + 0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x19,0x0A,0x7C, + 0x00,0x18,0x0C,0x7C,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x10,0x7C,0x7D,0x15,0x11,0x7D, + 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x15,0x7D,0x7D,0x10,0x16,0x7D,0x7D,0x0E,0x17,0x7E, + 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04, + + 0x05,0x18,0x05,0x7E,0x04,0x19,0x07,0x7C,0x02,0x18,0x08,0x7E,0x01,0x18,0x0A,0x7D, + 0x00,0x17,0x0C,0x7D,0x7F,0x17,0x0E,0x7C,0x7E,0x15,0x0F,0x7E,0x7E,0x14,0x11,0x7D, + 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x15,0x7F,0x7D,0x0E,0x17,0x7E, + 0x7D,0x0C,0x17,0x00,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x18,0x03,0x7D,0x07,0x19,0x03, + + 0x05,0x18,0x05,0x7E,0x04,0x18,0x07,0x7D,0x03,0x18,0x09,0x7C,0x02,0x17,0x0A,0x7D, + 0x01,0x17,0x0C,0x7C,0x00,0x16,0x0E,0x7C,0x7F,0x15,0x0F,0x7D,0x7E,0x14,0x11,0x7D, + 0x7E,0x12,0x12,0x7E,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x15,0x7F,0x7D,0x0E,0x16,0x7F, + 0x7D,0x0C,0x17,0x00,0x7D,0x0A,0x17,0x02,0x7D,0x09,0x18,0x02,0x7D,0x07,0x18,0x04, + + /* NTSC/PAL-M/525i 800x600 */ + + 0x07,0x15,0x07,0x7D,0x05,0x15,0x08,0x7E,0x04,0x15,0x09,0x7E,0x03,0x15,0x0B,0x7D, + 0x02,0x14,0x0C,0x7E,0x01,0x14,0x0D,0x7E,0x00,0x13,0x0F,0x7E,0x00,0x12,0x10,0x7E, + 0x7F,0x11,0x11,0x7F,0x7E,0x10,0x12,0x00,0x7E,0x0F,0x13,0x00,0x7E,0x0D,0x14,0x01, + 0x7D,0x0C,0x14,0x03,0x7D,0x0B,0x15,0x03,0x7D,0x09,0x15,0x05,0x7D,0x08,0x15,0x06, + + 0x07,0x15,0x07,0x7D,0x06,0x15,0x08,0x7D,0x05,0x15,0x09,0x7D,0x04,0x14,0x0B,0x7D, + 0x03,0x14,0x0C,0x7D,0x02,0x13,0x0D,0x7E,0x01,0x13,0x0E,0x7E,0x00,0x12,0x10,0x7E, + 0x7F,0x11,0x11,0x7F,0x7F,0x10,0x12,0x7F,0x7E,0x0E,0x13,0x01,0x7E,0x0D,0x13,0x02, + 0x7E,0x0C,0x14,0x02,0x7D,0x0B,0x14,0x04,0x7D,0x09,0x15,0x05,0x7D,0x08,0x15,0x06, + + 0x07,0x14,0x07,0x7E,0x06,0x14,0x08,0x7E,0x05,0x14,0x0A,0x7D,0x04,0x14,0x0B,0x7D, + 0x03,0x13,0x0C,0x7E,0x02,0x13,0x0D,0x7E,0x01,0x12,0x0E,0x7F,0x00,0x11,0x0F,0x00, + 0x00,0x10,0x10,0x00,0x7F,0x0F,0x11,0x01,0x7F,0x0E,0x12,0x01,0x7E,0x0D,0x13,0x02, + 0x7E,0x0C,0x13,0x03,0x7E,0x0B,0x14,0x03,0x7D,0x0A,0x14,0x05,0x7D,0x08,0x14,0x07, + + 0x07,0x14,0x07,0x7E,0x06,0x14,0x09,0x7D,0x05,0x14,0x0A,0x7D,0x04,0x13,0x0B,0x7E, + 0x03,0x13,0x0C,0x7E,0x02,0x12,0x0D,0x7F,0x01,0x12,0x0E,0x7F,0x01,0x11,0x0F,0x7F, + 0x00,0x10,0x10,0x00,0x7F,0x0F,0x11,0x01,0x7F,0x0E,0x12,0x01,0x7E,0x0D,0x12,0x03, + 0x7E,0x0C,0x13,0x03,0x7E,0x0B,0x13,0x04,0x7E,0x0A,0x14,0x04,0x7D,0x09,0x14,0x06, + + 0x08,0x13,0x08,0x7D,0x07,0x13,0x09,0x7D,0x05,0x13,0x0A,0x7E,0x04,0x13,0x0B,0x7E, + 0x04,0x12,0x0C,0x7E,0x03,0x12,0x0D,0x7E,0x02,0x11,0x0E,0x7F,0x01,0x10,0x0F,0x00, + 0x00,0x10,0x10,0x00,0x00,0x0F,0x10,0x01,0x7F,0x0E,0x11,0x02,0x7F,0x0D,0x12,0x02, + 0x7E,0x0C,0x12,0x04,0x7E,0x0B,0x13,0x04,0x7E,0x0A,0x13,0x05,0x7E,0x09,0x13,0x06, + + 0x08,0x13,0x08,0x7D,0x07,0x13,0x09,0x7D,0x06,0x12,0x0A,0x7E,0x05,0x12,0x0B,0x7E, + 0x04,0x12,0x0C,0x7E,0x03,0x11,0x0D,0x7F,0x02,0x11,0x0E,0x7F,0x01,0x10,0x0E,0x01, + 0x01,0x0F,0x0F,0x01,0x00,0x0E,0x10,0x02,0x00,0x0E,0x11,0x01,0x7F,0x0D,0x11,0x03, + 0x7F,0x0C,0x12,0x03,0x7E,0x0B,0x12,0x05,0x7E,0x0A,0x12,0x06,0x7E,0x09,0x13,0x06, + + 0x08,0x12,0x08,0x7E,0x07,0x12,0x09,0x7E,0x06,0x12,0x0A,0x7E,0x05,0x12,0x0B,0x7E, + 0x04,0x11,0x0C,0x7F,0x03,0x11,0x0D,0x7F,0x02,0x10,0x0D,0x01,0x02,0x10,0x0E,0x00, + 0x01,0x0F,0x0F,0x01,0x00,0x0E,0x10,0x02,0x00,0x0D,0x10,0x03,0x7F,0x0D,0x11,0x03, + 0x7F,0x0C,0x11,0x04,0x7F,0x0B,0x12,0x04,0x7E,0x0A,0x12,0x06,0x7E,0x09,0x12,0x07, + + /* PAL/PAL-N 640x480 */ + + 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E, + 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C, + 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C, + 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E, + + 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E, + 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C, + 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C, + 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E, + + 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E, + 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C, + 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C, + 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E, + + 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E, + 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C, + 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C, + 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E, + + 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E, + 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C, + 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C, + 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E, + + 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E, + 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C, + 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C, + 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E, + + 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E, + 0x7C,0x1D,0x09,0x7E,0x7C,0x1B,0x0B,0x7E,0x7C,0x19,0x0E,0x7D,0x7C,0x17,0x11,0x7C, + 0x7C,0x14,0x14,0x7C,0x7C,0x11,0x17,0x7C,0x7D,0x0E,0x19,0x7C,0x7E,0x0B,0x1B,0x7C, + 0x7E,0x09,0x1D,0x7C,0x7F,0x06,0x1F,0x7C,0x7F,0x04,0x20,0x7D,0x00,0x02,0x20,0x7E, + + /* PAL/PAL-N 720x576, 768x576 */ + + 0x03,0x1C,0x03,0x7E,0x01,0x1C,0x05,0x7E,0x00,0x1C,0x07,0x7D,0x7F,0x1B,0x09,0x7D, + 0x7E,0x1A,0x0B,0x7D,0x7D,0x19,0x0D,0x7D,0x7D,0x18,0x0F,0x7C,0x7C,0x16,0x12,0x7C, + 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x16,0x7C,0x7C,0x0F,0x18,0x7D,0x7C,0x0D,0x19,0x7E, + 0x7D,0x0B,0x1A,0x7E,0x7D,0x09,0x1B,0x7F,0x7E,0x07,0x1C,0x7F,0x7E,0x05,0x1C,0x01, + + 0x03,0x1B,0x03,0x7F,0x02,0x1B,0x05,0x7E,0x01,0x1B,0x07,0x7D,0x7F,0x1B,0x09,0x7D, + 0x7E,0x1A,0x0B,0x7D,0x7E,0x19,0x0D,0x7C,0x7D,0x17,0x10,0x7C,0x7C,0x16,0x12,0x7C, + 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x16,0x7C,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x19,0x7E, + 0x7D,0x0B,0x1A,0x7E,0x7D,0x09,0x1B,0x7F,0x7D,0x07,0x1B,0x01,0x7E,0x05,0x1B,0x02, + + 0x04,0x1A,0x04,0x7E,0x02,0x1B,0x05,0x7E,0x01,0x1A,0x07,0x7E,0x00,0x1A,0x09,0x7D, + 0x7F,0x19,0x0B,0x7D,0x7E,0x18,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7D,0x15,0x12,0x7C, + 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x18,0x7F, + 0x7D,0x0B,0x19,0x7F,0x7D,0x09,0x1A,0x00,0x7D,0x07,0x1A,0x02,0x7E,0x05,0x1B,0x02, + + 0x04,0x1A,0x04,0x7E,0x03,0x1A,0x06,0x7D,0x01,0x1A,0x08,0x7D,0x00,0x1A,0x09,0x7D, + 0x7F,0x19,0x0B,0x7D,0x7E,0x18,0x0E,0x7C,0x7E,0x17,0x10,0x7B,0x7D,0x15,0x12,0x7C, + 0x7D,0x13,0x13,0x7D,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0E,0x18,0x7E, + 0x7D,0x0B,0x19,0x7F,0x7D,0x09,0x1A,0x00,0x7D,0x08,0x1A,0x01,0x7E,0x06,0x1A,0x02, + + 0x04,0x19,0x04,0x7F,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x19,0x0A,0x7C, + 0x7F,0x18,0x0C,0x7D,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x10,0x7C,0x7D,0x15,0x11,0x7D, + 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x15,0x7D,0x7C,0x10,0x16,0x7E,0x7C,0x0E,0x17,0x7F, + 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04, + + 0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x18,0x0A,0x7D, + 0x00,0x18,0x0C,0x7C,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x0F,0x7D,0x7E,0x14,0x11,0x7D, + 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x16,0x7E,0x7D,0x0E,0x17,0x7E, + 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04, + + 0x05,0x18,0x05,0x7E,0x04,0x18,0x07,0x7D,0x03,0x18,0x08,0x7D,0x01,0x18,0x0A,0x7D, + 0x00,0x17,0x0C,0x7D,0x7F,0x16,0x0E,0x7D,0x7F,0x15,0x0F,0x7D,0x7E,0x14,0x11,0x7D, + 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x15,0x7F,0x7D,0x0E,0x16,0x7F, + 0x7D,0x0C,0x17,0x00,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x18,0x03,0x7D,0x07,0x18,0x04, + + /* PAL/PAL-N 800x600 */ + + 0x04,0x1A,0x04,0x7E,0x02,0x1A,0x05,0x7F,0x01,0x1A,0x07,0x7E,0x00,0x1A,0x09,0x7D, + 0x7F,0x19,0x0B,0x7D,0x7E,0x18,0x0D,0x7D,0x7D,0x17,0x10,0x7C,0x7D,0x15,0x12,0x7C, + 0x7C,0x14,0x14,0x7C,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0D,0x18,0x7F, + 0x7D,0x0B,0x19,0x7F,0x7D,0x09,0x1A,0x00,0x7D,0x07,0x1A,0x02,0x7E,0x05,0x1A,0x03, + + 0x04,0x1A,0x04,0x7E,0x03,0x1A,0x06,0x7D,0x01,0x1A,0x08,0x7D,0x00,0x19,0x0A,0x7D, + 0x7F,0x19,0x0C,0x7C,0x7E,0x18,0x0E,0x7C,0x7E,0x17,0x10,0x7B,0x7D,0x15,0x12,0x7C, + 0x7D,0x13,0x13,0x7D,0x7C,0x12,0x15,0x7D,0x7C,0x10,0x17,0x7D,0x7C,0x0E,0x18,0x7E, + 0x7D,0x0C,0x19,0x7E,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x1A,0x01,0x7E,0x06,0x1A,0x02, + + 0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x19,0x0A,0x7C, + 0x00,0x18,0x0C,0x7C,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x10,0x7C,0x7D,0x15,0x11,0x7D, + 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x15,0x7D,0x7C,0x10,0x16,0x7E,0x7C,0x0E,0x17,0x7F, + 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x19,0x00,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04, + + 0x05,0x19,0x05,0x7D,0x03,0x19,0x06,0x7E,0x02,0x19,0x08,0x7D,0x01,0x18,0x0A,0x7D, + 0x00,0x18,0x0C,0x7C,0x7F,0x17,0x0E,0x7C,0x7E,0x16,0x0F,0x7D,0x7E,0x14,0x11,0x7D, + 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x16,0x7E,0x7D,0x0E,0x17,0x7E, + 0x7D,0x0C,0x18,0x7F,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x19,0x02,0x7D,0x06,0x19,0x04, + + 0x05,0x18,0x05,0x7E,0x04,0x18,0x07,0x7D,0x03,0x18,0x08,0x7D,0x01,0x18,0x0A,0x7D, + 0x00,0x17,0x0C,0x7D,0x7F,0x16,0x0E,0x7D,0x7F,0x15,0x0F,0x7D,0x7E,0x14,0x11,0x7D, + 0x7D,0x13,0x13,0x7D,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x15,0x7F,0x7D,0x0E,0x16,0x7F, + 0x7D,0x0C,0x17,0x00,0x7D,0x0A,0x18,0x01,0x7D,0x08,0x18,0x03,0x7D,0x07,0x18,0x04, + + 0x06,0x18,0x06,0x7C,0x04,0x18,0x07,0x7D,0x03,0x18,0x09,0x7C,0x02,0x17,0x0A,0x7D, + 0x01,0x17,0x0C,0x7C,0x00,0x16,0x0E,0x7C,0x7F,0x15,0x0F,0x7D,0x7E,0x14,0x11,0x7D, + 0x7E,0x12,0x12,0x7E,0x7D,0x11,0x14,0x7E,0x7D,0x0F,0x15,0x7F,0x7D,0x0E,0x16,0x7F, + 0x7D,0x0C,0x17,0x00,0x7D,0x0A,0x17,0x02,0x7D,0x09,0x18,0x02,0x7D,0x07,0x18,0x04, + + 0x06,0x17,0x06,0x7D,0x05,0x17,0x07,0x7D,0x03,0x17,0x09,0x7D,0x02,0x17,0x0A,0x7D, + 0x01,0x16,0x0C,0x7D,0x00,0x15,0x0E,0x7D,0x7F,0x14,0x0F,0x7E,0x7F,0x13,0x11,0x7D, + 0x7E,0x12,0x12,0x7E,0x7E,0x11,0x13,0x7E,0x7D,0x0F,0x14,0x00,0x7D,0x0E,0x15,0x00, + 0x7D,0x0C,0x16,0x01,0x7D,0x0A,0x17,0x02,0x7D,0x09,0x17,0x03,0x7D,0x07,0x17,0x05 +}; + + /* Mandatory functions */ static void SISIdentify(int flags); static Bool SISProbe(DriverPtr drv, int flags); @@ -1034,7 +1301,7 @@ unsigned char SISSearchCRT1Rate(ScrnInfoPtr pScrn, DisplayModePtr mode); static void SISWaitVBRetrace(ScrnInfoPtr pScrn); void SISWaitRetraceCRT1(ScrnInfoPtr pScrn); void SISWaitRetraceCRT2(ScrnInfoPtr pScrn); -Bool InRegion(int x, int y, region r); +static Bool InRegion(int x, int y, region r); #ifdef SISMERGED static void SISMergePointerMoved(int scrnIndex, int x, int y); #endif @@ -1048,12 +1315,14 @@ unsigned char SiS_GetSetBIOSScratch(ScrnInfoPtr pScrn, USHORT offset, unsigned static void SiSDumpModeInfo(ScrnInfoPtr pScrn, DisplayModePtr mode); #endif -extern USHORT SiS_GetModeID(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth, BOOL FSTN); +extern USHORT SiS_GetModeID(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, + int Depth, BOOL FSTN, int LCDwith, int LCDheight); extern USHORT SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth, BOOLEAN FSTN, USHORT CustomT, int LCDwith, int LCDheight); extern USHORT SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth); extern USHORT SiS_GetModeID_VGA2(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth); extern int SiSTranslateToVESA(ScrnInfoPtr pScrn, int modenumber); +extern BOOLEAN SiSDetermineROMLayout661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo); extern BOOLEAN SiSBIOSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwDeviceExtension, ScrnInfoPtr pScrn, DisplayModePtr mode, BOOLEAN IsCustom); extern BOOLEAN SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwDeviceExtension, diff --git a/src/sis_opt.c b/src/sis_opt.c index add8168..b3dc1e7 100644 --- a/src/sis_opt.c +++ b/src/sis_opt.c @@ -1,31 +1,37 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c,v 1.45 2003/11/11 18:04:31 twini Exp $ */ +/* $XFree86$ */ /* * SiS driver option evaluation * - * Copyright 2001, 2002, 2003 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria * - * Based on code by ? (included in XFree86 4.1) + * 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. * - * 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 supplier not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. The supplier makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. + * 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. * - * THE SUPPLIER 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. + * "NoAccel", "NoXVideo", "SWCursor", "HWCursor" and "Rotate" option portions + * Copyright (C) 1999-2004 The XFree86 Project, Inc. Licensed under the terms + * of the XFree86 license (http://www.xfree86.org/current/LICENSE1.html). * * Authors: Thomas Winischhofer <thomas@winischhofer.net> - * ? + * ? */ #include "xf86.h" @@ -47,6 +53,7 @@ typedef enum { OPTION_RENDER, OPTION_FORCE_CRT1TYPE, OPTION_FORCE_CRT2TYPE, + OPTION_YPBPRAR, OPTION_SHADOW_FB, OPTION_DRI, OPTION_AGP_SIZE, @@ -58,6 +65,10 @@ typedef enum { OPTION_FORCECRT1, OPTION_XVONCRT2, OPTION_PDC, + OPTION_PDCA, + OPTION_PDCS, + OPTION_PDCAS, + OPTION_EMI, OPTION_TVSTANDARD, OPTION_USEROMDATA, OPTION_NOINTERNALMODES, @@ -96,6 +107,7 @@ typedef enum { OPTION_RESTOREBYSET, OPTION_NODDCFORCRT2, OPTION_FORCECRT2REDETECTION, + OPTION_SENSEYPBPR, OPTION_CRT1GAMMA, OPTION_CRT2GAMMA, OPTION_XVGAMMA, @@ -113,6 +125,7 @@ typedef enum { OPTION_XVINSIDECHROMAKEY, OPTION_XVYUVCHROMAKEY, OPTION_SCALELCD, + OPTION_CENTERLCD, OPTION_SPECIALTIMING, OPTION_LVDSHL, OPTION_ENABLEHOTKEY, @@ -149,6 +162,7 @@ static const OptionInfoRec SISOptions[] = { { OPTION_RENDER, "RenderAcceleration", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_FORCE_CRT1TYPE, "ForceCRT1Type", OPTV_STRING, {0}, FALSE }, { OPTION_FORCE_CRT2TYPE, "ForceCRT2Type", OPTV_STRING, {0}, FALSE }, + { OPTION_YPBPRAR, "YPbPrAspectRatio", OPTV_STRING, {0}, FALSE }, { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_AGP_SIZE, "AGPSize", OPTV_INTEGER, {0}, FALSE }, @@ -160,6 +174,12 @@ static const OptionInfoRec SISOptions[] = { { OPTION_FORCECRT1, "ForceCRT1", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_XVONCRT2, "XvOnCRT2", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_PDC, "PanelDelayCompensation", OPTV_INTEGER, {0}, -1 }, + { OPTION_PDCA, "PanelDelayCompensation1",OPTV_INTEGER, {0}, -1 }, + { OPTION_PDCS, "PDC", OPTV_INTEGER, {0}, -1 }, + { OPTION_PDCAS, "PDC1", OPTV_INTEGER, {0}, -1 }, + { OPTION_EMI, "EMI", OPTV_INTEGER, {0}, -1 }, + { OPTION_LVDSHL, "LVDSHL", OPTV_INTEGER, {0}, -1 }, + { OPTION_SPECIALTIMING, "SpecialTiming", OPTV_STRING, {0}, -1 }, { OPTION_TVSTANDARD, "TVStandard", OPTV_STRING, {0}, -1 }, { OPTION_USEROMDATA, "UseROMData", OPTV_BOOLEAN, {0}, -1 }, { OPTION_NOINTERNALMODES, "NoInternalModes", OPTV_BOOLEAN, {0}, FALSE }, @@ -198,6 +218,7 @@ static const OptionInfoRec SISOptions[] = { { OPTION_RESTOREBYSET, "RestoreBySetMode", OPTV_BOOLEAN, {0}, -1 }, { OPTION_NODDCFORCRT2, "NoCRT2Detection", OPTV_BOOLEAN, {0}, -1 }, { OPTION_FORCECRT2REDETECTION, "ForceCRT2ReDetection", OPTV_BOOLEAN, {0}, -1 }, + { OPTION_SENSEYPBPR, "SenseYPbPr", OPTV_BOOLEAN, {0}, -1 }, { OPTION_CRT1GAMMA, "CRT1Gamma", OPTV_BOOLEAN, {0}, -1 }, { OPTION_CRT2GAMMA, "CRT2Gamma", OPTV_BOOLEAN, {0}, -1 }, { OPTION_STOREDBRI, "StoredGammaBrightness", OPTV_STRING, {0}, -1 }, @@ -217,9 +238,8 @@ static const OptionInfoRec SISOptions[] = { { OPTION_XVDISABLECOLORKEY, "XvDisableColorKey", OPTV_BOOLEAN, {0}, -1 }, { OPTION_XVMEMCPY, "XvUseMemcpy", OPTV_BOOLEAN, {0}, -1 }, { OPTION_SCALELCD, "ScaleLCD", OPTV_BOOLEAN, {0}, -1 }, + { OPTION_CENTERLCD, "CenterLCD", OPTV_BOOLEAN, {0}, -1 }, { OPTION_ENABLEHOTKEY, "EnableHotkey", OPTV_BOOLEAN, {0}, -1 }, - { OPTION_SPECIALTIMING, "SpecialTiming", OPTV_STRING, {0}, -1 }, - { OPTION_LVDSHL, "LVDSHL", OPTV_INTEGER, {0}, -1 }, { OPTION_ENABLESISCTRL, "EnableSiSCtrl", OPTV_BOOLEAN, {0}, -1 }, #ifdef SISMERGED { OPTION_MERGEDFB, "MergedFB", OPTV_BOOLEAN, {0}, FALSE }, @@ -235,7 +255,7 @@ static const OptionInfoRec SISOptions[] = { { OPTION_MERGEDDPI, "MergedDPI", OPTV_STRING, {0}, FALSE }, #ifdef SISXINERAMA { OPTION_NOSISXINERAMA, "NoMergedXinerama", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_NOSISXINERAMA2, "NoTwinviewXineramaInfo", OPTV_BOOLEAN, {0}, FALSE }, /* alias */ + { OPTION_NOSISXINERAMA2, "NoTwinviewXineramaInfo", OPTV_BOOLEAN, {0}, FALSE }, /* alias */ { OPTION_CRT2ISSCRN0, "MergedXineramaCRT2IsScreen0",OPTV_BOOLEAN,{0},FALSE }, #endif #endif @@ -250,7 +270,6 @@ SiSOptions(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); MessageType from; -/* double temp; */ char *strptr; static const char *mybadparm = "\"%s\" is is not a valid parameter for option \"%s\"\n"; static const char *disabledstr = "disabled"; @@ -271,7 +290,6 @@ SiSOptions(ScrnInfoPtr pScrn) pSiS->newFastVram = -1; pSiS->NoHostBus = FALSE; -/* pSiS->UsePCIRetry = TRUE; */ pSiS->TurboQueue = TRUE; #ifdef SISVRAMQ /* TODO: Option (315 series VRAM command queue) */ @@ -282,7 +300,7 @@ SiSOptions(ScrnInfoPtr pScrn) pSiS->HWCursor = TRUE; pSiS->Rotate = FALSE; pSiS->ShadowFB = FALSE; - pSiS->loadDRI = TRUE; + pSiS->loadDRI = FALSE; pSiS->agpWantedPages = AGP_PAGES; pSiS->VESA = -1; pSiS->NoXvideo = FALSE; @@ -293,6 +311,8 @@ SiSOptions(ScrnInfoPtr pScrn) pSiS->XvOnCRT2 = FALSE; pSiS->NoYV12 = -1; pSiS->PDC = -1; + pSiS->PDCA = -1; + pSiS->EMI = -1; pSiS->OptTVStand = -1; pSiS->OptROMUsage = -1; pSiS->noInternalModes = FALSE; @@ -327,8 +347,10 @@ SiSOptions(ScrnInfoPtr pScrn) pSiS->restorebyset = TRUE; pSiS->nocrt2ddcdetection = FALSE; pSiS->forcecrt2redetection = TRUE; /* default changed since 13/09/2003 */ + pSiS->SenseYPbPr = TRUE; pSiS->ForceCRT1Type = CRT1_VGA; pSiS->ForceCRT2Type = CRT2_DEFAULT; + pSiS->ForceYPbPrAR = TV_YPBPR169; pSiS->ForceTVType = -1; pSiS->CRT1gamma = TRUE; pSiS->CRT1gammaGiven = FALSE; @@ -338,7 +360,7 @@ SiSOptions(ScrnInfoPtr pScrn) pSiS->enablesisctrl = FALSE; if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { pSiS->XvDefBri = 10; - pSiS->XvDefCon = 5; + pSiS->XvDefCon = 2; } else { pSiS->XvDefBri = 0; pSiS->XvDefCon = 4; @@ -348,6 +370,7 @@ SiSOptions(ScrnInfoPtr pScrn) pSiS->XvDefDisableGfx = FALSE; pSiS->XvDefDisableGfxLR = FALSE; pSiS->UsePanelScaler = -1; + pSiS->CenterLCD = -1; pSiS->XvUseMemcpy = TRUE; pSiS->XvUseChromaKey = FALSE; pSiS->XvDisableColorKey = FALSE; @@ -394,6 +417,14 @@ SiSOptions(ScrnInfoPtr pScrn) pSiS->HWCursor = FALSE; } + /* DRI only supported on 300 series, + * so don't load DRI by default on + * others. + */ + if(pSiS->VGAEngine == SIS_300_VGA) { + pSiS->loadDRI = TRUE; + } + #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0) pSiS->OptUseColorCursor = 0; #else @@ -405,6 +436,7 @@ SiSOptions(ScrnInfoPtr pScrn) pSiS->OptUseColorCursor = 1; } #endif + if(pSiS->VGAEngine == SIS_300_VGA) { pSiS->AllowHotkey = 0; } else if(pSiS->VGAEngine == SIS_315_VGA) { @@ -720,17 +752,34 @@ SiSOptions(ScrnInfoPtr pScrn) if(xf86GetOptValBool(pSiS->Options, OPTION_FORCECRT2REDETECTION, &val)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "ForceCRT2ReDetection"); } + if(xf86GetOptValBool(pSiS->Options, OPTION_SENSEYPBPR, &val)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "SenseYPbPr"); + } if(xf86GetOptValString(pSiS->Options, OPTION_FORCE_CRT1TYPE)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "ForceCRT1Type"); } if(xf86GetOptValString(pSiS->Options, OPTION_FORCE_CRT2TYPE)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "ForceCRT2Type"); } + if(xf86GetOptValString(pSiS->Options, OPTION_YPBPRAR)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "YPbPrAspectRatio"); + } if(xf86GetOptValBool(pSiS->Options, OPTION_SCALELCD, &val)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "ScaleLCD"); } - if(xf86GetOptValInteger(pSiS->Options, OPTION_PDC, &vali)) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "PanelDelayCompensation"); + if(xf86GetOptValBool(pSiS->Options, OPTION_CENTERLCD, &val)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "CenterLCD"); + } + if((xf86GetOptValInteger(pSiS->Options, OPTION_PDC, &vali)) || + (xf86GetOptValInteger(pSiS->Options, OPTION_PDCS, &vali))) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "PanelDelayCompensation (PDC)"); + } + if((xf86GetOptValInteger(pSiS->Options, OPTION_PDCA, &vali)) || + (xf86GetOptValInteger(pSiS->Options, OPTION_PDCAS, &vali))) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "PanelDelayCompensation1 (PDC1)"); + } + if(xf86GetOptValInteger(pSiS->Options, OPTION_EMI, &vali)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "EMI"); } if(xf86GetOptValString(pSiS->Options, OPTION_SPECIALTIMING)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "SpecialTiming"); @@ -907,11 +956,23 @@ SiSOptions(ScrnInfoPtr pScrn) } else pSiS->forcecrt2redetection = FALSE; } + /* SenseYPbPr (315/330 series only) + * If set to true, the driver will sense for YPbPr TV. This is + * inconvenient for folks connecting SVideo and CVBS at the same + * time, because this condition will be detected as YPbPr (since + * the TV output pins are shared). "False" will not sense for + * YPbPr and detect SVideo or CVBS only. + */ + if(xf86GetOptValBool(pSiS->Options, OPTION_SENSEYPBPR, &val)) { + if(val) pSiS->SenseYPbPr = TRUE; + else pSiS->SenseYPbPr = FALSE; + } + /* ForceCRT1Type (315/330 series only) * Used for forcing the driver to initialize CRT1 as * VGA (analog) or LCDA (for simultanious LCD and TV - * display) - on M650/651 with 30xLV only! + * display) - on M650/651 and 661 or later with 301C/30xLV only! */ if(pSiS->VGAEngine == SIS_315_VGA) { strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_FORCE_CRT1TYPE); @@ -953,10 +1014,12 @@ SiSOptions(ScrnInfoPtr pScrn) if(strptr != NULL) { if(!xf86NameCmp(strptr,"TV")) pSiS->ForceCRT2Type = CRT2_TV; - else if(!xf86NameCmp(strptr,"SVIDEO")) { + else if( (!xf86NameCmp(strptr,"SVIDEO")) || + (!xf86NameCmp(strptr,"SVHS")) ) { pSiS->ForceCRT2Type = CRT2_TV; pSiS->ForceTVType = TV_SVIDEO; - } else if(!xf86NameCmp(strptr,"COMPOSITE")) { + } else if( (!xf86NameCmp(strptr,"COMPOSITE")) || + (!xf86NameCmp(strptr,"CVBS")) ) { pSiS->ForceCRT2Type = CRT2_TV; pSiS->ForceTVType = TV_AVIDEO; } else if( (!xf86NameCmp(strptr,"COMPOSITE SVIDEO")) || /* Ugly, but shorter than a parsing function */ @@ -980,24 +1043,52 @@ SiSOptions(ScrnInfoPtr pScrn) pSiS->ForceCRT2Type = CRT2_VGA; else if(!xf86NameCmp(strptr,"NONE")) pSiS->ForceCRT2Type = 0; - else if(pSiS->Chipset == PCI_CHIP_SIS550) { - if(!xf86NameCmp(strptr,"DSTN")) { - if(pSiS->ForceCRT1Type == CRT1_VGA) { - pSiS->ForceCRT2Type = CRT2_LCD; - pSiS->DSTN = TRUE; - } - } else if(!xf86NameCmp(strptr,"FSTN")) { - if(pSiS->ForceCRT1Type == CRT1_VGA) { - pSiS->ForceCRT2Type = CRT2_LCD; - pSiS->FSTN = TRUE; - } + else if((!xf86NameCmp(strptr,"DSTN")) && (pSiS->Chipset == PCI_CHIP_SIS550)) { + if(pSiS->ForceCRT1Type == CRT1_VGA) { + pSiS->ForceCRT2Type = CRT2_LCD; + pSiS->DSTN = TRUE; + } + } else if((!xf86NameCmp(strptr,"FSTN")) && (pSiS->Chipset == PCI_CHIP_SIS550)) { + if(pSiS->ForceCRT1Type == CRT1_VGA) { + pSiS->ForceCRT2Type = CRT2_LCD; + pSiS->FSTN = TRUE; } +#ifdef ENABLE_YPBPR + } else if(!xf86NameCmp(strptr,"HIVISION")) { + pSiS->ForceCRT2Type = CRT2_TV; + pSiS->ForceTVType = TV_HIVISION; + } else if((!xf86NameCmp(strptr,"YPBPR1080I")) && (pSiS->VGAEngine == SIS_315_VGA)) { + pSiS->ForceCRT2Type = CRT2_TV; + pSiS->ForceTVType = TV_YPBPR; + pSiS->ForceYPbPrType = TV_YPBPR1080I; + } else if(((!xf86NameCmp(strptr,"YPBPR525I")) || (!xf86NameCmp(strptr,"YPBPR480I"))) && + (pSiS->VGAEngine == SIS_315_VGA)) { + pSiS->ForceCRT2Type = CRT2_TV; + pSiS->ForceTVType = TV_YPBPR; + pSiS->ForceYPbPrType = TV_YPBPR525I; + } else if(((!xf86NameCmp(strptr,"YPBPR525P")) || (!xf86NameCmp(strptr,"YPBPR480P"))) && + (pSiS->VGAEngine == SIS_315_VGA)) { + pSiS->ForceCRT2Type = CRT2_TV; + pSiS->ForceTVType = TV_YPBPR; + pSiS->ForceYPbPrType = TV_YPBPR525P; + } else if(((!xf86NameCmp(strptr,"YPBPR750P")) || (!xf86NameCmp(strptr,"YPBPR720P"))) && + (pSiS->VGAEngine == SIS_315_VGA)) { + pSiS->ForceCRT2Type = CRT2_TV; + pSiS->ForceTVType = TV_YPBPR; + pSiS->ForceYPbPrType = TV_YPBPR750P; +#endif } else { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mybadparm, strptr, "ForceCRT2Type"); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Valid parameters are \"LCD\" (=\"DVI-D\"), \"TV\", \"SVIDEO\", \"COMPOSITE\",\n" - "\t\"SVIDEO+COMPOSITE\", \"SCART\", \"VGA\" (=\"DVI-A\") or \"NONE\", on the SiS550\n" - "\talso \"DSTN\" and \"FSTN\"\n"); + "\t\"SVIDEO+COMPOSITE\", \"SCART\", \"VGA\" (=\"DVI-A\") or \"NONE\"; on the SiS550\n" + "\talso \"DSTN\" and \"FSTN\"" +#ifdef ENABLE_YPBPR + "; on SiS 301/301B bridges also \"HIVISION\", and on\n" + "\tSiS315/330 series with 301C/30xLV bridge also \"YPBPR480I\", \"YPBPR480P\",\n" + "\t\"YPBPR720P\" and \"YPBPR1080I\"" +#endif + "\n"); } if(pSiS->ForceCRT2Type != CRT2_DEFAULT) @@ -1005,6 +1096,23 @@ SiSOptions(ScrnInfoPtr pScrn) "CRT2 type shall be %s\n", strptr); } + if(pSiS->ForceTVType == TV_YPBPR) { + strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_YPBPRAR); + if(strptr != NULL) { + if(!xf86NameCmp(strptr,"4:3LB")) + pSiS->ForceYPbPrAR = TV_YPBPR43LB; + else if(!xf86NameCmp(strptr,"4:3")) + pSiS->ForceYPbPrAR = TV_YPBPR43; + else if(!xf86NameCmp(strptr,"16:9")) + pSiS->ForceYPbPrAR = TV_YPBPR169; + else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mybadparm, strptr, "YPbPrAspectRatio"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Valid parameters are \"4:3LB\", \"4:3\" and \"16:9\"\n"); + } + } + } + strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SPECIALTIMING); if(strptr != NULL) { int i = 0; @@ -1065,8 +1173,24 @@ SiSOptions(ScrnInfoPtr pScrn) pSiS->UsePanelScaler ? disabledstr : enabledstr); } + /* CenterLCD (300/315/330 + SiS video bridge only) + * If LCD shall not be scaled, this selects whether 1:1 data + * will be sent to the output, or the image shall be centered + * on the LCD. For LVDS panels, screen will always be centered, + * since these have no built-in scaler. For TMDS, this is + * selectable. Non-centered means that the driver will pass + * 1:1 data to the output and that the panel will have to + * scale by itself (if supported by the panel). + */ + if(xf86GetOptValBool(pSiS->Options, OPTION_CENTERLCD, &val)) { + pSiS->CenterLCD = val ? 1 : 0; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Non-scaled LCD output will %sbe centered\n", + pSiS->CenterLCD ? "not " : ""); + } + /* PanelDelayCompensation (300/315/330 series only) - * This might be required if the LCD panel shows "small waves". + * This might be required if the LCD panel shows "small waves" + * or wrong colors. * The parameter is an integer, (on 300 series usually either * 4, 32 or 24; on 315 series + LV bridge usually 3 or 51) * Why this option? Simply because SiS did poor BIOS design. @@ -1074,20 +1198,49 @@ SiSOptions(ScrnInfoPtr pScrn) * particular machine. For most panels, the driver is able * to detect the correct value. However, some panels require * a different setting. For 300 series, the value given must - * be within the mask 0x3c. + * be within the mask 0x3c. For 661 and later, if must be + * within the range of 0 to 31. */ - if(xf86GetOptValInteger(pSiS->Options, OPTION_PDC, &pSiS->PDC)) { + { + int val = -1; + xf86GetOptValInteger(pSiS->Options, OPTION_PDC, &val); + xf86GetOptValInteger(pSiS->Options, OPTION_PDCS, &val); + if(val != -1) { + pSiS->PDC = val; if((pSiS->VGAEngine == SIS_300_VGA) && (pSiS->PDC & ~0x3c)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Illegal PanelDelayCompensation parameter\n"); pSiS->PDC = -1; } else { + if(pSiS->VGAEngine == SIS_315_VGA) pSiS->PDC &= 0x1f; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Panel delay compensation shall be %d\n", + "Panel delay compensation shall be %d (for LCD=CRT2)\n", pSiS->PDC); } } + /* PanelDelayCompensation1 (315 series only) + * Same as above, but for LCD-via-CRT1 ("LCDA") + */ + if(pSiS->VGAEngine == SIS_315_VGA) { + val = -1; + xf86GetOptValInteger(pSiS->Options, OPTION_PDCA, &val); + xf86GetOptValInteger(pSiS->Options, OPTION_PDCAS, &val); + if(val != -1) { + pSiS->PDCA = val; + if(pSiS->PDCA > 0x1f) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Illegal PanelDelayCompensation1 (PDC1) parameter (0 <= PDC1 <= 31\n"); + pSiS->PDCA = -1; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Panel delay compensation shall be %d (for LCD=CRT1)\n", + pSiS->PDCA); + } + } + } + } + /* LVDSHL (300/315/330 series + 30xLV bridge only) * This might be required if the LCD panel is too dark. * The parameter is an integer from 0 to 3. @@ -1104,6 +1257,28 @@ SiSOptions(ScrnInfoPtr pScrn) } } + /* EMI (315/330 series + 302LV/302ELV bridge only) + * This might be required if the LCD panel loses sync on + * mode switches. So far, this problem should not show up + * due to the auto-detection (from reading the values set + * by the BIOS; however, the BIOS values are wrong sometimes + * such as in the case of some Compal machines with a + * 1400x1050, or some Inventec(Compaq) machines with a + * 1280x1024 panel. + * The parameter is an integer from 0 to 0x60ffffff. + */ + if(xf86GetOptValInteger(pSiS->Options, OPTION_EMI, &pSiS->EMI)) { + if((pSiS->EMI < 0) || (pSiS->EMI > 0x60ffffff)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Illegal EMI parameter, valid is 0 through 0x60ffffff\n"); + pSiS->EMI = -1; + } else { + pSiS->EMI &= 0x60ffffff; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "EMI will be 0x%04x\n", pSiS->EMI); + } + } + } @@ -1156,21 +1331,21 @@ SiSOptions(ScrnInfoPtr pScrn) } } - /* CHTVType (315/330 series only) + /* CHTVType (315/330 series + Chrontel only) * Used for telling the driver if the TV output shall - * be i480 HDTV or SCART. + * be 525i YPbPr or SCART. */ if(pSiS->VGAEngine == SIS_315_VGA) { strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CHTVTYPE); if(strptr != NULL) { if(!xf86NameCmp(strptr,"SCART")) pSiS->chtvtype = 1; - else if(!xf86NameCmp(strptr,"HDTV")) + else if(!xf86NameCmp(strptr,"YPBPR525I")) pSiS->chtvtype = 0; else { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mybadparm, strptr, "CHTVType"); xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Valid parameters are \"SCART\" or \"HDTV\"\n"); + "Valid parameters are \"SCART\" or \"YPBPR525I\"\n"); } if(pSiS->chtvtype != -1) xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, diff --git a/src/sis_regs.h b/src/sis_regs.h index 4298b3f..b4f29fa 100644 --- a/src/sis_regs.h +++ b/src/sis_regs.h @@ -1,30 +1,38 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h,v 1.24 2003/10/30 18:53:43 twini Exp $ */ +/* $XFree86$ */ /* - * 2D Acceleration for SiS300, SiS540, SiS630, SiS730, SiS530, SiS620 + * Register definitions for old and 300 series * - * Copyright 1998,1999 by Alan Hourihane, Wigan, England. - * 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. + * + * Old series register definitions + * Copyright (C) 1998, 1999 by Alan Hourihane, Wigan, England. + * + * Authors: Thomas Winischhofer <thomas@winischhofer.net> + * Alan Hourihane * */ - /* For general use --------------------------------------------------------------- */ @@ -64,16 +72,16 @@ outSISIDXREG(base,idx,__Temp); \ } while (0) -#define BITMASK(h,l) (((unsigned)(1U << ((h)-(l)+1))-1)<<(l)) -#define GENMASK(mask) BITMASK(1?mask,0?mask) +#define BITMASK(h,l) (((unsigned)(1U << ((h)-(l)+1))-1)<<(l)) +#define GENMASK(mask) BITMASK(1?mask,0?mask) #define GETBITS(var,mask) (((var) & GENMASK(mask)) >> (0?mask)) #define SETBITS(val,mask) ((val) << (0?mask)) #define SETBIT(n) (1<<(n)) -#define GETBITSTR(val,from,to) ((GETBITS(val,from)) << (0?to)) -#define SETVARBITS(var,val,from,to) (((var)&(~(GENMASK(to)))) | \ - GETBITSTR(val,from,to)) +#define GETBITSTR(val,from,to) ((GETBITS(val,from)) << (0?to)) +#define SETVARBITS(var,val,from,to) (((var)&(~(GENMASK(to)))) | \ + GETBITSTR(val,from,to)) #define GETVAR8(var) ((var)&0xFF) #define SETVAR8(var,val) (var) = GETVAR8(val) diff --git a/src/sis_setup.c b/src/sis_setup.c index 36e625b..884e03a 100644 --- a/src/sis_setup.c +++ b/src/sis_setup.c @@ -1,28 +1,34 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c,v 1.25 2003/11/06 19:10:01 twini Exp $ */ +/* $XFree86$ */ /* * Basic hardware and memory detection * - * Copyright 2001, 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. * - * Author: Thomas Winischhofer <thomas@winischhofer.net> + * Author: Thomas Winischhofer <thomas@winischhofer.net> + * + * Ideas and methods for old series based on code by Can-Ru Yeou, SiS Inc. * */ @@ -593,10 +599,23 @@ sis550Setup(ScrnInfoPtr pScrn) if(!alldone) { if(pSiS->Chipset == PCI_CHIP_SIS660) { - inSISIDXREG(SISSR, 0x79, config); - pScrn->videoRam = (1 << ((config & 0xf0) >> 4)) * 1024; + inSISIDXREG(SISCR, 0x79, config); pSiS->BusWidth = (config & 0x04) ? 128 : 64; ramtype = (config & 0x01) ? 8 : 4; + if(pSiS->sishw_ext.jChipType >= SIS_660) { + pScrn->videoRam = 0; + if(config & 0xf0) { + pScrn->videoRam = (1 << ((config & 0xf0) >> 4)) * 1024; + } + inSISIDXREG(SISCR, 0x78, config); + config &= 0x30; + if(config) { + if(config == 0x10) pScrn->videoRam += 32768; + else pScrn->videoRam += 65536; + } + } else { + pScrn->videoRam = (1 << ((config & 0xf0) >> 4)) * 1024; + } } else { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Shared Memory Area is disabled - awaiting doom\n"); @@ -650,7 +669,7 @@ SiSSetup(ScrnInfoPtr pScrn) break; case PCI_CHIP_SIS550: case PCI_CHIP_SIS650: /* + 740 */ - case PCI_CHIP_SIS660: /* + 661,741,660,760 */ + case PCI_CHIP_SIS660: /* + 661,741,760 */ sis550Setup(pScrn); break; case PCI_CHIP_SIS5597: diff --git a/src/sis_shadow.c b/src/sis_shadow.c index 2c85f79..e2c4a11 100644 --- a/src/sis_shadow.c +++ b/src/sis_shadow.c @@ -1,28 +1,30 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.c,v 1.8 2003/10/30 18:53:43 twini Exp $ */ +/* $XFree86$ */ /* - * Copyright (c) 1999, The XFree86 Project Inc. - * based on code written by Mark Vojkovich <markv@valinux.com> + * Copyright (C) 1999-2004 by The XFree86 Project, Inc. + * based on code written by Mark Vojkovich + * + * Licensed under the following terms: * * 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 + * the above copyright notice appears in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * 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. + * "as is" without expressed or implied warranty. * * THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * 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. * - * TW: This module doesn't use CurrentLayout, because it is never - * active when DGA is active and vice versa. + * TW: This module doesn't use CurrentLayout, because it is never + * active when DGA is active and vice versa. */ #include "xf86.h" diff --git a/src/sis_vb.c b/src/sis_vb.c index cbfeb07..c2f578d 100644 --- a/src/sis_vb.c +++ b/src/sis_vb.c @@ -1,26 +1,30 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c,v 1.31 2003/11/19 00:49:06 twini Exp $ */ +/* $XFree86$ */ /* * Video bridge detection and configuration for 300, 315 and 330 series * - * 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. * * Author: Thomas Winischhofer <thomas@winischhofer.net> * @@ -79,6 +83,26 @@ static const SiS_LCD_StStruct SiS315_LCD_Type[]= { VB_LCD_CUSTOM, 0, 0, LCD_CUSTOM, } /* f */ }; +static const SiS_LCD_StStruct SiS661_LCD_Type[]= +{ + { VB_LCD_1024x768, 1024, 768, LCD_1024x768 }, /* 0 - invalid */ + { VB_LCD_800x600, 800, 600, LCD_800x600 }, /* 1 */ + { VB_LCD_1024x768, 1024, 768, LCD_1024x768 }, /* 2 */ + { VB_LCD_1280x1024,1280, 1024, LCD_1280x1024 }, /* 3 */ + { VB_LCD_640x480, 640, 480, LCD_640x480 }, /* 4 */ + { VB_LCD_1024x600, 1024, 600, LCD_1024x600 }, /* 5 */ + { VB_LCD_1152x864, 1152, 864, LCD_1152x864 }, /* 6 */ + { VB_LCD_1280x960, 1280, 960, LCD_1280x960 }, /* 7 */ + { VB_LCD_1152x768, 1152, 768, LCD_1152x768 }, /* 8 */ + { VB_LCD_1400x1050,1400, 1050, LCD_1400x1050 }, /* 9 */ + { VB_LCD_1280x768, 1280, 768, LCD_1280x768 }, /* a */ + { VB_LCD_1600x1200,1600, 1200, LCD_1600x1200 }, /* b */ + { VB_LCD_1280x800, 1280, 800, LCD_1280x800 }, /* c */ + { VB_LCD_1680x1050,1680, 1050, LCD_1680x1050 }, /* d */ + { VB_LCD_1280x720, 1280, 720, LCD_1280x720 }, /* e */ + { VB_LCD_CUSTOM, 0, 0, LCD_CUSTOM, } /* f */ +}; + static Bool TestDDC1(ScrnInfoPtr pScrn) { @@ -108,9 +132,9 @@ SiS_SISDetectCRT1(ScrnInfoPtr pScrn) if(SR1F & 0xc0) mustwait = TRUE; if(pSiS->VGAEngine == SIS_315_VGA) { - inSISIDXREG(SISCR,0x63,CR63); + inSISIDXREG(SISCR,pSiS->myCR63,CR63); CR63 &= 0x40; - andSISIDXREG(SISCR,0x63,0xBF); + andSISIDXREG(SISCR,pSiS->myCR63,0xBF); } inSISIDXREG(SISCR,0x17,CR17); @@ -141,7 +165,7 @@ SiS_SISDetectCRT1(ScrnInfoPtr pScrn) } if(pSiS->VGAEngine == SIS_315_VGA) { - setSISIDXREG(SISCR,0x63,0xBF,CR63); + setSISIDXREG(SISCR,pSiS->myCR63,0xBF,CR63); } setSISIDXREG(SISCR,0x17,0x7F,CR17); @@ -210,7 +234,9 @@ void SISCRT1PreInit(ScrnInfoPtr pScrn) void SISLCDPreInit(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); - unsigned char CR32, CR36, CR37; + unsigned char CR32, CR36, CR37, CR7D=0, tmp; + + pSiS->LCDwidth = 0; if(!(pSiS->VBFlags & VB_VIDEOBRIDGE)) return; @@ -223,7 +249,7 @@ void SISLCDPreInit(ScrnInfoPtr pScrn) * if forcecrt2redetection was given, too. * This is useful on machines with DVI connectors where the * panel was connected after booting. This is only supported - * on the 315/330 series and the 301/30xB bridge (because the + * on the 315/330 series and the 301/30xB/C bridge (because the * 30xLV don't seem to have a DDC port and operate only LVDS * panels which mostly don't support DDC). We only do this if * there was no secondary VGA detected by the BIOS, because LCD @@ -251,7 +277,7 @@ void SISLCDPreInit(ScrnInfoPtr pScrn) if(!(pSiS->nocrt2ddcdetection)) { if((!(pSiS->VBFlags & CRT2_LCD)) && (!(CR32 & 0x10))) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "%s LCD/Plasma panel, sensing via DDC\n", + "%s LCD/plasma panel, sensing via DDC\n", pSiS->forcecrt2redetection ? "Forced re-detection of" : "BIOS detected no"); if(SiS_SenseLCDDDC(pSiS->SiS_Pr, pSiS)) { @@ -264,7 +290,7 @@ void SISLCDPreInit(ScrnInfoPtr pScrn) pSiS->postVBCR32 |= 0x08; } else { xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "No LCD/Plasma panel detected\n"); + "No LCD/plasma panel detected\n"); } } } @@ -278,6 +304,7 @@ void SISLCDPreInit(ScrnInfoPtr pScrn) if(pSiS->VBFlags & CRT2_LCD) { inSISIDXREG(SISCR, 0x36, CR36); inSISIDXREG(SISCR, 0x37, CR37); + inSISIDXREG(SISCR, 0x7D, CR7D); if(pSiS->SiS_Pr->SiS_CustomT == CUT_BARCO1366) { pSiS->VBLCDFlags |= VB_LCD_BARCO1366; pSiS->LCDwidth = 1360; @@ -294,12 +321,11 @@ void SISLCDPreInit(ScrnInfoPtr pScrn) pSiS->LCDwidth = pSiS->SiS_Pr->CP_MaxX = 848; pSiS->LCDheight = pSiS->SiS_Pr->CP_MaxY = 480; pSiS->VBLCDFlags |= VB_LCD_EXPANDING; - pSiS->sishw_ext.ulCRT2LCDType = LCD_848x480; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Assuming LCD/plasma panel (848x480, expanding, RGB24)\n"); } else { if((pSiS->VGAEngine == SIS_315_VGA) && (!CR36)) { - /* TW: Old 650/301LV BIOS version "forgot" to set CR36, CR37 */ + /* Old 650/301LV BIOS version "forgot" to set CR36, CR37 */ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "BIOS-provided LCD information invalid, probing myself...\n"); if(pSiS->VBFlags & VB_LVDS) pSiS->SiS_Pr->SiS_IF_DEF_LVDS = 1; @@ -312,7 +338,6 @@ void SISLCDPreInit(ScrnInfoPtr pScrn) pSiS->VBLCDFlags |= VB_LCD_CUSTOM; pSiS->LCDheight = pSiS->SiS_Pr->CP_MaxY; pSiS->LCDwidth = pSiS->SiS_Pr->CP_MaxX; - pSiS->sishw_ext.ulCRT2LCDType = LCD_CUSTOM; if(CR37 & 0x10) pSiS->VBLCDFlags |= VB_LCD_EXPANDING; xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected non-standard LCD/Plasma panel (max. X %d Y %d, preferred %dx%d, RGB%d)\n", @@ -324,24 +349,34 @@ void SISLCDPreInit(ScrnInfoPtr pScrn) pSiS->VBLCDFlags |= SiS300_LCD_Type[(CR36 & 0x0f)].VBLCD_lcdflag; pSiS->LCDheight = SiS300_LCD_Type[(CR36 & 0x0f)].LCDheight; pSiS->LCDwidth = SiS300_LCD_Type[(CR36 & 0x0f)].LCDwidth; - pSiS->sishw_ext.ulCRT2LCDType = SiS300_LCD_Type[(CR36 & 0x0f)].LCDtype; if(CR37 & 0x10) pSiS->VBLCDFlags |= VB_LCD_EXPANDING; - } else { + } else if((pSiS->sishw_ext.jChipType >= SIS_661) || (pSiS->ROM661New)) { + pSiS->VBLCDFlags |= SiS661_LCD_Type[(CR36 & 0x0f)].VBLCD_lcdflag; + pSiS->LCDheight = SiS661_LCD_Type[(CR36 & 0x0f)].LCDheight; + pSiS->LCDwidth = SiS661_LCD_Type[(CR36 & 0x0f)].LCDwidth; + if(CR37 & 0x10) pSiS->VBLCDFlags |= VB_LCD_EXPANDING; + if(pSiS->sishw_ext.jChipType < SIS_661) { + if(!(pSiS->SiS_Pr->PanelSelfDetected)) { + inSISIDXREG(SISCR,0x35,tmp); + CR37 &= 0xfc; + CR37 |= (tmp & 0x01); + } + } + } else { pSiS->VBLCDFlags |= SiS315_LCD_Type[(CR36 & 0x0f)].VBLCD_lcdflag; pSiS->LCDheight = SiS315_LCD_Type[(CR36 & 0x0f)].LCDheight; pSiS->LCDwidth = SiS315_LCD_Type[(CR36 & 0x0f)].LCDwidth; - pSiS->sishw_ext.ulCRT2LCDType = SiS315_LCD_Type[(CR36 & 0x0f)].LCDtype; if(CR37 & 0x10) pSiS->VBLCDFlags |= VB_LCD_EXPANDING; } xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected LCD/Plasma panel (%dx%d, %d, %sexp., RGB%d [%02x%02x])\n", + "Detected LCD/plasma panel (%dx%d, %d, %sexp., RGB%d [%02x%02x%02x])\n", pSiS->LCDwidth, pSiS->LCDheight, ((pSiS->VGAEngine == SIS_315_VGA) && (pSiS->Chipset != PCI_CHIP_SIS660)) ? ((CR36 & 0x0f) - 1) : ((CR36 & 0xf0) >> 4), (CR37 & 0x10) ? "" : "non-", (CR37 & 0x01) ? 18 : 24, - CR36, CR37); + CR36, CR37, CR7D); } } } @@ -352,13 +387,13 @@ void SISLCDPreInit(ScrnInfoPtr pScrn) void SISTVPreInit(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); - unsigned char SR16, SR38, CR32, CR35=0, CR38=0, CR79; + unsigned char SR16, SR38, CR32, CR35=0, CR38=0, CR79, CR39; int temp = 0; - if(!(pSiS->VBFlags & VB_VIDEOBRIDGE)) - return; + if(!(pSiS->VBFlags & VB_VIDEOBRIDGE)) return; inSISIDXREG(SISCR, 0x32, CR32); + inSISIDXREG(SISCR, 0x35, CR35); inSISIDXREG(SISSR, 0x16, SR16); inSISIDXREG(SISSR, 0x38, SR38); switch(pSiS->VGAEngine) { @@ -366,7 +401,7 @@ void SISTVPreInit(ScrnInfoPtr pScrn) if(pSiS->Chipset == PCI_CHIP_SIS630) temp = 0x35; break; case SIS_315_VGA: - if(pSiS->Chipset != PCI_CHIP_SIS660) temp = 0x38; + temp = 0x38; break; } if(temp) { @@ -379,27 +414,64 @@ void SISTVPreInit(ScrnInfoPtr pScrn) CR32, SR16, SR38); #endif - if(CR32 & 0x47) - pSiS->VBFlags |= CRT2_TV; + if(CR32 & 0x47) pSiS->VBFlags |= CRT2_TV; - if(CR32 & 0x04) - pSiS->VBFlags |= TV_SCART; + if(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPR) { + if(CR32 & 0x80) pSiS->VBFlags |= CRT2_TV; + } else { + CR32 &= 0x7f; + } + + if(CR32 & 0x01) + pSiS->VBFlags |= TV_AVIDEO; else if(CR32 & 0x02) pSiS->VBFlags |= TV_SVIDEO; - else if(CR32 & 0x01) - pSiS->VBFlags |= TV_AVIDEO; - else if(CR32 & 0x40) - pSiS->VBFlags |= (TV_SVIDEO | TV_HIVISION); - else if((CR38 & 0x04) && (pSiS->VBFlags & (VB_301C | VB_301LV | VB_302LV | VB_302ELV))) - pSiS->VBFlags |= TV_HIVISION_LV; - else if((CR38 & 0x04) && (pSiS->VBFlags & VB_CHRONTEL)) + else if(CR32 & 0x04) + pSiS->VBFlags |= TV_SCART; + else if((CR32 & 0x40) && (pSiS->SiS_SD_Flags & SiS_SD_SUPPORTHIVISION)) + pSiS->VBFlags |= (TV_HIVISION | TV_PAL); + else if((CR32 & 0x80) && (pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPR)) { + pSiS->VBFlags |= TV_YPBPR; + if(pSiS->Chipset == PCI_CHIP_SIS660) { + if(CR38 & 0x04) { + switch(CR35 & 0xE0) { + case 0x20: pSiS->VBFlags |= TV_YPBPR525P; break; + case 0x40: pSiS->VBFlags |= TV_YPBPR750P; break; + case 0x60: pSiS->VBFlags |= TV_YPBPR1080I; break; + default: pSiS->VBFlags |= TV_YPBPR525I; + } + } else pSiS->VBFlags |= TV_YPBPR525I; + inSISIDXREG(SISCR,0x39,CR39); + CR39 &= 0x03; + if(CR39 == 0x00) pSiS->VBFlags |= TV_YPBPR43LB; + else if(CR39 == 0x01) pSiS->VBFlags |= TV_YPBPR43; + else if(CR39 == 0x02) pSiS->VBFlags |= TV_YPBPR169; + else pSiS->VBFlags |= TV_YPBPR43; + } else if(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPR) { + if(CR38 & 0x08) { + switch(CR38 & 0x30) { + case 0x10: pSiS->VBFlags |= TV_YPBPR525P; break; + case 0x20: pSiS->VBFlags |= TV_YPBPR750P; break; + case 0x30: pSiS->VBFlags |= TV_YPBPR1080I; break; + default: pSiS->VBFlags |= TV_YPBPR525I; + } + } else pSiS->VBFlags |= TV_YPBPR525I; + if(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPRAR) { + inSISIDXREG(SISCR,0x3B,CR39); + CR39 &= 0x03; + if(CR39 == 0x00) pSiS->VBFlags |= TV_YPBPR43LB; + else if(CR39 == 0x01) pSiS->VBFlags |= TV_YPBPR169; + else if(CR39 == 0x03) pSiS->VBFlags |= TV_YPBPR43; + } + } + } else if((CR38 & 0x04) && (pSiS->VBFlags & VB_CHRONTEL)) pSiS->VBFlags |= (TV_CHSCART | TV_PAL); else if((CR38 & 0x08) && (pSiS->VBFlags & VB_CHRONTEL)) - pSiS->VBFlags |= (TV_CHHDTV | TV_NTSC); - - if(pSiS->VBFlags & (TV_SCART | TV_SVIDEO | TV_AVIDEO | TV_HIVISION | TV_HIVISION_LV)) { + pSiS->VBFlags |= (TV_CHYPBPR525I | TV_NTSC); + + if(pSiS->VBFlags & (TV_SCART | TV_SVIDEO | TV_AVIDEO)) { if(pSiS->VGAEngine == SIS_300_VGA) { - /* TW: Should be SR38, but this does not work. */ + /* Should be SR38, but this does not work. */ if(SR16 & 0x20) pSiS->VBFlags |= TV_PAL; else @@ -425,14 +497,14 @@ void SISTVPreInit(ScrnInfoPtr pScrn) } else pSiS->VBFlags |= TV_NTSC; } else if(pSiS->Chipset == PCI_CHIP_SIS660) { - inSISIDXREG(SISCR, 0x35, CR35); if(SR38 & 0x01) { pSiS->VBFlags |= TV_PAL; if(CR35 & 0x04) pSiS->VBFlags |= TV_PALM; else if(CR35 & 0x08) pSiS->VBFlags |= TV_PALN; - } else + } else { pSiS->VBFlags |= TV_NTSC; if(CR35 & 0x02) pSiS->VBFlags |= TV_NTSCJ; + } } else { /* 315, 330 */ if(SR38 & 0x01) { pSiS->VBFlags |= TV_PAL; @@ -442,16 +514,29 @@ void SISTVPreInit(ScrnInfoPtr pScrn) pSiS->VBFlags |= TV_NTSC; } } - - if(pSiS->VBFlags & (TV_SCART | TV_SVIDEO | TV_AVIDEO | TV_HIVISION | TV_HIVISION_LV | TV_CHSCART | TV_CHHDTV)) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "%sTV standard %s\n", - (pSiS->VBFlags & (TV_CHSCART | TV_CHHDTV)) ? "Using " : "Detected default ", - (pSiS->VBFlags & TV_NTSC) ? - ((pSiS->VBFlags & TV_CHHDTV) ? "480i HDTV" : - ((pSiS->VBFlags & TV_NTSCJ) ? "NTSCJ" : "NTSC")) : - ((pSiS->VBFlags & TV_PALM) ? "PALM" : - ((pSiS->VBFlags & TV_PALN) ? "PALN" : "PAL")) ); + + if(pSiS->VBFlags & (TV_SCART|TV_SVIDEO|TV_AVIDEO)) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected default TV standard %s\n", + (pSiS->VBFlags & TV_NTSC) ? + ((pSiS->VBFlags & TV_NTSCJ) ? "NTSCJ" : "NTSC") : + ((pSiS->VBFlags & TV_PALM) ? "PALM" : + ((pSiS->VBFlags & TV_PALN) ? "PALN" : "PAL"))); + } + + if(pSiS->VBFlags & TV_HIVISION) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "BIOS reports HiVision TV\n"); + } + + if((pSiS->VBFlags & VB_CHRONTEL) && (pSiS->VBFlags & (TV_CHSCART|TV_CHYPBPR525I))) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Chrontel: %s forced\n", + (pSiS->VBFlags & TV_CHSCART) ? "SCART (PAL)" : "YPbPr (480i)"); + } + + if(pSiS->VBFlags & TV_YPBPR) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected YPbPr TV (by default %s)\n", + (pSiS->VBFlags & TV_YPBPR525I) ? "480i" : + ((pSiS->VBFlags & TV_YPBPR525P) ? "480p" : + ((pSiS->VBFlags & TV_YPBPR750P) ? "720p" : "1080i"))); } } @@ -461,8 +546,7 @@ void SISCRT2PreInit(ScrnInfoPtr pScrn) SISPtr pSiS = SISPTR(pScrn); unsigned char CR32; - if(!(pSiS->VBFlags & VB_VIDEOBRIDGE)) - return; + if(!(pSiS->VBFlags & VB_VIDEOBRIDGE)) return; /* CRT2-VGA not supported on LVDS and 30xLV */ if(pSiS->VBFlags & (VB_LVDS|VB_301LV|VB_302LV|VB_302ELV)) diff --git a/src/sis_vga.c b/src/sis_vga.c index 1e056c7..9ce8b78 100644 --- a/src/sis_vga.c +++ b/src/sis_vga.c @@ -1,33 +1,36 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c,v 1.38 2003/11/19 00:49:06 twini Exp $ */ +/* $XFree86$ */ /* * Mode setup and basic video bridge detection * - * Copyright 2001, 2002, 2003 by Thomas Winischhofer, Vienna, Austria. + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria. * - * Init() function for old series (except for TV and FIFO calculation) based - * on code which was Copyright 1998,1999 by Alan Hourihane, Wigan, England. + * 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. * - * 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. + * 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. * - * 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. - * - * Authors: Thomas Winischhofer <thomas@winischhofer.net> - * ... + * Author: Thomas Winischhofer <thomas@winischhofer.net> * + * Init() function for old series (except for TV and FIFO calculation) + * previously based on code which is Copyright (C) 1998,1999 by Alan + * Hourihane, Wigan, England */ #include "xf86.h" @@ -41,14 +44,9 @@ #include "sis_regs.h" #include "sis_dac.h" -#if 0 -#define TV6326TEST -#endif - static Bool SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode); static Bool SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode); -/* To be used internally only */ -static int SISDoSense(ScrnInfoPtr pScrn, int tempbl, int tempbh, int tempcl, int tempch); +static int SISDoSense(ScrnInfoPtr pScrn, unsigned short type, unsigned short test); static void SISSense30x(ScrnInfoPtr pScrn); static int SIS6326DoSense(ScrnInfoPtr pScrn, int tempbh, int tempbl, int tempch, int tempcl); static void SISSense6326(ScrnInfoPtr pScrn); @@ -67,17 +65,6 @@ const CARD8 SiS6326TVRegs1_NTSC[6][14] = { {0x83,0x5d,0x21,0xbe,0x75,0x03,0x00,0x09,0x08,0x42,0x10,0x4d,0x61,0x79} /* 640x480u */ }; -#ifdef TV6326TEST -const CARD8 SiS6326TVRegs1_NTSC_2[6][3] = { - { 0x00,0x00,0x00}, - { 0x00,0x00,0x00}, - { 0x24,0x92,0x49}, - { 0x24,0x92,0x49}, /* 8a50 */ - { 0x24,0x92,0x49}, /* 640x400, 640x480 */ /* 8afc */ - { 0x21,0xbe,0x75} /* 640x480u */ /* n/a */ -}; -#endif - const CARD8 SiS6326TVRegs2_NTSC[6][54] = { {0x11, 0x17, 0x03, 0x09, 0x94, 0x02, 0x05, 0x06, 0x09, 0x50, 0x0C, 0x0C, 0x06, 0x0D, 0x04, 0x0A, 0x94, 0x06, 0x0D, 0x04, 0x0A, 0x94, @@ -120,17 +107,6 @@ const CARD8 SiS6326TVRegs1_PAL[6][14] = { {0x81,0x63,0xa4,0x03,0xd9,0x01,0x00,0x09,0x10,0x9f,0x10,0xaa,0x71,0x59} /* 720x540 */ }; -#ifdef TV6326TEST -const CARD8 SiS6326TVRegs1_PAL_2[6][3] = { - { 0x00,0x00,0x00}, - { 0x00,0x00,0x00}, - { 0xa4,0x07,0xd9}, /* 640x480 */ /* 887e */ - { 0xa4,0x08,0x19}, /* 800x600 */ /* 8828 */ - { 0xa1,0x7e,0xa3}, /* 800x600u */ /* n/a */ - { 0xa4,0x07,0xd9} /* 720x540 */ /* n/a */ -}; -#endif - const CARD8 SiS6326TVRegs2_PAL[6][54] = { {0x15, 0x4E, 0x35, 0x6E, 0x94, 0x02, 0x04, 0x38, 0x3A, 0x50, 0x3D, 0x70, 0x06, 0x3E, 0x35, 0x6D, 0x94, 0x05, 0x3F, 0x36, 0x6E, 0x94, @@ -164,7 +140,6 @@ const CARD8 SiS6326TVRegs2_PAL[6][54] = { 0x6A, 0x5A, 0x73, 0xA0, 0xC1, 0x95, 0x73, 0xB6, 0x03, 0xA0} }; - const CARD8 SiS6326CR[9][15] = { {0x79,0x63,0x64,0x1d,0x6a,0x93,0x00,0x6f,0xf0,0x58,0x8a,0x57,0x57,0x70,0x20}, /* PAL 800x600 */ {0x79,0x4f,0x50,0x95,0x60,0x93,0x00,0x6f,0xba,0x14,0x86,0xdf,0xe0,0x30,0x00}, /* PAL 640x480 */ @@ -807,11 +782,6 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode) for(i=0; i<14; i++) { pReg->sis6326tv[SiS6326TVRegs1[i]] = SiS6326TVRegs1_PAL[index][i]; } -#ifdef TV6326TEST - for(i=0, j=2; i<3; i++, j++) { - pReg->sis6326tv[j] = SiS6326TVRegs1_PAL_2[index][i]; - } -#endif fsc = (SiS6326TVRegs1_PAL[index][2] << 16) | (SiS6326TVRegs1_PAL[index][3] << 8) | (SiS6326TVRegs1_PAL[index][4]); @@ -822,11 +792,6 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode) for(i=0; i<14; i++) { pReg->sis6326tv[SiS6326TVRegs1[i]] = SiS6326TVRegs1_NTSC[index][i]; } -#ifdef TV6326TEST - for(i=0, j=2; i<3; i++, j++) { - pReg->sis6326tv[j] = SiS6326TVRegs1_NTSC_2[index][i]; - } -#endif fsc = (SiS6326TVRegs1_NTSC[index][2] << 16) | (SiS6326TVRegs1_NTSC[index][3] << 8) | (SiS6326TVRegs1_NTSC[index][4]); @@ -969,294 +934,203 @@ SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode) } static int -SISDoSense(ScrnInfoPtr pScrn, int tempbl, int tempbh, int tempcl, int tempch) +SISDoSense(ScrnInfoPtr pScrn, unsigned short type, unsigned short test) { - SISPtr pSiS = SISPTR(pScrn); - int temp; - - outSISIDXREG(SISPART4,0x11,tempbl); - temp = tempbh | tempcl; - setSISIDXREG(SISPART4,0x10,0xe0,temp); - SiS_DDC2Delay(pSiS->SiS_Pr, 0x1000); - tempch &= 0x7f; - inSISIDXREG(SISPART4,0x03,temp); - temp ^= 0x0e; - temp &= tempch; - return((temp == tempch)); + SISPtr pSiS = SISPTR(pScrn); + int temp, mytest, result, i, j; + +#ifdef TWDEBUG + xf86DrvMsg(0, X_INFO, "Sense: %x %x\n", type, test); +#endif + + for(j = 0; j < 10; j++) { + result = 0; + for(i = 0; i < 3; i++) { + mytest = test; + outSISIDXREG(SISPART4,0x11,(type & 0x00ff)); + temp = (type >> 8) | (mytest & 0x00ff); + setSISIDXREG(SISPART4,0x10,0xe0,temp); + SiS_DDC2Delay(pSiS->SiS_Pr, 0x1500); + mytest >>= 8; + mytest &= 0x7f; + inSISIDXREG(SISPART4,0x03,temp); + temp ^= 0x0e; + temp &= mytest; + if(temp == mytest) result++; +#if 1 + outSISIDXREG(SISPART4,0x11,0x00); + andSISIDXREG(SISPART4,0x10,0xe0); + SiS_DDC2Delay(pSiS->SiS_Pr, 0x1000); +#endif + } + if((result == 0) || (result >= 2)) break; + } + return(result); } +#define GETROMWORD(w) (pSiS->BIOS[w] | (pSiS->BIOS[w+1] << 8)) + /* Sense connected devices on 30x */ static void SISSense30x(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); - unsigned char backupP4_0d,backupP2_00,biosflag; - unsigned char svhs_bl, svhs_bh; - unsigned char svhs_cl, svhs_ch; - unsigned char cvbs_bl, cvbs_bh; - unsigned char cvbs_cl, cvbs_ch; - unsigned char vga2_bl, vga2_bh; - unsigned char vga2_cl, vga2_ch; - int myflag, result=0, i, j; - unsigned short temp; + unsigned char backupP4_0d,backupP2_00,backupP2_4d,biosflag=0; + unsigned short svhs=0, svhs_c=0; + unsigned short cvbs=0, cvbs_c=0; + unsigned short vga2=0, vga2_c=0; + int myflag, result; /* , i; */ inSISIDXREG(SISPART4,0x0d,backupP4_0d); outSISIDXREG(SISPART4,0x0d,(backupP4_0d | 0x04)); + SiS_DDC2Delay(pSiS->SiS_Pr, 0x2000); inSISIDXREG(SISPART2,0x00,backupP2_00); - outSISIDXREG(SISPART2,0x00,(backupP2_00 | 0x1c)); - - SISDoSense(pScrn, 0, 0, 0, 0); - - if(pSiS->Chipset != PCI_CHIP_SIS660) { - if((pSiS->VGAEngine == SIS_315_VGA) || - (pSiS->Chipset == PCI_CHIP_SIS300)) { - if(pSiS->sishw_ext.UseROM) { - if(pSiS->VGAEngine == SIS_300_VGA) temp = 0xfe; - else if(pSiS->Chipset == PCI_CHIP_SIS330) temp = 0x11b; - else temp = 0xf3; - if(pSiS->BIOS[temp] & 0x08) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "SiS30x: Video bridge has DVI-I TMDS/VGA combo connector\n"); - orSISIDXREG(SISCR, 0x32, 0x80); - } else { - andSISIDXREG(SISCR, 0x32, 0x7f); - } - } - } - } - - if(pSiS->VGAEngine == SIS_300_VGA) { + outSISIDXREG(SISPART2,0x00,((backupP2_00 | 0x1c) & 0xfc)); - if(pSiS->sishw_ext.UseROM) { - vga2_bh = pSiS->BIOS[0xf9]; vga2_bl = pSiS->BIOS[0xf8]; - svhs_bh = pSiS->BIOS[0xfb]; svhs_bl = pSiS->BIOS[0xfa]; - cvbs_bh = pSiS->BIOS[0xfd]; cvbs_bl = pSiS->BIOS[0xfc]; - biosflag = pSiS->BIOS[0xfe]; - } else { - vga2_bh = 0x00; vga2_bl = 0xd1; - svhs_bh = 0x00; svhs_bl = 0xb9; - cvbs_bh = 0x00; cvbs_bl = 0xb3; - biosflag = 2; - } - if(pSiS->VBFlags & (VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV|VB_302ELV)) { - vga2_bh = 0x01; vga2_bl = 0x90; - svhs_bh = 0x01; svhs_bl = 0x6b; - cvbs_bh = 0x01; cvbs_bl = 0x74; - } - inSISIDXREG(SISPART4,0x01,myflag); - if(myflag & 0x04) { - vga2_bh = 0x00; vga2_bl = 0xfd; - svhs_bh = 0x00; svhs_bl = 0xdd; - cvbs_bh = 0x00; cvbs_bl = 0xee; - } - vga2_ch = 0x0e; vga2_cl = 0x08; - svhs_ch = 0x04; svhs_cl = 0x04; - cvbs_ch = 0x08; cvbs_cl = 0x04; - - if(pSiS->Chipset == PCI_CHIP_SIS300) { - inSISIDXREG(SISSR,0x3b,myflag); - if(!(myflag & 0x01)) { - vga2_bh = 0x00; vga2_bl = 0x00; - vga2_ch = 0x00; vga2_cl = 0x00; - } - } - - } else if(pSiS->Chipset == PCI_CHIP_SIS660) { - - if(pSiS->sishw_ext.UseROM) { - biosflag = pSiS->BIOS[0x58]; - temp = pSiS->BIOS[0x254] | (pSiS->BIOS[0x255] << 8); - if(pSiS->VBFlags & VB_301) temp += 6; - else if(pSiS->VBFlags & VB_301B) temp += 12; - else if(pSiS->VBFlags & VB_301C) temp += 18; - else if(pSiS->VBFlags & VB_301LV) temp += 12; - else if(pSiS->VBFlags & VB_302LV) temp += 12; - else if(pSiS->VBFlags & VB_302ELV) temp += 18; - vga2_bh = pSiS->BIOS[temp+1]; vga2_bl = pSiS->BIOS[temp]; - svhs_bh = pSiS->BIOS[temp+3]; svhs_bl = pSiS->BIOS[temp+2]; - cvbs_bh = pSiS->BIOS[temp+5]; cvbs_bl = pSiS->BIOS[temp+4]; - } else { - biosflag = 2; - if(pSiS->VBFlags & (VB_301B | VB_301LV | VB_302LV)) { - vga2_bh = 0x01; vga2_bl = 0x90; - svhs_bh = 0x01; svhs_bl = 0x6b; /* Are these really correct for LV? */ - cvbs_bh = 0x01; cvbs_bl = 0x74; - } else if(pSiS->VBFlags & (VB_301C | VB_302ELV)) { - vga2_bh = 0x01; vga2_bl = 0x90; - svhs_bh = 0x01; svhs_bl = 0x6b; - cvbs_bh = 0x01; cvbs_bl = 0x10; - } else { - vga2_bh = 0x00; vga2_bl = 0xfd; - svhs_bh = 0x00; svhs_bl = 0xdd; - cvbs_bh = 0x00; cvbs_bl = 0xee; - } - } + inSISIDXREG(SISPART2,0x4d,backupP2_4d); + if(pSiS->VBFlags & (VB_301C|VB_301LV|VB_302LV|VB_302ELV)) { + outSISIDXREG(SISPART2,0x4d,(backupP2_4d & ~0x10)); + } - vga2_ch = 0x0e; vga2_cl = 0x08; - svhs_ch = 0x04; svhs_cl = 0x04; - cvbs_ch = 0x08; cvbs_cl = 0x04; + SISDoSense(pScrn, 0, 0); - if(pSiS->VBFlags & (VB_301LV|VB_302LV|VB_302ELV)) { - vga2_bh = 0x00; vga2_bl = 0x00; - vga2_ch = 0x00; vga2_cl = 0x00; - svhs_ch = 0x04; svhs_cl = 0x08; - cvbs_ch = 0x08; cvbs_cl = 0x08; - } + if(pSiS->VBFlags & VB_301) { + svhs = 0x00b9; cvbs = 0x00b3; vga2 = 0x00d1; + inSISIDXREG(SISPART4,0x01,myflag); + if(myflag & 0x04) { + svhs = 0x00dd; cvbs = 0x00ee; vga2 = 0x00fd; + } + } else if(pSiS->VBFlags & (VB_301B | VB_302B)) { + svhs = 0x016b; cvbs = 0x0174; vga2 = 0x0190; + } else if(pSiS->VBFlags & (VB_301LV | VB_302LV)) { + svhs = 0x0200; cvbs = 0x0100; + } else if(pSiS->VBFlags & (VB_301C | VB_302ELV)) { + svhs = 0x016b; cvbs = 0x0110; vga2 = 0x0190; + } else return; + + vga2_c = 0x0e08; svhs_c = 0x0404; cvbs_c = 0x0804; + if(pSiS->VBFlags & (VB_301LV|VB_302LV|VB_302ELV)) { + svhs_c = 0x0408; cvbs_c = 0x0808; + } + biosflag = 2; - } else { + if(pSiS->Chipset == PCI_CHIP_SIS300) { + inSISIDXREG(SISSR,0x3b,myflag); + if(!(myflag & 0x01)) vga2 = vga2_c = 0; + } - if(pSiS->sishw_ext.UseROM) { - if(pSiS->Chipset == PCI_CHIP_SIS330) { - vga2_bh = pSiS->BIOS[0xe6]; vga2_bl = pSiS->BIOS[0xe5]; - svhs_bh = pSiS->BIOS[0xe8]; svhs_bl = pSiS->BIOS[0xe7]; - cvbs_bh = pSiS->BIOS[0xea]; cvbs_bl = pSiS->BIOS[0xe9]; - biosflag = pSiS->BIOS[0x11b]; - } else { - vga2_bh = pSiS->BIOS[0xbe]; vga2_bl = pSiS->BIOS[0xbd]; - svhs_bh = pSiS->BIOS[0xc0]; svhs_bl = pSiS->BIOS[0xbf]; - cvbs_bh = pSiS->BIOS[0xc2]; cvbs_bl = pSiS->BIOS[0xc1]; - biosflag = pSiS->BIOS[0xf3]; - } - } else { - vga2_bh = 0x00; vga2_bl = 0xd1; - svhs_bh = 0x00; svhs_bl = 0xb9; - cvbs_bh = 0x00; cvbs_bl = 0xb3; - biosflag = 2; - } - - if(pSiS->VBFlags & (VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV|VB_302ELV)) { - if(pSiS->sishw_ext.UseROM) { - if(pSiS->Chipset == PCI_CHIP_SIS330) { - vga2_bh = pSiS->BIOS[0xec]; vga2_bl = pSiS->BIOS[0xeb]; - svhs_bh = pSiS->BIOS[0xee]; svhs_bl = pSiS->BIOS[0xed]; - cvbs_bh = pSiS->BIOS[0xf0]; cvbs_bl = pSiS->BIOS[0xef]; - } else { - vga2_bh = pSiS->BIOS[0xc4]; vga2_bl = pSiS->BIOS[0xc3]; - svhs_bh = pSiS->BIOS[0xc6]; svhs_bl = pSiS->BIOS[0xc5]; - cvbs_bh = pSiS->BIOS[0xc8]; cvbs_bl = pSiS->BIOS[0xc7]; - } - } else { - if(pSiS->VBFlags & (VB_301B|VB_301C|VB_302B)) { - vga2_bh = 0x01; vga2_bl = 0x90; - svhs_bh = 0x01; svhs_bl = 0x6b; - cvbs_bh = 0x01; cvbs_bl = 0x74; - } else { - vga2_bh = 0x00; vga2_bl = 0x00; - svhs_bh = 0x02; svhs_bl = 0x00; - cvbs_bh = 0x01; cvbs_bl = 0x00; - } - } - } - - if(pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)) { - inSISIDXREG(SISPART4,0x01,myflag); - if(myflag & 0x04) { - vga2_bh = 0x00; vga2_bl = 0xfd; - svhs_bh = 0x00; svhs_bl = 0xdd; - cvbs_bh = 0x00; cvbs_bl = 0xee; - } - } - - if(pSiS->VBFlags & (VB_301LV|VB_302LV|VB_302ELV)) { - /* TW: No VGA2 or SCART on LV bridges */ - vga2_bh = 0x00; vga2_bl = 0x00; - vga2_ch = 0x00; vga2_cl = 0x00; - svhs_ch = 0x04; svhs_cl = 0x08; - cvbs_ch = 0x08; cvbs_cl = 0x08; - } else { - vga2_ch = 0x0e; vga2_cl = 0x08; - svhs_ch = 0x04; svhs_cl = 0x04; - cvbs_ch = 0x08; cvbs_cl = 0x04; - } + if(pSiS->sishw_ext.UseROM) { + if(pSiS->VGAEngine == SIS_300_VGA) { + if(pSiS->VBFlags & VB_301) { + inSISIDXREG(SISPART4,0x01,myflag); + if(!(myflag & 0x04)) { + vga2 = GETROMWORD(0xf8); svhs = GETROMWORD(0xfa); cvbs = GETROMWORD(0xfc); + } + } + biosflag = pSiS->BIOS[0xfe]; + } else if(pSiS->Chipset == PCI_CHIP_SIS660) { + if(pSiS->ROM661New) { + biosflag = 2; + vga2 = GETROMWORD(0x63); svhs = cvbs = GETROMWORD(0x65); + if(pSiS->BIOS[0x5d] & 0x04) biosflag |= 0x01; + } + } else if(!pSiS->ROM661New) { +#if 0 /* eg. 1.15.23 has wrong values here */ + myflag = 0; + if(pSiS->VBFlags & VB_301) { + if(pSiS->Chipset == PCI_CHIP_SIS330) { + myflag = 0xe5; i = 0x11b; + } else { + myflag = 0xbd; i = 0xf3 + } + } else if(pSiS->VBFlags & (VB_301B|VB_302B|VB_301LV|VB_302LV)) { + if(pSiS->Chipset == PCI_CHIP_SIS330) { + myflag = 0xeb; i = 0x11b; + } else { + myflag = 0xc3; i = 0xf3 + } + } + if(myflag) { + biosflag = pSiS->BIOS[i]; vga2 = GETROMWORD(myflag); + svhs = GETROMWORD(myflag+2); cvbs = GETROMWORD(myflag+4); + } +#endif + } + } - } + if(pSiS->VBFlags & (VB_301LV|VB_302LV|VB_302ELV)) { + vga2 = vga2_c = 0; + } andSISIDXREG(SISCR, 0x32, ~0x14); pSiS->postVBCR32 &= ~0x14; - if(vga2_ch || vga2_cl || vga2_bh || vga2_bl) { -#ifdef TWDEBUG - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "SiS30x: Scanning for VGA2/SCART (%x %x %x %x)\n", - vga2_bh, vga2_bl, vga2_ch, vga2_cl); -#endif - - for(j = 0; j < 10; j++) { - result = 0; - for(i = 0; i < 3; i++) { - if(SISDoSense(pScrn, vga2_bl, vga2_bh, vga2_cl, vga2_ch)) - result++; - } - if((result == 0) || (result >= 2)) break; - } - if(result) { - if(biosflag & 0x01) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + + if(vga2_c || vga2) { + if(SISDoSense(pScrn, vga2, vga2_c)) { + if(biosflag & 0x01) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "SiS30x: Detected TV connected to SCART output\n"); - pSiS->VBFlags |= TV_SCART; - orSISIDXREG(SISCR, 0x32, 0x04); - pSiS->postVBCR32 |= 0x04; - } else { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + pSiS->VBFlags |= TV_SCART; + orSISIDXREG(SISCR, 0x32, 0x04); + pSiS->postVBCR32 |= 0x04; + } else { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "SiS30x: Detected secondary VGA connection\n"); - pSiS->VBFlags |= VGA2_CONNECTED; - orSISIDXREG(SISCR, 0x32, 0x10); - pSiS->postVBCR32 |= 0x10; - } + pSiS->VBFlags |= VGA2_CONNECTED; + orSISIDXREG(SISCR, 0x32, 0x10); + pSiS->postVBCR32 |= 0x10; + } } if(biosflag & 0x01) pSiS->SiS_SD_Flags |= SiS_SD_VBHASSCART; } -#ifdef TWDEBUG - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "SiS30x: Scanning for TV (%x %x %x %x; %x %x %x %x)\n", - svhs_bh, svhs_bl, svhs_ch, svhs_cl, - cvbs_bh, cvbs_bl, cvbs_ch, cvbs_cl); -#endif + andSISIDXREG(SISCR, 0x32, 0x3f); + pSiS->postVBCR32 &= 0x3f; + + if((pSiS->VGAEngine == SIS_315_VGA) && (pSiS->VBFlags & (VB_301C|VB_301LV|VB_302LV|VB_302ELV))) { + if(pSiS->SenseYPbPr) { + outSISIDXREG(SISPART2,0x4d,(backupP2_4d | 0x10)); + SiS_DDC2Delay(pSiS->SiS_Pr, 0x2000); + if((result = SISDoSense(pScrn, svhs, 0x0604))) { + if((result = SISDoSense(pScrn, cvbs, 0x0804))) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "SiS30x: Detected TV connected to YPbPr component output\n"); + orSISIDXREG(SISCR,0x32,0x80); + pSiS->VBFlags |= TV_YPBPR; + pSiS->postVBCR32 |= 0x80; + } + } + outSISIDXREG(SISPART2,0x4d,backupP2_4d); + } + } andSISIDXREG(SISCR, 0x32, ~0x03); pSiS->postVBCR32 &= ~0x03; - if(pSiS->VBFlags & (VB_301C | VB_302ELV)) { - orSISIDXREG(SISPART4,0x0d,0x04); - } + if(!(pSiS->VBFlags & TV_YPBPR)) { - for(j = 0; j < 10; j++) { - result = 0; - for(i = 0; i < 3; i++) { - if(SISDoSense(pScrn, svhs_bl, svhs_bh, svhs_cl, svhs_ch)) - result++; - } - if((result == 0) || (result >= 2)) break; - } - if(result) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + if((result = SISDoSense(pScrn, svhs, svhs_c))) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "SiS30x: Detected TV connected to SVIDEO output\n"); - pSiS->VBFlags |= TV_SVIDEO; - orSISIDXREG(SISCR, 0x32, 0x02); - pSiS->postVBCR32 |= 0x02; - } - - if((biosflag & 0x02) || (!(result))) { + pSiS->VBFlags |= TV_SVIDEO; + orSISIDXREG(SISCR, 0x32, 0x02); + pSiS->postVBCR32 |= 0x02; + } - for(j = 0; j < 10; j++) { - result = 0; - for(i = 0; i < 3; i++) { - if(SISDoSense(pScrn, cvbs_bl, cvbs_bh, cvbs_cl, cvbs_ch)) - result++; + if((biosflag & 0x02) || (!result)) { + if(SISDoSense(pScrn, cvbs, cvbs_c)) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "SiS30x: Detected TV connected to COMPOSITE output\n"); + pSiS->VBFlags |= TV_AVIDEO; + orSISIDXREG(SISCR, 0x32, 0x01); + pSiS->postVBCR32 |= 0x01; } - if((result == 0) || (result >= 2)) break; - } - if(result) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "SiS30x: Detected TV connected to COMPOSITE output\n"); - pSiS->VBFlags |= TV_AVIDEO; - orSISIDXREG(SISCR, 0x32, 0x01); - pSiS->postVBCR32 |= 0x01; } + } - SISDoSense(pScrn, 0, 0, 0, 0); + SISDoSense(pScrn, 0, 0); outSISIDXREG(SISPART2,0x00,backupP2_00); outSISIDXREG(SISPART4,0x0d,backupP4_0d); @@ -1337,9 +1211,10 @@ void SISVGAPreInit(ScrnInfoPtr pScrn) int upperlimitch, lowerlimitch; int chronteltype, chrontelidreg, upperlimitvb; unsigned char test[3]; + static const char *detectvb = "Detected %s video bridge (ID %d; Revision 0x%x)\n"; #if 0 unsigned char sr17=0; -#endif +#endif static const char *ChrontelTypeStr[] = { "7004", "7005", @@ -1396,43 +1271,31 @@ void SISVGAPreInit(ScrnInfoPtr pScrn) if(temp2 == 0xff) { pSiS->VBFlags |= VB_302LV; pSiS->sishw_ext.ujVBChipID = VB_CHIP_302LV; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected SiS302LV video bridge (ID 1; Revision 0x%x)\n", - temp1); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "SiS302LV", 1, temp1); } else { pSiS->VBFlags |= VB_302ELV; pSiS->sishw_ext.ujVBChipID = VB_CHIP_302ELV; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected SiS302ELV video bridge (ID 1; Revision 0x%x)\n", - temp1); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "SiS302ELV", 1, temp1); } } else if(temp1 >= 0xD0) { pSiS->VBFlags |= VB_301LV; pSiS->sishw_ext.ujVBChipID = VB_CHIP_301LV; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected SiS301LV video bridge (ID 1; Revision 0x%x)\n", - temp1); - } else if(temp1 >= 0xC0) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "SiS301LV", 1, temp1); + } else if(temp1 >= 0xC0) { pSiS->VBFlags |= VB_301C; pSiS->sishw_ext.ujVBChipID = VB_CHIP_301C; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected SiS301C video bridge (ID 1; Revision 0x%x)\n", - temp1); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "SiS301C", 1, temp1); } else if(temp1 >= 0xB0) { pSiS->VBFlags |= VB_301B; pSiS->sishw_ext.ujVBChipID = VB_CHIP_301B; inSISIDXREG(SISPART4, 0x23, temp2); if(!(temp2 & 0x02)) pSiS->VBFlags |= VB_30xBDH; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected SiS301B%s video bridge (Revision 0x%x)\n", - (temp2 & 0x02) ? "" : " (DH)", - temp1); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, + (temp2 & 0x02) ? "SiS301B" : "SiS301B-DH", 1, temp1); } else { pSiS->VBFlags |= VB_301; pSiS->sishw_ext.ujVBChipID = VB_CHIP_301; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected SiS301 video bridge (Revision 0x%x)\n", - temp1); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "SiS301", 1, temp1); } SISSense30x(pScrn); @@ -1444,32 +1307,25 @@ void SISVGAPreInit(ScrnInfoPtr pScrn) if(temp1 >= 0xE0) { pSiS->VBFlags |= VB_302LV; pSiS->sishw_ext.ujVBChipID = VB_CHIP_302LV; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected SiS302LV video bridge (ID 2; Revision 0x%x)\n", - temp1); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "SiS302LV", 2, temp1); } else if(temp1 >= 0xD0) { pSiS->VBFlags |= VB_301LV; pSiS->sishw_ext.ujVBChipID = VB_CHIP_301LV; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected SiS301LV video bridge (ID 2; Revision 0x%x)\n", - temp1); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "SiS301LV", 2, temp1); } else { pSiS->VBFlags |= VB_302B; pSiS->sishw_ext.ujVBChipID = VB_CHIP_302B; inSISIDXREG(SISPART4, 0x23, temp2); if(!(temp & 0x02)) pSiS->VBFlags |= VB_30xBDH; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected SiS302B%s video bridge (Revision 0x%x)\n", - (temp2 & 0x02) ? "" : " (DH)", - temp1); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, + (temp2 & 0x02) ? "SiS302B" : "SiS302B-DH", 2, temp1); } SISSense30x(pScrn); } else if (temp == 3) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected SiS303 video bridge - not supported\n"); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "unsupported SiS303", temp, 0); } else { @@ -1499,7 +1355,7 @@ void SISVGAPreInit(ScrnInfoPtr pScrn) if((temp >= lowerlimitlvds) && (temp <= upperlimitlvds)) { pSiS->VBFlags |= VB_LVDS; xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected LVDS transmitter (Bridge type %d)\n", temp); + "Detected LVDS transmitter (External chip ID %d)\n", temp); } if((temp >= lowerlimitch) && (temp <= upperlimitch)) { /* Set global for init301.c */ @@ -1543,7 +1399,7 @@ void SISVGAPreInit(ScrnInfoPtr pScrn) default: temp2 = 8; pSiS->ChrontelType = CHRONTEL_701x; break; } xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected Chrontel %s TV encoder (ID 0x%02x; bridge type %d)\n", + "Detected Chrontel %s TV encoder (ID 0x%02x; chip ID %d)\n", ChrontelTypeStr[temp2], temp1, temp); /* Sense connected TV's */ @@ -1640,10 +1496,10 @@ void SISVGAPreInit(ScrnInfoPtr pScrn) break; case 0x04: xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Chrontel: Detected TV connected to SCART output or 480i HDTV\n"); + "Chrontel: Detected TV connected to SCART or YPBPR output\n"); if(pSiS->chtvtype == -1) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Chrontel: Use CHTVType option to select either SCART or HDTV\n"); + "Chrontel: Use CHTVType option to select either SCART or YPBPR525I\n"); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Chrontel: Using SCART by default\n"); pSiS->chtvtype = 1; @@ -1651,7 +1507,7 @@ void SISVGAPreInit(ScrnInfoPtr pScrn) if(pSiS->chtvtype) pSiS->VBFlags |= TV_CHSCART; else - pSiS->VBFlags |= TV_CHHDTV; + pSiS->VBFlags |= TV_CHYPBPR525I; break; default: xf86DrvMsg(pScrn->scrnIndex, X_PROBED, @@ -1685,8 +1541,9 @@ void SISVGAPreInit(ScrnInfoPtr pScrn) "Detected Conexant video bridge - UNSUPPORTED\n"); } if((pSiS->VGAEngine == SIS_300_VGA) && (temp == 3)) { + pSiS->VBFlags |= VB_TRUMPION; xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Detected Trumpion Zurac (I/II/III) LVDS scaler - UNSUPPORTED\n"); + "Detected Trumpion Zurac (I/II/III) LVDS scaler\n"); } if(temp > upperlimitvb) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -1760,29 +1617,19 @@ void SISVGAPreInit(ScrnInfoPtr pScrn) pSiS->ChipFlags |= SiSCF_UseLCDA; pSiS->SiS_Pr->Backup = TRUE; } else { - inSISIDXREG(SISCR,0x35,temp); - if(temp & 0x01) { + orSISIDXREG(SISPART1,0x2f,0x01); /* Unlock CRT2 */ + inSISIDXREG(SISPART1,0x13,temp); + if(temp & 0x04) { pSiS->SiS_Pr->SiS_UseLCDA = TRUE; pSiS->ChipFlags |= SiSCF_UseLCDA; pSiS->SiS_Pr->Backup = TRUE; - } else { - inSISIDXREG(SISCR,0x30,temp); - if(temp & 0x20) { - orSISIDXREG(SISPART1,0x2f,0x01); /* Unlock CRT2 */ - inSISIDXREG(SISPART1,0x13,temp); - if(temp & 0x04) { - pSiS->SiS_Pr->SiS_UseLCDA = TRUE; - pSiS->ChipFlags |= SiSCF_UseLCDA; - pSiS->SiS_Pr->Backup = TRUE; - } - } } } } } if(pSiS->ChipFlags & SiSCF_UseLCDA) { xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Bridge uses LCDA for low resolution and text modes\n"); + "BIOS uses LCDA for low resolution and text modes\n"); if(pSiS->SiS_Pr->Backup == TRUE) { inSISIDXREG(SISCR,0x34,pSiS->SiS_Pr->Backup_Mode); inSISIDXREG(SISPART1,0x14,pSiS->SiS_Pr->Backup_14); diff --git a/src/sis_video.c b/src/sis_video.c index afe3012..85d75b5 100644 --- a/src/sis_video.c +++ b/src/sis_video.c @@ -1,39 +1,39 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c,v 1.41 2003/11/19 00:49:06 twini Exp $ */ +/* $XFree86$ */ /* * Xv driver for SiS 300, 315 and 330 series. * - * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria. - * All Rights Reserved. + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria. * - * Basic structure based on the mga Xv driver by Mark Vojkovich - * and i810 Xv driver by Jonathan Bian <jonathan.bian@intel.com>. - * - * Formerly based on a mostly non-working fragment for the 630 by - * Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan. + * 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. * - * 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. + * 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. * - * 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. + * Author: Thomas Winischhofer <thomas@winischhofer.net> * - * Authors: - * Thomas Winischhofer <thomas@winischhofer.net>: - * (Original code fragment for 630 by - * Sung-Ching Lin <sclin@sis.com.tw>) + * Formerly based on a mostly non-working code fragment for the 630 by + * Silicon Integrated Systems Corp, Inc., HsinChu, Taiwan which is + * Copyright (C) 2000 Silicon Integrated Systems Corp, Inc. * + * Basic structure based on the mga Xv driver by Mark Vojkovich + * and i810 Xv driver by Jonathan Bian <jonathan.bian@intel.com>. * * All comments in this file are by Thomas Winischhofer. * @@ -245,16 +245,17 @@ static char sisxvsdstorepbrir2[] = "XV_SD_STOREDGAMMAPBRIR2"; static char sisxvsdstorepbrig2[] = "XV_SD_STOREDGAMMAPBRIG2"; static char sisxvsdstorepbrib2[] = "XV_SD_STOREDGAMMAPBRIB2"; static char sisxvsdhidehwcursor[] = "XV_SD_HIDEHWCURSOR"; +static char sisxvsdpanelmode[] = "XV_SD_PANELMODE"; #ifdef TWDEBUG static char sisxvsetreg[] = "XV_SD_SETREG"; #endif #ifndef SIS_CP -#define NUM_ATTRIBUTES_300 56 +#define NUM_ATTRIBUTES_300 57 #ifdef TWDEBUG -#define NUM_ATTRIBUTES_315 63 +#define NUM_ATTRIBUTES_315 64 #else -#define NUM_ATTRIBUTES_315 62 +#define NUM_ATTRIBUTES_315 63 #endif #endif @@ -316,6 +317,7 @@ static XF86AttributeRec SISAttributes_300[NUM_ATTRIBUTES_300] = {XvSettable | XvGettable, 100, 10000, sisxvsdstorepbrir2}, {XvSettable | XvGettable, 100, 10000, sisxvsdstorepbrig2}, {XvSettable | XvGettable, 100, 10000, sisxvsdstorepbrib2}, + {XvSettable | XvGettable, 0, 15, sisxvsdpanelmode}, #ifdef SIS_CP SIS_CP_VIDEO_ATTRIBUTES #endif @@ -384,6 +386,7 @@ static XF86AttributeRec SISAttributes_315[NUM_ATTRIBUTES_315] = {XvSettable | XvGettable, 100, 10000, sisxvsdstorepbrig2}, {XvSettable | XvGettable, 100, 10000, sisxvsdstorepbrib2}, {XvSettable | XvGettable, 0, 1, sisxvsdhidehwcursor}, + {XvSettable | XvGettable, 0, 15, sisxvsdpanelmode}, #ifdef TWDEBUG {XvSettable , 0, 0xffffffff, sisxvsetreg}, #endif @@ -1389,6 +1392,7 @@ SISSetupImageVideo(ScreenPtr pScreen) pSiS->xv_PBG2 = MAKE_ATOM(sisxvsdstorepbrig2); pSiS->xv_PBB2 = MAKE_ATOM(sisxvsdstorepbrib2); pSiS->xv_SHC = MAKE_ATOM(sisxvsdhidehwcursor); + pSiS->xv_PMD = MAKE_ATOM(sisxvsdpanelmode); #ifdef TWDEBUG pSiS->xv_STR = MAKE_ATOM(sisxvsetreg); #endif @@ -1602,6 +1606,7 @@ SISSetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, #endif if(pSiS->xv_sisdirectunlocked) { SISSwitchCRT2Type(pScrn, (unsigned long)value); + set_dispmode(pScrn, pPriv); set_allowswitchcrt(pSiS, pPriv); set_maxencoding(pSiS, pPriv); } @@ -1611,6 +1616,7 @@ SISSetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, #endif if(pSiS->xv_sisdirectunlocked) { SISSwitchCRT1Status(pScrn, (unsigned long)value); + set_dispmode(pScrn, pPriv); set_allowswitchcrt(pSiS, pPriv); set_maxencoding(pSiS, pPriv); } @@ -1676,12 +1682,12 @@ SISSetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, } } else if(attribute == pSiS->xv_CMD) { if(pSiS->xv_sisdirectunlocked) { + int result = 0; pSiS->xv_sd_result = (value & 0xffffff00); - if(SISCheckModeIndexForCRT2Type(pScrn, (unsigned short)(value & 0xff), - (unsigned short)((value >> 8) & 0xff), - FALSE)) { - pSiS->xv_sd_result |= 0x01; - } + result = SISCheckModeIndexForCRT2Type(pScrn, (unsigned short)(value & 0xff), + (unsigned short)((value >> 8) & 0xff), + FALSE); + pSiS->xv_sd_result |= (result & 0xff); } } else if(attribute == pSiS->xv_SGA) { if(pSiS->xv_sisdirectunlocked) { @@ -1812,6 +1818,19 @@ SISSetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, pSiS->HWCursorIsVisible = VisibleBackup; } } + } else if(attribute == pSiS->xv_PMD) { + if(pSiS->xv_sisdirectunlocked) { + if(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTSCALE) { + if(value & 0x01) pSiS->SiS_Pr->UsePanelScaler = -1; + else if(value & 0x02) pSiS->SiS_Pr->UsePanelScaler = 1; + else pSiS->SiS_Pr->UsePanelScaler = 0; + if(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTCENTER) { + if(value & 0x04) pSiS->SiS_Pr->CenterScreen = -1; + else if(value & 0x08) pSiS->SiS_Pr->CenterScreen = 1; + else pSiS->SiS_Pr->CenterScreen = 0; + } + } + } #ifdef TWDEBUG } else if(attribute == pSiS->xv_STR) { unsigned short port; @@ -1955,6 +1974,7 @@ SISGetPortAttribute( } else if(attribute == pSiS->xv_CMDR) { *value = pSiS->xv_sd_result; } else if(attribute == pSiS->xv_OVR) { + /* Changing of CRT2 settings not supported in DHM! */ *value = 0; if(pSiS->OptTVSOver == 1) *value = 3; else if(pSiS->UseCHOverScan == 1) *value = 2; @@ -2029,6 +2049,20 @@ SISGetPortAttribute( *value = pSiS->GammaPBriB; } else if(attribute == pSiS->xv_SHC) { *value = pSiS->HideHWCursor ? 1 : 0; + } else if(attribute == pSiS->xv_PMD) { + *value = 0; + if(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTSCALE) { + switch(pSiS->SiS_Pr->UsePanelScaler) { + case -1: *value |= 0x01; break; + case 1: *value |= 0x02; break; + } + if(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTCENTER) { + switch(pSiS->SiS_Pr->CenterScreen) { + case -1: *value |= 0x04; break; + case 1: *value |= 0x08; break; + } + } + } #ifdef SIS_CP SIS_CP_VIDEO_GETATTRIBUTE #endif @@ -2081,12 +2115,10 @@ SiSHandleSiSDirectCommand(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv, sisdirectcomm break; case SDC_CMD_CHECKMODEFORCRT2: j = sdcbuf->sdc_parm[0]; - sdcbuf->sdc_parm[0] = 0; - if(SISCheckModeIndexForCRT2Type(pScrn, (unsigned short)(j & 0xff), - (unsigned short)((j >> 8) & 0xff), - FALSE)) { - sdcbuf->sdc_parm[0] = 1; - } + sdcbuf->sdc_parm[0] = SISCheckModeIndexForCRT2Type(pScrn, + (unsigned short)(j & 0xff), + (unsigned short)((j >> 8) & 0xff), + FALSE) & 0xff; break; default: sdcbuf->sdc_header = SDC_RESULT_UNDEFCMD; @@ -2700,7 +2732,7 @@ set_brightness(SISPtr pSiS, CARD8 brightness) static __inline void set_contrast(SISPtr pSiS, CARD8 contrast) { - setvideoregmask(pSiS, Index_VI_Contrast_Enh_Ctrl, contrast ^ 0x07, 0x07); + setvideoregmask(pSiS, Index_VI_Contrast_Enh_Ctrl, contrast, 0x07); } /* 315 series and later only */ @@ -3398,6 +3430,7 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv) pPriv->mustwait = 1; pPriv->oldx1 = overlay.dstBox.x1; pPriv->oldx2 = overlay.dstBox.x2; pPriv->oldy1 = overlay.dstBox.y1; pPriv->oldy2 = overlay.dstBox.y2; + } #ifdef SISMERGED } diff --git a/src/vgatypes.h b/src/vgatypes.h index 0daafed..634190b 100644 --- a/src/vgatypes.h +++ b/src/vgatypes.h @@ -1,36 +1,54 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/vgatypes.h,v 1.15 2003/11/19 00:49:06 twini Exp $ */ +/* $XFree86$ */ /* * General type definitions for universal mode switching modules * - * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria * - * If distributed as part of the linux kernel, the contents of this file - * is entirely covered by the GPL. + * If distributed as part of the Linux kernel, the following license terms + * apply: * - * Otherwise, the following terms apply: + * * This program is free software; you can redistribute it and/or modify + * * it under the terms of the GNU General Public License as published by + * * the Free Software Foundation; either version 2 of the named License, + * * or any later version. + * * + * * This program is distributed in the hope that it will be useful, + * * but WITHOUT ANY WARRANTY; without even the implied warranty of + * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * * GNU General Public License for more details. + * * + * * You should have received a copy of the GNU General Public License + * * along with this program; if not, write to the Free Software + * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * - * 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. + * Otherwise, the following license terms apply: * - * 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. + * * 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. + * * + * * 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> - * Silicon Integrated Systems + * Author: Thomas Winischhofer <thomas@winischhofer.net> * */ + #ifndef _VGATYPES_ #define _VGATYPES_ @@ -164,6 +182,9 @@ typedef enum _SIS_LCD_TYPE { LCD_640x480_2, /* FSTN, DSTN */ LCD_640x480_3, /* FSTN, DSTN */ LCD_848x480, + LCD_1280x800, + LCD_1680x1050, + LCD_1280x720, LCD_CUSTOM, LCD_UNKNOWN } SIS_LCD_TYPE; @@ -197,25 +218,27 @@ struct _SIS_HW_INFO /* of Linear VGA memory */ ULONG ulVideoMemorySize; /* size, in bytes, of the memory on the board */ + SISIOADDRESS ulIOAddress; /* base I/O address of VGA ports (0x3B0) */ + UCHAR jChipType; /* Used to Identify SiS Graphics Chip */ /* defined in the data structure type */ /* "SIS_CHIP_TYPE" */ UCHAR jChipRevision; /* Used to Identify SiS Graphics Chip Revision */ + UCHAR ujVBChipID; /* the ID of video bridge */ /* defined in the data structure type */ /* "SIS_VB_CHIP_TYPE" */ #ifdef LINUX_KERNEL BOOLEAN Is301BDH; + ULONG ulCRT2LCDType; /* defined in the data structure type */ + /* "SIS_LCD_TYPE" */ #endif USHORT usExternalChip; /* NO VB or other video bridge (other than */ /* SiS video bridge) */ - ULONG ulCRT2LCDType; /* defined in the data structure type */ - /* "SIS_LCD_TYPE" */ - BOOLEAN bIntegratedMMEnabled;/* supporting integration MM enable */ BOOLEAN bSkipDramSizing; /* True: Skip video memory sizing. */ @@ -231,14 +254,6 @@ struct _SIS_HW_INFO /* Note : restore cR registers if */ /* bSkipDramSizing = TRUE */ #endif - - PSIS_QUERYSPACE pQueryVGAConfigSpace; /* Get/Set VGA Configuration */ - /* space */ - - PSIS_QUERYSPACE pQueryNorthBridgeSpace;/* Get/Set North Bridge */ - /* space */ - - UCHAR pdc; /* PanelDelayCompensation */ }; #endif @@ -254,38 +269,44 @@ struct _SIS_HW_INFO typedef struct _SISFB_INFO sisfb_info, *psisfb_info; struct _SISFB_INFO { - unsigned long sisfb_id; /* for identifying sisfb */ + CARD32 sisfb_id; /* for identifying sisfb */ #ifndef SISFB_ID #define SISFB_ID 0x53495346 /* Identify myself with 'SISF' */ #endif - int chip_id; /* PCI ID of detected chip */ - int memory; /* video memory in KB which sisfb manages */ - int heapstart; /* heap start (= sisfb "mem" argument) in KB */ - unsigned char fbvidmode; /* current sisfb mode */ + CARD32 chip_id; /* PCI ID of detected chip */ + CARD32 memory; /* video memory in KB which sisfb manages */ + CARD32 heapstart; /* heap start (= sisfb "mem" argument) in KB */ + CARD8 fbvidmode; /* current sisfb mode */ + + CARD8 sisfb_version; + CARD8 sisfb_revision; + CARD8 sisfb_patchlevel; + + CARD8 sisfb_caps; /* sisfb's capabilities */ + + CARD32 sisfb_tqlen; /* turbo queue length (in KB) */ - unsigned char sisfb_version; - unsigned char sisfb_revision; - unsigned char sisfb_patchlevel; + CARD32 sisfb_pcibus; /* The card's PCI ID */ + CARD32 sisfb_pcislot; + CARD32 sisfb_pcifunc; - unsigned char sisfb_caps; /* sisfb's capabilities */ + CARD8 sisfb_lcdpdc; - int sisfb_tqlen; /* turbo queue length (in KB) */ + CARD8 sisfb_lcda; - unsigned int sisfb_pcibus; /* The card's PCI ID */ - unsigned int sisfb_pcislot; - unsigned int sisfb_pcifunc; + CARD32 sisfb_vbflags; + CARD32 sisfb_currentvbflags; - unsigned char sisfb_lcdpdc; - - unsigned char sisfb_lcda; + CARD32 sisfb_scalelcd; + CARD32 sisfb_specialtiming; - unsigned long sisfb_vbflags; - unsigned long sisfb_currentvbflags; + CARD8 sisfb_haveemi; + CARD8 sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33; + CARD8 sisfb_haveemilcd; - int sisfb_scalelcd; - unsigned long sisfb_specialtiming; + CARD8 sisfb_lcdpdca; - char reserved[219]; /* for future use */ + CARD8 reserved[212]; /* for future use */ }; #endif diff --git a/src/vstruct.h b/src/vstruct.h index c200559..262ec3f 100644 --- a/src/vstruct.h +++ b/src/vstruct.h @@ -1,34 +1,51 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/vstruct.h,v 1.22 2003/11/03 17:02:54 twini Exp $ */ +/* $XFree86$ */ /* * General structure definitions for universal mode switching modules * - * Copyright 2002, 2003 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria * - * If distributed as part of the linux kernel, the contents of this file - * is entirely covered by the GPL. + * If distributed as part of the Linux kernel, the following license terms + * apply: * - * Otherwise, the following terms apply: + * * This program is free software; you can redistribute it and/or modify + * * it under the terms of the GNU General Public License as published by + * * the Free Software Foundation; either version 2 of the named License, + * * or any later version. + * * + * * This program is distributed in the hope that it will be useful, + * * but WITHOUT ANY WARRANTY; without even the implied warranty of + * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * * GNU General Public License for more details. + * * + * * You should have received a copy of the GNU General Public License + * * along with this program; if not, write to the Free Software + * * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * - * 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. + * Otherwise, the following license terms apply: * - * 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. + * * 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. + * * + * * 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> - * Silicon Integrated Systems + * Author: Thomas Winischhofer <thomas@winischhofer.net> * */ @@ -144,7 +161,6 @@ typedef struct _SiS_ExtStruct { UCHAR Ext_ModeID; USHORT Ext_ModeFlag; - UCHAR Ext_ModeOffset; USHORT Ext_VESAID; UCHAR Ext_RESINFO; UCHAR VB_ExtTVFlickerIndex; @@ -160,6 +176,7 @@ typedef struct _SiS_Ext2Struct UCHAR Ext_CRT1CRTC; UCHAR Ext_CRTVCLK; UCHAR Ext_CRT2CRTC; + UCHAR Ext_CRT2CRTC_NS; UCHAR ModeID; USHORT XRes; USHORT YRes; @@ -208,24 +225,31 @@ typedef struct _SiS_ModeResInfoStruct UCHAR YChar; } SiS_ModeResInfoStruct; + + typedef UCHAR DRAM4Type[4]; /* Defines for SiS_CustomT */ /* Never change these for sisfb compatibility */ -#define CUT_NONE 0 -#define CUT_FORCENONE 1 -#define CUT_BARCO1366 2 -#define CUT_BARCO1024 3 -#define CUT_COMPAQ1280 4 -#define CUT_COMPAQ12802 5 -#define CUT_PANEL848 6 -#define CUT_CLEVO1024 7 -#define CUT_CLEVO10242 8 -#define CUT_CLEVO1400 9 -#define CUT_CLEVO14002 10 -#define CUT_UNIWILL1024 11 -#define CUT_ASUSL3000D 12 -#define CUT_UNIWILL10242 13 +#define CUT_NONE 0 +#define CUT_FORCENONE 1 +#define CUT_BARCO1366 2 +#define CUT_BARCO1024 3 +#define CUT_COMPAQ1280 4 +#define CUT_COMPAQ12802 5 +#define CUT_PANEL848 6 +#define CUT_CLEVO1024 7 +#define CUT_CLEVO10242 8 +#define CUT_CLEVO1400 9 +#define CUT_CLEVO14002 10 +#define CUT_UNIWILL1024 11 +#define CUT_ASUSL3000D 12 +#define CUT_UNIWILL10242 13 +#define CUT_ACER1280 14 +#define CUT_COMPAL1400_1 15 +#define CUT_COMPAL1400_2 16 +#define CUT_ASUSA2H_1 17 +#define CUT_ASUSA2H_2 18 typedef struct _SiS_Private { @@ -258,20 +282,27 @@ typedef struct _SiS_Private USHORT SiS_IF_DEF_TRUMPION; USHORT SiS_IF_DEF_DSTN; USHORT SiS_IF_DEF_FSTN; - USHORT SiS_IF_DEF_HiVision; USHORT SiS_SysFlags; UCHAR SiS_VGAINFO; #ifndef LINUX_KERNEL USHORT SiS_CP1, SiS_CP2, SiS_CP3, SiS_CP4; #endif BOOLEAN SiS_UseROM; - int SiS_CHOverScan; + BOOLEAN SiS_ROMNew; + BOOLEAN PanelSelfDetected; + int SiS_CHOverScan; BOOLEAN SiS_CHSOverScan; BOOLEAN SiS_ChSW; BOOLEAN SiS_UseLCDA; - int SiS_UseOEM; - ULONG SiS_CustomT; - USHORT SiS_Backup70xx; + int SiS_UseOEM; + ULONG SiS_CustomT; + USHORT SiS_Backup70xx; + BOOLEAN HaveEMI; + BOOLEAN HaveEMILCD; + BOOLEAN OverruleEMI; + UCHAR EMI_30,EMI_31,EMI_32,EMI_33; + SHORT PDC, PDCA; + UCHAR SiS_MyCR63; USHORT SiS_CRT1Mode; USHORT SiS_flag_clearbuffer; int SiS_RAMType; @@ -286,7 +317,7 @@ typedef struct _SiS_Private USHORT SiS_LCDInfo661; USHORT SiS_VBType; USHORT SiS_VBExtInfo; - USHORT SiS_HiVision; + USHORT SiS_YPbPr; USHORT SiS_SelectCRT2Rate; USHORT SiS_SetFlag; USHORT SiS_RVBHCFACT; @@ -310,32 +341,19 @@ typedef struct _SiS_Private USHORT SiS_DDC_Port; USHORT SiS_DDC_Index; USHORT SiS_DDC_Data; + USHORT SiS_DDC_NData; USHORT SiS_DDC_Clk; - USHORT SiS_DDC_DataShift; + USHORT SiS_DDC_NClk; USHORT SiS_DDC_DeviceAddr; USHORT SiS_DDC_ReadAddr; USHORT SiS_DDC_SecAddr; - USHORT SiS_Panel800x600; - USHORT SiS_Panel1024x768; - USHORT SiS_Panel1280x1024; - USHORT SiS_Panel1600x1200; - USHORT SiS_Panel1280x960; - USHORT SiS_Panel1400x1050; - USHORT SiS_Panel320x480; - USHORT SiS_Panel1152x768; - USHORT SiS_Panel1280x768; - USHORT SiS_Panel1024x600; - USHORT SiS_Panel640x480; - USHORT SiS_Panel640x480_2; - USHORT SiS_Panel640x480_3; - USHORT SiS_Panel1152x864; - USHORT SiS_PanelCustom; - USHORT SiS_PanelBarco1366; - USHORT SiS_PanelMax; + USHORT SiS_ChrontelInit; + BOOLEAN SiS_SensibleSR11; + USHORT SiS661LCD2TableSize; + USHORT SiS_PanelMinLVDS; USHORT SiS_PanelMin301; - USHORT SiS_ChrontelInit; - + const SiS_StStruct *SiS_SModeIDTable; SiS_StandTableStruct *SiS_StandTable; const SiS_ExtStruct *SiS_EModeIDTable; @@ -344,11 +362,10 @@ typedef struct _SiS_Private const SiS_CRT1TableStruct *SiS_CRT1Table; const SiS_MCLKDataStruct *SiS_MCLKData_0; const SiS_MCLKDataStruct *SiS_MCLKData_1; - const SiS_VCLKDataStruct *SiS_VCLKData; - const SiS_VBVCLKDataStruct *SiS_VBVCLKData; + SiS_VCLKDataStruct *SiS_VCLKData; + SiS_VBVCLKDataStruct *SiS_VBVCLKData; const SiS_StResInfoStruct *SiS_StResInfo; const SiS_ModeResInfoStruct *SiS_ModeResInfo; - const UCHAR *SiS_ScreenOffset; const UCHAR *pSiS_OutputSelect; const UCHAR *pSiS_SoftSetting; @@ -378,6 +395,12 @@ typedef struct _SiS_Private const USHORT *pSiS_VideoSenseData2; const USHORT *pSiS_YCSenseData2; #endif + + const SiS_PanelDelayTblStruct *SiS_PanelDelayTbl; + const SiS_PanelDelayTblStruct *SiS_PanelDelayTblLVDS; + + /* SiS bridge */ + const UCHAR *SiS_NTSCPhase; const UCHAR *SiS_PALPhase; const UCHAR *SiS_NTSCPhase2; @@ -389,42 +412,56 @@ typedef struct _SiS_Private const UCHAR *SiS_SpecialPhase; const UCHAR *SiS_SpecialPhaseM; const UCHAR *SiS_SpecialPhaseJ; - const SiS_LCDDataStruct *SiS_StLCD1024x768Data; const SiS_LCDDataStruct *SiS_ExtLCD1024x768Data; const SiS_LCDDataStruct *SiS_St2LCD1024x768Data; - const SiS_LCDDataStruct *SiS_StLCD1280x1024Data; + const SiS_LCDDataStruct *SiS_LCD1280x720Data; + const SiS_LCDDataStruct *SiS_StLCD1280x768_2Data; + const SiS_LCDDataStruct *SiS_ExtLCD1280x768_2Data; + const SiS_LCDDataStruct *SiS_LCD1280x768_3Data; + const SiS_LCDDataStruct *SiS_LCD1280x800Data; + const SiS_LCDDataStruct *SiS_LCD1280x960Data; const SiS_LCDDataStruct *SiS_ExtLCD1280x1024Data; const SiS_LCDDataStruct *SiS_St2LCD1280x1024Data; - const SiS_LCDDataStruct *SiS_NoScaleData1024x768; - const SiS_LCDDataStruct *SiS_NoScaleData1280x1024; - const SiS_LCDDataStruct *SiS_LCD1280x960Data; - const SiS_LCDDataStruct *SiS_NoScaleData1400x1050; - const SiS_LCDDataStruct *SiS_NoScaleData1600x1200; - const SiS_LCDDataStruct *SiS_NoScaleData1280x768; const SiS_LCDDataStruct *SiS_StLCD1400x1050Data; - const SiS_LCDDataStruct *SiS_StLCD1600x1200Data; - const SiS_LCDDataStruct *SiS_StLCD1280x768Data; const SiS_LCDDataStruct *SiS_ExtLCD1400x1050Data; + const SiS_LCDDataStruct *SiS_StLCD1600x1200Data; const SiS_LCDDataStruct *SiS_ExtLCD1600x1200Data; - const SiS_LCDDataStruct *SiS_ExtLCD1280x768Data; + const SiS_LCDDataStruct *SiS_LCD1680x1050Data; const SiS_LCDDataStruct *SiS_NoScaleData; const SiS_TVDataStruct *SiS_StPALData; const SiS_TVDataStruct *SiS_ExtPALData; const SiS_TVDataStruct *SiS_StNTSCData; const SiS_TVDataStruct *SiS_ExtNTSCData; + const SiS_TVDataStruct *SiS_St1HiTVData; const SiS_TVDataStruct *SiS_St2HiTVData; const SiS_TVDataStruct *SiS_ExtHiTVData; + const SiS_TVDataStruct *SiS_St525iData; + const SiS_TVDataStruct *SiS_St525pData; + const SiS_TVDataStruct *SiS_St750pData; + const SiS_TVDataStruct *SiS_Ext525iData; + const SiS_TVDataStruct *SiS_Ext525pData; + const SiS_TVDataStruct *SiS_Ext750pData; const UCHAR *SiS_NTSCTiming; const UCHAR *SiS_PALTiming; const UCHAR *SiS_HiTVExtTiming; const UCHAR *SiS_HiTVSt1Timing; const UCHAR *SiS_HiTVSt2Timing; - const UCHAR *SiS_HiTVTextTiming; const UCHAR *SiS_HiTVGroup3Data; const UCHAR *SiS_HiTVGroup3Simu; +#if 0 + const UCHAR *SiS_HiTVTextTiming; const UCHAR *SiS_HiTVGroup3Text; - const SiS_PanelDelayTblStruct *SiS_PanelDelayTbl; - const SiS_PanelDelayTblStruct *SiS_PanelDelayTblLVDS; +#endif + + const SiS_Part2PortTblStruct *SiS_CRT2Part2_1024x768_1; + const SiS_Part2PortTblStruct *SiS_CRT2Part2_1280x1024_1; + const SiS_Part2PortTblStruct *SiS_CRT2Part2_1024x768_2; + const SiS_Part2PortTblStruct *SiS_CRT2Part2_1280x1024_2; + const SiS_Part2PortTblStruct *SiS_CRT2Part2_1024x768_3; + const SiS_Part2PortTblStruct *SiS_CRT2Part2_1280x1024_3; + + /* LVDS, Chrontel */ + const SiS_LVDSDataStruct *SiS_LVDS800x600Data_1; const SiS_LVDSDataStruct *SiS_LVDS800x600Data_2; const SiS_LVDSDataStruct *SiS_LVDS1024x768Data_1; @@ -446,14 +483,6 @@ typedef struct _SiS_Private const SiS_LVDSDataStruct *SiS_LVDS640x480Data_1; const SiS_LVDSDataStruct *SiS_LVDS640x480Data_2; const SiS_LVDSDataStruct *SiS_LVDS320x480Data_1; - const SiS_LVDSDataStruct *SiS_LCDA1024x768Data_1; - const SiS_LVDSDataStruct *SiS_LCDA1024x768Data_2; - const SiS_LVDSDataStruct *SiS_LCDA1280x1024Data_1; - const SiS_LVDSDataStruct *SiS_LCDA1280x1024Data_2; - const SiS_LVDSDataStruct *SiS_LCDA1400x1050Data_1; - const SiS_LVDSDataStruct *SiS_LCDA1400x1050Data_2; - const SiS_LVDSDataStruct *SiS_LCDA1600x1200Data_1; - const SiS_LVDSDataStruct *SiS_LCDA1600x1200Data_2; const SiS_LVDSDataStruct *SiS_LVDSXXXxXXXData_1; const SiS_LVDSDataStruct *SiS_LVDSBARCO1366Data_1; const SiS_LVDSDataStruct *SiS_LVDSBARCO1366Data_2; @@ -470,6 +499,7 @@ typedef struct _SiS_Private const SiS_LVDSDataStruct *SiS_CHTVUPALNData; const SiS_LVDSDataStruct *SiS_CHTVOPALNData; const SiS_LVDSDataStruct *SiS_CHTVSOPALData; + const SiS_LVDSDesStruct *SiS_PanelType00_1; const SiS_LVDSDesStruct *SiS_PanelType01_1; const SiS_LVDSDesStruct *SiS_PanelType02_1; @@ -504,20 +534,11 @@ typedef struct _SiS_Private const SiS_LVDSDesStruct *SiS_PanelType0e_2; const SiS_LVDSDesStruct *SiS_PanelType0f_2; const SiS_LVDSDesStruct *SiS_PanelTypeNS_2; - - const SiS_LVDSDesStruct *LVDS1024x768Des_1; - const SiS_LVDSDesStruct *LVDS1280x1024Des_1; - const SiS_LVDSDesStruct *LVDS1400x1050Des_1; - const SiS_LVDSDesStruct *LVDS1600x1200Des_1; - const SiS_LVDSDesStruct *LVDS1024x768Des_2; - const SiS_LVDSDesStruct *LVDS1280x1024Des_2; - const SiS_LVDSDesStruct *LVDS1400x1050Des_2; - const SiS_LVDSDesStruct *LVDS1600x1200Des_2; - const SiS_LVDSDesStruct *SiS_CHTVUNTSCDesData; const SiS_LVDSDesStruct *SiS_CHTVONTSCDesData; const SiS_LVDSDesStruct *SiS_CHTVUPALDesData; const SiS_LVDSDesStruct *SiS_CHTVOPALDesData; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1800x600_1; const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x768_1; const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x1024_1; @@ -558,44 +579,13 @@ typedef struct _SiS_Private const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1640x480_2_H; const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1640x480_3; const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1640x480_3_H; + const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1320x480_1; const SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1UNTSC; const SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1ONTSC; const SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1UPAL; const SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1OPAL; const SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1SOPAL; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1320x480_1; - - const SiS_LCDACRT1DataStruct *SiS_LCDACRT11024x768_1; - const SiS_LCDACRT1DataStruct *SiS_LCDACRT11280x1024_1; - const SiS_LCDACRT1DataStruct *SiS_LCDACRT11400x1050_1; - const SiS_LCDACRT1DataStruct *SiS_LCDACRT11600x1200_1; - const SiS_LCDACRT1DataStruct *SiS_LCDACRT11024x768_1_H; - const SiS_LCDACRT1DataStruct *SiS_LCDACRT11280x1024_1_H; - const SiS_LCDACRT1DataStruct *SiS_LCDACRT11400x1050_1_H; - const SiS_LCDACRT1DataStruct *SiS_LCDACRT11600x1200_1_H; - const SiS_LCDACRT1DataStruct *SiS_LCDACRT11024x768_2; - const SiS_LCDACRT1DataStruct *SiS_LCDACRT11280x1024_2; - const SiS_LCDACRT1DataStruct *SiS_LCDACRT11400x1050_2; - const SiS_LCDACRT1DataStruct *SiS_LCDACRT11600x1200_2; - const SiS_LCDACRT1DataStruct *SiS_LCDACRT11024x768_2_H; - const SiS_LCDACRT1DataStruct *SiS_LCDACRT11280x1024_2_H; - const SiS_LCDACRT1DataStruct *SiS_LCDACRT11400x1050_2_H; - const SiS_LCDACRT1DataStruct *SiS_LCDACRT11600x1200_2_H; - - const SiS_Part2PortTblStruct *SiS_CRT2Part2_1024x768_1; - const SiS_Part2PortTblStruct *SiS_CRT2Part2_1280x1024_1; - const SiS_Part2PortTblStruct *SiS_CRT2Part2_1400x1050_1; - const SiS_Part2PortTblStruct *SiS_CRT2Part2_1600x1200_1; - const SiS_Part2PortTblStruct *SiS_CRT2Part2_1024x768_2; - const SiS_Part2PortTblStruct *SiS_CRT2Part2_1280x1024_2; - const SiS_Part2PortTblStruct *SiS_CRT2Part2_1400x1050_2; - const SiS_Part2PortTblStruct *SiS_CRT2Part2_1600x1200_2; - const SiS_Part2PortTblStruct *SiS_CRT2Part2_1024x768_3; - const SiS_Part2PortTblStruct *SiS_CRT2Part2_1280x1024_3; - const SiS_Part2PortTblStruct *SiS_CRT2Part2_1400x1050_3; - const SiS_Part2PortTblStruct *SiS_CRT2Part2_1600x1200_3; - const SiS_CHTVRegDataStruct *SiS_CHTVReg_UNTSC; const SiS_CHTVRegDataStruct *SiS_CHTVReg_ONTSC; const SiS_CHTVRegDataStruct *SiS_CHTVReg_UPAL; @@ -605,6 +595,7 @@ typedef struct _SiS_Private const SiS_CHTVRegDataStruct *SiS_CHTVReg_UPALN; const SiS_CHTVRegDataStruct *SiS_CHTVReg_OPALN; const SiS_CHTVRegDataStruct *SiS_CHTVReg_SOPAL; + const UCHAR *SiS_CHTVVCLKUNTSC; const UCHAR *SiS_CHTVVCLKONTSC; const UCHAR *SiS_CHTVVCLKUPAL; @@ -615,9 +606,13 @@ typedef struct _SiS_Private const UCHAR *SiS_CHTVVCLKOPALN; const UCHAR *SiS_CHTVVCLKSOPAL; - USHORT PanelXRes; - USHORT PanelYRes; - + USHORT PanelXRes, PanelHT; + USHORT PanelYRes, PanelVT; + USHORT PanelHRS, PanelHRE; + USHORT PanelVRS, PanelVRE; + USHORT PanelVCLKIdx300; + USHORT PanelVCLKIdx315; + BOOLEAN UseCustomMode; BOOLEAN CRT1UsesCustomMode; USHORT CHDisplay; @@ -659,11 +654,13 @@ typedef struct _SiS_Private UCHAR Backup_1d; int UsePanelScaler; + int CenterScreen; USHORT CP_Vendor, CP_Product; BOOLEAN CP_HaveCustomData; - int CP_PreferredX, CP_PreferredY; + int CP_PreferredX, CP_PreferredY, CP_PreferredIndex; int CP_MaxX, CP_MaxY, CP_MaxClock; + BOOLEAN CP_Supports64048075; int CP_HDisplay[7], CP_VDisplay[7]; /* For Custom LCD panel dimensions */ int CP_HTotal[7], CP_VTotal[7]; int CP_HSyncStart[7], CP_VSyncStart[7]; |