summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2004-09-15 16:34:06 +0000
committerAlexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de>2004-09-15 16:34:06 +0000
commit083c08486ce2e2a68d79f7134373f175cdf79c88 (patch)
tree0c4cb830e3131bcdab509a65c66d81e42aa98ae9
parent1d0cfb1c4b43af7025d72c12342de79164461754 (diff)
-rw-r--r--README.sgml1
-rw-r--r--man/sis.man84
-rw-r--r--src/300vtbl.h191
-rw-r--r--src/310vtbl.h374
-rw-r--r--src/init.c841
-rw-r--r--src/init.h346
-rw-r--r--src/init301.c3097
-rw-r--r--src/init301.h142
-rw-r--r--src/initdef.h38
-rw-r--r--src/oem300.h3
-rw-r--r--src/oem310.h24
-rw-r--r--src/osdef.h7
-rw-r--r--src/sis.h145
-rw-r--r--src/sis300_accel.c141
-rw-r--r--src/sis300_accel.h7
-rw-r--r--src/sis310_accel.c349
-rw-r--r--src/sis310_accel.h146
-rw-r--r--src/sis6326_video.c92
-rw-r--r--src/sis_accel.c18
-rw-r--r--src/sis_accel.h1
-rw-r--r--src/sis_common.h1
-rw-r--r--src/sis_cursor.c12
-rw-r--r--src/sis_cursor.h3
-rw-r--r--src/sis_dac.c208
-rw-r--r--src/sis_dac.h3
-rw-r--r--src/sis_dga.c2
-rw-r--r--src/sis_dri.c205
-rw-r--r--src/sis_dri.h11
-rw-r--r--src/sis_driver.c1851
-rw-r--r--src/sis_driver.h22
-rw-r--r--src/sis_opt.c90
-rw-r--r--src/sis_regs.h54
-rw-r--r--src/sis_setup.c193
-rw-r--r--src/sis_shadow.c312
-rw-r--r--src/sis_vb.c740
-rw-r--r--src/sis_vga.c451
-rw-r--r--src/sis_video.c1873
-rw-r--r--src/vgatypes.h101
-rw-r--r--src/vstruct.h10
39 files changed, 7313 insertions, 4876 deletions
diff --git a/README.sgml b/README.sgml
index 8169fbe..193cfdc 100644
--- a/README.sgml
+++ b/README.sgml
@@ -10,7 +10,6 @@
<date>5 October 2003
<ident>
-$Id$
</ident>
<!-- Table of contents -->
diff --git a/man/sis.man b/man/sis.man
index e842acb..336f644 100644
--- a/man/sis.man
+++ b/man/sis.man
@@ -1,6 +1,17 @@
-.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man,v 1.5 2001/12/17 20:52:34 dawes Exp $
+.\" $XFree86$
+.\" $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man,v 1.4 2004/08/05 15:35:30 twini Exp $
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
+#ifdef __servername__
+#define __myservername__ __servername__
+#else
+#define __myservername__ XFree86
+#endif
+#ifdef __xconfigfile__
+#define __myxconfigfile__ __xconfigfile__
+#else
+#define __myxconfigfile__ XF86Config
+#endif
.TH SIS __drivermansuffix__ __vendorversion__
.SH NAME
sis \- SiS video driver
@@ -14,7 +25,7 @@ sis \- SiS video driver
.fi
.SH DESCRIPTION
.B sis
-is an __xservername__ driver for SiS (Silicon Integrated Systems) video chips. The
+is an __myservername__ driver for SiS (Silicon Integrated Systems) video chips. The
driver is accelerated, and provides support for colordepths of 8, 16 and 24 bpp.
XVideo, Render and other extensions are supported as well.
.SH SUPPORTED HARDWARE
@@ -30,9 +41,9 @@ driver supports PCI and AGP video cards based on the following chipsets:
.B SiS630/730
.B SiS315/H/PRO
.B SiS550/551/552
-.B SiS650/651/M650/661FX/M661FX/M661MX/740/741
+.B SiS650/651/M650/661FX/M661FX/M661MX/740/741/741GX/M741
.B SiS330 (Xabre)
-.B SiS760
+.B SiS760/M760
.PP
In the following text, the following terms are used:
.PP
@@ -43,11 +54,10 @@ for SiS5597/5598, 530/620 and 6326/AGP/DVD
for SiS300/305, 540 and 630/730
.PP
.B 315/330 series
-for SiS315/H/PRO, 55x and (M)65x/(M)661xX/74x, 330, 760
+for SiS315, 55x and (M)65x/(M)661xX/74x(GX), 330, 760
.PP
-Note: Support for 661FX, M661FX, M661MX, 741 and 760 is untested.
.SH CONFIGURATION DETAILS
-Please refer to __xconfigfile__(__filemansuffix__) for general configuration
+Please refer to __myxconfigfile__(__filemansuffix__) for general configuration
details. This section only covers configuration details specific to this
driver.
.PP
@@ -204,12 +214,12 @@ The driver supports the following video bridges:
.B SiS301
.B SiS301B(-DH)
.B SiS301C
-.B SiS301LV(X)
-.B SiS302LV
+.B SiS301LV
+.B SiS302(E)LV
.PP
-Instead of a video bridge, some machines have a
+Instead of a video bridge, some machines have a third party
.B LVDS
-transmitter to control LCD panels, and a
+transmitter to control LCD panels, and/or a
.B "Chrontel 7005"
or
.B "7019"
@@ -217,36 +227,38 @@ for TV output. All these are supported as well.
.PP
About TV output
.PP
-On the SiS301 and the Chrontel 7005, only resolutions up to 800x600
-are supported. On all others, resolutions up to 1024x768 are supported.
-However, due to a hardware bug, Xvideo might be distorted on SiS video
-bridges if running NTSC or PAL-M at 1024x768.
+The driver fully supports standard (PAL, NTSC, PAL-N, PAL-M) S-video or
+composite output as well as high definition TV (HDTV) output via YPbPr plugs.
+For more information on HDTV, please consult the author's website.
+.PP
+As regards S-video and CVBS output, the SiS301 and the Chrontel 7005 only
+support resolutions up to 800x600. All others support resolutions up to
+1024x768. However, due to a hardware bug, Xvideo might be distorted on SiS
+video bridges if running NTSC or PAL-M at 1024x768.
.PP
About XVideo support
.PP
XVideo is supported on all chipsets of both families. However, there
are some differences in hardware features which cause limitations.
-The 300 series as well as the SiS55x, M650, 651, 661FX, M661FX, and
-741 support two video overlays. The SiS315/H/PRO, 650/740 and 330 support
-only one such overlay. On chips with two overlays, one overlay is used
-for CRT1, the other for CRT2. On the other chipsets, the option
+The 300 series as well as the SiS55x, M650, 651, 661FX, M661FX, M661MX,
+741, 741GX, M741, 760, M760 support two video overlays. The SiS315/H/PRO,
+650/740 and 330 support only one such overlay. On chips with two overlays,
+one overlay is used for CRT1, the other for CRT2. On the other chipsets,
+the option
.B \*qXvOnCRT2\*q
can be used to select the desired output channel.
.PP
About Merged Framebuffer support
.PP
-This mode is strongly recommended over Xinerama. Please see
-http://www.winischhofer.net/linuxsisvga.shtml for detailed
+Merged framebuffer mode is similar to dual head/Xinerama mode, but has a
+few advantages which make me recommend it strongly over Xinerama. Please
+see http://www.winischhofer.net/linuxsisvga.shtml for detailed
information.
.PP
About dual-head support
.PP
-Dual head mode has some limitations as regards color depth and
-resolution. Due to memory bandwidth limits, CRT1 might have a
-reduced maximum refresh rate if running on higher resolutions than
-1280x1024.
-.PP
-Colordepth 8 is not supported when running in dual head mode.
+Dual head mode with or without Xinerama is fully supported. Note that
+colordepth 8 is not supported in dual head mode.
.PP
The following driver
.B Options
@@ -300,7 +312,8 @@ Force display type to one of:
.B NONE
will disable CRT2. The SVIDEO, COMPOSITE, SVIDEO+COMPOSITE and SCART
parameters are for SiS video bridges only and can be used to force the
-driver to use a specific TV output connector (if present).
+driver to use a specific TV output connector (if present). For further
+parameters, see the author's website.
Default: auto detect.
.TP
.BI "Option \*qCRT2Gamma\*q \*q" boolean \*q
@@ -361,10 +374,10 @@ more information.
.PP
.I "3. 300 series specific information"
.PP
-DRI is supported on the 300 series only. On Linux, DRI requires the
-kernel's SiS framebuffer driver (
+DRI is supported on the 300 series only. On Linux, prior to kernel 2.6.3,
+DRI requires the kernel's SiS framebuffer driver (
.B sisfb
-) and some other modules which come with either the kernel or __xservername__.
+) and some other modules which come with either the kernel or the X server.
.PP
Sisfb takes care of memory management for texture data. In order to
prevent the X Server and sisfb from overwriting each other's data,
@@ -377,6 +390,7 @@ driver. If you start sisfb with a valid mode (ie you gain a graphical console),
the X driver can communicate with sisfb and doesn't require any
manual configuration for finding out about the video memory it is allowed
to use.
+.PP
However, if you are running a 2.4 series Linux kernel and use sisfb for
video memory management only, ie you started sisfb with mode=none and still
have a text mode console, there is no communication between sisfb and the
@@ -399,6 +413,10 @@ If you started sisfb without the mem argument, sisfb will reserve
If you intend to use DRI, I recommend setting the total video memory in
the BIOS to 64MB in order to at least overcome the lack of memory swap
functions.
+.PP
+As of Linux 2.6.3 and under *BSD, sisfb is not required for memory management.
+Hence, this option is mandatory on such systems not running sisfb to decide
+how much memory X should reserve for DRI.
.TP
.BI "Option \*qDRI\*q \*q" boolean \*q
This option allows enabling or disabling DRI. By default, DRI is on.
@@ -409,7 +427,11 @@ The amount is to be specified in megabyte, the default is 8.
.SH "KNOWN BUGS"
none.
.SH "SEE ALSO"
+#ifdef __xservername__
__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__)
+#else
+XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__)
+#endif
.PP
.B "http://www.winischhofer.net/linuxsisvga.shtml"
for more information and updates
diff --git a/src/300vtbl.h b/src/300vtbl.h
index 5c418bd..a3e5e6b 100644
--- a/src/300vtbl.h
+++ b/src/300vtbl.h
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/300vtbl.h,v 1.5 2004/08/10 21:57:20 twini Exp $ */
/*
* Register settings for SiS 300 series
*
@@ -34,7 +35,7 @@
* * 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
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -75,93 +76,93 @@ static const SiS_StStruct SiS300_SModeIDTable[] =
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) */
+ {0x6a,0x2212,0x0102,SIS_RI_800x600, 0x00,0x00,0x00,0x00,0x00,-1}, /* 800x600x? */
+ {0x2e,0x0a1b,0x0101,SIS_RI_640x480, 0x00,0x00,0x00,0x00,0x08,-1},
+ {0x2f,0x021b,0x0100,SIS_RI_640x400, 0x00,0x00,0x00,0x00,0x10,-1}, /* 640x400x8 */
+ {0x30,0x2a1b,0x0103,SIS_RI_800x600, 0x00,0x00,0x00,0x00,0x00,-1},
+ {0x31,0x4a1b,0x0000,SIS_RI_720x480, 0x00,0x00,0x00,0x00,0x11,-1}, /* 720x480x8 */
+ {0x32,0x6a1b,0x0000,SIS_RI_720x576, 0x00,0x00,0x00,0x00,0x12,-1}, /* 720x576x8 */
+ {0x33,0x4a1d,0x0000,SIS_RI_720x480, 0x00,0x00,0x00,0x00,0x11,-1}, /* 720x480x16 */
+ {0x34,0x6a1d,0x0000,SIS_RI_720x576, 0x00,0x00,0x00,0x00,0x12,-1}, /* 720x576x16 */
+ {0x35,0x4a1f,0x0000,SIS_RI_720x480, 0x00,0x00,0x00,0x00,0x11,-1}, /* 720x480x32 */
+ {0x36,0x6a1f,0x0000,SIS_RI_720x576, 0x00,0x00,0x00,0x00,0x12,-1}, /* 720x576x32 */
+ {0x37,0x0212,0x0104,SIS_RI_1024x768, 0x00,0x00,0x00,0x00,0x13,-1}, /* 1024x768x? */
+ {0x38,0x0a1b,0x0105,SIS_RI_1024x768, 0x00,0x00,0x00,0x00,0x13,-1}, /* 1024x768x8 */
+ {0x3a,0x0e3b,0x0107,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a,-1}, /* 1280x1024x8 */
+ {0x3c,0x063b,0x0130,SIS_RI_1600x1200,0x00,0x00,0x00,0x00,0x1e,-1},
+ {0x3d,0x067d,0x0131,SIS_RI_1600x1200,0x00,0x00,0x00,0x00,0x1e,-1},
+ {0x40,0x921c,0x010d,SIS_RI_320x200, 0x00,0x00,0x00,0x00,0x23,-1}, /* 320x200x15 */
+ {0x41,0x921d,0x010e,SIS_RI_320x200, 0x00,0x00,0x00,0x00,0x23,-1}, /* 320x200x16 */
+ {0x43,0x0a1c,0x0110,SIS_RI_640x480, 0x00,0x00,0x00,0x00,0x08,-1},
+ {0x44,0x0a1d,0x0111,SIS_RI_640x480, 0x00,0x00,0x00,0x00,0x08,-1},
+ {0x46,0x2a1c,0x0113,SIS_RI_800x600, 0x00,0x00,0x00,0x00,0x00,-1}, /* 800x600x15 */
+ {0x47,0x2a1d,0x0114,SIS_RI_800x600, 0x00,0x00,0x00,0x00,0x00,-1}, /* 800x600x16 */
+ {0x49,0x0a3c,0x0116,SIS_RI_1024x768, 0x00,0x00,0x00,0x00,0x13,-1},
+ {0x4a,0x0a3d,0x0117,SIS_RI_1024x768, 0x00,0x00,0x00,0x00,0x13,-1},
+ {0x4c,0x0e7c,0x0119,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a,-1},
+ {0x4d,0x0e7d,0x011a,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a,-1},
+ {0x50,0x921b,0x0132,SIS_RI_320x240, 0x00,0x00,0x00,0x00,0x24,-1}, /* 320x240x8 */
+ {0x51,0xb21b,0x0133,SIS_RI_400x300, 0x00,0x00,0x00,0x00,0x25,-1}, /* 400x300x8 */
+ {0x52,0x921b,0x0134,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x26,-1}, /* 512x384x8 */
+ {0x56,0x921d,0x0135,SIS_RI_320x240, 0x00,0x00,0x00,0x00,0x24,-1}, /* 320x240x16 */
+ {0x57,0xb21d,0x0136,SIS_RI_400x300, 0x00,0x00,0x00,0x00,0x25,-1}, /* 400x300x16 */
+ {0x58,0x921d,0x0137,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x26,-1}, /* 512x384x16 */
+ {0x59,0x921b,0x0138,SIS_RI_320x200, 0x00,0x00,0x00,0x00,0x23,-1}, /* 320x200x8 */
+ {0x5c,0x921f,0x0000,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x26,-1}, /* 512x384x32 */
+ {0x5d,0x021d,0x0139,SIS_RI_640x400, 0x00,0x00,0x00,0x00,0x10,-1}, /* 640x400x16 */
+ {0x5e,0x021f,0x0000,SIS_RI_640x400, 0x00,0x00,0x00,0x00,0x10,-1}, /* 640x400x32 */
+ {0x62,0x0a3f,0x013a,SIS_RI_640x480, 0x00,0x00,0x00,0x00,0x08,-1},
+ {0x63,0x2a3f,0x013b,SIS_RI_800x600, 0x00,0x00,0x00,0x00,0x00,-1}, /* 800x600x32 */
+ {0x64,0x0a7f,0x013c,SIS_RI_1024x768, 0x00,0x00,0x00,0x00,0x13,-1},
+ {0x65,0x0eff,0x013d,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a,-1},
+ {0x66,0x06ff,0x013e,SIS_RI_1600x1200,0x00,0x00,0x00,0x00,0x1e,-1},
+ {0x68,0x067b,0x013f,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x27,-1},
+ {0x69,0x06fd,0x0140,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x27,-1},
+ {0x6b,0x07ff,0x0000,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x27,-1},
+ {0x6c,0x067b,0x0000,SIS_RI_2048x1536,0x00,0x00,0x00,0x00,0x28,-1}, /* 2048x1536x8 - not in BIOS! */
+ {0x6d,0x06fd,0x0000,SIS_RI_2048x1536,0x00,0x00,0x00,0x00,0x28,-1}, /* 2048x1536x16 - not in BIOS! */
+ {0x70,0x6a1b,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x00,0x2d,-1}, /* 800x480x8 */
+ {0x71,0x4a1b,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x30,-1}, /* 1024x576x8 */
+ {0x74,0x4a1d,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x30,-1}, /* 1024x576x16 */
+ {0x75,0x0e3d,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x33,-1}, /* 1280x720x16 */
+ {0x76,0x6a1f,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x00,0x2d,-1}, /* 800x480x32 */
+ {0x77,0x4a3f,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x30,-1}, /* 1024x576x32 */
+ {0x78,0x0eff,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x33,-1}, /* 1280x720x32 */
+ {0x79,0x0e3b,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x33,-1}, /* 1280x720x8 */
+ {0x7a,0x6a1d,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x00,0x2d,-1}, /* 800x480x16 */
+ {0x7c,0x0a3b,0x0000,SIS_RI_1280x960, 0x00,0x00,0x00,0x00,0x29,-1}, /* 1280x960x8 */
+ {0x7d,0x0a7d,0x0000,SIS_RI_1280x960, 0x00,0x00,0x00,0x00,0x29,-1}, /* 1280x960x16 */
+ {0x7e,0x0aff,0x0000,SIS_RI_1280x960, 0x00,0x00,0x00,0x00,0x29,-1}, /* 1280x960x32 */
+ {0x20,0x4a1b,0x0000,SIS_RI_1024x600, 0x00,0x00,0x00,0x00,0x2b,-1}, /* 1024x600 */
+ {0x21,0x4a3d,0x0000,SIS_RI_1024x600, 0x00,0x00,0x00,0x00,0x2b,-1},
+ {0x22,0x4a7f,0x0000,SIS_RI_1024x600, 0x00,0x00,0x00,0x00,0x2b,-1},
+ {0x23,0x4a1b,0x0000,SIS_RI_1152x768, 0x00,0x00,0x00,0x00,0x2c,-1}, /* 1152x768 */
+ {0x24,0x4a3d,0x0000,SIS_RI_1152x768, 0x00,0x00,0x00,0x00,0x2c,-1},
+ {0x25,0x4a7f,0x0000,SIS_RI_1152x768, 0x00,0x00,0x00,0x00,0x2c,-1},
+ {0x29,0x4e1b,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x36,-1}, /* 1152x864 */
+ {0x2a,0x4e3d,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x36,-1},
+ {0x2b,0x4e7f,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x36,-1},
+ {0x39,0x6a1b,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x38,-1}, /* 848x480 */
+ {0x3b,0x6a3d,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x38,-1},
+ {0x3e,0x6a7f,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x38,-1},
+ {0x3f,0x6a1b,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x3a,-1}, /* 856x480 */
+ {0x42,0x6a3d,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x3a,-1},
+ {0x45,0x6a7f,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x3a,-1},
+ {0x48,0x6a3b,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x3c,-1}, /* 1360x768 */
+ {0x4b,0x6a7d,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x3c,-1},
+ {0x4e,0x6aff,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x3c,-1},
+ {0x4f,0x921f,0x0000,SIS_RI_320x200, 0x00,0x00,0x00,0x00,0x23,-1}, /* 320x200x32 */
+ {0x53,0x921f,0x0000,SIS_RI_320x240, 0x00,0x00,0x00,0x00,0x24,-1}, /* 320x240x32 */
+ {0x54,0xb21f,0x0000,SIS_RI_400x300, 0x00,0x00,0x00,0x00,0x25,-1}, /* 400x300x32 */
+ {0x55,0x2e3b,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x3d,-1}, /* 1280x768 */
+ {0x5a,0x2e7d,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x3d,-1},
+ {0x5b,0x2eff,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x3d,-1},
+ {0x5f,0x6a1b,0x0000,SIS_RI_768x576, 0x00,0x00,0x00,0x00,0x3e,-1}, /* 768x576x8 */
+ {0x60,0x6a1d,0x0000,SIS_RI_768x576, 0x00,0x00,0x00,0x00,0x3e,-1}, /* 768x576x16 */
+ {0x61,0x6a1f,0x0000,SIS_RI_768x576, 0x00,0x00,0x00,0x00,0x3e,-1}, /* 768x576x32 */
+ {0x67,0x6e3b,0x0000,SIS_RI_1360x1024,0x00,0x00,0x00,0x00,0x3f,-1}, /* 1360x1024x8 (BARCO) */
+ {0x6f,0x6e7d,0x0000,SIS_RI_1360x1024,0x00,0x00,0x00,0x00,0x3f,-1}, /* 1360x1024x16 (BARCO) */
+ {0x72,0x6eff,0x0000,SIS_RI_1360x1024,0x00,0x00,0x00,0x00,0x3f,-1}, /* 1360x1024x32 (BARCO) */
{0xff,0x0000,0xffff,0, 0x00,0x00,0x00,0x00,0x00}
};
@@ -184,8 +185,8 @@ static const SiS_Ext2Struct SiS300_RefIndex[] =
{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 */
+ {0xc06f,0x31,0x01,0x06,0x00,0x31, 720, 480, 0}, /* 11 */
+ {0x006f,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 */
@@ -212,16 +213,16 @@ static const SiS_Ext2Struct SiS300_RefIndex[] =
{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 */
+ {0x0077,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 */
+ {0x0077,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 */
+ {0x0077,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 */
+ {0x0067,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 */
@@ -229,7 +230,7 @@ static const SiS_Ext2Struct SiS300_RefIndex[] =
{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 */
+ {0x006f,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}
};
diff --git a/src/310vtbl.h b/src/310vtbl.h
index 764a5f6..98844ef 100644
--- a/src/310vtbl.h
+++ b/src/310vtbl.h
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/310vtbl.h,v 1.11 2004/08/20 18:57:05 kem Exp $ */
/*
* Register settings for SiS 315/330 series
*
@@ -34,7 +35,7 @@
* * 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
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -75,97 +76,106 @@ static const SiS_StStruct SiS310_SModeIDTable[]=
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}
+ {0x6a,0x2212,0x0102,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00, 3}, /* 800x600x? */
+ {0x2e,0x0a1b,0x0101,SIS_RI_640x480, 0x00,0x00,0x05,0x05,0x08, 2}, /* 640x480x8 */
+ {0x2f,0x0a1b,0x0100,SIS_RI_640x400, 0x00,0x00,0x05,0x05,0x10, 0}, /* 640x400x8 */
+ {0x30,0x2a1b,0x0103,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00, 3}, /* 800x600x8 */
+ {0x31,0x4a1b,0x0000,SIS_RI_720x480, 0x00,0x00,0x06,0x06,0x11,-1}, /* 720x480x8 */
+ {0x32,0x4a1b,0x0000,SIS_RI_720x576, 0x00,0x00,0x06,0x06,0x12,-1}, /* 720x576x8 */
+ {0x33,0x4a1d,0x0000,SIS_RI_720x480, 0x00,0x00,0x06,0x06,0x11,-1}, /* 720x480x16 */
+ {0x34,0x6a1d,0x0000,SIS_RI_720x576, 0x00,0x00,0x06,0x06,0x12,-1}, /* 720x576x16 */
+ {0x35,0x4a1f,0x0000,SIS_RI_720x480, 0x00,0x00,0x06,0x06,0x11,-1}, /* 720x480x32 */
+ {0x36,0x6a1f,0x0000,SIS_RI_720x576, 0x00,0x00,0x06,0x06,0x12,-1}, /* 720x576x32 */
+ {0x37,0x0212,0x0104,SIS_RI_1024x768, 0x00,0x00,0x08,0x07,0x13, 4}, /* 1024x768x? */
+ {0x38,0x0a1b,0x0105,SIS_RI_1024x768, 0x00,0x00,0x08,0x07,0x13, 4}, /* 1024x768x8 */
+ {0x3a,0x0e3b,0x0107,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a, 8}, /* 1280x1024x8 */
+ {0x3c,0x0e3b,0x0130,SIS_RI_1600x1200,0x00,0x00,0x00,0x00,0x1e,10}, /* 1600x1200x8 */
+ {0x3d,0x0e7d,0x0131,SIS_RI_1600x1200,0x00,0x00,0x00,0x00,0x1e,10}, /* 1600x1200x16 */
+ {0x40,0x9a1c,0x010d,SIS_RI_320x200, 0x00,0x00,0x04,0x04,0x25, 0}, /* 320x200x15 */
+ {0x41,0x9a1d,0x010e,SIS_RI_320x200, 0x00,0x00,0x04,0x04,0x25, 0}, /* 320x200x16 */
+ {0x43,0x0a1c,0x0110,SIS_RI_640x480, 0x00,0x00,0x05,0x05,0x08, 2},
+ {0x44,0x0a1d,0x0111,SIS_RI_640x480, 0x00,0x00,0x05,0x05,0x08, 2}, /* 640x480x16 */
+ {0x46,0x2a1c,0x0113,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00, 3},
+ {0x47,0x2a1d,0x0114,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00, 3}, /* 800x600x16 */
+ {0x49,0x0a3c,0x0116,SIS_RI_1024x768, 0x00,0x00,0x00,0x07,0x13, 4},
+ {0x4a,0x0a3d,0x0117,SIS_RI_1024x768, 0x00,0x00,0x08,0x07,0x13, 4}, /* 1024x768x16 */
+ {0x4c,0x0e7c,0x0119,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a, 8},
+ {0x4d,0x0e7d,0x011a,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a, 8}, /* 1280x1024x16 */
+ {0x50,0x9a1b,0x0132,SIS_RI_320x240, 0x00,0x00,0x04,0x04,0x26, 2}, /* 320x240x8 */
+ {0x51,0xba1b,0x0133,SIS_RI_400x300, 0x00,0x00,0x07,0x07,0x27, 3}, /* 400x300x8 */
+ {0x52,0xba1b,0x0134,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x28, 4}, /* 512x384x8 */
+ {0x56,0x9a1d,0x0135,SIS_RI_320x240, 0x00,0x00,0x04,0x04,0x26, 2}, /* 320x240x16 */
+ {0x57,0xba1d,0x0136,SIS_RI_400x300, 0x00,0x00,0x07,0x07,0x27, 3}, /* 400x300x16 */
+ {0x58,0xba1d,0x0137,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x28, 4}, /* 512x384x16 */
+ {0x59,0x9a1b,0x0138,SIS_RI_320x200, 0x00,0x00,0x04,0x04,0x25, 0}, /* 320x200x8 */
+ {0x5a,0x021b,0x0138,SIS_RI_320x240, 0x00,0x00,0x00,0x00,0x3f, 2}, /* 320x240x8 fstn */
+ {0x5b,0x0a1d,0x0135,SIS_RI_320x240, 0x00,0x00,0x00,0x00,0x3f, 2}, /* 320x240x16 fstn */
+ {0x5c,0xba1f,0x0000,SIS_RI_512x384, 0x00,0x00,0x00,0x00,0x28, 4}, /* 512x384x32 */
+ {0x5d,0x0a1d,0x0139,SIS_RI_640x400, 0x00,0x00,0x05,0x07,0x10, 0},
+ {0x5e,0x0a1f,0x0000,SIS_RI_640x400, 0x00,0x00,0x05,0x07,0x10, 0}, /* 640x400x32 */
+ {0x62,0x0a3f,0x013a,SIS_RI_640x480, 0x00,0x00,0x05,0x05,0x08, 2}, /* 640x480x32 */
+ {0x63,0x2a3f,0x013b,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00, 3}, /* 800x600x32 */
+ {0x64,0x0a7f,0x013c,SIS_RI_1024x768, 0x00,0x00,0x08,0x07,0x13, 4}, /* 1024x768x32 */
+ {0x65,0x0eff,0x013d,SIS_RI_1280x1024,0x00,0x00,0x00,0x00,0x1a, 8}, /* 1280x1024x32 */
+ {0x66,0x0eff,0x013e,SIS_RI_1600x1200,0x00,0x00,0x00,0x00,0x1e,10}, /* 1600x1200x32 */
+ {0x68,0x067b,0x013f,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x29,-1}, /* 1920x1440x8 */
+ {0x69,0x06fd,0x0140,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x29,-1}, /* 1920x1440x16 */
+ {0x6b,0x07ff,0x0141,SIS_RI_1920x1440,0x00,0x00,0x00,0x00,0x29,-1}, /* 1920x1440x32 */
+ {0x6c,0x067b,0x0000,SIS_RI_2048x1536,0x00,0x00,0x00,0x00,0x2f,-1}, /* 2048x1536x8 */
+ {0x6d,0x06fd,0x0000,SIS_RI_2048x1536,0x00,0x00,0x00,0x00,0x2f,-1}, /* 2048x1536x16 */
+ {0x6e,0x07ff,0x0000,SIS_RI_2048x1536,0x00,0x00,0x00,0x00,0x2f,-1}, /* 2048x1536x32 */
+ {0x70,0x6a1b,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x07,0x34,-1}, /* 800x480x8 */
+ {0x71,0x4a1b,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x37,-1}, /* 1024x576x8 */
+ {0x74,0x4a1d,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x37,-1}, /* 1024x576x16 */
+ {0x75,0x0a3d,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x3a, 5}, /* 1280x720x16 */
+ {0x76,0x6a1f,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x07,0x34,-1}, /* 800x480x32 */
+ {0x77,0x4a1f,0x0000,SIS_RI_1024x576, 0x00,0x00,0x00,0x00,0x37,-1}, /* 1024x576x32 */
+ {0x78,0x0a3f,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x3a, 5}, /* 1280x720x32 */
+ {0x79,0x0a3b,0x0000,SIS_RI_1280x720, 0x00,0x00,0x00,0x00,0x3a, 5}, /* 1280x720x8 */
+ {0x7a,0x6a1d,0x0000,SIS_RI_800x480, 0x00,0x00,0x07,0x07,0x34,-1}, /* 800x480x16 */
+ {0x7c,0x0e3b,0x0000,SIS_RI_1280x960, 0x00,0x00,0x00,0x00,0x3d,-1}, /* 1280x960x8 */
+ {0x7d,0x0e7d,0x0000,SIS_RI_1280x960, 0x00,0x00,0x00,0x00,0x3d,-1}, /* 1280x960x16 */
+ {0x7e,0x0eff,0x0000,SIS_RI_1280x960, 0x00,0x00,0x00,0x00,0x3d,-1}, /* 1280x960x32 */
+ {0x23,0x0e3b,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x40, 6}, /* 1280x768x8 */
+ {0x24,0x0e7d,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x40, 6}, /* 1280x768x16 */
+ {0x25,0x0eff,0x0000,SIS_RI_1280x768, 0x00,0x00,0x00,0x00,0x40, 6}, /* 1280x768x32 */
+ {0x26,0x0e3b,0x0000,SIS_RI_1400x1050,0x00,0x00,0x00,0x00,0x41, 9}, /* 1400x1050x8 */
+ {0x27,0x0e7d,0x0000,SIS_RI_1400x1050,0x00,0x00,0x00,0x00,0x41, 9}, /* 1400x1050x16 */
+ {0x28,0x0eff,0x0000,SIS_RI_1400x1050,0x00,0x00,0x00,0x00,0x41, 9}, /* 1400x1050x32*/
+ {0x29,0x4e1b,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x43,-1}, /* 1152x864 */
+ {0x2a,0x4e3d,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x43,-1},
+ {0x2b,0x4e7f,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x43,-1},
+ {0x39,0x6a1b,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x45,-1}, /* 848x480 */
+ {0x3b,0x6a3d,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x45,-1},
+ {0x3e,0x6a7f,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x45,-1},
+ {0x3f,0x6a1b,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x47,-1}, /* 856x480 */
+ {0x42,0x6a3d,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x47,-1},
+ {0x45,0x6a7f,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x47,-1},
+ {0x48,0x6a3b,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x49,-1}, /* 1360x768 */
+ {0x4b,0x6a7d,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x49,-1},
+ {0x4e,0x6aff,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x49,-1},
+ {0x4f,0x9a1f,0x0000,SIS_RI_320x200, 0x00,0x00,0x04,0x04,0x25, 0}, /* 320x200x32 */
+ {0x53,0x9a1f,0x0000,SIS_RI_320x240, 0x00,0x00,0x04,0x04,0x26, 2}, /* 320x240x32 */
+ {0x54,0xba1f,0x0000,SIS_RI_400x300, 0x00,0x00,0x07,0x07,0x27, 3}, /* 400x300x32 */
+ {0x5f,0x6a1b,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4a,-1}, /* 768x576 */
+ {0x60,0x6a1d,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4a,-1},
+ {0x61,0x6a3f,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4a,-1},
+ {0x14,0x0e3b,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4b, 7}, /* 1280x800 */
+ {0x15,0x0e7d,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4b, 7},
+ {0x16,0x0eff,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4b, 7},
+ {0x17,0x0e3b,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x4c, 9}, /* 1680x1050 */
+ {0x18,0x0e7d,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x4c, 9},
+ {0x19,0x0eff,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x4c, 9},
+ {0x2c,0x267b,0x0000,SIS_RI_1920x1080,0x00,0x00,0x00,0x00,0x4d,-1}, /* 1920x1080(i) */
+ {0x2d,0x26fd,0x0000,SIS_RI_1920x1080,0x00,0x00,0x00,0x00,0x4d,-1},
+ {0x73,0x27ff,0x0000,SIS_RI_1920x1080,0x00,0x00,0x00,0x00,0x4d,-1},
+ {0x1d,0x6a1b,0x0000,SIS_RI_960x540, 0x00,0x00,0x00,0x00,0x4e,-1}, /* 960x540 */
+ {0x1e,0x6a3d,0x0000,SIS_RI_960x540, 0x00,0x00,0x00,0x00,0x4e,-1},
+ {0x1f,0x6a7f,0x0000,SIS_RI_960x540, 0x00,0x00,0x00,0x00,0x4e,-1},
+ {0x20,0x6a1b,0x0000,SIS_RI_960x600, 0x00,0x00,0x00,0x00,0x4f,-1}, /* 960x600 */
+ {0x21,0x6a3d,0x0000,SIS_RI_960x600, 0x00,0x00,0x00,0x00,0x4f,-1},
+ {0x22,0x6a7f,0x0000,SIS_RI_960x600, 0x00,0x00,0x00,0x00,0x4f,-1},
+ {0xff,0x0000,0x0000,0, 0x00,0x00,0x00,0x00,0x00,-1}
};
static const SiS_Ext2Struct SiS310_RefIndex[]=
@@ -187,8 +197,8 @@ static const SiS_Ext2Struct SiS310_RefIndex[]=
{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 */
+ {0xc06f,0x3c,0x01,0x06,0x13,0x31, 720, 480, 0x30}, /* 0x11 */
+ {0x006f,0x3d,0x03,0x06,0x14,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 */
@@ -222,12 +232,12 @@ static const SiS_Ext2Struct SiS310_RefIndex[]=
{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 */
+ {0x0077,0x32,0x40,0x08,0x18,0x70, 800, 480, 0x30}, /* 0x34 */
+ {0x0047,0x33,0x07,0x08,0x18,0x70, 800, 480, 0x30}, /* 0x35 */
+ {0x0047,0x34,0x0a,0x08,0x18,0x70, 800, 480, 0x30}, /* 0x36 */
+ {0x0077,0x35,0x0b,0x09,0x19,0x71,1024, 576, 0x30}, /* 0x37 */
+ {0x0047,0x36,0x11,0x09,0x19,0x71,1024, 576, 0x30}, /* 0x38 */
+ {0x0047,0x37,0x16,0x09,0x19,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 */
@@ -237,19 +247,88 @@ static const SiS_Ext2Struct SiS310_RefIndex[]=
{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 */
+ {0x0127,0x44,0x19,0x00,0x1a,0x29,1152, 864, 0x30}, /* 0x43 1152x864-75Hz */
+ {0x0127,0x4a,0x1e,0x00,0x1a,0x29,1152, 864, 0x30}, /* 0x44 1152x864-85Hz */
+ {0x0087,0x45,0x57,0x00,0x16,0x39, 848, 480, 0x30}, /* 0x45 848x480-38Hzi */
+ {0xc067,0x46,0x55,0x0b,0x16,0x39, 848, 480, 0x30}, /* 0x46 848x480-60Hz */
+ {0x0087,0x47,0x57,0x00,0x17,0x3f, 856, 480, 0x30}, /* 0x47 856x480-38Hzi */
+ {0xc067,0x48,0x57,0x00,0x17,0x3f, 856, 480, 0x30}, /* 0x48 856x480-60Hz */
+ {0x0067,0x49,0x58,0x0c,0x1b,0x48,1360, 768, 0x30}, /* 0x49 1360x768-60Hz */
+ {0x006f,0x4d,0x03,0x06,0x15,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 */
+ {0x0087,0x51,0x69,0x00,0x00,0x2c,1920,1080, 0x30}, /* 0x4d 1920x1080 60Hzi */
+ {0x0067,0x52,0x6a,0x00,0x1c,0x1d, 960, 540, 0x30}, /* 0x4e 960x540 60Hz */
+ {0x0077,0x53,0x6b,0x0b,0x1d,0x20, 960, 600, 0x30}, /* 0x4f 960x600 60Hz */
{0xffff,0x00,0x00,0x00,0x00,0x00, 0, 0, 0}
};
+#ifdef LINUX_XF86
+static const struct {
+ UCHAR Ext_ModeID; /* ModeID in new ROM */
+ UCHAR Ext_MyModeID; /* corresponding ModeID in my tables (0 = identical) */
+ USHORT Ext_VESAID; /* corresponding VESA ID in new ROM */
+} SiS_EModeIDTable661[] = {
+ { 0x6a, 0x00, 0x0102 },
+ { 0x1d, 0x20, 0x0000 },
+ { 0x1e, 0x21, 0x0000 },
+ { 0x1f, 0x22, 0x0000 },
+ { 0x20, 0x29, 0x0000 },
+ { 0x21, 0x2a, 0x0000 },
+ { 0x22, 0x2b, 0x0000 },
+ { 0x23, 0x00, 0x011c },
+ { 0x24, 0x00, 0x011d },
+ { 0x25, 0x00, 0x011e },
+ { 0x26, 0x00, 0x011f },
+ { 0x27, 0x00, 0x0120 },
+ { 0x28, 0x00, 0x0121 },
+ { 0x2a, 0x14, 0x013d },
+ { 0x2b, 0x15, 0x013e },
+ { 0x2c, 0x16, 0x013f },
+ { 0x2e, 0x00, 0x0101 },
+ { 0x2f, 0x00, 0x0100 },
+ { 0x30, 0x00, 0x0103 },
+ { 0x37, 0x00, 0x0104 },
+ { 0x38, 0x00, 0x0105 },
+ { 0x3a, 0x00, 0x0107 },
+ { 0x3c, 0x00, 0x0125 },
+ { 0x3d, 0x00, 0x0126 },
+ { 0x40, 0x00, 0x010d },
+ { 0x41, 0x00, 0x010e },
+ { 0x43, 0x00, 0x0110 },
+ { 0x44, 0x00, 0x0111 },
+ { 0x46, 0x00, 0x0113 },
+ { 0x47, 0x00, 0x0114 },
+ { 0x49, 0x00, 0x0116 },
+ { 0x4a, 0x00, 0x0117 },
+ { 0x4c, 0x00, 0x0119 },
+ { 0x4d, 0x00, 0x011a },
+ { 0x50, 0x00, 0x0127 },
+ { 0x51, 0x00, 0x0128 },
+ { 0x52, 0x00, 0x0129 },
+ { 0x56, 0x00, 0x012a },
+ { 0x57, 0x00, 0x012b },
+ { 0x58, 0x00, 0x012c },
+ { 0x59, 0x00, 0x012d },
+ { 0x5a, 0x17, 0x012e },
+ { 0x5b, 0x18, 0x012f },
+ { 0x5c, 0x19, 0x0130 },
+ { 0x5d, 0x00, 0x0131 },
+ { 0x62, 0x00, 0x0112 },
+ { 0x63, 0x00, 0x0115 },
+ { 0x64, 0x00, 0x0118 },
+ { 0x65, 0x00, 0x011b },
+ { 0x66, 0x00, 0x0132 },
+ { 0x75, 0x00, 0x013a },
+ { 0x78, 0x00, 0x013b },
+ { 0x79, 0x00, 0x013c },
+ { 0x7b, 0x7c, 0x0136 },
+ { 0x7c, 0x7d, 0x0137 },
+ { 0x7d, 0x7e, 0x0138 },
+ { 0xff, 0xff, 0xffff }
+};
+#endif
+
static const SiS_CRT1TableStruct SiS310_CRT1Table[]=
{
{{0x2d,0x27,0x28,0x90,0x2c,0x80,0xbf,0x1f,
@@ -509,7 +588,16 @@ static const SiS_CRT1TableStruct SiS310_CRT1Table[]=
0x21}}, /* 0x4f */
{{0x15,0xd1,0xd1,0x99,0xe2,0x19,0x3d,0x10, /* 1680x1050-60 */
0x1a,0x8d,0x19,0x19,0x3e,0x2f,0x01,0x0c,
- 0x20}} /* 0x50 */
+ 0x20}}, /* 0x50 */
+ {{0x0e,0xef,0xef,0x92,0xfe,0x03,0x30,0xf0, /* 1920x1080-60i */
+ 0x1e,0x83,0x1b,0x1c,0x31,0x00,0x01,0x00,
+ 0x61}}, /* 0x51 */
+ {{0x85,0x77,0x77,0x89,0x7d,0x01,0x31,0xf0, /* 960x540-60 */
+ 0x1e,0x84,0x1b,0x1c,0x32,0x00,0x00,0x02,
+ 0x41}}, /* 0x52 */
+ {{0x87,0x77,0x77,0x8b,0x81,0x0b,0x68,0xf0, /* 960x600-60 */
+ 0x5a,0x80,0x57,0x57,0x69,0x00,0x00,0x02,
+ 0x01}} /* 0x53 */
};
static const SiS_MCLKDataStruct SiS310_MCLKData_0_315[] =
@@ -572,6 +660,30 @@ static const SiS_MCLKDataStruct SiS310_MCLKData_0_760[] =
{ 0x37,0x21,0x82,200}
};
+static const SiS_MCLKDataStruct SiS310_MCLKData_0_761[] =
+{
+ { 0x37,0x22,0x82,133}, /* Preliminary */
+ { 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_0_340[] =
+{
+ { 0x79,0x06,0x01,250},
+ { 0x7c,0x08,0x01,200},
+ { 0x7c,0x08,0x80,200},
+ { 0x79,0x06,0x80,250},
+ { 0x29,0x01,0x81,300},
+ { 0x29,0x01,0x81,300},
+ { 0x29,0x01,0x81,300},
+ { 0x29,0x01,0x81,300}
+};
+
static const SiS_MCLKDataStruct SiS310_MCLKData_1[] = /* ECLK */
{
{ 0x29,0x21,0x82,150},
@@ -584,6 +696,18 @@ static const SiS_MCLKDataStruct SiS310_MCLKData_1[] = /* ECLK */
{ 0x37,0x22,0x82,133}
};
+static const SiS_MCLKDataStruct SiS310_MCLKData_1_340[] =
+{
+ { 0x7c,0x08,0x01,200},
+ { 0x7c,0x08,0x01,200},
+ { 0x7c,0x08,0x80,200},
+ { 0x79,0x06,0x80,250},
+ { 0x29,0x01,0x81,300},
+ { 0x29,0x01,0x81,300},
+ { 0x29,0x01,0x81,300},
+ { 0x29,0x01,0x81,300}
+};
+
static SiS_VCLKDataStruct SiS310_VCLKData[]=
{
{ 0x1b,0xe1, 25}, /* 0x00 */
@@ -685,7 +809,16 @@ static SiS_VCLKDataStruct SiS310_VCLKData[]=
{ 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) */
+ { 0x5a,0x64, 65}, /* 0x63 1280x720 (LCD LVDS) */
+ { 0x70,0x28, 90}, /* 0x64 1152x864@60 */
+ { 0x41,0xc4, 32}, /* 0x65 848x480@60 */
+ { 0x5c,0xc6, 32}, /* 0x66 856x480@60 */
+ { 0x76,0xe7, 27}, /* 0x67 720x480@60 */
+ { 0x5f,0xc6, 33}, /* 0x68 720/768x576@60 */
+ { 0x52,0x27, 75}, /* 0x69 1920x1080i 60Hz interlaced */
+ { 0x7c,0x6b, 38}, /* 0x6a 960x540@60 */
+ { 0xe3,0x56, 41}, /* 0x6b 960x600@60 */
+ { 0x45,0x25, 83} /* 0x6c 1280x800 */
};
static SiS_VBVCLKDataStruct SiS310_VBVCLKData[]=
@@ -787,15 +920,24 @@ static SiS_VBVCLKDataStruct SiS310_VBVCLKData[]=
{ 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? */
+ { 0x70,0x29, 81}, /* 0x5b 1280x768 LCD (TMDS) */
+ { 0xce,0x1e, 73}, /* 0x5c 1280x800_2 LCD (SiS LVDS) - (CRT1: 45 25 83) */
{ 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 */
+ { 0x52,0x27, 75}, /* 0x5f 1280x720 (TMDS + HDTV) (correct) */
+ { 0xc8,0x48, 77}, /* 0x60 1280x768_2 (SiS LVDS) */
+ { 0x31,0x42, 79}, /* 0x61 1280x768_3 (SiS LVDS) - temp */
{ 0, 0, 0}, /* 0x62 - custom (will be filled out at run-time) */
- { 0x5a,0x64, 65} /* 0x63 1280x720 (LCD LVDS) */
+ { 0x9c,0x62, 69}, /* 0x63 1280x720 (SiS LVDS) */
+ { 0x70,0x28, 90}, /* 0x64 1152x864@60 */
+ { 0x41,0xc4, 32}, /* 0x65 848x480@60 */
+ { 0x5c,0xc6, 32}, /* 0x66 856x480@60 */
+ { 0x76,0xe7, 27}, /* 0x67 720x480@60 */
+ { 0x5f,0xc6, 33}, /* 0x68 720/768x576@60 */
+ { 0x52,0x27, 75}, /* 0x69 1920x1080i 60Hz interlaced (UNUSED) */
+ { 0x7c,0x6b, 38}, /* 0x6a 960x540@60 */
+ { 0xe3,0x56, 41}, /* 0x6b 960x600@60 */
+ { 0x9c,0x62, 69} /* 0x6c 1280x800 (SiS TMDS) (special) */
};
static const DRAM4Type SiS310_SR15[8] = {
diff --git a/src/init.c b/src/init.c
index f94f89e..c58341a 100644
--- a/src/init.c
+++ b/src/init.c
@@ -1,8 +1,9 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/init.c,v 1.15 2004/08/20 18:57:05 kem Exp $ */
/*
* Mode initializing code (CRT1 section) for
* for SiS 300/305/540/630/730 and
- * SiS 315/550/650/M650/651/661FX/M661FX/740/741/M741/330/660/M660/760/M760
+ * SiS 315/550/650/M650/651/661FX/M661FX/740/741(GX)/M741/330/660/M660/760/M760
* (Universal module for Linux kernel framebuffer and XFree86 4.x)
*
* Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
@@ -37,7 +38,7 @@
* * 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
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -81,6 +82,7 @@
/* POINTER INITIALIZATION */
/*********************************************/
+#if defined(SIS300) || defined(SIS315H)
static void
InitCommonPointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
@@ -133,8 +135,8 @@ InitCommonPointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
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_LCD1280x800_2Data = SiS_LCD1280x800_2Data;
SiS_Pr->SiS_LCD1280x960Data = SiS_LCD1280x960Data;
SiS_Pr->SiS_StLCD1400x1050Data = SiS_StLCD1400x1050Data;
SiS_Pr->SiS_ExtLCD1400x1050Data = SiS_ExtLCD1400x1050Data;
@@ -207,6 +209,7 @@ InitCommonPointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_Pr->SiS_PanelMinLVDS = Panel_800x600; /* lowest value LVDS/LCDA */
SiS_Pr->SiS_PanelMin301 = Panel_1024x768; /* lowest value 301 */
}
+#endif
#ifdef SIS300
static void
@@ -428,7 +431,11 @@ InitTo310Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_Pr->SiS_EModeIDTable = SiS310_EModeIDTable;
SiS_Pr->SiS_RefIndex = (SiS_Ext2Struct *)SiS310_RefIndex;
SiS_Pr->SiS_CRT1Table = SiS310_CRT1Table;
- if(HwInfo->jChipType >= SIS_760) {
+ if(HwInfo->jChipType >= SIS_340) {
+ SiS_Pr->SiS_MCLKData_0 = SiS310_MCLKData_0_340; /* 340 */
+ } else if(HwInfo->jChipType >= SIS_761) {
+ SiS_Pr->SiS_MCLKData_0 = SiS310_MCLKData_0_761; /* 761 - preliminary */
+ } else 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 */
@@ -439,7 +446,11 @@ InitTo310Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
} else {
SiS_Pr->SiS_MCLKData_0 = SiS310_MCLKData_0_315; /* 315 */
}
- SiS_Pr->SiS_MCLKData_1 = SiS310_MCLKData_1;
+ if(HwInfo->jChipType >= SIS_340) {
+ SiS_Pr->SiS_MCLKData_1 = SiS310_MCLKData_1_340;
+ } else {
+ SiS_Pr->SiS_MCLKData_1 = SiS310_MCLKData_1;
+ }
SiS_Pr->SiS_VCLKData = SiS310_VCLKData;
SiS_Pr->SiS_VBVCLKData = SiS310_VBVCLKData;
@@ -589,6 +600,8 @@ SiSInitPtr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
case SIS_741:
case SIS_660:
case SIS_760:
+ case SIS_761:
+ case SIS_340:
InitTo310Pointer(SiS_Pr, HwInfo);
break;
#endif
@@ -625,104 +638,90 @@ SiS_GetModeID(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay,
}
break;
case 400:
- if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth];
+ if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth >= 800) && (LCDwidth >= 600))) {
+ if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth];
+ }
break;
case 512:
- if(VDisplay == 384) ModeIndex = ModeIndex_512x384[Depth];
+ if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth >= 1024) && (LCDwidth >= 768))) {
+ if(VDisplay == 384) ModeIndex = ModeIndex_512x384[Depth];
+ }
break;
case 640:
if(VDisplay == 480) ModeIndex = ModeIndex_640x480[Depth];
else if(VDisplay == 400) ModeIndex = ModeIndex_640x400[Depth];
break;
case 720:
- if(!(VBFlags & CRT1_LCDA)) {
- if(VDisplay == 480) ModeIndex = ModeIndex_720x480[Depth];
- else if(VDisplay == 576) ModeIndex = ModeIndex_720x576[Depth];
- }
+ if(VDisplay == 480) ModeIndex = ModeIndex_720x480[Depth];
+ else if(VDisplay == 576) ModeIndex = ModeIndex_720x576[Depth];
break;
case 768:
- if(!(VBFlags & CRT1_LCDA)) {
- if(VDisplay == 576) ModeIndex = ModeIndex_768x576[Depth];
- }
+ if(VDisplay == 576) ModeIndex = ModeIndex_768x576[Depth];
break;
case 800:
- if(VDisplay == 600) ModeIndex = ModeIndex_800x600[Depth];
- else if(!(VBFlags & CRT1_LCDA)) {
- if(VDisplay == 480) ModeIndex = ModeIndex_800x480[Depth];
- }
+ if(VDisplay == 600) ModeIndex = ModeIndex_800x600[Depth];
+ else if(VDisplay == 480) ModeIndex = ModeIndex_800x480[Depth];
break;
case 848:
- if(!(VBFlags & CRT1_LCDA)) {
- if(VDisplay == 480) ModeIndex = ModeIndex_848x480[Depth];
- }
+ if(VDisplay == 480) ModeIndex = ModeIndex_848x480[Depth];
break;
case 856:
- if(!(VBFlags & CRT1_LCDA)) {
- if(VDisplay == 480) ModeIndex = ModeIndex_856x480[Depth];
+ if(VDisplay == 480) ModeIndex = ModeIndex_856x480[Depth];
+ break;
+ case 960:
+ if(VGAEngine == SIS_315_VGA) {
+ if(VDisplay == 540) ModeIndex = ModeIndex_960x540[Depth];
+ else if(VDisplay == 600) ModeIndex = ModeIndex_960x600[Depth];
}
break;
case 1024:
- if(VDisplay == 768) ModeIndex = ModeIndex_1024x768[Depth];
- else if(!(VBFlags & CRT1_LCDA)) {
- if(VDisplay == 576) ModeIndex = ModeIndex_1024x576[Depth];
- else if(VGAEngine == SIS_300_VGA) {
- if(VDisplay == 600) ModeIndex = ModeIndex_1024x600[Depth];
- }
+ if(VDisplay == 576) ModeIndex = ModeIndex_1024x576[Depth];
+ else if(VDisplay == 768) ModeIndex = ModeIndex_1024x768[Depth];
+ else if(VGAEngine == SIS_300_VGA) {
+ if(VDisplay == 600) ModeIndex = ModeIndex_1024x600[Depth];
}
break;
case 1152:
- if(!(VBFlags & CRT1_LCDA)) {
- if(VDisplay == 864) ModeIndex = ModeIndex_1152x864[Depth];
- else if(VGAEngine == SIS_300_VGA) {
- if(VDisplay == 768) ModeIndex = ModeIndex_1152x768[Depth];
- }
+ if(VDisplay == 864) ModeIndex = ModeIndex_1152x864[Depth];
+ if(VGAEngine == SIS_300_VGA) {
+ if(VDisplay == 768) ModeIndex = ModeIndex_1152x768[Depth];
}
break;
case 1280:
- 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];
+ switch(VDisplay) {
+ case 720:
+ ModeIndex = ModeIndex_1280x720[Depth];
+ break;
+ case 768:
+ if(VGAEngine == SIS_300_VGA) {
+ ModeIndex = ModeIndex_300_1280x768[Depth];
+ } else {
+ ModeIndex = ModeIndex_310_1280x768[Depth];
}
- } else if(!(VBFlags & CRT1_LCDA)) {
- if(VDisplay == 960) ModeIndex = ModeIndex_1280x960[Depth];
- else if(VDisplay == 768) {
- if(VGAEngine == SIS_300_VGA) {
- ModeIndex = ModeIndex_300_1280x768[Depth];
- } else {
- ModeIndex = ModeIndex_310_1280x768[Depth];
- }
+ break;
+ case 800:
+ if(VGAEngine == SIS_315_VGA) {
+ ModeIndex = ModeIndex_1280x800[Depth];
}
+ break;
+ case 960:
+ ModeIndex = ModeIndex_1280x960[Depth];
+ break;
+ case 1024:
+ ModeIndex = ModeIndex_1280x1024[Depth];
+ break;
}
break;
case 1360:
- if(!(VBFlags & CRT1_LCDA)) {
- if(VDisplay == 768) ModeIndex = ModeIndex_1360x768[Depth];
- else if(VGAEngine == SIS_300_VGA) {
- if(VDisplay == 1024) ModeIndex = ModeIndex_300_1360x1024[Depth];
- }
- }
+ if(VDisplay == 768) ModeIndex = ModeIndex_1360x768[Depth];
+ if(VGAEngine == SIS_300_VGA) {
+ if(VDisplay == 1024) ModeIndex = ModeIndex_300_1360x1024[Depth];
+ }
break;
case 1400:
if(VGAEngine == SIS_315_VGA) {
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];
- }
+ ModeIndex = ModeIndex_1400x1050[Depth];
}
}
break;
@@ -735,19 +734,18 @@ SiS_GetModeID(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay,
}
break;
case 1920:
- if(!(VBFlags & CRT1_LCDA)) {
- if(VDisplay == 1440) ModeIndex = ModeIndex_1920x1440[Depth];
+ if(VDisplay == 1440) ModeIndex = ModeIndex_1920x1440[Depth];
+ else if(VGAEngine == SIS_315_VGA) {
+ if(VDisplay == 1080) ModeIndex = ModeIndex_1920x1080[Depth];
}
break;
case 2048:
- if(!(VBFlags & CRT1_LCDA)) {
- if(VDisplay == 1536) {
- if(VGAEngine == SIS_300_VGA) {
- ModeIndex = ModeIndex_300_2048x1536[Depth];
- } else {
- ModeIndex = ModeIndex_310_2048x1536[Depth];
- }
- }
+ if(VDisplay == 1536) {
+ if(VGAEngine == SIS_300_VGA) {
+ ModeIndex = ModeIndex_300_2048x1536[Depth];
+ } else {
+ ModeIndex = ModeIndex_310_2048x1536[Depth];
+ }
}
break;
}
@@ -786,7 +784,7 @@ SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay,
case 512:
if(CustomT != CUT_PANEL848) {
if(!((VGAEngine == SIS_300_VGA) && (VBFlags & VB_TRUMPION))) {
- if(LCDwidth != 1024 || LCDheight != 600) {
+ if(LCDwidth >= 1024 && LCDwidth != 1152 && LCDheight >= 768) {
if(VDisplay == 384) {
ModeIndex = ModeIndex_512x384[Depth];
}
@@ -829,9 +827,6 @@ 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:
@@ -865,74 +860,115 @@ SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay,
else if(VDisplay == 240) ModeIndex = ModeIndex_320x240[Depth];
break;
case 400:
- if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth];
+ if(LCDwidth >= 800 && LCDheight >= 600) {
+ if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth];
+ }
break;
case 512:
- if(VDisplay == 384) ModeIndex = ModeIndex_512x384[Depth];
+ if(LCDwidth >= 1024 && LCDheight >= 768 && LCDwidth != 1152) {
+ if(VDisplay == 384) ModeIndex = ModeIndex_512x384[Depth];
+ }
break;
case 640:
if(VDisplay == 480) ModeIndex = ModeIndex_640x480[Depth];
else if(VDisplay == 400) ModeIndex = ModeIndex_640x400[Depth];
break;
+ case 720:
+ if(VGAEngine == SIS_315_VGA) {
+ if(VDisplay == 480) ModeIndex = ModeIndex_720x480[Depth];
+ else if(VDisplay == 576) ModeIndex = ModeIndex_720x576[Depth];
+ }
+ break;
+ case 768:
+ if(VGAEngine == SIS_315_VGA) {
+ if(VDisplay == 576) ModeIndex = ModeIndex_768x576[Depth];
+ }
+ break;
case 800:
if(VDisplay == 600) ModeIndex = ModeIndex_800x600[Depth];
+ if(VGAEngine == SIS_315_VGA) {
+ if(VDisplay == 480) ModeIndex = ModeIndex_800x480[Depth];
+ }
+ break;
+ case 848:
+ if(VGAEngine == SIS_315_VGA) {
+ if(VDisplay == 480) ModeIndex = ModeIndex_848x480[Depth];
+ }
+ break;
+ case 856:
+ if(VGAEngine == SIS_315_VGA) {
+ if(VDisplay == 480) ModeIndex = ModeIndex_856x480[Depth];
+ }
+ break;
+ case 960:
+ if(VGAEngine == SIS_315_VGA) {
+ if(VDisplay == 540) ModeIndex = ModeIndex_960x540[Depth];
+ else if(VDisplay == 600) ModeIndex = ModeIndex_960x600[Depth];
+ }
break;
case 1024:
if(VDisplay == 768) ModeIndex = ModeIndex_1024x768[Depth];
+ if(VGAEngine == SIS_315_VGA) {
+ if(VDisplay == 576) ModeIndex = ModeIndex_1024x576[Depth];
+ }
+ break;
+ case 1152:
+ if(VGAEngine == SIS_315_VGA) {
+ if(VDisplay == 864) ModeIndex = ModeIndex_1152x864[Depth];
+ }
break;
case 1280:
- if(VDisplay == 1024) ModeIndex = ModeIndex_1280x1024[Depth];
- else if(VDisplay == 768) {
- 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 {
- ModeIndex = ModeIndex_310_1280x768[Depth];
- }
- }
- } else if(VDisplay == 960) {
- if((LCDheight == 960) ||
- ((LCDheight == 1024) && (VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)))) {
- ModeIndex = ModeIndex_1280x960[Depth];
+ switch(VDisplay) {
+ case 720:
+ ModeIndex = ModeIndex_1280x720[Depth];
+ case 768:
+ if(VGAEngine == SIS_300_VGA) {
+ ModeIndex = ModeIndex_300_1280x768[Depth];
+ } else {
+ ModeIndex = ModeIndex_310_1280x768[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 800:
+ if(VGAEngine == SIS_315_VGA) {
+ ModeIndex = ModeIndex_1280x800[Depth];
}
+ break;
+ case 960:
+ ModeIndex = ModeIndex_1280x960[Depth];
+ break;
+ case 1024:
+ ModeIndex = ModeIndex_1280x1024[Depth];
+ break;
+ }
+ break;
+ case 1360:
+ if(VGAEngine == SIS_315_VGA) {
+ if(VDisplay == 768) ModeIndex = ModeIndex_1360x768[Depth];
}
break;
case 1400:
if(VGAEngine == SIS_315_VGA) {
- if(VBFlags & (VB_301B | VB_301C | VB_302B | VB_302LV | VB_302ELV)) {
- if((LCDwidth == 1400) || (LCDwidth == 1600) || (LCDwidth == 1680)) {
- ModeIndex = ModeIndex_1400x1050[Depth];
- }
+ if(VBFlags & (VB_301C | VB_302LV | VB_302ELV)) {
+ if(VDisplay == 1050) ModeIndex = ModeIndex_1400x1050[Depth];
}
}
break;
case 1600:
if(VGAEngine == SIS_315_VGA) {
- if(VBFlags & (VB_301C | VB_302B | VB_302LV | VB_302ELV)) {
+ if(VBFlags & (VB_301C | VB_302LV | VB_302ELV)) {
if(VDisplay == 1200) ModeIndex = ModeIndex_1600x1200[Depth];
}
}
break;
+#ifndef VB_FORBID_CRT2LCD_OVER_1600
case 1680:
if(VGAEngine == SIS_315_VGA) {
- if(VBFlags & (VB_301C | VB_302B | VB_302LV | VB_302ELV)) {
+ if(VBFlags & (VB_301C | VB_302LV | VB_302ELV)) {
if(VDisplay == 1050) ModeIndex = ModeIndex_1680x1050[Depth];
}
}
break;
+#endif
}
}
@@ -992,17 +1028,18 @@ SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int D
case 720:
if((!(VBFlags & TV_HIVISION)) && (!((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I)))) {
if(VDisplay == 480) {
- if((VBFlags & TV_YPBPR) || (VBFlags & (TV_NTSC | TV_PALM)))
- ModeIndex = ModeIndex_720x480[Depth];
+ ModeIndex = ModeIndex_720x480[Depth];
} else if(VDisplay == 576) {
- if((!(VBFlags & (TV_YPBPR | TV_PALM))) && (VBFlags & TV_PAL))
+ if( ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR750P)) ||
+ ((!(VBFlags & (TV_YPBPR | TV_PALM))) && (VBFlags & TV_PAL)) )
ModeIndex = ModeIndex_720x576[Depth];
}
}
break;
case 768:
if((!(VBFlags & TV_HIVISION)) && (!((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I)))) {
- if((!(VBFlags & (TV_YPBPR | TV_PALM))) && (VBFlags & TV_PAL)) {
+ if( ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR750P)) ||
+ ((!(VBFlags & (TV_YPBPR | TV_PALM))) && (VBFlags & TV_PAL)) ) {
if(VDisplay == 576) ModeIndex = ModeIndex_768x576[Depth];
}
}
@@ -1015,6 +1052,15 @@ SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int D
}
}
break;
+ case 960:
+ if(VGAEngine == SIS_315_VGA) {
+ if(VDisplay == 600) {
+ if((VBFlags & TV_HIVISION) || ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I))) {
+ ModeIndex = ModeIndex_960x600[Depth];
+ }
+ }
+ }
+ break;
case 1024:
if(VDisplay == 768) {
if(VBFlags & (VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV|VB_302ELV)) {
@@ -1084,6 +1130,12 @@ SiS_GetModeID_VGA2(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int
case 856:
if(VDisplay == 480) ModeIndex = ModeIndex_856x480[Depth];
break;
+ case 960:
+ if(VGAEngine == SIS_315_VGA) {
+ if(VDisplay == 540) ModeIndex = ModeIndex_960x540[Depth];
+ else if(VDisplay == 600) ModeIndex = ModeIndex_960x600[Depth];
+ }
+ break;
case 1024:
if(VDisplay == 768) ModeIndex = ModeIndex_1024x768[Depth];
else if(VDisplay == 576) ModeIndex = ModeIndex_1024x576[Depth];
@@ -1278,10 +1330,12 @@ SiS_GetSysFlags(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
/* (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;
+ if(HwInfo->jChipType >= SIS_330) {
SiS_Pr->SiS_MyCR63 = 0x53;
- }
+ if(HwInfo->jChipType >= SIS_661) {
+ SiS_Pr->SiS_SensibleSR11 = TRUE;
+ }
+ }
/* You should use the macros, not these flags directly */
@@ -1322,7 +1376,7 @@ 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;
+ if(temp1 & 0x30) SiS_Pr->SiS_SysFlags |= SF_760LFB;
}
}
@@ -1360,6 +1414,8 @@ SiSInitPCIetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
case SIS_741:
case SIS_660:
case SIS_760:
+ case SIS_761:
+ case SIS_340:
SiS_SetReg(SiS_Pr->SiS_P3c4,0x20,0xa1);
/* - Enable 2D (0x40)
* - Enable 3D (0x02)
@@ -1385,7 +1441,7 @@ SiSInitPCIetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
void
SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
- ULONG temp;
+ USHORT temp;
SiS_Pr->SiS_IF_DEF_LVDS = 0;
SiS_Pr->SiS_IF_DEF_TRUMPION = 0;
@@ -1430,6 +1486,8 @@ SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
case SIS_741:
case SIS_660:
case SIS_760:
+ case SIS_761:
+ case SIS_340:
temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);
temp = (temp & 0xe0) >> 5;
if((temp >= 2) && (temp <= 3)) SiS_Pr->SiS_IF_DEF_LVDS = 1;
@@ -1468,7 +1526,16 @@ SiSDetermineROMLayout661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
USHORT romversoffs, romvmaj = 1, romvmin = 0;
- if(HwInfo->jChipType >= SIS_661) {
+ if(HwInfo->jChipType >= SIS_761) {
+ /* I very much assume 761 and 340 will use new layout */
+ return TRUE;
+ } else if(HwInfo->jChipType >= SIS_661) {
+ if((ROMAddr[0x1a] == 'N') &&
+ (ROMAddr[0x1b] == 'e') &&
+ (ROMAddr[0x1c] == 'w') &&
+ (ROMAddr[0x1d] == 'V')) {
+ return TRUE;
+ }
romversoffs = ROMAddr[0x16] | (ROMAddr[0x17] << 8);
if(romversoffs) {
if((ROMAddr[romversoffs+1] == '.') || (ROMAddr[romversoffs+4] == '.')) {
@@ -1513,17 +1580,24 @@ SiSDetermineROMUsage(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
*/
SiS_Pr->SiS_UseROM = TRUE;
} else {
- /* 315/330 series stick to the standard */
+ /* 315/330 series stick to the standard(s) */
SiS_Pr->SiS_UseROM = TRUE;
if((SiS_Pr->SiS_ROMNew = SiSDetermineROMLayout661(SiS_Pr, HwInfo))) {
+ SiS_Pr->SiS_EMIOffset = 14;
+ SiS_Pr->SiS661LCD2TableSize = 36;
/* 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 if(ROMAddr[romptr + (36 * 16)] == 0xff) /* 0.94 */
+ SiS_Pr->SiS661LCD2TableSize = 36;
+ else if( (ROMAddr[romptr + (38 * 16)] == 0xff) || /* 2.00.00 - 2.02.00 */
+ (ROMAddr[0x6F] & 0x01) ) { /* 2.03.00+ */
+ SiS_Pr->SiS661LCD2TableSize = 38;
+ SiS_Pr->SiS_EMIOffset = 16;
+ }
}
}
}
@@ -1608,7 +1682,7 @@ SiS_ResetSegmentRegisters(SiS_Private *SiS_Pr,PSIS_HW_INFO HwInfo)
void
SiS_GetVBType(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
- USHORT flag=0, rev=0, nolcd=0;
+ USHORT flag=0, rev=0, nolcd=0, p4_0f, p4_25, p4_27;
SiS_Pr->SiS_VBType = 0;
@@ -1639,101 +1713,26 @@ SiS_GetVBType(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
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_SIS301C; /* VB_SIS302ELV; */
} else if(rev >= 0xD0) {
SiS_Pr->SiS_VBType = VB_SIS301LV;
}
}
-}
-
-/*********************************************/
-/* HELPER: GetDRAMSize */
-/*********************************************/
-
-#ifndef LINUX_XF86
-static ULONG
-GetDRAMSize(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
-{
- ULONG AdapterMemorySize = 0;
-#ifdef SIS315H
- USHORT counter;
-#endif
-
- switch(HwInfo->jChipType) {
-#ifdef SIS315H
- case SIS_315H:
- case SIS_315:
- case SIS_315PRO:
- counter = SiS_GetReg(SiS_Pr->SiS_P3c4,0x14);
- AdapterMemorySize = 1 << ((counter & 0xF0) >> 4);
- counter >>= 2;
- counter &= 0x03;
- if(counter == 0x02) {
- AdapterMemorySize += (AdapterMemorySize / 2); /* DDR asymetric */
- } else if(counter != 0) {
- AdapterMemorySize <<= 1; /* SINGLE_CHANNEL_2_RANK or DUAL_CHANNEL_1_RANK */
- }
- AdapterMemorySize *= (1024*1024);
- break;
-
- case SIS_330:
- counter = SiS_GetReg(SiS_Pr->SiS_P3c4,0x14);
- AdapterMemorySize = 1 << ((counter & 0xF0) >> 4);
- counter &= 0x0c;
- if(counter != 0) {
- AdapterMemorySize <<= 1;
- }
- AdapterMemorySize *= (1024*1024);
- break;
-
- case SIS_550:
- case SIS_650:
- case SIS_740:
- counter = SiS_GetReg(SiS_Pr->SiS_P3c4,0x14) & 0x3F;
- counter++;
- AdapterMemorySize = counter * 4;
- AdapterMemorySize *= (1024*1024);
- break;
-
- case SIS_661:
- case SIS_741:
- 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
- case SIS_300:
- case SIS_540:
- case SIS_630:
- case SIS_730:
- AdapterMemorySize = SiS_GetReg(SiS_Pr->SiS_P3c4,0x14) & 0x3F;
- AdapterMemorySize++;
- AdapterMemorySize *= (1024*1024);
- break;
-#endif
- default:
- break;
+ if(SiS_Pr->SiS_VBType & (VB_301C | VB_301LV | VB_302LV | VB_302ELV)) {
+ p4_0f = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x0f);
+ p4_25 = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x25);
+ p4_27 = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x27);
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x0f,0x7f);
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x25,0x08);
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x27,0xfd);
+ if(SiS_GetReg(SiS_Pr->SiS_Part4Port,0x26) & 0x08) {
+ SiS_Pr->SiS_VBType |= VB_UMC;
+ }
+ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x27,p4_27);
+ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x25,p4_25);
+ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x0f,p4_0f);
}
-
- return AdapterMemorySize;
}
-#endif
/*********************************************/
/* HELPER: Check RAM size */
@@ -1744,8 +1743,8 @@ static BOOLEAN
SiS_CheckMemorySize(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
USHORT ModeNo, USHORT ModeIdIndex)
{
+ USHORT AdapterMemSize = HwInfo->ulVideoMemorySize / (1024*1024);
USHORT memorysize,modeflag;
- ULONG temp;
if(SiS_Pr->UseCustomMode) {
modeflag = SiS_Pr->CModeFlag;
@@ -1761,11 +1760,8 @@ SiS_CheckMemorySize(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
memorysize >>= MemorySizeShift; /* Get required memory size */
memorysize++;
- temp = GetDRAMSize(SiS_Pr, HwInfo); /* Get adapter memory size (in MB) */
- temp /= (1024*1024);
-
- if(temp < memorysize) return(FALSE);
- else return(TRUE);
+ if(AdapterMemSize < memorysize) return FALSE;
+ return TRUE;
}
#endif
@@ -1779,14 +1775,17 @@ SiS_Get310DRAMType(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
UCHAR data, temp;
- if(*SiS_Pr->pSiS_SoftSetting & SoftDRAMType) {
- data = *SiS_Pr->pSiS_SoftSetting & 0x03;
+ if((*SiS_Pr->pSiS_SoftSetting) & SoftDRAMType) {
+ data = (*SiS_Pr->pSiS_SoftSetting) & 0x03;
} else {
- 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;
+ if(HwInfo->jChipType >= SIS_340) {
+ /* TODO */
+ data = 0;
+ } if(HwInfo->jChipType >= SIS_661) {
+ data = SiS_GetReg(SiS_Pr->SiS_P3d4,0x78) & 0x07;
+ if(SiS_Pr->SiS_ROMNew) {
+ data = ((SiS_GetReg(SiS_Pr->SiS_P3d4,0x78) & 0xc0) >> 6);
+ }
} else if(IS_SIS550650740) {
data = SiS_GetReg(SiS_Pr->SiS_P3c4,0x13) & 0x07;
} else { /* 315, 330 */
@@ -1813,10 +1812,14 @@ SiS_Get310DRAMType(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
USHORT
SiS_GetMCLK(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
+ UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
USHORT index;
index = SiS_Get310DRAMType(SiS_Pr, HwInfo);
if(HwInfo->jChipType >= SIS_661) {
+ if(SiS_Pr->SiS_ROMNew) {
+ return((USHORT)(SISGETROMW((0x90 + (index * 5) + 3))));
+ }
return(SiS_Pr->SiS_MCLKData_0[index].CLOCK);
} else if(index >= 4) {
index -= 4;
@@ -1842,20 +1845,17 @@ SiS_ClearBuffer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
if(SiS_Pr->SiS_ModeType >= ModeEGA) {
if(ModeNo > 0x13) {
- AdapterMemorySize = GetDRAMSize(SiS_Pr, HwInfo);
- SiS_SetMemory(VideoMemoryAddress,AdapterMemorySize,0);
+ SiS_SetMemory(VideoMemoryAddress, AdapterMemorySize, 0);
} else {
pBuffer = (USHORT *)VideoMemoryAddress;
- for(i=0; i<0x4000; i++)
- pBuffer[i] = 0x0000;
+ for(i=0; i<0x4000; i++) pBuffer[i] = 0x0000;
}
} else {
- pBuffer = (USHORT *)VideoMemoryAddress;
if(SiS_Pr->SiS_ModeType < ModeCGA) {
- for(i=0; i<0x4000; i++)
- pBuffer[i] = 0x0720;
+ pBuffer = (USHORT *)VideoMemoryAddress;
+ for(i=0; i<0x4000; i++) pBuffer[i] = 0x0720;
} else {
- SiS_SetMemory(VideoMemoryAddress,0x8000,0);
+ SiS_SetMemory(VideoMemoryAddress, 0x8000, 0);
}
}
}
@@ -1911,10 +1911,10 @@ SiS_GetModePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex)
UCHAR index;
if(ModeNo <= 0x13) {
- index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_StTableIndex;
+ index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_StTableIndex;
} else {
- if(SiS_Pr->SiS_ModeType <= 0x02) index = 0x1B; /* 02 -> ModeEGA */
- else index = 0x0F;
+ if(SiS_Pr->SiS_ModeType <= ModeEGA) index = 0x1B;
+ else index = 0x0F;
}
return index;
}
@@ -1929,7 +1929,7 @@ SiS_DoLowModeTest(SiS_Private *SiS_Pr, USHORT ModeNo, PSIS_HW_INFO HwInfo)
USHORT temp,temp1,temp2;
if((ModeNo != 0x03) && (ModeNo != 0x10) && (ModeNo != 0x12))
- return(1);
+ return(TRUE);
temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x11);
SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x11,0x80);
temp1 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x00);
@@ -1939,13 +1939,13 @@ SiS_DoLowModeTest(SiS_Private *SiS_Pr, USHORT ModeNo, PSIS_HW_INFO HwInfo)
SiS_SetReg(SiS_Pr->SiS_P3d4,0x11,temp);
if((HwInfo->jChipType >= SIS_315H) ||
(HwInfo->jChipType == SIS_300)) {
- if(temp2 == 0x55) return(0);
- else return(1);
+ if(temp2 == 0x55) return(FALSE);
+ else return(TRUE);
} else {
- if(temp2 != 0x55) return(1);
+ if(temp2 != 0x55) return(TRUE);
else {
SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01);
- return(0);
+ return(FALSE);
}
}
}
@@ -1965,25 +1965,26 @@ SiS_SetLowModeTest(SiS_Private *SiS_Pr, USHORT ModeNo, PSIS_HW_INFO HwInfo)
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);
- }
- }
- }
+ 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);
+ }
+ } 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)
{
+ /* Enable CRT1 gating */
SiS_SetRegAND(SiS_Pr->SiS_P3d4,SiS_Pr->SiS_MyCR63,0xbf);
#if 0
if(!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x15) & 0x01)) {
@@ -2016,7 +2017,7 @@ SiS_GetColorDepth(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex)
modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
}
- index = (modeflag & ModeInfoFlag) - ModeEGA;
+ index = (modeflag & ModeTypeMask) - ModeEGA;
if(index < 0) index = 0;
return(ColorDepth[index]);
}
@@ -3000,7 +3001,7 @@ SiS_SetCRT1ModeRegs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
data = 0;
if(ModeNo > 0x13) {
- if(SiS_Pr->SiS_ModeType > 0x02) {
+ if(SiS_Pr->SiS_ModeType > ModeEGA) {
data |= 0x02;
data |= ((SiS_Pr->SiS_ModeType - ModeVGA) << 2);
}
@@ -3063,7 +3064,7 @@ SiS_SetCRT1ModeRegs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
SiS_SetReg(SiS_Pr->SiS_P3c4,0x17,data);
} else if( (HwInfo->jChipType == SIS_330) ||
- ((HwInfo->jChipType == SIS_760) && (SiS_Pr->SiS_SysFlags & SF_760UMA))) {
+ ((HwInfo->jChipType == SIS_760) && (SiS_Pr->SiS_SysFlags & SF_760LFB))) {
data = SiS_Get310DRAMType(SiS_Pr, HwInfo);
if(HwInfo->jChipType == SIS_330) {
@@ -3107,7 +3108,7 @@ SiS_SetCRT1ModeRegs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
if(data2 >= 0x127) data = 0xba;
else data = 0x7a;
}
- } else {
+ } else { /* 760+LFB */
if (data2 >= 0x190) data = 0xba;
else if(data2 >= 0xff) data = 0x7a;
else if(data2 >= 0xd3) data = 0x3a;
@@ -3117,6 +3118,8 @@ SiS_SetCRT1ModeRegs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
}
}
SiS_SetReg(SiS_Pr->SiS_P3c4,0x17,data);
+ } else if(HwInfo->jChipType == SIS_340) {
+ /* TODO */
}
#endif
@@ -3377,8 +3380,6 @@ SiS_SetCRT1Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
}
}
-
-
/*********************************************/
/* HELPER: RESET VIDEO BRIDGE */
/*********************************************/
@@ -3670,28 +3671,29 @@ BOOLEAN
SiSBIOSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
DisplayModePtr mode, BOOLEAN IsCustom)
{
- SISPtr pSiS = SISPTR(pScrn);
- UShort ModeNo=0;
+ SISPtr pSiS = SISPTR(pScrn);
+ UShort ModeNo = 0;
SiS_Pr->UseCustomMode = FALSE;
if((IsCustom) && (SiS_CheckBuildCustomMode(pScrn, mode, pSiS->VBFlags))) {
- xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Setting custom mode %dx%d\n",
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Setting custom mode %dx%d\n",
SiS_Pr->CHDisplay,
(mode->Flags & V_INTERLACE ? SiS_Pr->CVDisplay * 2 :
(mode->Flags & V_DBLSCAN ? SiS_Pr->CVDisplay / 2 :
SiS_Pr->CVDisplay)));
- return(SiSSetMode(SiS_Pr, HwInfo, pScrn, ModeNo, TRUE));
-
- }
-
- ModeNo = SiS_CalcModeIndex(pScrn, mode, pSiS->VBFlags, pSiS->HaveCustomModes);
- if(!ModeNo) return FALSE;
+ } else {
- xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Setting standard mode 0x%x\n", ModeNo);
+ /* Don't need vbflags here; checks done earlier */
+ ModeNo = SiS_GetModeNumber(pScrn, mode, 0);
+ if(!ModeNo) return FALSE;
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Setting standard mode 0x%x\n", ModeNo);
+
+ }
+
return(SiSSetMode(SiS_Pr, HwInfo, pScrn, ModeNo, TRUE));
}
@@ -3715,9 +3717,8 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
SiS_Pr->UseCustomMode = FALSE;
/* Remember: Custom modes for CRT2 are ONLY supported
- * -) on 315/330 series,
- * -) on the 30x/B/C, and
- * -) if CRT2 is LCD or VGA
+ * -) on the 30x/B/C, and
+ * -) if CRT2 is LCD or VGA, or CRT1 is LCDA
*/
if((IsCustom) && (SiS_CheckBuildCustomMode(pScrn, mode, pSiS->VBFlags))) {
@@ -3726,13 +3727,7 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
} else {
- BOOLEAN havecustommodes = pSiS->HaveCustomModes;
-
-#ifdef SISMERGED
- if(pSiS->MergedFB) havecustommodes = pSiS->HaveCustomModes2;
-#endif
-
- ModeNo = SiS_CalcModeIndex(pScrn, mode, pSiS->VBFlags, havecustommodes);
+ ModeNo = SiS_GetModeNumber(pScrn, mode, 0);
if(!ModeNo) return FALSE;
}
@@ -3771,7 +3766,7 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
}
#endif
- /* We don't clear the buffer under X */
+ /* We don't clear the buffer in X */
SiS_Pr->SiS_flag_clearbuffer=0;
if(SiS_Pr->UseCustomMode) {
@@ -3910,7 +3905,7 @@ SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
} else {
- ModeNo = SiS_CalcModeIndex(pScrn, mode, pSiS->VBFlags, pSiS->HaveCustomModes);
+ ModeNo = SiS_GetModeNumber(pScrn, mode, 0);
if(!ModeNo) return FALSE;
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
@@ -3929,7 +3924,7 @@ SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
SiSSetLVDSetc(SiS_Pr, HwInfo);
SiSDetermineROMUsage(SiS_Pr, HwInfo);
- /* We don't clear the buffer under X */
+ /* We don't clear the buffer in X */
SiS_Pr->SiS_flag_clearbuffer = 0;
SiS_SetReg(SiS_Pr->SiS_P3c4,0x05,0x86);
@@ -4307,25 +4302,59 @@ SiS_CalcLCDACRT1Timing(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex)
#endif
}
-/* ================ XFREE86 ================= */
+void
+SiS_MakeClockRegs(ScrnInfoPtr pScrn, int clock, UCHAR *p2b, UCHAR *p2c)
+{
+ int out_n, out_dn, out_div, out_sbit, out_scale;
+ unsigned int vclk[5];
+
+#define Midx 0
+#define Nidx 1
+#define VLDidx 2
+#define Pidx 3
+#define PSNidx 4
+
+ if(SiS_compute_vclk(clock, &out_n, &out_dn, &out_div, &out_sbit, &out_scale)) {
+ (*p2b) = (out_div == 2) ? 0x80 : 0x00;
+ (*p2b) |= ((out_n - 1) & 0x7f);
+ (*p2c) = (out_dn - 1) & 0x1f;
+ (*p2c) |= (((out_scale - 1) & 3) << 5);
+ (*p2c) |= ((out_sbit & 0x01) << 7);
+#ifdef TWDEBUG
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Clock %d: n %d dn %d div %d sb %d sc %d\n",
+ clock, out_n, out_dn, out_div, out_sbit, out_scale);
+#endif
+ } else {
+ SiSCalcClock(pScrn, clock, 2, vclk);
+ (*p2b) = (vclk[VLDidx] == 2) ? 0x80 : 0x00;
+ (*p2b) |= (vclk[Midx] - 1) & 0x7f;
+ (*p2c) = (vclk[Nidx] - 1) & 0x1f;
+ if(vclk[Pidx] <= 4) {
+ /* postscale 1,2,3,4 */
+ (*p2c) |= ((vclk[Pidx] - 1) & 3) << 5;
+ } else {
+ /* postscale 6,8 */
+ (*p2c) |= (((vclk[Pidx] / 2) - 1) & 3) << 5;
+ (*p2c) |= 0x80;
+ }
+#ifdef TWDEBUG
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Clock %d: n %d dn %d div %d sc %d\n",
+ clock, vclk[Midx], vclk[Nidx], vclk[VLDidx], vclk[Pidx]);
+#endif
+ }
+}
+
+/* ================ XFREE86/X.ORG ================= */
/* Helper functions */
#ifdef LINUX_XF86
-
+
USHORT
SiS_CheckBuildCustomMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags)
{
SISPtr pSiS = SISPTR(pScrn);
- int out_n, out_dn, out_div, out_sbit, out_scale;
int depth = pSiS->CurrentLayout.bitsPerPixel;
- unsigned int vclk[5];
-
-#define Midx 0
-#define Nidx 1
-#define VLDidx 2
-#define Pidx 3
-#define PSNidx 4
pSiS->SiS_Pr->CModeFlag = 0;
@@ -4361,35 +4390,8 @@ SiS_CheckBuildCustomMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags)
pSiS->SiS_Pr->CHBlankEnd = pSiS->SiS_Pr->CHTotal;
pSiS->SiS_Pr->CVBlankStart = pSiS->SiS_Pr->CVSyncStart - 1;
pSiS->SiS_Pr->CVBlankEnd = pSiS->SiS_Pr->CVTotal;
-
- if(SiS_compute_vclk(pSiS->SiS_Pr->CDClock, &out_n, &out_dn, &out_div, &out_sbit, &out_scale)) {
- pSiS->SiS_Pr->CSR2B = (out_div == 2) ? 0x80 : 0x00;
- pSiS->SiS_Pr->CSR2B |= ((out_n - 1) & 0x7f);
- pSiS->SiS_Pr->CSR2C = (out_dn - 1) & 0x1f;
- pSiS->SiS_Pr->CSR2C |= (((out_scale - 1) & 3) << 5);
- pSiS->SiS_Pr->CSR2C |= ((out_sbit & 0x01) << 7);
-#ifdef TWDEBUG
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Clock %d: n %d dn %d div %d sb %d sc %d\n",
- pSiS->SiS_Pr->CDClock, out_n, out_dn, out_div, out_sbit, out_scale);
-#endif
- } else {
- SiSCalcClock(pScrn, pSiS->SiS_Pr->CDClock, 2, vclk);
- pSiS->SiS_Pr->CSR2B = (vclk[VLDidx] == 2) ? 0x80 : 0x00;
- pSiS->SiS_Pr->CSR2B |= (vclk[Midx] - 1) & 0x7f;
- pSiS->SiS_Pr->CSR2C = (vclk[Nidx] - 1) & 0x1f;
- if(vclk[Pidx] <= 4) {
- /* postscale 1,2,3,4 */
- pSiS->SiS_Pr->CSR2C |= ((vclk[Pidx] - 1) & 3) << 5;
- } else {
- /* postscale 6,8 */
- pSiS->SiS_Pr->CSR2C |= (((vclk[Pidx] / 2) - 1) & 3) << 5;
- pSiS->SiS_Pr->CSR2C |= 0x80;
- }
-#ifdef TWDEBUG
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Clock %d: n %d dn %d div %d sc %d\n",
- pSiS->SiS_Pr->CDClock, vclk[Midx], vclk[Nidx], vclk[VLDidx], vclk[Pidx]);
-#endif
- }
+
+ SiS_MakeClockRegs(pScrn, pSiS->SiS_Pr->CDClock, &pSiS->SiS_Pr->CSR2B, &pSiS->SiS_Pr->CSR2C);
pSiS->SiS_Pr->CSRClock = (pSiS->SiS_Pr->CDClock / 1000) + 1;
@@ -4447,7 +4449,39 @@ SiS_CheckBuildCustomMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags)
return 1;
}
-/* Build a list of supported modes */
+int
+SiS_FindPanelFromDB(SISPtr pSiS, USHORT panelvendor, USHORT panelproduct, int *maxx, int *maxy)
+{
+ int i, j;
+ BOOLEAN done = FALSE;
+
+ i = 0;
+ while((!done) && (SiS_PlasmaTable[i].vendor) && panelvendor) {
+ if(SiS_PlasmaTable[i].vendor == panelvendor) {
+ for(j=0; j<SiS_PlasmaTable[i].productnum; j++) {
+ if(SiS_PlasmaTable[i].product[j] == panelproduct) {
+ if(SiS_PlasmaTable[i].maxx && SiS_PlasmaTable[i].maxy) {
+ (*maxx) = (int)SiS_PlasmaTable[i].maxx;
+ (*maxy) = (int)SiS_PlasmaTable[i].maxy;
+ done = TRUE;
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
+ "Identified %s, correcting max X res %d, max Y res %d\n",
+ SiS_PlasmaTable[i].plasmaname,
+ SiS_PlasmaTable[i].maxx, SiS_PlasmaTable[i].maxy);
+ break;
+ }
+ }
+ }
+ }
+ i++;
+ }
+ return (done) ? 1 : 0;
+}
+
+/* Build a list of supported modes:
+ * Built-in modes for which we have all data are M_T_DEFAULT,
+ * modes derived from DDC or database data are M_T_BUILTIN
+ */
DisplayModePtr
SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN isfordvi)
{
@@ -4757,27 +4791,6 @@ SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN isfo
current->VTotal >>= 1;
}
-#if 0
- if((backup = xalloc(sizeof(DisplayModeRec)))) {
- if(!pSiS->backupmodelist) pSiS->backupmodelist = backup;
- else {
- pSiS->backupmodelist->next = backup;
- backup->prev = pSiS->backupmodelist;
- }
- backup->next = NULL;
- backup->HDisplay = current->HDisplay;
- backup->HSyncStart = current->HSyncStart;
- backup->HSyncEnd = current->HSyncEnd;
- backup->HTotal = current->HTotal;
- backup->VDisplay = current->VDisplay;
- backup->VSyncStart = current->VSyncStart;
- backup->VSyncEnd = current->VSyncEnd;
- backup->VTotal = current->VTotal;
- backup->Flags = current->Flags;
- backup->Clock = current->Clock;
- }
-#endif
-
#ifdef TWDEBUG
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Built-in: %s %.2f %d %d %d %d %d %d %d %d\n",
@@ -4820,11 +4833,19 @@ SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN isfo
} else {
if(!(SiS_PlasmaTable[i].plasmamodes[k] & 0x40)) continue;
}
+
+ l = SiS_PlasmaTable[i].plasmamodes[k] & 0x3f;
+
+ if(pSiS->VBFlags & (VB_301|VB_301B|VB_302B|VB_301LV)) {
+ if(isfordvi) {
+ if(SiS_PlasmaMode[l].VDisplay > 1024) continue;
+ }
+ }
if(!(new = xalloc(sizeof(DisplayModeRec)))) return first;
memset(new, 0, sizeof(DisplayModeRec));
- if(!(new->name = xalloc(10))) {
+ if(!(new->name = xalloc(12))) {
xfree(new);
return first;
}
@@ -4837,9 +4858,7 @@ SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN isfo
current = new;
pSiS->AddedPlasmaModes = TRUE;
-
- l = SiS_PlasmaTable[i].plasmamodes[k] & 0x3f;
-
+
sprintf(current->name, "%dx%d", SiS_PlasmaMode[l].HDisplay,
SiS_PlasmaMode[l].VDisplay);
@@ -4978,12 +4997,12 @@ SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN isfo
}
-/* Build a list of supported modes */
+/* Translate a mode number into the VESA pendant */
int
SiSTranslateToVESA(ScrnInfoPtr pScrn, int modenumber)
{
- SISPtr pSiS = SISPTR(pScrn);
- int i;
+ SISPtr pSiS = SISPTR(pScrn);
+ int i = 0;
/* Initialize our pointers */
if(pSiS->VGAEngine == SIS_300_VGA) {
@@ -5001,16 +5020,49 @@ SiSTranslateToVESA(ScrnInfoPtr pScrn, int modenumber)
} else return -1;
if(modenumber <= 0x13) return modenumber;
+
+#ifdef SIS315H
+ if(pSiS->ROM661New) {
+ while(SiS_EModeIDTable661[i].Ext_ModeID != 0xff) {
+ if(SiS_EModeIDTable661[i].Ext_ModeID == modenumber) {
+ return (int)SiS_EModeIDTable661[i].Ext_VESAID;
+ }
+ i++;
+ }
+ } else {
+#endif
+ while(pSiS->SiS_Pr->SiS_EModeIDTable[i].Ext_ModeID != 0xff) {
+ if(pSiS->SiS_Pr->SiS_EModeIDTable[i].Ext_ModeID == modenumber) {
+ return (int)pSiS->SiS_Pr->SiS_EModeIDTable[i].Ext_VESAID;
+ }
+ i++;
+ }
+#ifdef SIS315H
+ }
+#endif
+ return -1;
+}
- i = 0;
- while(pSiS->SiS_Pr->SiS_EModeIDTable[i].Ext_ModeID != 0xff) {
- if(pSiS->SiS_Pr->SiS_EModeIDTable[i].Ext_ModeID == modenumber) {
- return (int)pSiS->SiS_Pr->SiS_EModeIDTable[i].Ext_VESAID;
+/* Translate a new BIOS mode number into the driver's pendant */
+int
+SiSTranslateToOldMode(int modenumber)
+{
+#ifdef SIS315H
+ int i = 0;
+
+ while(SiS_EModeIDTable661[i].Ext_ModeID != 0xff) {
+ if(SiS_EModeIDTable661[i].Ext_ModeID == modenumber) {
+ if(SiS_EModeIDTable661[i].Ext_MyModeID)
+ return (int)SiS_EModeIDTable661[i].Ext_MyModeID;
+ else
+ return modenumber;
}
i++;
}
- return -1;
+#endif
+ return modenumber;
}
+
#endif /* Xfree86 */
#ifdef LINUX_KERNEL
@@ -5061,7 +5113,7 @@ sisfb_gettotalfrommode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
USHORT ModeIdIndex = 0, CRT1Index = 0;
USHORT RefreshRateTableIndex = 0;
unsigned char sr_data, cr_data, cr_data2;
-
+
if(HwInfo->jChipType < SIS_315H) {
#ifdef SIS300
InitTo300Pointer(SiS_Pr, HwInfo);
@@ -5103,10 +5155,7 @@ sisfb_gettotalfrommode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
int
sisfb_mode_rate_to_ddata(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
unsigned char modeno, unsigned char rateindex,
- ULONG *left_margin, ULONG *right_margin,
- ULONG *upper_margin, ULONG *lower_margin,
- ULONG *hsync_len, ULONG *vsync_len,
- ULONG *sync, ULONG *vmode)
+ struct fb_var_screeninfo *var)
{
USHORT ModeNo = modeno;
USHORT ModeIdIndex = 0, index = 0;
@@ -5194,15 +5243,15 @@ sisfb_mode_rate_to_ddata(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
/* Terrible hack, but the correct CRTC data for
* these modes only produces a black screen...
*/
- *left_margin = (400 - 376);
- *right_margin = (328 - 320);
- *hsync_len = (376 - 328);
+ var->left_margin = (400 - 376);
+ var->right_margin = (328 - 320);
+ var->hsync_len = (376 - 328);
} else {
- *left_margin = D * 8;
- *right_margin = F * 8;
- *hsync_len = C * 8;
+ var->left_margin = D * 8;
+ var->right_margin = F * 8;
+ var->hsync_len = C * 8;
}
@@ -5264,47 +5313,47 @@ sisfb_mode_rate_to_ddata(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
D = B - F - C;
- *upper_margin = D;
- *lower_margin = F;
- *vsync_len = C;
+ var->upper_margin = D;
+ var->lower_margin = F;
+ var->vsync_len = C;
if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag & 0x8000)
- *sync &= ~FB_SYNC_VERT_HIGH_ACT;
+ var->sync &= ~FB_SYNC_VERT_HIGH_ACT;
else
- *sync |= FB_SYNC_VERT_HIGH_ACT;
+ var->sync |= FB_SYNC_VERT_HIGH_ACT;
if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag & 0x4000)
- *sync &= ~FB_SYNC_HOR_HIGH_ACT;
+ var->sync &= ~FB_SYNC_HOR_HIGH_ACT;
else
- *sync |= FB_SYNC_HOR_HIGH_ACT;
+ var->sync |= FB_SYNC_HOR_HIGH_ACT;
- *vmode = FB_VMODE_NONINTERLACED;
+ var->vmode = FB_VMODE_NONINTERLACED;
if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag & 0x0080)
- *vmode = FB_VMODE_INTERLACED;
+ var->vmode = FB_VMODE_INTERLACED;
else {
- j = 0;
- while(SiS_Pr->SiS_EModeIDTable[j].Ext_ModeID != 0xff) {
+ j = 0;
+ while(SiS_Pr->SiS_EModeIDTable[j].Ext_ModeID != 0xff) {
if(SiS_Pr->SiS_EModeIDTable[j].Ext_ModeID ==
SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].ModeID) {
if(SiS_Pr->SiS_EModeIDTable[j].Ext_ModeFlag & DoubleScanMode) {
- *vmode = FB_VMODE_DOUBLE;
+ var->vmode = FB_VMODE_DOUBLE;
}
break;
}
j++;
- }
+ }
}
- if((*vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
+ if((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
#if 0 /* Do this? */
- *upper_margin <<= 1;
- *lower_margin <<= 1;
- *vsync_len <<= 1;
+ var->upper_margin <<= 1;
+ var->lower_margin <<= 1;
+ var->vsync_len <<= 1;
#endif
- } else if((*vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE) {
- *upper_margin >>= 1;
- *lower_margin >>= 1;
- *vsync_len >>= 1;
+ } else if((var->vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE) {
+ var->upper_margin >>= 1;
+ var->lower_margin >>= 1;
+ var->vsync_len >>= 1;
}
return 1;
diff --git a/src/init.h b/src/init.h
index 9684c68..0cd9927 100644
--- a/src/init.h
+++ b/src/init.h
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/init.h,v 1.12 2004/08/20 18:57:06 kem Exp $ */
/*
* Data and prototypes for init.c
*
@@ -34,7 +35,7 @@
* * 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
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -98,6 +99,8 @@ const USHORT ModeIndex_800x480[] = {0x70, 0x7a, 0x00, 0x76};
const USHORT ModeIndex_800x600[] = {0x30, 0x47, 0x00, 0x63};
const USHORT ModeIndex_848x480[] = {0x39, 0x3b, 0x00, 0x3e};
const USHORT ModeIndex_856x480[] = {0x3f, 0x42, 0x00, 0x45};
+const USHORT ModeIndex_960x540[] = {0x1d, 0x1e, 0x00, 0x1f}; /* 315 series only */
+const USHORT ModeIndex_960x600[] = {0x20, 0x21, 0x00, 0x22}; /* 315 series only */
const USHORT ModeIndex_1024x768[] = {0x38, 0x4a, 0x00, 0x64};
const USHORT ModeIndex_1024x576[] = {0x71, 0x74, 0x00, 0x77};
const USHORT ModeIndex_1024x600[] = {0x20, 0x21, 0x00, 0x22}; /* 300 series only */
@@ -114,6 +117,7 @@ const USHORT ModeIndex_300_1360x1024[]= {0x67, 0x6f, 0x00, 0x72}; /* 300 serie
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_1920x1080[] = {0x2c, 0x2d, 0x00, 0x73}; /* 315 series only */
const USHORT ModeIndex_1920x1440[] = {0x68, 0x69, 0x00, 0x6b};
const USHORT ModeIndex_300_2048x1536[]= {0x6c, 0x6d, 0x00, 0x00};
const USHORT ModeIndex_310_2048x1536[]= {0x6c, 0x6d, 0x00, 0x6e};
@@ -253,10 +257,14 @@ static const SiS_ModeResInfoStruct SiS_ModeResInfo[] =
{ 1152, 768, 8,16}, /* 0x1a */
{ 768, 576, 8,16}, /* 0x1b */
{ 1360,1024, 8,16}, /* 0x1c */
- { 1280, 800, 8,16}, /* 0x1d */
- { 1680,1050, 8,16} /* 0x1e */
+ { 1680,1050, 8,16}, /* 0x1d */
+ { 1280, 800, 8,16}, /* 0x1e */
+ { 1920,1080, 8,16}, /* 0x1f */
+ { 960, 540, 8,16}, /* 0x20 */
+ { 960, 600, 8,16} /* 0x21 */
};
+#if defined(SIS300) || defined(SIS315H)
static SiS_StandTableStruct SiS_StandTable[]=
{
/* 0x00: MD_0_200 */
@@ -695,6 +703,7 @@ static SiS_StandTableStruct SiS_StandTable[]=
0xff}
}
};
+#endif
/**************************************************************/
/* SIS VIDEO BRIDGE ----------------------------------------- */
@@ -840,7 +849,8 @@ static const SiS_TVDataStruct SiS_ExtPALData[] =
{ 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 (for NTSC equ) */
+ { 1, 1,1170, 821,1270, 520, 686, 0, 686,0xF3,0x00,0x1D,0x20}, /* 1024x768 (for NTSC equ) */
+ { 9, 4, 848, 528,1270, 530, 0, 0, 50,0xf5,0xfb,0x1b,0x2a} /* 720x480 test */
};
static const SiS_TVDataStruct SiS_StNTSCData[] =
@@ -899,7 +909,8 @@ static const SiS_TVDataStruct SiS_ExtHiTVData[] =
{ 5, 4, 0x627,0x464,0x670,0x3c0,0x128, 0, 0, 0x00,0x00,0x00,0x00}, /* 1280x1024 */
{ 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 */
+ { 8, 5, 0x6d6,0x323,0x670,0x3c0,0x128, 0, 0, 0x00,0x00,0x00,0x00}, /* 1280x720 */
+ { 137, 32, 0x3d4,0x233,0x663,0x3bf,0x143, 0, 0, 0x00,0x00,0x00,0x00} /* 960x600 */
};
static const SiS_TVDataStruct SiS_St525pData[] =
@@ -922,30 +933,31 @@ static const SiS_TVDataStruct SiS_St750pData[] =
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 },
+ { 143, 65, 0x35a,0x1bb,0x4f6,0x1b8,0x0ab, 0, 0x0ab, 0x00,0x00,0x00,0x00},
+ { 88, 35, 0x35a,0x189,0x4f6,0x1b8,0x0ab, 0, 0x0ab, 0x00,0x00,0x00,0x00},
+ { 18, 5, 0x339,0x1ae,0x500,0x2d0,0x05c, 0, 0x05c, 0x00,0x00,0x00,0x00},
+ { 143, 70, 0x39c,0x189,0x4f6,0x1b8,0x05c, 0, 0x05c, 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 */
+ { 99, 32, 0x320,0x1fe,0x500,0x2d0, 50, 0, 0, 0x00,0x00,0x00,0x00}, /* 720x480 test WORKS */
+ { 68, 64, 0x55f,0x346,0x500,0x2a8,0x27e, 0, 0, 0x00,0x00,0x00,0x00}, /* 1024x768 */
+ { 5, 2, 0x3a7,0x226,0x500,0x2a8, 0,128, 0, 0x00,0x00,0x00,0x00}, /* 720x576 */
+ { 25, 24, 0x5d8,0x2f3,0x460,0x2a8, 50, 0, 0, 0x00,0x00,0x00,0x00} /* 1280x720 WORKS */
+};
+
+static const SiS_LCDDataStruct SiS_LCD1280x720Data[] = /* 2.03.00 */
+{
+ { 44, 15, 864, 430, 1408, 806 }, /* 640x400 */
+ { 128, 35, 792, 385, 1408, 806 },
+ { 44, 15, 864, 430, 1408, 806 },
+ { 128, 35, 792, 385, 1408, 806 },
+ { 22, 9, 864, 516, 1408, 806 }, /* 640x480 */
+ { 8, 5, 1056, 655, 1408, 806 }, /* 800x600 */
+ { 0, 0, 0, 0, 0, 0 }, /* 1024x768 */
+ { 0, 0, 0, 0, 0, 0 }, /* 1280x1024 */
{ 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0 },
- { 1, 1, 1344, 806, 1344, 806 } /* 1280x720 */
+ { 1, 1, 1408, 806, 1408, 806 } /* 1280x720 */
};
/* About 1280x768: For TMDS, Panel_1280x768 will only be set if
@@ -954,7 +966,7 @@ static const SiS_LCDDataStruct SiS_LCD1280x720Data[] =
* For LVDS, we know two types. Data follows:
*/
-static const SiS_LCDDataStruct SiS_StLCD1280x768_2Data[] =
+static const SiS_LCDDataStruct SiS_StLCD1280x768_2Data[] = /* 2.03.00 */
{
{ 64, 21, 858, 434, 1408, 806 }, /* 640x400 */
{ 32, 9, 858, 372, 1408, 806 },
@@ -964,22 +976,27 @@ static const SiS_LCDDataStruct SiS_StLCD1280x768_2Data[] =
{ 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 */
+ { 1, 1, 1408, 806, 1408, 806 }, /* 1280x768 */
+ { 0, 0, 0, 0, 0, 0 },
+ { 16, 15, 1600, 750, 1600, 806 } /* 1280x720 - from Ext */
};
-static const SiS_LCDDataStruct SiS_ExtLCD1280x768_2Data[] =
+static const SiS_LCDDataStruct SiS_ExtLCD1280x768_2Data[] = /* 2.03.00 */
{
- { 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 },
+ { 16, 5, 960, 410, 1600, 806 }, /* 640x400 */
+ { 64, 21, 1152, 364, 1600, 806 },
+ { 16, 5, 960, 410, 1600, 806 },
+ { 64, 21, 1152, 364, 1600, 806 },
+ { 32, 13, 1040, 493, 1600, 806 }, /* 640x480 */
+ { 16, 9, 1152, 618, 1600, 806 }, /* 800x600 */
+ { 25, 21, 1344, 796, 1600, 806 }, /* 1024x768 */
+ { 0, 0, 0, 0, 0, 0 },
+ { 1, 1, 1600, 806, 1600, 806 }, /* 1280x768 */
{ 0, 0, 0, 0, 0, 0 },
- { 1, 1, 1408, 806, 1408, 806 }
+ { 16, 15, 1600, 750, 1600, 806 } /* 1280x720 */
};
+#if 0
static const SiS_LCDDataStruct SiS_LCD1280x768_3Data[] =
{
{ 64, 25, 1056, 422, 1664, 798 }, /* 640x400 */
@@ -990,20 +1007,40 @@ static const SiS_LCDDataStruct SiS_LCD1280x768_3Data[] =
{ 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 */
+ { 1, 1, 1408, 806, 1408, 806 }, /* 1280x768 */
+ { 0, 0, 0, 0, 0, 0 },
+ { 16, 15, 1600, 750, 1600, 806 } /* 1280x720 from above */
};
+#endif
-static const SiS_LCDDataStruct SiS_LCD1280x800Data[] =
+static const SiS_LCDDataStruct SiS_LCD1280x800Data[] = /* 0.93.12a (TMDS) */
{
- { 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 */
+ { 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 }, /* 1280x1024 */
+ { 1, 1, 1408, 816, 1408, 816 }, /* 1280x800 */
+ { 0, 0, 0, 0, 0, 0 }, /* 1280x768 (patch index) */
+ { 0, 0, 0, 0, 0, 0 } /* 1280x720 */
+};
+
+static const SiS_LCDDataStruct SiS_LCD1280x800_2Data[] = /* 2.03.00 (LVDS) */
+{
+ { 97, 42, 1344, 409, 1552, 812 }, /* 640x400 */
+ { 97, 35, 1280, 358, 1552, 812 },
+ { 97, 42, 1344, 409, 1552, 812 },
+ { 97, 35, 1280, 358, 1552, 812 },
+ { 97, 39, 1040, 488, 1552, 812 }, /* 640x480 */
+ { 194, 105, 1120, 608, 1552, 812 }, /* 800x600 */
+ { 97, 84, 1400, 780, 1552, 812 }, /* 1024x768 */
+ { 0, 0, 0, 0, 0, 0 }, /* 1280x1024 */
+ { 1, 1, 1552, 812, 1552, 812 }, /* 1280x800 */
+ { 97, 96, 1600, 780, 1552, 812 }, /* 1280x768 - patch index */
+ { 97, 90, 1600, 730, 1552, 812 } /* 1280x720 */
};
static const SiS_LCDDataStruct SiS_LCD1280x960Data[] =
@@ -1034,15 +1071,20 @@ static const SiS_LCDDataStruct SiS_StLCD1400x1050Data[] =
static const SiS_LCDDataStruct SiS_ExtLCD1400x1050Data[] =
{
- { 211, 100, 2100, 408, 1688, 1066 }, /* 640x400 */
+/* { 211, 60, 1260, 410, 1688, 1066 }, 640x400 (6330) */
+ { 211, 100, 2100, 408, 1688, 1066 }, /* 640x400 (6325) WORKS */
{ 211, 64, 1536, 358, 1688, 1066 },
{ 211, 100, 2100, 408, 1688, 1066 },
{ 211, 64, 1536, 358, 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 }
+/* { 211, 80, 1400, 490, 1688, 1066 }, 640x480 (6330) */
+ { 211, 48, 840, 488, 1688, 1066 }, /* 640x480 (6325) WORKS */
+/* { 211, 117, 1638, 613, 1688, 1066 }, 800x600 (6330) */
+ { 211, 72, 1008, 609, 1688, 1066 }, /* 800x600 (6325) WORKS */
+ { 211, 128, 1400, 776, 1688, 1066 }, /* 1024x768 */
+ { 211, 205, 1680, 1041, 1688, 1066 }, /* 1280x1024 - not used (always unscaled) */
+ { 1, 1, 1688, 1066, 1688, 1066 }, /* 1400x1050 */
+ { 0, 0, 0, 0, 0, 0 }, /* kludge */
+ { 211, 120, 1400, 730, 1688, 1066 } /* 1280x720 */
};
static const SiS_LCDDataStruct SiS_LCD1680x1050Data[] =
@@ -1056,9 +1098,9 @@ static const SiS_LCDDataStruct SiS_LCD1680x1050Data[] =
{ 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 */
+ { 95, 69, 1800, 817, 1900, 1066 }, /* 9 1280x800 patch index */
{ 13, 9, 1900, 739, 1900, 1066 }, /* 10 1280x720 */
- { 95, 94, 1880, 1066, 1900, 1066 }, /* 11 1400x1050 patch */
+ { 95, 94, 1880, 1066, 1900, 1066 }, /* 11 1400x1050 patch index */
{ 1, 1, 1900, 1066, 1900, 1066 } /* 12 1680x1050 */
};
@@ -1072,21 +1114,23 @@ static const SiS_LCDDataStruct SiS_StLCD1600x1200Data[] =
{ 4, 1,1080, 625, 2160, 1250 },
{ 5, 2,1350, 800, 2160, 1250 },
{135,88,1600,1100, 2160, 1250 },
- {135,88,1600,1100, 2160, 1250 },
+ {72, 49,1680,1092, 2160, 1250 },
{ 1, 1,2160,1250, 2160, 1250 }
};
static const SiS_LCDDataStruct SiS_ExtLCD1600x1200Data[] =
{
- {27, 4, 800, 500, 2160, 1250 },
+ {72,11, 990, 422, 2160, 1250 }, /* 640x400 (6330) WORKS */
+/* {27, 4, 800, 500, 2160, 1250 }, 640x400 (6235) */
{27, 4, 800, 500, 2160, 1250 },
{ 6, 1, 900, 500, 2160, 1250 },
{ 6, 1, 900, 500, 2160, 1250 },
- {27, 1, 800, 500, 2160, 1250 },
+ {45, 8, 960, 505, 2160, 1250 }, /* 640x480 (6330) WORKS */
+/* {27, 1, 800, 500, 2160, 1250 }, 640x480 (6325) */
{ 4, 1,1080, 625, 2160, 1250 },
{ 5, 2,1350, 800, 2160, 1250 },
- {27,16,1500,1064, 2160, 1250 },
- {27,16,1500,1064, 2160, 1250 },
+ {27,16,1500,1064, 2160, 1250 }, /* 1280x1024 */
+ {72,49,1680,1092, 2160, 1250 }, /* 1400x1050 (6330, was not supported on 6325) */
{ 1, 1,2160,1250, 2160, 1250 }
};
@@ -1104,16 +1148,27 @@ static const SiS_LCDDataStruct SiS_NoScaleData[] =
{ 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,1650, 750,1650, 750 }, /* 0x0c: 1280x720 (TMDS, projector) */
+ { 1, 1,1552, 812,1552, 812 }, /* 0x0d: 1280x800_2 (LVDS) (was: 1408,816/ 1656,841) */
{ 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) */
+ { 1, 1,1660, 806,1660, 806 }, /* 0x0f: 1280x768_2 (LVDS) */
+ { 1, 1,1664, 798,1664, 798 }, /* 0x10: 1280x768_3 (LVDS) - temp */
+ { 1, 1,1688, 802,1688, 802 }, /* 0x11: 1280x768 (TMDS) */
+ { 1, 1,1408, 806,1408, 806 }, /* 0x12: 1280x720 (LVDS) */
+ { 1, 1, 896, 497, 896, 497 }, /* 0x13: 720x480 */
+ { 1, 1, 912, 597, 912, 597 }, /* 0x14: 720x576 */
+ { 1, 1, 912, 597, 912, 597 }, /* 0x15: 768x576 */
+ { 1, 1,1056, 497,1056, 497 }, /* 0x16: 848x480 */
+ { 1, 1,1064, 497,1064, 497 }, /* 0x17: 856x480 */
+ { 1, 1,1056, 497,1056, 497 }, /* 0x18: 800x480 */
+ { 1, 1,1328, 739,1328, 739 }, /* 0x19: 1024x576 */
+ { 1, 1,1680, 892,1680, 892 }, /* 0x1a: 1152x864 */
+ { 1, 1,1808, 808,1808, 808 }, /* 0x1b: 1360x768 */
+ { 1, 1,1104, 563,1104, 563 }, /* 0x1c: 960x540 */
+ { 1, 1,1120, 618,1120, 618 }, /* 0x1d: 960x600 */
+ { 1, 1,1408, 816,1408, 816 } /* 0x1f: 1280x800 (TMDS special) */
};
-
/**************************************************************/
/* LVDS ----------------------------------------------------- */
/**************************************************************/
@@ -1154,7 +1209,6 @@ static const SiS_LVDSDataStruct SiS_LVDS640x480Data_2[]=
{ 800, 525, 800, 525} /* pseudo */
};
-
static const SiS_LVDSDataStruct SiS_LVDS800x600Data_1[]=
{
{ 848, 433,1060, 629},
@@ -1168,12 +1222,6 @@ static const SiS_LVDSDataStruct SiS_LVDS800x600Data_1[]=
static const SiS_LVDSDataStruct SiS_LVDS800x600Data_2[]=
{
- {1056, 628,1056, 628},
- {1056, 628,1056, 628},
- {1056, 628,1056, 628},
- {1056, 628,1056, 628},
- {1056, 628,1056, 628},
- {1056, 628,1056, 628},
{1056, 628,1056, 628}
};
@@ -1190,13 +1238,7 @@ static const SiS_LVDSDataStruct SiS_LVDS1024x768Data_1[]=
static const SiS_LVDSDataStruct SiS_LVDS1024x768Data_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},
+ {1344, 806,1344, 806}
};
static const SiS_LVDSDataStruct SiS_LVDS1280x1024Data_1[]=
@@ -1213,13 +1255,6 @@ static const SiS_LVDSDataStruct SiS_LVDS1280x1024Data_1[]=
static const SiS_LVDSDataStruct SiS_LVDS1280x1024Data_2[]=
{
- {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}
};
@@ -1238,15 +1273,7 @@ static const SiS_LVDSDataStruct SiS_LVDS1400x1050Data_1[]=
static const SiS_LVDSDataStruct SiS_LVDS1400x1050Data_2[]=
{
- {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},
+ {1688,1066, 1688,1066}
};
static const SiS_LVDSDataStruct SiS_LVDS1600x1200Data_1[]=
@@ -1261,32 +1288,11 @@ static const SiS_LVDSDataStruct SiS_LVDS1600x1200Data_1[]=
{1728,1144, 2048,1320},
{1848,1170, 2048,1320},
{2048,1320, 2048,1320}
-#if 0
- {1088, 450, 2048,1250},
- {1088, 400, 2048,1250},
- {1088, 450, 2048,1250},
- {1088, 400, 2048,1250},
- {1088, 530, 2048,1250},
- {1248, 650, 2048,1250},
- {1472, 818, 2048,1250},
- {1728,1066, 2048,1250},
- {1848,1066, 2048,1250},
- {2048,1250, 2048,1250}
-#endif
};
static const SiS_LVDSDataStruct SiS_LVDS1600x1200Data_2[]=
{
- {2048,1320, 2048,1320},
- {2048,1320, 2048,1320},
- {2048,1320, 2048,1320},
- {2048,1320, 2048,1320},
- {2048,1320, 2048,1320},
- {2048,1320, 2048,1320},
- {2048,1320, 2048,1320},
- {2048,1320, 2048,1320},
- {2048,1320, 2048,1320},
- {2048,1320, 2048,1320}
+ {2048,1320, 2048,1320}
};
static const SiS_LVDSDataStruct SiS_LVDS1280x960Data_1[]=
@@ -1304,15 +1310,7 @@ static const SiS_LVDSDataStruct SiS_LVDS1280x960Data_1[]=
static const SiS_LVDSDataStruct SiS_LVDS1280x960Data_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},
- { 800, 449,1280, 801},
- { 800, 525,1280, 813}
+ {1344, 806,1344, 806}
};
static const SiS_LVDSDataStruct SiS_LVDS1280x768Data_1[]=
@@ -1330,14 +1328,6 @@ static const SiS_LVDSDataStruct SiS_LVDS1280x768Data_1[]=
static const SiS_LVDSDataStruct SiS_LVDS1280x768Data_2[]=
{
- {1408, 806, 1408, 806},
- {1408, 806, 1408, 806},
- {1408, 806, 1408, 806},
- {1408, 806, 1408, 806},
- {1408, 806, 1408, 806},
- {1408, 806, 1408, 806},
- {1408, 806, 1408, 806},
- {1408, 806, 1408, 806},
{1408, 806, 1408, 806}
};
@@ -1354,12 +1344,6 @@ static const SiS_LVDSDataStruct SiS_LVDS1024x600Data_1[] =
static const SiS_LVDSDataStruct SiS_LVDS1024x600Data_2[] =
{
- {1344, 800,1344, 800},
- {1344, 800,1344, 800},
- {1344, 800,1344, 800},
- {1344, 800,1344, 800},
- {1344, 800,1344, 800},
- {1344, 800,1344, 800},
{1344, 800,1344, 800}
};
@@ -1376,12 +1360,6 @@ static const SiS_LVDSDataStruct SiS_LVDS1152x768Data_1[] =
static const SiS_LVDSDataStruct SiS_LVDS1152x768Data_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}
};
@@ -1392,12 +1370,11 @@ static const SiS_LVDSDataStruct SiS_LVDSXXXxXXXData_1[]=
{ 800, 449, 800, 449},
{ 900, 449, 900, 449},
{ 900, 449, 900, 449},
- { 800, 525, 800, 525}, /* 640x480 */
- {1056, 628, 1056, 628}, /* 800x600 */
- {1344, 806, 1344, 806}, /* 1024x768 */
- {1688,1066, 1688,1066}, /* 1280x1024 */ /* INSERTED ! */
- {1688, 806, 1688, 806}, /* 1280x768 */
- /* No other panels ! */
+ { 800, 525, 800, 525}, /* 640x480 */
+ {1056, 628, 1056, 628}, /* 800x600 */
+ {1344, 806, 1344, 806}, /* 1024x768 */
+ {1688,1066, 1688,1066}, /* 1280x1024 */ /* INSERTED */
+ {1688, 806, 1688, 806}, /* 1280x768 */
};
/* Custom data for Barco iQ R series */
@@ -1443,13 +1420,7 @@ static const SiS_LVDSDataStruct SiS_LVDSBARCO1024Data_1[]=
/* Custom data for Barco iQ G series */
static const SiS_LVDSDataStruct SiS_LVDSBARCO1024Data_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},
+ {1344, 806,1344, 806}
};
/* Custom data for 848x480 parallel panel */
@@ -1536,10 +1507,10 @@ static const SiS_LVDSDesStruct SiS_CHTVONTSCDesData[]=
static const SiS_LVDSDesStruct SiS_CHTVUPALDesData[]=
{
- {256, 0},
- {256, 0},
- {256, 0},
- {256, 0},
+ {256, 0},
+ {256, 0},
+ {256, 0},
+ {256, 0},
{ 0, 0},
{ 0, 0},
{ 0, 0}
@@ -1547,10 +1518,10 @@ static const SiS_LVDSDesStruct SiS_CHTVUPALDesData[]=
static const SiS_LVDSDesStruct SiS_CHTVOPALDesData[]=
{
- {256, 0},
- {256, 0},
- {256, 0},
- {256, 0},
+ {256, 0},
+ {256, 0},
+ {256, 0},
+ {256, 0},
{ 0, 0},
{ 0, 0},
{ 0, 0}
@@ -2074,6 +2045,7 @@ typedef struct _SiS_PlasmaTables
USHORT product[5];
const char *DDCnames[5];
const char *plasmaname;
+ USHORT maxx,maxy;
UCHAR modenum;
UCHAR plasmamodes[20]; /* | 0x80 = DVI-capable, | 0x40 = analog */
} SiS_PlasmaTables;
@@ -2192,6 +2164,7 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
{ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
{ "", "", "", "", "" },
"NEC PlasmaSync 42VP4/42VP4D/42VP4G/42VP4DG",
+ 0, 0,
11, /* All DVI, except 0, 7, 13 */
{ 0|0x40, 1|0xc0, 2|0xc0, 4|0xc0, 7|0x40, 9|0xc0,10|0xc0,11|0xc0,13|0x40,14|0xc0,
17|0xc0, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
@@ -2202,6 +2175,7 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
{ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
{ "", "", "", "", "" },
"NEC PlasmaSync 42PD1/50PD1/50PD2",
+ 0, 0,
5, /* DVI entirely unknown */
{ 0|0x40, 1|0xc0, 2|0xc0, 4|0xc0, 9|0xc0, 0 , 0 , 0 , 0 , 0 ,
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
@@ -2210,6 +2184,7 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
{ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
{ "", "", "", "", "" },
"NEC PlasmaSync 42PD3",
+ 0, 0,
10, /* DVI entirely unknown */
{ 0|0x40, 1|0xc0, 2|0xc0, 3|0xc0, 4|0xc0, 5|0xc0, 6|0xc0, 7|0x40, 8|0xc0, 9|0xc0,
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
@@ -2218,6 +2193,7 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
{ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
{ "", "", "", "", "" },
"NEC PlasmaSync 42VM3/61XM1",
+ 0, 0,
11, /* DVI entirely unknown */
{ 0|0x40, 1|0xc0, 2|0xc0, 3|0xc0, 4|0xc0, 5|0xc0, 6|0xc0, 8|0xc0, 9|0xc0,11|0xc0,
17|0xc0, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
@@ -2226,6 +2202,7 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
{ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
{ "", "", "", "", "" },
"NEC PlasmaSync 42MP1/42MP2",
+ 0, 0,
6, /* DVI entirely unknown */
{ 0|0x40, 1|0xc0, 2|0xc0, 4|0xc0, 9|0xc0,11|0xc0, 0 , 0 , 0 , 0 ,
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
@@ -2234,6 +2211,7 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
{ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
{ "", "", "", "", "" },
"NEC PlasmaSync 50MP1",
+ 0, 0,
10, /* DVI entirely unknown */
{ 0|0x40, 1|0xc0, 2|0xc0, 4|0xc0, 7|0x40, 9|0xc0,10|0xc0,11|0xc0,13|0x40,14|0xc0,
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
@@ -2243,6 +2221,7 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
{ 0xa482, 0xa483, 0x0000, 0x0000, 0x0000 },
{ "PX-42VM", "", "", "", "" },
"NEC PlasmaSync 42MP3/42MP4/50MP2/61MP1",
+ 0, 0,
11, /* All DVI except 0, 7, 13, 17 */
{ 0|0x40, 1|0xc0, 2|0xc0, 4|0xc0, 7|0x40, 9|0xc0,10|0xc0,11|0xc0,13|0x40,14|0xc0,
17|0x40, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
@@ -2252,6 +2231,7 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
{ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
{ "", "", "", "", "" },
"NEC PlasmaSync 3300W",
+ 0, 0,
3,
{ 0|0x40, 1|0xc0,18|0xc0, 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
@@ -2268,6 +2248,7 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
{ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
{ "", "", "", "", "" },
"NEC PlasmaSync 4210W",
+ 0, 0,
6, /* DVI entirely unknown */
{ 0|0x40, 1|0xc0, 2|0xc0, 4|0xc0, 9|0xc0,11|0xc0, 0 , 0 , 0 , 0 ,
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
@@ -2285,6 +2266,7 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
{ 0x000c, 0x000b, 0x0000, 0x0000, 0x0000 },
{ "", "", "", "", "" },
"Pioneer 503CMX/PDA-5002",
+ 0, 0,
6, /* DVI unknown */
{ 1|0xc0, 2|0xc0, 9|0xc0,11|0xc0,12|0xc0,15|0xc0, 0 , 0 , 0 , 0 ,
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
@@ -2293,6 +2275,7 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
{ 0xa00e, 0x0000, 0x0000, 0x0000, 0x0000 },
{ "", "", "", "", "" },
"Panasonic TH-42",
+ 0, 0,
5, /* No DVI output */
{ 1|0x40, 2|0x40, 4|0x40, 9|0x40,15|0x40, 0 , 0 , 0 , 0 , 0 ,
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
@@ -2301,10 +2284,20 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
{ 0xa005, 0x0000, 0x0000, 0x0000, 0x0000 },
{ "TH-42PW*4", "", "", "", "" },
"Panasonic TH-42PW5",
+ 0, 0,
1, /* No special modes otherwise; no DVI. */
{20|0x40,19|0x40, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
},
+ { 0x4c2e, 1,
+ { 0x9b05, 0x0000, 0x0000, 0x0000, 0x0000 },
+ { "PLV-Z2", "", "", "", "" },
+ "Sanyo PLV-Z2 (non HDCP-mode)", /* HDCP mode would be id 9b06, but not needed */
+ 1280, 768, /* as it then advertises correct size */
+ 1, /* 1280x720, no special modes otherwise */
+ { 6|0xc0, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
+ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
+ },
{ 0x0000 }
};
@@ -2351,9 +2344,12 @@ BOOLEAN SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr
BOOLEAN SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
DisplayModePtr mode, BOOLEAN IsCustom);
int SiSTranslateToVESA(ScrnInfoPtr pScrn, int modenumber);
+int SiSTranslateToOldMode(int modenumber);
BOOLEAN SiS_GetPanelID(SiS_Private *SiS_Pr, PSIS_HW_INFO);
USHORT SiS_CheckBuildCustomMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int VBFlags);
DisplayModePtr SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN isfordvi);
+int SiS_FindPanelFromDB(SISPtr pSiS, USHORT panelvendor, USHORT panelproduct, int *maxx, int *maxy);
+void SiS_MakeClockRegs(ScrnInfoPtr pScrn, int clock, UCHAR *p2b, UCHAR *p2c);
#else
BOOLEAN SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo);
#endif
@@ -2362,10 +2358,7 @@ int sisfb_mode_rate_to_dclock(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
unsigned char modeno, unsigned char rateindex);
int sisfb_mode_rate_to_ddata(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
unsigned char modeno, unsigned char rateindex,
- ULONG *left_margin, ULONG *right_margin,
- ULONG *upper_margin, ULONG *lower_margin,
- ULONG *hsync_len, ULONG *vsync_len,
- ULONG *sync, ULONG *vmode);
+ struct fb_var_screeninfo *var);
BOOLEAN sisfb_gettotalfrommode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
unsigned char modeno, int *htotal, int *vtotal, unsigned char rateindex);
#endif
@@ -2397,8 +2390,7 @@ extern void SiSCalcClock(ScrnInfoPtr pScrn, int clock, int max_VLD, unsigned in
extern unsigned char SiS_GetSetBIOSScratch(ScrnInfoPtr pScrn, USHORT offset, unsigned char value);
extern unsigned char SiS_GetSetModeID(ScrnInfoPtr pScrn, unsigned char id);
-extern USHORT SiS_CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned long VBFlags,
- BOOLEAN hcm);
+extern USHORT SiS_GetModeNumber(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned long VBFlags);
#endif
#endif
diff --git a/src/init301.c b/src/init301.c
index ab20ab6..abcbfa5 100644
--- a/src/init301.c
+++ b/src/init301.c
@@ -1,9 +1,10 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c,v 1.13 2004/08/20 18:57:06 kem Exp $ */
/*
* Mode initializing code (CRT2 section)
* for SiS 300/305/540/630/730 and
- * 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)
+ * SiS 315/550/650/M650/651/661FX/M661xX/740/741(GX)/M741/330/660/M660/760/M760
+ * (Universal module for Linux kernel framebuffer and XFree86/X.org 4.x)
*
* Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria
*
@@ -115,7 +116,10 @@ SiS_LockCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
static void
SiS_SetRegSR11ANDOR(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT DataAND, USHORT DataOR)
{
- if(HwInfo->jChipType >= SIS_661) DataAND &= 0x0f;
+ if(HwInfo->jChipType >= SIS_661) {
+ DataAND &= 0x0f;
+ DataOR &= 0x0f;
+ }
SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x11,DataAND,DataOR);
}
@@ -129,17 +133,29 @@ GetLCDStructPtr661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
UCHAR *myptr = NULL;
- USHORT romindex = 0;
+ USHORT romindex = 0, reg = 0, idx = 0;
- /* Use the BIOS tables only for LVDS panels; DVI is unreliable
+ /* Use the BIOS tables only for LVDS panels; TMDS is unreliable
* due to the variaty of panels the BIOS doesn't know about.
+ * Exception: If the BIOS has better knowledge (such as in case
+ * of machines with a 301C and a panel that does not support DDC)
+ * use the BIOS data as well.
*/
- if((SiS_Pr->SiS_ROMNew) && (SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) {
- myptr = (UCHAR *)SiS_LCDStruct661;
- romindex = SISGETROMW(0x100); /* 10c, 0.93: 10e */
+ if((SiS_Pr->SiS_ROMNew) &&
+ ((SiS_Pr->SiS_VBType & VB_SIS301LV302LV) || (!SiS_Pr->PanelSelfDetected))) {
+
+ if(HwInfo->jChipType < SIS_661) reg = 0x3c;
+ else reg = 0x7d;
+
+ idx = (SiS_GetReg(SiS_Pr->SiS_P3d4,reg) & 0x1f) * 26;
+
+ if(idx < (8*26)) {
+ myptr = (UCHAR *)&SiS_LCDStruct661[idx];
+ }
+ romindex = SISGETROMW(0x100);
if(romindex) {
- romindex += ((SiS_GetReg(SiS_Pr->SiS_P3d4,0x7d) & 0x1f) * 26);
+ romindex += idx;
myptr = &ROMAddr[romindex];
}
}
@@ -152,12 +168,16 @@ GetLCDStructPtr661_2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
USHORT romptr = 0;
- /* Use the BIOS tables only for LVDS panels; DVI is unreliable
+ /* Use the BIOS tables only for LVDS panels; TMDS is unreliable
* due to the variaty of panels the BIOS doesn't know about.
+ * Exception: If the BIOS has better knowledge (such as in case
+ * of machines with a 301C and a panel that does not support DDC)
+ * use the BIOS data as well.
*/
- if((SiS_Pr->SiS_ROMNew) && (SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) {
- romptr = SISGETROMW(0x102); /* 2ad */
+ if((SiS_Pr->SiS_ROMNew) &&
+ ((SiS_Pr->SiS_VBType & VB_SIS301LV302LV) || (!SiS_Pr->PanelSelfDetected))) {
+ romptr = SISGETROMW(0x102);
romptr += ((SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) >> 4) * SiS_Pr->SiS661LCD2TableSize);
}
@@ -171,12 +191,11 @@ GetLCDStructPtr661_2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
static BOOLEAN
SiS_AdjustCRT2Rate(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
- USHORT RefreshRateTableIndex, USHORT *i,
- PSIS_HW_INFO HwInfo)
+ USHORT RRTI, USHORT *i, PSIS_HW_INFO HwInfo)
{
USHORT checkmask=0,modeid,infoflag;
- modeid = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].ModeID;
+ modeid = SiS_Pr->SiS_RefIndex[RRTI + (*i)].ModeID;
if(SiS_Pr->SiS_VBType & VB_SISVB) {
@@ -237,8 +256,8 @@ SiS_AdjustCRT2Rate(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
/* Look backwards in table for matching CRT2 mode */
- for(; SiS_Pr->SiS_RefIndex[RefreshRateTableIndex+(*i)].ModeID == modeid; (*i)--) {
- infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].Ext_InfoFlag;
+ for(; SiS_Pr->SiS_RefIndex[RRTI + (*i)].ModeID == modeid; (*i)--) {
+ infoflag = SiS_Pr->SiS_RefIndex[RRTI + (*i)].Ext_InfoFlag;
if(infoflag & checkmask) return TRUE;
if((*i) == 0) break;
}
@@ -247,13 +266,11 @@ 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 != modeid) {
- return FALSE;
- }
- infoflag = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + (*i)].Ext_InfoFlag;
+ if(SiS_Pr->SiS_RefIndex[RRTI + (*i)].ModeID != modeid) break;
+ infoflag = SiS_Pr->SiS_RefIndex[RRTI + (*i)].Ext_InfoFlag;
if(infoflag & checkmask) return TRUE;
}
- return TRUE;
+ return FALSE;
}
/*********************************************/
@@ -269,16 +286,17 @@ SiS_GetRatePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01,
0x00, 0x00, 0x00, 0x00 };
- USHORT RefreshRateTableIndex,i,backup_i;
+ USHORT RRTI,i,backup_i;
USHORT modeflag,index,temp,backupindex;
/* Do NOT check for UseCustomMode here, will skrew up FIFO */
if(ModeNo == 0xfe) return 0;
- if(ModeNo <= 0x13)
+ if(ModeNo <= 0x13) {
modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
- else
+ } else {
modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ }
if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
@@ -313,23 +331,23 @@ SiS_GetRatePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
}
- RefreshRateTableIndex = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].REFindex;
- ModeNo = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].ModeID;
+ RRTI = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].REFindex;
+ ModeNo = SiS_Pr->SiS_RefIndex[RRTI].ModeID;
if(HwInfo->jChipType >= SIS_315H) {
if(!(SiS_Pr->SiS_VBInfo & DriverMode)) {
if( (SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_VESAID == 0x105) ||
(SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_VESAID == 0x107) ) {
- if(backupindex <= 1) RefreshRateTableIndex++;
+ if(backupindex <= 1) RRTI++;
}
}
}
i = 0;
do {
- if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + i].ModeID != ModeNo) break;
- temp = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + i].Ext_InfoFlag;
- temp &= ModeInfoFlag;
+ if(SiS_Pr->SiS_RefIndex[RRTI + i].ModeID != ModeNo) break;
+ temp = SiS_Pr->SiS_RefIndex[RRTI + i].Ext_InfoFlag;
+ temp &= ModeTypeMask;
if(temp < SiS_Pr->SiS_ModeType) break;
i++;
index--;
@@ -337,7 +355,7 @@ SiS_GetRatePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC)) {
if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
- temp = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex + i - 1].Ext_InfoFlag;
+ temp = SiS_Pr->SiS_RefIndex[RRTI + i - 1].Ext_InfoFlag;
if(temp & InterlaceMode) i++;
}
}
@@ -346,12 +364,12 @@ SiS_GetRatePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if((SiS_Pr->SiS_SetFlag & ProgrammingCRT2) && (!(SiS_Pr->SiS_VBInfo & DisableCRT2Display))) {
backup_i = i;
- if(!(SiS_AdjustCRT2Rate(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, &i, HwInfo))) {
+ if(!(SiS_AdjustCRT2Rate(SiS_Pr, ModeNo, ModeIdIndex, RRTI, &i, HwInfo))) {
i = backup_i;
}
}
- return(RefreshRateTableIndex + i);
+ return(RRTI + i);
}
/*********************************************/
@@ -422,6 +440,7 @@ SiS_DDC2Delay(SiS_Private *SiS_Pr, USHORT delaytime)
}
}
+#if defined(SIS300) || defined(SIS315H)
static void
SiS_GenericDelay(SiS_Private *SiS_Pr, USHORT delay)
{
@@ -436,6 +455,7 @@ SiS_GenericDelay(SiS_Private *SiS_Pr, USHORT delay)
delay--;
}
}
+#endif
#ifdef SIS315H
static void
@@ -447,6 +467,7 @@ SiS_LongDelay(SiS_Private *SiS_Pr, USHORT delay)
}
#endif
+#if defined(SIS300) || defined(SIS315H)
static void
SiS_ShortDelay(SiS_Private *SiS_Pr, USHORT delay)
{
@@ -454,12 +475,15 @@ SiS_ShortDelay(SiS_Private *SiS_Pr, USHORT delay)
SiS_GenericDelay(SiS_Pr,0x42);
}
}
+#endif
static void
SiS_PanelDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT DelayTime)
{
+#if defined(SIS300) || defined(SIS315H)
UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
USHORT PanelID, DelayIndex, Delay=0;
+#endif
if(HwInfo->jChipType < SIS_315H) {
@@ -474,7 +498,6 @@ SiS_PanelDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT DelayTime)
Delay = 3;
} else {
if(DelayTime >= 2) DelayTime -= 2;
-
if(!(DelayTime & 0x01)) {
Delay = SiS_Pr->SiS_PanelDelayTbl[DelayIndex].timer[0];
} else {
@@ -482,15 +505,12 @@ SiS_PanelDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT DelayTime)
}
if(SiS_Pr->SiS_UseROM) {
if(ROMAddr[0x220] & 0x40) {
- if(!(DelayTime & 0x01)) {
- Delay = (USHORT)ROMAddr[0x225];
- } else {
- Delay = (USHORT)ROMAddr[0x226];
- }
+ if(!(DelayTime & 0x01)) Delay = (USHORT)ROMAddr[0x225];
+ else Delay = (USHORT)ROMAddr[0x226];
}
}
}
- SiS_ShortDelay(SiS_Pr,Delay);
+ SiS_ShortDelay(SiS_Pr, Delay);
#endif /* SIS300 */
@@ -498,7 +518,10 @@ SiS_PanelDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT DelayTime)
#ifdef SIS315H
- if(HwInfo->jChipType >= SIS_661) {
+ if((HwInfo->jChipType >= SIS_661) ||
+ (HwInfo->jChipType <= SIS_315PRO) ||
+ (HwInfo->jChipType == SIS_330) ||
+ (SiS_Pr->SiS_ROMNew)) {
if(!(DelayTime & 0x01)) {
SiS_DDC2Delay(SiS_Pr, 0x1000);
@@ -506,11 +529,9 @@ SiS_PanelDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT DelayTime)
SiS_DDC2Delay(SiS_Pr, 0x4000);
}
- } else if(HwInfo->jChipType >= SIS_330) return;
-
- if((SiS_Pr->SiS_IF_DEF_LVDS == 1) ||
+ } else if((SiS_Pr->SiS_IF_DEF_LVDS == 1) /* ||
(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) { /* 315 series, LVDS; Special */
+ (SiS_Pr->SiS_CustomT == CUT_CLEVO1400) */ ) { /* 315 series, LVDS; Special */
if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) {
PanelID = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36);
@@ -541,7 +562,7 @@ SiS_PanelDelay(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT DelayTime)
}
}
}
- SiS_ShortDelay(SiS_Pr,Delay);
+ SiS_ShortDelay(SiS_Pr, Delay);
}
} else if(SiS_Pr->SiS_VBType & VB_SISVB) { /* 315 series, all bridges */
@@ -584,7 +605,6 @@ SiS_WaitRetrace1(SiS_Private *SiS_Pr)
USHORT watchdog;
if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x1f) & 0xc0) return;
-
if(!(SiS_GetReg(SiS_Pr->SiS_P3d4,0x17) & 0x80)) return;
watchdog = 65535;
@@ -593,6 +613,7 @@ SiS_WaitRetrace1(SiS_Private *SiS_Pr)
while((!(SiS_GetRegByte(SiS_Pr->SiS_P3da) & 0x08)) && --watchdog);
}
+#if defined(SIS300) || defined(SIS315H)
static void
SiS_WaitRetrace2(SiS_Private *SiS_Pr, USHORT reg)
{
@@ -603,6 +624,7 @@ SiS_WaitRetrace2(SiS_Private *SiS_Pr, USHORT reg)
watchdog = 65535;
while((!(SiS_GetReg(SiS_Pr->SiS_Part1Port,reg) & 0x02)) && --watchdog);
}
+#endif
static void
SiS_WaitVBRetrace(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
@@ -640,10 +662,10 @@ SiS_VBWait(SiS_Private *SiS_Pr)
tempal = SiS_GetRegByte(SiS_Pr->SiS_P3da);
if(temp & 0x01) {
if((tempal & 0x08)) continue;
- if(!(tempal & 0x08)) break;
+ else break;
} else {
if(!(tempal & 0x08)) continue;
- if((tempal & 0x08)) break;
+ else break;
}
}
temp ^= 0x01;
@@ -664,12 +686,14 @@ SiS_VBLongWait(SiS_Private *SiS_Pr)
/* HELPER: MISC */
/*********************************************/
+#ifdef SIS300
static BOOLEAN
SiS_Is301B(SiS_Private *SiS_Pr)
{
if(SiS_GetReg(SiS_Pr->SiS_Part4Port,0x01) >= 0xb0) return TRUE;
return FALSE;
}
+#endif
static BOOLEAN
SiS_CRT2IsLCD(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
@@ -715,6 +739,16 @@ SiS_IsVAMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
return FALSE;
}
+#ifdef SIS315H
+static BOOLEAN
+SiS_IsVAorLCD(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
+{
+ if(SiS_IsVAMode(SiS_Pr,HwInfo)) return TRUE;
+ if(SiS_CRT2IsLCD(SiS_Pr, HwInfo)) return TRUE;
+ return FALSE;
+}
+#endif
+
static BOOLEAN
SiS_IsDualLink(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
@@ -754,11 +788,8 @@ SiS_LCDAEnabled(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
static BOOLEAN
SiS_WeHaveBacklightCtrl(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
- USHORT flag;
-
if((HwInfo->jChipType >= SIS_315H) && (HwInfo->jChipType < SIS_661)) {
- flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x79);
- if(flag & 0x10) return TRUE;
+ if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x79) & 0x10) return TRUE;
}
return FALSE;
}
@@ -854,12 +885,12 @@ SiS_BridgeIsOn(SiS_Private *SiS_Pr)
USHORT flag;
if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
- return FALSE;
+ return TRUE;
} else if(SiS_Pr->SiS_VBType & VB_SISVB) {
flag = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x00);
- if((flag == 1) || (flag == 2)) return FALSE;
+ if((flag == 1) || (flag == 2)) return TRUE;
}
- return TRUE;
+ return FALSE;
}
static BOOLEAN
@@ -867,21 +898,21 @@ SiS_BridgeIsEnabled(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
USHORT flag;
- if(!(SiS_BridgeIsOn(SiS_Pr))) {
+ if(SiS_BridgeIsOn(SiS_Pr)) {
flag = SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00);
if(HwInfo->jChipType < SIS_315H) {
flag &= 0xa0;
- if((flag == 0x80) || (flag == 0x20)) return FALSE;
+ if((flag == 0x80) || (flag == 0x20)) return TRUE;
} else {
flag &= 0x50;
- if((flag == 0x40) || (flag == 0x10)) return FALSE;
+ if((flag == 0x40) || (flag == 0x10)) return TRUE;
}
}
- return TRUE;
+ return FALSE;
}
static BOOLEAN
-SiS_BridgeInSlave(SiS_Private *SiS_Pr)
+SiS_BridgeInSlavemode(SiS_Private *SiS_Pr)
{
USHORT flag1;
@@ -939,10 +970,10 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_Pr->SiS_SetFlag = 0;
- SiS_Pr->SiS_ModeType = modeflag & ModeInfoFlag;
+ SiS_Pr->SiS_ModeType = modeflag & ModeTypeMask;
tempbx = 0;
- if(SiS_BridgeIsOn(SiS_Pr) == 0) {
+ if(SiS_BridgeIsOn(SiS_Pr)) {
temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);
#if 0
if(HwInfo->jChipType < SIS_661) {
@@ -964,13 +995,13 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
#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_SISLCDA) {
if(ModeNo == 0x03) {
/* Mode 0x03 is never in driver mode */
SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x31,0xbf);
}
if(!(SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) & (DriverMode >> 8))) {
- /* Reset LCDA setting */
+ /* Reset LCDA setting if not driver mode */
SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xfc);
}
if(IS_SIS650) {
@@ -995,13 +1026,13 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
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(SiS_Pr->SiS_VBType & VB_SISYPBPR) {
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)) {
+ } else if(SiS_Pr->SiS_VBType & VB_SISHIVISION) {
if(temp & 0x04) {
temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35) & 0xe0;
if(temp == 0x60) tempbx |= SetCRT2ToHiVision;
@@ -1125,9 +1156,9 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
}
} else {
- if(!(SiS_BridgeIsEnabled(SiS_Pr,HwInfo))) {
+ if(SiS_BridgeIsEnabled(SiS_Pr,HwInfo)) {
if(!(tempbx & DriverMode)) {
- if(SiS_BridgeInSlave(SiS_Pr)) {
+ if(SiS_BridgeInSlavemode(SiS_Pr)) {
tempbx |= SetSimuScanMode;
}
}
@@ -1428,7 +1459,7 @@ 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;
+ if(temp == Panel_1280x800_2) temp = Panel_1280x800;
return temp;
}
@@ -1437,25 +1468,68 @@ SiS_GetLCDInfoBIOS(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
#ifdef SIS315H
UCHAR *ROMAddr;
+ USHORT temp;
+
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "Paneldata driver: [%d %d] [H %d %d] [V %d %d] [C %d 0x%02x 0x%02x]\n",
+ SiS_Pr->PanelHT, SiS_Pr->PanelVT,
+ SiS_Pr->PanelHRS, SiS_Pr->PanelHRE,
+ SiS_Pr->PanelVRS, SiS_Pr->PanelVRE,
+ SiS_Pr->SiS_VBVCLKData[SiS_Pr->PanelVCLKIdx315].CLOCK,
+ SiS_Pr->SiS_VBVCLKData[SiS_Pr->PanelVCLKIdx315].Part4_A,
+ SiS_Pr->SiS_VBVCLKData[SiS_Pr->PanelVCLKIdx315].Part4_B);
+#endif
if((ROMAddr = GetLCDStructPtr661(SiS_Pr, HwInfo))) {
- SiS_Pr->PanelHT = SISGETROMW(6);
- SiS_Pr->PanelVT = SISGETROMW(8);
+ if((temp = SISGETROMW(6)) != SiS_Pr->PanelHT) {
+ SiS_Pr->SiS_NeedRomModeData = TRUE;
+ SiS_Pr->PanelHT = temp;
+ }
+ if((temp = SISGETROMW(8)) != SiS_Pr->PanelVT) {
+ SiS_Pr->SiS_NeedRomModeData = TRUE;
+ SiS_Pr->PanelVT = temp;
+ }
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_VBVCLKData[VCLK_CUSTOM_315].CLOCK = (USHORT)((UCHAR)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_VCLKData[VCLK_CUSTOM_315].SR2C =
SiS_Pr->SiS_VBVCLKData[VCLK_CUSTOM_315].Part4_B = ROMAddr[20];
+
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "Paneldata BIOS: [%d %d] [H %d %d] [V %d %d] [C %d 0x%02x 0x%02x]\n",
+ SiS_Pr->PanelHT, SiS_Pr->PanelVT,
+ SiS_Pr->PanelHRS, SiS_Pr->PanelHRE,
+ SiS_Pr->PanelVRS, SiS_Pr->PanelVRE,
+ SiS_Pr->SiS_VBVCLKData[SiS_Pr->PanelVCLKIdx315].CLOCK,
+ SiS_Pr->SiS_VBVCLKData[SiS_Pr->PanelVCLKIdx315].Part4_A,
+ SiS_Pr->SiS_VBVCLKData[SiS_Pr->PanelVCLKIdx315].Part4_B);
+#endif
+
}
#endif
}
+static void
+SiS_CheckScaling(SiS_Private *SiS_Pr, USHORT resinfo, const UCHAR *nonscalingmodes)
+{
+ int i = 0;
+ while(nonscalingmodes[i] != 0xff) {
+ if(nonscalingmodes[i++] == resinfo) {
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) ||
+ (SiS_Pr->UsePanelScaler == -1)) {
+ SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
+ }
+ break;
+ }
+ }
+}
+
void
SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
PSIS_HW_INFO HwInfo)
@@ -1466,7 +1540,8 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
#ifdef SIS315H
UCHAR *myptr = NULL;
#endif
- USHORT temp,modeflag,resinfo=0;
+ USHORT temp,modeflag,resinfo=0,modexres=0,modeyres=0;
+ BOOLEAN panelcanscale = FALSE;
const unsigned char SiS300SeriesLCDRes[] =
{ 0, 1, 2, 3, 7, 4, 5, 8,
0, 0, 10, 0, 0, 0, 0, 15 };
@@ -1478,6 +1553,7 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_Pr->PanelHRE = 999; /* HSync end */
SiS_Pr->PanelVRS = 999; /* VSync start */
SiS_Pr->PanelVRE = 999; /* VSync end */
+ SiS_Pr->SiS_NeedRomModeData = FALSE;
if(!(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))) return;
@@ -1488,9 +1564,14 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
} else {
modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
+ modexres = SiS_Pr->SiS_ModeResInfo[resinfo].HTotal;
+ modeyres = SiS_Pr->SiS_ModeResInfo[resinfo].VTotal;
}
temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36);
+
+ /* For broken BIOSes: Assume 1024x768 */
+ if(temp == 0) temp = 0x02;
if((HwInfo->jChipType >= SIS_661) || (SiS_Pr->SiS_ROMNew)) {
SiS_Pr->SiS_LCDTypeInfo = (SiS_GetReg(SiS_Pr->SiS_P3d4,0x39) & 0x7c) >> 2;
@@ -1505,19 +1586,20 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
temp = SiS300SeriesLCDRes[temp];
}
+ /* Translate to our internal types */
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->SiS_VBType & VB_SIS301LV302LV) { /* SiS LVDS */
+ if(SiS_Pr->SiS_VBType & VB_SISLVDS) { /* 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;
+ }
+ if(SiS_Pr->SiS_ROMNew) {
+ if(temp == Panel661_1280x800) {
+ temp = Panel_1280x800_2;
}
-#endif
}
}
@@ -1538,6 +1620,73 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_LCDResInfo < SiS_Pr->SiS_PanelMinLVDS)
SiS_Pr->SiS_LCDResInfo = SiS_Pr->SiS_PanelMinLVDS;
}
+
+ temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x37);
+ SiS_Pr->SiS_LCDInfo = temp & ~0x000e;
+ /* Need temp below! */
+
+ if(SiS_Pr->SiS_LCDResInfo == Panel_1280x960) SiS_Pr->SiS_LCDInfo &= ~DontExpandLCD;
+
+ panelcanscale = (SiS_Pr->SiS_LCDInfo & DontExpandLCD) ? TRUE : FALSE;
+
+ if(!SiS_Pr->UsePanelScaler) SiS_Pr->SiS_LCDInfo &= ~DontExpandLCD;
+ else if(SiS_Pr->UsePanelScaler == 1) SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
+
+ /* Dual link, Pass 1:1 BIOS default, etc. */
+#ifdef SIS315H
+ if(HwInfo->jChipType >= SIS_661) {
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
+ if(temp & 0x08) SiS_Pr->SiS_LCDInfo |= LCDPass11;
+ }
+ if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
+ 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;
+ }
+ } else if(!(SiS_Pr->SiS_ROMNew)) {
+ if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
+ if((SiS_Pr->SiS_CustomT == CUT_CLEVO1024) &&
+ (SiS_Pr->SiS_LCDResInfo == Panel_1024x768)) {
+ 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
+
+ /* Pass 1:1 */
+ if((SiS_Pr->SiS_IF_DEF_LVDS == 1) || (SiS_Pr->SiS_VBType & VB_NoLCD)) {
+ /* 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_SISLVDS) {
+ /* 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 supported) */
+ if(panelcanscale) SiS_Pr->SiS_LCDInfo |= LCDPass11;
+ if(SiS_Pr->CenterScreen == 1) SiS_Pr->SiS_LCDInfo &= ~LCDPass11;
+ }
+ }
SiS_Pr->PanelVCLKIdx300 = VCLK65_300;
SiS_Pr->PanelVCLKIdx315 = VCLK108_2_315;
@@ -1569,7 +1718,7 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
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->PanelVRS = 2 /* 88 */ ; SiS_Pr->PanelVRE = 6;
SiS_Pr->PanelVCLKIdx300 = VCLK65_300;
SiS_Pr->PanelVCLKIdx315 = VCLK65_315;
break;
@@ -1607,31 +1756,37 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
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;
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ SiS_Pr->PanelHT = 1408; SiS_Pr->PanelVT = 806;
+ SiS_Pr->PanelVCLKIdx300 = VCLK81_300; /* ? */
+ SiS_Pr->PanelVCLKIdx315 = VCLK81_315; /* ? */
+ } else {
+ 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->PanelHT = 1660; SiS_Pr->PanelVT = 806;
+ SiS_Pr->PanelHRS = 48; SiS_Pr->PanelHRE = 112;
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_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 = VCLK_1280x800_315;
+ SiS_GetLCDInfoBIOS(SiS_Pr, HwInfo);
+ break;
+ case Panel_1280x800_2: SiS_Pr->PanelXRes = 1280; SiS_Pr->PanelYRes = 800;
+ SiS_Pr->PanelHT = 1552; SiS_Pr->PanelVT = 812;
+ SiS_Pr->PanelHRS = 48; SiS_Pr->PanelHRE = 112;
+ SiS_Pr->PanelVRS = 4; SiS_Pr->PanelVRE = 3;
+ SiS_Pr->PanelVCLKIdx315 = VCLK_1280x800_315_2;
SiS_GetLCDInfoBIOS(SiS_Pr, HwInfo);
break;
case Panel_1280x960: SiS_Pr->PanelXRes = 1280; SiS_Pr->PanelYRes = 960;
@@ -1672,6 +1827,12 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_Pr->PanelVCLKIdx315 = VCLK121_315;
SiS_GetLCDInfoBIOS(SiS_Pr, HwInfo);
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;
case Panel_Custom: SiS_Pr->PanelXRes = SiS_Pr->CP_MaxX;
SiS_Pr->PanelYRes = SiS_Pr->CP_MaxY;
SiS_Pr->PanelHT = SiS_Pr->CHTotal;
@@ -1689,123 +1850,190 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_Pr->PanelHRE -= SiS_Pr->PanelHRS;
SiS_Pr->PanelVRS -= SiS_Pr->PanelYRes;
SiS_Pr->PanelVRE -= SiS_Pr->PanelVRS;
+ if(SiS_Pr->CP_PrefClock) {
+ int idx;
+ SiS_Pr->PanelVCLKIdx315 = VCLK_CUSTOM_315;
+ SiS_Pr->PanelVCLKIdx300 = VCLK_CUSTOM_300;
+ if(HwInfo->jChipType < SIS_315H) idx = VCLK_CUSTOM_300;
+ else idx = VCLK_CUSTOM_315;
+ SiS_Pr->SiS_VCLKData[idx].CLOCK =
+ SiS_Pr->SiS_VBVCLKData[idx].CLOCK = SiS_Pr->CP_PrefClock;
+ SiS_Pr->SiS_VCLKData[idx].SR2B =
+ SiS_Pr->SiS_VBVCLKData[idx].Part4_A = SiS_Pr->CP_PrefSR2B;
+ SiS_Pr->SiS_VCLKData[idx].SR2C =
+ SiS_Pr->SiS_VBVCLKData[idx].Part4_B = SiS_Pr->CP_PrefSR2C;
+ }
}
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;
+ }
+
+ /* 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;
}
- temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x37);
- 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;
+ 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_661) {
- if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
- if(temp & 0x08) SiS_Pr->SiS_LCDInfo |= LCDPass11;
+ /* DontExpand overrule */
+ if((SiS_Pr->SiS_VBType & VB_SISVB) && (!(SiS_Pr->SiS_VBType & VB_NoLCD))) {
+
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) && (modeflag & NoSupportLCDScale)) {
+ /* No scaling for this mode on any panel */
+ SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
}
- if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
- 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;
+
+ switch(SiS_Pr->SiS_LCDResInfo) {
+
+ case Panel_Custom:
+ case Panel_1152x864:
+ case Panel_1280x768: /* TMDS only */
+ SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
+ break;
+
+ case Panel_800x600: {
+ static const UCHAR nonscalingmodes[] = {
+ SIS_RI_720x480, SIS_RI_720x576, SIS_RI_768x576, SIS_RI_800x480, SIS_RI_848x480,
+ SIS_RI_856x480, SIS_RI_960x540, 0xff
+ };
+ SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
+ break;
+ }
+ case Panel_1024x768: {
+ static const UCHAR nonscalingmodes[] = {
+ SIS_RI_720x480, SIS_RI_720x576, SIS_RI_768x576, SIS_RI_800x480, SIS_RI_848x480,
+ SIS_RI_856x480, SIS_RI_960x540, SIS_RI_1024x576,SIS_RI_1024x600,0xff
+ };
+ SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
+ break;
+ }
+ case Panel_1280x720: {
+ static const UCHAR nonscalingmodes[] = {
+ SIS_RI_720x480, SIS_RI_720x576, SIS_RI_768x576, SIS_RI_800x480, SIS_RI_848x480,
+ SIS_RI_856x480, SIS_RI_960x540, SIS_RI_1024x576,SIS_RI_1024x600,0xff
+ };
+ SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
+ if(SiS_Pr->PanelHT == 1650) {
+ SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
}
+ break;
}
- } 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;
+ case Panel_1280x768_2: { /* LVDS only */
+ static const UCHAR nonscalingmodes[] = {
+ SIS_RI_720x480, SIS_RI_720x576, SIS_RI_768x576, SIS_RI_800x480, SIS_RI_848x480,
+ SIS_RI_856x480, SIS_RI_960x540, SIS_RI_1024x576,SIS_RI_1024x600,SIS_RI_1152x768,
+ 0xff
+ };
+ SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
+ switch(resinfo) {
+ case SIS_RI_1280x720: if(SiS_Pr->UsePanelScaler == -1) {
+ SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
+ }
+ break;
+ }
+ break;
}
- 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;
+ case Panel_1280x800: { /* SiS TMDS special (Averatec 6200 series) */
+ static const UCHAR nonscalingmodes[] = {
+ SIS_RI_720x480, SIS_RI_720x576, SIS_RI_768x576, SIS_RI_800x480, SIS_RI_848x480,
+ SIS_RI_856x480, SIS_RI_960x540, SIS_RI_1024x576,SIS_RI_1024x600,SIS_RI_1152x768,
+ SIS_RI_1280x720, SIS_RI_1280x768, 0xff
+ };
+ SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
+ break;
+ }
+ case Panel_1280x800_2: { /* SiS LVDS */
+ static const UCHAR nonscalingmodes[] = {
+ SIS_RI_720x480, SIS_RI_720x576, SIS_RI_768x576, SIS_RI_800x480, SIS_RI_848x480,
+ SIS_RI_856x480, SIS_RI_960x540, SIS_RI_1024x576,SIS_RI_1024x600,SIS_RI_1152x768,
+ 0xff
+ };
+ SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
+ switch(resinfo) {
+ case SIS_RI_1280x720:
+ case SIS_RI_1280x768: if(SiS_Pr->UsePanelScaler == -1) {
+ SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
+ }
+ break;
}
+ break;
+ }
+ case Panel_1280x960: {
+ static const UCHAR nonscalingmodes[] = {
+ SIS_RI_720x480, SIS_RI_720x576, SIS_RI_768x576, SIS_RI_800x480, SIS_RI_848x480,
+ SIS_RI_856x480, SIS_RI_960x540, SIS_RI_1024x576,SIS_RI_1024x600,SIS_RI_1152x768,
+ SIS_RI_1152x864,SIS_RI_1280x720,SIS_RI_1280x768,SIS_RI_1280x800,0xff
+ };
+ SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
+ break;
+ }
+ case Panel_1280x1024: {
+ static const UCHAR nonscalingmodes[] = {
+ SIS_RI_720x480, SIS_RI_720x576, SIS_RI_768x576, SIS_RI_800x480, SIS_RI_848x480,
+ SIS_RI_856x480, SIS_RI_960x540, SIS_RI_1024x576,SIS_RI_1024x600,SIS_RI_1152x768,
+ SIS_RI_1152x864,SIS_RI_1280x720,SIS_RI_1280x768,SIS_RI_1280x800,SIS_RI_1280x960,
+ 0xff
+ };
+ SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
+ break;
+ }
+ case Panel_1400x1050: {
+ static const UCHAR nonscalingmodes[] = {
+ SIS_RI_720x480, SIS_RI_720x576, SIS_RI_768x576, SIS_RI_800x480, SIS_RI_848x480,
+ SIS_RI_856x480, SIS_RI_960x540, SIS_RI_1024x576,SIS_RI_1024x600,SIS_RI_1152x768,
+ SIS_RI_1152x864,SIS_RI_1280x768,SIS_RI_1280x800,SIS_RI_1280x960,0xff
+ };
+ SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
+ switch(resinfo) {
+ case SIS_RI_1280x720: if(SiS_Pr->UsePanelScaler == -1) {
+ SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
+ }
+ break;
+ case SIS_RI_1280x1024: SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
+ break;
+ }
+ break;
+ }
+ case Panel_1600x1200: {
+ static const UCHAR nonscalingmodes[] = {
+ SIS_RI_720x480, SIS_RI_720x576, SIS_RI_768x576, SIS_RI_800x480, SIS_RI_848x480,
+ SIS_RI_856x480, SIS_RI_960x540, SIS_RI_1024x576,SIS_RI_1024x600,SIS_RI_1152x768,
+ SIS_RI_1152x864,SIS_RI_1280x720,SIS_RI_1280x768,SIS_RI_1280x800,SIS_RI_1280x960,
+ SIS_RI_1360x768,SIS_RI_1360x1024,0xff
+ };
+ SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
+ break;
+ }
+ case Panel_1680x1050: {
+ static const UCHAR nonscalingmodes[] = {
+ SIS_RI_720x480, SIS_RI_720x576, SIS_RI_768x576, SIS_RI_800x480, SIS_RI_848x480,
+ SIS_RI_856x480, SIS_RI_960x540, SIS_RI_1024x576,SIS_RI_1024x600, SIS_RI_1152x768,
+ SIS_RI_1152x864,SIS_RI_1280x960,SIS_RI_1360x768,SIS_RI_1360x1024,0xff
+ };
+ SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
+ break;
}
- }
-#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;
}
}
-
+
if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
if(SiS_Pr->SiS_CustomT == CUT_PANEL848) {
SiS_Pr->SiS_LCDInfo = 0x80 | 0x40 | 0x20; /* neg h/v sync, RGB24(D0 = 0) */
}
}
- if(SiS_Pr->SiS_VBType & VB_SISVB) {
- if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
- 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;
- }
- }
- }
-
#ifdef SIS300
if(HwInfo->jChipType < SIS_315H) {
if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
@@ -1825,12 +2053,36 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
#endif
/* Special cases */
+
+ if(modexres == SiS_Pr->PanelXRes && modeyres == SiS_Pr->PanelYRes) {
+ SiS_Pr->SiS_LCDInfo &= ~LCDPass11;
+ }
+
if(SiS_Pr->SiS_IF_DEF_TRUMPION) {
SiS_Pr->SiS_LCDInfo |= (DontExpandLCD | LCDPass11);
}
-
- if(SiS_Pr->SiS_LCDResInfo == Panel_640x480) {
+
+ switch(SiS_Pr->SiS_LCDResInfo) {
+ case Panel_640x480:
SiS_Pr->SiS_LCDInfo |= LCDPass11;
+ break;
+ case Panel_1280x800:
+ /* Don't pass 1:1 by default (TMDS special) */
+ if(SiS_Pr->CenterScreen == -1) SiS_Pr->SiS_LCDInfo &= ~LCDPass11;
+ break;
+ case Panel_1280x960:
+ SiS_Pr->SiS_LCDInfo &= ~LCDPass11;
+ break;
+ case Panel_Custom:
+ if((!SiS_Pr->CP_PrefClock) ||
+ (modexres > SiS_Pr->PanelXRes) || (modeyres > SiS_Pr->PanelYRes)) {
+ SiS_Pr->SiS_LCDInfo |= LCDPass11;
+ }
+ break;
+ }
+
+ if(SiS_Pr->UseCustomMode) {
+ SiS_Pr->SiS_LCDInfo |= (DontExpandLCD | LCDPass11);
}
/* (In)validate LCDPass11 flag */
@@ -1838,70 +2090,37 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
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_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
-
+ /* LVDS DDA */
if(!((HwInfo->jChipType < SIS_315H) && (SiS_Pr->SiS_SetFlag & SetDOSMode))) {
- if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ if((SiS_Pr->SiS_IF_DEF_LVDS == 1) || (SiS_Pr->SiS_VBType & VB_NoLCD)) {
if(SiS_Pr->SiS_IF_DEF_TRUMPION == 0) {
if(ModeNo == 0x12) {
if(SiS_Pr->SiS_LCDInfo & LCDPass11) {
SiS_Pr->SiS_SetFlag |= EnableLVDSDDA;
}
+ } else if(ModeNo > 0x13) {
+ if(SiS_Pr->SiS_LCDResInfo == Panel_1024x600) {
+ if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) {
+ if((resinfo == SIS_RI_800x600) || (resinfo == SIS_RI_400x300)) {
+ SiS_Pr->SiS_SetFlag |= EnableLVDSDDA;
+ }
+ }
+ }
}
}
}
if(modeflag & HalfDCLK) {
- if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
+ if(SiS_Pr->SiS_IF_DEF_TRUMPION == 1) {
+ SiS_Pr->SiS_SetFlag |= EnableLVDSDDA;
+ } else 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;
}
@@ -1910,6 +2129,7 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
+ /* VESA timing */
if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
if(SiS_Pr->SiS_VBInfo & SetNotSimuMode) {
SiS_Pr->SiS_SetFlag |= LCDVESATiming;
@@ -1965,14 +2185,27 @@ SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(HwInfo->jChipType < SIS_315H) {
VCLKIndex = SiS_Pr->PanelVCLKIdx300;
+ if((SiS_Pr->SiS_LCDInfo & DontExpandLCD) && (SiS_Pr->SiS_LCDInfo & LCDPass11)) {
+ VCLKIndex = VCLKIndexGEN;
+ }
} else {
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;
+ switch(resinfo) {
+ /* Only those whose IndexGEN doesn't match VBVCLK array */
+ case SIS_RI_1280x720: VCLKIndex = VCLK_1280x720; break;
+ case SIS_RI_720x480: VCLKIndex = VCLK_720x480; break;
+ case SIS_RI_720x576: VCLKIndex = VCLK_720x576; break;
+ case SIS_RI_768x576: VCLKIndex = VCLK_768x576; break;
+ case SIS_RI_848x480: VCLKIndex = VCLK_848x480; break;
+ case SIS_RI_856x480: VCLKIndex = VCLK_856x480; break;
+ case SIS_RI_800x480: VCLKIndex = VCLK_800x480; break;
+ case SIS_RI_1024x576: VCLKIndex = VCLK_1024x576; break;
+ case SIS_RI_1152x864: VCLKIndex = VCLK_1152x864; break;
+ case SIS_RI_1360x768: VCLKIndex = VCLK_1360x768; break;
+ default: VCLKIndex = VCLKIndexGEN;
}
+
if(ModeNo <= 0x13) {
if(HwInfo->jChipType <= SIS_315PRO) {
if(SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC == 1) VCLKIndex = 0x42;
@@ -2145,11 +2378,12 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
{
USHORT i,j,modeflag;
USHORT tempcl,tempah=0;
-#ifdef SIS300
- USHORT temp;
-#endif
+#if defined(SIS300) || defined(SIS315H)
+ USHORT tempbl;
+#endif
#ifdef SIS315H
- USHORT tempbl, tempah2, tempbl2;
+ UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
+ USHORT tempah2, tempbl2;
#endif
if(ModeNo <= 0x13) {
@@ -2172,6 +2406,9 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
} else {
for(i=0,j=4; i<3; i++,j++) SiS_SetReg(SiS_Pr->SiS_Part1Port,j,0);
+ if(HwInfo->jChipType >= SIS_315H) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x02,0x7F);
+ }
tempcl = SiS_Pr->SiS_ModeType;
@@ -2181,14 +2418,14 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
/* For 301BDH: (with LCD via LVDS) */
if(SiS_Pr->SiS_VBType & VB_NoLCD) {
- temp = SiS_GetReg(SiS_Pr->SiS_P3c4,0x32);
- temp &= 0xef;
- temp |= 0x02;
+ tempbl = SiS_GetReg(SiS_Pr->SiS_P3c4,0x32);
+ tempbl &= 0xef;
+ tempbl |= 0x02;
if((SiS_Pr->SiS_VBInfo & SetCRT2ToTV) || (SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC)) {
- temp |= 0x10;
- temp &= 0xfd;
+ tempbl |= 0x10;
+ tempbl &= 0xfd;
}
- SiS_SetReg(SiS_Pr->SiS_P3c4,0x32,temp);
+ SiS_SetReg(SiS_Pr->SiS_P3c4,0x32,tempbl);
}
if(ModeNo > 0x13) {
@@ -2362,7 +2599,7 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
#ifdef SIS315H
- unsigned char bridgerev = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x01);;
+ unsigned char bridgerev = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x01);
/* The following is nearly unpreditable and varies from machine
* to machine. Especially the 301DH seems to be a real trouble
@@ -2393,10 +2630,11 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
* in a 650 box (Jake). What is the criteria?
*/
- if((IS_SIS740) || (HwInfo->jChipType >= SIS_661)) {
+ if((IS_SIS740) || (HwInfo->jChipType >= SIS_661) || (SiS_Pr->SiS_ROMNew)) {
tempah = 0x30;
tempbl = 0xc0;
- if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) {
+ if((SiS_Pr->SiS_VBInfo & DisableCRT2Display) ||
+ ((SiS_Pr->SiS_ROMNew) && (!(ROMAddr[0x5b] & 0x04)))) {
tempah = 0x00;
tempbl = 0x00;
}
@@ -2427,23 +2665,23 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(IS_SIS740) {
tempah = 0x80;
- if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) {
- tempah = 0x00;
- }
+ if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) tempah = 0x00;
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x23,0x7f,tempah);
} else {
tempah = 0x00;
tempbl = 0x7f;
if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) {
tempbl = 0xff;
- if(!(SiS_IsDualEdge(SiS_Pr, HwInfo))) {
- tempah = 0x80;
- }
+ if(!(SiS_IsDualEdge(SiS_Pr, HwInfo))) tempah = 0x80;
}
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x23,tempbl,tempah);
}
-
- /* 661: Sets p4 27 and 34 here, done in SetGroup4 here (old BIOS) */
+
+#if 0
+ if(SiS_Pr->SiS_VBType & VB_SIS301C) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x3a,0xc0);
+ }
+#endif
#endif /* SIS315H */
@@ -2472,9 +2710,7 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
tempbl = 0xfb;
if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) {
tempah = 0x00;
- if(SiS_IsDualEdge(SiS_Pr, HwInfo)) {
- tempbl = 0xff;
- }
+ if(SiS_IsDualEdge(SiS_Pr, HwInfo)) tempbl = 0xff;
}
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,tempbl,tempah);
@@ -2554,9 +2790,11 @@ SiS_GetCRT2ResInfo(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
if((SiS_Pr->SiS_VBType & VB_SISVB) && (!(SiS_Pr->SiS_VBType & VB_NoLCD))) {
+#if 0
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCDA | SetCRT2ToLCD | SetCRT2ToHiVision)) {
if(xres == 720) xres = 640;
}
+#endif
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
switch(SiS_Pr->SiS_LCDResInfo) {
@@ -2720,18 +2958,22 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
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) */
+
+ if(SiS_Pr->SiS_LCDResInfo == Panel_1680x1050) {
+ if (resinfo == SIS_RI_1280x800) tempal = 9;
+ else if(resinfo == SIS_RI_1400x1050) tempal = 11;
+ } else if((SiS_Pr->SiS_LCDResInfo == Panel_1280x800) ||
+ (SiS_Pr->SiS_LCDResInfo == Panel_1280x800_2)) {
+ if (resinfo == SIS_RI_1280x768) tempal = 9;
+ }
+
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
+ /* Pass 1:1 only (center-screen handled outside) */
+ /* This is never called for the panel's native resolution */
+ /* since Pass1:1 will not be set in this case */
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;
- }
}
}
@@ -2777,13 +3019,20 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
(resinfo == SIS_RI_720x576) ||
(resinfo == SIS_RI_768x576)) {
tempal = 6;
+ if(SiS_Pr->SiS_TVMode & (TVSetPAL | TVSetPALN)) {
+ if(resinfo == SIS_RI_720x480) tempal = 9;
+ }
}
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;
+ if((resinfo == SIS_RI_720x576) ||
+ (resinfo == SIS_RI_768x576)) {
+ tempal = 8;
+ }
+ if(resinfo == SIS_RI_1280x720) tempal = 9;
}
}
}
@@ -2796,6 +3045,7 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
tempbx = 0;
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) {
@@ -2811,10 +3061,12 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) tempbx += 1;
}
}
+
} else {
+
switch(SiS_Pr->SiS_LCDResInfo) {
case Panel_640x480: tempbx = 6; break;
- case Panel_640x480_2: tempbx = 30; break;
+ case Panel_640x480_2:
case Panel_640x480_3: tempbx = 30; break;
case Panel_800x600: tempbx = 0; break;
case Panel_1024x600: tempbx = 15; break;
@@ -2840,21 +3092,22 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
if(SiS_Pr->SiS_CustomT == CUT_BARCO1024) {
tempbx = 82;
- if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++;
} else if(SiS_Pr->SiS_CustomT == CUT_PANEL848) {
tempbx = 84;
- if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++;
}
+
+ if((SiS_Pr->SiS_CustomT != CUT_BARCO1366) &&
+ (SiS_Pr->SiS_CustomT != CUT_PANEL848)) {
+ if((SiS_Pr->SiS_LCDInfo & DontExpandLCD) &&
+ (!(SiS_Pr->SiS_LCDInfo & LCDPass11))) {
+ tempal = 0;
+ }
+ }
}
- if(SiS_Pr->SiS_SetFlag & SetDOSMode) {
- 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;
}
@@ -2951,20 +3204,6 @@ SiS_GetCRT2DataLVDS(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
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;
@@ -3070,11 +3309,14 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,
PSIS_HW_INFO HwInfo)
{
- USHORT tempax,tempbx,modeflag;
- USHORT resinfo;
- USHORT CRT2Index,ResIndex;
+ UCHAR *ROMAddr = NULL;
+ USHORT tempax,tempbx,modeflag,romptr=0;
+ USHORT resinfo,CRT2Index,ResIndex;
const SiS_LCDDataStruct *LCDPtr = NULL;
const SiS_TVDataStruct *TVPtr = NULL;
+#ifdef SIS315H
+ SHORT resinfo661;
+#endif
if(ModeNo <= 0x13) {
modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
@@ -3085,6 +3327,20 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
} else {
modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
+#ifdef SIS315H
+ resinfo661 = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].ROMMODEIDX661;
+ if( (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) &&
+ (SiS_Pr->SiS_SetFlag & LCDVESATiming) &&
+ (resinfo661 >= 0) &&
+ (SiS_Pr->SiS_NeedRomModeData) ) {
+ if((ROMAddr = GetLCDStructPtr661(SiS_Pr, HwInfo))) {
+ if((romptr = (SISGETROMW(21)))) {
+ romptr += (resinfo661 * 10);
+ ROMAddr = HwInfo->pjVirtualRomBase;
+ }
+ }
+ }
+#endif
}
SiS_Pr->SiS_NewFlickerMode = 0;
@@ -3220,23 +3476,49 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
if(SiS_Pr->UseCustomMode) {
- SiS_Pr->SiS_VGAHT = SiS_Pr->CHTotal;
- SiS_Pr->SiS_VGAVT = SiS_Pr->CVTotal;
- SiS_Pr->SiS_HT = SiS_Pr->CHTotal;
- SiS_Pr->SiS_VT = SiS_Pr->CVTotal;
- SiS_Pr->SiS_HDE = SiS_Pr->SiS_VGAHDE;
- SiS_Pr->SiS_VDE = SiS_Pr->SiS_VGAVDE;
+ SiS_Pr->SiS_VGAHT = SiS_Pr->CHTotal;
+ SiS_Pr->SiS_VGAVT = SiS_Pr->CVTotal;
+ SiS_Pr->SiS_HT = SiS_Pr->CHTotal;
+ SiS_Pr->SiS_VT = SiS_Pr->CVTotal;
+ SiS_Pr->SiS_HDE = SiS_Pr->SiS_VGAHDE;
+ SiS_Pr->SiS_VDE = SiS_Pr->SiS_VGAVDE;
} else {
+
+ BOOLEAN gotit = FALSE;
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;
+ 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;
+ gotit = TRUE;
- } else {
+ } else if( (!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) && (romptr) && (ROMAddr) ) {
+
+#ifdef SIS315H
+ SiS_Pr->SiS_RVBHCMAX = ROMAddr[romptr];
+ SiS_Pr->SiS_RVBHCFACT = ROMAddr[romptr+1];
+ SiS_Pr->SiS_VGAHT = ROMAddr[romptr+2] | ((ROMAddr[romptr+3] & 0x0f) << 8);
+ SiS_Pr->SiS_VGAVT = ROMAddr[romptr+4] | ((ROMAddr[romptr+3] & 0xf0) << 4);
+ SiS_Pr->SiS_HT = ROMAddr[romptr+5] | ((ROMAddr[romptr+6] & 0x0f) << 8);
+ SiS_Pr->SiS_VT = ROMAddr[romptr+7] | ((ROMAddr[romptr+6] & 0xf0) << 4);
+ if(SiS_Pr->SiS_VGAHT) gotit = TRUE;
+ else {
+ 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;
+ gotit = TRUE;
+ }
+#endif
+
+ }
+
+ if(!gotit) {
SiS_GetCRT2Ptr(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
&CRT2Index,&ResIndex,HwInfo);
@@ -3248,10 +3530,10 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
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_1280x800_2 :
+ case Panel_1280x800_2+ 32: LCDPtr = SiS_Pr->SiS_LCD1280x800_2Data; break;
case Panel_1280x960 :
case Panel_1280x960 + 32: LCDPtr = SiS_Pr->SiS_LCD1280x960Data; break;
case Panel_1280x1024 : LCDPtr = SiS_Pr->SiS_ExtLCD1280x1024Data; break;
@@ -3435,8 +3717,10 @@ SiS_GetLVDSDesData(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
#ifdef SIS315H
if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
/* non-pass 1:1 only, see above */
- if(SiS_Pr->SiS_VGAVDE != SiS_Pr->PanelYRes) {
+ if(SiS_Pr->SiS_VGAHDE != SiS_Pr->PanelXRes) {
SiS_Pr->SiS_LCDHDES = SiS_Pr->SiS_HT - ((SiS_Pr->PanelXRes - SiS_Pr->SiS_VGAHDE) / 2);
+ }
+ if(SiS_Pr->SiS_VGAVDE != SiS_Pr->PanelYRes) {
SiS_Pr->SiS_LCDVDES = SiS_Pr->SiS_VT - ((SiS_Pr->PanelYRes - SiS_Pr->SiS_VGAVDE) / 2);
}
}
@@ -3552,207 +3836,144 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
if(SiS_Pr->SiS_VBType & VB_SISVB) {
- if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { /* ===== For 30xB/LV ===== */
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { /* ===== For 30xB/LV ===== */
if(HwInfo->jChipType < SIS_315H) {
#ifdef SIS300 /* 300 series */
- if(HwInfo->jChipType == SIS_300) { /* For 300+301LV (A907) */
-
- if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwInfo))) {
- if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFE);
- SiS_PanelDelay(SiS_Pr, HwInfo, 3);
- }
+ if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwInfo))) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFE);
+ } else {
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x08);
}
+ SiS_PanelDelay(SiS_Pr, HwInfo, 3);
+ }
+ if(SiS_Is301B(SiS_Pr)) {
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,0x3f);
SiS_ShortDelay(SiS_Pr,1);
- SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xDF);
- SiS_DisplayOff(SiS_Pr);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
- if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
- if( (!(SiS_CRT2IsLCD(SiS_Pr, HwInfo))) ||
- (!(SiS_CR36BIOSWord23d(SiS_Pr, HwInfo))) ) {
- SiS_PanelDelay(SiS_Pr, HwInfo, 2);
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFD);
- }
- }
-
- } else {
-
- if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwInfo))) {
- SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x08);
- SiS_PanelDelay(SiS_Pr, HwInfo, 3);
- }
- if(SiS_Is301B(SiS_Pr)) {
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,0x3f);
- SiS_ShortDelay(SiS_Pr,1);
- }
- SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xDF);
- SiS_DisplayOff(SiS_Pr);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
- SiS_UnLockCRT2(SiS_Pr,HwInfo);
+ }
+ SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xDF);
+ SiS_DisplayOff(SiS_Pr);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
+ SiS_UnLockCRT2(SiS_Pr,HwInfo);
+ if(!(SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) {
SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x01,0x80);
SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x02,0x40);
- if( (!(SiS_CRT2IsLCD(SiS_Pr, HwInfo))) ||
- (!(SiS_CR36BIOSWord23d(SiS_Pr, HwInfo))) ) {
- SiS_PanelDelay(SiS_Pr, HwInfo, 2);
- SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x04);
- }
}
-
+ if( (!(SiS_CRT2IsLCD(SiS_Pr, HwInfo))) ||
+ (!(SiS_CR36BIOSWord23d(SiS_Pr, HwInfo))) ) {
+ SiS_PanelDelay(SiS_Pr, HwInfo, 2);
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFD);
+ } else {
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x04);
+ }
+ }
+
#endif /* SIS300 */
} else {
#ifdef SIS315H /* 315 series */
+
+ BOOLEAN custom1 = ((SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
+ (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) ? TRUE : FALSE;
- if(IS_SIS550650740660) { /* 550, 650, 740, 660 */
-
- modenum = SiS_GetReg(SiS_Pr->SiS_P3d4,0x34) & 0x7f;
+ modenum = SiS_GetReg(SiS_Pr->SiS_P3d4,0x34) & 0x7f;
- if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { /* LV */
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+
#ifdef SET_EMI
- if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
- if(SiS_Pr->SiS_CustomT != CUT_CLEVO1400) {
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
- }
+ 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)) ) {
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFE);
- if((SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) {
- SiS_PanelDelay(SiS_Pr, HwInfo, 3);
- }
- }
-
- if((SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) &&
- (SiS_Pr->SiS_CustomT != CUT_CLEVO1400)) {
- SiS_DDC2Delay(SiS_Pr,0xff00);
- SiS_DDC2Delay(SiS_Pr,0xe000);
-
- SiS_SetRegByte(SiS_Pr->SiS_P3c6,0x00);
-
- pushax = SiS_GetReg(SiS_Pr->SiS_P3c4,0x06);
-
- if(IS_SIS740) {
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x06,0xE3);
- }
-
- SiS_PanelDelay(SiS_Pr, HwInfo, 3);
-
- if(!(SiS_IsNotM650orLater(SiS_Pr, HwInfo))) {
- tempah = 0xef;
- if(SiS_IsVAMode(SiS_Pr,HwInfo)) {
- tempah = 0xf7;
- }
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x4c,tempah);
- }
- }
-
- } else if(SiS_Pr->SiS_VBType & VB_NoLCD) { /* B-DH */
-
- if(!(SiS_IsNotM650orLater(SiS_Pr,HwInfo))) {
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x4c,0xef);
- }
-
+ if( (modenum <= 0x13) ||
+ (SiS_IsVAMode(SiS_Pr,HwInfo)) ||
+ (!(SiS_IsDualEdge(SiS_Pr,HwInfo))) ) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFE);
+ if(custom1) SiS_PanelDelay(SiS_Pr, HwInfo, 3);
}
- if((SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) {
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1F,0xef);
+ if(!custom1) {
+ SiS_DDC2Delay(SiS_Pr,0xff00);
+ SiS_DDC2Delay(SiS_Pr,0xe000);
+ SiS_SetRegByte(SiS_Pr->SiS_P3c6,0x00);
+ pushax = SiS_GetReg(SiS_Pr->SiS_P3c4,0x06);
+ if(IS_SIS740) {
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x06,0xE3);
+ }
+ SiS_PanelDelay(SiS_Pr, HwInfo, 3);
}
- if((SiS_Pr->SiS_VBType & VB_SIS301B302B) ||
- (SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) {
- tempah = 0x3f;
- if(SiS_IsDualEdge(SiS_Pr,HwInfo)) {
- tempah = 0x7f;
- if(!(SiS_IsVAMode(SiS_Pr,HwInfo))) {
- tempah = 0xbf;
- }
- }
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1F,tempah);
+ }
+
+ if(!(SiS_IsNotM650orLater(SiS_Pr, HwInfo))) {
+ if(HwInfo->jChipType < SIS_340) {
+ tempah = 0xef;
+ if(SiS_IsVAMode(SiS_Pr,HwInfo)) tempah = 0xf7;
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x4c,tempah);
}
+ }
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1F,~0x10);
+ }
+
+ tempah = 0x3f;
+ if(SiS_IsDualEdge(SiS_Pr,HwInfo)) {
+ tempah = 0x7f;
+ if(!(SiS_IsVAMode(SiS_Pr,HwInfo))) tempah = 0xbf;
+ }
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1F,tempah);
- if((SiS_IsVAMode(SiS_Pr,HwInfo)) ||
- ((SiS_Pr->SiS_VBType & VB_SIS301LV302LV) && (modenum <= 0x13))) {
-
- if((SiS_Pr->SiS_VBType & VB_SIS301B302B) ||
- (SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) {
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x1E,0xDF);
- SiS_DisplayOff(SiS_Pr);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
- } else {
- SiS_DisplayOff(SiS_Pr);
- SiS_PanelDelay(SiS_Pr, HwInfo, 2);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x1E,0xDF);
- if((SiS_Pr->SiS_VBType & VB_SIS301LV302LV) && (modenum <= 0x13)) {
- SiS_DisplayOff(SiS_Pr);
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80);
- SiS_PanelDelay(SiS_Pr, HwInfo, 2);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
- temp = SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00);
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x10);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x00,temp);
- }
- }
-
- } else {
-
- if((SiS_Pr->SiS_VBType & VB_SIS301B302B) ||
- (SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) {
- if(!(SiS_IsDualEdge(SiS_Pr,HwInfo))) {
- SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xdf);
- SiS_DisplayOff(SiS_Pr);
- }
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80);
- } else {
- SiS_DisplayOff(SiS_Pr);
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80);
- SiS_PanelDelay(SiS_Pr, HwInfo, 2);
- }
-
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
- temp = SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00);
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x10);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x00,temp);
+ if((SiS_IsVAMode(SiS_Pr,HwInfo)) ||
+ ((SiS_Pr->SiS_VBType & VB_SIS301LV302LV) && (modenum <= 0x13))) {
+ SiS_DisplayOff(SiS_Pr);
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ SiS_PanelDelay(SiS_Pr, HwInfo, 2);
+ }
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x1E,0xDF);
+
+ }
+
+ if((!(SiS_IsVAMode(SiS_Pr,HwInfo))) ||
+ ((SiS_Pr->SiS_VBType & VB_SIS301LV302LV) && (modenum <= 0x13))) {
+
+ if(!(SiS_IsDualEdge(SiS_Pr,HwInfo))) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xdf);
+ SiS_DisplayOff(SiS_Pr);
+ }
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80);
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ SiS_PanelDelay(SiS_Pr, HwInfo, 2);
}
- if((SiS_Pr->SiS_VBType & VB_SIS301LV302LV) &&
- (SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) &&
- (SiS_Pr->SiS_CustomT != CUT_CLEVO1400)) {
-
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,~0x10);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
+ temp = SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x10);
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x00,temp);
- tempah = 0x3f;
- if(SiS_IsDualEdge(SiS_Pr,HwInfo)) {
- tempah = 0x7f;
- if(!(SiS_IsVAMode(SiS_Pr,HwInfo))) {
- tempah = 0xbf;
- }
- }
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1F,tempah);
+ }
+
+ if(SiS_IsNotM650orLater(SiS_Pr,HwInfo)) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0x7f);
+ }
- if(SiS_IsNotM650orLater(SiS_Pr,HwInfo)) {
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0x7f);
- }
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+
+ if(!custom1) {
if(!(SiS_IsVAMode(SiS_Pr,HwInfo))) {
- SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xdf);
if(!(SiS_CRT2IsLCD(SiS_Pr,HwInfo))) {
if(!(SiS_IsDualEdge(SiS_Pr,HwInfo))) {
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFD);
@@ -3763,89 +3984,31 @@ 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)) ) {
+ if(SiS_IsVAorLCD(SiS_Pr, HwInfo)) {
SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 20);
}
}
-
- } else if(SiS_Pr->SiS_VBType & VB_NoLCD) {
-
- /* NIL */
-
- } else if((SiS_Pr->SiS_VBType & VB_SIS301B302B) ||
- (SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) {
-
- if(!(SiS_IsNotM650orLater(SiS_Pr,HwInfo))) {
- tempah = 0xef;
- if(SiS_IsDualEdge(SiS_Pr,HwInfo)) {
- if(modenum > 0x13) {
- tempah = 0xf7;
- }
- }
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x4c,tempah);
- }
- if((SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) {
- if((SiS_IsVAMode(SiS_Pr,HwInfo)) ||
- (!(SiS_IsDualEdge(SiS_Pr,HwInfo)))) {
- if((!(SiS_WeHaveBacklightCtrl(SiS_Pr, HwInfo))) ||
- (!(SiS_CRT2IsLCD(SiS_Pr, HwInfo)))) {
- SiS_PanelDelay(SiS_Pr, HwInfo, 2);
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFD);
- SiS_PanelDelay(SiS_Pr, HwInfo, 4);
- }
+
+ } else {
+
+ if((SiS_IsVAMode(SiS_Pr,HwInfo)) ||
+ (!(SiS_IsDualEdge(SiS_Pr,HwInfo)))) {
+ if((!(SiS_WeHaveBacklightCtrl(SiS_Pr, HwInfo))) ||
+ (!(SiS_CRT2IsLCD(SiS_Pr, HwInfo)))) {
+ SiS_PanelDelay(SiS_Pr, HwInfo, 2);
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFD);
+ SiS_PanelDelay(SiS_Pr, HwInfo, 4);
}
}
}
-
- } else { /* 315, 330 - all bridge types */
-
- if(SiS_Is301B(SiS_Pr)) {
- tempah = 0x3f;
- if(SiS_IsDualEdge(SiS_Pr,HwInfo)) {
- tempah = 0x7f;
- if(!(SiS_IsVAMode(SiS_Pr,HwInfo))) {
- tempah = 0xbf;
- }
- }
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1F,tempah);
- if(SiS_IsVAMode(SiS_Pr,HwInfo)) {
- SiS_DisplayOff(SiS_Pr);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
- }
- }
- if( (!(SiS_Is301B(SiS_Pr))) ||
- (!(SiS_IsVAMode(SiS_Pr,HwInfo))) ) {
-
- if( (!(SiS_Is301B(SiS_Pr))) ||
- (!(SiS_IsDualEdge(SiS_Pr,HwInfo))) ) {
-
- SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xDF);
- SiS_DisplayOff(SiS_Pr);
-
- }
-
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x80);
-
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x32,0xDF);
-
- temp = SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00);
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x00,0x10);
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x1E,0xDF);
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x00,temp);
-
- }
-
- } /* 315/330 */
+ }
#endif /* SIS315H */
}
- } else { /* ============ For 301 ================ */
+ } else { /* ============ For 301 ================ */
if(HwInfo->jChipType < SIS_315H) {
#ifdef SIS300
@@ -3937,6 +4100,12 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
#ifdef SIS315H /* 315 series */
+ if(!(SiS_IsNotM650orLater(SiS_Pr,HwInfo))) {
+ if(HwInfo->jChipType < SIS_340) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x4c,~0x18);
+ }
+ }
+
if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
if(HwInfo->jChipType == SIS_740) {
@@ -4067,7 +4236,6 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
BOOLEAN delaylong = FALSE;
#endif
-
if(SiS_Pr->SiS_VBType & VB_SISVB) {
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { /* ====== For 301B et al ====== */
@@ -4076,28 +4244,55 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
#ifdef SIS300 /* 300 series */
- if(HwInfo->jChipType == SIS_300) {
-
- if(SiS_CRT2IsLCD(SiS_Pr, HwInfo)) {
- if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
- SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x02);
- if(!(SiS_CR36BIOSWord23d(SiS_Pr, HwInfo))) {
- SiS_PanelDelay(SiS_Pr, HwInfo, 0);
- }
+ if(SiS_CRT2IsLCD(SiS_Pr, HwInfo)) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x02);
+ } else if(SiS_Pr->SiS_VBType & VB_NoLCD) {
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x00);
+ }
+ if(SiS_Pr->SiS_VBType & (VB_SIS301LV302LV | VB_NoLCD)) {
+ if(!(SiS_CR36BIOSWord23d(SiS_Pr, HwInfo))) {
+ SiS_PanelDelay(SiS_Pr, HwInfo, 0);
}
}
+ }
+
+ if((SiS_Pr->SiS_VBType & VB_NoLCD) &&
+ (SiS_CRT2IsLCD(SiS_Pr, HwInfo))) {
+
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); /* Enable CRT2 */
+ SiS_DisplayOn(SiS_Pr);
+ SiS_UnLockCRT2(SiS_Pr,HwInfo);
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x02,0xBF);
+ if(SiS_BridgeInSlavemode(SiS_Pr)) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x01,0x1F);
+ } else {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x01,0x1F,0x40);
+ }
+ if(!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x13) & 0x40)) {
+ if(!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x16) & 0x10)) {
+ if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwInfo))) {
+ SiS_PanelDelay(SiS_Pr, HwInfo, 1);
+ }
+ SiS_WaitVBRetrace(SiS_Pr,HwInfo);
+ SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x00);
+ }
+ }
+
+ } else {
+
temp = SiS_GetReg(SiS_Pr->SiS_P3c4,0x32) & 0xDF; /* lock mode */
- if(SiS_BridgeInSlave(SiS_Pr)) {
+ if(SiS_BridgeInSlavemode(SiS_Pr)) {
tempah = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);
- if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20;
+ if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20;
}
SiS_SetReg(SiS_Pr->SiS_P3c4,0x32,temp);
SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20);
SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x00,0x1F,0x20); /* enable VB processor */
SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1F,0xC0);
SiS_DisplayOn(SiS_Pr);
- if(SiS_CRT2IsLCD(SiS_Pr, HwInfo)) {
- if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ if(SiS_CRT2IsLCD(SiS_Pr, HwInfo)) {
if(!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x16) & 0x10)) {
if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwInfo))) {
SiS_PanelDelay(SiS_Pr, HwInfo, 1);
@@ -4106,441 +4301,284 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
}
}
}
+
+ }
- } else {
-
- if((SiS_Pr->SiS_VBType & VB_NoLCD) &&
- (SiS_CRT2IsLCD(SiS_Pr, HwInfo))) {
- /* This is only for LCD output on 301B-DH via LVDS */
- SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x00);
- if(!(SiS_CR36BIOSWord23d(SiS_Pr,HwInfo))) {
- SiS_PanelDelay(SiS_Pr, HwInfo, 0);
- }
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); /* Enable CRT2 */
- SiS_DisplayOn(SiS_Pr);
- SiS_UnLockCRT2(SiS_Pr,HwInfo);
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x02,0xBF);
- if(SiS_BridgeInSlave(SiS_Pr)) {
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x01,0x1F);
- } else {
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x01,0x1F,0x40);
- }
- if(!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x13) & 0x40)) {
- if(!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x16) & 0x10)) {
- if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwInfo))) {
- SiS_PanelDelay(SiS_Pr, HwInfo, 1);
- }
- SiS_WaitVBRetrace(SiS_Pr,HwInfo);
- SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x00);
- }
- }
- } else {
- temp = SiS_GetReg(SiS_Pr->SiS_P3c4,0x32) & 0xDF; /* lock mode */
- if(SiS_BridgeInSlave(SiS_Pr)) {
- tempah = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);
- if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20;
- }
- SiS_SetReg(SiS_Pr->SiS_P3c4,0x32,temp);
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20);
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x00,0x1F,0x20); /* enable VB processor */
- SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1F,0xC0);
- SiS_DisplayOn(SiS_Pr);
- }
-
- }
+
#endif /* SIS300 */
} else {
#ifdef SIS315H /* 315 series */
- 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) {
+#ifdef SET_EMI
+ UCHAR r30=0, r31=0, r32=0, r33=0, cr36=0;
+ /* USHORT emidelay=0; */
+#endif
- if((SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) &&
- (SiS_Pr->SiS_CustomT != CUT_CLEVO1400)) {
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,0xef);
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,0xef);
#ifdef SET_EMI
- if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
- }
+ if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
+ }
#endif
- }
-
- if(!(SiS_IsNotM650orLater(SiS_Pr,HwInfo))) {
- tempah = 0x10;
- 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) &&
- (SiS_Pr->SiS_CustomT != CUT_CLEVO1400)) {
- SiS_SetRegByte(SiS_Pr->SiS_P3c6,0x00);
- SiS_DisplayOff(SiS_Pr);
- pushax = SiS_GetReg(SiS_Pr->SiS_P3c4,0x06);
- if(IS_SIS740) {
- SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x06,0xE3);
- }
- }
-
- if( (SiS_IsVAMode(SiS_Pr,HwInfo)) ||
- (SiS_CRT2IsLCD(SiS_Pr, HwInfo)) ) {
- if(!(SiS_GetReg(SiS_Pr->SiS_Part4Port,0x26) & 0x02)) {
- if((SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) &&
- (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);
- SiS_PanelDelay(SiS_Pr, HwInfo, 0);
- }
- }
- }
-
- if((SiS_Pr->SiS_CustomT != CUT_COMPAQ1280) &&
- (SiS_Pr->SiS_CustomT != CUT_CLEVO1400)) {
- if(!(SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) & 0x40)) {
- SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 10);
- delaylong = TRUE;
- }
- }
-
- } else if(SiS_Pr->SiS_VBType & VB_NoLCD) {
+ }
- if(!(SiS_IsNotM650orLater(SiS_Pr,HwInfo))) {
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x4c,0x10);
+ if(!(SiS_IsNotM650orLater(SiS_Pr, HwInfo))) {
+ if(HwInfo->jChipType < SIS_340) {
+ tempah = 0x10;
+ 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);
+ }
+ }
- } else if(SiS_Pr->SiS_VBType & VB_SIS301B302B) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+
+ SiS_SetRegByte(SiS_Pr->SiS_P3c6,0x00);
+ SiS_DisplayOff(SiS_Pr);
+ pushax = SiS_GetReg(SiS_Pr->SiS_P3c4,0x06);
+ if(IS_SIS740) {
+ SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x06,0xE3);
+ }
- if(!(SiS_IsNotM650orLater(SiS_Pr,HwInfo))) {
- tempah = 0x10;
- if(SiS_LCDAEnabled(SiS_Pr, HwInfo)) {
- if(SiS_TVEnabled(SiS_Pr, HwInfo)) tempah = 0x18;
- else tempah = 0x08;
+ if(SiS_IsVAorLCD(SiS_Pr, HwInfo)) {
+ if(!(SiS_GetReg(SiS_Pr->SiS_Part4Port,0x26) & 0x02)) {
+ SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 2);
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x02);
+ SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 2);
+ if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
+ SiS_GenericDelay(SiS_Pr, 0x4500);
}
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x4c,tempah);
}
-
}
- if(!(SiS_IsVAMode(SiS_Pr,HwInfo))) {
- temp = SiS_GetReg(SiS_Pr->SiS_P3c4,0x32) & 0xDF;
- if(SiS_BridgeInSlave(SiS_Pr)) {
- tempah = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);
- if(!(tempah & SetCRT2ToRAMDAC)) {
- if(!(SiS_LCDAEnabled(SiS_Pr, HwInfo))) temp |= 0x20;
- }
- }
- SiS_SetReg(SiS_Pr->SiS_P3c4,0x32,temp);
-
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); /* enable CRT2 */
-
- if((SiS_Pr->SiS_VBType & VB_SIS301B302B) ||
- (SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) {
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0x7f);
- temp = SiS_GetReg(SiS_Pr->SiS_Part1Port,0x2e);
- if(!(temp & 0x80)) {
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x80);
- }
- } else {
- SiS_PanelDelay(SiS_Pr, HwInfo, 2);
- }
- } else {
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x1e,0x20);
+ if(!(SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) & 0x40)) {
+ SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 10);
+ delaylong = TRUE;
}
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x00,0x1f,0x20);
+ }
- if((SiS_Pr->SiS_VBType & VB_SIS301B302B) ||
- (SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) {
- temp = SiS_GetReg(SiS_Pr->SiS_Part1Port,0x2e);
- if(!(temp & 0x80)) {
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x80);
+ if(!(SiS_IsVAMode(SiS_Pr,HwInfo))) {
+
+ temp = SiS_GetReg(SiS_Pr->SiS_P3c4,0x32) & 0xDF;
+ if(SiS_BridgeInSlavemode(SiS_Pr)) {
+ tempah = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);
+ if(!(tempah & SetCRT2ToRAMDAC)) {
+ if(!(SiS_LCDAEnabled(SiS_Pr, HwInfo))) temp |= 0x20;
}
- }
+ }
+ SiS_SetReg(SiS_Pr->SiS_P3c4,0x32,temp);
- tempah = 0xc0;
- if(SiS_IsDualEdge(SiS_Pr, HwInfo)) {
- tempah = 0x80;
- if(!(SiS_IsVAMode(SiS_Pr, HwInfo))) {
- tempah = 0x40;
- }
+ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); /* enable CRT2 */
+
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x2e,0x7f);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x80);
+
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ SiS_PanelDelay(SiS_Pr, HwInfo, 2);
}
- SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1F,tempah);
+
+ } else {
+
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x1e,0x20);
+
+ }
- if((SiS_Pr->SiS_VBType & VB_SIS301B302B) ||
- (((SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400)) &&
- (!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwInfo))))) {
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7f);
- }
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x00,0x1f,0x20);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x80);
+
+ tempah = 0xc0;
+ if(SiS_IsDualEdge(SiS_Pr, HwInfo)) {
+ tempah = 0x80;
+ if(!(SiS_IsVAMode(SiS_Pr, HwInfo))) tempah = 0x40;
+ }
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1F,tempah);
- if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
+ 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) {
- SiS_PanelDelay(SiS_Pr, HwInfo, 2);
- }
-#endif
+ SiS_PanelDelay(SiS_Pr, HwInfo, 2);
- SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1f,0x10);
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1f,0x10);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x80);
- if(SiS_Pr->SiS_CustomT != CUT_CLEVO1400) {
+ if(SiS_Pr->SiS_CustomT != CUT_CLEVO1400) {
#ifdef SET_EMI
- if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
- }
+ if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
+ SiS_GenericDelay(SiS_Pr, 0x500);
+ }
#endif
- SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x0c);
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x0c);
+
+ if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
#ifdef SET_EMI
- if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
-
- 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;
+ cr36 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36);
+
+ if(SiS_Pr->SiS_ROMNew) {
+ UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
+ USHORT romptr = GetLCDStructPtr661_2(SiS_Pr, HwInfo);
+ if(romptr) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x20); /* Reset */
+ SiS_Pr->EMI_30 = 0;
+ SiS_Pr->EMI_31 = ROMAddr[romptr + SiS_Pr->SiS_EMIOffset + 0];
+ SiS_Pr->EMI_32 = ROMAddr[romptr + SiS_Pr->SiS_EMIOffset + 1];
+ SiS_Pr->EMI_33 = ROMAddr[romptr + SiS_Pr->SiS_EMIOffset + 2];
+ if(ROMAddr[romptr + 1] & 0x10) SiS_Pr->EMI_30 = 0x40;
+ /* emidelay = SISGETROMW((romptr + 0x22)); */
+ SiS_Pr->HaveEMI = SiS_Pr->HaveEMILCD = SiS_Pr->OverruleEMI = TRUE;
}
+ }
- /* 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;
- }
- }
+ /* (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;
+ }
- if(!SiS_Pr->HaveEMI) {
- if((cr36 & 0x0f) == 0x02) {
+ /* 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)) {
+ switch((cr36 & 0x0f)) {
+ case 2:
+ r30 |= 0x40;
+ if(SiS_Pr->SiS_CustomT == CUT_CLEVO1024) r30 &= ~0x40;
+ if(!SiS_Pr->HaveEMI) {
+ r31 = 0x05; r32 = 0x60; r33 = 0x33;
if((cr36 & 0xf0) == 0x30) {
r31 = 0x0d; r32 = 0x70; r33 = 0x40;
- } else {
- r31 = 0x05; r32 = 0x60; r33 = 0x33;
- }
- } else if((cr36 & 0x0f) == 0x03) {
+ }
+ }
+ break;
+ case 3: /* 1280x1024 */
+ if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) r30 |= 0x40;
+ if(!SiS_Pr->HaveEMI) {
+ r31 = 0x12; r32 = 0xd0; r33 = 0x6b;
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) {
+ }
+ break;
+ case 9: /* 1400x1050 */
+ r30 |= 0x40;
+ if(!SiS_Pr->HaveEMI) {
+ r31 = 0x05; r32 = 0x60; r33 = 0x00;
if(SiS_Pr->SiS_CustomT == CUT_COMPAL1400_2) {
r31 = 0x0d; r32 = 0x70; r33 = 0x40; /* BIOS values */
- } else {
- r31 = 0x05; r32 = 0x60; r33 = 0x00;
}
- } else {
+ }
+ break;
+ case 11: /* 1600x1200 - unknown */
+ r30 |= 0x40;
+ if(!SiS_Pr->HaveEMI) {
r31 = 0x05; r32 = 0x60; r33 = 0x00;
}
}
+ }
- /* BIOS values don't work so well sometimes */
- if(!SiS_Pr->OverruleEMI) {
+ /* 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;
- }
- }
+ 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 */
- }
+ if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) {
+ if((cr36 & 0x0f) == 0x03) {
+ r30 = 0x20; r31 = 0x12; r32 = 0xd0; r33 = 0x6b;
}
+ }
#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 */
- }
+ 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) {
-
- if( (SiS_IsVAMode(SiS_Pr,HwInfo)) ||
- (SiS_CRT2IsLCD(SiS_Pr, HwInfo)) ) {
- SiS_DisplayOn(SiS_Pr);
- SiS_PanelDelay(SiS_Pr, HwInfo, 1);
- SiS_WaitVBRetrace(SiS_Pr, HwInfo);
- SiS_PanelDelay(SiS_Pr, HwInfo, 3);
- if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwInfo))) {
- SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x01);
- }
+ }
+
+ if(!(SiS_Pr->OverruleEMI && (!r30) && (!r31) && (!r32) && (!r33))) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x20); /* Reset */
+ SiS_GenericDelay(SiS_Pr, 0x500);
}
-
- } else if(SiS_Pr->SiS_CustomT == CUT_CLEVO1400) {
-
- if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwInfo))) {
- if( (SiS_IsVAMode(SiS_Pr, HwInfo)) ||
- (SiS_CRT2IsLCD(SiS_Pr, HwInfo)) ) {
- SiS_DisplayOn(SiS_Pr);
- SiS_PanelDelay(SiS_Pr, HwInfo, 1);
- SiS_WaitVBRetrace(SiS_Pr,HwInfo);
- SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x01);
- }
- }
-
- } 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))) ) {
- SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 10);
- if(delaylong) {
- SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 10);
- }
- SiS_WaitVBRetrace(SiS_Pr,HwInfo);
- if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
+ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x31,r31);
+ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x32,r32);
+ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x33,r33);
+#endif /* SET_EMI */
+
+ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10);
+
+#ifdef SET_EMI
+ if( (SiS_LCDAEnabled(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,0x26,0x01);
+ SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x40); /* Enable */
}
- }
-
- SiS_SetReg(SiS_Pr->SiS_P3c4,0x06,pushax);
- SiS_DisplayOn(SiS_Pr);
- SiS_SetRegByte(SiS_Pr->SiS_P3c6,0xff);
-
- if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwInfo))) {
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7f);
- }
-
+ }
+#endif
}
-
}
- } else { /* 315, 330 */
-
- if(!(SiS_IsVAMode(SiS_Pr,HwInfo))) {
- temp = SiS_GetReg(SiS_Pr->SiS_P3c4,0x32) & 0xDF;
- if(SiS_BridgeInSlave(SiS_Pr)) {
- tempah = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);
- if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20;
- }
- SiS_SetReg(SiS_Pr->SiS_P3c4,0x32,temp);
-
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x20); /* enable CRT2 */
-
- temp = SiS_GetReg(SiS_Pr->SiS_Part1Port,0x2E);
- if(!(temp & 0x80))
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2E,0x80);
- }
-
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x00,0x1f,0x20);
-
- if(SiS_Is301B(SiS_Pr)) {
-
- temp=SiS_GetReg(SiS_Pr->SiS_Part1Port,0x2E);
- if(!(temp & 0x80))
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2E,0x80);
-
- tempah = 0xc0;
- if(SiS_IsDualEdge(SiS_Pr,HwInfo)) {
- tempah = 0x80;
- if(!(SiS_IsVAMode(SiS_Pr,HwInfo))) {
- tempah = 0x40;
- }
+ if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwInfo))) {
+ if(SiS_IsVAorLCD(SiS_Pr, HwInfo)) {
+ SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 10);
+ if(delaylong) {
+ 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);
}
- SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x1F,tempah);
-
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7f);
-
- } else {
-
- SiS_VBLongWait(SiS_Pr);
- SiS_DisplayOn(SiS_Pr);
- SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7F);
- SiS_VBLongWait(SiS_Pr);
-
}
- } /* 315, 330 */
+ SiS_SetReg(SiS_Pr->SiS_P3c4,0x06,pushax);
+ SiS_DisplayOn(SiS_Pr);
+ SiS_SetRegByte(SiS_Pr->SiS_P3c6,0xff);
+
+ }
+
+ if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwInfo))) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7f);
+ }
#endif /* SIS315H */
@@ -4556,9 +4594,9 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
}
temp = SiS_GetReg(SiS_Pr->SiS_P3c4,0x32) & 0xDF; /* lock mode */
- if(SiS_BridgeInSlave(SiS_Pr)) {
+ if(SiS_BridgeInSlavemode(SiS_Pr)) {
tempah = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);
- if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20;
+ if(!(tempah & SetCRT2ToRAMDAC)) temp |= 0x20;
}
SiS_SetReg(SiS_Pr->SiS_P3c4,0x32,temp);
@@ -4611,7 +4649,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_DisplayOn(SiS_Pr);
SiS_UnLockCRT2(SiS_Pr,HwInfo);
SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x02,0xBF);
- if(SiS_BridgeInSlave(SiS_Pr)) {
+ if(SiS_BridgeInSlavemode(SiS_Pr)) {
SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x01,0x1F);
} else {
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x01,0x1F,0x40);
@@ -4643,6 +4681,12 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
#ifdef SIS315H /* 315 series */
+ if(!(SiS_IsNotM650orLater(SiS_Pr,HwInfo))) {
+ if(HwInfo->jChipType < SIS_340) {
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x4c,0x18);
+ }
+ }
+
if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) {
if(SiS_CRT2IsLCD(SiS_Pr, HwInfo)) {
SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xFB,0x00);
@@ -4897,9 +4941,11 @@ SiS_SetCRT2Sync(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT RefreshRateTableIndex
}
}
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
- if(SiS_Pr->SiS_LCDInfo & LCDSync) {
- tempah = SiS_Pr->SiS_LCDInfo;
- tempbl = (tempah >> 6) & 0x03;
+ if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) {
+ if(SiS_Pr->SiS_LCDInfo & LCDSync) {
+ tempah = SiS_Pr->SiS_LCDInfo;
+ tempbl = (tempah >> 6) & 0x03;
+ }
}
}
}
@@ -5004,7 +5050,7 @@ SiS_SetCRT2FIFO_300(SiS_Private *SiS_Pr,USHORT ModeNo,
CRT1ModeNo = 0xfe;
VCLK = SiS_Pr->CSRClock_CRT1; /* Get VCLK */
- data2 = (SiS_Pr->CModeFlag_CRT1 & ModeInfoFlag) - 2;
+ data2 = (SiS_Pr->CModeFlag_CRT1 & ModeTypeMask) - 2;
switch(data2) { /* Get color depth */
case 0 : colorth = 1; break;
case 1 : colorth = 1; break;
@@ -5224,14 +5270,22 @@ SiS_SetCRT2FIFO_300(SiS_Private *SiS_Pr,USHORT ModeNo,
static void
SiS_SetCRT2FIFO_310(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
- USHORT temp;
-
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;
+ if( (HwInfo->jChipType == SIS_760) &&
+ (SiS_Pr->SiS_SysFlags & SF_760LFB) &&
+ (SiS_Pr->SiS_ModeType == Mode32Bpp) &&
+ (SiS_Pr->SiS_VGAHDE >= 1280) &&
+ (SiS_Pr->SiS_VGAVDE >= 1024) ) {
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x2f,0x03);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x01,0x3b);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x4d,0xc0);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x2f,0x01);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x4d,0xc0);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x02,0x6e);
+ } else {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x02,~0x3f,0x04);
}
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x02,~0x3f,temp);
+
}
#endif
@@ -5240,10 +5294,10 @@ SiS_GetVGAHT2(SiS_Private *SiS_Pr)
{
ULONG tempax,tempbx;
- tempbx = ((SiS_Pr->SiS_VGAVT - SiS_Pr->SiS_VGAVDE) * SiS_Pr->SiS_RVBHCMAX) & 0xFFFF;
+ tempbx = (SiS_Pr->SiS_VGAVT - SiS_Pr->SiS_VGAVDE) * SiS_Pr->SiS_RVBHCMAX;
tempax = (SiS_Pr->SiS_VT - SiS_Pr->SiS_VDE) * SiS_Pr->SiS_RVBHCFACT;
tempax = (tempax * SiS_Pr->SiS_HT) / tempbx;
- return((USHORT) tempax);
+ return((USHORT)tempax);
}
/* Set Part 1 / SiS bridge slave mode */
@@ -5607,9 +5661,8 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
#endif
}
- /* 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))) {
+ /* is lvds if really LVDS, or 301B-DH with external LVDS transmitter */
+ if((SiS_Pr->SiS_IF_DEF_LVDS == 1) || (SiS_Pr->SiS_VBType & VB_NoLCD)) {
islvds = TRUE;
}
@@ -5686,12 +5739,6 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(tempax >= SiS_Pr->SiS_HT) tempax -= SiS_Pr->SiS_HT;
temp = tempax;
-#if 0
- /* TEST 2 */
- if((HwInfo->jChipType >= SIS_315H) && (islvds) && (SiS_Pr->SiS_LCDResInfo == Panel_1400x1050)) {
- } else
- /* /TEST2 */
-#endif
if(temp & 0x07) temp += 8;
temp >>= 3;
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x17,temp); /* BPLHDEE */
@@ -5737,13 +5784,6 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
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;
@@ -6145,8 +6185,10 @@ static void
SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
PSIS_HW_INFO HwInfo, USHORT RefreshRateTableIndex)
{
+#if defined(SIS300) || defined(SIS315H)
UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
- USHORT temp=0, tempax=0, tempbx=0, tempcx=0;
+#endif
+ USHORT temp=0, tempax=0, tempbx=0, tempcx=0, bridgeadd=0;
USHORT pushbx=0, CRT1Index=0, modeflag, resinfo=0;
#ifdef SIS315H
USHORT tempbl=0;
@@ -6203,40 +6245,8 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
tempbx = pushbx + tempcx;
tempcx <<= 1;
tempcx += tempbx;
-
- if(SiS_Pr->SiS_VBType & VB_SISVB) {
-
- 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_TVMode & TVSetNTSC1024) {
- tempbx = 1040;
- tempcx = 1044;
- }
-
- }
-
- temp = tempbx & 0x00FF;
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0B,temp); /* CRT2 Horizontal Retrace Start */
+
+ bridgeadd = 12;
#endif /* SIS300 */
@@ -6257,11 +6267,8 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
}
tempcx--;
-
- temp = tempcx & 0xff;
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x08,temp); /* CRT2 Horizontal Total */
-
- temp = ((tempcx & 0xff00) >> 8) << 4;
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x08,tempcx); /* CRT2 Horizontal Total */
+ temp = (tempcx >> 4) & 0xF0;
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x09,0x0F,temp); /* CRT2 Horizontal Total Overflow [7:4] */
tempcx = SiS_Pr->SiS_VGAHT; /* BTVGA2HDEE 0x0A,0x0C */
@@ -6273,85 +6280,83 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
tempcx >>= 1;
}
tempbx += 16;
-
- temp = tempbx & 0xff;
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0A,temp); /* CRT2 Horizontal Display Enable End */
+
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0A,tempbx); /* CRT2 Horizontal Display Enable End */
pushbx = tempbx;
tempcx >>= 1;
tempbx += tempcx;
tempcx += tempbx;
+
+ bridgeadd = 16;
if(SiS_Pr->SiS_VBType & VB_SISVB) {
-
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;
+ tempcx = (tempcx & 0xff00) | 0x30;
} else if(resinfo == SIS_RI_1600x1200) {
- tempcx = 0xff;
+ tempcx = (tempcx & 0xff00) | 0xff;
}
}
}
-
- 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;
- }
-
- 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_TVMode & TVSetNTSC1024) {
- tempbx = 1040;
- tempcx = 1044; /* HWCursor bug! */
- }
-
}
- temp = tempbx & 0xff;
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0B,temp); /* CRT2 Horizontal Retrace Start */
#endif /* SIS315H */
} /* 315/330 series */
-
- 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 */
-
+
+ if(SiS_Pr->SiS_VBType & VB_SISVB) {
+
+ if(SiS_Pr->UseCustomMode) {
+ tempbx = SiS_Pr->CHSyncStart + bridgeadd;
+ tempcx = SiS_Pr->CHSyncEnd + bridgeadd;
+ tempax = SiS_Pr->SiS_VGAHT;
+ if(modeflag & HalfDCLK) tempax >>= 1;
+ tempax--;
+ if(tempcx > tempax) tempcx = tempax;
+ }
+
+ 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 += bridgeadd;
+ tempcx += bridgeadd;
+ tempax = SiS_Pr->SiS_VGAHT;
+ if(modeflag & HalfDCLK) tempax >>= 1;
+ tempax--;
+ if(tempcx > tempax) tempcx = tempax;
+ }
+
+ if(SiS_Pr->SiS_TVMode & TVSetNTSC1024) {
+ tempbx = 1040;
+ tempcx = 1044; /* HWCursor bug! */
+ }
+
+ }
+
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0B,tempbx); /* CRT2 Horizontal Retrace Start */
+
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0D,tempcx); /* CRT2 Horizontal Retrace End */
+
+ temp = ((tempbx >> 8) & 0x0F) | ((pushbx >> 4) & 0xF0);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0C,temp); /* Overflow */
+
/* 2. Vertical setup */
tempcx = SiS_Pr->SiS_VGAVT - 1;
@@ -6375,12 +6380,10 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
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 */
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0F,tempbx); /* 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) */
+ temp = ((tempbx >> 5) & 0x38) | ((tempcx >> 8) & 0x07);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x12,temp); /* Overflow */
if((HwInfo->jChipType >= SIS_315H) && (HwInfo->jChipType < SIS_661)) {
tempbx++;
@@ -6399,37 +6402,33 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
if(SiS_Pr->SiS_VBType & VB_SISVB) {
-
if(SiS_Pr->UseCustomMode) {
tempbx = SiS_Pr->CVSyncStart;
- tempcx = (tempcx & 0xFF00) | (SiS_Pr->CVSyncEnd & 0x00FF);
+ tempcx = SiS_Pr->CVSyncEnd;
}
-
if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) {
- unsigned char cr8, cr7, cr13, cr9;
+ unsigned char cr8, cr7, cr13;
if(SiS_Pr->UseCustomMode) {
- cr8 = SiS_Pr->CCRT1CRTC[8];
- cr7 = SiS_Pr->CCRT1CRTC[7];
- cr13 = SiS_Pr->CCRT1CRTC[13];
- cr9 = SiS_Pr->CCRT1CRTC[9];
+ cr8 = SiS_Pr->CCRT1CRTC[8];
+ cr7 = SiS_Pr->CCRT1CRTC[7];
+ cr13 = SiS_Pr->CCRT1CRTC[13];
+ tempcx = 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];
+ cr8 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[8];
+ cr7 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[7];
+ cr13 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[13];
+ tempcx = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[9];
}
tempbx = cr8;
- if(cr7 & 0x04) tempbx |= 0x0100;
- if(cr7 & 0x80) tempbx |= 0x0200;
+ 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 */
- 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 >> 4) & 0x70) | (tempcx & 0x0F);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x11,temp); /* CRT2 Vert. Retrace End; Overflow */
/* 3. Panel delay compensation */
@@ -6439,7 +6438,6 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_VBType & VB_SISVB) {
temp = 0x20;
-
if(HwInfo->jChipType == SIS_300) {
temp = 0x10;
if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) temp = 0x2c;
@@ -6450,10 +6448,10 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
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 & SetCRT2ToTV) temp = 0x08;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
- if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) temp = 0x2c;
- else temp = 0x20;
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) temp = 0x2c;
+ else temp = 0x20;
}
if(SiS_Pr->SiS_UseROM) {
if(ROMAddr[0x220] & 0x80) {
@@ -6524,8 +6522,8 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
} /* < 661 */
tempax = 0;
- if (modeflag & DoubleScanMode) tempax |= 0x80;
- if (modeflag & HalfDCLK) tempax |= 0x40;
+ if(modeflag & DoubleScanMode) tempax |= 0x80;
+ if(modeflag & HalfDCLK) tempax |= 0x40;
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2C,0x3f,tempax);
#endif /* SIS315H */
@@ -6588,7 +6586,6 @@ SiS_GetGroup2CLVXPtr(SiS_Private *SiS_Pr, int tabletype, PSIS_HW_INFO HwInfo)
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;
-
} else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
tableptr = SiS_Part2CLVX_6;
}
@@ -6868,9 +6865,9 @@ static void
SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT RefreshRateTableIndex,
PSIS_HW_INFO HwInfo)
{
- USHORT i, j, tempax, tempbx, tempcx, temp;
- USHORT push1, push2, modeflag, crt2crtc, bridgeoffset;
- ULONG longtemp, tempeax;
+ USHORT i, j, tempax, tempbx, tempcx, tempch, tempcl, temp;
+ USHORT push2, modeflag, crt2crtc, bridgeoffset;
+ ULONG longtemp;
const UCHAR *PhasePoint;
const UCHAR *TimingPoint;
#ifdef SIS315H
@@ -7005,7 +7002,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) tempax = 950;
else if(SiS_Pr->SiS_TVMode & TVSetPAL) tempax = 520;
- else tempax = 440;
+ else tempax = 440; /* NTSC, YPbPr 525, 750 */
if( ( (!(SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoHiVision)) && (SiS_Pr->SiS_VDE <= tempax) ) ||
( (SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoHiVision) &&
@@ -7021,7 +7018,7 @@ 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 & SetCRT2ToTVNoHiVision) && (SiS_Pr->SiS_VGAHDE >= 1024)) {
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoYPbPrHiVision) && (SiS_Pr->SiS_VGAHDE >= 1024)) {
if(SiS_Pr->SiS_TVMode & TVSetPAL) {
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,0x1b); /* 19 */
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,0x54); /* 52 */
@@ -7037,47 +7034,38 @@ 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--;
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x1B,(tempcx & 0xff));
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x1B,tempcx);
SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1D,0xF0,((tempcx >> 8) & 0x0f));
-
- tempcx++;
- if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) tempcx++;
- tempcx >>= 1;
-
- push1 = tempcx;
-
+
+ tempcx = SiS_Pr->SiS_HT >> 1;
+ if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempcx >>= 1;
tempcx += 7;
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 += tempcx;
-
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x24,tempbx);
- temp = ((tempbx & 0xFF00) >> 8) << 4;
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x25,0x0F,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x25,0x0F,((tempbx >> 4) & 0xf0));
tempbx += 8;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
tempbx -= 4;
tempcx = tempbx;
}
- temp = (tempbx & 0x00FF) << 4;
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x29,0x0F,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x29,0x0F,((tempbx << 4) & 0xf0));
j += 2;
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);
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x27,tempcx);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x28,0x0F,((tempcx >> 4) & 0xf0));
tempcx += 8;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) tempcx -= 4;
SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x2A,0x0F,((tempcx << 4) & 0xf0));
- tempcx = push1;
-
+ tempcx = SiS_Pr->SiS_HT >> 1;
+ if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempcx >>= 1;
j += 2;
tempcx -= (TimingPoint[j] | ((TimingPoint[j+1]) << 8));
SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x2D,0x0F,((tempcx << 4) & 0xf0));
@@ -7089,133 +7077,114 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2E,tempcx);
tempbx = SiS_Pr->SiS_VDE;
- if(SiS_Pr->SiS_VGAVDE == 360) tempbx = 746;
- if(SiS_Pr->SiS_VGAVDE == 375) tempbx = 746;
- if(SiS_Pr->SiS_VGAVDE == 405) tempbx = 853;
- if(HwInfo->jChipType < SIS_315H) {
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) tempbx >>= 1;
- } else {
- 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(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ if(SiS_Pr->SiS_VGAVDE == 360) tempbx = 746;
+ if(SiS_Pr->SiS_VGAVDE == 375) tempbx = 746;
+ if(SiS_Pr->SiS_VGAVDE == 405) tempbx = 853;
+ } else if( (SiS_Pr->SiS_VBInfo & SetCRT2ToTV) &&
+ (!(SiS_Pr->SiS_TVMode & (TVSetYPbPr525p|TVSetYPbPr750p))) ) {
+ tempbx >>= 1;
+ if(HwInfo->jChipType >= SIS_315H) {
+ if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) {
+ if((ModeNo <= 0x13) && (crt2crtc == 1)) tempbx++;
} else if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
- if(crt2crtc == 4) {
- if(SiS_Pr->SiS_ModeType <= 3) tempbx++;
+ if(SiS_Pr->SiS_ModeType <= ModeVGA) {
+ if(crt2crtc == 4) tempbx++;
}
}
}
- }
- tempbx -= 2;
- temp = tempbx & 0x00FF;
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
- if((ModeNo == 0x2f) || (ModeNo == 0x5d) || (ModeNo == 0x5e)) temp++;
- }
- }
-
- if(HwInfo->jChipType < SIS_661) {
- /* From 1.10.7w - doesn't make sense */
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
- if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
- if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) {
- if(ModeNo == 0x03) temp++;
- }
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
+ if((ModeNo == 0x2f) || (ModeNo == 0x5d) || (ModeNo == 0x5e)) tempbx++;
+ }
+ if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) {
+ if(ModeNo == 0x03) tempbx++; /* From 1.10.7w - doesn't make sense */
}
}
}
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2F,temp);
+ tempbx -= 2;
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2F,tempbx);
temp = (tempcx >> 8) & 0x0F;
- temp |= (((tempbx >> 8) << 6) & 0xC0);
+ temp |= ((tempbx >> 2) & 0xC0);
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToSVIDEO | SetCRT2ToAVIDEO)) {
temp |= 0x10;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToAVIDEO) temp |= 0x20;
}
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x30,temp);
+
+ if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302LV | VB_SIS302ELV)) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x10,0xdf,((tempbx & 0x0400) >> 5));
+ }
+
+#if 0
+ /* TEST qqqq */
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) {
+ for(i=0x01, j=0; i<=0x2D; i++, j++) {
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,i,TimingPoint[j]);
+ }
+ for(i=0x39; i<=0x45; i++, j++) {
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,i,TimingPoint[j]);
+ }
+ }
+#endif
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
tempbx = SiS_Pr->SiS_VDE;
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
- if(!(SiS_Pr->SiS_TVMode & (TVSetYPbPr525p | TVSetYPbPr750p))) {
- tempbx >>= 1;
- }
+ if( (SiS_Pr->SiS_VBInfo & SetCRT2ToTV) &&
+ (!(SiS_Pr->SiS_TVMode & (TVSetYPbPr525p | TVSetYPbPr750p))) ) {
+ tempbx >>= 1;
}
tempbx -= 3;
- 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;
+ temp = ((tempbx >> 3) & 0x60) | 0x18;
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x46,temp);
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x47,tempbx);
+
+ if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302LV | VB_SIS302ELV)) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x10,0xbf,((tempbx & 0x0400) >> 4));
+ }
}
tempbx = 0;
if(!(modeflag & HalfDCLK)) {
if(SiS_Pr->SiS_VGAHDE >= SiS_Pr->SiS_HDE) {
tempax = 0;
- tempbx |= 0x2000;
+ tempbx |= 0x20;
}
}
- tempcx = 0x0101;
+ tempch = tempcl = 0x01;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
if(SiS_Pr->SiS_VGAHDE >= 1024) {
if((!(modeflag & HalfDCLK)) || (HwInfo->jChipType < SIS_315H)) {
- tempcx = 0x1920;
+ tempch = 0x19;
+ tempcl = 0x20;
if(SiS_Pr->SiS_VGAHDE >= 1280) {
- tempcx = 0x1420;
- tempbx &= ~0x2000;
+ tempch = 0x14;
+ tempbx &= ~0x20;
}
}
}
}
- if(!(tempbx & 0x2000)) {
- if(modeflag & HalfDCLK) {
- tempcx = (tempcx & 0xFF00) | ((tempcx << 1) & 0x00FF);
- }
- longtemp = (SiS_Pr->SiS_VGAHDE * ((tempcx & 0xFF00) >> 8)) / (tempcx & 0x00FF);
- longtemp <<= 13;
- if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
- longtemp <<= 3;
- }
- tempeax = longtemp / SiS_Pr->SiS_HDE;
- if(longtemp % SiS_Pr->SiS_HDE) tempeax++;
- tempax = (USHORT)tempeax;
- tempbx |= (tempax & 0x1F00);
- tempcx = (tempax & 0xFF00) >> (8 + 5);
+ if(!(tempbx & 0x20)) {
+ if(modeflag & HalfDCLK) tempcl <<= 1;
+ longtemp = ((SiS_Pr->SiS_VGAHDE * tempch) / tempcl) << 13;
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) longtemp <<= 3;
+ tempax = longtemp / SiS_Pr->SiS_HDE;
+ if(longtemp % SiS_Pr->SiS_HDE) tempax++;
+ tempbx |= ((tempax >> 8) & 0x1F);
+ tempcx = tempax >> 13;
}
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x44,tempax);
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x45,0xC0,(tempbx >> 8));
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x45,0xC0,tempbx);
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
- temp = tempcx & 0x0007;
- if(tempbx & 0x2000) temp = 0;
- if((HwInfo->jChipType < SIS_661) || (!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD))) {
- temp |= 0x18;
- }
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x46,0xE0,temp);
+ tempcx &= 0x07;
+ if(tempbx & 0x20) tempcx = 0;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x46,0xF8,tempcx);
if(SiS_Pr->SiS_TVMode & TVSetPAL) {
tempbx = 0x0382;
@@ -7226,7 +7195,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
}
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x4B,tempbx);
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x4C,tempcx);
- temp = (tempcx & 0x0300) >> (8 - 2);
+ temp = (tempcx & 0x0300) >> 6;
temp |= ((tempbx >> 8) & 0x03);
if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) {
temp |= 0x10;
@@ -7236,7 +7205,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
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));
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x43,(temp - 3));
SiS_SetTVSpecial(SiS_Pr, ModeNo);
@@ -7251,7 +7220,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
if(SiS_Pr->SiS_TVMode & TVSetPALM) {
if(!(SiS_Pr->SiS_TVMode & TVSetNTSC1024)) {
temp = SiS_GetReg(SiS_Pr->SiS_Part2Port,0x01);
- SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,temp - 1);
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x01,(temp - 1));
}
SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x00,0xEF);
}
@@ -7270,8 +7239,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempbx >>= 1;
tempbx--; /* RHACTE = HDE - 1 */
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x2C,tempbx);
- temp = (tempbx & 0xFF00) >> 4;
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x2B,0x0F,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x2B,0x0F,((tempbx >> 4) & 0xf0));
temp = 0x01;
if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) {
@@ -7290,21 +7258,17 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
tempbx = SiS_Pr->SiS_VDE - 1;
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x03,tempbx);
- temp = ((tempbx & 0xFF00) >> 8) & 0x07;
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x0C,0xF8,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x0C,0xF8,((tempbx >> 8) & 0x07));
tempcx = SiS_Pr->SiS_VT - 1;
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x19,tempcx);
-
- temp = ((tempcx & 0xFF00) >> 8) << 5;
-
- /* Enable dithering; only do this for 32bpp mode */
+ temp = (tempcx >> 3) & 0xE0;
if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) {
+ /* Enable dithering; only do this for 32bpp mode */
if(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00) & 0x01) {
temp |= 0x10;
}
}
-
SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1A,0x0f,temp);
SiS_SetRegAND(SiS_Pr->SiS_Part2Port,0x09,0xF0);
@@ -7373,7 +7337,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
tempbx -= tempax; /* lcdvdee */
}
- /* Non-expanding: lcdvdees = tempcx = VT-1; lcdvdee = tempbx = VDE-1 */
+ /* Non-expanding: lcdvdes = tempcx = VT-1; lcdvdee = tempbx = VDE-1 */
#ifdef TWDEBUG
xf86DrvMsg(0, X_INFO, "lcdvdes 0x%x lcdvdee 0x%x\n", tempcx, tempbx);
@@ -7382,8 +7346,8 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
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);
+ temp = (tempbx >> 5) & 0x38;
+ temp |= ((tempcx >> 8) & 0x07);
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x02,temp);
tempax = SiS_Pr->SiS_VDE;
@@ -7405,7 +7369,10 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
if(tempax % 4) { tempax >>= 2; tempax++; }
else { tempax >>= 2; }
tempbx -= (tempax - 1);
- } else tempbx -= 10;
+ } else {
+ tempbx -= 10;
+ if(tempbx <= SiS_Pr->SiS_VDE) tempbx = SiS_Pr->SiS_VDE + 1;
+ }
}
}
if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) {
@@ -7430,9 +7397,9 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x04,tempbx); /* lcdvrs */
- temp = ((tempbx & 0xFF00) >> 8) << 4;
+ temp = (tempbx >> 4) & 0xF0;
tempbx += (tempcx + 1);
- temp |= (tempbx & 0x000F);
+ temp |= (tempbx & 0x0F);
if(SiS_Pr->UseCustomMode) {
temp &= 0xf0;
@@ -7462,9 +7429,8 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
}
}
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] */
+ SiS_SetReg(SiS_Pr->SiS_Part2Port,0x1F,temp); /* lcdhdes */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x20,0x0F,((temp >> 4) & 0xf0));
tempcx = SiS_Pr->SiS_HT;
tempax = tempbx = SiS_Pr->SiS_HDE;
@@ -7487,8 +7453,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
tempbx += bridgeoffset;
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x23,tempbx); /* lcdhdee */
- temp = (tempbx >> 8) & 0x0f;
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x25,0xF0,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x25,0xF0,((tempbx >> 8) & 0x0f));
tempcx = (tempcx - tempax) >> 2;
@@ -7514,8 +7479,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
#endif
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x1C,tempbx); /* lcdhrs */
- temp = (tempbx & 0x0F00) >> 4;
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1D,0x0F,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1D,0x0F,((tempbx >> 4) & 0xf0));
tempbx = push2;
@@ -7555,24 +7519,14 @@ static void
SiS_SetGroup3(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
PSIS_HW_INFO HwInfo)
{
- USHORT modeflag, i;
- const UCHAR *tempdi;
+ USHORT i;
+ const UCHAR *tempdi;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) 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;
- }
-
#ifndef SIS_CP
SiS_SetReg(SiS_Pr->SiS_Part3Port,0x00,0x00);
-#endif
-
-#ifdef SIS_CP
+#else
SIS_CP_INIT301_CP
#endif
@@ -7595,11 +7549,6 @@ SiS_SetGroup3(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
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
}
} else if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) {
if(!(SiS_Pr->SiS_TVMode & TVSetYPbPr525i)) {
@@ -7654,7 +7603,8 @@ SiS_SetGroup4_C_ELV(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
{
USHORT temp, temp1, resinfo = 0;
- if(!(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302ELV))) return;
+ if(!(SiS_Pr->SiS_VBType & VB_SIS301C)) return;
+ if(!(SiS_Pr->SiS_VBInfo & (SetCRT2ToHiVision | SetCRT2ToYPbPr525750))) return;
if(ModeNo > 0x13) {
resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
@@ -7665,7 +7615,7 @@ SiS_SetGroup4_C_ELV(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
if(!(temp & 0x01)) {
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x3a,0xdf);
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x25,0xfc);
- if(HwInfo->jChipType < SIS_661) {
+ if((HwInfo->jChipType < SIS_661) && (!(SiS_Pr->SiS_ROMNew))) {
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x25,0xf8);
}
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x0f,0xfb);
@@ -7673,7 +7623,7 @@ SiS_SetGroup4_C_ELV(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
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) {
+ if((HwInfo->jChipType >= SIS_661) || (SiS_Pr->SiS_ROMNew)) {
temp1 = 0;
if(SiS_Pr->SiS_TVMode & TVAspect43) temp1 = 4;
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x0f,0xfb,temp1);
@@ -7686,6 +7636,9 @@ SiS_SetGroup4_C_ELV(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0xf8,(temp & 0xff));
}
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x3a,0xfb,(temp >> 8));
+ if(ModeNo > 0x13) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x3b,0xfd);
+ }
if(HwInfo->jChipType >= SIS_661) { /* ? */
if(SiS_Pr->SiS_TVMode & TVAspect43) {
@@ -7745,7 +7698,7 @@ static void
SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
USHORT RefreshRateTableIndex, PSIS_HW_INFO HwInfo)
{
- USHORT tempax,tempcx,tempbx,modeflag,temp,temp2,resinfo;
+ USHORT tempax,tempcx,tempbx,modeflag,temp,resinfo;
ULONG tempebx,tempeax,templong;
if(ModeNo <= 0x13) {
@@ -7778,180 +7731,154 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
if(SiS_IsDualLink(SiS_Pr, HwInfo)) {
SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x2c);
+ } else {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x27,~0x20);
}
-#ifdef SET_EMI
+
if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x2a,0x00);
+#ifdef SET_EMI
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
+#endif
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10);
}
-#endif
}
return;
}
}
- temp = SiS_Pr->SiS_RVBHCFACT;
- SiS_SetReg(SiS_Pr->SiS_Part4Port,0x13,temp);
+ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x13,SiS_Pr->SiS_RVBHCFACT);
tempbx = SiS_Pr->SiS_RVBHCMAX;
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x14,tempbx);
- temp2 = (tempbx >> 1) & 0x0080;
+ temp = (tempbx >> 1) & 0x80;
tempcx = SiS_Pr->SiS_VGAHT - 1;
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x16,tempcx);
- temp2 |= (((tempcx & 0xFF00) >> 8) << 3) & 0x00ff;
+ temp |= ((tempcx >> 5) & 0x78);
tempcx = SiS_Pr->SiS_VGAVT - 1;
if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) tempcx -= 5;
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x17,tempcx);
- temp = temp2 | (tempcx >> 8);
+ temp |= ((tempcx >> 8) & 0x07);
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x15,temp);
tempbx = SiS_Pr->SiS_VGAHDE;
- 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 & SetCRT2ToHiVision) {
+ if(modeflag & HalfDCLK) tempbx >>= 1;
+ if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempbx >>= 1;
+
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
temp = 0;
- if(tempbx > 800) {
- temp = 0xA0;
- if(tempbx != 1024) {
- temp = 0xC0;
- if(tempbx != 1280) temp = 0;
- }
- }
- } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
- if(tempbx <= 800) {
- temp = 0x80;
- }
+ if(tempbx > 800) temp = 0x60;
+ } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
+ temp = 0;
+ if(tempbx == 1024) temp = 0xA0;
+ else if(tempbx > 1024) temp = 0xC0;
+ } else if(SiS_Pr->SiS_TVMode & (TVSetYPbPr525p | TVSetYPbPr750p)) {
+ temp = 0;
+ if(tempbx >= 1280) temp = 0x40;
+ else if(tempbx >= 1024) temp = 0x20;
} else {
temp = 0x80;
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
- temp = 0;
- if(tempbx > 800) temp = 0x60;
- }
- }
-
- if(SiS_Pr->SiS_TVMode & (TVSetYPbPr525p | TVSetYPbPr750p)) {
- temp = 0;
- if(SiS_Pr->SiS_VGAHDE == 1024) temp = 0x20;
- }
-
- if(HwInfo->jChipType < SIS_661) {
- if(SiS_IsDualLink(SiS_Pr, HwInfo)) temp = 0;
+ if(tempbx >= 1024) temp = 0xA0;
}
if(SiS_Pr->SiS_VBType & VB_SIS301) {
- if(SiS_Pr->SiS_LCDResInfo != Panel_1280x1024)
- temp |= 0x0A;
+ if(SiS_Pr->SiS_LCDResInfo != Panel_1280x1024) temp |= 0x0A;
}
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x0E,0x10,temp);
-
+
+ tempeax = SiS_Pr->SiS_VGAVDE;
tempebx = SiS_Pr->SiS_VDE;
-
if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
if(!(temp & 0xE0)) tempebx >>=1;
- }
-
+ }
+
tempcx = SiS_Pr->SiS_RVBHRS;
- temp = tempcx & 0x00FF;
- SiS_SetReg(SiS_Pr->SiS_Part4Port,0x18,temp);
-
- tempeax = SiS_Pr->SiS_VGAVDE;
- tempcx |= 0x4000;
+ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x18,tempcx);
+ tempcx >>= 8;
+ tempcx |= 0x40;
+
if(tempeax <= tempebx) {
- tempcx ^= 0x4000;
+ tempcx ^= 0x40;
} else {
tempeax -= tempebx;
}
- templong = (tempeax * 256 * 1024) % tempebx;
- tempeax = (tempeax * 256 * 1024) / tempebx;
- tempebx = tempeax;
- if(templong != 0) tempebx++;
+ tempeax *= (256 * 1024);
+ templong = tempeax % tempebx;
+ tempeax /= tempebx;
+ if(templong) tempeax++;
- temp = (USHORT)(tempebx & 0x000000FF);
+ temp = (USHORT)(tempeax & 0x000000FF);
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x1B,temp);
- temp = (USHORT)((tempebx & 0x0000FF00) >> 8);
+ temp = (USHORT)((tempeax & 0x0000FF00) >> 8);
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x1A,temp);
-
- tempbx = (USHORT)(tempebx >> 16);
- temp = tempbx & 0x00FF;
- temp <<= 4;
- temp |= ((tempcx & 0xFF00) >> 8);
+ temp = (USHORT)((tempeax >> 12) & 0x70); /* sic! */
+ temp |= (tempcx & 0x4F);
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x19,temp);
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x1C,0x28);
+ /* Calc Linebuffer max address and set/clear decimode */
tempbx = 0;
+ if(SiS_Pr->SiS_TVMode & (TVSetHiVision | TVSetYPbPr750p)) tempbx = 0x08;
tempax = SiS_Pr->SiS_VGAHDE;
- if(modeflag & HalfDCLK) tempax >>= 1;
+ 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 > 800) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ tempax -= 800;
+ } else { /* 651+301C: Only if TVNoHiviNoYPbPr */
+ tempbx = 0x08;
if(tempax == 1024) tempax *= 25;
else tempax *= 20;
temp = tempax % 32;
tempax /= 32;
- tempax--;
- if (temp!=0) tempax++;
- }
- }
+ if(temp) tempax++;
+ tempax++;
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoYPbPrHiVision) ||
+ (SiS_Pr->SiS_TVMode & TVSetYPbPr525i)) {
+ if(resinfo == SIS_RI_1024x768) {
+ /* Otherwise white line at right edge */
+ tempax = (tempax & 0xff00) | 0x20;
+ }
+ }
+ }
+ }
tempax--;
- 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);
- temp <<= 4;
- temp |= tempbx;
+ temp = ((tempax >> 4) & 0x30) | tempbx;
+ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x1D,tempax);
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x1E,temp);
- if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
- if(IS_SIS550650740660) {
- temp = 0x0026; /* 1.10.7w; 1.10.8r; needs corresponding code in Dis/EnableBridge! */
- } else {
- temp = 0x0036;
- }
- } else {
- temp = 0x0036;
+ temp = 0x0036; tempbx = 0xD0;
+ if((HwInfo->jChipType >= SIS_315H) && (SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) {
+ temp = 0x0026; tempbx = 0xC0; /* See En/DisableBridge() */
}
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;
+ temp &= ~0x01;
}
}
}
}
- SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x1F,0xC0,temp);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x1F,tempbx,temp);
- tempbx = SiS_Pr->SiS_HT;
+ tempbx = SiS_Pr->SiS_HT >> 1;
if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempbx >>= 1;
- tempbx >>= 1;
tempbx -= 2;
- temp = ((tempbx & 0x0700) >> 8) << 3;
+ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x22,tempbx);
+ temp = (tempbx >> 5) & 0x38;
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x21,0xC0,temp);
- temp = tempbx & 0x00FF;
- SiS_SetReg(SiS_Pr->SiS_Part4Port,0x22,temp);
if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
@@ -7961,15 +7888,17 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(HwInfo->jChipType >= SIS_315H) {
if(SiS_IsDualLink(SiS_Pr, HwInfo)) {
SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x27,0x2c);
+ } else {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x27,~0x20);
}
}
-#ifdef SET_EMI
if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x2a,0x00);
+#ifdef SET_EMI
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
+#endif
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10);
}
-#endif
}
} /* 301B */
@@ -8175,7 +8104,10 @@ static void
SiS_SetCHTVReg(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
USHORT RefreshRateTableIndex)
{
- USHORT temp, tempbx, tempcl;
+#if defined(SIS300) || defined(SIS315H)
+ USHORT temp, tempbx;
+#endif
+ USHORT tempcl;
USHORT TVType, resindex;
const SiS_CHTVRegDataStruct *CHTVRegData = NULL;
@@ -9046,16 +8978,9 @@ SiS_SetCRT2Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
(SiS_Pr->SiS_CustomT == CUT_BARCO1024)) {
SetOEMLCDData2(SiS_Pr, HwInfo, ModeNo, ModeIdIndex,RefreshRateTableIndex);
}
- if(HwInfo->jChipType == SIS_730) {
- SiS_DisplayOn(SiS_Pr);
- }
+ SiS_DisplayOn(SiS_Pr);
}
}
- if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
- if(HwInfo->jChipType != SIS_730) {
- SiS_DisplayOn(SiS_Pr);
- }
- }
}
#endif
@@ -9064,7 +8989,7 @@ 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);
- SiS_OEM310Setting(SiS_Pr, HwInfo, ModeNo, ModeIdIndex);
+ SiS_OEM310Setting(SiS_Pr, HwInfo, ModeNo, ModeIdIndex, RefreshRateTableIndex);
} else {
SiS_OEM661Setting(SiS_Pr, HwInfo, ModeNo, ModeIdIndex, RefreshRateTableIndex);
}
@@ -9769,9 +9694,10 @@ USHORT
SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
{
USHORT DDCdatatype, paneltype, flag, xres=0, yres=0;
- USHORT index, myindex, lumsize, numcodes;
+ USHORT index, myindex, lumsize, numcodes, panelvendor, panelproduct;
unsigned char cr37=0, seekcode;
BOOLEAN checkexpand = FALSE;
+ BOOLEAN havesync = FALSE;
int retry, i;
unsigned char buffer[256];
@@ -9780,6 +9706,8 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
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;
+ SiS_Pr->CP_PrefClock = 0;
+ SiS_Pr->PanelSelfDetected = FALSE;
if(!(pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B))) return 0;
if(pSiS->VBFlags & VB_30xBDH) return 0;
@@ -9835,20 +9763,20 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
/* Catch a few clear cases: */
if(!(checkedid1(buffer))) {
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "CRT2: EDID corrupt\n");
+ "LCD sense: EDID corrupt\n");
return 0;
}
if(!(buffer[0x14] & 0x80)) {
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "CRT2: Attached display expects analog input (0x%02x)\n",
+ "LCD sense: Attached display expects analog input (0x%02x)\n",
buffer[0x14]);
return 0;
}
if((buffer[0x18] & 0x18) != 0x08) {
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "CRT2: Attached display is not of RGB but of %s type (0x%02x)\n",
+ "LCD sense: Attached display is not of RGB but of %s type (0x%02x)\n",
((buffer[0x18] & 0x18) == 0x00) ? "monochrome/greyscale" :
( ((buffer[0x18] & 0x18) == 0x10) ? "non-RGB multicolor" :
"undefined"),
@@ -9864,15 +9792,19 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
paneltype = Panel_Custom;
checkexpand = FALSE;
+
+ panelvendor = buffer[9] | (buffer[8] << 8);
+ panelproduct = buffer[10] | (buffer[11] << 8);
if(buffer[0x18] & 0x02) {
+
+ USHORT pclk = (buffer[0x36] | (buffer[0x37] << 8));
+ USHORT phb = (buffer[0x39] | ((buffer[0x3a] & 0x0f) << 8));
+ USHORT pvb = (buffer[0x3c] | ((buffer[0x3d] & 0x0f) << 8));
- xres = buffer[0x38] | ((buffer[0x3a] & 0xf0) << 4);
- yres = buffer[0x3b] | ((buffer[0x3d] & 0xf0) << 4);
-
- SiS_Pr->CP_PreferredX = xres;
- SiS_Pr->CP_PreferredY = yres;
-
+ SiS_Pr->CP_PreferredX = xres = buffer[0x38] | ((buffer[0x3a] & 0xf0) << 4);
+ SiS_Pr->CP_PreferredY = yres = buffer[0x3b] | ((buffer[0x3d] & 0xf0) << 4);
+
switch(xres) {
#if 0 /* Treat as custom */
case 800:
@@ -9889,7 +9821,7 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
}
break;
case 1280:
- if(yres == 1024) {
+ if(yres == 1024) {
paneltype = Panel_1280x1024;
checkexpand = TRUE;
} else if(yres == 960) {
@@ -9899,14 +9831,20 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
paneltype = Panel310_1280x960;
}
} else if(yres == 768) {
- if( ((buffer[0x36] | (buffer[0x37] << 8)) == 8100) &&
- ((buffer[0x39] | ((buffer[0x3a] & 0x0f) << 8)) == (1688 - 1280)) &&
- ((buffer[0x3c] | ((buffer[0x3d] & 0x0f) << 8)) == (802 - 768)) ) {
+ if( (pclk == 8100) &&
+ (phb == (1688 - 1280)) &&
+ (pvb == (802 - 768)) ) {
paneltype = Panel_1280x768;
checkexpand = FALSE;
cr37 |= 0x10;
}
- }
+ } else if(yres == 800) {
+ if( (pclk == 6900) &&
+ (phb == (1408 - 1280)) &&
+ (pvb == (816 - 800)) ) {
+ paneltype = Panel_1280x800;
+ }
+ }
break;
case 1400:
if(pSiS->VGAEngine == SIS_315_VGA) {
@@ -9916,7 +9854,6 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
}
}
break;
-#if 0 /* Treat this as custom, as we have no valid timing data yet */
case 1600:
if(pSiS->VGAEngine == SIS_315_VGA) {
if(pSiS->VBFlags & VB_301C) {
@@ -9927,41 +9864,62 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
}
}
break;
-#endif
}
- if(paneltype != Panel_Custom) {
- if((buffer[0x47] & 0x18) == 0x18) {
- cr37 |= ((((buffer[0x47] & 0x06) ^ 0x06) << 5) | 0x20);
- } else {
- /* 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 */
- }
+ /* Save sync: This is used if "Pass 1:1" is off; in this case
+ * we always use the panel's native mode = this "preferred mode"
+ * we just have been analysing. Hence, we also need its sync.
+ */
+ if((buffer[0x47] & 0x18) == 0x18) {
+ cr37 |= ((((buffer[0x47] & 0x06) ^ 0x06) << 5) | 0x20);
+ havesync = TRUE;
+ } else {
+ /* What now? There is no digital separate output timing... */
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_WARNING,
+ "LCD sense: Unable to retrieve Sync polarity information\n");
+ cr37 |= 0xc0; /* Default */
}
}
+
+ /* Check against our database; Eg. Sanyo projector reports
+ * 1024x768 as preferred mode, although it supports 1280x720
+ * natively in non-HTCP mode. Treat such wrongly reporting
+ * panels as custom and fixup actual maximum resolutions.
+ */
+ if(paneltype != Panel_Custom) {
+ int maxx, maxy;
+ if((SiS_FindPanelFromDB(pSiS, panelvendor, panelproduct, &maxx, &maxy))) {
+ paneltype = Panel_Custom;
+ SiS_Pr->CP_MaxX = maxx;
+ SiS_Pr->CP_MaxY = maxy;
+ /* Leave preferred unchanged (MUST contain a valid mode!) */
+ }
+ }
/* If we still don't know what panel this is, we take it
* as a custom panel and derive the timing data from the
* detailed timing blocks
*/
if(paneltype == Panel_Custom) {
-
- BOOLEAN havesync = FALSE;
+
int i, temp, base = 0x36;
unsigned long estpack;
- unsigned short estx[] = {
+ const unsigned short estx[] = {
720, 720, 640, 640, 640, 640, 800, 800,
800, 800, 832,1024,1024,1024,1024,1280,
1152
};
- unsigned short esty[] = {
+ const unsigned short esty[] = {
400, 400, 480, 480, 480, 480, 600, 600,
600, 600, 624, 768, 768, 768, 768,1024,
870
};
+ const int estclk[] = {
+ 0, 0, 25100, 0, 31500, 31500, 36100, 40000,
+ 50100, 49500, 0, 0, 65100, 75200, 78700,135200,
+ 0
+ };
paneltype = 0;
SiS_Pr->CP_Supports64048075 = TRUE;
@@ -9974,8 +9932,14 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
if(estpack & (1 << i)) {
if(estx[16 - i] > SiS_Pr->CP_MaxX) SiS_Pr->CP_MaxX = estx[16 - i];
if(esty[16 - i] > SiS_Pr->CP_MaxY) SiS_Pr->CP_MaxY = esty[16 - i];
+ if(estclk[16 - i] > SiS_Pr->CP_MaxClock) SiS_Pr->CP_MaxClock = estclk[16 - i];
}
}
+
+ /* 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;
/* 2. From Standard Timings */
for(i=0x26; i < 0x36; i+=2) {
@@ -10020,29 +9984,28 @@ 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] & 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]) ||
- (SiS_Pr->CP_HSyncStart[i] > SiS_Pr->CP_HTotal[i]) ||
- (SiS_Pr->CP_HSyncEnd[i] > SiS_Pr->CP_HTotal[i]) ||
- (SiS_Pr->CP_VDisplay[i] > SiS_Pr->CP_VSyncStart[i]) ||
- (SiS_Pr->CP_VDisplay[i] >= SiS_Pr->CP_VSyncEnd[i]) ||
- (SiS_Pr->CP_VDisplay[i] >= SiS_Pr->CP_VTotal[i]) ||
- (SiS_Pr->CP_VSyncStart[i] > SiS_Pr->CP_VSyncEnd[i]) ||
- (SiS_Pr->CP_VSyncStart[i] > SiS_Pr->CP_VTotal[i]) ||
- (SiS_Pr->CP_VSyncEnd[i] > SiS_Pr->CP_VTotal[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]) ||
+ (SiS_Pr->CP_HSyncStart[i] > SiS_Pr->CP_HTotal[i]) ||
+ (SiS_Pr->CP_HSyncEnd[i] > SiS_Pr->CP_HTotal[i]) ||
+ (SiS_Pr->CP_VDisplay[i] > SiS_Pr->CP_VSyncStart[i]) ||
+ (SiS_Pr->CP_VDisplay[i] >= SiS_Pr->CP_VSyncEnd[i]) ||
+ (SiS_Pr->CP_VDisplay[i] >= SiS_Pr->CP_VTotal[i]) ||
+ (SiS_Pr->CP_VSyncStart[i] > SiS_Pr->CP_VSyncEnd[i]) ||
+ (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] > 108200))) ||
+ ((!(pSiS->VBFlags & VB_301C)) &&
+ ((SiS_Pr->CP_Clock[i] > 108200) || (SiS_Pr->CP_VDisplay[i] > 1024)))) ||
(buffer[base+17] & 0x80)) {
SiS_Pr->CP_DataValid[i] = FALSE;
} else {
- paneltype = Panel_Custom;
-
SiS_Pr->CP_HaveCustomData = TRUE;
if(xres > SiS_Pr->CP_MaxX) SiS_Pr->CP_MaxX = xres;
@@ -10051,22 +10014,10 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
if((SiS_Pr->CP_PreferredX == xres) && (SiS_Pr->CP_PreferredY == yres)) {
SiS_Pr->CP_PreferredIndex = i;
+ SiS_MakeClockRegs(pSiS->pScrn, SiS_Pr->CP_Clock[i], &SiS_Pr->CP_PrefSR2B, &SiS_Pr->CP_PrefSR2C);
+ SiS_Pr->CP_PrefClock = (SiS_Pr->CP_Clock[i] / 1000) + 1;
}
- 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
- */
- checkexpand = FALSE;
- cr37 |= 0x10;
-
/* Extract the sync polarisation information. This only works
* if the Flags indicate a digital separate output.
*/
@@ -10074,20 +10025,37 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
SiS_Pr->CP_HSync_P[i] = (buffer[base+17] & 0x02) ? TRUE : FALSE;
SiS_Pr->CP_VSync_P[i] = (buffer[base+17] & 0x04) ? TRUE : FALSE;
SiS_Pr->CP_SyncValid[i] = TRUE;
- if(!havesync) {
+ if((i == SiS_Pr->CP_PreferredIndex) && (!havesync)) {
cr37 |= ((((buffer[base+17] & 0x06) ^ 0x06) << 5) | 0x20);
havesync = TRUE;
}
} else {
SiS_Pr->CP_SyncValid[i] = FALSE;
}
+
}
- }
+
+ } else if((!buffer[base]) && (!buffer[base+1]) && (!buffer[base+2]) && (!buffer[base+4])) {
+
+ /* Maximum pixclock from Monitor Range Limits */
+ if((buffer[base+3] == 0xfd) && (buffer[base+9] != 0xff)) {
+ int maxclk = buffer[base+9] * 10;
+ /* More than 170 is not supported anyway */
+ if(maxclk <= 170) SiS_Pr->CP_MaxClock = maxclk * 1000;
+ }
+
+ }
+
}
- if(!havesync) {
- xf86DrvMsg(pSiS->pScrn->scrnIndex, X_WARNING,
- "CRT2: Unable to retrieve Sync polarity information\n");
- }
+
+ if(SiS_Pr->CP_MaxX && SiS_Pr->CP_MaxY) {
+ paneltype = Panel_Custom;
+ checkexpand = FALSE;
+ cr37 |= 0x10;
+ SiS_Pr->CP_Vendor = panelvendor;
+ SiS_Pr->CP_Product = panelproduct;
+ }
+
}
if(paneltype && checkexpand) {
@@ -10110,28 +10078,32 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
if(!(checkedid2(buffer))) {
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "CRT2: EDID corrupt\n");
+ "LCD sense: EDID corrupt\n");
return 0;
}
if((buffer[0x41] & 0x0f) == 0x03) {
index = 0x42 + 3;
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "CRT2: Display supports TMDS input on primary interface\n");
+ "LCD sense: Display supports TMDS input on primary interface\n");
} else if((buffer[0x41] & 0xf0) == 0x30) {
index = 0x46 + 3;
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "CRT2: Display supports TMDS input on secondary interface\n");
+ "LCD sense: Display supports TMDS input on secondary interface\n");
} else {
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "CRT2: Display does not support TMDS video interface (0x%02x)\n",
+ "LCD sense: Display does not support TMDS video interface (0x%02x)\n",
buffer[0x41]);
return 0;
}
-
+
+ SiS_Pr->CP_Vendor = panelvendor = buffer[2] | (buffer[1] << 8);
+ SiS_Pr->CP_Product = panelproduct = buffer[3] | (buffer[4] << 8);
+
paneltype = Panel_Custom;
- SiS_Pr->CP_MaxX = xres = buffer[0x76] | (buffer[0x77] << 8);
- SiS_Pr->CP_MaxY = yres = buffer[0x78] | (buffer[0x79] << 8);
+ SiS_Pr->CP_MaxX = SiS_Pr->CP_PreferredX = xres = buffer[0x76] | (buffer[0x77] << 8);
+ SiS_Pr->CP_MaxY = SiS_Pr->CP_PreferredY = yres = buffer[0x78] | (buffer[0x79] << 8);
+
switch(xres) {
#if 0
case 800:
@@ -10168,7 +10140,6 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
}
}
break;
-#if 0 /* Treat this one as custom since we have no timing data yet */
case 1600:
if(pSiS->VGAEngine == SIS_315_VGA) {
if(pSiS->VBFlags & VB_301C) {
@@ -10179,7 +10150,6 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
}
}
break;
-#endif
}
/* Determine if RGB18 or RGB24 */
@@ -10202,7 +10172,25 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
lumsize++; /* luminance header byte */
index += lumsize;
}
+#if 0 /* "pixel rate" = pixel clock? */
+ if(buffer[0x7e] & 0x1c) {
+ for(i=0; i<((buffer[0x7e] & 0x1c) >> 2); i++) {
+ if(buffer[index + (i*8) + 6] && (buffer[index + (i*8) + 7] & 0x0f)) {
+ int clk = (buffer[index + (i*8) + 6] | ((buffer[index + (i*8) + 7] & 0x0f) << 4)) * 1000;
+ if(clk > SiS_Pr->CP_MaxClock) SiS_Pr->CP_MaxClock = clk;
+ }
+ }
+ }
+#endif
index += (((buffer[0x7e] & 0x1c) >> 2) * 8); /* skip Frequency Ranges */
+ if(buffer[0x7e] & 0x03) {
+ for(i=0; i<(buffer[0x7e] & 0x03); i++) {
+ if((buffer[index + (i*27) + 9]) || (buffer[index + (i*27) + 10])) {
+ int clk = ((buffer[index + (i*27) + 9]) | ((buffer[index + (i*27) + 9]) << 8)) * 10;
+ if(clk > SiS_Pr->CP_MaxClock) SiS_Pr->CP_MaxClock = clk;
+ }
+ }
+ }
index += ((buffer[0x7e] & 0x03) * 27); /* skip Detailed Range Limits */
numcodes = (buffer[0x7f] & 0xf8) >> 3;
if(numcodes) {
@@ -10214,13 +10202,29 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
}
if(buffer[myindex] == seekcode) {
cr37 |= ((((buffer[myindex + 1] & 0x0c) ^ 0x0c) << 4) | 0x20);
+ havesync = TRUE;
} else {
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_WARNING,
- "CRT2: Unable to retrieve Sync polarity information\n");
+ "LCD sense: Unable to retrieve Sync polarity information\n");
}
} else {
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_WARNING,
- "CRT2: Unable to retrieve Sync polarity information\n");
+ "LCD sense: Unable to retrieve Sync polarity information\n");
+ }
+
+ /* Check against our database; Eg. Sanyo projector reports
+ * 1024x768 in non-HDPC mode, although it supports 1280x720.
+ * Treat such wrongly reporting panels as custom.
+ */
+ if(paneltype != Panel_Custom) {
+ int maxx, maxy;
+ if((SiS_FindPanelFromDB(pSiS, panelvendor, panelproduct, &maxx, &maxy))) {
+ paneltype = Panel_Custom;
+ SiS_Pr->CP_MaxX = maxx;
+ SiS_Pr->CP_MaxY = maxy;
+ cr37 |= 0x10;
+ /* Leave preferred unchanged (MUST be a valid mode!) */
+ }
}
/* Now seek the detailed timing descriptions for custom panels */
@@ -10266,7 +10270,8 @@ 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] > 108200))) ||
+ ((!(pSiS->VBFlags & VB_301C)) &&
+ ((SiS_Pr->CP_Clock[i] > 108200) || (SiS_Pr->CP_VDisplay[i] > 1024)))) ||
(buffer[index + 17] & 0x80)) {
SiS_Pr->CP_DataValid[i] = FALSE;
@@ -10277,25 +10282,25 @@ 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)) {
+ if((SiS_Pr->CP_PreferredX == xres) && (SiS_Pr->CP_PreferredY == yres)) {
SiS_Pr->CP_PreferredIndex = i;
+ SiS_MakeClockRegs(pSiS->pScrn, SiS_Pr->CP_Clock[i], &SiS_Pr->CP_PrefSR2B, &SiS_Pr->CP_PrefSR2C);
+ SiS_Pr->CP_PrefClock = (SiS_Pr->CP_Clock[i] / 1000) + 1;
+ if(!havesync) {
+ cr37 |= ((((buffer[index + 17] & 0x06) ^ 0x06) << 5) | 0x20);
+ havesync = TRUE;
+ }
}
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;
- SiS_Pr->CP_Vendor = buffer[2] | (buffer[1] << 8);
- SiS_Pr->CP_Product = buffer[3] | (buffer[4] << 8);
-
- /* We must assume the panel can scale, since we have
- * no scaling data
- */
- cr37 |= 0x10;
-
}
}
+ cr37 |= 0x10;
+
}
break;
@@ -10314,7 +10319,7 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
for(i = 0; i < 7; i++) {
if(SiS_Pr->CP_DataValid[i]) {
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "Non-standard LCD timing data no. %d:\n", i);
+ "Non-standard LCD/DVI-D timing data no. %d:\n", i);
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
" HDisplay %d HSync %d HSyncEnd %d HTotal %d\n",
SiS_Pr->CP_HDisplay[i], SiS_Pr->CP_HSyncStart[i],
@@ -10336,14 +10341,17 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
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;
SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x32,0x08);
- SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x36,0xf0,paneltype);
+ SiS_SetReg(SiS_Pr->SiS_P3d4,0x36,paneltype);
cr37 &= 0xf1;
- SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,0xf3,cr37);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,0x0c,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);
+ "LCD sense: [DDC LCD results: 0x%02x, 0x%02x]\n", paneltype, cr37);
#endif
+ } else {
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x32,~0x08);
+ SiS_SetReg(SiS_Pr->SiS_P3d4,0x36,0x00);
}
return 0;
}
@@ -10375,7 +10383,7 @@ SiS_SenseVGA2DDC(SiS_Private *SiS_Pr, SISPtr pSiS)
DDCdatatype = 1;
} else {
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "Do DDC answer\n");
+ "VGA2 sense: Do DDC answer\n");
return 0; /* no DDC support (or no device attached) */
}
@@ -10384,7 +10392,7 @@ SiS_SenseVGA2DDC(SiS_Private *SiS_Pr, SISPtr pSiS)
do {
if(SiS_ReadDDC(SiS_Pr, DDCdatatype, buffer)) {
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "CRT2: DDC read failed (attempt %d), %s\n",
+ "VGA2 sense: DDC read failed (attempt %d), %s\n",
(3-retry), (retry == 1) ? "giving up" : "retrying");
retry--;
if(retry == 0) return 0xFFFF;
@@ -10397,13 +10405,13 @@ SiS_SenseVGA2DDC(SiS_Private *SiS_Pr, SISPtr pSiS)
switch(DDCdatatype) {
case 1:
if(!(checkedid1(buffer))) {
- xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "CRT2: EDID corrupt\n");
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_ERROR,
+ "VGA2 sense: EDID corrupt\n");
return 0;
}
if(buffer[0x14] & 0x80) { /* Display uses digital input */
- xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "CRT2: Attached display expects digital input\n");
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_ERROR,
+ "VGA2 sense: Attached display expects digital input\n");
return 0;
}
SiS_Pr->CP_Vendor = buffer[9] | (buffer[8] << 8);
@@ -10413,16 +10421,16 @@ SiS_SenseVGA2DDC(SiS_Private *SiS_Pr, SISPtr pSiS)
case 3:
case 4:
if(!(checkedid2(buffer))) {
- xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "CRT2: EDID corrupt\n");
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_ERROR,
+ "VGA2 sense: EDID corrupt\n");
return 0;
}
if( ((buffer[0x41] & 0x0f) != 0x01) && /* Display does not support analog input */
((buffer[0x41] & 0x0f) != 0x02) &&
((buffer[0x41] & 0xf0) != 0x10) &&
((buffer[0x41] & 0xf0) != 0x20) ) {
- xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "CRT2: Attached display does not support analog input (0x%02x)\n",
+ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_ERROR,
+ "VGA2 sense: Attached display does not support analog input (0x%02x)\n",
buffer[0x41]);
return 0;
}
@@ -10952,6 +10960,7 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
delay = SiS310_LCDDelayCompensation_301[myindex];
if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
if(IS_SIS740) delay = 0x01;
+ else if(HwInfo->jChipType <= SIS_315PRO) delay = SiS310_LCDDelayCompensation_3xx301LV[myindex];
else delay = SiS310_LCDDelayCompensation_650301LV[myindex];
} else if(SiS_Pr->SiS_VBType & VB_SIS301C) {
if(IS_SIS740) delay = 0x01; /* ? */
@@ -11294,35 +11303,18 @@ SetPhaseIncr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
}
}
-void
-SiS_OEM310Setting(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
- USHORT ModeNo,USHORT ModeIdIndex)
-{
- SetDelayComp(SiS_Pr,HwInfo,ModeNo);
-
- 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_SIS301) {
- SetEdgeEnhance(SiS_Pr,HwInfo,ModeNo,ModeIdIndex);
- }
- }
-}
-
static void
SetDelayComp661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo,
USHORT ModeIdIndex, USHORT RTI)
{
- USHORT delay = 0, romptr = 0, index;
+ USHORT delay = 0, romptr = 0, index, lcdpdcindex;
UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
if(!(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV | SetCRT2ToLCD | SetCRT2ToLCDA | SetCRT2ToRAMDAC)))
return;
/* 1. New ROM: VGA2 and LCD/LCDA-Pass1:1 */
+ /* (If a custom mode is used, Pass1:1 is always set; hence we do this:) */
if(SiS_Pr->SiS_ROMNew) {
if((SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) ||
@@ -11337,8 +11329,10 @@ SetDelayComp661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo,
}
if(index < 25) index = 25;
index = ((index / 25) - 1) << 1;
- if(SiS_Pr->SiS_VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToLCD)) index++;
- romptr = SISGETROMW(0x104); /* 0x4ae */
+ if((ROMAddr[0x5b] & 0x80) || (SiS_Pr->SiS_VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToLCD))) {
+ index++;
+ }
+ romptr = SISGETROMW(0x104);
delay = ROMAddr[romptr + index];
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToLCD)) {
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2d,0xf0,((delay >> 1) & 0x0f));
@@ -11364,10 +11358,12 @@ SetDelayComp661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo,
index = GetOEMTVPtr661(SiS_Pr);
if(SiS_Pr->SiS_ROMNew) {
- romptr = SISGETROMW(0x106); /* 0x4ba */
+ romptr = SISGETROMW(0x106);
+ if(SiS_Pr->SiS_VBType & VB_UMC) romptr += 12;
delay = ROMAddr[romptr + index];
} else {
delay = 0x04;
+ if(index > 3) delay = 0;
}
} else if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
@@ -11377,33 +11373,54 @@ SetDelayComp661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo,
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 */
+ lcdpdcindex = (SiS_Pr->SiS_VBType & VB_UMC) ? 14 : 12;
+
+ /* For LVDS (and sometimes TMDS), the BIOS must know about the correct value */
+ delay = ROMAddr[romptr + lcdpdcindex + 1]; /* LCD */
+ delay |= (ROMAddr[romptr + lcdpdcindex] << 8); /* LCDA */
} else {
- /* TMDS: Set our own, since BIOS has no idea - TODO: Find out about values */
+ /* TMDS: Set our own, since BIOS has no idea */
+ /* (This is done on >=661 only, since <661 is calling this only for LVDS) */
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;
+ switch(SiS_Pr->SiS_LCDResInfo) {
+ case Panel_1024x768: delay = 0x0008; break;
+ case Panel_1280x720: delay = 0x0004; break;
+ case Panel_1280x768:
+ case Panel_1280x768_2:delay = 0x0004; break;
+ case Panel_1280x800:
+ case Panel_1280x800_2:delay = 0x0004; break; /* Verified for 1280x800 */
+ case Panel_1280x1024: delay = 0x1e04; break;
+ case Panel_1400x1050: delay = 0x0004; break;
+ case Panel_1600x1200: delay = 0x0400; break;
+ case Panel_1680x1050: delay = 0x0e04; break;
+ default:
+ if((SiS_Pr->PanelXRes <= 1024) && (SiS_Pr->PanelYRes <= 768)) {
+ delay = 0x0008;
+ } else if((SiS_Pr->PanelXRes == 1280) && (SiS_Pr->PanelYRes == 1024)) {
+ delay = 0x1e04;
+ } else if((SiS_Pr->PanelXRes <= 1400) && (SiS_Pr->PanelYRes <= 1050)) {
+ delay = 0x0004;
+ } else if((SiS_Pr->PanelXRes <= 1600) && (SiS_Pr->PanelYRes <= 1200)) {
+ delay = 0x0400;
+ } else
+ delay = 0x0e04;
+ break;
+ }
+ }
+
+ /* Override by detected or user-set values */
+ /* (but only if, for some reason, we can't read value from BIOS) */
+ 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;
}
}
-
- /* 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) {
@@ -11431,31 +11448,30 @@ SetCRT2SyncDither661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo, US
} else {
infoflag = SiS_Pr->SiS_RefIndex[RTI].Ext_InfoFlag;
}
- infoflag &= 0xc0;
-
- temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x37);
- if(SiS_Pr->SiS_LCDInfo & LCDPass11) {
- temp &= 0x3f;
- temp |= infoflag;
- } else {
- if(temp & 0x20) infoflag = temp;
+
+ if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) {
+ infoflag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x37); /* No longer check D5 */
}
- if(temp & 0x01) infoflag |= 0x01;
+
+ infoflag &= 0xc0;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
- temp = 0x0c;
- if(infoflag & 0x01) temp ^= 0x14; /* BIOS: 18, wrong */
- temp |= (infoflag >> 6);
+ temp = (infoflag >> 6) | 0x0c;
+ if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) {
+ temp ^= 0x04;
+ if(SiS_Pr->SiS_ModeType >= Mode24Bpp) temp |= 0x10;
+ }
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;
+ if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) temp = 0x20;
temp |= infoflag;
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0f,temp);
+ temp = 0;
+ if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) {
+ if(SiS_Pr->SiS_ModeType >= Mode24Bpp) temp |= 0x80;
+ }
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x1a,0x7f,temp);
}
}
@@ -11485,14 +11501,40 @@ SetPanelParms661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
}
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x24,temp2,temp1);
}
- temp1 = (ROMAddr[romptr + 1] & 0x80) >> 1;
- SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x0d,0xbf,temp1);
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ temp1 = (ROMAddr[romptr + 1] & 0x80) >> 1;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x0d,0xbf,temp1);
+ }
}
}
}
void
+SiS_OEM310Setting(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
+ USHORT ModeNo,USHORT ModeIdIndex,USHORT RRTI)
+{
+ if((SiS_Pr->SiS_ROMNew) && (SiS_Pr->SiS_VBType & VB_SISLVDS)) {
+ SetDelayComp661(SiS_Pr,HwInfo,ModeNo,ModeIdIndex,RRTI);
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
+ SetCRT2SyncDither661(SiS_Pr,HwInfo,ModeNo,RRTI);
+ SetPanelParms661(SiS_Pr,HwInfo);
+ }
+ } else {
+ SetDelayComp(SiS_Pr,HwInfo,ModeNo);
+ }
+
+ 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_SIS301) {
+ SetEdgeEnhance(SiS_Pr,HwInfo,ModeNo,ModeIdIndex);
+ }
+ }
+}
+
+void
SiS_OEM661Setting(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
USHORT ModeNo,USHORT ModeIdIndex, USHORT RRTI)
{
@@ -11531,6 +11573,7 @@ SiS_FinalizeLCD(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
USHORT resinfo,modeflag;
if(!(SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) return;
+ if(SiS_Pr->SiS_ROMNew) return;
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
if(SiS_Pr->LVDSHL != -1) {
@@ -11600,13 +11643,13 @@ SiS_FinalizeLCD(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
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);
+#ifdef SET_EMI
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
+#endif
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10);
}
-#endif
} else if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) {
if(SiS_Pr->LVDSHL == -1) {
/* Maybe ACER only? */
diff --git a/src/init301.h b/src/init301.h
index 9e86ee1..e9c96aa 100644
--- a/src/init301.h
+++ b/src/init301.h
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h,v 1.9 2004/08/20 18:57:06 kem Exp $ */
/*
* Data and prototypes for init301.c
*
@@ -34,7 +35,7 @@
* * 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
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -88,29 +89,41 @@ const UCHAR SiS_YPbPrTable[3][64] = {
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,
+ 0x03,0x0a,0x65,0x9d /*0x8d*/,0x08,0x92,0x8f,0x40,
+ 0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x53 /*0x50*/,
0x00,0x40,0x44,0x00,0xdb,0x02,0x3b,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,
+ 0x0c,0x50,0xb2,0x9f,0x16,0x59,0x4c /*0x4f*/,0x13,
0xad,0x11,0xad,0x1d,0x40,0x8a,0x3d,0xb8,
- 0x51,0x5e,0x60,0x49,0x7d,0x92,0x0f,0x40,
+ 0x51,0x5e,0x60,0x57 /*0x49*/,0x7b /*0x7d*/,0x92,0x0f,0x40,
0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x4b,
0x43,0x41,0x11,0x00,0xfc,0xff,0x32,0x00
},
{
+#if 1
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,
+ 0xed,0x50,0x70,0x9f,0x16,0x59,0x21 /*0x2b*/,0x13,
0x27,0x0b,0x27,0xfc,0x30,0x27,0x1c,0xb0,
- 0x4b,0x4b,0x6f,0x2f,0x63,0x92,0x0f,0x40,
+ 0x4b,0x4b,0x65 /*0x6f*/,0x2f,0x63,0x92,0x0f,0x40,
0x60,0x80,0x14,0x90,0x8c,0x60,0x14,0x27,
0x00,0x40,0x11,0x00,0xfc,0xff,0x32,0x00
+#endif
+#if 0
+ 0x2a,0x14,0xe8,0x09,0x09,0xed,0x0c,0x0c, /* TEST (0.93) - BAD */
+ 0x98,0x0a,0x01,0x0c,0x06,0x0d,0x04,0x0a,
+ 0x06,0x14,0x0d,0x04,0x0a,0x00,0x85,0x3f,
+ 0xed,0x50,0x70,0x9e,0x16,0x57,0x6c,0x13,
+ 0x27,0x0b,0x27,0xfb,0x30,0x27,0x15,0xb0,
+ 0x3b,0xdb,0x61,0x24,0x78,0x92,0x0f,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0x14,0x6f,
+ 0x00,0x52,0xbb,0x00,0xd5,0xf7,0xa2,0x00
+#endif
}
};
@@ -136,7 +149,7 @@ const UCHAR SiS_HiTVGroup3_2[] = {
0x18, 0x1d, 0x23, 0x28, 0x4c, 0xaa, 0x01
};
-/* 301C / 302ELV (?) extended Part2 TV registers */
+/* 301C / 302ELV extended Part2 TV registers (4 tap scaler) */
static const UCHAR SiS_Part2CLVX_1[] = {
0x00,0x00,
@@ -205,49 +218,41 @@ 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,
+ 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,
0xFF,0xFF,
};
-
#ifdef SIS315H
-/* 661 et al LCD data structure */
+/* 661 et al LCD data structure (2.03.00) */
static const UCHAR SiS_LCDStruct661[] = {
/* 1024x768 */
/* 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 */
+ 0x00,0x02,0x00,0x06,0x00,0x41,0x5A,0x64,0x00,0x00,0x00,0x00,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,
+ 0x03,0xC0,0x00,0x05,0x00,0x04,0x98,0x06,0x2A,0x04,0x30,0x00,0x70,
+ 0x00,0x01,0x00,0x03,0x00,0x6C,0xF8,0x2F,0x00,0x00,0x00,0x00,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,
+ 0x00,0x01,0x00,0x03,0x00,0x6C,0xF8,0x2F,0x00,0x00,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,
+ 0x00,0x01,0x00,0x03,0x00,0xA2,0x70,0x24,0x00,0x00,0x00,0x00,0x0A,
+ /* 1280x768 (_2) */
+ 0x0A,0xE0,0x00,0x05,0x00,0x03,0x7C,0x06,0x26,0x03,0x30,0x00,0x70,
+ 0x00,0x03,0x00,0x06,0x00,0x4D,0xC8,0x48,0x00,0x00,0x00,0x00,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,
+ 0x0E,0xE0,0x00,0x05,0xD0,0x02,0x80,0x05,0x26,0x03,0x10,0x00,0x20,
+ 0x00,0x01,0x00,0x06,0x00,0x45,0x9C,0x62,0x00,0x00,0x00,0x00,0x05,
+ /* 1280x800 (_2) */
+ 0x0C,0xE0,0x00,0x05,0x20,0x03,0x10,0x06,0x2C,0x03,0x30,0x00,0x70,
+ 0x00,0x04,0x00,0x03,0x00,0x49,0xCE,0x1E,0x00,0x00,0x00,0x00,0x09,
/* 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
+ 0x00,0x03,0x00,0x06,0x00,0x79,0xBE,0x44,0x00,0x00,0x00,0x00,0x06,
};
#endif
@@ -335,46 +340,45 @@ 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);
+USHORT SiS_SetStart(SiS_Private *SiS_Pr);
+USHORT SiS_SetStop(SiS_Private *SiS_Pr);
+void SiS_DDC2Delay(SiS_Private *SiS_Pr, USHORT delaytime);
+USHORT SiS_SetSCLKLow(SiS_Private *SiS_Pr);
+USHORT SiS_SetSCLKHigh(SiS_Private *SiS_Pr);
+USHORT SiS_ReadDDC2Data(SiS_Private *SiS_Pr, USHORT tempax);
+USHORT SiS_WriteDDC2Data(SiS_Private *SiS_Pr, USHORT tempax);
+USHORT SiS_CheckACK(SiS_Private *SiS_Pr);
-USHORT SiS_ReadDDC1Bit(SiS_Private *SiS_Pr);
-void SiS_SetSwitchDDC2(SiS_Private *SiS_Pr);
-USHORT SiS_SetStart(SiS_Private *SiS_Pr);
-USHORT SiS_SetStop(SiS_Private *SiS_Pr);
-void SiS_DDC2Delay(SiS_Private *SiS_Pr, USHORT delaytime);
-USHORT SiS_SetSCLKLow(SiS_Private *SiS_Pr);
-USHORT SiS_SetSCLKHigh(SiS_Private *SiS_Pr);
-USHORT SiS_ReadDDC2Data(SiS_Private *SiS_Pr, USHORT tempax);
-USHORT SiS_WriteDDC2Data(SiS_Private *SiS_Pr, USHORT tempax);
-USHORT SiS_CheckACK(SiS_Private *SiS_Pr);
-
-USHORT SiS_InitDDCRegs(SiS_Private *SiS_Pr, unsigned long VBFlags, int VGAEngine,
- USHORT adaptnum, USHORT DDCdatatype, BOOLEAN checkcr32);
-USHORT SiS_WriteDABDDC(SiS_Private *SiS_Pr);
-USHORT SiS_PrepareReadDDC(SiS_Private *SiS_Pr);
-USHORT SiS_PrepareDDC(SiS_Private *SiS_Pr);
-void SiS_SendACK(SiS_Private *SiS_Pr, USHORT yesno);
-USHORT SiS_DoProbeDDC(SiS_Private *SiS_Pr);
-USHORT SiS_ProbeDDC(SiS_Private *SiS_Pr);
-USHORT SiS_ReadDDC(SiS_Private *SiS_Pr, USHORT DDCdatatype, unsigned char *buffer);
-USHORT SiS_HandleDDC(SiS_Private *SiS_Pr, unsigned long VBFlags, int VGAEngine,
- USHORT adaptnum, USHORT DDCdatatype, unsigned char *buffer);
+USHORT SiS_InitDDCRegs(SiS_Private *SiS_Pr, unsigned long VBFlags, int VGAEngine,
+ USHORT adaptnum, USHORT DDCdatatype, BOOLEAN checkcr32);
+USHORT SiS_WriteDABDDC(SiS_Private *SiS_Pr);
+USHORT SiS_PrepareReadDDC(SiS_Private *SiS_Pr);
+USHORT SiS_PrepareDDC(SiS_Private *SiS_Pr);
+void SiS_SendACK(SiS_Private *SiS_Pr, USHORT yesno);
+USHORT SiS_DoProbeDDC(SiS_Private *SiS_Pr);
+USHORT SiS_ProbeDDC(SiS_Private *SiS_Pr);
+USHORT SiS_ReadDDC(SiS_Private *SiS_Pr, USHORT DDCdatatype, unsigned char *buffer);
+USHORT SiS_HandleDDC(SiS_Private *SiS_Pr, unsigned long VBFlags, int VGAEngine,
+ USHORT adaptnum, USHORT DDCdatatype, unsigned char *buffer);
#ifdef LINUX_XF86
-USHORT SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS);
-USHORT SiS_SenseVGA2DDC(SiS_Private *SiS_Pr, SISPtr pSiS);
+USHORT SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS);
+USHORT SiS_SenseVGA2DDC(SiS_Private *SiS_Pr, SISPtr pSiS);
#endif
#ifdef SIS315H
-void SiS_OEM310Setting(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
- USHORT ModeNo,USHORT ModeIdIndex);
-void SiS_OEM661Setting(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
- USHORT ModeNo,USHORT ModeIdIndex, USHORT RRTI);
-void SiS_FinalizeLCD(SiS_Private *, USHORT, USHORT, PSIS_HW_INFO);
+void SiS_OEM310Setting(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
+ USHORT ModeNo,USHORT ModeIdIndex, USHORT RRTI);
+void SiS_OEM661Setting(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
+ USHORT ModeNo,USHORT ModeIdIndex, USHORT RRTI);
+void SiS_FinalizeLCD(SiS_Private *, USHORT, USHORT, PSIS_HW_INFO);
#endif
#ifdef SIS300
-void SiS_OEM300Setting(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
- USHORT ModeNo, USHORT ModeIdIndex, USHORT RefTabindex);
-void SetOEMLCDData2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
- USHORT ModeNo, USHORT ModeIdIndex,USHORT RefTableIndex);
+void SiS_OEM300Setting(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
+ USHORT ModeNo, USHORT ModeIdIndex, USHORT RefTabindex);
+void SetOEMLCDData2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
+ USHORT ModeNo, USHORT ModeIdIndex,USHORT RefTableIndex);
#endif
extern void SiS_SetReg(SISIOADDRESS, USHORT, USHORT);
@@ -404,4 +408,10 @@ extern void SiS_LoadDAC(SiS_Private *SiS_Pr, PSIS_HW_INFO,USHORT ModeNo,
extern void SiS_CalcLCDACRT1Timing(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex);
+extern void SiS_MakeClockRegs(ScrnInfoPtr pScrn, int clock, UCHAR *p2b, UCHAR *p2c);
+
+#ifdef LINUX_XF86
+extern int SiS_FindPanelFromDB(SISPtr pSiS, USHORT panelvendor, USHORT panelproduct, int *maxx, int *maxy);
+#endif
+
#endif
diff --git a/src/initdef.h b/src/initdef.h
index 869364c..cc6bf1f 100644
--- a/src/initdef.h
+++ b/src/initdef.h
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h,v 1.9 2004/08/20 18:57:06 kem Exp $ */
/*
* Global definitions for init.c and init301.c
*
@@ -34,7 +35,7 @@
* * 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
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -79,11 +80,17 @@
#define VB_SIS302LV 0x0010
#define VB_SIS302ELV 0x0020
#define VB_SIS301C 0x0040
+#define VB_UMC 0x4000
#define VB_NoLCD 0x8000
#define VB_SIS301BLV302BLV (VB_SIS301B|VB_SIS301C|VB_SIS302B|VB_SIS301LV|VB_SIS302LV|VB_SIS302ELV)
#define VB_SIS301B302B (VB_SIS301B|VB_SIS301C|VB_SIS302B)
#define VB_SIS301LV302LV (VB_SIS301LV|VB_SIS302LV|VB_SIS302ELV)
#define VB_SISVB (VB_SIS301 | VB_SIS301BLV302BLV)
+#define VB_SISTMDS (VB_SIS301 | VB_SIS301B302B)
+#define VB_SISLVDS VB_SIS301LV302LV
+#define VB_SISLCDA (VB_SIS302B|VB_SIS301C|VB_SIS301LV|VB_SIS302LV|VB_SIS302ELV)
+#define VB_SISYPBPR (VB_SIS301C|VB_SIS301LV|VB_SIS302LV|VB_SIS302ELV)
+#define VB_SISHIVISION (VB_SIS301|VB_SIS301B|VB_SIS302B)
/* VBInfo */
#define SetSimuScanMode 0x0001 /* CR 30 */
@@ -123,7 +130,7 @@
#define Mode24Bpp 0x06
#define Mode32Bpp 0x07
-#define ModeInfoFlag 0x07
+#define ModeTypeMask 0x07
#define IsTextMode 0x07
#define DACInfoFlag 0x0018
@@ -136,6 +143,7 @@
#define CRT2Mode 0x0800
#define HalfDCLK 0x1000
#define NoSupportSimuTV 0x2000
+#define NoSupportLCDScale 0x4000 /* SiS bridge: No scaling possible (no matter what panel) */
#define DoubleScanMode 0x8000
/* Infoflag */
@@ -200,7 +208,7 @@
#define SF_IsM661 0x0020
#define SF_IsM741 0x0040
#define SF_IsM760 0x0080
-#define SF_760UMA 0x8000
+#define SF_760LFB 0x8000 /* 760: We have LFB */
/* CR32 (Newer 630, and 315 series)
@@ -398,10 +406,10 @@
#define Panel_1400x1050 0x09
#define Panel_1280x768 0x0a /* 30xB/C and LVDS only (BIOS: all) */
#define Panel_1600x1200 0x0b
-#define Panel_1280x800 0x0c /* 661etc */
+#define Panel_1280x800 0x0c /* 661etc (TMDS) */
#define Panel_1680x1050 0x0d /* 661etc */
#define Panel_1280x720 0x0e /* 661etc */
-#define Panel_Custom 0x0f /* MUST BE 0x0f (for DVI DDC detection */
+#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
@@ -409,6 +417,7 @@
#define Panel_640x480_3 0x14 /* SiS 550 */
#define Panel_1280x768_2 0x15 /* 30xLV */
#define Panel_1280x768_3 0x16 /* 30xLV */
+#define Panel_1280x800_2 0x17 /* 30xLV */
/* Index in ModeResInfo table */
#define SIS_RI_320x200 0
@@ -433,7 +442,7 @@
#define SIS_RI_856x480 19
#define SIS_RI_1280x768 20
#define SIS_RI_1400x1050 21
-#define SIS_RI_1152x864 22 /* Up to this SiS conforming */
+#define SIS_RI_1152x864 22 /* Up to here SiS conforming */
#define SIS_RI_848x480 23
#define SIS_RI_1360x768 24
#define SIS_RI_1024x600 25
@@ -442,6 +451,9 @@
#define SIS_RI_1360x1024 28
#define SIS_RI_1680x1050 29
#define SIS_RI_1280x800 30
+#define SIS_RI_1920x1080 31
+#define SIS_RI_960x540 32
+#define SIS_RI_960x600 33
/* CR5F */
#define IsM650 0x80
@@ -478,13 +490,23 @@
#define VCLK100_315 0x46 /* Index in VBVCLKData table (315) */
#define VCLK34_315 0x55
#define VCLK68_315 0x0d
-#define VCLK69_315 0x5c /* Index in VBVCLKData table (315) */
+#define VCLK_1280x800_315_2 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 VCLK_720x480 0x67
+#define VCLK_720x576 0x68
+#define VCLK_768x576 0x68
+#define VCLK_848x480 0x65
+#define VCLK_856x480 0x66
+#define VCLK_800x480 0x65
+#define VCLK_1024x576 0x51
+#define VCLK_1152x864 0x64
+#define VCLK_1360x768 0x58
+#define VCLK_1280x800_315 0x6c
#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) */
@@ -595,7 +617,7 @@
/*
=============================================================
- for 315 series
+ for 315 series (old data layout)
=============================================================
*/
#define SoftDRAMType 0x80
diff --git a/src/oem300.h b/src/oem300.h
index 7995893..f7718f2 100644
--- a/src/oem300.h
+++ b/src/oem300.h
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/oem300.h,v 1.4 2004/07/26 22:40:56 twini Exp $ */
/*
* OEM Data for 300 series
*
@@ -34,7 +35,7 @@
* * 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
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
diff --git a/src/oem310.h b/src/oem310.h
index f76b136..ca8c427 100644
--- a/src/oem310.h
+++ b/src/oem310.h
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/oem310.h,v 1.4 2004/07/26 22:40:56 twini Exp $ */
/*
* OEM Data for 315/330 series
*
@@ -34,7 +35,7 @@
* * 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
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -126,7 +127,7 @@ static const UCHAR SiS310_LCDDelayCompensation_651302LV[] = /* M650/651 302L
0x33,0x33,0x33
};
-static const UCHAR SiS310_LCDDelayCompensation_3xx301B[] = /* 30xB,LV */
+static const UCHAR SiS310_LCDDelayCompensation_3xx301B[] = /* 30xB */
{
0x01,0x01,0x01, /* 800x600 */
0x0C,0x0C,0x0C, /* 1024x768 */
@@ -145,6 +146,25 @@ static const UCHAR SiS310_LCDDelayCompensation_3xx301B[] = /* 30xB,LV */
0x02,0x02,0x02
};
+static const UCHAR SiS310_LCDDelayCompensation_3xx301LV[] = /* 315+30xLV */
+{
+ 0x01,0x01,0x01, /* 800x600 */
+ 0x04,0x04,0x04, /* 1024x768 (A531/BIOS 1.14.05f: 4 - works with 6 */
+ 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 */
diff --git a/src/osdef.h b/src/osdef.h
index 663b976..30467a8 100644
--- a/src/osdef.h
+++ b/src/osdef.h
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/osdef.h,v 1.4 2004/07/26 22:40:56 twini Exp $ */
/*
* OS depending defines
*
@@ -34,7 +35,7 @@
* * 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
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -52,7 +53,7 @@
/* The choices are: */
/* #define LINUX_KERNEL */ /* Kernel framebuffer */
-#define LINUX_XF86 /* XFree86 */
+#define LINUX_XF86 /* XFree86/X.org */
#ifdef OutPortByte
#undef OutPortByte
@@ -108,7 +109,7 @@
#endif
/**********************************************************************/
-/* XFree86 */
+/* XFree86/X.org */
/**********************************************************************/
#ifdef LINUX_XF86
diff --git a/src/sis.h b/src/sis.h
index 6d719e8..df595ae 100644
--- a/src/sis.h
+++ b/src/sis.h
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h,v 1.18 2004/08/20 18:57:06 kem Exp $ */
/*
* Main global data and definitions
*
@@ -15,7 +16,7 @@
* 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
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -38,8 +39,8 @@
#define UNLOCK_ALWAYS
#define SISDRIVERVERSIONYEAR 4
-#define SISDRIVERVERSIONMONTH 2
-#define SISDRIVERVERSIONDAY 26
+#define SISDRIVERVERSIONMONTH 8
+#define SISDRIVERVERSIONDAY 20
#define SISDRIVERREVISION 1
#define SISDRIVERIVERSION (SISDRIVERVERSIONYEAR << 16) | \
@@ -70,14 +71,24 @@
#include "vgatypes.h"
#include "vstruct.h"
-#ifdef XF86DRI
+#ifdef XORG_VERSION_CURRENT
+#include "xorgVersion.h"
+#endif
+
+#ifdef XORG_VERSION_CURRENT
+#define SISMYSERVERNAME "X.org"
+#else
+#define SISMYSERVERNAME "XFree86"
+#endif
+
+#undef SISHAVEDRMWRITE
#undef SISNEWDRI
-#undef SISNEWDRI2
+#ifdef XF86DRI
+#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,99,3,0)
+#define SISHAVEDRMWRITE
+#endif
#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,99,14,0)
#define SISNEWDRI
-#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,4,99,99,0) /* Adapt this when the time has come */
-#define SISNEWDRI2
-#endif
#endif
#include "xf86drm.h"
#include "sarea.h"
@@ -86,7 +97,7 @@
#include "dri.h"
#include "GL/glxint.h"
#include "sis_dri.h"
-#endif
+#endif /* XF86DRI */
#if 1
#define SISDUALHEAD /* Include Dual Head code */
@@ -104,8 +115,8 @@
#endif
#endif
-#if 1
-#define SISGAMMA /* Include code for gamma correction */
+#if 1 /* Include code for gamma correction */
+#define SISGAMMA
#endif
#if 1 /* Include code for color hardware cursors */
@@ -129,29 +140,40 @@
#define SISVRAMQ /* Use VRAM queue mode on 315 series */
#endif
+/* Include support for YUV->RGB blit adaptors (VRAM queue mode only) */
+#undef INCL_YUV_BLIT_ADAPTOR
+#ifdef SISVRAMQ
+#if 1
+#define INCL_YUV_BLIT_ADAPTOR
+#endif
+#endif
+
#undef SIS315DRI /* define this if dri is adapted for 315/330 series */
/* For SiS315/550/650/740/330/660 - these should be moved elsewhere! */
#ifndef PCI_CHIP_SIS315H
-#define PCI_CHIP_SIS315H 0x0310
+#define PCI_CHIP_SIS315H 0x0310
#endif
#ifndef PCI_CHIP_SIS315
-#define PCI_CHIP_SIS315 0x0315
+#define PCI_CHIP_SIS315 0x0315
#endif
#ifndef PCI_CHIP_SIS315PRO
-#define PCI_CHIP_SIS315PRO 0x0325
+#define PCI_CHIP_SIS315PRO 0x0325
#endif
#ifndef PCI_CHIP_SIS550
-#define PCI_CHIP_SIS550 0x5315 /* 550_VGA */
+#define PCI_CHIP_SIS550 0x5315 /* 550_VGA */
#endif
#ifndef PCI_CHIP_SIS650
-#define PCI_CHIP_SIS650 0x6325 /* 650_VGA and 740_VGA */
+#define PCI_CHIP_SIS650 0x6325 /* 650_VGA and 740_VGA */
#endif
#ifndef PCI_CHIP_SIS330
-#define PCI_CHIP_SIS330 0x0330
+#define PCI_CHIP_SIS330 0x0330
#endif
#ifndef PCI_CHIP_SIS660
-#define PCI_CHIP_SIS660 0x6330 /* 661_VGA, 741_VGA, 760_VGA */
+#define PCI_CHIP_SIS660 0x6330 /* 661_VGA, 741_VGA, 760_VGA */
+#endif
+#ifndef PCI_CHIP_SIS340
+#define PCI_CHIP_SIS340 0x0340
#endif
#define SIS_NAME "SIS"
@@ -238,6 +260,15 @@
#define VB_SISBRIDGE (VB_301|VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV|VB_302ELV)
#define VB_SISTVBRIDGE (VB_301|VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV)
#define VB_VIDEOBRIDGE (VB_SISBRIDGE | VB_LVDS | VB_CHRONTEL | VB_CONEXANT)
+#define VB_SISLVDSBRIDGE (VB_301LV|VB_302LV|VB_302ELV)
+#define VB_SISTMDSBRIDGE (VB_301|VB_301B|VB_301C|VB_302B)
+#define VB_SISTMDSLCDABRIDGE (VB_301C)
+#define VB_SISVGA2BRIDGE (VB_301|VB_301B|VB_301C|VB_302B)
+#define VB_SISLCDABRIDGE (VB_301C|VB_302B|VB_301LV|VB_302LV|VB_302ELV)
+#define VB_SISHIVISIONBRIDGE (VB_301|VB_301B|VB_302B)
+#define VB_SISYPBPRBRIDGE (VB_301C|VB_301LV|VB_302LV|VB_302ELV)
+#define VB_SISYPBPRARBRIDGE (VB_301C)
+#define VB_SISTAP4SCALER (VB_301C|VB_302ELV)
#define DISPTYPE_DISP2 CRT2_ENABLE
#define DISPTYPE_DISP1 DISPTYPE_CRT1
@@ -246,6 +277,9 @@
#define VB_DISPMODE_DUAL DUALVIEW_MODE /* alias */
#define DISPLAY_MODE (SINGLE_MODE | MIRROR_MODE | DUALVIEW_MODE)
+/* pSiS->VBFlags2 (static stuff only!) */
+#define VB_SISUMC 0x00000001
+
/* pSiS->VBLCDFlags */
#define VB_LCD_320x480 0x00000001 /* DSTN/FSTN for 550 */
#define VB_LCD_640x480 0x00000002
@@ -270,6 +304,8 @@
#define VB_LCD_CUSTOM 0x40000000
#define VB_LCD_EXPANDING 0x80000000
+#define VB_FORBID_CRT2LCD_OVER_1600 /* CRT2/LCD supports only up to 1600 pixels */
+
/* PresetMode argument */
#define SIS_MODE_SIMU 0
#define SIS_MODE_CRT1 1
@@ -347,9 +383,10 @@ typedef unsigned char UChar;
#define SiSCF_315Core 0x00010000 /* 3D: Real 315 */
#define SiSCF_Real256ECore 0x00020000 /* 3D: Similar to 315 core, no T&L? (65x, 661, 740, 741) */
#define SiSCF_XabreCore 0x00040000 /* 3D: Real Xabre */
-#define SiSCF_Ultra256Core 0x00080000 /* 3D: Similar to Xabre, no T&L?, no P:Shader? (660, 760) */
+#define SiSCF_Ultra256Core 0x00080000 /* 3D: aka "Mirage 2"; similar to Xabre, no T&L?, no P:Shader? (760) */
#define SiSCF_UseLCDA 0x01000000
-#define SiSCF_760UMA 0x10000000 /* 760: UMA active */
+#define SiSCF_760LFB 0x08000000 /* 760: LFB active (if not set, UMA only) */
+#define SiSCF_760UMA 0x10000000 /* 760: UMA active (if not set, LFB only) */
#define SiSCF_CRT2HWCKaputt 0x20000000 /* CRT2 Mono HWCursor engine buggy (SiS 330) */
#define SiSCF_Glamour3 0x40000000
#define SiSCF_Integrated 0x80000000
@@ -383,6 +420,8 @@ typedef unsigned char UChar;
#define SiS_SD_SUPPORTYPBPRAR 0x02000000 /* YPbPr aspect ratio is supported */
#define SiS_SD_SUPPORTSCALE 0x04000000 /* Scaling of LCD panel supported */
#define SiS_SD_SUPPORTCENTER 0x08000000 /* If scaling supported: Centering of screen [NOT] supported (TMDS only) */
+#define SiS_SD_SUPPORTREDETECT 0x10000000 /* Support re-detection of CRT2 devices */
+#define SiS_SD_IS340SERIES 0x20000000
#define SIS_DIRECTKEY 0x03145792
@@ -414,6 +453,29 @@ typedef unsigned char UChar;
#define AGP_VTXBUF_PAGES 512
#define AGP_VTXBUF_SIZE (AGP_PAGE_SIZE * AGP_VTXBUF_PAGES)
+/* Used for mapping a0000 and saving/restoring fonts (or not doing so) */
+/* List of architectures likely to be incomplete */
+#define SIS_PC_PLATFORM
+#if defined(__powerpc__) || defined(__mips__) || defined(__arm32__)
+#undef SIS_PC_PLATFORM
+#endif
+
+#if 0
+/* Used for mapping i/o port area to virtual memory (or not doing so) */
+/* List of architectures likely to be incomplete */
+/* BROKEN, see comment in sis_driver.c */
+#undef SIS_NEED_MAP_IOP
+#if defined(__arm32__) || defined(__mips__)
+#define SIS_NEED_MAP_IOP
+#endif
+#endif
+
+/* Used for makeing use of the BIOS scratch area (save/restore mode number) */
+#undef SIS_USE_BIOS_SCRATCH
+#if (defined(i386) || defined(__i386) || defined(__i386__) || defined(__AMD64__))
+#define SIS_USE_BIOS_SCRATCH
+#endif
+
/* For backup of register contents */
typedef struct {
unsigned char sisRegs3C4[0x50];
@@ -429,6 +491,7 @@ typedef struct {
unsigned long sisMMIO85C0;
unsigned char sis6326tv[0x46];
unsigned long sisRegsPCI50, sisRegsPCIA0;
+ unsigned char BIOSModeSave;
} SISRegRec, *SISRegPtr;
typedef struct _sisModeInfoPtr {
@@ -548,7 +611,7 @@ typedef struct {
unsigned char scalingp1[9], scalingp4[9], scalingp2[64];
unsigned short cursorBufferNum;
BOOLEAN restorebyset;
- BOOLEAN CRT1gamma, CRT1gammaGiven, CRT2gamma, XvGamma, XvGammaGiven;
+ BOOLEAN CRT1gamma, CRT1gammaGiven, CRT2gamma, XvGamma, XvGammaGiven, XvDefAdaptorBlit;
int XvGammaRed, XvGammaGreen, XvGammaBlue;
int GammaBriR, GammaBriG, GammaBriB; /* strictly for Xinerama */
int GammaPBriR, GammaPBriG, GammaPBriB; /* strictly for Xinerama */
@@ -563,6 +626,12 @@ typedef struct {
unsigned char OldMode;
int HWCursorMBufNum, HWCursorCBufNum;
BOOLEAN ROM661New;
+#ifdef SIS_NEED_MAP_IOP
+ CARD32 IOPAddress; /* I/O port physical address */
+ unsigned char * IOPBase; /* I/O port linear address */
+ unsigned short MapCountIOPBase; /* map/unmap queue counter */
+ Bool forceUnmapIOPBase; /* ignore counter and unmap */
+#endif
#ifdef SIS_CP
SIS_CP_H_ENT
#endif
@@ -643,6 +712,7 @@ typedef struct {
unsigned char myCR32, myCR36, myCR37, myCR63;
unsigned char newCR32;
unsigned long VBFlags; /* Video bridge configuration */
+ unsigned long VBFlags2; /* Video bridge configuration 2 (static flags only) */
unsigned long VBFlags_backup; /* Backup for SlaveMode-modes */
unsigned long VBLCDFlags; /* Moved LCD panel size bits here */
int ChrontelType; /* CHRONTEL_700x or CHRONTEL_701x */
@@ -725,6 +795,7 @@ typedef struct {
int irq;
Bool IsAGPCard;
unsigned long DRIheapstart, DRIheapend;
+ Bool NeedFlush; /* Need to flush cmd buf mem (760) */
void (*RenderCallback)(ScrnInfoPtr);
Time RenderTime;
@@ -737,8 +808,8 @@ typedef struct {
int ColorExpandBufferNumber;
int ColorExpandBufferCountMask;
unsigned char *ColorExpandBufferAddr[32];
- int ColorExpandBufferScreenOffset[32];
- long ColorExpandBase;
+ CARD32 ColorExpandBufferScreenOffset[32];
+ CARD32 ColorExpandBase;
int ImageWriteBufferSize;
unsigned char *ImageWriteBufferAddr;
@@ -763,6 +834,8 @@ typedef struct {
#endif
XF86VideoAdaptorPtr adaptor;
+ XF86VideoAdaptorPtr blitadaptor;
+ void * blitPriv;
ScreenBlockHandlerProcPtr BlockHandler;
void (*VideoTimerCallback)(ScrnInfoPtr, Time);
void (*ResetXv)(ScrnInfoPtr);
@@ -843,8 +916,10 @@ typedef struct {
unsigned char sisfblcda;
int sisfbscalelcd;
unsigned long sisfbspecialtiming;
- BOOL sisfb_haveemi, sisfb_haveemilcd;
+ BOOL sisfb_haveemi, sisfb_haveemilcd, sisfb_tvposvalid, sisfb_havelock;
unsigned char sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33;
+ int sisfb_tvxpos, sisfb_tvypos;
+ char sisfbdevname[16];
int EMI;
int NoYV12; /* Disable Xv YV12 support (old series) */
unsigned char postVBCR32;
@@ -870,13 +945,13 @@ typedef struct {
Atom xvAutopaintColorKey, xvSetDefaults, xvSwitchCRT;
Atom xvDisableGfx, xvDisableGfxLR, xvTVXPosition, xvTVYPosition;
Atom xvDisableColorkey, xvUseChromakey, xvChromaMin, xvChromaMax;
- Atom xvInsideChromakey, xvYUVChromakey;
+ Atom xvInsideChromakey, xvYUVChromakey, xvVSync;
Atom xvGammaRed, xvGammaGreen, xvGammaBlue;
Atom xv_QVF, xv_QVV, xv_USD, xv_SVF, xv_QDD, xv_TAF, xv_TSA, xv_TEE, xv_GSF;
Atom xv_TTE, xv_TCO, xv_TCC, xv_TCF, xv_TLF, xv_CMD, xv_CMDR, xv_CT1, xv_SGA;
Atom xv_GDV, xv_GHI, xv_OVR, xv_GBI, xv_TXS, xv_TYS, xv_CFI, xv_COC, xv_COF;
Atom xv_YFI, xv_GSS, xv_BRR, xv_BRG, xv_BRB, xv_PBR, xv_PBG, xv_PBB, xv_SHC;
- Atom xv_BRR2, xv_BRG2, xv_BRB2, xv_PBR2, xv_PBG2, xv_PBB2, xv_PMD;
+ Atom xv_BRR2, xv_BRG2, xv_BRB2, xv_PBR2, xv_PBG2, xv_PBB2, xv_PMD, xv_RDT;
#ifdef TWDEBUG
Atom xv_STR;
#endif
@@ -899,7 +974,7 @@ typedef struct {
BOOLEAN forcecrt2redetection;
BOOLEAN CRT1gamma, CRT1gammaGiven, CRT2gamma, XvGamma, XvGammaGiven;
int XvDefCon, XvDefBri, XvDefHue, XvDefSat;
- BOOLEAN XvDefDisableGfx, XvDefDisableGfxLR;
+ BOOLEAN XvDefDisableGfx, XvDefDisableGfxLR, XvDefAdaptorBlit;
BOOLEAN XvUseMemcpy;
BOOLEAN XvUseChromaKey, XvDisableColorKey;
BOOLEAN XvInsideChromaKey, XvYUVChromaKey;
@@ -932,6 +1007,10 @@ typedef struct {
int HWCursorMBufNum, HWCursorCBufNum;
unsigned long mmioSize;
BOOLEAN ROM661New;
+ BOOLEAN NewCRLayout;
+ BOOLEAN skipswitchcheck;
+ unsigned long VBFlagsInit;
+ DisplayModePtr currentModeLast;
#ifdef SISMERGED
Bool MergedFB, MergedFBAuto;
SiSScrn2Rel CRT2Position;
@@ -952,6 +1031,12 @@ typedef struct {
int maxCRT2_X1, maxCRT2_X2, maxCRT2_Y1, maxCRT2_Y2;
int maxClone_X1, maxClone_X2, maxClone_Y1, maxClone_Y2;
int MergedFBXDPI, MergedFBYDPI;
+ IOADDRESS MyPIOOffset;
+ Bool OverruleRanges;
+#ifdef SIS_NEED_MAP_IOP
+ CARD32 IOPAddress; /* I/O port physical address */
+ unsigned char * IOPBase; /* I/O port linear address */
+#endif
#ifdef SISXINERAMA
Bool UseSiSXinerama;
Bool CRT2IsScrn0;
@@ -1032,7 +1117,7 @@ typedef struct _customttable {
unsigned short chipID;
char *biosversion;
char *biosdate;
- unsigned long bioschksum;
+ CARD32 bioschksum;
unsigned short biosFootprintAddr[5];
unsigned char biosFootprintData[5];
unsigned short pcisubsysvendor;
@@ -1118,6 +1203,7 @@ extern Bool SISSwitchCRT2Type(ScrnInfoPtr pScrn, unsigned long newvbflags);
extern int SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond,
unsigned short index, Bool quiet);
extern Bool SISSwitchCRT1Status(ScrnInfoPtr pScrn, int onoff);
+extern Bool SISRedetectCRT2Devices(ScrnInfoPtr pScrn);
extern int SiS_GetCHTVlumabandwidthcvbs(ScrnInfoPtr pScrn);
extern int SiS_GetCHTVlumabandwidthsvideo(ScrnInfoPtr pScrn);
extern int SiS_GetCHTVlumaflickerfilter(ScrnInfoPtr pScrn);
@@ -1140,3 +1226,6 @@ extern int SiS_GetTVyposoffset(ScrnInfoPtr pScrn);
extern int SiS_GetTVxscale(ScrnInfoPtr pScrn);
extern int SiS_GetTVyscale(ScrnInfoPtr pScrn);
#endif
+
+
+
diff --git a/src/sis300_accel.c b/src/sis300_accel.c
index 568fe63..78d93e6 100644
--- a/src/sis300_accel.c
+++ b/src/sis300_accel.c
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c,v 1.6 2004/08/04 15:46:33 twini Exp $ */
/*
* 2D Acceleration for SiS 530, 620, 300, 540, 630, 730.
*
@@ -15,7 +16,7 @@
* 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
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -42,7 +43,6 @@
#include "xf86Pci.h"
#include "compiler.h"
#include "xaa.h"
-#include "xaalocal.h"
#include "xaarop.h"
#include "sis.h"
@@ -53,9 +53,9 @@
#define HEADOFFSET (pSiS->dhmOffset)
#endif
-#undef STSCE /* TW: Use/Don't use ScreenToScreenColorExpand - does not work */
+#undef STSCE /* Use/Don't use ScreenToScreenColorExpand - does not work */
-#undef TRAP /* TW: Use/Don't use Trapezoid Fills - does not work - XAA provides
+#undef TRAP /* Use/Don't use Trapezoid Fills - does not work - XAA provides
* illegal trapezoid data (left and right edges cross each other
* sometimes) which causes drawing errors. Further, I have not found
* out how to draw polygones with a height greater than 127...
@@ -139,6 +139,9 @@ static void SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno);
static void SiSRestoreAccelState(ScrnInfoPtr pScrn);
#endif
+extern unsigned char SiSGetCopyROP(int rop);
+extern unsigned char SiSGetPatternROP(int rop);
+
static void
SiSInitializeAccelerator(ScrnInfoPtr pScrn)
{
@@ -177,12 +180,12 @@ SiS300AccelInit(ScreenPtr pScreen)
(pScrn->bitsPerPixel != 32))
return FALSE;
- /* TW: Although SiS states that the 300 series supports a
- * virtual framebuffer of 4096x4096, the 2D accelerator
- * does not seem to know that. If the destination bitmap
- * pitch is > 8192 (which easily happens in 32bpp mode),
- * the accelerator engine collapses.
- * TODO: Find out about the 530 and 620
+ /* Although SiS states that the 300 series supports a
+ * virtual framebuffer of 4096x4096, the 2D accelerator
+ * does not seem to know that. If the destination bitmap
+ * pitch is > 8192 (which easily happens in 32bpp mode),
+ * the accelerator engine collapses.
+ * TODO: Find out about the 530 and 620
*/
if(pSiS->scrnOffset < 8192) {
@@ -228,7 +231,7 @@ SiS300AccelInit(ScreenPtr pScreen)
#ifdef STSCE
/* Screen To Screen Color Expand */
- /* TW: The hardware does support this the way we need it */
+ /* The hardware does support this the way we need it */
infoPtr->SetupForScreenToScreenColorExpandFill =
SiSSetupForScreenToScreenColorExpand;
infoPtr->SubsequentScreenToScreenColorExpandFill =
@@ -248,9 +251,7 @@ SiS300AccelInit(ScreenPtr pScreen)
infoPtr->CPUToScreenColorExpandFillFlags = NO_PLANEMASK |
BIT_ORDER_IN_BYTE_MSBFIRST |
NO_TRANSPARENCY |
- SYNC_AFTER_COLOR_EXPAND |
- HARDWARE_PATTERN_SCREEN_ORIGIN |
- HARDWARE_PATTERN_PROGRAMMED_BITS ;
+ SYNC_AFTER_COLOR_EXPAND;
#endif
/* per-scanline color expansion (using indirect method) */
@@ -360,13 +361,13 @@ SiSRestoreAccelState(ScrnInfoPtr pScrn)
{
SISPtr pSiS = SISPTR(pScrn);
- /* TW: We don't need to do anything special here; forcing the
- * other head to re-read the CmdQueLen is not necessary:
- * After the Sync in RestoreAccelState(), the real queue
- * length is always larger than (or at least equal to)
- * the amount stored in CmdQueueLen of the other head,
- * so the only thing that might happen is one unnecessary
- * Sync on the other head. I think we can live with that.
+ /* We don't need to do anything special here; forcing the
+ * other head to re-read the CmdQueLen is not necessary:
+ * After the Sync in RestoreAccelState(), the real queue
+ * length is always larger than (or at least equal to)
+ * the amount stored in CmdQueueLen of the other head,
+ * so the only thing that might happen is one unnecessary
+ * Sync on the other head. I think we can live with that.
*/
pSiS->DoColorExpand = FALSE;
SiSIdle
@@ -391,7 +392,7 @@ static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
SiSSetupSRCTrans(trans_color)
SiSSetupCMDFlag(TRANSPARENT_BITBLT)
} else {
- SiSSetupROP(XAACopyROP[rop])
+ SiSSetupROP(SiSGetCopyROP(rop))
}
if(xdir > 0) {
SiSSetupCMDFlag(X_INC)
@@ -405,8 +406,8 @@ static void SiSSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
int src_x, int src_y, int dst_x, int dst_y,
int width, int height)
{
- SISPtr pSiS = SISPTR(pScrn);
- long srcbase, dstbase;
+ SISPtr pSiS = SISPTR(pScrn);
+ CARD32 srcbase, dstbase;
PDEBUG(ErrorF("Subsequent ScreenCopy(%d,%d, %d,%d, %d,%d)\n",
src_x, src_y, dst_x, dst_y, width, height));
@@ -448,7 +449,7 @@ static void
SiSSetupForSolidFill(ScrnInfoPtr pScrn,
int color, int rop, unsigned int planemask)
{
- SISPtr pSiS = SISPTR(pScrn);
+ SISPtr pSiS = SISPTR(pScrn);
PDEBUG(ErrorF("Setup SolidFill(0x%x, 0x%x, 0x%x)\n",
color, rop, planemask));
@@ -461,7 +462,7 @@ SiSSetupForSolidFill(ScrnInfoPtr pScrn,
SiSSetupPATFG(color)
SiSSetupDSTRect(pSiS->scrnOffset, -1)
SiSSetupDSTColorDepth(pSiS->DstColor);
- SiSSetupROP(XAAPatternROP[rop])
+ SiSSetupROP(SiSGetPatternROP(rop))
/* SiSSetupCMDFlag(PATFG) - is zero */
}
@@ -469,8 +470,8 @@ static void
SiSSubsequentSolidFillRect(ScrnInfoPtr pScrn,
int x, int y, int w, int h)
{
- SISPtr pSiS = SISPTR(pScrn);
- long dstbase;
+ SISPtr pSiS = SISPTR(pScrn);
+ CARD32 dstbase;
PDEBUG(ErrorF("Subsequent SolidFillRect(%d, %d, %d, %d)\n",
x, y, w, h));
@@ -498,7 +499,7 @@ SiSSubsequentSolidFillRect(ScrnInfoPtr pScrn,
SiSDoCMD
}
-/* TW: Trapezoid */
+/* Trapezoid */
/* This would work better if XAA would provide us with valid trapezoids.
* In fact, with small trapezoids the left and the right edge often cross
* each other or result in a line length of 0 which causes drawing errors
@@ -512,8 +513,8 @@ SiSSubsequentSolidFillTrap(ScrnInfoPtr pScrn, int y, int h,
int left, int dxL, int dyL, int eL,
int right, int dxR, int dyR, int eR )
{
- SISPtr pSiS = SISPTR(pScrn);
- long dstbase;
+ SISPtr pSiS = SISPTR(pScrn);
+ CARD32 dstbase;
#if 0
float kL, kR;
#endif
@@ -610,7 +611,7 @@ static void
SiSSetupForSolidLine(ScrnInfoPtr pScrn,
int color, int rop, unsigned int planemask)
{
- SISPtr pSiS = SISPTR(pScrn);
+ SISPtr pSiS = SISPTR(pScrn);
PDEBUG(ErrorF("Setup SolidLine(0x%x, 0x%x, 0x%x)\n",
color, rop, planemask));
@@ -619,7 +620,7 @@ SiSSetupForSolidLine(ScrnInfoPtr pScrn,
SiSSetupPATFG(color)
SiSSetupDSTRect(pSiS->scrnOffset, -1)
SiSSetupDSTColorDepth(pSiS->DstColor);
- SiSSetupROP(XAAPatternROP[rop])
+ SiSSetupROP(SiSGetPatternROP(rop))
SiSSetupCMDFlag(PATFG | LINE)
}
@@ -627,8 +628,9 @@ static void
SiSSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
int x1, int y1, int x2, int y2, int flags)
{
- SISPtr pSiS = SISPTR(pScrn);
- long dstbase,miny,maxy;
+ SISPtr pSiS = SISPTR(pScrn);
+ CARD32 dstbase;
+ int miny,maxy;
PDEBUG(ErrorF("Subsequent SolidLine(%d, %d, %d, %d, 0x%x)\n",
x1, y1, x2, y2, flags));
@@ -663,8 +665,8 @@ static void
SiSSubsequentSolidHorzVertLine(ScrnInfoPtr pScrn,
int x, int y, int len, int dir)
{
- SISPtr pSiS = SISPTR(pScrn);
- long dstbase;
+ SISPtr pSiS = SISPTR(pScrn);
+ CARD32 dstbase;
PDEBUG(ErrorF("Subsequent SolidHorzVertLine(%d, %d, %d, %d)\n",
x, y, len, dir));
@@ -708,7 +710,7 @@ SiSSetupForDashedLine(ScrnInfoPtr pScrn,
SiSSetupStyleLow(*pattern)
SiSSetupStyleHigh(*(pattern+4))
SiSSetupStylePeriod(length-1);
- SiSSetupROP(XAAPatternROP[rop])
+ SiSSetupROP(SiSGetPatternROP(rop))
SiSSetupPATFG(fg)
SiSSetupCMDFlag(LINE | LINE_STYLE)
if(bg != -1) {
@@ -724,7 +726,8 @@ SiSSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn,
int flags, int phase)
{
SISPtr pSiS = SISPTR(pScrn);
- long dstbase,miny,maxy;
+ CARD32 dstbase;
+ int miny,maxy;
PDEBUG(ErrorF("Subsequent DashedLine(%d,%d, %d,%d, 0x%x,0x%x)\n",
x1, y1, x2, y2, flags, phase));
@@ -768,7 +771,7 @@ SiSSetupForMonoPatternFill(ScrnInfoPtr pScrn,
SiSSetupDSTColorDepth(pSiS->DstColor);
SiSSetupMONOPAT(patx,paty)
SiSSetupPATFG(fg)
- SiSSetupROP(XAAPatternROP[rop])
+ SiSSetupROP(SiSGetPatternROP(rop))
SiSSetupCMDFlag(PATMONO)
if(bg != -1) {
SiSSetupPATBG(bg)
@@ -783,7 +786,7 @@ SiSSubsequentMonoPatternFill(ScrnInfoPtr pScrn,
int x, int y, int w, int h)
{
SISPtr pSiS = SISPTR(pScrn);
- long dstbase;
+ CARD32 dstbase;
PDEBUG(ErrorF("Subsequent MonoPatFill(0x%x,0x%x, %d,%d, %d,%d)\n",
patx, paty, x, y, w, h));
@@ -820,8 +823,8 @@ SiSSubsequentMonoPatternFillTrap(ScrnInfoPtr pScrn,
int left, int dxL, int dyL, int eL,
int right, int dxR, int dyR, int eR )
{
- SISPtr pSiS = SISPTR(pScrn);
- long dstbase;
+ SISPtr pSiS = SISPTR(pScrn);
+ CARD32 dstbase;
PDEBUG(ErrorF("Subsequent Mono8x8PatternFillTrap(%d, %d, %d - %d %d/%d %d/%d)\n",
y, h, left, right, dxL, dxR, eL, eR));
@@ -880,7 +883,7 @@ SiSSubsequentMonoPatternFillTrap(ScrnInfoPtr pScrn,
#if 0
-/* TW: The following (already commented) functions have NOT been adapted for dual-head mode */
+/* The following (already commented) functions have NOT been adapted for dual-head mode */
/* ----- CPU To Screen Color Expand (single task) ------------------------- */
@@ -902,7 +905,7 @@ SiSSetupForCPUToScreenColorExpand(ScrnInfoPtr pScrn,
SiSSetupDSTColorDepth(pSiS->DstColor);
SiSSetupSRCXY(0,0)
SiSSetupSRCFG(fg)
- SiSSetupROP(XAAPatternROP[rop])
+ SiSSetupROP(SiSGetPatternROP(rop))
SiSSetupCMDFlag(X_INC | Y_INC | COLOREXP)
if(bg == -1) {
SiSSetupCMDFlag(TRANSPARENT)
@@ -916,7 +919,7 @@ SiSSubsequentCPUToScreenColorExpand(ScrnInfoPtr pScrn,
int x, int y, int w, int h, int skipleft)
{
SISPtr pSiS = SISPTR(pScrn);
- long dstbase;
+ CARD32 dstbase;
PDEBUG(ErrorF("Subsequent CPUToScreen ColorExpand(%d,%d, %d,%d, %d)\n",
x, y, w, h, skipleft));
@@ -939,7 +942,7 @@ SiSSubsequentCPUToScreenColorExpand(ScrnInfoPtr pScrn,
/* ------ Screen To Screen Color Expand ------------------------------- */
-/* TW: The hareware does not seem to support this the way we need it */
+/* The hareware does not seem to support this the way we need it */
#ifdef STSCE
static void
@@ -947,14 +950,14 @@ SiSSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn,
int fg, int bg,
int rop, unsigned int planemask)
{
- SISPtr pSiS = SISPTR(pScrn);
+ SISPtr pSiS = SISPTR(pScrn);
PDEBUG(ErrorF("Setup ScreenToScreen ColorExp(0x%x,0x%x, 0x%x)\n",
fg, bg, rop));
SiSSetupDSTColorDepth(pSiS->DstColor)
SiSSetupDSTRect(pSiS->scrnOffset, -1)
- SiSSetupROP(XAACopyROP[rop])
+ SiSSetupROP(SiSGetCopyROP(rop))
SiSSetupSRCFG(fg)
/* SiSSetupSRCXY(0,0) */
@@ -969,7 +972,7 @@ SiSSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn,
}
#endif
-/* TW. This method blits in a single task; this does not seem to work
+/* This method blits in a single task; this does not seem to work
* because the hardware does not use the source pitch as scanline
* offset but only to calculate pattern address from source X and Y.
* XAA provides the pattern bitmap with scrnOffset (displayWidth * bpp/8)
@@ -1016,7 +1019,7 @@ SiSSubsequentScreenToScreenColorExpand(ScrnInfoPtr pScrn,
int srcx, int srcy, int skipleft)
{
SISPtr pSiS = SISPTR(pScrn);
- long srcbase, dstbase;
+ CARD32 srcbase, dstbase;
#if 0
int _x0, _y0, _x1, _y1;
#endif
@@ -1120,7 +1123,7 @@ SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
while((MMIO_IN16(pSiS->IOBase, 0x8242) & 0x1F00) != 0) {} /* WDR: == 0x10 */
SiSSetupSRCXY(0,0);
- SiSSetupROP(XAACopyROP[rop]);
+ SiSSetupROP(SiSGetCopyROP(rop));
SiSSetupSRCFG(fg);
SiSSetupDSTRect(pSiS->scrnOffset, -1);
SiSSetupDSTColorDepth(pSiS->DstColor);
@@ -1144,8 +1147,8 @@ SiSSubsequentScanlineCPUToScreenColorExpandFill(
int h, int skipleft)
{
SISPtr pSiS = SISPTR(pScrn);
- int _x0, _y0, _x1, _y1;
- long dstbase;
+ int _x0, _y0, _x1, _y1;
+ CARD32 dstbase;
dstbase = 0;
if((y >= 2048) || ((y + h) >= 2048)) {
@@ -1158,13 +1161,13 @@ SiSSubsequentScanlineCPUToScreenColorExpandFill(
}
#endif
- /* TW: Wait until there is no color expansion command in queue
- * (This solves the OpenOffice.org window-move bug)
- * Added Idle-check - bit 23 is set sometimes, although
- * engine is actually idle!
- * Update: Bit 23 is not reliable. After heavy 3D engine
- * action, this bit never gets cleared again. So do
- * SiSIdle instead.
+ /* Wait until there is no color expansion command in queue
+ * (This solves the OpenOffice.org window-move bug)
+ * Added Idle-check - bit 23 is set sometimes, although
+ * engine is actually idle!
+ * Update: Bit 23 is not reliable. After heavy 3D engine
+ * action, this bit never gets cleared again. So do
+ * SiSIdle instead.
*/
if((MMIO_IN16(pSiS->IOBase, 0x8242) & 0xe000) != 0xe000) {
/* while ((MMIO_IN16(pSiS->IOBase, 0x8242) & 0x0080) != 0) {} */
@@ -1198,7 +1201,7 @@ SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
#if 0
int newhead,bltbufstage,newtail;
#endif
- long cbo;
+ CARD32 cbo;
cbo = pSiS->ColorExpandBufferScreenOffset[bufno];
#ifdef SISDUALHEAD
@@ -1207,13 +1210,13 @@ SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
}
#endif
- /* TW: Wait until there is no color expansion command in queue
- * (This solves the GTK-big-font bug)
- * Added Idle-check - bit 23 is set sometimes, although
- * engine is actually idle!
- * Update: Bit 23 is not reliable. After heavy 3D engine
- * action, this bit never gets cleared again. So do
- * SiSIdle instead.
+ /* Wait until there is no color expansion command in queue
+ * (This solves the GTK-big-font bug)
+ * Added Idle-check - bit 23 is set sometimes, although
+ * engine is actually idle!
+ * Update: Bit 23 is not reliable. After heavy 3D engine
+ * action, this bit never gets cleared again. So do
+ * SiSIdle instead.
*/
if((MMIO_IN16(pSiS->IOBase, 0x8242) & 0xe000) != 0xe000) {
/* while ((MMIO_IN16(pSiS->IOBase, 0x8242) & 0x0080) != 0) {} */
diff --git a/src/sis300_accel.h b/src/sis300_accel.h
index e33fdbe..66064e7 100644
--- a/src/sis300_accel.h
+++ b/src/sis300_accel.h
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h,v 1.4 2004/07/26 22:40:56 twini Exp $ */
/*
* 2D Acceleration for SiS 530, 620, 300, 540, 630, 730.
* Definitions for the SIS engine communication
@@ -16,7 +17,7 @@
* 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
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -117,7 +118,7 @@
while( (MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \
CmdQueLen = (MMIO_IN16(pSiS->IOBase, 0x8240) & pSiS->CmdQueLenMask) - pSiS->CmdQueLenFix; \
}
-/* TW: (do three times, because 2D engine seems quite unsure about whether or not it's idle) */
+/* (do three times, because 2D engine seems quite unsure about whether or not it's idle) */
#define SiSSetupSRCBase(base) \
if (CmdQueLen <= 0) SiSIdle;\
@@ -264,7 +265,7 @@
MMIO_OUT32(pSiS->IOBase, BR(12), ls);\
CmdQueLen--;
-/* TW: Trapezoid */
+/* Trapezoid */
#define SiSSetupYH(y,h) \
if (CmdQueLen <= 0) SiSIdle;\
MMIO_OUT32(pSiS->IOBase, 0x8208, (y)<<16 | (h) );\
diff --git a/src/sis310_accel.c b/src/sis310_accel.c
index 4f26e06..49c33d2 100644
--- a/src/sis310_accel.c
+++ b/src/sis310_accel.c
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.c,v 1.11 2004/08/14 15:26:50 twini Exp $ */
/*
* 2D Acceleration for SiS 315 and 330 series
*
@@ -15,7 +16,7 @@
* 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
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -40,7 +41,6 @@
#include "xf86Pci.h"
#include "compiler.h"
#include "xaa.h"
-#include "xaalocal.h"
#include "xaarop.h"
#include "sis.h"
@@ -84,10 +84,16 @@
#define INCL_RENDER /* Use/Don't use RENDER extension acceleration */
#ifdef INCL_RENDER
-#ifdef RENDER
-#include "mipict.h"
-#include "dixstruct.h"
-#endif
+# ifdef RENDER
+# include "mipict.h"
+# include "dixstruct.h"
+# undef SISNEWRENDER
+# ifdef XORG_VERSION_CURRENT
+# if XORG_VERSION_CURRENT > XORG_VERSION_NUMERIC(6,7,0,0,0)
+# define SISNEWRENDER
+# endif
+# endif
+# endif
#endif
/* Accelerator functions */
@@ -169,27 +175,57 @@ static void SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno);
#endif
#ifdef INCL_RENDER
#ifdef RENDER
-extern Bool SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
+static Bool SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
int op, CARD16 red, CARD16 green,
- CARD16 blue, CARD16 alpha,
- int alphaType, CARD8 *alphaPtr,
+ CARD16 blue, CARD16 alpha,
+#ifdef SISNEWRENDER
+ CARD32 alphaType, CARD32 dstType,
+#else
+ int alphaType,
+#endif
+ CARD8 *alphaPtr,
int alphaPitch, int width,
int height, int flags);
-extern Bool SiSSetupForCPUToScreenTexture( ScrnInfoPtr pScrn,
- int op, int texType, CARD8 *texPtr,
+static Bool SiSSetupForCPUToScreenTexture( ScrnInfoPtr pScrn,
+ int op,
+#ifdef SISNEWRENDER
+ CARD32 texType, CARD32 dstType,
+#else
+ int texType,
+#endif
+ CARD8 *texPtr,
int texPitch, int width,
int height, int flags);
-extern void SiSSubsequentCPUToScreenTexture(ScrnInfoPtr pScrn,
+static void SiSSubsequentCPUToScreenTexture(ScrnInfoPtr pScrn,
int dstx, int dsty,
int srcx, int srcy,
int width, int height);
-extern CARD32 SiSAlphaTextureFormats[2];
-extern CARD32 SiSTextureFormats[2];
-CARD32 SiSAlphaTextureFormats[2] = { PICT_a8 , 0 };
-CARD32 SiSTextureFormats[2] = { PICT_a8r8g8b8, 0 };
+static CARD32 SiSAlphaTextureFormats[2] = { PICT_a8 , 0 };
+static CARD32 SiSTextureFormats[2] = { PICT_a8r8g8b8, 0 };
+#ifdef SISVRAMQ
+#define SiSRenderOpsMAX 0x2b
+static const CARD8 SiSRenderOps[] = { /* PictOpXXX 1 = supported, 0 = unsupported */
+ 1, 1, 1, 1,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 1, 1, 1, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 1, 1, 1, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0
+};
+#endif
+#ifdef SISNEWRENDER
+static CARD32 SiSDstTextureFormats16[2] = { PICT_r5g6b5 , 0 };
+static CARD32 SiSDstTextureFormats32[3] = { PICT_x8r8g8b8, PICT_a8r8g8b8, 0 };
+#endif
#endif
#endif
@@ -197,6 +233,11 @@ CARD32 SiSTextureFormats[2] = { PICT_a8r8g8b8, 0 };
static void SiSRestoreAccelState(ScrnInfoPtr pScrn);
#endif
+extern unsigned char SiSGetCopyROP(int rop);
+extern unsigned char SiSGetPatternROP(int rop);
+
+CARD32 dummybuf;
+
static void
SiSInitializeAccelerator(ScrnInfoPtr pScrn)
{
@@ -263,7 +304,8 @@ SiS315AccelInit(ScreenPtr pScreen)
infoPtr->SubsequentSolidFillRect = SiSSubsequentSolidFillRect;
#ifdef TRAP
if((pSiS->Chipset != PCI_CHIP_SIS660) &&
- (pSiS->Chipset != PCI_CHIP_SIS330)) {
+ (pSiS->Chipset != PCI_CHIP_SIS330) &&
+ (pSiS->Chipset != PCI_CHIP_SIS340)) {
infoPtr->SubsequentSolidFillTrap = SiSSubsequentSolidFillTrap;
}
#endif
@@ -287,7 +329,8 @@ SiS315AccelInit(ScreenPtr pScreen)
infoPtr->SubsequentMono8x8PatternFillRect = SiSSubsequentMonoPatternFill;
#ifdef TRAP
if((pSiS->Chipset != PCI_CHIP_SIS660) &&
- (pSiS->Chipset != PCI_CHIP_SIS330)) {
+ (pSiS->Chipset != PCI_CHIP_SIS330) &&
+ (pSiS->Chipset != PCI_CHIP_SIS340)) {
infoPtr->SubsequentMono8x8PatternFillTrap = SiSSubsequentMonoPatternFillTrap;
}
#endif
@@ -358,7 +401,8 @@ SiS315AccelInit(ScreenPtr pScreen)
#ifndef SISVRAMQ
if((pSiS->Chipset != PCI_CHIP_SIS650) &&
(pSiS->Chipset != PCI_CHIP_SIS660) &&
- (pSiS->Chipset != PCI_CHIP_SIS330)) {
+ (pSiS->Chipset != PCI_CHIP_SIS330) &&
+ (pSiS->Chipset != PCI_CHIP_SIS340)) {
pSiS->ColorExpandBufferNumber = 16;
pSiS->ColorExpandBufferCountMask = 0x0F;
pSiS->PerColorExpandBufferSize = ((pScrn->virtualX + 31)/32) * 4;
@@ -411,15 +455,28 @@ SiS315AccelInit(ScreenPtr pScreen)
if(pSiS->RenderAccelArray) {
pSiS->AccelLinearScratch = NULL;
+#ifdef SISNEWRENDER
+ infoPtr->SetupForCPUToScreenAlphaTexture2 = SiSSetupForCPUToScreenAlphaTexture;
+ infoPtr->CPUToScreenAlphaTextureDstFormats = (pScrn->bitsPerPixel == 16) ?
+ SiSDstTextureFormats16 : SiSDstTextureFormats32;
+#else
infoPtr->SetupForCPUToScreenAlphaTexture = SiSSetupForCPUToScreenAlphaTexture;
+#endif
infoPtr->SubsequentCPUToScreenAlphaTexture = SiSSubsequentCPUToScreenTexture;
infoPtr->CPUToScreenAlphaTextureFormats = SiSAlphaTextureFormats;
infoPtr->CPUToScreenAlphaTextureFlags = XAA_RENDER_NO_TILE;
+#ifdef SISNEWRENDER
+ infoPtr->SetupForCPUToScreenTexture2 = SiSSetupForCPUToScreenTexture;
+ infoPtr->CPUToScreenTextureDstFormats = (pScrn->bitsPerPixel == 16) ?
+ SiSDstTextureFormats16 : SiSDstTextureFormats32;
+#else
infoPtr->SetupForCPUToScreenTexture = SiSSetupForCPUToScreenTexture;
- infoPtr->SubsequentCPUToScreenTexture = SiSSubsequentCPUToScreenTexture;
+#endif
+ infoPtr->SubsequentCPUToScreenTexture = SiSSubsequentCPUToScreenTexture;
infoPtr->CPUToScreenTextureFormats = SiSTextureFormats;
infoPtr->CPUToScreenTextureFlags = XAA_RENDER_NO_TILE;
+
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "RENDER acceleration enabled\n");
}
}
@@ -549,7 +606,7 @@ static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
SiSSetupSRCTrans(trans_color)
SiSSetupCMDFlag(TRANSPARENT_BITBLT)
} else {
- SiSSetupROP(XAACopyROP[rop])
+ SiSSetupROP(SiSGetCopyROP(rop))
/* Set command - not needed, both 0 */
/* SiSSetupCMDFlag(BITBLT | SRCVIDEO) */
}
@@ -569,9 +626,9 @@ static void SiSSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
int src_x, int src_y, int dst_x, int dst_y,
int width, int height)
{
- SISPtr pSiS = SISPTR(pScrn);
- long srcbase, dstbase;
- int mymin, mymax;
+ SISPtr pSiS = SISPTR(pScrn);
+ CARD32 srcbase, dstbase;
+ int mymin, mymax;
PDEBUG(ErrorF("Subsequent ScreenCopy(%d,%d, %d,%d, %d,%d)\n",
src_x, src_y, dst_x, dst_y, width, height));
@@ -672,14 +729,14 @@ SiSSetupForSolidFill(ScrnInfoPtr pScrn, int color,
SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
SiSCheckQueue(16 * 1);
SiSSetupPATFGDSTRect(color, pSiS->scrnOffset, -1)
- SiSSetupROP(XAAPatternROP[rop])
+ SiSSetupROP(SiSGetPatternROP(rop))
SiSSetupCMDFlag(PATFG)
SiSSyncWP
#else
SiSSetupPATFG(color)
SiSSetupDSTRect(pSiS->scrnOffset, -1)
SiSSetupDSTColorDepth(pSiS->DstColor);
- SiSSetupROP(XAAPatternROP[rop])
+ SiSSetupROP(SiSGetPatternROP(rop))
SiSSetupCMDFlag(PATFG | pSiS->SiS310_AccelDepth)
#endif
}
@@ -688,8 +745,8 @@ static void
SiSSubsequentSolidFillRect(ScrnInfoPtr pScrn,
int x, int y, int w, int h)
{
- SISPtr pSiS = SISPTR(pScrn);
- long dstbase;
+ SISPtr pSiS = SISPTR(pScrn);
+ CARD32 dstbase;
PDEBUG(ErrorF("Subsequent SolidFillRect(%d, %d, %d, %d)\n",
x, y, w, h));
@@ -734,8 +791,8 @@ SiSSubsequentSolidFillTrap(ScrnInfoPtr pScrn, int y, int h,
int left, int dxL, int dyL, int eL,
int right, int dxR, int dyR, int eR )
{
- SISPtr pSiS = SISPTR(pScrn);
- long dstbase;
+ SISPtr pSiS = SISPTR(pScrn);
+ CARD32 dstbase;
dstbase = 0;
if(y >= 2048) {
@@ -807,7 +864,7 @@ static void
SiSSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop,
unsigned int planemask)
{
- SISPtr pSiS = SISPTR(pScrn);
+ SISPtr pSiS = SISPTR(pScrn);
PDEBUG(ErrorF("Setup SolidLine(0x%x, 0x%x, 0x%x)\n",
color, rop, planemask));
@@ -817,7 +874,7 @@ SiSSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop,
SiSCheckQueue(16 * 3);
SiSSetupLineCountPeriod(1, 1)
SiSSetupPATFGDSTRect(color, pSiS->scrnOffset, -1)
- SiSSetupROP(XAAPatternROP[rop])
+ SiSSetupROP(SiSGetPatternROP(rop))
SiSSetupCMDFlag(PATFG | LINE)
SiSSyncWP
#else
@@ -825,7 +882,7 @@ SiSSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop,
SiSSetupPATFG(color)
SiSSetupDSTRect(pSiS->scrnOffset, -1)
SiSSetupDSTColorDepth(pSiS->DstColor)
- SiSSetupROP(XAAPatternROP[rop])
+ SiSSetupROP(SiSGetPatternROP(rop))
SiSSetupCMDFlag(PATFG | LINE | pSiS->SiS310_AccelDepth)
#endif
}
@@ -834,8 +891,9 @@ static void
SiSSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
int x1, int y1, int x2, int y2, int flags)
{
- SISPtr pSiS = SISPTR(pScrn);
- long dstbase,miny,maxy;
+ SISPtr pSiS = SISPTR(pScrn);
+ CARD32 dstbase;
+ int miny,maxy;
PDEBUG(ErrorF("Subsequent SolidLine(%d, %d, %d, %d, 0x%x)\n",
x1, y1, x2, y2, flags));
@@ -874,8 +932,8 @@ static void
SiSSubsequentSolidHorzVertLine(ScrnInfoPtr pScrn,
int x, int y, int len, int dir)
{
- SISPtr pSiS = SISPTR(pScrn);
- long dstbase;
+ SISPtr pSiS = SISPTR(pScrn);
+ CARD32 dstbase;
PDEBUG(ErrorF("Subsequent SolidHorzVertLine(%d, %d, %d, %d)\n",
x, y, len, dir));
@@ -936,7 +994,7 @@ SiSSetupForDashedLine(ScrnInfoPtr pScrn,
SiSSetupPATFG(fg)
#endif
- SiSSetupROP(XAAPatternROP[rop])
+ SiSSetupROP(SiSGetPatternROP(rop))
SiSSetupCMDFlag(LINE | LINE_STYLE)
@@ -960,7 +1018,7 @@ SiSSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn,
int flags, int phase)
{
SISPtr pSiS = SISPTR(pScrn);
- long dstbase,miny,maxy;
+ CARD32 dstbase,miny,maxy;
PDEBUG(ErrorF("Subsequent DashedLine(%d,%d, %d,%d, 0x%x,0x%x)\n",
x1, y1, x2, y2, flags, phase));
@@ -1016,7 +1074,7 @@ SiSSetupForMonoPatternFill(ScrnInfoPtr pScrn,
SiSSetupMONOPAT(patx,paty)
- SiSSetupROP(XAAPatternROP[rop])
+ SiSSetupROP(SiSGetPatternROP(rop))
#ifdef SISVRAMQ
SiSSetupCMDFlag(PATMONO)
@@ -1042,7 +1100,7 @@ SiSSubsequentMonoPatternFill(ScrnInfoPtr pScrn,
int x, int y, int w, int h)
{
SISPtr pSiS = SISPTR(pScrn);
- long dstbase;
+ CARD32 dstbase;
PDEBUG(ErrorF("Subsequent MonoPatFill(0x%x,0x%x, %d,%d, %d,%d)\n",
patx, paty, x, y, w, h));
@@ -1085,8 +1143,8 @@ SiSSubsequentMonoPatternFillTrap(ScrnInfoPtr pScrn,
int left, int dxL, int dyL, int eL,
int right, int dxR, int dyR, int eR)
{
- SISPtr pSiS = SISPTR(pScrn);
- long dstbase;
+ SISPtr pSiS = SISPTR(pScrn);
+ CARD32 dstbase;
PDEBUG(ErrorF("Subsequent Mono8x8PatternFillTrap(%d, %d, %d - %d %d/%d %d/%d)\n",
y, h, left, right, dxL, dxR, eL, eR));
@@ -1175,7 +1233,7 @@ SiSSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny,
patadr += 16; /* = 64 due to (CARD32 *) */
}
- SiSSetupROP(XAAPatternROP[rop])
+ SiSSetupROP(SiSGetPatternROP(rop))
SiSSetupCMDFlag(PATPATREG)
@@ -1186,8 +1244,8 @@ static void
SiSSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patternx,
int patterny, int x, int y, int w, int h)
{
- SISPtr pSiS = SISPTR(pScrn);
- long dstbase;
+ SISPtr pSiS = SISPTR(pScrn);
+ CARD32 dstbase;
#ifdef ACCELDEBUG
xf86DrvMsg(0, X_INFO, "Subsequent Color8x8FillRect(%d, %d, %d, %d)\n",
@@ -1234,7 +1292,7 @@ SiSSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
#ifdef SISVRAMQ
SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
- SiSSetupROP(XAACopyROP[rop]);
+ SiSSetupROP(SiSGetCopyROP(rop));
SiSSetupSRCFGDSTRect(fg, pSiS->scrnOffset, -1)
if(bg == -1) {
SiSSetupCMDFlag(TRANSPARENT | ENCOLOREXP | SRCVIDEO);
@@ -1245,7 +1303,7 @@ SiSSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
SiSSyncWP
#else
SiSSetupSRCXY(0,0);
- SiSSetupROP(XAACopyROP[rop]);
+ SiSSetupROP(SiSGetCopyROP(rop));
SiSSetupSRCFG(fg);
SiSSetupDSTRect(pSiS->scrnOffset, -1);
SiSSetupDSTColorDepth(pSiS->DstColor);
@@ -1266,7 +1324,7 @@ SiSSubsequentCPUToScreenColorExpandFill(
{
SISPtr pSiS = SISPTR(pScrn);
int _x0, _y0, _x1, _y1;
- long srcbase, dstbase;
+ CARD32 srcbase, dstbase;
srcbase = pSiS->ColorExpandBase;
@@ -1346,7 +1404,7 @@ SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
#endif
SiSSetupSRCXY(0,0);
- SiSSetupROP(XAACopyROP[rop]);
+ SiSSetupROP(SiSGetCopyROP(rop));
SiSSetupSRCFG(fg);
SiSSetupDSTRect(pSiS->scrnOffset, -1);
#ifndef SISVRAMQ
@@ -1377,7 +1435,7 @@ SiSSubsequentScanlineCPUToScreenColorExpandFill(
{
SISPtr pSiS = SISPTR(pScrn);
int _x0, _y0, _x1, _y1;
- long dstbase;
+ CARD32 dstbase;
dstbase = 0;
if(y >= 2048) {
@@ -1422,7 +1480,7 @@ static void
SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
{
SISPtr pSiS = SISPTR(pScrn);
- long cbo;
+ CARD32 cbo;
cbo = pSiS->ColorExpandBufferScreenOffset[bufno];
#ifdef SISDUALHEAD
@@ -1474,7 +1532,7 @@ SiSSetupForScreenToScreenColorExpand(ScrnInfoPtr pScrn,
SiSSetupDSTColorDepth(pSiS->DstColor)
#endif
SiSSetupDSTRect(pSiS->scrnOffset, -1)
- SiSSetupROP(XAACopyROP[rop])
+ SiSSetupROP(SiSGetCopyROP(rop))
SiSSetupSRCFG(fg)
/* SiSSetupSRCXY(0,0) */
@@ -1533,7 +1591,7 @@ SiSSubsequentScreenToScreenColorExpand(ScrnInfoPtr pScrn,
int srcx, int srcy, int skipleft)
{
SISPtr pSiS = SISPTR(pScrn);
- long srcbase, dstbase;
+ CARD32 srcbase, dstbase;
#if 0
int _x0, _y0, _x1, _y1;
#endif
@@ -1688,33 +1746,50 @@ Bool
SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
int op, CARD16 red, CARD16 green,
CARD16 blue, CARD16 alpha,
- int alphaType, CARD8 *alphaPtr,
+#ifdef SISNEWRENDER
+ CARD32 alphaType, CARD32 dstType,
+#else
+ int alphaType,
+#endif
+ CARD8 *alphaPtr,
int alphaPitch, int width,
int height, int flags)
{
SISPtr pSiS = SISPTR(pScrn);
- int x, pitch, sizeNeeded, offset;
- CARD8 myalpha;
- CARD32 *dstPtr;
unsigned char *renderaccelarray;
+ CARD32 *dstPtr;
+ int x, pitch, sizeNeeded;
+ int sbpp = pSiS->CurrentLayout.bitsPerPixel >> 3;
+ int sbppshift = sbpp >> 1; /* 8->0, 16->1, 32->2 */
+ CARD8 myalpha;
+ BOOLEAN docopy = TRUE;
#ifdef ACCELDEBUG
- 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);
+ xf86DrvMsg(0, X_INFO, "AT: op %d t %x/%x ARGB %x %x %x %x, w %d h %d pch %d\n",
+ op, alphaType, dstType, alpha, red, green, blue, width, height, alphaPitch);
#endif
+ if((width > 2048) || (height > 2048)) return FALSE;
+
+#ifdef SISVRAMQ
+ if(op > SiSRenderOpsMAX) return FALSE;
+ if(!SiSRenderOps[op]) return FALSE;
+#else
if(op != PictOpOver) return FALSE;
-
- if((width > 2048) || (height > 2048)) return FALSE;
-
- pitch = (width + 31) & ~31;
- sizeNeeded = pitch * height;
- if(pScrn->bitsPerPixel == 16) sizeNeeded <<= 1;
+#endif
if(!((renderaccelarray = pSiS->RenderAccelArray)))
return FALSE;
+
+#ifdef ACCELDEBUG
+ xf86DrvMsg(0, X_INFO, "AT: op %d t %x/%x ARGB %x %x %x %x, w %d h %d pch %d\n",
+ op, alphaType, dstType, alpha, red, green, blue, width, height, alphaPitch);
+#endif
+
+ pitch = (width + 31) & ~31;
+ sizeNeeded = (pitch << 2) * height; /* Source a8 (=8bit), expand to A8R8G8B8 (=32bit) */
- if(!SiSAllocateLinear(pScrn, sizeNeeded))
+ if(!SiSAllocateLinear(pScrn, (sizeNeeded + sbpp - 1) >> sbppshift))
return FALSE;
red &= 0xff00;
@@ -1723,8 +1798,35 @@ SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
#ifdef SISVRAMQ
SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
- SiSSetupSRCPitchDSTRect((pitch << 2), pSiS->scrnOffset, -1);
- SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_PERPIXELALPHA)
+ switch(op) {
+ case PictOpClear:
+ case PictOpDisjointClear:
+ case PictOpConjointClear:
+ SiSSetupPATFGDSTRect(0, pSiS->scrnOffset, -1)
+ /* SiSSetupROP(0x00) - is already 0 */
+ SiSSetupCMDFlag(PATFG)
+ docopy = FALSE;
+ break;
+ case PictOpSrc:
+ case PictOpDisjointSrc:
+ case PictOpConjointSrc:
+ SiSSetupSRCPitchDSTRect((pitch << 2), pSiS->scrnOffset, -1);
+ SiSSetupAlpha(0xff)
+ SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_NODESTALPHA)
+ break;
+ case PictOpDst:
+ case PictOpDisjointDst:
+ case PictOpConjointDst:
+ SiSSetupSRCPitchDSTRect((pitch << 2), pSiS->scrnOffset, -1);
+ SiSSetupAlpha(0x00)
+ SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_CONSTANTALPHA)
+ docopy = FALSE;
+ break;
+ case PictOpOver:
+ SiSSetupSRCPitchDSTRect((pitch << 2), pSiS->scrnOffset, -1);
+ SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_PERPIXELALPHA)
+ break;
+ }
SiSSyncWP
#else
SiSSetupDSTColorDepth(pSiS->DstColor);
@@ -1734,19 +1836,18 @@ SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_PERPIXELALPHA | pSiS->SiS310_AccelDepth)
#endif
- offset = pSiS->AccelLinearScratch->offset << 1;
- if(pScrn->bitsPerPixel == 32) offset <<= 1;
+ /* Don't need source for clear and dest */
+ if(!docopy) return TRUE;
- dstPtr = (CARD32*)(pSiS->FbBase + offset);
+ dstPtr = (CARD32*)(pSiS->FbBase + (pSiS->AccelLinearScratch->offset << sbppshift));
if(pSiS->alphaBlitBusy) {
pSiS->alphaBlitBusy = FALSE;
SiSIdle
}
-
if(alpha == 0xffff) {
-
+
while(height--) {
for(x = 0; x < width; x++) {
myalpha = alphaPtr[x];
@@ -1782,38 +1883,86 @@ SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
Bool
SiSSetupForCPUToScreenTexture(ScrnInfoPtr pScrn,
- int op, int texType, CARD8 *texPtr,
+ int op,
+#ifdef SISNEWRENDER
+ CARD32 texType, CARD32 dstType,
+#else
+ int texType,
+#endif
+ CARD8 *texPtr,
int texPitch, int width,
int height, int flags)
{
- SISPtr pSiS = SISPTR(pScrn);
- int pitch, sizeNeeded, offset;
- CARD8 *dst;
+ SISPtr pSiS = SISPTR(pScrn);
+ CARD8 *dst;
+ int pitch, sizeNeeded;
+ int sbpp = pSiS->CurrentLayout.bitsPerPixel >> 3;
+ int sbppshift = sbpp >> 1; /* 8->0, 16->1, 32->2 */
+ int bppshift = PICT_FORMAT_BPP(texType) >> 4; /* 8->0, 16->1, 32->2 */
+ BOOLEAN docopy = TRUE;
#ifdef ACCELDEBUG
- xf86DrvMsg(0, X_INFO, "T: type %d op %d w %d h %d T-pitch %d\n",
- texType, op, width, height, texPitch);
+ xf86DrvMsg(0, X_INFO, "T: type %x/%x op %d w %d h %d T-pitch %d\n",
+ texType, dstType, op, width, height, texPitch);
#endif
-
+
+#ifdef SISVRAMQ
+ if(op > SiSRenderOpsMAX) return FALSE;
+ if(!SiSRenderOps[op]) return FALSE;
+#else
if(op != PictOpOver) return FALSE;
+#endif
- if((width > 2048) || (height > 2048)) return FALSE;
-
+ if((width > 2048) || (height > 2048)) return FALSE;
+
pitch = (width + 31) & ~31;
- sizeNeeded = pitch * height;
- if(pScrn->bitsPerPixel == 16) sizeNeeded <<= 1;
-
- width <<= 2;
- pitch <<= 2;
+ sizeNeeded = (pitch << bppshift) * height;
+
+#ifdef ACCELDEBUG
+ xf86DrvMsg(0, X_INFO, "T: %x/%x op %x w %d h %d T-pitch %d size %d (%d %d %d)\n",
+ texType, dstType, op, width, height, texPitch, sizeNeeded, sbpp, sbppshift, bppshift);
+#endif
- if(!SiSAllocateLinear(pScrn, sizeNeeded))
+ if(!SiSAllocateLinear(pScrn, (sizeNeeded + sbpp - 1) >> sbppshift))
return FALSE;
+
+ width <<= bppshift; /* -> bytes (for engine and memcpy) */
+ pitch <<= bppshift; /* -> bytes */
#ifdef SISVRAMQ
SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
- SiSSetupSRCPitchDSTRect(pitch, pSiS->scrnOffset, -1);
- SiSSetupAlpha(0x00)
- SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_PERPIXELALPHA)
+ switch(op) {
+ case PictOpClear:
+ case PictOpDisjointClear:
+ case PictOpConjointClear:
+ SiSSetupPATFGDSTRect(0, pSiS->scrnOffset, -1)
+ /* SiSSetupROP(0x00) - is already zero */
+ SiSSetupCMDFlag(PATFG)
+ docopy = FALSE;
+ break;
+ case PictOpSrc:
+ case PictOpDisjointSrc:
+ case PictOpConjointSrc:
+ SiSSetupSRCPitchDSTRect(pitch, pSiS->scrnOffset, -1);
+ SiSSetupAlpha(0xff)
+ SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_NODESTALPHA)
+ break;
+ case PictOpDst:
+ case PictOpDisjointDst:
+ case PictOpConjointDst:
+ SiSSetupSRCPitchDSTRect(pitch, pSiS->scrnOffset, -1);
+ SiSSetupAlpha(0x00)
+ SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_CONSTANTALPHA)
+ docopy = FALSE;
+ break;
+ case PictOpOver:
+ SiSSetupSRCPitchDSTRect(pitch, pSiS->scrnOffset, -1);
+ SiSSetupAlpha(0x00)
+ SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_PERPIXELALPHA)
+ break;
+ default:
+ return FALSE;
+ }
SiSSyncWP
#else
SiSSetupDSTColorDepth(pSiS->DstColor);
@@ -1823,12 +1972,12 @@ SiSSetupForCPUToScreenTexture(ScrnInfoPtr pScrn,
SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_PERPIXELALPHA | pSiS->SiS310_AccelDepth)
#endif
- offset = pSiS->AccelLinearScratch->offset << 1;
- if(pScrn->bitsPerPixel == 32) offset <<= 1;
-
- dst = (CARD8*)(pSiS->FbBase + offset);
-
- if(pSiS->alphaBlitBusy) {
+ /* Don't need source for clear and dest */
+ if(!docopy) return TRUE;
+
+ dst = (CARD8*)(pSiS->FbBase + (pSiS->AccelLinearScratch->offset << sbppshift));
+
+ if(pSiS->alphaBlitBusy) {
pSiS->alphaBlitBusy = FALSE;
SiSIdle
}
@@ -1837,7 +1986,7 @@ SiSSetupForCPUToScreenTexture(ScrnInfoPtr pScrn,
memcpy(dst, texPtr, width);
texPtr += texPitch;
dst += pitch;
- }
+ }
return TRUE;
}
@@ -1849,7 +1998,7 @@ SiSSubsequentCPUToScreenTexture(ScrnInfoPtr pScrn,
int width, int height)
{
SISPtr pSiS = SISPTR(pScrn);
- long srcbase, dstbase;
+ CARD32 srcbase, dstbase;
srcbase = pSiS->AccelLinearScratch->offset << 1;
if(pScrn->bitsPerPixel == 32) srcbase <<= 1;
diff --git a/src/sis310_accel.h b/src/sis310_accel.h
index d782cf5..3b4f689 100644
--- a/src/sis310_accel.h
+++ b/src/sis310_accel.h
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis310_accel.h,v 1.4 2004/07/26 22:40:56 twini Exp $ */
/*
* 2D Acceleration for SiS 315 and Xabre series
* Definitions for the SIS engine communication.
@@ -16,7 +17,7 @@
* 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
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -37,7 +38,7 @@
#define BITBLT 0x00000000 /* Blit */
#define COLOREXP 0x00000001 /* Color expand */
#define ENCOLOREXP 0x00000002 /* Enhanced color expand (315 only?) */
-#define MULTIPLE_SCANLINE 0x00000003 /* ? */
+#define MULTIPLE_SCANLINE 0x00000003 /* 315 only, not 330 */
#define LINE 0x00000004 /* Draw line */
#define TRAPAZOID_FILL 0x00000005 /* Fill trapezoid */
#define TRANSPARENT_BITBLT 0x00000006 /* Transparent Blit */
@@ -47,6 +48,9 @@
#define GRADIENT_FILL 0x0000000A /* Gradient fill */
#define STRETCH_BITBLT 0x0000000B /* Stretched BitBlit */
+#define YUVRGB_BLIT_325 0x0000000C
+#define YUVRGB_BLIT_330 0x00000003
+
/* Command bits */
/* Source selection */
@@ -97,6 +101,21 @@
#define T_R_Y_INC 0x00400000 /* right edge direction Y */
#define T_R_X_INC 0x00200000 /* right edge direction X */
+/* YUV to RGB blit */
+#define YUV_FORMAT_YUY2 0x00000000
+#define YUV_FORMAT_YVYU 0x00002000
+#define YUV_FORMAT_UYVY 0x00004000
+#define YUV_FORMAT_VYUY 0x00006000
+#define YUV_FORMAT_NV12 0x00008000 /* Only supported one */
+#define YUV_FORMAT_NV21 0x0000A000
+
+#define YUV_CMD_YUV 0x00800000
+
+/* Scanline trigger (315 only, not 330) */
+#define SCANLINE_TR_CRT1 0x00000000
+#define SCANLINE_TR_CRT2 0x01000000
+#define SCANLINE_TRIGGER_ENABLE 0x80000000
+
/* Some general registers */
#define SRC_ADDR 0x8200
#define SRC_PITCH 0x8204
@@ -166,6 +185,10 @@
#define SIS_PACKET_HEADER1 0x62100000L
#define SIS_NIL_CMD 0x168F0000L
+#define SIS_PACKET12_HEADER0 0x968A000CL
+#define SIS_PACKET12_HEADER1 0x62100010L
+#define SIS_PACKET12_LENGTH 80
+
/* Macros to do useful things with the SiS315/330 BitBLT engine */
/* Q_STATUS:
@@ -192,7 +215,7 @@
while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x0400) != 0x0400) {}; \
}
-#define SiSResetCmd pSiS->CommandReg = 0;
+#define SiSResetCmd pSiS->CommandReg = 0;
#define SiSSetupCMDFlag(flags) pSiS->CommandReg |= (flags);
@@ -201,11 +224,20 @@
#define SiSGetSwWP() (CARD32)(*(pSiS->cmdQ_SharedWritePort))
#define SiSGetHwRP() (CARD32)(MMIO_IN32(pSiS->IOBase, Q_READ_PTR))
-#define SiSSyncWP MMIO_OUT32(pSiS->IOBase, Q_WRITE_PTR, (CARD32)(*(pSiS->cmdQ_SharedWritePort)));
-
+#define SiSFlushCmdBuf \
+ if(pSiS->NeedFlush) { \
+ CARD32 ttt = ((SiSGetSwWP()) - 4) & pSiS->cmdQueueSizeMask; \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ dummybuf = ((volatile CARD32 *)(tt))[0]; \
+ }
+
+#define SiSSyncWP \
+ SiSFlushCmdBuf; \
+ MMIO_OUT32(pSiS->IOBase, Q_WRITE_PTR, (CARD32)(*(pSiS->cmdQ_SharedWritePort)));
+
#define SiSSetHwWP(p) \
- *(pSiS->cmdQ_SharedWritePort) = (p); \
- MMIO_OUT32(pSiS->IOBase, Q_WRITE_PTR, (p)); \
+ *(pSiS->cmdQ_SharedWritePort) = (p); \
+ MMIO_OUT32(pSiS->IOBase, Q_WRITE_PTR, (p));
#define SiSSetSwWP(p) *(pSiS->cmdQ_SharedWritePort) = (p);
@@ -279,9 +311,9 @@
CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + SRC_Y); \
- ((CARD32 *)(tt))[1] = (CARD32)((sx)<<16 | (sy)); \
+ ((CARD32 *)(tt))[1] = (CARD32)(((sx)<<16) | (sy)); \
((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + DST_Y); \
- ((CARD32 *)(tt))[3] = (CARD32)((dx)<<16 | (dy)); \
+ ((CARD32 *)(tt))[3] = (CARD32)(((dx)<<16) | (dy)); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -291,9 +323,9 @@
CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + DST_Y); \
- ((CARD32 *)(tt))[1] = (CARD32)((x)<<16 | (y)); \
+ ((CARD32 *)(tt))[1] = (CARD32)(((x)<<16) | (y)); \
((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + RECT_WIDTH); \
- ((CARD32 *)(tt))[3] = (CARD32)((h)<<16 | (w)); \
+ ((CARD32 *)(tt))[3] = (CARD32)(((h)<<16) | (w)); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -305,7 +337,7 @@
((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + SRC_PITCH); \
((CARD32 *)(tt))[1] = (CARD32)(pitch); \
((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + DST_PITCH); \
- ((CARD32 *)(tt))[3] = (CARD32)((y)<<16 | (x)); \
+ ((CARD32 *)(tt))[3] = (CARD32)(((y)<<16) | (x)); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -333,7 +365,7 @@
CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + SRC_Y); \
- ((CARD32 *)(tt))[1] = (CARD32)((x)<<16 | (y)); \
+ ((CARD32 *)(tt))[1] = (CARD32)(((x)<<16) | (y)); \
SiSNILandUpdateSWQueue \
}
@@ -351,7 +383,7 @@
CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + DST_Y); \
- ((CARD32 *)(tt))[1] = (CARD32)((x)<<16 | (y)); \
+ ((CARD32 *)(tt))[1] = (CARD32)(((x)<<16) | (y)); \
SiSNILandUpdateSWQueue \
}
@@ -360,7 +392,7 @@
CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + DST_PITCH); \
- ((CARD32 *)(tt))[1] = (CARD32)((y)<<16 | (x)); \
+ ((CARD32 *)(tt))[1] = (CARD32)(((y)<<16) | (x)); \
SiSNILandUpdateSWQueue \
}
@@ -369,7 +401,7 @@
CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + DST_PITCH); \
- ((CARD32 *)(tt))[1] = (CARD32)((y)<<16 | (x)); \
+ ((CARD32 *)(tt))[1] = (CARD32)(((y)<<16) | (x)); \
((CARD32 *)(tt))[2] = (CARD32)(SIS_BURST_HEADER0 + reg); \
((CARD32 *)(tt))[3] = (CARD32)(SIS_BURST_HEADER1 + num); \
SiSUpdateQueue \
@@ -386,7 +418,7 @@
((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + PAT_FGCOLOR); \
((CARD32 *)(tt))[1] = (CARD32)(color); \
((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + DST_PITCH); \
- ((CARD32 *)(tt))[3] = (CARD32)((y)<<16 | (x)); \
+ ((CARD32 *)(tt))[3] = (CARD32)(((y)<<16) | (x)); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -398,7 +430,7 @@
((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + SRC_FGCOLOR); \
((CARD32 *)(tt))[1] = (CARD32)(color); \
((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + DST_PITCH); \
- ((CARD32 *)(tt))[3] = (CARD32)((y)<<16 | (x)); \
+ ((CARD32 *)(tt))[3] = (CARD32)(((y)<<16) | (x)); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -408,7 +440,7 @@
CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + RECT_WIDTH); \
- ((CARD32 *)(tt))[1] = (CARD32)((h)<<16 | (w)); \
+ ((CARD32 *)(tt))[1] = (CARD32)(((h)<<16) | (w)); \
((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + SRC_PITCH); \
((CARD32 *)(tt))[3] = (CARD32)(pitch); \
SiSUpdateQueue \
@@ -420,7 +452,7 @@
CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + RECT_WIDTH); \
- ((CARD32 *)(tt))[1] = (CARD32)((h)<<16 | (w)); \
+ ((CARD32 *)(tt))[1] = (CARD32)(((h)<<16) | (w)); \
SiSNILandUpdateSWQueue \
}
@@ -501,9 +533,9 @@
CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + LEFT_CLIP); \
- ((CARD32 *)(tt))[1] = (CARD32)(((left) & 0xFFFF) | (top)<<16); \
+ ((CARD32 *)(tt))[1] = (CARD32)(((left) & 0xFFFF) | ((top)<<16)); \
((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + RIGHT_CLIP); \
- ((CARD32 *)(tt))[3] = (CARD32)(((right) & 0xFFFF) | (bottom)<<16); \
+ ((CARD32 *)(tt))[3] = (CARD32)(((right) & 0xFFFF)|((bottom)<<16)); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -516,6 +548,7 @@
((CARD32 *)(tt))[1] = (CARD32)(base); \
((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + COMMAND_READY); \
((CARD32 *)(tt))[3] = (CARD32)(pSiS->CommandReg); \
+ if(pSiS->NeedFlush) dummybuf = ((volatile CARD32 *)(tt))[3]; \
SiSUpdateQueue \
SiSSetHwWP(ttt); \
}
@@ -525,11 +558,12 @@
CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + RECT_WIDTH); \
- ((CARD32 *)(tt))[1] = (CARD32)((h)<<16 | (w)); \
+ ((CARD32 *)(tt))[1] = (CARD32)(((h)<<16) | (w)); \
((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + COMMAND_READY); \
((CARD32 *)(tt))[3] = (CARD32)(pSiS->CommandReg); \
- SiSUpdateQueue \
- SiSSetHwWP(ttt); \
+ if(pSiS->NeedFlush) dummybuf = ((volatile CARD32 *)(tt))[3]; \
+ SiSUpdateQueue \
+ SiSSetHwWP(ttt); \
}
#define SiSSetupROP(rop) \
@@ -543,6 +577,7 @@
((CARD32 *)(tt))[1] = (CARD32)(pSiS->CommandReg); \
((CARD32 *)(tt))[2] = (CARD32)(SIS_NIL_CMD); \
((CARD32 *)(tt))[3] = (CARD32)(SIS_NIL_CMD); \
+ if(pSiS->NeedFlush) dummybuf = ((volatile CARD32 *)(tt))[3]; \
SiSUpdateQueue \
SiSSetHwWP(ttt); \
}
@@ -554,9 +589,9 @@
CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + LINE_X0); \
- ((CARD32 *)(tt))[1] = (CARD32)((y1)<<16 | (x1)); \
+ ((CARD32 *)(tt))[1] = (CARD32)(((y1)<<16) | (x1)); \
((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + LINE_X1); \
- ((CARD32 *)(tt))[3] = (CARD32)((y2)<<16 | (x2)); \
+ ((CARD32 *)(tt))[3] = (CARD32)(((y2)<<16) | (x2)); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -566,7 +601,7 @@
CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + LINE_X0); \
- ((CARD32 *)(tt))[1] = (CARD32)((y)<<16 | (x)); \
+ ((CARD32 *)(tt))[1] = (CARD32)(((y)<<16) | (x)); \
SiSNILandUpdateSWQueue \
}
@@ -575,7 +610,7 @@
CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + LINE_X1); \
- ((CARD32 *)(tt))[1] = (CARD32)((y)<<16 | (x)); \
+ ((CARD32 *)(tt))[1] = (CARD32)(((y)<<16) | (x)); \
SiSNILandUpdateSWQueue \
}
@@ -584,7 +619,7 @@
CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + LINE_COUNT); \
- ((CARD32 *)(tt))[1] = (CARD32)((p) << 16 | (c)); \
+ ((CARD32 *)(tt))[1] = (CARD32)(((p) << 16) | (c)); \
SiSNILandUpdateSWQueue \
}
@@ -607,9 +642,9 @@
CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + TRAP_YH); \
- ((CARD32 *)(tt))[1] = (CARD32)((y)<<16 | (h)); \
+ ((CARD32 *)(tt))[1] = (CARD32)(((y)<<16) | (h)); \
((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + TRAP_LR); \
- ((CARD32 *)(tt))[3] = (CARD32)((right)<<16 | (left)); \
+ ((CARD32 *)(tt))[3] = (CARD32)(((right)<<16) | (left)); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -620,9 +655,9 @@
CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + TRAP_DL); \
- ((CARD32 *)(tt))[1] = (CARD32)((dyL)<<16 | (dxL)); \
+ ((CARD32 *)(tt))[1] = (CARD32)(((dyL)<<16) | (dxL)); \
((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + TRAP_DR); \
- ((CARD32 *)(tt))[3] = (CARD32)((dyR)<<16 | (dxR)); \
+ ((CARD32 *)(tt))[3] = (CARD32)(((dyR)<<16) | (dxR)); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -671,6 +706,49 @@
SiSSetSwWP(ttt); \
}
+typedef struct _SiS_Packet12_YUV {
+ CARD32 P12_Header0;
+ CARD32 P12_Header1;
+ CARD16 P12_UVPitch; /* 8200 UV if planar, Y if packed */
+ CARD16 P12_Unused0; /* 8202 */
+ CARD16 P12_YPitch; /* 8204 Y if planar */
+ CARD16 P12_AGPBase; /* 8206 */
+ CARD16 P12_Unused1; /* 8208 */
+ CARD16 P12_Unused2; /* 820a */
+ CARD16 P12_DstY; /* 820c */
+ CARD16 P12_DstX; /* 820e */
+ CARD32 P12_DstAddr; /* 8210 */
+ CARD16 P12_DstPitch; /* 8214 */
+ CARD16 P12_DstHeight; /* 8216 */
+ CARD16 P12_RectWidth; /* 8218 */
+ CARD16 P12_RectHeight; /* 821a */
+ CARD32 P12_Unused3; /* 821c */
+ CARD32 P12_Unused4; /* 8220 */
+ CARD32 P12_UVSrcAddr; /* 8224 UV if planar, Y if packed */
+ CARD32 P12_YSrcAddr; /* 8228 Y if planar */
+ CARD32 P12_Unused5; /* 822c */
+ CARD32 P12_Unused6; /* 8230 */
+ CARD16 P12_ClipLeft; /* 8234 */
+ CARD16 P12_ClipTop; /* 8236 */
+ CARD16 P12_ClipRight; /* 8238 */
+ CARD16 P12_ClipBottom; /* 823a */
+ CARD32 P12_Command; /* 823c */
+ CARD32 P12_Null1;
+ CARD32 P12_Null2;
+} SiS_Packet12_YUV;
+
+#define SiSWritePacketPart(part1, part2, part3, part4) \
+ { \
+ CARD32 ttt = SiSGetSwWP(); \
+ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
+ ((CARD32 *)(tt))[0] = (CARD32)(part1); \
+ ((CARD32 *)(tt))[1] = (CARD32)(part2); \
+ ((CARD32 *)(tt))[2] = (CARD32)(part3); \
+ ((CARD32 *)(tt))[3] = (CARD32)(part4); \
+ SiSUpdateQueue \
+ SiSSetSwWP(ttt); \
+ }
+
#endif /* VRAM mode */
/* ---- MMIO mode ---- */
diff --git a/src/sis6326_video.c b/src/sis6326_video.c
index fa3b556..20b364b 100644
--- a/src/sis6326_video.c
+++ b/src/sis6326_video.c
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis6326_video.c,v 1.6 2004/08/14 15:35:49 twini Exp $ */
/*
* Xv driver for SiS 5597/5598, 6236 and 530/620.
*
@@ -15,7 +16,7 @@
* 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
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -45,7 +46,6 @@
#include "xf86xv.h"
#include "Xv.h"
#include "xaa.h"
-#include "xaalocal.h"
#include "dixstruct.h"
#include "fourcc.h"
@@ -528,6 +528,13 @@ SIS6326SetupImageVideo(ScreenPtr pScreen)
XF86VideoAdaptorPtr adapt;
SISPortPrivPtr pPriv;
+#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,1,99,1,0)
+ XAAInfoRecPtr pXAA = pSiS->AccelInfoPtr;
+
+ if (!pXAA || !pXAA->FillSolidRects)
+ return NULL;
+#endif
+
if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) +
sizeof(SISPortPrivRec) +
sizeof(DevUnion))))
@@ -599,7 +606,7 @@ SIS6326SetupImageVideo(ScreenPtr pScreen)
return adapt;
}
-#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,0,0)
+#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,3,0)
static Bool
RegionsEqual(RegionPtr A, RegionPtr B)
{
@@ -1205,7 +1212,7 @@ static FBLinearPtr
SIS6326AllocateOverlayMemory(
ScrnInfoPtr pScrn,
FBLinearPtr linear,
- int size
+ int size /* in pixels */
){
ScreenPtr pScreen;
FBLinearPtr new_linear;
@@ -1239,7 +1246,7 @@ SIS6326AllocateOverlayMemory(
}
if (!new_linear)
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Xv: Failed to allocate %dK of video memory\n", size/1024);
+ "Xv: Failed to allocate %d pixels of linear video memory\n", size/1024);
return new_linear;
}
@@ -1268,17 +1275,17 @@ SIS6326StopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
if(shutdown) {
if(pPriv->videoStatus & CLIENT_VIDEO_ON) {
- close_overlay(pSiS, pPriv);
- pPriv->mustwait = 1;
+ close_overlay(pSiS, pPriv);
+ pPriv->mustwait = 1;
}
SIS6326FreeOverlayMemory(pScrn);
pPriv->videoStatus = 0;
pSiS->VideoTimerCallback = NULL;
} else {
if(pPriv->videoStatus & CLIENT_VIDEO_ON) {
- pPriv->videoStatus = OFF_TIMER | CLIENT_VIDEO_ON;
- pPriv->offTime = currentTime.milliseconds + OFF_DELAY;
- pSiS->VideoTimerCallback = SIS6326VideoTimerCallback;
+ pPriv->videoStatus = OFF_TIMER | CLIENT_VIDEO_ON;
+ pPriv->offTime = currentTime.milliseconds + OFF_DELAY;
+ pSiS->VideoTimerCallback = SIS6326VideoTimerCallback;
}
}
}
@@ -1317,7 +1324,7 @@ SIS6326PutImage(
pPriv->height = height;
pPriv->width = width;
- /* TW: Pixel formats:
+ /* Pixel formats:
1. YU12: 3 planes: H V
Y sample period 1 1 (8 bit per pixel)
V sample period 2 2 (8 bit per pixel, subsampled)
@@ -1360,14 +1367,14 @@ SIS6326PutImage(
/* make it a multiple of 16 to simplify to copy loop */
totalSize += 15;
- totalSize &= ~15;
+ totalSize &= ~15; /* in bytes */
pPriv->totalSize = totalSize;
- /* allocate memory (we do doublebuffering) */
+ /* allocate memory (we do doublebuffering) - size is in pixels */
if(!(pPriv->linear = SIS6326AllocateOverlayMemory(pScrn, pPriv->linear,
- totalSize<<1)))
- return BadAlloc;
+ ((totalSize + depth - 1) / depth) << 1)))
+ return BadAlloc;
/* fixup pointers */
pPriv->bufAddr[0] = (pPriv->linear->offset * depth);
@@ -1392,7 +1399,7 @@ SIS6326PutImage(
/* update cliplist */
if( pPriv->autopaintColorKey &&
(pPriv->grabbedByV4L ||
-#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,0,0)
+#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,3,0)
!RegionsEqual(&pPriv->clip, clipBoxes)) ) {
#else
!REGION_EQUAL(pScrn->pScreen, &pPriv->clip, clipBoxes)) ) {
@@ -1401,8 +1408,8 @@ SIS6326PutImage(
if(!pPriv->grabbedByV4L)
REGION_COPY(pScrn->pScreen, &pPriv->clip, clipBoxes);
/* draw these */
-#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
- XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0,
+#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,1,99,1,0)
+ (*pSiS->AccelInfoPtr->FillSolidRects)(pScrn, pPriv->colorKey, GXcopy, ~0,
REGION_NUM_RECTS(clipBoxes),
REGION_RECTS(clipBoxes));
#else
@@ -1490,33 +1497,32 @@ SIS6326VideoTimerCallback (ScrnInfoPtr pScrn, Time now)
if(pSiS->adaptor) {
pPriv = GET_PORT_PRIVATE(pScrn);
- if(!pPriv->videoStatus)
- pPriv = NULL;
+ if(!pPriv->videoStatus) pPriv = NULL;
}
if(pPriv) {
- if(pPriv->videoStatus & TIMER_MASK) {
- UpdateCurrentTime();
- if(pPriv->offTime < currentTime.milliseconds) {
+ if(pPriv->videoStatus & TIMER_MASK) {
if(pPriv->videoStatus & OFF_TIMER) {
- /* Turn off the overlay */
- sridx = inSISREG(SISSR); cridx = inSISREG(SISCR);
- close_overlay(pSiS, pPriv);
- outSISREG(SISSR, sridx); outSISREG(SISCR, cridx);
- pPriv->mustwait = 1;
- pPriv->videoStatus = FREE_TIMER;
- pPriv->freeTime = currentTime.milliseconds + FREE_DELAY;
- pSiS->VideoTimerCallback = SIS6326VideoTimerCallback;
+ if(pPriv->offTime < now) {
+ /* Turn off the overlay */
+ sridx = inSISREG(SISSR); cridx = inSISREG(SISCR);
+ close_overlay(pSiS, pPriv);
+ outSISREG(SISSR, sridx); outSISREG(SISCR, cridx);
+ pPriv->mustwait = 1;
+ pPriv->videoStatus = FREE_TIMER;
+ pPriv->freeTime = now + FREE_DELAY;
+ pSiS->VideoTimerCallback = SIS6326VideoTimerCallback;
+ }
+ } else if(pPriv->videoStatus & FREE_TIMER) {
+ if(pPriv->freeTime < now) {
+ SIS6326FreeOverlayMemory(pScrn);
+ pPriv->mustwait = 1;
+ pPriv->videoStatus = 0;
+ }
} else
- if(pPriv->videoStatus & FREE_TIMER) {
- SIS6326FreeOverlayMemory(pScrn);
- pPriv->mustwait = 1;
- pPriv->videoStatus = 0;
- }
- } else
- pSiS->VideoTimerCallback = SIS6326VideoTimerCallback;
- }
- }
+ pSiS->VideoTimerCallback = SIS6326VideoTimerCallback;
+ }
+ }
}
/* Offscreen surface stuff for v4l */
@@ -1553,7 +1559,7 @@ SIS6326AllocSurface (
w = (w + 1) & ~1;
pPriv->pitch = ((w << 1) + 63) & ~63; /* Only packed pixel modes supported */
size = h * pPriv->pitch;
- pPriv->linear = SIS6326AllocateOverlayMemory(pScrn, pPriv->linear, size);
+ pPriv->linear = SIS6326AllocateOverlayMemory(pScrn, pPriv->linear, ((size + depth - 1) / depth));
if(!pPriv->linear)
return BadAlloc;
@@ -1661,8 +1667,8 @@ SIS6326DisplaySurface (
SIS6326DisplayVideo(pScrn, pPriv);
if(pPriv->autopaintColorKey) {
-#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
- XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0,
+#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,1,99,1,0)
+ (*XAAPTR(pScrn)->FillSolidRects)(pScrn, pPriv->colorKey, GXcopy, ~0,
REGION_NUM_RECTS(clipBoxes),
REGION_RECTS(clipBoxes));
#else
diff --git a/src/sis_accel.c b/src/sis_accel.c
index 5a4488c..aff3088 100644
--- a/src/sis_accel.c
+++ b/src/sis_accel.c
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c,v 1.5 2004/08/04 15:46:33 twini Exp $ */
/*
* 2D acceleration for SiS5597/5598 and 6326
*
@@ -93,6 +94,9 @@ static void SiSSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
static void SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno);
#endif
+extern unsigned char SiSGetCopyROP(int rop);
+extern unsigned char SiSGetPatternROP(int rop);
+
Bool
SiSAccelInit(ScreenPtr pScreen)
{
@@ -271,7 +275,7 @@ SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
sisBLTSync;
sisSETPITCH(pSiS->scrnOffset, pSiS->scrnOffset);
- sisSETROP(XAACopyROP[rop]);
+ sisSETROP(SiSGetCopyROP(rop));
pSiS->Xdirection = xdir;
pSiS->Ydirection = ydir;
}
@@ -328,8 +332,8 @@ SiSSetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop,
SISPtr pSiS = SISPTR(pScrn);
sisBLTSync;
- sisSETBGROPCOL(XAACopyROP[rop], color);
- sisSETFGROPCOL(XAACopyROP[rop], color);
+ sisSETBGROPCOL(SiSGetCopyROP(rop), color);
+ sisSETFGROPCOL(SiSGetCopyROP(rop), color);
sisSETPITCH(pSiS->scrnOffset, pSiS->scrnOffset);
}
@@ -435,8 +439,8 @@ static void SiSSetupForSolidLine(ScrnInfoPtr pScrn,
SISPtr pSiS = SISPTR(pScrn);
sisBLTSync;
- sisSETBGROPCOL(XAACopyROP[rop], 0);
- sisSETFGROPCOL(XAACopyROP[rop], color);
+ sisSETBGROPCOL(SiSGetCopyROP(rop), 0);
+ sisSETFGROPCOL(SiSGetCopyROP(rop), color);
}
static void SiSSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
@@ -538,11 +542,11 @@ SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
sisSETROPBG(0xAA); /* dst = dst (=noop) */
pSiS->CommandReg |= sisSRCFG;
} else {
- sisSETBGROPCOL(XAAPatternROP[rop], bg);
+ sisSETBGROPCOL(SiSGetPatternROP(rop), bg);
pSiS->CommandReg |= sisSRCFG | sisPATBG;
}
- sisSETFGROPCOL(XAACopyROP[rop], fg);
+ sisSETFGROPCOL(SiSGetCopyROP(rop), fg);
sisSETDSTPITCH(pSiS->scrnOffset);
}
diff --git a/src/sis_accel.h b/src/sis_accel.h
index cf37d91..e2d7f93 100644
--- a/src/sis_accel.h
+++ b/src/sis_accel.h
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.h,v 1.3 2004/06/17 13:20:13 twini Exp $ */
/*
* 2D acceleration for 5597/5598 and 6326
* Definitions for the SIS engine communication
diff --git a/src/sis_common.h b/src/sis_common.h
index dbca0fd..c6467a7 100644
--- a/src/sis_common.h
+++ b/src/sis_common.h
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_common.h,v 1.3 2004/06/17 13:20:13 twini Exp $ */
/*
* Common header definitions for SiS 2D/3D/DRM suite
*
diff --git a/src/sis_cursor.c b/src/sis_cursor.c
index 0ebb44d..4b59d20 100644
--- a/src/sis_cursor.c
+++ b/src/sis_cursor.c
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c,v 1.4 2004/07/26 22:40:56 twini Exp $ */
/*
* SiS hardware cursor handling
*
@@ -15,7 +16,7 @@
* 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
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -918,13 +919,14 @@ SiS300UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
}
#endif
break;
- case PCI_CHIP_SIS550:
- case PCI_CHIP_SIS650:
case PCI_CHIP_SIS315:
case PCI_CHIP_SIS315H:
case PCI_CHIP_SIS315PRO:
- case PCI_CHIP_SIS660:
+ case PCI_CHIP_SIS550:
+ case PCI_CHIP_SIS650:
case PCI_CHIP_SIS330:
+ case PCI_CHIP_SIS660:
+ case PCI_CHIP_SIS340:
if(mode->Flags & V_INTERLACE)
return FALSE;
if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32))
@@ -992,6 +994,7 @@ SiSUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs)
case PCI_CHIP_SIS315PRO:
case PCI_CHIP_SIS330:
case PCI_CHIP_SIS660:
+ case PCI_CHIP_SIS340:
if(mode->Flags & V_INTERLACE)
return FALSE;
if((pCurs->bits->height > 64) || (pCurs->bits->width > 64))
@@ -1366,6 +1369,7 @@ SiSHWCursorInit(ScreenPtr pScreen)
case PCI_CHIP_SIS315PRO:
case PCI_CHIP_SIS330:
case PCI_CHIP_SIS660:
+ case PCI_CHIP_SIS340:
infoPtr->MaxWidth = 64;
infoPtr->MaxHeight = 64;
infoPtr->ShowCursor = SiS310ShowCursor;
diff --git a/src/sis_cursor.h b/src/sis_cursor.h
index c38d038..51d7bc6 100644
--- a/src/sis_cursor.h
+++ b/src/sis_cursor.h
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.h,v 1.4 2004/07/26 22:40:56 twini Exp $ */
/*
* SiS hardware cursor handling
* Definitions
@@ -16,7 +17,7 @@
* 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
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
diff --git a/src/sis_dac.c b/src/sis_dac.c
index 296e808..3b28b0b 100644
--- a/src/sis_dac.c
+++ b/src/sis_dac.c
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c,v 1.7 2004/08/04 15:46:33 twini Exp $ */
/*
* DAC helper functions (Save/Restore, MemClk, etc)
*
@@ -15,7 +16,7 @@
* 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
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -28,7 +29,10 @@
*
* Author: Thomas Winischhofer <thomas@winischhofer.net>
*
+ * --------------------------------------------------------------------------
+ *
* 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>,
@@ -37,9 +41,26 @@
* 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)
*
+ * 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.
*/
#include "xf86.h"
@@ -72,9 +93,12 @@ static void SiS301LoadPalette(ScrnInfoPtr pScrn, int numColors,
int *indicies, LOCO *colors, VisualPtr pVisual);
static void SetBlock(CARD16 port, CARD8 from, CARD8 to, CARD8 *DataPtr);
+unsigned char SiSGetCopyROP(int rop);
+unsigned char SiSGetPatternROP(int rop);
+
static const unsigned short ch700xidx[] = {
0x00,0x07,0x08,0x0a,0x0b,0x04,0x09,0x20,0x21,0x18,0x19,0x1a,
- 0x1b,0x1c,0x1d,0x1e,0x1f, /* 0x0e, - TW: Don't save the power register */
+ 0x1b,0x1c,0x1d,0x1e,0x1f, /* 0x0e, - Don't save the power register */
0x01,0x03,0x06,0x0d,0x11,0x13,0x14,0x15,0x17,0x22,0x23,0x24
};
@@ -412,7 +436,7 @@ SiSSave(ScrnInfoPtr pScrn, SISRegPtr sisReg)
sisReg->sisRegs3C2 = inSISREG(SISMISCR); /* Misc */
- /* TW: Save TV registers */
+ /* Save TV registers */
if((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV)) {
outSISIDXREG(SISCR, 0x80, 0x86);
for(i = 0x00; i <= 0x44; i++) {
@@ -479,7 +503,7 @@ SiSRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
usleep(10000);
outSISIDXREG(SISSR, 0x00, 0x03); /* End Reset */
- /* TW: Restore TV registers */
+ /* Restore TV registers */
pSiS->SiS6326Flags &= ~SIS6326_TVON;
if((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV)) {
for(i = 0x01; i <= 0x44; i++) {
@@ -566,14 +590,11 @@ SiS300Save(ScrnInfoPtr pScrn, SISRegPtr sisReg)
#endif
/* Save Mode number */
-#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,99,0,0)
- if(!(pSiS->UseVESA))
-#endif
- pSiS->BIOSModeSave = SiS_GetSetModeID(pScrn,0xFF);
+ sisReg->BIOSModeSave = SiS_GetSetModeID(pScrn,0xFF);
#ifdef TWDEBUG
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "BIOS mode ds:449 = 0x%x\n", pSiS->BIOSModeSave);
+ "BIOS mode ds:449 = 0x%x\n", sisReg->BIOSModeSave);
#endif
}
@@ -721,10 +742,7 @@ SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
outSISIDXREG(SISSR, 0x00, 0x03); /* End Reset */
/* Restore mode number */
-#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,99,0,0)
- if(!(pSiS->UseVESA))
-#endif
- SiS_GetSetModeID(pScrn,pSiS->BIOSModeSave);
+ SiS_GetSetModeID(pScrn,sisReg->BIOSModeSave);
}
/* Save SiS315 series register contents */
@@ -765,16 +783,16 @@ SiS315Save(ScrnInfoPtr pScrn, SISRegPtr sisReg)
/* Save video capture registers */
for(i = 0x00; i <= 0x4f; i++) {
inSISIDXREG(SISCAP, i, sisReg->sisCapt[i]);
-#ifdef TWDEBUG
+#ifdef TWDEBUG_VID
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Capt%02X Contents - %02X \n", i,sisReg->sisCapt[i]);
#endif
}
/* Save video playback registers */
- for(i = 0x00; i <= 0x3f; i++) {
+ for(i = 0x00; i <= 0x3f; i++) {
inSISIDXREG(SISVID, i, sisReg->sisVid[i]);
-#ifdef TWDEBUG
+#ifdef TWDEBUG_VID
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Vid%02X Contents - %02X \n", i,sisReg->sisVid[i]);
#endif
@@ -798,14 +816,11 @@ SiS315Save(ScrnInfoPtr pScrn, SISRegPtr sisReg)
#endif
/* Save mode number */
-#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,99,0,0)
- if(!(pSiS->UseVESA))
-#endif
- pSiS->BIOSModeSave = SiS_GetSetModeID(pScrn,0xFF);
+ sisReg->BIOSModeSave = SiS_GetSetModeID(pScrn,0xFF);
#ifdef TWDEBUG
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "BIOS mode ds:449 = 0x%x\n", pSiS->BIOSModeSave);
+ "BIOS mode ds:449 = 0x%x\n", sisReg->BIOSModeSave);
#endif
}
@@ -837,11 +852,12 @@ SiS315Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
* or application is running and which queue mode it
* uses.
*/
- outSISIDXREG(SISSR, 0x27, 0x1F);
+ andSISIDXREG(SISCR, 0x55, 0x33);
outSISIDXREG(SISSR, 0x26, 0x01);
+ outSISIDXREG(SISSR, 0x27, 0x1F);
/* Restore extended CR registers */
- for(i = 0x19; i < 0x5C; i++) {
+ for(i = 0x19; i < 0x5C; i++) {
outSISIDXREG(SISCR, i, sisReg->sisRegs3D4[i]);
}
if(pSiS->sishw_ext.jChipType < SIS_661) {
@@ -850,18 +866,27 @@ SiS315Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
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*/
+ if(sisReg->sisRegs3C4[0x1e] & 0x50) { /* 0x40=2D, 0x10=3D */
sisReg->sisRegs3C4[0x20] |= 0x20;
outSISIDXREG(SISSR, 0x20, sisReg->sisRegs3C4[0x20]);
}
-
- /* Restore extended SR registers */
+
if(pSiS->sishw_ext.jChipType >= SIS_661) {
sisReg->sisRegs3C4[0x11] &= 0x0f;
}
+
+ /* Restore extended SR registers */
for(i = 0x06; i <= 0x3F; i++) {
- outSISIDXREG(SISSR, i, sisReg->sisRegs3C4[i]);
+ if(i == 0x26) {
+ continue;
+ } else if(i == 0x27) {
+ outSISIDXREG(SISSR, 0x27, sisReg->sisRegs3C4[0x27]);
+ outSISIDXREG(SISSR, 0x26, sisReg->sisRegs3C4[0x26]);
+ } else {
+ outSISIDXREG(SISSR, i, sisReg->sisRegs3C4[i]);
+ }
}
+
/* Restore VCLK and ECLK */
andSISIDXREG(SISSR,0x31,0xcf);
if(pSiS->VBFlags & VB_LVDS) {
@@ -918,10 +943,7 @@ SiS315Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
outSISIDXREG(SISSR, 0x00, 0x03); /* End Reset */
/* Restore Mode number */
-#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,99,0,0)
- if(!(pSiS->UseVESA))
-#endif
- SiS_GetSetModeID(pScrn,pSiS->BIOSModeSave);
+ SiS_GetSetModeID(pScrn,sisReg->BIOSModeSave);
}
static void
@@ -1147,7 +1169,7 @@ SiSLVDSChrontelSave(ScrnInfoPtr pScrn, SISRegPtr sisReg)
int i;
/* Save Part1 */
- for(i=0; i<0x46; i++) {
+ for(i=0; i<0x46; i++) {
inSISIDXREG(SISPART1, i, sisReg->VBPart1[i]);
#ifdef TWDEBUG
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -1224,7 +1246,7 @@ SiSLVDSChrontelRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
}
if((!(sisReg->sisRegs3D4[0x30] & 0x03)) &&
- (sisReg->sisRegs3D4[0x31] & 0x20)) { /* disable CRT2 */
+ (sisReg->sisRegs3D4[0x31] & 0x20)) { /* disable CRT2 */
SiS_LockCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext);
return;
}
@@ -1289,13 +1311,14 @@ SiSMclk(SISPtr pSiS)
case PCI_CHIP_SIS300:
case PCI_CHIP_SIS540:
case PCI_CHIP_SIS630:
- case PCI_CHIP_SIS550:
- case PCI_CHIP_SIS650:
case PCI_CHIP_SIS315:
case PCI_CHIP_SIS315H:
case PCI_CHIP_SIS315PRO:
+ case PCI_CHIP_SIS550:
+ case PCI_CHIP_SIS650:
case PCI_CHIP_SIS330:
case PCI_CHIP_SIS660:
+ case PCI_CHIP_SIS340:
/* Numerator */
inSISIDXREG(SISSR, 0x28, Num);
mclk = 14318 * ((Num & 0x7f) + 1);
@@ -1372,9 +1395,12 @@ SiSEstimateCRT2Clock(ScrnInfoPtr pScrn, BOOLEAN IsForMergedFBCRT2)
} else if(pSiS->VBLCDFlags & VB_LCD_1280x768) {
return 81000;
} else if(pSiS->VBLCDFlags & VB_LCD_1280x800) {
+ return 83000; /* Use this any way; BIOS timing seems wrong */
+#if 0
/* Must fake clock; built-in mode shows 83 for VGA, but uses only 70 for LCD */
if(IsForMergedFBCRT2) return 83000;
else return 70000;
+#endif
} 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;
@@ -1387,10 +1413,12 @@ SiSEstimateCRT2Clock(ScrnInfoPtr pScrn, BOOLEAN IsForMergedFBCRT2)
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_MaxClock)) {
return pSiS->SiS_Pr->CP_MaxClock;
- } else
- return 108000;
+ } else {
+ if(pSiS->VBFlags & VB_301C) return 162000;
+ else return 108000;
+ }
} else if(pSiS->VBFlags & CRT2_TV) {
if(pSiS->VBFlags & VB_CHRONTEL) {
switch(pSiS->VGAEngine) {
@@ -1428,10 +1456,8 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, BOOLEAN IsForCRT2)
#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 };
+ const float magicDED[4] = { 1.2, 1.368421, 2.263158, 1.2};
+ const float magicINT[4] = { 1.441177, 1.441177, 2.588235, 1.441177 };
#ifdef __SUNPRO_C
#undef const
#endif
@@ -1473,39 +1499,44 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, BOOLEAN IsForCRT2)
case PCI_CHIP_SIS650:
case PCI_CHIP_SIS330:
case PCI_CHIP_SIS660:
+ case PCI_CHIP_SIS340:
switch(pSiS->Chipset) {
case PCI_CHIP_SIS300:
- magic = magic300[bus/64];
+ magic = magicDED[bus/64];
max = 540000;
break;
case PCI_CHIP_SIS540:
case PCI_CHIP_SIS630:
- magic = magic630[bus/64];
+ magic = magicINT[bus/64];
max = 540000;
break;
case PCI_CHIP_SIS315:
case PCI_CHIP_SIS315H:
case PCI_CHIP_SIS315PRO:
case PCI_CHIP_SIS330:
- magic = magic315[bus/64];
+ magic = magicDED[bus/64];
max = 780000;
break;
case PCI_CHIP_SIS550:
- magic = magic550[bus/64];
+ magic = magicINT[bus/64];
max = 620000;
break;
case PCI_CHIP_SIS650:
- magic = magic550[bus/64];
+ magic = magicINT[bus/64];
max = 680000;
break;
case PCI_CHIP_SIS660:
if((pSiS->sishw_ext.jChipType >= SIS_660) &&
(!(pSiS->ChipFlags & SiSCF_760UMA))) {
- magic = magic315[bus/64];
+ magic = magicDED[bus/64];
} else {
- magic = magic550[bus/64];
+ magic = magicINT[bus/64];
}
- max = 680000;
+ max = 800000;
+ case PCI_CHIP_SIS340:
+ magic = magicDED[bus/64];
+ max = 800000;
+ break;
}
PDEBUG(ErrorF("mclk: %d, bus: %d, magic: %g, bpp: %d\n",
@@ -1528,7 +1559,7 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, BOOLEAN IsForCRT2)
crt2used = 0.0;
crt2clock = SiSEstimateCRT2Clock(pScrn, IsForCRT2);
if(crt2clock) {
- crt2used = crt2clock + 2000;
+ crt2used = crt2clock + 2000;
}
DHM = FALSE;
GetForCRT1 = FALSE;
@@ -1550,17 +1581,17 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, BOOLEAN IsForCRT2)
if(!GetForCRT1) {
- /* TW: First head = CRT2 */
+ /* First head = CRT2 */
if(crt2clock) {
- /* TW: We use the mem bandwidth as max clock; this
- * might exceed the 70% limit a bit, but that
- * does not matter; we take care of that limit
- * when we calc CRT1. Overall, we might use up
- * to 85% of the memory bandwidth, which seems
- * enough to use accel and video.
- * The "* macic" is just to compensate the
- * calculation below.
+ /* We use the mem bandwidth as max clock; this
+ * might exceed the 70% limit a bit, but that
+ * does not matter; we take care of that limit
+ * when we calc CRT1. Overall, we might use up
+ * to 85% of the memory bandwidth, which seems
+ * enough to use accel and video.
+ * The "* macic" is just to compensate the
+ * calculation below.
*/
total = crt2used * magic;
@@ -1587,7 +1618,7 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, BOOLEAN IsForCRT2)
} else {
#ifdef SISDUALHEAD
- /* TW: Second head = CRT1 */
+ /* Second head = CRT1 */
/* Now We know about the first head's depth,
* so we can calculate more accurately.
@@ -1885,6 +1916,7 @@ SISDACPreInit(ScrnInfoPtr pScrn)
case PCI_CHIP_SIS315PRO:
case PCI_CHIP_SIS330:
case PCI_CHIP_SIS660:
+ case PCI_CHIP_SIS340:
pSiS->MaxClock = SiSMemBandWidth(pScrn, FALSE);
pSiS->SiSSave = SiS315Save;
pSiS->SiSSave2 = SiS301Save;
@@ -1971,3 +2003,53 @@ SiS6326GetXXReg(ScrnInfoPtr pScrn, CARD8 index)
inSISIDXREG(SISCR, 0xE3, data);
return(data);
}
+
+unsigned char SiSGetCopyROP(int rop)
+{
+ const unsigned char 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 */
+ };
+
+ return(sisALUConv[rop]);
+}
+
+unsigned char SiSGetPatternROP(int rop)
+{
+ const unsigned char 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 */
+ };
+
+ return(sisPatALUConv[rop]);
+}
diff --git a/src/sis_dac.h b/src/sis_dac.h
index cbce161..f1f700c 100644
--- a/src/sis_dac.h
+++ b/src/sis_dac.h
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h,v 1.4 2004/07/26 22:40:56 twini Exp $ */
/*
* DAC helper functions (Save/Restore, MemClk, etc)
* Definitions and prototypes
@@ -16,7 +17,7 @@
* 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
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
diff --git a/src/sis_dga.c b/src/sis_dga.c
index a806cec..34a9f3e 100644
--- a/src/sis_dga.c
+++ b/src/sis_dga.c
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c,v 1.3 2004/06/17 13:20:13 twini Exp $ */
/*
* SiS DGA handling
*
@@ -39,7 +40,6 @@
#include "xf86Pci.h"
#include "xf86PciInfo.h"
#include "xaa.h"
-#include "xaalocal.h"
#include "sis.h"
#include "sis_regs.h"
#include "dgaproc.h"
diff --git a/src/sis_dri.c b/src/sis_dri.c
index c143d2f..3dd7aff 100644
--- a/src/sis_dri.c
+++ b/src/sis_dri.c
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.9 2004/08/14 15:26:50 twini Exp $ */
/*
* DRI wrapper for 300 and 315 series
*
@@ -47,11 +48,27 @@
#include "GL/glxtokens.h"
#include "sis.h"
-#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,99,0,0)
-#include "xf86drmCompat.h"
+
+#ifndef SISHAVEDRMWRITE
+# if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
+extern Bool drmSiSAgpInit(int driSubFD, int offset, int size);
+# else
+# include "xf86drmCompat.h"
+# endif
#endif
-#ifdef SISNEWDRI
+#ifdef XORG_VERSION_CURRENT
+#define SISHAVECREATEBUSID
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(6,7,99,1,0)
+extern char *DRICreatePCIBusID(pciVideoPtr PciInfo);
+#endif
+#else
+# if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,4,99,99,0)
+# undef SISHAVECREATEBUSID /* Waiting, waiting, waiting... */
+# endif
+#endif
+
+#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,0,0,0)
#include "sis_common.h"
#endif
@@ -70,7 +87,6 @@
while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000){}; \
}
-
extern void GlxSetVisualConfigs(
int nconfigs,
__GLXvisualConfig *configs,
@@ -82,9 +98,9 @@ static char SISClientDriverName[] = "sis";
static Bool SISInitVisualConfigs(ScreenPtr pScreen);
static Bool SISCreateContext(ScreenPtr pScreen, VisualPtr visual,
- drmContext hwContext, void *pVisualConfigPriv,
+ drm_context_t hwContext, void *pVisualConfigPriv,
DRIContextType contextStore);
-static void SISDestroyContext(ScreenPtr pScreen, drmContext hwContext,
+static void SISDestroyContext(ScreenPtr pScreen, drm_context_t hwContext,
DRIContextType contextStore);
static void SISDRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
DRIContextType readContextType,
@@ -94,11 +110,7 @@ static void SISDRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
static void SISDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index);
static void SISDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
RegionPtr prgnSrc, CARD32 index);
-
-#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
-extern Bool drmSiSAgpInit(int driSubFD, int offset, int size);
-#endif
-
+
static Bool
SISInitVisualConfigs(ScreenPtr pScreen)
{
@@ -138,31 +150,46 @@ SISInitVisualConfigs(ScreenPtr pScreen)
xfree(pSISConfigs);
return FALSE;
}
- for(i=0; i<numConfigs; i++) pSISConfigPtrs[i] = &pSISConfigs[i];
+ for(i=0; i<numConfigs; i++) pSISConfigPtrs[i] = &pSISConfigs[i];
i = 0;
for(accum = 0; accum <= 1; accum++) {
- for(z_stencil=0; z_stencil<(useZ16?2:4); z_stencil++) {
+ for(z_stencil = 0; z_stencil < (useZ16 ? 2 : 4); z_stencil++) {
for(db = 0; db <= 1; db++) {
pConfigs[i].vid = -1;
pConfigs[i].class = -1;
pConfigs[i].rgba = TRUE;
- pConfigs[i].redSize = -1;
- pConfigs[i].greenSize = -1;
- pConfigs[i].blueSize = -1;
- pConfigs[i].redMask = -1;
- pConfigs[i].greenMask = -1;
- pConfigs[i].blueMask = -1;
- pConfigs[i].alphaMask = 0;
+ if(pScrn->bitsPerPixel == 16) {
+ pConfigs[i].redSize = 5;
+ pConfigs[i].greenSize = 6;
+ pConfigs[i].blueSize = 5;
+ pConfigs[i].alphaSize = 0;
+ pConfigs[i].redMask = 0x0000F800;
+ pConfigs[i].greenMask = 0x000007E0;
+ pConfigs[i].blueMask = 0x0000001F;
+ pConfigs[i].alphaMask = 0x00000000;
+ } else {
+ pConfigs[i].redSize = 8;
+ pConfigs[i].greenSize = 8;
+ pConfigs[i].blueSize = 8;
+ pConfigs[i].alphaSize = 8;
+ pConfigs[i].redMask = 0x00FF0000;
+ pConfigs[i].greenMask = 0x0000FF00;
+ pConfigs[i].blueMask = 0x000000FF;
+ pConfigs[i].alphaMask = 0xFF000000;
+ }
if(accum) {
- pConfigs[i].accumRedSize = 16;
+ pConfigs[i].accumRedSize = 16;
pConfigs[i].accumGreenSize = 16;
- pConfigs[i].accumBlueSize = 16;
- pConfigs[i].accumAlphaSize = 16;
+ pConfigs[i].accumBlueSize = 16;
+ if(pConfigs[i].alphaMask == 0)
+ pConfigs[i].accumAlphaSize = 0;
+ else
+ pConfigs[i].accumAlphaSize = 16;
} else {
- pConfigs[i].accumRedSize = 0;
+ pConfigs[i].accumRedSize = 0;
pConfigs[i].accumGreenSize = 0;
- pConfigs[i].accumBlueSize = 0;
+ pConfigs[i].accumBlueSize = 0;
pConfigs[i].accumAlphaSize = 0;
}
if(db) pConfigs[i].doubleBuffer = TRUE;
@@ -189,11 +216,14 @@ SISInitVisualConfigs(ScreenPtr pScreen)
}
pConfigs[i].auxBuffers = 0;
pConfigs[i].level = 0;
- pConfigs[i].visualRating = GLX_NONE_EXT;
- pConfigs[i].transparentPixel = 0;
- pConfigs[i].transparentRed = 0;
+ if(pConfigs[i].accumRedSize != 0)
+ pConfigs[i].visualRating = GLX_SLOW_CONFIG;
+ else
+ pConfigs[i].visualRating = GLX_NONE_EXT;
+ pConfigs[i].transparentPixel = GLX_NONE;
+ pConfigs[i].transparentRed = 0;
pConfigs[i].transparentGreen = 0;
- pConfigs[i].transparentBlue = 0;
+ pConfigs[i].transparentBlue = 0;
pConfigs[i].transparentAlpha = 0;
pConfigs[i].transparentIndex = 0;
i++;
@@ -222,7 +252,7 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
SISPtr pSIS = SISPTR(pScrn);
DRIInfoPtr pDRIInfo;
SISDRIPtr pSISDRI;
-#ifdef SISNEWDRI
+#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,0,0,0)
drmVersionPtr version;
#endif
@@ -231,31 +261,31 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
pSIS->cmdQ_SharedWritePortBackup = NULL;
#endif
- /* Check that the GLX, DRI, and DRM modules have been loaded by testing
- * for canonical symbols in each module.
- */
- if(!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) return FALSE;
- if(!xf86LoaderCheckSymbol("DRIScreenInit")) return FALSE;
- if(!xf86LoaderCheckSymbol("drmAvailable")) return FALSE;
- if(!xf86LoaderCheckSymbol("DRIQueryVersion")) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
+ /* Check that the GLX, DRI, and DRM modules have been loaded by testing
+ * for canonical symbols in each module.
+ */
+ if(!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) return FALSE;
+ if(!xf86LoaderCheckSymbol("DRIScreenInit")) return FALSE;
+ if(!xf86LoaderCheckSymbol("drmAvailable")) return FALSE;
+ if(!xf86LoaderCheckSymbol("DRIQueryVersion")) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR,
"[dri] SISDRIScreenInit failed (libdri.a too old)\n");
- return FALSE;
- }
+ return FALSE;
+ }
- /* Check the DRI version */
- {
- int major, minor, patch;
- DRIQueryVersion(&major, &minor, &patch);
- if(major != 4 || minor < 0) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
+ /* Check the DRI version */
+ {
+ int major, minor, patch;
+ DRIQueryVersion(&major, &minor, &patch);
+ if(major != 4 || minor < 0) {
+ xf86DrvMsg(pScreen->myNum, X_ERROR,
"[dri] SISDRIScreenInit failed because of a version mismatch.\n"
"\t[dri] libDRI version is %d.%d.%d but version 4.0.x is needed.\n"
"\t[dri] Disabling DRI.\n",
major, minor, patch);
- return FALSE;
- }
- }
+ return FALSE;
+ }
+ }
pDRIInfo = DRICreateInfoRec();
if (!pDRIInfo) return FALSE;
@@ -263,17 +293,18 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
pDRIInfo->drmDriverName = SISKernelDriverName;
pDRIInfo->clientDriverName = SISClientDriverName;
-#ifdef SISNEWDRI2
+
+#ifdef SISHAVECREATEBUSID
if(xf86LoaderCheckSymbol("DRICreatePCIBusID")) {
- pDRIInfo->busIdString = DRICreatePCIBusID(pSiS->PciInfo);
+ pDRIInfo->busIdString = DRICreatePCIBusID(pSIS->PciInfo);
} else {
-#endif
+#endif
pDRIInfo->busIdString = xalloc(64);
sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d",
((pciConfigPtr)pSIS->PciInfo->thisCard)->busnum,
((pciConfigPtr)pSIS->PciInfo->thisCard)->devnum,
- ((pciConfigPtr)pSIS->PciInfo->thisCard)->funcnum);
-#ifdef SISNEWDRI2
+ ((pciConfigPtr)pSIS->PciInfo->thisCard)->funcnum);
+#ifdef SISHAVECREATEBUSID
}
#endif
@@ -359,42 +390,42 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
return FALSE;
}
-#ifdef SISNEWDRI
+#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,0,0,0)
/* Check DRM kernel version */
version = drmGetVersion(pSIS->drmSubFD);
if(version) {
- if(version->version_major != 1 ||
- version->version_minor < 0) {
- /* incompatible drm version */
- xf86DrvMsg(pScreen->myNum, X_ERROR,
+ if((version->version_major != 1) ||
+ (version->version_minor < 0)) {
+ /* incompatible drm version */
+ xf86DrvMsg(pScreen->myNum, X_ERROR,
"[dri] SISDRIScreenInit failed because of a version mismatch.\n"
- "\t[dri] sis.o kernel module version is %d.%d.%d but version 1.0.x is needed.\n"
+ "\t[dri] sis.o kernel module version is %d.%d.%d but version >=1.0.x is needed.\n"
"\t[dri] Disabling the DRI.\n",
version->version_major,
version->version_minor,
version->version_patchlevel);
- drmFreeVersion(version);
- SISDRICloseScreen(pScreen);
- return FALSE;
- }
- if(version->version_minor >= 1) {
- /* Includes support for framebuffer memory allocation without sisfb */
- drm_sis_fb_t fb;
- fb.offset = pSIS->DRIheapstart;
- fb.size = pSIS->DRIheapend - pSIS->DRIheapstart;
- drmCommandWrite(pSIS->drmSubFD, DRM_SIS_FB_INIT, &fb, sizeof(fb));
- xf86DrvMsg(pScreen->myNum, X_INFO,
+ drmFreeVersion(version);
+ SISDRICloseScreen(pScreen);
+ return FALSE;
+ }
+ if(version->version_minor >= 1) {
+ /* Includes support for framebuffer memory allocation without sisfb */
+ drm_sis_fb_t fb;
+ fb.offset = pSIS->DRIheapstart;
+ fb.size = pSIS->DRIheapend - pSIS->DRIheapstart;
+ drmCommandWrite(pSIS->drmSubFD, DRM_SIS_FB_INIT, &fb, sizeof(fb));
+ xf86DrvMsg(pScreen->myNum, X_INFO,
"[dri] DRI video RAM memory heap: 0x%lx to 0x%lx (%dKB)\n",
pSIS->DRIheapstart, pSIS->DRIheapend,
(int)((pSIS->DRIheapend - pSIS->DRIheapstart) >> 10));
- }
- drmFreeVersion(version);
+ }
+ drmFreeVersion(version);
}
#endif
pSISDRI->regs.size = SISIOMAPSIZE;
pSISDRI->regs.map = 0;
- if(drmAddMap(pSIS->drmSubFD, (drmHandle)pSIS->IOAddress,
+ if(drmAddMap(pSIS->drmSubFD, (drm_handle_t)pSIS->IOAddress,
pSISDRI->regs.size, DRM_REGISTERS, 0,
&pSISDRI->regs.handle) < 0) {
SISDRICloseScreen(pScreen);
@@ -491,7 +522,7 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
/* pSIS->agpBase = */
pSISDRI->agp.size = pSIS->agpSize;
- if(drmAddMap(pSIS->drmSubFD, (drmHandle)0, pSISDRI->agp.size, DRM_AGP, 0, &pSISDRI->agp.handle) < 0) {
+ if(drmAddMap(pSIS->drmSubFD, (drm_handle_t)0, pSISDRI->agp.size, DRM_AGP, 0, &pSISDRI->agp.handle) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] Failed to map public AGP area, AGP disabled\n");
pSISDRI->agp.size = 0;
break;
@@ -507,7 +538,17 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
pSISDRI->AGPVtxBufOffset = pSIS->agpVtxBufAddr - pSIS->agpAddr;
pSISDRI->AGPVtxBufSize = pSIS->agpVtxBufSize;
+#ifndef SISHAVEDRMWRITE
drmSiSAgpInit(pSIS->drmSubFD, AGP_VTXBUF_SIZE,(pSIS->agpSize - AGP_VTXBUF_SIZE));
+#else
+ {
+ drm_sis_agp_t agp;
+
+ agp.offset = AGP_VTXBUF_SIZE;
+ agp.size = pSIS->agpSize - AGP_VTXBUF_SIZE;
+ drmCommandWrite(pSIS->drmSubFD, DRM_SIS_AGP_INIT, &agp, sizeof(agp));
+ }
+#endif
#endif
} else {
@@ -519,7 +560,17 @@ Bool SISDRIScreenInit(ScreenPtr pScreen)
pSISDRI->AGPCmdBufOffset = pSIS->agpCmdBufAddr - pSIS->agpAddr;
pSISDRI->AGPCmdBufSize = pSIS->agpCmdBufSize;
+#ifndef SISHAVEDRMWRITE
drmSiSAgpInit(pSIS->drmSubFD, AGP_CMDBUF_SIZE,(pSIS->agpSize - AGP_CMDBUF_SIZE));
+#else
+ {
+ drm_sis_agp_t agp;
+
+ agp.offset = AGP_CMDBUF_SIZE;
+ agp.size = pSIS->agpSize - AGP_CMDBUF_SIZE;
+ drmCommandWrite(pSIS->drmSubFD, DRM_SIS_AGP_INIT, &agp, sizeof(agp));
+ }
+#endif
}
}
while(0);
@@ -596,14 +647,14 @@ SISDRICloseScreen(ScreenPtr pScreen)
*/
static Bool
SISCreateContext(ScreenPtr pScreen, VisualPtr visual,
- drmContext hwContext, void *pVisualConfigPriv,
+ drm_context_t hwContext, void *pVisualConfigPriv,
DRIContextType contextStore)
{
return TRUE;
}
static void
-SISDestroyContext(ScreenPtr pScreen, drmContext hwContext,
+SISDestroyContext(ScreenPtr pScreen, drm_context_t hwContext,
DRIContextType contextStore)
{
}
diff --git a/src/sis_dri.h b/src/sis_dri.h
index 29ce331..3b6b347 100644
--- a/src/sis_dri.h
+++ b/src/sis_dri.h
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h,v 1.6 2004/06/21 00:38:20 twini Exp $ */
/*
* SiS DRI wrapper
*
@@ -36,6 +37,14 @@
#include "xf86drm.h"
+/* Hack: When the types were changed, the typedefs
+ * went into drm.h. This file did not exist earlier.
+ */
+#ifndef _DRM_H_
+#define drm_handle_t drmHandle
+#define drm_context_t drmContext
+#endif
+
#define SIS_MAX_DRAWABLES 256
#define SISIOMAPSIZE (64*1024)
@@ -64,7 +73,7 @@ typedef struct {
#define SIS_DEPTH 2
typedef struct {
- drmHandle handle;
+ drm_handle_t handle;
drmSize size;
drmAddress map;
} sisRegion, *sisRegionPtr;
diff --git a/src/sis_driver.c b/src/sis_driver.c
index f816f61..d7b4f69 100644
--- a/src/sis_driver.c
+++ b/src/sis_driver.c
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.20 2004/08/20 18:57:06 kem Exp $ */
/*
* SiS driver main code
*
@@ -15,7 +16,7 @@
* 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
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -34,7 +35,7 @@
*
* This notice covers the entire driver code unless otherwise indicated.
*
- * Formerly based on code which is
+ * Formerly based on code which was
* Copyright (C) 1998, 1999 by Alan Hourihane, Wigan, England.
* Written by:
* Alan Hourihane <alanh@fairlite.demon.co.uk>,
@@ -54,6 +55,9 @@
#include "xf86_ansic.h"
#include "dixstruct.h"
#include "xf86Version.h"
+#ifdef XORG_VERSION_CURRENT
+#include "xorgVersion.h"
+#endif
#include "xf86PciInfo.h"
#include "xf86Pci.h"
#include "xf86cmap.h"
@@ -154,6 +158,7 @@ static SymTabRec SISChipsets[] = {
{ PCI_CHIP_SIS650, "SIS650/M650/651/740" },
{ PCI_CHIP_SIS330, "SIS330(Xabre)" },
{ PCI_CHIP_SIS660, "SIS660/661FX/M661FX/M661MX/741/741GX/M741/760/M760" },
+ { PCI_CHIP_SIS340, "SIS340" },
{ -1, NULL }
};
@@ -171,17 +176,13 @@ static PciChipsets SISPciChipsets[] = {
{ PCI_CHIP_SIS650, PCI_CHIP_SIS650, RES_SHARED_VGA },
{ PCI_CHIP_SIS330, PCI_CHIP_SIS330, RES_SHARED_VGA },
{ PCI_CHIP_SIS660, PCI_CHIP_SIS660, RES_SHARED_VGA },
+ { PCI_CHIP_SIS340, PCI_CHIP_SIS340, RES_SHARED_VGA },
{ -1, -1, RES_UNDEFINED }
};
static const char *xaaSymbols[] = {
- "XAACopyROP",
"XAACreateInfoRec",
"XAADestroyInfoRec",
-#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,0,0)
- "XAAFillSolidRects",
-#endif
- "XAAFillMono8x8PatternRects",
"XAAHelpPatternROP",
"XAAInit",
NULL
@@ -268,7 +269,15 @@ static const char *drmSymbols[] = {
"drmAgpRelease",
"drmCtlInstHandler",
"drmGetInterruptFromBusID",
+#ifndef SISHAVEDRMWRITE
"drmSiSAgpInit",
+#else
+ "drmCommandWrite",
+#endif
+#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,0,0,0)
+ "drmGetVersion",
+ "drmFreeVersion",
+#endif
NULL
};
@@ -281,14 +290,18 @@ static const char *driSymbols[] = {
"DRILock",
"DRIQueryVersion",
"DRIScreenInit",
- "DRIUnlock",
+ "DRIUnlock",
"GlxSetVisualConfigs",
-#ifdef SISNEWDRI2
- "DRICreatePCIBusID"
-#endif
+ NULL
+};
+
+#ifdef XFree86LOADER
+static const char *driRefSymbols[] = {
+ "DRICreatePCIBusID", /* not REQUIRED */
NULL
};
#endif
+#endif /* XF86DRI */
#ifdef XFree86LOADER
@@ -300,7 +313,11 @@ static XF86ModuleVersionInfo sisVersRec =
MODULEVENDORSTRING,
MODINFOSTRING1,
MODINFOSTRING2,
+#ifdef XORG_VERSION_CURRENT
+ XORG_VERSION_CURRENT,
+#else
XF86_VERSION_CURRENT,
+#endif
SIS_MAJOR_VERSION, SIS_MINOR_VERSION, SIS_PATCHLEVEL,
ABI_CLASS_VIDEODRV, /* This is a video driver */
ABI_VIDEODRV_VERSION,
@@ -322,7 +339,7 @@ sisSetup(pointer module, pointer opts, int *errmaj, int *errmin)
shadowSymbols, ramdacSymbols,
vbeSymbols, int10Symbols,
#ifdef XF86DRI
- drmSymbols, driSymbols,
+ drmSymbols, driSymbols, driRefSymbols,
#endif
NULL);
return (pointer)TRUE;
@@ -581,7 +598,7 @@ SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int fla
}
}
- if(pSiS->VBFlags & (VB_301LV|VB_302LV|VB_302ELV)) {
+ if(pSiS->VBFlags & VB_SISLVDSBRIDGE) {
if((docrt2 && (pSiS->VBFlags & CRT2_LCD)) || (docrt1 && (pSiS->VBFlags & CRT1_LCDA))) {
if(backlight) {
SiS_SiS30xBLOn(pSiS->SiS_Pr,&pSiS->sishw_ext);
@@ -592,30 +609,30 @@ SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int fla
}
if(docrt1) {
- setSISIDXREG(SISSR, 0x01, ~0x20, sr1); /* Set/Clear "Display On" bit */
switch(pSiS->VGAEngine) {
case SIS_OLD_VGA:
case SIS_530_VGA:
+ setSISIDXREG(SISSR, 0x01, ~0x20, sr1); /* Set/Clear "Display On" bit */
inSISIDXREG(SISSR, 0x11, oldpmreg);
setSISIDXREG(SISCR, 0x17, 0x7f, cr17);
setSISIDXREG(SISSR, 0x11, 0x3f, pmreg);
break;
case SIS_315_VGA:
- if((!pSiS->CRT1off) && ((!(pSiS->VBFlags & CRT1_LCDA)) || (pSiS->VBFlags & VB_301C))) {
+ if((!pSiS->CRT1off) && ((!(pSiS->VBFlags & CRT1_LCDA)) || (pSiS->VBFlags & VB_SISTMDSLCDABRIDGE))) {
setSISIDXREG(SISCR, pSiS->myCR63, 0xbf, cr63);
setSISIDXREG(SISSR, 0x07, 0xef, sr7);
}
/* fall through */
default:
- if((!(pSiS->VBFlags & CRT1_LCDA)) || (pSiS->VBFlags & VB_301C)) {
+ if(!SiSBridgeIsInSlaveMode(pScrn)) {
+ setSISIDXREG(SISSR, 0x01, ~0x20, sr1); /* Set/Clear "Display On" bit */
+ }
+ if((!(pSiS->VBFlags & CRT1_LCDA)) || (pSiS->VBFlags & VB_SISTMDSLCDABRIDGE)) {
inSISIDXREG(SISSR, 0x1f, oldpmreg);
- if(!pSiS->CRT1off) {
+ if((!pSiS->CRT1off) && (!SiSBridgeIsInSlaveMode(pScrn))) {
setSISIDXREG(SISSR, 0x1f, 0x3f, pmreg);
}
}
- /* TODO: Check if Chrontel TV is active and in slave mode,
- * don't go into power-saving mode this in this case!
- */
}
oldpmreg &= 0xc0;
}
@@ -650,7 +667,8 @@ SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int fla
}
}
- if((docrt1) && (pmreg != oldpmreg) && ((!(pSiS->VBFlags & CRT1_LCDA)) || (pSiS->VBFlags & VB_301C))) {
+ if((docrt1) && (pmreg != oldpmreg) &&
+ ((!(pSiS->VBFlags & CRT1_LCDA)) || (pSiS->VBFlags & VB_SISTMDSLCDABRIDGE))) {
outSISIDXREG(SISSR, 0x00, 0x01); /* Synchronous Reset */
usleep(10000);
outSISIDXREG(SISSR, 0x00, 0x03); /* End Reset */
@@ -741,6 +759,23 @@ SISErrorLog(ScrnInfoPtr pScrn, const char *format, ...)
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, str);
}
+static void
+SiS_SiSFB_Lock(ScrnInfoPtr pScrn, Bool lock)
+{
+ SISPtr pSiS = SISPTR(pScrn);
+ int fd;
+ CARD32 parm;
+
+ if(!pSiS->sisfbfound) return;
+ if(!pSiS->sisfb_havelock) return;
+
+ if((fd = open(pSiS->sisfbdevname, 'r')) != -1) {
+ parm = lock ? 1 : 0;
+ ioctl(fd, SISFB_SET_LOCK, &parm);
+ close(fd);
+ }
+}
+
/* Mandatory */
static Bool
SISProbe(DriverPtr drv, int flags)
@@ -842,7 +877,8 @@ SISProbe(DriverPtr drv, int flags)
pEnt->chipset == PCI_CHIP_SIS650 || pEnt->chipset == PCI_CHIP_SIS550 ||
pEnt->chipset == PCI_CHIP_SIS315 || pEnt->chipset == PCI_CHIP_SIS315H ||
pEnt->chipset == PCI_CHIP_SIS315PRO || pEnt->chipset == PCI_CHIP_SIS330 ||
- pEnt->chipset == PCI_CHIP_SIS300 || pEnt->chipset == PCI_CHIP_SIS660) {
+ pEnt->chipset == PCI_CHIP_SIS300 || pEnt->chipset == PCI_CHIP_SIS660 ||
+ pEnt->chipset == PCI_CHIP_SIS340) {
SISEntPtr pSiSEnt = NULL;
DevUnion *pPriv;
@@ -1026,6 +1062,37 @@ SiSSetSyncRangeFromEdid(ScrnInfoPtr pScrn, int flag)
}
#endif
+static BOOLEAN
+SiSAllowSyncOverride(SISPtr pSiS)
+{
+#ifdef SISDUALHEAD
+ if(pSiS->DualHeadMode) {
+ if(pSiS->SecondHead) {
+ if(pSiS->VBFlags & CRT1_LCDA) return TRUE;
+ } else {
+ if(pSiS->VBFlags & (CRT2_LCD | CRT2_TV)) return TRUE;
+ }
+ return FALSE;
+ } else
+#endif
+#ifdef SISMERGED
+ if(pSiS->MergedFB) {
+ if(pSiS->VBFlags & CRT1_LCDA) return TRUE;
+ return FALSE;
+ }
+#endif
+
+ if(!(pSiS->VBFlags & DISPTYPE_CRT1)) {
+ if(pSiS->VBFlags & (CRT2_LCD | CRT2_TV)) {
+ return TRUE;
+ }
+ } else if(pSiS->VBFlags & CRT1_LCDA) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
/* Some helper functions for MergedFB mode */
#ifdef SISMERGED
@@ -2130,7 +2197,7 @@ SiSInternalDDC(ScrnInfoPtr pScrn, int crtno)
} else {
/* If CRT1 is LCDA, skip DDC (except 301C: DDC allowed, but uses CRT2 port!) */
if(pSiS->VBFlags & CRT1_LCDA) {
- if(pSiS->VBFlags & VB_301C) realcrtno = 1;
+ if(pSiS->VBFlags & VB_SISTMDSLCDABRIDGE) realcrtno = 1;
else return NULL;
}
}
@@ -2247,30 +2314,73 @@ SiSMakeOwnModeList(ScrnInfoPtr pScrn, BOOLEAN acceptcustommodes, BOOLEAN include
return FALSE;
}
+void SISDetermineLCDACap(ScrnInfoPtr pScrn)
+{
+ SISPtr pSiS = SISPTR(pScrn);
+
+ if( ((pSiS->sishw_ext.jChipType == SIS_650) ||
+ (pSiS->sishw_ext.jChipType >= SIS_661)) &&
+ (pSiS->VBFlags & VB_SISLCDABRIDGE) &&
+ (pSiS->VESA != 1) ) {
+ pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTLCDA;
+ } else {
+ pSiS->SiS_SD_Flags &= ~SiS_SD_SUPPORTLCDA;
+ }
+}
+
+void SISSaveDetectedDevices(ScrnInfoPtr pScrn)
+{
+ SISPtr pSiS = SISPTR(pScrn);
+ /* Backup detected CRT2 devices */
+ pSiS->detectedCRT2Devices = pSiS->VBFlags & (CRT2_LCD|CRT2_TV|CRT2_VGA|TV_AVIDEO|TV_SVIDEO|
+ TV_SCART|TV_HIVISION|TV_YPBPR);
+}
+
+static BOOLEAN
+SISCheckBIOS(SISPtr pSiS, unsigned short mypciid)
+{
+ unsigned short romptr, pciid;
+
+ if(!pSiS->BIOS) return FALSE;
+
+ if((pSiS->BIOS[0] != 0x55) || (pSiS->BIOS[1] != 0xaa)) return FALSE;
+
+ romptr = pSiS->BIOS[0x18] | (pSiS->BIOS[0x19] << 8);
+ if(romptr > (BIOS_SIZE - 8)) return FALSE;
+ if((pSiS->BIOS[romptr] != 'P') || (pSiS->BIOS[romptr+1] != 'C') ||
+ (pSiS->BIOS[romptr+2] != 'I') || (pSiS->BIOS[romptr+3] != 'R')) return FALSE;
+
+ pciid = pSiS->BIOS[romptr+4] | (pSiS->BIOS[romptr+5] << 8);
+ if(pciid != 0x1039) return FALSE;
+
+ pciid = pSiS->BIOS[romptr+6] | (pSiS->BIOS[romptr+7] << 8);
+ if(pciid != mypciid) return FALSE;
+
+ return TRUE;
+}
+
/* Mandatory */
static Bool
SISPreInit(ScrnInfoPtr pScrn, int flags)
{
SISPtr pSiS;
+#ifdef SISDUALHEAD
+ SISEntPtr pSiSEnt = NULL;
+#endif
MessageType from;
unsigned char usScratchCR17, CR5F;
unsigned char usScratchCR32, usScratchCR63;
- unsigned char usScratchSR1F;
- unsigned long int i;
+ unsigned char usScratchSR1F, tempreg;
+ unsigned char srlockReg, crlockReg;
+ unsigned int i;
int temp;
ClockRangePtr clockRanges;
int pix24flags;
-#ifdef SISDUALHEAD
- SISEntPtr pSiSEnt = NULL;
-#endif
#if defined(SISMERGED) || defined(SISDUALHEAD)
DisplayModePtr first, p, n;
#endif
- unsigned char srlockReg,crlockReg;
- unsigned char tempreg;
xf86MonPtr pMonitor = NULL;
Bool didddc2;
-
vbeInfoPtr pVbe;
VbeInfoBlock *vbe;
@@ -2280,6 +2390,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
static const char *subshstr = "Substituting missing CRT%d monitor HSync data by DDC data\n";
static const char *subsvstr = "Substituting missing CRT%d monitor VRefresh data by DDC data\n";
#endif
+ static const char *saneh = "Correcting bogus or missing CRT%d monitor HSync range\n";
+ static const char *sanev = "Correcting bogus or missing CRT%d monitor VRefresh range\n";
#ifdef SISMERGED
static const char *mergednocrt1 = "CRT1 not detected or forced off. %s.\n";
static const char *mergednocrt2 = "No CRT2 output selected or no bridge detected. %s.\n";
@@ -2326,7 +2438,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
return FALSE;
}
- /* The vgahw module should be loaded here when needed */
+ /* Load the vgahw module */
if(!xf86LoadSubModule(pScrn, "vgahw")) {
SISErrorLog(pScrn, "Could not load vgahw module\n");
return FALSE;
@@ -2347,15 +2459,30 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Copyright (C) 2001-2004 Thomas Winischhofer <thomas@winischhofer.net> and others\n");
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Compiled for X.Org %d.%d.%d.%d\n",
+ "Compiled for " SISMYSERVERNAME " version %d.%d.%d.%d\n",
+#ifdef XORG_VERSION_CURRENT
+ XORG_VERSION_MAJOR, XORG_VERSION_MINOR,
+ XORG_VERSION_PATCH, XORG_VERSION_SNAP);
+#else
XF86_VERSION_MAJOR, XF86_VERSION_MINOR,
XF86_VERSION_PATCH, XF86_VERSION_SNAP);
+#endif
+
+#ifdef XORG_VERSION_CURRENT
+#if 0 /* no prototype yet */
+ if(xorgGetVersion() != XORG_VERSION_CURRENT) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "This version of the driver is not compiled for this version of " SISMYSERVERNAME "\n");
+ }
+#endif
+#else
#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,99,0,0)
if(xf86GetVersion() != XF86_VERSION_CURRENT) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "This version of the driver is not compiled for this version of X.Org!\n");
+ "This version of the driver is not compiled for this version of " SISMYSERVERNAME "\n");
}
#endif
+#endif
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"See http://www.winischhofer.net/linuxsisvga.shtml "
"for documentation and updates\n");
@@ -2413,22 +2540,57 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"This adapter is %s display adapter\n",
(pSiS->Primary ? "primary" : "secondary"));
-
+
+ /* "Patch" the PIOOffset inside vgaHW in order to force
+ * the vgaHW module to use our relocated i/o ports.
+ */
+ VGAHWPTR(pScrn)->PIOOffset = pSiS->MyPIOOffset = pSiS->IODBase + pSiS->PciInfo->ioBase[2] - 0x380;
+
+#ifdef SIS_NEED_MAP_IOP
+ /********************************************/
+ /* THIS IS BROKEN AND WON'T WORK */
+ /* Reasons: */
+ /* 1) MIPS and ARM have no i/o ports but */
+ /* use memory mapped i/o only. The inX/outX */
+ /* macros in compiler.h are smart enough to */
+ /* add "IOPortBase" to the port number, but */
+ /* "IOPortBase" is never initialized. */
+ /* 2) IOPortBase is declared in compiler.h */
+ /* itself. So until somebody fixes all */
+ /* modules (eg vgahw) to set IOPortBase, */
+ /* vga support for MIPS and ARM is unusable.*/
+ /********************************************/
+ pSiS->IOPAddress = pSiS->IODBase + pSiS->PciInfo->ioBase[2];
+ if(!SISMapIOPMem(pScrn)) {
+ SISErrorLog(pScrn, "Could not map I/O port area at 0x%x\n", pSiS->IOPAddress);
+ SISFreeRec(pScrn);
+ return FALSE;
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "I/O port area mapped to %p, size 128\n", pSiS->IOPBase);
+#if defined(__mips__) || defined(__arm32__)
+ /* inX/outX macros on these use IOPortBase as offset */
+ /* This is entirely skrewed. */
+ IOPortBase = (unsigned int)pSiS->IOPBase;
+#else
+ /* Others might not... */
+ VGAHWPTR(pScrn)->PIOOffset = pSiS->MyPIOOffset = (IOADDRESS)pSiS->IOPBase - 0x380;
+#endif
+ }
+#endif
+
+ /* Map 64k VGA window for saving/restoring CGA fonts */
+#ifdef SIS_PC_PLATFORM
if(pSiS->Primary) {
- VGAHWPTR(pScrn)->MapSize = 0x10000; /* Standard 64k VGA window */
+ VGAHWPTR(pScrn)->MapSize = 0x10000;
if(!vgaHWMapMem(pScrn)) {
- SISErrorLog(pScrn, "Could not map VGA memory\n");
SISFreeRec(pScrn);
return FALSE;
}
}
+#endif
+
vgaHWGetIOBase(VGAHWPTR(pScrn));
- /* We "patch" the PIOOffset inside vgaHW in order to force
- * the vgaHW module to use our relocated i/o ports.
- */
- VGAHWPTR(pScrn)->PIOOffset = pSiS->IODBase + (pSiS->PciInfo->ioBase[2] & 0xFFFC) - 0x380;
-
pSiS->pInt = NULL;
if(!pSiS->Primary) {
#if !defined(__alpha__)
@@ -2482,7 +2644,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
* Set the Chipset and ChipRev, allowing config file entries to
* override. DANGEROUS!
*/
- if(pSiS->pEnt->device->chipset && *pSiS->pEnt->device->chipset) {
+ if(pSiS->pEnt->device->chipset && *pSiS->pEnt->device->chipset) {
pScrn->chipset = pSiS->pEnt->device->chipset;
pSiS->Chipset = xf86StringToToken(SISChipsets, pScrn->chipset);
from = X_CONFIG;
@@ -2556,11 +2718,16 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
SISFreeRec(pScrn);
return FALSE;
}
+
+ /* Always do a ValidMode() inside Switchmode() */
+ pSiS->skipswitchcheck = FALSE;
/* Determine chipset and VGA engine type */
pSiS->ChipFlags = 0;
pSiS->SiS_SD_Flags = 0;
pSiS->HWCursorMBufNum = pSiS->HWCursorCBufNum = 0;
+ pSiS->NeedFlush = FALSE;
+ pSiS->NewCRLayout = FALSE;
switch(pSiS->Chipset) {
case PCI_CHIP_SIS300:
@@ -2636,7 +2803,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->VGAEngine = SIS_315_VGA;
pSiS->ChipFlags |= SiSCF_XabreCore;
pSiS->SiS_SD_Flags |= SiS_SD_IS330SERIES;
- pSiS->myCR63 = 0x63;
+ pSiS->myCR63 = 0x53; /* sic! */
pSiS->mmioSize = 256;
break;
case PCI_CHIP_SIS660: /* 660, 661, 741, 760 */
@@ -2647,11 +2814,13 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->sishw_ext.jChipType = SIS_660;
pSiS->ChipFlags |= SiSCF_Ultra256Core;
pSiS->mmioSize = 256;
+ pSiS->NeedFlush = TRUE;
break;
case 0x07601039:
pSiS->sishw_ext.jChipType = SIS_760;
pSiS->ChipFlags |= SiSCF_Ultra256Core;
pSiS->mmioSize = 256;
+ pSiS->NeedFlush = TRUE;
break;
case 0x07411039:
pSiS->sishw_ext.jChipType = SIS_741;
@@ -2673,9 +2842,19 @@ 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 */
+ pSiS->myCR63 = 0x53; /* sic! */
+ pSiS->NewCRLayout = TRUE;
}
break;
+ case PCI_CHIP_SIS340:
+ pSiS->sishw_ext.jChipType = SIS_340;
+ pSiS->VGAEngine = SIS_315_VGA;
+ pSiS->ChipFlags |= SiSCF_XabreCore;
+ pSiS->SiS_SD_Flags |= SiS_SD_IS340SERIES;
+ pSiS->myCR63 = 0x53; /* sic! */
+ pSiS->mmioSize = 256;
+ pSiS->NewCRLayout = TRUE;
+ break;
case PCI_CHIP_SIS530:
pSiS->sishw_ext.jChipType = SIS_530;
pSiS->VGAEngine = SIS_530_VGA;
@@ -2693,9 +2872,9 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
* We use this for checking where sisfb starts its memory
* heap in order to automatically detect the correct MaxXFBMem
* setting (which normally is given by the option of the same name).
- * Under kernel 2.4.y, that only works if sisfb is completely
+ * Under a 2.4 kernel, that only works if sisfb is completely
* running, ie with a video mode because the fbdev will not be
- * installed otherwise. Under 2.5 and later, sisfb will install
+ * installed otherwise. Under 2.6 and later, sisfb will install
* the framebuffer device in any way and running it with mode=none
* is no longer supported (or necessary).
*/
@@ -2709,132 +2888,181 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->sisfb_haveemi = FALSE;
pSiS->OldMode = 0;
pSiS->sisfbfound = FALSE;
+ pSiS->sisfb_tvposvalid = FALSE;
+ pSiS->sisfbdevname[0] = 0;
+ pSiS->sisfb_havelock = FALSE;
if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) {
- int fd, i;
- sisfb_info mysisfbinfo;
- char name[10];
- CARD32 sisfbversion;
+ int fd, i;
+ CARD32 sisfbinfosize = 0;
+ sisfb_info *mysisfbinfo;
+ CARD32 sisfbversion;
+ char name[16];
- {
- i=0;
- do {
+ i=0;
+ do {
+
+ if(i <= 7) {
sprintf(name, "/dev/fb%1d", i);
- if((fd = open(name, 'r')) != -1) {
-
- if(!ioctl(fd, SISFB_GET_INFO, &mysisfbinfo)) {
-
- if(mysisfbinfo.sisfb_id == SISFB_ID) {
-
- sisfbversion = (mysisfbinfo.sisfb_version << 16) |
- (mysisfbinfo.sisfb_revision << 8) |
- (mysisfbinfo.sisfb_patchlevel);
-
- if(sisfbversion >= 0x010508) {
- /* Added PCI bus/slot/func into in sisfb Version 1.5.08.
- Check this to make sure we run on the same card as sisfb
- */
- if((mysisfbinfo.sisfb_pcibus == pSiS->PciInfo->bus) &&
- (mysisfbinfo.sisfb_pcislot == pSiS->PciInfo->device) &&
- (mysisfbinfo.sisfb_pcifunc == pSiS->PciInfo->func) ) {
- pSiS->sisfbfound = TRUE;
- }
- } else pSiS->sisfbfound = TRUE;
+ } else {
+ sprintf(name, "/dev/fb/%1d", i-8);
+ }
+
+ if((fd = open(name, 'r')) != -1) {
+
+ Bool gotit = FALSE;
+
+ if(!ioctl(fd, SISFB_GET_INFO_SIZE, &sisfbinfosize)) {
+ if((mysisfbinfo = xalloc(sisfbinfosize))) {
+ if(!ioctl(fd, (SISFB_GET_INFO | (sisfbinfosize << 16)), mysisfbinfo)) {
+ gotit = TRUE;
+ } else {
+ xfree(mysisfbinfo);
+ mysisfbinfo = NULL;
+ }
+ }
+ } else {
+ if((mysisfbinfo = xalloc(sizeof(*mysisfbinfo)+16))) {
+ if(!ioctl(fd, SISFB_GET_INFO_OLD, mysisfbinfo)) {
+ gotit = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Possibly old version of sisfb detected. Please update.\n");
+ } else {
+ xfree(mysisfbinfo);
+ mysisfbinfo = NULL;
+ }
+ }
+ }
+
+ if(gotit) {
+
+ if(mysisfbinfo->sisfb_id == SISFB_ID) {
+
+ sisfbversion = (mysisfbinfo->sisfb_version << 16) |
+ (mysisfbinfo->sisfb_revision << 8) |
+ (mysisfbinfo->sisfb_patchlevel);
+
+ if(sisfbversion >= 0x010508) {
+ /* Added PCI bus/slot/func into in sisfb Version 1.5.08.
+ * Check this to make sure we run on the same card as sisfb
+ */
+ if((mysisfbinfo->sisfb_pcibus == pSiS->PciInfo->bus) &&
+ (mysisfbinfo->sisfb_pcislot == pSiS->PciInfo->device) &&
+ (mysisfbinfo->sisfb_pcifunc == pSiS->PciInfo->func) ) {
+ pSiS->sisfbfound = TRUE;
+ }
+ } else pSiS->sisfbfound = TRUE;
- if(pSiS->sisfbfound) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ if(pSiS->sisfbfound) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"%s: SiS kernel fb driver (sisfb) %d.%d.%d detected (PCI: %02d:%02d.%d)\n",
&name[5],
- mysisfbinfo.sisfb_version,
- mysisfbinfo.sisfb_revision,
- mysisfbinfo.sisfb_patchlevel,
+ mysisfbinfo->sisfb_version,
+ mysisfbinfo->sisfb_revision,
+ mysisfbinfo->sisfb_patchlevel,
pSiS->PciInfo->bus,
pSiS->PciInfo->device,
pSiS->PciInfo->func);
- /* Added version/rev/pl in sisfb 1.4.0 */
- if(mysisfbinfo.sisfb_version == 0) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Old version of sisfb found. Please update\n");
- }
- pSiS->sisfbMem = mysisfbinfo.heapstart;
- /* Basically, we can't trust the pdc register if sisfb is loaded */
- pSiS->donttrustpdc = TRUE;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "sisfb: memory heap starts at %dKB\n", (int)pSiS->sisfbMem);
+ /* Added version/rev/pl in sisfb 1.4.0 */
+ if(mysisfbinfo->sisfb_version == 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Old version of sisfb found. Please update.\n");
+ }
+ pSiS->sisfbMem = mysisfbinfo->heapstart;
+ /* Basically, we can't trust the pdc register if sisfb is loaded */
+ pSiS->donttrustpdc = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "sisfb: memory heap starts at %dKB\n", (int)pSiS->sisfbMem);
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "sisfb: using video mode 0x%02x\n", mysisfbinfo->fbvidmode);
+ pSiS->OldMode = mysisfbinfo->fbvidmode;
+ if(sisfbversion >= 0x010506) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "sisfb: using video mode 0x%02x\n", mysisfbinfo.fbvidmode);
- pSiS->OldMode = mysisfbinfo.fbvidmode;
- if(sisfbversion >= 0x010506) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "sisfb: %sreserved hardware cursor, using %s command queue\n",
- (mysisfbinfo.sisfb_caps & 0x80) ? "" : "not ",
- (mysisfbinfo.sisfb_caps & 0x40) ? "SiS300 Turbo" :
- (mysisfbinfo.sisfb_caps & 0x20) ? "SiS315/330 AGP" :
- (mysisfbinfo.sisfb_caps & 0x10) ? "SiS315/330 VRAM" :
- (mysisfbinfo.sisfb_caps & 0x08) ? "SiS315/330 MMIO" :
+ "sisfb: %sreserved HW cursor, using %s cmd queue\n",
+ (mysisfbinfo->sisfb_caps & 0x80) ? "" : "not ",
+ (mysisfbinfo->sisfb_caps & 0x40) ? "SiS300 Turbo" :
+ (mysisfbinfo->sisfb_caps & 0x20) ? "SiS315/330/340 AGP" :
+ (mysisfbinfo->sisfb_caps & 0x10) ? "SiS315/330/340 VRAM" :
+ (mysisfbinfo->sisfb_caps & 0x08) ? "SiS315/330/340 MMIO" :
"no");
- }
- if(sisfbversion >= 0x01050A) {
- /* We can trust the pdc value if sisfb is of recent version */
- if(pSiS->VGAEngine == SIS_300_VGA) pSiS->donttrustpdc = FALSE;
- if(sisfbversion >= 0x01050B) {
- 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) {
- if(pSiS->VGAEngine == SIS_315_VGA) {
- pSiS->sisfblcda = mysisfbinfo.sisfb_lcda;
- }
- if(sisfbversion >= 0x01060D) {
- pSiS->sisfbscalelcd = mysisfbinfo.sisfb_scalelcd;
- pSiS->sisfbspecialtiming = mysisfbinfo.sisfb_specialtiming;
- }
- if(sisfbversion >= 0x010610) {
- 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;
- }
- }
- }
+ }
+ if(sisfbversion >= 0x01050A) {
+ /* We can trust the pdc value if sisfb is of recent version */
+ if(pSiS->VGAEngine == SIS_300_VGA) pSiS->donttrustpdc = FALSE;
+ }
+ if(sisfbversion >= 0x01050B) {
+ 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) {
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ pSiS->sisfblcda = mysisfbinfo->sisfb_lcda;
+ }
+ }
+ if(sisfbversion >= 0x01060D) {
+ pSiS->sisfbscalelcd = mysisfbinfo->sisfb_scalelcd;
+ pSiS->sisfbspecialtiming = mysisfbinfo->sisfb_specialtiming;
+ }
+ if(sisfbversion >= 0x010610) {
+ 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;
}
- }
- }
+ }
+ }
}
- }
+ if(sisfbversion >= 0x010700) {
+ pSiS->sisfb_havelock = TRUE;
+ if(sisfbversion >= 0x010701) {
+ pSiS->sisfb_tvxpos = mysisfbinfo->sisfb_tvxpos;
+ pSiS->sisfb_tvypos = mysisfbinfo->sisfb_tvypos;
+ pSiS->sisfb_tvposvalid = TRUE;
+ }
+ }
+ }
}
- close (fd);
- }
- i++;
- } while((i <= 7) && (!pSiS->sisfbfound));
- if(!pSiS->sisfbfound) xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "sisfb not found\n");
+ xfree(mysisfbinfo);
+ mysisfbinfo = NULL;
+ }
+ close (fd);
+ }
+ i++;
+ } while((i <= 15) && (!pSiS->sisfbfound));
+
+ if(pSiS->sisfbfound) {
+ strncpy(pSiS->sisfbdevname, name, 15);
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "sisfb not found\n");
}
}
-
+
/*
* The first thing we should figure out is the depth, bpp, etc.
+ * Set SupportConvert... flags since we use the fb layer which
+ * supports this conversion. (24to32 seems not implemented though)
* Additionally, determine the size of the HWCursor memory area.
*/
switch(pSiS->VGAEngine) {
@@ -2848,12 +3076,15 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
break;
case SIS_530_VGA:
pSiS->CursorSize = 2048;
- pix24flags = Support32bppFb |
- Support24bppFb;
+ pix24flags = Support32bppFb |
+ Support24bppFb |
+ SupportConvert32to24;
break;
default:
pSiS->CursorSize = 2048;
- pix24flags = Support24bppFb;
+ pix24flags = Support24bppFb |
+ SupportConvert32to24 |
+ PreferConvert32to24;
break;
}
@@ -2942,7 +3173,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
/* Get our relocated IO registers */
- pSiS->RelIO = (SISIOADDRESS)((pSiS->PciInfo->ioBase[2] & 0xFFFC) + pSiS->IODBase);
+ pSiS->RelIO = (SISIOADDRESS)(pSiS->PciInfo->ioBase[2] + pSiS->IODBase);
pSiS->sishw_ext.ulIOAddress = (SISIOADDRESS)(pSiS->RelIO + 0x30);
xf86DrvMsg(pScrn->scrnIndex, from, "Relocated IO registers at 0x%lX\n",
(unsigned long)pSiS->RelIO);
@@ -3168,7 +3399,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
/* Unlock registers */
sisSaveUnlockExtRegisterLock(pSiS, &srlockReg, &crlockReg);
- /* Read BIOS for 300 and 315/330 series customization */
+ /* Read BIOS for 300 and 315/330/340 series customization */
pSiS->sishw_ext.pjVirtualRomBase = NULL;
pSiS->BIOS = NULL;
pSiS->sishw_ext.UseROM = FALSE;
@@ -3190,33 +3421,37 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
"Could not allocate memory for video BIOS image\n");
} else {
unsigned long segstart;
- unsigned short romptr, pciid;
- BOOLEAN found;
-
- found = FALSE;
- for(segstart=BIOS_BASE; segstart<0x000f0000; segstart+=0x00001000) {
+ unsigned short mypciid = pSiS->Chipset;
+ BOOLEAN found = FALSE, readpci = FALSE;
+
+ switch(pSiS->sishw_ext.jChipType) {
+ case SIS_300: readpci = TRUE; break;
+ case SIS_315: mypciid = PCI_CHIP_SIS315; readpci = TRUE; break;
+ case SIS_315PRO: mypciid = PCI_CHIP_SIS315PRO; readpci = TRUE; break;
+ case SIS_315H: readpci = TRUE; break;
+ case SIS_330: readpci = TRUE; break;
+ case SIS_340: readpci = TRUE; break;
+ }
+
+ if(readpci) {
+ xf86ReadPciBIOS(0, pSiS->PciTag, 0, pSiS->BIOS, BIOS_SIZE);
+ if(SISCheckBIOS(pSiS, mypciid)) found = TRUE;
+ }
+
+ if(!found) {
+ for(segstart=BIOS_BASE; segstart<0x000f0000; segstart+=0x00001000) {
#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
- if(xf86ReadBIOS(segstart, 0, pSiS->BIOS, BIOS_SIZE) != BIOS_SIZE) continue;
+ if(xf86ReadBIOS(segstart, 0, pSiS->BIOS, BIOS_SIZE) != BIOS_SIZE) continue;
#else
- if(xf86ReadDomainMemory(pSiS->PciTag, segstart, BIOS_SIZE, pSiS->BIOS) != BIOS_SIZE) continue;
+ if(xf86ReadDomainMemory(pSiS->PciTag, segstart, BIOS_SIZE, pSiS->BIOS) != BIOS_SIZE) continue;
#endif
- if((pSiS->BIOS[0] != 0x55) || (pSiS->BIOS[1] != 0xaa)) continue;
-
- 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;
+ if(!SISCheckBIOS(pSiS, mypciid)) continue;
- pciid = pSiS->BIOS[romptr+6] | (pSiS->BIOS[romptr+7] << 8);
- if(pciid != pSiS->Chipset) continue;
-
- found = TRUE;
- break;
+ found = TRUE;
+ break;
+ }
}
if(!found) {
@@ -3225,12 +3460,13 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
xfree(pSiS->BIOS);
pSiS->BIOS = NULL;
} else {
+ unsigned short romptr;
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 (%s data layout)\n",
- &pSiS->BIOS[romptr], segstart, pSiS->ROM661New ? "new" : "old");
+ "Video BIOS version \"%7s\" found (%s data layout)\n",
+ &pSiS->BIOS[romptr], pSiS->ROM661New ? "new" : "old");
#ifdef SISDUALHEAD
if(pSiSEnt) {
pSiSEnt->BIOS = pSiS->BIOS;
@@ -3311,6 +3547,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiSEnt->AllowHotkey = pSiS->AllowHotkey;
pSiSEnt->enablesisctrl = pSiS->enablesisctrl;
pSiSEnt->SenseYPbPr = pSiS->SenseYPbPr;
+ pSiSEnt->XvDefAdaptorBlit = pSiS->XvDefAdaptorBlit;
#ifdef SIS_CP
SIS_CP_DRIVER_COPYOPTIONSENT
#endif
@@ -3391,7 +3628,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
pSiS->XvOnCRT2 = pSiSEnt->XvOnCRT2;
pSiS->enablesisctrl = pSiSEnt->enablesisctrl;
- /* Copy gamma brightness to Ent for Xinerama */
+ pSiS->XvDefAdaptorBlit = pSiSEnt->XvDefAdaptorBlit;
+ /* Copy gamma brightness to Ent (sic!) for Xinerama */
pSiSEnt->GammaBriR = pSiS->GammaBriR;
pSiSEnt->GammaBriG = pSiS->GammaBriG;
pSiSEnt->GammaBriB = pSiS->GammaBriB;
@@ -3513,7 +3751,6 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->FbMapSize = pSiS->availMem = pScrn->videoRam * 1024;
pSiS->sishw_ext.ulVideoMemorySize = pScrn->videoRam * 1024;
- pSiS->sishw_ext.bSkipDramSizing = TRUE;
/* Calculate real availMem according to Accel/TurboQueue and
* HWCursur setting. Also, initialize some variables used
@@ -3692,8 +3929,10 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->ChipFlags |= SiSCF_LARGEOVERLAY;
break;
case PCI_CHIP_SIS330:
- pSiS->ChipFlags |= SiSCF_LARGEOVERLAY;
pSiS->ChipFlags |= SiSCF_CRT2HWCKaputt;
+ /* Fall through */
+ case PCI_CHIP_SIS340:
+ pSiS->ChipFlags |= SiSCF_LARGEOVERLAY;
break;
case PCI_CHIP_SIS660:
{
@@ -3849,7 +4088,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
int i = 0, j;
unsigned short bversptr = 0;
BOOLEAN footprint;
- unsigned long chksum = 0;
+ CARD32 chksum = 0;
if(pSiS->sishw_ext.UseROM) {
bversptr = pSiS->BIOS[0x16] | (pSiS->BIOS[0x17] << 8);
@@ -3907,13 +4146,13 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
SISCRT1PreInit(pScrn);
/* Detect LCD (connected via CRT2, regardless of LCDA) and LCD resolution */
- SISLCDPreInit(pScrn);
+ SISLCDPreInit(pScrn, FALSE);
/* LCDA only supported under these conditions: */
if(pSiS->ForceCRT1Type == CRT1_LCDA) {
if( ((pSiS->sishw_ext.jChipType != SIS_650) &&
(pSiS->sishw_ext.jChipType < SIS_661)) ||
- (!(pSiS->VBFlags & (VB_301C | VB_302B | VB_301LV | VB_302LV))) ) {
+ (!(pSiS->VBFlags & VB_SISLCDABRIDGE)) ) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Chipset/Video bridge does not support LCD-via-CRT1\n");
pSiS->ForceCRT1Type = CRT1_VGA;
@@ -3933,39 +4172,44 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
#ifdef ENABLE_YPBPR
if((pSiS->VGAEngine == SIS_315_VGA) &&
- (pSiS->VBFlags & (VB_301C|VB_301LV|VB_302LV|VB_302ELV))) {
+ (pSiS->VBFlags & VB_SISYPBPRBRIDGE)) {
pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTYPBPR;
- if((pSiS->Chipset == PCI_CHIP_SIS660) || (pSiS->VBFlags & VB_301C)) {
+ if(pSiS->VBFlags & VB_SISYPBPRARBRIDGE) {
pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTYPBPRAR;
}
}
- if(pSiS->VBFlags & (VB_301|VB_301B|VB_302B)) {
+ if(pSiS->VBFlags & VB_SISHIVISIONBRIDGE) {
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;
- }
+ if((pSiS->VGAEngine != SIS_300_VGA) || (!(pSiS->VBFlags & VB_TRUMPION))) {
+ pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTSCALE;
+ if((pSiS->VBFlags & VB_SISTMDSBRIDGE) &&
+ (!(pSiS->VBFlags & VB_30xBDH))) {
+ pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTCENTER;
}
}
+
+#ifdef SISDUALHEAD
+ if(!pSiS->DualHeadMode) {
+ pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTREDETECT;
+ }
+#endif
-#ifdef TWDEBUG /* @@@ TEST @@@ */
+#ifdef TWDEBUG /* FOR TESTING */
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);
+ SISTVPreInit(pScrn, FALSE);
/* Detect CRT2-VGA */
- SISCRT2PreInit(pScrn);
+ SISCRT2PreInit(pScrn, FALSE);
/* Backup detected CRT2 devices */
- pSiS->detectedCRT2Devices = pSiS->VBFlags & (CRT2_LCD|CRT2_TV|CRT2_VGA|TV_AVIDEO|TV_SVIDEO|TV_SCART|TV_HIVISION|TV_YPBPR);
+ SISSaveDetectedDevices(pScrn);
if(!(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPR)) {
if((pSiS->ForceTVType != -1) && (pSiS->ForceTVType & TV_YPBPR)) {
@@ -3989,7 +4233,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
((pSiS->VBFlags & VB_CHRONTEL) && (pSiS->ChrontelType == CHRONTEL_700x))) {
pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTTVPOS;
}
- if(pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)) {
+ if(pSiS->VBFlags & VB_SISVGA2BRIDGE) {
pSiS->SiS_SD_Flags |= (SiS_SD_SUPPORTSCART | SiS_SD_SUPPORTVGA2);
}
if(pSiS->VBFlags & VB_CHRONTEL) {
@@ -3999,14 +4243,10 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
}
- if( ((pSiS->sishw_ext.jChipType == SIS_650) ||
- (pSiS->sishw_ext.jChipType >= SIS_661)) &&
- (pSiS->VBFlags & (VB_301C | VB_302B | VB_301LV | VB_302LV)) &&
- (pSiS->VBFlags & CRT2_LCD) &&
- (pSiS->VESA != 1) ) {
- pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTLCDA;
- } else {
- /* Paranoia */
+ SISDetermineLCDACap(pScrn);
+ if((!(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTLCDA)) ||
+ (!(pSiS->VBFlags & CRT2_LCD))) {
+ /* No LCDA if not supported or no LCD panel found */
pSiS->ForceCRT1Type = CRT1_VGA;
}
@@ -4028,7 +4268,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->ForceCRT2Type = CRT2_LCD;
else if(pSiS->VBFlags & CRT2_TV)
pSiS->ForceCRT2Type = CRT2_TV;
- else if(pSiS->VBFlags & CRT2_VGA)
+ else if((pSiS->VBFlags & CRT2_VGA) && (pSiS->ForceCRT1Type == CRT1_VGA))
pSiS->ForceCRT2Type = CRT2_VGA;
}
@@ -4055,7 +4295,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
break;
case CRT2_VGA:
pSiS->VBFlags &= ~(CRT2_TV | CRT2_LCD);
- if(pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B))
+ if(pSiS->VBFlags & VB_SISVGA2BRIDGE)
pSiS->VBFlags |= CRT2_VGA;
else {
pSiS->VBFlags &= ~(CRT2_VGA);
@@ -4086,7 +4326,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
(float)((float)pSiS->XvGammaBlue / 1000));
if(!pSiS->CRT1gamma) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Separate Xv gamma corr. only effective if CRT1 gamma corr. is enabled\n");
+ "Xv gamma correction only effective if CRT1 gamma corr. is enabled\n");
}
}
}
@@ -4246,8 +4486,16 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
}
- /* SCART only supported for PAL */
+
if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
+ /* Default to PAL */
+ if(pSiS->VBFlags & (TV_SVIDEO | TV_AVIDEO)) {
+ if(!(pSiS->VBFlags & (TV_PAL | TV_NTSC))) {
+ pSiS->VBFlags &= ~(TV_PAL | TV_NTSC | TV_PALN | TV_PALM | TV_NTSCJ);
+ pSiS->VBFlags |= TV_PAL;
+ }
+ }
+ /* SCART only supported for PAL */
if((pSiS->VBFlags & VB_SISBRIDGE) && (pSiS->VBFlags & TV_SCART)) {
pSiS->VBFlags &= ~(TV_NTSC | TV_PALN | TV_PALM | TV_NTSCJ);
pSiS->VBFlags |= TV_PAL;
@@ -4519,7 +4767,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
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->VBFlags & VB_SISLVDSBRIDGE) {
if(pSiS->sisfbpdc != 0xff) {
pSiS->SiS_Pr->PDC = pSiS->sisfbpdc;
@@ -4575,7 +4823,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
/* Let user override (for all bridges) */
- if(pSiS->VBFlags & (VB_301B | VB_301C | VB_301LV | VB_302LV | VB_302ELV)) {
+ if(pSiS->VBFlags & (VB_301B | VB_301C | VB_SISLVDSBRIDGE)) {
if(pSiS->PDC != -1) {
pSiS->SiS_Pr->PDC = pSiS->PDC & 0x1f;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
@@ -4689,7 +4937,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
/* Now for something completely different: DDC.
- * For 300 and 315/330 series, we provide our
+ * For 300 and 315/330/340 series, we provide our
* own functions (in order to probe CRT2 as well)
* If these fail, use the VBE.
* All other chipsets will use VBE. No need to re-invent
@@ -4827,45 +5075,108 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
#endif
- /* If there is no HSync or VRefresh data for the monitor,
- * derive it from DDC data. Done by common layer since
- * 4.3.99.14.
- */
+ /* If there is no HSync or VRefresh data for the monitor,
+ * derive it from DDC data. Done by common layer since
+ * 4.3.99.14.
+ * Addendum: I overrule the ranges now in any case unless
+ * it would affect a CRT output device. Hence, for LCD(A)
+ * and TV, we always get proper ranges. This is entirely
+ * harmless. However, option "NoOverruleRanges" will
+ * disable this behavior.
+ * This should "fix" the - by far - most common configuration
+ * mistakes.
+ */
+ if((pScrn->monitor->nHsync <= 0) || (pSiS->OverruleRanges)) {
#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,14,0)
- if(pScrn->monitor->DDC) {
- if(pScrn->monitor->nHsync <= 0) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, subshstr,
+ if((pScrn->monitor->nHsync <= 0) && (pScrn->monitor->DDC)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, subshstr,
#ifdef SISDUALHEAD
pSiS->DualHeadMode ? (pSiS->SecondHead ? 1 : 2) :
#endif
pSiS->CRT1off ? 2 : 1);
- SiSSetSyncRangeFromEdid(pScrn, 1);
+ SiSSetSyncRangeFromEdid(pScrn, 1);
}
- if(pScrn->monitor->nVrefresh <= 0) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, subsvstr,
+#endif
+ if((pScrn->monitor->nHsync <= 0) || (pSiS->OverruleRanges)) {
+ if(SiSAllowSyncOverride(pSiS)) {
+ /* Set sane ranges for LCD and TV
+ * (our strict checking will filter out invalid ones anyway)
+ */
+ pScrn->monitor->nHsync = 1;
+ pScrn->monitor->hsync[0].lo = 28;
+ pScrn->monitor->hsync[0].hi = 80;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, saneh,
#ifdef SISDUALHEAD
pSiS->DualHeadMode ? (pSiS->SecondHead ? 1 : 2) :
#endif
- pSiS->CRT1off ? 2 : 1);
- SiSSetSyncRangeFromEdid(pScrn, 0);
+ pSiS->CRT1off ? 2 : 1);
+ }
}
}
+
+ if((pScrn->monitor->nVrefresh <= 0) || (pSiS->OverruleRanges)) {
+#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,14,0)
+ if((pScrn->monitor->nVrefresh <= 0) && (pScrn->monitor->DDC)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, subsvstr,
+#ifdef SISDUALHEAD
+ pSiS->DualHeadMode ? (pSiS->SecondHead ? 1 : 2) :
#endif
+ pSiS->CRT1off ? 2 : 1);
+ SiSSetSyncRangeFromEdid(pScrn, 0);
+ }
+#endif
+ if((pScrn->monitor->nVrefresh <= 0) || (pSiS->OverruleRanges)) {
+ if(SiSAllowSyncOverride(pSiS)) {
+ /* Set sane ranges for LCD and TV */
+ pScrn->monitor->nVrefresh = 1;
+ pScrn->monitor->vrefresh[0].lo = 56; /* 56 for 720/768x576 */
+ pScrn->monitor->vrefresh[0].hi = 71; /* 71 for 640x400 */
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, sanev,
+#ifdef SISDUALHEAD
+ pSiS->DualHeadMode ? (pSiS->SecondHead ? 1 : 2) :
+#endif
+ pSiS->CRT1off ? 2 : 1);
+ }
+ }
+ }
+
#ifdef SISMERGED
if(pSiS->MergedFB) {
+ if((pSiS->CRT2pScrn->monitor->nHsync <= 0) || (pSiS->OverruleRanges)) {
#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,14,0)
- if(pSiS->CRT2pScrn->monitor->DDC) {
- if(pSiS->CRT2pScrn->monitor->nHsync <= 0) {
+ if((pSiS->CRT2pScrn->monitor->nHsync <= 0) && (pSiS->CRT2pScrn->monitor->DDC)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, subshstr, 2);
SiSSetSyncRangeFromEdid(pSiS->CRT2pScrn, 1);
}
- if(pSiS->CRT2pScrn->monitor->nVrefresh <= 0) {
+#endif
+ if((pSiS->CRT2pScrn->monitor->nHsync <= 0) || (pSiS->OverruleRanges)) {
+ if(pSiS->VBFlags & (CRT2_TV | CRT2_LCD)) {
+ /* Set sane ranges for LCD and TV */
+ pSiS->CRT2pScrn->monitor->nHsync = 1;
+ pSiS->CRT2pScrn->monitor->hsync[0].lo = 28;
+ pSiS->CRT2pScrn->monitor->hsync[0].hi = 80;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, saneh, 2);
+ }
+ }
+ }
+ if((pSiS->CRT2pScrn->monitor->nVrefresh <= 0) || (pSiS->OverruleRanges)) {
+#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,14,0)
+ if((pSiS->CRT2pScrn->monitor->nVrefresh <= 0) && (pSiS->CRT2pScrn->monitor->DDC)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, subsvstr, 2);
SiSSetSyncRangeFromEdid(pSiS->CRT2pScrn, 0);
}
+#endif
+ if((pSiS->CRT2pScrn->monitor->nVrefresh <= 0) || (pSiS->OverruleRanges)) {
+ if(pSiS->VBFlags & (CRT2_TV | CRT2_LCD)) {
+ /* Set sane ranges for LCD and TV */
+ pSiS->CRT2pScrn->monitor->nVrefresh = 1;
+ pSiS->CRT2pScrn->monitor->vrefresh[0].lo = 56; /* 56 for 768/720x576 */
+ pSiS->CRT2pScrn->monitor->vrefresh[0].hi = 71; /* 71 for 640x400 */
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, sanev, 2);
+ }
+ }
}
-#endif
xf86DrvMsg(pScrn->scrnIndex, X_INFO, crtsetupstr, 1);
}
@@ -4925,57 +5236,98 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
clockRanges->doubleScanAllowed = TRUE;
/*
- * Since we have lots of built-in modes for 300/315/330 series
+ * Since we have lots of built-in modes for 300/315/330/340 series
* with vb support, we replace the given default mode list with our
* own. In case the video bridge is to be used, we only allow other
* modes if
* -) vbtype is 301, 301B, 301C or 302B, and
* -) crt2 device is not TV, and
- * -) crt1 is not LCDA
+ * -) crt1 is not LCDA, unless bridge is TMDS/LCDA capable (301C)
*/
if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
if(!(pSiS->noInternalModes)) {
- BOOLEAN acceptcustommodes = TRUE;
- BOOLEAN includelcdmodes = TRUE;
- BOOLEAN isfordvi = FALSE;
+ BOOLEAN acceptcustommodes = TRUE; /* Accept user modelines */
+ BOOLEAN includelcdmodes = TRUE; /* Include modes reported by DDC */
+ BOOLEAN isfordvi = FALSE; /* Is for digital DVI output */
if(pSiS->UseVESA) {
acceptcustommodes = FALSE;
includelcdmodes = FALSE;
}
-#ifdef SISDUALHEAD
+#ifdef SISDUALHEAD /* Dual head is static. Output devices will not change. */
if(pSiS->DualHeadMode) {
if(!pSiS->SecondHead) {
- if((pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)) && (!(pSiS->VBFlags & VB_30xBDH))) {
- if(!(pSiS->VBFlags & (CRT2_LCD|CRT2_VGA))) includelcdmodes = FALSE;
- if(pSiS->VBFlags & CRT2_LCD) isfordvi = TRUE;
- if(pSiS->VBFlags & CRT2_TV) acceptcustommodes = FALSE;
+ if(pSiS->VBFlags & VB_SISTMDSBRIDGE) {
+ if(!(pSiS->VBFlags & VB_30xBDH)) {
+ if(!(pSiS->VBFlags & (CRT2_LCD|CRT2_VGA))) includelcdmodes = FALSE;
+ if(pSiS->VBFlags & CRT2_LCD) isfordvi = TRUE;
+ if(pSiS->VBFlags & CRT2_TV) acceptcustommodes = FALSE;
+ } else {
+ if(pSiS->VBFlags & (CRT2_TV|CRT2_LCD)) {
+ acceptcustommodes = FALSE;
+ includelcdmodes = FALSE;
+ }
+ }
} else {
acceptcustommodes = FALSE;
includelcdmodes = FALSE;
}
clockRanges->interlaceAllowed = FALSE;
} else {
- includelcdmodes = FALSE;
- if(pSiS->VBFlags & CRT1_LCDA) {
- acceptcustommodes = FALSE;
- /* Ignore interlace, mode switching code will handle this */
+ if(pSiS->VBFlags & CRT1_LCDA) {
+ if(!(pSiS->VBFlags & VB_SISTMDSLCDABRIDGE)) {
+ acceptcustommodes = FALSE;
+ includelcdmodes = FALSE;
+ /* Will handle i-lace in mode-switching code */
+ } else {
+ isfordvi = TRUE;
+ /* Don't allow i-lace modes */
+ clockRanges->interlaceAllowed = FALSE;
+ }
+ } else {
+ includelcdmodes = FALSE;
}
}
} else
#endif
-#ifdef SISMERGED
+#ifdef SISMERGED /* MergedFB mode is not static. Output devices may change. */
if(pSiS->MergedFB) {
- includelcdmodes = FALSE;
if(pSiS->VBFlags & CRT1_LCDA) {
- acceptcustommodes = FALSE;
- /* Ignore interlace, mode switching code will handle this */
+ if(!(pSiS->VBFlags & VB_SISTMDSLCDABRIDGE)) {
+ acceptcustommodes = FALSE;
+ includelcdmodes = FALSE;
+ /* Will handle i-lace in mode-switching code */
+ } else {
+ isfordvi = TRUE;
+ /* Don't allow i-lace custom modes */
+ clockRanges->interlaceAllowed = FALSE;
+ }
+ } else {
+ includelcdmodes = FALSE;
}
} else
-#endif
- if((pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)) && (!(pSiS->VBFlags & VB_30xBDH))) {
- if(!(pSiS->VBFlags & (CRT2_LCD|CRT2_VGA))) includelcdmodes = FALSE;
- if(pSiS->VBFlags & CRT2_LCD) isfordvi = TRUE;
- if(pSiS->VBFlags & (CRT2_TV|CRT1_LCDA)) acceptcustommodes = FALSE;
+#endif /* Mirror mode is not static. Output devices may change. */
+ if(pSiS->VBFlags & VB_SISTMDSBRIDGE) {
+ if(!(pSiS->VBFlags & VB_30xBDH)) {
+ if(!(pSiS->VBFlags & VB_SISTMDSLCDABRIDGE)) {
+ if(!(pSiS->VBFlags & (CRT2_LCD|CRT2_VGA))) includelcdmodes = FALSE;
+ if(pSiS->VBFlags & CRT2_LCD) isfordvi = TRUE;
+ } else {
+ if(!(pSiS->VBFlags & (CRT2_LCD|CRT2_VGA|CRT1_LCDA))) includelcdmodes = FALSE;
+ if(pSiS->VBFlags & (CRT2_LCD|CRT1_LCDA)) isfordvi = TRUE;
+ }
+ /* Allow user modes, even if CRT2 is TV. Will be filtered through ValidMode();
+ * leaving the user modes here might have the advantage that such a mode, if
+ * it matches in resolution with a supported TV mode, allows us to drive eg.
+ * non standard panels, and still permits switching to TV. This mode will be
+ * "mapped" to a supported mode of identical resolution for TV. All this is
+ * taken care of by ValidMode() and ModeInit()/PresetMode().
+ */
+ } else {
+ if(pSiS->VBFlags & (CRT2_TV|CRT2_LCD)) {
+ acceptcustommodes = FALSE;
+ includelcdmodes = FALSE;
+ }
+ }
} else if(pSiS->VBFlags & (CRT2_ENABLE | CRT1_LCDA)) {
acceptcustommodes = FALSE;
includelcdmodes = FALSE;
@@ -4996,7 +5348,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
#endif
} else {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Building list of built-in modes failed, using X.Org defaults\n");
+ "Building list of built-in modes failed, using server defaults\n");
}
} else {
pSiS->HaveCustomModes = TRUE;
@@ -5173,7 +5525,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
xf86PruneDriverModes(pScrn);
if(i == 0 || pScrn->modes == NULL) {
- SISErrorLog(pScrn, "No valid modes found\n");
+ SISErrorLog(pScrn, "No valid modes found - check VertRefresh/HorizSync\n");
#ifdef SISDUALHEAD
if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE;
#endif
@@ -5224,10 +5576,17 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "Max pixel clock for CRT2 is %d MHz\n",
clockRanges->maxClock / 1000);
- if((pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)) && (!(pSiS->VBFlags & VB_30xBDH))) {
- if(!(pSiS->VBFlags & (CRT2_LCD|CRT2_VGA))) includelcdmodes = FALSE;
- if(pSiS->VBFlags & CRT2_LCD) isfordvi = TRUE;
- if(pSiS->VBFlags & CRT2_TV) acceptcustommodes = FALSE;
+ if(pSiS->VBFlags & VB_SISTMDSBRIDGE) {
+ if(!(pSiS->VBFlags & VB_30xBDH)) {
+ if(!(pSiS->VBFlags & (CRT2_LCD|CRT2_VGA))) includelcdmodes = FALSE;
+ if(pSiS->VBFlags & CRT2_LCD) isfordvi = TRUE;
+ /* See above for a remark on handling CRT2 = TV */
+ } else {
+ if(pSiS->VBFlags & (CRT2_LCD|CRT2_TV)) {
+ includelcdmodes = FALSE;
+ acceptcustommodes = FALSE;
+ }
+ }
} else {
includelcdmodes = FALSE;
acceptcustommodes = FALSE;
@@ -5414,18 +5773,22 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
xf86LoaderReqSymLists(shadowSymbols, NULL);
}
- /* Load the dri module if requested. */
+ /* Load the dri and glx modules if requested. */
#ifdef XF86DRI
if(pSiS->loadDRI) {
- if(xf86LoadSubModule(pScrn, "dri")) {
- xf86LoaderReqSymLists(driSymbols, drmSymbols, NULL);
- } else {
-#ifdef SISDUALHEAD
- if(!pSiS->DualHeadMode)
-#endif
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Remove >Load \"dri\"< from the Module section of your XF86Config file\n");
- }
+ if(!xf86LoaderCheckSymbol("DRIScreenInit")) {
+ if(xf86LoadSubModule(pScrn, "dri")) {
+ if(!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) {
+ if(xf86LoadSubModule(pScrn, "glx")) {
+ xf86LoaderReqSymLists(driSymbols, drmSymbols, NULL);
+ } else {
+ SISErrorLog(pScrn, "Failed to load glx module\n");
+ }
+ }
+ } else {
+ SISErrorLog(pScrn, "Failed to load dri module\n");
+ }
+ }
}
#endif
@@ -5495,13 +5858,81 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
#endif
if(pSiS->enablesisctrl) pSiS->SiS_SD_Flags |= SiS_SD_ENABLED;
+
+ pSiS->currentModeLast = pScrn->currentMode;
+ pSiS->VBFlagsInit = pSiS->VBFlags;
return TRUE;
}
+/*
+ * Map I/O port area for non-PC platforms
+ */
+#ifdef SIS_NEED_MAP_IOP
+static Bool
+SISMapIOPMem(ScrnInfoPtr pScrn)
+{
+ SISPtr pSiS = SISPTR(pScrn);
+#ifdef SISDUALHEAD
+ SISEntPtr pSiSEnt = pSiS->entityPrivate;
+
+ if(pSiS->DualHeadMode) {
+ pSiSEnt->MapCountIOPBase++;
+ if(!(pSiSEnt->IOPBase)) {
+ /* Only map if not mapped previously */
+ pSiSEnt->IOPBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO,
+ pSiS->PciTag, pSiS->IOPAddress, 128);
+ }
+ pSiS->IOPBase = pSiSEnt->IOPBase;
+ } else
+#endif
+ pSiS->IOPBase = xf86MapPciMem(pScrn->scrnIndex, mmioFlags,
+ pSiS->PciTag, pSiS->IOPAddress, 128);
+
+ if(pSiS->IOPBase == NULL) {
+ SISErrorLog(pScrn, "Could not map I/O port area\n");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static Bool
+SISUnmapIOPMem(ScrnInfoPtr pScrn)
+{
+ SISPtr pSiS = SISPTR(pScrn);
+#ifdef SISDUALHEAD
+ SISEntPtr pSiSEnt = pSiS->entityPrivate;;
+#endif
+
+/* In dual head mode, we must not unmap if the other head still
+ * assumes memory as mapped
+ */
+#ifdef SISDUALHEAD
+ if(pSiS->DualHeadMode) {
+ if(pSiSEnt->MapCountIOPBase) {
+ pSiSEnt->MapCountIOPBase--;
+ if((pSiSEnt->MapCountIOPBase == 0) || (pSiSEnt->forceUnmapIOPBase)) {
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOPBase, 2048);
+ pSiSEnt->IOPBase = NULL;
+ pSiSEnt->MapCountIOPBase = 0;
+ pSiSEnt->forceUnmapIOPBase = FALSE;
+ }
+ pSiS->IOPBase = NULL;
+ }
+ } else {
+#endif
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOPBase, 2048);
+ pSiS->IOPBase = NULL;
+#ifdef SISDUALHEAD
+ }
+#endif
+ return TRUE;
+}
+#endif
/*
- * Map the framebuffer and MMIO memory.
+ * Map the framebuffer and MMIO memory
*/
static Bool
@@ -5700,21 +6131,24 @@ SISSave(ScrnInfoPtr pScrn)
vgaReg = &VGAHWPTR(pScrn)->SavedReg;
sisReg = &pSiS->SavedReg;
- if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
- if((pSiS->VBFlags & VB_VIDEOBRIDGE) && (SiSBridgeIsInSlaveMode(pScrn))) {
- vgaHWSave(pScrn, vgaReg, VGA_SR_CMAP | VGA_SR_MODE);
- SiSRegInit(pSiS->SiS_Pr, pSiS->RelIO+0x30);
- SiSSetLVDSetc(pSiS->SiS_Pr, &pSiS->sishw_ext, 0);
- SiS_GetVBType(pSiS->SiS_Pr, &pSiS->sishw_ext);
- SiS_DisableBridge(pSiS->SiS_Pr, &pSiS->sishw_ext);
- vgaHWSave(pScrn, vgaReg, VGA_SR_FONTS);
- SiS_EnableBridge(pSiS->SiS_Pr, &pSiS->sishw_ext);
- } else {
- vgaHWSave(pScrn, vgaReg, VGA_SR_ALL);
- }
+ if( ((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) &&
+ ((pSiS->VBFlags & VB_VIDEOBRIDGE) && (SiSBridgeIsInSlaveMode(pScrn))) ) {
+ vgaHWSave(pScrn, vgaReg, VGA_SR_CMAP | VGA_SR_MODE);
+#ifdef SIS_PC_PLATFORM
+ SiSRegInit(pSiS->SiS_Pr, pSiS->RelIO+0x30);
+ SiSSetLVDSetc(pSiS->SiS_Pr, &pSiS->sishw_ext, 0);
+ SiS_GetVBType(pSiS->SiS_Pr, &pSiS->sishw_ext);
+ SiS_DisableBridge(pSiS->SiS_Pr, &pSiS->sishw_ext);
+ vgaHWSave(pScrn, vgaReg, VGA_SR_FONTS);
+ SiS_EnableBridge(pSiS->SiS_Pr, &pSiS->sishw_ext);
+#endif
} else {
+#ifdef SIS_PC_PLATFORM
vgaHWSave(pScrn, vgaReg, VGA_SR_ALL);
- }
+#else
+ vgaHWSave(pScrn, vgaReg, VGA_SR_CMAP | VGA_SR_MODE);
+#endif
+ }
sisSaveUnlockExtRegisterLock(pSiS,&sisReg->sisRegs3C4[0x05],&sisReg->sisRegs3D4[0x80]);
@@ -5736,6 +6170,7 @@ SISSave(ScrnInfoPtr pScrn)
}
}
+#ifdef SIS_PC_PLATFORM
static void
SiS_WriteAttr(SISPtr pSiS, int index, int value)
{
@@ -5753,12 +6188,14 @@ SiS_ReadAttr(SISPtr pSiS, int index)
outb(pSiS->IODBase + VGA_ATTR_INDEX, index);
return(inb(pSiS->IODBase + VGA_ATTR_DATA_R));
}
+#endif
#define SIS_FONTS_SIZE (8 * 8192)
static void
SiS_SaveFonts(ScrnInfoPtr pScrn)
{
+#ifdef SIS_PC_PLATFORM
SISPtr pSiS = SISPTR(pScrn);
unsigned char miscOut, attr10, gr4, gr5, gr6, seq2, seq4, scrn;
#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
@@ -5826,11 +6263,13 @@ SiS_SaveFonts(ScrnInfoPtr pScrn)
outSISIDXREG(SISGR, 0x05, gr5);
outSISIDXREG(SISGR, 0x06, gr6);
outSISREG(SISMISCW, miscOut);
+#endif
}
static void
SiS_RestoreFonts(ScrnInfoPtr pScrn)
{
+#ifdef SIS_PC_PLATFORM
SISPtr pSiS = SISPTR(pScrn);
unsigned char miscOut, attr10, gr1, gr3, gr4, gr5, gr6, gr8, seq2, seq4, scrn;
#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
@@ -5897,6 +6336,7 @@ SiS_RestoreFonts(ScrnInfoPtr pScrn)
outSISIDXREG(SISGR, 0x08, gr8);
outSISIDXREG(SISSR, 0x02, seq2);
outSISIDXREG(SISSR, 0x04, seq4);
+#endif
}
#undef SIS_FONTS_SIZE
@@ -6088,7 +6528,7 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
if(!SiSBIOSSetModeCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext, pScrn,
((SiSMergedDisplayModePtr)mode->Private)->CRT2,
- pSiS->IsCustomCRT2)) {
+ pSiS->IsCustom)) {
SISErrorLog(pScrn, "SiSBIOSSetModeCRT2() failed\n");
return FALSE;
}
@@ -6096,26 +6536,34 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
} else {
#endif
- if(pSiS->VBFlags & CRT1_LCDA) {
+ if((pSiS->VBFlags & CRT1_LCDA) || (!(mode->type & M_T_DEFAULT))) {
+
SiSPreSetMode(pScrn, mode, SIS_MODE_CRT1);
+
if(!SiSBIOSSetModeCRT1(pSiS->SiS_Pr, &pSiS->sishw_ext, pScrn,
mode, pSiS->IsCustom)) {
SISErrorLog(pScrn, "SiSBIOSSetModeCRT1() failed\n");
return FALSE;
}
+
SiSPreSetMode(pScrn, mode, SIS_MODE_CRT2);
+
if(!SiSBIOSSetModeCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext, pScrn,
mode, pSiS->IsCustom)) {
SISErrorLog(pScrn, "SiSBIOSSetModeCRT2() failed\n");
return FALSE;
}
+
} else {
+
SiSPreSetMode(pScrn, mode, SIS_MODE_SIMU);
+
if(!SiSBIOSSetMode(pSiS->SiS_Pr, &pSiS->sishw_ext, pScrn,
mode, pSiS->IsCustom)) {
- SISErrorLog(pScrn, "SiSBIOSSetModeCRT() failed\n");
+ SISErrorLog(pScrn, "SiSBIOSSetMode() failed\n");
return FALSE;
}
+
}
#ifdef SISMERGED
@@ -6141,7 +6589,7 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
/* Reset our PIOOffset as vgaHWInit might have reset it */
- VGAHWPTR(pScrn)->PIOOffset = pSiS->IODBase + (pSiS->PciInfo->ioBase[2] & 0xFFFC) - 0x380;
+ VGAHWPTR(pScrn)->PIOOffset = pSiS->MyPIOOffset;
/* Prepare the register contents */
if(!(*pSiS->ModeInit)(pScrn, mode)) {
@@ -6183,7 +6631,7 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
/* Update Currentlayout */
- pSiS->CurrentLayout.mode = mode;
+ pSiS->CurrentLayout.mode = pSiS->currentModeLast = mode;
return TRUE;
}
@@ -6285,6 +6733,52 @@ SISSpecialRestore(ScrnInfoPtr pScrn)
}
}
+/* Fix SR11 for 661 and later */
+static void
+SiSFixupSR11(ScrnInfoPtr pScrn)
+{
+ SISPtr pSiS = SISPTR(pScrn);
+ CARD8 tmpreg;
+
+#ifdef UNLOCK_ALWAYS
+ 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);
+ }
+
+ inSISIDXREG(SISSR,0x11,tmpreg);
+ if(tmpreg & 0xf0) {
+ andSISIDXREG(SISSR,0x11,0x0f);
+ }
+ }
+}
+
+/* Subroutine for restoring sisfb's TV parameters (used by SiSRestore()) */
+
+static void
+SiSRestore_SiSFB_TVParms(ScrnInfoPtr pScrn)
+{
+ SISPtr pSiS = SISPTR(pScrn);
+ int fd;
+ CARD32 parm;
+
+ if(!pSiS->sisfbfound) return;
+ if(!pSiS->sisfb_tvposvalid) return;
+ if(!(pSiS->sisfbdevname[0])) return;
+
+ if((fd = open(pSiS->sisfbdevname, 'r')) != -1) {
+ parm = (CARD32)((pSiS->sisfb_tvxpos << 16) | (pSiS->sisfb_tvypos & 0xffff));
+ ioctl(fd, SISFB_SET_TVPOSOFFSET, &parm);
+ close(fd);
+ }
+}
+
/*
* Restore the initial mode. To be used internally only!
*/
@@ -6353,7 +6847,7 @@ SISRestore(ScrnInfoPtr pScrn)
*/
if( ( (pSiS->restorebyset) ||
(pSiS->VBFlags & (VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV|VB_302ELV)) ||
- ((pSiS->sishw_ext.jChipType == SIS_730) && (pSiS->VBFlags & VB_LVDS)) ) &&
+ ((pSiS->sishw_ext.jChipType == SIS_730) && (pSiS->VBFlags & VB_LVDS)) ) &&
(pSiS->OldMode) ) {
Bool changedmode = FALSE;
@@ -6384,6 +6878,12 @@ SISRestore(ScrnInfoPtr pScrn)
int backupscaler = pSiS->SiS_Pr->UsePanelScaler;
int backupcenter = pSiS->SiS_Pr->CenterScreen;
unsigned long backupspecialtiming = pSiS->SiS_Pr->SiS_CustomT;
+ int mymode = pSiS->OldMode;
+
+ if((pSiS->VGAEngine == SIS_315_VGA) && (pSiS->ROM661New) && (!pSiS->sisfbfound)) {
+ /* New BIOS has set mode, therefore eventually translate number */
+ mymode = SiSTranslateToOldMode(mymode);
+ }
if((pSiS->VBFlags & (VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV|VB_302ELV))) {
/* !!! REQUIRED for 630+301B-DH, otherwise the text modes
@@ -6394,8 +6894,8 @@ SISRestore(ScrnInfoPtr pScrn)
unsigned char temp;
inSISIDXREG(SISCR, 0x30, temp);
if(temp & 0x20) {
- if(pSiS->OldMode == 0x03) {
- pSiS->OldMode = 0x13;
+ if(mymode == 0x03) {
+ mymode = 0x13;
changedmode = TRUE;
}
}
@@ -6403,19 +6903,26 @@ 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(pSiS->sisfbfound) {
+ pSiS->SiS_Pr->UsePanelScaler = pSiS->sisfbscalelcd;
+ pSiS->SiS_Pr->SiS_CustomT = pSiS->sisfbspecialtiming;
+ } else {
+ pSiS->SiS_Pr->UsePanelScaler = -1;
+ /* Leave CustomT as it is */
+ }
+ SiSSetMode(pSiS->SiS_Pr, &pSiS->sishw_ext, pScrn, mymode, FALSE);
if(changedmode) {
- pSiS->OldMode = 0x03;
outSISIDXREG(SISCR,0x34,0x03);
}
SISSpecialRestore(pScrn);
- SiS_GetSetModeID(pScrn,pSiS->OldMode);
+ SiS_GetSetModeID(pScrn, pSiS->OldMode); /* NOT mymode! */
pSiS->SiS_Pr->UsePanelScaler = backupscaler;
pSiS->SiS_Pr->CenterScreen = backupcenter;
pSiS->SiS_Pr->SiS_CustomT = backupspecialtiming;
+ SiS_SiSFB_Lock(pScrn, FALSE);
+ SiSRestore_SiSFB_TVParms(pScrn);
+ SiS_SiSFB_Lock(pScrn, TRUE);
}
@@ -6426,22 +6933,18 @@ SISRestore(ScrnInfoPtr pScrn)
outSISIDXREG(SISSR, 0x1f, pSiS->oldSR1F);
#ifdef SISVRAMQ
- /* Restore queue mode registers on 315/330 series */
+ /* Restore queue mode registers on 315/330/340 series */
/* (This became necessary due to the switch to VRAM queue) */
if(pSiS->VGAEngine == SIS_315_VGA) {
unsigned char tempCR55=0;
- if(pSiS->sishw_ext.jChipType <= SIS_330) {
- inSISIDXREG(SISCR,0x55,tempCR55);
- andSISIDXREG(SISCR,0x55,0x33);
- }
+ 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);
- if(pSiS->sishw_ext.jChipType <= SIS_330) {
- outSISIDXREG(SISCR,0x55,tempCR55);
- }
+ outSISIDXREG(SISCR,0x55,tempCR55);
}
#endif
@@ -6467,7 +6970,7 @@ SISRestore(ScrnInfoPtr pScrn)
}
if(doitlater) {
- outSISIDXREG(SISCR, 0x17, pSiS->oldCR17);
+ outSISIDXREG(SISCR, 0x17, pSiS->oldCR17);
}
if(pSiS->Primary) {
@@ -6477,6 +6980,7 @@ SISRestore(ScrnInfoPtr pScrn)
* so this is the only safe way: Disable the bridge ONLY if
* in Slave Mode, and don't bother if not.
*/
+#ifdef SIS_PC_PLATFORM
SiSRegInit(pSiS->SiS_Pr, pSiS->RelIO+0x30);
SiSSetLVDSetc(pSiS->SiS_Pr, &pSiS->sishw_ext, 0);
SiS_GetVBType(pSiS->SiS_Pr, &pSiS->sishw_ext);
@@ -6485,22 +6989,32 @@ SISRestore(ScrnInfoPtr pScrn)
vgaHWProtect(pScrn, TRUE);
/* We now restore ALL to overcome the vga=extended problem */
+
vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL);
-
+
vgaHWProtect(pScrn, FALSE);
SiS_EnableBridge(pSiS->SiS_Pr, &pSiS->sishw_ext);
andSISIDXREG(SISSR, 0x01, ~0x20); /* Display on */
+#else
+ vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE | VGA_SR_CMAP);
+#endif
} else {
vgaHWProtect(pScrn, TRUE);
/* We now restore ALL to overcome the vga=extended problem */
+#ifdef SIS_PC_PLATFORM
vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL);
+#else
+ vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE | VGA_SR_CMAP);
+#endif
vgaHWProtect(pScrn, FALSE);
}
}
-
+
+ SiSFixupSR11(pScrn);
+
#ifdef TWDEBUG
{
SISRegPtr pReg = &pSiS->ModeReg;
@@ -6524,7 +7038,11 @@ SISRestore(ScrnInfoPtr pScrn)
vgaHWProtect(pScrn, TRUE);
if(pSiS->Primary) {
- vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL);
+#ifdef SIS_PC_PLATFORM
+ vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL);
+#else
+ vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE | VGA_SR_CMAP);
+#endif
}
/* Restore TV. This is rather complicated, but if we don't do it,
@@ -6573,23 +7091,19 @@ SISVESARestore(ScrnInfoPtr pScrn)
if(pSiS->UseVESA) {
SISVESASaveRestore(pScrn, MODE_RESTORE);
#ifdef SISVRAMQ
- /* Restore queue mode registers on 315/330 series */
+ /* Restore queue mode registers on 315/330/340 series */
/* (This became necessary due to the switch to VRAM queue) */
if(pSiS->VGAEngine == SIS_315_VGA) {
SISRegPtr sisReg = &pSiS->SavedReg;
unsigned char tempCR55=0;
- if(pSiS->sishw_ext.jChipType <= SIS_330) {
- inSISIDXREG(SISCR,0x55,tempCR55);
- andSISIDXREG(SISCR,0x55,0x33);
- }
+ 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);
- if(pSiS->sishw_ext.jChipType <= SIS_330) {
- outSISIDXREG(SISCR,0x55,tempCR55);
- }
+ outSISIDXREG(SISCR,0x55,tempCR55);
}
#endif
}
@@ -6659,6 +7173,9 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
hwp = VGAHWPTR(pScrn);
pSiS = SISPTR(pScrn);
+
+ /* Patch the PIOOffset inside vgaHW to use our relocated IO ports */
+ VGAHWPTR(pScrn)->PIOOffset = pSiS->MyPIOOffset;
#ifdef SISDUALHEAD
if((!pSiS->DualHeadMode) || (!pSiS->SecondHead)) {
@@ -6685,7 +7202,8 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
}
#endif
- /* Map the VGA memory and get the VGA IO base */
+ /* Map the 64k VGA memory */
+#ifdef SIS_PC_PLATFORM
if(pSiS->Primary) {
hwp->MapSize = 0x10000; /* Standard 64k VGA window */
if(!vgaHWMapMem(pScrn)) {
@@ -6693,18 +7211,18 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
return FALSE;
}
}
+#endif
+
+ /* Get the VGA IO base (relocated) */
vgaHWGetIOBase(hwp);
-
- /* Patch the PIOOffset inside vgaHW to use
- * our relocated IO ports.
- */
- VGAHWPTR(pScrn)->PIOOffset = pSiS->IODBase + (pSiS->PciInfo->ioBase[2] & 0xFFFC) - 0x380;
/* Map the SIS memory and MMIO areas */
if(!SISMapMem(pScrn)) {
SISErrorLog(pScrn, "SiSMapMem() failed\n");
return FALSE;
}
+
+ SiS_SiSFB_Lock(pScrn, TRUE);
#ifdef UNLOCK_ALWAYS
sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
@@ -6721,7 +7239,6 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if(pSiS->VGAEngine != SIS_315_VGA)
#endif
SiSEnableTurboQueue(pScrn);
-
}
/* Save the current state */
@@ -6752,18 +7269,23 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
inSISIDXREG(SISCR, 0x30, cr30);
inSISIDXREG(SISCR, 0x31, cr31);
- /* What if CR34 is different from the BIOS byte? */
+ /* What if CR34 is different from the BIOS scratch byte? */
if(pSiS->OldMode != myoldmode) {
- /* If no bridge output is active, trust the BIOS byte */
- if(!cr31 && !cr30) pSiS->OldMode = myoldmode;
+ /* If no bridge output is active, trust the BIOS scratch byte */
+ if( (!(pSiS->VBFlags & VB_VIDEOBRIDGE)) ||
+ (pSiS->OldMode == 0) ||
+ (!cr31 && !cr30) ||
+ (cr31 & 0x20) ) {
+ pSiS->OldMode = myoldmode;
+ }
/* ..else trust CR34 */
}
/* Newer 650 BIOSes set CR34 to 0xff if the mode has been
* "patched", for instance for 80x50 text mode. (That mode
* has no number of its own, it's 0x03 like 80x25). In this
- * case, we trust the BIOS byte (provided that any of these
- * two is valid).
+ * case, we trust the BIOS scratch byte (provided that any
+ * of these two is valid).
*/
if(pSiS->OldMode > 0x7f) {
pSiS->OldMode = myoldmode;
@@ -6776,6 +7298,15 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
}
#endif
}
+
+ /* RandR resets screen mode and size in CloseScreen(), hence
+ * we need to adapt our VBFlags to the initial state if the
+ * current mode has changed since closescreen() (or Screeninit()
+ * for the first instance)
+ */
+ if(pScrn->currentMode != pSiS->currentModeLast) {
+ pSiS->VBFlags = pSiS->VBFlags_backup = pSiS->VBFlagsInit;
+ }
/* Initialise the first mode */
if(!SISModeInit(pScrn, pScrn->currentMode)) {
@@ -6794,18 +7325,6 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
SISAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
/*
- * The next step is to setup the screen's visuals, and initialise the
- * framebuffer code. In cases where the framebuffer's default
- * choices for things like visual layouts and bits per RGB are OK,
- * this may be as simple as calling the framebuffer's ScreenInit()
- * function. If not, the visuals will need to be setup before calling
- * a fb ScreenInit() function and fixed up after.
- *
- * For most PC hardware at depths >= 8, the defaults that cfb uses
- * are not appropriate. In this driver, we fixup the visuals after.
- */
-
- /*
* Reset visual list.
*/
miClearVisualTypes();
@@ -6887,7 +7406,7 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
#endif
/*
- * Call the framebuffer layer's ScreenInit function, and fill in other
+ * Call the framebuffer layer's ScreenInit function and fill in other
* pScreen fields.
*/
switch(pScrn->bitsPerPixel) {
@@ -6932,7 +7451,7 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
/* Initialize RENDER ext; must be after RGB ordering fixed */
fbPictureInit(pScreen, 0, 0);
- /* hardware cursor needs to wrap this layer <-- TW: what does that mean? */
+ /* hardware cursor needs to wrap this layer */
if(!pSiS->ShadowFB) SISDGAInit(pScreen);
xf86SetBlackWhitePixels(pScreen);
@@ -7024,7 +7543,7 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Using SiS300/315 series HW Xv on CRT%d\n",
+ "Using SiS300/315/330/340 series HW Xv on CRT%d\n",
(pSiS->SecondHead ? 1 : 2));
if(!pSiS->hasTwoOverlays) {
if( (pSiS->XvOnCRT2 && pSiS->SecondHead) ||
@@ -7039,15 +7558,20 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
#endif
if(pSiS->hasTwoOverlays)
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Using SiS300/315/330 series HW Xv\n" );
+ "Using SiS300/315/330/340 series HW Xv\n" );
else
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Using SiS300/315/330 series HW Xv by default on CRT%d\n",
+ "Using SiS300/315/330/340 series HW Xv by default on CRT%d\n",
(pSiS->XvOnCRT2 ? 2 : 1));
SISInitVideo(pScreen);
#ifdef SISDUALHEAD
}
#endif
+ if(pSiS->blitadaptor) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Default Xv adaptor is %s\n",
+ pSiS->XvDefAdaptorBlit ? "Video Blitter" : "Video Overlay");
+ }
} else if( pSiS->Chipset == PCI_CHIP_SIS6326 ||
pSiS->Chipset == PCI_CHIP_SIS530 ||
pSiS->Chipset == PCI_CHIP_SIS5597 ) {
@@ -7179,6 +7703,12 @@ SISSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
SISPtr pSiS = SISPTR(pScrn);
+
+ if(!pSiS->skipswitchcheck) {
+ if(SISValidMode(scrnIndex, mode, TRUE, flags) != MODE_OK) {
+ return FALSE;
+ }
+ }
if(!pSiS->NoAccel) {
if(pSiS->AccelInfoPtr) {
@@ -7205,12 +7735,27 @@ Bool
SISSwitchCRT2Type(ScrnInfoPtr pScrn, unsigned long newvbflags)
{
SISPtr pSiS = SISPTR(pScrn);
- BOOLEAN hcm;
+ BOOLEAN hcm = pSiS->HaveCustomModes;
DisplayModePtr mode = pScrn->currentMode;
/* Do NOT use this to switch from CRT2_LCD to CRT1_LCDA */
+
+ /* Switching CRT2 to LCD or VGA will switch CRT1 to VGA if
+ * previously LCD-via-CRT1
+ */
+
+ /* For usability reasons, the user should not simply "lose" one
+ * of his output devices in MergedFB mode. Therefore, a switch
+ * which might lead to this situation will not be performed in
+ * MergedFB mode. (For example: If CRT1 is LCD-via-CRT1, don't
+ * let the user switch CRT2 to LCD or VGA mode, because he
+ * would lose one output device since LCD-via-CRT1 is only
+ * supported together with TV, not any other CRT2 type.)
+ * In Non-MergedFB mode, losing one output device is not
+ * considered that harmful.
+ */
- /* Only on 300 and 315/330 series */
+ /* Only on 300 and 315/330/340 series */
if(pSiS->VGAEngine != SIS_300_VGA &&
pSiS->VGAEngine != SIS_315_VGA) return FALSE;
@@ -7242,35 +7787,37 @@ SISSwitchCRT2Type(ScrnInfoPtr pScrn, unsigned long newvbflags)
if(pSiS->MergedFB) {
if(!(newvbflags & CRT2_ENABLE)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "CRT2 can't be switched off in MergedFB mode\n");
+ "CRT2 can't be switched off in MergedFB mode\n");
return FALSE;
}
+ if((newvbflags & (CRT2_LCD|CRT2_VGA)) && (newvbflags & CRT1_LCDA)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "CRT2 type can only be TV while in LCD-via-CRT1 mode\n");
+ return FALSE;
+ }
hcm = pSiS->HaveCustomModes2;
if(mode->Private) {
mode = ((SiSMergedDisplayModePtr)mode->Private)->CRT2;
}
- } else
+ }
#endif
- hcm = pSiS->HaveCustomModes;
if((!(newvbflags & CRT2_ENABLE)) && (!newvbflags & DISPTYPE_CRT1)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"CRT2 can't be switched off while CRT1 is off\n");
return FALSE;
}
-
- /* CRT2_LCD overrules LCDA */
- if(newvbflags & CRT2_LCD) {
+
+ /* CRT2_LCD and CRT2_VGA overrule LCDA (in non-MergedFB mode) */
+ if(newvbflags & (CRT2_LCD|CRT2_VGA)) {
newvbflags &= ~CRT1_LCDA;
}
/* Check if the current mode is suitable for desired output device (if any) */
- if(newvbflags & CRT2_ENABLE) {
- if(!SiS_CheckCalcModeIndex(pScrn, mode, newvbflags, hcm)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ if(SiS_CheckModeCRT2(pScrn, mode, newvbflags, hcm) < 0x14) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Current mode not suitable for desired CRT2 output device\n");
- return FALSE;
- }
+ return FALSE;
}
/* Remember: Dualhead not supported */
@@ -7290,7 +7837,12 @@ SISSwitchCRT2Type(ScrnInfoPtr pScrn, unsigned long newvbflags)
pSiS->VBFlags = pSiS->VBFlags_backup = newvbflags;
- if(!(pScrn->SwitchMode(pScrn->scrnIndex, pScrn->currentMode, 0))) return FALSE;
+ pSiS->skipswitchcheck = TRUE;
+ if(!(pScrn->SwitchMode(pScrn->scrnIndex, pScrn->currentMode, 0))) {
+ pSiS->skipswitchcheck = FALSE;
+ return FALSE;
+ }
+ pSiS->skipswitchcheck = FALSE;
SISAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
return TRUE;
}
@@ -7377,7 +7929,7 @@ SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned sh
}
/* Check if the desired mode is suitable for current CRT2 output device */
- if(!SiS_CheckCalcModeIndex(pScrn, mode, vbflags, hcm)) {
+ if(SiS_CheckModeCRT2(pScrn, mode, vbflags, hcm) < 0x14) {
if((!cond) && (!quiet)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Desired mode not suitable for current CRT2 output device\n");
@@ -7418,7 +7970,7 @@ SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned sh
}
/* Check if the desired mode is suitable for current CRT1 output device */
- if(!SiS_CalcModeIndex(pScrn, mode, vbflags, hcm)) {
+ if(SiS_CheckModeCRT1(pScrn, mode, vbflags, hcm) < 0x14) {
if((!cond) && (!quiet)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Desired mode not suitable for current CRT1 output device\n");
@@ -7436,6 +7988,46 @@ SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, unsigned short cond, unsigned sh
}
Bool
+SISRedetectCRT2Devices(ScrnInfoPtr pScrn)
+{
+ SISPtr pSiS = SISPTR(pScrn);
+
+ if((pSiS->VGAEngine != SIS_300_VGA) && (pSiS->VGAEngine != SIS_315_VGA)) {
+ return FALSE;
+ }
+
+#ifdef SISDUALHEAD
+ if(pSiS->DualHeadMode) return FALSE;
+#endif
+
+ /* Sync the accelerators */
+ if(!pSiS->NoAccel) {
+ if(pSiS->AccelInfoPtr) {
+ (*pSiS->AccelInfoPtr->Sync)(pScrn);
+ }
+ }
+
+ if(SISRedetectCRT2Type(pScrn)) {
+ /* If this returns TRUE, we need to reset the display mode */
+ /* Sync the accelerators */
+ if(!pSiS->NoAccel) {
+ if(pSiS->AccelInfoPtr) {
+ (*pSiS->AccelInfoPtr->Sync)(pScrn);
+ }
+ }
+ pSiS->skipswitchcheck = TRUE;
+ if(!(pScrn->SwitchMode(pScrn->scrnIndex, pScrn->currentMode, 0))) {
+ pSiS->skipswitchcheck = FALSE;
+ return FALSE;
+ }
+ pSiS->skipswitchcheck = FALSE;
+ SISAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+ }
+
+ return TRUE;
+}
+
+Bool
SISSwitchCRT1Status(ScrnInfoPtr pScrn, int onoff)
{
SISPtr pSiS = SISPTR(pScrn);
@@ -7444,11 +8036,23 @@ SISSwitchCRT1Status(ScrnInfoPtr pScrn, int onoff)
int crt1off;
/* onoff: 0=OFF, 1=ON(VGA), 2=ON(LCDA) */
- /* Switching to LCDA will disable CRT2 if previously LCD */
+
+ /* Switching to LCDA will disable CRT2 if previously LCD or VGA */
+
+ /* For usability reasons, the user should not simply "lose" one
+ * of his output devices in MergedFB mode. Therefore, a switch
+ * which might lead to this situation will not be performed in
+ * MergedFB mode. (For example: If CRT2 is either LCD or VGA,
+ * don't let the user switch to LCD-via-CRT1 mode, because he
+ * would lose one output device since LCD-via-CRT1 is only
+ * supported together with TV, not any other CRT2 type.)
+ * In Non-MergedFB mode, losing one output device is not
+ * considered that harmful.
+ */
/* Do NOT use this to switch from CRT1_LCDA to CRT2_LCD */
- /* Only on 300 and 315/330 series */
+ /* Only on 300 and 315/330/340 series */
if(pSiS->VGAEngine != SIS_300_VGA &&
pSiS->VGAEngine != SIS_315_VGA) return FALSE;
@@ -7459,11 +8063,11 @@ SISSwitchCRT1Status(ScrnInfoPtr pScrn, int onoff)
if(pSiS->DualHeadMode) return FALSE;
#endif
- /* Can't switch to LCDA of not supported (duh!) */
+ /* Can't switch to LCDA if not supported (duh!) */
if(!(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTLCDA)) {
if(onoff == 2) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "LCD-via-CRT1 not supported on this hardware\n");
+ "LCD-via-CRT1 not supported by hardware or no panel detected\n");
return FALSE;
}
}
@@ -7472,12 +8076,12 @@ SISSwitchCRT1Status(ScrnInfoPtr pScrn, int onoff)
if(pSiS->MergedFB) {
if(!onoff) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "CRT1 can't be switched off in MergedFB mode\n");
+ "CRT1 can't be switched off in MergedFB mode\n");
return FALSE;
} else if(onoff == 2) {
- if(vbflags & CRT2_LCD) {
+ if(vbflags & (CRT2_LCD|CRT2_VGA)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "CRT2 type can't be LCD while CRT1 is LCD-via-CRT1\n");
+ "CRT1 type can only be VGA while CRT2 is LCD or VGA\n");
return FALSE;
}
}
@@ -7494,7 +8098,7 @@ SISSwitchCRT1Status(ScrnInfoPtr pScrn, int onoff)
crt1off = 0;
if(onoff == 2) {
vbflags |= CRT1_LCDA;
- vbflags &= ~CRT2_LCD;
+ vbflags &= ~(CRT2_LCD|CRT2_VGA);
}
/* Remember: Dualhead not supported */
if(vbflags & CRT2_ENABLE) vbflags |= MIRROR_MODE;
@@ -7504,11 +8108,11 @@ SISSwitchCRT1Status(ScrnInfoPtr pScrn, int onoff)
}
if(vbflags & CRT1_LCDA) {
- if(!SiS_CalcModeIndex(pScrn, mode, vbflags, pSiS->HaveCustomModes)) {
+ if(SiS_CheckModeCRT1(pScrn, mode, vbflags, pSiS->HaveCustomModes) < 0x14) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Current mode not suitable for LCD-via-CRT1\n");
return FALSE;
- }
+ }
}
pSiS->CRT1off = crt1off;
@@ -7521,7 +8125,12 @@ SISSwitchCRT1Status(ScrnInfoPtr pScrn, int onoff)
}
}
- if(!(pScrn->SwitchMode(pScrn->scrnIndex, pScrn->currentMode, 0))) return FALSE;
+ pSiS->skipswitchcheck = TRUE;
+ if(!(pScrn->SwitchMode(pScrn->scrnIndex, pScrn->currentMode, 0))) {
+ pSiS->skipswitchcheck = FALSE;
+ return FALSE;
+ }
+ pSiS->skipswitchcheck = FALSE;
SISAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
return TRUE;
}
@@ -7901,6 +8510,8 @@ SISEnterVT(int scrnIndex, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
SISPtr pSiS = SISPTR(pScrn);
+
+ SiS_SiSFB_Lock(pScrn, TRUE);
sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
@@ -8005,6 +8616,8 @@ SISLeaveVT(int scrnIndex, int flags)
}
vgaHWLock(hwp);
+
+ SiS_SiSFB_Lock(pScrn, FALSE);
}
@@ -8073,6 +8686,8 @@ SISCloseScreen(int scrnIndex, ScreenPtr pScreen)
vgaHWLock(hwp);
}
+
+ SiS_SiSFB_Lock(pScrn, FALSE);
/* 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
@@ -8082,7 +8697,9 @@ SISCloseScreen(int scrnIndex, ScreenPtr pScreen)
*/
SISUnmapMem(pScrn);
+#ifdef SIS_PC_PLATFORM
vgaHWUnmapMem(pScrn);
+#endif
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
@@ -8126,6 +8743,11 @@ SISCloseScreen(int scrnIndex, ScreenPtr pScreen)
pSiS->adaptor = NULL;
pSiS->ResetXv = pSiS->ResetXvGamma = NULL;
}
+
+ if(pSiS->blitadaptor) {
+ xfree(pSiS->blitadaptor);
+ pSiS->blitadaptor = NULL;
+ }
pScrn->vtSema = FALSE;
@@ -8144,6 +8766,21 @@ SISCloseScreen(int scrnIndex, ScreenPtr pScreen)
static void
SISFreeScreen(int scrnIndex, int flags)
{
+#ifdef SIS_NEED_MAP_IOP
+ ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+ SISPtr pSiS = SISPTR(pScrn);
+
+ if(pSiS) {
+#ifdef SISDUALHEAD
+ SISEntPtr pSiSEnt = pSiS->entityPrivate;
+ if(pSiSEnt) {
+ pSiSEnt->forceUnmapIOPBase = TRUE;
+ }
+#endif
+ SISUnmapIOPMem(pScrn);
+ }
+#endif
+
if(xf86LoaderCheckSymbol("vgaHWFreeHWRec")) {
vgaHWFreeHWRec(xf86Screens[scrnIndex]);
}
@@ -8171,10 +8808,10 @@ SISValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
if(pSiS->SecondHead) {
- if(SiS_CalcModeIndex(pScrn, mode, pSiS->VBFlags, pSiS->HaveCustomModes) < 0x14)
+ if(SiS_CheckModeCRT1(pScrn, mode, pSiS->VBFlags, pSiS->HaveCustomModes) < 0x14)
return(MODE_BAD);
} else {
- if(SiS_CheckCalcModeIndex(pScrn, mode, pSiS->VBFlags, pSiS->HaveCustomModes) < 0x14)
+ if(SiS_CheckModeCRT2(pScrn, mode, pSiS->VBFlags, pSiS->HaveCustomModes) < 0x14)
return(MODE_BAD);
}
} else
@@ -8183,30 +8820,28 @@ SISValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
if(pSiS->MergedFB) {
if(!mode->Private) {
if(!pSiS->CheckForCRT2) {
- if(SiS_CalcModeIndex(pScrn, mode, pSiS->VBFlags, pSiS->HaveCustomModes) < 0x14)
+ if(SiS_CheckModeCRT1(pScrn, mode, pSiS->VBFlags, pSiS->HaveCustomModes) < 0x14)
return(MODE_BAD);
} else {
- if(SiS_CheckCalcModeIndex(pScrn, mode, pSiS->VBFlags, pSiS->HaveCustomModes2) < 0x14)
+ if(SiS_CheckModeCRT2(pScrn, mode, pSiS->VBFlags, pSiS->HaveCustomModes2) < 0x14)
return(MODE_BAD);
}
} else {
- if(SiS_CalcModeIndex(pScrn, ((SiSMergedDisplayModePtr)mode->Private)->CRT1,
+ if(SiS_CheckModeCRT1(pScrn, ((SiSMergedDisplayModePtr)mode->Private)->CRT1,
pSiS->VBFlags, pSiS->HaveCustomModes) < 0x14)
return(MODE_BAD);
- if(SiS_CheckCalcModeIndex(pScrn, ((SiSMergedDisplayModePtr)mode->Private)->CRT2,
+ if(SiS_CheckModeCRT2(pScrn, ((SiSMergedDisplayModePtr)mode->Private)->CRT2,
pSiS->VBFlags, pSiS->HaveCustomModes2) < 0x14)
return(MODE_BAD);
}
} else
#endif
- {
+ {
+ if(SiS_CheckModeCRT1(pScrn, mode, pSiS->VBFlags, pSiS->HaveCustomModes) < 0x14)
+ return(MODE_BAD);
- if(pSiS->VBFlags & CRT1_LCDA) {
- if(SiS_CalcModeIndex(pScrn, mode, pSiS->VBFlags, pSiS->HaveCustomModes) < 0x14)
- return(MODE_BAD);
- }
- if(SiS_CheckCalcModeIndex(pScrn, mode, pSiS->VBFlags, pSiS->HaveCustomModes) < 0x14)
+ if(SiS_CheckModeCRT2(pScrn, mode, pSiS->VBFlags, pSiS->HaveCustomModes) < 0x14)
return(MODE_BAD);
}
}
@@ -8235,7 +8870,7 @@ SISSaveScreen(ScreenPtr pScreen, int mode)
if(pSiS->VGAEngine == SIS_300_VGA) {
- if(pSiS->VBFlags & (VB_301LV|VB_302LV|VB_302ELV)) {
+ if(pSiS->VBFlags & VB_SISLVDSBRIDGE) {
if(!xf86IsUnblank(mode)) {
pSiS->Blank = TRUE;
SiS_SiS30xBLOff(pSiS->SiS_Pr,&pSiS->sishw_ext);
@@ -8279,7 +8914,7 @@ SISSaveScreen(ScreenPtr pScreen, int mode)
pSiS->Blank = FALSE;
outSISIDXREG(SISSR, 0x11, pSiS->LCDon);
}
- } else if(pSiS->VBFlags & (VB_301LV|VB_302LV|VB_302ELV)) {
+ } else if(pSiS->VBFlags & VB_SISLVDSBRIDGE) {
if(!xf86IsUnblank(mode)) {
pSiS->Blank = TRUE;
SiS_SiS30xBLOff(pSiS->SiS_Pr,&pSiS->sishw_ext);
@@ -8310,7 +8945,7 @@ SISSaveScreenDH(ScreenPtr pScreen, int mode)
SISPtr pSiS = SISPTR(pScrn);
- if((pSiS->SecondHead) && ((!(pSiS->VBFlags & CRT1_LCDA)) || (pSiS->VBFlags & VB_301C))) {
+ if((pSiS->SecondHead) && ((!(pSiS->VBFlags & CRT1_LCDA)) || (pSiS->VBFlags & VB_SISTMDSLCDABRIDGE))) {
/* Slave head is always CRT1 */
if(pSiS->VBFlags & CRT1_LCDA) pSiS->Blank = xf86IsUnblank(mode) ? FALSE : TRUE;
@@ -8332,7 +8967,7 @@ SISSaveScreenDH(ScreenPtr pScreen, int mode)
if(pSiS->VGAEngine == SIS_300_VGA) {
- if(pSiS->VBFlags & (VB_301LV|VB_302LV|VB_302ELV)) {
+ if(pSiS->VBFlags & VB_SISLVDSBRIDGE) {
checkit = TRUE;
if(!xf86IsUnblank(mode)) {
SiS_SiS30xBLOff(pSiS->SiS_Pr,&pSiS->sishw_ext);
@@ -8372,7 +9007,7 @@ SISSaveScreenDH(ScreenPtr pScreen, int mode)
} else {
outSISIDXREG(SISSR, 0x11, pSiS->LCDon);
}
- } else if(pSiS->VBFlags & (VB_301LV|VB_302LV|VB_302ELV)) {
+ } else if(pSiS->VBFlags & VB_SISLVDSBRIDGE) {
checkit = TRUE;
if(!xf86IsUnblank(mode)) {
SiS_SiS30xBLOff(pSiS->SiS_Pr,&pSiS->sishw_ext);
@@ -8430,7 +9065,7 @@ SISModifyModeInfo(DisplayModePtr mode)
mode->CrtcVBlankEnd--;
}
-/* Enable the Turboqueue/Commandqueue (For 300 and 315/330 series only) */
+/* Enable the Turboqueue/Commandqueue (For 300 and 315/330/340 series only) */
void
SiSEnableTurboQueue(ScrnInfoPtr pScrn)
{
@@ -8438,7 +9073,7 @@ SiSEnableTurboQueue(ScrnInfoPtr pScrn)
unsigned short SR26, SR27;
unsigned long temp;
- switch (pSiS->VGAEngine) {
+ switch(pSiS->VGAEngine) {
case SIS_300_VGA:
if((!pSiS->NoAccel) && (pSiS->TurboQueue)) {
/* TQ size is always 512k */
@@ -8454,7 +9089,7 @@ SiSEnableTurboQueue(ScrnInfoPtr pScrn)
case SIS_315_VGA:
if(!pSiS->NoAccel) {
- /* On 315/330 series, there are three queue modes available
+ /* On 315/330/340 series, there are three queue modes available
* which are chosen by setting bits 7:5 in SR26:
* 1. MMIO queue mode (bit 5, 0x20). The hardware will keep
* track of the queue, the FIFO, command parsing and so
@@ -8488,11 +9123,9 @@ SiSEnableTurboQueue(ScrnInfoPtr pScrn)
/* Set Command Queue Threshold to max value 11111b (?) */
outSISIDXREG(SISSR, 0x27, 0x1F);
- /* No idea what this does */
- if(pSiS->sishw_ext.jChipType <= SIS_330) {
- inSISIDXREG(SISCR, 0x55, tempCR55) ;
- andSISIDXREG(SISCR, 0x55, 0x33) ;
- }
+ /* Disable queue flipping */
+ inSISIDXREG(SISCR, 0x55, tempCR55) ;
+ andSISIDXREG(SISCR, 0x55, 0x33) ;
/* Syncronous reset for Command Queue */
outSISIDXREG(SISSR, 0x26, 0x01);
MMIO_OUT32(pSiS->IOBase, 0x85c4, 0);
@@ -8521,9 +9154,7 @@ SiSEnableTurboQueue(ScrnInfoPtr pScrn)
#endif
temp += pSiS->cmdQueueOffset;
pSiS->cmdQueueBase = (unsigned long *)temp;
- if(pSiS->sishw_ext.jChipType <= SIS_330) {
- outSISIDXREG(SISCR, 0x55, tempCR55);
- }
+ outSISIDXREG(SISCR, 0x55, tempCR55);
#else
/* For MMIO */
/* Set Command Queue Threshold to max value 11111b */
@@ -8560,132 +9191,49 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
unsigned char CR39 = 0, CR3B = 0;
unsigned char CR17, CR38 = 0;
unsigned char CR35 = 0, CR79 = 0;
- unsigned long vbflag;
- int temp = 0, i;
- int crt1rateindex = 0;
- DisplayModePtr mymode;
-#ifdef SISMERGED
- DisplayModePtr mymode2 = NULL;
-#endif
-
-#ifdef SISMERGED
- if(pSiS->MergedFB) {
- mymode = ((SiSMergedDisplayModePtr)mode->Private)->CRT1;
- mymode2 = ((SiSMergedDisplayModePtr)mode->Private)->CRT2;
- } else
-#endif
- mymode = mode;
-
- vbflag = pSiS->VBFlags;
+ int temp = 0, crt1rateindex = 0;
+ unsigned long vbflag = pSiS->VBFlags;
+ DisplayModePtr mymode = mode;
+ BOOLEAN hcm = pSiS->HaveCustomModes;
+
pSiS->IsCustom = FALSE;
+
+ /* NEVER call this with viewmode = SIS_MODE_SIMU
+ * if mode->type is not M_T_DEFAULT!
+ */
+
#ifdef SISMERGED
- pSiS->IsCustomCRT2 = FALSE;
-
if(pSiS->MergedFB) {
- /* CRT2 */
- if(vbflag & CRT2_LCD) {
- if(pSiS->SiS_Pr->CP_HaveCustomData) {
- for(i=0; i<7; i++) {
- if(pSiS->SiS_Pr->CP_DataValid[i]) {
- if((mymode2->HDisplay == pSiS->SiS_Pr->CP_HDisplay[i]) &&
- (mymode2->VDisplay == pSiS->SiS_Pr->CP_VDisplay[i])) {
- if(mymode2->type & M_T_BUILTIN) {
- pSiS->IsCustomCRT2 = TRUE;
- }
- }
- }
- }
- }
- }
- if(vbflag & (CRT2_VGA|CRT2_LCD)) {
- if(pSiS->AddedPlasmaModes) {
- if(mymode2->type & M_T_BUILTIN) {
- pSiS->IsCustomCRT2 = TRUE;
- }
- }
- if(pSiS->HaveCustomModes2) {
- if(!(mymode2->type & M_T_DEFAULT)) {
- pSiS->IsCustomCRT2 = TRUE;
- }
- }
- }
- /* CRT1 */
- if(pSiS->HaveCustomModes) {
- if(!(mymode->type & M_T_DEFAULT)) {
- pSiS->IsCustom = TRUE;
- }
- }
- } else
-#endif
-#ifdef SISDUALHEAD
- if(pSiS->DualHeadMode) {
- if(!pSiS->SecondHead) {
- /* CRT2 */
- if(vbflag & CRT2_LCD) {
- if(pSiS->SiS_Pr->CP_HaveCustomData) {
- for(i=0; i<7; i++) {
- if(pSiS->SiS_Pr->CP_DataValid[i]) {
- if((mymode->HDisplay == pSiS->SiS_Pr->CP_HDisplay[i]) &&
- (mymode->VDisplay == pSiS->SiS_Pr->CP_VDisplay[i])) {
- if(mymode->type & M_T_BUILTIN) {
- pSiS->IsCustom = TRUE;
- }
- }
- }
- }
- }
- }
- if(vbflag & (CRT2_VGA|CRT2_LCD)) {
- if(pSiS->AddedPlasmaModes) {
- if(mymode->type & M_T_BUILTIN) {
- pSiS->IsCustom = TRUE;
- }
- }
- if(pSiS->HaveCustomModes) {
- if(!(mymode->type & M_T_DEFAULT)) {
- pSiS->IsCustom = TRUE;
- }
- }
- }
- } else {
- /* CRT1 */
- if(pSiS->HaveCustomModes) {
- if(!(mymode->type & M_T_DEFAULT)) {
- pSiS->IsCustom = TRUE;
- }
- }
+ switch(viewmode) {
+ case SIS_MODE_CRT1:
+ mymode = ((SiSMergedDisplayModePtr)mode->Private)->CRT1;
+ break;
+ case SIS_MODE_CRT2:
+ mymode = ((SiSMergedDisplayModePtr)mode->Private)->CRT2;
+ hcm = pSiS->HaveCustomModes2;
}
- } else
+ }
#endif
- {
- if(vbflag & CRT2_LCD) {
- if(pSiS->SiS_Pr->CP_HaveCustomData) {
- for(i=0; i<7; i++) {
- if(pSiS->SiS_Pr->CP_DataValid[i]) {
- if((mymode->HDisplay == pSiS->SiS_Pr->CP_HDisplay[i]) &&
- (mymode->VDisplay == pSiS->SiS_Pr->CP_VDisplay[i])) {
- if(mymode->type & M_T_BUILTIN) {
- pSiS->IsCustom = TRUE;
- }
- }
- }
- }
- }
- }
- if(vbflag & (CRT2_LCD|CRT2_VGA)) {
- if(pSiS->AddedPlasmaModes) {
- if(mymode->type & M_T_BUILTIN) {
- pSiS->IsCustom = TRUE;
- }
- }
+
+ switch(viewmode) {
+ case SIS_MODE_CRT1:
+ if(SiS_CheckModeCRT1(pScrn, mymode, vbflag, hcm) == 0xfe) {
+ pSiS->IsCustom = TRUE;
}
- if((pSiS->HaveCustomModes) && (!(vbflag & CRT2_TV))) {
- if(!(mymode->type & M_T_DEFAULT)) {
+ break;
+ case SIS_MODE_CRT2:
+ if(vbflag & CRT2_ENABLE) {
+ if(SiS_CheckModeCRT2(pScrn, mymode, vbflag, hcm) == 0xfe) {
pSiS->IsCustom = TRUE;
+ }
+ } else {
+ /* This can only happen in mirror mode */
+ if(SiS_CheckModeCRT1(pScrn, mymode, vbflag, hcm) == 0xfe) {
+ pSiS->IsCustom = TRUE;
}
}
}
-
+
#ifdef UNLOCK_ALWAYS
sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); /* Unlock Registers */
#endif
@@ -8695,7 +9243,7 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
CR32 = pSiS->newCR32;
inSISIDXREG(SISCR, 0x33, CR33);
- if(pSiS->Chipset == PCI_CHIP_SIS660) {
+ if(pSiS->NewCRLayout) {
inSISIDXREG(SISCR, 0x35, CR35);
inSISIDXREG(SISCR, 0x38, CR38);
@@ -8704,6 +9252,7 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
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 &= ~0x07;
} else {
@@ -8720,6 +9269,7 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
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);
@@ -8732,7 +9282,7 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
CR31 |= 0x04; /* Set VB_NotSimuMode (not for 30xB/1400x1050?) */
CR35 = 0x00;
- if(pSiS->Chipset != PCI_CHIP_SIS660) {
+ if(!pSiS->NewCRLayout) {
if(!pSiS->AllowHotkey) {
CR31 |= 0x80; /* Disable hotkey-switch */
}
@@ -8764,13 +9314,13 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
CR38 &= ~0x04;
CR31 &= ~0x01;
} else if(vbflag & TV_HIVISION) { /* SiS bridge */
- if(pSiS->Chipset == PCI_CHIP_SIS660) {
+ if(pSiS->NewCRLayout) {
CR38 |= 0x04;
CR35 |= 0x60;
} else {
CR30 |= 0x80;
if(pSiS->VGAEngine == SIS_315_VGA) {
- if(vbflag & (VB_301LV | VB_302LV | VB_301C)) {
+ if(vbflag & VB_SISYPBPRBRIDGE) {
CR38 |= (0x08 | 0x30);
}
}
@@ -8778,7 +9328,7 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
CR31 |= 0x01;
CR35 |= 0x01;
} else if(vbflag & TV_YPBPR) { /* SiS bridge */
- if(pSiS->Chipset == PCI_CHIP_SIS660) {
+ if(pSiS->NewCRLayout) {
CR38 |= 0x04;
if(vbflag & TV_YPBPR525P) CR35 |= 0x20;
else if(vbflag & TV_YPBPR750P) CR35 |= 0x40;
@@ -8896,11 +9446,6 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
}
}
- /* for VESA: no DRIVERMODE, otherwise
- * -) CRT2 will not be initialized correctly when using mode
- * where LCD has to scale, and
- * -) CRT1 will have too low rate
- */
if(pSiS->UseVESA) {
CR31 &= ~0x40; /* Clear Drivermode */
CR31 |= 0x06; /* Set SlaveMode, Enable SimuMode in Slavemode */
@@ -8913,55 +9458,38 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
CR31 &= ~0x06; /* Disable SlaveMode, disable SimuMode in SlaveMode */
if(!pSiS->IsCustom) {
crt1rateindex = SISSearchCRT1Rate(pScrn, mymode);
- } else {
- crt1rateindex = CR33;
- }
+ }
}
-#ifdef SISDUALHEAD
- if(pSiS->DualHeadMode) {
- if(pSiS->SecondHead) {
- /* CRT1 */
- CR33 &= 0xf0;
- if(!(vbflag & CRT1_LCDA)) {
- CR33 |= (crt1rateindex & 0x0f);
- }
- } else {
- /* CRT2 */
- CR33 &= 0x0f;
- if(vbflag & CRT2_VGA) {
- CR33 |= ((crt1rateindex << 4) & 0xf0);
- }
- }
- } else
-#endif
-#ifdef SISMERGED
- if(pSiS->MergedFB) {
- CR33 = 0;
- if(!(vbflag & CRT1_LCDA)) {
- CR33 |= (crt1rateindex & 0x0f);
- }
- if(vbflag & CRT2_VGA) {
- if(!pSiS->IsCustomCRT2) {
- CR33 |= (SISSearchCRT1Rate(pScrn, mymode2) << 4);
+ switch(viewmode) {
+ case SIS_MODE_SIMU:
+ CR33 = 0;
+ if(!(vbflag & CRT1_LCDA)) {
+ CR33 |= (crt1rateindex & 0x0f);
}
- }
- } else
-#endif
- {
- CR33 = 0;
- if(!(vbflag & CRT1_LCDA)) {
- CR33 |= (crt1rateindex & 0x0f);
- }
- if(vbflag & CRT2_VGA) {
- CR33 |= ((crt1rateindex & 0x0f) << 4);
- }
- if((!(pSiS->UseVESA)) && (vbflag & CRT2_ENABLE)) {
- if(pSiS->CRT1off) CR33 &= 0xf0;
- }
+ if(vbflag & CRT2_VGA) {
+ CR33 |= ((crt1rateindex & 0x0f) << 4);
+ }
+ break;
+ case SIS_MODE_CRT1:
+ CR33 &= 0xf0;
+ if(!(vbflag & CRT1_LCDA)) {
+ CR33 |= (crt1rateindex & 0x0f);
+ }
+ break;
+ case SIS_MODE_CRT2:
+ CR33 &= 0x0f;
+ if(vbflag & CRT2_VGA) {
+ CR33 |= ((crt1rateindex & 0x0f) << 4);
+ }
+ break;
}
-
- if(pSiS->Chipset == PCI_CHIP_SIS660) {
+
+ if((!pSiS->UseVESA) && (vbflag & CRT2_ENABLE)) {
+ if(pSiS->CRT1off) CR33 &= 0xf0;
+ }
+
+ if(pSiS->NewCRLayout) {
CR31 &= 0xfe; /* Clear PAL flag (now in CR35) */
CR38 &= 0x07; /* Use only LCDA and HiVision/YPbPr bits */
@@ -8971,6 +9499,7 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
outSISIDXREG(SISCR, 0x35, CR35);
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);
@@ -8987,6 +9516,7 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
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",
CR30, CR31, CR33, temp, CR38);
@@ -10512,6 +11042,13 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val)
case 0x31: /* 720x480 */
case 0x33:
case 0x35:
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ if(!usentsc) {
+ srindex = 21;
+ break;
+ }
+ }
+ /* fall through */
case 0x32: /* 720x576 */
case 0x34:
case 0x36:
@@ -10584,7 +11121,7 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val)
}
#endif
SISWaitRetraceCRT2(pScrn);
- if(pSiS->VBFlags & (VB_301C|VB_302ELV)) {
+ if(pSiS->VBFlags & VB_SISTAP4SCALER) {
for(i=0; i<64; i++) {
outSISIDXREG(SISPART2,(0xc0 + i),p2scaling[i]);
}
@@ -10628,9 +11165,9 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val)
SISWaitRetraceCRT2(pScrn);
- if(pSiS->VBFlags & (VB_301C|VB_302ELV)) {
+ if(pSiS->VBFlags & VB_SISTAP4SCALER) {
#ifdef TWDEBUG
- xf86DrvMsg(0, X_INFO, "301C scaler: Table index %d\n");
+ xf86DrvMsg(0, X_INFO, "301C scaler: Table index %d\n", srindex301c);
#endif
for(j=0; j<64; j++) {
outSISIDXREG(SISPART2,(0xc0 + j), SiS301CScaling[srindex301c + j]);
@@ -10733,14 +11270,7 @@ 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);
- }
- }
+ SiSFixupSR11(pScrn);
if((!pSiS->UseVESA) && (pSiS->VBFlags & CRT2_ENABLE)) {
@@ -10850,6 +11380,7 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg)
case SIS_741:
case SIS_660:
case SIS_760:
+ case SIS_340:
if(myclock < 180) {
pSiS->MiscFlags |= MISC_CRT1OVERLAY;
if(myclock < 166) {
@@ -11083,7 +11614,7 @@ 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)) {
+ if(pSiS->VBFlags & VB_SISTAP4SCALER) {
for(i=0; i<64; i++) {
inSISIDXREG(SISPART2,(0xc0 + i),pSiS->scalingp2[i]);
}
@@ -11108,7 +11639,7 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg)
for(i=0; i<9; i++) {
pSiSEnt->scalingp4[i] = pSiS->scalingp4[i];
}
- if(pSiS->VBFlags & (VB_301C | VB_302ELV)) {
+ if(pSiS->VBFlags & VB_SISTAP4SCALER) {
for(i=0; i<64; i++) {
pSiSEnt->scalingp2[i] = pSiS->scalingp2[i];
}
@@ -11350,28 +11881,112 @@ SiSCalcVESAModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
USHORT
-SiS_CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned long VBFlags, BOOLEAN havecustommodes)
+SiS_GetModeNumber(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned long VBFlags)
{
SISPtr pSiS = SISPTR(pScrn);
UShort i = (pSiS->CurrentLayout.bitsPerPixel+7)/8 - 1;
+
+ return(SiS_GetModeID(pSiS->VGAEngine, VBFlags, mode->HDisplay, mode->VDisplay,
+ i, pSiS->FSTN, pSiS->LCDwidth, pSiS->LCDheight));
+}
+
+static BOOLEAN
+SiSValidLCDUserMode(SISPtr pSiS, unsigned long VBFlags, DisplayModePtr mode, BOOLEAN isforlcda)
+{
+ if(mode->Flags & V_INTERLACE) return FALSE;
+
+ if(mode->HDisplay > 2048) return FALSE;
+ if(mode->VDisplay > 1536) return FALSE;
+
+ if(VBFlags & VB_301C) {
+ if(mode->Clock > 162500) return FALSE;
+#ifdef VB_FORBID_CRT2LCD_OVER_1600
+ if(!isforlcda) {
+ if(mode->HDisplay > 1600) return FALSE;
+ }
+#endif
+ } else { /* 301, 301B, 302B (no LCDA!) */
+ if(mode->Clock > 108500) return FALSE;
+ if(mode->HDisplay > 1600) return FALSE;
+ if(mode->VDisplay > 1024) return FALSE;
+ }
+
+ return TRUE;
+}
+
+static BOOLEAN
+SiSValidVGA2UserMode(SISPtr pSiS, unsigned long VBFlags, DisplayModePtr mode)
+{
+ if(mode->Flags & V_INTERLACE) return FALSE;
+
+ if(mode->HDisplay > 2048) return FALSE;
+ if(mode->VDisplay > 1536) return FALSE;
+
+ if(VBFlags & VB_301C) {
+ if(mode->Clock > 203000) return FALSE;
+ } else if(VBFlags & (VB_301B|VB_302B)) {
+ if(mode->Clock > 162500) return FALSE;
+ } else {
+ if(mode->Clock > 135500) return FALSE;
+ }
+
+ return TRUE;
+}
+
+static USHORT
+SiS_CheckModeCRT1(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned long VBFlags, BOOLEAN havecustommodes)
+{
+ SISPtr pSiS = SISPTR(pScrn);
+ UShort i = (pSiS->CurrentLayout.bitsPerPixel+7)/8 - 1;
+ int j;
if(!(VBFlags & CRT1_LCDA)) {
+
if((havecustommodes) && (!(mode->type & M_T_DEFAULT))) {
return 0xfe;
}
+
+ } else if(VBFlags & VB_SISTMDSLCDABRIDGE) {
+
+ if(pSiS->SiS_Pr->CP_HaveCustomData) {
+ for(j=0; j<7; j++) {
+ if((pSiS->SiS_Pr->CP_DataValid[j]) &&
+ (mode->HDisplay == pSiS->SiS_Pr->CP_HDisplay[j]) &&
+ (mode->VDisplay == pSiS->SiS_Pr->CP_VDisplay[j]) &&
+ (mode->type & M_T_BUILTIN))
+ return 0xfe;
+ }
+ }
+
+ if((pSiS->AddedPlasmaModes) && (mode->type & M_T_BUILTIN))
+ return 0xfe;
+
+ if((havecustommodes) &&
+ (pSiS->LCDwidth) && /* = test if LCD present */
+ (!(mode->type & M_T_DEFAULT)) &&
+ (SiSValidLCDUserMode(pSiS, VBFlags, mode, TRUE)))
+ return 0xfe;
+
+ if((mode->HDisplay > pSiS->LCDwidth) ||
+ (mode->VDisplay > pSiS->LCDheight)) {
+ return 0;
+ }
+
} else {
+
if((mode->HDisplay > pSiS->LCDwidth) ||
(mode->VDisplay > pSiS->LCDheight)) {
return 0;
}
+
}
return(SiS_GetModeID(pSiS->VGAEngine, VBFlags, mode->HDisplay, mode->VDisplay,
i, pSiS->FSTN, pSiS->LCDwidth, pSiS->LCDheight));
}
-USHORT
-SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned long VBFlags, BOOLEAN havecustommodes)
+static USHORT
+SiS_CheckModeCRT2(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned long VBFlags, BOOLEAN havecustommodes)
{
SISPtr pSiS = SISPTR(pScrn);
UShort i = (pSiS->CurrentLayout.bitsPerPixel+7)/8 - 1;
@@ -11379,30 +11994,38 @@ SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned long VBF
int j;
#ifdef TWDEBUG
- xf86DrvMsg(0, X_INFO, "Inside CheckCalcModeIndex (VBFlags %x, mode %dx%d)\n",
+ xf86DrvMsg(0, X_INFO, "Inside CheckCalcModeIndex (VBFlags %lx, mode %dx%d)\n",
VBFlags,mode->HDisplay, mode->VDisplay);
#endif
if(VBFlags & CRT2_LCD) { /* CRT2 is LCD */
- if(pSiS->SiS_Pr->CP_HaveCustomData) {
- for(j=0; j<7; j++) {
- if((pSiS->SiS_Pr->CP_DataValid[j]) &&
- (mode->HDisplay == pSiS->SiS_Pr->CP_HDisplay[j]) &&
- (mode->VDisplay == pSiS->SiS_Pr->CP_VDisplay[j]) &&
- (mode->type & M_T_BUILTIN))
- return 0xfe;
- }
- }
-
- if((pSiS->AddedPlasmaModes) && (mode->type & M_T_BUILTIN))
- return 0xfe;
+ if((VBFlags & VB_SISTMDSBRIDGE) && (!(VBFlags & VB_30xBDH))) {
+
+ if(pSiS->SiS_Pr->CP_HaveCustomData) {
+ for(j=0; j<7; j++) {
+ if((pSiS->SiS_Pr->CP_DataValid[j]) &&
+ (mode->HDisplay == pSiS->SiS_Pr->CP_HDisplay[j]) &&
+ (mode->VDisplay == pSiS->SiS_Pr->CP_VDisplay[j]) &&
+#ifdef VB_FORBID_CRT2LCD_OVER_1600
+ (mode->HDisplay <= 1600) &&
+#endif
+ (mode->type & M_T_BUILTIN))
+ return 0xfe;
+ }
+ }
- if((havecustommodes) &&
- (pSiS->LCDwidth) && /* = test if LCD present */
- (!(mode->type & M_T_DEFAULT)) &&
- (!(mode->Flags & V_INTERLACE)))
- return 0xfe;
+ /* All plasma modes have HDisplay <= 1600 */
+ if((pSiS->AddedPlasmaModes) && (mode->type & M_T_BUILTIN))
+ return 0xfe;
+
+ if((havecustommodes) &&
+ (pSiS->LCDwidth) && /* = test if LCD present */
+ (!(mode->type & M_T_DEFAULT)) &&
+ (SiSValidLCDUserMode(pSiS, VBFlags, mode, FALSE)))
+ return 0xfe;
+
+ }
if( ((mode->HDisplay <= pSiS->LCDwidth) &&
(mode->VDisplay <= pSiS->LCDheight)) ||
@@ -11427,14 +12050,15 @@ SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned long VBF
if((havecustommodes) &&
(!(mode->type & M_T_DEFAULT)) &&
- (!(mode->Flags & V_INTERLACE)))
+ (SiSValidVGA2UserMode(pSiS, VBFlags, mode)))
return 0xfe;
ModeIndex = SiS_GetModeID_VGA2(pSiS->VGAEngine, VBFlags, mode->HDisplay, mode->VDisplay, i);
- } else { /* CRT1 only, no CRT2 */
+ } else { /* no CRT2 */
- ModeIndex = SiS_CalcModeIndex(pScrn, mode, VBFlags, havecustommodes);
+ /* Return a valid mode number */
+ ModeIndex = 0xfe;
}
@@ -11655,7 +12279,7 @@ unsigned char
SiS_GetSetBIOSScratch(ScrnInfoPtr pScrn, USHORT offset, unsigned char value)
{
unsigned char ret = 0;
-#if (defined(i386) || defined(__i386) || defined(__i386__) || defined(__AMD64__))
+#ifdef SIS_USE_BIOS_SCRATCH
unsigned char *base;
base = xf86MapVidMem(pScrn->scrnIndex, VIDMEM_MMIO, 0, 0x2000);
@@ -11667,8 +12291,9 @@ SiS_GetSetBIOSScratch(ScrnInfoPtr pScrn, USHORT offset, unsigned char value)
ret = *(base + offset);
/* value != 0xff means: set register */
- if(value != 0xff)
+ if(value != 0xff) {
*(base + offset) = value;
+ }
xf86UnMapVidMem(pScrn->scrnIndex, base, 0x2000);
#endif
@@ -11705,7 +12330,7 @@ sisSaveUnlockExtRegisterLock(SISPtr pSiS, unsigned char *reg1, unsigned char *re
inSISIDXREG(SISSR, i, val1);
inSISIDXREG(0x3c4, i, val2);
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_INFO,
- "SR%02d: RelIO=0x%02x 0x3c4=0x%02x (%d)\n",
+ "SR%02d: RelIO=0x%02x 0x3c4=0x%02x (%ld)\n",
i, val1, val2, mylockcalls);
}
#endif
diff --git a/src/sis_driver.h b/src/sis_driver.h
index d76cde0..761a25d 100644
--- a/src/sis_driver.h
+++ b/src/sis_driver.h
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h,v 1.8 2004/08/12 12:59:25 twini Exp $ */
/*
* Global data and definitions
*
@@ -15,7 +16,7 @@
* 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
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -75,6 +76,8 @@ static const struct _sis_vrate {
{7, 800, 600, 120, FALSE}, {8, 800, 600, 160, FALSE},
{1, 848, 480, 39, TRUE}, {2, 848, 480, 60, TRUE},
{1, 856, 480, 39, TRUE}, {2, 856, 480, 60, TRUE},
+ {1, 960, 540, 60, TRUE},
+ {1, 960, 600, 60, TRUE},
{1, 1024, 576, 60, TRUE}, {2, 1024, 576, 75, TRUE}, {3, 1024, 576, 85, TRUE},
{1, 1024, 600, 60, TRUE},
{1, 1024, 768, 43, TRUE}, {2, 1024, 768, 60, TRUE}, {3, 1024, 768, 70, FALSE},
@@ -94,6 +97,7 @@ static const struct _sis_vrate {
{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, 1080, 30, 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},
@@ -1283,6 +1287,10 @@ static ModeStatus SISValidMode(int scrnIndex, DisplayModePtr mode,
/* Internally used functions */
static Bool SISMapMem(ScrnInfoPtr pScrn);
static Bool SISUnmapMem(ScrnInfoPtr pScrn);
+#ifdef SIS_NEED_MAP_IOP
+static Bool SISMapIOPMem(ScrnInfoPtr pScrn);
+static Bool SISUnmapIOPMem(ScrnInfoPtr pScrn);
+#endif
static void SISSave(ScrnInfoPtr pScrn);
static void SISRestore(ScrnInfoPtr pScrn);
static void SISVESARestore(ScrnInfoPtr pScrn);
@@ -1302,18 +1310,21 @@ static void SISWaitVBRetrace(ScrnInfoPtr pScrn);
void SISWaitRetraceCRT1(ScrnInfoPtr pScrn);
void SISWaitRetraceCRT2(ScrnInfoPtr pScrn);
static Bool InRegion(int x, int y, region r);
+static USHORT SiS_CheckModeCRT1(ScrnInfoPtr pScrn, DisplayModePtr mode,
+ unsigned long VBFlags, BOOLEAN hcm);
+static USHORT SiS_CheckModeCRT2(ScrnInfoPtr pScrn, DisplayModePtr mode,
+ unsigned long VBFlags, BOOLEAN hcm);
#ifdef SISMERGED
static void SISMergePointerMoved(int scrnIndex, int x, int y);
#endif
BOOLEAN SiSBridgeIsInSlaveMode(ScrnInfoPtr pScrn);
-USHORT SiS_CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode,
- unsigned long VBFlags, BOOLEAN hcm);
-USHORT SiS_CheckCalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode,
- unsigned long VBFlags, BOOLEAN hcm);
+USHORT SiS_GetModeNumber(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned long VBFlags);
unsigned char SiS_GetSetBIOSScratch(ScrnInfoPtr pScrn, USHORT offset, unsigned char value);
#ifdef DEBUG
static void SiSDumpModeInfo(ScrnInfoPtr pScrn, DisplayModePtr mode);
#endif
+void SISDetermineLCDACap(ScrnInfoPtr pScrn);
+void SISSaveDetectedDevices(ScrnInfoPtr pScrn);
extern USHORT SiS_GetModeID(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay,
int Depth, BOOL FSTN, int LCDwith, int LCDheight);
@@ -1322,6 +1333,7 @@ extern USHORT SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, in
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 int SiSTranslateToOldMode(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);
diff --git a/src/sis_opt.c b/src/sis_opt.c
index b3dc1e7..6b5163a 100644
--- a/src/sis_opt.c
+++ b/src/sis_opt.c
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c,v 1.5 2004/07/26 22:40:56 twini Exp $ */
/*
* SiS driver option evaluation
*
@@ -15,7 +16,7 @@
* 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
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -26,10 +27,6 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * "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>
* ?
*/
@@ -124,6 +121,7 @@ typedef enum {
OPTION_XVDISABLECOLORKEY,
OPTION_XVINSIDECHROMAKEY,
OPTION_XVYUVCHROMAKEY,
+ OPTION_XVDEFAULTADAPTOR,
OPTION_SCALELCD,
OPTION_CENTERLCD,
OPTION_SPECIALTIMING,
@@ -146,6 +144,7 @@ typedef enum {
OPTION_ENABLESISCTRL,
OPTION_STOREDBRI,
OPTION_STOREDPBRI,
+ OPTION_OVERRULERANGES,
#ifdef SIS_CP
SIS_CP_OPT_OPTIONS
#endif
@@ -237,10 +236,12 @@ static const OptionInfoRec SISOptions[] = {
{ OPTION_XVYUVCHROMAKEY, "XvYUVChromaKey", OPTV_BOOLEAN, {0}, -1 },
{ OPTION_XVDISABLECOLORKEY, "XvDisableColorKey", OPTV_BOOLEAN, {0}, -1 },
{ OPTION_XVMEMCPY, "XvUseMemcpy", OPTV_BOOLEAN, {0}, -1 },
+ { OPTION_XVDEFAULTADAPTOR, "XvDefaultAdaptor", OPTV_STRING, {0}, -1 },
{ OPTION_SCALELCD, "ScaleLCD", OPTV_BOOLEAN, {0}, -1 },
{ OPTION_CENTERLCD, "CenterLCD", OPTV_BOOLEAN, {0}, -1 },
{ OPTION_ENABLEHOTKEY, "EnableHotkey", OPTV_BOOLEAN, {0}, -1 },
{ OPTION_ENABLESISCTRL, "EnableSiSCtrl", OPTV_BOOLEAN, {0}, -1 },
+ { OPTION_OVERRULERANGES, "OverruleFrequencyRanges",OPTV_BOOLEAN, {0}, -1 },
#ifdef SISMERGED
{ OPTION_MERGEDFB, "MergedFB", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_MERGEDFB2, "TwinView", OPTV_BOOLEAN, {0}, FALSE }, /* alias */
@@ -369,6 +370,7 @@ SiSOptions(ScrnInfoPtr pScrn)
pSiS->XvDefSat = 0;
pSiS->XvDefDisableGfx = FALSE;
pSiS->XvDefDisableGfxLR = FALSE;
+ pSiS->XvDefAdaptorBlit = FALSE;
pSiS->UsePanelScaler = -1;
pSiS->CenterLCD = -1;
pSiS->XvUseMemcpy = TRUE;
@@ -384,6 +386,7 @@ SiSOptions(ScrnInfoPtr pScrn)
pSiS->GammaPBriR = pSiS->GammaPBriG = pSiS->GammaPBriB = 1000;
pSiS->HideHWCursor = FALSE;
pSiS->HWCursorIsVisible = FALSE;
+ pSiS->OverruleRanges = TRUE;
#ifdef SISMERGED
pSiS->MergedFB = pSiS->MergedFBAuto = FALSE;
pSiS->CRT2Position = sisRightOf;
@@ -403,7 +406,7 @@ SiSOptions(ScrnInfoPtr pScrn)
/* Chipset dependent defaults */
if(pSiS->Chipset == PCI_CHIP_SIS530) {
- /* TW: TQ still broken on 530/620? */
+ /* TQ still broken on 530/620? */
pSiS->TurboQueue = FALSE;
}
@@ -587,6 +590,20 @@ SiSOptions(ScrnInfoPtr pScrn)
#endif
#endif
+ /* OverruleFrequencyRanges
+ *
+ * Enable/disable overruling bogus frequency ranges for TV and LCD(A)
+ */
+ if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
+ Bool val;
+ if(xf86GetOptValBool(pSiS->Options, OPTION_OVERRULERANGES, &val)) {
+ if(!val) {
+ pSiS->OverruleRanges = FALSE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Overruling frequency ranges disabled\n");
+ }
+ }
+ }
+
/*
* MergedFB
*
@@ -827,6 +844,9 @@ SiSOptions(ScrnInfoPtr pScrn)
if(xf86GetOptValBool(pSiS->Options, OPTION_XVONCRT2, &val)) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "XvOnCRT2");
}
+ if(xf86GetOptValString(pSiS->Options, OPTION_XVDEFAULTADAPTOR)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring, "XvDefaultAdaptor");
+ }
#ifdef SIS_CP
SIS_CP_OPT_DH_WARN
#endif
@@ -979,14 +999,15 @@ SiSOptions(ScrnInfoPtr pScrn)
if(strptr != NULL) {
if(!xf86NameCmp(strptr,"VGA")) {
pSiS->ForceCRT1Type = CRT1_VGA;
- } else if( (!xf86NameCmp(strptr,"LCD")) ||
- (!xf86NameCmp(strptr,"LCDA")) ||
- (!xf86NameCmp(strptr,"LCD-A")) ) {
+ } else if( (!xf86NameCmp(strptr,"LCD")) ||
+ (!xf86NameCmp(strptr,"LCDA")) ||
+ (!xf86NameCmp(strptr,"DVI-D")) ||
+ (!xf86NameCmp(strptr,"LCD-A")) ) {
pSiS->ForceCRT1Type = CRT1_LCDA;
} else {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mybadparm, strptr, "ForceCRT1Type");
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Valid parameters are \"VGA\" or \"LCD\"\n");
+ "Valid parameters are \"VGA\" or \"LCD\" (alias \"DVI-D\")\n");
}
}
}
@@ -1000,7 +1021,7 @@ SiSOptions(ScrnInfoPtr pScrn)
if(xf86GetOptValBool(pSiS->Options, OPTION_FORCECRT1, &val)) {
pSiS->forceCRT1 = val ? 1 : 0;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "CRT1 shall be forced to %s\n",
+ "CRT1 shall be forced %s\n",
val ? "ON" : "OFF");
if(!pSiS->forceCRT1) pSiS->ForceCRT1Type = CRT1_VGA;
}
@@ -1037,11 +1058,17 @@ SiSOptions(ScrnInfoPtr pScrn)
} else {
pSiS->ForceCRT2Type = 0;
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Can't set both CRT1 and CRT2 type to LCD; CRT2 disabled\n");
+ "Can't set both CRT1 and CRT2 type to LCD; CRT2 disabled\n");
+ }
+ } else if((!xf86NameCmp(strptr,"VGA")) || (!xf86NameCmp(strptr,"DVI-A"))) {
+ if(pSiS->ForceCRT1Type == CRT1_VGA) {
+ pSiS->ForceCRT2Type = CRT2_VGA;
+ } else {
+ pSiS->ForceCRT2Type = 0;
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "CRT2 can only be TV or off while CRT1 is LCD; CRT2 disabled\n");
}
- } else if((!xf86NameCmp(strptr,"VGA")) || (!xf86NameCmp(strptr,"DVI-A")))
- pSiS->ForceCRT2Type = CRT2_VGA;
- else if(!xf86NameCmp(strptr,"NONE"))
+ } else if(!xf86NameCmp(strptr,"NONE"))
pSiS->ForceCRT2Type = 0;
else if((!xf86NameCmp(strptr,"DSTN")) && (pSiS->Chipset == PCI_CHIP_SIS550)) {
if(pSiS->ForceCRT1Type == CRT1_VGA) {
@@ -1514,6 +1541,21 @@ SiSOptions(ScrnInfoPtr pScrn)
pSiS->CRT2gamma = val;
}
}
+
+ /* Default adaptor: Overlay (default) or Blitter */
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_XVDEFAULTADAPTOR))) {
+ if(!xf86NameCmp(strptr, "OVERLAY")) {
+ pSiS->XvDefAdaptorBlit = FALSE;
+ } else if(!xf86NameCmp(strptr, "BLITTER")) {
+ pSiS->XvDefAdaptorBlit = TRUE;
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mybadparm, strptr, "XvDefaultAdaptor");
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Valid parameters are \"OVERLAY\" or \"BLITTER\"\n");
+ }
+ }
+ }
#ifdef SIS_CP
SIS_CP_OPT_DOOPT
@@ -1558,11 +1600,12 @@ SiSOptions(ScrnInfoPtr pScrn)
* generated out of the known and supported modes. Use
* this option to disable this. NOT RECOMMENDED.
*/
- from = X_DEFAULT;
- if(xf86GetOptValBool(pSiS->Options, OPTION_NOINTERNALMODES, &pSiS->noInternalModes))
- from = X_CONFIG;
- xf86DrvMsg(pScrn->scrnIndex, from, "Usage of built-in modes is %s\n",
- pSiS->noInternalModes ? disabledstr : enabledstr);
+ if(xf86GetOptValBool(pSiS->Options, OPTION_NOINTERNALMODES, &pSiS->noInternalModes)) {
+ if(pSiS->noInternalModes) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Usage of built-in modes is %s\n", disabledstr);
+ }
+ }
+
}
/* ShadowFB */
@@ -1787,10 +1830,11 @@ SiSOptions(ScrnInfoPtr pScrn)
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Xv will %suse memcpy()\n",
val ? "" : "not ");
}
- /* XvGamma - enable/disable gamma correction for Xv
- * Supported for CRT1 only
- */
+
if(pSiS->VGAEngine == SIS_315_VGA) {
+ /* XvGamma - enable/disable gamma correction for Xv
+ * Supported for CRT1 only
+ */
if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_XVGAMMA))) {
if( (!xf86NameCmp(strptr,"off")) ||
(!xf86NameCmp(strptr,"false")) ||
diff --git a/src/sis_regs.h b/src/sis_regs.h
index b4f29fa..a2fe2c9 100644
--- a/src/sis_regs.h
+++ b/src/sis_regs.h
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h,v 1.4 2004/07/26 22:40:56 twini Exp $ */
/*
* Register definitions for old and 300 series
*
@@ -15,7 +16,7 @@
* 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
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -291,13 +292,13 @@
#define Index_VI_SubPict_Scale_Control 0x3D
/* (0x40 = enable/disable subpicture) */
-/* TW: Subpicture line buffer control */
+/* Subpicture line buffer control */
#define Index_VI_SubPict_Threshold 0x3E
-/* TW: What is this? */
+/* What is this? */
#define Index_VI_FIFO_Max 0x3F
-/* TW: Subpicture palette; 16 colors, total 32 bytes address space */
+/* Subpicture palette; 16 colors, total 32 bytes address space */
#define Index_VI_SubPict_Pal_Base_Low 0x40
#define Index_VI_SubPict_Pal_Base_High 0x41
@@ -307,7 +308,7 @@
#define Index_MPEG_Read_Ctrl2 0x62 /* MPEG auto flip */
#define Index_MPEG_Read_Ctrl3 0x63 /* MPEG auto flip */
-/* TW: MPEG AutoFlip scale */
+/* MPEG AutoFlip scale */
#define Index_MPEG_Ver_Up_Scale_Low 0x64
#define Index_MPEG_Ver_Up_Scale_High 0x65
@@ -317,9 +318,9 @@
#define Index_MPEG_UV_Buf_Preset_Middle 0x69
#define Index_MPEG_Y_UV_Buf_Preset_High 0x6A
-/* TW: The following registers only exist on the 315 series */
+/* The following registers only exist on the 315 series */
-/* TW: Bit 16:24 of Y_U_V buf start address */
+/* Bit 16:24 of Y_U_V buf start address */
#define Index_VI_Y_Buf_Start_Over 0x6B
#define Index_VI_U_Buf_Start_Over 0x6C
#define Index_VI_V_Buf_Start_Over 0x6D
@@ -336,11 +337,18 @@
#define Index_VI_Control_Misc3 0x74
+/* 340: */
+/* DDA registers 0x75 - 0xb4 */
+/* threshold high 0xb5, 0xb6 */
+#define Index_VI_Line_Buffer_Size_High 0xb7
+
+
/* Bits in Scale control (0x1c) */
#define VI_Scale_Ctrl_Horiz_DDA 0x20
#define VI_Scale_Ctrl_Vert_DDA 0x40
-/* TW: Bits (and helpers) for Index_VI_Control_Misc0 */
+/* Bits (and helpers) for Index_VI_Control_Misc0 */
+#define VI_Misc0_Enable_Capture_AutoFlip 0x01 /* 340 only? */
#define VI_Misc0_Enable_Overlay 0x02
#define VI_Misc0_420_Plane_Enable 0x04 /* Select Plane or Packed mode */
#define VI_Misc0_422_Enable 0x20 /* Select 422 or 411 mode */
@@ -352,7 +360,7 @@
#define VI_Misc0_Fmt_NV12 0x4c /* (330 series only?) */
#define VI_Misc0_ChromaKeyRGBYUV 0x40 /* 300 series only: 0 = RGB, 1 = YUV */
-/* TW: Bits for Index_VI_Control_Misc1 */
+/* Bits for Index_VI_Control_Misc1 */
#define VI_Misc1_DisableGraphicsAtOverlay 0x01 /* Disables graphics display in overlay area */
#define VI_Misc1_BOB_Enable 0x02 /* Enable BOB de-interlacer */
#define VI_Misc1_Line_Merge 0x04
@@ -362,7 +370,7 @@
/* #define VI_Misc1_? 0x40 */
/* #define VI_Misc1_? 0x80 */
-/* TW: Bits for Index_VI_Control_Misc2 */
+/* Bits for Index_VI_Control_Misc2 */
#define VI_Misc2_Select_Video2 0x01
#define VI_Misc2_Video2_On_Top 0x02
#define VI_Misc2_DisableGraphics 0x04 /* Disable graphics display entirely (<= 650 only, not >= M650, 651) */
@@ -372,12 +380,12 @@
#define VI_Misc2_Auto_Flip_Enable 0x40
#define VI_Misc2_Video_Reg_Write_Enable 0x80 /* 315 series only? */
-/* TW: Bits for Index_VI_Control_Misc3 */
+/* Bits for Index_VI_Control_Misc3 */
#define VI_Misc3_Submit_Video_1 0x01 /* AKA "address ready" */
#define VI_Misc3_Submit_Video_2 0x02 /* AKA "address ready" */
#define VI_Misc3_Submit_SubPict 0x04 /* AKA "address ready" */
-/* TW: Values for Index_VI_Key_Overlay_OP (0x2F) */
+/* Values for Index_VI_Key_Overlay_OP (0x2F) */
#define VI_ROP_Never 0x00
#define VI_ROP_DestKey 0x03
#define VI_ROP_ChromaKey 0x05
@@ -469,10 +477,10 @@
#define Index_VI6326_Control_Misc5 0xBE /* (Datasheet: 530/620 ONLY - not correct) */
#define Index_VI6326_Control_Misc6 0xB2 /* 5597 and 6326 only! */
-/* TW: What is this? not a register, obviously */
+/* What is this? not a register, obviously */
#define Index_VI6326_FIFO_Max 0x3F
-/* TW: Bits (and helpers) for Index_VI6326_Control_Misc0 */
+/* Bits (and helpers) for Index_VI6326_Control_Misc0 */
#define VI6326_Misc0_EnableCapture 0x01 /* 1 = on, 0 = off (6326 only) */
#define VI6326_Misc0_EnableOverlay 0x02 /* 1 = on, 0 = off */
#define VI6326_Misc0_VideoOnly 0x10 /* 1 = video only, 0 = gfx + video */
@@ -480,7 +488,7 @@
#define VI6326_Misc0_VideoFormat 0x40 /* 1 = YUV, 0 = RGB */
#define VI6326_Misc0_FieldPolarity 0x80 /* 1 = *Odd / Even, 0 = Odd / *Even (6326 only) */
-/* TW: Bits for Index_VI6326_Control_Misc1 (ALL 6326 ONLY) */
+/* Bits for Index_VI6326_Control_Misc1 (ALL 6326 ONLY) */
#define VI6326_Misc1_EnableYUVCapture 0x01 /* 0 = RGB, 1 = YUV */
#define VI6326_Misc1_EnableCaptureDithering 0x02 /* 0 = disable, 1 = enable */
#define VI6326_Misc1_CaptureFormat555 0x04 /* 1 = 555, 0 = 565 */
@@ -493,7 +501,7 @@
#define VI6326_Misc1_EnableVBSyncIRQ 0x40 /* 1 = Enable IRQ on vertical blank */
#define VI6326_Misc1_ClearVBSyncIRQ 0x80 /* Clear pending irq */
-/* TW: Bits for Index_VI6326_Control_Misc3 */
+/* Bits for Index_VI6326_Control_Misc3 */
#define VI6326_Misc3_UVCaptureFormat 0x01 /* 1 = 2's complement, 0 = CCIR 601 (6326 only) */
#define VI6326_Misc3_UVOverlayFormat 0x02 /* 1 = 2's complement, 0 = CCIR 601 */
#define VI6326_Misc3_ChromaKeyFormat 0x04 /* 1 = YUV, 0 = RGB */
@@ -503,7 +511,7 @@
#define VI6326_Misc3_BT819A 0x40 /* 1 = enable, 0 = disable (6326 only) */
#define VI6326_Misc3_SystemMemFB 0x80 /* 1 = enable, 0 = disable (6326 only) */
-/* TW: Bits for Index_VI6326_Control_Misc4 */
+/* Bits for Index_VI6326_Control_Misc4 */
#define VI6326_Misc4_CPUVideoFormatMask 0x03
#define VI6326_Misc4_CPUVideoFormatRGB555 0x00
#define VI6326_Misc4_CPUVideoFormatYUV422 0x01
@@ -511,12 +519,12 @@
#define VI6326_Misc4_EnableYUV420 0x04 /* 1 = enable, 0 = disable */
/** #define WHATISTHIS 0x40 */
-/* TW: Bits for Index_VI6326_Control_Misc5 (all 530/620 only) */
+/* Bits for Index_VI6326_Control_Misc5 (all 530/620 only) */
#define VI6326_Misc5_LineBufferMerge 0x10 /* 0 = disable, 1=enable */
#define VI6326_Misc5_VPlaneBit20 0x04
#define VI6326_Misc5_UPlaneBit20 0x02
-/* TW: Bits for Index_VI6326_Control_Misc6 (5597 and 6326 only) */
+/* Bits for Index_VI6326_Control_Misc6 (5597 and 6326 only) */
#define VI6326_Misc6_Decimation 0x80 /* 0=disable 1=enable video decimation */
/* Video format selection */
@@ -527,14 +535,14 @@
#define VI_6326_VideoRGB555 0x00
#define VI_6326_VideoRGB565 0x40
-/* TW: Values for Index_VI6326_Key_Overlay_OP */
+/* Values for Index_VI6326_Key_Overlay_OP */
#define VI6326_ROP_Never 0x00
#define VI6326_ROP_DestKey 0x03
#define VI6326_ROP_Always 0x0F
/* --- end of 6326 video registers ---------------------------------- */
-/* TW register base (6326 only) */
+/* register base (6326 only) */
#define Index_TV6326_TVOutIndex 0xE0
#define Index_TV6326_TVOutData 0xE1
@@ -569,7 +577,7 @@
#define _VIN_FIELD_BOTH 4
-/* i2c registers (TW; not on 300/315 series) */
+/* i2c registers (not on 300/315 series) */
#define X_INDEXREG 0x14
#define X_PORTREG 0x15
#define X_DATA 0x0f
@@ -580,7 +588,7 @@
/* mmio registers for video */
#define REG_PRIM_CRT_COUNTER 0x8514
-/* TW: MPEG MMIO registers (630 and later) ----------------------------------------- */
+/* MPEG MMIO registers (630 and later) ----------------------------------------- */
/* Not public (yet?) */
diff --git a/src/sis_setup.c b/src/sis_setup.c
index 884e03a..0155ce7 100644
--- a/src/sis_setup.c
+++ b/src/sis_setup.c
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c,v 1.4 2004/07/26 22:40:56 twini Exp $ */
/*
* Basic hardware and memory detection
*
@@ -15,7 +16,7 @@
* 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
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -66,10 +67,11 @@ static const char *dramTypeStr[] = {
"ESDRAM",
"DDR SDRAM", /* for 550/650/etc */
"DDR SDRAM", /* for 550/650/etc */
- "VCM" /* for 630 */
+ "VCM", /* for 630 */
+ "DDR2 SDRAM",
"" };
-/* TW: MCLK tables for SiS6326 */
+/* MCLK tables for SiS6326 */
static const int SiS6326MCLKIndex[4][8] = {
{ 10, 12, 14, 16, 17, 18, 19, 7 }, /* SGRAM */
{ 4, 6, 8, 10, 11, 12, 13, 3 }, /* Fast Page */
@@ -166,7 +168,7 @@ sisOldSetup(ScrnInfoPtr pScrn)
i = SiS6326MCLKIndex[i][temp];
pSiS->MemClock = SiS6326MCLK[i].mclk;
#if 0
- /* TW: Correct invalid MCLK settings by old BIOSes */
+ /* Correct invalid MCLK settings by old BIOSes */
newsr13 = SiS6326MCLK[i].sr13;
newsr28 = SiS6326MCLK[i].sr28;
newsr29 = SiS6326MCLK[i].sr29;
@@ -350,7 +352,7 @@ sis300Setup(ScrnInfoPtr pScrn)
pSiS->BusWidth);
}
-/* For 315, 315H, 315PRO, 330 */
+/* For 315, 315H, 315PRO, 330, 340 */
static void
sis315Setup(ScrnInfoPtr pScrn)
{
@@ -360,14 +362,14 @@ sis315Setup(ScrnInfoPtr pScrn)
int busDDRA[4] = {64+32, 64+32 , (64+32)*2, (64+32)*2};
unsigned int config, config1, config2, sr3a;
char *dramTypeStr315[] = {
- "Single Channel 1 rank SDR SDRAM",
- "Single Channel 1 rank SDR SGRAM",
- "Single Channel 1 rank DDR SDRAM",
- "Single Channel 1 rank DDR SGRAM",
- "Single Channel 2 rank SDR SDRAM",
- "Single Channel 2 rank SDR SGRAM",
- "Single Channel 2 rank DDR SDRAM",
- "Single Channel 2 rank DDR SGRAM",
+ "Single channel 1 rank SDR SDRAM",
+ "Single channel 1 rank SDR SGRAM",
+ "Single channel 1 rank DDR SDRAM",
+ "Single channel 1 rank DDR SGRAM",
+ "Single channel 2 rank SDR SDRAM",
+ "Single channel 2 rank SDR SGRAM",
+ "Single channel 2 rank DDR SDRAM",
+ "Single channel 2 rank DDR SGRAM",
"Asymmetric SDR SDRAM",
"Asymmetric SDR SGRAM",
"Asymmetric DDR SDRAM",
@@ -393,6 +395,23 @@ sis315Setup(ScrnInfoPtr pScrn)
"",
"Dual channel DDR SDRAM",
""};
+ char *dramTypeStr340[] = {
+ "Single channel 1 Rank DDR SDRAM",
+ "Single channel 1 Rank DDR2 SDRAM",
+ "Single channel 1 Rank DDR2x SDRAM",
+ "",
+ "Single channel 2 Rank DDR SDRAM",
+ "Single channel 2 Rank DDR2 SDRAM",
+ "Single channel 2 Rank DDR2x SDRAM",
+ "",
+ "Dual channel 1 rank DDR SDRAM",
+ "Dual channel 1 rank DDR2 SDRAM",
+ "Dual channel 1 rank DDR2x SDRAM",
+ "",
+ "Quad channel 1 rank DDR SDRAM",
+ "Quad channel 1 rank DDR2 SDRAM",
+ "Quad channel 1 rank DDR2x SDRAM",
+ ""};
inSISIDXREG(SISSR, 0x14, config);
config1 = (config & 0x0C) >> 2;
@@ -401,40 +420,75 @@ sis315Setup(ScrnInfoPtr pScrn)
pScrn->videoRam = (1 << ((config & 0xF0) >> 4)) * 1024;
- if(pSiS->Chipset == PCI_CHIP_SIS330) {
+ if(pSiS->Chipset == PCI_CHIP_SIS340) {
+
+ pSiS->IsAGPCard = TRUE;
+
+ if(config1 == 0x02) pScrn->videoRam <<= 1; /* dual rank */
+ else if(config1 == 0x03) pScrn->videoRam <<= 2; /* quad rank */
+
+ inSISIDXREG(SISSR, 0x39, config2);
+ config2 &= 0x02;
+ if(!config2) {
+ inSISIDXREG(SISSR, 0x3a, config2);
+ config2 = (config2 & 0x02) >> 1;
+ }
+
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "DRAM type: %s\n", dramTypeStr340[(config1 * 4) + (config2 & 0x03)]);
+
+ } else if(pSiS->Chipset == PCI_CHIP_SIS330) {
pSiS->IsAGPCard = TRUE;
if(config1) pScrn->videoRam <<= 1;
+
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "DRAM type: %s\n", dramTypeStr330[(config1 * 4) + (config2 & 0x02)]);
} else {
pSiS->IsAGPCard = ((sr3a & 0x30) == 0x30) ? FALSE : TRUE;
/* If SINGLE_CHANNEL_2_RANK or DUAL_CHANNEL_1_RANK -> mem * 2 */
- if((config1 == 0x01) || (config1 == 0x03))
+ if((config1 == 0x01) || (config1 == 0x03)) {
pScrn->videoRam <<= 1;
+ }
/* If DDR asymetric -> mem * 1,5 */
- if(config1 == 0x02)
- pScrn->videoRam += pScrn->videoRam/2;
+ if(config1 == 0x02) pScrn->videoRam += pScrn->videoRam/2;
+
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "DRAM type: %s\n", dramTypeStr315[(config1 * 4) + config2]);
}
pSiS->MemClock = SiSMclk(pSiS);
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "DRAM type: %s\n",
- (pSiS->Chipset == PCI_CHIP_SIS330) ?
- dramTypeStr330[(config1 * 4) + (config2 & 0x02)] :
- dramTypeStr315[(config1 * 4) + config2]);
-
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"Memory clock: %3.3f MHz\n",
pSiS->MemClock/1000.0);
- /* TW: DDR -> mclk * 2 - needed for bandwidth calculation */
- if(pSiS->Chipset == PCI_CHIP_SIS330) {
+ /* DDR -> mclk * 2 - needed for bandwidth calculation */
+ if(pSiS->Chipset == PCI_CHIP_SIS340) {
+
+ pSiS->MemClock *= 2; /* at least DDR */
+
+ inSISIDXREG(SISCR,0x97,config);
+ if(!(config & 0x10)) {
+ inSISIDXREG(SISSR,0x39,config);
+ config = (config & 0x02) >> 1;
+ } else config &= 0x01;
+
+ if(config) {
+ pSiS->MemClock *= 2; /* DDR2 ? */
+ pSiS->BusWidth = 32;
+ } else {
+ pSiS->BusWidth = 64;
+ }
+
+ } else if(pSiS->Chipset == PCI_CHIP_SIS330) {
+
if(config2 & 0x02) {
pSiS->MemClock *= 2;
if(config1 == 0x02) {
@@ -449,7 +503,9 @@ sis315Setup(ScrnInfoPtr pScrn)
pSiS->BusWidth = busSDR[(config & 0x02)];
}
}
+
} else {
+
if(config2 & 0x02) pSiS->MemClock *= 2;
if(config1 == 0x02)
pSiS->BusWidth = busDDRA[(config & 0x03)];
@@ -457,6 +513,7 @@ sis315Setup(ScrnInfoPtr pScrn)
pSiS->BusWidth = busDDR[(config & 0x03)];
else
pSiS->BusWidth = busSDR[(config & 0x03)];
+
}
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
@@ -474,6 +531,7 @@ sis550Setup(ScrnInfoPtr pScrn)
BOOLEAN alldone = FALSE;
pSiS->IsAGPCard = TRUE;
+ pSiS->ChipFlags &= ~SiSCF_760UMA;
pSiS->MemClock = SiSMclk(pSiS);
@@ -482,25 +540,44 @@ sis550Setup(ScrnInfoPtr pScrn)
if(pSiS->sishw_ext.jChipType >= SIS_660) {
/* UMA - shared fb */
- pSiS->ChipFlags &= ~SiSCF_760UMA;
pciconfig = pciReadByte(0x00000000, 0x4c);
if(pciconfig & 0xe0) {
- pScrn->videoRam = ((1 << (pciconfig & 0xe0) >> 5) - 2) * 32768;
+ pScrn->videoRam = (1 << (((pciconfig & 0xe0) >> 5) - 2)) * 32768;
pSiS->ChipFlags |= SiSCF_760UMA;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "%dK shared video RAM\n",
+ "%dK shared video RAM (UMA)\n",
pScrn->videoRam);
} else pScrn->videoRam = 0;
- /* LFB - local framebuffer */
- pciconfig = (pciReadByte(0x00000800, 0xcd) >> 1) & 0x03;
- if(pciconfig == 0x01) pScrn->videoRam += 32768;
- else if(pciconfig == 0x03) pScrn->videoRam += 65536;
+ /* LFB - local framebuffer: PCI reg hold total RAM (but configurable in BIOS) */
+ pciconfig = pciReadByte(0x00000800, 0xcd);
+ pciconfig = (pciconfig >> 1) & 0x03;
+ i = 0;
+ if(pciconfig == 0x01) i = 32768;
+ else if(pciconfig == 0x03) i = 65536;
+ if(i) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "%dK total local framebuffer RAM (LFB)\n", i);
+ }
+
+ /* LFB: CR78 holds amount of LFB memory configured in the BIOS setup */
+ inSISIDXREG(SISCR, 0x78, config);
+ config &= 0x30;
+ if(config) {
+ i = 0;
+ if(config == 0x10) i = 32768;
+ else if(config == 0x30) i = 65536;
+ if(i) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "%dK configured local framebuffer RAM (LFB)\n", i);
+ pScrn->videoRam += i;
+ pSiS->ChipFlags |= SiSCF_760LFB;
+ }
+ }
if((pScrn->videoRam < 32768) || (pScrn->videoRam > 131072)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Illegal video Ram size (%d) detected, using BIOS setting\n",
+ "Illegal video RAM size (%dK) detected, using BIOS provided setting\n",
pScrn->videoRam);
+ pSiS->ChipFlags &= ~(SiSCF_760LFB | SiSCF_760UMA);
} else {
pSiS->BusWidth = 64;
ramtype = 8;
@@ -509,22 +586,20 @@ sis550Setup(ScrnInfoPtr pScrn)
} else {
- int dimmnum, maxmem;
+ int dimmnum;
if(pSiS->sishw_ext.jChipType == SIS_741) {
dimmnum = 4;
- maxmem = 131072;
} else { /* 661 */
dimmnum = 3;
- maxmem = 65536;
}
pciconfig = pciReadByte(0x00000000, 0x64);
if(pciconfig & 0x80) {
pScrn->videoRam = (1 << (((pciconfig & 0x70) >> 4) - 1)) * 32768;
- if((pScrn->videoRam < 32768) || (pScrn->videoRam > maxmem)) {
+ if((pScrn->videoRam < 32768) || (pScrn->videoRam > (128 * 1024))) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Illegal video RAM size (%d) detected, using BIOS setting\n",
+ "Illegal video RAM size (%dK) detected, using BIOS provided setting\n",
pScrn->videoRam);
} else {
pSiS->BusWidth = 64;
@@ -540,17 +615,18 @@ sis550Setup(ScrnInfoPtr pScrn)
}
}
pciconfig = pciReadByte(0x00000000, 0x7c);
- if(pciconfig & 0x02) ramtype = 8;
- else ramtype = 4;
+ ramtype = (pciconfig & 0x02) ? 8 : 4;
+#if 0
if(pSiS->sishw_ext.jChipType == SIS_741) {
- /* Is this really correct? */
+ /* Is this really correct? - Doesn't seem so*/
ramtype = 12 - ramtype;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"SiS741 PCI RamType %d\n", ramtype);
/* For now, we don't trust it */
- inSISIDXREG(SISSR, 0x79, config);
+ inSISIDXREG(SISCR, 0x79, config);
ramtype = (config & 0x01) ? 8 : 4;
}
+#endif
alldone = TRUE;
}
}
@@ -596,6 +672,8 @@ sis550Setup(ScrnInfoPtr pScrn)
}
+ /* Fall back to BIOS detection results in case of problems: */
+
if(!alldone) {
if(pSiS->Chipset == PCI_CHIP_SIS660) {
@@ -606,12 +684,14 @@ sis550Setup(ScrnInfoPtr pScrn)
pScrn->videoRam = 0;
if(config & 0xf0) {
pScrn->videoRam = (1 << ((config & 0xf0) >> 4)) * 1024;
+ pSiS->ChipFlags |= SiSCF_760UMA;
}
inSISIDXREG(SISCR, 0x78, config);
config &= 0x30;
if(config) {
if(config == 0x10) pScrn->videoRam += 32768;
else pScrn->videoRam += 65536;
+ pSiS->ChipFlags |= SiSCF_760LFB;
}
} else {
pScrn->videoRam = (1 << ((config & 0xf0) >> 4)) * 1024;
@@ -655,26 +735,27 @@ SiSSetup(ScrnInfoPtr pScrn)
pSiS->Flags = 0;
pSiS->VBFlags = 0;
- switch (SISPTR(pScrn)->Chipset) {
- case PCI_CHIP_SIS300:
- case PCI_CHIP_SIS630: /* +730 */
- case PCI_CHIP_SIS540:
+ switch (SISPTR(pScrn)->Chipset) {
+ case PCI_CHIP_SIS300:
+ case PCI_CHIP_SIS630: /* +730 */
+ case PCI_CHIP_SIS540:
sis300Setup(pScrn);
break;
- case PCI_CHIP_SIS315:
- case PCI_CHIP_SIS315H:
- case PCI_CHIP_SIS315PRO:
- case PCI_CHIP_SIS330:
+ case PCI_CHIP_SIS315:
+ case PCI_CHIP_SIS315H:
+ case PCI_CHIP_SIS315PRO:
+ case PCI_CHIP_SIS330:
+ case PCI_CHIP_SIS340:
sis315Setup(pScrn);
break;
- case PCI_CHIP_SIS550:
- case PCI_CHIP_SIS650: /* + 740 */
- case PCI_CHIP_SIS660: /* + 661,741,760 */
+ case PCI_CHIP_SIS550:
+ case PCI_CHIP_SIS650: /* + 740,M650,651 */
+ case PCI_CHIP_SIS660: /* + (M)661,(M)741,(M)760 */
sis550Setup(pScrn);
break;
- case PCI_CHIP_SIS5597:
- case PCI_CHIP_SIS6326:
- case PCI_CHIP_SIS530:
+ case PCI_CHIP_SIS5597:
+ case PCI_CHIP_SIS6326:
+ case PCI_CHIP_SIS530:
default:
sisOldSetup(pScrn);
break;
diff --git a/src/sis_shadow.c b/src/sis_shadow.c
index e2c4a11..3869f6e 100644
--- a/src/sis_shadow.c
+++ b/src/sis_shadow.c
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.c,v 1.3 2004/06/17 13:20:14 twini Exp $ */
/*
* Copyright (C) 1999-2004 by The XFree86 Project, Inc.
* based on code written by Mark Vojkovich
@@ -39,96 +40,88 @@
#include "sis_shadow.h"
void
+SISPointerMoved(int index, int x, int y)
+{
+ ScrnInfoPtr pScrn = xf86Screens[index];
+ SISPtr pSiS = SISPTR(pScrn);
+
+ if(pSiS->Rotate == 1) {
+ (*pSiS->PointerMoved)(index, pScrn->pScreen->height - y - 1, x);
+ } else {
+ (*pSiS->PointerMoved)(index, y, pScrn->pScreen->width - x - 1);
+ }
+}
+
+void
SISRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
{
SISPtr pSiS = SISPTR(pScrn);
- int width, height, Bpp, FBPitch;
- unsigned char *src, *dst;
+ int width, height, Bpp, FBPitch;
+ CARD8 *src, *dst;
Bpp = pScrn->bitsPerPixel >> 3;
FBPitch = BitmapBytePad(pScrn->displayWidth * pScrn->bitsPerPixel);
while(num--) {
- width = (pbox->x2 - pbox->x1) * Bpp;
- height = pbox->y2 - pbox->y1;
- src = pSiS->ShadowPtr + (pbox->y1 * pSiS->ShadowPitch) +
- (pbox->x1 * Bpp);
- dst = pSiS->FbBase + (pbox->y1 * FBPitch) + (pbox->x1 * Bpp);
-
- while(height--) {
- memcpy(dst, src, width);
- dst += FBPitch;
- src += pSiS->ShadowPitch;
- }
+ width = (pbox->x2 - pbox->x1) * Bpp;
+ height = pbox->y2 - pbox->y1;
+ src = pSiS->ShadowPtr + (pbox->y1 * pSiS->ShadowPitch) + (pbox->x1 * Bpp);
+ dst = pSiS->FbBase + (pbox->y1 * FBPitch) + (pbox->x1 * Bpp);
+
+ while(height--) {
+ memcpy(dst, src, width);
+ dst += FBPitch;
+ src += pSiS->ShadowPitch;
+ }
- pbox++;
+ pbox++;
}
}
void
-SISPointerMoved(int index, int x, int y)
-{
- ScrnInfoPtr pScrn = xf86Screens[index];
- SISPtr pSiS = SISPTR(pScrn);
- int newX, newY;
-
- if(pSiS->Rotate == 1) {
- newX = pScrn->pScreen->height - y - 1;
- newY = x;
- } else {
- newX = y;
- newY = pScrn->pScreen->width - x - 1;
- }
-
- (*pSiS->PointerMoved)(index, newX, newY);
-}
-
-void
SISRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
{
SISPtr pSiS = SISPTR(pScrn);
- int count, width, height, y1, y2, dstPitch, srcPitch;
- CARD8 *dstPtr, *srcPtr, *src;
+ int count, width, height, y1, y2, dstPitch, srcPitch;
+ CARD8 *dstPtr, *srcPtr, *src;
CARD32 *dst;
dstPitch = pScrn->displayWidth;
srcPitch = -pSiS->Rotate * pSiS->ShadowPitch;
while(num--) {
- width = pbox->x2 - pbox->x1;
- y1 = pbox->y1 & ~3;
- y2 = (pbox->y2 + 3) & ~3;
- height = (y2 - y1) >> 2; /* in dwords */
-
- if(pSiS->Rotate == 1) {
- dstPtr = pSiS->FbBase +
- (pbox->x1 * dstPitch) + pScrn->virtualX - y2;
- srcPtr = pSiS->ShadowPtr + ((1 - y2) * srcPitch) + pbox->x1;
- } else {
- dstPtr = pSiS->FbBase +
- ((pScrn->virtualY - pbox->x2) * dstPitch) + y1;
- srcPtr = pSiS->ShadowPtr + (y1 * srcPitch) + pbox->x2 - 1;
- }
-
- while(width--) {
- src = srcPtr;
- dst = (CARD32*)dstPtr;
- count = height;
- while(count--) {
- *(dst++) = src[0] | (src[srcPitch] << 8) |
- (src[srcPitch * 2] << 16) |
- (src[srcPitch * 3] << 24);
- src += srcPitch * 4;
- }
- srcPtr += pSiS->Rotate;
- dstPtr += dstPitch;
- }
-
- pbox++;
+ width = pbox->x2 - pbox->x1;
+ y1 = pbox->y1 & ~3;
+ y2 = (pbox->y2 + 3) & ~3;
+ height = (y2 - y1) >> 2; /* in dwords */
+
+ if(pSiS->Rotate == 1) {
+ dstPtr = pSiS->FbBase + (pbox->x1 * dstPitch) + pScrn->virtualX - y2;
+ srcPtr = pSiS->ShadowPtr + ((1 - y2) * srcPitch) + pbox->x1;
+ } else {
+ dstPtr = pSiS->FbBase + ((pScrn->virtualY - pbox->x2) * dstPitch) + y1;
+ srcPtr = pSiS->ShadowPtr + (y1 * srcPitch) + pbox->x2 - 1;
+ }
+
+ while(width--) {
+ src = srcPtr;
+ dst = (CARD32 *)dstPtr;
+ count = height;
+ while(count--) {
+ *(dst++) = src[0] |
+ (src[srcPitch] << 8) |
+ (src[srcPitch * 2] << 16) |
+ (src[srcPitch * 3] << 24);
+ src += (srcPitch * 4);
+ }
+ srcPtr += pSiS->Rotate;
+ dstPtr += dstPitch;
+ }
+
+ pbox++;
}
}
-
void
SISRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
{
@@ -141,89 +134,86 @@ SISRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
srcPitch = -pSiS->Rotate * pSiS->ShadowPitch >> 1;
while(num--) {
- width = pbox->x2 - pbox->x1;
- y1 = pbox->y1 & ~1;
- y2 = (pbox->y2 + 1) & ~1;
- height = (y2 - y1) >> 1; /* in dwords */
-
- if(pSiS->Rotate == 1) {
- dstPtr = (CARD16*)pSiS->FbBase +
- (pbox->x1 * dstPitch) + pScrn->virtualX - y2;
- srcPtr = (CARD16*)pSiS->ShadowPtr +
- ((1 - y2) * srcPitch) + pbox->x1;
- } else {
- dstPtr = (CARD16*)pSiS->FbBase +
- ((pScrn->virtualY - pbox->x2) * dstPitch) + y1;
- srcPtr = (CARD16*)pSiS->ShadowPtr +
- (y1 * srcPitch) + pbox->x2 - 1;
- }
-
- while(width--) {
- src = srcPtr;
- dst = (CARD32*)dstPtr;
- count = height;
- while(count--) {
- *(dst++) = src[0] | (src[srcPitch] << 16);
- src += srcPitch * 2;
- }
- srcPtr += pSiS->Rotate;
- dstPtr += dstPitch;
- }
-
- pbox++;
+ width = pbox->x2 - pbox->x1;
+ y1 = pbox->y1 & ~1;
+ y2 = (pbox->y2 + 1) & ~1;
+ height = (y2 - y1) >> 1; /* in dwords */
+
+ if(pSiS->Rotate == 1) {
+ dstPtr = (CARD16 *)pSiS->FbBase + (pbox->x1 * dstPitch) + pScrn->virtualX - y2;
+ srcPtr = (CARD16 *)pSiS->ShadowPtr + ((1 - y2) * srcPitch) + pbox->x1;
+ } else {
+ dstPtr = (CARD16 *)pSiS->FbBase + ((pScrn->virtualY - pbox->x2) * dstPitch) + y1;
+ srcPtr = (CARD16 *)pSiS->ShadowPtr + (y1 * srcPitch) + pbox->x2 - 1;
+ }
+
+ while(width--) {
+ src = srcPtr;
+ dst = (CARD32 *)dstPtr;
+ count = height;
+ while(count--) {
+ *(dst++) = src[0] | (src[srcPitch] << 16);
+ src += (srcPitch * 2);
+ }
+ srcPtr += pSiS->Rotate;
+ dstPtr += dstPitch;
+ }
+
+ pbox++;
}
}
-
/* this one could be faster */
void
SISRefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
{
SISPtr pSiS = SISPTR(pScrn);
- int count, width, height, y1, y2, dstPitch, srcPitch;
- CARD8 *dstPtr, *srcPtr, *src;
+ int count, width, height, y1, y2, dstPitch, srcPitch;
+ CARD8 *dstPtr, *srcPtr, *src;
CARD32 *dst;
dstPitch = BitmapBytePad(pScrn->displayWidth * 24);
srcPitch = -pSiS->Rotate * pSiS->ShadowPitch;
while(num--) {
- width = pbox->x2 - pbox->x1;
- y1 = pbox->y1 & ~3;
- y2 = (pbox->y2 + 3) & ~3;
- height = (y2 - y1) >> 2; /* blocks of 3 dwords */
-
- if(pSiS->Rotate == 1) {
- dstPtr = pSiS->FbBase +
- (pbox->x1 * dstPitch) + ((pScrn->virtualX - y2) * 3);
- srcPtr = pSiS->ShadowPtr + ((1 - y2) * srcPitch) + (pbox->x1 * 3);
- } else {
- dstPtr = pSiS->FbBase +
- ((pScrn->virtualY - pbox->x2) * dstPitch) + (y1 * 3);
- srcPtr = pSiS->ShadowPtr + (y1 * srcPitch) + (pbox->x2 * 3) - 3;
- }
-
- while(width--) {
- src = srcPtr;
- dst = (CARD32*)dstPtr;
- count = height;
- while(count--) {
- dst[0] = src[0] | (src[1] << 8) | (src[2] << 16) |
- (src[srcPitch] << 24);
- dst[1] = src[srcPitch + 1] | (src[srcPitch + 2] << 8) |
- (src[srcPitch * 2] << 16) |
- (src[(srcPitch * 2) + 1] << 24);
- dst[2] = src[(srcPitch * 2) + 2] | (src[srcPitch * 3] << 8) |
- (src[(srcPitch * 3) + 1] << 16) |
- (src[(srcPitch * 3) + 2] << 24);
- dst += 3;
- src += srcPitch * 4;
- }
- srcPtr += pSiS->Rotate * 3;
- dstPtr += dstPitch;
- }
-
- pbox++;
+ width = pbox->x2 - pbox->x1;
+ y1 = pbox->y1 & ~3;
+ y2 = (pbox->y2 + 3) & ~3;
+ height = (y2 - y1) >> 2; /* blocks of 3 dwords */
+
+ if(pSiS->Rotate == 1) {
+ dstPtr = pSiS->FbBase + (pbox->x1 * dstPitch) + ((pScrn->virtualX - y2) * 3);
+ srcPtr = pSiS->ShadowPtr + ((1 - y2) * srcPitch) + (pbox->x1 * 3);
+ } else {
+ dstPtr = pSiS->FbBase + ((pScrn->virtualY - pbox->x2) * dstPitch) + (y1 * 3);
+ srcPtr = pSiS->ShadowPtr + (y1 * srcPitch) + (pbox->x2 * 3) - 3;
+ }
+
+ while(width--) {
+ src = srcPtr;
+ dst = (CARD32 *)dstPtr;
+ count = height;
+ while(count--) {
+ dst[0] = src[0] |
+ (src[1] << 8) |
+ (src[2] << 16) |
+ (src[srcPitch] << 24);
+ dst[1] = src[srcPitch + 1] |
+ (src[srcPitch + 2] << 8) |
+ (src[srcPitch * 2] << 16) |
+ (src[(srcPitch * 2) + 1] << 24);
+ dst[2] = src[(srcPitch * 2) + 2] |
+ (src[srcPitch * 3] << 8) |
+ (src[(srcPitch * 3) + 1] << 16) |
+ (src[(srcPitch * 3) + 2] << 24);
+ dst += 3;
+ src += (srcPitch << 2);
+ }
+ srcPtr += pSiS->Rotate * 3;
+ dstPtr += dstPitch;
+ }
+
+ pbox++;
}
}
@@ -231,40 +221,36 @@ void
SISRefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
{
SISPtr pSiS = SISPTR(pScrn);
- int count, width, height, dstPitch, srcPitch;
+ int count, width, height, dstPitch, srcPitch;
CARD32 *dstPtr, *srcPtr, *src, *dst;
dstPitch = pScrn->displayWidth;
srcPitch = -pSiS->Rotate * pSiS->ShadowPitch >> 2;
while(num--) {
- width = pbox->x2 - pbox->x1;
- height = pbox->y2 - pbox->y1;
-
- if(pSiS->Rotate == 1) {
- dstPtr = (CARD32*)pSiS->FbBase +
- (pbox->x1 * dstPitch) + pScrn->virtualX - pbox->y2;
- srcPtr = (CARD32*)pSiS->ShadowPtr +
- ((1 - pbox->y2) * srcPitch) + pbox->x1;
- } else {
- dstPtr = (CARD32*)pSiS->FbBase +
- ((pScrn->virtualY - pbox->x2) * dstPitch) + pbox->y1;
- srcPtr = (CARD32*)pSiS->ShadowPtr +
- (pbox->y1 * srcPitch) + pbox->x2 - 1;
- }
-
- while(width--) {
- src = srcPtr;
- dst = dstPtr;
- count = height;
- while(count--) {
- *(dst++) = *src;
- src += srcPitch;
- }
- srcPtr += pSiS->Rotate;
- dstPtr += dstPitch;
- }
-
- pbox++;
+ width = pbox->x2 - pbox->x1;
+ height = pbox->y2 - pbox->y1;
+
+ if(pSiS->Rotate == 1) {
+ dstPtr = (CARD32 *)pSiS->FbBase + (pbox->x1 * dstPitch) + pScrn->virtualX - pbox->y2;
+ srcPtr = (CARD32 *)pSiS->ShadowPtr + ((1 - pbox->y2) * srcPitch) + pbox->x1;
+ } else {
+ dstPtr = (CARD32 *)pSiS->FbBase + ((pScrn->virtualY - pbox->x2) * dstPitch) + pbox->y1;
+ srcPtr = (CARD32 *)pSiS->ShadowPtr + (pbox->y1 * srcPitch) + pbox->x2 - 1;
+ }
+
+ while(width--) {
+ src = srcPtr;
+ dst = dstPtr;
+ count = height;
+ while(count--) {
+ *(dst++) = *src;
+ src += srcPitch;
+ }
+ srcPtr += pSiS->Rotate;
+ dstPtr += dstPitch;
+ }
+
+ pbox++;
}
}
diff --git a/src/sis_vb.c b/src/sis_vb.c
index c2f578d..fc36b84 100644
--- a/src/sis_vb.c
+++ b/src/sis_vb.c
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c,v 1.13 2004/08/20 18:57:06 kem Exp $ */
/*
* Video bridge detection and configuration for 300, 315 and 330 series
*
@@ -15,7 +16,7 @@
* 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
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -40,67 +41,74 @@
#include "sis_vb.h"
#include "sis_dac.h"
+extern BOOLEAN SiS_GetPanelID(SiS_Private *SiS_Pr, PSIS_HW_INFO HwDeviceExtension);
+extern USHORT SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS);
+extern USHORT SiS_SenseVGA2DDC(SiS_Private *SiS_Pr, SISPtr pSiS);
+
+extern void SISDetermineLCDACap(ScrnInfoPtr pScrn);
+extern void SISSaveDetectedDevices(ScrnInfoPtr pScrn);
+
extern void SISWaitRetraceCRT1(ScrnInfoPtr pScrn);
extern unsigned char SiS_GetSetBIOSScratch(ScrnInfoPtr pScrn, USHORT offset, unsigned char value);
static const SiS_LCD_StStruct SiS300_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_1280x960, 1280, 960, LCD_1280x960 }, /* 4 */
- { VB_LCD_640x480, 640, 480, LCD_640x480 }, /* 5 */
- { VB_LCD_1024x600, 1024, 600, LCD_1024x600 }, /* 6 */
- { VB_LCD_1152x768, 1152, 768, LCD_1152x768 }, /* 7 */
- { VB_LCD_1024x768, 1024, 768, LCD_1024x768 }, /* 8 */
- { VB_LCD_1024x768, 1024, 768, LCD_1024x768 }, /* 9 */
- { VB_LCD_1280x768, 1280, 768, LCD_1280x768 }, /* a */
- { VB_LCD_1024x768, 1024, 768, LCD_1024x768 }, /* b */
- { VB_LCD_1024x768, 1024, 768, LCD_1024x768 }, /* c */
- { VB_LCD_1024x768, 1024, 768, LCD_1024x768 }, /* d */
- { VB_LCD_320x480, 320, 480, LCD_320x480 }, /* e */
- { VB_LCD_CUSTOM, 0, 0, LCD_CUSTOM } /* f */
+ { VB_LCD_1024x768, 1024, 768 }, /* 0 - invalid */
+ { VB_LCD_800x600, 800, 600 }, /* 1 */
+ { VB_LCD_1024x768, 1024, 768 }, /* 2 */
+ { VB_LCD_1280x1024,1280, 1024 }, /* 3 */
+ { VB_LCD_1280x960, 1280, 960 }, /* 4 */
+ { VB_LCD_640x480, 640, 480 }, /* 5 */
+ { VB_LCD_1024x600, 1024, 600 }, /* 6 */
+ { VB_LCD_1152x768, 1152, 768 }, /* 7 */
+ { VB_LCD_1024x768, 1024, 768 }, /* 8 */
+ { VB_LCD_1024x768, 1024, 768 }, /* 9 */
+ { VB_LCD_1280x768, 1280, 768 }, /* a */
+ { VB_LCD_1024x768, 1024, 768 }, /* b */
+ { VB_LCD_1024x768, 1024, 768 }, /* c */
+ { VB_LCD_1024x768, 1024, 768 }, /* d */
+ { VB_LCD_320x480, 320, 480 }, /* e */
+ { VB_LCD_CUSTOM, 0, 0 } /* f */
};
static const SiS_LCD_StStruct SiS315_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_640x480_2, 640, 480, LCD_640x480_2 }, /* c DSTN/FSTN */
- { VB_LCD_640x480_3, 640, 480, LCD_640x480_3 }, /* d DSTN/FSTN */
- { VB_LCD_320x480, 320, 480, LCD_320x480 }, /* e */
- { VB_LCD_CUSTOM, 0, 0, LCD_CUSTOM, } /* f */
+ { VB_LCD_1024x768, 1024, 768 }, /* 0 - invalid */
+ { VB_LCD_800x600, 800, 600 }, /* 1 */
+ { VB_LCD_1024x768, 1024, 768 }, /* 2 */
+ { VB_LCD_1280x1024,1280, 1024 }, /* 3 */
+ { VB_LCD_640x480, 640, 480 }, /* 4 */
+ { VB_LCD_1024x600, 1024, 600 }, /* 5 */
+ { VB_LCD_1152x864, 1152, 864 }, /* 6 */
+ { VB_LCD_1280x960, 1280, 960 }, /* 7 */
+ { VB_LCD_1152x768, 1152, 768 }, /* 8 */
+ { VB_LCD_1400x1050,1400, 1050 }, /* 9 */
+ { VB_LCD_1280x768, 1280, 768 }, /* a */
+ { VB_LCD_1600x1200,1600, 1200 }, /* b */
+ { VB_LCD_640x480_2, 640, 480 }, /* c DSTN/FSTN */
+ { VB_LCD_640x480_3, 640, 480 }, /* d DSTN/FSTN */
+ { VB_LCD_320x480, 320, 480 }, /* e */
+ { VB_LCD_CUSTOM, 0, 0 } /* 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 */
+ { VB_LCD_1024x768, 1024, 768 }, /* 0 - invalid */
+ { VB_LCD_800x600, 800, 600 }, /* 1 */
+ { VB_LCD_1024x768, 1024, 768 }, /* 2 */
+ { VB_LCD_1280x1024,1280, 1024 }, /* 3 */
+ { VB_LCD_640x480, 640, 480 }, /* 4 */
+ { VB_LCD_1024x600, 1024, 600 }, /* 5 */
+ { VB_LCD_1152x864, 1152, 864 }, /* 6 */
+ { VB_LCD_1280x960, 1280, 960 }, /* 7 */
+ { VB_LCD_1152x768, 1152, 768 }, /* 8 */
+ { VB_LCD_1400x1050,1400, 1050 }, /* 9 */
+ { VB_LCD_1280x768, 1280, 768 }, /* a */
+ { VB_LCD_1600x1200,1600, 1200 }, /* b */
+ { VB_LCD_1280x800, 1280, 800 }, /* c */
+ { VB_LCD_1680x1050,1680, 1050 }, /* d */
+ { VB_LCD_1280x720, 1280, 720 }, /* e */
+ { VB_LCD_CUSTOM, 0, 0 } /* f */
};
static Bool
@@ -127,14 +135,13 @@ SiS_SISDetectCRT1(ScrnInfoPtr pScrn)
Bool mustwait = FALSE;
inSISIDXREG(SISSR,0x1F,SR1F);
- orSISIDXREG(SISSR,0x1F,0x04);
- andSISIDXREG(SISSR,0x1F,0x3F);
+ setSISIDXREG(SISSR,0x1F,0x3f,0x04);
if(SR1F & 0xc0) mustwait = TRUE;
if(pSiS->VGAEngine == SIS_315_VGA) {
inSISIDXREG(SISCR,pSiS->myCR63,CR63);
CR63 &= 0x40;
- andSISIDXREG(SISCR,pSiS->myCR63,0xBF);
+ andSISIDXREG(SISCR,pSiS->myCR63,0xbf);
}
inSISIDXREG(SISCR,0x17,CR17);
@@ -149,19 +156,44 @@ SiS_SISDetectCRT1(ScrnInfoPtr pScrn)
if(mustwait) {
for(i=0; i < 10; i++) SISWaitRetraceCRT1(pScrn);
}
+
+ if(pSiS->sishw_ext.jChipType >= SIS_330) {
+ int watchdog;
+ if(pSiS->sishw_ext.jChipType >= SIS_340) {
+ outSISIDXREG(SISCR, 0x57, 0x4a);
+ } else {
+ outSISIDXREG(SISCR, 0x57, 0x5f);
+ }
+ orSISIDXREG(SISCR, 0x53, 0x02);
+ watchdog = 655360;
+ while((!((inSISREG(SISINPSTAT)) & 0x01)) && --watchdog);
+ watchdog = 655360;
+ while(((inSISREG(SISINPSTAT)) & 0x01) && --watchdog);
+ if((inSISREG(SISMISCW)) & 0x10) temp = 1;
+ andSISIDXREG(SISCR, 0x53, 0xfd);
+ outSISIDXREG(SISCR, 0x57, 0x00);
+#ifdef TWDEBUG
+ xf86DrvMsg(0, X_INFO, "330: Found CRT1: %s\n", (temp == 1) ? "yes" : "no");
+#endif
+ }
- i = 3;
- do {
- temp = SiS_HandleDDC(pSiS->SiS_Pr, pSiS->VBFlags, pSiS->VGAEngine, 0, 0, NULL);
- } while(((temp == 0) || (temp == 0xffff)) && i--);
+ if(temp == 0xffff) {
+ i = 3;
+ do {
+ temp = SiS_HandleDDC(pSiS->SiS_Pr, pSiS->VBFlags, pSiS->VGAEngine, 0, 0, NULL);
+ } while(((temp == 0) || (temp == 0xffff)) && i--);
- if((temp == 0) || (temp == 0xffff)) {
- if(TestDDC1(pScrn)) temp = 1;
+ if((temp == 0) || (temp == 0xffff)) {
+ if(TestDDC1(pScrn)) temp = 1;
+ }
}
-
+
if((temp) && (temp != 0xffff)) {
orSISIDXREG(SISCR,0x32,0x20);
ret = 1;
+ } else if(pSiS->sishw_ext.jChipType >= SIS_330) {
+ andSISIDXREG(SISCR,0x32,~0x20);
+ ret = 0;
}
if(pSiS->VGAEngine == SIS_315_VGA) {
@@ -204,8 +236,13 @@ void SISCRT1PreInit(ScrnInfoPtr pScrn)
inSISIDXREG(SISCR, 0x32, CR32);
- if(CR32 & 0x20) CRT1Detected = 1;
- else CRT1Detected = SiS_SISDetectCRT1(pScrn);
+ if(pSiS->sishw_ext.jChipType >= SIS_330) {
+ /* Works reliably on 330 and later */
+ CRT1Detected = SiS_SISDetectCRT1(pScrn);
+ } else {
+ if(CR32 & 0x20) CRT1Detected = 1;
+ else CRT1Detected = SiS_SISDetectCRT1(pScrn);
+ }
if(CR32 & 0x5F) OtherDevices = 1;
@@ -226,17 +263,20 @@ void SISCRT1PreInit(ScrnInfoPtr pScrn)
}
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "%sCRT1 (VGA) connection detected\n",
+ "%sCRT1/VGA detected\n",
CRT1Detected ? "" : "No ");
}
/* Detect CRT2-LCD and LCD size */
-void SISLCDPreInit(ScrnInfoPtr pScrn)
+void SISLCDPreInit(ScrnInfoPtr pScrn, Bool quiet)
{
SISPtr pSiS = SISPTR(pScrn);
unsigned char CR32, CR36, CR37, CR7D=0, tmp;
-
- pSiS->LCDwidth = 0;
+
+ pSiS->VBFlags &= ~(CRT2_LCD);
+ pSiS->VBLCDFlags = 0;
+ pSiS->LCDwidth = 0;
+ pSiS->LCDheight = 0;
if(!(pSiS->VBFlags & VB_VIDEOBRIDGE)) return;
@@ -265,21 +305,25 @@ void SISLCDPreInit(ScrnInfoPtr pScrn)
*/
#ifdef SISDUALHEAD
if((!pSiS->DualHeadMode) || (!pSiS->SecondHead)) {
-#endif
+#endif
if((pSiS->VGAEngine == SIS_315_VGA) &&
- (pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)) &&
- (!(pSiS->VBFlags & VB_30xBDH))) {
+ (pSiS->VBFlags & VB_SISTMDSBRIDGE) &&
+ (!(pSiS->VBFlags & VB_30xBDH)) &&
+ (pSiS->VESA != 1)) {
if(pSiS->forcecrt2redetection) {
pSiS->VBFlags &= ~CRT2_LCD;
+ /* Do NOT clear CR32[D3] here! */
}
if(!(pSiS->nocrt2ddcdetection)) {
if((!(pSiS->VBFlags & CRT2_LCD)) && (!(CR32 & 0x10))) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "%s LCD/plasma panel, sensing via DDC\n",
- pSiS->forcecrt2redetection ?
- "Forced re-detection of" : "BIOS detected no");
+ if(!quiet) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s LCD/plasma panel, sensing via DDC\n",
+ pSiS->forcecrt2redetection ?
+ "Forced re-detection of" : "BIOS detected no");
+ }
if(SiS_SenseLCDDDC(pSiS->SiS_Pr, pSiS)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"DDC error during LCD panel detection\n");
@@ -304,7 +348,11 @@ void SISLCDPreInit(ScrnInfoPtr pScrn)
if(pSiS->VBFlags & CRT2_LCD) {
inSISIDXREG(SISCR, 0x36, CR36);
inSISIDXREG(SISCR, 0x37, CR37);
- inSISIDXREG(SISCR, 0x7D, CR7D);
+ if(pSiS->sishw_ext.jChipType < SIS_661) {
+ inSISIDXREG(SISCR, 0x3C, CR7D);
+ } else {
+ inSISIDXREG(SISCR, 0x7D, CR7D);
+ }
if(pSiS->SiS_Pr->SiS_CustomT == CUT_BARCO1366) {
pSiS->VBLCDFlags |= VB_LCD_BARCO1366;
pSiS->LCDwidth = 1360;
@@ -324,23 +372,39 @@ void SISLCDPreInit(ScrnInfoPtr pScrn)
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
"Assuming LCD/plasma panel (848x480, expanding, RGB24)\n");
} else {
- if((pSiS->VGAEngine == SIS_315_VGA) && (!CR36)) {
- /* 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;
- else pSiS->SiS_Pr->SiS_IF_DEF_LVDS = 0;
- SiS_GetPanelID(pSiS->SiS_Pr, &pSiS->sishw_ext);
- inSISIDXREG(SISCR, 0x36, CR36);
- inSISIDXREG(SISCR, 0x37, CR37);
+ if(CR36 == 0) {
+ /* Old 650/301LV and ECS A907 BIOS versions "forget" to set CR36, CR37 */
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ if(pSiS->sishw_ext.jChipType < SIS_661) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "BIOS provided invalid panel size, probing...\n");
+ if(pSiS->VBFlags & VB_LVDS) pSiS->SiS_Pr->SiS_IF_DEF_LVDS = 1;
+ else pSiS->SiS_Pr->SiS_IF_DEF_LVDS = 0;
+ SiS_GetPanelID(pSiS->SiS_Pr, &pSiS->sishw_ext);
+ inSISIDXREG(SISCR, 0x36, CR36);
+ inSISIDXREG(SISCR, 0x37, CR37);
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Broken BIOS, unable to determine panel size, disabling LCD\n");
+ pSiS->VBFlags &= ~CRT2_LCD;
+ return;
+ }
+ } else if(pSiS->VGAEngine == SIS_300_VGA) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "BIOS provided invalid panel size, assuming 1024x768, RGB18\n");
+ setSISIDXREG(SISCR,0x36,0xf0,0x02);
+ setSISIDXREG(SISCR,0x37,0xee,0x01);
+ CR36 = 0x02;
+ inSISIDXREG(SISCR,0x37,CR37);
+ }
}
- if(((CR36 & 0x0f) == 0x0f) && (pSiS->SiS_Pr->CP_HaveCustomData)) {
+ if((CR36 & 0x0f) == 0x0f) {
pSiS->VBLCDFlags |= VB_LCD_CUSTOM;
pSiS->LCDheight = pSiS->SiS_Pr->CP_MaxY;
pSiS->LCDwidth = pSiS->SiS_Pr->CP_MaxX;
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",
+ "Detected LCD/Plasma panel (max. X %d Y %d, pref. %dx%d, RGB%d)\n",
pSiS->SiS_Pr->CP_MaxX, pSiS->SiS_Pr->CP_MaxY,
pSiS->SiS_Pr->CP_PreferredX, pSiS->SiS_Pr->CP_PreferredY,
(CR37 & 0x01) ? 18 : 24);
@@ -371,8 +435,7 @@ void SISLCDPreInit(ScrnInfoPtr pScrn)
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"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)) ?
+ ((pSiS->VGAEngine == SIS_315_VGA) && (!pSiS->ROM661New)) ?
((CR36 & 0x0f) - 1) : ((CR36 & 0xf0) >> 4),
(CR37 & 0x10) ? "" : "non-",
(CR37 & 0x01) ? 18 : 24,
@@ -384,12 +447,12 @@ void SISLCDPreInit(ScrnInfoPtr pScrn)
}
/* Detect CRT2-TV connector type and PAL/NTSC flag */
-void SISTVPreInit(ScrnInfoPtr pScrn)
+void SISTVPreInit(ScrnInfoPtr pScrn, Bool quiet)
{
SISPtr pSiS = SISPTR(pScrn);
unsigned char SR16, SR38, CR32, CR35=0, CR38=0, CR79, CR39;
int temp = 0;
-
+
if(!(pSiS->VBFlags & VB_VIDEOBRIDGE)) return;
inSISIDXREG(SISCR, 0x32, CR32);
@@ -432,7 +495,7 @@ void SISTVPreInit(ScrnInfoPtr pScrn)
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(pSiS->NewCRLayout) {
if(CR38 & 0x04) {
switch(CR35 & 0xE0) {
case 0x20: pSiS->VBFlags |= TV_YPBPR525P; break;
@@ -496,7 +559,7 @@ void SISTVPreInit(ScrnInfoPtr pScrn)
else if(CR38 & 0x80) pSiS->VBFlags |= TV_PALN;
} else
pSiS->VBFlags |= TV_NTSC;
- } else if(pSiS->Chipset == PCI_CHIP_SIS660) {
+ } else if(pSiS->NewCRLayout) {
if(SR38 & 0x01) {
pSiS->VBFlags |= TV_PAL;
if(CR35 & 0x04) pSiS->VBFlags |= TV_PALM;
@@ -515,7 +578,7 @@ void SISTVPreInit(ScrnInfoPtr pScrn)
}
}
- if(pSiS->VBFlags & (TV_SCART|TV_SVIDEO|TV_AVIDEO)) {
+ if((pSiS->VBFlags & (TV_SCART|TV_SVIDEO|TV_AVIDEO)) && !quiet) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected default TV standard %s\n",
(pSiS->VBFlags & TV_NTSC) ?
((pSiS->VBFlags & TV_NTSCJ) ? "NTSCJ" : "NTSC") :
@@ -523,16 +586,16 @@ void SISTVPreInit(ScrnInfoPtr pScrn)
((pSiS->VBFlags & TV_PALN) ? "PALN" : "PAL")));
}
- if(pSiS->VBFlags & TV_HIVISION) {
+ if((pSiS->VBFlags & TV_HIVISION) && !quiet) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "BIOS reports HiVision TV\n");
}
- if((pSiS->VBFlags & VB_CHRONTEL) && (pSiS->VBFlags & (TV_CHSCART|TV_CHYPBPR525I))) {
+ if((pSiS->VBFlags & VB_CHRONTEL) && (pSiS->VBFlags & (TV_CHSCART|TV_CHYPBPR525I)) && !quiet) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Chrontel: %s forced\n",
(pSiS->VBFlags & TV_CHSCART) ? "SCART (PAL)" : "YPbPr (480i)");
}
- if(pSiS->VBFlags & TV_YPBPR) {
+ if((pSiS->VBFlags & TV_YPBPR) && !quiet) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected YPbPr TV (by default %s)\n",
(pSiS->VBFlags & TV_YPBPR525I) ? "480i" :
((pSiS->VBFlags & TV_YPBPR525P) ? "480p" :
@@ -541,15 +604,13 @@ void SISTVPreInit(ScrnInfoPtr pScrn)
}
/* Detect CRT2-VGA */
-void SISCRT2PreInit(ScrnInfoPtr pScrn)
+void SISCRT2PreInit(ScrnInfoPtr pScrn, Bool quiet)
{
SISPtr pSiS = SISPTR(pScrn);
unsigned char CR32;
- 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))
+ /* CRT2-VGA only supported on these bridges */
+ if(!(pSiS->VBFlags & VB_SISVGA2BRIDGE))
return;
inSISIDXREG(SISCR, 0x32, CR32);
@@ -572,28 +633,26 @@ void SISCRT2PreInit(ScrnInfoPtr pScrn)
* which is prone to be misdetected as a secondary VGA)
*/
if(!(pSiS->nocrt2ddcdetection)) {
- if(pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B)) {
- if(!(pSiS->VBFlags & (CRT2_VGA | CRT2_LCD))) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "%s secondary VGA, sensing via DDC\n",
- pSiS->forcecrt2redetection ?
+ if(!(pSiS->VBFlags & (CRT2_VGA | CRT2_LCD))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s secondary VGA, sensing via DDC\n",
+ pSiS->forcecrt2redetection ?
"Forced re-detection of" : "BIOS detected no");
- if(SiS_SenseVGA2DDC(pSiS->SiS_Pr, pSiS)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ if(SiS_SenseVGA2DDC(pSiS->SiS_Pr, pSiS)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"DDC error during secondary VGA detection\n");
- } else {
- inSISIDXREG(SISCR, 0x32, CR32);
- if(CR32 & 0x10) {
- pSiS->VBFlags |= CRT2_VGA;
- pSiS->postVBCR32 |= 0x10;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ } else {
+ inSISIDXREG(SISCR, 0x32, CR32);
+ if(CR32 & 0x10) {
+ pSiS->VBFlags |= CRT2_VGA;
+ pSiS->postVBCR32 |= 0x10;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"Detected secondary VGA connection\n");
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"No secondary VGA connection detected\n");
- }
}
- }
+ }
}
}
#ifdef SISDUALHEAD
@@ -601,5 +660,454 @@ void SISCRT2PreInit(ScrnInfoPtr pScrn)
#endif
}
+static int
+SISDoSense(ScrnInfoPtr pScrn, unsigned short type, unsigned short test)
+{
+ 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 */
+void
+SISSense30x(ScrnInfoPtr pScrn, Bool quiet)
+{
+ SISPtr pSiS = SISPTR(pScrn);
+ unsigned char backupP4_0d,backupP2_00,backupP2_4d,backupSR_1e,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; */
+
+ if(!(pSiS->VBFlags & VB_SISBRIDGE)) return;
+
+ 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;
+
+ if(pSiS->Chipset == PCI_CHIP_SIS300) {
+ inSISIDXREG(SISSR,0x3b,myflag);
+ if(!(myflag & 0x01)) vga2 = vga2_c = 0;
+ }
+
+ 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) ||
+ (pSiS->Chipset == PCI_CHIP_SIS340)) {
+ if(pSiS->ROM661New) {
+ biosflag = 2;
+ vga2 = GETROMWORD(0x63);
+ if(pSiS->BIOS[0x6f] & 0x01) {
+ if(pSiS->VBFlags2 & VB_SISUMC) vga2 = GETROMWORD(0x4d);
+ }
+ 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_SISVGA2BRIDGE)) {
+ vga2 = vga2_c = 0;
+ }
+
+ inSISIDXREG(SISSR,0x1e,backupSR_1e);
+ orSISIDXREG(SISSR,0x1e,0x20);
+
+ inSISIDXREG(SISPART4,0x0d,backupP4_0d);
+ if(pSiS->VBFlags & VB_301C) {
+ setSISIDXREG(SISPART4,0x0d,~0x07,0x01);
+ } else {
+ orSISIDXREG(SISPART4,0x0d,0x04);
+ }
+ SiS_DDC2Delay(pSiS->SiS_Pr, 0x2000);
+
+ inSISIDXREG(SISPART2,0x00,backupP2_00);
+ outSISIDXREG(SISPART2,0x00,((backupP2_00 | 0x1c) & 0xfc));
+
+ inSISIDXREG(SISPART2,0x4d,backupP2_4d);
+ if(pSiS->VBFlags & VB_SISYPBPRBRIDGE) {
+ outSISIDXREG(SISPART2,0x4d,(backupP2_4d & ~0x10));
+ }
+
+ if(!(pSiS->VBFlags & VB_301C)) {
+ SISDoSense(pScrn, 0, 0);
+ }
+
+ andSISIDXREG(SISCR, 0x32, ~0x14);
+ pSiS->postVBCR32 &= ~0x14;
+
+ if(vga2_c || vga2) {
+ if(SISDoSense(pScrn, vga2, vga2_c)) {
+ if(biosflag & 0x01) {
+ if(!quiet) {
+ 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 {
+ if(!quiet) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "SiS30x: Detected secondary VGA connection\n");
+ }
+ pSiS->VBFlags |= VGA2_CONNECTED;
+ orSISIDXREG(SISCR, 0x32, 0x10);
+ pSiS->postVBCR32 |= 0x10;
+ }
+ }
+ if(biosflag & 0x01) pSiS->SiS_SD_Flags |= SiS_SD_VBHASSCART;
+ }
+
+ andSISIDXREG(SISCR, 0x32, 0x3f);
+ pSiS->postVBCR32 &= 0x3f;
+
+ if(pSiS->VBFlags & VB_301C) {
+ orSISIDXREG(SISPART4,0x0d,0x04);
+ }
+
+ if((pSiS->VGAEngine == SIS_315_VGA) && (pSiS->VBFlags & VB_SISYPBPRBRIDGE)) {
+ if(pSiS->SenseYPbPr) {
+ outSISIDXREG(SISPART2,0x4d,(backupP2_4d | 0x10));
+ SiS_DDC2Delay(pSiS->SiS_Pr, 0x2000);
+ /* New BIOS (2.x) uses vga2 sensing here for all bridges >301LV */
+ if((result = SISDoSense(pScrn, svhs, 0x0604))) {
+ if((result = SISDoSense(pScrn, cvbs, 0x0804))) {
+ if(!quiet) {
+ 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 & TV_YPBPR)) {
+
+ if((result = SISDoSense(pScrn, svhs, svhs_c))) {
+ if(!quiet) {
+ 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)) {
+ if(SISDoSense(pScrn, cvbs, cvbs_c)) {
+ if(!quiet) {
+ 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);
+
+ outSISIDXREG(SISPART2,0x00,backupP2_00);
+ outSISIDXREG(SISPART4,0x0d,backupP4_0d);
+ outSISIDXREG(SISSR,0x1e,backupSR_1e);
+
+ if(pSiS->VBFlags & VB_301C) {
+ inSISIDXREG(SISPART2,0x00,biosflag);
+ if(biosflag & 0x20) {
+ for(myflag = 2; myflag > 0; myflag--) {
+ biosflag ^= 0x20;
+ outSISIDXREG(SISPART2,0x00,biosflag);
+ }
+ }
+ }
+
+ outSISIDXREG(SISPART2,0x00,backupP2_00);
+}
+
+void
+SISSenseChrontel(ScrnInfoPtr pScrn, Bool quiet)
+{
+ SISPtr pSiS = SISPTR(pScrn);
+ int temp1=0, temp2, i;
+ unsigned char test[3];
+
+ if(pSiS->SiS_Pr->SiS_IF_DEF_CH70xx == 1) {
+
+ /* Chrontel 700x */
+
+ /* Read power status */
+ temp1 = SiS_GetCH700x(pSiS->SiS_Pr, 0x0e); /* Power status */
+ if((temp1 & 0x03) != 0x03) {
+ /* Power all outputs */
+ SiS_SetCH700x(pSiS->SiS_Pr, 0x0B0E);
+ SiS_DDC2Delay(pSiS->SiS_Pr, 0x96);
+ }
+ /* Sense connected TV devices */
+ for(i = 0; i < 3; i++) {
+ SiS_SetCH700x(pSiS->SiS_Pr, 0x0110);
+ SiS_DDC2Delay(pSiS->SiS_Pr, 0x96);
+ SiS_SetCH700x(pSiS->SiS_Pr, 0x0010);
+ SiS_DDC2Delay(pSiS->SiS_Pr, 0x96);
+ temp1 = SiS_GetCH700x(pSiS->SiS_Pr, 0x10);
+ if(!(temp1 & 0x08)) test[i] = 0x02;
+ else if(!(temp1 & 0x02)) test[i] = 0x01;
+ else test[i] = 0;
+ SiS_DDC2Delay(pSiS->SiS_Pr, 0x96);
+ }
+
+ if(test[0] == test[1]) temp1 = test[0];
+ else if(test[0] == test[2]) temp1 = test[0];
+ else if(test[1] == test[2]) temp1 = test[1];
+ else {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Chrontel: TV detection unreliable - test results varied\n");
+ temp1 = test[2];
+ }
+
+ } else if(pSiS->SiS_Pr->SiS_IF_DEF_CH70xx == 2) {
+
+ /* Chrontel 701x */
+
+ /* Backup Power register */
+ temp1 = SiS_GetCH701x(pSiS->SiS_Pr, 0x49);
+
+ /* Enable TV path */
+ SiS_SetCH701x(pSiS->SiS_Pr, 0x2049);
+
+ SiS_DDC2Delay(pSiS->SiS_Pr, 0x96);
+
+ /* Sense connected TV devices */
+ temp2 = SiS_GetCH701x(pSiS->SiS_Pr, 0x20);
+ temp2 |= 0x01;
+ SiS_SetCH701x(pSiS->SiS_Pr, (temp2 << 8) | 0x20);
+
+ SiS_DDC2Delay(pSiS->SiS_Pr, 0x96);
+
+ temp2 ^= 0x01;
+ SiS_SetCH701x(pSiS->SiS_Pr, (temp2 << 8) | 0x20);
+
+ SiS_DDC2Delay(pSiS->SiS_Pr, 0x96);
+
+ temp2 = SiS_GetCH701x(pSiS->SiS_Pr, 0x20);
+
+ /* Restore Power register */
+ SiS_SetCH701x(pSiS->SiS_Pr, (temp1 << 8) | 0x49);
+
+ temp1 = 0;
+ if(temp2 & 0x02) temp1 |= 0x01;
+ if(temp2 & 0x10) temp1 |= 0x01;
+ if(temp2 & 0x04) temp1 |= 0x02;
+
+ if( (temp1 & 0x01) && (temp1 & 0x02) ) temp1 = 0x04;
+
+ }
+
+ switch(temp1) {
+ case 0x01:
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Chrontel: Detected TV connected to COMPOSITE output\n");
+ pSiS->VBFlags |= TV_AVIDEO;
+ orSISIDXREG(SISCR, 0x32, 0x01);
+ andSISIDXREG(SISCR, 0x32, ~0x06);
+ pSiS->postVBCR32 |= 0x01;
+ pSiS->postVBCR32 &= ~0x06;
+ break;
+ case 0x02:
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Chrontel: Detected TV connected to SVIDEO output\n");
+ pSiS->VBFlags |= TV_SVIDEO;
+ orSISIDXREG(SISCR, 0x32, 0x02);
+ andSISIDXREG(SISCR, 0x32, ~0x05);
+ pSiS->postVBCR32 |= 0x02;
+ pSiS->postVBCR32 &= ~0x05;
+ break;
+ case 0x04:
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Chrontel: Detected TV connected to SCART or YPBPR output\n");
+ if(pSiS->chtvtype == -1) {
+ if(!quiet) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "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;
+ }
+ if(pSiS->chtvtype)
+ pSiS->VBFlags |= TV_CHSCART;
+ else
+ pSiS->VBFlags |= TV_CHYPBPR525I;
+ break;
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Chrontel: No TV detected.\n");
+ andSISIDXREG(SISCR, 0x32, ~0x07);
+ pSiS->postVBCR32 &= ~0x07;
+ }
+}
+
+/* Redetect CRT2 devices. Calling this requires a reset
+ * of the current display mode if TRUE is returned.
+ */
+Bool SISRedetectCRT2Type(ScrnInfoPtr pScrn)
+{
+ SISPtr pSiS = SISPTR(pScrn);
+ unsigned long VBFlagsBackup = pSiS->VBFlags;
+ Bool backup1 = pSiS->forcecrt2redetection;
+ Bool backup2 = pSiS->nocrt2ddcdetection;
+
+#ifdef SISDUALHEAD
+ if(pSiS->DualHeadMode) return FALSE;
+#endif
+
+ pSiS->VBFlags &= (VB_VIDEOBRIDGE | DISPLAY_MODE);
+
+ /* At first, re-do the sensing for TV and VGA2 */
+ if(pSiS->VBFlags & VB_SISBRIDGE) {
+ SISSense30x(pScrn, FALSE);
+ } else if(pSiS->VBFlags & VB_CHRONTEL) {
+ SiS_SetChrontelGPIO(pSiS->SiS_Pr, 0x9c);
+ SISSenseChrontel(pScrn, TRUE);
+ SiS_SetChrontelGPIO(pSiS->SiS_Pr, 0x00);
+ }
+
+ SISTVPreInit(pScrn, TRUE);
+
+ pSiS->forcecrt2redetection = TRUE;
+ pSiS->nocrt2ddcdetection = FALSE;
+
+ /* We only re-detect LCD for the TMDS-SiS-bridges. LVDS
+ * is practically never being hot-plugged (and even if,
+ * there is no way of detecting this).
+ */
+ if((pSiS->VGAEngine == SIS_315_VGA) &&
+ (pSiS->VBFlags & VB_SISTMDSBRIDGE) &&
+ (!(pSiS->VBFlags & VB_30xBDH)) &&
+ (pSiS->VESA != 1)) {
+ SISLCDPreInit(pScrn, TRUE);
+ } else {
+ pSiS->VBFlags |= (pSiS->detectedCRT2Devices & CRT2_LCD);
+ }
+
+ /* Secondary VGA is only supported on these bridges: */
+ if(pSiS->VBFlags & VB_SISVGA2BRIDGE) {
+ SISCRT2PreInit(pScrn, TRUE);
+ }
+
+ pSiS->forcecrt2redetection = backup1;
+ pSiS->nocrt2ddcdetection = backup2;
+
+ SISDetermineLCDACap(pScrn);
+ SISSaveDetectedDevices(pScrn);
+
+ pSiS->VBFlags = VBFlagsBackup;
+
+ /* If LCD disappeared, don't use it and don't advertise LCDA support. Duh! */
+ if(!(pSiS->detectedCRT2Devices & CRT2_LCD)) {
+ pSiS->SiS_SD_Flags &= ~(SiS_SD_SUPPORTLCDA);
+ if(pSiS->VBFlags & CRT2_LCD) {
+ /* If CRT2 was LCD, disable CRT2 and adapt display mode flags */
+ pSiS->VBFlags &= ~(CRT2_LCD | DISPLAY_MODE);
+ /* Switch on CRT1 as an emergency measure */
+ pSiS->VBFlags |= (SINGLE_MODE | DISPTYPE_CRT1);
+ pSiS->CRT1off = 0;
+ }
+ /* If CRT1 was LCD, switch to CRT1-VGA. No need to adapt display mode flags. */
+ pSiS->VBFlags &= ~(CRT1_LCDA);
+ pSiS->VBFlags_backup = pSiS->VBFlags;
+ }
+
+ pSiS->VBFlagsInit = pSiS->VBFlags;
+
+ /* Save new detection result registers to write them back in EnterVT() */
+ inSISIDXREG(SISCR,0x32,pSiS->myCR32);
+ inSISIDXREG(SISCR,0x36,pSiS->myCR36);
+ inSISIDXREG(SISCR,0x37,pSiS->myCR37);
+
+ return TRUE;
+}
diff --git a/src/sis_vga.c b/src/sis_vga.c
index 9ce8b78..63d8261 100644
--- a/src/sis_vga.c
+++ b/src/sis_vga.c
@@ -1,9 +1,15 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c,v 1.6 2004/08/10 21:57:20 twini Exp $ */
/*
* Mode setup and basic video bridge detection
*
* Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria.
*
+ * The SISInit() function for old series (except TV and FIFO calculation)
+ * was previously based on code which was Copyright (C) 1998,1999 by Alan
+ * Hourihane, Wigan, England. However, the code has been rewritten entirely
+ * and is - it its current representation - not covered by this old copyright.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -15,7 +21,7 @@
* 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
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -28,9 +34,6 @@
*
* 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"
@@ -46,12 +49,13 @@
static Bool SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode);
static Bool SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode);
-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);
static void SiS6326TVDelay(ScrnInfoPtr pScrn, int delay);
+extern void SISSense30x(ScrnInfoPtr pScrn, Bool quiet);
+extern void SISSenseChrontel(ScrnInfoPtr pScrn, Bool quiet);
+
const CARD8 SiS6326TVRegs1[14] = {
0x00,0x01,0x02,0x03,0x04,0x11,0x12,0x13,0x21,0x26,0x27,0x3a,0x3c,0x43
};
@@ -433,11 +437,13 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
/* Programmable Clock */
pReg->sisRegs3C2 = inb(SISMISCR) | 0x0C;
+#if 0
if(pSiS->oldChipset <= OC_SIS86202) {
/* TODO: Handle SR07 for clock selection */
/* 86C201 does not even have a programmable clock... */
/* pReg->sisRegs3C4[0x07] &= 0x??; */
}
+#endif
/* Set VCLK */
if((sis6326tvmode) || (sis6326himode)) {
@@ -508,7 +514,7 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
pReg->sisRegs3C4[0x2A] = (vclk[Midx] - 1) & 0x7f;
pReg->sisRegs3C4[0x2A] |= ((vclk[VLDidx] == 2) ? 1 : 0) << 7;
- /* bits [4:0] contain denumerator */
+ /* D[4:0]: denumerator */
pReg->sisRegs3C4[0x2B] = (vclk[Nidx] - 1) & 0x1f;
if(vclk[Pidx] <= 4){
@@ -560,7 +566,7 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
pSiS->ValidWidth = TRUE;
pReg->sisRegs3C4[0x27] &= 0xCF;
if(pSiS->CurrentLayout.bitsPerPixel == 24) {
- /* Invalid logical width */
+ /* "Invalid logical width" */
pReg->sisRegs3C4[0x27] |= 0x30;
pSiS->ValidWidth = FALSE;
} else {
@@ -933,209 +939,6 @@ SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode)
return(TRUE);
}
-static int
-SISDoSense(ScrnInfoPtr pScrn, unsigned short type, unsigned short test)
-{
- 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,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) & 0xfc));
-
- inSISIDXREG(SISPART2,0x4d,backupP2_4d);
- if(pSiS->VBFlags & (VB_301C|VB_301LV|VB_302LV|VB_302ELV)) {
- outSISIDXREG(SISPART2,0x4d,(backupP2_4d & ~0x10));
- }
-
- SISDoSense(pScrn, 0, 0);
-
- 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;
-
- if(pSiS->Chipset == PCI_CHIP_SIS300) {
- inSISIDXREG(SISSR,0x3b,myflag);
- if(!(myflag & 0x01)) vga2 = vga2_c = 0;
- }
-
- 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_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,
- "SiS30x: Detected secondary VGA connection\n");
- pSiS->VBFlags |= VGA2_CONNECTED;
- orSISIDXREG(SISCR, 0x32, 0x10);
- pSiS->postVBCR32 |= 0x10;
- }
- }
- if(biosflag & 0x01) pSiS->SiS_SD_Flags |= SiS_SD_VBHASSCART;
- }
-
- 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 & TV_YPBPR)) {
-
- 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)) {
- 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;
- }
- }
-
- }
-
- SISDoSense(pScrn, 0, 0);
-
- outSISIDXREG(SISPART2,0x00,backupP2_00);
- outSISIDXREG(SISPART4,0x0d,backupP4_0d);
-}
-
static void
SiS6326TVDelay(ScrnInfoPtr pScrn, int delay)
{
@@ -1202,16 +1005,34 @@ SISSense6326(ScrnInfoPtr pScrn)
}
}
+static BOOLEAN
+SISIsUMC(SISPtr pSiS)
+{
+ USHORT p4_0f, p4_25, p4_27, temp;
+
+ inSISIDXREG(SISPART4, 0x0f, p4_0f);
+ inSISIDXREG(SISPART4, 0x25, p4_25);
+ inSISIDXREG(SISPART4, 0x27, p4_27);
+ andSISIDXREG(SISPART4, 0x0f, 0x7f);
+ orSISIDXREG(SISPART4, 0x25, 0x08);
+ andSISIDXREG(SISPART4, 0x27, 0xfd);
+ inSISIDXREG(SISPART4, 0x26, temp);
+ outSISIDXREG(SISPART4, 0x27, p4_27);
+ outSISIDXREG(SISPART4, 0x25, p4_25);
+ outSISIDXREG(SISPART4, 0x0f, p4_0f);
+ return((temp & 0x08) ? TRUE : FALSE);
+}
+
/* Detect video bridge and set VBFlags accordingly */
void SISVGAPreInit(ScrnInfoPtr pScrn)
{
SISPtr pSiS = SISPTR(pScrn);
- int temp,temp1,temp2, i;
+ int temp,temp1,temp2,sistypeidx;
int upperlimitlvds, lowerlimitlvds;
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";
+
+ static const char *detectvb = "Detected %s (%s) video bridge (ID %d; Rev 0x%x)\n";
#if 0
unsigned char sr17=0;
#endif
@@ -1226,6 +1047,16 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
"7020",
"(unknown)"
};
+ static const char *SiSVBTypeStr[] = {
+ "301", /* 0 */
+ "301B", /* 1 */
+ "301B-DH", /* 2 */
+ "301LV", /* 3 */
+ "302LV", /* 4 */
+ "301C", /* 5 */
+ "302ELV", /* 6 */
+ "302B" /* 7 */
+ };
switch (pSiS->Chipset) {
case PCI_CHIP_SIS300:
@@ -1238,6 +1069,7 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
case PCI_CHIP_SIS315PRO:
case PCI_CHIP_SIS330:
case PCI_CHIP_SIS660:
+ case PCI_CHIP_SIS340:
pSiS->ModeInit = SIS300Init;
break;
default:
@@ -1253,7 +1085,7 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
SISSense6326(pScrn);
}
- pSiS->VBFlags = 0; /* reset VBFlags */
+ pSiS->VBFlags = pSiS->VBFlags2 = 0; /* reset VBFlags */
pSiS->SiS_Pr->SiS_UseLCDA = FALSE;
pSiS->SiS_Pr->Backup = FALSE;
@@ -1264,73 +1096,79 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
inSISIDXREG(SISPART4, 0x00, temp);
temp &= 0x0F;
if(temp == 1) {
+
inSISIDXREG(SISPART4, 0x01, temp1);
temp1 &= 0xff;
+
+ if(temp1 >= 0xC0) {
+ if(SISIsUMC(pSiS)) pSiS->VBFlags2 |= VB_SISUMC;
+ }
+
if(temp1 >= 0xE0) {
inSISIDXREG(SISPART4, 0x39, temp2);
if(temp2 == 0xff) {
pSiS->VBFlags |= VB_302LV;
- pSiS->sishw_ext.ujVBChipID = VB_CHIP_302LV;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "SiS302LV", 1, temp1);
+ sistypeidx = 4;
} else {
- pSiS->VBFlags |= VB_302ELV;
- pSiS->sishw_ext.ujVBChipID = VB_CHIP_302ELV;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "SiS302ELV", 1, temp1);
+ pSiS->VBFlags |= VB_301C; /* VB_302ELV; */
+ sistypeidx = 5; /* 6; */
}
} else if(temp1 >= 0xD0) {
pSiS->VBFlags |= VB_301LV;
- pSiS->sishw_ext.ujVBChipID = VB_CHIP_301LV;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "SiS301LV", 1, temp1);
+ sistypeidx = 3;
} else if(temp1 >= 0xC0) {
pSiS->VBFlags |= VB_301C;
- pSiS->sishw_ext.ujVBChipID = VB_CHIP_301C;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "SiS301C", 1, temp1);
+ sistypeidx = 5;
} else if(temp1 >= 0xB0) {
- pSiS->VBFlags |= VB_301B;
- pSiS->sishw_ext.ujVBChipID = VB_CHIP_301B;
+ pSiS->VBFlags |= VB_301B;
+ sistypeidx = 1;
inSISIDXREG(SISPART4, 0x23, temp2);
- if(!(temp2 & 0x02)) pSiS->VBFlags |= VB_30xBDH;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb,
- (temp2 & 0x02) ? "SiS301B" : "SiS301B-DH", 1, temp1);
+ if(!(temp2 & 0x02)) {
+ pSiS->VBFlags |= VB_30xBDH;
+ sistypeidx = 2;
+ }
} else {
pSiS->VBFlags |= VB_301;
- pSiS->sishw_ext.ujVBChipID = VB_CHIP_301;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "SiS301", 1, temp1);
+ sistypeidx = 0;
}
+
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, SiSVBTypeStr[sistypeidx],
+ (pSiS->VBFlags2 & VB_SISUMC) ? "UMC" : "Charter", 1, temp1);
- SISSense30x(pScrn);
+ SISSense30x(pScrn, TRUE);
- } else if (temp == 2) {
+ } else if(temp == 2) {
inSISIDXREG(SISPART4, 0x01, temp1);
temp1 &= 0xff;
+
+ if(temp1 >= 0xC0) {
+ if(SISIsUMC(pSiS)) pSiS->VBFlags2 |= VB_SISUMC;
+ }
+
if(temp1 >= 0xE0) {
pSiS->VBFlags |= VB_302LV;
- pSiS->sishw_ext.ujVBChipID = VB_CHIP_302LV;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "SiS302LV", 2, temp1);
+ sistypeidx = 4;
} else if(temp1 >= 0xD0) {
pSiS->VBFlags |= VB_301LV;
- pSiS->sishw_ext.ujVBChipID = VB_CHIP_301LV;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "SiS301LV", 2, temp1);
+ sistypeidx = 3;
} 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, detectvb,
- (temp2 & 0x02) ? "SiS302B" : "SiS302B-DH", 2, temp1);
+ sistypeidx = 7;
}
+
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, SiSVBTypeStr[sistypeidx],
+ (pSiS->VBFlags2 & VB_SISUMC) ? "UMC" : "Charter", 2, temp1);
- SISSense30x(pScrn);
+ SISSense30x(pScrn, FALSE);
} else if (temp == 3) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "unsupported SiS303", temp, 0);
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "unsupported SiS303", "unknown", temp, 0);
} else {
- pSiS->sishw_ext.ujVBChipID = VB_CHIP_UNKNOWN;
- if(pSiS->Chipset == PCI_CHIP_SIS660) {
+ if(pSiS->NewCRLayout) {
inSISIDXREG(SISCR, 0x38, temp);
temp = (temp >> 5) & 0x07;
} else {
@@ -1347,7 +1185,7 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
lowerlimitch = 3; upperlimitch = 3;
chronteltype = 2; chrontelidreg = 0x4b;
upperlimitvb = upperlimitlvds;
- if(pSiS->Chipset == PCI_CHIP_SIS660) {
+ if(pSiS->NewCRLayout) {
upperlimitvb = 4;
}
}
@@ -1403,119 +1241,8 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
ChrontelTypeStr[temp2], temp1, temp);
/* Sense connected TV's */
-
- if(chronteltype == 1) {
-
- /* Chrontel 700x */
-
- /* Read power status */
- temp1 = SiS_GetCH700x(pSiS->SiS_Pr, 0x0e); /* Power status */
- if((temp1 & 0x03) != 0x03) {
- /* TW: Power all outputs */
- SiS_SetCH700x(pSiS->SiS_Pr, 0x0B0E);
- SiS_DDC2Delay(pSiS->SiS_Pr, 0x96);
- }
- /* Sense connected TV devices */
- for(i = 0; i < 3; i++) {
- SiS_SetCH700x(pSiS->SiS_Pr, 0x0110);
- SiS_DDC2Delay(pSiS->SiS_Pr, 0x96);
- SiS_SetCH700x(pSiS->SiS_Pr, 0x0010);
- SiS_DDC2Delay(pSiS->SiS_Pr, 0x96);
- temp1 = SiS_GetCH700x(pSiS->SiS_Pr, 0x10);
- if(!(temp1 & 0x08)) test[i] = 0x02;
- else if(!(temp1 & 0x02)) test[i] = 0x01;
- else test[i] = 0;
- SiS_DDC2Delay(pSiS->SiS_Pr, 0x96);
- }
-
- if(test[0] == test[1]) temp1 = test[0];
- else if(test[0] == test[2]) temp1 = test[0];
- else if(test[1] == test[2]) temp1 = test[1];
- else {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "TV detection unreliable - test results varied\n");
- temp1 = test[2];
- }
-
- } else {
-
- /* Chrontel 701x */
-
- /* Backup Power register */
- temp1 = SiS_GetCH701x(pSiS->SiS_Pr, 0x49);
-
- /* Enable TV path */
- SiS_SetCH701x(pSiS->SiS_Pr, 0x2049);
-
- SiS_DDC2Delay(pSiS->SiS_Pr, 0x96);
-
- /* Sense connected TV devices */
- temp2 = SiS_GetCH701x(pSiS->SiS_Pr, 0x20);
- temp2 |= 0x01;
- SiS_SetCH701x(pSiS->SiS_Pr, (temp2 << 8) | 0x20);
-
- SiS_DDC2Delay(pSiS->SiS_Pr, 0x96);
-
- temp2 ^= 0x01;
- SiS_SetCH701x(pSiS->SiS_Pr, (temp2 << 8) | 0x20);
-
- SiS_DDC2Delay(pSiS->SiS_Pr, 0x96);
-
- temp2 = SiS_GetCH701x(pSiS->SiS_Pr, 0x20);
-
- /* Restore Power register */
- SiS_SetCH701x(pSiS->SiS_Pr, (temp1 << 8) | 0x49);
-
- temp1 = 0;
- if(temp2 & 0x02) temp1 |= 0x01;
- if(temp2 & 0x10) temp1 |= 0x01;
- if(temp2 & 0x04) temp1 |= 0x02;
-
- if( (temp1 & 0x01) && (temp1 & 0x02) ) temp1 = 0x04;
-
- }
-
- switch(temp1) {
- case 0x01:
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Chrontel: Detected TV connected to COMPOSITE output\n");
- pSiS->VBFlags |= TV_AVIDEO;
- orSISIDXREG(SISCR, 0x32, 0x01);
- andSISIDXREG(SISCR, 0x32, ~0x06);
- pSiS->postVBCR32 |= 0x01;
- pSiS->postVBCR32 &= ~0x06;
- break;
- case 0x02:
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Chrontel: Detected TV connected to SVIDEO output\n");
- pSiS->VBFlags |= TV_SVIDEO;
- orSISIDXREG(SISCR, 0x32, 0x02);
- andSISIDXREG(SISCR, 0x32, ~0x05);
- pSiS->postVBCR32 |= 0x02;
- pSiS->postVBCR32 &= ~0x05;
- break;
- case 0x04:
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "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 YPBPR525I\n");
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Chrontel: Using SCART by default\n");
- pSiS->chtvtype = 1;
- }
- if(pSiS->chtvtype)
- pSiS->VBFlags |= TV_CHSCART;
- else
- pSiS->VBFlags |= TV_CHYPBPR525I;
- break;
- default:
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Chrontel: No TV detected.\n");
- andSISIDXREG(SISCR, 0x32, ~0x07);
- pSiS->postVBCR32 &= ~0x07;
- }
-
+ SISSenseChrontel(pScrn, FALSE);
+
} else if(temp1==0) {
/* This indicates a communication problem, but it only occures if there
* is no TV attached. So we don't use TV in this case.
@@ -1535,7 +1262,7 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
SiS_SetChrontelGPIO(pSiS->SiS_Pr, 0x00);
}
}
- if((pSiS->Chipset == PCI_CHIP_SIS660) && (temp == 4)) {
+ if((pSiS->NewCRLayout) && (temp == 4)) {
pSiS->VBFlags |= VB_CONEXANT;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"Detected Conexant video bridge - UNSUPPORTED\n");
@@ -1628,7 +1355,7 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
}
}
if(pSiS->ChipFlags & SiSCF_UseLCDA) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 3,
"BIOS uses LCDA for low resolution and text modes\n");
if(pSiS->SiS_Pr->Backup == TRUE) {
inSISIDXREG(SISCR,0x34,pSiS->SiS_Pr->Backup_Mode);
diff --git a/src/sis_video.c b/src/sis_video.c
index 85d75b5..3c5b6c3 100644
--- a/src/sis_video.c
+++ b/src/sis_video.c
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c,v 1.9 2004/08/14 15:35:49 twini Exp $ */
/*
* Xv driver for SiS 300, 315 and 330 series.
*
@@ -15,7 +16,7 @@
* 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
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -37,7 +38,7 @@
*
* All comments in this file are by Thomas Winischhofer.
*
- * This supports the following chipsets:
+ * The overlay adaptor supports the following chipsets:
* SiS300: No registers >0x65, two overlays (one used for CRT1, one for CRT2)
* SiS630/730: No registers >0x6b, two overlays (one used for CRT1, one for CRT2)
* SiS550: Full register range, two overlays (one used for CRT1, one for CRT2)
@@ -46,6 +47,7 @@
* SiSM650/651: Full register range, two overlays (one used for CRT1, one for CRT2)
* SiS330: Full register range, one overlay (used for both CRT1 and CRT2 alt.)
* SiS661/741/760: Full register range, two overlays (one used for CRT1, one for CRT2)
+ * SiS340: - not finished yet; dda stuff missing - 1 overlay. Extended registers for DDA
*
* Help for reading the code:
* 315/550/650/740/M650/651/330/661/741/760 = SIS_315_VGA
@@ -79,8 +81,17 @@
* Full size overlays available.
* DISPMODE is either SINGLE1 or SINGLE2. Overlay is used depending on
* XvOnCRT2 flag.
+ *
+ * About the video blitter:
+ * The video blitter adaptor supports 16 ports. By default, adaptor 0 will
+ * be the overlay adaptor, adaptor 1 the video blitter. The option XvDefaultAdaptor
+ * allows reversing this.
+ * Since SiS does not provide information on the 3D engine, I could not
+ * implement scaling. Instead, the driver paints a black border around the unscaled
+ * video if the destination area is bigger than the video.
+ *
*/
-
+
#include "xf86.h"
#include "xf86_OSproc.h"
#include "xf86Resources.h"
@@ -95,12 +106,15 @@
#include "xf86xv.h"
#include "Xv.h"
#include "xaa.h"
-#include "xaalocal.h"
#include "dixstruct.h"
#include "fourcc.h"
#include "sis_regs.h"
+#ifdef INCL_YUV_BLIT_ADAPTOR
+#include "sis310_accel.h"
+#endif
+
static XF86VideoAdaptorPtr SISSetupImageVideo(ScreenPtr);
static void SISStopVideo(ScrnInfoPtr, pointer, Bool);
static int SISSetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer);
@@ -116,8 +130,22 @@ static void SISVideoTimerCallback(ScrnInfoPtr pScrn, Time now);
static void SISInitOffscreenImages(ScreenPtr pScrn);
extern BOOLEAN SiSBridgeIsInSlaveMode(ScrnInfoPtr pScrn);
-#define OFF_DELAY 200 /* milliseconds */
-#define FREE_DELAY 60000
+#ifdef INCL_YUV_BLIT_ADAPTOR
+static XF86VideoAdaptorPtr SISSetupBlitVideo(ScreenPtr);
+static void SISStopVideoBlit(ScrnInfoPtr, unsigned long, Bool);
+static int SISSetPortAttributeBlit(ScrnInfoPtr, Atom, INT32, unsigned long);
+static int SISGetPortAttributeBlit(ScrnInfoPtr, Atom ,INT32 *, unsigned long);
+static void SISQueryBestSizeBlit(ScrnInfoPtr, Bool, short, short, short,
+ short, unsigned int *,unsigned int *, unsigned long);
+static int SISPutImageBlit( ScrnInfoPtr,
+ short, short, short, short, short, short, short, short,
+ int, unsigned char*, short, short, Bool, RegionPtr, unsigned long);
+static int SISQueryImageAttributesBlit(ScrnInfoPtr,
+ int, unsigned short *, unsigned short *, int *, int *);
+#endif
+
+#define OFF_DELAY 200 /* milliseconds */
+#define FREE_DELAY 30000
#define OFF_TIMER 0x01
#define FREE_TIMER 0x02
@@ -125,7 +153,7 @@ extern BOOLEAN SiSBridgeIsInSlaveMode(ScrnInfoPtr pScrn);
#define TIMER_MASK (OFF_TIMER | FREE_TIMER)
-#define WATCHDOG_DELAY 500000 /* Watchdog counter for Vertical Restrace waiting */
+#define WATCHDOG_DELAY 200000 /* Watchdog counter for Vertical Restrace waiting */
#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
@@ -135,6 +163,7 @@ extern BOOLEAN SiSBridgeIsInSlaveMode(ScrnInfoPtr pScrn);
#define IMAGE_MAX_HEIGHT_300 576
#define IMAGE_MAX_WIDTH_315 1920
#define IMAGE_MAX_HEIGHT_315 1080
+#define IMAGE_MAX_WIDTH_340 1920 /* ? */
#define OVERLAY_MIN_WIDTH 32 /* Minimum overlay sizes */
#define OVERLAY_MIN_HEIGHT 24
@@ -146,14 +175,12 @@ extern BOOLEAN SiSBridgeIsInSlaveMode(ScrnInfoPtr pScrn);
#define LINEBUFLIMIT1 384 /* Limits at which line buffers must be merged */
#define LINEBUFLIMIT2 720
#define LINEBUFLIMIT3 576
+#define LINEBUFLIMIT4 1280 /* 340 */
#ifdef SISDUALHEAD
#define HEADOFFSET (pSiS->dhmOffset)
#endif
-
-#define GET_PORT_PRIVATE(pScrn) \
- (SISPortPrivPtr)((SISPTR(pScrn))->adaptor->pPortPrivates[0].ptr)
-
+
/* Note on "MIRROR":
* When using VESA on machines with an enabled video bridge, this means
* a real mirror. CRT1 and CRT2 have the exact same resolution and
@@ -164,15 +191,6 @@ extern BOOLEAN SiSBridgeIsInSlaveMode(ScrnInfoPtr pScrn);
* refresh rate.
*/
-/* client libraries expect an encoding */
-static XF86VideoEncodingRec DummyEncoding =
-{
- 0,
- "XV_IMAGE",
- 0, 0, /* Will be filled in */
- {1, 1}
-};
-
#define NUM_FORMATS 3
static XF86VideoFormatRec SISFormats[NUM_FORMATS] =
@@ -215,6 +233,7 @@ static char sisxvsdquerydetecteddevices[] = "XV_SD_QUERYDETECTEDDEVICES";
static char sisxvsdcrt1status[] = "XV_SD_CRT1STATUS";
static char sisxvsdcheckmodeindexforcrt2[] = "XV_SD_CHECKMODEINDEXFORCRT2";
static char sisxvsdresultcheckmodeindexforcrt2[] = "XV_SD_RESULTCHECKMODEINDEXFORCRT2";
+static char sisxvsdredetectcrt2[] = "XV_SD_REDETECTCRT2DEVICES";
static char sisxvsdsisantiflicker[] = "XV_SD_SISANTIFLICKER";
static char sisxvsdsissaturation[] = "XV_SD_SISSATURATION";
static char sisxvsdsisedgeenhance[] = "XV_SD_SISEDGEENHANCE";
@@ -246,16 +265,35 @@ 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 INCL_YUV_BLIT_ADAPTOR
+static char sisxvvsync[] = "XV_SYNC_TO_VBLANK";
+#endif
#ifdef TWDEBUG
static char sisxvsetreg[] = "XV_SD_SETREG";
#endif
+/***********************************************/
+/* OVERLAY ADAPTOR */
+/***********************************************/
+
+#define GET_PORT_PRIVATE(pScrn) \
+ (SISPortPrivPtr)((SISPTR(pScrn))->adaptor->pPortPrivates[0].ptr)
+
+/* client libraries expect an encoding */
+static XF86VideoEncodingRec DummyEncoding =
+{
+ 0,
+ "XV_IMAGE",
+ 0, 0, /* Will be filled in */
+ {1, 1}
+};
+
#ifndef SIS_CP
-#define NUM_ATTRIBUTES_300 57
+#define NUM_ATTRIBUTES_300 58
#ifdef TWDEBUG
-#define NUM_ATTRIBUTES_315 64
+#define NUM_ATTRIBUTES_315 65
#else
-#define NUM_ATTRIBUTES_315 63
+#define NUM_ATTRIBUTES_315 64
#endif
#endif
@@ -276,18 +314,19 @@ static XF86AttributeRec SISAttributes_300[NUM_ATTRIBUTES_300] =
{XvSettable | XvGettable, 0, 1, sisxvyuvchromakey},
{XvSettable | XvGettable, 0, (1 << 24) - 1, sisxvchromamin},
{XvSettable | XvGettable, 0, (1 << 24) - 1, sisxvchromamax},
- { XvGettable, 0, 0xffffffff, sisxvqueryvbflags},
- { XvGettable, 0, 0xffffffff, sisxvsdgetdriverversion},
- { XvGettable, 0, 0xffffffff, sisxvsdgethardwareinfo},
- { XvGettable, 0, 0xffffffff, sisxvsdgetbusid},
- { XvGettable, 0, 0xffffffff, sisxvsdqueryvbflagsversion},
- { XvGettable, 0, 0xffffffff, sisxvsdgetsdflags},
- {XvSettable | XvGettable, 0, 0xffffffff, sisxvsdunlocksisdirect},
- {XvSettable , 0, 0xffffffff, sisxvsdsetvbflags},
- { XvGettable, 0, 0xffffffff, sisxvsdquerydetecteddevices},
+ { XvGettable, 0, -1, sisxvqueryvbflags},
+ { XvGettable, 0, -1, sisxvsdgetdriverversion},
+ { XvGettable, 0, -1, sisxvsdgethardwareinfo},
+ { XvGettable, 0, -1, sisxvsdgetbusid},
+ { XvGettable, 0, -1, sisxvsdqueryvbflagsversion},
+ { XvGettable, 0, -1, sisxvsdgetsdflags},
+ {XvSettable | XvGettable, 0, -1, sisxvsdunlocksisdirect},
+ {XvSettable , 0, -1, sisxvsdsetvbflags},
+ { XvGettable, 0, -1, sisxvsdquerydetecteddevices},
{XvSettable | XvGettable, 0, 1, sisxvsdcrt1status},
- {XvSettable , 0, 0xffffffff, sisxvsdcheckmodeindexforcrt2},
- { XvGettable, 0, 0xffffffff, sisxvsdresultcheckmodeindexforcrt2},
+ {XvSettable , 0, -1, sisxvsdcheckmodeindexforcrt2},
+ { XvGettable, 0, -1, sisxvsdresultcheckmodeindexforcrt2},
+ {XvSettable , 0, 0, sisxvsdredetectcrt2},
{XvSettable | XvGettable, 0, 4, sisxvsdsisantiflicker},
{XvSettable | XvGettable, 0, 15, sisxvsdsissaturation},
{XvSettable | XvGettable, 0, 15, sisxvsdsisedgeenhance},
@@ -304,7 +343,7 @@ static XF86AttributeRec SISAttributes_300[NUM_ATTRIBUTES_300] =
{XvSettable | XvGettable, 0, 3, sisxvsdenablegamma},
{XvSettable | XvGettable, -16, 16, sisxvsdtvxscale},
{XvSettable | XvGettable, -4, 3, sisxvsdtvyscale},
- { XvGettable, 0, 0xffffffff, sisxvsdgetscreensize},
+ { XvGettable, 0, -1, sisxvsdgetscreensize},
{XvSettable | XvGettable, 100, 10000, sisxvsdstorebrir},
{XvSettable | XvGettable, 100, 10000, sisxvsdstorebrig},
{XvSettable | XvGettable, 100, 10000, sisxvsdstorebrib},
@@ -344,18 +383,19 @@ static XF86AttributeRec SISAttributes_315[NUM_ATTRIBUTES_315] =
{XvSettable | XvGettable, 0, 1, sisxvinsidechromakey},
{XvSettable | XvGettable, 0, (1 << 24) - 1, sisxvchromamin},
{XvSettable | XvGettable, 0, (1 << 24) - 1, sisxvchromamax},
- { XvGettable, 0, 0xffffffff, sisxvqueryvbflags},
- { XvGettable, 0, 0xffffffff, sisxvsdgetdriverversion},
- { XvGettable, 0, 0xffffffff, sisxvsdgethardwareinfo},
- { XvGettable, 0, 0xffffffff, sisxvsdgetbusid},
- { XvGettable, 0, 0xffffffff, sisxvsdqueryvbflagsversion},
- { XvGettable, 0, 0xffffffff, sisxvsdgetsdflags},
- {XvSettable | XvGettable, 0, 0xffffffff, sisxvsdunlocksisdirect},
- {XvSettable , 0, 0xffffffff, sisxvsdsetvbflags},
- { XvGettable, 0, 0xffffffff, sisxvsdquerydetecteddevices},
+ { XvGettable, 0, -1, sisxvqueryvbflags},
+ { XvGettable, 0, -1, sisxvsdgetdriverversion},
+ { XvGettable, 0, -1, sisxvsdgethardwareinfo},
+ { XvGettable, 0, -1, sisxvsdgetbusid},
+ { XvGettable, 0, -1, sisxvsdqueryvbflagsversion},
+ { XvGettable, 0, -1, sisxvsdgetsdflags},
+ {XvSettable | XvGettable, 0, -1, sisxvsdunlocksisdirect},
+ {XvSettable , 0, -1, sisxvsdsetvbflags},
+ { XvGettable, 0, -1, sisxvsdquerydetecteddevices},
{XvSettable | XvGettable, 0, 1, sisxvsdcrt1status},
- {XvSettable , 0, 0xffffffff, sisxvsdcheckmodeindexforcrt2},
- { XvGettable, 0, 0xffffffff, sisxvsdresultcheckmodeindexforcrt2},
+ {XvSettable , 0, -1, sisxvsdcheckmodeindexforcrt2},
+ { XvGettable, 0, -1, sisxvsdresultcheckmodeindexforcrt2},
+ {XvSettable , 0, 0, sisxvsdredetectcrt2},
{XvSettable | XvGettable, 0, 4, sisxvsdsisantiflicker},
{XvSettable | XvGettable, 0, 15, sisxvsdsissaturation},
{XvSettable | XvGettable, 0, 15, sisxvsdsisedgeenhance},
@@ -372,7 +412,7 @@ static XF86AttributeRec SISAttributes_315[NUM_ATTRIBUTES_315] =
{XvSettable | XvGettable, 0, 7, sisxvsdenablegamma},
{XvSettable | XvGettable, -16, 16, sisxvsdtvxscale},
{XvSettable | XvGettable, -4, 3, sisxvsdtvyscale},
- { XvGettable, 0, 0xffffffff, sisxvsdgetscreensize},
+ { XvGettable, 0, -1, sisxvsdgetscreensize},
{XvSettable | XvGettable, 100, 10000, sisxvsdstorebrir},
{XvSettable | XvGettable, 100, 10000, sisxvsdstorebrig},
{XvSettable | XvGettable, 100, 10000, sisxvsdstorebrib},
@@ -388,7 +428,7 @@ static XF86AttributeRec SISAttributes_315[NUM_ATTRIBUTES_315] =
{XvSettable | XvGettable, 0, 1, sisxvsdhidehwcursor},
{XvSettable | XvGettable, 0, 15, sisxvsdpanelmode},
#ifdef TWDEBUG
- {XvSettable , 0, 0xffffffff, sisxvsetreg},
+ {XvSettable , 0, -1, sisxvsetreg},
#endif
#ifdef SIS_CP
SIS_CP_VIDEO_ATTRIBUTES
@@ -397,17 +437,18 @@ static XF86AttributeRec SISAttributes_315[NUM_ATTRIBUTES_315] =
};
#define NUM_IMAGES_300 6
-#define NUM_IMAGES_315 7 /* NV12 only - but does not work */
+#define NUM_IMAGES_315 7 /* basically NV12 only - but does not work */
#define NUM_IMAGES_330 9 /* NV12 and NV21 */
+
#define PIXEL_FMT_YV12 FOURCC_YV12 /* 0x32315659 */
#define PIXEL_FMT_UYVY FOURCC_UYVY /* 0x59565955 */
#define PIXEL_FMT_YUY2 FOURCC_YUY2 /* 0x32595559 */
#define PIXEL_FMT_I420 FOURCC_I420 /* 0x30323449 */
#define PIXEL_FMT_RGB5 0x35315652
#define PIXEL_FMT_RGB6 0x36315652
-#define PIXEL_FMT_YVYU 0x55595659 /* 315/330 only */
-#define PIXEL_FMT_NV12 0x3231564e /* 330 only */
-#define PIXEL_FMT_NV21 0x3132564e /* 330 only */
+#define PIXEL_FMT_YVYU 0x55595659 /* 315/330+ only */
+#define PIXEL_FMT_NV12 0x3231564e /* 330+ only */
+#define PIXEL_FMT_NV21 0x3132564e /* 330+ only */
/* TODO: */
#define PIXEL_FMT_RAW8 0x38574152
@@ -428,7 +469,6 @@ static XF86ImageRec SISImages[NUM_IMAGES_330] =
16,
XvPacked,
1,
-/* 15, 0x001F, 0x03E0, 0x7C00, - incorrect! */
15, 0x7C00, 0x03E0, 0x001F,
0, 0, 0,
0, 0, 0,
@@ -446,7 +486,6 @@ static XF86ImageRec SISImages[NUM_IMAGES_330] =
16,
XvPacked,
1,
-/* 16, 0x001F, 0x07E0, 0xF800, - incorrect! */
16, 0xF800, 0x07E0, 0x001F,
0, 0, 0,
0, 0, 0,
@@ -573,6 +612,8 @@ typedef struct {
int tvxpos, tvypos;
Bool updatetvxpos, updatetvypos;
+
+ Bool is340;
} SISPortPrivRec, *SISPortPrivPtr;
@@ -599,7 +640,7 @@ typedef struct {
CARD16 SCREENheight;
- CARD8 lineBufSize;
+ CARD16 lineBufSize;
DisplayModePtr currentmode;
@@ -617,7 +658,7 @@ typedef struct {
CARD32 PSV2;
CARD32 PSU2;
CARD16 SCREENheight2;
- CARD8 lineBufSize2;
+ CARD16 lineBufSize2;
DisplayModePtr currentmode2;
@@ -625,36 +666,125 @@ typedef struct {
#endif
CARD8 bobEnable;
+
+ CARD8 planar;
+ CARD8 planar_shiftpitch;
CARD8 contrastCtrl;
CARD8 contrastFactor;
+
+ CARD16 oldLine, oldtop;
CARD8 (*VBlankActiveFunc)(SISPtr, SISPortPrivPtr);
#if 0
CARD32 (*GetScanLineFunc)(SISPtr pSiS);
#endif
-#if 0
- /* The following are not used yet */
- CARD16 SubPictHUSF; /* Subpicture scaling */
- CARD16 SubpictVUSF;
- CARD8 SubpictIntBit;
- CARD8 SubPictwHPre;
- CARD16 SubPictsrcW; /* Subpicture source width */
- CARD16 SubPictsrcH; /* Subpicture source height */
- BoxRec SubPictdstBox; /* SubPicture destination box */
- CARD32 SubPictAddr; /* SubPicture address */
- CARD32 SubPictPitch; /* SubPicture pitch */
- CARD32 SubPictOrigPitch; /* SubPicture real pitch (needed for scaling twice) */
- CARD32 SubPictPreset; /* Subpicture Preset */
-
- CARD32 MPEG_Y; /* MPEG Y Buffer Addr */
- CARD32 MPEG_UV; /* MPEG UV Buffer Addr */
-#endif
-
} SISOverlayRec, *SISOverlayPtr;
+/***********************************************/
+/* BLITTER ADAPTOR */
+/***********************************************/
+
+#ifdef INCL_YUV_BLIT_ADAPTOR
+
+#define NUM_BLIT_PORTS 16
+
+static XF86VideoEncodingRec DummyEncodingBlit =
+{
+ 0,
+ "XV_IMAGE",
+ 2046, 2046,
+ {1, 1}
+};
+
+#define NUM_ATTRIBUTES_BLIT 2
+
+static XF86AttributeRec SISAttributes_Blit[NUM_ATTRIBUTES_BLIT] =
+{
+ {XvSettable | XvGettable, 0, 1, sisxvvsync},
+ {XvSettable , 0, 0, sisxvsetdefaults}
+};
+
+#define NUM_IMAGES_BLIT 7
+
+static XF86ImageRec SISImagesBlit[NUM_IMAGES_BLIT] =
+{
+
+ XVIMAGE_YUY2,
+ XVIMAGE_YV12,
+ XVIMAGE_UYVY,
+ XVIMAGE_I420,
+ { /* YVYU */
+ PIXEL_FMT_YVYU, \
+ XvYUV, \
+ LSBFirst, \
+ {'Y','V','Y','U',
+ 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71},
+ 16,
+ XvPacked,
+ 1,
+ 0, 0, 0, 0,
+ 8, 8, 8,
+ 1, 2, 2,
+ 1, 1, 1,
+ {'Y','V','Y','U',
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
+ XvTopToBottom
+ },
+ { /* NV12 */
+ PIXEL_FMT_NV12,
+ XvYUV,
+ LSBFirst,
+ {'N','V','1','2',
+ 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71},
+ 12,
+ XvPlanar,
+ 2,
+ 0, 0, 0, 0,
+ 8, 8, 8,
+ 1, 2, 2,
+ 1, 2, 2,
+ {'Y','U','V',0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
+ XvTopToBottom
+ },
+ { /* NV21 */
+ PIXEL_FMT_NV21,
+ XvYUV,
+ LSBFirst,
+ {'N','V','2','1',
+ 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71},
+ 12,
+ XvPlanar,
+ 2,
+ 0, 0, 0, 0,
+ 8, 8, 8,
+ 1, 2, 2,
+ 1, 2, 2,
+ {'Y','V','U',0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
+ XvTopToBottom
+ }
+};
+
+typedef struct {
+ FBLinearPtr linear[NUM_BLIT_PORTS];
+ CARD32 bufAddr[NUM_BLIT_PORTS][2];
+
+ unsigned char currentBuf[NUM_BLIT_PORTS];
+
+ RegionRec blitClip[NUM_BLIT_PORTS];
+
+ CARD32 videoStatus[NUM_BLIT_PORTS];
+ Time freeTime[NUM_BLIT_PORTS];
+
+ Bool vsync;
+ CARD32 AccelCmd;
+ CARD32 VBlankTriggerCRT1, VBlankTriggerCRT2;
+} SISBPortPrivRec, *SISBPortPrivPtr;
+#endif /* INCL_BLIT */
/****************************************************************************
* Raw register access : These routines directly interact with the sis's
@@ -713,7 +843,7 @@ static void setsrregmask(SISPtr pSiS, CARD8 reg, CARD8 data, CARD8 mask)
/* VBlank */
static CARD8 vblank_active_CRT1(SISPtr pSiS, SISPortPrivPtr pPriv)
{
- return(inSISREG(SISINPSTAT) & 0x08);
+ return(inSISREG(SISINPSTAT) & 0x08); /* Verified */
}
static CARD8 vblank_active_CRT2(SISPtr pSiS, SISPortPrivPtr pPriv)
@@ -727,29 +857,36 @@ static CARD8 vblank_active_CRT2(SISPtr pSiS, SISPortPrivPtr pPriv)
} else {
inSISIDXREG(SISPART1, 0x25, ret);
}
- return((ret & 0x02) ^ 0x02);
+ return(ret & 0x02); /* Verified */
}
/* Scanline - unused */
#if 0
-static CARD32 get_scanline_CRT1(SISPtr pSiS)
+static CARD16 get_scanline_CRT1(SISPtr pSiS)
{
CARD32 line;
- _siswrite (pSiS, REG_PRIM_CRT_COUNTER, 0x00000001);
- line = _sisread (pSiS, REG_PRIM_CRT_COUNTER);
+ _siswrite(pSiS, REG_PRIM_CRT_COUNTER, 0x00000001);
+ line = _sisread(pSiS, REG_PRIM_CRT_COUNTER);
- return ((line >> 16) & 0x07FF);
+ return((CARD16)((line >> 16) & 0x07FF));
}
+#endif
-static CARD32 get_scanline_CRT2(SISPtr pSiS)
+#if 1
+static CARD16 get_scanline_CRT2(SISPtr pSiS, SISPortPrivPtr pPriv)
{
- CARD32 line;
-
- line = (CARD32)(getsisreg(pSiS, SISPART1, Index_CRT2_FC_VCount1) & 0x70) * 16
- + getsisreg(pSiS, SISPART1, Index_CRT2_FC_VCount);
+ CARD8 reg1, reg2;
+
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ inSISIDXREG(SISPART1, 0x32, reg1);
+ inSISIDXREG(SISPART1, 0x33, reg2);
+ } else {
+ inSISIDXREG(SISPART1, 0x27, reg1);
+ inSISIDXREG(SISPART1, 0x28, reg2);
+ }
- return line;
+ return((CARD16)(reg1 | ((reg2 & 0x70) << 4)));
}
#endif
@@ -819,37 +956,66 @@ SISResetXvGamma(ScrnInfoPtr pScrn)
void SISInitVideo(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+#ifdef INCL_YUV_BLIT_ADAPTOR
+ SISPtr pSiS = SISPTR(pScrn);
+#endif
XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL;
- XF86VideoAdaptorPtr newAdaptor = NULL;
+ XF86VideoAdaptorPtr newAdaptor = NULL, newBlitAdaptor = NULL;
int num_adaptors;
newAdaptor = SISSetupImageVideo(pScreen);
- if(newAdaptor)
+ if(newAdaptor) {
SISInitOffscreenImages(pScreen);
+ }
+
+#ifdef INCL_YUV_BLIT_ADAPTOR
+ if( ( (pSiS->ChipFlags & SiSCF_Is65x) ||
+ (pSiS->sishw_ext.jChipType >= SIS_330) ) &&
+ (pScrn->bitsPerPixel != 8) ) {
+ newBlitAdaptor = SISSetupBlitVideo(pScreen);
+ }
+#endif
num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors);
- if(newAdaptor) {
- if(!num_adaptors) {
- num_adaptors = 1;
- adaptors = &newAdaptor;
- } else {
- /* need to free this someplace */
- newAdaptors = xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*));
- if(newAdaptors) {
+ if(newAdaptor || newBlitAdaptor) {
+ int size = num_adaptors;
+
+ if(newAdaptor) size++;
+ if(newBlitAdaptor) size++;
+
+ newAdaptors = xalloc(size * sizeof(XF86VideoAdaptorPtr*));
+ if(newAdaptors) {
+ if(num_adaptors) {
memcpy(newAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr));
+ }
+ if(pSiS->XvDefAdaptorBlit) {
+ if(newBlitAdaptor) {
+ newAdaptors[num_adaptors] = newBlitAdaptor;
+ num_adaptors++;
+ }
+ }
+ if(newAdaptor) {
newAdaptors[num_adaptors] = newAdaptor;
- adaptors = newAdaptors;
num_adaptors++;
}
+ if(!pSiS->XvDefAdaptorBlit) {
+ if(newBlitAdaptor) {
+ newAdaptors[num_adaptors] = newBlitAdaptor;
+ num_adaptors++;
+ }
+ }
+ adaptors = newAdaptors;
}
}
- if(num_adaptors)
+ if(num_adaptors) {
xf86XVScreenInit(pScreen, adaptors, num_adaptors);
+ }
- if(newAdaptors)
+ if(newAdaptors) {
xfree(newAdaptors);
+ }
}
static void
@@ -861,7 +1027,6 @@ SISSetPortDefaults(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
#endif
pPriv->colorKey = pSiS->colorKey = 0x000101fe;
- pPriv->videoStatus = 0;
pPriv->brightness = pSiS->XvDefBri;
pPriv->contrast = pSiS->XvDefCon;
pPriv->hue = pSiS->XvDefHue;
@@ -924,7 +1089,7 @@ SISResetVideo(ScrnInfoPtr pScrn)
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Xv: Video password could not unlock registers\n");
}
-
+
/* Initialize first overlay (CRT1) ------------------------------- */
/* This bit has obviously a different meaning on 315 series (linebuffer-related) */
@@ -959,8 +1124,12 @@ SISResetVideo(ScrnInfoPtr pScrn)
setvideoreg(pSiS, Index_VI_Disp_Y_UV_Buf_Preset_High, 0x00);
setvideoreg(pSiS, Index_VI_Play_Threshold_Low, 0x00);
setvideoreg(pSiS, Index_VI_Play_Threshold_High, 0x00);
+ if(pSiS->Chipset == PCI_CHIP_SIS340) {
+ setvideoregmask(pSiS, 0xb5, 0x00, 0x01); /* Threshold high? */
+ setvideoregmask(pSiS, 0xb6, 0x00, 0x01);
+ }
- if(pSiS->Chipset == PCI_CHIP_SIS330) {
+ if(pSiS->Chipset == PCI_CHIP_SIS330) { /* 340? */
setvideoregmask(pSiS, Index_VI_Key_Overlay_OP, 0x00, 0x10);
} else if(pSiS->Chipset == PCI_CHIP_SIS660) {
setvideoregmask(pSiS, Index_VI_Key_Overlay_OP, 0x00, 0xE0);
@@ -972,6 +1141,10 @@ SISResetVideo(ScrnInfoPtr pScrn)
if((pSiS->ChipFlags & SiSCF_Is65x) || (pSiS->Chipset == PCI_CHIP_SIS660)) {
setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x00, 0x04);
}
+
+ /* Reset top window position for scanline check */
+ setvideoreg(pSiS, Index_VI_Win_Ver_Disp_Start_Low, 0x00);
+ setvideoreg(pSiS, Index_VI_Win_Ver_Over, 0x00);
/* Initialize second overlay (CRT2) - only for 300, 630/730, 550, M650/651, 661/741/660/760 */
if(pPriv->hasTwoOverlays) {
@@ -1016,6 +1189,9 @@ SISResetVideo(ScrnInfoPtr pScrn)
if(pSiS->sishw_ext.jChipType == SIS_661) {
setvideoregmask(pSiS, Index_VI_V_Buf_Start_Over, 0x24, 0x3c);
}
+
+ setvideoreg(pSiS, Index_VI_Win_Ver_Disp_Start_Low, 0x00);
+ setvideoreg(pSiS, Index_VI_Win_Ver_Over, 0x00);
}
@@ -1100,22 +1276,22 @@ set_disptype_regs(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
/*
* SR06[7:6]
- * Bit 7: Enable overlay 2 on CRT2
- * Bit 6: Enable overlay 1 on CRT2
+ * Bit 7: Enable overlay 1 on CRT2
+ * Bit 6: Enable overlay 0 on CRT2
* SR32[7:6]
- * Bit 7: DCLK/TCLK overlay 2
+ * Bit 7: DCLK/TCLK overlay 1
* 0=DCLK (overlay on CRT1)
* 1=TCLK (overlay on CRT2)
- * Bit 6: DCLK/TCLK overlay 1
+ * Bit 6: DCLK/TCLK overlay 0
* 0=DCLK (overlay on CRT1)
* 1=TCLK (overlay on CRT2)
*
* On chipsets with two overlays, we can freely select and also
- * have a mirror mode. However, we use overlay 1 for CRT1 and
- * overlay 2 for CRT2.
+ * have a mirror mode. However, we use overlay 0 for CRT1 and
+ * overlay 1 for CRT2.
* ATTENTION: CRT2 can only take up to 1 (one) overlay. Setting
* SR06/32 to 0xc0 DOES NOT WORK. THAT'S CONFIRMED.
- * Therefore, we use overlay 1 on CRT2 if in SINGLE2 mode.
+ * Therefore, we use overlay 0 on CRT2 if in SINGLE2 mode.
*
* For chipsets with only one overlay, user must choose whether
* to display the overlay on CRT1 or CRT2 by setting XvOnCRT2
@@ -1131,7 +1307,7 @@ set_disptype_regs(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
case DISPMODE_SINGLE1: /* CRT1-only mode: */
if(pPriv->hasTwoOverlays) {
if(pPriv->dualHeadMode) {
- setsrregmask(pSiS, 0x06, 0x00, 0x40); /* overlay 1 -> CRT1 */
+ setsrregmask(pSiS, 0x06, 0x00, 0x40); /* overlay 0 -> CRT1 */
setsrregmask(pSiS, 0x32, 0x00, 0x40);
} else {
setsrregmask(pSiS, 0x06, 0x00, 0xc0); /* both overlays -> CRT1 */
@@ -1152,10 +1328,10 @@ set_disptype_regs(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
case DISPMODE_SINGLE2: /* CRT2-only mode: */
if(pPriv->hasTwoOverlays) {
if(pPriv->dualHeadMode) {
- setsrregmask(pSiS, 0x06, 0x80, 0x80); /* overlay 2 -> CRT2 */
+ setsrregmask(pSiS, 0x06, 0x80, 0x80); /* overlay 1 -> CRT2 */
setsrregmask(pSiS, 0x32, 0x80, 0x80);
} else {
- setsrregmask(pSiS, 0x06, 0x40, 0xc0); /* overlay 1 -> CRT2 */
+ setsrregmask(pSiS, 0x06, 0x40, 0xc0); /* overlay 0 -> CRT2 */
setsrregmask(pSiS, 0x32, 0xc0, 0xc0); /* (although both clocks for CRT2!) */
}
} else {
@@ -1172,7 +1348,7 @@ set_disptype_regs(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
case DISPMODE_MIRROR: /* CRT1+CRT2-mode: (only on chips with 2 overlays) */
default:
- setsrregmask(pSiS, 0x06, 0x80, 0xc0); /* overlay 1 -> CRT1, overlay 2 -> CRT2 */
+ setsrregmask(pSiS, 0x06, 0x80, 0xc0); /* overlay 0 -> CRT1, overlay 1 -> CRT2 */
setsrregmask(pSiS, 0x32, 0x80, 0xc0);
break;
}
@@ -1206,6 +1382,9 @@ set_maxencoding(SISPtr pSiS, SISPortPrivPtr pPriv)
} else {
DummyEncoding.width = IMAGE_MAX_WIDTH_315;
DummyEncoding.height = IMAGE_MAX_HEIGHT_315;
+ if(pSiS->Chipset == PCI_CHIP_SIS340) {
+ DummyEncoding.width = IMAGE_MAX_WIDTH_340;
+ }
if(pPriv->hasTwoOverlays) {
/* Only half width available if both overlays
* are going to be used
@@ -1247,6 +1426,13 @@ SISSetupImageVideo(ScreenPtr pScreen)
XF86VideoAdaptorPtr adapt;
SISPortPrivPtr pPriv;
+#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,1,99,1,0)
+ XAAInfoRecPtr pXAA = pSiS->AccelInfoPtr;
+
+ if (!pXAA || !pXAA->FillSolidRects)
+ return NULL;
+#endif
+
if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) +
sizeof(SISPortPrivRec) +
sizeof(DevUnion))))
@@ -1319,6 +1505,7 @@ SISSetupImageVideo(ScreenPtr pScreen)
pPriv->grabbedByV4L= FALSE;
pPriv->NoOverlay = FALSE;
pPriv->PrevOverlay = FALSE;
+ pPriv->is340 = (pSiS->Chipset == PCI_CHIP_SIS340) ? TRUE : FALSE;
/* gotta uninit this someplace */
#if defined(REGION_NULL)
@@ -1362,6 +1549,7 @@ SISSetupImageVideo(ScreenPtr pScreen)
pSiS->xv_CT1 = MAKE_ATOM(sisxvsdcrt1status);
pSiS->xv_CMD = MAKE_ATOM(sisxvsdcheckmodeindexforcrt2);
pSiS->xv_CMDR = MAKE_ATOM(sisxvsdresultcheckmodeindexforcrt2);
+ pSiS->xv_RDT = MAKE_ATOM(sisxvsdredetectcrt2);
pSiS->xv_TAF = MAKE_ATOM(sisxvsdsisantiflicker);
pSiS->xv_TSA = MAKE_ATOM(sisxvsdsissaturation);
pSiS->xv_TEE = MAKE_ATOM(sisxvsdsisedgeenhance);
@@ -1430,6 +1618,7 @@ SISSetupImageVideo(ScreenPtr pScreen)
* M650/651.. 4 480 1920x1080
* 330 2 960 1920x1080
* 661/741/760 4 768 1920x1080
+ * 340 2 1280? ?
* The unit of size is unknown; I just know that a size of 480 limits
* the video source width to 384. Beyond that, line buffers must be
* merged (otherwise the video output is garbled).
@@ -1458,6 +1647,9 @@ SISSetupImageVideo(ScreenPtr pScreen)
* generally larger, so our merging-limit is higher, too.
*/
pPriv->linebufMergeLimit = LINEBUFLIMIT2;
+ if(pSiS->Chipset == PCI_CHIP_SIS340) {
+ pPriv->linebufMergeLimit = LINEBUFLIMIT4;
+ }
}
}
@@ -1476,7 +1668,7 @@ SISSetupImageVideo(ScreenPtr pScreen)
return adapt;
}
-#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,0,0)
+#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,3,0)
static Bool
RegionsEqual(RegionPtr A, RegionPtr B)
{
@@ -1620,6 +1812,13 @@ SISSetPortAttribute(ScrnInfoPtr pScrn, Atom attribute,
set_allowswitchcrt(pSiS, pPriv);
set_maxencoding(pSiS, pPriv);
}
+ } else if(attribute == pSiS->xv_RDT) {
+#ifdef SISDUALHEAD
+ if(!pPriv->dualHeadMode)
+#endif
+ if(pSiS->xv_sisdirectunlocked) {
+ SISRedetectCRT2Devices(pScrn);
+ }
} else if(attribute == pSiS->xv_TAF) {
if(pSiS->xv_sisdirectunlocked) {
SiS_SetSISTVantiflicker(pScrn, (int)value);
@@ -2194,18 +2393,13 @@ calc_scale_factor(SISOverlayPtr pOverlay, ScrnInfoPtr pScrn,
flag = 0;
}
-#if 0
- /* TEST @@@ */
- if(pOverlay->bobEnable & 0x08) dstH <<= 1;
-#endif
-
if(dstW < OVERLAY_MIN_WIDTH) dstW = OVERLAY_MIN_WIDTH;
if(dstW == srcW) {
pOverlay->HUSF = 0x00;
pOverlay->IntBit = 0x05;
pOverlay->wHPre = 0;
} else if(dstW > srcW) {
- dstW += 2;
+ dstW += 2;
pOverlay->HUSF = (srcW << 16) / dstW;
pOverlay->IntBit = 0x04;
pOverlay->wHPre = 0;
@@ -2249,20 +2443,20 @@ calc_scale_factor(SISOverlayPtr pOverlay, ScrnInfoPtr pScrn,
if(I < 2) {
pOverlay->VUSF = ((srcH - dstH) << 16) / dstH;
- /* TW: Needed for LCD-scaling modes */
+ /* Needed for LCD-scaling modes */
if((flag) && (mult = (srcH / origdstH)) >= 2) {
pOverlay->pitch /= mult;
}
} else {
#if 0
if(((pOverlay->bobEnable & 0x08) == 0x00) &&
- (((srcPitch * I)>>2) > 0xFFF)){
+ (((srcPitch * I) >> 2) > 0xFFF)){
pOverlay->bobEnable |= 0x08;
srcPitch >>= 1;
}
#endif
- if(((srcPitch * I)>>2) > 0xFFF) {
- I = (0xFFF*2/srcPitch);
+ if(((srcPitch * I) >> 2) > 0xFFF) {
+ I = (0xFFF * 2 / srcPitch);
pOverlay->VUSF = 0xFFFF;
} else {
dstH = I * dstH;
@@ -2272,7 +2466,7 @@ calc_scale_factor(SISOverlayPtr pOverlay, ScrnInfoPtr pScrn,
pOverlay->VUSF = 0x00;
}
/* set video frame buffer offset */
- pOverlay->pitch = (CARD16)(srcPitch*I);
+ pOverlay->pitch = (CARD16)(srcPitch * I);
}
}
}
@@ -2321,11 +2515,6 @@ calc_scale_factor_2(SISOverlayPtr pOverlay, ScrnInfoPtr pScrn,
flag = 0;
}
-#if 0
- /* TEST @@@ */
- if(pOverlay->bobEnable & 0x08) dstH <<= 1;
-#endif
-
if(dstW < OVERLAY_MIN_WIDTH) dstW = OVERLAY_MIN_WIDTH;
if(dstW == srcW) {
pOverlay->HUSF2 = 0x00;
@@ -2388,8 +2577,8 @@ calc_scale_factor_2(SISOverlayPtr pOverlay, ScrnInfoPtr pScrn,
srcPitch >>= 1;
}
#endif
- if(((srcPitch * I)>>2) > 0xFFF) {
- I = (0xFFF*2/srcPitch);
+ if(((srcPitch * I) >> 2) > 0xFFF) {
+ I = (0xFFF * 2 / srcPitch);
pOverlay->VUSF2 = 0xFFFF;
} else {
dstH = I * dstH;
@@ -2399,106 +2588,108 @@ calc_scale_factor_2(SISOverlayPtr pOverlay, ScrnInfoPtr pScrn,
pOverlay->VUSF2 = 0x00;
}
/* set video frame buffer offset */
- pOverlay->pitch2 = (CARD16)(srcPitch*I);
+ pOverlay->pitch2 = (CARD16)(srcPitch * I);
}
}
}
#endif
-static CARD8
-calc_line_buf_size(CARD32 srcW, CARD8 wHPre, CARD32 pixelFormat)
+static CARD16
+calc_line_buf_size(CARD32 srcW, CARD8 wHPre, CARD8 planar, SISPortPrivPtr pPriv)
{
- CARD8 preHIDF;
CARD32 I;
- CARD32 line = srcW;
- if( (pixelFormat == PIXEL_FMT_YV12) ||
- (pixelFormat == PIXEL_FMT_I420) ||
- (pixelFormat == PIXEL_FMT_NV12) ||
- (pixelFormat == PIXEL_FMT_NV21) )
- {
- preHIDF = wHPre & 0x07;
- switch (preHIDF)
- {
- case 3 :
- if((line & 0xffffff00) == line)
- I = (line >> 8);
- else
- I = (line >> 8) + 1;
- return((CARD8)(I * 32 - 1));
- case 4 :
- if((line & 0xfffffe00) == line)
- I = (line >> 9);
- else
- I = (line >> 9) + 1;
- return((CARD8)(I * 64 - 1));
- case 5 :
- if((line & 0xfffffc00) == line)
- I = (line >> 10);
- else
- I = (line >> 10) + 1;
- return((CARD8)(I * 128 - 1));
- case 6 :
- return((CARD8)(255));
- default :
- if((line & 0xffffff80) == line)
- I = (line >> 7);
- else
- I = (line >> 7) + 1;
- return((CARD8)(I * 16 - 1));
+ if(planar) {
+
+ switch(wHPre & 0x07) {
+ case 3:
+ I = (srcW >> 8);
+ if(srcW & 0xff) I++;
+ I <<= 5;
+ break;
+ case 4:
+ I = (srcW >> 9);
+ if(srcW & 0x1ff) I++;
+ I <<= 6;
+ break;
+ case 5:
+ I = (srcW >> 10);
+ if(srcW & 0x3ff) I++;
+ I <<= 7;
+ break;
+ case 6:
+ if(pPriv->is340) {
+ I = (srcW >> 11);
+ if(srcW & 0x7ff) I++;
+ I <<= 8;
+ break;
+ } else {
+ return((CARD16)(255));
+ }
+ default:
+ I = (srcW >> 7);
+ if(srcW & 0x7f) I++;
+ I <<= 4;
+ break;
}
- } else { /* YUV2, UYVY */
- if((line & 0xffffff8) == line)
- I = (line >> 3);
- else
- I = (line >> 3) + 1;
- return((CARD8)(I - 1));
+
+ } else { /* packed */
+
+ I = (srcW >> 3);
+ if(srcW & 0x07) I++;
+
}
+
+ if(I <= 3) I = 4;
+
+ return((CARD16)(I - 1));
}
static __inline void
-set_line_buf_size_1(SISOverlayPtr pOverlay)
+calc_line_buf_size_1(SISOverlayPtr pOverlay, SISPortPrivPtr pPriv)
{
- pOverlay->lineBufSize = calc_line_buf_size(pOverlay->srcW,pOverlay->wHPre, pOverlay->pixelFormat);
+ pOverlay->lineBufSize =
+ calc_line_buf_size(pOverlay->srcW, pOverlay->wHPre, pOverlay->planar, pPriv);
}
#ifdef SISMERGED
static __inline void
-set_line_buf_size_2(SISOverlayPtr pOverlay)
+calc_line_buf_size_2(SISOverlayPtr pOverlay, SISPortPrivPtr pPriv)
{
- pOverlay->lineBufSize2 = calc_line_buf_size(pOverlay->srcW2,pOverlay->wHPre2, pOverlay->pixelFormat);
+ pOverlay->lineBufSize2 =
+ calc_line_buf_size(pOverlay->srcW2, pOverlay->wHPre2, pOverlay->planar, pPriv);
}
static void
merge_line_buf_mfb(SISPtr pSiS, SISPortPrivPtr pPriv, Bool enable1, Bool enable2,
short width1, short width2, short limit)
{
- unsigned char misc1, misc2, mask = pPriv->linebufmask;
+ unsigned char misc1, misc2, mask = pPriv->linebufmask;
- if(pPriv->hasTwoOverlays) { /* This means we are in MIRROR mode */
+ if(pPriv->hasTwoOverlays) { /* This means we are in MIRROR mode */
- misc2 = 0x00;
- if(enable1) misc1 = 0x04;
- else misc1 = 0x00;
- setvideoregmask(pSiS, Index_VI_Control_Misc2, misc2, mask);
- setvideoregmask(pSiS, Index_VI_Control_Misc1, misc1, 0x04);
+ misc2 = 0x00;
+ if(enable1) misc1 = 0x04;
+ else misc1 = 0x00;
+ setvideoregmask(pSiS, Index_VI_Control_Misc2, misc2, mask);
+ setvideoregmask(pSiS, Index_VI_Control_Misc1, misc1, 0x04);
- misc2 = 0x01;
- if(enable2) misc1 = 0x04;
- else misc1 = 0x00;
- setvideoregmask(pSiS, Index_VI_Control_Misc2, misc2, mask);
- setvideoregmask(pSiS, Index_VI_Control_Misc1, misc1, 0x04);
+ misc2 = 0x01;
+ if(enable2) misc1 = 0x04;
+ else misc1 = 0x00;
+ setvideoregmask(pSiS, Index_VI_Control_Misc2, misc2, mask);
+ setvideoregmask(pSiS, Index_VI_Control_Misc1, misc1, 0x04);
- } else { /* This means we are either in SINGLE1 or SINGLE2 mode */
+ } else { /* This means we are either in SINGLE1 or SINGLE2 mode */
- misc2 = 0x00;
- if(enable1 || enable2) misc1 = 0x04;
- else misc1 = 0x00;
+ misc2 = 0x00;
+ if(enable1 || enable2) misc1 = 0x04;
+ else misc1 = 0x00;
- setvideoregmask(pSiS, Index_VI_Control_Misc2, misc2, mask);
- setvideoregmask(pSiS, Index_VI_Control_Misc1, misc1, 0x04);
+ setvideoregmask(pSiS, Index_VI_Control_Misc2, misc2, mask);
+ setvideoregmask(pSiS, Index_VI_Control_Misc1, misc1, 0x04);
- }
+ }
}
#endif
@@ -2526,6 +2717,7 @@ merge_line_buf_mfb(SISPtr pSiS, SISPortPrivPtr pPriv, Bool enable1, Bool enable2
* Individual merge is supported on all chipsets.
* Dual merge is only supported on the 300 series and M650/651 and later.
* All merge is only supported on the M650/651 and later.
+ * Single-Overlay-chipsets only support Individual merge.
*
*/
@@ -2763,7 +2955,9 @@ set_disablegfx(SISPtr pSiS, Bool mybool, SISOverlayPtr pOverlay)
{
/* This is not supported on M65x, 65x (x>0) or later */
/* For CRT1 ONLY!!! */
- if((!(pSiS->ChipFlags & SiSCF_Is65x)) && (pSiS->Chipset != PCI_CHIP_SIS660)) {
+ if((!(pSiS->ChipFlags & SiSCF_Is65x)) &&
+ (pSiS->Chipset != PCI_CHIP_SIS660) &&
+ (pSiS->Chipset != PCI_CHIP_SIS340)) {
setvideoregmask(pSiS, Index_VI_Control_Misc2, mybool ? 0x04 : 0x00, 0x04);
if(mybool) pOverlay->keyOP = VI_ROP_Always;
}
@@ -2783,15 +2977,11 @@ set_disablegfxlr(SISPtr pSiS, Bool mybool, SISOverlayPtr pOverlay)
static void
set_overlay(SISPtr pSiS, SISOverlayPtr pOverlay, SISPortPrivPtr pPriv, int index, int iscrt2)
{
- ScrnInfoPtr pScrn = pSiS->pScrn;
-
- CARD16 pitch=0;
CARD8 h_over=0, v_over=0;
- CARD16 top, bottom, left, right;
+ CARD16 top, bottom, left, right, pitch=0;
CARD16 screenX, screenY;
- int modeflags, watchdog;
- CARD8 data;
CARD32 PSY;
+ int modeflags, watchdog=0;
#ifdef SISMERGED
if(pSiS->MergedFB && iscrt2) {
@@ -2840,38 +3030,62 @@ set_overlay(SISPtr pSiS, SISOverlayPtr pOverlay, SISPortPrivPtr pPriv, int index
/* set line buffer size */
#ifdef SISMERGED
- if(pSiS->MergedFB && iscrt2)
- setvideoreg(pSiS, Index_VI_Line_Buffer_Size, pOverlay->lineBufSize2);
- else
+ if(pSiS->MergedFB && iscrt2) {
+ setvideoreg(pSiS, Index_VI_Line_Buffer_Size, (CARD8)pOverlay->lineBufSize2);
+ if(pPriv->is340) {
+ setvideoreg(pSiS, Index_VI_Line_Buffer_Size_High, (CARD8)(pOverlay->lineBufSize2 >> 8));
+ }
+ } else {
#endif
- setvideoreg(pSiS, Index_VI_Line_Buffer_Size, pOverlay->lineBufSize);
+ setvideoreg(pSiS, Index_VI_Line_Buffer_Size, (CARD8)pOverlay->lineBufSize);
+ if(pPriv->is340) {
+ setvideoreg(pSiS, Index_VI_Line_Buffer_Size_High, (CARD8)(pOverlay->lineBufSize >> 8));
+ }
+#ifdef SISMERGED
+ }
+#endif
/* set color key mode */
setvideoregmask(pSiS, Index_VI_Key_Overlay_OP, pOverlay->keyOP, 0x0f);
-
+
/* We don't have to wait for vertical retrace in all cases */
if(pPriv->mustwait) {
- if((pSiS->VGAEngine == SIS_315_VGA) && (index)) {
- /* overlay 2 needs special treatment */
- setvideoregmask(pSiS, Index_VI_Control_Misc0, 0x00, 0x02);
- }
- watchdog = WATCHDOG_DELAY;
- while(pOverlay->VBlankActiveFunc(pSiS, pPriv) && --watchdog);
- watchdog = WATCHDOG_DELAY;
- while((!pOverlay->VBlankActiveFunc(pSiS, pPriv)) && --watchdog);
- if(!watchdog) xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Xv: Waiting for vertical retrace timed-out\n");
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+
+ if(index) {
+ CARD16 mytop = getvideoreg(pSiS, Index_VI_Win_Ver_Disp_Start_Low);
+ mytop |= ((getvideoreg(pSiS, Index_VI_Win_Ver_Over) & 0x0f) << 8);
+ pOverlay->oldtop = mytop;
+ watchdog = 0xffff;
+ if(mytop < screenY - 2) {
+ do {
+ watchdog = get_scanline_CRT2(pSiS, pPriv);
+ } while((watchdog <= mytop) || (watchdog >= screenY));
+ }
+ pOverlay->oldLine = watchdog;
+ }
+
+ } else {
+
+ watchdog = WATCHDOG_DELAY;
+ while(pOverlay->VBlankActiveFunc(pSiS, pPriv) && --watchdog);
+ watchdog = WATCHDOG_DELAY;
+ while((!pOverlay->VBlankActiveFunc(pSiS, pPriv)) && --watchdog);
+
+ }
}
-
+
/* Unlock address registers */
- data = getvideoreg(pSiS, Index_VI_Control_Misc1);
- setvideoreg(pSiS, Index_VI_Control_Misc1, data | 0x20);
- /* Is this required? */
- setvideoreg(pSiS, Index_VI_Control_Misc1, data | 0x20);
+ setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x20, 0x20);
+
+ /* set destination window position */
+ setvideoreg(pSiS, Index_VI_Win_Hor_Disp_Start_Low, (CARD8)left);
+ setvideoreg(pSiS, Index_VI_Win_Hor_Disp_End_Low, (CARD8)right);
+ setvideoreg(pSiS, Index_VI_Win_Hor_Over, (CARD8)h_over);
- /* Is this required? (seems so) */
- if((pSiS->Chipset == SIS_315_VGA) && !index)
- setvideoregmask(pSiS, Index_VI_Control_Misc3, 0x00, (1 << index));
+ setvideoreg(pSiS, Index_VI_Win_Ver_Disp_Start_Low, (CARD8)top);
+ setvideoreg(pSiS, Index_VI_Win_Ver_Disp_End_Low, (CARD8)bottom);
+ setvideoreg(pSiS, Index_VI_Win_Ver_Over, (CARD8)v_over);
/* Set Y buf pitch */
setvideoreg(pSiS, Index_VI_Disp_Y_Buf_Pitch_Low, (CARD8)(pitch));
@@ -2891,105 +3105,85 @@ set_overlay(SISPtr pSiS, SISOverlayPtr pOverlay, SISPortPrivPtr pPriv, int index
/* set 315 series overflow bits for Y plane */
if(pSiS->VGAEngine == SIS_315_VGA) {
- setvideoreg(pSiS, Index_VI_Disp_Y_Buf_Pitch_High, (CARD8)(pitch >> 12));
- setvideoreg(pSiS, Index_VI_Y_Buf_Start_Over, ((CARD8)(PSY >> 24) & 0x03));
+ setvideoreg(pSiS, Index_VI_Disp_Y_Buf_Pitch_High, (CARD8)(pitch >> 12));
+ setvideoreg(pSiS, Index_VI_Y_Buf_Start_Over, ((CARD8)(PSY >> 24) & 0x03));
}
/* Set U/V data if using planar formats */
- if( (pOverlay->pixelFormat == PIXEL_FMT_YV12) ||
- (pOverlay->pixelFormat == PIXEL_FMT_I420) ||
- (pOverlay->pixelFormat == PIXEL_FMT_NV12) ||
- (pOverlay->pixelFormat == PIXEL_FMT_NV21) ) {
+ if(pOverlay->planar) {
- CARD32 PSU=0, PSV=0, uvpitch = pitch;
+ CARD32 PSU = pOverlay->PSU;
+ CARD32 PSV = pOverlay->PSV;
- PSU = pOverlay->PSU;
- PSV = pOverlay->PSV;
#ifdef SISMERGED
if(pSiS->MergedFB && iscrt2) {
PSU = pOverlay->PSU2;
PSV = pOverlay->PSV2;
}
#endif
- if((pOverlay->pixelFormat == PIXEL_FMT_YV12) ||
- (pOverlay->pixelFormat == PIXEL_FMT_I420)) {
- uvpitch >>= 1;
- }
+
+ if(pOverlay->planar_shiftpitch) pitch >>= 1;
/* Set U/V pitch */
- setvideoreg (pSiS, Index_VI_Disp_UV_Buf_Pitch_Low, (CARD8)uvpitch);
- setvideoregmask (pSiS, Index_VI_Disp_Y_UV_Buf_Pitch_Middle, (CARD8)(uvpitch >> 4), 0xf0);
+ setvideoreg(pSiS, Index_VI_Disp_UV_Buf_Pitch_Low, (CARD8)pitch);
+ setvideoregmask(pSiS, Index_VI_Disp_Y_UV_Buf_Pitch_Middle, (CARD8)(pitch >> 4), 0xf0);
/* set U/V start address */
- setvideoreg (pSiS, Index_VI_U_Buf_Start_Low, (CARD8)PSU);
- setvideoreg (pSiS, Index_VI_U_Buf_Start_Middle,(CARD8)(PSU >> 8));
- setvideoreg (pSiS, Index_VI_U_Buf_Start_High, (CARD8)(PSU >> 16));
+ setvideoreg(pSiS, Index_VI_U_Buf_Start_Low, (CARD8)PSU);
+ setvideoreg(pSiS, Index_VI_U_Buf_Start_Middle,(CARD8)(PSU >> 8));
+ setvideoreg(pSiS, Index_VI_U_Buf_Start_High, (CARD8)(PSU >> 16));
- setvideoreg (pSiS, Index_VI_V_Buf_Start_Low, (CARD8)PSV);
- setvideoreg (pSiS, Index_VI_V_Buf_Start_Middle,(CARD8)(PSV >> 8));
- setvideoreg (pSiS, Index_VI_V_Buf_Start_High, (CARD8)(PSV >> 16));
+ setvideoreg(pSiS, Index_VI_V_Buf_Start_Low, (CARD8)PSV);
+ setvideoreg(pSiS, Index_VI_V_Buf_Start_Middle,(CARD8)(PSV >> 8));
+ setvideoreg(pSiS, Index_VI_V_Buf_Start_High, (CARD8)(PSV >> 16));
/* 315 series overflow bits */
if(pSiS->VGAEngine == SIS_315_VGA) {
- setvideoreg (pSiS, Index_VI_Disp_UV_Buf_Pitch_High, (CARD8)(uvpitch >> 12));
- setvideoreg (pSiS, Index_VI_U_Buf_Start_Over, ((CARD8)(PSU >> 24) & 0x03));
+ setvideoreg(pSiS, Index_VI_Disp_UV_Buf_Pitch_High, (CARD8)(pitch >> 12));
+ setvideoreg(pSiS, Index_VI_U_Buf_Start_Over, ((CARD8)(PSU >> 24) & 0x03));
if(pSiS->sishw_ext.jChipType == SIS_661) {
- setvideoregmask (pSiS, Index_VI_V_Buf_Start_Over, ((CARD8)(PSV >> 24) & 0x03), 0xc3);
+ setvideoregmask(pSiS, Index_VI_V_Buf_Start_Over, ((CARD8)(PSV >> 24) & 0x03), 0xc3);
} else {
- setvideoreg (pSiS, Index_VI_V_Buf_Start_Over, ((CARD8)(PSV >> 24) & 0x03));
+ setvideoreg(pSiS, Index_VI_V_Buf_Start_Over, ((CARD8)(PSV >> 24) & 0x03));
}
}
}
+
+ setvideoregmask(pSiS, Index_VI_Control_Misc1, pOverlay->bobEnable, 0x1a);
+
+ /* Lock the address registers */
+ setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x20);
/* set scale factor */
#ifdef SISMERGED
if(pSiS->MergedFB && iscrt2) {
- setvideoreg (pSiS, Index_VI_Hor_Post_Up_Scale_Low, (CARD8)(pOverlay->HUSF2));
- setvideoreg (pSiS, Index_VI_Hor_Post_Up_Scale_High,(CARD8)((pOverlay->HUSF2) >> 8));
- setvideoreg (pSiS, Index_VI_Ver_Up_Scale_Low, (CARD8)(pOverlay->VUSF2));
- setvideoreg (pSiS, Index_VI_Ver_Up_Scale_High, (CARD8)((pOverlay->VUSF2) >> 8));
+ setvideoreg(pSiS, Index_VI_Hor_Post_Up_Scale_Low, (CARD8)(pOverlay->HUSF2));
+ setvideoreg(pSiS, Index_VI_Hor_Post_Up_Scale_High,(CARD8)((pOverlay->HUSF2) >> 8));
+ setvideoreg(pSiS, Index_VI_Ver_Up_Scale_Low, (CARD8)(pOverlay->VUSF2));
+ setvideoreg(pSiS, Index_VI_Ver_Up_Scale_High, (CARD8)((pOverlay->VUSF2) >> 8));
- setvideoregmask (pSiS, Index_VI_Scale_Control, (pOverlay->IntBit2 << 3)
- |(pOverlay->wHPre2), 0x7f);
+ setvideoregmask(pSiS, Index_VI_Scale_Control, (pOverlay->IntBit2 << 3) |
+ (pOverlay->wHPre2), 0x7f);
} else {
#endif
- setvideoreg (pSiS, Index_VI_Hor_Post_Up_Scale_Low, (CARD8)(pOverlay->HUSF));
- setvideoreg (pSiS, Index_VI_Hor_Post_Up_Scale_High,(CARD8)((pOverlay->HUSF) >> 8));
- setvideoreg (pSiS, Index_VI_Ver_Up_Scale_Low, (CARD8)(pOverlay->VUSF));
- setvideoreg (pSiS, Index_VI_Ver_Up_Scale_High, (CARD8)((pOverlay->VUSF)>>8));
+ setvideoreg(pSiS, Index_VI_Hor_Post_Up_Scale_Low, (CARD8)(pOverlay->HUSF));
+ setvideoreg(pSiS, Index_VI_Hor_Post_Up_Scale_High,(CARD8)((pOverlay->HUSF) >> 8));
+ setvideoreg(pSiS, Index_VI_Ver_Up_Scale_Low, (CARD8)(pOverlay->VUSF));
+ setvideoreg(pSiS, Index_VI_Ver_Up_Scale_High, (CARD8)((pOverlay->VUSF) >> 8));
- setvideoregmask (pSiS, Index_VI_Scale_Control, (pOverlay->IntBit << 3)
- |(pOverlay->wHPre), 0x7f);
+ setvideoregmask(pSiS, Index_VI_Scale_Control, (pOverlay->IntBit << 3) |
+ (pOverlay->wHPre), 0x7f);
#ifdef SISMERGED
}
#endif
-
- if((pSiS->VGAEngine == SIS_315_VGA) && (index)){
- /* Trigger register copy for 315/330 series */
- /* setvideoreg(pSiS, Index_VI_Control_Misc3, (1 << index)); */
- setvideoregmask(pSiS, Index_VI_Control_Misc3, (1 << index), (1 << index));
- }
-
- /* set destination window position */
- setvideoreg(pSiS, Index_VI_Win_Hor_Disp_Start_Low, (CARD8)left);
- setvideoreg(pSiS, Index_VI_Win_Hor_Disp_End_Low, (CARD8)right);
- setvideoreg(pSiS, Index_VI_Win_Hor_Over, (CARD8)h_over);
-
- setvideoreg(pSiS, Index_VI_Win_Ver_Disp_Start_Low, (CARD8)top);
- setvideoreg(pSiS, Index_VI_Win_Ver_Disp_End_Low, (CARD8)bottom);
- setvideoreg(pSiS, Index_VI_Win_Ver_Over, (CARD8)v_over);
-
- setvideoregmask(pSiS, Index_VI_Control_Misc1, pOverlay->bobEnable, 0x1a);
-
- /* Lock the address registers */
- setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x20);
+
}
/* Overlay MUST NOT be switched off while beam is over it */
static void
close_overlay(SISPtr pSiS, SISPortPrivPtr pPriv)
{
- CARD32 watchdog;
+ int watchdog;
if(!(pPriv->overlayStatus)) return;
pPriv->overlayStatus = FALSE;
@@ -3023,15 +3217,16 @@ close_overlay(SISPtr pSiS, SISPortPrivPtr pPriv)
}
setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x01);
- watchdog = WATCHDOG_DELAY;
- while(vblank_active_CRT2(pSiS, pPriv) && --watchdog);
+
watchdog = WATCHDOG_DELAY;
while((!vblank_active_CRT2(pSiS, pPriv)) && --watchdog);
- setvideoregmask(pSiS, Index_VI_Control_Misc0, 0x00, 0x02);
watchdog = WATCHDOG_DELAY;
while(vblank_active_CRT2(pSiS, pPriv) && --watchdog);
+ setvideoregmask(pSiS, Index_VI_Control_Misc0, 0x00, 0x02);
watchdog = WATCHDOG_DELAY;
while((!vblank_active_CRT2(pSiS, pPriv)) && --watchdog);
+ watchdog = WATCHDOG_DELAY;
+ while(vblank_active_CRT2(pSiS, pPriv) && --watchdog);
#ifdef SIS_CP
SIS_CP_RESET_CP
@@ -3052,17 +3247,19 @@ close_overlay(SISPtr pSiS, SISPortPrivPtr pPriv)
}
}
#endif
+
setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x00, 0x05);
setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x01);
- watchdog = WATCHDOG_DELAY;
- while(vblank_active_CRT1(pSiS, pPriv) && --watchdog);
+
watchdog = WATCHDOG_DELAY;
while((!vblank_active_CRT1(pSiS, pPriv)) && --watchdog);
- setvideoregmask(pSiS, Index_VI_Control_Misc0, 0x00, 0x02);
watchdog = WATCHDOG_DELAY;
while(vblank_active_CRT1(pSiS, pPriv) && --watchdog);
+ setvideoregmask(pSiS, Index_VI_Control_Misc0, 0x00, 0x02);
watchdog = WATCHDOG_DELAY;
while((!vblank_active_CRT1(pSiS, pPriv)) && --watchdog);
+ watchdog = WATCHDOG_DELAY;
+ while(vblank_active_CRT1(pSiS, pPriv) && --watchdog);
}
}
@@ -3228,13 +3425,19 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
srcOffsetY = pPriv->src_h * (-overlay.dstBox.y1) / pPriv->drw_h;
overlay.dstBox.y1 = 0;
}
+
+ if((overlay.dstBox.x1 >= overlay.dstBox.x2 - 2) ||
+ (overlay.dstBox.x1 >= screenwidth - 2) ||
+ (overlay.dstBox.y1 >= overlay.dstBox.y2)) {
+#ifdef SISMERGED
+ if(pSiS->MergedFB) overlay.DoFirst = FALSE;
+ else
+#endif
+ return;
+ }
#ifdef SISMERGED
if(pSiS->MergedFB) {
- if((overlay.dstBox2.x1 >= overlay.dstBox2.x2) ||
- (overlay.dstBox2.y1 >= overlay.dstBox2.y2))
- overlay.DoSecond = FALSE;
-
if((overlay.dstBox2.x2 <= 0) || (overlay.dstBox2.y2 <= 0))
overlay.DoSecond = FALSE;
@@ -3245,10 +3448,16 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
srcOffsetX2 = pPriv->src_w * (-overlay.dstBox2.x1) / pPriv->drw_w;
overlay.dstBox2.x1 = 0;
}
+
if(overlay.dstBox2.y1 < 0) {
srcOffsetY2 = pPriv->src_h * (-overlay.dstBox2.y1) / pPriv->drw_h;
overlay.dstBox2.y1 = 0;
}
+
+ if((overlay.dstBox2.x1 >= overlay.dstBox2.x2 - 2) ||
+ (overlay.dstBox2.x1 >= screen2width - 2) ||
+ (overlay.dstBox2.y1 >= overlay.dstBox2.y2))
+ overlay.DoSecond = FALSE;
/* If neither overlay is to be displayed, disable them if they are currently enabled */
if((!overlay.DoFirst) && (!overlay.DoSecond)) {
@@ -3258,19 +3467,19 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
if(temp & 0x02) {
watchdog = WATCHDOG_DELAY;
if(pPriv->hasTwoOverlays) {
- while(vblank_active_CRT1(pSiS, pPriv) && --watchdog);
+ while((!vblank_active_CRT1(pSiS, pPriv)) && --watchdog);
watchdog = WATCHDOG_DELAY;
- while((!vblank_active_CRT1(pSiS, pPriv)) && --watchdog);
+ while(vblank_active_CRT1(pSiS, pPriv) && --watchdog);
} else {
temp = getsrreg(pSiS, 0x06);
if(!(temp & 0x40)) {
- while(vblank_active_CRT1(pSiS, pPriv) && --watchdog);
+ while((!vblank_active_CRT1(pSiS, pPriv)) && --watchdog);
watchdog = WATCHDOG_DELAY;
- while((!vblank_active_CRT1(pSiS, pPriv)) && --watchdog);
+ while(vblank_active_CRT1(pSiS, pPriv) && --watchdog);
} else {
- while(vblank_active_CRT2(pSiS, pPriv) && --watchdog);
+ while((!vblank_active_CRT2(pSiS, pPriv)) && --watchdog);
watchdog = WATCHDOG_DELAY;
- while((!vblank_active_CRT2(pSiS, pPriv)) && --watchdog);
+ while(vblank_active_CRT2(pSiS, pPriv) && --watchdog);
}
}
setvideoregmask(pSiS, Index_VI_Control_Misc0, 0x00, 0x02);
@@ -3281,9 +3490,9 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
temp = getvideoreg(pSiS,Index_VI_Control_Misc0);
if(temp & 0x02) {
watchdog = WATCHDOG_DELAY;
- while(vblank_active_CRT2(pSiS, pPriv) && --watchdog);
+ while((!vblank_active_CRT2(pSiS, pPriv)) && --watchdog);
watchdog = WATCHDOG_DELAY;
- while((!vblank_active_CRT2(pSiS, pPriv)) && --watchdog);
+ while(vblank_active_CRT2(pSiS, pPriv) && --watchdog);
setvideoregmask(pSiS, Index_VI_Control_Misc0, 0x00, 0x02);
}
}
@@ -3296,6 +3505,8 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
switch(pPriv->id) {
case PIXEL_FMT_YV12:
+ overlay.planar = 1;
+ overlay.planar_shiftpitch = 1;
#ifdef SISMERGED
if((!pSiS->MergedFB) || (overlay.DoFirst)) {
#endif
@@ -3328,6 +3539,8 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
break;
case PIXEL_FMT_I420:
+ overlay.planar = 1;
+ overlay.planar_shiftpitch = 1;
#ifdef SISMERGED
if((!pSiS->MergedFB) || (overlay.DoFirst)) {
#endif
@@ -3361,6 +3574,8 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
case PIXEL_FMT_NV12:
case PIXEL_FMT_NV21:
+ overlay.planar = 1;
+ overlay.planar_shiftpitch = 0;
#ifdef SISMERGED
if((!pSiS->MergedFB) || (overlay.DoFirst)) {
#endif
@@ -3395,6 +3610,7 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
case PIXEL_FMT_RGB6:
case PIXEL_FMT_RGB5:
default:
+ overlay.planar = 0;
#ifdef SISMERGED
if((!pSiS->MergedFB) || (overlay.DoFirst)) {
#endif
@@ -3430,7 +3646,6 @@ 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
}
@@ -3457,9 +3672,9 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
temp = getvideoreg(pSiS,Index_VI_Control_Misc0);
if(temp & 0x02) {
watchdog = WATCHDOG_DELAY;
- while(vblank_active_CRT1(pSiS, pPriv) && --watchdog);
+ while((!vblank_active_CRT1(pSiS, pPriv)) && --watchdog);
watchdog = WATCHDOG_DELAY;
- while((!vblank_active_CRT1(pSiS, pPriv)) && --watchdog);
+ while(vblank_active_CRT1(pSiS, pPriv) && --watchdog);
setvideoregmask(pSiS, Index_VI_Control_Misc0, 0x00, 0x02);
}
} else if(!overlay.DoSecond) {
@@ -3468,16 +3683,23 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
temp = getvideoreg(pSiS,Index_VI_Control_Misc0);
if(temp & 0x02) {
watchdog = WATCHDOG_DELAY;
- while(vblank_active_CRT2(pSiS, pPriv) && --watchdog);
+ while((!vblank_active_CRT2(pSiS, pPriv)) && --watchdog);
watchdog = WATCHDOG_DELAY;
- while((!vblank_active_CRT2(pSiS, pPriv)) && --watchdog);
+ while(vblank_active_CRT2(pSiS, pPriv) && --watchdog);
setvideoregmask(pSiS, Index_VI_Control_Misc0, 0x00, 0x02);
}
}
}
#endif
+ /* xf86DrvMsg(0, X_INFO, "DV(2): %d %d %d %d (%d %d) | %d %d %d %d (%d %d)\n",
+ overlay.dstBox.x1,overlay.dstBox.x2,overlay.dstBox.y1,overlay.dstBox.y2,srcOffsetX,srcOffsetY,
+ overlay.dstBox2.x1,overlay.dstBox2.x2,overlay.dstBox2.y1,overlay.dstBox2.y2,srcOffsetX2,srcOffsetY2); */
+
/* Loop head */
+ /* Note: index can only be 1 for CRT2, ie overlay 1
+ * is only used for CRT2.
+ */
if(pPriv->displayMode & DISPMODE_SINGLE2) {
if(pPriv->hasTwoOverlays) { /* We have 2 overlays: */
if(pPriv->dualHeadMode) {
@@ -3542,27 +3764,61 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
#ifdef SISMERGED
if((!pSiS->MergedFB) || (overlay.DoFirst))
#endif
- set_line_buf_size_1(&overlay);
+ calc_line_buf_size_1(&overlay, pPriv);
#ifdef SISMERGED
if((pSiS->MergedFB) && (overlay.DoSecond))
- set_line_buf_size_2(&overlay);
+ calc_line_buf_size_2(&overlay, pPriv);
#endif
+ if(pPriv->dualHeadMode) {
+#ifdef SISDUALHEAD
+ if(!pSiS->SecondHead) {
+ if(pPriv->updatetvxpos) {
+ SiS_SetTVxposoffset(pScrn, pPriv->tvxpos);
+ pPriv->updatetvxpos = FALSE;
+ }
+ if(pPriv->updatetvypos) {
+ SiS_SetTVyposoffset(pScrn, pPriv->tvypos);
+ pPriv->updatetvypos = FALSE;
+ }
+ }
+#endif
+ } else {
+ if(pPriv->updatetvxpos) {
+ SiS_SetTVxposoffset(pScrn, pPriv->tvxpos);
+ pPriv->updatetvxpos = FALSE;
+ }
+ if(pPriv->updatetvypos) {
+ SiS_SetTVyposoffset(pScrn, pPriv->tvypos);
+ pPriv->updatetvypos = FALSE;
+ }
+ }
+
+#if 0 /* Clearing this does not seem to be required */
+ /* and might even be dangerous. */
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ watchdog = WATCHDOG_DELAY;
+ while(overlay.VBlankActiveFunc(pSiS, pPriv) && --watchdog);
+ setvideoregmask(pSiS, Index_VI_Control_Misc3, 0x00, 0x03);
+ }
+#endif
+ setvideoregmask(pSiS, Index_VI_Control_Misc3, 0x03, 0x03);
+
/* Do the following in a loop for CRT1 and CRT2 ----------------- */
MIRROR:
- /* calculate (not set!) scale factor */
+ /* calculate scale factor */
#ifdef SISMERGED
if(pSiS->MergedFB && iscrt2)
calc_scale_factor_2(&overlay, pScrn, pPriv, index, iscrt2);
else
#endif
calc_scale_factor(&overlay, pScrn, pPriv, index, iscrt2);
-
- /* Select overlay 1 (used for CRT1/or CRT2) or overlay 2 (used for CRT2) */
+
+ /* Select overlay 0 (used for CRT1/or CRT2) or overlay 1 (used for CRT2 only) */
setvideoregmask(pSiS, Index_VI_Control_Misc2, index, 0x01);
-
- /* set format */
+
+ /* set format (before color and chroma keys) */
set_format(pSiS, &overlay);
/* set color key */
@@ -3585,35 +3841,10 @@ MIRROR:
set_saturation(pSiS, pPriv->saturation);
}
- if(pPriv->dualHeadMode) {
-#ifdef SISDUALHEAD
- if(!pSiS->SecondHead) {
- if(pPriv->updatetvxpos) {
- SiS_SetTVxposoffset(pScrn, pPriv->tvxpos);
- pPriv->updatetvxpos = FALSE;
- }
- if(pPriv->updatetvypos) {
- SiS_SetTVyposoffset(pScrn, pPriv->tvypos);
- pPriv->updatetvypos = FALSE;
- }
- }
-#endif
- } else {
- if(pPriv->updatetvxpos) {
- SiS_SetTVxposoffset(pScrn, pPriv->tvxpos);
- pPriv->updatetvxpos = FALSE;
- }
- if(pPriv->updatetvypos) {
- SiS_SetTVyposoffset(pScrn, pPriv->tvypos);
- pPriv->updatetvypos = FALSE;
- }
- }
-
/* enable/disable graphics display around overlay
* (Since disabled overlays don't get treated in this
* loop, we omit respective checks here)
*/
-
if(!iscrt2) set_disablegfx(pSiS, pPriv->disablegfx, &overlay);
else if(!pPriv->hasTwoOverlays) {
set_disablegfx(pSiS, FALSE, &overlay);
@@ -3624,14 +3855,9 @@ MIRROR:
SIS_CP_VIDEO_SET_CP
#endif
- /* set overlay parameters */
+ /* set remaining overlay parameters */
set_overlay(pSiS, &overlay, pPriv, index, iscrt2);
-
- if((pSiS->VGAEngine == SIS_315_VGA) && !index) {
- /* Trigger register copy for 315 series */
- setvideoregmask(pSiS, Index_VI_Control_Misc3, (1 << index), (1 << index));
- }
-
+
/* enable overlay */
setvideoregmask (pSiS, Index_VI_Control_Misc0, 0x02, 0x02);
@@ -3646,10 +3872,78 @@ MIRROR:
overlay.VBlankActiveFunc = vblank_active_CRT2;
goto MIRROR;
#ifdef SISMERGED
- }
+ }
#endif
}
+ /* Now for the trigger: This is a bad hack to work-around
+ * an obvious hardware bug: Overlay 1 (which is ONLY used
+ * for CRT2 in this driver) does not always update its
+ * window position and some other stuff. Earlier, this was
+ * solved be disabling the overlay, but this took forever
+ * and was ugly on the screen.
+ * Now: We write 0x03 to 0x74 from the beginning. This is
+ * meant as a "lock" - the driver is supposed to write 0
+ * to this register, bit 0 for overlay 0, bit 1 for over-
+ * lay 1, then change buffer addresses, pitches, window
+ * position, scaler registers, format, etc., then write
+ * 1 to 0x74. The hardware then reads the registers into
+ * its internal engine and clears these bits.
+ * All this works for overlay 0, but not 1. Overlay 1
+ * has assumingly the following restrictions:
+ * - New data written to the registers are only read
+ * correctly by the engine, if the registers are written
+ * when the current scanline is beyond the current
+ * overlay position and below the maximum visible
+ * scanline (vertical screen resolution)
+ * - If a vertical retrace occures during writing the
+ * registers, the registers written BEFORE this re-
+ * trace happened, are not being read into the
+ * engine if the trigger is set after the retrace.
+ * Therefore: We write the overlay registers above in
+ * set_overlay only if the scanline matches, and save
+ * the then current scanline. If this scanline is higher
+ * than the now current scanline, we assume a retrace,
+ * wait for the scanline to match the criteria above again,
+ * and rewrite all relevant registers.
+ * I have no idea if this is meant that way, but after
+ * fiddling three entire days with this crap, I found this
+ * to be the only solution.
+ */
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ if((pPriv->mustwait) && index) {
+ watchdog = get_scanline_CRT2(pSiS, pPriv);
+ if(watchdog <= overlay.oldLine) {
+ int i, mytop = overlay.oldtop;
+ int screenHeight = overlay.SCREENheight;
+#ifdef SISMERGED
+ if(pSiS->MergedFB) {
+ screenHeight = overlay.SCREENheight2;
+ }
+#endif
+ if(mytop < screenHeight - 2) {
+ do {
+ watchdog = get_scanline_CRT2(pSiS, pPriv);
+ } while((watchdog <= mytop) || (watchdog >= screenHeight));
+ }
+ for(i=0x02; i<=0x12; i++) {
+ setvideoreg(pSiS, i, getvideoreg(pSiS, i));
+ }
+ for(i=0x18; i<=0x1c; i++) {
+ setvideoreg(pSiS, i, getvideoreg(pSiS, i));
+ }
+ for(i=0x2c; i<=0x2e; i++) {
+ setvideoreg(pSiS, i, getvideoreg(pSiS, i));
+ }
+ for(i=0x6b; i<=0x6f; i++) {
+ setvideoreg(pSiS, i, getvideoreg(pSiS, i));
+ }
+ }
+ }
+ /* Trigger register copy for 315/330 series */
+ setvideoregmask(pSiS, Index_VI_Control_Misc3, 0x03, 0x03);
+ }
+
pPriv->mustwait = 0;
pPriv->overlayStatus = TRUE;
}
@@ -3664,13 +3958,11 @@ SISAllocateOverlayMemory(
FBLinearPtr new_linear;
if(linear) {
- if(linear->size >= size)
- return linear;
+ if(linear->size >= size) return linear;
- if(xf86ResizeOffscreenLinear(linear, size))
- return linear;
+ if(xf86ResizeOffscreenLinear(linear, size)) return linear;
- xf86FreeOffscreenLinear(linear);
+ xf86FreeOffscreenLinear(linear);
}
pScreen = screenInfo.screens[pScrn->scrnIndex];
@@ -3679,25 +3971,25 @@ SISAllocateOverlayMemory(
NULL, NULL, NULL);
if(!new_linear) {
- int max_size;
+ int max_size;
- xf86QueryLargestOffscreenLinear(pScreen, &max_size, 8,
+ xf86QueryLargestOffscreenLinear(pScreen, &max_size, 8,
PRIORITY_EXTREME);
- if(max_size < size) return NULL;
+ if(max_size < size) return NULL;
- xf86PurgeUnlockedOffscreenAreas(pScreen);
- new_linear = xf86AllocateOffscreenLinear(pScreen, size, 8,
+ xf86PurgeUnlockedOffscreenAreas(pScreen);
+ new_linear = xf86AllocateOffscreenLinear(pScreen, size, 8,
NULL, NULL, NULL);
}
if(!new_linear)
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Xv: Failed to allocate %dK of video memory\n", size/1024);
-#ifdef TWDEBUG
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Xv: Failed to allocate %d pixels of linear video memory\n", size/1024);
+#ifdef TWDEBUG
else
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Xv: Allocated %dK of video memory\n", size/1024);
-#endif
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Xv: Allocated %d pixels of linear video memory\n", size/1024);
+#endif
return new_linear;
}
@@ -3708,8 +4000,8 @@ SISFreeOverlayMemory(ScrnInfoPtr pScrn)
SISPortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn);
if(pPriv->linear) {
- xf86FreeOffscreenLinear(pPriv->linear);
- pPriv->linear = NULL;
+ xf86FreeOffscreenLinear(pPriv->linear);
+ pPriv->linear = NULL;
}
}
@@ -3730,11 +4022,11 @@ SISStopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
}
SISFreeOverlayMemory(pScrn);
pPriv->videoStatus = 0;
- pSiS->VideoTimerCallback = NULL;
} else {
if(pPriv->videoStatus & CLIENT_VIDEO_ON) {
- pPriv->videoStatus = OFF_TIMER | CLIENT_VIDEO_ON;
+ UpdateCurrentTime();
pPriv->offTime = currentTime.milliseconds + OFF_DELAY;
+ pPriv->videoStatus = OFF_TIMER | CLIENT_VIDEO_ON;
pSiS->VideoTimerCallback = SISVideoTimerCallback;
}
}
@@ -3754,6 +4046,7 @@ SISPutImage(
){
SISPtr pSiS = SISPTR(pScrn);
SISPortPrivPtr pPriv = (SISPortPrivPtr)data;
+ XAAInfoRecPtr pXAA = pSiS->AccelInfoPtr;
int totalSize=0;
int depth = pSiS->CurrentLayout.bitsPerPixel >> 3;
@@ -3802,6 +4095,14 @@ SISPutImage(
Y0 U0 Y1 V0 Y2 U2 Y3 V2 ...
5. YVYU: Like YUY2, but order is
Y0 V0 Y1 U0 Y2 V2 Y3 U2 ...
+ 6. NV12, NV21: 2 planes H V
+ Y sample period 1 1 (8 bit per pixel)
+ V sample period 2 1 (8 bit per pixel, subsampled)
+ U sample period 2 1 (8 bit per pixel, subsampled)
+ Y plane is fully samples (width*height), U and V planes are
+ interleaved in memory (one byte U, one byte V for NV12, NV21
+ other way round) and sampled in 2x1 blocks. Otherwise such
+ as all other planar formats.
*/
switch(id){
@@ -3826,12 +4127,12 @@ SISPutImage(
/* make it a multiple of 16 to simplify to copy loop */
totalSize += 15;
- totalSize &= ~15;
+ totalSize &= ~15; /* in bytes */
- /* allocate memory (we do doublebuffering) */
+ /* allocate memory (we do doublebuffering) - size is in pixels! */
if(!(pPriv->linear = SISAllocateOverlayMemory(pScrn, pPriv->linear,
- totalSize<<1)))
- return BadAlloc;
+ ((totalSize + depth - 1) / depth) << 1)))
+ return BadAlloc;
/* fixup pointers */
pPriv->bufAddr[0] = (pPriv->linear->offset * depth);
@@ -3857,7 +4158,7 @@ SISPutImage(
/* update cliplist */
if(pPriv->autopaintColorKey &&
(pPriv->grabbedByV4L ||
-#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,0,0)
+#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,3,0)
(!RegionsEqual(&pPriv->clip, clipBoxes)) ||
#else
(!REGION_EQUAL(pScrn->pScreen, &pPriv->clip, clipBoxes)) ||
@@ -3869,15 +4170,16 @@ SISPutImage(
}
/* draw these */
pPriv->PrevOverlay = pPriv->NoOverlay;
- if((pPriv->NoOverlay) && (!pSiS->NoAccel)) {
- XAAFillMono8x8PatternRects(pScrn, myreds[depth-1], 0x000000, GXcopy, ~0,
+ if((pPriv->NoOverlay) && pXAA && pXAA->FillMono8x8PatternRects) {
+ (*pXAA->FillMono8x8PatternRects)(pScrn, myreds[depth-1],
+ 0x000000, GXcopy, ~0,
REGION_NUM_RECTS(clipBoxes),
REGION_RECTS(clipBoxes),
0x00422418, 0x18244200, 0, 0);
} else {
if(!pSiS->disablecolorkeycurrent) {
-#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
- XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0,
+#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,1,99,1,0)
+ (*pXAA->FillSolidRects)(pScrn, pPriv->colorKey, GXcopy, ~0,
REGION_NUM_RECTS(clipBoxes),
REGION_RECTS(clipBoxes));
#else
@@ -3968,48 +4270,9 @@ SISQueryImageAttributes(
return size;
}
-static void
-SISVideoTimerCallback(ScrnInfoPtr pScrn, Time now)
-{
- SISPtr pSiS = SISPTR(pScrn);
- SISPortPrivPtr pPriv = NULL;
- unsigned char sridx, cridx;
-
- pSiS->VideoTimerCallback = NULL;
-
- if(!pScrn->vtSema) return;
-
- if(pSiS->adaptor) {
- pPriv = GET_PORT_PRIVATE(pScrn);
- if(!pPriv->videoStatus)
- pPriv = NULL;
- }
-
- if(pPriv) {
- if(pPriv->videoStatus & TIMER_MASK) {
- UpdateCurrentTime();
- if(pPriv->offTime < currentTime.milliseconds) {
- if(pPriv->videoStatus & OFF_TIMER) {
- /* Turn off the overlay */
- sridx = inSISREG(SISSR); cridx = inSISREG(SISCR);
- close_overlay(pSiS, pPriv);
- outSISREG(SISSR, sridx); outSISREG(SISCR, cridx);
- pPriv->mustwait = 1;
- pPriv->videoStatus = FREE_TIMER;
- pPriv->freeTime = currentTime.milliseconds + FREE_DELAY;
- pSiS->VideoTimerCallback = SISVideoTimerCallback;
- } else if(pPriv->videoStatus & FREE_TIMER) {
- SISFreeOverlayMemory(pScrn);
- pPriv->mustwait = 1;
- pPriv->videoStatus = 0;
- }
- } else
- pSiS->VideoTimerCallback = SISVideoTimerCallback;
- }
- }
-}
-
-/* Offscreen surface stuff */
+/*****************************************************************/
+/* OFFSCREEN SURFACES */
+/*****************************************************************/
static int
SISAllocSurface (
@@ -4039,8 +4302,9 @@ SISAllocSurface (
depth = pSiS->CurrentLayout.bitsPerPixel >> 3;
w = (w + 1) & ~1;
pPriv->pitch = ((w << 1) + 63) & ~63; /* Only packed pixel modes supported */
- size = h * pPriv->pitch; /* / depth; - Why? */
- pPriv->linear = SISAllocateOverlayMemory(pScrn, pPriv->linear, size);
+ size = h * pPriv->pitch;
+ pPriv->linear = SISAllocateOverlayMemory(pScrn, pPriv->linear, ((size + depth - 1) / depth));
+
if(!pPriv->linear)
return BadAlloc;
@@ -4151,8 +4415,10 @@ SISDisplaySurface (
SISDisplayVideo(pScrn, pPriv);
if(pPriv->autopaintColorKey) {
- if((pPriv->NoOverlay) && (!(pSiS->NoAccel))) {
- XAAFillMono8x8PatternRects(pScrn,
+ XAAInfoRecPtr pXAA = pSiS->AccelInfoPtr;
+
+ if((pPriv->NoOverlay) && pXAA && pXAA->FillMono8x8PatternRects) {
+ (*pXAA->FillMono8x8PatternRects)(pScrn,
myreds[(pSiS->CurrentLayout.bitsPerPixel >> 3) - 1],
0x000000, GXcopy, ~0,
REGION_NUM_RECTS(clipBoxes),
@@ -4160,8 +4426,8 @@ SISDisplaySurface (
0x00422418, 0x18244200, 0, 0);
} else {
-#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,0,0)
- XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0,
+#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,1,99,1,0)
+ (*pXAA->FillSolidRects)(pScrn, pPriv->colorKey, GXcopy, ~0,
REGION_NUM_RECTS(clipBoxes),
REGION_RECTS(clipBoxes));
#else
@@ -4277,208 +4543,637 @@ SISInitOffscreenImages(ScreenPtr pScreen)
xf86XVRegisterOffscreenImages(pScreen, SISOffscreenImages, num);
}
-#ifdef NOT_YET_IMPLEMENTED /* ----------- TW: FOR FUTURE USE -------------------- */
+/*****************************************************************/
+/* BLIT ADAPTORS */
+/*****************************************************************/
+#ifdef INCL_YUV_BLIT_ADAPTOR
-/* Set alpha - does not work */
static void
-set_alpha(SISPtr pSiS, CARD8 alpha)
+SISSetPortDefaultsBlit(ScrnInfoPtr pScrn, SISBPortPrivPtr pPriv)
{
- setvideoregmask(pSiS, Index_VI_Key_Overlay_OP, ((alpha & 0x0f) << 4), 0xf0);
+ /* Default: Don't sync. */
+ pPriv->vsync = 0;
}
-/* Set SubPicture Start Address (yet unused) */
static void
-set_subpict_start_offset(SISPtr pSiS, SISOverlayPtr pOverlay, int index)
+SISResetVideoBlit(ScrnInfoPtr pScrn)
{
- CARD32 temp;
- CARD8 data;
-
- temp = pOverlay->SubPictAddr >> 4; /* 630 <-> 315 shiftValue? */
-
- setvideoreg(pSiS,Index_VI_SubPict_Buf_Start_Low, temp & 0xFF);
- setvideoreg(pSiS,Index_VI_SubPict_Buf_Start_Middle, (temp>>8) & 0xFF);
- setvideoreg(pSiS,Index_VI_SubPict_Buf_Start_High, (temp>>16) & 0x3F);
- if(pSiS->VGAEngine == SIS_315_VGA) {
- setvideoreg(pSiS,Index_VI_SubPict_Start_Over, (temp>>22) & 0x01);
- /* Submit SubPict offset ? */
- /* data=getvideoreg(pSiS,Index_VI_Control_Misc3); */
- setvideoreg(pSiS,Index_VI_Control_Misc3, (1 << index) | 0x04);
- }
}
-/* Set SubPicture Pitch (yet unused) */
-static void
-set_subpict_pitch(SISPtr pSiS, SISOverlayPtr pOverlay, int index)
+static XF86VideoAdaptorPtr
+SISSetupBlitVideo(ScreenPtr pScreen)
{
- CARD32 temp;
- CARD8 data;
-
- temp = pOverlay->SubPictPitch >> 4; /* 630 <-> 315 shiftValue? */
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ SISPtr pSiS = SISPTR(pScrn);
+ XF86VideoAdaptorPtr adapt;
+ SISBPortPrivPtr pPriv;
+ int i;
- setvideoreg(pSiS,Index_VI_SubPict_Buf_Pitch, temp & 0xFF);
- if(pSiS->VGAEngine == SIS_315_VGA) {
- setvideoreg(pSiS,Index_VI_SubPict_Buf_Pitch_High, (temp>>8) & 0xFF);
- /* Submit SubPict pitch ? */
- /* data=getvideoreg(pSiS,Index_VI_Control_Misc3); */
- setvideoreg(pSiS,Index_VI_Control_Misc3, (1 << index) | 0x04);
- }
-}
+ if(!pSiS->AccelInfoPtr) return NULL;
-/* Calculate and set SubPicture scaling (untested, unused yet) */
-static void
-set_subpict_scale_factor(SISOverlayPtr pOverlay, ScrnInfoPtr pScrn,
- SISPortPrivPtr pPriv, int index, int iscrt2)
-{
- SISPtr pSiS = SISPTR(pScrn);
- CARD32 I=0,mult=0;
- int flag=0;
-
- int dstW = pOverlay->SubPictdstBox.x2 - pOverlay->SubPictdstBox.x1;
- int dstH = pOverlay->SubPictdstBox.y2 - pOverlay->SubPictdstBox.y1;
- int srcW = pOverlay->SubPictsrcW;
- int srcH = pOverlay->SubPictsrcH;
- CARD16 LCDheight = pSiS->LCDheight;
- int srcPitch = pOverlay->SubPictOrigPitch;
- int origdstH = dstH;
+ if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) +
+ (sizeof(DevUnion) * NUM_BLIT_PORTS) +
+ sizeof(SISBPortPrivRec)))) {
+ return NULL;
+ }
- /* Stretch image due to idiotic LCD "auto"-scaling */
- /* INCOMPLETE and INCORRECT - See set_scale_factor() */
- if( (pPriv->bridgeIsSlave) && (pSiS->VBFlags & CRT2_LCD) ) {
- dstH = (dstH * LCDheight) / pOverlay->SCREENheight;
- } else if((index) && (pSiS->VBFlags & CRT2_LCD)) {
- dstH = (dstH * LCDheight) / pOverlay->SCREENheight;
- if(pPriv->displayMode == DISPMODE_MIRROR) flag = 1;
- }
+ adapt->type = XvWindowMask | XvInputMask | XvImageMask;
+ adapt->flags = 0;
+ adapt->name = "SIS 315/330 series Video Blitter";
+ adapt->nEncodings = 1;
+ adapt->pEncodings = &DummyEncodingBlit;
+ adapt->nFormats = 4;
+ adapt->pFormats = SISFormats;
+ adapt->nImages = NUM_IMAGES_BLIT;
+ adapt->pImages = SISImagesBlit;
+ adapt->pAttributes = SISAttributes_Blit;
+ adapt->nAttributes = NUM_ATTRIBUTES_BLIT;
+ adapt->nPorts = NUM_BLIT_PORTS;
+ adapt->pPortPrivates = (DevUnion*)(&adapt[1]);
+
+ pSiS->blitPriv = (void *)(&adapt->pPortPrivates[NUM_BLIT_PORTS]);
+ pPriv = (SISBPortPrivPtr)(pSiS->blitPriv);
+
+ for(i = 0; i < NUM_BLIT_PORTS; i++) {
+ adapt->pPortPrivates[i].uval = (unsigned long)(i);
+#if defined(REGION_NULL)
+ REGION_NULL(pScreen, &pPriv->blitClip[i]);
+#else
+ REGION_INIT(pScreen, &pPriv->blitClip[i], NullBox, 0);
+#endif
+ pPriv->videoStatus[i] = 0;
+ pPriv->currentBuf[i] = 0;
+ pPriv->linear[i] = NULL;
+ }
+
+ if(pSiS->sishw_ext.jChipType >= SIS_330) {
+ pPriv->AccelCmd = YUVRGB_BLIT_330;
+ pPriv->VBlankTriggerCRT1 = 0;
+ pPriv->VBlankTriggerCRT2 = 0;
+ } else {
+ pPriv->AccelCmd = YUVRGB_BLIT_325;
+ pPriv->VBlankTriggerCRT1 = SCANLINE_TRIGGER_ENABLE | SCANLINE_TR_CRT1;
+ pPriv->VBlankTriggerCRT2 = SCANLINE_TRIGGER_ENABLE | SCANLINE_TR_CRT2;
+ }
+
+ adapt->PutVideo = NULL;
+ adapt->PutStill = NULL;
+ adapt->GetVideo = NULL;
+ adapt->GetStill = NULL;
+ adapt->StopVideo = (StopVideoFuncPtr)SISStopVideoBlit;
+ adapt->SetPortAttribute = (SetPortAttributeFuncPtr)SISSetPortAttributeBlit;
+ adapt->GetPortAttribute = (GetPortAttributeFuncPtr)SISGetPortAttributeBlit;
+ adapt->QueryBestSize = (QueryBestSizeFuncPtr)SISQueryBestSizeBlit;
+ adapt->PutImage = (PutImageFuncPtr)SISPutImageBlit;
+ adapt->QueryImageAttributes = SISQueryImageAttributesBlit;
+
+ pSiS->blitadaptor = adapt;
- if(dstW == srcW) {
- pOverlay->SubPictHUSF = 0x00;
- pOverlay->SubPictIntBit = 0x01;
- } else if(dstW > srcW) {
- pOverlay->SubPictHUSF = (srcW << 16) / dstW;
- pOverlay->SubPictIntBit = 0x00;
- } else {
- int tmpW = dstW;
+ pSiS->xvVSync = MAKE_ATOM(sisxvvsync);
+ pSiS->xvSetDefaults = MAKE_ATOM(sisxvsetdefaults);
+
+ SISResetVideoBlit(pScrn);
+
+ /* Reset the properties to their defaults */
+ SISSetPortDefaultsBlit(pScrn, pPriv);
- I = 0x00;
- while (srcW >= tmpW) {
- tmpW <<= 1;
- I++;
- }
- pOverlay->SubPictwHPre = (CARD8)(I - 1);
- dstW <<= (I - 1);
- if((srcW % dstW))
- pOverlay->SubPictHUSF = ((srcW - dstW) << 16) / dstW;
- else
- pOverlay->SubPictHUSF = 0x00;
+ return adapt;
+}
- pOverlay->SubPictIntBit = 0x01;
- }
+static void
+SISFreeBlitMemory(ScrnInfoPtr pScrn, int index)
+{
+ SISPtr pSiS = SISPTR(pScrn);
+ SISBPortPrivPtr pPriv = (SISBPortPrivPtr)(pSiS->blitPriv);
- if(dstH == srcH) {
- pOverlay->SubPictVUSF = 0x00;
- pOverlay->SubPictIntBit |= 0x02;
- } else if(dstH > srcH) {
- dstH += 0x02;
- pOverlay->SubPictVUSF = (srcH << 16) / dstH;
- /* pOverlay->SubPictIntBit |= 0x00; */
- } else {
+ if(pPriv->linear[index]) {
+ xf86FreeOffscreenLinear(pPriv->linear[index]);
+ pPriv->linear[index] = NULL;
+ }
+}
- I = srcH / dstH;
- pOverlay->SubPictIntBit |= 0x02;
+static int
+SISGetPortAttributeBlit(ScrnInfoPtr pScrn, Atom attribute,
+ INT32 *value, unsigned long index)
+{
+ SISPtr pSiS = SISPTR(pScrn);
+ SISBPortPrivPtr pPriv = (SISBPortPrivPtr)(pSiS->blitPriv);
- if(I < 2) {
- pOverlay->SubPictVUSF = ((srcH - dstH) << 16) / dstH;
- /* TW: Needed for LCD-scaling modes */
- if((flag) && (mult = (srcH / origdstH)) >= 2)
- pOverlay->SubPictPitch /= mult;
- } else {
- if(((srcPitch * I)>>2) > 0xFFF) {
- I = (0xFFF*2/srcPitch);
- pOverlay->SubPictVUSF = 0xFFFF;
- } else {
- dstH = I * dstH;
- if(srcH % dstH)
- pOverlay->SubPictVUSF = ((srcH - dstH) << 16) / dstH;
- else
- pOverlay->SubPictVUSF = 0x00;
- }
- /* set video frame buffer offset */
- pOverlay->SubPictPitch = (CARD16)(srcPitch*I);
- }
- }
- /* set SubPicture scale factor */
- setvideoreg (pSiS, Index_VI_SubPict_Hor_Scale_Low, (CARD8)(pOverlay->SubPictHUSF));
- setvideoreg (pSiS, Index_VI_SubPict_Hor_Scale_High, (CARD8)((pOverlay->SubPictHUSF)>>8));
- setvideoreg (pSiS, Index_VI_SubPict_Vert_Scale_Low, (CARD8)(pOverlay->SubPictVUSF));
- setvideoreg (pSiS, Index_VI_SubPict_Vert_Scale_High,(CARD8)((pOverlay->SubPictVUSF)>>8));
-
- setvideoregmask (pSiS, Index_VI_SubPict_Scale_Control,
- (pOverlay->SubPictIntBit << 3) |
- (pOverlay->SubPictwHPre), 0x7f);
+ if(attribute == pSiS->xvVSync) {
+ *value = pPriv->vsync;
+ } else return BadMatch;
+ return Success;
}
-/* Set SubPicture Preset (yet unused) */
-static void
-set_subpict_preset(SISPtr pSiS, SISOverlayPtr pOverlay)
+static int
+SISSetPortAttributeBlit(ScrnInfoPtr pScrn, Atom attribute,
+ INT32 value, unsigned long index)
{
- CARD32 temp;
- CARD8 data;
-
- temp = pOverlay->SubPictPreset >> 4; /* TW: 630 <-> 315 ? */
-
- setvideoreg(pSiS,Index_VI_SubPict_Buf_Preset_Low, temp & 0xFF);
- setvideoreg(pSiS,Index_VI_SubPict_Buf_Preset_Middle, (temp>>8) & 0xFF);
- data = getvideoreg(pSiS,Index_VI_SubPict_Buf_Start_High);
- if(temp > 0xFFFF)
- data |= 0x40;
- else
- data &= ~0x40;
- setvideoreg(pSiS,Index_VI_SubPict_Buf_Start_High, data);
+ SISPtr pSiS = SISPTR(pScrn);
+ SISBPortPrivPtr pPriv = (SISBPortPrivPtr)(pSiS->blitPriv);
+
+ if(attribute == pSiS->xvVSync) {
+ if((value < 0) || (value > 1)) return BadValue;
+ pPriv->vsync = value;
+ } else if(attribute == pSiS->xvSetDefaults) {
+ SISSetPortDefaultsBlit(pScrn, pPriv);
+ } else return BadMatch;
+ return Success;
}
static void
-enable_subpict_overlay(SISPtr pSiS, Bool enable)
+SISStopVideoBlit(ScrnInfoPtr pScrn, unsigned long index, Bool shutdown)
{
- setvideoregmask(pSiS, Index_VI_SubPict_Scale_Control,
- enable ? 0x40 : 0x00,
- 0x40);
+ SISPtr pSiS = SISPTR(pScrn);
+ SISBPortPrivPtr pPriv = (SISBPortPrivPtr)(pSiS->blitPriv);
+
+ /* This shouldn't be called for blitter adaptors due to
+ * adapt->flags but we provide it anyway.
+ */
+
+ if(index > NUM_BLIT_PORTS) return;
+
+ REGION_EMPTY(pScrn->pScreen, &pPriv->blitClip[index]);
+
+ if(shutdown) {
+ XAAInfoRecPtr pXAA = pSiS->AccelInfoPtr;
+ pPriv->videoStatus[index] = 0;
+ if(pXAA && pXAA->Sync) (pXAA->Sync)(pScrn);
+ SISFreeBlitMemory(pScrn, (int)index);
+ }
}
-/* Set overlay for subpicture */
static void
-set_subpict_overlay(SISPtr pSiS, SISOverlayPtr pOverlay, SISPortPrivPtr pPriv, int index)
+SISWriteBlitPacket(SISPtr pSiS, CARD32 *packet)
{
- ScrnInfoPtr pScrn = pSiS->pScrn;
+ CARD32 dummybuf;
+
+ SiSWritePacketPart(packet[0], packet[1], packet[2], packet[3]);
+ SiSWritePacketPart(packet[4], packet[5], packet[6], packet[7]);
+ SiSWritePacketPart(packet[8], packet[9], packet[10], packet[11]);
+ SiSWritePacketPart(packet[12], packet[13], packet[14], packet[15]);
+ SiSWritePacketPart(packet[16], packet[17], packet[18], packet[19]);
+ SiSSyncWP;
+ (void)dummybuf; /* Suppress compiler warning */
+}
- set_subpict_pitch(pSiS, &overlay, index);
- set_subpict_start_offset(pSiS, &overlay, index);
- set_subpict_scale_factor(&overlay, pScrn, pPriv, index);
- /* set_subpict_preset(pSiS, &overlay); */
- /* enable_subpict_overlay(pSiS, 1); */
+static int
+SISPutImageBlit(
+ ScrnInfoPtr pScrn,
+ short src_x, short src_y,
+ short drw_x, short drw_y,
+ short src_w, short src_h,
+ short drw_w, short drw_h,
+ int id, unsigned char* buf,
+ short width, short height,
+ Bool sync,
+ RegionPtr clipBoxes, unsigned long index
+){
+ SISPtr pSiS = SISPTR(pScrn);
+ SISBPortPrivPtr pPriv = (SISBPortPrivPtr)(pSiS->blitPriv);
+#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,1,99,1,0)
+ XAAInfoRecPtr pXAA = pSiS->AccelInfoPtr;
+#endif
+ BoxPtr pbox = REGION_RECTS(clipBoxes);
+ int nbox = REGION_NUM_RECTS(clipBoxes);
+ int depth = pSiS->CurrentLayout.bitsPerPixel >> 3;
+ CARD32 dstbase = 0, offsety, offsetuv, temp;
+ int totalSize, bytesize=0, h, w, wb, srcPitch;
+ int xoffset = 0, yoffset = 0, left, right, top, bottom;
+ unsigned char *ybases, *ubases = NULL, *vbases = NULL, *myubases, *myvbases;
+ unsigned char *ybased, *uvbased, packed;
+ CARD16 *myuvbased;
+ SiS_Packet12_YUV MyPacket;
+ Bool first;
+
+ if(index > NUM_BLIT_PORTS) return BadMatch;
+
+ if(!height || !width) return Success;
+
+ switch(id) {
+ case PIXEL_FMT_YV12:
+ case PIXEL_FMT_I420:
+ case PIXEL_FMT_NV12:
+ case PIXEL_FMT_NV21:
+ srcPitch = (width + 7) & ~7; /* Should come this way anyway */
+ bytesize = srcPitch * height;
+ totalSize = (bytesize * 3) >> 1;
+ break;
+ case PIXEL_FMT_YUY2:
+ case PIXEL_FMT_UYVY:
+ case PIXEL_FMT_YVYU:
+ srcPitch = ((width << 1) + 3) & ~3;
+ /* Size = width * 2 * height */
+ totalSize = srcPitch * height;
+ bytesize = 0;
+ break;
+ default:
+ return BadMatch;
+ }
+
+ /* allocate memory (we do doublebuffering) */
+ if(!(pPriv->linear[index] = SISAllocateOverlayMemory(pScrn, pPriv->linear[index],
+ ((totalSize + depth - 1) / depth) << 1)))
+ return BadAlloc;
+
+ /* fixup pointers */
+ pPriv->bufAddr[index][0] = (pPriv->linear[index]->offset * depth);
+ pPriv->bufAddr[index][1] = pPriv->bufAddr[index][0] + totalSize;
+
+ if(drw_w > width) {
+ xoffset = (drw_w - width) >> 1;
+ }
+ if(drw_h > (height & ~1)) {
+ yoffset = (drw_h - height) >> 1;
+ }
+
+ if(xoffset || yoffset) {
+#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,3,0)
+ if(!RegionsEqual(&pPriv->blitClip[index], clipBoxes)) {
+#else
+ if(!REGION_EQUAL(pScrn->pScreen, &pPriv->blitClip[index], clipBoxes)) {
+#endif
+#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,1,99,1,0)
+ (*pXAA->FillSolidRects)(pScrn, 0x00000000, GXcopy, ~0,
+ REGION_NUM_RECTS(clipBoxes),
+ REGION_RECTS(clipBoxes));
+#else
+ xf86XVFillKeyHelper(pScrn->pScreen, 0x00000000, clipBoxes);
+#endif
+ REGION_COPY(pScrn->pScreen, &pPriv->blitClip[index], clipBoxes);
+ }
+ }
+
+ memset(&MyPacket, 0, sizeof(MyPacket));
+
+ ybased = pSiS->FbBase + pPriv->bufAddr[index][pPriv->currentBuf[index]];
+ uvbased = pSiS->FbBase + pPriv->bufAddr[index][pPriv->currentBuf[index]] + bytesize;
+
+ ybases = buf;
+ packed = 0;
+
+ switch(id) {
+ case PIXEL_FMT_YV12:
+ vbases = buf + bytesize;
+ ubases = buf + bytesize*5/4;
+ break;
+ case PIXEL_FMT_I420:
+ ubases = buf + bytesize;
+ vbases = buf + bytesize*5/4;
+ break;
+ case PIXEL_FMT_NV12:
+ MyPacket.P12_Command = YUV_FORMAT_NV12;
+ break;
+ case PIXEL_FMT_NV21:
+ MyPacket.P12_Command = YUV_FORMAT_NV21;
+ break;
+ case PIXEL_FMT_YUY2:
+ MyPacket.P12_Command = YUV_FORMAT_YUY2;
+ packed = 1;
+ break;
+ case PIXEL_FMT_UYVY:
+ MyPacket.P12_Command = YUV_FORMAT_UYVY;
+ packed = 1;
+ break;
+ case PIXEL_FMT_YVYU:
+ MyPacket.P12_Command = YUV_FORMAT_YVYU;
+ packed = 1;
+ break;
+ default:
+ return BadMatch;
+ }
+
+ switch(id) {
+ case PIXEL_FMT_YV12:
+ case PIXEL_FMT_I420:
+ MyPacket.P12_Command = YUV_FORMAT_NV12;
+ /* Copy y plane */
+ memcpy(ybased, ybases, bytesize);
+ /* Copy u/v planes */
+ wb = srcPitch >> 1;
+ h = height >> 1;
+ while(h--) {
+ myuvbased = (CARD16*)uvbased;
+ myubases = ubases;
+ myvbases = vbases;
+ w = wb;
+ while(w--) {
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+ temp = (*myubases++) << 8;
+ temp |= (*myvbases++);
+#else
+ temp = (*myvbases++) << 8;
+ temp |= (*myubases++);
+#endif
+ *myuvbased++ = temp;
+ }
+ uvbased += srcPitch;
+ ubases += wb;
+ vbases += wb;
+ }
+ break;
+ default:
+ memcpy(ybased, ybases, totalSize);
+ }
+
+#ifdef SISDUALHEAD
+ dstbase += HEADOFFSET;
+#endif
+
+ MyPacket.P12_Header0 = SIS_PACKET12_HEADER0;
+ MyPacket.P12_Header1 = SIS_PACKET12_HEADER1;
+ MyPacket.P12_Null1 = SIS_NIL_CMD;
+ MyPacket.P12_Null2 = SIS_NIL_CMD;
+ MyPacket.P12_YPitch = MyPacket.P12_UVPitch = srcPitch;
+ MyPacket.P12_DstAddr = dstbase;
+ MyPacket.P12_DstPitch = pSiS->scrnOffset;
+ MyPacket.P12_DstHeight = 0xffff;
+
+ MyPacket.P12_Command |= pPriv->AccelCmd |
+ SRCVIDEO |
+ PATFG |
+ pSiS->SiS310_AccelDepth |
+ YUV_CMD_YUV |
+ DSTVIDEO;
+
+ if(pPriv->vsync) {
+#ifdef SISMERGED
+ if(!pSiS->MergedFB) {
+#endif
+#ifdef SISDUALHEAD
+ if(pSiS->DualHeadMode) {
+ if(pSiS->SecondHead) {
+ MyPacket.P12_Command |= pPriv->VBlankTriggerCRT1;
+ } else {
+ MyPacket.P12_Command |= pPriv->VBlankTriggerCRT2;
+ }
+ } else {
+#endif
+ Bool IsSlaveMode = SiSBridgeIsInSlaveMode(pScrn);
+ if((pSiS->VBFlags & DISPTYPE_DISP2) && !IsSlaveMode)
+ MyPacket.P12_Command |= pPriv->VBlankTriggerCRT2;
+ else if((pSiS->VBFlags & DISPTYPE_DISP1) || IsSlaveMode)
+ MyPacket.P12_Command |= pPriv->VBlankTriggerCRT1;
+#ifdef SISDUALHEAD
+ }
+#endif
+#ifdef SISMERGED
+ }
+#endif
+ }
+
+ first = TRUE;
+ while(nbox--) {
+ left = pbox->x1;
+ if(left >= drw_x + xoffset + width) goto mycont;
+
+ right = pbox->x2;
+ if(right <= drw_x + xoffset) goto mycont;
+
+ top = pbox->y1;
+ if(top >= drw_y + yoffset + height) goto mycont;
+
+ bottom = pbox->y2;
+ if(bottom <= drw_y + yoffset) goto mycont;
+
+ if(left < (drw_x + xoffset)) left = drw_x + xoffset;
+ if(right > (drw_x + xoffset + width)) right = drw_x + xoffset + width;
+ if(top < (drw_y + yoffset)) top = drw_y + yoffset;
+ if(bottom > (drw_y + yoffset + height)) bottom = drw_y + yoffset + height;
+
+ MyPacket.P12_DstX = left;
+ MyPacket.P12_DstY = top;
+ MyPacket.P12_RectWidth = right - left;
+ MyPacket.P12_RectHeight = bottom - top;
+
+#ifdef SISMERGED
+ if((first) && (pSiS->MergedFB)) {
+ int scrwidth = ((SiSMergedDisplayModePtr)pSiS->CurrentLayout.mode->Private)->CRT2->HDisplay;
+ int scrheight = ((SiSMergedDisplayModePtr)pSiS->CurrentLayout.mode->Private)->CRT2->VDisplay;
+ if( (right < pSiS->CRT2pScrn->frameX0) ||
+ (left >= pSiS->CRT2pScrn->frameX0 + scrwidth) ||
+ (bottom < pSiS->CRT2pScrn->frameY0) ||
+ (top >= pSiS->CRT2pScrn->frameY0 + scrheight) ) {
+ MyPacket.P12_Command |= pPriv->VBlankTriggerCRT1;
+ } else {
+ MyPacket.P12_Command |= pPriv->VBlankTriggerCRT2;
+ }
+ }
+#endif
+
+ offsety = offsetuv = 0;
+ if(packed) {
+ if(pbox->y1 > drw_y + yoffset) {
+ offsetuv = (pbox->y1 - drw_y - yoffset) * srcPitch;
+ }
+ if(pbox->x1 > drw_x + xoffset) {
+ offsetuv += ((pbox->x1 - drw_x - xoffset) << 1);
+ if(offsetuv & 3) {
+#if 0 /* Paint over covering object - no */
+ if(MyPacket.P12_DstX > 0) {
+ offsetuv &= ~3;
+ MyPacket.P12_DstX--;
+ MyPacket.P12_RectWidth++;
+ } else {
+#endif
+ offsetuv = (offsetuv + 3) & ~3;
+ MyPacket.P12_DstX++;
+ MyPacket.P12_RectWidth--;
+#if 0
+ }
+#endif
+ }
+ }
+ } else {
+ if(pbox->y1 > drw_y + yoffset) {
+ offsety = (pbox->y1 - drw_y - yoffset) * srcPitch;
+ offsetuv = ((pbox->y1 - drw_y - yoffset) >> 1) * srcPitch;
+ }
+ if(pbox->x1 > drw_x + xoffset) {
+ offsety += (pbox->x1 - drw_x - xoffset);
+ offsetuv += (pbox->x1 - drw_x - xoffset);
+ if(offsetuv & 1) {
+ offsety++;
+ offsetuv++;
+ MyPacket.P12_DstX++;
+ MyPacket.P12_RectWidth--;
+ }
+ }
+ }
+
+ if(!MyPacket.P12_RectWidth) continue;
+
+ MyPacket.P12_YSrcAddr = pPriv->bufAddr[index][pPriv->currentBuf[index]] + offsety;
+ MyPacket.P12_UVSrcAddr = pPriv->bufAddr[index][pPriv->currentBuf[index]] + bytesize + offsetuv;
+ SISWriteBlitPacket(pSiS, (CARD32*)&MyPacket);
+ MyPacket.P12_Command &= ~(pPriv->VBlankTriggerCRT1 | pPriv->VBlankTriggerCRT2);
+ first = FALSE;
+mycont:
+ pbox++;
+ }
+
+#if 0
+ {
+ int debug = 0;
+ while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) { debug++; };
+ while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) { debug++; };
+ xf86DrvMsg(0, X_INFO, "vsync %d, debug %d\n", pPriv->vsync, debug);
+ }
+#endif
+
+ pPriv->currentBuf[index] ^= 1;
+
+ UpdateCurrentTime();
+ pPriv->freeTime[index] = currentTime.milliseconds + FREE_DELAY;
+ pPriv->videoStatus[index] = FREE_TIMER;
+
+ pSiS->VideoTimerCallback = SISVideoTimerCallback;
+
+ return Success;
}
+static int
+SISQueryImageAttributesBlit(
+ ScrnInfoPtr pScrn,
+ int id,
+ unsigned short *w, unsigned short *h,
+ int *pitches, int *offsets
+){
+ int pitchY, pitchUV;
+ int size, sizeY, sizeUV;
-/* Set MPEG Field Preset (yet unused) */
-static void
-set_mpegfield_preset(SISPtr pSiS, SISOverlayPtr pOverlay)
-{
- setvideoreg(pSiS,Index_MPEG_Y_Buf_Preset_Low, pOverlay->MPEG_Y & 0xFF);
- setvideoreg(pSiS,Index_MPEG_Y_Buf_Preset_Middle, (pOverlay->MPEG_Y>>8) & 0xFF);
+ if(*w > DummyEncodingBlit.width) *w = DummyEncodingBlit.width;
+ if(*h > DummyEncodingBlit.height) *h = DummyEncodingBlit.height;
- setvideoreg(pSiS,Index_MPEG_UV_Buf_Preset_Low, pOverlay->MPEG_UV & 0xFF);
- setvideoreg(pSiS,Index_MPEG_UV_Buf_Preset_Middle, (pOverlay->MPEG_UV>>8) & 0xFF);
+ switch(id) {
+ case PIXEL_FMT_YV12:
+ case PIXEL_FMT_I420:
+ *w = (*w + 7) & ~7;
+ *h = (*h + 1) & ~1;
+ pitchY = *w;
+ pitchUV = *w >> 1;
+ if(pitches) {
+ pitches[0] = pitchY;
+ pitches[1] = pitches[2] = pitchUV;
+ }
+ sizeY = pitchY * (*h);
+ sizeUV = pitchUV * ((*h) >> 1);
+ if(offsets) {
+ offsets[0] = 0;
+ offsets[1] = sizeY;
+ offsets[2] = sizeY + sizeUV;
+ }
+ size = sizeY + (sizeUV << 1);
+ break;
+ case PIXEL_FMT_NV12:
+ case PIXEL_FMT_NV21:
+ *w = (*w + 7) & ~7;
+ pitchY = *w;
+ pitchUV = *w;
+ if(pitches) {
+ pitches[0] = pitchY;
+ pitches[1] = pitchUV;
+ }
+ sizeY = pitchY * (*h);
+ sizeUV = pitchUV * ((*h) >> 1);
+ if(offsets) {
+ offsets[0] = 0;
+ offsets[1] = sizeY;
+ }
+ size = sizeY + (sizeUV << 1);
+ break;
+ case PIXEL_FMT_YUY2:
+ case PIXEL_FMT_UYVY:
+ case PIXEL_FMT_YVYU:
+ default:
+ *w = (*w + 1) & ~1;
+ pitchY = *w << 1;
+ if(pitches) pitches[0] = pitchY;
+ if(offsets) offsets[0] = 0;
+ size = pitchY * (*h);
+ break;
+ }
+
+ return size;
+}
- setvideoreg(pSiS,Index_MPEG_Y_UV_Buf_Preset_High,
- ((pOverlay->MPEG_Y>>16) & 0x0F) | ((pOverlay->MPEG_UV>>12) & 0xF0));
+static void
+SISQueryBestSizeBlit(
+ ScrnInfoPtr pScrn,
+ Bool motion,
+ short vid_w, short vid_h,
+ short drw_w, short drw_h,
+ unsigned int *p_w, unsigned int *p_h,
+ unsigned long index
+){
+ /* We cannot scale */
+ *p_w = vid_w;
+ *p_h = vid_h;
}
+#endif /* INCL_YUV */
+
+/*****************************************/
+/* TIMER CALLBACK */
+/*****************************************/
static void
-set_mpegfield_scale(SISPtr pSiS, SISOverlayPtr pOverlay)
+SISVideoTimerCallback(ScrnInfoPtr pScrn, Time now)
{
- /* Empty for now */
-}
+ SISPtr pSiS = SISPTR(pScrn);
+ SISPortPrivPtr pPriv = NULL;
+ SISBPortPrivPtr pPrivBlit = NULL;
+ unsigned char sridx, cridx;
+ Bool setcallback = FALSE;
-#endif /* ------------------------------------------------------------------- */
+ if(!pScrn->vtSema) return;
+ if(pSiS->adaptor) {
+ pPriv = GET_PORT_PRIVATE(pScrn);
+ if(!pPriv->videoStatus) pPriv = NULL;
+ }
+ if(pPriv) {
+ if(pPriv->videoStatus & TIMER_MASK) {
+ if(pPriv->videoStatus & OFF_TIMER) {
+ setcallback = TRUE;
+ if(pPriv->offTime < now) {
+ /* Turn off the overlay */
+ sridx = inSISREG(SISSR); cridx = inSISREG(SISCR);
+ close_overlay(pSiS, pPriv);
+ outSISREG(SISSR, sridx); outSISREG(SISCR, cridx);
+ pPriv->mustwait = 1;
+ pPriv->videoStatus = FREE_TIMER;
+ pPriv->freeTime = now + FREE_DELAY;
+ }
+ } else if(pPriv->videoStatus & FREE_TIMER) {
+ if(pPriv->freeTime < now) {
+ SISFreeOverlayMemory(pScrn);
+ pPriv->mustwait = 1;
+ pPriv->videoStatus = 0;
+ } else {
+ setcallback = TRUE;
+ }
+ }
+ }
+ }
+
+#ifdef INCL_YUV_BLIT_ADAPTOR
+ if(pSiS->blitadaptor) {
+ int i;
+ pPrivBlit = (SISBPortPrivPtr)(pSiS->blitPriv);
+ for(i = 0; i < NUM_BLIT_PORTS; i++) {
+ if(pPrivBlit->videoStatus[i] & FREE_TIMER) {
+ if(pPrivBlit->freeTime[i] < now) {
+ SISFreeBlitMemory(pScrn, i);
+ pPrivBlit->videoStatus[i] = 0;
+ } else {
+ setcallback = TRUE;
+ }
+ }
+ }
+ }
+#endif
+
+ pSiS->VideoTimerCallback = (setcallback) ? SISVideoTimerCallback : NULL;
+}
diff --git a/src/vgatypes.h b/src/vgatypes.h
index 634190b..b83e799 100644
--- a/src/vgatypes.h
+++ b/src/vgatypes.h
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/vgatypes.h,v 1.4 2004/07/26 22:40:56 twini Exp $ */
/*
* General type definitions for universal mode switching modules
*
@@ -34,7 +35,7 @@
* * 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
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -118,21 +119,17 @@ typedef IOADDRESS SISIOADDRESS;
#endif
#endif
-#ifndef LINUX_KERNEL /* For the linux kernel, this is defined in sisfb.h */
-#ifndef SIS_CHIP_TYPE
-typedef enum _SIS_CHIP_TYPE {
+enum _SIS_CHIP_TYPE {
SIS_VGALegacy = 0,
-#ifdef LINUX_XF86
SIS_530,
SIS_OLD,
-#endif
SIS_300,
SIS_630,
SIS_730,
SIS_540,
SIS_315H, /* SiS 310 */
SIS_315,
- SIS_315PRO, /* SiS 325 */
+ SIS_315PRO,
SIS_550,
SIS_650,
SIS_740,
@@ -141,29 +138,13 @@ typedef enum _SIS_CHIP_TYPE {
SIS_741,
SIS_660,
SIS_760,
+ SIS_761,
+ SIS_340,
MAX_SIS_CHIP
-} SIS_CHIP_TYPE;
-#endif
-#endif
-
-#ifndef SIS_VB_CHIP_TYPE
-typedef enum _SIS_VB_CHIP_TYPE {
- VB_CHIP_Legacy = 0,
- VB_CHIP_301,
- VB_CHIP_301B,
- VB_CHIP_301LV,
- VB_CHIP_302,
- VB_CHIP_302B,
- VB_CHIP_302LV,
- VB_CHIP_301C,
- VB_CHIP_302ELV,
- VB_CHIP_UNKNOWN, /* other video bridge or no video bridge */
- MAX_VB_CHIP
-} SIS_VB_CHIP_TYPE;
-#endif
+};
-#ifndef SIS_LCD_TYPE
-typedef enum _SIS_LCD_TYPE {
+#ifdef LINUX_KERNEL
+enum _SIS_LCD_TYPE {
LCD_INVALID = 0,
LCD_800x600,
LCD_1024x768,
@@ -173,29 +154,22 @@ typedef enum _SIS_LCD_TYPE {
LCD_1600x1200,
LCD_1920x1440,
LCD_2048x1536,
- LCD_320x480, /* FSTN, DSTN */
+ LCD_320x480, /* FSTN */
LCD_1400x1050,
LCD_1152x864,
LCD_1152x768,
LCD_1280x768,
LCD_1024x600,
- LCD_640x480_2, /* FSTN, DSTN */
- LCD_640x480_3, /* FSTN, DSTN */
+ LCD_640x480_2, /* DSTN */
+ LCD_640x480_3, /* DSTN */
LCD_848x480,
LCD_1280x800,
LCD_1680x1050,
LCD_1280x720,
LCD_CUSTOM,
LCD_UNKNOWN
-} SIS_LCD_TYPE;
-#endif
-
-#ifndef PSIS_DSReg
-typedef struct _SIS_DSReg
-{
- UCHAR jIdx;
- UCHAR jVal;
-} SIS_DSReg, *PSIS_DSReg;
+};
+typedef unsigned int SIS_LCD_TYPE;
#endif
#ifndef SIS_HW_INFO
@@ -219,51 +193,38 @@ struct _SIS_HW_INFO
ULONG ulVideoMemorySize; /* size, in bytes, of the memory on the board */
- SISIOADDRESS ulIOAddress; /* base I/O address of VGA ports (0x3B0) */
+ SISIOADDRESS ulIOAddress; /* base I/O address of VGA ports (0x3B0; relocated) */
UCHAR jChipType; /* Used to Identify SiS Graphics Chip */
- /* defined in the data structure type */
- /* "SIS_CHIP_TYPE" */
+ /* defined in the enum "SIS_CHIP_TYPE" (above or sisfb.h) */
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) */
-
BOOLEAN bIntegratedMMEnabled;/* supporting integration MM enable */
-
- BOOLEAN bSkipDramSizing; /* True: Skip video memory sizing. */
#ifdef LINUX_KERNEL
- PSIS_DSReg pSR; /* restore SR registers in initial function. */
- /* end data :(idx, val) = (FF, FF). */
- /* Note : restore SR registers if */
- /* bSkipDramSizing = TRUE */
-
- PSIS_DSReg pCR; /* restore CR registers in initial function. */
- /* end data :(idx, val) = (FF, FF) */
- /* Note : restore cR registers if */
- /* bSkipDramSizing = TRUE */
+ ULONG ulCRT2LCDType; /* defined in the data structure type */
+ /* "SIS_LCD_TYPE" */
#endif
};
#endif
-/* Addtional IOCTL for communication sisfb <> X driver */
+/* Addtional IOCTLs for communication sisfb <> X driver */
/* If changing this, sisfb.h must also be changed (for sisfb) */
#ifdef LINUX_XF86 /* We don't want the X driver to depend on the kernel source */
/* ioctl for identifying and giving some info (esp. memory heap start) */
-#define SISFB_GET_INFO 0x80046ef8 /* Wow, what a terrible hack... */
+#define SISFB_GET_INFO_SIZE 0x8004f300
+#define SISFB_GET_INFO 0x8000f301 /* Must be patched with result from ..._SIZE at D[29:16] */
+/* deprecated ioctl number (for older versions of sisfb) */
+#define SISFB_GET_INFO_OLD 0x80046ef8
+
+/* ioctls for tv parameters (position) */
+#define SISFB_SET_TVPOSOFFSET 0x4004f304
+
+/* lock sisfb from register access */
+#define SISFB_SET_LOCK 0x4004f306
/* Structure argument for SISFB_GET_INFO ioctl */
typedef struct _SISFB_INFO sisfb_info, *psisfb_info;
@@ -305,8 +266,10 @@ struct _SISFB_INFO {
CARD8 sisfb_haveemilcd;
CARD8 sisfb_lcdpdca;
+
+ CARD16 sisfb_tvxpos, sisfb_tvypos; /* Warning: Values + 32 ! */
- CARD8 reserved[212]; /* for future use */
+ CARD8 reserved[208]; /* for future use */
};
#endif
diff --git a/src/vstruct.h b/src/vstruct.h
index 262ec3f..8e5bcdb 100644
--- a/src/vstruct.h
+++ b/src/vstruct.h
@@ -1,4 +1,5 @@
/* $XFree86$ */
+/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/sis/vstruct.h,v 1.7 2004/08/20 18:57:06 kem Exp $ */
/*
* General structure definitions for universal mode switching modules
*
@@ -34,7 +35,7 @@
* * 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
+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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,
@@ -168,6 +169,7 @@ typedef struct _SiS_ExtStruct
UCHAR VB_ExtTVYFilterIndex;
UCHAR VB_ExtTVYFilterIndexROM661;
UCHAR REFindex;
+ CHAR ROMMODEIDX661;
} SiS_ExtStruct;
typedef struct _SiS_Ext2Struct
@@ -289,6 +291,7 @@ typedef struct _SiS_Private
#endif
BOOLEAN SiS_UseROM;
BOOLEAN SiS_ROMNew;
+ BOOLEAN SiS_NeedRomModeData;
BOOLEAN PanelSelfDetected;
int SiS_CHOverScan;
BOOLEAN SiS_CHSOverScan;
@@ -301,6 +304,7 @@ typedef struct _SiS_Private
BOOLEAN HaveEMILCD;
BOOLEAN OverruleEMI;
UCHAR EMI_30,EMI_31,EMI_32,EMI_33;
+ USHORT SiS_EMIOffset;
SHORT PDC, PDCA;
UCHAR SiS_MyCR63;
USHORT SiS_CRT1Mode;
@@ -417,8 +421,8 @@ typedef struct _SiS_Private
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_LCD1280x800_2Data;
const SiS_LCDDataStruct *SiS_LCD1280x960Data;
const SiS_LCDDataStruct *SiS_ExtLCD1280x1024Data;
const SiS_LCDDataStruct *SiS_St2LCD1280x1024Data;
@@ -660,6 +664,8 @@ typedef struct _SiS_Private
BOOLEAN CP_HaveCustomData;
int CP_PreferredX, CP_PreferredY, CP_PreferredIndex;
int CP_MaxX, CP_MaxY, CP_MaxClock;
+ UCHAR CP_PrefSR2B, CP_PrefSR2C;
+ USHORT CP_PrefClock;
BOOLEAN CP_Supports64048075;
int CP_HDisplay[7], CP_VDisplay[7]; /* For Custom LCD panel dimensions */
int CP_HTotal[7], CP_VTotal[7];