summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Winischhofer <thomas@winischhofer.net>2005-03-11 14:39:48 +0000
committerThomas Winischhofer <thomas@winischhofer.net>2005-03-11 14:39:48 +0000
commit2d51792a3cf3f4f87d596aba78f8dacc5b62254a (patch)
tree2deadf26f3a165e50657eb0bf6091480edb4dc2b
parent291fc2d3ae3112b8f5d8a3836446da17d496b58c (diff)
- MergedFB/Xinerama: Added support for non-rectangular layouts (no panning into dead areas, mouse restriced to accessible areas) - MergedFB/Xinerama: Added support for RandR. Current window managers are smart enough to update their Xinerama-info on RandR events. This practically allows switching from dual-head operation to single-head operation (by switching to a clone mode and simultaniously resizing the desktop) and vice versa. - MergedFB: Improved "physical alignment compensation" Offset by disallowing panning and mouse movements into dead areas. (However, RandR is disabled if that Offset is used.) - MergedFB: Made identically looking MetaModes work with RandR. (by supplying a fake rate.) - Added "Reflect" feature: Reflect screen in x, y or x+y direction (Uses shadow framebuffer; no accel, no Xv, no HWCursor.) - Added aspect ratio detection for analog (VGA) devices. Produces different default modes for 800x480, 1024x576, 1280x720, 1280x768 and 1280x800 depending on the aspect ratio. Options exist to overrule this for each output device. - Fixed FSTN support on SiS55x (for 320x240 xSTN panels) - Workaround for SiS76x memory access latency issues if no local framebuffer memory is present. Driver now allows only one video overlay and assumes a quite restricted memory bandwidth. This chip is really crippled. / If in hybrid mode, the driver only uses the LFB memory (required changes in the video memory layout) - Minor fix for machines with Trumpion Zurac LVDS scalers. - Fixed bug in SaveScreen() causing a sig 11 sometimes. - Added screen blanking for TV output - Added two widescreen modes for PAL/NTSC TV output - Numerous minor fixes and clean-ups. - Numerous whitespace cleanups. Sorry for the noise.
-rw-r--r--src/310vtbl.h327
-rw-r--r--src/init.c786
-rw-r--r--src/init.h188
-rw-r--r--src/init301.c2776
-rw-r--r--src/init301.h46
-rw-r--r--src/initdef.h76
-rw-r--r--src/sis.h139
-rw-r--r--src/sis310_accel.c437
-rw-r--r--src/sis310_accel.h380
-rw-r--r--src/sis6326_video.c488
-rw-r--r--src/sis_common.h14
-rw-r--r--src/sis_cursor.c271
-rw-r--r--src/sis_dac.c464
-rw-r--r--src/sis_dac.h52
-rw-r--r--src/sis_dga.c134
-rw-r--r--src/sis_dri.c328
-rw-r--r--src/sis_driver.c3998
-rw-r--r--src/sis_driver.h51
-rw-r--r--src/sis_memcpy.c11
-rw-r--r--src/sis_opt.c1446
-rw-r--r--src/sis_regs.h62
-rw-r--r--src/sis_setup.c530
-rw-r--r--src/sis_shadow.c163
-rw-r--r--src/sis_vb.c273
-rw-r--r--src/sis_vga.c822
-rw-r--r--src/sis_video.c925
-rw-r--r--src/vgatypes.h23
-rw-r--r--src/vstruct.h51
28 files changed, 8478 insertions, 6783 deletions
diff --git a/src/310vtbl.h b/src/310vtbl.h
index 2df8db3..194073f 100644
--- a/src/310vtbl.h
+++ b/src/310vtbl.h
@@ -79,10 +79,10 @@ static const SiS_ExtStruct SiS310_EModeIDTable[]=
{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 */
+ {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 */
+ {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 */
@@ -115,138 +115,142 @@ static const SiS_ExtStruct SiS310_EModeIDTable[]=
{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,0x46,-1}, /* 848x480 */
- {0x3b,0x6a3d,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x46,-1},
- {0x3e,0x6a7f,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x46,-1},
- {0x3f,0x6a1b,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x48,-1}, /* 856x480 */
- {0x42,0x6a3d,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x48,-1},
- {0x45,0x6a7f,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x48,-1},
- {0x48,0x6a3b,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x4a,-1}, /* 1360x768 */
- {0x4b,0x6a7d,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x4a,-1},
- {0x4e,0x6aff,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x4a,-1},
+ {0x26,0x0e3b,0x0000,SIS_RI_1400x1050,0x00,0x00,0x00,0x00,0x43, 9}, /* 1400x1050x8 */
+ {0x27,0x0e7d,0x0000,SIS_RI_1400x1050,0x00,0x00,0x00,0x00,0x43, 9}, /* 1400x1050x16 */
+ {0x28,0x0eff,0x0000,SIS_RI_1400x1050,0x00,0x00,0x00,0x00,0x43, 9}, /* 1400x1050x32*/
+ {0x29,0x4e1b,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x45,-1}, /* 1152x864 */
+ {0x2a,0x4e3d,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x45,-1},
+ {0x2b,0x4e7f,0x0000,SIS_RI_1152x864, 0x00,0x00,0x00,0x00,0x45,-1},
+ {0x39,0x6a1b,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x48,-1}, /* 848x480 */
+ {0x3b,0x6a3d,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x48,-1},
+ {0x3e,0x6a7f,0x0000,SIS_RI_848x480, 0x00,0x00,0x00,0x00,0x48,-1},
+ {0x3f,0x6a1b,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x4a,-1}, /* 856x480 */
+ {0x42,0x6a3d,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x4a,-1},
+ {0x45,0x6a7f,0x0000,SIS_RI_856x480, 0x00,0x00,0x00,0x00,0x4a,-1},
+ {0x48,0x6a3b,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x4c,-1}, /* 1360x768 */
+ {0x4b,0x6a7d,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x4c,-1},
+ {0x4e,0x6aff,0x0000,SIS_RI_1360x768, 0x00,0x00,0x00,0x00,0x4c,-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,0x4b,-1}, /* 768x576 */
- {0x60,0x6a1d,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4b,-1},
- {0x61,0x6a3f,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4b,-1},
- {0x14,0x0e3b,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4c, 7}, /* 1280x800 */
- {0x15,0x0e7d,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4c, 7},
- {0x16,0x0eff,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4c, 7},
- {0x17,0x0e3b,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x4d, 9}, /* 1680x1050 */
- {0x18,0x0e7d,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x4d, 9},
- {0x19,0x0eff,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x4d, 9},
- {0x2c,0x267b,0x0000,SIS_RI_1920x1080,0x00,0x00,0x00,0x00,0x4e,-1}, /* 1920x1080(i) */
- {0x2d,0x26fd,0x0000,SIS_RI_1920x1080,0x00,0x00,0x00,0x00,0x4e,-1},
- {0x73,0x27ff,0x0000,SIS_RI_1920x1080,0x00,0x00,0x00,0x00,0x4e,-1},
- {0x1d,0x6a1b,0x0000,SIS_RI_960x540, 0x00,0x00,0x00,0x00,0x4f,-1}, /* 960x540 */
- {0x1e,0x6a3d,0x0000,SIS_RI_960x540, 0x00,0x00,0x00,0x00,0x4f,-1},
- {0x1f,0x6a7f,0x0000,SIS_RI_960x540, 0x00,0x00,0x00,0x00,0x4f,-1},
- {0x20,0x6a1b,0x0000,SIS_RI_960x600, 0x00,0x00,0x00,0x00,0x50,-1}, /* 960x600 */
- {0x21,0x6a3d,0x0000,SIS_RI_960x600, 0x00,0x00,0x00,0x00,0x50,-1},
- {0x22,0x6a7f,0x0000,SIS_RI_960x600, 0x00,0x00,0x00,0x00,0x50,-1},
+ {0x5f,0x6a1b,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4d,-1}, /* 768x576 */
+ {0x60,0x6a1d,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4d,-1},
+ {0x61,0x6a3f,0x0000,SIS_RI_768x576, 0x00,0x00,0x06,0x06,0x4d,-1},
+ {0x14,0x0e3b,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4e, 7}, /* 1280x800 */
+ {0x15,0x0e7d,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4e, 7},
+ {0x16,0x0eff,0x0000,SIS_RI_1280x800, 0x00,0x00,0x00,0x00,0x4e, 7},
+ {0x17,0x0e3b,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x51, 9}, /* 1680x1050 */
+ {0x18,0x0e7d,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x51, 9},
+ {0x19,0x0eff,0x0000,SIS_RI_1680x1050,0x00,0x00,0x00,0x00,0x51, 9},
+ {0x2c,0x267b,0x0000,SIS_RI_1920x1080,0x00,0x00,0x00,0x00,0x52,-1}, /* 1920x1080(i) */
+ {0x2d,0x26fd,0x0000,SIS_RI_1920x1080,0x00,0x00,0x00,0x00,0x52,-1},
+ {0x73,0x27ff,0x0000,SIS_RI_1920x1080,0x00,0x00,0x00,0x00,0x52,-1},
+ {0x1d,0x6a1b,0x0000,SIS_RI_960x540, 0x00,0x00,0x00,0x00,0x53,-1}, /* 960x540 */
+ {0x1e,0x6a3d,0x0000,SIS_RI_960x540, 0x00,0x00,0x00,0x00,0x53,-1},
+ {0x1f,0x6a7f,0x0000,SIS_RI_960x540, 0x00,0x00,0x00,0x00,0x53,-1},
+ {0x20,0x6a1b,0x0000,SIS_RI_960x600, 0x00,0x00,0x00,0x00,0x54,-1}, /* 960x600 */
+ {0x21,0x6a3d,0x0000,SIS_RI_960x600, 0x00,0x00,0x00,0x00,0x54,-1},
+ {0x22,0x6a7f,0x0000,SIS_RI_960x600, 0x00,0x00,0x00,0x00,0x54,-1},
{0xff,0x0000,0x0000,0, 0x00,0x00,0x00,0x00,0x00,-1}
};
static const SiS_Ext2Struct SiS310_RefIndex[]=
{
- {0x085f,0x0d,0x03,0x05,0x05,0x6a, 800, 600, 0x40, 0x00, 0x00}, /* 0x0 */
- {0x0067,0x0e,0x04,0x05,0x05,0x6a, 800, 600, 0x40, 0x00, 0x00}, /* 0x1 */
- {0x0067,0x0f,0x08,0x48,0x05,0x6a, 800, 600, 0x40, 0x00, 0x00}, /* 0x2 */
- {0x0067,0x10,0x07,0x8b,0x05,0x6a, 800, 600, 0x40, 0x00, 0x00}, /* 0x3 */
- {0x0047,0x11,0x0a,0x00,0x05,0x6a, 800, 600, 0x40, 0x00, 0x00}, /* 0x4 */
- {0x0047,0x12,0x0d,0x00,0x05,0x6a, 800, 600, 0x40, 0x00, 0x00}, /* 0x5 */
- {0x0047,0x13,0x13,0x00,0x05,0x6a, 800, 600, 0x20, 0x00, 0x00}, /* 0x6 */
- {0x0107,0x14,0x1c,0x00,0x05,0x6a, 800, 600, 0x20, 0x00, 0x00}, /* 0x7 */
- {0xc85f,0x05,0x00,0x04,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00}, /* 0x8 */
- {0xc067,0x06,0x02,0x04,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00}, /* 0x9 */
- {0xc067,0x07,0x02,0x47,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00}, /* 0xa */
- {0xc067,0x08,0x03,0x8a,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00}, /* 0xb */
- {0xc047,0x09,0x05,0x00,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00}, /* 0xc */
- {0xc047,0x0a,0x09,0x00,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00}, /* 0xd */
- {0xc047,0x0b,0x0e,0x00,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00}, /* 0xe */
- {0xc047,0x0c,0x15,0x00,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00}, /* 0xf */
- {0x487f,0x04,0x00,0x00,0x00,0x2f, 640, 400, 0x30, 0x55, 0x6e}, /* 0x10 */
- {0xc06f,0x3c,0x01,0x06,0x13,0x31, 720, 480, 0x30, 0x00, 0x00}, /* 0x11 */
- {0x006f,0x3d,0x6f,0x06,0x14,0x32, 720, 576, 0x30, 0x00, 0x00}, /* 0x12 (6f was 03) */
- {0x0087,0x15,0x06,0x00,0x06,0x37,1024, 768, 0x30, 0x00, 0x00}, /* 0x13 */
- {0xc877,0x16,0x0b,0x06,0x06,0x37,1024, 768, 0x20, 0x00, 0x00}, /* 0x14 */
- {0xc067,0x17,0x0f,0x49,0x06,0x37,1024, 768, 0x20, 0x00, 0x00}, /* 0x15 */
- {0x0067,0x18,0x11,0x00,0x06,0x37,1024, 768, 0x20, 0x00, 0x00}, /* 0x16 */
- {0x0047,0x19,0x16,0x8c,0x06,0x37,1024, 768, 0x20, 0x00, 0x00}, /* 0x17 */
- {0x0107,0x1a,0x1b,0x00,0x06,0x37,1024, 768, 0x10, 0x00, 0x00}, /* 0x18 */
- {0x0107,0x1b,0x1f,0x00,0x06,0x37,1024, 768, 0x10, 0x00, 0x00}, /* 0x19 */
- {0x0087,0x1c,0x11,0x00,0x07,0x3a,1280,1024, 0x30, 0x00, 0x00}, /* 0x1a */
- {0x0137,0x1d,0x19,0x07,0x07,0x3a,1280,1024, 0x00, 0x00, 0x00}, /* 0x1b */
- {0x0107,0x1e,0x1e,0x00,0x07,0x3a,1280,1024, 0x00, 0x00, 0x00}, /* 0x1c */
- {0x0207,0x1f,0x20,0x00,0x07,0x3a,1280,1024, 0x00, 0x00, 0x00}, /* 0x1d */
- {0x0227,0x20,0x21,0x09,0x09,0x3c,1600,1200, 0x00, 0x00, 0x00}, /* 0x1e */
- {0x0407,0x21,0x22,0x00,0x09,0x3c,1600,1200, 0x00, 0x00, 0x00}, /* 0x1f */
- {0x0407,0x22,0x23,0x00,0x09,0x3c,1600,1200, 0x00, 0x00, 0x00}, /* 0x20 */
- {0x0407,0x23,0x25,0x00,0x09,0x3c,1600,1200, 0x00, 0x00, 0x00}, /* 0x21 */
- {0x0007,0x24,0x26,0x00,0x09,0x3c,1600,1200, 0x00, 0x00, 0x00}, /* 0x22 */
- {0x0007,0x25,0x2c,0x00,0x09,0x3c,1600,1200, 0x00, 0x00, 0x00}, /* 0x23 */
- {0x0007,0x26,0x34,0x00,0x09,0x3c,1600,1200, 0x00, 0x00, 0x00}, /* 0x24 */
- {0x407f,0x00,0x00,0x00,0x00,0x40, 320, 200, 0x30, 0x56, 0x4e}, /* 0x25 */
- {0xc07f,0x01,0x00,0x04,0x04,0x50, 320, 240, 0x30, 0x00, 0x00}, /* 0x26 */
- {0x007f,0x02,0x04,0x05,0x05,0x51, 400, 300, 0x30, 0x00, 0x00}, /* 0x27 */
- {0xc077,0x03,0x0b,0x06,0x06,0x52, 512, 384, 0x30, 0x00, 0x00}, /* 0x28 */
- {0x8007,0x27,0x27,0x00,0x00,0x68,1920,1440, 0x00, 0x00, 0x00}, /* 0x29 */
- {0x4007,0x28,0x29,0x00,0x00,0x68,1920,1440, 0x00, 0x00, 0x00}, /* 0x2a */
- {0x4007,0x29,0x2e,0x00,0x00,0x68,1920,1440, 0x00, 0x00, 0x00}, /* 0x2b */
- {0x4007,0x2a,0x30,0x00,0x00,0x68,1920,1440, 0x00, 0x00, 0x00}, /* 0x2c */
- {0x4007,0x2b,0x35,0x00,0x00,0x68,1920,1440, 0x00, 0x00, 0x00}, /* 0x2d */
- {0x4005,0x2c,0x39,0x00,0x00,0x68,1920,1440, 0x00, 0x00, 0x00}, /* 0x2e */
- {0x4007,0x2d,0x2b,0x00,0x00,0x6c,2048,1536, 0x00, 0x00, 0x00}, /* 0x2f */
- {0x4007,0x2e,0x31,0x00,0x00,0x6c,2048,1536, 0x00, 0x00, 0x00}, /* 0x30 */
- {0x4007,0x2f,0x33,0x00,0x00,0x6c,2048,1536, 0x00, 0x00, 0x00}, /* 0x31 */
- {0x4007,0x30,0x37,0x00,0x00,0x6c,2048,1536, 0x00, 0x00, 0x00}, /* 0x32 */
- {0x4005,0x31,0x38,0x00,0x00,0x6c,2048,1536, 0x00, 0x00, 0x00}, /* 0x33 */
- {0x0077,0x32,0x40,0x08,0x18,0x70, 800, 480, 0x30, 0x00, 0x00}, /* 0x34 */
- {0x0047,0x33,0x07,0x08,0x18,0x70, 800, 480, 0x30, 0x00, 0x00}, /* 0x35 */
- {0x0047,0x34,0x0a,0x08,0x18,0x70, 800, 480, 0x30, 0x00, 0x00}, /* 0x36 */
- {0x0077,0x35,0x0b,0x09,0x19,0x71,1024, 576, 0x30, 0x00, 0x00}, /* 0x37 */
- {0x0047,0x36,0x11,0x09,0x19,0x71,1024, 576, 0x30, 0x00, 0x00}, /* 0x38 */
- {0x0047,0x37,0x16,0x09,0x19,0x71,1024, 576, 0x30, 0x00, 0x00}, /* 0x39 */
- {0x1137,0x38,0x19,0x0a,0x0c,0x75,1280, 720, 0x30, 0x00, 0x00}, /* 0x3a */
- {0x1107,0x39,0x1e,0x0a,0x0c,0x75,1280, 720, 0x30, 0x00, 0x00}, /* 0x3b */
- {0x1307,0x3a,0x20,0x0a,0x0c,0x75,1280, 720, 0x30, 0x00, 0x00}, /* 0x3c */
- {0x0127,0x3b,0x19,0x08,0x0a,0x7c,1280, 960, 0x30, 0x00, 0x00}, /* 0x3d */
- {0x0227,0x4c,0x59,0x08,0x0a,0x7c,1280, 960, 0x20, 0x00, 0x00}, /* 0x3e */
- {0xc07f,0x4e,0x00,0x06,0x04,0x5a, 320, 240, 0x30, 0x00, 0x00}, /* 0x3f */ /* FSTN 320x240 */
- {0x0077,0x42,0x5b,0x08,0x11,0x23,1280, 768, 0x30, 0x00, 0x00}, /* 0x40 */ /* 0x5b was 0x12 */
- {0x0127,0x43,0x4d,0x08,0x0b,0x26,1400,1050, 0x30, 0x00, 0x00}, /* 0x41 */
- {0x0207,0x4b,0x5a,0x08,0x0b,0x26,1400,1050, 0x30, 0x00, 0x00}, /* 0x42 1400x1050-75Hz */
- {0x0127,0x54,0x6d,0x00,0x1a,0x29,1152, 864, 0x30, 0x00, 0x00}, /* 0x43 1152x864-60Hz */
- {0x0127,0x44,0x19,0x00,0x1a,0x29,1152, 864, 0x30, 0x00, 0x00}, /* 0x44 1152x864-75Hz */
- {0x0127,0x4a,0x1e,0x00,0x1a,0x29,1152, 864, 0x30, 0x00, 0x00}, /* 0x45 1152x864-85Hz */
- {0x0087,0x45,0x57,0x00,0x16,0x39, 848, 480, 0x30, 0x00, 0x00}, /* 0x46 848x480-38Hzi */
- {0xc067,0x46,0x55,0x0b,0x16,0x39, 848, 480, 0x30, 0x00, 0x00}, /* 0x47 848x480-60Hz */
- {0x0087,0x47,0x57,0x00,0x17,0x3f, 856, 480, 0x30, 0x00, 0x00}, /* 0x48 856x480-38Hzi */
- {0xc067,0x48,0x57,0x00,0x17,0x3f, 856, 480, 0x30, 0x00, 0x00}, /* 0x49 856x480-60Hz */
- {0x0067,0x49,0x58,0x0c,0x1b,0x48,1360, 768, 0x30, 0x00, 0x00}, /* 0x4a 1360x768-60Hz */
- {0x006f,0x4d,0x71,0x06,0x15,0x5f, 768, 576, 0x30, 0x00, 0x00}, /* 0x4b 768x576-56Hz */
- {0x0067,0x4f,0x5c,0x08,0x0d,0x14,1280, 800, 0x30, 0x00, 0x00}, /* 0x4c 1280x800-60Hz */
- {0x0067,0x50,0x5d,0x0c,0x0e,0x17,1680,1050, 0x30, 0x00, 0x00}, /* 0x4d 1680x1050-60Hz */
- {0x0087,0x51,0x69,0x00,0x00,0x2c,1920,1080, 0x30, 0x00, 0x00}, /* 0x4e 1920x1080 60Hzi */
- {0x0067,0x52,0x6a,0x00,0x1c,0x1d, 960, 540, 0x30, 0x00, 0x00}, /* 0x4f 960x540 60Hz */
- {0x0077,0x53,0x6b,0x0b,0x1d,0x20, 960, 600, 0x30, 0x00, 0x00}, /* 0x50 960x600 60Hz */
- {0xffff,0x00,0x00,0x00,0x00,0x00, 0, 0, 0, 0x00, 0x00}
+ {0x085f,0x0d,0x03,0x05,0x05,0x6a, 800, 600, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x0 */
+ {0x0067,0x0e,0x04,0x05,0x05,0x6a, 800, 600, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x1 */
+ {0x0067,0x0f,0x08,0x48,0x05,0x6a, 800, 600, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x2 */
+ {0x0067,0x10,0x07,0x8b,0x05,0x6a, 800, 600, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x3 */
+ {0x0047,0x11,0x0a,0x00,0x05,0x6a, 800, 600, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x4 */
+ {0x0047,0x12,0x0d,0x00,0x05,0x6a, 800, 600, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x5 */
+ {0x0047,0x13,0x13,0x00,0x05,0x6a, 800, 600, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x6 */
+ {0x0107,0x14,0x1c,0x00,0x05,0x6a, 800, 600, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x7 */
+ {0xc85f,0x05,0x00,0x04,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x8 */
+ {0xc067,0x06,0x02,0x04,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x9 */
+ {0xc067,0x07,0x02,0x47,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0xa */
+ {0xc067,0x08,0x03,0x8a,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0xb */
+ {0xc047,0x09,0x05,0x00,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0xc */
+ {0xc047,0x0a,0x09,0x00,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0xd */
+ {0xc047,0x0b,0x0e,0x00,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0xe */
+ {0xc047,0x0c,0x15,0x00,0x04,0x2e, 640, 480, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0xf */
+ {0x487f,0x04,0x00,0x00,0x00,0x2f, 640, 400, 0x30, 0x55, 0x6e, 0x00, 0x00, 0x00, 0x00}, /* 0x10 */
+ {0xc06f,0x3c,0x01,0x06,0x13,0x31, 720, 480, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x11 */
+ {0x006f,0x3d,0x6f,0x06,0x14,0x32, 720, 576, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x12 (6f was 03) */
+ {0x0087,0x15,0x06,0x00,0x06,0x37,1024, 768, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x13 */
+ {0xc877,0x16,0x0b,0x06,0x06,0x37,1024, 768, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x14 */
+ {0xc067,0x17,0x0f,0x49,0x06,0x37,1024, 768, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x15 */
+ {0x0067,0x18,0x11,0x00,0x06,0x37,1024, 768, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x16 */
+ {0x0047,0x19,0x16,0x8c,0x06,0x37,1024, 768, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x17 */
+ {0x0107,0x1a,0x1b,0x00,0x06,0x37,1024, 768, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x18 */
+ {0x0107,0x1b,0x1f,0x00,0x06,0x37,1024, 768, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x19 */
+ {0x0087,0x1c,0x11,0x00,0x07,0x3a,1280,1024, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x1a */
+ {0x0137,0x1d,0x19,0x07,0x07,0x3a,1280,1024, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x1b */
+ {0x0107,0x1e,0x1e,0x00,0x07,0x3a,1280,1024, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x1c */
+ {0x0207,0x1f,0x20,0x00,0x07,0x3a,1280,1024, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x1d */
+ {0x0227,0x20,0x21,0x09,0x09,0x3c,1600,1200, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x1e */
+ {0x0407,0x21,0x22,0x00,0x09,0x3c,1600,1200, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x1f */
+ {0x0407,0x22,0x23,0x00,0x09,0x3c,1600,1200, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x20 */
+ {0x0407,0x23,0x25,0x00,0x09,0x3c,1600,1200, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x21 */
+ {0x0007,0x24,0x26,0x00,0x09,0x3c,1600,1200, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x22 */
+ {0x0007,0x25,0x2c,0x00,0x09,0x3c,1600,1200, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x23 */
+ {0x0007,0x26,0x34,0x00,0x09,0x3c,1600,1200, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x24 */
+ {0x407f,0x00,0x00,0x00,0x00,0x40, 320, 200, 0x30, 0x56, 0x4e, 0x00, 0x00, 0x00, 0x00}, /* 0x25 */
+ {0xc07f,0x01,0x00,0x04,0x04,0x50, 320, 240, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x26 */
+ {0x007f,0x02,0x04,0x05,0x05,0x51, 400, 300, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x27 */
+ {0xc077,0x03,0x0b,0x06,0x06,0x52, 512, 384, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x28 */
+ {0x8007,0x27,0x27,0x00,0x00,0x68,1920,1440, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x29 */
+ {0x4007,0x28,0x29,0x00,0x00,0x68,1920,1440, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x2a */
+ {0x4007,0x29,0x2e,0x00,0x00,0x68,1920,1440, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x2b */
+ {0x4007,0x2a,0x30,0x00,0x00,0x68,1920,1440, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x2c */
+ {0x4007,0x2b,0x35,0x00,0x00,0x68,1920,1440, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x2d */
+ {0x4005,0x2c,0x39,0x00,0x00,0x68,1920,1440, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x2e */
+ {0x4007,0x2d,0x2b,0x00,0x00,0x6c,2048,1536, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x2f */
+ {0x4007,0x2e,0x31,0x00,0x00,0x6c,2048,1536, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x30 */
+ {0x4007,0x2f,0x33,0x00,0x00,0x6c,2048,1536, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x31 */
+ {0x4007,0x30,0x37,0x00,0x00,0x6c,2048,1536, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x32 */
+ {0x4005,0x31,0x38,0x00,0x00,0x6c,2048,1536, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x33 */
+ {0x2077,0x32,0x40,0x08,0x18,0x70, 800, 480, 0x30, 0x00, 0x00, 0x32, 0x40, 0x5e, 0x73}, /* 0x34 */
+ {0x2047,0x33,0x07,0x08,0x18,0x70, 800, 480, 0x30, 0x00, 0x00, 0x33, 0x07, 0xff, 0xff}, /* 0x35 */
+ {0x2047,0x34,0x0a,0x08,0x18,0x70, 800, 480, 0x30, 0x00, 0x00, 0x34, 0x0a, 0xff, 0xff}, /* 0x36 */
+ {0x2077,0x35,0x0b,0x09,0x19,0x71,1024, 576, 0x30, 0x00, 0x00, 0x35, 0x0b, 0x5f, 0x74}, /* 0x37 */
+ {0x2047,0x36,0x11,0x09,0x19,0x71,1024, 576, 0x30, 0x00, 0x00, 0x36, 0x11, 0xff, 0xff}, /* 0x38 */
+ {0x2047,0x37,0x16,0x09,0x19,0x71,1024, 576, 0x30, 0x00, 0x00, 0x37, 0x16, 0xff, 0xff}, /* 0x39 */
+ {0x3137,0x38,0x19,0x0a,0x0c,0x75,1280, 720, 0x30, 0x00, 0x00, 0x38, 0x19, 0x60, 0x75}, /* 0x3a */
+ {0x3107,0x39,0x1e,0x0a,0x0c,0x75,1280, 720, 0x30, 0x00, 0x00, 0x39, 0x1e, 0xff, 0xff}, /* 0x3b */
+ {0x3307,0x3a,0x20,0x0a,0x0c,0x75,1280, 720, 0x30, 0x00, 0x00, 0x3a, 0x20, 0xff, 0xff}, /* 0x3c */
+ {0x0127,0x3b,0x19,0x08,0x0a,0x7c,1280, 960, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x3d */
+ {0x0227,0x4c,0x59,0x08,0x0a,0x7c,1280, 960, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x3e */
+ {0xc07f,0x4e,0x00,0x06,0x04,0x5a, 320, 240, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x3f */ /* FSTN 320x240 */
+ {0x2077,0x42,0x5b,0x08,0x11,0x23,1280, 768, 0x30, 0x00, 0x00, 0x58, 0x19, 0x42, 0x5b}, /* 0x40 */ /* 0x5b was 0x12 */
+ {0x2077,0x42,0x5b,0x08,0x11,0x23,1280, 768, 0x30, 0x00, 0x00, 0x59, 0x1e, 0xff, 0xff}, /* 0x41 */
+ {0x2077,0x42,0x5b,0x08,0x11,0x23,1280, 768, 0x30, 0x00, 0x00, 0x5a, 0x20, 0xff, 0xff}, /* 0x42 */
+ {0x0127,0x43,0x4d,0x08,0x0b,0x26,1400,1050, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x43 */
+ {0x0207,0x4b,0x5a,0x08,0x0b,0x26,1400,1050, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x44 1400x1050-75Hz */
+ {0x0127,0x54,0x6d,0x00,0x1a,0x29,1152, 864, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x45 1152x864-60Hz */
+ {0x0127,0x44,0x19,0x00,0x1a,0x29,1152, 864, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x46 1152x864-75Hz */
+ {0x0127,0x4a,0x1e,0x00,0x1a,0x29,1152, 864, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x47 1152x864-85Hz */
+ {0x0087,0x45,0x57,0x00,0x16,0x39, 848, 480, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x48 848x480-38Hzi */
+ {0xc067,0x46,0x55,0x0b,0x16,0x39, 848, 480, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x49 848x480-60Hz */
+ {0x0087,0x47,0x57,0x00,0x17,0x3f, 856, 480, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x4a 856x480-38Hzi */
+ {0xc067,0x48,0x57,0x00,0x17,0x3f, 856, 480, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x4b 856x480-60Hz */
+ {0x0067,0x49,0x58,0x0c,0x1b,0x48,1360, 768, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x4c 1360x768-60Hz */
+ {0x006f,0x4d,0x71,0x06,0x15,0x5f, 768, 576, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x4d 768x576-56Hz */
+ {0x2067,0x4f,0x5c,0x08,0x0d,0x14,1280, 800, 0x30, 0x00, 0x00, 0x5b, 0x19, 0x4f, 0x5c}, /* 0x4e 1280x800-60Hz */
+ {0x2067,0x4f,0x5c,0x08,0x0d,0x14,1280, 800, 0x30, 0x00, 0x00, 0x5c, 0x1e, 0xff, 0xff}, /* 0x4f 1280x800-75Hz */
+ {0x2067,0x4f,0x5c,0x08,0x0d,0x14,1280, 800, 0x30, 0x00, 0x00, 0x5d, 0x20, 0xff, 0xff}, /* 0x50 1280x800-85Hz */
+ {0x0067,0x50,0x5d,0x0c,0x0e,0x17,1680,1050, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x51 1680x1050-60Hz */
+ {0x0087,0x51,0x69,0x00,0x00,0x2c,1920,1080, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x52 1920x1080 60Hzi */
+ {0x0067,0x52,0x6a,0x00,0x1c,0x1d, 960, 540, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x53 960x540 60Hz */
+ {0x0077,0x53,0x6b,0x0b,0x1d,0x20, 960, 600, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* 0x54 960x600 60Hz */
+ {0xffff,0x00,0x00,0x00,0x00,0x00, 0, 0, 0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
};
#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 */
+ USHORT Ext_VESAID; /* corresponding VESA ID in new ROM */
} SiS_EModeIDTable661[] = {
- { 0x6a, 0x00, 0x0102 },
+ { 0x6a, 0x00, 0x0102 },
{ 0x1d, 0x20, 0x0000 },
{ 0x1e, 0x21, 0x0000 },
{ 0x1f, 0x22, 0x0000 },
@@ -331,7 +335,7 @@ static const SiS_CRT1TableStruct SiS310_CRT1Table[]=
{{0x5f,0x4f,0x4f,0x83,0x55,0x81,0x0b,0x3e, /* 0x05 - corrected 640x480-60 */
0xe9,0x8b,0xdf,0xe8,0x0c,0x00,0x00,0x05,
0x00}},
-#if 0
+#if 0
{{0x63,0x4f,0x50,0x86,0x56,0x9b,0x06,0x3e,
0xe8,0x8b,0xdf,0xe7,0xff,0x10,0x00,0x01,
0x00}}, /* 0x6 */
@@ -495,18 +499,18 @@ static const SiS_CRT1TableStruct SiS310_CRT1Table[]=
{{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0x2e,0xd4,
0x7d,0x81,0xcf,0xcf,0x2f,0x21,0x00,0x07,
0x01}}, /* 0x3a */
-#if 0
+#if 0
{{0xdc,0x9f,0x9f,0x00,0xab,0x19,0xe6,0xef, /* 1280x960 - invalid */
0xc0,0xc3,0xbf,0xbf,0xe7,0x10,0x00,0x07,
0x01}}, /* 0x3b */
-#endif
+#endif
{{0xdc,0x9f,0x9f,0x80,0xaf,0x9d,0xe6,0xff, /* 1280x960-60 - corrected */
0xc0,0x83,0xbf,0xbf,0xe7,0x10,0x00,0x07,
- 0x01}}, /* 0x3b */
+ 0x01}}, /* 0x3b */
{{0x6b,0x59,0x59,0x8f,0x5e,0x8c,0x0b,0x3e,
0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x05,
0x00}}, /* 0x3c */
-#if 0
+#if 0
{{0x7b,0x59,0x63,0x9f,0x6a,0x93,0x6f,0xf0,
0x58,0x8a,0x3f,0x57,0x70,0x20,0x00,0x05,
0x01}}, /* 0x3d */
@@ -559,16 +563,16 @@ static const SiS_CRT1TableStruct SiS310_CRT1Table[]=
{{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0xf1,0xff, /* 1280x960-85 */
0xc0,0x83,0xbf,0xbf,0xf2,0x10,0x00,0x07,
0x01}}, /* 0x4c */
-#if 0
+#if 0
{{0x7b,0x5f,0x63,0x9f,0x6a,0x93,0x6f,0xf0, /* 768x576 */
0x58,0x8a,0x3f,0x57,0x70,0x20,0x00,0x05,
0x01}}, /* 0x4d */
-#endif
- {{0x75,0x5f,0x5f,0x99,0x66,0x90,0x53,0xf0, /* 768x576, corrected to 60Hz */
+#endif
+ {{0x75,0x5f,0x5f,0x99,0x66,0x90,0x53,0xf0, /* 768x576, corrected to 60Hz */
0x41,0x84,0x3f,0x3f,0x54,0x00,0x00,0x05,
0x41}},
- {{0x2d,0x27,0x28,0x90,0x2c,0x80,0x0b,0x3e, /* FSTN 320x480, TEMP - possibly invalid */
- 0xe9,0x8b,0xdf,0xe7,0x04,0x00,0x00,0x00,
+ {{0x5f,0x27,0x4f,0x83,0x55,0x81,0x0b,0x3e, /* FSTN 320x240 (working) */
+ 0xe9,0x8b,0xdf,0xe8,0x0c,0x00,0x00,0x05,
0x00}}, /* 0x4e */
{{0xcd,0x9f,0x9f,0x91,0xab,0x1c,0x3a,0xff, /* 1280x800-60 */
0x20,0x83,0x1f,0x1f,0x3b,0x10,0x00,0x07,
@@ -596,7 +600,34 @@ static const SiS_CRT1TableStruct SiS310_CRT1Table[]=
0x00}}, /* 0x56 */
{{0xd7,0xc7,0xc7,0x9b,0xd1,0x15,0xd1,0x10, /* 1600x1200 for LCDA */
0xb2,0x86,0xaf,0xb0,0xd2,0x2f,0x00,0x03,
- 0x00}} /* 0x57 */
+ 0x00}}, /* 0x57 */
+ {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0xdc, /* 1280x768 (1280x1024) 60 Hz */
+ 0x92,0x86,0xff,0x91,0x29,0x21,0x00,0x07,
+ 0x01}}, /* 0x58 */
+ {{0xce,0x9f,0x9f,0x92,0xa5,0x17,0x28,0xdc, /* 1280x768 (1280x1024) 75 Hz */
+ 0x92,0x86,0xff,0x91,0x29,0x21,0x00,0x07,
+ 0x01}}, /* 0x59 */
+ {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0x2e,0xdc, /* 1280x768 (1280x1024) 85 Hz */
+ 0x95,0x89,0xff,0x94,0x2f,0x21,0x00,0x07,
+ 0x01}}, /* 0x5a */
+ {{0xce,0x9f,0x9f,0x92,0xa9,0x17,0x28,0xde, /* 1280x800 (1280x1024) 60 Hz */
+ 0xa2,0x86,0x1f,0xa1,0x29,0x01,0x00,0x07,
+ 0x01}}, /* 0x5b */
+ {{0xce,0x9f,0x9f,0x92,0xa5,0x17,0x28,0xde, /* 1280x800 (1280x1024) 75 Hz */
+ 0xa2,0x86,0x1f,0xa1,0x29,0x01,0x00,0x07,
+ 0x01}}, /* 0x5c */
+ {{0xd3,0x9f,0x9f,0x97,0xab,0x1f,0x2e,0xde, /* 1280x800 (1280x1024) 85 Hz */
+ 0xa5,0x89,0x1f,0xa4,0x2f,0x01,0x00,0x07,
+ 0x01}}, /* 0x5d */
+ {{0x7f,0x63,0x63,0x83,0x6d,0x1d,0x0b,0x3e, /* 800x480 (wide) 60 Hz */
+ 0xe9,0x8b,0xdf,0xe8,0x0c,0x00,0x00,0x06,
+ 0x00}}, /* 0x5e */
+ {{0xa0,0x7f,0x7f,0x84,0x85,0x97,0x52,0xf0, /* 1024x576 (wide) 60 Hz */
+ 0x41,0x85,0x3f,0x40,0x53,0x00,0x00,0x02,
+ 0x01}}, /* 0x5f */
+ {{0xc9,0x9f,0x9f,0x8d,0xb0,0x15,0xec,0xf0, /* 1280x720 (wide) 60 Hz */
+ 0xd4,0x89,0xcf,0xd3,0xed,0x20,0x00,0x07,
+ 0x01}} /* 0x60 */
};
static const SiS_MCLKDataStruct SiS310_MCLKData_0_315[] =
@@ -800,7 +831,7 @@ static SiS_VCLKDataStruct SiS310_VCLKData[]=
{ 0x30,0x23, 88}, /* 0x58 1360x768-62 (is 60Hz!) */
{ 0x52,0x07,149}, /* 0x59 1280x960-85 */
{ 0x56,0x07,156}, /* 0x5a 1400x1050-75 */
- { 0x70,0x29, 81}, /* 0x5b 1280x768 LCD */
+ { 0x70,0x29, 81}, /* 0x5b 1280x768 LCD */
{ 0x45,0x25, 83}, /* 0x5c 1280x800 */
{ 0x70,0x0a,147}, /* 0x5d 1680x1050 */
{ 0x70,0x24,162}, /* 0x5e 1600x1200 */
@@ -822,8 +853,11 @@ static SiS_VCLKDataStruct SiS310_VCLKData[]=
{ 0x15,0xe1, 20}, /* 0x6e 640x400@60 (fake, not actually used) */
{ 0x5f,0xc6, 33}, /* 0x6f 720x576@60 */
{ 0x37,0x5a, 10}, /* 0x70 320x200@60 (fake, not actually used) */
- { 0x2b,0xc2, 35}, /* 0x71 768@576@60 */
- { 0xa8,0x42,131} /* 0x72 1600x1200@60 for LCDA */
+ { 0x2b,0xc2, 35}, /* 0x71 768x576@60 */
+ { 0xa8,0x42,131}, /* 0x72 1600x1200@60 for LCDA */
+ { 0x1b,0xc1, 34}, /* 0x73 800x480 60Hz (wide) */
+ { 0x41,0x64, 48}, /* 0x74 1024x576 60Hz (wide) */
+ { 0x52,0x27, 75} /* 0x75 1280x720 60Hz (wide) */
};
static SiS_VBVCLKDataStruct SiS310_VBVCLKData[]=
@@ -925,7 +959,7 @@ 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 (TMDS) */
+ { 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 */
@@ -948,7 +982,10 @@ static SiS_VBVCLKDataStruct SiS310_VBVCLKData[]=
{ 0x5f,0xc6, 33}, /* 0x6f 720x576@60 */
{ 0x37,0x5a, 10}, /* 0x70 320x200@60 (fake, not actually used) */
{ 0x2b,0xc2, 35}, /* 0x71 768@576@60 */
- { 0xa8,0x42,131} /* 0x72 1600x1200@60 for LCDA */
+ { 0xa8,0x42,131}, /* 0x72 1600x1200@60 for LCDA */
+ { 0x1b,0xc1, 34}, /* 0x73 800x480 60Hz (wide) */
+ { 0x41,0x64, 48}, /* 0x74 1024x576 60Hz (wide) */
+ { 0x52,0x27, 75} /* 0x75 1280x720 60Hz (wide) */
};
static const DRAM4Type SiS310_SR15[8] = {
@@ -958,7 +995,7 @@ static const DRAM4Type SiS310_SR15[8] = {
{0xa9,0xa9,0xac,0xac},
{0xa0,0xa0,0xa0,0xa8},
{0x00,0x00,0x02,0x02},
- {0x30,0x30,0x40,0x40},
+ {0x30,0x30,0x40,0x40},
{0x00,0xa5,0xfb,0xf6}
};
@@ -991,14 +1028,14 @@ static UCHAR SiS310_CRT2Data_4_10 = 0x80;
static const USHORT SiS310_RGBSenseData = 0xd1;
static const USHORT SiS310_VideoSenseData = 0xb9;
static const USHORT SiS310_YCSenseData = 0xb3;
-static const USHORT SiS310_RGBSenseData2 = 0x0190;
+static const USHORT SiS310_RGBSenseData2 = 0x0190;
static const USHORT SiS310_VideoSenseData2 = 0x0174;
static const USHORT SiS310_YCSenseData2 = 0x016b;
#endif
static const SiS_PanelDelayTblStruct SiS310_PanelDelayTbl[]=
{
- {{0x10,0x40}},
+ {{0x10,0x40}},
{{0x10,0x40}},
{{0x10,0x40}},
{{0x10,0x40}},
@@ -1044,7 +1081,7 @@ static const SiS_LCDDataStruct SiS310_St2LCD1024x768Data[] =
{
{ 62, 25, 800, 546,1344, 806},
{ 32, 15, 930, 546,1344, 806},
- { 62, 25, 800, 546,1344, 806},
+ { 62, 25, 800, 546,1344, 806},
{ 104, 45, 945, 496,1344, 806},
{ 62, 25, 800, 546,1344, 806},
{ 31, 18,1008, 624,1344, 806},
@@ -1154,7 +1191,7 @@ static const SiS_LVDSDataStruct SiS310_CHTVUPALMData[]=
{ 840, 600, 840, 600},
{ 784, 600, 784, 600},
{1064, 750,1064, 750},
- {1160, 945,1160, 945}
+ {1160, 945,1160, 945}
};
static const SiS_LVDSDataStruct SiS310_CHTVOPALMData[]=
@@ -1165,7 +1202,7 @@ static const SiS_LVDSDataStruct SiS310_CHTVOPALMData[]=
{ 840, 525, 840, 525},
{ 784, 525, 784, 525},
{1040, 700,1040, 700},
- {1160, 840,1160, 840}
+ {1160, 840,1160, 840}
};
static const SiS_LVDSDataStruct SiS310_CHTVUPALNData[]=
@@ -1187,7 +1224,7 @@ static const SiS_LVDSDataStruct SiS310_CHTVOPALNData[]=
{1008, 625,1008, 625},
{ 840, 625, 840, 625},
{ 944, 625, 944, 625},
- {1400, 875,1400, 875}
+ {1400, 875,1400, 875}
};
static const SiS_LVDSDataStruct SiS310_CHTVSOPALData[]= /* (super overscan - no effect on 7019) */
@@ -1198,13 +1235,13 @@ static const SiS_LVDSDataStruct SiS310_CHTVSOPALData[]= /* (super overscan -
{1008, 625,1008, 625},
{ 840, 625, 840, 625},
{ 944, 625, 944, 625},
- {1400, 875,1400, 875}
+ {1400, 875,1400, 875}
};
/* CRT1 CRTC for Chrontel TV slave modes */
static const SiS_LVDSCRT1DataStruct SiS310_CHTVCRT1UNTSC[] =
-{
+{
{{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e,
0xe8,0x84,0x8f,0x57,0x20,0x00,0x01,
0x00 }},
@@ -1254,7 +1291,7 @@ static const SiS_LVDSCRT1DataStruct SiS310_CHTVCRT1ONTSC[] =
};
static const SiS_LVDSCRT1DataStruct SiS310_CHTVCRT1UPAL[] =
-{
+{
{{0x79,0x4f,0x9d,0x5a,0x90,0x6f,0x3e,
0xf8,0x83,0x8f,0x70,0x20,0x00,0x05,
0x00 }},
diff --git a/src/init.c b/src/init.c
index 9e16556..5f13ef5 100644
--- a/src/init.c
+++ b/src/init.c
@@ -146,21 +146,20 @@ InitCommonPointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_Pr->SiS_ExtLCD1600x1200Data = SiS_ExtLCD1600x1200Data;
SiS_Pr->SiS_NoScaleData = SiS_NoScaleData;
- SiS_Pr->SiS_LVDS320x480Data_1 = SiS_LVDS320x480Data_1;
+ SiS_Pr->SiS_LVDS320x240Data_1 = SiS_LVDS320x240Data_1;
+ SiS_Pr->SiS_LVDS320x240Data_2 = SiS_LVDS320x240Data_2;
SiS_Pr->SiS_LVDS640x480Data_1 = SiS_LVDS640x480Data_1;
- SiS_Pr->SiS_LVDS640x480Data_1 = SiS_LVDS640x480Data_1;
- SiS_Pr->SiS_LVDS640x480Data_2 = SiS_LVDS640x480Data_2;
SiS_Pr->SiS_LVDS800x600Data_1 = SiS_LVDS800x600Data_1;
SiS_Pr->SiS_LVDS1024x600Data_1 = SiS_LVDS1024x600Data_1;
SiS_Pr->SiS_LVDS1024x768Data_1 = SiS_LVDS1024x768Data_1;
- SiS_Pr->SiS_LVDSCRT1320x480_1 = SiS_LVDSCRT1320x480_1;
+ SiS_Pr->SiS_LVDSCRT1320x240_1 = SiS_LVDSCRT1320x240_1;
+ SiS_Pr->SiS_LVDSCRT1320x240_2 = SiS_LVDSCRT1320x240_2;
+ SiS_Pr->SiS_LVDSCRT1320x240_2_H = SiS_LVDSCRT1320x240_2_H;
+ SiS_Pr->SiS_LVDSCRT1320x240_3 = SiS_LVDSCRT1320x240_3;
+ SiS_Pr->SiS_LVDSCRT1320x240_3_H = SiS_LVDSCRT1320x240_3_H;
SiS_Pr->SiS_LVDSCRT1640x480_1 = SiS_LVDSCRT1640x480_1;
SiS_Pr->SiS_LVDSCRT1640x480_1_H = SiS_LVDSCRT1640x480_1_H;
- SiS_Pr->SiS_LVDSCRT1640x480_2 = SiS_LVDSCRT1640x480_2;
- SiS_Pr->SiS_LVDSCRT1640x480_2_H = SiS_LVDSCRT1640x480_2_H;
- SiS_Pr->SiS_LVDSCRT1640x480_3 = SiS_LVDSCRT1640x480_3;
- SiS_Pr->SiS_LVDSCRT1640x480_3_H = SiS_LVDSCRT1640x480_3_H;
#if 0
SiS_Pr->SiS_LVDSCRT11024x600_1 = SiS_LVDSCRT11024x600_1;
SiS_Pr->SiS_LVDSCRT11024x600_1_H = SiS_LVDSCRT11024x600_1_H;
@@ -431,37 +430,39 @@ SiS_GetModeID(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay,
switch(HDisplay)
{
case 320:
- if(VDisplay == 200) ModeIndex = ModeIndex_320x200[Depth];
+ if(VDisplay == 200) ModeIndex = ModeIndex_320x200[Depth];
else if(VDisplay == 240) {
- if(FSTN) ModeIndex = ModeIndex_320x240_FSTN[Depth];
- else ModeIndex = ModeIndex_320x240[Depth];
- }
- break;
+ if((VBFlags & CRT2_LCD) && (FSTN))
+ ModeIndex = ModeIndex_320x240_FSTN[Depth];
+ else
+ ModeIndex = ModeIndex_320x240[Depth];
+ }
+ break;
case 400:
- if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth >= 800) && (LCDwidth >= 600))) {
- if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth];
+ if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth >= 800) && (LCDwidth >= 600))) {
+ if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth];
}
- break;
+ break;
case 512:
- if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth >= 1024) && (LCDwidth >= 768))) {
- if(VDisplay == 384) ModeIndex = ModeIndex_512x384[Depth];
+ if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth >= 1024) && (LCDwidth >= 768))) {
+ if(VDisplay == 384) ModeIndex = ModeIndex_512x384[Depth];
}
- break;
+ break;
case 640:
- if(VDisplay == 480) ModeIndex = ModeIndex_640x480[Depth];
+ if(VDisplay == 480) ModeIndex = ModeIndex_640x480[Depth];
else if(VDisplay == 400) ModeIndex = ModeIndex_640x400[Depth];
- break;
+ break;
case 720:
- if(VDisplay == 480) ModeIndex = ModeIndex_720x480[Depth];
- else if(VDisplay == 576) ModeIndex = ModeIndex_720x576[Depth];
- break;
+ if(VDisplay == 480) ModeIndex = ModeIndex_720x480[Depth];
+ else if(VDisplay == 576) ModeIndex = ModeIndex_720x576[Depth];
+ break;
case 768:
- 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(VDisplay == 480) ModeIndex = ModeIndex_800x480[Depth];
- break;
+ break;
case 848:
if(VDisplay == 480) ModeIndex = ModeIndex_848x480[Depth];
break;
@@ -475,20 +476,20 @@ SiS_GetModeID(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay,
}
break;
case 1024:
- if(VDisplay == 576) ModeIndex = ModeIndex_1024x576[Depth];
- else if(VDisplay == 768) ModeIndex = ModeIndex_1024x768[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(VDisplay == 864) ModeIndex = ModeIndex_1152x864[Depth];
- if(VGAEngine == SIS_300_VGA) {
+ if(VDisplay == 864) ModeIndex = ModeIndex_1152x864[Depth];
+ if(VGAEngine == SIS_300_VGA) {
if(VDisplay == 768) ModeIndex = ModeIndex_1152x768[Depth];
}
break;
case 1280:
- switch(VDisplay) {
+ switch(VDisplay) {
case 720:
ModeIndex = ModeIndex_1280x720[Depth];
break;
@@ -513,41 +514,41 @@ SiS_GetModeID(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay,
}
break;
case 1360:
- if(VDisplay == 768) ModeIndex = ModeIndex_1360x768[Depth];
+ if(VDisplay == 768) ModeIndex = ModeIndex_1360x768[Depth];
if(VGAEngine == SIS_300_VGA) {
if(VDisplay == 1024) ModeIndex = ModeIndex_300_1360x1024[Depth];
- }
- break;
+ }
+ break;
case 1400:
- if(VGAEngine == SIS_315_VGA) {
+ if(VGAEngine == SIS_315_VGA) {
if(VDisplay == 1050) {
ModeIndex = ModeIndex_1400x1050[Depth];
}
}
- break;
+ break;
case 1600:
- if(VDisplay == 1200) ModeIndex = ModeIndex_1600x1200[Depth];
- break;
+ if(VDisplay == 1200) ModeIndex = ModeIndex_1600x1200[Depth];
+ break;
case 1680:
- if(VGAEngine == SIS_315_VGA) {
- if(VDisplay == 1050) ModeIndex = ModeIndex_1680x1050[Depth];
+ if(VGAEngine == SIS_315_VGA) {
+ if(VDisplay == 1050) ModeIndex = ModeIndex_1680x1050[Depth];
}
- break;
+ break;
case 1920:
- 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;
+ break;
case 2048:
- if(VDisplay == 1536) {
- if(VGAEngine == SIS_300_VGA) {
+ if(VDisplay == 1536) {
+ if(VGAEngine == SIS_300_VGA) {
ModeIndex = ModeIndex_300_2048x1536[Depth];
- } else {
+ } else {
ModeIndex = ModeIndex_310_2048x1536[Depth];
- }
+ }
}
- break;
+ break;
}
return ModeIndex;
@@ -560,31 +561,41 @@ SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay,
{
USHORT ModeIndex = 0;
+#if 0
+ if(CustomT == CUT_AOP8060) {
+ if(HDisplay == 320 && VDisplay == 240)
+ return ModeIndex_320x240[Depth];
+ else
+ return 0;
+ }
+#endif
+
if(VBFlags & (VB_LVDS | VB_30xBDH)) {
switch(HDisplay)
{
case 320:
if(CustomT != CUT_PANEL848) {
- if(VDisplay == 200) ModeIndex = ModeIndex_320x200[Depth];
- else if(VDisplay == 240) {
+ if(VDisplay == 200) {
+ if(!FSTN) ModeIndex = ModeIndex_320x200[Depth];
+ } else if(VDisplay == 240) {
if(!FSTN) ModeIndex = ModeIndex_320x240[Depth];
- else if(VGAEngine == SIS_315_VGA) {
- ModeIndex = ModeIndex_320x240_FSTN[Depth];
+ else if(VGAEngine == SIS_315_VGA) {
+ ModeIndex = ModeIndex_320x240_FSTN[Depth];
}
}
}
- break;
- case 400:
+ break;
+ case 400:
if(CustomT != CUT_PANEL848) {
- if(!((VGAEngine == SIS_300_VGA) && (VBFlags & VB_TRUMPION))) {
- if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth];
+ if(!((VGAEngine == SIS_300_VGA) && (VBFlags & VB_TRUMPION))) {
+ if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth];
}
}
- break;
+ break;
case 512:
if(CustomT != CUT_PANEL848) {
- if(!((VGAEngine == SIS_300_VGA) && (VBFlags & VB_TRUMPION))) {
+ if(!((VGAEngine == SIS_300_VGA) && (VBFlags & VB_TRUMPION))) {
if(LCDwidth >= 1024 && LCDwidth != 1152 && LCDheight >= 768) {
if(VDisplay == 384) {
ModeIndex = ModeIndex_512x384[Depth];
@@ -596,7 +607,7 @@ SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay,
case 640:
if(VDisplay == 480) ModeIndex = ModeIndex_640x480[Depth];
else if(VDisplay == 400) {
- if(CustomT != CUT_PANEL848) ModeIndex = ModeIndex_640x400[Depth];
+ if(CustomT != CUT_PANEL848) ModeIndex = ModeIndex_640x400[Depth];
}
break;
case 800:
@@ -617,7 +628,7 @@ SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay,
break;
case 1152:
if(VGAEngine == SIS_300_VGA) {
- if((VDisplay == 768) && (LCDheight == 768)) {
+ if((VDisplay == 768) && (LCDheight == 768)) {
ModeIndex = ModeIndex_1152x768[Depth];
}
}
@@ -625,29 +636,29 @@ SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay,
case 1280:
if(VDisplay == 1024) ModeIndex = ModeIndex_1280x1024[Depth];
else if(VGAEngine == SIS_315_VGA) {
- if((VDisplay == 768) && (LCDheight == 768)) {
+ if((VDisplay == 768) && (LCDheight == 768)) {
ModeIndex = ModeIndex_310_1280x768[Depth];
}
}
break;
case 1360:
if(VGAEngine == SIS_300_VGA) {
- if(CustomT == CUT_BARCO1366) {
+ if(CustomT == CUT_BARCO1366) {
if(VDisplay == 1024) ModeIndex = ModeIndex_300_1360x1024[Depth];
}
}
if(CustomT == CUT_PANEL848) {
- if(VDisplay == 768) ModeIndex = ModeIndex_1360x768[Depth];
+ if(VDisplay == 768) ModeIndex = ModeIndex_1360x768[Depth];
}
break;
case 1400:
if(VGAEngine == SIS_315_VGA) {
- if(VDisplay == 1050) ModeIndex = ModeIndex_1400x1050[Depth];
+ if(VDisplay == 1050) ModeIndex = ModeIndex_1400x1050[Depth];
}
break;
case 1600:
if(VGAEngine == SIS_315_VGA) {
- if(VDisplay == 1200) ModeIndex = ModeIndex_1600x1200[Depth];
+ if(VDisplay == 1200) ModeIndex = ModeIndex_1600x1200[Depth];
}
break;
}
@@ -657,17 +668,17 @@ SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay,
switch(HDisplay)
{
case 320:
- if(VDisplay == 200) ModeIndex = ModeIndex_320x200[Depth];
+ if(VDisplay == 200) ModeIndex = ModeIndex_320x200[Depth];
else if(VDisplay == 240) ModeIndex = ModeIndex_320x240[Depth];
- break;
- case 400:
+ break;
+ case 400:
if(LCDwidth >= 800 && LCDheight >= 600) {
- if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth];
+ if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth];
}
- break;
+ break;
case 512:
if(LCDwidth >= 1024 && LCDheight >= 768 && LCDwidth != 1152) {
- if(VDisplay == 384) ModeIndex = ModeIndex_512x384[Depth];
+ if(VDisplay == 384) ModeIndex = ModeIndex_512x384[Depth];
}
break;
case 640:
@@ -676,96 +687,96 @@ SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay,
break;
case 720:
if(VGAEngine == SIS_315_VGA) {
- if(VDisplay == 480) ModeIndex = ModeIndex_720x480[Depth];
+ 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];
+ 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];
+ if(VDisplay == 480) ModeIndex = ModeIndex_800x480[Depth];
}
break;
case 848:
if(VGAEngine == SIS_315_VGA) {
- if(VDisplay == 480) ModeIndex = ModeIndex_848x480[Depth];
+ if(VDisplay == 480) ModeIndex = ModeIndex_848x480[Depth];
}
break;
case 856:
if(VGAEngine == SIS_315_VGA) {
- 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];
+ 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];
+ if(VDisplay == 576) ModeIndex = ModeIndex_1024x576[Depth];
}
break;
case 1152:
if(VGAEngine == SIS_315_VGA) {
- if(VDisplay == 864) ModeIndex = ModeIndex_1152x864[Depth];
+ if(VDisplay == 864) ModeIndex = ModeIndex_1152x864[Depth];
}
break;
case 1280:
switch(VDisplay) {
case 720:
- ModeIndex = ModeIndex_1280x720[Depth];
+ ModeIndex = ModeIndex_1280x720[Depth];
case 768:
- if(VGAEngine == SIS_300_VGA) {
+ if(VGAEngine == SIS_300_VGA) {
ModeIndex = ModeIndex_300_1280x768[Depth];
} else {
ModeIndex = ModeIndex_310_1280x768[Depth];
}
break;
case 800:
- if(VGAEngine == SIS_315_VGA) {
+ if(VGAEngine == SIS_315_VGA) {
ModeIndex = ModeIndex_1280x800[Depth];
}
break;
case 960:
- ModeIndex = ModeIndex_1280x960[Depth];
+ ModeIndex = ModeIndex_1280x960[Depth];
break;
case 1024:
- ModeIndex = ModeIndex_1280x1024[Depth];
+ ModeIndex = ModeIndex_1280x1024[Depth];
break;
}
break;
case 1360:
if(VGAEngine == SIS_315_VGA) {
- if(VDisplay == 768) ModeIndex = ModeIndex_1360x768[Depth];
+ if(VDisplay == 768) ModeIndex = ModeIndex_1360x768[Depth];
}
break;
case 1400:
if(VGAEngine == SIS_315_VGA) {
- if(VBFlags & (VB_301C | VB_302LV | VB_302ELV)) {
+ 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_302LV | VB_302ELV)) {
- if(VDisplay == 1200) ModeIndex = ModeIndex_1600x1200[Depth];
+ 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_302LV | VB_302ELV)) {
- if(VDisplay == 1050) ModeIndex = ModeIndex_1680x1050[Depth];
+ if(VBFlags & (VB_301C | VB_302LV | VB_302ELV)) {
+ if(VDisplay == 1050) ModeIndex = ModeIndex_1680x1050[Depth];
}
}
break;
@@ -785,7 +796,7 @@ SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int D
switch(HDisplay)
{
- case 512:
+ case 512:
if(VGAEngine == SIS_315_VGA) {
if(VDisplay == 384) ModeIndex = ModeIndex_512x384[Depth];
}
@@ -799,7 +810,7 @@ SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int D
break;
case 1024:
if(VGAEngine == SIS_315_VGA) {
- if(VDisplay == 768) ModeIndex = ModeIndex_1024x768[Depth];
+ if(VDisplay == 768) ModeIndex = ModeIndex_1024x768[Depth];
}
break;
}
@@ -809,17 +820,17 @@ SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int D
switch(HDisplay)
{
case 320:
- if(VDisplay == 200) ModeIndex = ModeIndex_320x200[Depth];
+ if(VDisplay == 200) ModeIndex = ModeIndex_320x200[Depth];
else if(VDisplay == 240) ModeIndex = ModeIndex_320x240[Depth];
- break;
- case 400:
- if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth];
- break;
- case 512:
+ break;
+ case 400:
+ if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth];
+ break;
+ case 512:
if( ((VBFlags & TV_YPBPR) && (VBFlags & (TV_YPBPR750P | TV_YPBPR1080I))) ||
- (VBFlags & TV_HIVISION) ||
- ((!(VBFlags & (TV_YPBPR | TV_PALM))) && (VBFlags & TV_PAL)) ) {
- if(VDisplay == 384) ModeIndex = ModeIndex_512x384[Depth];
+ (VBFlags & TV_HIVISION) ||
+ ((!(VBFlags & (TV_YPBPR | TV_PALM))) && (VBFlags & TV_PAL)) ) {
+ if(VDisplay == 384) ModeIndex = ModeIndex_512x384[Depth];
}
break;
case 640:
@@ -828,34 +839,34 @@ SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int D
break;
case 720:
if((!(VBFlags & TV_HIVISION)) && (!((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I)))) {
- if(VDisplay == 480) {
- ModeIndex = ModeIndex_720x480[Depth];
- } else if(VDisplay == 576) {
+ if(VDisplay == 480) {
+ ModeIndex = ModeIndex_720x480[Depth];
+ } else if(VDisplay == 576) {
if( ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR750P)) ||
((!(VBFlags & (TV_YPBPR | TV_PALM))) && (VBFlags & TV_PAL)) )
- ModeIndex = ModeIndex_720x576[Depth];
- }
+ ModeIndex = ModeIndex_720x576[Depth];
+ }
}
break;
case 768:
if((!(VBFlags & TV_HIVISION)) && (!((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I)))) {
- if( ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR750P)) ||
+ if( ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR750P)) ||
((!(VBFlags & (TV_YPBPR | TV_PALM))) && (VBFlags & TV_PAL)) ) {
- 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(VDisplay == 480) {
- if((VBFlags & TV_HIVISION) || ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I))) {
+ if(!((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR750P))) {
ModeIndex = ModeIndex_800x480[Depth];
}
}
break;
case 960:
if(VGAEngine == SIS_315_VGA) {
- if(VDisplay == 600) {
+ if(VDisplay == 600) {
if((VBFlags & TV_HIVISION) || ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I))) {
ModeIndex = ModeIndex_960x600[Depth];
}
@@ -868,21 +879,24 @@ SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int D
ModeIndex = ModeIndex_1024x768[Depth];
}
} else if(VDisplay == 576) {
- if((VBFlags & TV_HIVISION) || ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I))) {
+ if( (VBFlags & TV_HIVISION) ||
+ ((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I)) ||
+ ((VBFlags & (VB_301B|VB_301C|VB_302B|VB_301LV|VB_302LV|VB_302ELV)) &&
+ ((!(VBFlags & (TV_YPBPR | TV_PALM))) && (VBFlags & TV_PAL))) ) {
ModeIndex = ModeIndex_1024x576[Depth];
}
}
break;
case 1280:
if(VDisplay == 720) {
- if((VBFlags & TV_HIVISION) ||
+ if((VBFlags & TV_HIVISION) ||
((VBFlags & TV_YPBPR) && (VBFlags & (TV_YPBPR1080I | TV_YPBPR750P)))) {
- ModeIndex = ModeIndex_1280x720[Depth];
+ ModeIndex = ModeIndex_1280x720[Depth];
}
} else if(VDisplay == 1024) {
- if((VBFlags & TV_HIVISION) ||
+ if((VBFlags & TV_HIVISION) ||
((VBFlags & TV_YPBPR) && (VBFlags & TV_YPBPR1080I))) {
- ModeIndex = ModeIndex_1280x1024[Depth];
+ ModeIndex = ModeIndex_1280x1024[Depth];
}
}
break;
@@ -1165,7 +1179,7 @@ SiS_GetSysFlags(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
case 0x90:
temp1 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x5c) & 0xf8;
switch(temp1) {
- case 0x00: SiS_Pr->SiS_SysFlags |= SF_IsM652; break;
+ case 0x00: SiS_Pr->SiS_SysFlags |= SF_IsM652; break;
case 0x40: SiS_Pr->SiS_SysFlags |= SF_IsM653; break;
default: SiS_Pr->SiS_SysFlags |= SF_IsM650; break;
}
@@ -1179,9 +1193,14 @@ 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_760LFB;
+
+ if(HwInfo->jChipType >= SIS_760 && HwInfo->jChipType <= SIS_761) {
+ if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x78) & 0x30) {
+ SiS_Pr->SiS_SysFlags |= SF_760LFB;
+ }
+ if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x79) & 0xf0) {
+ SiS_Pr->SiS_SysFlags |= SF_760UMA;
+ }
}
}
@@ -1222,11 +1241,11 @@ SiSInitPCIetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
case SIS_761:
case SIS_340:
SiS_SetReg(SiS_Pr->SiS_P3c4,0x20,0xa1);
- /* - Enable 2D (0x40)
- * - Enable 3D (0x02)
+ /* - Enable 3D G/L transformation engine (0x80)
+ * - Enable 2D (0x40)
* - Enable 3D vertex command fetch (0x10)
* - Enable 3D command parser (0x08)
- * - Enable 3D G/L transformation engine (0x80)
+ * - Enable 3D (0x02)
*/
SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0xDA);
break;
@@ -1234,8 +1253,9 @@ SiSInitPCIetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_SetReg(SiS_Pr->SiS_P3c4,0x20,0xa1);
/* No 3D engine ! */
/* - Enable 2D (0x40)
+ * - disable 3D
*/
- SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x1E,0x40);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x1E,0x60,0x40);
}
}
@@ -1251,8 +1271,6 @@ SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_Pr->SiS_IF_DEF_LVDS = 0;
SiS_Pr->SiS_IF_DEF_TRUMPION = 0;
SiS_Pr->SiS_IF_DEF_CH70xx = 0;
- SiS_Pr->SiS_IF_DEF_DSTN = 0;
- SiS_Pr->SiS_IF_DEF_FSTN = 0;
SiS_Pr->SiS_IF_DEF_CONEX = 0;
SiS_Pr->SiS_ChrontelInit = 0;
@@ -1266,15 +1284,15 @@ SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
case SIS_540:
case SIS_630:
case SIS_730:
- temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x37);
- temp = (temp & 0x0E) >> 1;
- if((temp >= 2) && (temp <= 5)) SiS_Pr->SiS_IF_DEF_LVDS = 1;
- if(temp == 3) SiS_Pr->SiS_IF_DEF_TRUMPION = 1;
- if((temp == 4) || (temp == 5)) {
+ temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x37);
+ temp = (temp & 0x0E) >> 1;
+ if((temp >= 2) && (temp <= 5)) SiS_Pr->SiS_IF_DEF_LVDS = 1;
+ if(temp == 3) SiS_Pr->SiS_IF_DEF_TRUMPION = 1;
+ if((temp == 4) || (temp == 5)) {
/* Save power status (and error check) - UNUSED */
SiS_Pr->SiS_Backup70xx = SiS_GetCH700x(SiS_Pr, 0x0e);
SiS_Pr->SiS_IF_DEF_CH70xx = 1;
- }
+ }
break;
#endif
#ifdef SIS315H
@@ -1282,26 +1300,26 @@ SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
case SIS_650:
case SIS_740:
case SIS_330:
- temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x37);
- temp = (temp & 0x0E) >> 1;
- if((temp >= 2) && (temp <= 3)) SiS_Pr->SiS_IF_DEF_LVDS = 1;
- if(temp == 3) SiS_Pr->SiS_IF_DEF_CH70xx = 2;
- break;
+ temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x37);
+ temp = (temp & 0x0E) >> 1;
+ if((temp >= 2) && (temp <= 3)) SiS_Pr->SiS_IF_DEF_LVDS = 1;
+ if(temp == 3) SiS_Pr->SiS_IF_DEF_CH70xx = 2;
+ break;
case SIS_661:
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;
- if(temp == 3) SiS_Pr->SiS_IF_DEF_CH70xx = 2;
- if(temp == 4) SiS_Pr->SiS_IF_DEF_CONEX = 1; /* Not yet supported */
- break;
+ temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);
+ temp = (temp & 0xe0) >> 5;
+ if((temp >= 2) && (temp <= 3)) SiS_Pr->SiS_IF_DEF_LVDS = 1;
+ if(temp == 3) SiS_Pr->SiS_IF_DEF_CH70xx = 2;
+ if(temp == 4) SiS_Pr->SiS_IF_DEF_CONEX = 1; /* Not yet supported */
+ break;
#endif
default:
- break;
+ break;
}
}
@@ -1336,9 +1354,9 @@ SiSDetermineROMLayout661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
return TRUE;
} else if(HwInfo->jChipType >= SIS_661) {
if((ROMAddr[0x1a] == 'N') &&
- (ROMAddr[0x1b] == 'e') &&
- (ROMAddr[0x1c] == 'w') &&
- (ROMAddr[0x1d] == 'V')) {
+ (ROMAddr[0x1b] == 'e') &&
+ (ROMAddr[0x1c] == 'w') &&
+ (ROMAddr[0x1d] == 'V')) {
return TRUE;
}
romversoffs = ROMAddr[0x16] | (ROMAddr[0x17] << 8);
@@ -1353,9 +1371,9 @@ SiSDetermineROMLayout661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
}
} else if(IS_SIS650740) {
if((ROMAddr[0x1a] == 'N') &&
- (ROMAddr[0x1b] == 'e') &&
- (ROMAddr[0x1c] == 'w') &&
- (ROMAddr[0x1d] == 'V')) {
+ (ROMAddr[0x1b] == 'e') &&
+ (ROMAddr[0x1c] == 'w') &&
+ (ROMAddr[0x1d] == 'V')) {
return TRUE;
}
}
@@ -1370,6 +1388,7 @@ SiSDetermineROMUsage(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_Pr->SiS_UseROM = FALSE;
SiS_Pr->SiS_ROMNew = FALSE;
+ SiS_Pr->SiS_PWDOffset = 0;
if((ROMAddr) && (HwInfo->UseROM)) {
if(HwInfo->jChipType == SIS_300) {
@@ -1389,19 +1408,21 @@ SiSDetermineROMUsage(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_Pr->SiS_UseROM = TRUE;
if((SiS_Pr->SiS_ROMNew = SiSDetermineROMLayout661(SiS_Pr, HwInfo))) {
SiS_Pr->SiS_EMIOffset = 14;
+ SiS_Pr->SiS_PWDOffset = 17;
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;
+ SiS_Pr->SiS661LCD2TableSize = 32;
else if(ROMAddr[romptr + (34 * 16)] == 0xff)
- SiS_Pr->SiS661LCD2TableSize = 34;
- else if(ROMAddr[romptr + (36 * 16)] == 0xff) /* 0.94 */
- SiS_Pr->SiS661LCD2TableSize = 36; /* 2.05.00+ */
+ SiS_Pr->SiS661LCD2TableSize = 34;
+ else if(ROMAddr[romptr + (36 * 16)] == 0xff) /* 0.94, 2.05.00+ */
+ SiS_Pr->SiS661LCD2TableSize = 36;
else if( (ROMAddr[romptr + (38 * 16)] == 0xff) || /* 2.00.00 - 2.02.00 */
- (ROMAddr[0x6F] & 0x01) ) { /* 2.03.00+ */
+ (ROMAddr[0x6F] & 0x01) ) { /* 2.03.00 - <2.05.00 */
SiS_Pr->SiS661LCD2TableSize = 38; /* UMC data layout abandoned at 2.05.00 */
SiS_Pr->SiS_EMIOffset = 16;
+ SiS_Pr->SiS_PWDOffset = 19;
}
}
}
@@ -1504,14 +1525,14 @@ SiS_GetVBType(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_Pr->SiS_VBType = VB_SIS302B;
} else if(flag == 1) {
if(rev >= 0xC0) {
- SiS_Pr->SiS_VBType = VB_SIS301C;
+ SiS_Pr->SiS_VBType = VB_SIS301C;
} else if(rev >= 0xB0) {
- SiS_Pr->SiS_VBType = VB_SIS301B;
+ SiS_Pr->SiS_VBType = VB_SIS301B;
/* Check if 30xB DH version (no LCD support, use Panel Link instead) */
- nolcd = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x23);
- if(!(nolcd & 0x02)) SiS_Pr->SiS_VBType |= VB_NoLCD;
+ nolcd = SiS_GetReg(SiS_Pr->SiS_Part4Port,0x23);
+ if(!(nolcd & 0x02)) SiS_Pr->SiS_VBType |= VB_NoLCD;
} else {
- SiS_Pr->SiS_VBType = VB_SIS301;
+ SiS_Pr->SiS_VBType = VB_SIS301;
}
}
if(SiS_Pr->SiS_VBType & (VB_SIS301B | VB_SIS301C | VB_SIS302B)) {
@@ -1723,6 +1744,38 @@ SiS_GetModePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex)
}
/*********************************************/
+/* HELPERS: Get some indices */
+/*********************************************/
+
+USHORT
+SiS_GetRefCRTVCLK(SiS_Private *SiS_Pr, USHORT Index, int UseWide)
+{
+ if(SiS_Pr->SiS_RefIndex[Index].Ext_InfoFlag & HaveWideTiming) {
+ if(UseWide == 1) {
+ return(SiS_Pr->SiS_RefIndex[Index].Ext_CRTVCLK_WIDE);
+ } else {
+ return(SiS_Pr->SiS_RefIndex[Index].Ext_CRTVCLK_NORM);
+ }
+ } else {
+ return(SiS_Pr->SiS_RefIndex[Index].Ext_CRTVCLK);
+ }
+}
+
+USHORT
+SiS_GetRefCRT1CRTC(SiS_Private *SiS_Pr, USHORT Index, int UseWide)
+{
+ if(SiS_Pr->SiS_RefIndex[Index].Ext_InfoFlag & HaveWideTiming) {
+ if(UseWide == 1) {
+ return(SiS_Pr->SiS_RefIndex[Index].Ext_CRT1CRTC_WIDE);
+ } else {
+ return(SiS_Pr->SiS_RefIndex[Index].Ext_CRT1CRTC_NORM);
+ }
+ } else {
+ return(SiS_Pr->SiS_RefIndex[Index].Ext_CRT1CRTC);
+ }
+}
+
+/*********************************************/
/* HELPER: LowModeTests */
/*********************************************/
@@ -1747,8 +1800,8 @@ SiS_DoLowModeTest(SiS_Private *SiS_Pr, USHORT ModeNo, PSIS_HW_INFO HwInfo)
} else {
if(temp2 != 0x55) return TRUE;
else {
- SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01);
- return FALSE;
+ SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01);
+ return FALSE;
}
}
}
@@ -1766,7 +1819,7 @@ SiS_SetLowModeTest(SiS_Private *SiS_Pr, USHORT ModeNo, PSIS_HW_INFO HwInfo)
/*********************************************/
static void
-SiS_SetupCR5x(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
+SiS_OpenCRTC(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
if(IS_SIS650) {
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
@@ -1785,6 +1838,20 @@ SiS_SetupCR5x(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
}
static void
+SiS_CloseCRTC(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
+{
+ USHORT temp1 = 0, temp2 = 0;
+
+ if(IS_SIS661741660760) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
+ temp1 = 0xa0; temp2 = 0x08;
+ }
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x51,0x1f,temp1);
+ SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x56,0xe7,temp2);
+ }
+}
+
+static void
SiS_HandleCRT1(SiS_Private *SiS_Pr)
{
/* Enable CRT1 gating */
@@ -1813,11 +1880,10 @@ SiS_GetColorDepth(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex)
/* Do NOT check UseCustomMode, will skrew up FIFO */
if(ModeNo == 0xfe) {
modeflag = SiS_Pr->CModeFlag;
+ } else if(ModeNo <= 0x13) {
+ modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
} else {
- if(ModeNo <= 0x13)
- modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
- else
- modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
+ modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
}
index = (modeflag & ModeTypeMask) - ModeEGA;
@@ -1901,9 +1967,9 @@ SiS_SetMiscRegs(SiS_Private *SiS_Pr, USHORT StandTableIndex, PSIS_HW_INFO HwInfo
if(HwInfo->jChipType < SIS_661) {
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
- Miscdata |= 0x0C;
- }
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
+ Miscdata |= 0x0C;
+ }
}
}
@@ -1928,18 +1994,18 @@ SiS_SetCRTCRegs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
SiS_SetReg(SiS_Pr->SiS_P3d4,i,CRTCdata); /* Set CRTC(3d4) */
}
if(HwInfo->jChipType >= SIS_661) {
- SiS_SetupCR5x(SiS_Pr, HwInfo);
+ SiS_OpenCRTC(SiS_Pr, HwInfo);
for(i = 0x13; i <= 0x14; i++) {
- CRTCdata = SiS_Pr->SiS_StandTable[StandTableIndex].CRTC[i];
- SiS_SetReg(SiS_Pr->SiS_P3d4,i,CRTCdata);
+ CRTCdata = SiS_Pr->SiS_StandTable[StandTableIndex].CRTC[i];
+ SiS_SetReg(SiS_Pr->SiS_P3d4,i,CRTCdata);
}
} else if( ( (HwInfo->jChipType == SIS_630) ||
- (HwInfo->jChipType == SIS_730) ) &&
- (HwInfo->jChipRevision >= 0x30) ) { /* for 630S0 */
+ (HwInfo->jChipType == SIS_730) ) &&
+ (HwInfo->jChipRevision >= 0x30) ) { /* for 630S0 */
if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
- if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToTV)) {
- SiS_SetReg(SiS_Pr->SiS_P3d4,0x18,0xFE);
- }
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToTV)) {
+ SiS_SetReg(SiS_Pr->SiS_P3d4,0x18,0xFE);
+ }
}
}
}
@@ -1965,25 +2031,25 @@ SiS_SetATTRegs(SiS_Private *SiS_Pr, USHORT StandTableIndex,
}
#endif
if(i == 0x13) {
- /* Pixel shift. If screen on LCD or TV is shifted left or right,
- * this might be the cause.
- */
- if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) ARdata=0;
- }
- if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
- if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
- if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) ARdata=0;
- }
- }
- }
+ /* Pixel shift. If screen on LCD or TV is shifted left or right,
+ * this might be the cause.
+ */
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) ARdata=0;
+ }
+ if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) ARdata=0;
+ }
+ }
+ }
if(HwInfo->jChipType >= SIS_661) {
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToTV | SetCRT2ToLCD)) {
if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) ARdata=0;
}
} else if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
- if(HwInfo->jChipType >= SIS_315H) {
+ if(HwInfo->jChipType >= SIS_315H) {
if(IS_SIS550650740660) {
/* 315, 330 don't do this */
if(SiS_Pr->SiS_VBType & VB_SIS301B302B) {
@@ -1993,9 +2059,9 @@ SiS_SetATTRegs(SiS_Private *SiS_Pr, USHORT StandTableIndex,
}
}
} else {
- if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) ARdata=0;
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) ARdata=0;
}
- }
+ }
}
SiS_GetRegByte(SiS_Pr->SiS_P3da); /* reset 3da */
SiS_SetRegByte(SiS_Pr->SiS_P3c0,i); /* set index */
@@ -2047,7 +2113,7 @@ SiS_ClearExt1Regs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
if(HwInfo->jChipType >= SIS_315H) {
SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x37,0xFE);
if(ModeNo <= 0x13) {
- if(ModeNo == 0x06 || ModeNo >= 0x0e) {
+ if(ModeNo == 0x06 || ModeNo >= 0x0e) {
SiS_SetReg(SiS_Pr->SiS_P3c4,0x0e,0x20);
}
}
@@ -2148,7 +2214,7 @@ SiS_SetCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
}
- index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
+ index = SiS_GetRefCRT1CRTC(SiS_Pr, RefreshRateTableIndex, SiS_Pr->SiS_UseWide);
/* Alternate for 1600x1200 LCDA */
if((index == 0x20) && (SiS_Pr->Alternate1600x1200)) index = 0x57;
@@ -2331,7 +2397,7 @@ SiS_SetCRT1FIFO_300(SiS_Private *SiS_Pr, USHORT ModeNo, PSIS_HW_INFO HwInfo,
if(SiS_Pr->UseCustomMode) {
VCLK = SiS_Pr->CSRClock;
} else {
- index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
+ index = SiS_GetRefCRTVCLK(SiS_Pr, RefreshRateTableIndex, SiS_Pr->SiS_UseWide);
VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; /* Get VCLK */
}
@@ -2461,7 +2527,7 @@ SiS_SetCRT1FIFO_630(SiS_Private *SiS_Pr, USHORT ModeNo,
if(SiS_Pr->UseCustomMode) {
VCLK = SiS_Pr->CSRClock;
} else {
- index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
+ index = SiS_GetRefCRTVCLK(SiS_Pr, RefreshRateTableIndex, SiS_Pr->SiS_UseWide);
VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; /* Get VCLK */
}
@@ -2839,26 +2905,25 @@ 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_760LFB))) {
+ } else if( (HwInfo->jChipType == SIS_330) || (SiS_Pr->SiS_SysFlags & SF_760LFB) ) {
data = SiS_Get310DRAMType(SiS_Pr, HwInfo);
if(HwInfo->jChipType == SIS_330) {
- data = SiS_Pr->SiS_SR15[2][data];
+ data = SiS_Pr->SiS_SR15[2][data];
} else {
- if(SiS_Pr->SiS_ROMNew) data = ROMAddr[0xf6];
- else if(SiS_Pr->SiS_UseROM) data = ROMAddr[0x100 + data];
+ if(SiS_Pr->SiS_ROMNew) data = ROMAddr[0xf6];
+ else if(SiS_Pr->SiS_UseROM) data = ROMAddr[0x100 + data];
else data = 0xba;
}
if(SiS_Pr->SiS_ModeType <= ModeEGA) {
- data &= 0xc7;
+ data &= 0xc7;
} else {
- if(SiS_Pr->UseCustomMode) {
+ if(SiS_Pr->UseCustomMode) {
data2 = SiS_Pr->CSRClock;
} else {
- data2 = SiS_GetVCLK2Ptr(SiS_Pr,ModeNo,ModeIdIndex,
- RefreshRateTableIndex,HwInfo);
- data2 = SiS_Pr->SiS_VCLKData[data2].CLOCK;
+ data2 = SiS_GetVCLK2Ptr(SiS_Pr,ModeNo,ModeIdIndex,
+ RefreshRateTableIndex,HwInfo);
+ data2 = SiS_Pr->SiS_VCLKData[data2].CLOCK;
}
data3 = SiS_GetColorDepth(SiS_Pr,ModeNo,ModeIdIndex) >> 1;
@@ -2870,7 +2935,7 @@ SiS_SetCRT1ModeRegs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
if(HwInfo->jChipType == SIS_330) {
if(SiS_Pr->SiS_ModeType != Mode16Bpp) {
- if (data2 >= 0x19c) data = 0xba;
+ if (data2 >= 0x19c) data = 0xba;
else if(data2 >= 0x140) data = 0x7a;
else if(data2 >= 0x101) data = 0x3a;
else if(data2 >= 0xf5) data = 0x32;
@@ -2884,7 +2949,7 @@ SiS_SetCRT1ModeRegs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
if(data2 >= 0x127) data = 0xba;
else data = 0x7a;
}
- } else { /* 760+LFB */
+ } else { /* 76x+LFB */
if (data2 >= 0x190) data = 0xba;
else if(data2 >= 0xff) data = 0x7a;
else if(data2 >= 0xd3) data = 0x3a;
@@ -2911,7 +2976,7 @@ SiS_SetCRT1ModeRegs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
SiS_SetVCLKState(SiS_Pr, HwInfo, ModeNo, RefreshRateTableIndex, ModeIdIndex);
#ifdef SIS315H
- if(HwInfo->jChipType >= SIS_315H) {
+ if((HwInfo->jChipType >= SIS_315H) && (HwInfo->jChipType < SIS_661)) {
if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) & 0x40) {
SiS_SetReg(SiS_Pr->SiS_P3d4,0x52,0x2c);
} else {
@@ -3161,6 +3226,17 @@ SiS_SetCRT1Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
/*********************************************/
static void
+SiS_InitVB(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
+{
+ UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
+
+ SiS_Pr->Init_P4_0E = 0;
+ if(SiS_Pr->SiS_ROMNew) {
+ SiS_Pr->Init_P4_0E = ROMAddr[0x82];
+ }
+}
+
+static void
SiS_ResetVB(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
@@ -3260,15 +3336,15 @@ SiS_SetPitch(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn)
#ifdef LINUX_XF86
/* We need pScrn for setting the pitch correctly */
BOOLEAN
-SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,ScrnInfoPtr pScrn,USHORT ModeNo, BOOLEAN dosetpitch)
+SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn, USHORT ModeNo, BOOLEAN dosetpitch)
#else
BOOLEAN
-SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo)
+SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
#endif
{
- USHORT ModeIdIndex;
SISIOADDRESS BaseAddr = HwInfo->ulIOAddress;
- unsigned char backupreg=0;
+ USHORT RealModeNo, ModeIdIndex;
+ UCHAR backupreg = 0;
#ifdef LINUX_KERNEL
USHORT KeepLockReg;
@@ -3276,19 +3352,29 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo)
SiS_Pr->CRT1UsesCustomMode = FALSE;
#endif
+ SiS_Pr->SiS_flag_clearbuffer = 0;
+
if(SiS_Pr->UseCustomMode) {
ModeNo = 0xfe;
+ } else {
+#ifdef LINUX_KERNEL
+ if(!(ModeNo & 0x80)) SiS_Pr->SiS_flag_clearbuffer = 1;
+#endif
+ ModeNo &= 0x7f;
}
+ /* Don't use FSTN mode for CRT1 */
+ RealModeNo = ModeNo;
+ if(ModeNo == 0x5b) ModeNo = 0x56;
+
SiSInitPtr(SiS_Pr, HwInfo);
SiSRegInit(SiS_Pr, BaseAddr);
SiS_GetSysFlags(SiS_Pr, HwInfo);
+ SiS_Pr->SiS_VGAINFO = 0x11;
#if defined(LINUX_XF86) && (defined(i386) || defined(__i386) || defined(__i386__) || defined(__AMD64__) || defined(__amd64__))
if(pScrn) SiS_Pr->SiS_VGAINFO = SiS_GetSetBIOSScratch(pScrn, 0x489, 0xff);
- else
#endif
- SiS_Pr->SiS_VGAINFO = 0x11;
#ifdef LINUX_KERNEL
KeepLockReg = SiS_GetReg(SiS_Pr->SiS_P3c4,0x05);
@@ -3299,15 +3385,6 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo)
SiSSetLVDSetc(SiS_Pr, HwInfo);
SiSDetermineROMUsage(SiS_Pr, HwInfo);
- SiS_Pr->SiS_flag_clearbuffer = 0;
-
- if(!SiS_Pr->UseCustomMode) {
-#ifdef LINUX_KERNEL
- if(!(ModeNo & 0x80)) SiS_Pr->SiS_flag_clearbuffer = 1;
-#endif
- ModeNo &= 0x7f;
- }
-
SiS_UnLockCRT2(SiS_Pr, HwInfo);
if(!SiS_Pr->UseCustomMode) {
@@ -3320,6 +3397,7 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo)
/* Init/restore some VB registers */
+ SiS_InitVB(SiS_Pr, HwInfo);
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
if(HwInfo->jChipType >= SIS_315H) {
SiS_ResetVB(SiS_Pr, HwInfo);
@@ -3345,9 +3423,7 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo)
}
#endif
- if(HwInfo->jChipType >= SIS_315H) {
- SiS_SetupCR5x(SiS_Pr, HwInfo);
- }
+ SiS_OpenCRTC(SiS_Pr, HwInfo);
if(SiS_Pr->UseCustomMode) {
SiS_Pr->CRT1UsesCustomMode = TRUE;
@@ -3366,15 +3442,17 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo)
/* Set mode on CRT2 */
if(SiS_Pr->SiS_VBInfo & (SetSimuScanMode | SwitchCRT2 | SetCRT2ToLCDA)) {
if( (SiS_Pr->SiS_VBType & VB_SISVB) ||
- (SiS_Pr->SiS_IF_DEF_LVDS == 1) ||
- (SiS_Pr->SiS_IF_DEF_CH70xx != 0) ||
- (SiS_Pr->SiS_IF_DEF_TRUMPION != 0) ) {
- SiS_SetCRT2Group(SiS_Pr, HwInfo, ModeNo);
+ (SiS_Pr->SiS_IF_DEF_LVDS == 1) ||
+ (SiS_Pr->SiS_IF_DEF_CH70xx != 0) ||
+ (SiS_Pr->SiS_IF_DEF_TRUMPION != 0) ) {
+ SiS_SetCRT2Group(SiS_Pr, HwInfo, RealModeNo);
}
}
SiS_HandleCRT1(SiS_Pr);
+ SiS_CloseCRTC(SiS_Pr, HwInfo);
+
SiS_StrangeStuff(SiS_Pr, HwInfo);
SiS_DisplayOn(SiS_Pr);
@@ -3382,7 +3460,7 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo)
if(HwInfo->jChipType >= SIS_315H) {
if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
- if(!(SiS_IsDualEdge(SiS_Pr, HwInfo))) {
+ if(!(SiS_IsDualEdge(SiS_Pr, HwInfo))) {
SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x13,0xfb);
}
}
@@ -3390,7 +3468,7 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo)
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
if(HwInfo->jChipType >= SIS_315H) {
- if(!SiS_Pr->SiS_ROMNew) {
+ if(!SiS_Pr->SiS_ROMNew) {
if(SiS_IsVAMode(SiS_Pr,HwInfo)) {
SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01);
} else {
@@ -3404,15 +3482,15 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo)
if((ModeNo == 0x03) || (ModeNo == 0x10)) {
SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x51,0x80);
SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x56,0x08);
- }
+ }
}
if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x30) & SetCRT2ToLCD) {
SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xfc);
}
} else if((HwInfo->jChipType == SIS_630) ||
- (HwInfo->jChipType == SIS_730)) {
- SiS_SetReg(SiS_Pr->SiS_P3d4,0x35,backupreg);
+ (HwInfo->jChipType == SIS_730)) {
+ SiS_SetReg(SiS_Pr->SiS_P3d4,0x35,backupreg);
}
}
@@ -3420,7 +3498,7 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo)
if(pScrn) {
/* SetPitch: Adapt to virtual size & position */
if((ModeNo > 0x13) && (dosetpitch)) {
- SiS_SetPitch(SiS_Pr, pScrn);
+ SiS_SetPitch(SiS_Pr, pScrn);
}
/* Backup/Set ModeNo in BIOS scratch area */
@@ -3454,7 +3532,7 @@ SiSBIOSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
if((IsCustom) && (SiS_CheckBuildCustomMode(pScrn, mode, pSiS->VBFlags))) {
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Setting custom mode %dx%d\n",
- SiS_Pr->CHDisplay,
+ SiS_Pr->CHDisplay,
(mode->Flags & V_INTERLACE ? SiS_Pr->CVDisplay * 2 :
(mode->Flags & V_DBLSCAN ? SiS_Pr->CVDisplay / 2 :
SiS_Pr->CVDisplay)));
@@ -3462,7 +3540,7 @@ SiSBIOSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
} else {
/* Don't need vbflags here; checks done earlier */
- ModeNo = SiS_GetModeNumber(pScrn, mode, 0);
+ ModeNo = SiS_GetModeNumber(pScrn, mode, pSiS->VBFlags);
if(!ModeNo) return FALSE;
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Setting standard mode 0x%x\n", ModeNo);
@@ -3480,11 +3558,11 @@ BOOLEAN
SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
DisplayModePtr mode, BOOLEAN IsCustom)
{
- USHORT ModeIdIndex;
SISIOADDRESS BaseAddr = HwInfo->ulIOAddress;
- UShort ModeNo = 0;
- unsigned char backupreg=0;
- SISPtr pSiS = SISPTR(pScrn);
+ SISPtr pSiS = SISPTR(pScrn);
+ USHORT ModeIdIndex;
+ USHORT ModeNo = 0;
+ UCHAR backupreg = 0;
#ifdef SISDUALHEAD
SISEntPtr pSiSEnt = pSiS->entityPrivate;
#endif
@@ -3502,8 +3580,8 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
} else {
- ModeNo = SiS_GetModeNumber(pScrn, mode, 0);
- if(!ModeNo) return FALSE;
+ ModeNo = SiS_GetModeNumber(pScrn, mode, pSiS->VBFlags);
+ if(!ModeNo) return FALSE;
}
@@ -3535,9 +3613,9 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
#if 0
/* We can't set CRT2 mode before CRT1 mode is set */
if(pSiSEnt->CRT1ModeNo == -1) {
- xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
"Setting CRT2 mode delayed until after setting CRT1 mode\n");
- return TRUE;
+ return TRUE;
}
#endif
pSiSEnt->CRT2ModeSet = TRUE;
@@ -3561,7 +3639,7 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
} else {
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
- "Setting standard mode 0x%x on CRT2\n", ModeNo);
+ "Setting standard mode 0x%x on CRT2\n", ModeNo);
}
@@ -3575,14 +3653,15 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
SiS_GetVBType(SiS_Pr, HwInfo);
+ SiS_InitVB(SiS_Pr, HwInfo);
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
if(HwInfo->jChipType >= SIS_315H) {
SiS_ResetVB(SiS_Pr, HwInfo);
SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x32,0x10);
SiS_SetRegOR(SiS_Pr->SiS_Part2Port,0x00,0x0c);
- backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);
+ backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);
} else {
- backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35);
+ backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35);
}
}
@@ -3615,7 +3694,7 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
if(HwInfo->jChipType >= SIS_315H) {
if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
- if(!(SiS_IsDualEdge(SiS_Pr, HwInfo))) {
+ if(!(SiS_IsDualEdge(SiS_Pr, HwInfo))) {
SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x13,0xfb);
}
}
@@ -3623,7 +3702,7 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
if(HwInfo->jChipType >= SIS_315H) {
- if(!SiS_Pr->SiS_ROMNew) {
+ if(!SiS_Pr->SiS_ROMNew) {
if(SiS_IsVAMode(SiS_Pr,HwInfo)) {
SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01);
} else {
@@ -3637,7 +3716,7 @@ SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xfc);
}
} else if((HwInfo->jChipType == SIS_630) ||
- (HwInfo->jChipType == SIS_730)) {
+ (HwInfo->jChipType == SIS_730)) {
SiS_SetReg(SiS_Pr->SiS_P3d4,0x35,backupreg);
}
}
@@ -3657,13 +3736,13 @@ BOOLEAN
SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
DisplayModePtr mode, BOOLEAN IsCustom)
{
- SISPtr pSiS = SISPTR(pScrn);
SISIOADDRESS BaseAddr = HwInfo->ulIOAddress;
- USHORT ModeIdIndex, ModeNo=0;
- UCHAR backupreg=0;
+ SISPtr pSiS = SISPTR(pScrn);
+ USHORT ModeIdIndex, ModeNo = 0;
+ UCHAR backupreg = 0;
#ifdef SISDUALHEAD
SISEntPtr pSiSEnt = pSiS->entityPrivate;
- UCHAR backupcr30, backupcr31, backupcr38, backupcr35, backupp40d=0;
+ UCHAR backupcr30, backupcr31, backupcr38, backupcr35, backupp40d=0;
BOOLEAN backupcustom;
#endif
@@ -3671,22 +3750,22 @@ SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
if((IsCustom) && (SiS_CheckBuildCustomMode(pScrn, mode, pSiS->VBFlags))) {
- USHORT temptemp = SiS_Pr->CVDisplay;
+ USHORT temptemp = SiS_Pr->CVDisplay;
- if(SiS_Pr->CModeFlag & DoubleScanMode) temptemp >>= 1;
- else if(SiS_Pr->CInfoFlag & InterlaceMode) temptemp <<= 1;
+ if(SiS_Pr->CModeFlag & DoubleScanMode) temptemp >>= 1;
+ else if(SiS_Pr->CInfoFlag & InterlaceMode) temptemp <<= 1;
- xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
"Setting custom mode %dx%d on CRT1\n",
SiS_Pr->CHDisplay, temptemp);
ModeNo = 0xfe;
} else {
- ModeNo = SiS_GetModeNumber(pScrn, mode, 0);
- if(!ModeNo) return FALSE;
+ ModeNo = SiS_GetModeNumber(pScrn, mode, 0); /* don't give VBFlags */
+ if(!ModeNo) return FALSE;
- xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
"Setting standard mode 0x%x on CRT1\n", ModeNo);
}
@@ -3719,6 +3798,7 @@ SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
/* Determine VBType */
SiS_GetVBType(SiS_Pr, HwInfo);
+ SiS_InitVB(SiS_Pr, HwInfo);
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
if(HwInfo->jChipType >= SIS_315H) {
backupreg = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);
@@ -3735,9 +3815,7 @@ SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
SiS_GetLCDResInfo(SiS_Pr, ModeNo, ModeIdIndex, HwInfo);
SiS_SetLowModeTest(SiS_Pr, ModeNo, HwInfo);
- if(HwInfo->jChipType >= SIS_315H) {
- SiS_SetupCR5x(SiS_Pr, HwInfo);
- }
+ SiS_OpenCRTC(SiS_Pr, HwInfo);
/* Set mode on CRT1 */
SiS_SetCRT1Group(SiS_Pr, HwInfo, ModeNo, ModeIdIndex);
@@ -3745,6 +3823,8 @@ SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
SiS_SetCRT2Group(SiS_Pr, HwInfo, ModeNo);
}
+ SiS_CloseCRTC(SiS_Pr, HwInfo);
+
/* SetPitch: Adapt to virtual size & position */
SiS_SetPitchCRT1(SiS_Pr, pScrn);
@@ -3786,9 +3866,10 @@ SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ScrnInfoPtr pScrn,
SiS_SetReg(SiS_Pr->SiS_P3d4,0x35,pSiSEnt->CRT2CR35);
SiS_SetReg(SiS_Pr->SiS_P3d4,0x38,pSiSEnt->CRT2CR38);
}
+
SiSBIOSSetModeCRT2(SiS_Pr, HwInfo, pSiSEnt->pScrn_1,
pSiSEnt->CRT2DMode, pSiSEnt->CRT2IsCustom);
- SiS_SetReg(SiS_Pr->SiS_P3d4,0x30,backupcr30);
+ SiS_SetReg(SiS_Pr->SiS_P3d4,0x30,backupcr30);
SiS_SetReg(SiS_Pr->SiS_P3d4,0x31,backupcr31);
SiS_SetReg(SiS_Pr->SiS_P3d4,0x35,backupcr35);
SiS_SetReg(SiS_Pr->SiS_P3d4,0x38,backupcr38);
@@ -3915,23 +3996,25 @@ SiS_GetPanelID(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
void
SiS_CalcCRRegisters(SiS_Private *SiS_Pr, int depth)
{
+ int x = 1; /* Fix sync */
+
SiS_Pr->CCRT1CRTC[0] = ((SiS_Pr->CHTotal >> 3) - 5) & 0xff; /* CR0 */
SiS_Pr->CCRT1CRTC[1] = (SiS_Pr->CHDisplay >> 3) - 1; /* CR1 */
SiS_Pr->CCRT1CRTC[2] = (SiS_Pr->CHBlankStart >> 3) - 1; /* CR2 */
SiS_Pr->CCRT1CRTC[3] = (((SiS_Pr->CHBlankEnd >> 3) - 1) & 0x1F) | 0x80; /* CR3 */
SiS_Pr->CCRT1CRTC[4] = (SiS_Pr->CHSyncStart >> 3) + 3; /* CR4 */
SiS_Pr->CCRT1CRTC[5] = ((((SiS_Pr->CHBlankEnd >> 3) - 1) & 0x20) << 2) | /* CR5 */
- (((SiS_Pr->CHSyncEnd >> 3) + 3) & 0x1F);
+ (((SiS_Pr->CHSyncEnd >> 3) + 3) & 0x1F);
- SiS_Pr->CCRT1CRTC[6] = (SiS_Pr->CVTotal - 2) & 0xFF; /* CR6 */
- SiS_Pr->CCRT1CRTC[7] = (((SiS_Pr->CVTotal - 2) & 0x100) >> 8) /* CR7 */
- | (((SiS_Pr->CVDisplay - 1) & 0x100) >> 7)
- | ((SiS_Pr->CVSyncStart & 0x100) >> 6)
- | (((SiS_Pr->CVBlankStart - 1) & 0x100) >> 5)
+ SiS_Pr->CCRT1CRTC[6] = (SiS_Pr->CVTotal - 2) & 0xFF; /* CR6 */
+ SiS_Pr->CCRT1CRTC[7] = (((SiS_Pr->CVTotal - 2) & 0x100) >> 8) /* CR7 */
+ | (((SiS_Pr->CVDisplay - 1) & 0x100) >> 7)
+ | (((SiS_Pr->CVSyncStart - x) & 0x100) >> 6)
+ | (((SiS_Pr->CVBlankStart- 1) & 0x100) >> 5)
| 0x10
- | (((SiS_Pr->CVTotal - 2) & 0x200) >> 4)
- | (((SiS_Pr->CVDisplay - 1) & 0x200) >> 3)
- | ((SiS_Pr->CVSyncStart & 0x200) >> 2);
+ | (((SiS_Pr->CVTotal - 2) & 0x200) >> 4)
+ | (((SiS_Pr->CVDisplay - 1) & 0x200) >> 3)
+ | (((SiS_Pr->CVSyncStart - x) & 0x200) >> 2);
SiS_Pr->CCRT1CRTC[16] = ((((SiS_Pr->CVBlankStart - 1) & 0x200) >> 4) >> 5); /* CR9 */
@@ -3940,8 +4023,8 @@ SiS_CalcCRRegisters(SiS_Private *SiS_Pr, int depth)
else if(SiS_Pr->CHDisplay >= 640) SiS_Pr->CCRT1CRTC[16] |= 0x40;
}
- SiS_Pr->CCRT1CRTC[8] = (SiS_Pr->CVSyncStart ) & 0xFF; /* CR10 */
- SiS_Pr->CCRT1CRTC[9] = ((SiS_Pr->CVSyncEnd ) & 0x0F) | 0x80; /* CR11 */
+ SiS_Pr->CCRT1CRTC[8] = (SiS_Pr->CVSyncStart - x) & 0xFF; /* CR10 */
+ SiS_Pr->CCRT1CRTC[9] = ((SiS_Pr->CVSyncEnd - x) & 0x0F) | 0x80; /* CR11 */
SiS_Pr->CCRT1CRTC[10] = (SiS_Pr->CVDisplay - 1) & 0xFF; /* CR12 */
SiS_Pr->CCRT1CRTC[11] = (SiS_Pr->CVBlankStart - 1) & 0xFF; /* CR15 */
SiS_Pr->CCRT1CRTC[12] = (SiS_Pr->CVBlankEnd - 1) & 0xFF; /* CR16 */
@@ -3950,7 +4033,7 @@ SiS_CalcCRRegisters(SiS_Private *SiS_Pr, int depth)
GETBITSTR((SiS_Pr->CVTotal -2), 10:10, 0:0) |
GETBITSTR((SiS_Pr->CVDisplay -1), 10:10, 1:1) |
GETBITSTR((SiS_Pr->CVBlankStart-1), 10:10, 2:2) |
- GETBITSTR((SiS_Pr->CVSyncStart ), 10:10, 3:3) |
+ GETBITSTR((SiS_Pr->CVSyncStart -x), 10:10, 3:3) |
GETBITSTR((SiS_Pr->CVBlankEnd -1), 8:8, 4:4) |
GETBITSTR((SiS_Pr->CVSyncEnd ), 4:4, 5:5) ;
@@ -4325,7 +4408,8 @@ SiS_FindPanelFromDB(SISPtr pSiS, USHORT panelvendor, USHORT panelproduct, int *m
* modes derived from DDC or database data are M_T_BUILTIN
*/
DisplayModePtr
-SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN isfordvi, BOOLEAN fakecrt2modes)
+SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN isfordvi,
+ BOOLEAN fakecrt2modes, BOOLEAN IsForCRT2)
{
SISPtr pSiS = SISPTR(pScrn);
unsigned short VRE, VBE, VRS, VBS, VDE, VT;
@@ -4333,7 +4417,7 @@ SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN isfo
unsigned char sr_data, cr_data, cr_data2, cr_data3;
unsigned char sr2b, sr2c;
float num, denum, postscalar, divider;
- int A, B, C, D, E, F, temp, i, j, k, l, index, vclkindex;
+ int A, B, C, D, E, F, temp, i, j, k, l, index, vclkindex, UseWide;
DisplayModePtr new = NULL, current = NULL, first = NULL;
BOOLEAN done = FALSE, IsHDCLK;
#if 0
@@ -4343,6 +4427,9 @@ SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN isfo
pSiS->backupmodelist = NULL;
pSiS->AddedPlasmaModes = FALSE;
+ UseWide = pSiS->SiS_Pr->SiS_UseWide;
+ if(IsForCRT2) UseWide = pSiS->SiS_Pr->SiS_UseWideCRT2;
+
/* Initialize our pointers */
if(pSiS->VGAEngine == SIS_300_VGA) {
#ifdef SIS300
@@ -4361,23 +4448,31 @@ SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN isfo
i = 0;
while(pSiS->SiS_Pr->SiS_RefIndex[i].Ext_InfoFlag != 0xFFFF) {
- index = pSiS->SiS_Pr->SiS_RefIndex[i].Ext_CRT1CRTC;
+ if(pSiS->SiS_Pr->SiS_RefIndex[i].Ext_InfoFlag & HaveWideTiming) {
+ if(UseWide == 1) {
+ if((pSiS->SiS_Pr->SiS_RefIndex[i].Ext_CRT1CRTC_WIDE == 0xff) &&
+ (pSiS->SiS_Pr->SiS_RefIndex[i].Ext_CRTVCLK_WIDE == 0xff)) {
+ i++;
+ continue;
+ }
+ } else {
+ if((pSiS->SiS_Pr->SiS_RefIndex[i].Ext_CRT1CRTC_NORM == 0xff) &&
+ (pSiS->SiS_Pr->SiS_RefIndex[i].Ext_CRTVCLK_NORM == 0xff)) {
+ i++;
+ continue;
+ }
+ }
+ }
+
+ index = SiS_GetRefCRT1CRTC(pSiS->SiS_Pr, i, UseWide);
if(fakecrt2modes) {
- if(pSiS->SiS_Pr->SiS_RefIndex[i].Ext_FakeCRT2CRTC) {
+ if(pSiS->SiS_Pr->SiS_RefIndex[i].Ext_FakeCRT2CRTC) {
index = pSiS->SiS_Pr->SiS_RefIndex[i].Ext_FakeCRT2CRTC;
}
}
- /* 0x5a (320x240) is a pure FTSN mode, not DSTN! */
- if((!pSiS->FSTN) &&
- (pSiS->SiS_Pr->SiS_RefIndex[i].ModeID == 0x5a)) {
- i++;
- continue;
- }
- if((pSiS->FSTN) &&
- (pSiS->SiS_Pr->SiS_RefIndex[i].XRes == 320) &&
- (pSiS->SiS_Pr->SiS_RefIndex[i].YRes == 240) &&
- (pSiS->SiS_Pr->SiS_RefIndex[i].ModeID != 0x5a)) {
+ /* 0x5a (320x240) for FTSN - skip, is bad for CRT1 */
+ if(pSiS->SiS_Pr->SiS_RefIndex[i].ModeID == 0x5a) {
i++;
continue;
}
@@ -4385,12 +4480,12 @@ SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN isfo
if(!(new = xalloc(sizeof(DisplayModeRec)))) return first;
memset(new, 0, sizeof(DisplayModeRec));
if(!(new->name = xalloc(10))) {
- xfree(new);
+ xfree(new);
return first;
}
if(!first) first = new;
if(current) {
- current->next = new;
+ current->next = new;
new->prev = current;
}
@@ -4403,9 +4498,9 @@ SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes, BOOLEAN isfo
current->type = M_T_DEFAULT;
- vclkindex = pSiS->SiS_Pr->SiS_RefIndex[i].Ext_CRTVCLK;
+ vclkindex = SiS_GetRefCRTVCLK(pSiS->SiS_Pr, i, UseWide);
if(fakecrt2modes) {
- if(pSiS->SiS_Pr->SiS_RefIndex[i].Ext_FakeCRT2Clk) {
+ if(pSiS->SiS_Pr->SiS_RefIndex[i].Ext_FakeCRT2Clk) {
vclkindex = pSiS->SiS_Pr->SiS_RefIndex[i].Ext_FakeCRT2Clk;
}
}
@@ -4950,14 +5045,35 @@ sisfb_mode_rate_to_dclock(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
#endif
}
+ if(rateindex > 0) rateindex--;
+
+#ifdef SIS315H
+ switch(ModeNo) {
+ case 0x5a: ModeNo = 0x50; break;
+ case 0x5b: ModeNo = 0x56;
+ }
+#endif
+
if(!(SiS_SearchModeID(SiS_Pr, &ModeNo, &ModeIdIndex))) {;
- printk(KERN_ERR "Could not find mode %x\n", ModeNo);
- return 65 * 1000;
+ printk(KERN_ERR "Could not find mode %x\n", ModeNo);
+ return 65 * 1000;
}
RefreshRateTableIndex = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].REFindex;
- RefreshRateTableIndex += (rateindex - 1);
- ClockIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
+
+ if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag & HaveWideTiming) {
+ if(SiS_Pr->SiS_UseWide == 1) {
+ /* Wide screen: Ignore rateindex */
+ ClockIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK_WIDE;
+ } else {
+ RefreshRateTableIndex += rateindex;
+ ClockIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK_NORM;
+ }
+ } else {
+ RefreshRateTableIndex += rateindex;
+ ClockIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
+ }
+
Clock = SiS_Pr->SiS_VCLKData[ClockIndex].CLOCK * 1000;
return Clock;
@@ -4970,7 +5086,7 @@ sisfb_gettotalfrommode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
USHORT ModeNo = modeno;
USHORT ModeIdIndex = 0, CRT1Index = 0;
USHORT RefreshRateTableIndex = 0;
- unsigned char sr_data, cr_data, cr_data2;
+ UCHAR sr_data, cr_data, cr_data2;
if(HwInfo->jChipType < SIS_315H) {
#ifdef SIS300
@@ -4986,23 +5102,42 @@ sisfb_gettotalfrommode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
#endif
}
+ if(rateindex > 0) rateindex--;
+
+#ifdef SIS315H
+ switch(ModeNo) {
+ case 0x5a: ModeNo = 0x50; break;
+ case 0x5b: ModeNo = 0x56;
+ }
+#endif
+
if(!(SiS_SearchModeID(SiS_Pr, &ModeNo, &ModeIdIndex))) return FALSE;
RefreshRateTableIndex = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].REFindex;
- RefreshRateTableIndex += (rateindex - 1);
- CRT1Index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
+ if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag & HaveWideTiming) {
+ if(SiS_Pr->SiS_UseWide == 1) {
+ /* Wide screen: Ignore rateindex */
+ CRT1Index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC_WIDE;
+ } else {
+ RefreshRateTableIndex += rateindex;
+ CRT1Index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC_NORM;
+ }
+ } else {
+ RefreshRateTableIndex += rateindex;
+ CRT1Index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
+ }
sr_data = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[14];
cr_data = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[0];
- *htotal = (((cr_data & 0xff) | ((unsigned short) (sr_data & 0x03) << 8)) + 5) * 8;
+ *htotal = (((cr_data & 0xff) | ((USHORT) (sr_data & 0x03) << 8)) + 5) * 8;
sr_data = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[13];
cr_data = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[6];
cr_data2 = SiS_Pr->SiS_CRT1Table[CRT1Index].CR[7];
*vtotal = ((cr_data & 0xFF) |
- ((unsigned short)(cr_data2 & 0x01) << 8) |
- ((unsigned short)(cr_data2 & 0x20) << 4) |
- ((unsigned short)(sr_data & 0x01) << 10)) + 2;
+ ((USHORT)(cr_data2 & 0x01) << 8) |
+ ((USHORT)(cr_data2 & 0x20) << 4) |
+ ((USHORT)(sr_data & 0x01) << 10)) + 2;
if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag & InterlaceMode)
*vtotal *= 2;
@@ -5037,11 +5172,30 @@ sisfb_mode_rate_to_ddata(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
#endif
}
+ if(rateindex > 0) rateindex--;
+
+#ifdef SIS315H
+ switch(ModeNo) {
+ case 0x5a: ModeNo = 0x50; break;
+ case 0x5b: ModeNo = 0x56;
+ }
+#endif
+
if(!(SiS_SearchModeID(SiS_Pr, &ModeNo, &ModeIdIndex))) return 0;
RefreshRateTableIndex = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].REFindex;
- RefreshRateTableIndex += (rateindex - 1);
- index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
+ if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_InfoFlag & HaveWideTiming) {
+ if(SiS_Pr->SiS_UseWide == 1) {
+ /* Wide screen: Ignore rateindex */
+ index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC_WIDE;
+ } else {
+ RefreshRateTableIndex += rateindex;
+ index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC_NORM;
+ }
+ } else {
+ RefreshRateTableIndex += rateindex;
+ index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
+ }
sr_data = SiS_Pr->SiS_CRT1Table[index].CR[14];
@@ -5191,13 +5345,13 @@ sisfb_mode_rate_to_ddata(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
else {
j = 0;
while(SiS_Pr->SiS_EModeIDTable[j].Ext_ModeID != 0xff) {
- if(SiS_Pr->SiS_EModeIDTable[j].Ext_ModeID ==
+ if(SiS_Pr->SiS_EModeIDTable[j].Ext_ModeID ==
SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].ModeID) {
- if(SiS_Pr->SiS_EModeIDTable[j].Ext_ModeFlag & DoubleScanMode) {
+ if(SiS_Pr->SiS_EModeIDTable[j].Ext_ModeFlag & DoubleScanMode) {
var->vmode = FB_VMODE_DOUBLE;
- }
+ }
break;
- }
+ }
j++;
}
}
diff --git a/src/init.h b/src/init.h
index 829885f..6ff12c2 100644
--- a/src/init.h
+++ b/src/init.h
@@ -283,7 +283,7 @@ static const SiS_ModeResInfoStruct SiS_ModeResInfo[] =
{ 768, 576, 8,16}, /* 0x1b */
{ 1360,1024, 8,16}, /* 0x1c */
{ 1680,1050, 8,16}, /* 0x1d */
- { 1280, 800, 8,16}, /* 0x1e */
+ { 1280, 800, 8,16}, /* 0x1e */
{ 1920,1080, 8,16}, /* 0x1f */
{ 960, 540, 8,16}, /* 0x20 */
{ 960, 600, 8,16} /* 0x21 */
@@ -761,7 +761,7 @@ static const UCHAR SiS_PALTiming[] = {
};
static const UCHAR SiS_HiTVExtTiming[] = {
- 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x64,
+ 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x64,
0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f,
0x64,0x90,0x33,0x8c,0x18,0x36,0x3e,0x13,
@@ -772,7 +772,7 @@ static const UCHAR SiS_HiTVExtTiming[] = {
};
static const UCHAR SiS_HiTVSt1Timing[] = {
- 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x65,
+ 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x65,
0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f,
0x65,0x90,0x7b,0xa8,0x03,0xf0,0x87,0x03,
@@ -783,7 +783,7 @@ static const UCHAR SiS_HiTVSt1Timing[] = {
};
static const UCHAR SiS_HiTVSt2Timing[] = {
- 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x64,
+ 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x64,
0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f,
0x64,0x90,0x33,0x8c,0x18,0x36,0x3e,0x13,
@@ -795,7 +795,7 @@ static const UCHAR SiS_HiTVSt2Timing[] = {
#if 0
static const UCHAR SiS_HiTVTextTiming[] = {
- 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x65,
+ 0x32,0x65,0x2c,0x5f,0x08,0x31,0x3a,0x65,
0x28,0x02,0x01,0x3d,0x06,0x3e,0x35,0x6d,
0x06,0x14,0x3e,0x35,0x6d,0x00,0xc5,0x3f,
0x65,0x90,0xe7,0xbc,0x03,0x0c,0x97,0x03,
@@ -807,7 +807,7 @@ static const UCHAR SiS_HiTVTextTiming[] = {
#endif
static const UCHAR SiS_HiTVGroup3Data[] = {
- 0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0x5f,
+ 0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0x5f,
0x05,0x21,0xb2,0xb2,0x55,0x77,0x2a,0xa6,
0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20,
0x8c,0x6e,0x60,0x2e,0x58,0x48,0x72,0x44,
@@ -818,7 +818,7 @@ static const UCHAR SiS_HiTVGroup3Data[] = {
};
static const UCHAR SiS_HiTVGroup3Simu[] = {
- 0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0x95,
+ 0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0x95,
0xdb,0x20,0xb8,0xb8,0x55,0x47,0x2a,0xa6,
0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20,
0x8c,0x6e,0x60,0x15,0x26,0xd3,0xe4,0x11,
@@ -830,7 +830,7 @@ static const UCHAR SiS_HiTVGroup3Simu[] = {
#if 0
static const UCHAR SiS_HiTVGroup3Text[] = {
- 0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0xa7,
+ 0x00,0x1a,0x22,0x63,0x62,0x22,0x08,0xa7,
0xf5,0x20,0xce,0xce,0x55,0x47,0x2a,0xa6,
0x25,0x2f,0x47,0xfa,0xc8,0xff,0x8e,0x20,
0x8c,0x6e,0x60,0x18,0x2c,0x0c,0x20,0x22,
@@ -875,7 +875,7 @@ static const SiS_TVDataStruct SiS_ExtPALData[] =
{ 3, 2,1080, 619,1270, 540, 438, 0, 438, 0,0xf3,0x00,0x1d,0x20}, /* 720x576 */
{ 1, 1,1170, 821,1270, 520, 686, 0, 686, 0,0xF3,0x00,0x1D,0x20}, /* 1024x768 */
{ 1, 1,1170, 821,1270, 520, 686, 0, 686, 0,0xF3,0x00,0x1D,0x20}, /* 1024x768 (for NTSC equ) */
- { 9, 4, 848, 528,1270, 530, 0, 0, 50, 0,0xf5,0xfb,0x1b,0x2a} /* 720x480 test */
+ { 9, 4, 848, 528,1270, 530, 0, 0, 50, 0,0xf5,0xfb,0x1b,0x2a} /* 720x480 */
};
static const SiS_TVDataStruct SiS_StNTSCData[] =
@@ -964,7 +964,7 @@ static const SiS_TVDataStruct SiS_Ext750pData[] =
{ 143, 70, 0x39c,0x189,0x4f6,0x1b8,0x05c, 0, 0x05c, 0, 0, 0, 0, 0},
{ 99, 32, 0x320,0x1fe,0x500,0x2d0, 50, 0, 0, 0, 0, 0, 0, 0}, /* 640x480 */
{ 5, 4, 0x5d8,0x29e,0x500,0x2a8, 50, 0, 0, 0, 0, 0, 0, 0}, /* 800x600 */
- { 99, 32, 0x320,0x1fe,0x500,0x2d0, 50, 0, 0, 0, 0, 0, 0, 0}, /* 720x480 test WORKS */
+ { 99, 32, 0x320,0x1fe,0x500,0x2d0, 50, 0, 0, 0, 0, 0, 0, 0}, /* 720x480 test WORKS */
{ 68, 64, 0x55f,0x346,0x500,0x2a8,0x27e, 0, 0, 0, 0, 0, 0, 0}, /* 1024x768 */
{ 5, 2, 0x3a7,0x226,0x500,0x2a8, 0, 1, 0, 0, 0, 0, 0, 0}, /* 720x576 */
{ 25, 24, 0x5d8,0x2f3,0x460,0x2a8, 50, 0, 0, 0, 0, 0, 0, 0} /* 1280x720 WORKS */
@@ -988,8 +988,8 @@ static const SiS_LCDDataStruct SiS_LCD1280x720Data[] = /* 2.03.00 */
/* About 1280x768: For TMDS, Panel_1280x768 will only be set if
* the panel is a Fujitsu 7911 (VL-17WDX8) (with clock 81, 1688x802)
* Other TMDS panels of this resolution will be treated as custom.
- * For LVDS, we know another type (_2).
- * (Note: 1280x768_3 is now special for SiS301/NetVista
+ * For LVDS, we know another type (_2).
+ * (Note: 1280x768_3 is now special for SiS301/NetVista
*/
static const SiS_LCDDataStruct SiS_StLCD1280x768_2Data[] = /* 2.03.00 */
@@ -1011,7 +1011,7 @@ static const SiS_LCDDataStruct SiS_ExtLCD1280x768_2Data[] = /* 2.03.00 */
{
{ 16, 5, 960, 410, 1600, 806 }, /* 640x400 */
{ 64, 21, 1152, 364, 1600, 806 },
- { 16, 5, 960, 410, 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 */
@@ -1042,9 +1042,9 @@ static const SiS_LCDDataStruct SiS_LCD1280x768_3Data[] =
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 },
+ { 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 */
@@ -1057,9 +1057,9 @@ static const SiS_LCDDataStruct SiS_LCD1280x800Data[] = /* 0.93.12a (TMDS) */
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, 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 */
@@ -1073,9 +1073,9 @@ static const SiS_LCDDataStruct SiS_LCD1280x800_2Data[] = /* 2.03.00 (LVDS) */
static const SiS_LCDDataStruct SiS_LCD1280x800_3Data[] = /* 2.02.05a (LVDS); m250 */
{
{ 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 },
+ { 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 */
@@ -1157,7 +1157,7 @@ static const SiS_LCDDataStruct SiS_StLCD1600x1200Data[] =
{ 4, 1,1080, 625, 2160, 1250 },
{ 5, 2,1350, 800, 2160, 1250 },
{135,88,1600,1100, 2160, 1250 },
- {72, 49,1680,1092, 2160, 1250 },
+ {72, 49,1680,1092, 2160, 1250 },
{ 1, 1,2160,1250, 2160, 1250 }
};
@@ -1218,29 +1218,32 @@ static const SiS_LCDDataStruct SiS_NoScaleData[] =
/* LVDS ----------------------------------------------------- */
/**************************************************************/
-static const SiS_LVDSDataStruct SiS_LVDS320x480Data_1[]=
+/* FSTN/DSTN 320x240, 2 variants */
+static const SiS_LVDSDataStruct SiS_LVDS320x240Data_1[]=
{
{ 848, 433, 400, 525},
{ 848, 389, 400, 525},
{ 848, 433, 400, 525},
{ 848, 389, 400, 525},
{ 848, 518, 400, 525},
- {1056, 628, 400, 525}
+ {1056, 628, 400, 525},
+ { 400, 525, 400, 525} /* xSTN */
};
-static const SiS_LVDSDataStruct SiS_LVDS640x480Data_1[]=
+static const SiS_LVDSDataStruct SiS_LVDS320x240Data_2[]=
{
- { 800, 445, 800, 525}, /* 800, 449, 800, 449 */
+ { 800, 445, 800, 525},
{ 800, 395, 800, 525},
{ 800, 445, 800, 525},
{ 800, 395, 800, 525},
- { 800, 525, 800, 525}
+ { 800, 525, 800, 525},
+ {1056, 628,1056, 628},
+ { 480, 525, 480, 525} /* xSTN */
};
-/* FSTN 320x240 */
-static const SiS_LVDSDataStruct SiS_LVDS640x480Data_2[]=
+static const SiS_LVDSDataStruct SiS_LVDS640x480Data_1[]=
{
- { 800, 445, 800, 525},
+ { 800, 445, 800, 525}, /* 800, 449, 800, 449 */
{ 800, 395, 800, 525},
{ 800, 445, 800, 525},
{ 800, 395, 800, 525},
@@ -1303,7 +1306,7 @@ static const SiS_LVDSDataStruct SiS_CHTVONTSCData[]=
/* CRT1 CRTC data for slave modes */
-static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT1320x480_1[] =
+static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT1320x240_1[] =
{
{{0x65,0x4f,0x89,0x56,0x83,0xaa,0x1f,
0x90,0x85,0x8f,0xab,0x30,0x00,0x05,
@@ -1328,48 +1331,7 @@ static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT1320x480_1[] =
0x00 }}
};
-static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT1640x480_1[] =
-{
- {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
- 0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
- 0x00}},
- {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
- 0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
- 0x00}},
- {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
- 0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
- 0x00}},
- {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
- 0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
- 0x00}},
- {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
- 0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
- 0x00}},
- {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0,
- 0x58,0x8c,0x57,0x73,0x20,0x00,0x06,
- 0x01}}
-};
-
-static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT1640x480_1_H[] =
-{
- {{0x2d,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
- 0x9c,0x8e,0x96,0xb9,0x00,0x00,0x00,
- 0x00}},
- {{0x2d,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
- 0x83,0x85,0x63,0xba,0x00,0x00,0x00,
- 0x00}},
- {{0x2d,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
- 0x9c,0x8e,0x96,0xb9,0x00,0x00,0x00,
- 0x00}},
- {{0x2d,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
- 0x83,0x85,0x63,0xba,0x00,0x00,0x00,
- 0x00}},
- {{0x2d,0x28,0x90,0x2c,0x80,0x0b,0x3e,
- 0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00,
- 0x00}}
-};
-
-static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT1640x480_2[] =
+static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT1320x240_2[] =
{
{{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
@@ -1389,12 +1351,17 @@ static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT1640x480_2[] =
{{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0,
0x58,0x8c,0x57,0x73,0x20,0x00,0x06,
0x01}},
+#if 0
{{0x2d,0x27,0x90,0x2c,0x80,0x0b,0x3e,
0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00,
0x00}}
+#endif
+ {{0x5f,0x4f,0x83,0x55,0x81,0x0b,0x3e,
+ 0xe9,0x8b,0xe8,0x0c,0x00,0x00,0x05,
+ 0x00}},
};
-static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT1640x480_2_H[] =
+static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT1320x240_2_H[] =
{
{{0x65,0x4f,0x89,0x56,0x83,0xaa,0x1f,
0x90,0x85,0x8f,0xab,0x30,0x00,0x05,
@@ -1419,7 +1386,7 @@ static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT1640x480_2_H[] =
0x00}}
};
-static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT1640x480_3[] =
+static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT1320x240_3[] =
{
{{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
0xe9,0x8b,0xdf,0x04,0x00,0x00,0x05,
@@ -1444,7 +1411,7 @@ static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT1640x480_3[] =
0x00}}
};
-static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT1640x480_3_H[] =
+static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT1320x240_3_H[] =
{
{{0x65,0x4f,0x89,0x56,0x83,0xaa,0x1f,
0x90,0x85,0x8f,0xab,0x30,0x00,0x05,
@@ -1469,6 +1436,47 @@ static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT1640x480_3_H[] =
0x00}}
};
+static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT1640x480_1[] =
+{
+ {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
+ 0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
+ 0x00}},
+ {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
+ 0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
+ 0x00}},
+ {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
+ 0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
+ 0x00}},
+ {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
+ 0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
+ 0x00}},
+ {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e,
+ 0xe9,0x8b,0xdf,0x04,0x30,0x00,0x05,
+ 0x00}},
+ {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0,
+ 0x58,0x8c,0x57,0x73,0x20,0x00,0x06,
+ 0x01}}
+};
+
+static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT1640x480_1_H[] =
+{
+ {{0x2d,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
+ 0x9c,0x8e,0x96,0xb9,0x00,0x00,0x00,
+ 0x00}},
+ {{0x2d,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
+ 0x83,0x85,0x63,0xba,0x00,0x00,0x00,
+ 0x00}},
+ {{0x2d,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
+ 0x9c,0x8e,0x96,0xb9,0x00,0x00,0x00,
+ 0x00}},
+ {{0x2d,0x28,0x90,0x2b,0xa0,0xbf,0x1f,
+ 0x83,0x85,0x63,0xba,0x00,0x00,0x00,
+ 0x00}},
+ {{0x2d,0x28,0x90,0x2c,0x80,0x0b,0x3e,
+ 0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00,
+ 0x00}}
+};
+
#if 0
static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT11024x600_1[] =
{
@@ -1727,17 +1735,17 @@ static const SiS_PlasmaModes SiS_PlasmaMode[] = {
720, 750, 1, 2,
SIS_PL_HSYNCP | SIS_PL_VSYNCP },
{ "720x480", /* 24: 720x480 (aka "525p" and "480p") (Panasonic) */
- 27000,
- 720, 856, 40, 32,
+ 27000,
+ 720, 856, 40, 32,
480, 525, 1, 3,
SIS_PL_HSYNCP | SIS_PL_VSYNCP },
{ "720x576", /* 25: 720x576 (aka "625p"and "576p") (Panasonic) */
- 27500,
+ 27500,
720, 864, 16, 64,
576, 625, 5, 6,
SIS_PL_HSYNCP | SIS_PL_VSYNCP },
{ "1280x720@50", /* 26: WIDE720(50) (aka "750p") (Generic) */
- 74300,
+ 74300,
1280, 1980,400, 80,
720, 750, 5, 5,
SIS_PL_HSYNCP | SIS_PL_VSYNCP },
@@ -1745,7 +1753,7 @@ static const SiS_PlasmaModes SiS_PlasmaMode[] = {
/*
27.00 720 755 791 858 480 480 484 525
-27.50 720 732 795 864 576 581 587 625
+27.50 720 732 795 864 576 581 587 625
*/
static const SiS_PlasmaTables SiS_PlasmaTable[] = {
@@ -1906,8 +1914,8 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
{ 0x34a9, 1,
{ 0xd034, 0x0000, 0x0000, 0x0000, 0x0000 },
{ "AE500U (DVI-D)", "", "", "", "" },
- "Panasonic AE500U",
- 1280, 768,
+ "Panasonic AE500U",
+ 1280, 768,
1280, 720,
1, /* 1280x720, no special modes otherwise */
{21|0xc0, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
@@ -1916,11 +1924,11 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
{ 0x34a9, 1,
{ 0xd043, 0x0000, 0x0000, 0x0000, 0x0000 },
{ "AE700U (HDMI)", "", "", "", "" },
- "Panasonic AE700U",
- 1360, 768,
+ "Panasonic AE700U",
+ 1360, 768,
1280, 720,
6, /* 1280x720/60, 1280x720/50, 1280x768@56(digital/analog), 720x480, 720x576 */
- {21|0xc0,23|0xc0,22|0x80,13|0x40,24|0x80,25|0x80, 0 , 0 , 0 , 0 ,
+ {21|0xc0,23|0xc0,22|0x80,13|0x40,24|0x80,25|0x80, 0 , 0 , 0 , 0 ,
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
},
{ 0x0000 }
@@ -1930,7 +1938,7 @@ static const SiS_PlasmaTables SiS_PlasmaTable[] = {
#ifdef LINUX_XF86
USHORT SiS_GetModeID(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay,
int Depth, BOOLEAN FSTN, int LCDwith, int LCDheight);
-#endif
+#endif
USHORT SiS_GetModeID_LCD(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth, BOOLEAN FSTN,
USHORT CustomT, int LCDwith, int LCDheight);
USHORT SiS_GetModeID_TV(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth);
@@ -1963,6 +1971,8 @@ USHORT SiS_GetOffset(SiS_Private *SiS_Pr,USHORT ModeNo, USHORT ModeIdIndex,
void SiS_LoadDAC(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo, USHORT ModeIdIndex);
void SiS_CalcLCDACRT1Timing(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,PSIS_HW_INFO HwInfo);
void SiS_CalcCRRegisters(SiS_Private *SiS_Pr, int depth);
+USHORT SiS_GetRefCRTVCLK(SiS_Private *SiS_Pr, USHORT Index, int UseWide);
+USHORT SiS_GetRefCRT1CRTC(SiS_Private *SiS_Pr, USHORT Index, int UseWide);
#ifdef LINUX_XF86
BOOLEAN SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,ScrnInfoPtr pScrn,USHORT ModeNo, BOOLEAN dosetpitch);
@@ -1976,7 +1986,7 @@ 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, BOOLEAN f2);
+DisplayModePtr SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN, BOOLEAN isfordvi, BOOLEAN f2, BOOLEAN);
int SiS_FindPanelFromDB(SISPtr pSiS, USHORT panelvendor, USHORT panelproduct, int *maxx, int *maxy, int *prefx, int *prefy);
void SiS_MakeClockRegs(ScrnInfoPtr pScrn, int clock, UCHAR *p2b, UCHAR *p2c);
#else
diff --git a/src/init301.c b/src/init301.c
index fd10b83..bb3f1e8 100644
--- a/src/init301.c
+++ b/src/init301.c
@@ -68,6 +68,10 @@
#define SET_EMI /* 302LV/ELV: Set EMI values */
#endif
+#if 1
+#define SET_PWD /* 301/302LV: Set PWD */
+#endif
+
#define COMPAL_HACK /* Needed for Compal 1400x1050 (EMI) */
#define COMPAQ_HACK /* Needed for Inventec/Compaq 1280x1024 (EMI) */
#define ASUS_HACK /* Needed for Asus A2H 1024x768 (EMI) */
@@ -142,18 +146,18 @@ GetLCDStructPtr661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
* use the BIOS data as well.
*/
- if((SiS_Pr->SiS_ROMNew) &&
+ 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);
+ romindex = SISGETROMW(0x100);
if(romindex) {
romindex += idx;
myptr = &ROMAddr[romindex];
@@ -175,9 +179,9 @@ GetLCDStructPtr661_2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
* use the BIOS data as well.
*/
- if((SiS_Pr->SiS_ROMNew) &&
+ if((SiS_Pr->SiS_ROMNew) &&
((SiS_Pr->SiS_VBType & VB_SIS301LV302LV) || (!SiS_Pr->PanelSelfDetected))) {
- romptr = SISGETROMW(0x102);
+ romptr = SISGETROMW(0x102);
romptr += ((SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) >> 4) * SiS_Pr->SiS661LCD2TableSize);
}
@@ -281,13 +285,15 @@ USHORT
SiS_GetRatePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
PSIS_HW_INFO HwInfo)
{
- SHORT LCDRefreshIndex[] = { 0x00, 0x00, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01,
- 0x00, 0x00, 0x00, 0x00 };
USHORT RRTI,i,backup_i;
USHORT modeflag,index,temp,backupindex;
+ static const SHORT LCDRefreshIndex[] = {
+ 0x00, 0x00, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01,
+ 0x00, 0x00, 0x00, 0x00
+ };
/* Do NOT check for UseCustomMode here, will skrew up FIFO */
if(ModeNo == 0xfe) return 0;
@@ -313,21 +319,21 @@ SiS_GetRatePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_SetFlag & ProgrammingCRT2) {
if(SiS_Pr->SiS_VBType & VB_SISVB) {
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
if(SiS_Pr->SiS_VBType & VB_NoLCD) index = 0;
else if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) index = backupindex = 0;
}
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
if(!(SiS_Pr->SiS_VBType & VB_NoLCD)) {
- temp = LCDRefreshIndex[SiS_GetBIOSLCDResInfo(SiS_Pr)];
- if(index > temp) index = temp;
+ temp = LCDRefreshIndex[SiS_GetBIOSLCDResInfo(SiS_Pr)];
+ if(index > temp) index = temp;
}
}
} else {
- if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) index = 0;
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) index = 0;
if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) index = 0;
- }
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) index = 0;
+ }
}
}
@@ -336,10 +342,10 @@ SiS_GetRatePtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
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) RRTI++;
- }
+ if( (SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_VESAID == 0x105) ||
+ (SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_VESAID == 0x107) ) {
+ if(backupindex <= 1) RRTI++;
+ }
}
}
@@ -355,8 +361,8 @@ 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[RRTI + i - 1].Ext_InfoFlag;
- if(temp & InterlaceMode) i++;
+ temp = SiS_Pr->SiS_RefIndex[RRTI + i - 1].Ext_InfoFlag;
+ if(temp & InterlaceMode) i++;
}
}
@@ -483,7 +489,7 @@ 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
+#endif
if(HwInfo->jChipType < SIS_315H) {
@@ -699,14 +705,10 @@ SiS_Is301B(SiS_Private *SiS_Pr)
static BOOLEAN
SiS_CRT2IsLCD(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
- USHORT flag;
-
if(HwInfo->jChipType == SIS_730) {
- flag = SiS_GetReg(SiS_Pr->SiS_P3c4,0x13);
- if(flag & 0x20) return TRUE;
+ if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x13) & 0x20) return TRUE;
}
- flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);
- if(flag & 0x20) return TRUE;
+ if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x30) & 0x20) return TRUE;
return FALSE;
}
@@ -714,12 +716,9 @@ BOOLEAN
SiS_IsDualEdge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
#ifdef SIS315H
- USHORT flag;
-
if(HwInfo->jChipType >= SIS_315H) {
if((HwInfo->jChipType != SIS_650) || (SiS_GetReg(SiS_Pr->SiS_P3d4,0x5f) & 0xf0)) {
- flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);
- if(flag & EnableDualEdge) return TRUE;
+ if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x38) & EnableDualEdge) return TRUE;
}
}
#endif
@@ -746,7 +745,7 @@ 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;
+ return FALSE;
}
#endif
@@ -803,8 +802,7 @@ SiS_IsNotM650orLater(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
USHORT flag;
if(HwInfo->jChipType == SIS_650) {
- flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x5f);
- flag &= 0xF0;
+ flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x5f) & 0xf0;
/* Check for revision != A0 only */
if((flag == 0xe0) || (flag == 0xc0) ||
(flag == 0xb0) || (flag == 0x90)) return FALSE;
@@ -817,11 +815,9 @@ SiS_IsNotM650orLater(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
static BOOLEAN
SiS_IsYPbPr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
- USHORT flag;
-
if(HwInfo->jChipType >= SIS_315H) {
- flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);
- if(flag & EnableCHYPbPr) return TRUE; /* = YPrPb = 0x08 */
+ /* YPrPb = 0x08 */
+ if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x38) & EnableCHYPbPr) return TRUE;
}
return FALSE;
}
@@ -831,11 +827,9 @@ SiS_IsYPbPr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
static BOOLEAN
SiS_IsChScart(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
- USHORT flag;
-
if(HwInfo->jChipType >= SIS_315H) {
- flag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);
- if(flag & EnableCHScart) return TRUE; /* = Scart = 0x04 */
+ /* Scart = 0x04 */
+ if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x38) & EnableCHScart) return TRUE;
}
return FALSE;
}
@@ -930,23 +924,23 @@ SiS_BridgeInSlavemode(SiS_Private *SiS_Pr)
void
SiS_SetChrontelGPIO(SiS_Private *SiS_Pr, USHORT myvbinfo)
{
- unsigned long acpibase;
- unsigned short temp;
+ ULONG acpibase;
+ USHORT temp;
if(!(SiS_Pr->SiS_ChSW)) return;
#ifdef LINUX_KERNEL
- SiS_SetRegLong(0xcf8,0x80000874); /* get ACPI base */
+ SiS_SetRegLong(0xcf8,0x80000874); /* get ACPI base */
acpibase = SiS_GetRegLong(0xcfc);
#else
acpibase = pciReadLong(0x00000800, 0x74);
#endif
acpibase &= 0xFFFF;
- temp = SiS_GetRegShort((USHORT)(acpibase + 0x3c)); /* ACPI register 0x3c: GP Event 1 I/O mode select */
+ temp = SiS_GetRegShort((USHORT)(acpibase + 0x3c)); /* ACPI register 0x3c: GP Event 1 I/O mode select */
temp &= 0xFEFF;
SiS_SetRegShort((USHORT)(acpibase + 0x3c), temp);
temp = SiS_GetRegShort((USHORT)(acpibase + 0x3c));
- temp = SiS_GetRegShort((USHORT)(acpibase + 0x3a)); /* ACPI register 0x3a: GP Pin Level (low/high) */
+ temp = SiS_GetRegShort((USHORT)(acpibase + 0x3a)); /* ACPI register 0x3a: GP Pin Level (low/high) */
temp &= 0xFEFF;
if(!(myvbinfo & SetCRT2ToTV)) temp |= 0x0100;
SiS_SetRegShort((USHORT)(acpibase + 0x3a), temp);
@@ -958,7 +952,7 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
PSIS_HW_INFO HwInfo, int checkcrt2mode)
{
USHORT tempax,tempbx,temp;
- USHORT modeflag, resinfo=0;
+ USHORT modeflag, resinfo = 0;
if(ModeNo <= 0x13) {
modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
@@ -974,28 +968,28 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_Pr->SiS_ModeType = modeflag & ModeTypeMask;
tempbx = 0;
-
+
if(SiS_BridgeIsOn(SiS_Pr)) {
-
- temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);
- tempbx |= temp;
- tempax = SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) << 8;
- tempax &= (DriverMode | LoadDACFlag | SetNotSimuMode | SetPALTV);
- tempbx |= tempax;
+
+ temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);
+ tempbx |= temp;
+ tempax = SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) << 8;
+ tempax &= (DriverMode | LoadDACFlag | SetNotSimuMode | SetPALTV);
+ tempbx |= tempax;
#ifdef SIS315H
if(HwInfo->jChipType >= SIS_315H) {
- if(SiS_Pr->SiS_VBType & VB_SISLCDA) {
+ if(SiS_Pr->SiS_VBType & VB_SISLCDA) {
if(ModeNo == 0x03) {
- /* Mode 0x03 is never in driver mode */
+ /* 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 if not driver mode */
+ /* Reset LCDA setting if not driver mode */
SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x38,0xfc);
}
if(IS_SIS650) {
- if(SiS_Pr->SiS_UseLCDA) {
+ if(SiS_Pr->SiS_UseLCDA) {
if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x5f) & 0xF0) {
if((ModeNo <= 0x13) || (!(SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) & (DriverMode >> 8)))) {
SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x38,(EnableDualEdge | SetToLCDA));
@@ -1004,21 +998,21 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
}
temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);
- if((temp & (EnableDualEdge | SetToLCDA)) == (EnableDualEdge | SetToLCDA)) {
- tempbx |= SetCRT2ToLCDA;
+ if((temp & (EnableDualEdge | SetToLCDA)) == (EnableDualEdge | SetToLCDA)) {
+ tempbx |= SetCRT2ToLCDA;
}
}
if(HwInfo->jChipType >= SIS_661) { /* New CR layout */
tempbx &= ~(SetCRT2ToYPbPr525750 | SetCRT2ToHiVision);
if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x38) & 0x04) {
- temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35) & 0xe0;
+ temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35) & 0xe0;
if(temp == 0x60) tempbx |= SetCRT2ToHiVision;
- else if(SiS_Pr->SiS_VBType & VB_SISYPBPR) {
+ else if(SiS_Pr->SiS_VBType & VB_SISYPBPR) {
tempbx |= SetCRT2ToYPbPr525750;
- }
+ }
}
- }
+ }
if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38);
@@ -1039,44 +1033,44 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
tempbx &= ~(SetCRT2ToRAMDAC);
}
- if(SiS_Pr->SiS_VBType & VB_SISVB) {
+ if(SiS_Pr->SiS_VBType & VB_SISVB) {
temp = SetCRT2ToSVIDEO |
- SetCRT2ToAVIDEO |
- SetCRT2ToSCART |
- SetCRT2ToLCDA |
- SetCRT2ToLCD |
- SetCRT2ToRAMDAC |
- SetCRT2ToHiVision |
+ SetCRT2ToAVIDEO |
+ SetCRT2ToSCART |
+ SetCRT2ToLCDA |
+ SetCRT2ToLCD |
+ SetCRT2ToRAMDAC |
+ SetCRT2ToHiVision |
SetCRT2ToYPbPr525750;
- } else {
- if(HwInfo->jChipType >= SIS_315H) {
- if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
- temp = SetCRT2ToAVIDEO |
+ } else {
+ if(HwInfo->jChipType >= SIS_315H) {
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
+ temp = SetCRT2ToAVIDEO |
SetCRT2ToSVIDEO |
SetCRT2ToSCART |
SetCRT2ToLCDA |
SetCRT2ToLCD |
SetCRT2ToCHYPbPr;
- } else {
- temp = SetCRT2ToLCDA |
+ } else {
+ temp = SetCRT2ToLCDA |
SetCRT2ToLCD;
}
} else {
- if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
- temp = SetCRT2ToTV | SetCRT2ToLCD;
- } else {
- temp = SetCRT2ToLCD;
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
+ temp = SetCRT2ToTV | SetCRT2ToLCD;
+ } else {
+ temp = SetCRT2ToLCD;
}
}
- }
+ }
- if(!(tempbx & temp)) {
- tempax = DisableCRT2Display;
- tempbx = 0;
- }
+ if(!(tempbx & temp)) {
+ tempax = DisableCRT2Display;
+ tempbx = 0;
+ }
+
+ if(SiS_Pr->SiS_VBType & VB_SISVB) {
- if(SiS_Pr->SiS_VBType & VB_SISVB) {
-
USHORT clearmask = ( DriverMode |
DisableCRT2Display |
LoadDACFlag |
@@ -1085,84 +1079,84 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SetPALTV |
SwitchCRT2 |
SetSimuScanMode );
-
- if(tempbx & SetCRT2ToLCDA) tempbx &= (clearmask | SetCRT2ToLCDA);
+
+ if(tempbx & SetCRT2ToLCDA) tempbx &= (clearmask | SetCRT2ToLCDA);
if(tempbx & SetCRT2ToRAMDAC) tempbx &= (clearmask | SetCRT2ToRAMDAC);
if(tempbx & SetCRT2ToLCD) tempbx &= (clearmask | SetCRT2ToLCD);
if(tempbx & SetCRT2ToSCART) tempbx &= (clearmask | SetCRT2ToSCART);
if(tempbx & SetCRT2ToHiVision) tempbx &= (clearmask | SetCRT2ToHiVision);
if(tempbx & SetCRT2ToYPbPr525750) tempbx &= (clearmask | SetCRT2ToYPbPr525750);
-
- } else {
-
+
+ } else {
+
if(HwInfo->jChipType >= SIS_315H) {
if(tempbx & SetCRT2ToLCDA) {
- tempbx &= (0xFF00|SwitchCRT2|SetSimuScanMode);
+ tempbx &= (0xFF00|SwitchCRT2|SetSimuScanMode);
}
}
- if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
- if(tempbx & SetCRT2ToTV) {
- tempbx &= (0xFF00|SetCRT2ToTV|SwitchCRT2|SetSimuScanMode);
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
+ if(tempbx & SetCRT2ToTV) {
+ tempbx &= (0xFF00|SetCRT2ToTV|SwitchCRT2|SetSimuScanMode);
}
- }
- if(tempbx & SetCRT2ToLCD) {
- tempbx &= (0xFF00|SetCRT2ToLCD|SwitchCRT2|SetSimuScanMode);
+ }
+ if(tempbx & SetCRT2ToLCD) {
+ tempbx &= (0xFF00|SetCRT2ToLCD|SwitchCRT2|SetSimuScanMode);
}
if(HwInfo->jChipType >= SIS_315H) {
if(tempbx & SetCRT2ToLCDA) {
tempbx |= SetCRT2ToLCD;
}
}
-
+
}
- if(tempax & DisableCRT2Display) {
- if(!(tempbx & (SwitchCRT2 | SetSimuScanMode))) {
- tempbx = SetSimuScanMode | DisableCRT2Display;
- }
- }
+ if(tempax & DisableCRT2Display) {
+ if(!(tempbx & (SwitchCRT2 | SetSimuScanMode))) {
+ tempbx = SetSimuScanMode | DisableCRT2Display;
+ }
+ }
- if(!(tempbx & DriverMode)) tempbx |= SetSimuScanMode;
+ if(!(tempbx & DriverMode)) tempbx |= SetSimuScanMode;
/* LVDS/CHRONTEL (LCD/TV) and 301BDH (LCD) can only be slave in 8bpp modes */
if(SiS_Pr->SiS_ModeType <= ModeVGA) {
if( (SiS_Pr->SiS_IF_DEF_LVDS == 1) ||
((SiS_Pr->SiS_VBType & VB_NoLCD) && (tempbx & SetCRT2ToLCD)) ) {
- modeflag &= (~CRT2Mode);
+ modeflag &= (~CRT2Mode);
}
}
- if(!(tempbx & SetSimuScanMode)) {
- if(tempbx & SwitchCRT2) {
- if((!(modeflag & CRT2Mode)) && (checkcrt2mode)) {
+ if(!(tempbx & SetSimuScanMode)) {
+ if(tempbx & SwitchCRT2) {
+ if((!(modeflag & CRT2Mode)) && (checkcrt2mode)) {
if(resinfo != SIS_RI_1600x1200) {
- tempbx |= SetSimuScanMode;
+ tempbx |= SetSimuScanMode;
}
}
- } else {
- if(SiS_BridgeIsEnabled(SiS_Pr,HwInfo)) {
- if(!(tempbx & DriverMode)) {
- if(SiS_BridgeInSlavemode(SiS_Pr)) {
+ } else {
+ if(SiS_BridgeIsEnabled(SiS_Pr,HwInfo)) {
+ if(!(tempbx & DriverMode)) {
+ if(SiS_BridgeInSlavemode(SiS_Pr)) {
tempbx |= SetSimuScanMode;
- }
- }
- }
- }
- }
+ }
+ }
+ }
+ }
+ }
- if(!(tempbx & DisableCRT2Display)) {
- if(tempbx & DriverMode) {
- if(tempbx & SetSimuScanMode) {
- if((!(modeflag & CRT2Mode)) && (checkcrt2mode)) {
- if(resinfo != SIS_RI_1600x1200) {
+ if(!(tempbx & DisableCRT2Display)) {
+ if(tempbx & DriverMode) {
+ if(tempbx & SetSimuScanMode) {
+ if((!(modeflag & CRT2Mode)) && (checkcrt2mode)) {
+ if(resinfo != SIS_RI_1600x1200) {
tempbx |= SetInSlaveMode;
}
- }
- }
- } else {
- tempbx |= SetInSlaveMode;
- }
- }
+ }
+ }
+ } else {
+ tempbx |= SetInSlaveMode;
+ }
+ }
}
@@ -1425,7 +1419,7 @@ SiS_SetTVMode(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, PSIS_HW_IN
#ifdef TWDEBUG
xf86DrvMsg(0, X_INFO, "(init301: TVMode %x, VBInfo %x)\n", SiS_Pr->SiS_TVMode, SiS_Pr->SiS_VBInfo);
-#endif
+#endif
}
/*********************************************/
@@ -1437,7 +1431,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_2) temp = Panel_1280x768;
if(temp == Panel_1280x800_2) temp = Panel_1280x800;
return temp;
}
@@ -1447,17 +1441,17 @@ SiS_GetLCDInfoBIOS(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
#ifdef SIS315H
UCHAR *ROMAddr;
- USHORT temp;
-
+ 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->PanelHT, SiS_Pr->PanelVT,
SiS_Pr->PanelHRS, SiS_Pr->PanelHRE,
- SiS_Pr->PanelVRS, SiS_Pr->PanelVRE,
+ 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_A,
SiS_Pr->SiS_VBVCLKData[SiS_Pr->PanelVCLKIdx315].Part4_B);
-#endif
+#endif
if((ROMAddr = GetLCDStructPtr661(SiS_Pr, HwInfo))) {
if((temp = SISGETROMW(6)) != SiS_Pr->PanelHT) {
@@ -1479,16 +1473,16 @@ SiS_GetLCDInfoBIOS(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_Pr->SiS_VBVCLKData[VCLK_CUSTOM_315].Part4_A = ROMAddr[19];
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->PanelHT, SiS_Pr->PanelVT,
SiS_Pr->PanelHRS, SiS_Pr->PanelHRE,
- SiS_Pr->PanelVRS, SiS_Pr->PanelVRE,
+ 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_A,
SiS_Pr->SiS_VBVCLKData[SiS_Pr->PanelVCLKIdx315].Part4_B);
-#endif
+#endif
}
#endif
@@ -1521,7 +1515,7 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
#endif
#ifdef SIS315H
UCHAR *myptr = NULL;
-#endif
+#endif
USHORT temp,modeflag,resinfo=0,modexres=0,modeyres=0;
BOOLEAN panelcanscale = FALSE;
@@ -1533,7 +1527,7 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_Pr->PanelVRS = 999; /* VSync start */
SiS_Pr->PanelVRE = 999; /* VSync end */
SiS_Pr->SiS_NeedRomModeData = FALSE;
-
+
/* Alternative 1600x1200@60 timing for 1600x1200 LCDA */
SiS_Pr->Alternate1600x1200 = FALSE;
@@ -1551,7 +1545,7 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36);
-
+
/* For broken BIOSes: Assume 1024x768 */
if(temp == 0) temp = 0x02;
@@ -1563,7 +1557,7 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_Pr->SiS_LCDTypeInfo = (temp & 0x0F) - 1;
}
temp &= 0x0f;
-#ifdef SIS300
+#ifdef SIS300
if(HwInfo->jChipType < SIS_315H) {
/* Very old BIOSes only know 7 sizes (NetVista 2179, 1.01g) */
if(SiS_Pr->SiS_VBType & VB_SIS301) {
@@ -1576,8 +1570,9 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
/* 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 (temp == Panel310_1152x768) temp = Panel_320x240_2; /* Verified working */
+ else if(temp == Panel310_320x240_2) temp = Panel_320x240_2;
+ else if(temp == Panel310_320x240_3) temp = Panel_320x240_3;
}
if(SiS_Pr->SiS_VBType & VB_SISLVDS) { /* SiS LVDS */
@@ -1589,11 +1584,11 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
temp = Panel_1280x800_2;
}
}
- }
+ }
SiS_Pr->SiS_LCDResInfo = temp;
-#ifdef SIS300
+#ifdef SIS300
if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
if(SiS_Pr->SiS_CustomT == CUT_BARCO1366) {
SiS_Pr->SiS_LCDResInfo = Panel_Barco1366;
@@ -1610,17 +1605,20 @@ 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! */
-
+
/* These can't scale no matter what */
switch(SiS_Pr->SiS_LCDResInfo) {
- case Panel_1280x960:
+ case Panel_320x240_1:
+ case Panel_320x240_2:
+ case Panel_320x240_3:
+ case Panel_1280x960:
SiS_Pr->SiS_LCDInfo &= ~DontExpandLCD;
}
-
+
panelcanscale = (SiS_Pr->SiS_LCDInfo & DontExpandLCD) ? TRUE : FALSE;
if(!SiS_Pr->UsePanelScaler) SiS_Pr->SiS_LCDInfo &= ~DontExpandLCD;
@@ -1639,7 +1637,7 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(myptr[2] & 0x01) SiS_Pr->SiS_LCDInfo |= LCDDualLink;
}
}
- } else if(HwInfo->jChipType >= SIS_315H) {
+ } 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;
}
@@ -1686,19 +1684,15 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_Pr->PanelVCLKIdx315 = VCLK108_2_315;
switch(SiS_Pr->SiS_LCDResInfo) {
- case Panel_320x480: SiS_Pr->PanelXRes = 320; SiS_Pr->PanelYRes = 480;
- SiS_Pr->PanelHT = 400; SiS_Pr->PanelVT = 525;
- SiS_Pr->PanelVCLKIdx300 = VCLK28;
- SiS_Pr->PanelVCLKIdx315 = VCLK28;
- break;
- case Panel_640x480_2:
- case Panel_640x480_3: SiS_Pr->PanelXRes = 640; SiS_Pr->PanelYRes = 480;
- SiS_Pr->PanelVRS = 24; SiS_Pr->PanelVRE = 3;
+ case Panel_320x240_1:
+ case Panel_320x240_2:
+ case Panel_320x240_3: SiS_Pr->PanelXRes = 640; SiS_Pr->PanelYRes = 480;
+ SiS_Pr->PanelVRS = 24; SiS_Pr->PanelVRE = 3;
SiS_Pr->PanelVCLKIdx300 = VCLK28;
SiS_Pr->PanelVCLKIdx315 = VCLK28;
break;
case Panel_640x480: SiS_Pr->PanelXRes = 640; SiS_Pr->PanelYRes = 480;
- SiS_Pr->PanelVRE = 3;
+ SiS_Pr->PanelVRE = 3;
SiS_Pr->PanelVCLKIdx300 = VCLK28;
SiS_Pr->PanelVCLKIdx315 = VCLK28;
break;
@@ -1707,42 +1701,42 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_Pr->PanelHRS = 40; SiS_Pr->PanelHRE = 128;
SiS_Pr->PanelVRS = 1; SiS_Pr->PanelVRE = 4;
SiS_Pr->PanelVCLKIdx300 = VCLK40;
- SiS_Pr->PanelVCLKIdx315 = VCLK40;
+ SiS_Pr->PanelVCLKIdx315 = VCLK40;
break;
case Panel_1024x600: SiS_Pr->PanelXRes = 1024; SiS_Pr->PanelYRes = 600;
- SiS_Pr->PanelHT = 1344; SiS_Pr->PanelVT = 800;
+ SiS_Pr->PanelHT = 1344; SiS_Pr->PanelVT = 800;
SiS_Pr->PanelHRS = 24; SiS_Pr->PanelHRE = 136;
SiS_Pr->PanelVRS = 2 /* 88 */ ; SiS_Pr->PanelVRE = 6;
- SiS_Pr->PanelVCLKIdx300 = VCLK65_300;
- SiS_Pr->PanelVCLKIdx315 = VCLK65_315;
- break;
+ SiS_Pr->PanelVCLKIdx300 = VCLK65_300;
+ SiS_Pr->PanelVCLKIdx315 = VCLK65_315;
+ break;
case Panel_1024x768: SiS_Pr->PanelXRes = 1024; SiS_Pr->PanelYRes = 768;
- SiS_Pr->PanelHT = 1344; SiS_Pr->PanelVT = 806;
+ SiS_Pr->PanelHT = 1344; SiS_Pr->PanelVT = 806;
SiS_Pr->PanelHRS = 24; SiS_Pr->PanelHRE = 136;
SiS_Pr->PanelVRS = 3; SiS_Pr->PanelVRE = 6;
if(HwInfo->jChipType < SIS_315H) {
SiS_Pr->PanelHRS = 23;
- SiS_Pr->PanelVRE = 5;
+ SiS_Pr->PanelVRE = 5;
}
SiS_Pr->PanelVCLKIdx300 = VCLK65_300;
SiS_Pr->PanelVCLKIdx315 = VCLK65_315;
SiS_GetLCDInfoBIOS(SiS_Pr, HwInfo);
break;
case Panel_1152x768: SiS_Pr->PanelXRes = 1152; SiS_Pr->PanelYRes = 768;
- SiS_Pr->PanelHT = 1344; SiS_Pr->PanelVT = 806;
+ SiS_Pr->PanelHT = 1344; SiS_Pr->PanelVT = 806;
SiS_Pr->PanelHRS = 24; SiS_Pr->PanelHRE = 136;
SiS_Pr->PanelVRS = 3; SiS_Pr->PanelVRE = 6;
if(HwInfo->jChipType < SIS_315H) {
SiS_Pr->PanelHRS = 23;
- SiS_Pr->PanelVRE = 5;
+ SiS_Pr->PanelVRE = 5;
}
- SiS_Pr->PanelVCLKIdx300 = VCLK65_300;
+ SiS_Pr->PanelVCLKIdx300 = VCLK65_300;
SiS_Pr->PanelVCLKIdx315 = VCLK65_315;
- break;
+ break;
case Panel_1152x864: SiS_Pr->PanelXRes = 1152; SiS_Pr->PanelYRes = 864;
- break;
+ break;
case Panel_1280x720: SiS_Pr->PanelXRes = 1280; SiS_Pr->PanelYRes = 720;
- SiS_Pr->PanelHT = 1650; SiS_Pr->PanelVT = 750;
+ SiS_Pr->PanelHT = 1650; SiS_Pr->PanelVT = 750;
SiS_Pr->PanelHRS = 110; SiS_Pr->PanelHRE = 40;
SiS_Pr->PanelVRS = 5; SiS_Pr->PanelVRE = 5;
SiS_Pr->PanelVCLKIdx315 = VCLK_1280x720;
@@ -1750,12 +1744,12 @@ 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;
- if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
+ 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->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;
@@ -1763,37 +1757,37 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
break;
case Panel_1280x768_2: SiS_Pr->PanelXRes = 1280; SiS_Pr->PanelYRes = 768;
- SiS_Pr->PanelHT = 1660; SiS_Pr->PanelVT = 806;
+ 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;
+ 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->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;
+ 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->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;
- SiS_Pr->PanelHT = 1800; SiS_Pr->PanelVT = 1000;
+ SiS_Pr->PanelHT = 1800; SiS_Pr->PanelVT = 1000;
SiS_Pr->PanelVCLKIdx300 = VCLK108_3_300;
SiS_Pr->PanelVCLKIdx315 = VCLK108_3_315;
- if(resinfo == SIS_RI_1280x1024) {
+ if(resinfo == SIS_RI_1280x1024) {
SiS_Pr->PanelVCLKIdx300 = VCLK100_300;
SiS_Pr->PanelVCLKIdx315 = VCLK100_315;
}
break;
case Panel_1280x1024: SiS_Pr->PanelXRes = 1280; SiS_Pr->PanelYRes = 1024;
- SiS_Pr->PanelHT = 1688; SiS_Pr->PanelVT = 1066;
+ SiS_Pr->PanelHT = 1688; SiS_Pr->PanelVT = 1066;
SiS_Pr->PanelHRS = 48; SiS_Pr->PanelHRE = 112;
SiS_Pr->PanelVRS = 1; SiS_Pr->PanelVRE = 3;
SiS_Pr->PanelVCLKIdx300 = VCLK108_3_300;
@@ -1801,20 +1795,20 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_GetLCDInfoBIOS(SiS_Pr, HwInfo);
break;
case Panel_1400x1050: SiS_Pr->PanelXRes = 1400; SiS_Pr->PanelYRes = 1050;
- SiS_Pr->PanelHT = 1688; SiS_Pr->PanelVT = 1066;
- SiS_Pr->PanelHRS = 48; SiS_Pr->PanelHRE = 112;
+ SiS_Pr->PanelHT = 1688; SiS_Pr->PanelVT = 1066;
+ SiS_Pr->PanelHRS = 48; SiS_Pr->PanelHRE = 112;
SiS_Pr->PanelVRS = 1; SiS_Pr->PanelVRE = 3;
SiS_Pr->PanelVCLKIdx315 = VCLK108_2_315;
SiS_GetLCDInfoBIOS(SiS_Pr, HwInfo);
break;
case Panel_1600x1200: SiS_Pr->PanelXRes = 1600; SiS_Pr->PanelYRes = 1200;
- SiS_Pr->PanelHT = 2160; SiS_Pr->PanelVT = 1250;
+ SiS_Pr->PanelHT = 2160; SiS_Pr->PanelVT = 1250;
SiS_Pr->PanelHRS = 64; SiS_Pr->PanelHRE = 192;
SiS_Pr->PanelVRS = 1; SiS_Pr->PanelVRE = 3;
SiS_Pr->PanelVCLKIdx315 = VCLK162_315;
if((HwInfo->jChipType < SIS_661) && (SiS_Pr->SiS_VBType & VB_SISTMDSLCDA)) {
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
- SiS_Pr->PanelHT = 1760; SiS_Pr->PanelVT = 1235;
+ SiS_Pr->PanelHT = 1760; SiS_Pr->PanelVT = 1235;
SiS_Pr->PanelHRS = 48; SiS_Pr->PanelHRE = 32;
SiS_Pr->PanelVRS = 2; SiS_Pr->PanelVRE = 4;
SiS_Pr->PanelVCLKIdx315 = VCLK130_315;
@@ -1828,25 +1822,25 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_GetLCDInfoBIOS(SiS_Pr, HwInfo);
break;
case Panel_1680x1050: SiS_Pr->PanelXRes = 1680; SiS_Pr->PanelYRes = 1050;
- SiS_Pr->PanelHT = 1900; SiS_Pr->PanelVT = 1066;
+ SiS_Pr->PanelHT = 1900; SiS_Pr->PanelVT = 1066;
SiS_Pr->PanelHRS = 26; SiS_Pr->PanelHRE = 76;
SiS_Pr->PanelVRS = 3; SiS_Pr->PanelVRE = 6;
SiS_Pr->PanelVCLKIdx315 = VCLK121_315;
SiS_GetLCDInfoBIOS(SiS_Pr, HwInfo);
break;
case Panel_Barco1366: SiS_Pr->PanelXRes = 1360; SiS_Pr->PanelYRes = 1024;
- SiS_Pr->PanelHT = 1688; SiS_Pr->PanelVT = 1066;
- break;
+ 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;
+ 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->PanelYRes = SiS_Pr->CP_MaxY;
SiS_Pr->PanelHT = SiS_Pr->CHTotal;
SiS_Pr->PanelVT = SiS_Pr->CVTotal;
if(SiS_Pr->CP_PreferredIndex != -1) {
SiS_Pr->PanelXRes = SiS_Pr->CP_HDisplay[SiS_Pr->CP_PreferredIndex];
- SiS_Pr->PanelYRes = SiS_Pr->CP_VDisplay[SiS_Pr->CP_PreferredIndex];
+ SiS_Pr->PanelYRes = SiS_Pr->CP_VDisplay[SiS_Pr->CP_PreferredIndex];
SiS_Pr->PanelHT = SiS_Pr->CP_HTotal[SiS_Pr->CP_PreferredIndex];
SiS_Pr->PanelVT = SiS_Pr->CP_VTotal[SiS_Pr->CP_PreferredIndex];
SiS_Pr->PanelHRS = SiS_Pr->CP_HSyncStart[SiS_Pr->CP_PreferredIndex];
@@ -1863,20 +1857,20 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
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;
+ 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;
default: SiS_Pr->PanelXRes = 1024; SiS_Pr->PanelYRes = 768;
- SiS_Pr->PanelHT = 1344; SiS_Pr->PanelVT = 806;
+ SiS_Pr->PanelHT = 1344; SiS_Pr->PanelVT = 806;
break;
- }
-
+ }
+
/* Special cases */
if( (SiS_Pr->SiS_IF_DEF_FSTN) ||
(SiS_Pr->SiS_IF_DEF_DSTN) ||
@@ -1896,29 +1890,29 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
/* 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 (LCD=CRT2)*/
SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
}
-
+
switch(SiS_Pr->SiS_LCDResInfo) {
-
+
case Panel_Custom:
case Panel_1152x864:
case Panel_1280x768: /* TMDS only */
- SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
+ SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
break;
-
+
case Panel_800x600: {
- static const UCHAR nonscalingmodes[] = {
+ static const UCHAR nonscalingmodes[] = {
SIS_RI_720x480, SIS_RI_720x576, SIS_RI_768x576, SIS_RI_800x480, 0xff
};
SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
break;
}
case Panel_1024x768: {
- static const UCHAR nonscalingmodes[] = {
+ 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_960x600, SIS_RI_1024x576,SIS_RI_1024x600,
0xff
@@ -1927,7 +1921,7 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
break;
}
case Panel_1280x720: {
- static const UCHAR nonscalingmodes[] = {
+ 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_960x600, SIS_RI_1024x576,SIS_RI_1024x600,
0xff
@@ -1939,7 +1933,7 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
break;
}
case Panel_1280x768_2: { /* LVDS only */
- static const UCHAR nonscalingmodes[] = {
+ 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_960x600, SIS_RI_1024x576,SIS_RI_1024x600,
SIS_RI_1152x768,0xff
@@ -1951,19 +1945,19 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
break;
}
- break;
- }
+ break;
+ }
case Panel_1280x800: { /* SiS TMDS special (Averatec 6200 series) */
- static const UCHAR nonscalingmodes[] = {
+ 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_960x600, SIS_RI_1024x576,SIS_RI_1024x600,
SIS_RI_1152x768,SIS_RI_1280x720,SIS_RI_1280x768,0xff
};
SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
- break;
+ break;
}
case Panel_1280x800_2: { /* SiS LVDS */
- static const UCHAR nonscalingmodes[] = {
+ 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_960x600, SIS_RI_1024x576,SIS_RI_1024x600,
SIS_RI_1152x768,0xff
@@ -1976,20 +1970,20 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
break;
}
- break;
+ break;
}
case Panel_1280x960: {
- static const UCHAR nonscalingmodes[] = {
+ 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_960x600, 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;
+ break;
}
case Panel_1280x1024: {
- static const UCHAR nonscalingmodes[] = {
+ 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_960x600, SIS_RI_1024x576,SIS_RI_1024x600,
SIS_RI_1152x768,SIS_RI_1152x864,SIS_RI_1280x720,SIS_RI_1280x768,SIS_RI_1280x800,
@@ -1999,7 +1993,7 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
break;
}
case Panel_1400x1050: {
- static const UCHAR nonscalingmodes[] = {
+ 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_960x600, SIS_RI_1024x576,SIS_RI_1024x600,
SIS_RI_1152x768,SIS_RI_1152x864,SIS_RI_1280x768,SIS_RI_1280x800,SIS_RI_1280x960,
@@ -2008,11 +2002,11 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
switch(resinfo) {
case SIS_RI_1280x720: if(SiS_Pr->UsePanelScaler == -1) {
- SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
- }
- break;
+ SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
+ }
+ break;
case SIS_RI_1280x1024: SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
- break;
+ break;
}
break;
}
@@ -2024,12 +2018,12 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SIS_RI_1280x960,SIS_RI_1360x768,SIS_RI_1360x1024,0xff
};
SiS_CheckScaling(SiS_Pr, resinfo, nonscalingmodes);
- break;
+ 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_960x600, SIS_RI_1024x576,SIS_RI_1024x600,
+ 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_960x600, SIS_RI_1024x576,SIS_RI_1024x600,
SIS_RI_1152x768,SIS_RI_1152x864,SIS_RI_1280x960,SIS_RI_1360x768,SIS_RI_1360x1024,
0xff
};
@@ -2038,11 +2032,11 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
}
}
-
-#ifdef SIS300
+
+#ifdef SIS300
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) */
+ SiS_Pr->SiS_LCDInfo = 0x80 | 0x40 | 0x20; /* neg h/v sync, RGB24(D0 = 0) */
}
}
@@ -2050,29 +2044,29 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
if(SiS_Pr->SiS_UseROM) {
if((ROMAddr[0x233] == 0x12) && (ROMAddr[0x234] == 0x34)) {
- if(!(ROMAddr[0x235] & 0x02)) {
- SiS_Pr->SiS_LCDInfo &= (~DontExpandLCD);
- }
+ if(!(ROMAddr[0x235] & 0x02)) {
+ SiS_Pr->SiS_LCDInfo &= (~DontExpandLCD);
+ }
}
}
} else if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
if((SiS_Pr->SiS_SetFlag & SetDOSMode) && ((ModeNo == 0x03) || (ModeNo == 0x10))) {
- SiS_Pr->SiS_LCDInfo &= (~DontExpandLCD);
+ SiS_Pr->SiS_LCDInfo &= (~DontExpandLCD);
}
}
}
#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);
}
-
+
switch(SiS_Pr->SiS_LCDResInfo) {
case Panel_640x480:
SiS_Pr->SiS_LCDInfo |= LCDPass11;
@@ -2080,18 +2074,18 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
case Panel_1280x800:
/* Don't pass 1:1 by default (TMDS special) */
if(SiS_Pr->CenterScreen == -1) SiS_Pr->SiS_LCDInfo &= ~LCDPass11;
- break;
+ break;
case Panel_1280x960:
SiS_Pr->SiS_LCDInfo &= ~LCDPass11;
break;
case Panel_Custom:
- if((!SiS_Pr->CP_PrefClock) ||
+ 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_CustomT == CUT_UNKNOWNLCD)) {
SiS_Pr->SiS_LCDInfo |= (DontExpandLCD | LCDPass11);
}
@@ -2108,12 +2102,12 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_IF_DEF_TRUMPION == 0) {
if(ModeNo == 0x12) {
if(SiS_Pr->SiS_LCDInfo & LCDPass11) {
- SiS_Pr->SiS_SetFlag |= EnableLVDSDDA;
+ 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)) {
+ if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) {
+ if((resinfo == SIS_RI_800x600) || (resinfo == SIS_RI_400x300)) {
SiS_Pr->SiS_SetFlag |= EnableLVDSDDA;
}
}
@@ -2123,18 +2117,18 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
if(modeflag & HalfDCLK) {
- if(SiS_Pr->SiS_IF_DEF_TRUMPION == 1) {
+ if(SiS_Pr->SiS_IF_DEF_TRUMPION == 1) {
SiS_Pr->SiS_SetFlag |= EnableLVDSDDA;
- } else if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
+ } 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_800x600) {
- if(resinfo == SIS_RI_400x300) SiS_Pr->SiS_SetFlag |= EnableLVDSDDA;
- }
+ if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) {
+ if(resinfo == SIS_RI_512x384) SiS_Pr->SiS_SetFlag |= EnableLVDSDDA;
+ } else if(SiS_Pr->SiS_LCDResInfo == Panel_800x600) {
+ if(resinfo == SIS_RI_400x300) SiS_Pr->SiS_SetFlag |= EnableLVDSDDA;
+ }
}
}
@@ -2143,7 +2137,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;
+ SiS_Pr->SiS_SetFlag |= LCDVESATiming;
}
} else {
SiS_Pr->SiS_SetFlag |= LCDVESATiming;
@@ -2157,7 +2151,7 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
#endif
#ifdef LINUX_XF86
xf86DrvMsgVerb(0, X_PROBED, 4,
- "(init301: LCDInfo=0x%04x LCDResInfo=0x%02x LCDTypeInfo=0x%02x SetFlag=0x%04x)\n",
+ "(init301: LCDInfo=0x%04x LCDResInfo=0x%02x LCDTypeInfo=0x%02x SetFlag=0x%04x)\n",
SiS_Pr->SiS_LCDInfo, SiS_Pr->SiS_LCDResInfo, SiS_Pr->SiS_LCDTypeInfo, SiS_Pr->SiS_SetFlag);
#endif
}
@@ -2170,8 +2164,8 @@ USHORT
SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
USHORT RefreshRateTableIndex, PSIS_HW_INFO HwInfo)
{
- USHORT CRT2Index,VCLKIndex=0,VCLKIndexGEN=0;
- USHORT modeflag,resinfo,tempbx;
+ USHORT CRT2Index, VCLKIndex = 0, VCLKIndexGEN = 0, VCLKIndexGENCRT = 0;
+ USHORT modeflag, resinfo, tempbx;
const UCHAR *CHTVVCLKPtr = NULL;
if(ModeNo <= 0x13) {
@@ -2179,31 +2173,33 @@ SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo;
CRT2Index = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
VCLKIndexGEN = (SiS_GetRegByte((SiS_Pr->SiS_P3ca+0x02)) >> 2) & 0x03;
+ VCLKIndexGENCRT = VCLKIndexGEN;
} else {
modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
CRT2Index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
VCLKIndexGEN = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK;
+ VCLKIndexGENCRT = SiS_GetRefCRTVCLK(SiS_Pr, RefreshRateTableIndex,
+ (SiS_Pr->SiS_SetFlag & ProgrammingCRT2) ? SiS_Pr->SiS_UseWideCRT2 : SiS_Pr->SiS_UseWide);
}
if(SiS_Pr->SiS_VBType & VB_SISVB) { /* 30x/B/LV */
if(SiS_Pr->SiS_SetFlag & ProgrammingCRT2) {
- CRT2Index >>= 6;
- if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { /* LCD */
+ CRT2Index >>= 6;
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) { /* LCD */
- if(HwInfo->jChipType < SIS_315H) {
+ if(HwInfo->jChipType < SIS_315H) {
VCLKIndex = SiS_Pr->PanelVCLKIdx300;
if((SiS_Pr->SiS_LCDInfo & DontExpandLCD) && (SiS_Pr->SiS_LCDInfo & LCDPass11)) {
- VCLKIndex = VCLKIndexGEN;
+ VCLKIndex = VCLKIndexGEN;
}
} else {
VCLKIndex = SiS_Pr->PanelVCLKIdx315;
if((SiS_Pr->SiS_LCDInfo & DontExpandLCD) && (SiS_Pr->SiS_LCDInfo & LCDPass11)) {
switch(resinfo) {
- /* Only those whose IndexGEN doesn't match VBVCLK array */
- case SIS_RI_1280x720: VCLKIndex = VCLK_1280x720; break;
+ /* Correct those whose IndexGEN doesn't match VBVCLK array */
case SIS_RI_720x480: VCLKIndex = VCLK_720x480; break;
case SIS_RI_720x576: VCLKIndex = VCLK_720x576; break;
case SIS_RI_768x576: VCLKIndex = VCLK_768x576; break;
@@ -2212,14 +2208,15 @@ SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
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_1280x720: VCLKIndex = VCLK_1280x720; 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;
- } else {
+ } else {
if(SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC == 1) VCLKIndex = 0x00;
}
}
@@ -2231,25 +2228,25 @@ SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
}
- } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { /* TV */
+ } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { /* TV */
if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
- if(SiS_Pr->SiS_TVMode & TVRPLLDIV2XO) VCLKIndex = HiTVVCLKDIV2;
- else VCLKIndex = HiTVVCLK;
- if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) VCLKIndex = HiTVSimuVCLK;
- } else if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) VCLKIndex = YPbPr750pVCLK;
+ if(SiS_Pr->SiS_TVMode & TVRPLLDIV2XO) VCLKIndex = HiTVVCLKDIV2;
+ else VCLKIndex = HiTVVCLK;
+ if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) VCLKIndex = HiTVSimuVCLK;
+ } else if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) VCLKIndex = YPbPr750pVCLK;
else if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) VCLKIndex = TVVCLKDIV2;
else if(SiS_Pr->SiS_TVMode & TVRPLLDIV2XO) VCLKIndex = TVVCLKDIV2;
- else VCLKIndex = TVVCLK;
+ else VCLKIndex = TVVCLK;
if(HwInfo->jChipType < SIS_315H) VCLKIndex += TVCLKBASE_300;
- else VCLKIndex += TVCLKBASE_315;
+ else VCLKIndex += TVCLKBASE_315;
- } else { /* VGA2 */
+ } else { /* VGA2 */
- VCLKIndex = VCLKIndexGEN;
+ VCLKIndex = VCLKIndexGENCRT;
if(HwInfo->jChipType < SIS_315H) {
- if(ModeNo > 0x13) {
+ if(ModeNo > 0x13) {
if( (HwInfo->jChipType == SIS_630) &&
(HwInfo->jChipRevision >= 0x30)) {
if(VCLKIndex == 0x14) VCLKIndex = 0x34;
@@ -2257,20 +2254,20 @@ SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
/* Better VGA2 clock for 1280x1024@75 */
if(VCLKIndex == 0x17) VCLKIndex = 0x45;
}
- }
- }
+ }
+ }
} else { /* If not programming CRT2 */
- VCLKIndex = VCLKIndexGEN;
+ VCLKIndex = VCLKIndexGENCRT;
if(HwInfo->jChipType < SIS_315H) {
- if(ModeNo > 0x13) {
+ if(ModeNo > 0x13) {
if( (HwInfo->jChipType != SIS_630) &&
(HwInfo->jChipType != SIS_300) ) {
if(VCLKIndex == 0x1b) VCLKIndex = 0x48;
}
}
- }
+ }
}
} else { /* LVDS */
@@ -2279,12 +2276,12 @@ SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_SetFlag & ProgrammingCRT2) {
- if( (SiS_Pr->SiS_IF_DEF_CH70xx != 0) && (SiS_Pr->SiS_VBInfo & SetCRT2ToTV) ) {
+ if( (SiS_Pr->SiS_IF_DEF_CH70xx != 0) && (SiS_Pr->SiS_VBInfo & SetCRT2ToTV) ) {
VCLKIndex &= 0x1f;
- tempbx = 0;
+ tempbx = 0;
if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) tempbx += 1;
- if(SiS_Pr->SiS_TVMode & TVSetPAL) {
+ if(SiS_Pr->SiS_TVMode & TVSetPAL) {
tempbx += 2;
if(SiS_Pr->SiS_ModeType > ModeVGA) {
if(SiS_Pr->SiS_CHSOverScan) tempbx = 8;
@@ -2297,21 +2294,21 @@ SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) tempbx += 1;
}
}
- switch(tempbx) {
- case 0: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKUNTSC; break;
- case 1: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKONTSC; break;
- case 2: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKUPAL; break;
- case 3: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKOPAL; break;
+ switch(tempbx) {
+ case 0: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKUNTSC; break;
+ case 1: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKONTSC; break;
+ case 2: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKUPAL; break;
+ case 3: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKOPAL; break;
case 4: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKUPALM; break;
- case 5: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKOPALM; break;
- case 6: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKUPALN; break;
- case 7: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKOPALN; break;
+ case 5: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKOPALM; break;
+ case 6: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKUPALN; break;
+ case 7: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKOPALN; break;
case 8: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKSOPAL; break;
default: CHTVVCLKPtr = SiS_Pr->SiS_CHTVVCLKOPAL; break;
- }
- VCLKIndex = CHTVVCLKPtr[VCLKIndex];
+ }
+ VCLKIndex = CHTVVCLKPtr[VCLKIndex];
- } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
if(HwInfo->jChipType < SIS_315H) {
VCLKIndex = SiS_Pr->PanelVCLKIdx300;
@@ -2319,7 +2316,7 @@ SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
VCLKIndex = SiS_Pr->PanelVCLKIdx315;
}
-#ifdef SIS300
+#ifdef SIS300
/* Special Timing: Barco iQ Pro R series */
if(SiS_Pr->SiS_CustomT == CUT_BARCO1366) VCLKIndex = 0x44;
@@ -2327,7 +2324,7 @@ SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_CustomT == CUT_PANEL848) {
if(HwInfo->jChipType < SIS_315H) {
VCLKIndex = VCLK34_300;
- /* if(resinfo == SIS_RI_1360x768) VCLKIndex = ?; */
+ /* if(resinfo == SIS_RI_1360x768) VCLKIndex = ?; */
} else {
VCLKIndex = VCLK34_315;
/* if(resinfo == SIS_RI_1360x768) VCLKIndex = ?; */
@@ -2335,26 +2332,26 @@ SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
#endif
- } else {
+ } else {
- VCLKIndex = VCLKIndexGEN;
+ VCLKIndex = VCLKIndexGENCRT;
if(HwInfo->jChipType < SIS_315H) {
- if(ModeNo > 0x13) {
+ if(ModeNo > 0x13) {
if( (HwInfo->jChipType == SIS_630) &&
- (HwInfo->jChipRevision >= 0x30) ) {
+ (HwInfo->jChipRevision >= 0x30) ) {
if(VCLKIndex == 0x14) VCLKIndex = 0x2e;
- }
- }
+ }
+ }
}
- }
+ }
} else { /* if not programming CRT2 */
- VCLKIndex = VCLKIndexGEN;
+ VCLKIndex = VCLKIndexGENCRT;
if(HwInfo->jChipType < SIS_315H) {
- if(ModeNo > 0x13) {
+ if(ModeNo > 0x13) {
if( (HwInfo->jChipType != SIS_630) &&
- (HwInfo->jChipType != SIS_300) ) {
+ (HwInfo->jChipType != SIS_300) ) {
if(VCLKIndex == 0x1b) VCLKIndex = 0x48;
}
#if 0
@@ -2369,7 +2366,7 @@ SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
}
-
+
#ifdef TWDEBUG
xf86DrvMsg(0, X_INFO, "VCLKIndex %d (0x%x)\n", VCLKIndex, VCLKIndex);
#endif
@@ -2385,11 +2382,11 @@ static void
SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
PSIS_HW_INFO HwInfo)
{
- USHORT i,j,modeflag;
- USHORT tempcl,tempah=0;
+ USHORT i,j,modeflag,tempah=0;
+ SHORT tempcl;
#if defined(SIS300) || defined(SIS315H)
USHORT tempbl;
-#endif
+#endif
#ifdef SIS315H
UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
USHORT tempah2, tempbl2;
@@ -2401,7 +2398,7 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
modeflag = SiS_Pr->CModeFlag;
} else {
modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- }
+ }
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
@@ -2435,7 +2432,7 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(ModeNo > 0x13) {
tempcl -= ModeVGA;
- if((tempcl > 0) || (tempcl == 0)) { /* tempcl is USHORT -> always true! */
+ if((tempcl > 0) || (tempcl == 0)) {
tempah = ((0x10 >> tempcl) | 0x80);
}
} else tempah = 0x80;
@@ -2448,15 +2445,9 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
#ifdef SIS315H /* ------- 315/330 series ------ */
- if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
- if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) {
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x2e,0x08);
- }
- }
-
if(ModeNo > 0x13) {
tempcl -= ModeVGA;
- if((tempcl > 0) || (tempcl == 0)) { /* tempcl is USHORT -> always true! */
+ if((tempcl > 0) || (tempcl == 0)) {
tempah = (0x08 >> tempcl);
if (tempah == 0) tempah = 1;
tempah |= 0x40;
@@ -2487,39 +2478,42 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_VBType & VB_SISVB) {
- tempah = 0x01;
- if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
- tempah |= 0x02;
- }
- if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC)) {
- tempah ^= 0x05;
- if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) {
- tempah ^= 0x01;
- }
- }
+ tempah = 0x01;
+ if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
+ tempah |= 0x02;
+ }
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC)) {
+ tempah ^= 0x05;
+ if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) {
+ tempah ^= 0x01;
+ }
+ }
- if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) tempah = 0;
+ if(HwInfo->jChipType < SIS_315H) {
- if(HwInfo->jChipType < SIS_315H) {
+ if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) tempah = 0;
- tempah = (tempah << 5) & 0xFF;
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x01,tempah);
- tempah = (tempah >> 5) & 0xFF;
+ tempah = (tempah << 5) & 0xFF;
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x01,tempah);
+ tempah = (tempah >> 5) & 0xFF;
- } else {
+ } else {
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2E,0xF8,tempah);
+ if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) tempah = 0x08;
+ else if(!(SiS_IsDualEdge(SiS_Pr, HwInfo))) tempah |= 0x08;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2E,0xF0,tempah);
+ tempah &= ~0x08;
}
- if((SiS_Pr->SiS_ModeType == ModeVGA) && (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode))) {
- tempah |= 0x10;
- }
+ if((SiS_Pr->SiS_ModeType == ModeVGA) && (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode))) {
+ tempah |= 0x10;
+ }
tempah |= 0x80;
- if(SiS_Pr->SiS_VBType & VB_SIS301) {
+ if(SiS_Pr->SiS_VBType & VB_SIS301) {
if(SiS_Pr->PanelXRes < 1280 && SiS_Pr->PanelYRes < 960) tempah &= ~0x80;
- }
+ }
if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
if(!(SiS_Pr->SiS_TVMode & (TVSetYPbPr750p | TVSetYPbPr525p))) {
@@ -2530,11 +2524,11 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x0D,0x40,tempah);
-
+
tempah = 0x80;
if(SiS_Pr->SiS_VBType & VB_SIS301) {
if(SiS_Pr->PanelXRes < 1280 && SiS_Pr->PanelYRes < 960) tempah = 0;
- }
+ }
if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempah |= 0x40;
@@ -2550,7 +2544,7 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(HwInfo->jChipType >= SIS_315H) {
-#ifdef SIS315H
+#ifdef SIS315H
/* LVDS can only be slave in 8bpp modes */
tempah = 0x80;
if((modeflag & CRT2Mode) && (SiS_Pr->SiS_ModeType > ModeVGA)) {
@@ -2572,11 +2566,11 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2e,0xF0,tempah);
-#endif
+#endif
} else {
-#ifdef SIS300
+#ifdef SIS300
tempah = 0;
if( (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) && (SiS_Pr->SiS_ModeType > ModeVGA) ) {
tempah |= 0x02;
@@ -2586,7 +2580,7 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_VBInfo & DisableCRT2Display) tempah = 0;
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x01,tempah);
-#endif
+#endif
}
@@ -2681,7 +2675,7 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
} else if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
-#ifdef SIS300
+#ifdef SIS300
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x21,0x3f);
if((SiS_Pr->SiS_VBInfo & DisableCRT2Display) ||
@@ -2694,7 +2688,7 @@ SiS_SetCRT2ModeRegs(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
#endif
}
-
+
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x0D,0x80);
if(SiS_Pr->SiS_VBType & VB_SIS301C) {
@@ -2797,26 +2791,26 @@ SiS_GetCRT2ResInfo(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
case Panel_1024x768:
if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) {
if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) {
- if(yres == 350) yres = 357;
- if(yres == 400) yres = 420;
- if(yres == 480) yres = 525;
- }
- }
+ if(yres == 350) yres = 357;
+ if(yres == 400) yres = 420;
+ if(yres == 480) yres = 525;
+ }
+ }
break;
case Panel_1280x1024:
if(!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) {
/* BIOS bug - does this regardless of scaling */
- if(yres == 400) yres = 405;
+ if(yres == 400) yres = 405;
+ }
+ if(yres == 350) yres = 360;
+ if(SiS_Pr->SiS_SetFlag & LCDVESATiming) {
+ if(yres == 360) yres = 375;
}
- if(yres == 350) yres = 360;
- if(SiS_Pr->SiS_SetFlag & LCDVESATiming) {
- if(yres == 360) yres = 375;
- }
break;
case Panel_1600x1200:
if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) {
- if(yres == 1024) yres = 1056;
- }
+ if(yres == 1024) yres = 1056;
+ }
break;
}
}
@@ -2824,19 +2818,19 @@ SiS_GetCRT2ResInfo(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
} else {
if(SiS_Pr->SiS_VBType & VB_SISVB) {
- if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToHiVision)) {
- if(xres == 720) xres = 640;
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToHiVision)) {
+ if(xres == 720) xres = 640;
}
} else if(xres == 720) xres = 640;
if(SiS_Pr->SiS_SetFlag & SetDOSMode) {
yres = 400;
- if(HwInfo->jChipType >= SIS_315H) {
- if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x17) & 0x80) yres = 480;
- } else {
- if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x13) & 0x80) yres = 480;
- }
- if(SiS_Pr->SiS_IF_DEF_DSTN || SiS_Pr->SiS_IF_DEF_FSTN) yres = 480;
+ if(HwInfo->jChipType >= SIS_315H) {
+ if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x17) & 0x80) yres = 480;
+ } else {
+ if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x13) & 0x80) yres = 480;
+ }
+ if(SiS_Pr->SiS_IF_DEF_DSTN || SiS_Pr->SiS_IF_DEF_FSTN) yres = 480;
}
}
@@ -2866,18 +2860,18 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { /* LCD */
- tempbx = SiS_Pr->SiS_LCDResInfo;
+ tempbx = SiS_Pr->SiS_LCDResInfo;
if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) tempbx += 32;
-
+
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)) {
+ (SiS_Pr->SiS_LCDResInfo == Panel_1280x800_2)) {
if (resinfo == SIS_RI_1280x768) tempal = 9;
}
-
- if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
+
+ 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 */
@@ -2900,23 +2894,23 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
} else { /* TV */
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
- /* if(SiS_Pr->SiS_VGAVDE > 480) SiS_Pr->SiS_TVMode &= (~TVSetTVSimuMode); */
- tempbx = 2;
- if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
+ /* if(SiS_Pr->SiS_VGAVDE > 480) SiS_Pr->SiS_TVMode &= (~TVSetTVSimuMode); */
+ tempbx = 2;
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
tempbx = 13;
- if(!(SiS_Pr->SiS_TVMode & TVSetTVSimuMode)) tempbx = 14;
- }
+ if(!(SiS_Pr->SiS_TVMode & TVSetTVSimuMode)) tempbx = 14;
+ }
} else if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) {
- if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) tempbx = 7;
- else if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) tempbx = 6;
- else tempbx = 5;
- if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) tempbx += 5;
- } else {
- if(SiS_Pr->SiS_TVMode & TVSetPAL) tempbx = 3;
- else tempbx = 4;
- if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) tempbx += 5;
- }
+ if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) tempbx = 7;
+ else if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) tempbx = 6;
+ else tempbx = 5;
+ if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) tempbx += 5;
+ } else {
+ if(SiS_Pr->SiS_TVMode & TVSetPAL) tempbx = 3;
+ else tempbx = 4;
+ if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) tempbx += 5;
+ }
}
@@ -2924,26 +2918,33 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
if(ModeNo > 0x13) {
if(SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoHiVision) {
- if(tempal == 6) tempal = 7;
- if((resinfo == SIS_RI_720x480) ||
- (resinfo == SIS_RI_720x576) ||
- (resinfo == SIS_RI_768x576)) {
+ switch(resinfo) {
+ case SIS_RI_720x480:
+ tempal = 6;
+ if(SiS_Pr->SiS_TVMode & (TVSetPAL | TVSetPALN)) tempal = 9;
+ break;
+ case SIS_RI_720x576:
+ case SIS_RI_768x576:
+ case SIS_RI_1024x576: /* Not in NTSC or YPBPR mode (except 1080i)! */
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 & TVSetYPbPr750p) tempal = 8;
}
- }
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) {
- if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) {
- if(resinfo == SIS_RI_1024x768) tempal = 8;
+ break;
+ case SIS_RI_800x480:
+ tempal = 4;
+ break;
+ case SIS_RI_1024x768:
+ tempal = 7;
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) {
+ if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) tempal = 8;
}
- if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) {
- if((resinfo == SIS_RI_720x576) ||
- (resinfo == SIS_RI_768x576)) {
- tempal = 8;
- }
- if(resinfo == SIS_RI_1280x720) tempal = 9;
+ break;
+ case SIS_RI_1280x720:
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) {
+ if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) tempal = 9;
}
+ break;
}
}
}
@@ -2955,26 +2956,27 @@ 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 = 90;
- if(SiS_Pr->SiS_TVMode & TVSetPAL) {
+
+ tempbx = 90;
+ if(SiS_Pr->SiS_TVMode & TVSetPAL) {
tempbx = 92;
if(SiS_Pr->SiS_ModeType > ModeVGA) {
if(SiS_Pr->SiS_CHSOverScan) tempbx = 99;
}
if(SiS_Pr->SiS_TVMode & TVSetPALM) tempbx = 94;
else if(SiS_Pr->SiS_TVMode & TVSetPALN) tempbx = 96;
- }
+ }
if(tempbx != 99) {
if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) tempbx++;
}
-
+
} else {
-
- switch(SiS_Pr->SiS_LCDResInfo) {
+
+ switch(SiS_Pr->SiS_LCDResInfo) {
case Panel_640x480: tempbx = 12; break;
- case Panel_640x480_2:
- case Panel_640x480_3: tempbx = 14; break;
+ case Panel_320x240_1: tempbx = 10; break;
+ case Panel_320x240_2:
+ case Panel_320x240_3: tempbx = 14; break;
case Panel_800x600: tempbx = 16; break;
case Panel_1024x600: tempbx = 18; break;
case Panel_1152x768:
@@ -2983,15 +2985,16 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
case Panel_1280x1024: tempbx = 24; break;
case Panel_1400x1050: tempbx = 26; break;
case Panel_1600x1200: tempbx = 28; break;
-#ifdef SIS300
+#ifdef SIS300
case Panel_Barco1366: tempbx = 80; break;
-#endif
+#endif
}
switch(SiS_Pr->SiS_LCDResInfo) {
+ case Panel_320x240_1:
+ case Panel_320x240_2:
+ case Panel_320x240_3:
case Panel_640x480:
- case Panel_640x480_2:
- case Panel_640x480_3:
break;
default:
if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++;
@@ -2999,7 +3002,7 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
if(SiS_Pr->SiS_LCDInfo & LCDPass11) tempbx = 30;
-#ifdef SIS300
+#ifdef SIS300
if(SiS_Pr->SiS_CustomT == CUT_BARCO1024) {
tempbx = 82;
if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++;
@@ -3035,13 +3038,13 @@ SiS_GetRAMDAC2DATA(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
tempax = SiS_Pr->SiS_StandTable[index].CRTC[0];
tempbx = SiS_Pr->SiS_StandTable[index].CRTC[6];
temp1 = SiS_Pr->SiS_StandTable[index].CRTC[7];
-
+
dotclock = (modeflag & Charx8Dot) ? 8 : 9;
} else {
modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
- index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
+ index = SiS_GetRefCRT1CRTC(SiS_Pr, RefreshRateTableIndex, SiS_Pr->SiS_UseWideCRT2);
tempax = SiS_Pr->SiS_CRT1Table[index].CR[0];
tempax |= (SiS_Pr->SiS_CRT1Table[index].CR[14] << 8);
@@ -3052,14 +3055,14 @@ SiS_GetRAMDAC2DATA(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
tempcx <<= 2;
tempbx |= tempcx;
temp1 = SiS_Pr->SiS_CRT1Table[index].CR[7];
-
+
dotclock = 8;
}
if(temp1 & 0x01) tempbx |= 0x0100;
if(temp1 & 0x20) tempbx |= 0x0200;
-
+
tempax += 5;
tempax *= dotclock;
if(modeflag & HalfDCLK) tempax <<= 1;
@@ -3075,7 +3078,7 @@ SiS_CalcPanelLinkTiming(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
USHORT RefreshRateTableIndex)
{
USHORT ResIndex;
-
+
if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
if(SiS_Pr->SiS_LCDInfo & LCDPass11) {
if(SiS_Pr->UseCustomMode) {
@@ -3109,7 +3112,7 @@ SiS_CalcPanelLinkTiming(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_Pr->SiS_HT = SiS_Pr->PanelHT;
SiS_Pr->SiS_VT = SiS_Pr->PanelVT;
SiS_Pr->SiS_VGAHT = SiS_Pr->PanelHT - (SiS_Pr->PanelXRes - SiS_Pr->SiS_VGAHDE);
- SiS_Pr->SiS_VGAVT = SiS_Pr->PanelVT - (SiS_Pr->PanelYRes - SiS_Pr->SiS_VGAVDE);
+ SiS_Pr->SiS_VGAVT = SiS_Pr->PanelVT - (SiS_Pr->PanelYRes - SiS_Pr->SiS_VGAVDE);
}
}
@@ -3151,31 +3154,31 @@ SiS_GetCRT2DataLVDS(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
SiS_GetCRT2Ptr(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex,
&CRT2Index, &ResIndex, HwInfo);
-
+
SiS_Pr->SiS_IF_DEF_LVDS = backup;
switch(CRT2Index) {
- case 10: LVDSData = SiS_Pr->SiS_LVDS320x480Data_1; break;
+ case 10: LVDSData = SiS_Pr->SiS_LVDS320x240Data_1; break;
+ case 14: LVDSData = SiS_Pr->SiS_LVDS320x240Data_2; break;
case 12: LVDSData = SiS_Pr->SiS_LVDS640x480Data_1; break;
- case 14: LVDSData = SiS_Pr->SiS_LVDS640x480Data_2; break;
case 16: LVDSData = SiS_Pr->SiS_LVDS800x600Data_1; break;
case 18: LVDSData = SiS_Pr->SiS_LVDS1024x600Data_1; break;
- case 20: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_1; break;
-#ifdef SIS300
- case 80: LVDSData = SiS_Pr->SiS_LVDSBARCO1366Data_1; break;
+ case 20: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_1; break;
+#ifdef SIS300
+ case 80: LVDSData = SiS_Pr->SiS_LVDSBARCO1366Data_1; break;
case 81: LVDSData = SiS_Pr->SiS_LVDSBARCO1366Data_2; break;
case 82: LVDSData = SiS_Pr->SiS_LVDSBARCO1024Data_1; break;
case 84: LVDSData = SiS_Pr->SiS_LVDS848x480Data_1; break;
case 85: LVDSData = SiS_Pr->SiS_LVDS848x480Data_2; break;
-#endif
+#endif
case 90: LVDSData = SiS_Pr->SiS_CHTVUNTSCData; break;
- case 91: LVDSData = SiS_Pr->SiS_CHTVONTSCData; break;
- case 92: LVDSData = SiS_Pr->SiS_CHTVUPALData; break;
- case 93: LVDSData = SiS_Pr->SiS_CHTVOPALData; break;
+ case 91: LVDSData = SiS_Pr->SiS_CHTVONTSCData; break;
+ case 92: LVDSData = SiS_Pr->SiS_CHTVUPALData; break;
+ case 93: LVDSData = SiS_Pr->SiS_CHTVOPALData; break;
case 94: LVDSData = SiS_Pr->SiS_CHTVUPALMData; break;
- case 95: LVDSData = SiS_Pr->SiS_CHTVOPALMData; break;
- case 96: LVDSData = SiS_Pr->SiS_CHTVUPALNData; break;
- case 97: LVDSData = SiS_Pr->SiS_CHTVOPALNData; break;
+ case 95: LVDSData = SiS_Pr->SiS_CHTVOPALMData; break;
+ case 96: LVDSData = SiS_Pr->SiS_CHTVUPALNData; break;
+ case 97: LVDSData = SiS_Pr->SiS_CHTVOPALNData; break;
case 99: LVDSData = SiS_Pr->SiS_CHTVSOPALData; break;
}
@@ -3189,20 +3192,20 @@ SiS_GetCRT2DataLVDS(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
}
if( (!(SiS_Pr->SiS_VBType & VB_SISVB)) &&
- (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) &&
+ (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) &&
(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) ) {
- if( (!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) ||
+ if( (!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) ||
(SiS_Pr->SiS_SetFlag & SetDOSMode) ) {
SiS_Pr->SiS_HDE = SiS_Pr->PanelXRes;
SiS_Pr->SiS_VDE = SiS_Pr->PanelYRes;
-#ifdef SIS300
+#ifdef SIS300
if(SiS_Pr->SiS_CustomT == CUT_BARCO1366) {
if(ResIndex < 0x08) {
SiS_Pr->SiS_HDE = 1280;
- SiS_Pr->SiS_VDE = 1024;
+ SiS_Pr->SiS_VDE = 1024;
}
}
-#endif
+#endif
}
}
}
@@ -3218,9 +3221,9 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT resinfo,CRT2Index,ResIndex;
const SiS_LCDDataStruct *LCDPtr = NULL;
const SiS_TVDataStruct *TVPtr = NULL;
-#ifdef SIS315H
+#ifdef SIS315H
SHORT resinfo661;
-#endif
+#endif
if(ModeNo <= 0x13) {
modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
@@ -3231,11 +3234,11 @@ 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
+#ifdef SIS315H
resinfo661 = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].ROMMODEIDX661;
if( (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) &&
(SiS_Pr->SiS_SetFlag & LCDVESATiming) &&
- (resinfo661 >= 0) &&
+ (resinfo661 >= 0) &&
(SiS_Pr->SiS_NeedRomModeData) ) {
if((ROMAddr = GetLCDStructPtr661(SiS_Pr, HwInfo))) {
if((romptr = (SISGETROMW(21)))) {
@@ -3244,9 +3247,9 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
}
}
}
-#endif
+#endif
}
-
+
SiS_Pr->SiS_NewFlickerMode = 0;
SiS_Pr->SiS_RVBHRS = 50;
SiS_Pr->SiS_RY1COE = 0;
@@ -3265,7 +3268,7 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
SiS_Pr->SiS_RVBHCFACT = 1;
SiS_Pr->SiS_HDE = SiS_Pr->SiS_VGAHDE;
SiS_Pr->SiS_VDE = SiS_Pr->SiS_VGAVDE;
-
+
tempax = SiS_Pr->CHTotal;
if(modeflag & HalfDCLK) tempax <<= 1;
SiS_Pr->SiS_VGAHT = SiS_Pr->SiS_HT = tempax;
@@ -3307,7 +3310,7 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
SiS_Pr->SiS_VDE = (TVPtr+ResIndex)->TVVDE;
SiS_Pr->SiS_RVBHRS2 = (TVPtr+ResIndex)->RVBHRS2 & 0x0fff;
if(modeflag & HalfDCLK) {
- SiS_Pr->SiS_RVBHRS = (TVPtr+ResIndex)->HALFRVBHRS;
+ SiS_Pr->SiS_RVBHRS = (TVPtr+ResIndex)->HALFRVBHRS;
if(SiS_Pr->SiS_RVBHRS2) {
SiS_Pr->SiS_RVBHRS2 = ((SiS_Pr->SiS_RVBHRS2 + 3) >> 1) - 3;
tempax = ((TVPtr+ResIndex)->RVBHRS2 >> 12) & 0x07;
@@ -3318,7 +3321,6 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
SiS_Pr->SiS_RVBHRS = (TVPtr+ResIndex)->RVBHRS;
}
SiS_Pr->SiS_NewFlickerMode = ((TVPtr+ResIndex)->FlickerMode) << 7;
-
if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
@@ -3341,40 +3343,40 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
} else if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) {
- if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) {
- SiS_Pr->SiS_HT = 1650;
- SiS_Pr->SiS_VT = 750;
+ if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) {
+ SiS_Pr->SiS_HT = 1650;
+ SiS_Pr->SiS_VT = 750;
} else if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) {
SiS_Pr->SiS_HT = NTSCHT;
SiS_Pr->SiS_VT = NTSCVT;
- } else {
- SiS_Pr->SiS_HT = NTSCHT;
+ } else {
+ SiS_Pr->SiS_HT = NTSCHT;
if(SiS_Pr->SiS_TVMode & TVSetNTSC1024) SiS_Pr->SiS_HT = NTSC2HT;
- SiS_Pr->SiS_VT = NTSCVT;
- }
+ SiS_Pr->SiS_VT = NTSCVT;
+ }
} else {
- SiS_Pr->SiS_RY1COE = (TVPtr+ResIndex)->RY1COE;
- SiS_Pr->SiS_RY2COE = (TVPtr+ResIndex)->RY2COE;
- SiS_Pr->SiS_RY3COE = (TVPtr+ResIndex)->RY3COE;
- SiS_Pr->SiS_RY4COE = (TVPtr+ResIndex)->RY4COE;
+ SiS_Pr->SiS_RY1COE = (TVPtr+ResIndex)->RY1COE;
+ SiS_Pr->SiS_RY2COE = (TVPtr+ResIndex)->RY2COE;
+ SiS_Pr->SiS_RY3COE = (TVPtr+ResIndex)->RY3COE;
+ SiS_Pr->SiS_RY4COE = (TVPtr+ResIndex)->RY4COE;
- if(modeflag & HalfDCLK) {
- SiS_Pr->SiS_RY1COE = 0x00;
- SiS_Pr->SiS_RY2COE = 0xf4;
- SiS_Pr->SiS_RY3COE = 0x10;
- SiS_Pr->SiS_RY4COE = 0x38;
- }
+ if(modeflag & HalfDCLK) {
+ SiS_Pr->SiS_RY1COE = 0x00;
+ SiS_Pr->SiS_RY2COE = 0xf4;
+ SiS_Pr->SiS_RY3COE = 0x10;
+ SiS_Pr->SiS_RY4COE = 0x38;
+ }
- if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) {
- SiS_Pr->SiS_HT = NTSCHT;
+ if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) {
+ SiS_Pr->SiS_HT = NTSCHT;
if(SiS_Pr->SiS_TVMode & TVSetNTSC1024) SiS_Pr->SiS_HT = NTSC2HT;
- SiS_Pr->SiS_VT = NTSCVT;
- } else {
- SiS_Pr->SiS_HT = PALHT;
- SiS_Pr->SiS_VT = PALVT;
- }
+ SiS_Pr->SiS_VT = NTSCVT;
+ } else {
+ SiS_Pr->SiS_HT = PALHT;
+ SiS_Pr->SiS_VT = PALVT;
+ }
}
@@ -3385,35 +3387,35 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
if(SiS_Pr->UseCustomMode) {
- SiS_Pr->SiS_HDE = SiS_Pr->SiS_VGAHDE;
- SiS_Pr->SiS_VDE = SiS_Pr->SiS_VGAVDE;
-
+ SiS_Pr->SiS_HDE = SiS_Pr->SiS_VGAHDE;
+ SiS_Pr->SiS_VDE = SiS_Pr->SiS_VGAVDE;
+
tempax = SiS_Pr->CHTotal;
if(modeflag & HalfDCLK) tempax <<= 1;
- SiS_Pr->SiS_VGAHT = SiS_Pr->SiS_HT = tempax;
- SiS_Pr->SiS_VGAVT = SiS_Pr->SiS_VT = SiS_Pr->CVTotal;
+ SiS_Pr->SiS_VGAHT = SiS_Pr->SiS_HT = tempax;
+ SiS_Pr->SiS_VGAVT = SiS_Pr->SiS_VT = SiS_Pr->CVTotal;
} else {
-
- BOOLEAN gotit = FALSE;
- if((SiS_Pr->SiS_LCDInfo & DontExpandLCD) && (!(SiS_Pr->SiS_LCDInfo & LCDPass11))) {
+ 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 if( (!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) && (romptr) && (ROMAddr) ) {
-
-#ifdef SIS315H
+
+#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] << 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] << 4) | ((ROMAddr[romptr+6] & 0xf0) >> 4);
+ 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] << 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] << 4) | ((ROMAddr[romptr+6] & 0xf0) >> 4);
SiS_Pr->SiS_RVBHRS2 = ROMAddr[romptr+8] | ((ROMAddr[romptr+9] & 0x0f) << 8);
if((SiS_Pr->SiS_RVBHRS2) && (modeflag & HalfDCLK)) {
SiS_Pr->SiS_RVBHRS2 = ((SiS_Pr->SiS_RVBHRS2 + 3) >> 1) - 3;
@@ -3426,42 +3428,42 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
SiS_Pr->SiS_LCDInfo |= DontExpandLCD;
SiS_Pr->SiS_LCDInfo &= ~LCDPass11;
SiS_Pr->SiS_RVBHCMAX = 1;
- SiS_Pr->SiS_RVBHCFACT = 1;
+ SiS_Pr->SiS_RVBHCFACT = 1;
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_VGAVT = SiS_Pr->PanelVT;
+ SiS_Pr->SiS_HT = SiS_Pr->PanelHT;
+ SiS_Pr->SiS_VT = SiS_Pr->PanelVT;
SiS_Pr->SiS_RVBHRS2 = 0;
gotit = TRUE;
}
-#endif
-
- }
-
+#endif
+
+ }
+
if(!gotit) {
- SiS_GetCRT2Ptr(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
- &CRT2Index,&ResIndex,HwInfo);
+ SiS_GetCRT2Ptr(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex,
+ &CRT2Index,&ResIndex,HwInfo);
- switch(CRT2Index) {
+ switch(CRT2Index) {
case Panel_1024x768 : LCDPtr = SiS_Pr->SiS_ExtLCD1024x768Data; break;
case Panel_1024x768 + 32: LCDPtr = SiS_Pr->SiS_St2LCD1024x768Data; break;
case Panel_1280x720 :
case Panel_1280x720 + 32: LCDPtr = SiS_Pr->SiS_LCD1280x720Data; break;
case Panel_1280x768_2 : LCDPtr = SiS_Pr->SiS_ExtLCD1280x768_2Data; break;
- case Panel_1280x768_2+ 32: LCDPtr = SiS_Pr->SiS_StLCD1280x768_2Data; break;
+ case Panel_1280x768_2+ 32: LCDPtr = SiS_Pr->SiS_StLCD1280x768_2Data; 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;
- case Panel_1280x1024 + 32: LCDPtr = SiS_Pr->SiS_St2LCD1280x1024Data; break;
- case Panel_1400x1050 : LCDPtr = SiS_Pr->SiS_ExtLCD1400x1050Data; break;
- case Panel_1400x1050 + 32: LCDPtr = SiS_Pr->SiS_StLCD1400x1050Data; break;
- case Panel_1600x1200 : LCDPtr = SiS_Pr->SiS_ExtLCD1600x1200Data; break;
- case Panel_1600x1200 + 32: LCDPtr = SiS_Pr->SiS_StLCD1600x1200Data; break;
+ case Panel_1280x1024 : LCDPtr = SiS_Pr->SiS_ExtLCD1280x1024Data; break;
+ case Panel_1280x1024 + 32: LCDPtr = SiS_Pr->SiS_St2LCD1280x1024Data; break;
+ case Panel_1400x1050 : LCDPtr = SiS_Pr->SiS_ExtLCD1400x1050Data; break;
+ case Panel_1400x1050 + 32: LCDPtr = SiS_Pr->SiS_StLCD1400x1050Data; break;
+ case Panel_1600x1200 : LCDPtr = SiS_Pr->SiS_ExtLCD1600x1200Data; break;
+ case Panel_1600x1200 + 32: LCDPtr = SiS_Pr->SiS_StLCD1600x1200Data; break;
case Panel_1680x1050 :
case Panel_1680x1050 + 32: LCDPtr = SiS_Pr->SiS_LCD1680x1050Data; break;
case 100 : LCDPtr = SiS_Pr->SiS_NoScaleData; break;
@@ -3469,66 +3471,66 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
case 200 : LCDPtr = SiS310_ExtCompaq1280x1024Data; break;
case 201 : LCDPtr = SiS_Pr->SiS_St2LCD1280x1024Data; break;
#endif
- default : LCDPtr = SiS_Pr->SiS_ExtLCD1024x768Data; break;
- }
+ default : LCDPtr = SiS_Pr->SiS_ExtLCD1024x768Data; break;
+ }
#ifdef TWDEBUG
- xf86DrvMsg(0, X_INFO, "GetCRT2Data: Index %d ResIndex %d\n", CRT2Index, ResIndex);
+ xf86DrvMsg(0, X_INFO, "GetCRT2Data: Index %d ResIndex %d\n", CRT2Index, ResIndex);
#endif
- SiS_Pr->SiS_RVBHCMAX = (LCDPtr+ResIndex)->RVBHCMAX;
- SiS_Pr->SiS_RVBHCFACT = (LCDPtr+ResIndex)->RVBHCFACT;
- SiS_Pr->SiS_VGAHT = (LCDPtr+ResIndex)->VGAHT;
- SiS_Pr->SiS_VGAVT = (LCDPtr+ResIndex)->VGAVT;
- SiS_Pr->SiS_HT = (LCDPtr+ResIndex)->LCDHT;
- SiS_Pr->SiS_VT = (LCDPtr+ResIndex)->LCDVT;
+ SiS_Pr->SiS_RVBHCMAX = (LCDPtr+ResIndex)->RVBHCMAX;
+ SiS_Pr->SiS_RVBHCFACT = (LCDPtr+ResIndex)->RVBHCFACT;
+ SiS_Pr->SiS_VGAHT = (LCDPtr+ResIndex)->VGAHT;
+ SiS_Pr->SiS_VGAVT = (LCDPtr+ResIndex)->VGAVT;
+ SiS_Pr->SiS_HT = (LCDPtr+ResIndex)->LCDHT;
+ SiS_Pr->SiS_VT = (LCDPtr+ResIndex)->LCDVT;
}
tempax = SiS_Pr->PanelXRes;
- tempbx = SiS_Pr->PanelYRes;
+ tempbx = SiS_Pr->PanelYRes;
switch(SiS_Pr->SiS_LCDResInfo) {
case Panel_1024x768:
- if(SiS_Pr->SiS_SetFlag & LCDVESATiming) {
- if(HwInfo->jChipType < SIS_315H) {
- if (SiS_Pr->SiS_VGAVDE == 350) tempbx = 560;
- else if(SiS_Pr->SiS_VGAVDE == 400) tempbx = 640;
- }
- } else {
- if (SiS_Pr->SiS_VGAVDE == 357) tempbx = 527;
- else if(SiS_Pr->SiS_VGAVDE == 420) tempbx = 620;
- else if(SiS_Pr->SiS_VGAVDE == 525) tempbx = 775;
- else if(SiS_Pr->SiS_VGAVDE == 600) tempbx = 775;
- else if(SiS_Pr->SiS_VGAVDE == 350) tempbx = 560;
- else if(SiS_Pr->SiS_VGAVDE == 400) tempbx = 640;
- }
+ if(SiS_Pr->SiS_SetFlag & LCDVESATiming) {
+ if(HwInfo->jChipType < SIS_315H) {
+ if (SiS_Pr->SiS_VGAVDE == 350) tempbx = 560;
+ else if(SiS_Pr->SiS_VGAVDE == 400) tempbx = 640;
+ }
+ } else {
+ if (SiS_Pr->SiS_VGAVDE == 357) tempbx = 527;
+ else if(SiS_Pr->SiS_VGAVDE == 420) tempbx = 620;
+ else if(SiS_Pr->SiS_VGAVDE == 525) tempbx = 775;
+ else if(SiS_Pr->SiS_VGAVDE == 600) tempbx = 775;
+ else if(SiS_Pr->SiS_VGAVDE == 350) tempbx = 560;
+ else if(SiS_Pr->SiS_VGAVDE == 400) tempbx = 640;
+ }
break;
case Panel_1280x960:
- if (SiS_Pr->SiS_VGAVDE == 350) tempbx = 700;
- else if(SiS_Pr->SiS_VGAVDE == 400) tempbx = 800;
- else if(SiS_Pr->SiS_VGAVDE == 1024) tempbx = 960;
+ if (SiS_Pr->SiS_VGAVDE == 350) tempbx = 700;
+ else if(SiS_Pr->SiS_VGAVDE == 400) tempbx = 800;
+ else if(SiS_Pr->SiS_VGAVDE == 1024) tempbx = 960;
break;
case Panel_1280x1024:
- if (SiS_Pr->SiS_VGAVDE == 360) tempbx = 768;
- else if(SiS_Pr->SiS_VGAVDE == 375) tempbx = 800;
- else if(SiS_Pr->SiS_VGAVDE == 405) tempbx = 864;
+ if (SiS_Pr->SiS_VGAVDE == 360) tempbx = 768;
+ else if(SiS_Pr->SiS_VGAVDE == 375) tempbx = 800;
+ else if(SiS_Pr->SiS_VGAVDE == 405) tempbx = 864;
break;
- case Panel_1600x1200:
+ case Panel_1600x1200:
if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) {
- if (SiS_Pr->SiS_VGAVDE == 350) tempbx = 875;
- else if(SiS_Pr->SiS_VGAVDE == 400) tempbx = 1000;
- }
+ if (SiS_Pr->SiS_VGAVDE == 350) tempbx = 875;
+ else if(SiS_Pr->SiS_VGAVDE == 400) tempbx = 1000;
+ }
break;
- }
+ }
- if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
- tempax = SiS_Pr->SiS_VGAHDE;
- tempbx = SiS_Pr->SiS_VGAVDE;
- }
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
+ tempax = SiS_Pr->SiS_VGAHDE;
+ tempbx = SiS_Pr->SiS_VGAVDE;
+ }
- SiS_Pr->SiS_HDE = tempax;
- SiS_Pr->SiS_VDE = tempbx;
+ SiS_Pr->SiS_HDE = tempax;
+ SiS_Pr->SiS_VDE = tempbx;
}
}
}
@@ -3567,11 +3569,11 @@ SiS_GetLVDSDesPtr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
const SiS_LVDSDesStruct *PanelDesPtr = NULL;
-#ifdef SIS300
+#ifdef SIS300
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
-
+
if(HwInfo->jChipType < SIS_315H) {
-
+
if(SiS_Pr->SiS_LCDTypeInfo == 4) {
if(SiS_Pr->SiS_CustomT == CUT_BARCO1366) {
PanelDesPtr = SiS_Pr->SiS_PanelType04_1a;
@@ -3585,11 +3587,11 @@ SiS_GetLVDSDesPtr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
}
}
}
-
+
}
}
#endif
- return PanelDesPtr;
+ return PanelDesPtr;
}
static void
@@ -3602,13 +3604,22 @@ SiS_GetLVDSDesData(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
SiS_Pr->SiS_LCDHDES = 0;
SiS_Pr->SiS_LCDVDES = 0;
+ if(SiS_Pr->SiS_IF_DEF_TRUMPION) {
+ if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) {
+ if(SiS_Pr->SiS_VGAVDE == SiS_Pr->PanelYRes) {
+ SiS_Pr->SiS_LCDVDES = SiS_Pr->PanelVT - 1;
+ }
+ }
+ return;
+ }
+
if( (SiS_Pr->UseCustomMode) ||
(SiS_Pr->SiS_LCDResInfo == Panel_Custom) ||
(SiS_Pr->SiS_CustomT == CUT_PANEL848) ||
(SiS_Pr->SiS_LCDInfo & LCDPass11) ) {
return;
}
-
+
if(ModeNo <= 0x13) ResIndex = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
else ResIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
@@ -3639,24 +3650,27 @@ SiS_GetLVDSDesData(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
SiS_Pr->SiS_LCDVDES = SiS_Pr->PanelVT - 1;
}
}
+ if(SiS_Pr->SiS_LCDResInfo == Panel_1280x800) { /* Verified for Averatec 6240 */
+ SiS_Pr->SiS_LCDVDES = SiS_Pr->PanelVT - 1;
+ }
}
#endif
} else {
-
+
if((SiS_Pr->SiS_IF_DEF_CH70xx != 0) && (SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) {
if((SiS_Pr->SiS_TVMode & TVSetPAL) && (!(SiS_Pr->SiS_TVMode & TVSetPALM))) {
if(ResIndex <= 3) SiS_Pr->SiS_LCDHDES = 256;
}
-
+
} else if((PanelDesPtr = SiS_GetLVDSDesPtr(SiS_Pr, HwInfo))) {
-
+
SiS_Pr->SiS_LCDHDES = (PanelDesPtr+ResIndex)->LCDHDES;
SiS_Pr->SiS_LCDVDES = (PanelDesPtr+ResIndex)->LCDVDES;
-
+
} else if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
-
+
if(SiS_Pr->SiS_VGAHDE != SiS_Pr->PanelXRes) {
SiS_Pr->SiS_LCDHDES = SiS_Pr->SiS_HT - ((SiS_Pr->PanelXRes - SiS_Pr->SiS_VGAHDE) / 2);
}
@@ -3678,11 +3692,11 @@ SiS_GetLVDSDesData(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
}
}
}
-
+
} else {
-
+
if(HwInfo->jChipType < SIS_315H) {
-#ifdef SIS300
+#ifdef SIS300
switch(SiS_Pr->SiS_LCDResInfo) {
case Panel_800x600:
if(SiS_Pr->SiS_VGAVDE == SiS_Pr->PanelYRes) {
@@ -3705,15 +3719,15 @@ SiS_GetLVDSDesData(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
break;
case Panel_1024x600:
default:
- if( (SiS_Pr->SiS_VGAHDE == SiS_Pr->PanelXRes) &&
+ if( (SiS_Pr->SiS_VGAHDE == SiS_Pr->PanelXRes) &&
(SiS_Pr->SiS_VGAVDE == SiS_Pr->PanelYRes) ) {
SiS_Pr->SiS_LCDVDES = SiS_Pr->PanelVT - 1;
} else {
SiS_Pr->SiS_LCDHDES = SiS_Pr->PanelHT - 1;
}
break;
- }
-
+ }
+
switch(SiS_Pr->SiS_LCDTypeInfo) {
case 1:
SiS_Pr->SiS_LCDHDES = SiS_Pr->SiS_LCDVDES = 0;
@@ -3725,22 +3739,23 @@ SiS_GetLVDSDesData(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
else if(SiS_Pr->SiS_VGAVDE >= 350) SiS_Pr->SiS_LCDVDES = 440;
break;
}
-#endif
+#endif
} else {
-#ifdef SIS315H
+#ifdef SIS315H
switch(SiS_Pr->SiS_LCDResInfo) {
- case Panel_1024x768:
+ case Panel_1024x768:
case Panel_1280x1024:
if(SiS_Pr->SiS_VGAVDE == SiS_Pr->PanelYRes) {
SiS_Pr->SiS_LCDVDES = SiS_Pr->PanelVT - 1;
}
break;
- case Panel_640x480_2:
- case Panel_640x480_3:
+ case Panel_320x240_1:
+ case Panel_320x240_2:
+ case Panel_320x240_3:
SiS_Pr->SiS_LCDVDES = 524;
break;
}
-#endif
+#endif
}
}
@@ -3754,7 +3769,7 @@ SiS_GetLVDSDesData(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
if(HwInfo->jChipType < SIS_315H) {
if(!(modeflag & HalfDCLK)) SiS_Pr->SiS_LCDHDES = 320;
} else {
-#ifdef SIS315H
+#ifdef SIS315H
if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) SiS_Pr->SiS_LCDHDES = 480;
if(SiS_Pr->SiS_LCDResInfo == Panel_1400x1050) SiS_Pr->SiS_LCDHDES = 804;
if(SiS_Pr->SiS_LCDResInfo == Panel_1600x1200) SiS_Pr->SiS_LCDHDES = 704;
@@ -3763,7 +3778,7 @@ SiS_GetLVDSDesData(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
if(SiS_Pr->SiS_LCDResInfo == Panel_1400x1050) SiS_Pr->SiS_LCDHDES = 632;
if(SiS_Pr->SiS_LCDResInfo == Panel_1600x1200) SiS_Pr->SiS_LCDHDES = 542;
}
-#endif
+#endif
}
}
}
@@ -3776,6 +3791,31 @@ SiS_GetLVDSDesData(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
/* DISABLE VIDEO BRIDGE */
/*********************************************/
+#ifdef SIS315H
+static void
+SiS_HandlePWD(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
+{
+#ifdef SET_PWD
+ UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
+ USHORT romptr = GetLCDStructPtr661_2(SiS_Pr, HwInfo);
+ USHORT temp;
+
+ if( (SiS_Pr->SiS_VBType & (VB_301C |VB_SIS301LV302LV)) &&
+ (romptr) &&
+ (SiS_Pr->SiS_PWDOffset) ) {
+ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x2b,ROMAddr[romptr + SiS_Pr->SiS_PWDOffset + 0]);
+ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x2c,ROMAddr[romptr + SiS_Pr->SiS_PWDOffset + 1]);
+ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x2d,ROMAddr[romptr + SiS_Pr->SiS_PWDOffset + 2]);
+ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x2e,ROMAddr[romptr + SiS_Pr->SiS_PWDOffset + 3]);
+ SiS_SetReg(SiS_Pr->SiS_Part4Port,0x2f,ROMAddr[romptr + SiS_Pr->SiS_PWDOffset + 4]);
+ temp = 0x00;
+ if(ROMAddr[romptr + 2] & (0x06 << 1)) temp = 0x80;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x27,0x7f,temp);
+ }
+#endif
+}
+#endif
+
/* NEVER use any variables (VBInfo), this will be called
* from outside the context of modeswitch!
* MUST call getVBType before calling this
@@ -3825,21 +3865,21 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
} 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;
modenum = SiS_GetReg(SiS_Pr->SiS_P3d4,0x34) & 0x7f;
- if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
-
+ 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) {
@@ -3847,10 +3887,13 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
}
}
#endif
+
+ SiS_HandlePWD(SiS_Pr, HwInfo);
+
if( (modenum <= 0x13) ||
(SiS_IsVAMode(SiS_Pr,HwInfo)) ||
(!(SiS_IsDualEdge(SiS_Pr,HwInfo))) ) {
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFE);
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFE);
if(custom1) SiS_PanelDelay(SiS_Pr, HwInfo, 3);
}
@@ -3865,8 +3908,8 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_PanelDelay(SiS_Pr, HwInfo, 3);
}
- }
-
+ }
+
if(!(SiS_IsNotM650orLater(SiS_Pr, HwInfo))) {
if(HwInfo->jChipType < SIS_340) {
tempah = 0xef;
@@ -3874,11 +3917,11 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
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;
@@ -3895,9 +3938,9 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
}
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))) {
@@ -3906,7 +3949,7 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
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);
}
@@ -3918,13 +3961,13 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x00,temp);
}
-
+
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))) {
@@ -3942,9 +3985,9 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 20);
}
}
-
+
} else {
-
+
if((SiS_IsVAMode(SiS_Pr,HwInfo)) ||
(!(SiS_IsDualEdge(SiS_Pr,HwInfo)))) {
if((!(SiS_WeHaveBacklightCtrl(SiS_Pr, HwInfo))) ||
@@ -3966,7 +4009,7 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
if(HwInfo->jChipType < SIS_315H) {
#ifdef SIS300
- if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwInfo))) {
+ if(!(SiS_CR36BIOSWord23b(SiS_Pr,HwInfo))) {
SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x08);
SiS_PanelDelay(SiS_Pr, HwInfo, 3);
}
@@ -4085,7 +4128,7 @@ SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
if( (!(SiS_IsDualEdge(SiS_Pr,HwInfo))) ||
(SiS_IsTVOrYPbPrOrScart(SiS_Pr,HwInfo)) ) {
SiS_SetCH701x(SiS_Pr,0x0149);
- }
+ }
}
}
@@ -4210,10 +4253,10 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
}
}
}
-
+
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);
@@ -4232,9 +4275,9 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_SetRegSR11ANDOR(SiS_Pr,HwInfo,0xF7,0x00);
}
}
-
+
} else {
-
+
temp = SiS_GetReg(SiS_Pr->SiS_P3c4,0x32) & 0xDF; /* lock mode */
if(SiS_BridgeInSlavemode(SiS_Pr)) {
tempah = SiS_GetReg(SiS_Pr->SiS_P3d4,0x30);
@@ -4255,10 +4298,10 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
}
}
}
-
+
}
-
+
#endif /* SIS300 */
} else {
@@ -4268,7 +4311,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
#ifdef SET_EMI
UCHAR r30=0, r31=0, r32=0, r33=0, cr36=0;
/* USHORT emidelay=0; */
-#endif
+#endif
if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) {
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x1f,0xef);
@@ -4291,7 +4334,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
}
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);
@@ -4299,8 +4342,10 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x06,0xE3);
}
+ SiS_HandlePWD(SiS_Pr, HwInfo);
+
if(SiS_IsVAorLCD(SiS_Pr, HwInfo)) {
- if(!(SiS_GetReg(SiS_Pr->SiS_Part4Port,0x26) & 0x02)) {
+ 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);
@@ -4315,10 +4360,10 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
delaylong = TRUE;
}
- }
+ }
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);
@@ -4329,23 +4374,23 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_SetReg(SiS_Pr->SiS_P3c4,0x32,temp);
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);
}
-
+
} else {
-
+
SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x1e,0x20);
-
+
}
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;
@@ -4371,8 +4416,8 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
#ifdef SET_EMI
- cr36 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36);
-
+ cr36 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36);
+
if(SiS_Pr->SiS_ROMNew) {
UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
USHORT romptr = GetLCDStructPtr661_2(SiS_Pr, HwInfo);
@@ -4415,14 +4460,14 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
if((!SiS_Pr->HaveEMI) || (!SiS_Pr->HaveEMILCD)) {
switch((cr36 & 0x0f)) {
- case 2:
+ 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;
- }
+ }
}
break;
case 3: /* 1280x1024 */
@@ -4463,7 +4508,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
#ifdef COMPAQ_HACK
if(SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) {
if((cr36 & 0x0f) == 0x03) {
- r30 = 0x20; r31 = 0x12; r32 = 0xd0; r33 = 0x6b;
+ r30 = 0x20; r31 = 0x12; r32 = 0xd0; r33 = 0x6b;
}
}
#endif
@@ -4478,7 +4523,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
}
#endif
}
-
+
if(!(SiS_Pr->OverruleEMI && (!r30) && (!r31) && (!r32) && (!r33))) {
SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x20); /* Reset */
SiS_GenericDelay(SiS_Pr, 0x500);
@@ -4487,12 +4532,12 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
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)) ) {
+
+#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) {
@@ -4506,7 +4551,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x30,0x40); /* Enable */
}
}
-#endif
+#endif
}
}
@@ -4516,9 +4561,9 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
if(delaylong) {
SiS_PanelDelayLoop(SiS_Pr, HwInfo, 3, 10);
}
- SiS_WaitVBRetrace(SiS_Pr,HwInfo);
+ SiS_WaitVBRetrace(SiS_Pr,HwInfo);
if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
- SiS_GenericDelay(SiS_Pr, 0x500);
+ SiS_GenericDelay(SiS_Pr, 0x500);
}
SiS_SetRegOR(SiS_Pr->SiS_Part4Port,0x26,0x01);
}
@@ -4529,7 +4574,7 @@ SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
SiS_SetRegByte(SiS_Pr->SiS_P3c6,0xff);
}
-
+
if(!(SiS_WeHaveBacklightCtrl(SiS_Pr,HwInfo))) {
SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x00,0x7f);
}
@@ -4751,15 +4796,27 @@ SiS_SetCRT2Offset(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
offset = SiS_GetOffset(SiS_Pr,ModeNo,ModeIdIndex,RRTI,HwInfo);
- if((SiS_Pr->SiS_LCDResInfo == Panel_640x480_2) ||
- (SiS_Pr->SiS_LCDResInfo == Panel_640x480_3)) {
+#if 0 /* Wrong, fifostop too short */
+ if((SiS_Pr->SiS_LCDResInfo == Panel_320x240_1) ||
+ (SiS_Pr->SiS_LCDResInfo == Panel_320x240_2) ||
+ (SiS_Pr->SiS_LCDResInfo == Panel_320x240_3)) {
offset >>= 1;
}
+#endif
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x07,(offset & 0xFF));
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x09,(offset >> 8));
+
+#if 0 /* Wrong, fifostop too short */
+ if((SiS_Pr->SiS_LCDResInfo == Panel_320x240_1) ||
+ (SiS_Pr->SiS_LCDResInfo == Panel_320x240_2) ||
+ (SiS_Pr->SiS_LCDResInfo == Panel_320x240_3)) {
+ offset >>= 1;
+ }
+#endif
+
temp = (UCHAR)(((offset >> 3) & 0xFF) + 1);
- if(offset % 8) temp++;
+ if(offset & 0x07) temp++;
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x03,temp);
}
@@ -4781,36 +4838,40 @@ SiS_SetCRT2Sync(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT RefreshRateTableIndex
if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { /* LVDS */
if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
- tempah = 0;
+ tempah = 0;
} else if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) && (SiS_Pr->SiS_LCDInfo & LCDSync)) {
- tempah = SiS_Pr->SiS_LCDInfo;
+ tempah = SiS_Pr->SiS_LCDInfo;
} else tempah = infoflag >> 8;
tempah &= 0xC0;
tempah |= 0x20;
if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) tempah |= 0x10;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
- if((SiS_Pr->SiS_CustomT == CUT_BARCO1366) ||
- (SiS_Pr->SiS_CustomT == CUT_BARCO1024)) {
+ if((SiS_Pr->SiS_CustomT == CUT_BARCO1366) ||
+ (SiS_Pr->SiS_CustomT == CUT_BARCO1024)) {
tempah |= 0xf0;
- }
+ }
if( (SiS_Pr->SiS_IF_DEF_FSTN) ||
- (SiS_Pr->SiS_IF_DEF_DSTN) ||
- (SiS_Pr->SiS_IF_DEF_TRUMPION) ||
- (SiS_Pr->SiS_CustomT == CUT_PANEL848) ) {
- tempah |= 0x30;
- }
+ (SiS_Pr->SiS_IF_DEF_DSTN) ||
+ (SiS_Pr->SiS_IF_DEF_TRUMPION) ||
+ (SiS_Pr->SiS_CustomT == CUT_PANEL848) ) {
+ tempah |= 0x30;
+ }
+ if( (SiS_Pr->SiS_IF_DEF_FSTN) ||
+ (SiS_Pr->SiS_IF_DEF_DSTN) ) {
+ tempah &= ~0xc0;
+ }
}
if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
- if(HwInfo->jChipType >= SIS_315H) {
- tempah >>= 3;
+ if(HwInfo->jChipType >= SIS_315H) {
+ tempah >>= 3;
tempah &= 0x18;
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,0xE7,tempah);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,0xE7,tempah);
/* Don't care about 12/18/24 bit mode - TV is via VGA, not PL */
- } else {
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,0xe0);
- }
+ } else {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,0xe0);
+ }
} else {
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,tempah);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,tempah);
}
} else if(SiS_Pr->SiS_VBType & VB_SISVB) {
@@ -4819,34 +4880,34 @@ SiS_SetCRT2Sync(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT RefreshRateTableIndex
#ifdef SIS300 /* ---- 300 series --- */
- if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { /* 630 - 301B(-DH) */
+ if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { /* 630 - 301B(-DH) */
tempah = infoflag >> 8;
tempbl = 0;
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
if(SiS_Pr->SiS_LCDInfo & LCDSync) {
- tempah = SiS_Pr->SiS_LCDInfo;
+ tempah = SiS_Pr->SiS_LCDInfo;
tempbl = (tempah >> 6) & 0x03;
- }
- }
- tempah &= 0xC0;
- tempah |= 0x20;
- if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) tempah |= 0x10;
- tempah |= 0xc0;
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,tempah);
+ }
+ }
+ tempah &= 0xC0;
+ tempah |= 0x20;
+ if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) tempah |= 0x10;
+ tempah |= 0xc0;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,tempah);
if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) && (!(SiS_Pr->SiS_VBType & VB_NoLCD))) {
SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1a,0xf0,tempbl);
}
- } else { /* 630 - 301 */
+ } else { /* 630 - 301 */
- tempah = infoflag >> 8;
- tempah &= 0xC0;
- tempah |= 0x20;
+ tempah = infoflag >> 8;
+ tempah &= 0xC0;
+ tempah |= 0x20;
if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) tempah |= 0x10;
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,tempah);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,tempah);
- }
+ }
#endif /* SIS300 */
@@ -4854,58 +4915,58 @@ SiS_SetCRT2Sync(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT RefreshRateTableIndex
#ifdef SIS315H /* ------- 315 series ------ */
- if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { /* 315 - LVDS */
+ if(SiS_Pr->SiS_VBType & VB_SIS301LV302LV) { /* 315 - LVDS */
tempbl = 0;
if((SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) &&
(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024)) {
tempah = infoflag >> 8;
if(SiS_Pr->SiS_LCDInfo & LCDSync) {
- tempbl = ((SiS_Pr->SiS_LCDInfo & 0xc0) >> 6);
+ tempbl = ((SiS_Pr->SiS_LCDInfo & 0xc0) >> 6);
}
} else if((SiS_Pr->SiS_CustomT == CUT_CLEVO1400) &&
- (SiS_Pr->SiS_LCDResInfo == Panel_1400x1050)) {
- tempah = infoflag >> 8;
+ (SiS_Pr->SiS_LCDResInfo == Panel_1400x1050)) {
+ tempah = infoflag >> 8;
tempbl = 0x03;
} else {
- tempah = SiS_GetReg(SiS_Pr->SiS_P3d4,0x37);
+ tempah = SiS_GetReg(SiS_Pr->SiS_P3d4,0x37);
tempbl = (tempah >> 6) & 0x03;
tempbl |= 0x08;
if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) tempbl |= 0x04;
}
tempah &= 0xC0;
- tempah |= 0x20;
- if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) tempah |= 0x10;
+ tempah |= 0x20;
+ if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) tempah |= 0x10;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) tempah |= 0xc0;
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,tempah);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,tempah);
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1a,0xf0,tempbl);
}
}
- } else { /* 315 - TMDS */
+ } else { /* 315 - TMDS */
- tempah = tempbl = infoflag >> 8;
+ tempah = tempbl = infoflag >> 8;
if(!SiS_Pr->UseCustomMode) {
tempbl = 0;
if((SiS_Pr->SiS_VBType & VB_SIS301C) && (SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC)) {
- if(ModeNo <= 0x13) {
- tempah = SiS_GetRegByte((SiS_Pr->SiS_P3ca+0x02));
- }
+ if(ModeNo <= 0x13) {
+ tempah = SiS_GetRegByte((SiS_Pr->SiS_P3ca+0x02));
+ }
}
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
- if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) {
- if(SiS_Pr->SiS_LCDInfo & LCDSync) {
- tempah = SiS_Pr->SiS_LCDInfo;
+ if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) {
+ if(SiS_Pr->SiS_LCDInfo & LCDSync) {
+ tempah = SiS_Pr->SiS_LCDInfo;
tempbl = (tempah >> 6) & 0x03;
}
- }
+ }
}
}
tempah &= 0xC0;
- tempah |= 0x20;
- if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) tempah |= 0x10;
+ tempah |= 0x20;
+ if(!(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit)) tempah |= 0x10;
if(SiS_Pr->SiS_VBType & VB_NoLCD) {
/* Imitate BIOS bug */
if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) tempah |= 0xc0;
@@ -4915,10 +4976,10 @@ SiS_SetCRT2Sync(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT RefreshRateTableIndex
tempah &= 0x18;
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,0xe7,tempah);
} else {
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,tempah);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x19,0x0F,tempah);
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) {
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
- SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1a,0xf0,tempbl);
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1a,0xf0,tempbl);
}
}
}
@@ -4936,25 +4997,23 @@ SiS_SetCRT2FIFO_300(SiS_Private *SiS_Pr,USHORT ModeNo,
PSIS_HW_INFO HwInfo)
{
UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
- USHORT temp,index;
- USHORT modeidindex,refreshratetableindex;
- USHORT VCLK=0,MCLK,colorth=0,data2=0;
+ USHORT temp, index, modeidindex, refreshratetableindex;
+ USHORT VCLK=0, MCLK, colorth=0, data2=0;
USHORT tempal, tempah, tempbx, tempcl, tempax;
- USHORT CRT1ModeNo,CRT2ModeNo;
- USHORT SelectRate_backup;
- ULONG data,eax;
+ USHORT CRT1ModeNo, CRT2ModeNo, SelectRate_backup;
+ ULONG data, eax;
const UCHAR LatencyFactor[] = {
- 97, 88, 86, 79, 77, 00, /*; 64 bit BQ=2 */
- 00, 87, 85, 78, 76, 54, /*; 64 bit BQ=1 */
- 97, 88, 86, 79, 77, 00, /*; 128 bit BQ=2 */
- 00, 79, 77, 70, 68, 48, /*; 128 bit BQ=1 */
- 80, 72, 69, 63, 61, 00, /*; 64 bit BQ=2 */
- 00, 70, 68, 61, 59, 37, /*; 64 bit BQ=1 */
- 86, 77, 75, 68, 66, 00, /*; 128 bit BQ=2 */
- 00, 68, 66, 59, 57, 37 /*; 128 bit BQ=1 */
+ 97, 88, 86, 79, 77, 0, /*; 64 bit BQ=2 */
+ 0, 87, 85, 78, 76, 54, /*; 64 bit BQ=1 */
+ 97, 88, 86, 79, 77, 0, /*; 128 bit BQ=2 */
+ 0, 79, 77, 70, 68, 48, /*; 128 bit BQ=1 */
+ 80, 72, 69, 63, 61, 0, /*; 64 bit BQ=2 */
+ 0, 70, 68, 61, 59, 37, /*; 64 bit BQ=1 */
+ 86, 77, 75, 68, 66, 0, /*; 128 bit BQ=2 */
+ 0, 68, 66, 59, 57, 37 /*; 128 bit BQ=1 */
};
const UCHAR LatencyFactor730[] = {
- 69, 63, 61,
+ 69, 63, 61,
86, 79, 77,
103, 96, 94,
120,113,111,
@@ -4972,12 +5031,12 @@ SiS_SetCRT2FIFO_300(SiS_Private *SiS_Pr,USHORT ModeNo,
137,130,128,
};
const UCHAR ThLowB[] = {
- 81, 4, 72, 6, 88, 8,120,12,
- 55, 4, 54, 6, 66, 8, 90,12,
- 42, 4, 45, 6, 55, 8, 75,12
+ 81, 4, 72, 6, 88, 8,120,12,
+ 55, 4, 54, 6, 66, 8, 90,12,
+ 42, 4, 45, 6, 55, 8, 75,12
};
const UCHAR ThTiming[] = {
- 1, 2, 2, 3, 0, 1, 1, 2
+ 1, 2, 2, 3, 0, 1, 1, 2
};
SelectRate_backup = SiS_Pr->SiS_SelectCRT2Rate;
@@ -4991,12 +5050,12 @@ SiS_SetCRT2FIFO_300(SiS_Private *SiS_Pr,USHORT ModeNo,
refreshratetableindex = SiS_GetRatePtr(SiS_Pr, CRT1ModeNo, modeidindex, HwInfo);
if(CRT1ModeNo >= 0x13) {
- index = SiS_Pr->SiS_RefIndex[refreshratetableindex].Ext_CRTVCLK;
- VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; /* Get VCLK */
+ index = SiS_GetRefCRTVCLK(SiS_Pr, refreshratetableindex, SiS_Pr->SiS_UseWide);
+ VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; /* Get VCLK */
colorth = SiS_GetColorDepth(SiS_Pr,CRT1ModeNo,modeidindex); /* Get colordepth */
- colorth >>= 1;
- if(!colorth) colorth++;
+ colorth >>= 1;
+ if(!colorth) colorth++;
}
} else {
@@ -5005,214 +5064,185 @@ SiS_SetCRT2FIFO_300(SiS_Private *SiS_Pr,USHORT ModeNo,
VCLK = SiS_Pr->CSRClock_CRT1; /* Get VCLK */
data2 = (SiS_Pr->CModeFlag_CRT1 & ModeTypeMask) - 2;
switch(data2) { /* Get color depth */
- case 0 : colorth = 1; break;
- case 1 : colorth = 1; break;
- case 2 : colorth = 2; break;
- case 3 : colorth = 2; break;
- case 4 : colorth = 3; break;
- case 5 : colorth = 4; break;
- default: colorth = 2;
+ case 0 : colorth = 1; break;
+ case 1 : colorth = 1; break;
+ case 2 : colorth = 2; break;
+ case 3 : colorth = 2; break;
+ case 4 : colorth = 3; break;
+ case 5 : colorth = 4; break;
+ default: colorth = 2;
}
}
if(CRT1ModeNo >= 0x13) {
- if(HwInfo->jChipType == SIS_300) {
- index = SiS_GetReg(SiS_Pr->SiS_P3c4,0x3A);
- } else {
- index = SiS_GetReg(SiS_Pr->SiS_P3c4,0x1A);
- }
- index &= 0x07;
- MCLK = SiS_Pr->SiS_MCLKData_0[index].CLOCK; /* Get MCLK */
+ if(HwInfo->jChipType == SIS_300) {
+ index = SiS_GetReg(SiS_Pr->SiS_P3c4,0x3A);
+ } else {
+ index = SiS_GetReg(SiS_Pr->SiS_P3c4,0x1A);
+ }
+ index &= 0x07;
+ MCLK = SiS_Pr->SiS_MCLKData_0[index].CLOCK; /* Get MCLK */
- data2 = (colorth * VCLK) / MCLK;
+ data2 = (colorth * VCLK) / MCLK;
- temp = SiS_GetReg(SiS_Pr->SiS_P3c4,0x14);
- temp = ((temp & 0x00FF) >> 6) << 1;
- if(temp == 0) temp = 1;
- temp <<= 2;
- temp &= 0xff;
+ temp = SiS_GetReg(SiS_Pr->SiS_P3c4,0x14);
+ temp = ((temp & 0x00FF) >> 6) << 1;
+ if(temp == 0) temp = 1;
+ temp <<= 2;
+ temp &= 0xff;
- data2 = temp - data2;
+ data2 = temp - data2;
- if((28 * 16) % data2) {
- data2 = (28 * 16) / data2;
- data2++;
- } else {
- data2 = (28 * 16) / data2;
- }
+ if((28 * 16) % data2) {
+ data2 = (28 * 16) / data2;
+ data2++;
+ } else {
+ data2 = (28 * 16) / data2;
+ }
- if(HwInfo->jChipType == SIS_300) {
-
- tempah = SiS_GetReg(SiS_Pr->SiS_P3c4,0x18);
- tempah &= 0x62;
- tempah >>= 1;
- tempal = tempah;
- tempah >>= 3;
- tempal |= tempah;
- tempal &= 0x07;
- tempcl = ThTiming[tempal];
- tempbx = SiS_GetReg(SiS_Pr->SiS_P3c4,0x16);
- tempbx >>= 6;
- tempah = SiS_GetReg(SiS_Pr->SiS_P3c4,0x14);
- tempah >>= 4;
- tempah &= 0x0c;
- tempbx |= tempah;
+ if(HwInfo->jChipType == SIS_300) {
+
+ tempah = tempal = (SiS_GetReg(SiS_Pr->SiS_P3c4,0x18) & 0x62) >> 1;
+ tempcl = ThTiming[((tempah >> 3) | tempal) & 0x07];
+ tempbx = SiS_GetReg(SiS_Pr->SiS_P3c4,0x16) >> 6;
+ tempbx |= ((SiS_GetReg(SiS_Pr->SiS_P3c4,0x14) >> 4) & 0x0c);
tempbx <<= 1;
- tempal = ThLowB[tempbx + 1];
- tempal *= tempcl;
- tempal += ThLowB[tempbx];
- data = tempal;
+ data = (ThLowB[tempbx + 1] * tempcl) + ThLowB[tempbx];
- } else if(HwInfo->jChipType == SIS_730) {
+ } else if(HwInfo->jChipType == SIS_730) {
#ifdef LINUX_KERNEL
- SiS_SetRegLong(0xcf8,0x80000050);
- eax = SiS_GetRegLong(0xcfc);
+ SiS_SetRegLong(0xcf8,0x80000050);
+ eax = SiS_GetRegLong(0xcfc);
#else
- eax = pciReadLong(0x00000000, 0x50);
+ eax = pciReadLong(0x00000000, 0x50);
#endif
- tempal = (USHORT)(eax >> 8);
- tempal &= 0x06;
- tempal <<= 5;
+ tempal = (((USHORT)(eax >> 8)) & 0x06) << 5;
#ifdef LINUX_KERNEL
- SiS_SetRegLong(0xcf8,0x800000A0);
- eax = SiS_GetRegLong(0xcfc);
+ SiS_SetRegLong(0xcf8,0x800000A0);
+ eax = SiS_GetRegLong(0xcfc);
#else
- eax = pciReadLong(0x00000000, 0xA0);
-#endif
- temp = (USHORT)(eax >> 28);
- temp &= 0x0F;
- tempal |= temp;
-
- tempbx = tempal; /* BIOS BUG (2.04.5d, 2.04.6a use ah here, which is unset!) */
- tempbx = 0; /* -- do it like the BIOS anyway... */
- tempax = tempbx;
- tempbx &= 0xc0;
- tempbx >>= 6;
- tempax &= 0x0f;
- tempax *= 3;
- tempbx += tempax;
-
- data = LatencyFactor730[tempbx];
- data += 15;
- temp = SiS_GetReg(SiS_Pr->SiS_P3c4,0x14);
- if(!(temp & 0x80)) data += 5;
+ eax = pciReadLong(0x00000000, 0xA0);
+#endif
+ temp = ((USHORT)(eax >> 28)) & 0x0f;
+ tempal |= temp;
+
+ tempbx = tempal; /* BIOS BUG (2.04.5d, 2.04.6a use ah here, which is unset!) */
+ tempbx = 0; /* -- do it like the BIOS anyway... */
+ tempax = (tempbx & 0x0f) * 3;
+ tempbx &= 0xc0;
+ tempbx >>= 6;
+ tempbx += tempax;
+
+ data = LatencyFactor730[tempbx] + 15;
+ if(!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x14) & 0x80)) data += 5;
} else {
- index = 0;
- temp = SiS_GetReg(SiS_Pr->SiS_P3c4,0x14);
- if(temp & 0x0080) index += 12;
+ index = 0;
+ if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x14) & 0x80) index += 12;
#ifdef LINUX_KERNEL
- SiS_SetRegLong(0xcf8,0x800000A0);
- eax = SiS_GetRegLong(0xcfc);
+ SiS_SetRegLong(0xcf8,0x800000A0);
+ eax = SiS_GetRegLong(0xcfc);
#else
- /* We use pci functions X offers. We use tag 0, because
- * we want to read/write to the host bridge (which is always
- * 00:00.0 on 630, 730 and 540), not the VGA device.
- */
- eax = pciReadLong(0x00000000, 0xA0);
+ eax = pciReadLong(0x00000000, 0xA0);
#endif
- temp = (USHORT)(eax >> 24);
- if(!(temp&0x01)) index += 24;
+ temp = (USHORT)(eax >> 24);
+ if(!(temp & 0x01)) index += 24;
#ifdef LINUX_KERNEL
- SiS_SetRegLong(0xcf8,0x80000050);
- eax = SiS_GetRegLong(0xcfc);
+ SiS_SetRegLong(0xcf8,0x80000050);
+ eax = SiS_GetRegLong(0xcfc);
#else
- eax = pciReadLong(0x00000000, 0x50);
+ eax = pciReadLong(0x00000000, 0x50);
#endif
- temp=(USHORT)(eax >> 24);
- if(temp & 0x01) index += 6;
+ temp = eax >> 24;
+ if(temp & 0x01) index += 6;
+ index += ((temp & 0x0f) >> 1);
- temp = (temp & 0x0F) >> 1;
- index += temp;
-
- data = LatencyFactor[index];
- data += 15;
- temp = SiS_GetReg(SiS_Pr->SiS_P3c4,0x14);
- if(!(temp & 0x80)) data += 5;
- }
+ data = LatencyFactor[index] + 15;
+ if(!(SiS_GetReg(SiS_Pr->SiS_P3c4,0x14) & 0x80)) data += 5;
+ }
- data += data2; /* CRT1 Request Period */
+ data += data2; /* CRT1 Request Period */
- SiS_Pr->SiS_SetFlag |= ProgrammingCRT2;
- SiS_Pr->SiS_SelectCRT2Rate = SelectRate_backup;
+ SiS_Pr->SiS_SetFlag |= ProgrammingCRT2;
+ SiS_Pr->SiS_SelectCRT2Rate = SelectRate_backup;
- if(!SiS_Pr->UseCustomMode) {
+ if(!SiS_Pr->UseCustomMode) {
- CRT2ModeNo = ModeNo;
- SiS_SearchModeID(SiS_Pr, &CRT2ModeNo, &modeidindex);
+ CRT2ModeNo = ModeNo;
+ SiS_SearchModeID(SiS_Pr, &CRT2ModeNo, &modeidindex);
- refreshratetableindex = SiS_GetRatePtr(SiS_Pr, CRT2ModeNo, modeidindex, HwInfo);
+ refreshratetableindex = SiS_GetRatePtr(SiS_Pr, CRT2ModeNo, modeidindex, HwInfo);
- index = SiS_GetVCLK2Ptr(SiS_Pr,CRT2ModeNo,modeidindex,
- refreshratetableindex,HwInfo);
- VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; /* Get VCLK */
+ index = SiS_GetVCLK2Ptr(SiS_Pr,CRT2ModeNo,modeidindex,
+ refreshratetableindex,HwInfo);
+ VCLK = SiS_Pr->SiS_VCLKData[index].CLOCK; /* Get VCLK */
- if((SiS_Pr->SiS_CustomT == CUT_BARCO1366) || (SiS_Pr->SiS_CustomT == CUT_BARCO1024)) {
- if(SiS_Pr->SiS_UseROM) {
- if(ROMAddr[0x220] & 0x01) {
- VCLK = ROMAddr[0x229] | (ROMAddr[0x22a] << 8);
- }
- }
- }
+ if((SiS_Pr->SiS_CustomT == CUT_BARCO1366) || (SiS_Pr->SiS_CustomT == CUT_BARCO1024)) {
+ if(SiS_Pr->SiS_UseROM) {
+ if(ROMAddr[0x220] & 0x01) {
+ VCLK = ROMAddr[0x229] | (ROMAddr[0x22a] << 8);
+ }
+ }
+ }
- } else {
+ } else {
- CRT2ModeNo = 0xfe;
- VCLK = SiS_Pr->CSRClock; /* Get VCLK */
+ CRT2ModeNo = 0xfe;
+ VCLK = SiS_Pr->CSRClock; /* Get VCLK */
- }
+ }
- colorth = SiS_GetColorDepth(SiS_Pr,CRT2ModeNo,modeidindex); /* Get colordepth */
- colorth >>= 1;
- if(!colorth) colorth++;
+ colorth = SiS_GetColorDepth(SiS_Pr,CRT2ModeNo,modeidindex); /* Get colordepth */
+ colorth >>= 1;
+ if(!colorth) colorth++;
- data = data * VCLK * colorth;
- if(data % (MCLK << 4)) {
- data = data / (MCLK << 4);
- data++;
- } else {
- data = data / (MCLK << 4);
- }
+ data = data * VCLK * colorth;
+ if(data % (MCLK << 4)) {
+ data = data / (MCLK << 4);
+ data++;
+ } else {
+ data = data / (MCLK << 4);
+ }
- if(data <= 6) data = 6;
- if(data > 0x14) data = 0x14;
+ if(data <= 6) data = 6;
+ if(data > 0x14) data = 0x14;
- temp = SiS_GetReg(SiS_Pr->SiS_Part1Port,0x01);
- if(HwInfo->jChipType == SIS_300) {
- if(data <= 0x0f) temp = (temp & (~0x1F)) | 0x13;
- else temp = (temp & (~0x1F)) | 0x16;
- if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) {
- temp = (temp & (~0x1F)) | 0x13;
- }
- } else {
- if( ( (HwInfo->jChipType == SIS_630) ||
- (HwInfo->jChipType == SIS_730) ) &&
- (HwInfo->jChipRevision >= 0x30) ) /* 630s or 730(s?) */
- {
- temp = (temp & (~0x1F)) | 0x1b;
- } else {
- temp = (temp & (~0x1F)) | 0x16;
- }
- }
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x01,0xe0,temp);
+ temp = SiS_GetReg(SiS_Pr->SiS_Part1Port,0x01);
+ if(HwInfo->jChipType == SIS_300) {
+ if(data <= 0x0f) temp = (temp & (~0x1F)) | 0x13;
+ else temp = (temp & (~0x1F)) | 0x16;
+ if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) {
+ temp = (temp & (~0x1F)) | 0x13;
+ }
+ } else {
+ if( ( (HwInfo->jChipType == SIS_630) ||
+ (HwInfo->jChipType == SIS_730) ) &&
+ (HwInfo->jChipRevision >= 0x30) ) /* 630s or 730(s?) */
+ {
+ temp = (temp & (~0x1F)) | 0x1b;
+ } else {
+ temp = (temp & (~0x1F)) | 0x16;
+ }
+ }
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x01,0xe0,temp);
- if( (HwInfo->jChipType == SIS_630) &&
- (HwInfo->jChipRevision >= 0x30) ) /* 630s, NOT 730 */
- {
- if(data > 0x13) data = 0x13;
- }
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x02,0xe0,data);
+ if( (HwInfo->jChipType == SIS_630) &&
+ (HwInfo->jChipRevision >= 0x30) ) /* 630s, NOT 730 */
+ {
+ if(data > 0x13) data = 0x13;
+ }
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x02,0xe0,data);
} else { /* If mode <= 0x13, we just restore everything */
- SiS_Pr->SiS_SetFlag |= ProgrammingCRT2;
- SiS_Pr->SiS_SelectCRT2Rate = SelectRate_backup;
+ SiS_Pr->SiS_SetFlag |= ProgrammingCRT2;
+ SiS_Pr->SiS_SelectCRT2Rate = SelectRate_backup;
}
}
@@ -5236,9 +5266,9 @@ SiS_SetCRT2FIFO_310(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
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,0x04);
}
-
+
}
#endif
@@ -5261,7 +5291,7 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
USHORT temp, modeflag, i, j, xres=0, VGAVDE;
const USHORT CRTranslation[] = {
/* CR0 CR1 CR2 CR3 CR4 CR5 CR6 CR7 */
- 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,
+ 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a,
/* CR8 CR9 SR0A SR0B SR0C SR0D SR0E CR0F */
0x00, 0x0b, 0x17, 0x18, 0x19, 0x00, 0x1a, 0x00,
/* CR10 CR11 CR12 CR13 CR14 CR15 CR16 CR17 */
@@ -5285,22 +5315,22 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x31,0x04);
}
}
-
+
SiS_Pr->CHTotal = 8224; /* Max HT, 0x2020, results in 0x3ff in registers */
-
- SiS_Pr->CHDisplay = SiS_Pr->SiS_VGAHDE;
+
+ SiS_Pr->CHDisplay = SiS_Pr->SiS_VGAHDE;
if(modeflag & HalfDCLK) SiS_Pr->CHDisplay >>= 1;
-
+
SiS_Pr->CHBlankStart = SiS_Pr->CHDisplay;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
SiS_Pr->CHBlankStart += 16;
}
-
- SiS_Pr->CHBlankEnd = 32;
+
+ SiS_Pr->CHBlankEnd = 32;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
if(xres == 1600) SiS_Pr->CHBlankEnd += 80;
}
-
+
temp = SiS_Pr->SiS_VGAHT - 96;
if(!(modeflag & HalfDCLK)) temp -= 32;
if(SiS_Pr->SiS_LCDInfo & LCDPass11) {
@@ -5312,11 +5342,11 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
if(SiS_Pr->SiS_RVBHRS2) temp = SiS_Pr->SiS_RVBHRS2;
}
SiS_Pr->CHSyncStart = temp;
-
+
SiS_Pr->CHSyncEnd = 0xffe8; /* results in 0x2000 in registers */
-
+
SiS_Pr->CVTotal = 2049; /* Max VT, 0x0801, results in 0x7ff in registers */
-
+
VGAVDE = SiS_Pr->SiS_VGAVDE;
if (VGAVDE == 357) VGAVDE = 350;
else if(VGAVDE == 360) VGAVDE = 350;
@@ -5326,21 +5356,21 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
else if(VGAVDE == 525) VGAVDE = 480;
else if(VGAVDE == 1056) VGAVDE = 1024;
SiS_Pr->CVDisplay = VGAVDE;
-
+
SiS_Pr->CVBlankStart = SiS_Pr->CVDisplay;
-
+
SiS_Pr->CVBlankEnd = 1;
if(ModeNo == 0x3c) SiS_Pr->CVBlankEnd = 226;
-
+
temp = (SiS_Pr->SiS_VGAVT - VGAVDE) >> 1;
SiS_Pr->CVSyncStart = VGAVDE + temp;
-
+
temp >>= 3;
SiS_Pr->CVSyncEnd = SiS_Pr->CVSyncStart + temp;
-
+
SiS_CalcCRRegisters(SiS_Pr, 0);
SiS_Pr->CCRT1CRTC[16] &= ~0xE0;
-
+
for(i = 0; i <= 7; i++) {
SiS_SetReg(SiS_Pr->SiS_Part1Port,CRTranslation[i],SiS_Pr->CCRT1CRTC[i]);
}
@@ -5353,22 +5383,22 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
for(i = 0x0a, j = 13; i <= 0x0c; i++, j++) {
SiS_SetReg(SiS_Pr->SiS_Part1Port,CRTranslation[i],SiS_Pr->CCRT1CRTC[j]);
}
-
+
temp = SiS_Pr->CCRT1CRTC[16] & 0xE0;
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,CRTranslation[0x0E],0x1F,temp);
temp = (SiS_Pr->CCRT1CRTC[16] & 0x01) << 5;
if(modeflag & DoubleScanMode) temp |= 0x80;
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,CRTranslation[0x09],0x5F,temp);
-
+
temp = 0;
temp |= (SiS_GetReg(SiS_Pr->SiS_P3c4,0x01) & 0x01);
if(modeflag & HalfDCLK) temp |= 0x08;
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x16,temp); /* SR01: HalfDCLK[3], 8/9 div dotclock[0] */
-
+
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0F,0x00); /* CR14: (text mode: underline location) */
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x12,0x00); /* CR17: n/a */
-
+
temp = 0;
if(SiS_Pr->SiS_LCDInfo & LCDRGB18Bit) {
temp = (SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00) & 0x01) << 7;
@@ -5377,25 +5407,25 @@ SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex,
temp = SiS_GetRegByte((SiS_Pr->SiS_P3ca+0x02));
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1b,temp); /* ? */
-
+
#ifdef TWDEBUG
xf86DrvMsg(0, X_INFO, "%d %d %d %d %d %d %d %d (%d %d %d %d)\n",
- SiS_Pr->CHDisplay, SiS_Pr->CHSyncStart, SiS_Pr->CHSyncEnd, SiS_Pr->CHTotal,
+ SiS_Pr->CHDisplay, SiS_Pr->CHSyncStart, SiS_Pr->CHSyncEnd, SiS_Pr->CHTotal,
SiS_Pr->CVDisplay, SiS_Pr->CVSyncStart, SiS_Pr->CVSyncEnd, SiS_Pr->CVTotal,
SiS_Pr->CHBlankStart, SiS_Pr->CHBlankEnd, SiS_Pr->CVBlankStart, SiS_Pr->CVBlankEnd);
xf86DrvMsg(0, X_INFO, " {{0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,\n",
- SiS_Pr->CCRT1CRTC[0], SiS_Pr->CCRT1CRTC[1],
+ SiS_Pr->CCRT1CRTC[0], SiS_Pr->CCRT1CRTC[1],
SiS_Pr->CCRT1CRTC[2], SiS_Pr->CCRT1CRTC[3],
SiS_Pr->CCRT1CRTC[4], SiS_Pr->CCRT1CRTC[5],
SiS_Pr->CCRT1CRTC[6], SiS_Pr->CCRT1CRTC[7]);
xf86DrvMsg(0, X_INFO, " 0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,\n",
- SiS_Pr->CCRT1CRTC[8], SiS_Pr->CCRT1CRTC[9],
+ SiS_Pr->CCRT1CRTC[8], SiS_Pr->CCRT1CRTC[9],
SiS_Pr->CCRT1CRTC[10], SiS_Pr->CCRT1CRTC[11],
SiS_Pr->CCRT1CRTC[12], SiS_Pr->CCRT1CRTC[13],
SiS_Pr->CCRT1CRTC[14], SiS_Pr->CCRT1CRTC[15]);
xf86DrvMsg(0, X_INFO, " 0x%02x}},\n", SiS_Pr->CCRT1CRTC[16]);
-#endif
+#endif
}
/* Setup panel link
@@ -5406,12 +5436,12 @@ static void
SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
PSIS_HW_INFO HwInfo, USHORT RefreshRateTableIndex)
{
- USHORT modeflag,resinfo;
- USHORT push2,tempax,tempbx,tempcx,temp;
- ULONG tempeax=0,tempebx,tempecx,tempvcfact=0;
+ USHORT modeflag, resinfo = 0;
+ USHORT push2, tempax, tempbx, tempcx, temp;
+ ULONG tempeax = 0, tempebx, tempecx, tempvcfact = 0;
BOOLEAN islvds = FALSE, issis = FALSE, chkdclkfirst = FALSE;
#ifdef SIS300
- USHORT crt2crtc;
+ USHORT crt2crtc = 0;
#endif
#ifdef SIS315H
USHORT pushcx;
@@ -5425,15 +5455,11 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
#endif
} else if(SiS_Pr->UseCustomMode) {
modeflag = SiS_Pr->CModeFlag;
- resinfo = 0;
-#ifdef SIS300
- crt2crtc = 0;
-#endif
} else {
modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
#ifdef SIS300
- crt2crtc = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
+ crt2crtc = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC;
#endif
}
@@ -5486,10 +5512,10 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
tempax = SiS_Pr->SiS_LCDHDES;
if(islvds) {
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
- if((!SiS_Pr->SiS_IF_DEF_FSTN) && (!SiS_Pr->SiS_IF_DEF_DSTN)) {
- if((SiS_Pr->SiS_LCDResInfo == Panel_640x480) &&
- (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode))) {
- tempax -= 8;
+ if(!SiS_Pr->SiS_IF_DEF_FSTN && !SiS_Pr->SiS_IF_DEF_DSTN) {
+ if((SiS_Pr->SiS_LCDResInfo == Panel_640x480) &&
+ (!(SiS_Pr->SiS_VBInfo & SetInSlaveMode))) {
+ tempax -= 8;
}
}
}
@@ -5502,13 +5528,14 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
tempbx = SiS_Pr->SiS_HDE;
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
- if((SiS_Pr->SiS_LCDResInfo == Panel_640x480_2) ||
- (SiS_Pr->SiS_LCDResInfo == Panel_640x480_3)) {
- tempbx >>= 1;
- }
if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) {
tempbx = SiS_Pr->PanelXRes;
}
+ if((SiS_Pr->SiS_LCDResInfo == Panel_320x240_1) ||
+ (SiS_Pr->SiS_LCDResInfo == Panel_320x240_2) ||
+ (SiS_Pr->SiS_LCDResInfo == Panel_320x240_3)) {
+ tempbx >>= 1;
+ }
}
tempax += tempbx;
@@ -5533,25 +5560,25 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
temp = (tempcx >> 3) & 0x00FF;
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
if(SiS_Pr->SiS_IF_DEF_TRUMPION) {
- if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) {
- switch(ModeNo) {
- case 0x04:
- case 0x05:
- case 0x0d: temp = 0x56; break;
- case 0x10: temp = 0x60; break;
- case 0x13: temp = 0x5f; break;
- case 0x40:
- case 0x41:
- case 0x4f:
- case 0x43:
- case 0x44:
- case 0x62:
- case 0x56:
- case 0x53:
- case 0x5d:
- case 0x5e: temp = 0x54; break;
- }
- }
+ if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) {
+ switch(ModeNo) {
+ case 0x04:
+ case 0x05:
+ case 0x0d: temp = 0x56; break;
+ case 0x10: temp = 0x60; break;
+ case 0x13: temp = 0x5f; break;
+ case 0x40:
+ case 0x41:
+ case 0x4f:
+ case 0x43:
+ case 0x44:
+ case 0x62:
+ case 0x56:
+ case 0x53:
+ case 0x5d:
+ case 0x5e: temp = 0x54; break;
+ }
+ }
}
}
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x14,temp); /* BPLHRS */
@@ -5559,12 +5586,12 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
temp += 2;
if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) {
- temp += 8;
- if(SiS_Pr->PanelHRE != 999) {
- temp = tempcx + SiS_Pr->PanelHRE;
+ temp += 8;
+ if(SiS_Pr->PanelHRE != 999) {
+ temp = tempcx + SiS_Pr->PanelHRE;
if(temp >= SiS_Pr->SiS_HT) temp -= SiS_Pr->SiS_HT;
temp >>= 3;
- }
+ }
}
} else {
temp += 10;
@@ -5572,9 +5599,6 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
temp &= 0x1F;
temp |= ((tempcx & 0x07) << 5);
-#if 0
- if(SiS_Pr->SiS_IF_DEF_FSTN) temp = 0x20; /* WRONG? BIOS loads cl, not ah */
-#endif
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x15,temp); /* BPLHRE */
/* Vertical */
@@ -5594,7 +5618,7 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
tempcx = SiS_Pr->SiS_VGAVT - SiS_Pr->SiS_VGAVDE;
if(HwInfo->jChipType < SIS_315H) {
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
- if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) {
+ if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) {
tempcx = SiS_Pr->SiS_VGAVT - SiS_Pr->PanelYRes;
}
}
@@ -5614,12 +5638,12 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
else if(issis) tempbx++;
}
- if(tempbx >= SiS_Pr->SiS_VT) tempbx -= SiS_Pr->SiS_VT;
+ if(tempbx >= SiS_Pr->SiS_VT) tempbx -= SiS_Pr->SiS_VT;
temp = tempbx & 0x00FF;
if(SiS_Pr->SiS_IF_DEF_TRUMPION) {
if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) {
- if(ModeNo == 0x10) temp = 0xa9;
+ if(ModeNo == 0x10) temp = 0xa9;
}
}
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x18,temp); /* BPLVRS */
@@ -5662,35 +5686,35 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x1A,tempbx,temp);
- tempbx = push2; /* BPLVDEE */
+ tempbx = push2; /* BPLVDEE */
tempcx = SiS_Pr->SiS_LCDVDES; /* BPLVDES */
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
switch(SiS_Pr->SiS_LCDResInfo) {
case Panel_640x480:
- tempbx = SiS_Pr->SiS_VGAVDE - 1;
- tempcx = SiS_Pr->SiS_VGAVDE;
+ tempbx = SiS_Pr->SiS_VGAVDE - 1;
+ tempcx = SiS_Pr->SiS_VGAVDE;
break;
case Panel_800x600:
- if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
- if(resinfo == SIS_RI_800x600) tempcx++;
- }
+ if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
+ if(resinfo == SIS_RI_800x600) tempcx++;
+ }
break;
case Panel_1024x600:
- if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
- if(resinfo == SIS_RI_1024x600) tempcx++;
- if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
+ if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
+ if(resinfo == SIS_RI_1024x600) tempcx++;
+ if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) {
if(resinfo == SIS_RI_800x600) tempcx++;
}
- }
+ }
break;
case Panel_1024x768:
- if(HwInfo->jChipType < SIS_315H) {
- if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
- if(resinfo == SIS_RI_1024x768) tempcx++;
+ if(HwInfo->jChipType < SIS_315H) {
+ if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
+ if(resinfo == SIS_RI_1024x768) tempcx++;
}
- }
+ }
break;
}
}
@@ -5698,7 +5722,6 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
temp = ((tempbx >> 8) & 0x07) << 3;
temp = temp | ((tempcx >> 8) & 0x07);
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1D,temp);
- /* if(SiS_Pr->SiS_IF_DEF_FSTN) tempbx++; */
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1C,tempbx);
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1B,tempcx);
@@ -5798,7 +5821,7 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x20,temp);
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x21,tempbx);
- tempecx >>= 16; /* BPLHCFACT */
+ tempecx >>= 16; /* BPLHCFACT */
if(!chkdclkfirst) {
if(modeflag & HalfDCLK) tempecx >>= 1;
}
@@ -5827,17 +5850,26 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
#ifdef SIS300
if(SiS_Pr->SiS_IF_DEF_TRUMPION) {
- int i;
+ UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
+ UCHAR *trumpdata;
+ int i, j = crt2crtc;
UCHAR TrumpMode13[4] = { 0x01, 0x10, 0x2c, 0x00 };
UCHAR TrumpMode10_1[4] = { 0x01, 0x10, 0x27, 0x00 };
UCHAR TrumpMode10_2[4] = { 0x01, 0x16, 0x10, 0x00 };
+ if(SiS_Pr->SiS_UseROM) {
+ trumpdata = &ROMAddr[0x8001 + (j * 80)];
+ } else {
+ if(SiS_Pr->SiS_LCDTypeInfo == 0x0e) j += 7;
+ trumpdata = &SiS300_TrumpionData[j][0];
+ }
+
SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x02,0xbf);
for(i=0; i<5; i++) {
- SiS_SetTrumpionBlock(SiS_Pr, &SiS300_TrumpionData[crt2crtc][0]);
+ SiS_SetTrumpionBlock(SiS_Pr, trumpdata);
}
if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) {
- if(ModeNo == 0x13) {
+ if(ModeNo == 0x13) {
for(i=0; i<4; i++) {
SiS_SetTrumpionBlock(SiS_Pr, &TrumpMode13[0]);
}
@@ -5861,67 +5893,66 @@ SiS_SetGroup1_LVDS(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x29,0x5A);
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x2A,0x4B);
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x44,~0x07,0x03);
- tempax = SiS_Pr->SiS_HDE; /* Blps = lcdhdee(lcdhdes+HDE) + 64 */
- if(SiS_Pr->SiS_LCDResInfo == Panel_640x480_2 ||
- SiS_Pr->SiS_LCDResInfo == Panel_640x480_3) tempax >>= 1;
+ tempax = SiS_Pr->SiS_HDE; /* Blps = lcdhdee(lcdhdes+HDE) + 64 */
+ if(SiS_Pr->SiS_LCDResInfo == Panel_320x240_1 ||
+ SiS_Pr->SiS_LCDResInfo == Panel_320x240_2 ||
+ SiS_Pr->SiS_LCDResInfo == Panel_320x240_3) tempax >>= 1;
tempax += 64;
- temp = tempax & 0x00FF;
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x38,temp);
- temp = ((tempax & 0xFF00) >> 8) << 3;
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x38,tempax & 0xff);
+ temp = (tempax >> 8) << 3;
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x35,~0x078,temp);
- tempax += 32; /* Blpe=lBlps+32 */
- temp = tempax & 0x00FF;
- if(SiS_Pr->SiS_IF_DEF_FSTN) temp = 0;
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x39,temp);
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x3A,0x00); /* Bflml=0 */
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x3C,~0x007,0x00);
+ tempax += 32; /* Blpe = lBlps+32 */
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x39,tempax & 0xff);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x3A,0x00); /* Bflml = 0 */
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x3C,~0x007);
tempax = SiS_Pr->SiS_VDE;
- if(SiS_Pr->SiS_LCDResInfo == Panel_640x480_2 ||
- SiS_Pr->SiS_LCDResInfo == Panel_640x480_3) tempax >>= 1;
+ if(SiS_Pr->SiS_LCDResInfo == Panel_320x240_1 ||
+ SiS_Pr->SiS_LCDResInfo == Panel_320x240_2 ||
+ SiS_Pr->SiS_LCDResInfo == Panel_320x240_3) tempax >>= 1;
tempax >>= 1;
- temp = tempax & 0x00FF;
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x3B,temp);
- temp = ((tempax & 0xFF00) >> 8) << 3;
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x3B,tempax & 0xff);
+ temp = (tempax >> 8) << 3;
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x3C,~0x038,temp);
tempeax = SiS_Pr->SiS_HDE;
- if(SiS_Pr->SiS_LCDResInfo == Panel_640x480_2 ||
- SiS_Pr->SiS_LCDResInfo == Panel_640x480_3) tempeax >>= 1;
- tempeax <<= 2; /* BDxFIFOSTOP = (HDE*4)/128 */
- tempebx = 128;
- temp = (USHORT)(tempeax % tempebx);
- tempeax = tempeax / tempebx;
+ if(SiS_Pr->SiS_LCDResInfo == Panel_320x240_1 ||
+ SiS_Pr->SiS_LCDResInfo == Panel_320x240_2 ||
+ SiS_Pr->SiS_LCDResInfo == Panel_320x240_3) tempeax >>= 1;
+ tempeax <<= 2; /* BDxFIFOSTOP = (HDE*4)/128 */
+ temp = tempeax & 0x7f;
+ tempeax >>= 7;
if(temp) tempeax++;
- temp = (USHORT)(tempeax & 0x003F);
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x45,~0x0FF,temp);
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x3F,0x00); /* BDxWadrst0 */
+ temp = tempeax & 0x3f;
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x45,temp);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x3F,0x00); /* BDxWadrst0 */
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x3E,0x00);
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x3D,0x10);
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x3C,~0x040,0x00);
+ SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x3C,~0x040);
tempax = SiS_Pr->SiS_HDE;
- if(SiS_Pr->SiS_LCDResInfo == Panel_640x480_2 ||
- SiS_Pr->SiS_LCDResInfo == Panel_640x480_3) tempax >>= 1;
- tempax >>= 4; /* BDxWadroff = HDE*4/8/8 */
+ if(SiS_Pr->SiS_LCDResInfo == Panel_320x240_1 ||
+ SiS_Pr->SiS_LCDResInfo == Panel_320x240_2 ||
+ SiS_Pr->SiS_LCDResInfo == Panel_320x240_3) tempax >>= 1;
+ tempax >>= 4; /* BDxWadroff = HDE*4/8/8 */
pushcx = tempax;
temp = tempax & 0x00FF;
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x43,temp);
temp = ((tempax & 0xFF00) >> 8) << 3;
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x44,~0x0F8,temp);
- tempax = SiS_Pr->SiS_VDE; /* BDxWadrst1 = BDxWadrst0 + BDxWadroff * VDE */
- if(SiS_Pr->SiS_LCDResInfo == Panel_640x480_2 ||
- SiS_Pr->SiS_LCDResInfo == Panel_640x480_3) tempax >>= 1;
- tempeax = (tempax * pushcx);
- tempebx = 0x00100000 + tempeax;
- temp = (USHORT)tempebx & 0x000000FF;
+ tempax = SiS_Pr->SiS_VDE; /* BDxWadrst1 = BDxWadrst0 + BDxWadroff * VDE */
+ if(SiS_Pr->SiS_LCDResInfo == Panel_320x240_1 ||
+ SiS_Pr->SiS_LCDResInfo == Panel_320x240_2 ||
+ SiS_Pr->SiS_LCDResInfo == Panel_320x240_3) tempax >>= 1;
+ tempeax = tempax * pushcx;
+ temp = tempeax & 0xFF;
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x42,temp);
- temp = (USHORT)((tempebx & 0x0000FF00) >> 8);
+ temp = (tempeax & 0xFF00) >> 8;
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x41,temp);
- temp = (USHORT)((tempebx & 0x00FF0000) >> 16);
+ temp = ((tempeax & 0xFF0000) >> 16) | 0x10;
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x40,temp);
- temp = (USHORT)(((tempebx & 0x01000000) >> 24) << 7);
+ temp = ((tempeax & 0x01000000) >> 24) << 7;
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x3C,~0x080,temp);
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x2F,0x03);
@@ -5963,7 +5994,7 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
{
#if defined(SIS300) || defined(SIS315H)
UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
-#endif
+#endif
USHORT temp=0, tempax=0, tempbx=0, tempcx=0, bridgeadd=0;
USHORT pushbx=0, CRT1Index=0, modeflag, resinfo=0;
#ifdef SIS315H
@@ -5980,7 +6011,7 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
} else if(SiS_Pr->UseCustomMode) {
modeflag = SiS_Pr->CModeFlag;
} else {
- CRT1Index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC;
+ CRT1Index = SiS_GetRefCRT1CRTC(SiS_Pr, RefreshRateTableIndex, SiS_Pr->SiS_UseWideCRT2);
resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
}
@@ -5993,11 +6024,11 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(HwInfo->jChipType < SIS_315H ) {
#ifdef SIS300
- SiS_SetCRT2FIFO_300(SiS_Pr, ModeNo, HwInfo);
+ SiS_SetCRT2FIFO_300(SiS_Pr, ModeNo, HwInfo);
#endif
} else {
#ifdef SIS315H
- SiS_SetCRT2FIFO_310(SiS_Pr, HwInfo);
+ SiS_SetCRT2FIFO_310(SiS_Pr, HwInfo);
#endif
}
@@ -6007,21 +6038,21 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
#ifdef SIS300 /* ------------- 300 series --------------*/
- temp = (SiS_Pr->SiS_VGAHT - 1) & 0x0FF; /* BTVGA2HT 0x08,0x09 */
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x08,temp); /* CRT2 Horizontal Total */
+ temp = (SiS_Pr->SiS_VGAHT - 1) & 0x0FF; /* BTVGA2HT 0x08,0x09 */
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x08,temp); /* CRT2 Horizontal Total */
- temp = (((SiS_Pr->SiS_VGAHT - 1) & 0xFF00) >> 8) << 4;
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x09,0x0f,temp); /* CRT2 Horizontal Total Overflow [7:4] */
+ temp = (((SiS_Pr->SiS_VGAHT - 1) & 0xFF00) >> 8) << 4;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x09,0x0f,temp); /* CRT2 Horizontal Total Overflow [7:4] */
- temp = (SiS_Pr->SiS_VGAHDE + 12) & 0x0FF; /* BTVGA2HDEE 0x0A,0x0C */
- SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0A,temp); /* CRT2 Horizontal Display Enable End */
+ temp = (SiS_Pr->SiS_VGAHDE + 12) & 0x0FF; /* BTVGA2HDEE 0x0A,0x0C */
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0A,temp); /* CRT2 Horizontal Display Enable End */
pushbx = SiS_Pr->SiS_VGAHDE + 12; /* bx BTVGA2HRS 0x0B,0x0C */
- tempcx = (SiS_Pr->SiS_VGAHT - SiS_Pr->SiS_VGAHDE) >> 2;
- tempbx = pushbx + tempcx;
- tempcx <<= 1;
- tempcx += tempbx;
-
+ tempcx = (SiS_Pr->SiS_VGAHT - SiS_Pr->SiS_VGAHDE) >> 2;
+ tempbx = pushbx + tempcx;
+ tempcx <<= 1;
+ tempcx += tempbx;
+
bridgeadd = 12;
#endif /* SIS300 */
@@ -6056,14 +6087,14 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
tempcx >>= 1;
}
tempbx += 16;
-
+
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) {
@@ -6082,10 +6113,10 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
#endif /* SIS315H */
} /* 315/330 series */
-
+
if(SiS_Pr->SiS_VBType & VB_SISVB) {
-
- if(SiS_Pr->UseCustomMode) {
+
+ if(SiS_Pr->UseCustomMode) {
tempbx = SiS_Pr->CHSyncStart + bridgeadd;
tempcx = SiS_Pr->CHSyncEnd + bridgeadd;
tempax = SiS_Pr->SiS_VGAHT;
@@ -6093,7 +6124,7 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
tempax--;
if(tempcx > tempax) tempcx = tempax;
}
-
+
if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) {
unsigned char cr4, cr14, cr5, cr15;
if(SiS_Pr->UseCustomMode) {
@@ -6107,32 +6138,32 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
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 */
+ 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;
+ 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! */
- }
-
+ }
+
+ 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;
@@ -6145,11 +6176,11 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_VBInfo & (SetCRT2ToSVIDEO | SetCRT2ToAVIDEO)) {
temp--;
}
- }
+ }
} else {
- temp--;
- }
- } else if(HwInfo->jChipType >= SIS_315H) {
+ temp--;
+ }
+ } else if(HwInfo->jChipType >= SIS_315H) {
temp--;
}
}
@@ -6162,8 +6193,8 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x12,temp); /* Overflow */
if((HwInfo->jChipType >= SIS_315H) && (HwInfo->jChipType < SIS_661)) {
- tempbx++;
- tempax = tempbx;
+ tempbx++;
+ tempax = tempbx;
tempcx++;
tempcx -= tempax;
tempcx >>= 2;
@@ -6173,8 +6204,8 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
tempcx += tempbx;
tempcx++;
} else {
- tempbx = (SiS_Pr->SiS_VGAVT + SiS_Pr->SiS_VGAVDE) >> 1; /* BTVGA2VRS 0x10,0x11 */
- tempcx = ((SiS_Pr->SiS_VGAVT - SiS_Pr->SiS_VGAVDE) >> 4) + tempbx + 1; /* BTVGA2VRE 0x11 */
+ tempbx = (SiS_Pr->SiS_VGAVT + SiS_Pr->SiS_VGAVDE) >> 1; /* BTVGA2VRS 0x10,0x11 */
+ tempcx = ((SiS_Pr->SiS_VGAVT - SiS_Pr->SiS_VGAVDE) >> 4) + tempbx + 1; /* BTVGA2VRE 0x11 */
}
if(SiS_Pr->SiS_VBType & VB_SISVB) {
@@ -6182,7 +6213,7 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
tempbx = SiS_Pr->CVSyncStart;
tempcx = SiS_Pr->CVSyncEnd;
}
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) {
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) {
unsigned char cr8, cr7, cr13;
if(SiS_Pr->UseCustomMode) {
cr8 = SiS_Pr->CCRT1CRTC[8];
@@ -6195,11 +6226,11 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
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(cr13 & 0x08) tempbx |= 0x0400;
- }
+ tempbx = cr8;
+ if(cr7 & 0x04) tempbx |= 0x0100;
+ if(cr7 & 0x80) tempbx |= 0x0200;
+ if(cr13 & 0x08) tempbx |= 0x0400;
+ }
}
SiS_SetReg(SiS_Pr->SiS_Part1Port,0x10,tempbx); /* CRT2 Vertical Retrace Start */
@@ -6226,13 +6257,13 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_LCDResInfo == Panel_Custom) temp = 0x2c;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) temp = 0x08;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) {
- if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) temp = 0x2c;
- else temp = 0x20;
- }
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) temp = 0x2c;
+ else temp = 0x20;
+ }
if(SiS_Pr->SiS_UseROM) {
if(ROMAddr[0x220] & 0x80) {
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoYPbPrHiVision)
- temp = ROMAddr[0x221];
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoYPbPrHiVision)
+ temp = ROMAddr[0x221];
else if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision)
temp = ROMAddr[0x222];
else if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024)
@@ -6259,9 +6290,9 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
if(SiS_Pr->PDC != -1) temp = SiS_Pr->PDC & 0x3c;
}
- }
+ }
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,~0x3C,temp); /* Panel Link Delay Compensation; (Software Command Reset; Power Saving) */
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x13,~0x3C,temp); /* Panel Link Delay Compensation; (Software Command Reset; Power Saving) */
#endif /* SIS300 */
@@ -6269,7 +6300,7 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
#ifdef SIS315H /* --------------- 315/330 series ---------------*/
- if(HwInfo->jChipType < SIS_661) {
+ if(HwInfo->jChipType < SIS_661) {
if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
@@ -6297,10 +6328,10 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
} /* < 661 */
- tempax = 0;
- if(modeflag & DoubleScanMode) tempax |= 0x80;
- if(modeflag & HalfDCLK) tempax |= 0x40;
- SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2C,0x3f,tempax);
+ tempax = 0;
+ if(modeflag & DoubleScanMode) tempax |= 0x80;
+ if(modeflag & HalfDCLK) tempax |= 0x40;
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2C,0x3f,tempax);
#endif /* SIS315H */
@@ -6310,19 +6341,19 @@ SiS_SetGroup1(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_VBType & VB_SISVB) {
if((SiS_Pr->SiS_VBType & VB_NoLCD) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) {
- /* For 301BDH with LCD, we set up the Panel Link */
+ /* For 301BDH with LCD, we set up the Panel Link */
SiS_SetGroup1_LVDS(SiS_Pr, ModeNo, ModeIdIndex, HwInfo, RefreshRateTableIndex);
} else if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
- SiS_SetGroup1_301(SiS_Pr, ModeNo, ModeIdIndex, HwInfo, RefreshRateTableIndex);
+ SiS_SetGroup1_301(SiS_Pr, ModeNo, ModeIdIndex, HwInfo, RefreshRateTableIndex);
}
} else {
if(HwInfo->jChipType < SIS_315H) {
SiS_SetGroup1_LVDS(SiS_Pr, ModeNo, ModeIdIndex, HwInfo, RefreshRateTableIndex);
} else {
if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
- if((!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) || (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
- SiS_SetGroup1_LVDS(SiS_Pr, ModeNo,ModeIdIndex, HwInfo,RefreshRateTableIndex);
- }
+ if((!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) || (SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
+ SiS_SetGroup1_LVDS(SiS_Pr, ModeNo,ModeIdIndex, HwInfo,RefreshRateTableIndex);
+ }
} else {
SiS_SetGroup1_LVDS(SiS_Pr, ModeNo,ModeIdIndex, HwInfo,RefreshRateTableIndex);
}
@@ -6383,7 +6414,7 @@ SiS_SetGroup2_C_ELV(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
int i, j;
UCHAR temp;
- if(!(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302ELV))) return;
+ if(!(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302ELV))) return;
tableptr = SiS_GetGroup2CLVXPtr(SiS_Pr, 0, HwInfo);
for(i = 0x80, j = 0; i <= 0xbf; i++, j++) {
@@ -6405,9 +6436,9 @@ SiS_GetCRT2Part2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,
USHORT RefreshRateTableIndex,USHORT *CRT2Index,
USHORT *ResIndex,PSIS_HW_INFO HwInfo)
{
-
+
if(HwInfo->jChipType < SIS_315H) return FALSE;
-
+
if(ModeNo <= 0x13)
(*ResIndex) = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC;
else
@@ -6494,7 +6525,7 @@ SiS_Group2LCDSpecial(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo, US
/* For ECS A907. Highly preliminary. */
static void
SiS_Set300Part2Regs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
- USHORT ModeIdIndex, USHORT RefreshRateTableIndex,
+ USHORT ModeIdIndex, USHORT RefreshRateTableIndex,
USHORT ModeNo)
{
USHORT crt2crtc, resindex;
@@ -6809,7 +6840,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) tempcx--;
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x1B,tempcx);
SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x1D,0xF0,((tempcx >> 8) & 0x0f));
-
+
tempcx = SiS_Pr->SiS_HT >> 1;
if(SiS_IsDualLink(SiS_Pr, HwInfo)) tempcx >>= 1;
tempcx += 7;
@@ -6869,7 +6900,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
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 */
}
@@ -6885,7 +6916,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
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));
}
@@ -6900,8 +6931,8 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
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)) {
+
+ if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302LV | VB_SIS302ELV)) {
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x10,0xbf,((tempbx & 0x0400) >> 4));
}
}
@@ -6918,10 +6949,10 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
if(SiS_Pr->SiS_VGAHDE >= 1024) {
if((!(modeflag & HalfDCLK)) || (HwInfo->jChipType < SIS_315H)) {
- tempch = 0x19;
+ tempch = 0x19;
tempcl = 0x20;
if(SiS_Pr->SiS_VGAHDE >= 1280) {
- tempch = 0x14;
+ tempch = 0x14;
tempbx &= ~0x20;
}
}
@@ -7021,7 +7052,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
tempcx = SiS_Pr->SiS_VT - 1;
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x19,tempcx);
- temp = (tempcx >> 3) & 0xE0;
+ 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) {
@@ -7063,7 +7094,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
} else {
#endif
-
+
/* Checked for 1024x768, 1280x1024, 1400x1050, 1600x1200 */
/* Clevo dual-link 1024x768 */
/* Compaq 1280x1024 has HT 1696 sometimes (calculation OK, if given HT is correct) */
@@ -7176,13 +7207,14 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
bridgeoffset = 7;
if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) bridgeoffset += 2;
- if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302ELV)) bridgeoffset++;
- if(SiS_IsDualLink(SiS_Pr, HwInfo)) bridgeoffset++;
+ if(SiS_Pr->SiS_VBType & (VB_SIS301C | VB_SIS302ELV)) bridgeoffset += 2; /* OK for Averatec 1280x800 (301C) */
+ if(SiS_IsDualLink(SiS_Pr, HwInfo)) bridgeoffset++;
+ /* Higher bridgeoffset shifts to the LEFT */
temp = 0;
if((SiS_Pr->SiS_LCDInfo & DontExpandLCD) && (!(SiS_Pr->SiS_LCDInfo & LCDPass11))) {
if(SiS_Pr->PanelXRes != SiS_Pr->SiS_HDE) {
- temp = SiS_Pr->SiS_HT - ((SiS_Pr->PanelXRes - SiS_Pr->SiS_HDE) / 2);
+ temp = SiS_Pr->SiS_HT - ((SiS_Pr->PanelXRes - SiS_Pr->SiS_HDE) / 2);
if(SiS_IsDualLink(SiS_Pr, HwInfo)) temp >>= 1;
}
}
@@ -7201,7 +7233,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
if(SiS_IsDualLink(SiS_Pr, HwInfo)) {
tempcx >>= 1;
tempbx >>= 1;
- tempax >>= 1;
+ tempax >>= 1;
}
#ifdef TWDEBUG
@@ -7268,7 +7300,7 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr
#endif
#ifdef SIS315H
} /* CRT2-LCD from table */
-#endif
+#endif
}
/*********************************************/
@@ -7337,6 +7369,7 @@ SiS_SetGroup3(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
/*********************************************/
#ifdef SIS315H
+#if 0
static void
SiS_ShiftXPos(SiS_Private *SiS_Pr, int shift)
{
@@ -7356,16 +7389,22 @@ SiS_ShiftXPos(SiS_Private *SiS_Pr, int shift)
SiS_SetReg(SiS_Pr->SiS_Part2Port,0x43,temp);
SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x42,0x0f,((temp >> 4) & 0xf0));
}
+#endif
static void
SiS_SetGroup4_C_ELV(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
USHORT ModeNo, USHORT ModeIdIndex)
{
USHORT temp, temp1, resinfo = 0;
+ UCHAR *ROMAddr = HwInfo->pjVirtualRomBase;
if(!(SiS_Pr->SiS_VBType & VB_SIS301C)) return;
if(!(SiS_Pr->SiS_VBInfo & (SetCRT2ToHiVision | SetCRT2ToYPbPr525750))) return;
+ if((HwInfo->jChipType >= SIS_661) && (SiS_Pr->SiS_ROMNew)) {
+ if(!(ROMAddr[0x61] & 0x04)) return;
+ }
+
if(ModeNo > 0x13) {
resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO;
}
@@ -7389,17 +7428,22 @@ SiS_SetGroup4_C_ELV(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x0f,0xfb,temp1);
if(SiS_Pr->SiS_TVMode & TVAspect43LB) temp |= 0x01;
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0x7c,(temp & 0xff));
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x3a,0xfb,(temp >> 8));
+ if(ModeNo > 0x13) {
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x39,0xfd);
+ }
} else {
temp1 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x3b) & 0x03;
if(temp1 == 0x01) temp |= 0x01;
if(temp1 == 0x03) temp |= 0x04; /* ? why not 0x10? */
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x26,0xf8,(temp & 0xff));
- }
- SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x3a,0xfb,(temp >> 8));
- if(ModeNo > 0x13) {
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x3b,0xfd);
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x3a,0xfb,(temp >> 8));
+ if(ModeNo > 0x13) {
+ SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x3b,0xfd);
+ }
}
+#if 0
if(HwInfo->jChipType >= SIS_661) { /* ? */
if(SiS_Pr->SiS_TVMode & TVAspect43) {
if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) {
@@ -7413,7 +7457,10 @@ SiS_SetGroup4_C_ELV(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,
}
}
}
+#endif
+
}
+
}
#endif
@@ -7497,9 +7544,9 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x2a,0x00);
-#ifdef SET_EMI
+#ifdef SET_EMI
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
-#endif
+#endif
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10);
}
}
@@ -7529,7 +7576,7 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
tempbx = SiS_Pr->SiS_VGAHDE;
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 = 0x60;
@@ -7546,23 +7593,28 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(tempbx >= 1024) temp = 0xA0;
}
+ temp |= SiS_Pr->Init_P4_0E;
+
if(SiS_Pr->SiS_VBType & VB_SIS301) {
- if(SiS_Pr->SiS_LCDResInfo != Panel_1280x1024) temp |= 0x0A;
+ if(SiS_Pr->SiS_LCDResInfo != Panel_1280x1024) {
+ temp &= 0xf0;
+ temp |= 0x0A;
+ }
}
SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x0E,0x10,temp);
-
- tempeax = SiS_Pr->SiS_VGAVDE;
+
+ 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;
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x18,tempcx);
tempcx >>= 8;
tempcx |= 0x40;
-
+
if(tempeax <= tempebx) {
tempcx ^= 0x40;
} else {
@@ -7603,7 +7655,7 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
tempax /= 32;
if(temp) tempax++;
tempax++;
- if((SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoYPbPrHiVision) ||
+ if((SiS_Pr->SiS_VBInfo & SetCRT2ToTVNoYPbPrHiVision) ||
(SiS_Pr->SiS_TVMode & TVSetYPbPr525i)) {
if(resinfo == SIS_RI_1024x768) {
/* Otherwise white line at right edge */
@@ -7611,9 +7663,9 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
}
}
- }
+ }
tempax--;
- temp = ((tempax >> 4) & 0x30) | tempbx;
+ temp = ((tempax >> 4) & 0x30) | tempbx;
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x1D,tempax);
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x1E,temp);
@@ -7654,9 +7706,9 @@ SiS_SetGroup4(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x2a,0x00);
-#ifdef SET_EMI
+#ifdef SET_EMI
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
-#endif
+#endif
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10);
}
}
@@ -7695,7 +7747,8 @@ SiS_GetLVDSCRT1Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
USHORT *DisplayType)
{
USHORT modeflag=0;
-
+ BOOLEAN checkhd = TRUE;
+
/* Pass 1:1 not supported here */
if(ModeNo <= 0x13) {
@@ -7709,7 +7762,7 @@ SiS_GetLVDSCRT1Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
(*ResIndex) &= 0x3F;
if((SiS_Pr->SiS_IF_DEF_CH70xx) && (SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) {
-
+
(*DisplayType) = 80;
if((SiS_Pr->SiS_TVMode & TVSetPAL) && (!(SiS_Pr->SiS_TVMode & TVSetPALM))) {
(*DisplayType) = 82;
@@ -7720,33 +7773,34 @@ SiS_GetLVDSCRT1Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if((*DisplayType) != 84) {
if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) (*DisplayType)++;
}
-
+
} else {
-
+
(*DisplayType = 0);
switch(SiS_Pr->SiS_LCDResInfo) {
- case Panel_640x480: (*DisplayType) = 10; break;
- case Panel_640x480_2: (*DisplayType) = 14; break;
- case Panel_640x480_3: (*DisplayType) = 18; break;
- case Panel_1024x600: (*DisplayType) = 26; break;
+ case Panel_320x240_1: (*DisplayType) = 50;
+ checkhd = FALSE;
+ break;
+ case Panel_320x240_2: (*DisplayType) = 14;
+ break;
+ case Panel_320x240_3: (*DisplayType) = 18;
+ break;
+ case Panel_640x480: (*DisplayType) = 10;
+ break;
+ case Panel_1024x600: (*DisplayType) = 26;
+ break;
default: return TRUE;
}
- if(modeflag & HalfDCLK) (*DisplayType)++;
+ if(checkhd) {
+ if(modeflag & HalfDCLK) (*DisplayType)++;
+ }
if(SiS_Pr->SiS_LCDResInfo == Panel_1024x600) {
if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) (*DisplayType) += 2;
}
-
- }
-#if 0
- if(SiS_Pr->SiS_IF_DEF_FSTN) {
- if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel320x480){
- (*DisplayType) = 50;
- }
}
-#endif
return TRUE;
}
@@ -7758,7 +7812,7 @@ SiS_ModCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
USHORT tempah,i,modeflag,j,ResIndex,DisplayType;
const SiS_LVDSCRT1DataStruct *LVDSCRT1Ptr=NULL;
const USHORT CRIdx[] = {
- 0x00, 0x02, 0x03, 0x04, 0x05, 0x06,
+ 0x00, 0x02, 0x03, 0x04, 0x05, 0x06,
0x07, 0x10, 0x11, 0x15, 0x16
};
@@ -7766,17 +7820,17 @@ SiS_ModCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
(SiS_Pr->SiS_CustomT == CUT_BARCO1024) ||
(SiS_Pr->SiS_CustomT == CUT_PANEL848))
return;
-
+
if(SiS_Pr->SiS_IF_DEF_LVDS) {
if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) {
if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) return;
}
} else if(SiS_Pr->SiS_VBType & VB_SISVB) {
if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) return;
- } else return;
-
+ } else return;
+
if(SiS_Pr->SiS_LCDInfo & LCDPass11) return;
-
+
if(HwInfo->jChipType < SIS_315H) {
if(SiS_Pr->SiS_SetFlag & SetDOSMode) return;
}
@@ -7787,30 +7841,30 @@ SiS_ModCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
}
switch(DisplayType) {
+ case 50: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1320x240_1; break; /* xSTN */
+ case 14: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1320x240_2; break; /* xSTN */
+ case 15: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1320x240_2_H; break; /* xSTN */
+ case 18: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1320x240_3; break; /* xSTN */
+ case 19: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1320x240_3_H; break; /* xSTN */
case 10: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1640x480_1; break;
case 11: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1640x480_1_H; break;
- case 14: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1640x480_2; break;
- case 15: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1640x480_2_H; break;
- case 18: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1640x480_3; break;
- case 19: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1640x480_3_H; break;
-#if 0 /* Works better with calculated numbers */
+#if 0 /* Works better with calculated numbers */
case 26: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x600_1; break;
case 27: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x600_1_H; break;
case 28: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x600_2; break;
case 29: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x600_2_H; break;
-#endif
- case 50: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1320x480_1; break; /* FSTN */
+#endif
case 80: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1UNTSC; break;
case 81: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1ONTSC; break;
case 82: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1UPAL; break;
case 83: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1OPAL; break;
case 84: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1SOPAL; break;
}
-
+
if(LVDSCRT1Ptr) {
-
+
SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f);
-
+
for(i = 0; i <= 10; i++) {
tempah = (LVDSCRT1Ptr + ResIndex)->CR[i];
SiS_SetReg(SiS_Pr->SiS_P3d4,CRIdx[i],tempah);
@@ -7823,18 +7877,18 @@ SiS_ModCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
tempah = (LVDSCRT1Ptr + ResIndex)->CR[14] & 0xE0;
SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0E,0x1f,tempah);
-
+
if(ModeNo <= 0x13) modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag;
else modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag;
tempah = ((LVDSCRT1Ptr + ResIndex)->CR[14] & 0x01) << 5;
- if(modeflag & DoubleScanMode) tempah |= 0x080;
+ if(modeflag & DoubleScanMode) tempah |= 0x80;
SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,~0x020,tempah);
-
+
} else {
-
- SiS_CalcLCDACRT1Timing(SiS_Pr, ModeNo, ModeIdIndex, HwInfo);
-
+
+ SiS_CalcLCDACRT1Timing(SiS_Pr, ModeNo, ModeIdIndex, HwInfo);
+
}
}
@@ -7851,15 +7905,15 @@ SiS_SetCRT2ECLK(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
UCHAR sr2b, sr2c;
if((SiS_Pr->SiS_LCDResInfo == Panel_640x480) || (SiS_Pr->SiS_LCDInfo & LCDPass11)) {
- SiS_Pr->SiS_SetFlag &= (~ProgrammingCRT2);
- if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK == 2) {
- RefreshRateTableIndex--;
- }
- vclkindex = SiS_GetVCLK2Ptr(SiS_Pr, ModeNo, ModeIdIndex,
+ SiS_Pr->SiS_SetFlag &= (~ProgrammingCRT2);
+ if(SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK == 2) {
+ RefreshRateTableIndex--;
+ }
+ vclkindex = SiS_GetVCLK2Ptr(SiS_Pr, ModeNo, ModeIdIndex,
RefreshRateTableIndex, HwInfo);
- SiS_Pr->SiS_SetFlag |= ProgrammingCRT2;
+ SiS_Pr->SiS_SetFlag |= ProgrammingCRT2;
} else {
- vclkindex = SiS_GetVCLK2Ptr(SiS_Pr, ModeNo, ModeIdIndex,
+ vclkindex = SiS_GetVCLK2Ptr(SiS_Pr, ModeNo, ModeIdIndex,
RefreshRateTableIndex, HwInfo);
}
@@ -7869,7 +7923,7 @@ SiS_SetCRT2ECLK(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if((SiS_Pr->SiS_CustomT == CUT_BARCO1366) || (SiS_Pr->SiS_CustomT == CUT_BARCO1024)) {
if(SiS_Pr->SiS_UseROM) {
if(ROMAddr[0x220] & 0x01) {
- sr2b = ROMAddr[0x227];
+ sr2b = ROMAddr[0x227];
sr2c = ROMAddr[0x228];
}
}
@@ -7878,7 +7932,7 @@ SiS_SetCRT2ECLK(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
clkbase = 0x02B;
if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) {
if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) {
- clkbase += 3;
+ clkbase += 3;
}
}
@@ -7903,7 +7957,7 @@ SiS_SetCHTVReg(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
{
#if defined(SIS300) || defined(SIS315H)
USHORT temp, tempbx;
-#endif
+#endif
USHORT tempcl;
USHORT TVType, resindex;
const SiS_CHTVRegDataStruct *CHTVRegData = NULL;
@@ -7916,17 +7970,17 @@ SiS_SetCHTVReg(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
TVType = 0;
if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) TVType += 1;
if(SiS_Pr->SiS_TVMode & TVSetPAL) {
- TVType += 2;
- if(SiS_Pr->SiS_ModeType > ModeVGA) {
- if(SiS_Pr->SiS_CHSOverScan) TVType = 8;
- }
- if(SiS_Pr->SiS_TVMode & TVSetPALM) {
- TVType = 4;
- if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) TVType += 1;
- } else if(SiS_Pr->SiS_TVMode & TVSetPALN) {
- TVType = 6;
- if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) TVType += 1;
- }
+ TVType += 2;
+ if(SiS_Pr->SiS_ModeType > ModeVGA) {
+ if(SiS_Pr->SiS_CHSOverScan) TVType = 8;
+ }
+ if(SiS_Pr->SiS_TVMode & TVSetPALM) {
+ TVType = 4;
+ if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) TVType += 1;
+ } else if(SiS_Pr->SiS_TVMode & TVSetPALN) {
+ TVType = 6;
+ if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) TVType += 1;
+ }
}
switch(TVType) {
case 0: CHTVRegData = SiS_Pr->SiS_CHTVReg_UNTSC; break;
@@ -8060,7 +8114,7 @@ SiS_SetCHTVReg(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
SiS_SetCH70xxANDOR(SiS_Pr,0x0121,0xFE); /* ACIV on */
}
}
-
+
#endif /* 300 */
} else {
@@ -8170,10 +8224,10 @@ SiS_Chrontel701xBLOn(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
/* Enable Chrontel 7019 LCD panel backlight */
if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) {
if(HwInfo->jChipType == SIS_740) {
- SiS_SetCH701x(SiS_Pr,0x6566);
+ SiS_SetCH701x(SiS_Pr,0x6566);
} else {
- temp = SiS_GetCH701x(SiS_Pr,0x66);
- temp |= 0x20;
+ temp = SiS_GetCH701x(SiS_Pr,0x66);
+ temp |= 0x20;
SiS_SetCH701x(SiS_Pr,(temp << 8) | 0x66);
}
}
@@ -8211,21 +8265,21 @@ SiS_ChrontelPowerSequencing(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
if(HwInfo->jChipType == SIS_740) {
if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) {
- if(SiS_Pr->SiS_CustomT == CUT_ASUSL3000D) tableptr = asus1024_740;
- else tableptr = table1024_740;
+ if(SiS_Pr->SiS_CustomT == CUT_ASUSL3000D) tableptr = asus1024_740;
+ else tableptr = table1024_740;
} else if((SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) ||
- (SiS_Pr->SiS_LCDResInfo == Panel_1400x1050) ||
+ (SiS_Pr->SiS_LCDResInfo == Panel_1400x1050) ||
(SiS_Pr->SiS_LCDResInfo == Panel_1600x1200)) {
if(SiS_Pr->SiS_CustomT == CUT_ASUSL3000D) tableptr = asus1400_740;
else tableptr = table1400_740;
} else return;
} else {
if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) {
- tableptr = table1024_650;
+ tableptr = table1024_650;
} else if((SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) ||
- (SiS_Pr->SiS_LCDResInfo == Panel_1400x1050) ||
+ (SiS_Pr->SiS_LCDResInfo == Panel_1400x1050) ||
(SiS_Pr->SiS_LCDResInfo == Panel_1600x1200)) {
- tableptr = table1400_650;
+ tableptr = table1400_650;
} else return;
}
@@ -8238,23 +8292,23 @@ static void
SiS_SetCH701xForLCD(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
UCHAR regtable[] = { 0x1c, 0x5f, 0x64, 0x6f, 0x70, 0x71,
- 0x72, 0x73, 0x74, 0x76, 0x78, 0x7d, 0x66 };
+ 0x72, 0x73, 0x74, 0x76, 0x78, 0x7d, 0x66 };
UCHAR table1024_740[] = { 0x60, 0x02, 0x00, 0x07, 0x40, 0xed,
- 0xa3, 0xc8, 0xc7, 0xac, 0xe0, 0x02, 0x44 };
+ 0xa3, 0xc8, 0xc7, 0xac, 0xe0, 0x02, 0x44 };
UCHAR table1280_740[] = { 0x60, 0x03, 0x11, 0x00, 0x40, 0xe3,
- 0xad, 0xdb, 0xf6, 0xac, 0xe0, 0x02, 0x44 };
+ 0xad, 0xdb, 0xf6, 0xac, 0xe0, 0x02, 0x44 };
UCHAR table1400_740[] = { 0x60, 0x03, 0x11, 0x00, 0x40, 0xe3,
- 0xad, 0xdb, 0xf6, 0xac, 0xe0, 0x02, 0x44 };
+ 0xad, 0xdb, 0xf6, 0xac, 0xe0, 0x02, 0x44 };
UCHAR table1600_740[] = { 0x60, 0x04, 0x11, 0x00, 0x40, 0xe3,
- 0xad, 0xde, 0xf6, 0xac, 0x60, 0x1a, 0x44 };
+ 0xad, 0xde, 0xf6, 0xac, 0x60, 0x1a, 0x44 };
UCHAR table1024_650[] = { 0x60, 0x02, 0x00, 0x07, 0x40, 0xed,
- 0xa3, 0xc8, 0xc7, 0xac, 0x60, 0x02 };
+ 0xa3, 0xc8, 0xc7, 0xac, 0x60, 0x02 };
UCHAR table1280_650[] = { 0x60, 0x03, 0x11, 0x00, 0x40, 0xe3,
- 0xad, 0xdb, 0xf6, 0xac, 0xe0, 0x02 };
+ 0xad, 0xdb, 0xf6, 0xac, 0xe0, 0x02 };
UCHAR table1400_650[] = { 0x60, 0x03, 0x11, 0x00, 0x40, 0xef,
- 0xad, 0xdb, 0xf6, 0xac, 0x60, 0x02 };
+ 0xad, 0xdb, 0xf6, 0xac, 0x60, 0x02 };
UCHAR table1600_650[] = { 0x60, 0x04, 0x11, 0x00, 0x40, 0xe3,
- 0xad, 0xde, 0xf6, 0xac, 0x60, 0x1a };
+ 0xad, 0xde, 0xf6, 0xac, 0x60, 0x1a };
UCHAR *tableptr = NULL;
USHORT tempbh;
int i;
@@ -8627,6 +8681,65 @@ SiS_ChrontelDoSomething1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
}
#endif /* 315 series */
+#if 0
+#ifdef SIS315H
+static void
+SiS_SetupAOP8060(SiS_Private *SiS_Pr)
+{
+ int i, j;
+ static const UCHAR crtable[] = {
+ 0x64,0x27,0x4f,0x88,0x54,0x9f,0xc4,0x1f,
+ 0x00,0x47,0x06,0x07,0x00,0x00,0x3f,0xff,
+ 0x92,0x09,0x8f,0x14,0x1f,0x8f,0xb5,0xa3,
+ 0xff,0x00,0x5c
+ };
+ static const UCHAR p1table1[] = {
+ 0xdf,0x50,0x64,0x11,0x8c,0x0b,
+ 0xeb,0x1e,0x0a,0x00,0x2d,0x2f,0x00,0x28,
+ 0xf2,0x36,0x00,0x00,0xef,0x0a,0x3f,0x09,
+ 0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x87,
+ 0x5a,0x4b,0x02,0x00,0x00
+ };
+ static const UCHAR p1table2[] = {
+ 0x0b,0x55,0x00,0x80,0xa0,0x00,0xf0,0x00,
+ 0x10,0x00,0x00,0x10,0x25,0x80,0x14,0x03,
+ 0x0a
+ };
+
+ SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f);
+ for(i = 0x00; i <= 0x1a; i++) {
+ if(i == 0x13) continue;
+ SiS_SetReg(SiS_Pr->SiS_P3d4, i, crtable[i]);
+ }
+ SiS_SetReg(SiS_Pr->SiS_P3c4,0x0a,0x30);
+ SiS_SetReg(SiS_Pr->SiS_P3c4,0x0b,0x00);
+ SiS_SetReg(SiS_Pr->SiS_P3c4,0x0c,0x01);
+ SiS_SetReg(SiS_Pr->SiS_P3c4,0x2b,0x1b);
+ SiS_SetReg(SiS_Pr->SiS_P3c4,0x2c,0xe1);
+
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x2f,0x01);
+
+ for(i = 0x08, j = 0; i <= 0x2d; i++) {
+ if(i == 0x09 || i == 0x0f || i == 0x1e) continue;
+ SiS_SetReg(SiS_Pr->SiS_Part1Port, i, p1table1[j]);
+ j++;
+ }
+ for(i = 0x35, j = 0; i <= 0x45; i++, j++) {
+ SiS_SetReg(SiS_Pr->SiS_Part1Port, i, p1table2[j]);
+ }
+ SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x09,0x0f,0x10);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1e,0x75);
+ SiS_SetReg(SiS_Pr->SiS_Part1Port,0x2e,0xe0);
+ SiS_SetReg(SiS_Pr->SiS_P3c4,0x1e,0x62);
+ SiS_SetReg(SiS_Pr->SiS_P3c4,0x2e,0x08);
+ SiS_SetReg(SiS_Pr->SiS_P3c4,0x2f,0x21);
+ SiS_SetReg(SiS_Pr->SiS_P3c4,0x32,0x01);
+
+ SiS_SetReg(SiS_Pr->SiS_P3d4,0x09,0x47);
+}
+#endif
+#endif
+
/*********************************************/
/* MAIN: SET CRT2 REGISTER GROUP */
/*********************************************/
@@ -8640,7 +8753,7 @@ SiS_SetCRT2Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
USHORT ModeIdIndex, RefreshRateTableIndex;
#if 0
USHORT temp;
-#endif
+#endif
SiS_Pr->SiS_SetFlag |= ProgrammingCRT2;
@@ -8683,8 +8796,8 @@ SiS_SetCRT2Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
SiS_GetLVDSDesData(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo);
}
-#ifdef LINUX_XF86
#ifdef TWDEBUG
+#ifdef LINUX_XF86
xf86DrvMsg(0, X_INFO, "(init301: LCDHDES 0x%03x LCDVDES 0x%03x)\n", SiS_Pr->SiS_LCDHDES, SiS_Pr->SiS_LCDVDES);
xf86DrvMsg(0, X_INFO, "(init301: HDE 0x%03x VDE 0x%03x)\n", SiS_Pr->SiS_HDE, SiS_Pr->SiS_VDE);
xf86DrvMsg(0, X_INFO, "(init301: VGAHDE 0x%03x VGAVDE 0x%03x)\n", SiS_Pr->SiS_VGAHDE, SiS_Pr->SiS_VGAVDE);
@@ -8699,58 +8812,58 @@ SiS_SetCRT2Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
if(SiS_Pr->SiS_VBType & VB_SISVB) {
- if(SiS_Pr->SiS_SetFlag & LowModeTests) {
+ if(SiS_Pr->SiS_SetFlag & LowModeTests) {
- SiS_SetGroup2(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo);
+ SiS_SetGroup2(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo);
#ifdef SIS315H
- SiS_SetGroup2_C_ELV(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo);
+ SiS_SetGroup2_C_ELV(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo);
#endif
- SiS_SetGroup3(SiS_Pr, ModeNo, ModeIdIndex, HwInfo);
- SiS_SetGroup4(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo);
+ SiS_SetGroup3(SiS_Pr, ModeNo, ModeIdIndex, HwInfo);
+ SiS_SetGroup4(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo);
#ifdef SIS315H
- SiS_SetGroup4_C_ELV(SiS_Pr, HwInfo, ModeNo, ModeIdIndex);
+ SiS_SetGroup4_C_ELV(SiS_Pr, HwInfo, ModeNo, ModeIdIndex);
#endif
- SiS_SetGroup5(SiS_Pr, ModeNo, ModeIdIndex, HwInfo);
+ SiS_SetGroup5(SiS_Pr, ModeNo, ModeIdIndex, HwInfo);
- SiS_SetCRT2Sync(SiS_Pr, ModeNo, RefreshRateTableIndex, HwInfo);
+ SiS_SetCRT2Sync(SiS_Pr, ModeNo, RefreshRateTableIndex, HwInfo);
- /* For 301BDH (Panel link initialization): */
- if((SiS_Pr->SiS_VBType & VB_NoLCD) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) {
- if(SiS_Pr->SiS_LCDResInfo != Panel_640x480) {
- if(!((SiS_Pr->SiS_SetFlag & SetDOSMode) && ((ModeNo == 0x03) || (ModeNo == 0x10)))) {
- if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
- SiS_ModCRT1CRTC(SiS_Pr,ModeNo,ModeIdIndex,
- RefreshRateTableIndex,HwInfo);
- }
- }
- }
- SiS_SetCRT2ECLK(SiS_Pr,ModeNo,ModeIdIndex,
- RefreshRateTableIndex,HwInfo);
- }
- }
+ /* For 301BDH (Panel link initialization): */
+ if((SiS_Pr->SiS_VBType & VB_NoLCD) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) {
+ if(SiS_Pr->SiS_LCDResInfo != Panel_640x480) {
+ if(!((SiS_Pr->SiS_SetFlag & SetDOSMode) && ((ModeNo == 0x03) || (ModeNo == 0x10)))) {
+ if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) {
+ SiS_ModCRT1CRTC(SiS_Pr,ModeNo,ModeIdIndex,
+ RefreshRateTableIndex,HwInfo);
+ }
+ }
+ }
+ SiS_SetCRT2ECLK(SiS_Pr,ModeNo,ModeIdIndex,
+ RefreshRateTableIndex,HwInfo);
+ }
+ }
} else {
- SiS_SetCRT2Sync(SiS_Pr, ModeNo, RefreshRateTableIndex, HwInfo);
-
- SiS_ModCRT1CRTC(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwInfo);
+ SiS_SetCRT2Sync(SiS_Pr, ModeNo, RefreshRateTableIndex, HwInfo);
- SiS_SetCRT2ECLK(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwInfo);
+ SiS_ModCRT1CRTC(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwInfo);
- if(SiS_Pr->SiS_SetFlag & LowModeTests) {
- if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
- if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
- if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) {
+ SiS_SetCRT2ECLK(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwInfo);
+
+ if(SiS_Pr->SiS_SetFlag & LowModeTests) {
+ if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) {
+ if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA)) {
+ if(SiS_Pr->SiS_IF_DEF_CH70xx == 2) {
#ifdef SIS315H
- SiS_SetCH701xForLCD(SiS_Pr,HwInfo);
+ SiS_SetCH701xForLCD(SiS_Pr,HwInfo);
#endif
- }
- }
- if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
- SiS_SetCHTVReg(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex);
- }
- }
- }
+ }
+ }
+ if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) {
+ SiS_SetCHTVReg(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex);
+ }
+ }
+ }
}
@@ -8760,16 +8873,16 @@ SiS_SetCRT2Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
if(SiS_Pr->SiS_UseOEM) {
if((SiS_Pr->SiS_UseROM) && (SiS_Pr->SiS_UseOEM == -1)) {
if((ROMAddr[0x233] == 0x12) && (ROMAddr[0x234] == 0x34)) {
- SiS_OEM300Setting(SiS_Pr,HwInfo,ModeNo,ModeIdIndex,
- RefreshRateTableIndex);
+ SiS_OEM300Setting(SiS_Pr,HwInfo,ModeNo,ModeIdIndex,
+ RefreshRateTableIndex);
}
} else {
- SiS_OEM300Setting(SiS_Pr,HwInfo,ModeNo,ModeIdIndex,
- RefreshRateTableIndex);
+ SiS_OEM300Setting(SiS_Pr,HwInfo,ModeNo,ModeIdIndex,
+ RefreshRateTableIndex);
}
}
if(SiS_Pr->SiS_IF_DEF_LVDS == 1) {
- if((SiS_Pr->SiS_CustomT == CUT_BARCO1366) ||
+ if((SiS_Pr->SiS_CustomT == CUT_BARCO1366) ||
(SiS_Pr->SiS_CustomT == CUT_BARCO1024)) {
SetOEMLCDData2(SiS_Pr, HwInfo, ModeNo, ModeIdIndex,RefreshRateTableIndex);
}
@@ -8784,11 +8897,11 @@ SiS_SetCRT2Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
if(SiS_Pr->SiS_SetFlag & LowModeTests) {
if(HwInfo->jChipType < SIS_661) {
SiS_FinalizeLCD(SiS_Pr, ModeNo, ModeIdIndex, HwInfo);
- SiS_OEM310Setting(SiS_Pr, HwInfo, ModeNo, ModeIdIndex, RefreshRateTableIndex);
+ SiS_OEM310Setting(SiS_Pr, HwInfo, ModeNo, ModeIdIndex, RefreshRateTableIndex);
} else {
SiS_OEM661Setting(SiS_Pr, HwInfo, ModeNo, ModeIdIndex, RefreshRateTableIndex);
}
- SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x01,0x40);
+ SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x01,0x40);
}
}
#endif
@@ -8809,6 +8922,16 @@ SiS_SetCRT2Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
}
}
+#if 0
+#ifdef SIS315H
+ if( (HwInfo->jChipType == SIS_550) &&
+ (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) &&
+ (SiS_Pr->SiS_CustomT == CUT_AOP8060) ) {
+ SiS_SetupAOP8060(SiS_Pr);
+ }
+#endif
+#endif
+
if(SiS_Pr->SiS_SetFlag & LowModeTests) {
SiS_LockCRT2(SiS_Pr,HwInfo);
}
@@ -8840,8 +8963,7 @@ SiS_SiS30xBLOff(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo)
{
/* Switch off LCD backlight on SiS30xLV */
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFE);
- SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x26,0xFD);
- SiS_DDC2Delay(SiS_Pr,0xe000);
+ SiS_DDC2Delay(SiS_Pr,0xff00);
}
/*********************************************/
@@ -8899,8 +9021,8 @@ SiS_SetTrumpionBlock(SiS_Private *SiS_Pr, UCHAR *dataptr)
{
SiS_Pr->SiS_DDC_DeviceAddr = 0xF0; /* DAB (Device Address Byte) */
SiS_Pr->SiS_DDC_Index = 0x11; /* Bit 0 = SC; Bit 1 = SD */
- SiS_Pr->SiS_DDC_Data = 0x02; /* Bitmask in IndexReg for Data */
- SiS_Pr->SiS_DDC_Clk = 0x01; /* Bitmask in IndexReg for Clk */
+ SiS_Pr->SiS_DDC_Data = 0x02; /* Bitmask in IndexReg for Data */
+ SiS_Pr->SiS_DDC_Clk = 0x01; /* Bitmask in IndexReg for Clk */
SiS_SetupDDCN(SiS_Pr);
SiS_SetSwitchDDC2(SiS_Pr);
@@ -9130,10 +9252,10 @@ SiS_InitDDCRegs(SiS_Private *SiS_Pr, unsigned long VBFlags, int VGAEngine,
if(adaptnum != 0) {
if(!(VBFlags & (VB_301|VB_301B|VB_301C|VB_302B))) return 0xFFFF;
if((VBFlags & VB_30xBDH) && (adaptnum == 1)) return 0xFFFF;
- }
-
+ }
+
/* adapternum for SiS bridges: 0 = CRT1, 1 = LCD, 2 = VGA2 */
-
+
SiS_Pr->SiS_ChrontelInit = 0; /* force re-detection! */
SiS_Pr->SiS_DDC_SecAddr = 0;
@@ -9161,7 +9283,7 @@ SiS_InitDDCRegs(SiS_Private *SiS_Pr, unsigned long VBFlags, int VGAEngine,
#endif
if(VGAEngine == SIS_300_VGA) { /* 300 series */
-
+
if(myadaptnum != 0) {
flag = 0;
if(VBFlags & VB_SISBRIDGE) {
@@ -9219,7 +9341,7 @@ SiS_InitDDCRegs(SiS_Private *SiS_Pr, unsigned long VBFlags, int VGAEngine,
if(flag) temp = 0;
}
-
+
SiS_Pr->SiS_DDC_Data = 0x02 << temp;
SiS_Pr->SiS_DDC_Clk = 0x01 << temp;
@@ -9229,7 +9351,7 @@ SiS_InitDDCRegs(SiS_Private *SiS_Pr, unsigned long VBFlags, int VGAEngine,
xf86DrvMsg(0, X_INFO, "DDC Port %x Index %x Shift %d\n",
SiS_Pr->SiS_DDC_Port, SiS_Pr->SiS_DDC_Index, temp);
#endif
-
+
return 0;
}
@@ -9354,7 +9476,7 @@ SiS_ReadDDC(SiS_Private *SiS_Pr, USHORT DDCdatatype, unsigned char *buffer)
USHORT flag, length, i;
unsigned char chksum,gotcha;
- if(DDCdatatype > 4) return 0xFFFF;
+ if(DDCdatatype > 4) return 0xFFFF;
flag = 0;
SiS_SetSwitchDDC2(SiS_Pr);
@@ -9527,17 +9649,17 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
if(!(pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B))) return 0;
if(pSiS->VBFlags & VB_30xBDH) return 0;
-
+
if(SiS_InitDDCRegs(SiS_Pr, pSiS->VBFlags, pSiS->VGAEngine, 1, 0, FALSE) == 0xFFFF) return 0;
-
+
SiS_Pr->SiS_DDC_SecAddr = 0x00;
-
+
/* Probe supported DA's */
flag = SiS_ProbeDDC(SiS_Pr);
#ifdef TWDEBUG
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_INFO,
"CRT2 DDC capabilities 0x%x\n", flag);
-#endif
+#endif
if(flag & 0x10) {
SiS_Pr->SiS_DDC_DeviceAddr = 0xa6; /* EDID V2 (FP) */
DDCdatatype = 4;
@@ -9548,7 +9670,7 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
SiS_Pr->SiS_DDC_DeviceAddr = 0xa0; /* EDID V1 */
DDCdatatype = 1;
} else return 0; /* no DDC support (or no device attached) */
-
+
/* Read the entire EDID */
retry = 2;
do {
@@ -9570,8 +9692,8 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
buffer[i+8], buffer[i+9], buffer[i+10], buffer[i+11],
buffer[i+12], buffer[i+13], buffer[i+14], buffer[i+15]);
}
-#endif
-
+#endif
+
/* Analyze EDID and retrieve LCD panel information */
paneltype = 0;
switch(DDCdatatype) {
@@ -9598,10 +9720,10 @@ 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);
-
+
/* Overrule bogus preferred modes from database */
if((indb = SiS_FindPanelFromDB(pSiS, panelvendor, panelproduct, &maxx, &maxy, &prefx, &prefy))) {
if(prefx) SiS_Pr->CP_PreferredX = xres = prefx;
@@ -9609,14 +9731,14 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
}
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));
if(!xres) SiS_Pr->CP_PreferredX = xres = buffer[0x38] | ((buffer[0x3a] & 0xf0) << 4);
if(!yres) SiS_Pr->CP_PreferredY = yres = buffer[0x3b] | ((buffer[0x3d] & 0xf0) << 4);
-
+
switch(xres) {
case 1024:
if(yres == 768) {
@@ -9625,7 +9747,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) {
@@ -9642,7 +9764,7 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
if( (pclk == 6900) &&
(phb == (1408 - 1280)) &&
(pvb == (816 - 800)) ) {
- paneltype = Panel_1280x800;
+ paneltype = Panel_1280x800;
}
}
break;
@@ -9656,12 +9778,12 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
break;
case 1600:
if((pSiS->VGAEngine == SIS_315_VGA) && (pSiS->VBFlags & VB_301C)) {
- if(yres == 1200) {
+ if(yres == 1200) {
if( (pclk == 16200) &&
(phb == (2160 - 1600)) &&
(pvb == (1250 - 1200)) ) {
paneltype = Panel310_1600x1200;
- checkexpand = TRUE;
+ checkexpand = TRUE;
}
}
}
@@ -9683,10 +9805,10 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
}
}
-
+
/* Check against our database; eg. Sanyo Z2 projector reports
- * 1024x768 as preferred mode, although it supports 1280x720
- * natively in non-HDCP mode. Treat such wrongly reporting
+ * 1024x768 as preferred mode, although it supports 1280x720
+ * natively in non-HDCP mode. Treat such wrongly reporting
* panels as custom and fixup actual maximum resolutions.
*/
if(paneltype != Panel_Custom) {
@@ -9703,7 +9825,7 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
* detailed timing blocks
*/
if(paneltype == Panel_Custom) {
-
+
int i, temp, base = 0x36;
unsigned long estpack;
const unsigned short estx[] = {
@@ -9736,7 +9858,7 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
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
*/
@@ -9799,7 +9921,7 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
(SiS_Pr->CP_VSyncStart[i] > SiS_Pr->CP_VTotal[i]) ||
(SiS_Pr->CP_VSyncEnd[i] > SiS_Pr->CP_VTotal[i]) ||
(((pSiS->VBFlags & VB_301C) && (SiS_Pr->CP_Clock[i] > 162500)) ||
- ((!(pSiS->VBFlags & VB_301C)) &&
+ ((!(pSiS->VBFlags & VB_301C)) &&
((SiS_Pr->CP_Clock[i] > 110500) || (SiS_Pr->CP_VDisplay[i] > 1024) ||
(SiS_Pr->CP_HDisplay[i] > 1600)))) ||
(buffer[base+17] & 0x80)) {
@@ -9834,22 +9956,22 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
} 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(SiS_Pr->CP_MaxX && SiS_Pr->CP_MaxY) {
paneltype = Panel_Custom;
checkexpand = FALSE;
@@ -9857,12 +9979,12 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
SiS_Pr->CP_Vendor = panelvendor;
SiS_Pr->CP_Product = panelproduct;
}
-
+
}
if(paneltype && checkexpand) {
/* If any of the Established low-res modes is supported, the
- * panel can scale automatically. For 800x600 panels, we only
+ * panel can scale automatically. For 800x600 panels, we only
* check the even lower ones.
*/
if(paneltype == Panel_800x600) {
@@ -9871,9 +9993,9 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
if(buffer[0x23]) cr37 |= 0x10;
}
}
-
+
break;
-
+
case 3: /* Analyze EDID V2 */
case 4:
index = 0;
@@ -9894,18 +10016,18 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
"LCD sense: Display supports TMDS input on secondary interface\n");
} else {
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "LCD sense: 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 = 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) {
case 1024:
if(yres == 768) {
@@ -9953,7 +10075,7 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
lumsize++; /* luminance header byte */
index += lumsize;
}
-#if 0 /* "pixel rate" = pixel clock? */
+#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)) {
@@ -9961,8 +10083,8 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
if(clk > SiS_Pr->CP_MaxClock) SiS_Pr->CP_MaxClock = clk;
}
}
- }
-#endif
+ }
+#endif
index += (((buffer[0x7e] & 0x1c) >> 2) * 8); /* skip Frequency Ranges */
if(buffer[0x7e] & 0x03) {
for(i=0; i<(buffer[0x7e] & 0x03); i++) {
@@ -9992,9 +10114,9 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_WARNING,
"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.
+ * 1024x768 in non-HDPC mode, although it supports 1280x720.
* Treat such wrongly reporting panels as custom.
*/
if(paneltype != Panel_Custom) {
@@ -10051,7 +10173,7 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
(SiS_Pr->CP_VSyncStart[i] > SiS_Pr->CP_VTotal[i]) ||
(SiS_Pr->CP_VSyncEnd[i] > SiS_Pr->CP_VTotal[i]) ||
(((pSiS->VBFlags & VB_301C) && (SiS_Pr->CP_Clock[i] > 162500)) ||
- ((!(pSiS->VBFlags & VB_301C)) &&
+ ((!(pSiS->VBFlags & VB_301C)) &&
((SiS_Pr->CP_Clock[i] > 110500) || (SiS_Pr->CP_VDisplay[i] > 1024) ||
(SiS_Pr->CP_HDisplay[i] > 1600)))) ||
(buffer[index + 17] & 0x80)) {
@@ -10082,7 +10204,7 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
}
cr37 |= 0x10;
-
+
}
break;
@@ -10125,16 +10247,16 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS)
SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x37,0x0c,cr37);
SiS_Pr->PanelSelfDetected = TRUE;
#ifdef TWDEBUG
- xf86DrvMsgVerb(pSiS->pScrn->scrnIndex, X_PROBED, 3,
+ xf86DrvMsgVerb(pSiS->pScrn->scrnIndex, X_PROBED, 3,
"LCD sense: [DDC LCD results: 0x%02x, 0x%02x]\n", paneltype, cr37);
-#endif
+#endif
} else {
SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x32,~0x08);
SiS_SetReg(SiS_Pr->SiS_P3d4,0x36,0x00);
}
return 0;
}
-
+
USHORT
SiS_SenseVGA2DDC(SiS_Private *SiS_Pr, SISPtr pSiS)
{
@@ -10146,9 +10268,9 @@ SiS_SenseVGA2DDC(SiS_Private *SiS_Pr, SISPtr pSiS)
if(!(pSiS->VBFlags & (VB_301|VB_301B|VB_301C|VB_302B))) return 0;
if(SiS_InitDDCRegs(SiS_Pr, pSiS->VBFlags, pSiS->VGAEngine, 2, 0, FALSE) == 0xFFFF) return 0;
-
+
SiS_Pr->SiS_DDC_SecAddr = 0x00;
-
+
/* Probe supported DA's */
flag = SiS_ProbeDDC(SiS_Pr);
if(flag & 0x10) {
@@ -10171,14 +10293,14 @@ SiS_SenseVGA2DDC(SiS_Private *SiS_Pr, SISPtr pSiS)
do {
if(SiS_ReadDDC(SiS_Pr, DDCdatatype, buffer)) {
xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED,
- "VGA2 sense: 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;
} else break;
} while(1);
-
- /* Analyze EDID. We don't have many chances to
+
+ /* Analyze EDID. We don't have many chances to
* distinguish a flat panel from a CRT...
*/
switch(DDCdatatype) {
@@ -10597,7 +10719,7 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
/* Find delay (from ROM, internal tables, PCI subsystem) */
if(SiS_Pr->SiS_VBInfo & SetCRT2ToRAMDAC) { /* ------------ VGA */
-
+
if((SiS_Pr->SiS_UseROM) && (!(SiS_Pr->SiS_ROMNew))) {
romptr = GetRAMDACromptr(SiS_Pr, HwInfo);
}
@@ -10651,7 +10773,7 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
} else {
delay = 0x0c;
if(SiS_Pr->SiS_VBType & VB_SIS301C) {
- delay = 0x03;
+ delay = 0x03;
if((SiS_Pr->PanelXRes > 1280) && (SiS_Pr->PanelYRes > 1024)) {
delay = 0x00;
}
@@ -10753,7 +10875,7 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
else delay = SiS310_LCDDelayCompensation_650301LV[myindex];
} else if(SiS_Pr->SiS_VBType & VB_SIS301C) {
if(IS_SIS740) delay = 0x01; /* ? */
- else delay = 0x03;
+ else delay = 0x03;
if(SiS_Pr->SiS_LCDResInfo == Panel_1600x1200) delay = 0x00; /* experience */
} else if(SiS_Pr->SiS_VBType & VB_SIS301B302B) {
if(IS_SIS740) delay = 0x01;
@@ -10768,11 +10890,11 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x2D,0x0F,((delay << 4) & 0xf0));
dochiptest = FALSE;
}
-
+
} else if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { /* ------------ TV */
index = GetTVPtrIndex(SiS_Pr);
-
+
if(IS_SIS650 && (SiS_Pr->SiS_VBType & VB_SIS301LV302LV)) {
if(SiS_IsNotM650orLater(SiS_Pr,HwInfo)) {
@@ -10844,7 +10966,7 @@ SetDelayComp(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo)
delay &= 0x0f;
dochiptest = FALSE;
}
-
+
} else return;
/* Write delay */
@@ -11122,7 +11244,7 @@ SetDelayComp661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo,
if((ROMAddr[0x5b] & 0x80) || (SiS_Pr->SiS_VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToLCD))) {
index++;
}
- romptr = SISGETROMW(0x104);
+ 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));
@@ -11148,7 +11270,7 @@ SetDelayComp661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo,
index = GetOEMTVPtr661(SiS_Pr);
if(SiS_Pr->SiS_ROMNew) {
- romptr = SISGETROMW(0x106);
+ romptr = SISGETROMW(0x106);
if(SiS_Pr->SiS_VBType & VB_UMC) romptr += 12;
delay = ROMAddr[romptr + index];
} else {
@@ -11164,7 +11286,7 @@ SetDelayComp661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo,
((romptr = GetLCDStructPtr661_2(SiS_Pr, HwInfo))) ) {
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 */
@@ -11177,9 +11299,9 @@ SetDelayComp661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo,
switch(SiS_Pr->SiS_LCDResInfo) {
case Panel_1024x768: delay = 0x0008; break;
case Panel_1280x720: delay = 0x0004; break;
- case Panel_1280x768:
+ case Panel_1280x768:
case Panel_1280x768_2:delay = 0x0004; break;
- case Panel_1280x800:
+ 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;
@@ -11199,7 +11321,7 @@ SetDelayComp661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo,
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)) {
@@ -11210,7 +11332,7 @@ SetDelayComp661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo,
}
}
-
+
}
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) {
@@ -11238,11 +11360,11 @@ SetCRT2SyncDither661(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo, US
} else {
infoflag = SiS_Pr->SiS_RefIndex[RTI].Ext_InfoFlag;
}
-
+
if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) {
infoflag = SiS_GetReg(SiS_Pr->SiS_P3d4,0x37); /* No longer check D5 */
}
-
+
infoflag &= 0xc0;
if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) {
@@ -11435,9 +11557,9 @@ SiS_FinalizeLCD(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,
if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) {
if(SiS_Pr->SiS_VBType & (VB_SIS302LV | VB_SIS302ELV)) {
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x2a,0x00);
-#ifdef SET_EMI
+#ifdef SET_EMI
SiS_SetRegAND(SiS_Pr->SiS_Part4Port,0x30,0x0c);
-#endif
+#endif
SiS_SetReg(SiS_Pr->SiS_Part4Port,0x34,0x10);
}
} else if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) {
@@ -11620,7 +11742,7 @@ GetOEMLCDPtr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, int Flag)
if(HwInfo->jChipType == SIS_300) {
- tempbx = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) & 0x0f;
+ tempbx = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36) & 0x0f;
if(SiS_Pr->SiS_VBType & VB_SIS301) tempbx &= 0x07;
tempbx -= 2;
if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) tempbx += 4;
@@ -11660,9 +11782,9 @@ GetOEMLCDPtr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, int Flag)
tempbx = SiS_Pr->SiS_LCDTypeInfo << 2;
if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) tempbx += 2;
if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++;
-
+
}
-
+
return tempbx;
}
diff --git a/src/init301.h b/src/init301.h
index 85c0eea..e511334 100644
--- a/src/init301.h
+++ b/src/init301.h
@@ -248,12 +248,12 @@ static const UCHAR SiS_LCDStruct661[] = {
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,0x00,0x00,0x00,0x00,0x06,
+ 0x00,0x03,0x00,0x06,0x00,0x79,0xBE,0x44,0x00,0x00,0x00,0x00,0x06,
};
#endif
#ifdef SIS300
-static UCHAR SiS300_TrumpionData[7][80] = {
+static UCHAR SiS300_TrumpionData[14][80] = {
{ 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x0D,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02,
0x20,0x03,0x0B,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x10,0x00,0x00,0x04,0x23,
0x00,0x00,0x03,0x28,0x03,0x10,0x05,0x08,0x40,0x10,0x00,0x10,0x04,0x23,0x00,0x23,
@@ -288,7 +288,43 @@ static UCHAR SiS300_TrumpionData[7][80] = {
0x40,0x05,0x13,0x00,0x00,0x03,0x26,0x03,0x88,0x0C,0x30,0x90,0x00,0x00,0x04,0x23,
0x00,0x01,0x03,0x24,0x03,0x28,0x06,0x08,0x40,0x90,0x00,0x90,0x04,0x23,0x00,0x23,
0x03,0x11,0x60,0x40,0x05,0xFF,0x0F,0xF4,0x18,0x01,0x00,0x08,0x01,0x00,0x08,0x01,
- 0x00,0x08,0x01,0x01,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x5B,0x01,0xBE,0x01,0x00 }
+ 0x00,0x08,0x01,0x01,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x5B,0x01,0xBE,0x01,0x00 },
+ /* variant 2 */
+ { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02,
+ 0x20,0x03,0x15,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x18,0x00,0x00,0x04,0x23,
+ 0x00,0x01,0x03,0x44,0x03,0x28,0x06,0x08,0x40,0x18,0x00,0x18,0x04,0x23,0x00,0x23,
+ 0x03,0x11,0x60,0xA6,0x01,0xFF,0x03,0xFF,0x19,0x01,0x00,0x05,0x13,0x04,0x04,0x05,
+ 0x04,0x0C,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 },
+ { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02,
+ 0x20,0x03,0x15,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x18,0x00,0x00,0x04,0x23,
+ 0x00,0x01,0x03,0x44,0x03,0x28,0x06,0x08,0x40,0x18,0x00,0x18,0x04,0x23,0x00,0x23,
+ 0x03,0x11,0x60,0xA6,0x01,0xFF,0x03,0xFF,0x19,0x01,0x00,0x05,0x13,0x04,0x04,0x05,
+ 0x04,0x0C,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 },
+ { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x8A,0x00,0xD8,0x02,
+ 0x84,0x03,0x16,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x1C,0x00,0x20,0x04,0x23,
+ 0x00,0x01,0x03,0x53,0x03,0x28,0x06,0x08,0x40,0x1C,0x00,0x16,0x04,0x23,0x00,0x23,
+ 0x03,0x11,0x60,0xDA,0x01,0xFF,0x0F,0xF4,0x18,0x07,0x05,0x05,0x13,0x04,0x04,0x05,
+ 0x01,0x0B,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 },
+ { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x72,0x00,0xD8,0x02,
+ 0x84,0x03,0x16,0x00,0x90,0x01,0xC1,0x01,0x60,0x0C,0x30,0x1C,0x00,0x20,0x04,0x23,
+ 0x00,0x01,0x03,0x53,0x03,0x28,0x06,0x08,0x40,0x1C,0x00,0x16,0x04,0x23,0x00,0x23,
+ 0x03,0x11,0x60,0xDA,0x01,0xFF,0x0F,0xF4,0x18,0x07,0x05,0x05,0x13,0x04,0x04,0x05,
+ 0x01,0x0B,0x13,0x0A,0x02,0xB0,0x00,0x00,0x02,0xBA,0xF0,0x55,0x01,0xBE,0x01,0x00 },
+ { 0x02,0x0A,0x02,0x00,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0x7F,0x00,0x80,0x02,
+ 0x20,0x03,0x16,0x00,0xE0,0x01,0x0D,0x02,0x60,0x0C,0x30,0x98,0x00,0x00,0x04,0x23,
+ 0x00,0x01,0x03,0x45,0x03,0x48,0x06,0x08,0x40,0x98,0x00,0x98,0x04,0x23,0x00,0x23,
+ 0x03,0x11,0x60,0xF4,0x01,0xFF,0x0F,0xF4,0x18,0x01,0x00,0x05,0x01,0x00,0x05,0x05,
+ 0x04,0x0C,0x08,0x05,0x02,0xB0,0x00,0x00,0x02,0xBA,0xEA,0x58,0x01,0xBE,0x01,0x00 },
+ { 0x02,0x0A,0x02,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0xBF,0x00,0x20,0x03,
+ 0x20,0x04,0x0D,0x00,0x58,0x02,0x71,0x02,0x80,0x0C,0x30,0x9A,0x00,0xFA,0x03,0x1D,
+ 0x00,0x01,0x03,0x22,0x03,0x28,0x06,0x08,0x40,0x98,0x00,0x98,0x04,0x1D,0x00,0x1D,
+ 0x03,0x11,0x60,0x39,0x03,0x40,0x05,0xF4,0x18,0x07,0x02,0x06,0x04,0x01,0x06,0x0B,
+ 0x02,0x0A,0x20,0x19,0x02,0xB0,0x00,0x00,0x02,0xBA,0xEA,0x58,0x01,0xBE,0x01,0x00 },
+ { 0x02,0x0A,0x0A,0x01,0x04,0x01,0x00,0x03,0x11,0x00,0x0D,0x10,0xEF,0x00,0x00,0x04,
+ 0x40,0x05,0x13,0x00,0x00,0x03,0x26,0x03,0x88,0x0C,0x30,0x90,0x00,0x00,0x04,0x23,
+ 0x00,0x01,0x03,0x24,0x03,0x28,0x06,0x08,0x40,0x90,0x00,0x90,0x04,0x23,0x00,0x23,
+ 0x03,0x11,0x60,0x40,0x05,0xFF,0x0F,0xF4,0x18,0x01,0x00,0x08,0x01,0x00,0x08,0x01,
+ 0x00,0x08,0x01,0x01,0x02,0xB0,0x00,0x00,0x02,0xBA,0xEA,0x58,0x01,0xBE,0x01,0x00 }
};
#endif
@@ -403,9 +439,11 @@ 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,
PSIS_HW_INFO HwInfo);
extern void SiS_CalcCRRegisters(SiS_Private *SiS_Pr, int depth);
+extern USHORT SiS_GetRefCRTVCLK(SiS_Private *SiS_Pr, USHORT Index, int UseWide);
+extern USHORT SiS_GetRefCRT1CRTC(SiS_Private *SiS_Pr, USHORT Index, int UseWide);
#ifdef LINUX_XF86
extern void SiS_MakeClockRegs(ScrnInfoPtr pScrn, int clock, UCHAR *p2b, UCHAR *p2c);
-extern int SiS_FindPanelFromDB(SISPtr pSiS, USHORT panelvendor, USHORT panelproduct,
+extern int SiS_FindPanelFromDB(SISPtr pSiS, USHORT panelvendor, USHORT panelproduct,
int *maxx, int *maxy, int *prefx, int *prefy);
#endif
diff --git a/src/initdef.h b/src/initdef.h
index 2cd70bd..756d611 100644
--- a/src/initdef.h
+++ b/src/initdef.h
@@ -109,7 +109,7 @@
#define SetNotSimuMode 0x0400
#define SetNotSimuTVMode SetNotSimuMode
#define SetDispDevSwitch 0x0800
-#define SetCRT2ToYPbPr525750 0x0800
+#define SetCRT2ToYPbPr525750 0x0800
#define LoadDACFlag 0x1000
#define DisableCRT2Display 0x2000
#define DriverMode 0x4000
@@ -153,7 +153,7 @@
#define SupportCHTV 0x0800
#define Support64048060Hz 0x0800 /* Special for 640x480 LCD */
#define SupportHiVision 0x0010
-#define SupportYPbPr750p 0x1000
+#define SupportYPbPr750p 0x1000
#define SupportLCD 0x0020
#define SupportRAMDAC2 0x0040 /* All (<= 100Mhz) */
#define SupportRAMDAC2_135 0x0100 /* All except DH (<= 135Mhz) */
@@ -161,6 +161,7 @@
#define SupportRAMDAC2_202 0x0400 /* C (<= 202Mhz) */
#define InterlaceMode 0x0080
#define SyncPP 0x0000
+#define HaveWideTiming 0x2000 /* Have specific wide- and non-wide timing */
#define SyncPN 0x4000
#define SyncNP 0x8000
#define SyncNN 0xc000
@@ -209,7 +210,8 @@
#define SF_IsM661 0x0020
#define SF_IsM741 0x0040
#define SF_IsM760 0x0080
-#define SF_760LFB 0x8000 /* 760: We have LFB */
+#define SF_760UMA 0x4000 /* 76x: We have UMA */
+#define SF_760LFB 0x8000 /* 76x: We have LFB */
/* CR32 (Newer 630, and 315 series)
@@ -229,25 +231,19 @@
#define TVOverScanShift 4
/* CR35 (661 series only)
-
[0] 1 = PAL, 0 = NTSC
[1] 1 = NTSC-J (if D0 = 0)
[2] 1 = PALM (if D0 = 1)
[3] 1 = PALN (if D0 = 1)
[4] 1 = Overscan (Chrontel only)
[7:5] (only if D2 in CR38 is set)
- 000 525i
- 001 525p
+ 000 525i
+ 001 525p
010 750p
011 1080i (or HiVision on 301, 301B)
-
- These bits are being translated to TVMode flag.
-
*/
-/*
- CR37
-
+/* CR37
[0] Set 24/18 bit (0/1) RGB to LVDS/TMDS transmitter (set by BIOS)
[3:1] External chip
300 series:
@@ -261,7 +257,7 @@
010 LVDS
011 LVDS + Chrontel 7019
660 series [2:1] only:
- reserved (now in CR38)
+ reserved (chip type now in CR38)
All other combinations reserved
[3] 661 only: Pass 1:1 data
[4] LVDS: 0: Panel Link expands / 1: Panel Link does not expand
@@ -321,6 +317,7 @@
#define Enable302LV_DualLink 0x04 /* 302LV only; enable dual link */
/* CR39 (661 and later)
+ D[7] LVDS (SiS or third party)
D[1:0] YPbPr Aspect Ratio
00 4:3 letterbox
01 4:3
@@ -342,7 +339,7 @@
0101 Set Contrast event
0110 Set Mute event
0111 Set Volume Up/Down event
- [4] Enable Backlight Control by BIOS/driver
+ [4] Enable Backlight Control by BIOS/driver
(set by driver; set means that the BIOS should
not touch the backlight registers because eg.
the driver already switched off the backlight)
@@ -351,6 +348,26 @@
[7] TV UnderScan/OverScan (set by BIOS)
*/
+/* CR7C - 661 and later
+ [7] DualEdge enabled (or: to be enabled)
+ [6] CRT2 = TV/LCD/VGA enabled (or: to be enabled)
+ [5] Init done (set at end of SiS_Init)
+ {4] LVDS LCD capabilities
+ [3] LVDS LCD capabilities
+ [2] LVDS LCD capabilities (PWD)
+ [1] LVDS LCD capabilities (PWD)
+ [0] LVDS=1, TMDS=0 (SiS or third party)
+*/
+
+/* CR7E - 661 and later
+ VBType:
+ [7] LVDS (third party)
+ [3] 301C
+ [2] 302LV
+ [1] 301LV
+ [0] 301B
+*/
+
/* LCDResInfo */
#define Panel300_800x600 0x01 /* CR36 */
#define Panel300_1024x768 0x02
@@ -360,7 +377,6 @@
#define Panel300_1024x600 0x06
#define Panel300_1152x768 0x07
#define Panel300_1280x768 0x0a
-#define Panel300_320x480 0x0e /* fstn - This is fake, can be any */
#define Panel300_Custom 0x0f
#define Panel300_Barco1366 0x10
@@ -375,9 +391,9 @@
#define Panel310_1400x1050 0x09
#define Panel310_1280x768 0x0a
#define Panel310_1600x1200 0x0b
-#define Panel310_640x480_2 0x0c
-#define Panel310_640x480_3 0x0d
-#define Panel310_320x480 0x0e /* fstn - TW: This is fake, can be any */
+#define Panel310_320x240_2 0x0c /* xSTN */
+#define Panel310_320x240_3 0x0d /* xSTN */
+#define Panel310_320x240_1 0x0e /* xSTN - This is fake, can be any */
#define Panel310_Custom 0x0f
#define Panel661_800x600 0x01
@@ -411,11 +427,11 @@
#define Panel_1680x1050 0x0d /* 661etc */
#define Panel_1280x720 0x0e /* 661etc */
#define Panel_Custom 0x0f /* MUST BE 0x0f (for DVI DDC detection) */
-#define Panel_320x480 0x10 /* SiS 550 fstn - TW: This is fake, can be any */
+#define Panel_320x240_1 0x10 /* SiS 550 xSTN */
#define Panel_Barco1366 0x11
#define Panel_848x480 0x12
-#define Panel_640x480_2 0x13 /* SiS 550 */
-#define Panel_640x480_3 0x14 /* SiS 550 */
+#define Panel_320x240_2 0x13 /* SiS 550 xSTN */
+#define Panel_320x240_3 0x14 /* SiS 550 xSTN */
#define Panel_1280x768_2 0x15 /* 30xLV */
#define Panel_1280x768_3 0x16 /* (unused) */
#define Panel_1280x800_2 0x17 /* 30xLV */
@@ -485,22 +501,22 @@
#define VCLK_CUSTOM_300 0x47
#define VCLK65_315 0x0b /* Indices in (VB)VCLKData table (315) */
-#define VCLK108_2_315 0x19
-#define VCLK81_315 0x5b
-#define VCLK162_315 0x5e
-#define VCLK108_3_315 0x45
-#define VCLK100_315 0x46
+#define VCLK108_2_315 0x19
+#define VCLK81_315 0x5b
+#define VCLK162_315 0x5e
+#define VCLK108_3_315 0x45
+#define VCLK100_315 0x46
#define VCLK34_315 0x55
#define VCLK68_315 0x0d
-#define VCLK_1280x800_315_2 0x5c
-#define VCLK121_315 0x5d
-#define VCLK130_315 0x72
+#define VCLK_1280x800_315_2 0x5c
+#define VCLK121_315 0x5d
+#define VCLK130_315 0x72
#define VCLK_1280x720 0x5f
#define VCLK_1280x768_2 0x60
#define VCLK_1280x768_3 0x61 /* (unused?) */
#define VCLK_CUSTOM_315 0x62
#define VCLK_1280x720_2 0x63
-#define VCLK_720x480 0x67
+#define VCLK_720x480 0x67
#define VCLK_720x576 0x68
#define VCLK_768x576 0x68
#define VCLK_848x480 0x65
diff --git a/src/sis.h b/src/sis.h
index a0b915c..c7a2404 100644
--- a/src/sis.h
+++ b/src/sis.h
@@ -32,17 +32,17 @@
*
*/
-#ifndef _SIS_H
+#ifndef _SIS_H_
#define _SIS_H_
#define SISDRIVERVERSIONYEAR 5
-#define SISDRIVERVERSIONMONTH 2
-#define SISDRIVERVERSIONDAY 1
+#define SISDRIVERVERSIONMONTH 3
+#define SISDRIVERVERSIONDAY 11
#define SISDRIVERREVISION 1
#define SISDRIVERIVERSION ((SISDRIVERVERSIONYEAR << 16) | \
(SISDRIVERVERSIONMONTH << 8) | \
- SISDRIVERVERSIONDAY | \
+ SISDRIVERVERSIONDAY | \
(SISDRIVERREVISION << 24))
#undef SIS_LINUX /* Try to find out whether platform is Linux */
@@ -165,7 +165,7 @@
/* Configurable stuff: ------------------------------------- */
-#define SISDUALHEAD /* Include Dual Head code */
+#define SISDUALHEAD /* Include Dual Head code */
#define SISMERGED /* Include Merged-FB code */
@@ -244,14 +244,11 @@
#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, 761_VGA */
#endif
#ifndef PCI_CHIP_SIS340
#define PCI_CHIP_SIS340 0x0340
#endif
-#ifndef PCI_CHIP_SIS761
-#define PCI_CHIP_SIS761 0x6340 /* ? */
-#endif
/* pSiS->Flags (old series only) */
#define SYNCDRAM 0x00000001
@@ -366,6 +363,7 @@
#define VB_LCD_1280x800 0x00010000
#define VB_LCD_1680x1050 0x00020000
#define VB_LCD_1280x720 0x00040000
+#define VB_LCD_320x240 0x00080000
#define VB_LCD_UNKNOWN 0x10000000
#define VB_LCD_BARCO1366 0x20000000
#define VB_LCD_CUSTOM 0x40000000
@@ -384,6 +382,8 @@
#define MISC_CRT1OVERLAYGAMMA 0x00000004 /* Current display mode supports overlay gamma corr on CRT1 */
#define MISC_TVNTSC1024 0x00000008 /* Current display mode is TV NTSC/PALM/YPBPR525I 1024x768 */
#define MISC_CRT2OVERLAY 0x00000010 /* Current display mode supports overlay (CRT2) */
+#define MISC_SIS760ONEOVERLAY 0x00000020 /* SiS760/761: Only one overlay available currently */
+#define MISC_STNMODE 0x00000040 /* SiS550: xSTN active */
/* pSiS->SiS6326Flags */
#define SIS6326_HASTV 0x00000001
@@ -422,7 +422,7 @@ typedef unsigned char UChar;
#define SIS_530_VGA 1
#define SIS_OLD_VGA 2
#define SIS_300_VGA 3
-#define SIS_315_VGA 4 /* Includes 330/660/661/741/760 and M versions thereof */
+#define SIS_315_VGA 4 /* Includes 330/660/661/741/760/340/761 and M versions thereof */
/* pSiS->oldChipset */
#define OC_UNKNOWN 0
@@ -436,7 +436,7 @@ typedef unsigned char UChar;
#define OC_SIS5597 8
#define OC_SIS6326 9
#define OC_SIS530A 11
-#define OC_SIS530B 12
+#define OC_SIS530B 12 /* 620 in 620-WDR */
#define OC_SIS620 13
/* Chrontel type */
@@ -466,8 +466,8 @@ typedef unsigned char UChar;
#define SiSCF_Ultra256Core 0x00080000 /* 3D: aka "Mirage 2"; similar to Xabre, no T&L?, no P:Shader? (760) */
#define SiSCF_MMIOPalette 0x00100000 /* HW supports MMIO palette writing/reading */
#define SiSCF_UseLCDA 0x01000000
-#define SiSCF_760LFB 0x08000000 /* 760: LFB active (if not set, UMA only) */
-#define SiSCF_760UMA 0x10000000 /* 760: UMA active (if not set, LFB only) */
+#define SiSCF_760LFB 0x08000000 /* 760/761: LFB active (if not set, UMA only) */
+#define SiSCF_760UMA 0x10000000 /* 760/761: 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
@@ -520,6 +520,10 @@ typedef unsigned char UChar;
#define SiS_SD2_VIDEOBRIDGE 0x00000400 /* Any type of video bridge present */
#define SiS_SD2_THIRDPARTYLVDS 0x00000800 /* Third party LVDS (non-SiS) */
#define SiS_SD2_ADDLFLAGS 0x00001000 /* Following flags valid */
+#define SiS_SD2_SUPPORT760OO 0x00002000 /* Support dynamic one/two overlay configuration changes */
+ /* (If set, utility must re-read SD2 flags after mode change) */
+#define SiS_SD2_SIS760ONEOVL 0x00004000 /* (76x:) Only one overlay currently */
+#define SiS_SD2_MERGEDUCLOCK 0x00008000 /* Provide VRefresh in mode->Clock field in MergedFB mode */
/* ... */
#define SiS_SD2_NOOVERLAY 0x80000000 /* No video overlay */
@@ -604,16 +608,17 @@ typedef struct _sisModeInfoPtr {
struct _sisModeInfoPtr *next;
} sisModeInfoRec, *sisModeInfoPtr;
-/* SISFBLayout is mainly there because of DGA. It holds the
- * current layout parameters needed for acceleration and other
- * stuff. When switching mode using DGA, these are set up
- * accordingly and not necessarily match pScrn's. Therefore,
- * driver modules should read these values instead of pScrn's.
+/* SISFBLayout (which has nothing to do with sisfb, actually)
+ * is mainly there because of DGA. It holds the current layout
+ * parameters needed for acceleration and other stuff. When
+ * switching mode using DGA, these are set up accordingly and
+ * not necessarily match pScrn's. Therefore, driver modules
+ * should read these values instead of pScrn's.
*/
typedef struct {
- int bitsPerPixel; /* = pScrn->bitsPerPixel */
- int depth; /* = pScrn->depth */
- int displayWidth; /* = pScrn->displayWidth */
+ int bitsPerPixel; /* = pScrn->bitsPerPixel */
+ int depth; /* = pScrn->depth */
+ int displayWidth; /* = pScrn->displayWidth */
int displayHeight; /* = imageHeight from DGA mode; ONLY WHEN DGA IS ACTIVE!!! */
int DGAViewportX;
int DGAViewportY;
@@ -636,11 +641,11 @@ typedef struct {
unsigned int agpSize;
unsigned int agpWantedSize;
unsigned int agpWantedPages;
- ULong agpCmdBufAddr; /* 300 series */
+ ULong agpCmdBufAddr; /* 300 series */
UChar *agpCmdBufBase;
unsigned int agpCmdBufSize;
unsigned int agpCmdBufFree;
- ULong agpVtxBufAddr; /* 315 series */
+ ULong agpVtxBufAddr; /* 315/330 series */
UChar *agpVtxBufBase;
unsigned int agpVtxBufSize;
unsigned int agpVtxBufFree;
@@ -663,6 +668,7 @@ typedef struct {
Bool HWCursor; /* Backup master settings for use on slave */
Bool TurboQueue;
int ForceCRT1Type;
+ Bool CRT1TypeForced;
int ForceCRT2Type;
int OptTVStand;
int OptTVOver;
@@ -679,6 +685,7 @@ typedef struct {
ULong slaveFbAddress;
ULong slaveFbSize;
UChar *FbBase; /* VRAM linear address */
+ UChar *RealFbBase; /* Real VRAM linear address (for DHM, SiS76x UMA skipping) */
UChar *IOBase; /* MMIO linear address */
UShort MapCountIOBase; /* map/unmap queue counter */
UShort MapCountFbBase; /* map/unmap queue counter */
@@ -739,9 +746,13 @@ typedef struct {
Bool HaveFastVidCpy;
vidCopyFunc SiSFastVidCopy, SiSFastMemCopy;
unsigned int CPUFlags;
+ Bool SiS760VLFB; /* video area for UMA+LFB reserved in LFB */
+ ULong SiS760VLFBBase; /* Base of reserved video ram in LFB (address) */
+ unsigned int SiS760VLFBOffset; /* Base of reserved video ram in LFB (offset) */
+ ULong SiS760VLFBSize; /* Total size of reserved video ram in LFB (bytes) */
#ifdef SIS_NEED_MAP_IOP
- CARD32 IOPAddress; /* I/O port physical address */
- UChar *IOPBase; /* I/O port linear address */
+ CARD32 IOPAddress; /* I/O port physical address */
+ UChar *IOPBase; /* I/O port linear address */
UShort MapCountIOPBase; /* map/unmap queue counter */
Bool forceUnmapIOPBase; /* ignore counter and unmap */
#endif
@@ -763,6 +774,10 @@ typedef enum {
sisClone
} SiSScrn2Rel;
+typedef struct _region {
+ int x0,x1,y0,y1;
+} region;
+
typedef struct {
ScrnInfoPtr pScrn; /* -------------- DON'T INSERT ANYTHING HERE --------------- */
pciVideoPtr PciInfo; /* -------- OTHERWISE sis_dri.so MUST BE RECOMPILED -------- */
@@ -778,6 +793,7 @@ typedef struct {
ULong FbAddress; /* VRAM physical address (in DHM: for each Fb!) */
ULong realFbAddress; /* For DHM/PCI mem mapping: store global FBAddress */
UChar *FbBase; /* VRAM virtual linear address */
+ UChar *RealFbBase; /* Real VRAM virtual linear address (for DHM and SiS76x UMA skipping) */
CARD32 IOAddress; /* MMIO physical address */
UChar *IOBase; /* MMIO linear address */
IOADDRESS IODBase; /* Base of PIO memory area */
@@ -794,10 +810,9 @@ typedef struct {
long FbMapSize; /* Used for Mem Mapping - DON'T CHANGE THIS */
long availMem; /* Really available Fb mem (minus TQ, HWCursor) */
ULong maxxfbmem; /* limit fb memory X is to use to this (KB) */
- ULong sisfbMem; /* heapstart of sisfb (if running) */
-#ifdef SISDUALHEAD
- ULong dhmOffset; /* Offset to memory for each head (0 or ..) */
-#endif
+ ULong sisfbHeapStart; /* heapstart of sisfb (if running) */
+ ULong dhmOffset; /* Offset to memory for each head (0 or ..); also used on SiS76x/UMA+LFB */
+ ULong FbBaseOffset;
DGAModePtr DGAModes;
int numDGAModes;
Bool DGAactive;
@@ -811,6 +826,7 @@ typedef struct {
Bool TurboQueue;
int VESA;
int ForceCRT1Type;
+ Bool CRT1Detected, CRT1TypeForced;
int ForceCRT2Type;
int OptTVStand;
int OptTVOver;
@@ -917,8 +933,7 @@ typedef struct {
int ImageWriteBufferSize;
UChar *ImageWriteBufferAddr;
- int Rotate;
- Bool RotateMouse;
+ int Rotate, Reflect;
void (*PointerMoved)(int index, int x, int y);
/* ShadowFB support */
@@ -933,7 +948,7 @@ typedef struct {
/* DRI */
Bool loadDRI;
#ifdef XF86DRI
- Bool directRenderingEnabled;
+ Bool directRenderingEnabled;
DRIInfoPtr pDRIInfo;
int drmSubFD;
int numVisualConfigs;
@@ -949,15 +964,11 @@ typedef struct {
ScreenBlockHandlerProcPtr BlockHandler;
void (*VideoTimerCallback)(ScrnInfoPtr, Time);
void (*ResetXv)(ScrnInfoPtr);
+ void (*ResetXvDisplay)(ScrnInfoPtr);
void (*ResetXvGamma)(ScrnInfoPtr);
/* misc */
OptionInfoPtr Options;
- UChar LCDon;
-#ifdef SISDUALHEAD
- Bool BlankCRT1, BlankCRT2;
-#endif
- Bool Blank;
UChar BIOSModeSave;
int CRT1off; /* 1=CRT1 off, 0=CRT1 on */
CARD16 LCDheight; /* Vertical resolution of LCD panel */
@@ -994,7 +1005,7 @@ typedef struct {
CARD32 CmdQueMaxLen; /* (6326/5597/5598) Amount of cmds the queue can hold */
CARD32 TurboQueueLen; /* For future use */
CARD32 detectedCRT2Devices; /* detected CRT2 devices before mask-out */
- Bool NoHostBus; /* Enable/disable 5597/5598 host bus */
+ Bool HostBus; /* Enable/disable 5597/5598 host bus */
Bool noInternalModes; /* Use our own default modes? */
int OptUseOEM; /* Use internal OEM data? */
int chtvlumabandwidthcvbs; /* TV settings for Chrontel TV encoder */
@@ -1029,6 +1040,10 @@ typedef struct {
Bool sisfb_haveemi, sisfb_haveemilcd, sisfb_tvposvalid, sisfb_havelock;
UChar sisfb_emi30,sisfb_emi31,sisfb_emi32,sisfb_emi33;
int sisfb_tvxpos, sisfb_tvypos;
+ Bool sisfbHaveNewHeapDef;
+ ULong sisfbHeapSize, sisfbVideoOffset;
+ Bool sisfbxSTN;
+ ULong sisfbDSTN, sisfbFSTN;
char sisfbdevname[16];
int EMI;
int PRGB;
@@ -1073,6 +1088,13 @@ typedef struct {
#endif
int xv_sisdirectunlocked;
ULong xv_sd_result;
+ Bool SiS760VLFB; /* video area for UMA+LFB reserved in LFB */
+ ULong SiS760VLFBBase; /* Base of reserved video ram in LFB (address) */
+ unsigned int SiS760VLFBOffset; /* Base of reserved video ram in LFB (offset) */
+ ULong SiS760VLFBSize; /* Total size of reserved video ram in LFB (bytes) */
+ ULong SiS760VLFBHSize; /* Size of reserved video ram in LFB per head (bytes) */
+ int SiS76xLFBSize;
+ int SiS76xUMASize;
int CRT1isoff;
#ifdef SIS_CP
SIS_CP_H
@@ -1152,8 +1174,8 @@ typedef struct {
int GammaBriR2, GammaBriG2, GammaBriB2;
int GammaPBriR2, GammaPBriG2, GammaPBriB2;
#ifdef SIS_NEED_MAP_IOP
- CARD32 IOPAddress; /* I/O port physical address */
- UChar *IOPBase; /* I/O port linear address */
+ CARD32 IOPAddress; /* I/O port physical address */
+ UChar *IOPBase; /* I/O port linear address */
#endif
#ifdef SISMERGED
Bool MergedFB, MergedFBAuto;
@@ -1176,10 +1198,13 @@ typedef struct {
int maxClone_X1, maxClone_X2, maxClone_Y1, maxClone_Y2;
int MergedFBXDPI, MergedFBYDPI;
int CRT1XOffs, CRT1YOffs, CRT2XOffs, CRT2YOffs;
+ int MBXNR1XMAX, MBXNR1YMAX, MBXNR2XMAX, MBXNR2YMAX;
+ Bool NonRect, HaveNonRect, HaveOffsRegions, MouseRestrictions;
+ region NonRectDead, OffDead1, OffDead2;
#ifdef SISXINERAMA
Bool UseSiSXinerama;
Bool CRT2IsScrn0;
- ExtensionEntry *XineramaExtEntry;
+ ExtensionEntry *XineramaExtEntry;
int SiSXineramaVX, SiSXineramaVY;
Bool AtLeastOneNonClone;
#endif
@@ -1195,17 +1220,23 @@ typedef struct _ModeInfoData {
#define SDMPTR(x) ((SiSMergedDisplayModePtr)(x->currentMode->Private))
#define CDMPTR ((SiSMergedDisplayModePtr)(pSiS->CurrentLayout.mode->Private))
-#define BOUND(test,low,hi) { \
- if(test < low) test = low; \
- if(test > hi) test = hi; }
-
-#define REBOUND(low,hi,test) { \
- if(test < low) { \
- hi += test-low; \
- low = test; } \
- if(test > hi) { \
- low += test-hi; \
- hi = test; } }
+#define BOUND(test,low,hi) \
+ { \
+ if((test) < (low)) (test) = (low); \
+ if((test) > (hi)) (test) = (hi); \
+ }
+
+#define REBOUND(low,hi,test) \
+ { \
+ if((test) < (low)) { \
+ (hi) += (test)-(low); \
+ (low) = (test); \
+ } \
+ if((test) > (hi)) { \
+ (low) += (test)-(hi); \
+ (hi) = (test); \
+ } \
+ }
typedef struct _MergedDisplayModeRec {
DisplayModePtr CRT1;
@@ -1213,10 +1244,6 @@ typedef struct _MergedDisplayModeRec {
SiSScrn2Rel CRT2Position;
} SiSMergedDisplayModeRec, *SiSMergedDisplayModePtr;
-typedef struct _region {
- int x0,x1,y0,y1;
-} region;
-
typedef struct _myhddctiming {
int whichone;
UChar mask;
diff --git a/src/sis310_accel.c b/src/sis310_accel.c
index 1c27c3a..3f11f60 100644
--- a/src/sis310_accel.c
+++ b/src/sis310_accel.c
@@ -45,11 +45,9 @@
#define ACCELDEBUG
#endif
-#ifdef SISDUALHEAD
-#define HEADOFFSET (pSiS->dhmOffset)
-#endif
+#define FBOFFSET (pSiS->dhmOffset)
-#undef TRAP /* Use/Don't use Trapezoid Fills
+#undef TRAP /* Use/Don't use Trapezoid Fills
* DOES NOT WORK. XAA sometimes provides illegal
* trapezoid data (left and right edges cross each
* other) which causes drawing errors. Since
@@ -61,19 +59,19 @@
* doing it by the CPU.
*/
-#undef CTSCE /* Use/Don't use CPUToScreenColorExpand. Disabled
+#undef CTSCE /* Use/Don't use CPUToScreenColorExpand. Disabled
* because it is slower than doing it by the CPU.
* Indirect mode does not work in VRAM queue mode.
* Does not work on 330 series (even in MMIO mode).
*/
-#undef CTSCE_DIRECT /* Use direct method - This works (on both 315 and 330 at
+#undef CTSCE_DIRECT /* Use direct method - This works (on both 315 and 330 at
* least in VRAM queue mode) but we don't use this either,
* because it's slower than doing it by the CPU. (Using it
* would require defining CTSCE)
*/
-#undef STSCE /* Use/Don't use ScreenToScreenColorExpand - does not work,
- * see comments below.
+#undef STSCE /* Use/Don't use ScreenToScreenColorExpand - does not work,
+ * see comments below.
*/
#define INCL_RENDER /* Use/Don't use RENDER extension acceleration */
@@ -172,23 +170,23 @@ static void SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno);
#ifdef RENDER
static Bool SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
int op, CARD16 red, CARD16 green,
- CARD16 blue, CARD16 alpha,
+ CARD16 blue, CARD16 alpha,
#ifdef SISNEWRENDER
CARD32 alphaType, CARD32 dstType,
#else
- int alphaType,
-#endif
+ int alphaType,
+#endif
CARD8 *alphaPtr,
int alphaPitch, int width,
int height, int flags);
static Bool SiSSetupForCPUToScreenTexture( ScrnInfoPtr pScrn,
- int op,
+ int op,
#ifdef SISNEWRENDER
CARD32 texType, CARD32 dstType,
-#else
- int texType,
-#endif
+#else
+ int texType,
+#endif
CARD8 *texPtr,
int texPitch, int width,
int height, int flags);
@@ -199,7 +197,7 @@ static void SiSSubsequentCPUToScreenTexture(ScrnInfoPtr pScrn,
int width, int height);
static CARD32 SiSAlphaTextureFormats[2] = { PICT_a8 , 0 };
-static CARD32 SiSTextureFormats[2] = { PICT_a8r8g8b8, 0 };
+static CARD32 SiSTextureFormats[2] = { PICT_a8r8g8b8, 0 };
#ifdef SISVRAMQ
#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,0,0,0)
#define SiSRenderOpsMAX 0x2b
@@ -207,7 +205,7 @@ static CARD32 SiSTextureFormats[2] = { PICT_a8r8g8b8, 0 };
#define SiSRenderOpsMAX 0x0f
#endif
static const CARD8 SiSRenderOps[] = { /* PictOpXXX 1 = supported, 0 = unsupported */
- 1, 1, 1, 1,
+ 1, 1, 1, 1,
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0,
@@ -219,11 +217,11 @@ static const CARD8 SiSRenderOps[] = { /* PictOpXXX 1 = supported, 0 = unsupporte
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 };
+static CARD32 SiSDstTextureFormats32[3] = { PICT_x8r8g8b8, PICT_a8r8g8b8, 0 };
#endif
#endif
#endif
@@ -251,9 +249,9 @@ SiSInitializeAccelerator(ScrnInfoPtr pScrn)
#ifndef SISVRAMQ
if(pSiS->ChipFlags & SiSCF_Integrated) {
CmdQueLen = 0;
- } else {
+ } else {
CmdQueLen = ((128 * 1024) / 4) - 64;
- }
+ }
#endif
}
@@ -266,7 +264,7 @@ SiS315AccelInit(ScreenPtr pScreen)
int topFB, reservedFbSize, usableFbSize;
BoxRec Avail;
#ifdef SISDUALHEAD
- SISEntPtr pSiSEnt = NULL;
+ SISEntPtr pSiSEnt = NULL;
#endif
#ifdef CTSCE
unsigned char *AvailBufBase;
@@ -279,18 +277,18 @@ SiS315AccelInit(ScreenPtr pScreen)
pSiS->PerColorExpandBufferSize = 0;
pSiS->RenderAccelArray = NULL;
pSiS->AccelInfoPtr = NULL;
-
- if((pScrn->bitsPerPixel != 8) &&
+
+ if((pScrn->bitsPerPixel != 8) &&
(pScrn->bitsPerPixel != 16) &&
(pScrn->bitsPerPixel != 32)) {
pSiS->NoAccel = TRUE;
}
-
+
if(!pSiS->NoAccel) {
pSiS->AccelInfoPtr = infoPtr = XAACreateInfoRec();
if(!infoPtr) pSiS->NoAccel = TRUE;
}
-
+
if(!pSiS->NoAccel) {
SiSInitializeAccelerator(pScrn);
@@ -334,7 +332,7 @@ SiS315AccelInit(ScreenPtr pScreen)
infoPtr->SubsequentDashedTwoPointLine = SiSSubsequentDashedTwoPointLine;
infoPtr->DashPatternMaxLength = 64;
infoPtr->DashedLineFlags = NO_PLANEMASK |
- LINE_PATTERN_MSBFIRST_LSBJUSTIFIED;
+ LINE_PATTERN_MSBFIRST_LSBJUSTIFIED;
/* 8x8 mono pattern fill */
infoPtr->SetupForMono8x8PatternFill = SiSSetupForMonoPatternFill;
@@ -356,7 +354,7 @@ SiS315AccelInit(ScreenPtr pScreen)
infoPtr->SetupForColor8x8PatternFill = SiSSetupForColor8x8PatternFill;
infoPtr->SubsequentColor8x8PatternFillRect = SiSSubsequentColor8x8PatternFillRect;
infoPtr->Color8x8PatternFillFlags = NO_PLANEMASK |
- HARDWARE_PATTERN_SCREEN_ORIGIN |
+ HARDWARE_PATTERN_SCREEN_ORIGIN |
NO_TRANSPARENCY;
#endif
@@ -367,11 +365,11 @@ SiS315AccelInit(ScreenPtr pScreen)
* with a pitch of scrnOffset (= width * bpp / 8).
*/
infoPtr->SetupForScreenToScreenColorExpandFill =
- SiSSetupForScreenToScreenColorExpand;
+ SiSSetupForScreenToScreenColorExpand;
infoPtr->SubsequentScreenToScreenColorExpandFill =
- SiSSubsequentScreenToScreenColorExpand;
+ SiSSubsequentScreenToScreenColorExpand;
infoPtr->ScreenToScreenColorExpandFillFlags = NO_PLANEMASK |
- BIT_ORDER_IN_BYTE_MSBFIRST ;
+ BIT_ORDER_IN_BYTE_MSBFIRST ;
#endif
#ifdef CTSCE
@@ -386,7 +384,7 @@ SiS315AccelInit(ScreenPtr pScreen)
* the call to Subsequent(), therefore we do not execute the
* command in Subsequent, but in the following call to Sync().
* (Hence, the SYNC_AFTER_COLOR_EXPAND flag MUST BE SET)
- *
+ *
* This is slower than doing it by the CPU.
*/
@@ -411,8 +409,8 @@ SiS315AccelInit(ScreenPtr pScreen)
* Does not work in VRAM queue mode.
*/
#ifndef SISVRAMQ
- if((pSiS->Chipset != PCI_CHIP_SIS650) &&
- (pSiS->Chipset != PCI_CHIP_SIS660) &&
+ if((pSiS->Chipset != PCI_CHIP_SIS650) &&
+ (pSiS->Chipset != PCI_CHIP_SIS660) &&
(pSiS->Chipset != PCI_CHIP_SIS330) &&
(pSiS->Chipset != PCI_CHIP_SIS340)) {
pSiS->ColorExpandBufferNumber = 16;
@@ -429,57 +427,57 @@ SiS315AccelInit(ScreenPtr pScreen)
SCANLINE_PAD_DWORD |
BIT_ORDER_IN_BYTE_MSBFIRST |
LEFT_EDGE_CLIPPING;
- }
+ }
#endif
#endif
#endif
#ifdef INCL_RENDER
#ifdef RENDER
- /* Render */
- if(((pScrn->bitsPerPixel == 16) || (pScrn->bitsPerPixel == 32)) && pSiS->doRender) {
- int i, j;
+ /* Render */
+ if(((pScrn->bitsPerPixel == 16) || (pScrn->bitsPerPixel == 32)) && pSiS->doRender) {
+ int i, j;
#ifdef SISDUALHEAD
if(pSiSEnt) pSiS->RenderAccelArray = pSiSEnt->RenderAccelArray;
#endif
if(!pSiS->RenderAccelArray) {
if((pSiS->RenderAccelArray = xnfcalloc(65536, 1))) {
#ifdef SISDUALHEAD
- if(pSiSEnt) pSiSEnt->RenderAccelArray = pSiS->RenderAccelArray;
+ if(pSiSEnt) pSiSEnt->RenderAccelArray = pSiS->RenderAccelArray;
#endif
- for(i = 0; i < 256; i++) {
- for(j = 0; j < 256; j++) {
- pSiS->RenderAccelArray[(i << 8) + j] = (i * j) / 255;
+ for(i = 0; i < 256; i++) {
+ for(j = 0; j < 256; j++) {
+ pSiS->RenderAccelArray[(i << 8) + j] = (i * j) / 255;
}
- }
- }
+ }
+ }
}
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;
+ 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;
-#endif
- infoPtr->SubsequentCPUToScreenTexture = SiSSubsequentCPUToScreenTexture;
- infoPtr->CPUToScreenTextureFormats = SiSTextureFormats;
- infoPtr->CPUToScreenTextureFlags = XAA_RENDER_NO_TILE;
-
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "RENDER acceleration enabled\n");
+ infoPtr->SetupForCPUToScreenTexture2 = SiSSetupForCPUToScreenTexture;
+ infoPtr->CPUToScreenTextureDstFormats = (pScrn->bitsPerPixel == 16) ?
+ SiSDstTextureFormats16 : SiSDstTextureFormats32;
+#else
+ infoPtr->SetupForCPUToScreenTexture = SiSSetupForCPUToScreenTexture;
+#endif
+ infoPtr->SubsequentCPUToScreenTexture = SiSSubsequentCPUToScreenTexture;
+ infoPtr->CPUToScreenTextureFormats = SiSTextureFormats;
+ infoPtr->CPUToScreenTextureFlags = XAA_RENDER_NO_TILE;
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "RENDER acceleration enabled\n");
}
}
#endif
@@ -491,22 +489,31 @@ SiS315AccelInit(ScreenPtr pScreen)
}
#endif
- } /* NoAccel */
+ } /* NoAccel */
/* Init framebuffer memory manager */
- topFB = pSiS->maxxfbmem;
+ topFB = pSiS->maxxfbmem; /* relative to FbBase */
reservedFbSize = pSiS->ColorExpandBufferNumber * pSiS->PerColorExpandBufferSize;
usableFbSize = topFB - reservedFbSize;
-
- /* Layout:
- * |--------------++++++++++++++++++++^************==========~~~~~~~~~~~~|
- * UsableFbSize ColorExpandBuffers | DRI-Heap HWCursor CommandQueue
- * topFB
+
+ /* Traditional layout:
+ * |-----------------++++++++++++++++++++^************==========~~~~~~~~~~~~|
+ * | UsableFbSize ColorExpandBuffers | DRI-Heap HWCursor CommandQueue
+ * FbBase topFB
+ * +-------------maxxfbmem---------------+
+ *
+ * On SiS76x with UMA+LFB:
+ * |UUUUUUUUUUUUUUU--------------++++++++++++++++++++^==========~~~~~~~~~~~~|
+ * DRI heap |UsableFbSize ColorExpandBuffers | HWCursor CommandQueue
+ * (in UMA and FbBase topFB
+ * eventually +---------- maxxfbmem ------------+
+ * beginning of
+ * LFB)
*/
-
+
#ifdef CTSCE
AvailBufBase = pSiS->FbBase + usableFbSize;
if(pSiS->ColorExpandBufferNumber) {
@@ -530,7 +537,7 @@ SiS315AccelInit(ScreenPtr pScreen)
Avail.y2 = (usableFbSize / (pScrn->displayWidth * pScrn->bitsPerPixel/8)) - 1;
if(Avail.y2 < 0) Avail.y2 = 32767;
-
+
if(Avail.y2 < pScrn->currentMode->VDisplay) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Not enough video RAM for accelerator. At least "
@@ -548,9 +555,9 @@ SiS315AccelInit(ScreenPtr pScreen)
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Framebuffer from (%d,%d) to (%d,%d)\n",
Avail.x1, Avail.y1, Avail.x2 - 1, Avail.y2 - 1);
-
+
xf86InitFBManager(pScreen, &Avail);
-
+
if(pSiS->NoAccel) {
return TRUE;
} else {
@@ -602,7 +609,7 @@ static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
xdir, ydir, rop, planemask, trans_color));
#ifdef SISVRAMQ
- SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
+ SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
SiSCheckQueue(16 * 2);
SiSSetupSRCPitchDSTRect(pSiS->scrnOffset, pSiS->scrnOffset, -1)
#else
@@ -626,7 +633,7 @@ static void SiSSetupForScreenToScreenCopy(ScrnInfoPtr pScrn,
#endif
#ifdef SISVRAMQ
- SiSSyncWP
+ SiSSyncWP
#endif
/* The chip is smart enough to know the direction */
@@ -654,21 +661,21 @@ static void SiSSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
* Fixed in 4.3.99.10 (?) and Debian's 4.3.0.1
*/
#if (XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,3,99,10,0)) && (XF86_VERSION_CURRENT != XF86_VERSION_NUMERIC(4,3,0,1,0))
- if((src_x < 0) ||
+ if((src_x < 0) ||
(dst_x < 0) ||
(src_y < 0) ||
(dst_y < 0) ||
(width <= 0) ||
(height <= 0)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "BitBlit fatal error: Illegal coordinates:\n");
+ "BitBlit fatal error: Illegal coordinates:\n");
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Source x %d y %d, dest x %d y %d, width %d height %d\n",
src_x, src_y, dst_x, dst_y, width, height);
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "This is very probably caused by a known bug in libxaa.a.\n");
+ "This is very probably caused by a known bug in libxaa.a.\n");
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Please update libxaa.a to avoid this error.\n");
+ "Please update libxaa.a to avoid this error.\n");
return;
}
#endif
@@ -678,13 +685,13 @@ static void SiSSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
* that logic fails if we fiddle with the bitmap
* addresses. Therefore, we check if the source
* and destination blitting areas overlap and
- * adapt the bitmap addresses synchronously
+ * adapt the bitmap addresses synchronously
* if the coordinates exceed the valid range.
- * The the areas do not overlap, we do our
+ * The the areas do not overlap, we do our
* normal check.
*/
if((mymax - mymin) < height) {
- if((src_y >= 2048) || (dst_y >= 2048)) {
+ if((src_y >= 2048) || (dst_y >= 2048)) {
srcbase = pSiS->scrnOffset * mymin;
dstbase = pSiS->scrnOffset * mymin;
src_y -= mymin;
@@ -700,14 +707,13 @@ static void SiSSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn,
dst_y = 0;
}
}
-#ifdef SISDUALHEAD
- srcbase += HEADOFFSET;
- dstbase += HEADOFFSET;
-#endif
+
+ srcbase += FBOFFSET;
+ dstbase += FBOFFSET;
#ifdef SISVRAMQ
SiSCheckQueue(16 * 3);
- SiSSetupSRCDSTBase(srcbase, dstbase)
+ SiSSetupSRCDSTBase(srcbase, dstbase)
SiSSetupSRCDSTXY(src_x, src_y, dst_x, dst_y)
SiSSetRectDoCMD(width,height)
#else
@@ -741,9 +747,9 @@ SiSSetupForSolidFill(ScrnInfoPtr pScrn, int color,
SiSSetupPATFGDSTRect(color, pSiS->scrnOffset, -1)
SiSSetupROP(SiSGetPatternROP(rop))
SiSSetupCMDFlag(PATFG)
- SiSSyncWP
+ SiSSyncWP
#else
- SiSSetupPATFG(color)
+ SiSSetupPATFG(color)
SiSSetupDSTRect(pSiS->scrnOffset, -1)
SiSSetupDSTColorDepth(pSiS->DstColor);
SiSSetupROP(SiSGetPatternROP(rop))
@@ -766,9 +772,8 @@ SiSSubsequentSolidFillRect(ScrnInfoPtr pScrn,
dstbase = pSiS->scrnOffset * y;
y = 0;
}
-#ifdef SISDUALHEAD
- dstbase += HEADOFFSET;
-#endif
+
+ dstbase += FBOFFSET;
pSiS->CommandReg &= ~(T_XISMAJORL | T_XISMAJORR |
T_L_X_INC | T_L_Y_INC |
@@ -809,9 +814,8 @@ SiSSubsequentSolidFillTrap(ScrnInfoPtr pScrn, int y, int h,
dstbase = pSiS->scrnOffset * y;
y = 0;
}
-#ifdef SISDUALHEAD
- dstbase += HEADOFFSET;
-#endif
+
+ dstbase += FBOFFSET;
#ifdef SISVRAMQ /* Not optimized yet */
SiSCheckQueue(16 * 10)
@@ -882,11 +886,11 @@ SiSSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop,
#ifdef SISVRAMQ
SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
SiSCheckQueue(16 * 3);
- SiSSetupLineCountPeriod(1, 1)
+ SiSSetupLineCountPeriod(1, 1)
SiSSetupPATFGDSTRect(color, pSiS->scrnOffset, -1)
SiSSetupROP(SiSGetPatternROP(rop))
SiSSetupCMDFlag(PATFG | LINE)
- SiSSyncWP
+ SiSSyncWP
#else
SiSSetupLineCount(1)
SiSSetupPATFG(color)
@@ -916,9 +920,8 @@ SiSSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
y1 -= miny;
y2 -= miny;
}
-#ifdef SISDUALHEAD
- dstbase += HEADOFFSET;
-#endif
+
+ dstbase += FBOFFSET;
if(flags & OMIT_LAST) {
SiSSetupCMDFlag(NO_LAST_PIXEL)
@@ -928,7 +931,7 @@ SiSSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn,
#ifdef SISVRAMQ
SiSCheckQueue(16 * 2);
- SiSSetupX0Y0X1Y1(x1,y1,x2,y2)
+ SiSSetupX0Y0X1Y1(x1,y1,x2,y2)
SiSSetupDSTBaseDoCMD(dstbase)
#else
SiSSetupDSTBase(dstbase)
@@ -954,13 +957,12 @@ SiSSubsequentSolidHorzVertLine(ScrnInfoPtr pScrn,
dstbase = pSiS->scrnOffset * y;
y = 0;
}
-#ifdef SISDUALHEAD
- dstbase += HEADOFFSET;
-#endif
+
+ dstbase += FBOFFSET;
#ifdef SISVRAMQ
SiSCheckQueue(16 * 2);
- if(dir == DEGREES_0) {
+ if(dir == DEGREES_0) {
SiSSetupX0Y0X1Y1(x, y, (x + len), y)
} else {
SiSSetupX0Y0X1Y1(x, y, x, (y + len))
@@ -991,7 +993,7 @@ SiSSetupForDashedLine(ScrnInfoPtr pScrn,
#ifdef SISVRAMQ
SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
SiSCheckQueue(16 * 3);
- SiSSetupLineCountPeriod(1, length-1)
+ SiSSetupLineCountPeriod(1, length-1)
SiSSetupStyle(*pattern,*(pattern+4))
SiSSetupPATFGDSTRect(fg, pSiS->scrnOffset, -1)
#else
@@ -1041,9 +1043,8 @@ SiSSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn,
y1 -= miny;
y2 -= miny;
}
-#ifdef SISDUALHEAD
- dstbase += HEADOFFSET;
-#endif
+
+ dstbase += FBOFFSET;
if(flags & OMIT_LAST) {
SiSSetupCMDFlag(NO_LAST_PIXEL)
@@ -1087,7 +1088,7 @@ SiSSetupForMonoPatternFill(ScrnInfoPtr pScrn,
SiSSetupROP(SiSGetPatternROP(rop))
#ifdef SISVRAMQ
- SiSSetupCMDFlag(PATMONO)
+ SiSSetupCMDFlag(PATMONO)
#else
SiSSetupPATFG(fg)
SiSSetupCMDFlag(PATMONO | pSiS->SiS310_AccelDepth)
@@ -1100,7 +1101,7 @@ SiSSetupForMonoPatternFill(ScrnInfoPtr pScrn,
}
#ifdef SISVRAMQ
- SiSSyncWP
+ SiSSyncWP
#endif
}
@@ -1119,9 +1120,8 @@ SiSSubsequentMonoPatternFill(ScrnInfoPtr pScrn,
dstbase = pSiS->scrnOffset * y;
y = 0;
}
-#ifdef SISDUALHEAD
- dstbase += HEADOFFSET;
-#endif
+
+ dstbase += FBOFFSET;
/* Clear commandReg because Setup can be used for Rect and Trap */
pSiS->CommandReg &= ~(T_XISMAJORL | T_XISMAJORR |
@@ -1164,9 +1164,8 @@ SiSSubsequentMonoPatternFillTrap(ScrnInfoPtr pScrn,
dstbase=pSiS->scrnOffset*y;
y = 0;
}
-#ifdef SISDUALHEAD
- dstbase += HEADOFFSET;
-#endif
+
+ dstbase += FBOFFSET;
#ifdef SISVRAMQ
SiSCheckQueue(16 * 4);
@@ -1247,7 +1246,7 @@ SiSSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny,
SiSSetupCMDFlag(PATPATREG)
- SiSSyncWP
+ SiSSyncWP
}
static void
@@ -1267,9 +1266,9 @@ SiSSubsequentColor8x8PatternFillRect(ScrnInfoPtr pScrn, int patternx,
dstbase = pSiS->scrnOffset * y;
y = 0;
}
-#ifdef SISDUALHEAD
- dstbase += HEADOFFSET;
-#endif
+
+ dstbase += FBOFFSET;
+
/* SiSSetupCMDFlag(BITBLT) - BITBLT = 0 */
SiSCheckQueue(16 * 2)
@@ -1301,7 +1300,7 @@ SiSSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
SISPtr pSiS=SISPTR(pScrn);
#ifdef SISVRAMQ
- SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
+ SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
SiSSetupROP(SiSGetCopyROP(rop));
SiSSetupSRCFGDSTRect(fg, pSiS->scrnOffset, -1)
if(bg == -1) {
@@ -1310,7 +1309,7 @@ SiSSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
SiSSetupSRCBG(bg);
SiSSetupCMDFlag(ENCOLOREXP | SRCVIDEO);
}
- SiSSyncWP
+ SiSSyncWP
#else
SiSSetupSRCXY(0,0);
SiSSetupROP(SiSGetCopyROP(rop));
@@ -1344,10 +1343,8 @@ SiSSubsequentCPUToScreenColorExpandFill(
y = 0;
}
-#ifdef SISDUALHEAD
- srcbase += HEADOFFSET;
- dstbase += HEADOFFSET;
-#endif
+ srcbase += FBOFFSET;
+ dstbase += FBOFFSET;
#ifdef SISVRAMQ
SiSSetupSRCDSTBase(srcbase,dstbase);
@@ -1362,7 +1359,7 @@ SiSSubsequentCPUToScreenColorExpandFill(
_x1 = x + w;
_y1 = y + h;
#ifdef SISVRAMQ
- SiSSetupClip(_x0, _y0, _x1, _y1);
+ SiSSetupClip(_x0, _y0, _x1, _y1);
#else
SiSSetupClipLT(_x0, _y0);
SiSSetupClipRB(_x1, _y1);
@@ -1452,9 +1449,8 @@ SiSSubsequentScanlineCPUToScreenColorExpandFill(
dstbase = pSiS->scrnOffset*y;
y = 0;
}
-#ifdef SISDUALHEAD
- dstbase += HEADOFFSET;
-#endif
+
+ dstbase += FBOFFSET;
#ifndef SISVRAMQ
if((SIS_MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) {
@@ -1493,9 +1489,7 @@ SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno)
CARD32 cbo;
cbo = pSiS->ColorExpandBufferScreenOffset[bufno];
-#ifdef SISDUALHEAD
- cbo += HEADOFFSET;
-#endif
+ cbo += FBOFFSET;
#ifndef SISVRAMQ
if((SIS_MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) {
@@ -1641,10 +1635,8 @@ SiSSubsequentScreenToScreenColorExpand(ScrnInfoPtr pScrn,
y = 0;
}
-#ifdef SISDUALHEAD
- srcbase += HEADOFFSET;
- dstbase += HEADOFFSET;
-#endif
+ srcbase += FBOFFSET;
+ dstbase += FBOFFSET;
SiSSetupSRCBase(srcbase)
SiSSetupDSTBase(dstbase)
@@ -1696,7 +1688,7 @@ SiSSubsequentScreenToScreenColorExpand(ScrnInfoPtr pScrn,
#ifdef SISVRAMQ
/* We MUST sync here, there must not be 2 or more color expansion commands in the queue */
SiSIdle
-#endif
+#endif
}
#endif
@@ -1758,46 +1750,46 @@ SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
CARD16 blue, CARD16 alpha,
#ifdef SISNEWRENDER
CARD32 alphaType, CARD32 dstType,
-#else
- int alphaType,
-#endif
+#else
+ int alphaType,
+#endif
CARD8 *alphaPtr,
- int alphaPitch, int width,
- int height, int flags)
+ int alphaPitch, int width,
+ int height, int flags)
{
- SISPtr pSiS = SISPTR(pScrn);
+ SISPtr pSiS = SISPTR(pScrn);
unsigned char *renderaccelarray;
CARD32 *dstPtr;
- int x, pitch, sizeNeeded;
+ int x, pitch, sizeNeeded;
int sbpp = pSiS->CurrentLayout.bitsPerPixel >> 3;
int sbppshift = sbpp >> 1; /* 8->0, 16->1, 32->2 */
CARD8 myalpha;
Bool docopy = TRUE;
#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);
+ xf86DrvMsg(0, X_INFO, "AT: op %d t %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;
-#endif
+ if(op > SiSRenderOpsMAX) return FALSE;
+ if(!SiSRenderOps[op]) return FALSE;
+#else
+ if(op != PictOpOver) return FALSE;
+#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
+ xf86DrvMsg(0, X_INFO, "AT: op %d t %x ARGB %x %x %x %x, w %d h %d pch %d\n",
+ op, alphaType, alpha, red, green, blue, width, height, alphaPitch);
+#endif
- pitch = (width + 31) & ~31;
- sizeNeeded = (pitch << 2) * height; /* Source a8 (=8bit), expand to A8R8G8B8 (=32bit) */
+ pitch = (width + 31) & ~31;
+ sizeNeeded = (pitch << 2) * height; /* Source a8 (=8bit), expand to A8R8G8B8 (=32bit) */
if(!SiSAllocateLinear(pScrn, (sizeNeeded + sbpp - 1) >> sbppshift))
return FALSE;
@@ -1807,32 +1799,32 @@ SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
blue &= 0xff00;
#ifdef SISVRAMQ
- SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
+ SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
switch(op) {
case PictOpClear:
-#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,0,0,0)
+#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,0,0,0)
case PictOpDisjointClear:
- case PictOpConjointClear:
-#endif
+ case PictOpConjointClear:
+#endif
SiSSetupPATFGDSTRect(0, pSiS->scrnOffset, -1)
/* SiSSetupROP(0x00) - is already 0 */
SiSSetupCMDFlag(PATFG)
docopy = FALSE;
break;
case PictOpSrc:
-#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,0,0,0)
+#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,0,0,0)
case PictOpDisjointSrc:
case PictOpConjointSrc:
-#endif
+#endif
SiSSetupSRCPitchDSTRect((pitch << 2), pSiS->scrnOffset, -1);
SiSSetupAlpha(0xff)
SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_NODESTALPHA)
break;
case PictOpDst:
-#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,0,0,0)
+#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,0,0,0)
case PictOpDisjointDst:
case PictOpConjointDst:
-#endif
+#endif
SiSSetupSRCPitchDSTRect((pitch << 2), pSiS->scrnOffset, -1);
SiSSetupAlpha(0x00)
SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_CONSTANTALPHA)
@@ -1853,7 +1845,7 @@ SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
#endif
/* Don't need source for clear and dest */
- if(!docopy) return TRUE;
+ if(!docopy) return TRUE;
dstPtr = (CARD32*)(pSiS->FbBase + (pSiS->AccelLinearScratch->offset << sbppshift));
@@ -1863,18 +1855,18 @@ SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
}
if(alpha == 0xffff) {
-
- while(height--) {
+
+ while(height--) {
for(x = 0; x < width; x++) {
myalpha = alphaPtr[x];
dstPtr[x] = (renderaccelarray[red + myalpha] << 16) |
- (renderaccelarray[green + myalpha] << 8) |
+ (renderaccelarray[green + myalpha] << 8) |
renderaccelarray[blue + myalpha] |
myalpha << 24;
}
dstPtr += pitch;
alphaPtr += alphaPitch;
- }
+ }
} else {
@@ -1884,94 +1876,94 @@ SiSSetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn,
for(x = 0; x < width; x++) {
myalpha = alphaPtr[x];
dstPtr[x] = (renderaccelarray[alpha + myalpha] << 24) |
- (renderaccelarray[red + myalpha] << 16) |
- (renderaccelarray[green + myalpha] << 8) |
+ (renderaccelarray[red + myalpha] << 16) |
+ (renderaccelarray[green + myalpha] << 8) |
renderaccelarray[blue + myalpha];
}
dstPtr += pitch;
alphaPtr += alphaPitch;
- }
+ }
}
- return TRUE;
+ return TRUE;
}
Bool
SiSSetupForCPUToScreenTexture(ScrnInfoPtr pScrn,
- int op,
+ int op,
#ifdef SISNEWRENDER
CARD32 texType, CARD32 dstType,
-#else
- int texType,
-#endif
+#else
+ int texType,
+#endif
CARD8 *texPtr,
- int texPitch, int width,
- int height, int flags)
+ int texPitch, int width,
+ int height, int flags)
{
- SISPtr pSiS = SISPTR(pScrn);
+ SISPtr pSiS = SISPTR(pScrn);
CARD8 *dst;
- int pitch, sizeNeeded;
+ 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 */
Bool docopy = TRUE;
#ifdef ACCELDEBUG
- xf86DrvMsg(0, X_INFO, "T: type %x/%x op %d w %d h %d T-pitch %d\n",
- texType, dstType, op, width, height, texPitch);
+ xf86DrvMsg(0, X_INFO, "T: type %x op %d w %d h %d T-pitch %d\n",
+ texType, 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(!SiSRenderOps[op]) return FALSE;
+#else
+ if(op != PictOpOver) return FALSE;
+#endif
if((width > 2048) || (height > 2048)) return FALSE;
-
- pitch = (width + 31) & ~31;
- sizeNeeded = (pitch << bppshift) * height;
-
+
+ pitch = (width + 31) & ~31;
+ 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
+ xf86DrvMsg(0, X_INFO, "T: %x op %x w %d h %d T-pitch %d size %d (%d %d %d)\n",
+ texType, op, width, height, texPitch, sizeNeeded, sbpp, sbppshift, bppshift);
+#endif
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);
+ SiSSetupDSTColorDepth(pSiS->SiS310_AccelDepth);
switch(op) {
case PictOpClear:
-#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,0,0,0)
+#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,0,0,0)
case PictOpDisjointClear:
- case PictOpConjointClear:
-#endif
+ case PictOpConjointClear:
+#endif
SiSSetupPATFGDSTRect(0, pSiS->scrnOffset, -1)
/* SiSSetupROP(0x00) - is already zero */
SiSSetupCMDFlag(PATFG)
docopy = FALSE;
break;
case PictOpSrc:
-#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,0,0,0)
+#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,0,0,0)
case PictOpDisjointSrc:
- case PictOpConjointSrc:
-#endif
+ case PictOpConjointSrc:
+#endif
SiSSetupSRCPitchDSTRect(pitch, pSiS->scrnOffset, -1);
SiSSetupAlpha(0xff)
SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_NODESTALPHA)
break;
case PictOpDst:
-#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,0,0,0)
+#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,0,0,0)
case PictOpDisjointDst:
case PictOpConjointDst:
-#endif
+#endif
SiSSetupSRCPitchDSTRect(pitch, pSiS->scrnOffset, -1);
SiSSetupAlpha(0x00)
SiSSetupCMDFlag(ALPHA_BLEND | SRCVIDEO | A_CONSTANTALPHA)
@@ -1996,10 +1988,10 @@ SiSSetupForCPUToScreenTexture(ScrnInfoPtr pScrn,
/* Don't need source for clear and dest */
if(!docopy) return TRUE;
-
+
dst = (CARD8*)(pSiS->FbBase + (pSiS->AccelLinearScratch->offset << sbppshift));
-
- if(pSiS->alphaBlitBusy) {
+
+ if(pSiS->alphaBlitBusy) {
pSiS->alphaBlitBusy = FALSE;
SiSIdle
}
@@ -2015,11 +2007,11 @@ SiSSetupForCPUToScreenTexture(ScrnInfoPtr pScrn,
void
SiSSubsequentCPUToScreenTexture(ScrnInfoPtr pScrn,
- int dst_x, int dst_y,
- int src_x, int src_y,
- int width, int height)
+ int dst_x, int dst_y,
+ int src_x, int src_y,
+ int width, int height)
{
- SISPtr pSiS = SISPTR(pScrn);
+ SISPtr pSiS = SISPTR(pScrn);
CARD32 srcbase, dstbase;
srcbase = pSiS->AccelLinearScratch->offset << 1;
@@ -2035,10 +2027,9 @@ SiSSubsequentCPUToScreenTexture(ScrnInfoPtr pScrn,
dstbase = pSiS->scrnOffset * dst_y;
dst_y = 0;
}
-#ifdef SISDUALHEAD
- srcbase += HEADOFFSET;
- dstbase += HEADOFFSET;
-#endif
+
+ srcbase += FBOFFSET;
+ dstbase += FBOFFSET;
#ifdef SISVRAMQ
SiSCheckQueue(16 * 3)
@@ -2064,7 +2055,7 @@ void
SISWriteBlitPacket(SISPtr pSiS, CARD32 *packet)
{
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]);
diff --git a/src/sis310_accel.h b/src/sis310_accel.h
index a0d4b23..e104ae4 100644
--- a/src/sis310_accel.h
+++ b/src/sis310_accel.h
@@ -164,12 +164,12 @@
#define ALPHA_ALPHA PAT_FGCOLOR
/* Trapezoid registers */
-#define TRAP_YH SRC_Y /* 0x8208 */
-#define TRAP_LR DST_Y /* 0x820C */
-#define TRAP_DL 0x8244
-#define TRAP_DR 0x8248
-#define TRAP_EL 0x824C
-#define TRAP_ER 0x8250
+#define TRAP_YH SRC_Y /* 0x8208 */
+#define TRAP_LR DST_Y /* 0x820C */
+#define TRAP_DL 0x8244
+#define TRAP_DR 0x8248
+#define TRAP_EL 0x824C
+#define TRAP_ER 0x8250
/* Queue */
#define Q_BASE_ADDR 0x85C0 /* Base address of software queue */
@@ -185,8 +185,8 @@
#define SIS_PACKET_HEADER1 0x62100000L
#define SIS_NIL_CMD 0x168F0000L
-#define SIS_PACKET12_HEADER0 0x968A000CL
-#define SIS_PACKET12_HEADER1 0x62100010L
+#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 */
@@ -215,7 +215,7 @@
while( (SIS_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);
@@ -226,18 +226,18 @@
#define SiSFlushCmdBuf \
if(pSiS->NeedFlush) { \
- CARD32 ttt = ((SiSGetSwWP()) - 4) & pSiS->cmdQueueSizeMask; \
+ CARD32 ttt = ((SiSGetSwWP()) - 4) & pSiS->cmdQueueSizeMask; \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
dummybuf = SIS_RQINDEX(0); \
- }
+ }
#define SiSSyncWP \
SiSFlushCmdBuf; \
- SIS_MMIO_OUT32(pSiS->IOBase, Q_WRITE_PTR, (CARD32)(*(pSiS->cmdQ_SharedWritePort)));
-
+ SIS_MMIO_OUT32(pSiS->IOBase, Q_WRITE_PTR, (CARD32)(*(pSiS->cmdQ_SharedWritePort)));
+
#define SiSSetHwWP(p) \
*(pSiS->cmdQ_SharedWritePort) = (p); \
- SIS_MMIO_OUT32(pSiS->IOBase, Q_WRITE_PTR, (p));
+ SIS_MMIO_OUT32(pSiS->IOBase, Q_WRITE_PTR, (p));
#define SiSSetSwWP(p) *(pSiS->cmdQ_SharedWritePort) = (p);
@@ -265,19 +265,19 @@
ttt += 16; \
ttt &= pSiS->cmdQueueSizeMask; \
if(!ttt) { \
- while(SIS_MMIO_IN32(pSiS->IOBase, Q_READ_PTR) < pSiS->cmdQueueSize_div4) {} \
+ while(SIS_MMIO_IN32(pSiS->IOBase, Q_READ_PTR) < pSiS->cmdQueueSize_div4) {} \
} else if(ttt == pSiS->cmdQueueSize_div4) { \
- CARD32 temppp; \
+ CARD32 temppp; \
do { \
temppp = SIS_MMIO_IN32(pSiS->IOBase, Q_READ_PTR); \
} while(temppp >= ttt && temppp <= pSiS->cmdQueueSize_div2); \
} else if(ttt == pSiS->cmdQueueSize_div2) { \
- CARD32 temppp; \
+ CARD32 temppp; \
do { \
temppp = SIS_MMIO_IN32(pSiS->IOBase, Q_READ_PTR); \
} while(temppp >= ttt && temppp <= pSiS->cmdQueueSize_4_3); \
} else if(ttt == pSiS->cmdQueueSize_4_3) { \
- while(SIS_MMIO_IN32(pSiS->IOBase, Q_READ_PTR) > ttt) {} \
+ while(SIS_MMIO_IN32(pSiS->IOBase, Q_READ_PTR) > ttt) {} \
}
/* Write-updates MUST be 128bit aligned. */
@@ -297,115 +297,115 @@
#define SiSSetupSRCDSTBase(srcbase,dstbase) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + SRC_ADDR); \
- SIS_WQINDEX(1) = (CARD32)(srcbase); \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + SRC_ADDR); \
+ SIS_WQINDEX(1) = (CARD32)(srcbase); \
SIS_WQINDEX(2) = (CARD32)(SIS_SPKC_HEADER + DST_ADDR); \
- SIS_WQINDEX(3) = (CARD32)(dstbase); \
- SiSUpdateQueue \
+ SIS_WQINDEX(3) = (CARD32)(dstbase); \
+ SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
#define SiSSetupSRCDSTXY(sx,sy,dx,dy) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + SRC_Y); \
- SIS_WQINDEX(1) = (CARD32)(((sx)<<16) | (sy)); \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + SRC_Y); \
+ SIS_WQINDEX(1) = (CARD32)(((sx)<<16) | (sy)); \
SIS_WQINDEX(2) = (CARD32)(SIS_SPKC_HEADER + DST_Y); \
- SIS_WQINDEX(3) = (CARD32)(((dx)<<16) | (dy)); \
+ SIS_WQINDEX(3) = (CARD32)(((dx)<<16) | (dy)); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
#define SiSSetupDSTXYRect(x,y,w,h) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + DST_Y); \
- SIS_WQINDEX(1) = (CARD32)(((x)<<16) | (y)); \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + DST_Y); \
+ SIS_WQINDEX(1) = (CARD32)(((x)<<16) | (y)); \
SIS_WQINDEX(2) = (CARD32)(SIS_SPKC_HEADER + RECT_WIDTH); \
- SIS_WQINDEX(3) = (CARD32)(((h)<<16) | (w)); \
- SiSUpdateQueue \
+ SIS_WQINDEX(3) = (CARD32)(((h)<<16) | (w)); \
+ SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
#define SiSSetupSRCPitchDSTRect(pitch,x,y) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + SRC_PITCH); \
- SIS_WQINDEX(1) = (CARD32)(pitch); \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + SRC_PITCH); \
+ SIS_WQINDEX(1) = (CARD32)(pitch); \
SIS_WQINDEX(2) = (CARD32)(SIS_SPKC_HEADER + DST_PITCH); \
- SIS_WQINDEX(3) = (CARD32)(((y)<<16) | (x)); \
+ SIS_WQINDEX(3) = (CARD32)(((y)<<16) | (x)); \
SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
#define SiSSetupSRCBase(base) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + SRC_ADDR); \
- SIS_WQINDEX(1) = (CARD32)(base); \
- SiSNILandUpdateSWQueue \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + SRC_ADDR); \
+ SIS_WQINDEX(1) = (CARD32)(base); \
+ SiSNILandUpdateSWQueue \
}
#define SiSSetupSRCPitch(pitch) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + SRC_PITCH); \
- SIS_WQINDEX(1) = (CARD32)(pitch); \
- SiSNILandUpdateSWQueue \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + SRC_PITCH); \
+ SIS_WQINDEX(1) = (CARD32)(pitch); \
+ SiSNILandUpdateSWQueue \
}
#define SiSSetupSRCXY(x,y) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + SRC_Y); \
- SIS_WQINDEX(1) = (CARD32)(((x)<<16) | (y)); \
- SiSNILandUpdateSWQueue \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + SRC_Y); \
+ SIS_WQINDEX(1) = (CARD32)(((x)<<16) | (y)); \
+ SiSNILandUpdateSWQueue \
}
#define SiSSetupDSTBase(base) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + DST_ADDR); \
- SIS_WQINDEX(1) = (CARD32)(base); \
- SiSNILandUpdateSWQueue \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + DST_ADDR); \
+ SIS_WQINDEX(1) = (CARD32)(base); \
+ SiSNILandUpdateSWQueue \
}
#define SiSSetupDSTXY(x,y) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + DST_Y); \
- SIS_WQINDEX(1) = (CARD32)(((x)<<16) | (y)); \
- SiSNILandUpdateSWQueue \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + DST_Y); \
+ SIS_WQINDEX(1) = (CARD32)(((x)<<16) | (y)); \
+ SiSNILandUpdateSWQueue \
}
#define SiSSetupDSTRect(x,y) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + DST_PITCH); \
- SIS_WQINDEX(1) = (CARD32)(((y)<<16) | (x)); \
- SiSNILandUpdateSWQueue \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + DST_PITCH); \
+ SIS_WQINDEX(1) = (CARD32)(((y)<<16) | (x)); \
+ SiSNILandUpdateSWQueue \
}
#define SiSSetupDSTRectBurstHeader(x,y,reg,num) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + DST_PITCH); \
- SIS_WQINDEX(1) = (CARD32)(((y)<<16) | (x)); \
+ SIS_WQINDEX(1) = (CARD32)(((y)<<16) | (x)); \
SIS_WQINDEX(2) = (CARD32)(SIS_BURST_HEADER0 + reg); \
SIS_WQINDEX(3) = (CARD32)(SIS_BURST_HEADER1 + num); \
- SiSUpdateQueue \
+ SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -414,141 +414,141 @@
#define SiSSetupPATFGDSTRect(color,x,y) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + PAT_FGCOLOR); \
- SIS_WQINDEX(1) = (CARD32)(color); \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + PAT_FGCOLOR); \
+ SIS_WQINDEX(1) = (CARD32)(color); \
SIS_WQINDEX(2) = (CARD32)(SIS_SPKC_HEADER + DST_PITCH); \
- SIS_WQINDEX(3) = (CARD32)(((y)<<16) | (x)); \
- SiSUpdateQueue \
+ SIS_WQINDEX(3) = (CARD32)(((y)<<16) | (x)); \
+ SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
#define SiSSetupSRCFGDSTRect(color,x,y) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + SRC_FGCOLOR); \
- SIS_WQINDEX(1) = (CARD32)(color); \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + SRC_FGCOLOR); \
+ SIS_WQINDEX(1) = (CARD32)(color); \
SIS_WQINDEX(2) = (CARD32)(SIS_SPKC_HEADER + DST_PITCH); \
- SIS_WQINDEX(3) = (CARD32)(((y)<<16) | (x)); \
- SiSUpdateQueue \
+ SIS_WQINDEX(3) = (CARD32)(((y)<<16) | (x)); \
+ SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
#define SiSSetupRectSRCPitch(w,h,pitch) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + RECT_WIDTH); \
- SIS_WQINDEX(1) = (CARD32)(((h)<<16) | (w)); \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + RECT_WIDTH); \
+ SIS_WQINDEX(1) = (CARD32)(((h)<<16) | (w)); \
SIS_WQINDEX(2) = (CARD32)(SIS_SPKC_HEADER + SRC_PITCH); \
- SIS_WQINDEX(3) = (CARD32)(pitch); \
- SiSUpdateQueue \
+ SIS_WQINDEX(3) = (CARD32)(pitch); \
+ SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
#define SiSSetupRect(w,h) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + RECT_WIDTH); \
- SIS_WQINDEX(1) = (CARD32)(((h)<<16) | (w)); \
- SiSNILandUpdateSWQueue \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + RECT_WIDTH); \
+ SIS_WQINDEX(1) = (CARD32)(((h)<<16) | (w)); \
+ SiSNILandUpdateSWQueue \
}
#define SiSSetupPATFG(color) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + PAT_FGCOLOR); \
- SIS_WQINDEX(1) = (CARD32)(color); \
- SiSNILandUpdateSWQueue \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + PAT_FGCOLOR); \
+ SIS_WQINDEX(1) = (CARD32)(color); \
+ SiSNILandUpdateSWQueue \
}
#define SiSSetupPATBG(color) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + PAT_BGCOLOR); \
- SIS_WQINDEX(1) = (CARD32)(color); \
- SiSNILandUpdateSWQueue \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + PAT_BGCOLOR); \
+ SIS_WQINDEX(1) = (CARD32)(color); \
+ SiSNILandUpdateSWQueue \
}
#define SiSSetupSRCFG(color) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + SRC_FGCOLOR); \
- SIS_WQINDEX(1) = (CARD32)(color); \
- SiSNILandUpdateSWQueue \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + SRC_FGCOLOR); \
+ SIS_WQINDEX(1) = (CARD32)(color); \
+ SiSNILandUpdateSWQueue \
}
#define SiSSetupSRCBG(color) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + SRC_BGCOLOR); \
- SIS_WQINDEX(1) = (CARD32)(color); \
- SiSNILandUpdateSWQueue \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + SRC_BGCOLOR); \
+ SIS_WQINDEX(1) = (CARD32)(color); \
+ SiSNILandUpdateSWQueue \
}
#define SiSSetupSRCTrans(color) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + TRANS_SRC_KEY_HIGH); \
- SIS_WQINDEX(1) = (CARD32)(color); \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + TRANS_SRC_KEY_HIGH); \
+ SIS_WQINDEX(1) = (CARD32)(color); \
SIS_WQINDEX(2) = (CARD32)(SIS_SPKC_HEADER + TRANS_SRC_KEY_LOW); \
- SIS_WQINDEX(3) = (CARD32)(color); \
- SiSUpdateQueue \
+ SIS_WQINDEX(3) = (CARD32)(color); \
+ SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
#define SiSSetupDSTTrans(color) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + TRANS_DST_KEY_HIGH); \
- SIS_WQINDEX(1) = (CARD32)(color); \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + TRANS_DST_KEY_HIGH); \
+ SIS_WQINDEX(1) = (CARD32)(color); \
SIS_WQINDEX(2) = (CARD32)(SIS_SPKC_HEADER + TRANS_DST_KEY_LOW); \
- SIS_WQINDEX(3) = (CARD32)(color); \
- SiSUpdateQueue \
+ SIS_WQINDEX(3) = (CARD32)(color); \
+ SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
#define SiSSetupMONOPAT(p0,p1) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + MONO_MASK); \
- SIS_WQINDEX(1) = (CARD32)(p0); \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + MONO_MASK); \
+ SIS_WQINDEX(1) = (CARD32)(p0); \
SIS_WQINDEX(2) = (CARD32)(SIS_SPKC_HEADER + MONO_MASK + 4); \
- SIS_WQINDEX(3) = (CARD32)(p1); \
- SiSUpdateQueue \
+ SIS_WQINDEX(3) = (CARD32)(p1); \
+ SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
#define SiSSetupClip(left,top,right,bottom) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + LEFT_CLIP); \
- SIS_WQINDEX(1) = (CARD32)(((left) & 0xFFFF) | ((top)<<16)); \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + LEFT_CLIP); \
+ SIS_WQINDEX(1) = (CARD32)(((left) & 0xFFFF) | ((top)<<16)); \
SIS_WQINDEX(2) = (CARD32)(SIS_SPKC_HEADER + RIGHT_CLIP); \
- SIS_WQINDEX(3) = (CARD32)(((right) & 0xFFFF)|((bottom)<<16)); \
- SiSUpdateQueue \
+ SIS_WQINDEX(3) = (CARD32)(((right) & 0xFFFF)|((bottom)<<16)); \
+ SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
#define SiSSetupDSTBaseDoCMD(base) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + DST_ADDR); \
- SIS_WQINDEX(1) = (CARD32)(base); \
- SIS_WQINDEX(2) = (CARD32)(SIS_SPKC_HEADER + COMMAND_READY); \
- SIS_WQINDEX(3) = (CARD32)(pSiS->CommandReg); \
+ SIS_WQINDEX(1) = (CARD32)(base); \
+ SIS_WQINDEX(2) = (CARD32)(SIS_SPKC_HEADER + COMMAND_READY); \
+ SIS_WQINDEX(3) = (CARD32)(pSiS->CommandReg); \
if(pSiS->NeedFlush) dummybuf = SIS_RQINDEX(3); \
SiSUpdateQueue \
SiSSetHwWP(ttt); \
@@ -556,12 +556,12 @@
#define SiSSetRectDoCMD(w,h) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + RECT_WIDTH); \
- SIS_WQINDEX(1) = (CARD32)(((h)<<16) | (w)); \
- SIS_WQINDEX(2) = (CARD32)(SIS_SPKC_HEADER + COMMAND_READY); \
- SIS_WQINDEX(3) = (CARD32)(pSiS->CommandReg); \
+ SIS_WQINDEX(1) = (CARD32)(((h)<<16) | (w)); \
+ SIS_WQINDEX(2) = (CARD32)(SIS_SPKC_HEADER + COMMAND_READY); \
+ SIS_WQINDEX(3) = (CARD32)(pSiS->CommandReg); \
if(pSiS->NeedFlush) dummybuf = SIS_RQINDEX(3); \
SiSUpdateQueue \
SiSSetHwWP(ttt); \
@@ -572,12 +572,12 @@
#define SiSDoCMD \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + COMMAND_READY); \
- SIS_WQINDEX(1) = (CARD32)(pSiS->CommandReg); \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + COMMAND_READY); \
+ SIS_WQINDEX(1) = (CARD32)(pSiS->CommandReg); \
SIS_WQINDEX(2) = (CARD32)(SIS_NIL_CMD); \
- SIS_WQINDEX(3) = (CARD32)(SIS_NIL_CMD); \
+ SIS_WQINDEX(3) = (CARD32)(SIS_NIL_CMD); \
if(pSiS->NeedFlush) dummybuf = SIS_RQINDEX(3); \
SiSUpdateQueue \
SiSSetHwWP(ttt); \
@@ -587,52 +587,52 @@
#define SiSSetupX0Y0X1Y1(x1,y1,x2,y2) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + LINE_X0); \
- SIS_WQINDEX(1) = (CARD32)(((y1)<<16) | (x1)); \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + LINE_X0); \
+ SIS_WQINDEX(1) = (CARD32)(((y1)<<16) | (x1)); \
SIS_WQINDEX(2) = (CARD32)(SIS_SPKC_HEADER + LINE_X1); \
- SIS_WQINDEX(3) = (CARD32)(((y2)<<16) | (x2)); \
- SiSUpdateQueue \
+ SIS_WQINDEX(3) = (CARD32)(((y2)<<16) | (x2)); \
+ SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
#define SiSSetupX0Y0(x,y) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + LINE_X0); \
- SIS_WQINDEX(1) = (CARD32)(((y)<<16) | (x)); \
- SiSNILandUpdateSWQueue \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + LINE_X0); \
+ SIS_WQINDEX(1) = (CARD32)(((y)<<16) | (x)); \
+ SiSNILandUpdateSWQueue \
}
#define SiSSetupX1Y1(x,y) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + LINE_X1); \
- SIS_WQINDEX(1) = (CARD32)(((y)<<16) | (x)); \
- SiSNILandUpdateSWQueue \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + LINE_X1); \
+ SIS_WQINDEX(1) = (CARD32)(((y)<<16) | (x)); \
+ SiSNILandUpdateSWQueue \
}
#define SiSSetupLineCountPeriod(c, p) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + LINE_COUNT); \
- SIS_WQINDEX(1) = (CARD32)(((p) << 16) | (c)); \
- SiSNILandUpdateSWQueue \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + LINE_COUNT); \
+ SIS_WQINDEX(1) = (CARD32)(((p) << 16) | (c)); \
+ SiSNILandUpdateSWQueue \
}
#define SiSSetupStyle(ls,hs) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + LINE_STYLE_0); \
- SIS_WQINDEX(1) = (CARD32)(ls); \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + LINE_STYLE_0); \
+ SIS_WQINDEX(1) = (CARD32)(ls); \
SIS_WQINDEX(2) = (CARD32)(SIS_SPKC_HEADER + LINE_STYLE_1); \
- SIS_WQINDEX(3) = (CARD32)(hs); \
- SiSUpdateQueue \
+ SIS_WQINDEX(3) = (CARD32)(hs); \
+ SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -640,38 +640,38 @@
#define SiSSetupYHLR(y,h,left,right) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + TRAP_YH); \
- SIS_WQINDEX(1) = (CARD32)(((y)<<16) | (h)); \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + TRAP_YH); \
+ SIS_WQINDEX(1) = (CARD32)(((y)<<16) | (h)); \
SIS_WQINDEX(2) = (CARD32)(SIS_SPKC_HEADER + TRAP_LR); \
- SIS_WQINDEX(3) = (CARD32)(((right)<<16) | (left)); \
- SiSUpdateQueue \
+ SIS_WQINDEX(3) = (CARD32)(((right)<<16) | (left)); \
+ SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
#define SiSSetupdLdR(dxL,dyL,fxR,dyR) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + TRAP_DL); \
- SIS_WQINDEX(1) = (CARD32)(((dyL)<<16) | (dxL)); \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + TRAP_DL); \
+ SIS_WQINDEX(1) = (CARD32)(((dyL)<<16) | (dxL)); \
SIS_WQINDEX(2) = (CARD32)(SIS_SPKC_HEADER + TRAP_DR); \
- SIS_WQINDEX(3) = (CARD32)(((dyR)<<16) | (dxR)); \
- SiSUpdateQueue \
+ SIS_WQINDEX(3) = (CARD32)(((dyR)<<16) | (dxR)); \
+ SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
#define SiSSetupELER(eL,eR) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + TRAP_EL); \
- SIS_WQINDEX(1) = (CARD32)(eL); \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + TRAP_EL); \
+ SIS_WQINDEX(1) = (CARD32)(eL); \
SIS_WQINDEX(2) = (CARD32)(SIS_SPKC_HEADER + TRAP_ER); \
- SIS_WQINDEX(3) = (CARD32)(eR); \
- SiSUpdateQueue \
+ SIS_WQINDEX(3) = (CARD32)(eR); \
+ SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
@@ -679,38 +679,38 @@
#define SiSSetupAlpha(alpha) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + ALPHA_ALPHA); \
- SIS_WQINDEX(1) = (CARD32)(alpha); \
- SiSNILandUpdateSWQueue \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + ALPHA_ALPHA); \
+ SIS_WQINDEX(1) = (CARD32)(alpha); \
+ SiSNILandUpdateSWQueue \
}
#define SiSSetPattern(num, value) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + (PATTERN_REG + (num * 4))); \
- SIS_WQINDEX(1) = (CARD32)(value); \
- SiSNILandUpdateSWQueue \
+ SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + (PATTERN_REG + (num * 4))); \
+ SIS_WQINDEX(1) = (CARD32)(value); \
+ SiSNILandUpdateSWQueue \
}
#define SiSSetupPatternRegBurst(pat1, pat2, pat3, pat4) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(pat1); \
- SIS_WQINDEX(1) = (CARD32)(pat2); \
+ SIS_WQINDEX(0) = (CARD32)(pat1); \
+ SIS_WQINDEX(1) = (CARD32)(pat2); \
SIS_WQINDEX(2) = (CARD32)(pat3); \
- SIS_WQINDEX(3) = (CARD32)(pat4); \
- SiSUpdateQueue \
+ SIS_WQINDEX(3) = (CARD32)(pat4); \
+ SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
typedef struct _SiS_Packet12_YUV {
- CARD32 P12_Header0;
- CARD32 P12_Header1;
- CARD16 P12_UVPitch; /* 8200 UV if planar, Y if packed */
+ 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 */
@@ -736,20 +736,20 @@ typedef struct _SiS_Packet12_YUV {
CARD32 P12_Command; /* 823c */
CARD32 P12_Null1;
CARD32 P12_Null2;
-} SiS_Packet12_YUV;
+} SiS_Packet12_YUV;
#define SiSWritePacketPart(part1, part2, part3, part4) \
{ \
- CARD32 ttt = SiSGetSwWP(); \
+ CARD32 ttt = SiSGetSwWP(); \
pointer tt = (char *)pSiS->cmdQueueBase + ttt; \
- SIS_WQINDEX(0) = (CARD32)(part1); \
- SIS_WQINDEX(1) = (CARD32)(part2); \
+ SIS_WQINDEX(0) = (CARD32)(part1); \
+ SIS_WQINDEX(1) = (CARD32)(part2); \
SIS_WQINDEX(2) = (CARD32)(part3); \
- SIS_WQINDEX(3) = (CARD32)(part4); \
- SiSUpdateQueue \
+ SIS_WQINDEX(3) = (CARD32)(part4); \
+ SiSUpdateQueue \
SiSSetSwWP(ttt); \
}
-
+
#endif /* VRAM mode */
/* ---- MMIO mode ---- */
diff --git a/src/sis6326_video.c b/src/sis6326_video.c
index e144c53..f138c3e 100644
--- a/src/sis6326_video.c
+++ b/src/sis6326_video.c
@@ -1,7 +1,7 @@
/* $XFree86$ */
/* $XdotOrg$ */
/*
- * Xv driver for SiS 5597/5598, 6236 and 530/620.
+ * Xv driver for SiS 5597/5598, 6326 and 530/620.
*
* Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria.
*
@@ -64,10 +64,10 @@ static int SIS6326GetPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer);
static void SIS6326QueryBestSize(ScrnInfoPtr, Bool, short, short, short,
short, unsigned int *,unsigned int *, pointer);
static int SIS6326PutImage( ScrnInfoPtr,
- short, short, short, short, short, short, short, short,
- int, unsigned char*, short, short, Bool, RegionPtr, pointer);
+ short, short, short, short, short, short, short, short,
+ int, unsigned char*, short, short, Bool, RegionPtr, pointer);
static int SIS6326QueryImageAttributes(ScrnInfoPtr,
- int, unsigned short *, unsigned short *, int *, int *);
+ int, unsigned short *, unsigned short *, int *, int *);
static void SIS6326VideoTimerCallback(ScrnInfoPtr pScrn, Time now);
static void SIS6326InitOffscreenImages(ScreenPtr pScrn);
@@ -83,7 +83,7 @@ static Atom xvDisableGfx;
#define IMAGE_MIN_HEIGHT 24
#define IMAGE_MAX_WIDTH 720 /* Are these correct for the chips ? */
#define IMAGE_MAX_HEIGHT 576
-#define IMAGE_MAX_WIDTH_5597 384
+#define IMAGE_MAX_WIDTH_5597 384
#define IMAGE_MAX_HEIGHT_5597 288
#if 0
@@ -112,7 +112,7 @@ static CARD8 getvideoreg(SISPtr pSiS, CARD8 reg)
{
CARD8 ret;
inSISIDXREG(SISCR, reg, ret);
- return(ret);
+ return ret;
}
static __inline void setvideoreg(SISPtr pSiS, CARD8 reg, CARD8 data)
@@ -120,13 +120,9 @@ static __inline void setvideoreg(SISPtr pSiS, CARD8 reg, CARD8 data)
outSISIDXREG(SISCR, reg, data);
}
-static void setvideoregmask(SISPtr pSiS, CARD8 reg, CARD8 data, CARD8 mask)
+static __inline void setvideoregmask(SISPtr pSiS, CARD8 reg, CARD8 data, CARD8 mask)
{
- CARD8 old;
-
- inSISIDXREG(SISCR, reg, old);
- data = (data & mask) | (old & (~mask));
- outSISIDXREG(SISCR, reg, data);
+ setSISIDXREGmask(SISCR, reg, data, mask);
}
/* VBlank */
@@ -158,34 +154,31 @@ void SIS6326InitVideo(ScreenPtr pScreen)
if(newAdaptor) {
SIS6326InitOffscreenImages(pScreen);
}
-
+
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) {
- memcpy(newAdaptors, adaptors, num_adaptors *
- sizeof(XF86VideoAdaptorPtr));
- newAdaptors[num_adaptors] = newAdaptor;
- adaptors = newAdaptors;
- num_adaptors++;
- }
- }
+ if(!num_adaptors) {
+ num_adaptors = 1;
+ adaptors = &newAdaptor;
+ } else {
+ /* need to free this someplace */
+ newAdaptors = xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*));
+ if(newAdaptors) {
+ memcpy(newAdaptors, adaptors, num_adaptors *
+ sizeof(XF86VideoAdaptorPtr));
+ newAdaptors[num_adaptors] = newAdaptor;
+ adaptors = newAdaptors;
+ num_adaptors++;
+ }
+ }
}
if(num_adaptors)
- xf86XVScreenInit(pScreen, adaptors, num_adaptors);
+ xf86XVScreenInit(pScreen, adaptors, num_adaptors);
if(newAdaptors)
- xfree(newAdaptors);
-#if 0
- oldW = 0; oldH = 0; /* DEBUG */
-#endif
+ xfree(newAdaptors);
}
/* client libraries expect an encoding */
@@ -238,7 +231,7 @@ static XF86AttributeRec SIS6326Attributes[NUM_ATTRIBUTES] =
static XF86ImageRec SIS6326Images[NUM_IMAGES] =
{
- XVIMAGE_YUY2, /* TW: If order is changed, SIS6326OffscreenImages must be adapted */
+ XVIMAGE_YUY2, /* If order is changed, SIS6326OffscreenImages must be adapted */
XVIMAGE_UYVY,
XVIMAGE_YV12,
XVIMAGE_I420,
@@ -251,8 +244,7 @@ static XF86ImageRec SIS6326Images[NUM_IMAGES] =
16,
XvPacked,
1,
-/* 15, 0x001F, 0x03E0, 0x7C00, - incorrect! */
- 15, 0x7C00, 0x03E0, 0x001F,
+ 15, 0x7C00, 0x03E0, 0x001F,
0, 0, 0,
0, 0, 0,
0, 0, 0,
@@ -269,8 +261,7 @@ static XF86ImageRec SIS6326Images[NUM_IMAGES] =
16,
XvPacked,
1,
-/* 16, 0x001F, 0x07E0, 0xF800, - incorrect! */
- 16, 0xF800, 0x07E0, 0x001F,
+ 16, 0xF800, 0x07E0, 0x001F,
0, 0, 0,
0, 0, 0,
0, 0, 0,
@@ -282,7 +273,7 @@ static XF86ImageRec SIS6326Images[NUM_IMAGES] =
static XF86ImageRec SIS6326ImagesNoYV12[NUM_IMAGES_NOYV12] =
{
- XVIMAGE_YUY2, /* TW: If order is changed, SIS6326OffscreenImages must be adapted */
+ XVIMAGE_YUY2, /* If order is changed, SIS6326OffscreenImages must be adapted */
XVIMAGE_UYVY,
{
0x35315652,
@@ -293,8 +284,7 @@ static XF86ImageRec SIS6326ImagesNoYV12[NUM_IMAGES_NOYV12] =
16,
XvPacked,
1,
-/* 15, 0x001F, 0x03E0, 0x7C00, */
- 15, 0x7C00, 0x03E0, 0x001F, /* TW: Should be more correct than the other... */
+ 15, 0x7C00, 0x03E0, 0x001F,
0, 0, 0,
0, 0, 0,
0, 0, 0,
@@ -311,8 +301,7 @@ static XF86ImageRec SIS6326ImagesNoYV12[NUM_IMAGES_NOYV12] =
16,
XvPacked,
1,
-/* 16, 0x001F, 0x07E0, 0xF800, */
- 16, 0xF800, 0x07E0, 0x001F, /* TW: Should be more correct than the other... */
+ 16, 0xF800, 0x07E0, 0x001F,
0, 0, 0,
0, 0, 0,
0, 0, 0,
@@ -353,7 +342,7 @@ typedef struct {
} SISOverlayRec, *SISOverlayPtr;
typedef struct {
- FBLinearPtr linear; /* TW: We now use Linear, not Area */
+ FBLinearPtr linear;
CARD32 bufAddr[2];
unsigned char currentBuf;
@@ -363,7 +352,7 @@ typedef struct {
int id;
short srcPitch, height, width;
CARD32 totalSize;
-
+
char brightness;
unsigned char contrast;
@@ -384,7 +373,7 @@ typedef struct {
int pitch;
int offset;
-} SISPortPrivRec, *SISPortPrivPtr;
+} SISPortPrivRec, *SISPortPrivPtr;
#define GET_PORT_PRIVATE(pScrn) \
(SISPortPrivPtr)((SISPTR(pScrn))->adaptor->pPortPrivates[0].ptr)
@@ -393,7 +382,7 @@ static void
SIS6326SetPortDefaults(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
{
SISPtr pSiS = SISPTR(pScrn);
-
+
pPriv->colorKey = 0x000101fe;
pPriv->videoStatus = 0;
pPriv->brightness = pSiS->XvDefBri; /* 0; - see sis_opt.c */
@@ -411,65 +400,64 @@ SIS6326ResetVideo(ScrnInfoPtr pScrn)
#ifdef UNLOCK_ALWAYS
sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
#endif
- if(getvideoreg (pSiS, Index_VI6326_Passwd) != 0xa1) {
- setvideoreg (pSiS, Index_VI6326_Passwd, 0x86);
- if(getvideoreg (pSiS, Index_VI6326_Passwd) != 0xa1)
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Xv: Video password could not unlock video registers\n");
+ if(getvideoreg(pSiS, Index_VI6326_Passwd) != 0xa1) {
+ setvideoreg(pSiS, Index_VI6326_Passwd, 0x86);
+ if(getvideoreg(pSiS, Index_VI6326_Passwd) != 0xa1)
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Xv: Video password could not unlock video registers\n");
}
/* Initialize the overlay ----------------------------------- */
switch(pSiS->Chipset) {
- case PCI_CHIP_SIS6326:
+ case PCI_CHIP_SIS5597:
/* Disable overlay (D[1]) & capture (D[0]) */
- setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x03);
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x03);
/* What do these do? (Datasheet names these bits "reserved") */
- setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x18);
- setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x0c);
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x18);
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x0c);
/* Select YUV format (D[6]) and "gfx + video" mode (D[4]), odd polarity? (D[7]) */
- setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x40, 0xD0);
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x40, 0xD0);
/* No interrupt, no filter, disable dithering */
- setvideoregmask(pSiS, Index_VI6326_Control_Misc1, 0x00, 0x7A);
- /* Disable VMI (D[4:3]), Brooktree support (D[6]) and system memory framebuffer (D[7]) */
- setvideoregmask(pSiS, Index_VI6326_Control_Misc3, 0x00, 0xF8);
- /* Disable video decimation */
- setvideoregmask(pSiS, Index_VI6326_Control_Misc6, 0x00, 0x80);
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc1, 0x00, 0x7A);
+ /* Disable Brooktree support (D[6]) and system memory framebuffer (D[7]) */
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc3, 0x00, 0xC0);
+ /* Disable video decimation (has a really strange effect if enabled) */
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc6, 0x00, 0x80);
break;
- case PCI_CHIP_SIS5597:
+ case PCI_CHIP_SIS6326:
/* Disable overlay (D[1]) & capture (D[0]) */
- setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x03);
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x03);
/* What do these do? (Datasheet names these bits "reserved") */
- setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x18);
- setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x0c);
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x18);
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x0c);
/* Select YUV format (D[6]) and "gfx + video" mode (D[4]), odd polarity? (D[7]) */
- setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x40, 0xD0);
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x40, 0xD0);
/* No interrupt, no filter, disable dithering */
- setvideoregmask(pSiS, Index_VI6326_Control_Misc1, 0x00, 0x7A);
- /* Disable Brooktree support (D[6]) and system memory framebuffer (D[7]) */
- setvideoregmask(pSiS, Index_VI6326_Control_Misc3, 0x00, 0xC0);
- /* Disable video decimation (has a really strange effect if enabled) */
- setvideoregmask(pSiS, Index_VI6326_Control_Misc6, 0x00, 0x80);
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc1, 0x00, 0x7A);
+ /* Disable VMI (D[4:3]), Brooktree support (D[6]) and system memory framebuffer (D[7]) */
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc3, 0x00, 0xF8);
+ /* Disable video decimation */
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc6, 0x00, 0x80);
break;
case PCI_CHIP_SIS530:
- /* What is this? (Bit is "reserved") */
- setvideoregmask (pSiS, Index_VI6326_Control_Misc4, 0x40, 0x40);
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc4, 0x40, 0x40);
/* Disable overlay (D[1]) */
- setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x02);
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x02);
- /* What do these do? (Datasheet names these bits "reserved") */
- setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x18);
- setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x0c);
+ /* What do D[3:2] do? (Datasheet names these bits "reserved") */
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x18);
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x00, 0x0c);
/* Select YUV format (D[6]) and "gfx + video" mode (D[4]) */
- setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x40, 0x50);
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x40, 0x50);
break;
default:
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Internal error: SiS6326ResetVideo() called with invalid chipset (%x)\n",
pSiS->Chipset);
return;
@@ -477,7 +465,9 @@ SIS6326ResetVideo(ScrnInfoPtr pScrn)
/* Clear format selection */
setvideoregmask(pSiS, Index_VI6326_Control_Misc1, 0x00, 0x04);
- setvideoregmask(pSiS, Index_VI6326_Control_Misc4, 0x00, 0x07);
+ if(pSiS->oldChipset >= OC_SIS5597) {
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc4, 0x00, 0x05);
+ }
/* Select RGB Chromakey format (D[2]=0), CCIR 601 UV data format (D[1]=0) */
/* D[1]: 1 = 2's complement, 0 = CCIR 601 format */
@@ -506,8 +496,8 @@ SIS6326ResetVideo(ScrnInfoPtr pScrn)
/* set default properties for overlay ------------------------------- */
- setvideoregmask (pSiS, Index_VI6326_Contrast_Enh_Ctrl, 0x04, 0x07);
- setvideoreg (pSiS, Index_VI6326_Brightness, 0x20);
+ setvideoregmask(pSiS, Index_VI6326_Contrast_Enh_Ctrl, 0x04, 0x07);
+ setvideoreg(pSiS, Index_VI6326_Brightness, 0x20);
if(pSiS->oldChipset < OC_SIS6205A || pSiS->oldChipset > OC_SIS82204) {
setvideoregmask(pSiS, Index_VI6326_AlphaGraph, 0x00, 0xF8);
@@ -516,6 +506,7 @@ SIS6326ResetVideo(ScrnInfoPtr pScrn)
setvideoregmask(pSiS, Index_VI6326_AlphaGraph, 0x00, 0xE1);
setvideoregmask(pSiS, Index_VI6326_AlphaVideo, 0xE1, 0xE1);
}
+
}
static XF86VideoAdaptorPtr
@@ -529,23 +520,23 @@ SIS6326SetupImageVideo(ScreenPtr pScreen)
#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,1,99,1,0)
XAAInfoRecPtr pXAA = pSiS->AccelInfoPtr;
- if (!pXAA || !pXAA->FillSolidRects)
- return NULL;
+ if(!pXAA || !pXAA->FillSolidRects)
+ return NULL;
#endif
if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) +
sizeof(SISPortPrivRec) +
sizeof(DevUnion))))
- return NULL;
+ return NULL;
adapt->type = XvWindowMask | XvInputMask | XvImageMask;
adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT;
adapt->name = "SIS 5597/5598/6326/530/620 Video Overlay";
adapt->nEncodings = 1;
if(pSiS->oldChipset < OC_SIS6326) {
- adapt->pEncodings = &DummyEncoding5597;
+ adapt->pEncodings = &DummyEncoding5597;
} else {
- adapt->pEncodings = &DummyEncoding;
+ adapt->pEncodings = &DummyEncoding;
}
adapt->nFormats = NUM_FORMATS;
adapt->pFormats = SIS6326Formats;
@@ -637,7 +628,7 @@ RegionsEqual(RegionPtr A, RegionPtr B)
static int
SIS6326SetPortAttribute(ScrnInfoPtr pScrn, Atom attribute,
- INT32 value, pointer data)
+ INT32 value, pointer data)
{
SISPortPrivPtr pPriv = (SISPortPrivPtr)data;
@@ -689,17 +680,17 @@ SIS6326GetPortAttribute(
return Success;
}
-static void
+static void
SIS6326QueryBestSize(
- ScrnInfoPtr pScrn,
+ ScrnInfoPtr pScrn,
Bool motion,
- short vid_w, short vid_h,
- short drw_w, short drw_h,
- unsigned int *p_w, unsigned int *p_h,
+ short vid_w, short vid_h,
+ short drw_w, short drw_h,
+ unsigned int *p_w, unsigned int *p_h,
pointer data
){
*p_w = drw_w;
- *p_h = drw_h;
+ *p_h = drw_h;
/* TODO: report the HW limitation */
}
@@ -715,20 +706,11 @@ calc_scale_factor(SISPtr pSiS, SISOverlayPtr pOverlay, ScrnInfoPtr pScrn,
int srcW = pOverlay->srcW;
int srcH = pOverlay->srcH;
-#if 0
- /* DEBUG */
- if((oldH != dstH) || (oldW != dstW)){
- xf86DrvMsg(0, X_INFO, "Video size %dx%d\n", dstW, dstH);
- oldH = dstH; oldW = dstW;
- }
- /* /DEBUG */
-#endif
-
- /* TW: For double scan modes, we need to double the height */
+ /* For double scan modes, we need to double the height */
if(pSiS->CurrentLayout.mode->Flags & V_DBLSCAN) {
dstH <<= 1;
}
- /* TW: For interlace modes, we need to half the height */
+ /* For interlace modes, we need to half the height */
if(pSiS->CurrentLayout.mode->Flags & V_INTERLACE) {
dstH >>= 1;
}
@@ -736,16 +718,16 @@ calc_scale_factor(SISPtr pSiS, SISOverlayPtr pOverlay, ScrnInfoPtr pScrn,
/* Horizontal */
if(dstW < IMAGE_MIN_WIDTH) dstW = IMAGE_MIN_WIDTH;
if(dstW == srcW) {
- pOverlay->HUSF = 0x00;
- pOverlay->HIntBit = 0x01;
+ pOverlay->HUSF = 0x00;
+ pOverlay->HIntBit = 0x01;
} else if(dstW > srcW) {
pOverlay->HIntBit = 0x00;
temp = srcW * 64 / (dstW + 1);
if(temp > 63) temp = 63;
pOverlay->HUSF = temp;
} else {
- /* 6326 can't scale below factor .440 - to check with 530/620 */
- if(((dstW * 1000) / srcW) < 440) dstW = ((srcW * 440) / 1000) + 1;
+ /* 6326 can't scale below factor .440 - to check with 530/620 */
+ if(((dstW * 1000) / srcW) < 440) dstW = ((srcW * 440) / 1000) + 1;
temp = srcW / dstW;
if(temp > 15) temp = 15;
pOverlay->HIntBit = temp;
@@ -756,15 +738,15 @@ calc_scale_factor(SISPtr pSiS, SISOverlayPtr pOverlay, ScrnInfoPtr pScrn,
/* Vertical */
if(dstH < IMAGE_MIN_HEIGHT) dstH = IMAGE_MIN_HEIGHT;
if(dstH == srcH) {
- pOverlay->VUSF = 0x00;
+ pOverlay->VUSF = 0x00;
pOverlay->PitchMult = 1;
} else if(dstH > srcH) {
- temp = srcH * 64 / (dstH + 1);
+ temp = srcH * 64 / (dstH + 1);
if (temp > 63) temp = 63;
pOverlay->VUSF = temp;
pOverlay->PitchMult = 1;
} else {
- /* 6326 can't scale below factor .440 - to check with 530/620 */
+ /* 6326 can't scale below factor .440 - to check with 530/620 */
if(((dstH * 1000) / srcH) < 440) dstH = ((srcH * 440) / 1000) + 1;
temp = srcH / dstH;
if(srcH % dstH) {
@@ -784,13 +766,12 @@ calc_line_buf_size(SISOverlayPtr pOverlay)
CARD32 line = pOverlay->srcW;
if( (pOverlay->pixelFormat == PIXEL_FMT_YV12) ||
- (pOverlay->pixelFormat == PIXEL_FMT_I420) )
- {
- I = (line >> 5) + (((line >> 6) * 2)) + 3;
+ (pOverlay->pixelFormat == PIXEL_FMT_I420) ) {
+ I = (line >> 5) + (((line >> 6) * 2)) + 3;
I <<= 5;
} else { /* YUV2, UYVY, RGB */
- I = line << 1;
- if(I & 7) I += 8;
+ I = line << 1;
+ if(I & 7) I += 8;
}
I += 8;
I >>= 3;
@@ -812,35 +793,35 @@ set_format(SISPtr pSiS, SISOverlayPtr pOverlay)
{
CARD8 fmt, misc0, misc1, misc4;
- switch (pOverlay->pixelFormat){
+ switch(pOverlay->pixelFormat) {
case PIXEL_FMT_YV12:
case PIXEL_FMT_I420: /* V/530 V/6326 */
- fmt = 0x80; /* D[7:6] 10 YUV2(=YUYV), 01 VYUY, 00 UYVY, 11 YVYU / 00 RGB 555, 01 RGB 565 */
+ fmt = 0x80; /* D[7:6] 10 YUV2(=YUYV), 01 VYUY, 00 UYVY, 11 YVYU / 00 RGB 555, 01 RGB 565 */
misc0 = 0x40; /* D[6]: 1 = YUV, 0 = RGB */
misc4 = 0x05; /* D[1:0] 00 RGB 555, 01 YUV 422, 10 RGB 565; D[2] 1 = YUV420 mode */
misc1 = 0xff;
- break;
+ break;
case PIXEL_FMT_UYVY:
- fmt = 0x00; /* D[7:6] 10 YUV2(=YUYV), 01 VYUY, 00 UYVY, 11 YVYU / 00 RGB 555, 01 RGB 565 */
+ fmt = 0x00; /* D[7:6] 10 YUV2(=YUYV), 01 VYUY, 00 UYVY, 11 YVYU / 00 RGB 555, 01 RGB 565 */
misc0 = 0x40; /* D[6]: 1 = YUV, 0 = RGB */
misc4 = 0x00; /* D[1:0] 00 RGB 555, 01 YUV 422, 10 RGB 565; D[2] 1 = YUV420 mode */
misc1 = 0xff;
- break;
+ break;
case PIXEL_FMT_YUY2: /* V/530 V/6326 */
- fmt = 0x80; /* D[7:6] 10 YUV2(=YUYV), 01 VYUY, 00 UYVY, 11 YVYU / 00 RGB 555, 01 RGB 565 */
+ fmt = 0x80; /* D[7:6] 10 YUV2(=YUYV), 01 VYUY, 00 UYVY, 11 YVYU / 00 RGB 555, 01 RGB 565 */
misc0 = 0x40; /* D[6]: 1 = YUV, 0 = RGB */
misc4 = 0x00; /* D[1:0] 00 RGB 555, 01 YUV 422, 10 RGB 565; D[2] 1 = YUV420 mode */
misc1 = 0xff;
- break;
+ break;
case PIXEL_FMT_RGB6: /* V/530 V/6326 */
- fmt = 0x40; /* D[7:6] 10 YUV2(=YUYV), 01 VYUY, 00 UYVY, 11 YVYU / 00 RGB 555, 01 RGB 565 */
+ fmt = 0x40; /* D[7:6] 10 YUV2(=YUYV), 01 VYUY, 00 UYVY, 11 YVYU / 00 RGB 555, 01 RGB 565 */
misc0 = 0x00; /* D[6]: 1 = YUV, 0 = RGB */
misc4 = 0xff;
misc1 = 0x00; /* D[2] = Capture format selection (DS5597) - WDR sets this */
break;
case PIXEL_FMT_RGB5: /* V/530 V/6326 */
default:
- fmt = 0x00; /* D[7:6] 10 YUV2(=YUYV), 01 VYUY, 00 UYVY, 11 YVYU / 00 RGB 555, 01 RGB 565 */
+ fmt = 0x00; /* D[7:6] 10 YUV2(=YUYV), 01 VYUY, 00 UYVY, 11 YVYU / 00 RGB 555, 01 RGB 565 */
misc0 = 0x00; /* D[6]: 1 = YUV, 0 = RGB */
misc4 = 0xff;
misc1 = 0x04; /* D[2] = Capture format selection (DS5597) - WDR sets this */
@@ -850,15 +831,15 @@ set_format(SISPtr pSiS, SISOverlayPtr pOverlay)
setvideoregmask(pSiS, Index_VI6326_VideoFormatSelect, fmt, 0xC0);
setvideoregmask(pSiS, Index_VI6326_Control_Misc0, misc0, 0x40);
if(misc4 == 0xff) {
- setvideoregmask(pSiS, Index_VI6326_Control_Misc1, misc1, 0x04);
- if(pSiS->oldChipset >= OC_SIS5597) {
- setvideoregmask(pSiS, Index_VI6326_Control_Misc4, 0x00, 0x05);
- }
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc1, misc1, 0x04);
+ if(pSiS->oldChipset >= OC_SIS5597) {
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc4, 0x00, 0x05);
+ }
} else {
- if(pSiS->oldChipset >= OC_SIS5597) {
- setvideoregmask(pSiS, Index_VI6326_Control_Misc4, misc4, 0x05);
- }
- setvideoregmask(pSiS, Index_VI6326_Control_Misc1, 0x00, 0x04);
+ if(pSiS->oldChipset >= OC_SIS5597) {
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc4, misc4, 0x05);
+ }
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc1, 0x00, 0x04);
}
}
@@ -868,13 +849,13 @@ set_colorkey(SISPtr pSiS, CARD32 colorkey)
CARD8 r, g, b, s;
b = (CARD8)(colorkey & 0xFF);
- g = (CARD8)((colorkey>>8) & 0xFF);
- r = (CARD8)((colorkey>>16) & 0xFF);
+ g = (CARD8)((colorkey >> 8) & 0xFF);
+ r = (CARD8)((colorkey >> 16) & 0xFF);
if(pSiS->CurrentLayout.bitsPerPixel >= 24) {
- s = b;
- b = r;
- r = s;
+ s = b;
+ b = r;
+ r = s;
}
setvideoreg(pSiS, Index_VI6326_Overlay_ColorKey_Blue_Min ,(CARD8)b);
@@ -908,10 +889,10 @@ set_contrast_data(SISPtr pSiS, int value)
if(temp > 3) temp = 3;
setvideoregmask(pSiS, Index_VI6326_Contrast_Enh_Ctrl, (temp << 6), 0xC0);
switch(temp) {
- case 0: temp = 2048; break;
- case 1: temp = 4096; break;
- case 2: temp = 8192; break;
- case 3: temp = 16384; break;
+ case 0: temp = 2048; break;
+ case 1: temp = 4096; break;
+ case 2: temp = 8192; break;
+ case 3: temp = 16384; break;
}
temp <<= 10;
temp /= value;
@@ -939,24 +920,24 @@ set_overlay(SISPtr pSiS, SISOverlayPtr pOverlay, SISPortPrivPtr pPriv, int index
top = pOverlay->dstBox.y1;
bottom = pOverlay->dstBox.y2;
if(bottom > screenY) {
- bottom = screenY;
+ bottom = screenY;
}
left = pOverlay->dstBox.x1;
right = pOverlay->dstBox.x2;
if(right > screenX) {
- right = screenX;
+ right = screenX;
}
/* TW: DoubleScan modes require Y coordinates * 2 */
if(pSiS->CurrentLayout.mode->Flags & V_DBLSCAN) {
- top <<= 1;
- bottom <<= 1;
+ top <<= 1;
+ bottom <<= 1;
}
/* TW: Interlace modes require Y coordinates / 2 */
if(pSiS->CurrentLayout.mode->Flags & V_INTERLACE) {
- top >>= 1;
- bottom >>= 1;
+ top >>= 1;
+ bottom >>= 1;
}
h_over = (((left>>8) & 0x07) | ((right>>4) & 0x70));
@@ -965,8 +946,8 @@ set_overlay(SISPtr pSiS, SISOverlayPtr pOverlay, SISPortPrivPtr pPriv, int index
pitch = pOverlay->pitch * pOverlay->PitchMult;
pitch >>= 2; /* Datasheet: Unit = double word - verified */
if(pitch > 0xfff) {
- pitch = pOverlay->pitch * (0xFFF * 2 / pOverlay->pitch);
- pOverlay->VUSF = 0x3F;
+ pitch = pOverlay->pitch * (0xFFF * 2 / pOverlay->pitch);
+ pOverlay->VUSF = 0x3F;
}
/* set color key */
@@ -984,9 +965,9 @@ set_overlay(SISPtr pSiS, SISOverlayPtr pOverlay, SISPortPrivPtr pPriv, int index
/* Set U/V pitch if using planar formats */
if( (pOverlay->pixelFormat == PIXEL_FMT_YV12) ||
(pOverlay->pixelFormat == PIXEL_FMT_I420) ) {
- /* Set U/V pitch */ /* Datasheet: Unit = double word - verified */
- setvideoreg(pSiS, Index_VI6326_Disp_UV_Buf_Pitch_Low, (CARD8)pitch >> 1);
- setvideoregmask(pSiS, Index_VI6326_Disp_UV_Buf_Pitch_High, (CARD8)(pitch >> 9), 0x0f);
+ /* Set U/V pitch */ /* Datasheet: Unit = double word - verified */
+ setvideoreg(pSiS, Index_VI6326_Disp_UV_Buf_Pitch_Low, (CARD8)pitch >> 1);
+ setvideoregmask(pSiS, Index_VI6326_Disp_UV_Buf_Pitch_High, (CARD8)(pitch >> 9), 0x0f);
}
/* set line buffer size */
@@ -999,10 +980,10 @@ set_overlay(SISPtr pSiS, SISOverlayPtr pOverlay, SISPortPrivPtr pPriv, int index
/* TW: We don't have to wait for vertical retrace in all cases */
if(pPriv->mustwait) {
- watchdog = WATCHDOG_DELAY;
- while ((!pOverlay->VBlankActiveFunc(pSiS)) && --watchdog);
- if(!watchdog) xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Xv: Waiting for vertical retrace timed-out\n");
+ watchdog = WATCHDOG_DELAY;
+ while ((!pOverlay->VBlankActiveFunc(pSiS)) && --watchdog);
+ if(!watchdog) xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Xv: Waiting for vertical retrace timed-out\n");
}
/* set destination window position */
@@ -1015,17 +996,17 @@ set_overlay(SISPtr pSiS, SISOverlayPtr pOverlay, SISPortPrivPtr pPriv, int index
setvideoreg(pSiS, Index_VI6326_Win_Ver_Over, (CARD8)v_over);
/* Set Y start address */
- setvideoreg (pSiS, Index_VI6326_Disp_Y_Buf_Start_Low, (CARD8)(pOverlay->PSY));
- setvideoreg (pSiS, Index_VI6326_Disp_Y_Buf_Start_Middle, (CARD8)((pOverlay->PSY)>>8));
+ setvideoreg(pSiS, Index_VI6326_Disp_Y_Buf_Start_Low, (CARD8)(pOverlay->PSY));
+ setvideoreg(pSiS, Index_VI6326_Disp_Y_Buf_Start_Middle, (CARD8)((pOverlay->PSY)>>8));
if(pSiS->oldChipset <= OC_SIS6326) { /* all old chipsets incl 6326 */
/* Set overflow bits */
- setvideoregmask (pSiS, Index_VI6326_Disp_Capt_Y_Buf_Start_High,
+ setvideoregmask(pSiS, Index_VI6326_Disp_Capt_Y_Buf_Start_High,
(CARD8)(((pOverlay->PSY)>>12) & 0xF0), 0xF0);
/* Set framebuffer end address */
- setvideoreg (pSiS, Index_VI6326_Disp_Y_End, (CARD8)(pOverlay->YUVEnd));
+ setvideoreg(pSiS, Index_VI6326_Disp_Y_End, (CARD8)(pOverlay->YUVEnd));
} else { /* 530/620 */
/* Set overflow bits */
- setvideoregmask (pSiS, Index_VI6326_Disp_Capt_Y_Buf_Start_High,
+ setvideoregmask(pSiS, Index_VI6326_Disp_Capt_Y_Buf_Start_High,
(CARD8)(((pOverlay->PSY)>>13) & 0xF8), 0xF8);
}
@@ -1037,18 +1018,18 @@ set_overlay(SISPtr pSiS, SISOverlayPtr pOverlay, SISPortPrivPtr pPriv, int index
CARD32 PSV = pOverlay->PSV;
/* set U/V start address */
- setvideoreg (pSiS, Index_VI6326_U_Buf_Start_Low, (CARD8)PSU);
- setvideoreg (pSiS, Index_VI6326_U_Buf_Start_Middle,(CARD8)(PSU >> 8));
+ setvideoreg(pSiS, Index_VI6326_U_Buf_Start_Low, (CARD8)PSU);
+ setvideoreg(pSiS, Index_VI6326_U_Buf_Start_Middle,(CARD8)(PSU >> 8));
- setvideoreg (pSiS, Index_VI6326_V_Buf_Start_Low, (CARD8)PSV);
- setvideoreg (pSiS, Index_VI6326_V_Buf_Start_Middle,(CARD8)(PSV >> 8));
+ setvideoreg(pSiS, Index_VI6326_V_Buf_Start_Low, (CARD8)PSV);
+ setvideoreg(pSiS, Index_VI6326_V_Buf_Start_Middle,(CARD8)(PSV >> 8));
- setvideoreg (pSiS, Index_VI6326_UV_Buf_Start_High,
+ setvideoreg(pSiS, Index_VI6326_UV_Buf_Start_High,
(CARD8)(((PSU >> 16) & 0x0F) | ((PSV >> 12) & 0xF0)) );
if(pSiS->oldChipset > OC_SIS6326) {
/* Set bit 20 of the addresses in Misc5 (530/620 only) */
- setvideoreg (pSiS, Index_VI6326_Control_Misc5,
+ setvideoreg(pSiS, Index_VI6326_Control_Misc5,
(CARD8)(((PSU >> (20-1)) & 0x02) | ((PSV >> (20-2)) & 0x04)) );
}
}
@@ -1109,19 +1090,19 @@ SIS6326DisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
overlay.dstBox.y2 = pPriv->drw_y + pPriv->drw_h - pScrn->frameY0;
if((overlay.dstBox.x1 > overlay.dstBox.x2) ||
- (overlay.dstBox.y1 > overlay.dstBox.y2))
- return;
+ (overlay.dstBox.y1 > overlay.dstBox.y2))
+ return;
if((overlay.dstBox.x2 < 0) || (overlay.dstBox.y2 < 0))
- return;
+ return;
if(overlay.dstBox.x1 < 0) {
- srcOffsetX = pPriv->src_w * (-overlay.dstBox.x1) / pPriv->drw_w;
- overlay.dstBox.x1 = 0;
+ srcOffsetX = pPriv->src_w * (-overlay.dstBox.x1) / pPriv->drw_w;
+ overlay.dstBox.x1 = 0;
}
if(overlay.dstBox.y1 < 0) {
- srcOffsetY = pPriv->src_h * (-overlay.dstBox.y1) / pPriv->drw_h;
- overlay.dstBox.y1 = 0;
+ srcOffsetY = pPriv->src_h * (-overlay.dstBox.y1) / pPriv->drw_h;
+ overlay.dstBox.y1 = 0;
}
switch(pPriv->id){
@@ -1168,13 +1149,13 @@ SIS6326DisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
overlay.srcW = pPriv->src_w - (sx - pPriv->src_x);
overlay.srcH = pPriv->src_h - (sy - pPriv->src_y);
- if ( (pPriv->oldx1 != overlay.dstBox.x1) ||
- (pPriv->oldx2 != overlay.dstBox.x2) ||
- (pPriv->oldy1 != overlay.dstBox.y1) ||
- (pPriv->oldy2 != overlay.dstBox.y2) ) {
- pPriv->mustwait = 1;
- pPriv->oldx1 = overlay.dstBox.x1; pPriv->oldx2 = overlay.dstBox.x2;
- pPriv->oldy1 = overlay.dstBox.y1; pPriv->oldy2 = overlay.dstBox.y2;
+ if( (pPriv->oldx1 != overlay.dstBox.x1) ||
+ (pPriv->oldx2 != overlay.dstBox.x2) ||
+ (pPriv->oldy1 != overlay.dstBox.y1) ||
+ (pPriv->oldy2 != overlay.dstBox.y2) ) {
+ pPriv->mustwait = 1;
+ pPriv->oldx1 = overlay.dstBox.x1; pPriv->oldx2 = overlay.dstBox.x2;
+ pPriv->oldy1 = overlay.dstBox.y1; pPriv->oldy2 = overlay.dstBox.y2;
}
/* calculate line buffer length */
@@ -1188,9 +1169,8 @@ SIS6326DisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
/* set (not only determine) if line buffer is to be merged */
if(pSiS->oldChipset > OC_SIS5597) {
- int temp;
+ int temp = 384;
if(pSiS->oldChipset <= OC_SIS6326) temp = 352;
- else temp = 384;
merge_line_buf(pSiS, pPriv, (overlay.srcW > temp));
}
@@ -1199,9 +1179,9 @@ SIS6326DisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
/* enable overlay */
if(pSiS->oldChipset > OC_SIS6326) {
- setvideoregmask (pSiS, Index_VI6326_Control_Misc4, 0x40, 0x40);
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc4, 0x40, 0x40);
}
- setvideoregmask (pSiS, Index_VI6326_Control_Misc0, 0x02, 0x02);
+ setvideoregmask(pSiS, Index_VI6326_Control_Misc0, 0x02, 0x02);
pPriv->mustwait = 0;
}
@@ -1212,8 +1192,8 @@ SIS6326FreeOverlayMemory(ScrnInfoPtr pScrn)
SISPortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn);
if(pPriv->linear) {
- xf86FreeOffscreenLinear(pPriv->linear);
- pPriv->linear = NULL;
+ xf86FreeOffscreenLinear(pPriv->linear);
+ pPriv->linear = NULL;
}
}
@@ -1223,8 +1203,7 @@ SIS6326StopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
SISPortPrivPtr pPriv = (SISPortPrivPtr)data;
SISPtr pSiS = SISPTR(pScrn);
- if(pPriv->grabbedByV4L)
- return;
+ if(pPriv->grabbedByV4L) return;
REGION_EMPTY(pScrn->pScreen, &pPriv->clip);
@@ -1264,8 +1243,7 @@ SIS6326PutImage(
CARD32 *src, *dest;
unsigned long i;
- if(pPriv->grabbedByV4L)
- return Success;
+ if(pPriv->grabbedByV4L) return Success;
pPriv->drw_x = drw_x;
pPriv->drw_y = drw_y;
@@ -1285,7 +1263,7 @@ SIS6326PutImage(
V sample period 2 2 (8 bit per pixel, subsampled)
U sample period 2 2 (8 bit per pixel, subsampled)
- Y plane is fully sampled (width*height), U and V planes
+ Y plane is fully sampled (width*height), U and V planes
are sampled in 2x2 blocks, hence a group of 4 pixels requires
4 + 1 + 1 = 6 bytes. The data is planar, ie in single planes
for Y, U and V.
@@ -1342,7 +1320,7 @@ SIS6326PutImage(
dest = (CARD32 *)(pSiS->FbBase + pPriv->bufAddr[pPriv->currentBuf]);
src = (CARD32 *)buf;
for(i = 0; i < (totalSize/16); i++) {
- *dest++ = *src++;
+ *dest++ = *src++;
*dest++ = *src++;
*dest++ = *src++;
*dest++ = *src++;
@@ -1359,16 +1337,16 @@ SIS6326PutImage(
#else
!REGION_EQUAL(pScrn->pScreen, &pPriv->clip, clipBoxes)) ) {
#endif
- /* We always paint colorkey for V4L */
- if(!pPriv->grabbedByV4L)
- REGION_COPY(pScrn->pScreen, &pPriv->clip, clipBoxes);
- /* draw these */
+ /* We always paint colorkey for V4L */
+ if(!pPriv->grabbedByV4L)
+ REGION_COPY(pScrn->pScreen, &pPriv->clip, clipBoxes);
+ /* draw these */
#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,1,99,1,0)
- (*pSiS->AccelInfoPtr->FillSolidRects)(pScrn, pPriv->colorKey, GXcopy, ~0,
+ (*pSiS->AccelInfoPtr->FillSolidRects)(pScrn, pPriv->colorKey, GXcopy, ~0,
REGION_NUM_RECTS(clipBoxes),
REGION_RECTS(clipBoxes));
#else
- xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes);
+ xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes);
#endif
}
@@ -1406,34 +1384,34 @@ SIS6326QueryImageAttributes(
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;
+ *w = (*w + 7) & ~7;
+ *h = (*h + 1) & ~1;
+ pitchY = *w;
+ pitchUV = *w >> 1;
+ if(pitches) {
+ pitches[0] = pitchY;
+ pitches[1] = pitches[2] = pitchUV;
}
- size = sizeY + (sizeUV << 1);
- break;
+ 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_YUY2:
case PIXEL_FMT_UYVY:
case PIXEL_FMT_RGB5:
case PIXEL_FMT_RGB6:
default:
- *w = (*w + 1) & ~1;
- pitchY = *w << 1;
- if(pitches) pitches[0] = pitchY;
- if(offsets) offsets[0] = 0;
- size = pitchY * (*h);
- break;
+ *w = (*w + 1) & ~1;
+ pitchY = *w << 1;
+ if(pitches) pitches[0] = pitchY;
+ if(offsets) offsets[0] = 0;
+ size = pitchY * (*h);
+ break;
}
return size;
@@ -1451,30 +1429,30 @@ SIS6326VideoTimerCallback(ScrnInfoPtr pScrn, Time now)
if(!pScrn->vtSema) return;
if(pSiS->adaptor) {
- pPriv = GET_PORT_PRIVATE(pScrn);
+ pPriv = GET_PORT_PRIVATE(pScrn);
if(!pPriv->videoStatus) pPriv = NULL;
}
if(pPriv) {
if(pPriv->videoStatus & TIMER_MASK) {
- if(pPriv->videoStatus & OFF_TIMER) {
+ if(pPriv->videoStatus & OFF_TIMER) {
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;
+ /* 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) {
+ } else if(pPriv->videoStatus & FREE_TIMER) {
if(pPriv->freeTime < now) {
- SIS6326FreeOverlayMemory(pScrn);
- pPriv->mustwait = 1;
- pPriv->videoStatus = 0;
- }
- } else
+ SIS6326FreeOverlayMemory(pScrn);
+ pPriv->mustwait = 1;
+ pPriv->videoStatus = 0;
+ }
+ } else
pSiS->VideoTimerCallback = SIS6326VideoTimerCallback;
}
}
@@ -1496,18 +1474,18 @@ SIS6326AllocSurface (
int size, depth;
if((w < IMAGE_MIN_WIDTH) || (h < IMAGE_MIN_HEIGHT))
- return BadValue;
+ return BadValue;
if(pSiS->oldChipset < OC_SIS6326) {
- if((w > IMAGE_MAX_WIDTH_5597) || (h > IMAGE_MAX_HEIGHT_5597))
- return BadValue;
+ if((w > IMAGE_MAX_WIDTH_5597) || (h > IMAGE_MAX_HEIGHT_5597))
+ return BadValue;
} else {
- if((w > IMAGE_MAX_WIDTH) || (h > IMAGE_MAX_HEIGHT))
- return BadValue;
+ if((w > IMAGE_MAX_WIDTH) || (h > IMAGE_MAX_HEIGHT))
+ return BadValue;
}
if(pPriv->grabbedByV4L)
- return BadAlloc;
+ return BadAlloc;
depth = pSiS->CurrentLayout.bitsPerPixel >> 3;
@@ -1516,7 +1494,7 @@ SIS6326AllocSurface (
size = h * pPriv->pitch;
pPriv->linear = SISAllocateOverlayMemory(pScrn, pPriv->linear, ((size + depth - 1) / depth));
if(!pPriv->linear)
- return BadAlloc;
+ return BadAlloc;
pPriv->totalSize = size;
@@ -1545,9 +1523,9 @@ SIS6326StopSurface (XF86SurfacePtr surface)
SISPtr pSiS = SISPTR(surface->pScrn);
if(pPriv->grabbedByV4L && pPriv->videoStatus) {
- close_overlay(pSiS, pPriv);
- pPriv->mustwait = 1;
- pPriv->videoStatus = 0;
+ close_overlay(pSiS, pPriv);
+ pPriv->mustwait = 1;
+ pPriv->videoStatus = 0;
}
return Success;
}
@@ -1558,9 +1536,9 @@ SIS6326FreeSurface (XF86SurfacePtr surface)
SISPortPrivPtr pPriv = (SISPortPrivPtr)(surface->devPrivate.ptr);
if(pPriv->grabbedByV4L) {
- SIS6326StopSurface(surface);
- SIS6326FreeOverlayMemory(surface->pScrn);
- pPriv->grabbedByV4L = FALSE;
+ SIS6326StopSurface(surface);
+ SIS6326FreeOverlayMemory(surface->pScrn);
+ pPriv->grabbedByV4L = FALSE;
}
return Success;
}
@@ -1603,7 +1581,7 @@ SIS6326DisplaySurface (
SISPortPrivPtr pPriv = (SISPortPrivPtr)(surface->devPrivate.ptr);
if(!pPriv->grabbedByV4L)
- return Success;
+ return Success;
pPriv->drw_x = drw_x;
pPriv->drw_y = drw_y;
@@ -1623,11 +1601,11 @@ SIS6326DisplaySurface (
if(pPriv->autopaintColorKey) {
#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,1,99,1,0)
- (*XAAPTR(pScrn)->FillSolidRects)(pScrn, pPriv->colorKey, GXcopy, ~0,
+ (*XAAPTR(pScrn)->FillSolidRects)(pScrn, pPriv->colorKey, GXcopy, ~0,
REGION_NUM_RECTS(clipBoxes),
REGION_RECTS(clipBoxes));
#else
- xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes);
+ xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes);
#endif
}
diff --git a/src/sis_common.h b/src/sis_common.h
index 690c9ce..9215786 100644
--- a/src/sis_common.h
+++ b/src/sis_common.h
@@ -42,22 +42,22 @@
#define DRM_SIS_FB_INIT 0x16
typedef struct {
- int context;
- unsigned long offset;
- unsigned long size;
- void *free;
+ int context;
+ unsigned long offset;
+ unsigned long size;
+ void *free;
} drm_sis_mem_t;
typedef struct {
- unsigned long offset, size;
+ unsigned long offset, size;
} drm_sis_agp_t;
typedef struct {
- unsigned long offset, size;
+ unsigned long offset, size;
} drm_sis_fb_t;
typedef struct {
- unsigned int left, right;
+ unsigned int left, right;
} drm_sis_flip_t;
#endif /* _SIS_COMMON_H_ */
diff --git a/src/sis_cursor.c b/src/sis_cursor.c
index 0308fe4..1e293ee 100644
--- a/src/sis_cursor.c
+++ b/src/sis_cursor.c
@@ -205,14 +205,14 @@ SiS300ShowCursor(ScrnInfoPtr pScrn)
#endif
if(pSiS->UseHWARGBCursor) {
sis300EnableHWARGBCursor()
- if(pSiS->VBFlags & CRT2_ENABLE) {
+ if(pSiS->VBFlags & CRT2_ENABLE) {
sis301EnableHWARGBCursor()
- }
+ }
} else {
- sis300EnableHWCursor()
- if(pSiS->VBFlags & CRT2_ENABLE) {
+ sis300EnableHWCursor()
+ if(pSiS->VBFlags & CRT2_ENABLE) {
sis301EnableHWCursor()
- }
+ }
}
#ifdef SISDUALHEAD
}
@@ -266,16 +266,16 @@ SiS310ShowCursor(ScrnInfoPtr pScrn)
}
} else {
if(pSiS->UseHWARGBCursor) {
- sis310EnableHWARGBCursor()
- if(pSiS->VBFlags & CRT2_ENABLE) {
+ sis310EnableHWARGBCursor()
+ if(pSiS->VBFlags & CRT2_ENABLE) {
sis301EnableHWARGBCursor310()
}
- } else {
+ } else {
sis310EnableHWCursor()
- if(pSiS->VBFlags & CRT2_ENABLE) {
+ if(pSiS->VBFlags & CRT2_ENABLE) {
sis301EnableHWCursor310()
}
- }
+ }
}
#ifdef SISDUALHEAD
}
@@ -371,13 +371,16 @@ SiSSetCursorPositionMerged(ScrnInfoPtr pScrn1, int x, int y)
y2 = 0;
}
- if(mode1->Flags & V_INTERLACE) { y1 /= 2; y1_preset /= 2; }
- else if(mode1->Flags & V_DBLSCAN) { y1 *= 2; y1_preset *= 2; }
+ /* Work around bug in cursor engine if y > display */
+ if(y1 > mode1->VDisplay) { y1 = 2000; y1_preset = 0; }
+ else if(mode1->Flags & V_INTERLACE) { y1 /= 2; y1_preset /= 2; }
+ else if(mode1->Flags & V_DBLSCAN) { y1 *= 2; y1_preset *= 2; }
- if(mode2->Flags & V_INTERLACE) { y2 /= 2; y2_preset /= 2; }
- else if(mode2->Flags & V_DBLSCAN) { y2 *= 2; y2_preset *= 2; }
+ if(y2 > mode2->VDisplay) { y2 = 2000; y2_preset = 0; }
+ else if(mode2->Flags & V_INTERLACE) { y2 /= 2; y2_preset /= 2; }
+ else if(mode2->Flags & V_DBLSCAN) { y2 *= 2; y2_preset *= 2; }
- /* Work around bug in Cursor engine */
+ /* Work around bug in cursor engine if x > display */
if(x1 > mode1->HDisplay) { y1 = 2000; y1_preset = 0; }
if(x2 > mode2->HDisplay) { y2 = 2000; y2_preset = 0; }
@@ -410,6 +413,9 @@ SiS300SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
}
#endif
+ if(mode->Flags & V_INTERLACE) y /= 2;
+ else if(mode->Flags & V_DBLSCAN) y *= 2;
+
if(x < 0) {
x_preset = (-x);
x = 0;
@@ -419,27 +425,24 @@ SiS300SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
y = 0;
}
- if(mode->Flags & V_INTERLACE) y /= 2;
- else if(mode->Flags & V_DBLSCAN) y *= 2;
-
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
if(pSiS->SecondHead) {
/* Head 2 is always CRT1 */
sis300SetCursorPositionX(x, x_preset)
- sis300SetCursorPositionY(y, y_preset)
+ sis300SetCursorPositionY(y, y_preset)
} else {
/* Head 1 is always CRT2 */
sis301SetCursorPositionX(x + 13, x_preset)
- sis301SetCursorPositionY(y, y_preset)
+ sis301SetCursorPositionY(y, y_preset)
}
} else {
#endif
sis300SetCursorPositionX(x, x_preset)
sis300SetCursorPositionY(y, y_preset)
if(pSiS->VBFlags & CRT2_ENABLE) {
- sis301SetCursorPositionX(x + 13, x_preset)
- sis301SetCursorPositionY(y, y_preset)
+ sis301SetCursorPositionX(x + 13, x_preset)
+ sis301SetCursorPositionY(y, y_preset)
}
#ifdef SISDUALHEAD
}
@@ -461,6 +464,9 @@ SiS310SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
}
#endif
+ if(mode->Flags & V_INTERLACE) y >>= 1;
+ else if(mode->Flags & V_DBLSCAN) y <<= 1;
+
if(x < 0) {
x_preset = (-x);
x = 0;
@@ -470,28 +476,37 @@ SiS310SetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
y = 0;
}
- if(mode->Flags & V_INTERLACE) y /= 2;
- else if(mode->Flags & V_DBLSCAN) y *= 2;
-
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
if(pSiS->SecondHead) {
/* Head 2 is always CRT1 */
sis310SetCursorPositionX(x, x_preset)
- sis310SetCursorPositionY(y, y_preset)
+ sis310SetCursorPositionY(y, y_preset)
} else {
/* Head 1 is always CRT2 */
+#if 0
+ if((pSiS->VBFlags & CRT2_LCD) && (pSiS->FSTN || pSiS->DSTN)) {
+ y >>= 1;
+ y_preset >>= 1;
+ }
+#endif
sis301SetCursorPositionX310(x + 17, x_preset)
- sis301SetCursorPositionY310(y, y_preset)
+ sis301SetCursorPositionY310(y, y_preset)
}
} else {
#endif
- sis310SetCursorPositionX(x, x_preset)
- sis310SetCursorPositionY(y, y_preset)
- if(pSiS->VBFlags & CRT2_ENABLE) {
- sis301SetCursorPositionX310(x + 17, x_preset)
- sis301SetCursorPositionY310(y, y_preset)
- }
+ sis310SetCursorPositionX(x, x_preset)
+ sis310SetCursorPositionY(y, y_preset)
+ if(pSiS->VBFlags & CRT2_ENABLE) {
+#if 0
+ if((pSiS->VBFlags & CRT2_LCD) && (pSiS->FSTN || pSiS->DSTN)) {
+ y >>= 1;
+ y_preset >>= 1;
+ }
+#endif
+ sis301SetCursorPositionX310(x + 17, x_preset)
+ sis301SetCursorPositionY310(y, y_preset)
+ }
#ifdef SISDUALHEAD
}
#endif
@@ -570,19 +585,19 @@ SiS310SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
if(pSiS->DualHeadMode) {
if(pSiS->SecondHead) {
/* Head 2 is always CRT1 */
- sis310SetCursorBGColor(bg)
- sis310SetCursorFGColor(fg)
+ sis310SetCursorBGColor(bg)
+ sis310SetCursorFGColor(fg)
} else {
/* Head 1 is always CRT2 */
if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) {
if((fg != pSiS->CurFGCol) || (bg != pSiS->CurBGCol)) {
- pSiS->CurFGCol = fg;
- pSiS->CurBGCol = bg;
- SiSXConvertMono2ARGB(pSiS);
+ pSiS->CurFGCol = fg;
+ pSiS->CurBGCol = bg;
+ SiSXConvertMono2ARGB(pSiS);
}
} else {
sis301SetCursorBGColor310(bg)
- sis301SetCursorFGColor310(fg)
+ sis301SetCursorFGColor310(fg)
}
}
} else {
@@ -591,15 +606,15 @@ SiS310SetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
sis310SetCursorFGColor(fg)
if(pSiS->VBFlags & CRT2_ENABLE) {
- if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) {
+ if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) {
if((fg != pSiS->CurFGCol) || (bg != pSiS->CurBGCol)) {
pSiS->CurFGCol = fg;
- pSiS->CurBGCol = bg;
+ pSiS->CurBGCol = bg;
SiSXConvertMono2ARGB(pSiS);
}
} else {
sis301SetCursorBGColor310(bg)
- sis301SetCursorFGColor310(fg)
+ sis301SetCursorFGColor310(fg)
}
}
#ifdef SISDUALHEAD
@@ -612,7 +627,7 @@ SiSLoadCursorImage(ScrnInfoPtr pScrn, UChar *src)
{
SISPtr pSiS = SISPTR(pScrn);
DisplayModePtr mode = pSiS->CurrentLayout.mode;
- int cursor_addr;
+ ULong cursor_addr;
UChar temp;
UChar sridx, cridx;
@@ -626,13 +641,13 @@ SiSLoadCursorImage(ScrnInfoPtr pScrn, UChar *src)
if(mode->Flags & V_DBLSCAN) {
int i;
for(i = 0; i < 32; i++) {
- SiSMemCopyToVideoRam(pSiS, (UChar *)pSiS->FbBase + (cursor_addr * 1024) + (32 * i),
- src + (16 * i), 16);
- SiSMemCopyToVideoRam(pSiS, (UChar *)pSiS->FbBase + (cursor_addr * 1024) + (32 * i) + 16,
- src + (16 * i), 16);
+ SiSMemCopyToVideoRam(pSiS, (UChar *)pSiS->RealFbBase + (cursor_addr * 1024) + (32 * i),
+ src + (16 * i), 16);
+ SiSMemCopyToVideoRam(pSiS, (UChar *)pSiS->RealFbBase + (cursor_addr * 1024) + (32 * i) + 16,
+ src + (16 * i), 16);
}
} else {
- SiSMemCopyToVideoRam(pSiS, (UChar *)pSiS->FbBase + (cursor_addr * 1024), src, 1024);
+ SiSMemCopyToVideoRam(pSiS, (UChar *)pSiS->RealFbBase + (cursor_addr * 1024), src, 1024);
}
/* copy bits [21:18] into the top bits of SR38 */
@@ -662,10 +677,10 @@ static void
SiS300LoadCursorImage(ScrnInfoPtr pScrn, UChar *src)
{
SISPtr pSiS = SISPTR(pScrn);
- int cursor_addr;
+ ULong cursor_addr;
CARD32 status1 = 0, status2 = 0;
- UChar *dest = pSiS->FbBase;
- Bool sizedouble = FALSE;
+ UChar *dest = pSiS->RealFbBase;
+ Bool sizedouble = FALSE;
#ifdef SISDUALHEAD
SISEntPtr pSiSEnt = pSiS->entityPrivate;
#endif
@@ -684,16 +699,16 @@ SiS300LoadCursorImage(ScrnInfoPtr pScrn, UChar *src)
cursor_addr = pScrn->videoRam - pSiS->cursorOffset - (pSiS->CursorSize/1024); /* 1K boundary */
#ifdef SISDUALHEAD
- /* Use the global (real) FbBase in DHM */
- if(pSiS->DualHeadMode) dest = pSiSEnt->FbBase;
+ /* Use the global FbBase in DHM */
+ if(pSiS->DualHeadMode) dest = pSiSEnt->RealFbBase;
#endif
if(sizedouble) {
int i;
for(i = 0; i < 32; i++) {
- SiSMemCopyToVideoRam(pSiS, (UChar *)dest + (cursor_addr * 1024) + (32 * i),
+ SiSMemCopyToVideoRam(pSiS, (UChar *)dest + (cursor_addr * 1024) + (32 * i),
src + (16 * i), 16);
- SiSMemCopyToVideoRam(pSiS, (UChar *)dest + (cursor_addr * 1024) + (32 * i) + 16,
+ SiSMemCopyToVideoRam(pSiS, (UChar *)dest + (cursor_addr * 1024) + (32 * i) + 16,
src + (16 * i), 16);
}
} else {
@@ -718,8 +733,8 @@ SiS300LoadCursorImage(ScrnInfoPtr pScrn, UChar *src)
}
sis300SetCursorAddress(cursor_addr);
if(status1) sis300SetCursorStatus(status1)
-
- if(pSiS->VBFlags & CRT2_ENABLE) {
+
+ if(pSiS->VBFlags & CRT2_ENABLE) {
if((pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) {
status2 = sis301GetCursorStatus;
sis301DisableHWCursor()
@@ -739,7 +754,7 @@ SiS310LoadCursorImage(ScrnInfoPtr pScrn, UChar *src)
SISPtr pSiS = SISPTR(pScrn);
ULong cursor_addr, cursor_addr2 = 0;
CARD32 status1 = 0, status2 = 0;
- UChar *dest = pSiS->FbBase;
+ UChar *dest = pSiS->RealFbBase;
Bool sizedouble = FALSE;
int bufnum;
#ifdef SISDUALHEAD
@@ -768,8 +783,8 @@ SiS310LoadCursorImage(ScrnInfoPtr pScrn, UChar *src)
}
#ifdef SISDUALHEAD
- /* Use the global (real) FbBase in DHM */
- if(pSiS->DualHeadMode) dest = pSiSEnt->FbBase;
+ /* Use the global FbBase in DHM */
+ if(pSiS->DualHeadMode) dest = pSiSEnt->RealFbBase;
#endif
if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) {
@@ -781,10 +796,10 @@ SiS310LoadCursorImage(ScrnInfoPtr pScrn, UChar *src)
if(sizedouble) {
int i;
for(i = 0; i < 32; i++) {
- SiSMemCopyToVideoRam(pSiS, (UChar *)dest + (cursor_addr * 1024) + (32 * i),
- src + (16 * i), 16);
- SiSMemCopyToVideoRam(pSiS, (UChar *)dest + (cursor_addr * 1024) + (32 * i) + 16,
- src + (16 * i), 16);
+ SiSMemCopyToVideoRam(pSiS, (UChar *)dest + (cursor_addr * 1024) + (32 * i),
+ src + (16 * i), 16);
+ SiSMemCopyToVideoRam(pSiS, (UChar *)dest + (cursor_addr * 1024) + (32 * i) + 16,
+ src + (16 * i), 16);
}
} else {
SiSMemCopyToVideoRam(pSiS, (UChar *)dest + (cursor_addr * 1024), src, 1024);
@@ -801,7 +816,7 @@ SiS310LoadCursorImage(ScrnInfoPtr pScrn, UChar *src)
SiSXConvertMono2ARGB(pSiS);
if(pSiS->UseHWARGBCursor) {
- if(pSiS->VBFlags & DISPTYPE_CRT1) {
+ if(pSiS->VBFlags & DISPTYPE_CRT1) {
status1 = sis310GetCursorStatus;
sis310DisableHWCursor();
SISWaitRetraceCRT1(pScrn);
@@ -812,7 +827,7 @@ SiS310LoadCursorImage(ScrnInfoPtr pScrn, UChar *src)
} else {
if(pSiS->UseHWARGBCursor) {
- if(pSiS->VBFlags & DISPTYPE_CRT1) {
+ if(pSiS->VBFlags & DISPTYPE_CRT1) {
status1 = sis310GetCursorStatus;
sis310DisableHWCursor()
if(pSiS->VBFlags & CRT2_ENABLE) {
@@ -840,17 +855,17 @@ SiS310LoadCursorImage(ScrnInfoPtr pScrn, UChar *src)
if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) {
sis301SetCursorAddress310(cursor_addr2)
} else {
- if((pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) {
+ if((pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) {
status2 = sis301GetCursorStatus310;
sis301DisableHWCursor310()
SISWaitRetraceCRT2(pScrn);
sis301SwitchToMONOCursor310();
}
- sis301SetCursorAddress310(cursor_addr)
+ sis301SetCursorAddress310(cursor_addr)
if(status2) sis301SetCursorStatus310(status2)
}
}
-
+
pSiS->UseHWARGBCursor = FALSE;
}
@@ -885,50 +900,56 @@ SiS300UseHWCursor(ScreenPtr pScreen, CursorPtr pCurs)
}
#endif
- switch (pSiS->Chipset) {
+ switch (pSiS->Chipset) {
case PCI_CHIP_SIS300:
case PCI_CHIP_SIS630:
case PCI_CHIP_SIS540:
- if(mode->Flags & V_INTERLACE)
- return FALSE;
+ if(mode->Flags & V_INTERLACE)
+ return FALSE;
if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32))
return FALSE;
#ifdef SISMERGED
- if(pSiS->MergedFB) {
+ if(pSiS->MergedFB) {
if(mode2->Flags & V_INTERLACE)
- return FALSE;
+ return FALSE;
if((mode2->Flags & V_DBLSCAN) && (pCurs->bits->height > 32))
return FALSE;
}
#endif
- break;
+ break;
+ case PCI_CHIP_SIS550:
+#ifdef SISDUALHEAD
+ if((!pSiS->DualHeadMode) || (!pSiS->SecondHead))
+#endif
+ if((pSiS->FSTN || pSiS->DSTN) && (pSiS->VBFlags & CRT2_LCD))
+ return FALSE;
+ /* fall through */
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:
- if(mode->Flags & V_INTERLACE)
- return FALSE;
+ if(mode->Flags & V_INTERLACE)
+ return FALSE;
if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32))
return FALSE;
#ifdef SISMERGED
- if(pSiS->MergedFB) {
+ if(pSiS->MergedFB) {
if(mode2->Flags & V_INTERLACE)
- return FALSE;
+ return FALSE;
if((mode2->Flags & V_DBLSCAN) && (pCurs->bits->height > 32))
return FALSE;
}
#endif
- break;
-
+ break;
+
default:
- if(mode->Flags & V_INTERLACE)
- return FALSE;
- if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32))
+ if(mode->Flags & V_INTERLACE)
+ return FALSE;
+ if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32))
return FALSE;
break;
}
@@ -943,7 +964,7 @@ SiSUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
SISPtr pSiS = SISPTR(pScrn);
- DisplayModePtr mode = pSiS->CurrentLayout.mode;
+ DisplayModePtr mode = pSiS->CurrentLayout.mode;
#ifdef SISMERGED
DisplayModePtr mode2 = NULL;
@@ -953,20 +974,20 @@ SiSUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs)
}
#endif
- switch (pSiS->Chipset) {
+ switch (pSiS->Chipset) {
case PCI_CHIP_SIS300:
case PCI_CHIP_SIS630:
case PCI_CHIP_SIS540:
- if(mode->Flags & V_INTERLACE)
- return FALSE;
+ if(mode->Flags & V_INTERLACE)
+ return FALSE;
if((pCurs->bits->height > 32) || (pCurs->bits->width > 32))
return FALSE;
if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 16))
return FALSE;
#ifdef SISMERGED
- if(pSiS->MergedFB) {
+ if(pSiS->MergedFB) {
if(mode2->Flags & V_INTERLACE)
- return FALSE;
+ return FALSE;
if((mode2->Flags & V_DBLSCAN) && (pCurs->bits->height > 16))
return FALSE;
}
@@ -974,6 +995,12 @@ SiSUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs)
break;
case PCI_CHIP_SIS550:
+#ifdef SISDUALHEAD
+ if((!pSiS->DualHeadMode) || (!pSiS->SecondHead))
+#endif
+ if((pSiS->FSTN || pSiS->DSTN) && (pSiS->VBFlags & CRT2_LCD))
+ return FALSE;
+ /* fall through */
case PCI_CHIP_SIS650:
case PCI_CHIP_SIS315:
case PCI_CHIP_SIS315H:
@@ -981,8 +1008,8 @@ SiSUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs)
case PCI_CHIP_SIS330:
case PCI_CHIP_SIS660:
case PCI_CHIP_SIS340:
- if(mode->Flags & V_INTERLACE)
- return FALSE;
+ if(mode->Flags & V_INTERLACE)
+ return FALSE;
if((pCurs->bits->height > 64) || (pCurs->bits->width > 64))
return FALSE;
if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32))
@@ -990,30 +1017,30 @@ SiSUseHWCursorARGB(ScreenPtr pScreen, CursorPtr pCurs)
if((pSiS->CurrentLayout.bitsPerPixel == 8) && (pSiS->VBFlags & CRT2_ENABLE))
return FALSE;
#ifdef SISMERGED
- if(pSiS->MergedFB) {
+ if(pSiS->MergedFB) {
if(mode2->Flags & V_INTERLACE)
- return FALSE;
+ return FALSE;
if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32))
return FALSE;
}
#endif
- break;
-
+ break;
+
default:
- return FALSE;
+ return FALSE;
}
return TRUE;
}
-static void
+static void
SiS300LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
{
SISPtr pSiS = SISPTR(pScrn);
int cursor_addr, i, j, maxheight = 32;
- CARD32 *src = pCurs->bits->argb, *p;
+ CARD32 *src = pCurs->bits->argb, *p;
CARD32 *pb, *dest;
-#define MYSISPTRTYPE CARD32
+#define MYSISPTRTYPE CARD32
int srcwidth = pCurs->bits->width;
int srcheight = pCurs->bits->height;
CARD32 temp, status1 = 0, status2 = 0;
@@ -1041,10 +1068,10 @@ SiS300LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
#ifdef SISDUALHEAD
if (pSiS->DualHeadMode)
/* TW: Use the global (real) FbBase in DHM */
- dest = (MYSISPTRTYPE *)((UChar *)pSiSEnt->FbBase + (cursor_addr * 1024));
+ dest = (MYSISPTRTYPE *)((UChar *)pSiSEnt->RealFbBase + (cursor_addr * 1024));
else
#endif
- dest = (MYSISPTRTYPE *)((UChar *)pSiS->FbBase + (cursor_addr * 1024));
+ dest = (MYSISPTRTYPE *)((UChar *)pSiS->RealFbBase + (cursor_addr * 1024));
if(sizedouble) {
if(srcheight > 16) srcheight = 16;
@@ -1060,11 +1087,11 @@ SiS300LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
if(pSiS->OptUseColorCursorBlend) {
if(temp & 0xffffff) {
if((temp & 0xff000000) > pSiS->OptColorCursorBlendThreshold) {
- temp &= 0x00ffffff;
+ temp &= 0x00ffffff;
} else {
- temp = 0xff111111;
+ temp = 0xff111111;
}
- } else temp = 0xff000000;
+ } else temp = 0xff000000;
} else {
if(temp & 0xffffff) temp &= 0x00ffffff;
else temp = 0xff000000;
@@ -1081,7 +1108,7 @@ SiS300LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
sisfbwritelinc(dest, sisfbreadlinc(pb)); /* *dest++ = *pb++; */
}
}
-
+
}
if(srcheight < maxheight) {
for(; i < maxheight; i++) {
@@ -1115,7 +1142,7 @@ SiS300LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
sis300SetCursorAddress(cursor_addr);
if(status1) sis300SetCursorStatus(status1)
-
+
if(pSiS->VBFlags & CRT2_ENABLE) {
if((!pSiS->UseHWARGBCursor) && (!pSiS->VBFlags & DISPTYPE_CRT1)) {
status2 = sis301GetCursorStatus;
@@ -1175,14 +1202,14 @@ static void SiS310LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
if(srcwidth > 64) srcwidth = 64;
if(srcheight > 64) srcheight = 64;
-
+
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode)
- /* Use the global (real) FbBase in DHM */
- dest = (CARD32 *)((UChar *)pSiSEnt->FbBase + (cursor_addr * 1024));
+ /* Use the global FbBase in DHM */
+ dest = (CARD32 *)((UChar *)pSiSEnt->RealFbBase + (cursor_addr * 1024));
else
#endif
- dest = (CARD32 *)((UChar *)pSiS->FbBase + (cursor_addr * 1024));
+ dest = (CARD32 *)((UChar *)pSiS->RealFbBase + (cursor_addr * 1024));
if(sizedouble) {
if(srcheight > 32) srcheight = 32;
@@ -1211,7 +1238,7 @@ static void SiS310LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
}
}
}
-
+
if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) {
if(!pSiS->UseHWARGBCursor) {
if(pSiS->VBFlags & DISPTYPE_CRT1) {
@@ -1243,7 +1270,7 @@ static void SiS310LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
sis310SetCursorAddress(cursor_addr);
if(status1) sis310SetCursorStatus(status1)
-
+
if(pSiS->VBFlags & CRT2_ENABLE) {
if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) {
sis301SetCursorAddress310(cursor_addr)
@@ -1258,7 +1285,7 @@ static void SiS310LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs)
if(status2) sis301SetCursorStatus310(status2)
}
}
-
+
pSiS->UseHWARGBCursor = TRUE;
}
#endif
@@ -1278,7 +1305,7 @@ SiSHWCursorInit(ScreenPtr pScreen)
pSiS->CursorInfoPtr = infoPtr;
pSiS->UseHWARGBCursor = FALSE;
- switch (pSiS->Chipset) {
+ switch(pSiS->Chipset) {
case PCI_CHIP_SIS300:
case PCI_CHIP_SIS630:
case PCI_CHIP_SIS540:
@@ -1289,7 +1316,7 @@ SiSHWCursorInit(ScreenPtr pScreen)
infoPtr->SetCursorPosition = SiS300SetCursorPosition;
infoPtr->SetCursorColors = SiS300SetCursorColors;
infoPtr->LoadCursorImage = SiS300LoadCursorImage;
- infoPtr->UseHWCursor = SiS300UseHWCursor;
+ infoPtr->UseHWCursor = SiS300UseHWCursor;
#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,2,99,0,0)
#ifdef ARGB_CURSOR
#ifdef SIS_ARGB_CURSOR
@@ -1297,8 +1324,8 @@ SiSHWCursorInit(ScreenPtr pScreen)
infoPtr->UseHWCursorARGB = SiSUseHWCursorARGB;
infoPtr->LoadCursorARGB = SiS300LoadCursorImageARGB;
}
-#endif
-#endif
+#endif
+#endif
#endif
infoPtr->Flags =
HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
@@ -1309,11 +1336,11 @@ SiSHWCursorInit(ScreenPtr pScreen)
HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64;
break;
- 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:
@@ -1333,7 +1360,7 @@ SiSHWCursorInit(ScreenPtr pScreen)
infoPtr->LoadCursorARGB = SiS310LoadCursorImageARGB;
}
#endif
-#endif
+#endif
#endif
infoPtr->Flags =
HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
diff --git a/src/sis_dac.c b/src/sis_dac.c
index b794269..6ce6176 100644
--- a/src/sis_dac.c
+++ b/src/sis_dac.c
@@ -391,8 +391,7 @@ SiSSave(ScrnInfoPtr pScrn, SISRegPtr sisReg)
break;
default:
max=0x37;
- break;
- }
+ }
/* Save extended SR registers */
for(i = 0x00; i <= max; i++) {
@@ -452,7 +451,6 @@ SiSRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
break;
default:
max = 0x37;
- break;
}
/* Disable TV on 6326 before restoring */
@@ -489,7 +487,7 @@ SiSRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
SiS6326SetTVReg(pScrn, i, sisReg->sis6326tv[i]);
#ifdef TWDEBUG
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "VR%02x restored to %02x\n",
+ "VR%02x restored to %02x\n",
i, sisReg->sis6326tv[i]);
#endif
}
@@ -498,7 +496,7 @@ SiSRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
tmp = SiS6326GetXXReg(pScrn, 0x14);
SiS6326SetXXReg(pScrn, 0x14, 0xc8);
if(!(sisReg->sisRegs3C4[0x0D] & 0x04)) {
- tmp = SiS6326GetXXReg(pScrn, 0x13);
+ tmp = SiS6326GetXXReg(pScrn, 0x13);
SiS6326SetXXReg(pScrn, 0x13, 0xf6);
tmp = SiS6326GetXXReg(pScrn, 0x14);
SiS6326SetXXReg(pScrn, 0x14, 0xbf);
@@ -547,9 +545,9 @@ SiS300Save(ScrnInfoPtr pScrn, SISRegPtr sisReg)
sisReg->sisRegsPCIA0 = pciReadLong(0x00000000, 0xA0);
#ifdef TWDEBUG
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "PCI Config 50 = %lx\n", sisReg->sisRegsPCI50);
+ "PCI Config 50 = %lx\n", sisReg->sisRegsPCI50);
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "PCI Config A0 = %lx\n", sisReg->sisRegsPCIA0);
+ "PCI Config A0 = %lx\n", sisReg->sisRegsPCIA0);
#endif
}
@@ -572,7 +570,7 @@ SiS300Save(ScrnInfoPtr pScrn, SISRegPtr sisReg)
#ifdef TWDEBUG
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "BIOS mode ds:449 = 0x%x\n", sisReg->BIOSModeSave);
+ "BIOS mode ds:449 = 0x%x\n", sisReg->BIOSModeSave);
#endif
}
@@ -582,7 +580,7 @@ SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
{
SISPtr pSiS = SISPTR(pScrn);
int i,temp;
- CARD32 temp1;
+ CARD32 temp1, temp2;
PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, "SiS300Restore()\n"));
@@ -600,11 +598,11 @@ SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
if(!(pSiS->UseVESA)) {
if(pSiS->VBFlags & VB_LVDS) {
- SiSRegInit(pSiS->SiS_Pr, pSiS->RelIO + 0x30);
+ SiSRegInit(pSiS->SiS_Pr, pSiS->RelIO + 0x30);
SiSSetLVDSetc(pSiS->SiS_Pr, &pSiS->sishw_ext, 0);
SiS_GetVBType(pSiS->SiS_Pr, &pSiS->sishw_ext);
- SiS_UnLockCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext);
- SiS_DisableBridge(pSiS->SiS_Pr, &pSiS->sishw_ext);
+ SiS_UnLockCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext);
+ SiS_DisableBridge(pSiS->SiS_Pr, &pSiS->sishw_ext);
}
}
@@ -620,7 +618,7 @@ SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
outSISIDXREG(SISCR, 0x1A, sisReg->sisRegs3D4[0x19]);
inSISIDXREG(SISCR,0x19,val);
if(val == sisReg->sisRegs3D4[0x1A])
- outSISIDXREG(SISCR, 0x19, sisReg->sisRegs3D4[0x1A]);
+ outSISIDXREG(SISCR, 0x19, sisReg->sisRegs3D4[0x1A]);
}
/* Set (and leave) PCI_IO_ENABLE on if accelerators are on */
@@ -642,10 +640,10 @@ SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
for(i = 0x06; i <= 0x3D; i++) {
temp = sisReg->sisRegs3C4[i];
if(!(pSiS->UseVESA)) {
- if(pSiS->VBFlags & VB_LVDS) {
- if(i == 0x11) {
- inSISIDXREG(SISSR,0x11,temp);
- temp &= 0x0c;
+ if(pSiS->VBFlags & VB_LVDS) {
+ if(i == 0x11) {
+ inSISIDXREG(SISSR,0x11,temp);
+ temp &= 0x0c;
temp |= (sisReg->sisRegs3C4[i] & 0xf3);
}
}
@@ -686,24 +684,20 @@ SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
/* Restore FQBQ and GUI timer settings */
if(pSiS->Chipset == PCI_CHIP_SIS630) {
temp1 = pciReadLong(0x00000000, 0x50);
+ temp2 = pciReadLong(0x00000000, 0xA0);
if(pciReadLong(0x00000000, 0x00) == 0x06301039) {
temp1 &= 0xf0ffffff;
temp1 |= (sisReg->sisRegsPCI50 & ~0xf0ffffff);
+ temp2 &= 0xf0ffffff;
+ temp2 |= (sisReg->sisRegsPCIA0 & ~0xf0ffffff);
} else { /* 730 */
temp1 &= 0xfffff9ff;
temp1 |= (sisReg->sisRegsPCI50 & ~0xfffff9ff);
+ temp2 &= 0x00ffffff;
+ temp2 |= (sisReg->sisRegsPCIA0 & ~0x00ffffff);
}
pciWriteLong(0x00000000, 0x50, temp1);
-
- temp1 = pciReadLong(0x00000000, 0xA0);
- if(pciReadLong(0x00000000, 0x00) == 0x06301039) {
- temp1 &= 0xf0ffffff;
- temp1 |= (sisReg->sisRegsPCIA0 & ~0xf0ffffff);
- } else { /* 730 */
- temp1 &= 0x00ffffff;
- temp1 |= (sisReg->sisRegsPCIA0 & ~0x00ffffff);
- }
- pciWriteLong(0x00000000, 0xA0, temp1);
+ pciWriteLong(0x00000000, 0xA0, temp2);
}
/* Restore panel link/video bridge registers */
@@ -817,7 +811,7 @@ SiS315Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
/* Wait for accelerator to finish on-going drawing operations. */
inSISIDXREG(SISSR, 0x1E, temp);
- if(temp & (0x40|0x10|0x02)) { /* 0x40 = 2D, 0x10 = 3D enabled*/
+ if(temp & (0x40|0x10|0x02)) { /* 0x40 = 2D, 0x02 = 3D enabled*/
while ( (SIS_MMIO_IN32(pSiS->IOBase, 0x85CC) & 0x80000000) != 0x80000000){};
while ( (SIS_MMIO_IN32(pSiS->IOBase, 0x85CC) & 0x80000000) != 0x80000000){};
while ( (SIS_MMIO_IN32(pSiS->IOBase, 0x85CC) & 0x80000000) != 0x80000000){};
@@ -830,7 +824,7 @@ SiS315Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
* uses.
*/
andSISIDXREG(SISCR, 0x55, 0x33);
- outSISIDXREG(SISSR, 0x26, 0x01);
+ orSISIDXREG(SISSR, 0x26, 0x01);
outSISIDXREG(SISSR, 0x27, 0x1F);
/* Restore extended CR registers */
@@ -843,12 +837,12 @@ 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] & 0x52) { /* 0x40=2D, 0x02=3D */
sisReg->sisRegs3C4[0x20] |= 0x20;
outSISIDXREG(SISSR, 0x20, sisReg->sisRegs3C4[0x20]);
}
- if(pSiS->sishw_ext.jChipType >= SIS_661) {
+ if(pSiS->SiS_Pr->SiS_SensibleSR11) {
sisReg->sisRegs3C4[0x11] &= 0x0f;
}
@@ -1307,52 +1301,52 @@ SiSMclk(SISPtr pSiS)
case PCI_CHIP_SIS660:
case PCI_CHIP_SIS340:
- /* Numerator */
+ /* Numerator */
inSISIDXREG(SISSR, 0x28, Num);
- mclk = 14318 * ((Num & 0x7f) + 1);
+ mclk = 14318 * ((Num & 0x7f) + 1);
- /* Denumerator */
+ /* Denumerator */
inSISIDXREG(SISSR, 0x29, Denum);
- mclk = mclk / ((Denum & 0x1f) + 1);
+ mclk = mclk / ((Denum & 0x1f) + 1);
- /* Divider */
- if((Num & 0x80) != 0) mclk *= 2;
+ /* Divider */
+ if((Num & 0x80) != 0) mclk *= 2;
- /* Post-Scaler */
- if((Denum & 0x80) == 0) {
- mclk = mclk / (((Denum & 0x60) >> 5) + 1);
- } else {
- mclk = mclk / ((((Denum & 0x60) >> 5) + 1) * 2);
- }
- break;
+ /* Post-Scaler */
+ if((Denum & 0x80) == 0) {
+ mclk = mclk / (((Denum & 0x60) >> 5) + 1);
+ } else {
+ mclk = mclk / ((((Denum & 0x60) >> 5) + 1) * 2);
+ }
+ break;
case PCI_CHIP_SIS5597:
case PCI_CHIP_SIS6326:
case PCI_CHIP_SIS530:
default:
- /* Numerator */
- inSISIDXREG(SISSR, 0x28, Num);
- mclk = 14318 * ((Num & 0x7f) + 1);
+ /* Numerator */
+ inSISIDXREG(SISSR, 0x28, Num);
+ mclk = 14318 * ((Num & 0x7f) + 1);
- /* Denumerator */
+ /* Denumerator */
inSISIDXREG(SISSR, 0x29, Denum);
- mclk = mclk / ((Denum & 0x1f) + 1);
+ mclk = mclk / ((Denum & 0x1f) + 1);
- /* Divider. Doesn't work on older cards */
+ /* Divider. Doesn't work on older cards */
if(pSiS->oldChipset >= OC_SIS5597) {
- if(Num & 0x80) mclk *= 2;
+ if(Num & 0x80) mclk *= 2;
}
- /* Post-scaler. Values' meaning depends on SR13 bit 7 */
+ /* Post-scaler. Values' meaning depends on SR13 bit 7 */
inSISIDXREG(SISSR, 0x13, Base);
- if((Base & 0x80) == 0) {
- mclk = mclk / (((Denum & 0x60) >> 5) + 1);
- } else {
- /* Values 00 and 01 are reserved */
- if ((Denum & 0x60) == 0x40) mclk /= 6;
- if ((Denum & 0x60) == 0x60) mclk /= 8;
- }
- break;
+ if((Base & 0x80) == 0) {
+ mclk = mclk / (((Denum & 0x60) >> 5) + 1);
+ } else {
+ /* Values 00 and 01 are reserved */
+ if ((Denum & 0x60) == 0x40) mclk /= 6;
+ if ((Denum & 0x60) == 0x60) mclk /= 8;
+ }
+ break;
}
return(mclk);
@@ -1371,10 +1365,10 @@ SiSMclk(SISPtr pSiS)
static int
SiSEstimateCRT2Clock(ScrnInfoPtr pScrn, Bool IsForMergedFBCRT2)
{
- SISPtr pSiS = SISPTR(pScrn);
+ SISPtr pSiS = SISPTR(pScrn);
if(pSiS->VBFlags & CRT2_LCD) {
- if(pSiS->VBLCDFlags & (VB_LCD_320x480 | VB_LCD_800x600 | VB_LCD_640x480)) {
+ if(pSiS->VBLCDFlags & (VB_LCD_320x480 | VB_LCD_800x600 | VB_LCD_640x480)) {
return 40000;
} else if(pSiS->VBLCDFlags & (VB_LCD_1024x768 | VB_LCD_1024x600 | VB_LCD_1152x768)) {
return 65000;
@@ -1411,16 +1405,16 @@ SiSEstimateCRT2Clock(ScrnInfoPtr pScrn, Bool IsForMergedFBCRT2)
if(pSiS->VBFlags & VB_CHRONTEL) {
switch(pSiS->VGAEngine) {
case SIS_300_VGA:
- return 50000;
+ return 50000;
case SIS_315_VGA:
default:
return 70000;
}
} else if(pSiS->VBFlags & VB_SISBRIDGE) {
if(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPR)
- return 75000;
+ return 75000;
else
- return 70000;
+ return 70000;
}
}
@@ -1430,12 +1424,12 @@ SiSEstimateCRT2Clock(ScrnInfoPtr pScrn, Bool IsForMergedFBCRT2)
/* Calculate the maximum dotclock */
int SiSMemBandWidth(ScrnInfoPtr pScrn, Bool IsForCRT2)
{
- SISPtr pSiS = SISPTR(pScrn);
+ SISPtr pSiS = SISPTR(pScrn);
#ifdef SISDUALHEAD
- SISEntPtr pSiSEnt = pSiS->entityPrivate;
+ SISEntPtr pSiSEnt = pSiS->entityPrivate;
#endif
- int bus = pSiS->BusWidth;
- int mclk = pSiS->MemClock;
+ int bus = pSiS->BusWidth;
+ int mclk = pSiS->MemClock;
int bpp = pSiS->CurrentLayout.bitsPerPixel;
int max = 0;
float magic = 0.0, total;
@@ -1446,23 +1440,23 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, Bool IsForCRT2)
#ifdef __SUNPRO_C
#define const
#endif
- const float magicDED[4] = { 1.2, 1.368421, 2.263158, 1.2};
- const float magicINT[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
- switch(pSiS->Chipset) {
+ switch(pSiS->Chipset) {
- case PCI_CHIP_SIS5597:
- total = ((mclk * (bus / 8)) * 0.7) / bytesperpixel;
+ case PCI_CHIP_SIS5597:
+ total = ((mclk * (bus / 8)) * 0.7) / bytesperpixel;
if(total > 135000) total = 135000;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"Maximum pixel clock at %d bpp is %g MHz\n",
bpp, total/1000);
- return(int)(total);
+ return(int)(total);
- case PCI_CHIP_SIS6326:
+ case PCI_CHIP_SIS6326:
total = ((mclk * (bus / 8)) * 0.7) / bytesperpixel;
if(total > 175500) total = 175500;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
@@ -1470,17 +1464,17 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, Bool IsForCRT2)
bpp, total/1000);
return(int)(total);
- case PCI_CHIP_SIS530:
- total = ((mclk * (bus / 8)) * 0.7) / bytesperpixel;
+ case PCI_CHIP_SIS530:
+ total = ((mclk * (bus / 8)) * 0.7) / bytesperpixel;
if(total > 230000) total = 230000;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"Maximum pixel clock at %d bpp is %g MHz\n",
bpp, total/1000);
return(int)(total);
- case PCI_CHIP_SIS300:
- case PCI_CHIP_SIS540:
- case PCI_CHIP_SIS630:
+ case PCI_CHIP_SIS300:
+ case PCI_CHIP_SIS540:
+ case PCI_CHIP_SIS630:
case PCI_CHIP_SIS315:
case PCI_CHIP_SIS315H:
case PCI_CHIP_SIS315PRO:
@@ -1489,16 +1483,16 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, Bool IsForCRT2)
case PCI_CHIP_SIS330:
case PCI_CHIP_SIS660:
case PCI_CHIP_SIS340:
- switch(pSiS->Chipset) {
- case PCI_CHIP_SIS300:
- magic = magicDED[bus/64];
+ switch(pSiS->Chipset) {
+ case PCI_CHIP_SIS300:
+ magic = magicDED[bus/64];
max = 540000;
- break;
- case PCI_CHIP_SIS540:
- case PCI_CHIP_SIS630:
+ break;
+ case PCI_CHIP_SIS540:
+ case PCI_CHIP_SIS630:
magic = magicINT[bus/64];
max = 540000;
- break;
+ break;
case PCI_CHIP_SIS315:
case PCI_CHIP_SIS315H:
case PCI_CHIP_SIS315PRO:
@@ -1508,7 +1502,7 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, Bool IsForCRT2)
break;
case PCI_CHIP_SIS550:
magic = magicINT[bus/64];
- max = 620000;
+ max = 610000;
break;
case PCI_CHIP_SIS650:
magic = magicINT[bus/64];
@@ -1516,27 +1510,27 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, Bool IsForCRT2)
break;
case PCI_CHIP_SIS660:
if((pSiS->sishw_ext.jChipType >= SIS_660) &&
- (!(pSiS->ChipFlags & SiSCF_760UMA))) {
+ (pSiS->ChipFlags & SiSCF_760LFB)) {
magic = magicDED[bus/64];
} else {
magic = magicINT[bus/64];
}
- max = 800000;
+ max = 680000;
case PCI_CHIP_SIS340:
magic = magicDED[bus/64];
max = 800000;
break;
- }
+ }
- PDEBUG(ErrorF("mclk: %d, bus: %d, magic: %g, bpp: %d\n",
- mclk, bus, magic, bpp));
+ PDEBUG(ErrorF("mclk: %d, bus: %d, magic: %g, bpp: %d\n",
+ mclk, bus, magic, bpp));
- total = mclk * bus / bpp;
+ total = mclk * bus / bpp;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"Memory bandwidth at %d bpp is %g MHz\n", bpp, total/1000);
- if((pSiS->VBFlags & CRT2_ENABLE) && (!pSiS->CRT1off)) {
+ if((pSiS->VBFlags & CRT2_ENABLE) && (!pSiS->CRT1off)) {
maxcrt2 = 135000;
if(pSiS->VBFlags & (VB_301B|VB_302B)) maxcrt2 = 162000;
@@ -1568,12 +1562,12 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, Bool IsForCRT2)
if(DHM) {
- if(!GetForCRT1) {
+ if(!GetForCRT1) {
/* First head = CRT2 */
if(crt2clock) {
- /* We use the mem bandwidth as max clock; this
+ /* 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
@@ -1582,16 +1576,16 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, Bool IsForCRT2)
* The "* macic" is just to compensate the
* calculation below.
*/
- total = crt2used * magic;
+ total = crt2used * magic;
} else {
- /* We don't know about the second head's
+ /* We don't know about the second head's
* depth yet. So we assume it uses the
- * same. But since the maximum dotclock
+ * same. But since the maximum dotclock
* is limited on CRT2, we can assume a
* maximum here.
- */
- if((total / 2) > (maxcrt2 + 2000)) {
+ */
+ if((total / 2) > (maxcrt2 + 2000)) {
total = (maxcrt2 + 2000) * magic;
crt2used = maxcrt2 + 2000;
} else {
@@ -1599,10 +1593,10 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, Bool IsForCRT2)
crt2used = total;
}
- }
+ }
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Bandwidth reserved for CRT2 is %g Mhz\n",
+ "Bandwidth reserved for CRT2 is %g MHz\n",
crt2used/1000);
} else {
@@ -1614,21 +1608,21 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, Bool IsForCRT2)
*/
if(crt2clock) {
- total -= (crt2used * pSiSEnt->pScrn_1->bitsPerPixel / bpp);
+ total -= (crt2used * pSiSEnt->pScrn_1->bitsPerPixel / bpp);
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Bandwidth reserved for CRT2 at %d bpp is %g Mhz\n",
+ "Bandwidth reserved for CRT2 at %d bpp is %g Mhz\n",
bpp,
(crt2used * pSiSEnt->pScrn_1->bitsPerPixel / bpp)/1000);
} else {
- total -= (pSiSEnt->maxUsedClock * pSiSEnt->pScrn_1->bitsPerPixel / bpp);
+ total -= (pSiSEnt->maxUsedClock * pSiSEnt->pScrn_1->bitsPerPixel / bpp);
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Bandwidth reserved for CRT2 at %d bpp is %d Mhz\n",
+ "Bandwidth reserved for CRT2 at %d bpp is %d Mhz\n",
bpp,
(pSiSEnt->maxUsedClock * pSiSEnt->pScrn_1->bitsPerPixel / bpp)/1000);
}
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Bandwidth available for CRT1 is %g MHz\n", total/1000);
+ "Bandwidth available for CRT1 is %g MHz\n", total/1000);
#endif
}
@@ -1638,29 +1632,29 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, Bool IsForCRT2)
total -= crt2used;
} else {
if((total / 2) > (maxcrt2 + 2000)) {
- total -= (maxcrt2 + 2000);
+ total -= (maxcrt2 + 2000);
crt2used = maxcrt2 + 2000;
} else {
- total /= 2;
+ total /= 2;
crt2used = total;
}
}
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Bandwidth reserved for CRT2 is %g Mhz\n", crt2used/1000);
+ "Bandwidth reserved for CRT2 is %g Mhz\n", crt2used/1000);
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"Bandwidth available for CRT1 is %g MHz\n", total/1000);
- }
+ }
- }
+ }
total /= magic;
if(total > (max / 2)) total = max / 2;
- return(int)(total);
+ return(int)(total);
default:
- return(135000);
+ return(135000);
}
}
@@ -1689,11 +1683,13 @@ SISLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
if(pSiS->DualHeadMode) dogamma1 = pSiSEnt->CRT1gamma;
#endif
+ PDEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "LoadPalette()\n"));
+
#ifdef SISDUALHEAD
if((!pSiS->DualHeadMode) || (pSiS->SecondHead)) {
#endif
- if(pSiS->VGAEngine == SIS_315_VGA) {
+ if(pSiS->VGAEngine == SIS_315_VGA) {
inSISIDXREG(SISSR, 0x1f, backup);
andSISIDXREG(SISSR, 0x1f, 0xe7);
if( (pSiS->XvGamma) &&
@@ -1703,110 +1699,110 @@ SISLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
orSISIDXREG(SISSR, 0x1f, 0x10);
resetxvgamma = TRUE;
}
- }
+ }
- switch(pSiS->CurrentLayout.depth) {
- case 15:
+ switch(pSiS->CurrentLayout.depth) {
+ case 15:
if(dogamma1) {
- orSISIDXREG(SISSR, 0x07, 0x04);
+ orSISIDXREG(SISSR, 0x07, 0x04);
/* 315/330: depth 15 not supported, no MMIO code needed */
- for(i=0; i<numColors; i++) {
- index = indices[i];
+ for(i=0; i<numColors; i++) {
+ index = indices[i];
if(index < 32) { /* Paranoia */
for(j=0; j<8; j++) {
- outSISREG(SISCOLIDX, (index << 3) + j);
- outSISREG(SISCOLDATA, colors[index].red << myshift);
- outSISREG(SISCOLDATA, colors[index].green << myshift);
- outSISREG(SISCOLDATA, colors[index].blue << myshift);
+ outSISREG(SISCOLIDX, (index << 3) + j);
+ outSISREG(SISCOLDATA, colors[index].red << myshift);
+ outSISREG(SISCOLDATA, colors[index].green << myshift);
+ outSISREG(SISCOLDATA, colors[index].blue << myshift);
}
}
- }
+ }
} else {
- andSISIDXREG(SISSR, 0x07, ~0x04);
+ andSISIDXREG(SISSR, 0x07, ~0x04);
}
break;
case 16:
if(dogamma1) {
- orSISIDXREG(SISSR, 0x07, 0x04);
+ orSISIDXREG(SISSR, 0x07, 0x04);
if(pSiS->ChipFlags & SiSCF_MMIOPalette) {
for(i=0; i<numColors; i++) {
- index = indices[i];
+ index = indices[i];
if(index < 64) { /* Paranoia */
- for(j=0; j<4; j++) {
+ for(j=0; j<4; j++) {
SIS_MMIO_OUT32(pSiS->IOBase, 0x8570,
- (colors[index].green << (myshift + 8)) |
- (colors[index >> 1].blue << (myshift + 16)) |
- (colors[index >> 1].red << myshift) |
+ (colors[index].green << (myshift + 8)) |
+ (colors[index >> 1].blue << (myshift + 16)) |
+ (colors[index >> 1].red << myshift) |
(((index << 2) + j) << 24));
- }
+ }
}
- }
+ }
} else {
- for(i=0; i<numColors; i++) {
- index = indices[i];
+ for(i=0; i<numColors; i++) {
+ index = indices[i];
if(index < 64) { /* Paranoia */
- for(j=0; j<4; j++) {
- outSISREG(SISCOLIDX, (index << 2) + j);
- outSISREG(SISCOLDATA, colors[index >> 1].red << myshift);
- outSISREG(SISCOLDATA, colors[index].green << myshift);
- outSISREG(SISCOLDATA, colors[index >> 1].blue << myshift);
- }
+ for(j=0; j<4; j++) {
+ outSISREG(SISCOLIDX, (index << 2) + j);
+ outSISREG(SISCOLDATA, colors[index >> 1].red << myshift);
+ outSISREG(SISCOLDATA, colors[index].green << myshift);
+ outSISREG(SISCOLDATA, colors[index >> 1].blue << myshift);
+ }
}
- }
+ }
}
} else {
- andSISIDXREG(SISSR, 0x07, ~0x04);
+ andSISIDXREG(SISSR, 0x07, ~0x04);
}
break;
case 24:
if(dogamma1) {
- orSISIDXREG(SISSR, 0x07, 0x04);
+ orSISIDXREG(SISSR, 0x07, 0x04);
if(pSiS->ChipFlags & SiSCF_MMIOPalette) {
for(i=0; i<numColors; i++) {
- index = indices[i];
+ index = indices[i];
if(index < 256) { /* Paranoia */
- SIS_MMIO_OUT32(pSiS->IOBase, 0x8570,
- (colors[index].blue << 16) |
+ SIS_MMIO_OUT32(pSiS->IOBase, 0x8570,
+ (colors[index].blue << 16) |
(colors[index].green << 8) |
(colors[index].red) |
- (index << 24));
+ (index << 24));
}
}
} else {
- for(i=0; i<numColors; i++) {
- index = indices[i];
+ for(i=0; i<numColors; i++) {
+ index = indices[i];
if(index < 256) { /* Paranoia */
- outSISREG(SISCOLIDX, index);
- outSISREG(SISCOLDATA, colors[index].red);
- outSISREG(SISCOLDATA, colors[index].green);
- outSISREG(SISCOLDATA, colors[index].blue);
+ outSISREG(SISCOLIDX, index);
+ outSISREG(SISCOLDATA, colors[index].red);
+ outSISREG(SISCOLDATA, colors[index].green);
+ outSISREG(SISCOLDATA, colors[index].blue);
}
- }
+ }
}
} else {
- andSISIDXREG(SISSR, 0x07, ~0x04);
+ andSISIDXREG(SISSR, 0x07, ~0x04);
}
break;
default:
andSISIDXREG(SISSR, 0x07, ~0x04);
if(pSiS->ChipFlags & SiSCF_MMIOPalette) {
for(i=0; i<numColors; i++) {
- index = indices[i];
+ index = indices[i];
SIS_MMIO_OUT32(pSiS->IOBase, 0x8570,
- ((colors[index].blue) << 16) |
+ ((colors[index].blue) << 16) |
((colors[index].green) << 8) |
(colors[index].red) |
(index << 24));
}
} else {
- for(i=0; i<numColors; i++) {
+ for(i=0; i<numColors; i++) {
/* In pio mode, only 6 bits are supported */
- index = indices[i];
- outSISREG(SISCOLIDX, index);
- outSISREG(SISCOLDATA, colors[index].red >> 2);
- outSISREG(SISCOLDATA, colors[index].green >> 2);
- outSISREG(SISCOLDATA, colors[index].blue >> 2);
- }
+ index = indices[i];
+ outSISREG(SISCOLIDX, index);
+ outSISREG(SISCOLDATA, colors[index].red >> 2);
+ outSISREG(SISCOLDATA, colors[index].green >> 2);
+ outSISREG(SISCOLDATA, colors[index].blue >> 2);
+ }
}
}
@@ -1828,13 +1824,13 @@ SISLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
switch(pSiS->VGAEngine) {
case SIS_300_VGA:
case SIS_315_VGA:
- if(pSiS->VBFlags & CRT2_ENABLE) {
+ if(pSiS->VBFlags & CRT2_ENABLE) {
/* Only the SiS bridges support a CRT2 palette */
if(pSiS->VBFlags & VB_SISBRIDGE) {
- if((pSiS->CRT2SepGamma) && (pSiS->crt2cindices) && (pSiS->crt2colors)) {
+ if((pSiS->CRT2SepGamma) && (pSiS->crt2cindices) && (pSiS->crt2colors)) {
SiS301LoadPalette(pScrn, numColors, pSiS->crt2cindices, pSiS->crt2colors, myshift);
} else {
- SiS301LoadPalette(pScrn, numColors, indices, colors, myshift);
+ SiS301LoadPalette(pScrn, numColors, indices, colors, myshift);
}
}
}
@@ -1863,11 +1859,11 @@ SiS_UpdateGammaCRT2(ScrnInfoPtr pScrn)
static void
SiS301LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, int myshift)
{
- SISPtr pSiS = SISPTR(pScrn);
- int i, j, index;
+ SISPtr pSiS = SISPTR(pScrn);
+ int i, j, index;
Bool dogamma2 = pSiS->CRT2gamma;
#ifdef SISDUALHEAD
- SISEntPtr pSiSEnt = pSiS->entityPrivate;
+ SISEntPtr pSiSEnt = pSiS->entityPrivate;
if(pSiS->DualHeadMode) dogamma2 = pSiSEnt->CRT2gamma;
#endif
@@ -1878,64 +1874,64 @@ SiS301LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
switch(pSiS->CurrentLayout.depth) {
case 15:
if(dogamma2) {
- orSISIDXREG(SISPART4, 0x0d, 0x08);
- for(i=0; i<numColors; i++) {
- index = indices[i];
+ orSISIDXREG(SISPART4, 0x0d, 0x08);
+ for(i=0; i<numColors; i++) {
+ index = indices[i];
if(index < 32) { /* Paranoia */
for(j=0; j<8; j++) {
- outSISREG(SISCOL2IDX, (index << 3) + j);
- outSISREG(SISCOL2DATA, colors[index].red << myshift);
- outSISREG(SISCOL2DATA, colors[index].green << myshift);
- outSISREG(SISCOL2DATA, colors[index].blue << myshift);
+ outSISREG(SISCOL2IDX, (index << 3) + j);
+ outSISREG(SISCOL2DATA, colors[index].red << myshift);
+ outSISREG(SISCOL2DATA, colors[index].green << myshift);
+ outSISREG(SISCOL2DATA, colors[index].blue << myshift);
}
}
- }
+ }
} else {
- andSISIDXREG(SISPART4, 0x0d, ~0x08);
+ andSISIDXREG(SISPART4, 0x0d, ~0x08);
}
break;
case 16:
if(dogamma2) {
- orSISIDXREG(SISPART4, 0x0d, 0x08);
- for(i = 0; i < numColors; i++) {
- index = indices[i];
+ orSISIDXREG(SISPART4, 0x0d, 0x08);
+ for(i = 0; i < numColors; i++) {
+ index = indices[i];
if(index < 64) { /* Paranoia */
for(j = 0; j < 4; j++) {
- outSISREG(SISCOL2IDX, (index << 2) + j);
- outSISREG(SISCOL2DATA, colors[index >> 1].red << myshift);
- outSISREG(SISCOL2DATA, colors[index].green << myshift);
- outSISREG(SISCOL2DATA, colors[index >> 1].blue << myshift);
+ outSISREG(SISCOL2IDX, (index << 2) + j);
+ outSISREG(SISCOL2DATA, colors[index >> 1].red << myshift);
+ outSISREG(SISCOL2DATA, colors[index].green << myshift);
+ outSISREG(SISCOL2DATA, colors[index >> 1].blue << myshift);
}
}
- }
+ }
} else {
- andSISIDXREG(SISPART4, 0x0d, ~0x08);
+ andSISIDXREG(SISPART4, 0x0d, ~0x08);
}
break;
case 24:
if(dogamma2) {
- orSISIDXREG(SISPART4, 0x0d, 0x08);
- for(i = 0; i < numColors; i++) {
- index = indices[i];
+ orSISIDXREG(SISPART4, 0x0d, 0x08);
+ for(i = 0; i < numColors; i++) {
+ index = indices[i];
if(index < 256) { /* Paranoia */
- outSISREG(SISCOL2IDX, index);
- outSISREG(SISCOL2DATA, colors[index].red);
- outSISREG(SISCOL2DATA, colors[index].green);
- outSISREG(SISCOL2DATA, colors[index].blue);
+ outSISREG(SISCOL2IDX, index);
+ outSISREG(SISCOL2DATA, colors[index].red);
+ outSISREG(SISCOL2DATA, colors[index].green);
+ outSISREG(SISCOL2DATA, colors[index].blue);
}
- }
+ }
} else {
- andSISIDXREG(SISPART4, 0x0d, ~0x08);
+ andSISIDXREG(SISPART4, 0x0d, ~0x08);
}
break;
default:
orSISIDXREG(SISPART4, 0x0d, 0x08);
- for(i = 0; i < numColors; i++) {
- index = indices[i];
- outSISREG(SISCOL2IDX, index);
- outSISREG(SISCOL2DATA, colors[index].red);
- outSISREG(SISCOL2DATA, colors[index].green);
- outSISREG(SISCOL2DATA, colors[index].blue);
+ for(i = 0; i < numColors; i++) {
+ index = indices[i];
+ outSISREG(SISCOL2IDX, index);
+ outSISREG(SISCOL2DATA, colors[index].red);
+ outSISREG(SISCOL2DATA, colors[index].green);
+ outSISREG(SISCOL2DATA, colors[index].blue);
}
}
}
@@ -1948,30 +1944,30 @@ SISDACPreInit(ScrnInfoPtr pScrn)
pSiS->MaxClock = SiSMemBandWidth(pScrn, FALSE);
switch (pSiS->Chipset) {
- case PCI_CHIP_SIS550:
- case PCI_CHIP_SIS315:
- case PCI_CHIP_SIS315H:
- case PCI_CHIP_SIS315PRO:
- case PCI_CHIP_SIS650:
- case PCI_CHIP_SIS330:
- case PCI_CHIP_SIS660:
- case PCI_CHIP_SIS340:
- pSiS->SiSSave = SiS315Save;
- pSiS->SiSRestore = SiS315Restore;
- break;
- case PCI_CHIP_SIS300:
- case PCI_CHIP_SIS540:
- case PCI_CHIP_SIS630:
- pSiS->SiSSave = SiS300Save;
- pSiS->SiSRestore = SiS300Restore;
- break;
- case PCI_CHIP_SIS5597:
- case PCI_CHIP_SIS6326:
- case PCI_CHIP_SIS530:
- default:
- pSiS->SiSSave = SiSSave;
- pSiS->SiSRestore = SiSRestore;
- break;
+ case PCI_CHIP_SIS550:
+ case PCI_CHIP_SIS315:
+ case PCI_CHIP_SIS315H:
+ case PCI_CHIP_SIS315PRO:
+ case PCI_CHIP_SIS650:
+ case PCI_CHIP_SIS330:
+ case PCI_CHIP_SIS660:
+ case PCI_CHIP_SIS340:
+ pSiS->SiSSave = SiS315Save;
+ pSiS->SiSRestore = SiS315Restore;
+ break;
+ case PCI_CHIP_SIS300:
+ case PCI_CHIP_SIS540:
+ case PCI_CHIP_SIS630:
+ pSiS->SiSSave = SiS300Save;
+ pSiS->SiSRestore = SiS300Restore;
+ break;
+ case PCI_CHIP_SIS5597:
+ case PCI_CHIP_SIS6326:
+ case PCI_CHIP_SIS530:
+ default:
+ pSiS->SiSSave = SiSSave;
+ pSiS->SiSRestore = SiSRestore;
+ break;
}
}
diff --git a/src/sis_dac.h b/src/sis_dac.h
index d0d68e2..4b5b9f9 100644
--- a/src/sis_dac.h
+++ b/src/sis_dac.h
@@ -43,37 +43,37 @@ int SiSMclk(SISPtr pSiS);
void SiSRestoreBridge(ScrnInfoPtr pScrn, SISRegPtr sisReg);
void SiS_UpdateGammaCRT2(ScrnInfoPtr pScrn);
-extern void SiS6326SetTVReg(ScrnInfoPtr pScrn, CARD8 index, CARD8 data);
-extern UChar SiS6326GetTVReg(ScrnInfoPtr pScrn, CARD8 index);
-extern void SiS6326SetXXReg(ScrnInfoPtr pScrn, CARD8 index, CARD8 data);
-extern UChar SiS6326GetXXReg(ScrnInfoPtr pScrn, CARD8 index);
+extern void SiS6326SetTVReg(ScrnInfoPtr pScrn, CARD8 index, CARD8 data);
+extern UChar SiS6326GetTVReg(ScrnInfoPtr pScrn, CARD8 index);
+extern void SiS6326SetXXReg(ScrnInfoPtr pScrn, CARD8 index, CARD8 data);
+extern UChar SiS6326GetXXReg(ScrnInfoPtr pScrn, CARD8 index);
-extern int SiSCalcVRate(DisplayModePtr mode);
+extern float SiSCalcVRate(DisplayModePtr mode);
-extern void SISCalculateGammaRampCRT2(ScrnInfoPtr pScrn);
+extern void SISCalculateGammaRampCRT2(ScrnInfoPtr pScrn);
/* Functions from init.c and init301.c (use their datatypes!) */
-extern void SiS_UnLockCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO);
-extern void SiS_LockCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO);
-extern void SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO);
-extern void SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO);
-extern USHORT SiS_GetCH700x(SiS_Private *SiS_Pr, USHORT tempbx);
-extern void SiS_SetCH700x(SiS_Private *SiS_Pr, USHORT tempbx);
-extern USHORT SiS_GetCH701x(SiS_Private *SiS_Pr, USHORT tempbx);
-extern void SiS_SetCH701x(SiS_Private *SiS_Pr, USHORT tempbx);
-extern USHORT SiS_GetCH70xx(SiS_Private *SiS_Pr, USHORT tempbx);
-extern void SiS_SetCH70xx(SiS_Private *SiS_Pr, USHORT tempbx);
-extern void SiS_SetCH70xxANDOR(SiS_Private *SiS_Pr, USHORT tempax, USHORT tempbh);
-extern void SiS_DDC2Delay(SiS_Private *SiS_Pr, USHORT delaytime);
-extern USHORT SiS_ReadDDC1Bit(SiS_Private *SiS_Pr);
-extern USHORT SiS_HandleDDC(SiS_Private *SiS_Pr, ULONG VBFlags, int VGAEngine,
+extern void SiS_UnLockCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO);
+extern void SiS_LockCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO);
+extern void SiS_DisableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO);
+extern void SiS_EnableBridge(SiS_Private *SiS_Pr, PSIS_HW_INFO);
+extern USHORT SiS_GetCH700x(SiS_Private *SiS_Pr, USHORT tempbx);
+extern void SiS_SetCH700x(SiS_Private *SiS_Pr, USHORT tempbx);
+extern USHORT SiS_GetCH701x(SiS_Private *SiS_Pr, USHORT tempbx);
+extern void SiS_SetCH701x(SiS_Private *SiS_Pr, USHORT tempbx);
+extern USHORT SiS_GetCH70xx(SiS_Private *SiS_Pr, USHORT tempbx);
+extern void SiS_SetCH70xx(SiS_Private *SiS_Pr, USHORT tempbx);
+extern void SiS_SetCH70xxANDOR(SiS_Private *SiS_Pr, USHORT tempax, USHORT tempbh);
+extern void SiS_DDC2Delay(SiS_Private *SiS_Pr, USHORT delaytime);
+extern USHORT SiS_ReadDDC1Bit(SiS_Private *SiS_Pr);
+extern USHORT SiS_HandleDDC(SiS_Private *SiS_Pr, ULONG VBFlags, int VGAEngine,
USHORT adaptnum, USHORT DDCdatatype, UCHAR *buffer);
-extern void SiS_SetChrontelGPIO(SiS_Private *SiS_Pr, USHORT myvbinfo);
-extern void SiS_DisplayOn(SiS_Private *SiS_Pr);
+extern void SiS_SetChrontelGPIO(SiS_Private *SiS_Pr, USHORT myvbinfo);
+extern void SiS_DisplayOn(SiS_Private *SiS_Pr);
extern UCHAR SiS_GetSetModeID(ScrnInfoPtr pScrn, UCHAR id);
-extern void SiS_SetEnableDstn(SiS_Private *SiS_Pr, int enable);
-extern void SiS_SetEnableFstn(SiS_Private *SiS_Pr, int enable);
+extern void SiS_SetEnableDstn(SiS_Private *SiS_Pr, int enable);
+extern void SiS_SetEnableFstn(SiS_Private *SiS_Pr, int enable);
extern void SiSRegInit(SiS_Private *SiS_Pr, USHORT BaseAddr);
-extern void SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwDeviceExtension, USHORT ModeNo);
-extern void SiS_GetVBType(SiS_Private *SiS_Pr, PSIS_HW_INFO);
+extern void SiSSetLVDSetc(SiS_Private *SiS_Pr, PSIS_HW_INFO HwDeviceExtension, USHORT ModeNo);
+extern void SiS_GetVBType(SiS_Private *SiS_Pr, PSIS_HW_INFO);
/* End of init.c/init301.c imports */
diff --git a/src/sis_dga.c b/src/sis_dga.c
index 94b46d2..67ee4c8 100644
--- a/src/sis_dga.c
+++ b/src/sis_dga.c
@@ -41,12 +41,12 @@
#include "sis_regs.h"
#ifndef NEW_DGAOPENFRAMEBUFFER
-static Bool SIS_OpenFramebuffer(ScrnInfoPtr, char **, UChar **,
+static Bool SIS_OpenFramebuffer(ScrnInfoPtr, char **, UChar **,
int *, int *, int *);
#else
static Bool SIS_OpenFramebuffer(ScrnInfoPtr, char **, unsigned int *,
unsigned int *, unsigned int *, unsigned int *);
-#endif
+#endif
static Bool SIS_SetMode(ScrnInfoPtr, DGAModePtr);
static void SIS_Sync(ScrnInfoPtr);
static int SIS_GetViewport(ScrnInfoPtr);
@@ -106,6 +106,46 @@ SISSetupDGAMode(
while(pMode) {
+#ifdef SISMERGED
+ if(pSiS->MergedFB) {
+ Bool nogood = FALSE;
+ /* Filter out all meta modes that would require driver-side panning */
+ switch(((SiSMergedDisplayModePtr)pMode->Private)->CRT2Position) {
+ case sisClone:
+ if( (((SiSMergedDisplayModePtr)pMode->Private)->CRT1->HDisplay !=
+ ((SiSMergedDisplayModePtr)pMode->Private)->CRT2->HDisplay) ||
+ (((SiSMergedDisplayModePtr)pMode->Private)->CRT1->VDisplay !=
+ ((SiSMergedDisplayModePtr)pMode->Private)->CRT2->VDisplay) ||
+ (((SiSMergedDisplayModePtr)pMode->Private)->CRT1->HDisplay !=
+ pMode->HDisplay) ||
+ (((SiSMergedDisplayModePtr)pMode->Private)->CRT1->VDisplay !=
+ pMode->VDisplay) )
+ nogood = TRUE;
+ break;
+ case sisRightOf:
+ case sisLeftOf:
+ if( (((SiSMergedDisplayModePtr)pMode->Private)->CRT1->VDisplay !=
+ ((SiSMergedDisplayModePtr)pMode->Private)->CRT2->VDisplay) ||
+ (((SiSMergedDisplayModePtr)pMode->Private)->CRT1->VDisplay != pMode->VDisplay) )
+ nogood = TRUE;
+ break;
+ default:
+ if( (((SiSMergedDisplayModePtr)pMode->Private)->CRT1->HDisplay !=
+ ((SiSMergedDisplayModePtr)pMode->Private)->CRT2->HDisplay) ||
+ (((SiSMergedDisplayModePtr)pMode->Private)->CRT1->HDisplay != pMode->HDisplay) )
+ nogood = TRUE;
+ }
+ if(nogood) {
+ if(depth == 16) { /* Print this only the first time */
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "DGA: MetaMode %dx%d not suitable for DGA, skipping\n",
+ pMode->HDisplay, pMode->VDisplay);
+ }
+ goto mode_nogood;
+ }
+ }
+#endif
+
otherPitch = secondPitch ? secondPitch : pMode->HDisplay;
if(pMode->HDisplay != otherPitch) {
@@ -192,6 +232,10 @@ SECOND_PASS:
currentMode->viewportHeight);
}
+#ifdef SISMERGED
+mode_nogood:
+#endif
+
pMode = pMode->next;
if(pMode == firstMode)
break;
@@ -219,9 +263,9 @@ SISDGAInit(ScreenPtr pScreen)
if(!(pSiS->MergedFB)) {
#endif
modes = SISSetupDGAMode(pScrn, modes, &num, 8, 8,
- (pScrn->bitsPerPixel == 8),
- ((pScrn->bitsPerPixel != 8)
- ? 0 : pScrn->displayWidth),
+ (pScrn->bitsPerPixel == 8),
+ ((pScrn->bitsPerPixel != 8)
+ ? 0 : pScrn->displayWidth),
0, 0, 0, PseudoColor);
#ifdef SISMERGED
}
@@ -240,9 +284,9 @@ SISDGAInit(ScreenPtr pScreen)
if((pSiS->VGAEngine == SIS_530_VGA) || (pSiS->VGAEngine == SIS_OLD_VGA)) {
/* 24 */
modes = SISSetupDGAMode(pScrn, modes, &num, 24, 24,
- (pScrn->bitsPerPixel == 24),
+ (pScrn->bitsPerPixel == 24),
((pScrn->bitsPerPixel != 24)
- ? 0 : pScrn->displayWidth),
+ ? 0 : pScrn->displayWidth),
0xff0000, 0x00ff00, 0x0000ff, TrueColor);
}
@@ -258,13 +302,19 @@ SISDGAInit(ScreenPtr pScreen)
pSiS->numDGAModes = num;
pSiS->DGAModes = modes;
- if((pSiS->VGAEngine == SIS_300_VGA) ||
- (pSiS->VGAEngine == SIS_315_VGA) ||
- (pSiS->VGAEngine == SIS_530_VGA)) {
- return DGAInit(pScreen, &SISDGAFuncs3xx, modes, num);
+ if(num) {
+ if((pSiS->VGAEngine == SIS_300_VGA) ||
+ (pSiS->VGAEngine == SIS_315_VGA) ||
+ (pSiS->VGAEngine == SIS_530_VGA)) {
+ return DGAInit(pScreen, &SISDGAFuncs3xx, modes, num);
+ } else {
+ return DGAInit(pScreen, &SISDGAFuncs, modes, num);
+ }
} else {
- return DGAInit(pScreen, &SISDGAFuncs, modes, num);
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "No DGA-suitable modes found, disabling DGA\n");
+ return TRUE;
+ }
}
static Bool
@@ -278,31 +328,31 @@ SIS_SetMode(
if(!pMode) { /* restore the original mode */
- if(pSiS->DGAactive) {
- /* put the ScreenParameters back */
+ if(pSiS->DGAactive) {
+ /* put the ScreenParameters back */
memcpy(&pSiS->CurrentLayout, &BackupLayouts[index], sizeof(SISFBLayout));
- }
+ }
pScrn->currentMode = pSiS->CurrentLayout.mode;
pSiS->DGAactive = FALSE;
- (*pScrn->SwitchMode)(index, pScrn->currentMode, 0);
+ (*pScrn->SwitchMode)(index, pScrn->currentMode, 0);
(*pScrn->AdjustFrame)(index, pScrn->frameX0, pScrn->frameY0, 0);
} else { /* set new mode */
if(!pSiS->DGAactive) {
/* save the old parameters */
- memcpy(&BackupLayouts[index], &pSiS->CurrentLayout, sizeof(SISFBLayout));
- pSiS->DGAactive = TRUE;
- }
+ memcpy(&BackupLayouts[index], &pSiS->CurrentLayout, sizeof(SISFBLayout));
+ pSiS->DGAactive = TRUE;
+ }
pSiS->CurrentLayout.bitsPerPixel = pMode->bitsPerPixel;
pSiS->CurrentLayout.depth = pMode->depth;
pSiS->CurrentLayout.displayWidth = pMode->bytesPerScanline / (pMode->bitsPerPixel >> 3);
- pSiS->CurrentLayout.displayHeight = pMode->imageHeight;
+ pSiS->CurrentLayout.displayHeight = pMode->imageHeight;
- (*pScrn->SwitchMode)(index, pMode->mode, 0);
+ (*pScrn->SwitchMode)(index, pMode->mode, 0);
/* Adjust viewport to 0/0 after mode switch */
/* This fixes the vmware-in-dualhead problems */
(*pScrn->AdjustFrame)(index, 0, 0, 0);
@@ -321,10 +371,10 @@ SIS_GetViewport(
return pSiS->DGAViewportStatus;
}
-static void
+static void
SIS_SetViewport(
ScrnInfoPtr pScrn,
- int x, int y,
+ int x, int y,
int flags
){
SISPtr pSiS = SISPTR(pScrn);
@@ -335,10 +385,10 @@ SIS_SetViewport(
pSiS->CurrentLayout.DGAViewportY = y;
}
-static void
+static void
SIS_FillRect (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
ULong color
){
SISPtr pSiS = SISPTR(pScrn);
@@ -350,7 +400,7 @@ SIS_FillRect (
}
}
-static void
+static void
SIS_Sync(
ScrnInfoPtr pScrn
){
@@ -361,11 +411,11 @@ SIS_Sync(
}
}
-static void
+static void
SIS_BlitRect(
- ScrnInfoPtr pScrn,
- int srcx, int srcy,
- int w, int h,
+ ScrnInfoPtr pScrn,
+ int srcx, int srcy,
+ int w, int h,
int dstx, int dsty
){
SISPtr pSiS = SISPTR(pScrn);
@@ -384,9 +434,9 @@ SIS_BlitRect(
static void
SIS_BlitTransRect(
- ScrnInfoPtr pScrn,
- int srcx, int srcy,
- int w, int h,
+ ScrnInfoPtr pScrn,
+ int srcx, int srcy,
+ int w, int h,
int dstx, int dsty,
ULong color
){
@@ -404,11 +454,11 @@ SIS_BlitTransRect(
}
}
-static Bool
+static Bool
SIS_OpenFramebuffer(
ScrnInfoPtr pScrn,
char **name,
-#ifndef NEW_DGAOPENFRAMEBUFFER
+#ifndef NEW_DGAOPENFRAMEBUFFER
UChar **mem,
int *size,
int *offset,
@@ -418,23 +468,23 @@ SIS_OpenFramebuffer(
unsigned int *size,
unsigned int *offset,
unsigned int *flags
-#endif
+#endif
){
SISPtr pSiS = SISPTR(pScrn);
*name = NULL; /* no special device */
-#ifndef NEW_DGAOPENFRAMEBUFFER
+#ifndef NEW_DGAOPENFRAMEBUFFER
*mem = (UChar *)pSiS->FbAddress;
#else
*mem = pSiS->FbAddress;
-#endif
+#endif
*size = pSiS->maxxfbmem;
*offset = 0;
-#ifndef NEW_DGAOPENFRAMEBUFFER
+#ifndef NEW_DGAOPENFRAMEBUFFER
*flags = DGA_NEED_ROOT;
#else
*flags = 0;
-#endif
+#endif
return TRUE;
}
diff --git a/src/sis_dri.c b/src/sis_dri.c
index f56dcf6..516a1a3 100644
--- a/src/sis_dri.c
+++ b/src/sis_dri.c
@@ -6,7 +6,7 @@
* Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria
*
* Preliminary 315/330 support by Thomas Winischhofer
- * Portions of Mesa 4/5 changes by Eric Anholt
+ * Portions of Mesa 4/5/6 changes by Eric Anholt
*
* Licensed under the following terms:
*
@@ -90,20 +90,20 @@ static char SISKernelDriverName[] = "sis";
static char SISClientDriverName[] = "sis";
static Bool SISInitVisualConfigs(ScreenPtr pScreen);
-static Bool SISCreateContext(ScreenPtr pScreen, VisualPtr visual,
+static Bool SISCreateContext(ScreenPtr pScreen, VisualPtr visual,
drm_context_t hwContext, void *pVisualConfigPriv,
DRIContextType contextStore);
static void SISDestroyContext(ScreenPtr pScreen, drm_context_t hwContext,
DRIContextType contextStore);
-static void SISDRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
- DRIContextType readContextType,
+static void SISDRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
+ DRIContextType readContextType,
void *readContextStore,
- DRIContextType writeContextType,
+ DRIContextType writeContextType,
void *writeContextStore);
static void SISDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index);
-static void SISDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
+static void SISDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
RegionPtr prgnSrc, CARD32 index);
-
+
static Bool
SISInitVisualConfigs(ScreenPtr pScreen)
{
@@ -230,7 +230,7 @@ SISInitVisualConfigs(ScreenPtr pScreen)
}
break;
}
-
+
pSIS->numVisualConfigs = numConfigs;
pSIS->pVisualConfigs = pConfigs;
pSIS->pVisualConfigsPriv = pSISConfigs;
@@ -239,7 +239,7 @@ SISInitVisualConfigs(ScreenPtr pScreen)
return TRUE;
}
-Bool
+Bool
SISDRIScreenInit(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
@@ -266,7 +266,7 @@ SISDRIScreenInit(ScreenPtr pScreen)
"[dri] SISDRIScreenInit failed (libdri.a too old)\n");
return FALSE;
}
-
+
/* Check the DRI version */
{
int major, minor, patch;
@@ -282,23 +282,23 @@ SISDRIScreenInit(ScreenPtr pScreen)
}
pDRIInfo = DRICreateInfoRec();
- if (!pDRIInfo) return FALSE;
+ if(!pDRIInfo) return FALSE;
pSIS->pDRIInfo = pDRIInfo;
pDRIInfo->drmDriverName = SISKernelDriverName;
pDRIInfo->clientDriverName = SISClientDriverName;
-#ifdef SISHAVECREATEBUSID
+#ifdef SISHAVECREATEBUSID
if(xf86LoaderCheckSymbol("DRICreatePCIBusID")) {
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 SISHAVECREATEBUSID
+ ((pciConfigPtr)pSIS->PciInfo->thisCard)->funcnum);
+#ifdef SISHAVECREATEBUSID
}
#endif
@@ -315,21 +315,28 @@ SISDRIScreenInit(ScreenPtr pScreen)
pDRIInfo->ddxDriverPatchVersion = 0;
#endif
- pDRIInfo->frameBufferPhysicalAddress = pSIS->FbAddress;
-
- /* TW: This was FbMapSize which is wrong as we must not
- * ever overwrite HWCursor and TQ area. On the other
- * hand, using availMem here causes MTRR allocation
- * to fail ("base is not aligned to size"). Since
- * DRI memory management is done via framebuffer
- * device, I assume that the size given here
- * is NOT used for eventual memory management.
+ pDRIInfo->frameBufferPhysicalAddress = pSIS->realFbAddress;
+
+ /* This was FbMapSize which is wrong as we must not
+ * ever overwrite HWCursor and TQ area. On the other
+ * hand, using availMem here causes MTRR allocation
+ * to fail ("base is not aligned to size"). Since
+ * DRI memory management is done via framebuffer
+ * device, I assume that the size given here
+ * is NOT used for eventual memory management.
+ *
+ * TODO: For SiS76x, this needs special attention
+ * if the UMA area is skipped. The memory layout
+ * is different then; the viewport is NOT at the
+ * start of the video memory but after the UMA
+ * area (or eventually even further up if the user
+ * gave a MaxXFBMem limit).
*/
- pDRIInfo->frameBufferSize = pSIS->FbMapSize; /* availMem; */
-
- /* TW: scrnOffset is being calulated in sis_vga.c */
+ pDRIInfo->frameBufferSize = pSIS->FbMapSize;
+
+ /* scrnOffset is being calulated in sis_vga.c */
pDRIInfo->frameBufferStride = pSIS->scrnOffset;
-
+
pDRIInfo->ddxDrawableTableEntry = SIS_MAX_DRAWABLES;
if(SAREA_MAX_DRAWABLES < SIS_MAX_DRAWABLES)
@@ -349,9 +356,8 @@ SISDRIScreenInit(ScreenPtr pScreen)
/* For now the mapping works by using a fixed size defined
* in the SAREA header
*/
- if(sizeof(XF86DRISAREARec)+sizeof(SISSAREAPriv) > SAREA_MAX) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Data does not fit in SAREA\n");
+ if(sizeof(XF86DRISAREARec) + sizeof(SISSAREAPriv) > SAREA_MAX) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Data does not fit in SAREA\n");
return FALSE;
}
pDRIInfo->SAREASize = SAREA_MAX;
@@ -374,8 +380,7 @@ SISDRIScreenInit(ScreenPtr pScreen)
pDRIInfo->bufferRequests = DRI_ALL_WINDOWS;
if(!DRIScreenInit(pScreen, pDRIInfo, &pSIS->drmSubFD)) {
- xf86DrvMsg(pScreen->myNum, X_ERROR,
- "[dri] DRIScreenInit failed. Disabling DRI.\n");
+ xf86DrvMsg(pScreen->myNum, X_ERROR, "[dri] DRIScreenInit failed. Disabling DRI.\n");
xfree(pDRIInfo->devPrivate);
pDRIInfo->devPrivate = 0;
DRIDestroyInfoRec(pSIS->pDRIInfo);
@@ -431,6 +436,7 @@ SISDRIScreenInit(ScreenPtr pScreen)
/* AGP */
do {
+
pSIS->agpWantedSize = pSIS->agpWantedPages * AGP_PAGE_SIZE;
pSIS->agpSize = 0;
pSIS->agpCmdBufSize = 0;
@@ -466,46 +472,67 @@ SISDRIScreenInit(ScreenPtr pScreen)
#define AGP_DEFAULT_SIZE (AGP_DEFAULT_SIZE_MB * 1024 * 1024)
if(drmAgpAlloc(pSIS->drmSubFD, pSIS->agpWantedSize, 0, NULL, &pSIS->agpHandle) < 0) {
+
xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] Failed to allocate %dMB AGP memory\n",
(int)(pSIS->agpWantedSize / (1024 * 1024)));
+
if(pSIS->agpWantedSize > AGP_DEFAULT_SIZE) {
+
xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Retrying with %dMB\n", AGP_DEFAULT_SIZE_MB);
+
pSIS->agpWantedSize = AGP_DEFAULT_SIZE;
+
if(drmAgpAlloc(pSIS->drmSubFD, pSIS->agpWantedSize, 0, NULL, &pSIS->agpHandle) < 0) {
xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] Failed to allocate %dMB AGP memory, AGP disabled\n",
AGP_DEFAULT_SIZE_MB);
drmAgpRelease(pSIS->drmSubFD);
break;
}
+
} else {
+
drmAgpRelease(pSIS->drmSubFD);
break;
+
}
+
}
xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Allocated %dMB AGP memory\n",
(int)(pSIS->agpWantedSize / (1024 * 1024)));
if(drmAgpBind(pSIS->drmSubFD, pSIS->agpHandle, 0) < 0) {
+
xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] Failed to bind AGP memory\n");
drmAgpFree(pSIS->drmSubFD, pSIS->agpHandle);
+
if(pSIS->agpWantedSize > AGP_DEFAULT_SIZE) {
+
xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Retrying with %dMB\n", AGP_DEFAULT_SIZE_MB);
- pSIS->agpWantedSize = AGP_DEFAULT_SIZE;
+ pSIS->agpWantedSize = AGP_DEFAULT_SIZE;
+
if(drmAgpAlloc(pSIS->drmSubFD, pSIS->agpWantedSize, 0, NULL, &pSIS->agpHandle) < 0) {
+
xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] Failed to re-allocate AGP memory, AGP disabled\n");
drmAgpRelease(pSIS->drmSubFD);
break;
+
} else if(drmAgpBind(pSIS->drmSubFD, pSIS->agpHandle, 0) < 0) {
+
xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] Failed to bind AGP memory again, AGP disabled\n");
drmAgpFree(pSIS->drmSubFD, pSIS->agpHandle);
drmAgpRelease(pSIS->drmSubFD);
break;
+
}
+
} else {
+
drmAgpRelease(pSIS->drmSubFD);
break;
+
}
+
}
xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Bound %dMB AGP memory\n",
@@ -518,7 +545,10 @@ SISDRIScreenInit(ScreenPtr pScreen)
pSISDRI->agp.size = pSIS->agpSize;
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;
+ drmAgpUnbind(pSIS->drmSubFD, pSIS->agpHandle);
+ drmAgpFree(pSIS->drmSubFD, pSIS->agpHandle);
+ drmAgpRelease(pSIS->drmSubFD);
+ pSIS->agpSize = pSISDRI->agp.size = 0;
break;
}
@@ -537,7 +567,7 @@ SISDRIScreenInit(ScreenPtr pScreen)
#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));
@@ -550,7 +580,7 @@ SISDRIScreenInit(ScreenPtr pScreen)
pSIS->agpCmdBufAddr = pSIS->agpAddr;
pSIS->agpCmdBufBase = pSIS->agpCmdBufAddr - pSIS->agpAddr + pSIS->agpBase;
pSIS->agpCmdBufFree = 0;
-
+
pSISDRI->AGPCmdBufOffset = pSIS->agpCmdBufAddr - pSIS->agpAddr;
pSISDRI->AGPCmdBufSize = pSIS->agpCmdBufSize;
@@ -559,41 +589,118 @@ SISDRIScreenInit(ScreenPtr pScreen)
#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);
-
- /* enable IRQ */
+ } while(0);
+
+ /* Eventually grab and enable IRQ */
+ pSIS->irqEnabled = FALSE;
pSIS->irq = drmGetInterruptFromBusID(pSIS->drmSubFD,
- ((pciConfigPtr)pSIS->PciInfo->thisCard)->busnum,
- ((pciConfigPtr)pSIS->PciInfo->thisCard)->devnum,
- ((pciConfigPtr)pSIS->PciInfo->thisCard)->funcnum);
+ ((pciConfigPtr)pSIS->PciInfo->thisCard)->busnum,
+ ((pciConfigPtr)pSIS->PciInfo->thisCard)->devnum,
+ ((pciConfigPtr)pSIS->PciInfo->thisCard)->funcnum);
- if((drmCtlInstHandler(pSIS->drmSubFD, pSIS->irq)) != 0) {
+ if(pSIS->irq < 0) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "[drm] Failed to add IRQ %d handler, stereo disabled\n",
- pSIS->irq);
- pSIS->irqEnabled = FALSE;
+ "[drm] Got no valid IRQ number for device %d:%d:%d (code %d)\n",
+ ((pciConfigPtr)pSIS->PciInfo->thisCard)->busnum,
+ ((pciConfigPtr)pSIS->PciInfo->thisCard)->devnum,
+ ((pciConfigPtr)pSIS->PciInfo->thisCard)->funcnum,
+ pSIS->irq);
+ } else if((drmCtlInstHandler(pSIS->drmSubFD, pSIS->irq)) != 0) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "[drm] Failed to add IRQ %d handler\n",
+ pSIS->irq);
} else {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "[drm] Successfully installed handler for IRQ %d\n",
+ pSIS->irq);
pSIS->irqEnabled = TRUE;
}
-
+
pSISDRI->irqEnabled = pSIS->irqEnabled;
-
+
if(!(SISInitVisualConfigs(pScreen))) {
SISDRICloseScreen(pScreen);
return FALSE;
}
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] Visual configs initialized.\n" );
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] Visual configs initialized\n" );
+
+ return TRUE;
+}
+
+Bool
+SISDRIFinishScreenInit(ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ SISPtr pSiS = SISPTR(pScrn);
+ SISDRIPtr pSISDRI;
+
+ pSiS->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT;
+ /* pSiS->pDRIInfo->driverSwapMethod = DRI_SERVER_SWAP; */
+
+ pSISDRI = (SISDRIPtr)pSiS->pDRIInfo->devPrivate;
+ pSISDRI->deviceID = pSiS->Chipset;
+ pSISDRI->width = pScrn->virtualX;
+ pSISDRI->height = pScrn->virtualY;
+ pSISDRI->mem = pScrn->videoRam * 1024;
+ pSISDRI->bytesPerPixel = (pScrn->bitsPerPixel+7) / 8;
+
+ /* TODO */
+ pSISDRI->scrnX = pSISDRI->width;
+ pSISDRI->scrnY = pSISDRI->height;
+
+ /* TODO:
+ For SiS76x UMA skipping, FbBaseOffset needs
+ attention. Perhaps the fbOffset field is
+ meant for this...?
+ */
+
+ /*
+ pSISDRI->textureOffset = pSiS->texOffset;
+ pSISDRI->textureSize = pSiS->texSize;
+ pSISDRI->fbOffset = pSiS->fbOffset;
+ pSISDRI->backOffset = pSiS->backOffset;
+ pSISDRI->depthOffset = pSiS->depthOffset;
+ */
+
+ /* set SAREA value */
+ {
+ SISSAREAPriv *saPriv;
+
+ saPriv = (SISSAREAPriv*)DRIGetSAREAPrivate(pScreen);
+
+ assert(saPriv);
+
+ saPriv->CtxOwner = -1;
+ saPriv->QueueLength = *(pSiS->cmdQueueLenPtr);
+ pSiS->cmdQueueLenPtrBackup = pSiS->cmdQueueLenPtr;
+ pSiS->cmdQueueLenPtr = &(saPriv->QueueLength);
+
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+#ifdef SIS315DRI
+ saPriv->AGPVtxBufNext = 0;
+ saPriv->sharedWPoffset = pSiS->cmdQ_SharedWritePort_2D;
+ pSiS->cmdQ_SharedWritePortBackup = pSiS->cmdQ_SharedWritePort;
+ pSiS->cmdQ_SharedWritePort = &(saPriv->sharedWPoffset);
+#endif
+ } else {
+ saPriv->AGPCmdBufNext = 0;
+
+ /* frame control */
+ saPriv->FrameCount = 0;
+ *(ULong *)(pSiS->IOBase+0x8a2c) = 0;
+ SiSIdle
+ }
+ }
- return TRUE;
+ return DRIFinishScreenInit(pScreen);
}
void
@@ -615,32 +722,50 @@ SISDRICloseScreen(ScreenPtr pScreen)
}
}
+ if(pSIS->irqEnabled) {
+ xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Removing IRQ handler\n");
+ drmCtlUninstHandler(pSIS->drmSubFD);
+ pSIS->irqEnabled = FALSE;
+ pSIS->irq = 0;
+ }
+
+ if(pSIS->agpSize){
+ xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Freeing AGP memory\n");
+ drmAgpUnbind(pSIS->drmSubFD, pSIS->agpHandle);
+ drmAgpFree(pSIS->drmSubFD, pSIS->agpHandle);
+ xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Releasing AGP module\n");
+ drmAgpRelease(pSIS->drmSubFD);
+ pSIS->agpSize = 0;
+ }
+
DRICloseScreen(pScreen);
if(pSIS->pDRIInfo) {
if(pSIS->pDRIInfo->devPrivate) {
xfree(pSIS->pDRIInfo->devPrivate);
- pSIS->pDRIInfo->devPrivate=0;
+ pSIS->pDRIInfo->devPrivate = NULL;
}
DRIDestroyInfoRec(pSIS->pDRIInfo);
- pSIS->pDRIInfo=0;
+ pSIS->pDRIInfo = NULL;
+ }
+
+ if(pSIS->pVisualConfigs) {
+ xfree(pSIS->pVisualConfigs);
+ pSIS->pVisualConfigs = NULL;
+ }
+
+ if(pSIS->pVisualConfigsPriv) {
+ xfree(pSIS->pVisualConfigsPriv);
+ pSIS->pVisualConfigsPriv = NULL;
}
- if(pSIS->pVisualConfigs) xfree(pSIS->pVisualConfigs);
- if(pSIS->pVisualConfigsPriv) xfree(pSIS->pVisualConfigsPriv);
- if(pSIS->agpSize){
- xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Freeing AGP memory\n");
- drmAgpFree(pSIS->drmSubFD, pSIS->agpHandle);
- xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Releasing AGP module\n");
- drmAgpRelease(pSIS->drmSubFD);
- }
}
/* TODO: xserver receives driver's swapping event and do something
* according the data initialized in this function
*/
static Bool
-SISCreateContext(ScreenPtr pScreen, VisualPtr visual,
+SISCreateContext(ScreenPtr pScreen, VisualPtr visual,
drm_context_t hwContext, void *pVisualConfigPriv,
DRIContextType contextStore)
{
@@ -648,74 +773,13 @@ SISCreateContext(ScreenPtr pScreen, VisualPtr visual,
}
static void
-SISDestroyContext(ScreenPtr pScreen, drm_context_t hwContext,
+SISDestroyContext(ScreenPtr pScreen, drm_context_t hwContext,
DRIContextType contextStore)
{
}
-Bool
-SISDRIFinishScreenInit(ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- SISPtr pSiS = SISPTR(pScrn);
- SISDRIPtr pSISDRI;
-
- pSiS->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT;
- /* pSiS->pDRIInfo->driverSwapMethod = DRI_SERVER_SWAP; */
-
- pSISDRI=(SISDRIPtr)pSiS->pDRIInfo->devPrivate;
- pSISDRI->deviceID=pSiS->Chipset;
- pSISDRI->width=pScrn->virtualX;
- pSISDRI->height=pScrn->virtualY;
- pSISDRI->mem=pScrn->videoRam*1024;
- pSISDRI->bytesPerPixel= (pScrn->bitsPerPixel+7) / 8;
- /* TODO */
- pSISDRI->scrnX=pSISDRI->width;
- pSISDRI->scrnY=pSISDRI->height;
-
-/*
- pSISDRI->textureOffset=pSiS->texOffset;
- pSISDRI->textureSize=pSiS->texSize;
- pSISDRI->fbOffset=pSiS->fbOffset;
- pSISDRI->backOffset=pSiS->backOffset;
- pSISDRI->depthOffset=pSiS->depthOffset;
-*/
-
- /* set SAREA value */
- {
- SISSAREAPriv *saPriv;
-
- saPriv = (SISSAREAPriv*)DRIGetSAREAPrivate(pScreen);
-
- assert(saPriv);
-
- saPriv->CtxOwner = -1;
- saPriv->QueueLength = *(pSiS->cmdQueueLenPtr);
- pSiS->cmdQueueLenPtrBackup = pSiS->cmdQueueLenPtr;
- pSiS->cmdQueueLenPtr = &(saPriv->QueueLength);
-
- if(pSiS->VGAEngine == SIS_315_VGA) {
-#ifdef SIS315DRI
- saPriv->AGPVtxBufNext = 0;
- saPriv->sharedWPoffset = pSiS->cmdQ_SharedWritePort_2D;
- pSiS->cmdQ_SharedWritePortBackup = pSiS->cmdQ_SharedWritePort;
- pSiS->cmdQ_SharedWritePort = &(saPriv->sharedWPoffset);
-#endif
- } else {
- saPriv->AGPCmdBufNext = 0;
-
- /* frame control */
- saPriv->FrameCount = 0;
- *(ULong *)(pSiS->IOBase+0x8a2c) = 0;
- SiSIdle
- }
- }
-
- return DRIFinishScreenInit(pScreen);
-}
-
static void
-SISDRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
+SISDRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
DRIContextType oldContextType, void *oldContext,
DRIContextType newContextType, void *newContext)
{
@@ -732,9 +796,9 @@ SISDRISwapContext(ScreenPtr pScreen, DRISyncType syncType,
SISLostContext(pScreen);
}
#endif
-
+
/* mEndPrimitive */
- /*
+ /*
* TODO: do this only if X-Server get lock. If kernel supports delayed
* signal, needless to do this
*/
@@ -765,7 +829,7 @@ SISDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index)
}
static void
-SISDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
+SISDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
RegionPtr prgnSrc, CARD32 index)
{
ScreenPtr pScreen = pParent->drawable.pScreen;
@@ -782,11 +846,11 @@ SISDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
}
#if 0
-void SISLostContext(ScreenPtr pScreen)
+void SISLostContext(ScreenPtr pScreen)
{
}
-void SISSwapContextPrivate(ScreenPtr pScreen)
+void SISSwapContextPrivate(ScreenPtr pScreen)
{
}
#endif
diff --git a/src/sis_driver.c b/src/sis_driver.c
index 711d521..033e08d 100644
--- a/src/sis_driver.c
+++ b/src/sis_driver.c
@@ -33,7 +33,7 @@
* sis_dga.c; these were mostly taken over; sis_dri.c was changed for
* new versions of the DRI layer)
*
- * This notice covers the entire driver code unless otherwise indicated.
+ * This notice covers the entire driver code unless indicated otherwise.
*
* Formerly based on code which was
* Copyright (C) 1998, 1999 by Alan Hourihane, Wigan, England.
@@ -57,6 +57,7 @@
#include "mibstore.h"
#define _XF86MISC_SERVER_
#include "xf86misc.h"
+#include "edid.h"
#define SIS_NEED_inSISREG
#define SIS_NEED_inSISIDXREG
@@ -150,7 +151,7 @@ static SymTabRec SISChipsets[] = {
{ PCI_CHIP_SIS550, "SIS550" },
{ PCI_CHIP_SIS650, "SIS650/M650/651/740" },
{ PCI_CHIP_SIS330, "SIS330(Xabre)" },
- { PCI_CHIP_SIS660, "SIS660/661FX/M661FX/M661MX/741/741GX/M741/760/M760" },
+ { PCI_CHIP_SIS660, "SIS660/[M]661[F|M]X/[M]670/[M]741[GX]/[M]760[GX]/[M]761[GX]/[M]770[GX]" },
{ PCI_CHIP_SIS340, "SIS340" },
{ -1, NULL }
};
@@ -236,14 +237,16 @@ static const char *vbeSymbols[] = {
static const char *drmSymbols[] = {
"drmAddMap",
"drmAgpAcquire",
+ "drmAgpRelease",
"drmAgpAlloc",
+ "drmAgpFree",
"drmAgpBase",
"drmAgpBind",
+ "drmAgpUnbind",
"drmAgpEnable",
- "drmAgpFree",
"drmAgpGetMode",
- "drmAgpRelease",
"drmCtlInstHandler",
+ "drmCtlUninstHandler",
"drmGetInterruptFromBusID",
#ifndef SISHAVEDRMWRITE
"drmSiSAgpInit",
@@ -258,22 +261,22 @@ static const char *drmSymbols[] = {
};
static const char *driSymbols[] = {
- "DRICloseScreen",
"DRICreateInfoRec",
- "DRIDestroyInfoRec",
+ "DRIScreenInit",
"DRIFinishScreenInit",
+ "DRIDestroyInfoRec",
+ "DRICloseScreen",
"DRIGetSAREAPrivate",
"DRILock",
- "DRIQueryVersion",
- "DRIScreenInit",
"DRIUnlock",
+ "DRIQueryVersion",
"GlxSetVisualConfigs",
NULL
};
#ifdef XFree86LOADER
static const char *driRefSymbols[] = {
- "DRICreatePCIBusID", /* not REQUIRED */
+ "DRICreatePCIBusID", /* not REQUIRED, but eventually referenced */
NULL
};
#endif
@@ -374,21 +377,23 @@ SISFreeRec(ScrnInfoPtr pScrn)
#ifdef SISDUALHEAD
if(pSiSEnt) {
if(!pSiS->SecondHead) {
- /* Free memory only if we are first head; in case of an error
+ /* Free memory only if we are first head; in case of an error
* during init of the second head, the server will continue -
* and we need the BIOS image and SiS_Private for the first
* head.
*/
if(pSiSEnt->BIOS) xfree(pSiSEnt->BIOS);
- pSiSEnt->BIOS = pSiS->BIOS = NULL;
+ pSiSEnt->BIOS = pSiS->BIOS = NULL;
if(pSiSEnt->SiS_Pr) xfree(pSiSEnt->SiS_Pr);
- pSiSEnt->SiS_Pr = pSiS->SiS_Pr = NULL;
+ pSiSEnt->SiS_Pr = pSiS->SiS_Pr = NULL;
if(pSiSEnt->RenderAccelArray) xfree(pSiSEnt->RenderAccelArray);
pSiSEnt->RenderAccelArray = pSiS->RenderAccelArray = NULL;
+ pSiSEnt->pScrn_1 = NULL;
} else {
- pSiS->BIOS = NULL;
+ pSiS->BIOS = NULL;
pSiS->SiS_Pr = NULL;
pSiS->RenderAccelArray = NULL;
+ pSiSEnt->pScrn_2 = NULL;
}
} else {
#endif
@@ -410,36 +415,36 @@ SISFreeRec(ScrnInfoPtr pScrn)
pSiS->MetaModes = NULL;
if(pSiS->CRT2pScrn) {
if(pSiS->CRT2pScrn->modes) {
- while(pSiS->CRT2pScrn->modes)
- xf86DeleteMode(&pSiS->CRT2pScrn->modes, pSiS->CRT2pScrn->modes);
+ while(pSiS->CRT2pScrn->modes)
+ xf86DeleteMode(&pSiS->CRT2pScrn->modes, pSiS->CRT2pScrn->modes);
}
if(pSiS->CRT2pScrn->monitor) {
- if(pSiS->CRT2pScrn->monitor->Modes) {
+ if(pSiS->CRT2pScrn->monitor->Modes) {
while(pSiS->CRT2pScrn->monitor->Modes)
xf86DeleteMode(&pSiS->CRT2pScrn->monitor->Modes, pSiS->CRT2pScrn->monitor->Modes);
}
if(pSiS->CRT2pScrn->monitor->DDC) xfree(pSiS->CRT2pScrn->monitor->DDC);
- xfree(pSiS->CRT2pScrn->monitor);
+ xfree(pSiS->CRT2pScrn->monitor);
}
xfree(pSiS->CRT2pScrn);
pSiS->CRT2pScrn = NULL;
}
if(pSiS->CRT1Modes) {
if(pSiS->CRT1Modes != pScrn->modes) {
- if(pScrn->modes) {
- pScrn->currentMode = pScrn->modes;
- do {
- DisplayModePtr p = pScrn->currentMode->next;
- if(pScrn->currentMode->Private)
- xfree(pScrn->currentMode->Private);
- xfree(pScrn->currentMode);
- pScrn->currentMode = p;
- } while(pScrn->currentMode != pScrn->modes);
- }
- pScrn->currentMode = pSiS->CRT1CurrentMode;
- pScrn->modes = pSiS->CRT1Modes;
- pSiS->CRT1CurrentMode = NULL;
- pSiS->CRT1Modes = NULL;
+ if(pScrn->modes) {
+ pScrn->currentMode = pScrn->modes;
+ do {
+ DisplayModePtr p = pScrn->currentMode->next;
+ if(pScrn->currentMode->Private)
+ xfree(pScrn->currentMode->Private);
+ xfree(pScrn->currentMode);
+ pScrn->currentMode = p;
+ } while(pScrn->currentMode != pScrn->modes);
+ }
+ pScrn->currentMode = pSiS->CRT1CurrentMode;
+ pScrn->modes = pSiS->CRT1Modes;
+ pSiS->CRT1CurrentMode = NULL;
+ pSiS->CRT1Modes = NULL;
}
}
#endif
@@ -470,11 +475,11 @@ SISErrorLog(ScrnInfoPtr pScrn, const char *format, ...)
va_start(ap, format);
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, str);
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- " ERROR:\n");
+ " ERROR:\n");
xf86VDrvMsgVerb(pScrn->scrnIndex, X_ERROR, 1, format, ap);
va_end(ap);
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- " END OF MESSAGE\n");
+ " END OF MESSAGE\n");
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, str);
}
@@ -556,8 +561,8 @@ SISProbe(DriverPtr drv, int flags)
}
numUsed = xf86MatchPciInstances(SIS_NAME, PCI_VENDOR_SIS,
- SISChipsets, SISPciChipsets, devSections,
- numDevSections, drv, &usedChips);
+ SISChipsets, SISPciChipsets, devSections,
+ numDevSections, drv, &usedChips);
/* Free it since we don't need that list after this */
xfree(devSections);
@@ -565,41 +570,41 @@ SISProbe(DriverPtr drv, int flags)
if(flags & PROBE_DETECT) {
- foundScreen = TRUE;
+ foundScreen = TRUE;
} else for(i = 0; i < numUsed; i++) {
- ScrnInfoPtr pScrn;
+ ScrnInfoPtr pScrn;
#ifdef SISDUALHEAD
EntityInfoPtr pEnt;
#endif
- /* Allocate a ScrnInfoRec and claim the slot */
- pScrn = NULL;
-
- if((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i],
- SISPciChipsets, NULL, NULL,
- NULL, NULL, NULL))) {
- /* Fill in what we can of the ScrnInfoRec */
- pScrn->driverVersion = SIS_CURRENT_VERSION;
- pScrn->driverName = SIS_DRIVER_NAME;
- pScrn->name = SIS_NAME;
- pScrn->Probe = SISProbe;
- pScrn->PreInit = SISPreInit;
- pScrn->ScreenInit = SISScreenInit;
- pScrn->SwitchMode = SISSwitchMode;
- pScrn->AdjustFrame = SISAdjustFrame;
- pScrn->EnterVT = SISEnterVT;
- pScrn->LeaveVT = SISLeaveVT;
- pScrn->FreeScreen = SISFreeScreen;
- pScrn->ValidMode = SISValidMode;
+ /* Allocate a ScrnInfoRec and claim the slot */
+ pScrn = NULL;
+
+ if((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i],
+ SISPciChipsets, NULL, NULL,
+ NULL, NULL, NULL))) {
+ /* Fill in what we can of the ScrnInfoRec */
+ pScrn->driverVersion = SIS_CURRENT_VERSION;
+ pScrn->driverName = SIS_DRIVER_NAME;
+ pScrn->name = SIS_NAME;
+ pScrn->Probe = SISProbe;
+ pScrn->PreInit = SISPreInit;
+ pScrn->ScreenInit = SISScreenInit;
+ pScrn->SwitchMode = SISSwitchMode;
+ pScrn->AdjustFrame = SISAdjustFrame;
+ pScrn->EnterVT = SISEnterVT;
+ pScrn->LeaveVT = SISLeaveVT;
+ pScrn->FreeScreen = SISFreeScreen;
+ pScrn->ValidMode = SISValidMode;
#ifdef X_XF86MiscPassMessage
- if(xf86GetVersion() >= XF86_VERSION_NUMERIC(4,3,99,2,0)) {
+ if(xf86GetVersion() >= XF86_VERSION_NUMERIC(4,3,99,2,0)) {
pScrn->HandleMessage = SISHandleMessage;
- }
+ }
#endif
- foundScreen = TRUE;
- }
+ foundScreen = TRUE;
+ }
#ifdef SISDUALHEAD
pEnt = xf86GetEntityInfo(usedChips[i]);
@@ -662,9 +667,9 @@ SISCalculateGammaRamp(ScreenPtr pScreen, ScrnInfoPtr pScrn)
for(i=0; i<3; i++) {
ramp[i] = (UShort *)xalloc(nramp * sizeof(UShort));
if(!ramp[i]) {
- if(ramp[0]) { xfree(ramp[0]); ramp[0] = NULL; }
+ if(ramp[0]) { xfree(ramp[0]); ramp[0] = NULL; }
if(ramp[1]) { xfree(ramp[1]); ramp[1] = NULL; }
- return;
+ return;
}
}
@@ -680,10 +685,10 @@ SISCalculateGammaRamp(ScreenPtr pScreen, ScrnInfoPtr pScrn)
}
for(j = 0; j < nramp; j++) {
- framp = pow(gamma_prescale[i] * j * dramp, invgamma);
+ framp = pow(gamma_prescale[i] * j * dramp, invgamma);
- v = (fullscale < 0) ? (65535 + fullscale * framp) :
- fullscale * framp;
+ v = (fullscale < 0) ? (65535 + fullscale * framp) :
+ fullscale * framp;
if(v < 0) v = 0;
else if(v > 65535) v = 65535;
ramp[i][j] = (UShort)v;
@@ -801,19 +806,19 @@ SiSSetSyncRangeFromEdid(ScrnInfoPtr pScrn, int flag)
if(flag) { /* HSync */
for(i = 0; i < 4; i++) {
- if(ddc->det_mon[i].type == DS_RANGES) {
- mon->nHsync = 1;
- mon->hsync[0].lo = ddc->det_mon[i].section.ranges.min_h;
- mon->hsync[0].hi = ddc->det_mon[i].section.ranges.max_h;
+ if(ddc->det_mon[i].type == DS_RANGES) {
+ mon->nHsync = 1;
+ mon->hsync[0].lo = ddc->det_mon[i].section.ranges.min_h;
+ mon->hsync[0].hi = ddc->det_mon[i].section.ranges.max_h;
if(mon->hsync[0].lo > 32.0 || mon->hsync[0].hi < 31.0) {
if(ddc->timings1.t1 & 0x80) {
- mon->nHsync++;
+ mon->nHsync++;
mon->hsync[1].lo = 31.0;
mon->hsync[1].hi = 32.0;
}
}
- return;
- }
+ return;
+ }
}
/* If no sync ranges detected in detailed timing table, we
@@ -821,7 +826,7 @@ SiSSetSyncRangeFromEdid(ScrnInfoPtr pScrn, int flag)
*/
for(i = 0; i < 12; i++) {
- if(myhtiming[i].whichone == 1) temp = ddc->timings1.t1;
+ if(myhtiming[i].whichone == 1) temp = ddc->timings1.t1;
else temp = ddc->timings1.t2;
if(temp & myhtiming[i].mask) {
if((i == 0) || (myhlow > myhtiming[i].rate))
@@ -844,7 +849,7 @@ SiSSetSyncRangeFromEdid(ScrnInfoPtr pScrn, int flag)
}
if((myhhigh > 0.0) && (myhlow > 0.0)) {
- mon->nHsync = 1;
+ mon->nHsync = 1;
mon->hsync[0].lo = myhlow - 0.1;
mon->hsync[0].hi = myhhigh;
}
@@ -854,22 +859,22 @@ SiSSetSyncRangeFromEdid(ScrnInfoPtr pScrn, int flag)
for(i = 0; i < 4; i++) {
if(ddc->det_mon[i].type == DS_RANGES) {
- mon->nVrefresh = 1;
- mon->vrefresh[0].lo = ddc->det_mon[i].section.ranges.min_v;
- mon->vrefresh[0].hi = ddc->det_mon[i].section.ranges.max_v;
+ mon->nVrefresh = 1;
+ mon->vrefresh[0].lo = ddc->det_mon[i].section.ranges.min_v;
+ mon->vrefresh[0].hi = ddc->det_mon[i].section.ranges.max_v;
if(mon->vrefresh[0].lo > 72 || mon->vrefresh[0].hi < 70) {
if(ddc->timings1.t1 & 0x80) {
- mon->nVrefresh++;
+ mon->nVrefresh++;
mon->vrefresh[1].lo = 71;
mon->vrefresh[1].hi = 71;
}
}
- return;
+ return;
}
}
for(i = 0; i < 11; i++) {
- if(myvtiming[i].whichone == 1) temp = ddc->timings1.t1;
+ if(myvtiming[i].whichone == 1) temp = ddc->timings1.t1;
else temp = ddc->timings1.t2;
if(temp & myvtiming[i].mask) {
if((i == 0) || (myvlow > myvtiming[i].rate))
@@ -892,7 +897,7 @@ SiSSetSyncRangeFromEdid(ScrnInfoPtr pScrn, int flag)
}
if((myvhigh > 0) && (myvlow > 0)) {
- mon->nVrefresh = 1;
+ mon->nVrefresh = 1;
mon->vrefresh[0].lo = myvlow;
mon->vrefresh[0].hi = myvhigh;
}
@@ -1098,12 +1103,16 @@ SiSStrToRanges(range *r, char *s, int max)
/* Copy and link two modes (i, j) for mergedfb mode
* (Code base taken from mga driver)
- * Copys mode i, merges j to copy of i, links the result to dest and returns it.
- * Links i and j in Private record.
- * If dest is NULL, return value is copy of i linked to itself.
- * For mergedfb auto-config, we only check the dimension
- * against virtualX/Y, if they were user-provided.
- * No special treatment required for CRTxxOffs.
+ *
+ * - Copy mode i, merge j to copy of i, link the result to dest
+ * - Link i and j in private record.
+ * - If dest is NULL, return value is copy of i linked to itself.
+ * - For mergedfb auto-config, we only check the dimension
+ * against virtualX/Y, if they were user-provided.
+ * - No special treatment required for CRTxxOffs.
+ * - Provide fake dotclock in order to distinguish between similar
+ * looking MetaModes (for RandR and VidMode extensions)
+ * - Set unique VRefresh of dest mode for RandR
*/
static DisplayModePtr
SiSCopyModeNLink(ScrnInfoPtr pScrn, DisplayModePtr dest,
@@ -1189,19 +1198,18 @@ SiSCopyModeNLink(ScrnInfoPtr pScrn, DisplayModePtr dest,
mode->type |= M_T_USERDEF;
#endif
- /* Provide a sophisticated fake DotClock in order to trick the vidmode
- * extension to allow selecting among a number of modes whose merged result
- * looks identical but consists of different modes for CRT1 and CRT2
+ /* Set the VRefresh field (in order to make RandR use it for the rates). We
+ * simply set this to the refresh rate for the CRT1 mode (since CRT2 will
+ * mostly be LCD or TV anyway).
*/
- mode->Clock = (((i->Clock >> 3) + i->HTotal) << 16) | ((j->Clock >> 2) + j->HTotal);
- mode->Clock ^= ((i->VTotal << 19) | (j->VTotal << 3));
+ mode->VRefresh = SiSCalcVRate(i);
if( ((mode->HDisplay * ((pScrn->bitsPerPixel + 7) / 8) * mode->VDisplay) > pSiS->maxxfbmem) ||
- (mode->HDisplay > 4088) ||
+ (mode->HDisplay > 4088) ||
(mode->VDisplay > 4096) ) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Skipped \"%s\" (%dx%d), not enough video RAM or beyond hardware specs\n",
+ "Skipped \"%s\" (%dx%d), not enough video RAM or beyond hardware specs\n",
mode->name, mode->HDisplay, mode->VDisplay);
xfree(mode->Private);
xfree(mode);
@@ -1215,10 +1223,32 @@ SiSCopyModeNLink(ScrnInfoPtr pScrn, DisplayModePtr dest,
}
#endif
+ /* Now see if the resulting mode would be discarded as a "size" by the
+ * RandR extension, and increase its clock by 1000 in case it does.
+ */
+ if(dest) {
+ DisplayModePtr t = dest;
+ do {
+ if((t->HDisplay == mode->HDisplay) &&
+ (t->VDisplay == mode->VDisplay) &&
+ ((int)(t->VRefresh + .5) == (int)(mode->VRefresh + .5))) {
+ mode->VRefresh += 1000.0;
+ }
+ t = t->next;
+ } while((t) && (t != dest));
+ }
+
+ /* Provide a fake but unique DotClock in order to trick the vidmode
+ * extension to allow selecting among a number of modes whose merged result
+ * looks identical but consists of different modes for CRT1 and CRT2
+ */
+ mode->Clock = (int)(mode->VRefresh * 1000.0);
+
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Merged \"%s\" (%dx%d) and \"%s\" (%dx%d) to %dx%d%s\n",
+ "Merged \"%s\" (%dx%d) and \"%s\" (%dx%d) to %dx%d (%d)%s\n",
i->name, i->HDisplay, i->VDisplay, j->name, j->HDisplay, j->VDisplay,
- mode->HDisplay, mode->VDisplay, (srel == sisClone) ? " (Clone)" : "");
+ mode->HDisplay, mode->VDisplay, (int)mode->VRefresh,
+ (srel == sisClone) ? " (Clone)" : "");
mode->next = mode;
mode->prev = mode;
@@ -1257,12 +1287,12 @@ SiSFindWidestTallestMode(DisplayModePtr i, Bool tallest)
do {
if(tallest) {
if(c->VDisplay > max) {
- max = c->VDisplay;
+ max = c->VDisplay;
d = c;
}
} else {
if(c->HDisplay > max) {
- max = c->HDisplay;
+ max = c->HDisplay;
d = c;
}
}
@@ -1271,6 +1301,48 @@ SiSFindWidestTallestMode(DisplayModePtr i, Bool tallest)
return d;
}
+static void
+SiSFindWidestTallestCommonMode(DisplayModePtr i, DisplayModePtr j, Bool tallest,
+ DisplayModePtr *a, DisplayModePtr *b)
+{
+ DisplayModePtr c = i, d;
+ int max = 0;
+ Bool foundone;
+
+ (*a) = (*b) = NULL;
+
+ if(!i || !j) return;
+
+ do {
+ d = j;
+ foundone = FALSE;
+ do {
+ if( (c->HDisplay == d->HDisplay) &&
+ (c->VDisplay == d->VDisplay) ) {
+ foundone = TRUE;
+ break;
+ }
+ d = d->next;
+ } while(d != j);
+ if(foundone) {
+ if(tallest) {
+ if(c->VDisplay > max) {
+ max = c->VDisplay;
+ (*a) = c;
+ (*b) = d;
+ }
+ } else {
+ if(c->HDisplay > max) {
+ max = c->HDisplay;
+ (*a) = c;
+ (*b) = d;
+ }
+ }
+ }
+ c = c->next;
+ } while(c != i);
+}
+
static DisplayModePtr
SiSGenerateModeListFromLargestModes(ScrnInfoPtr pScrn,
DisplayModePtr i, DisplayModePtr j,
@@ -1281,33 +1353,67 @@ SiSGenerateModeListFromLargestModes(ScrnInfoPtr pScrn,
#endif
DisplayModePtr mode1 = NULL;
DisplayModePtr mode2 = NULL;
+ DisplayModePtr mode3 = NULL;
+ DisplayModePtr mode4 = NULL;
DisplayModePtr result = NULL;
#ifdef SISXINERAMA
pSiS->AtLeastOneNonClone = FALSE;
#endif
+ /* Now build a default list of MetaModes.
+ * - Non-clone: If the user enabled NonRectangular, we use the
+ * largest mode for each CRT1 and CRT2. If not, we use the largest
+ * common mode for CRT1 and CRT2 (if available). Additionally, and
+ * regardless if the above, we produce a clone mode consisting of
+ * the largest common mode (if available) in order to use DGA.
+ * - Clone: If the (global) CRT2Position is Clone, we use the
+ * largest common mode if available, otherwise the first two modes
+ * in each list.
+ */
+
switch(srel) {
case sisLeftOf:
case sisRightOf:
mode1 = SiSFindWidestTallestMode(i, FALSE);
mode2 = SiSFindWidestTallestMode(j, FALSE);
+ SiSFindWidestTallestCommonMode(i, j, FALSE, &mode3, &mode4);
break;
case sisAbove:
case sisBelow:
mode1 = SiSFindWidestTallestMode(i, TRUE);
mode2 = SiSFindWidestTallestMode(j, TRUE);
+ SiSFindWidestTallestCommonMode(i, j, TRUE, &mode3, &mode4);
break;
case sisClone:
- mode1 = i;
- mode2 = j;
+ SiSFindWidestTallestCommonMode(i, j, FALSE, &mode3, &mode4);
+ if(mode3 && mode4) {
+ mode1 = mode3;
+ mode2 = mode4;
+ } else {
+ mode1 = i;
+ mode2 = j;
+ }
+ }
+
+ if(srel != sisClone) {
+ if(mode3 && mode4 && !pSiS->NonRect) {
+ mode1 = mode3;
+ mode2 = mode2;
+ }
}
if(mode1 && mode2) {
- return(SiSCopyModeNLink(pScrn, result, mode1, mode2, srel));
- } else {
- return NULL;
+ result = SiSCopyModeNLink(pScrn, result, mode1, mode2, srel);
}
+
+ if(srel != sisClone) {
+ if(mode3 && mode4) {
+ result = SiSCopyModeNLink(pScrn, result, mode3, mode4, sisClone);
+ }
+ }
+
+ return result;
}
/* Generate the merged-fb mode modelist from metamodes
@@ -1335,92 +1441,88 @@ SiSGenerateModeListFromMetaModes(ScrnInfoPtr pScrn, char* str,
#endif
do {
- switch(*str) {
- case 0:
- case '-':
+ switch(*str) {
+ case 0:
+ case '-':
case '+':
- case ' ':
- if(strmode != str) {
+ case ' ':
+ if(strmode != str) {
myslen = str - strmode;
if(myslen > 255) myslen = 255;
- strncpy(modename, strmode, myslen);
- modename[myslen] = 0;
+ strncpy(modename, strmode, myslen);
+ modename[myslen] = 0;
- if(gotdash) {
- if(mode1 == NULL) {
+ if(gotdash) {
+ if(mode1 == NULL) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Error parsing MetaModes parameter\n");
return NULL;
}
- mode2 = SiSGetModeFromName(modename, j);
- if(!mode2) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Mode \"%s\" is not a supported mode for CRT2\n", modename);
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "\t(Skipping metamode \"%s%s%s\")\n", mode1->name, gotplus ? "+" : "-", modename);
- mode1 = NULL;
+ mode2 = SiSGetModeFromName(modename, j);
+ if(!mode2) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Mode \"%s\" is not a supported mode for CRT2\n", modename);
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "\t(Skipping metamode \"%s%s%s\")\n", mode1->name, gotplus ? "+" : "-", modename);
+ mode1 = NULL;
gotplus = FALSE;
- }
- } else {
- mode1 = SiSGetModeFromName(modename, i);
- if(!mode1) {
- char* tmps = str;
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Mode \"%s\" is not a supported mode for CRT1\n", modename);
- while(*tmps == ' ') tmps++;
+ }
+ } else {
+ mode1 = SiSGetModeFromName(modename, i);
+ if(!mode1) {
+ char* tmps = str;
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Mode \"%s\" is not a supported mode for CRT1\n", modename);
+ while(*tmps == ' ') tmps++;
/* skip the next mode */
- if((*tmps == '-') || (*tmps == '+')) {
- tmps++;
+ if((*tmps == '-') || (*tmps == '+')) {
+ tmps++;
/* skip spaces */
- while(*tmps == ' ') tmps++;
+ while(*tmps == ' ') tmps++;
/* skip modename */
- while((*tmps != ' ') && (*tmps != '-') && (*tmps != '+') && (*tmps != 0)) tmps++;
+ while((*tmps != ' ') && (*tmps != '-') && (*tmps != '+') && (*tmps != 0)) tmps++;
myslen = tmps - strmode;
if(myslen > 255) myslen = 255;
- strncpy(modename,strmode,myslen);
- modename[myslen] = 0;
- str = tmps - 1;
- }
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "\t(Skipping metamode \"%s\")\n", modename);
- mode1 = NULL;
+ strncpy(modename,strmode,myslen);
+ modename[myslen] = 0;
+ str = tmps - 1;
+ }
+ mode1 = NULL;
gotplus = FALSE;
- }
- }
- gotdash = FALSE;
- }
- strmode = str + 1;
- gotdash |= ((*str == '-') || (*str == '+'));
+ }
+ }
+ gotdash = FALSE;
+ }
+ strmode = str + 1;
+ gotdash |= ((*str == '-') || (*str == '+'));
gotplus |= (*str == '+');
- if(*str != 0) break;
+ if(*str != 0) break;
/* Fall through otherwise */
default:
- if(!gotdash && mode1) {
- sr = srel;
+ if(!gotdash && mode1) {
+ sr = srel;
if(gotplus) sr = sisClone;
- if(!mode2) {
- mode2 = SiSGetModeFromName(mode1->name, j);
- sr = sisClone;
- }
- if(!mode2) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Mode \"%s\" is not a supported mode for CRT2\n", mode1->name);
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "\t(Skipping metamode \"%s\")\n", modename);
- mode1 = NULL;
- } else {
- result = SiSCopyModeNLink(pScrn, result, mode1, mode2, sr);
- mode1 = NULL;
- mode2 = NULL;
- }
+ if(!mode2) {
+ mode2 = SiSGetModeFromName(mode1->name, j);
+ sr = sisClone;
+ }
+ if(!mode2) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Mode \"%s\" is not a supported mode for CRT2\n", mode1->name);
+ mode1 = NULL;
+ } else {
+ result = SiSCopyModeNLink(pScrn, result, mode1, mode2, sr);
+ mode1 = NULL;
+ mode2 = NULL;
+ }
gotplus = FALSE;
- }
- break;
+ }
+ break;
- }
+ }
} while(*(str++) != 0);
@@ -1432,13 +1534,18 @@ SiSGenerateModeList(ScrnInfoPtr pScrn, char* str,
DisplayModePtr i, DisplayModePtr j,
SiSScrn2Rel srel)
{
+ SISPtr pSiS = SISPTR(pScrn);
+
if(str != NULL) {
return(SiSGenerateModeListFromMetaModes(pScrn, str, i, j, srel));
} else {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "No MetaModes given, linking %s modes by default\n",
- (srel == sisClone) ? "first" :
- (((srel == sisLeftOf) || (srel == sisRightOf)) ? "widest" : "tallest"));
+ "No MetaModes given, linking %s modes by default\n",
+ (srel == sisClone) ? "largest common" :
+ (pSiS->NonRect ?
+ (((srel == sisLeftOf) || (srel == sisRightOf)) ? "widest" : "tallest")
+ :
+ (((srel == sisLeftOf) || (srel == sisRightOf)) ? "widest common" : "tallest common")) );
return(SiSGenerateModeListFromLargestModes(pScrn, i, j, srel));
}
}
@@ -1465,9 +1572,9 @@ SiSRecalcDefaultVirtualSize(ScrnInfoPtr pScrn)
if(!(pScrn->display->virtualX)) {
if(maxh > 4088) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Virtual width with CRT2Position offset beyond hardware specs\n");
- pSiS->CRT1XOffs = pSiS->CRT2XOffs = 0;
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Virtual width with CRT2Position offset beyond hardware specs\n");
+ pSiS->CRT1XOffs = pSiS->CRT2XOffs = 0;
maxh -= (pSiS->CRT1XOffs + pSiS->CRT2XOffs);
}
pScrn->virtualX = maxh;
@@ -1475,8 +1582,8 @@ SiSRecalcDefaultVirtualSize(ScrnInfoPtr pScrn)
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, str, "width", maxh);
} else {
if(maxh < pScrn->display->virtualX) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, errstr, "width");
- pSiS->CRT1XOffs = pSiS->CRT2XOffs = 0;
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, errstr, "width");
+ pSiS->CRT1XOffs = pSiS->CRT2XOffs = 0;
}
}
@@ -1485,8 +1592,8 @@ SiSRecalcDefaultVirtualSize(ScrnInfoPtr pScrn)
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, str, "height", maxv);
} else {
if(maxv < pScrn->display->virtualY) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, errstr, "height");
- pSiS->CRT1YOffs = pSiS->CRT2YOffs = 0;
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, errstr, "height");
+ pSiS->CRT1YOffs = pSiS->CRT2YOffs = 0;
}
}
}
@@ -1522,11 +1629,11 @@ SiSMergedFBSetDpi(ScrnInfoPtr pScrn1, ScrnInfoPtr pScrn2, SiSScrn2Rel srel)
switch(srel) {
case sisLeftOf:
case sisRightOf:
- ddcWidthmm = (DDC1->features.hsize + DDC2->features.hsize) * 10;
+ ddcWidthmm = (DDC1->features.hsize + DDC2->features.hsize) * 10;
break;
case sisAbove:
case sisBelow:
- ddcHeightmm = (DDC1->features.vsize + DDC2->features.vsize) * 10;
+ ddcHeightmm = (DDC1->features.vsize + DDC2->features.vsize) * 10;
default:
break;
}
@@ -1536,11 +1643,11 @@ SiSMergedFBSetDpi(ScrnInfoPtr pScrn1, ScrnInfoPtr pScrn2, SiSScrn2Rel srel)
switch(srel) {
case sisLeftOf:
case sisRightOf:
- ddcWidthmm *= 2;
+ ddcWidthmm *= 2;
break;
case sisAbove:
case sisBelow:
- ddcHeightmm *= 2;
+ ddcHeightmm *= 2;
default:
break;
}
@@ -1550,11 +1657,11 @@ SiSMergedFBSetDpi(ScrnInfoPtr pScrn1, ScrnInfoPtr pScrn2, SiSScrn2Rel srel)
switch(srel) {
case sisLeftOf:
case sisRightOf:
- ddcWidthmm *= 2;
+ ddcWidthmm *= 2;
break;
case sisAbove:
case sisBelow:
- ddcHeightmm *= 2;
+ ddcHeightmm *= 2;
default:
break;
}
@@ -1616,7 +1723,7 @@ SiSMergedFBSetDpi(ScrnInfoPtr pScrn1, ScrnInfoPtr pScrn2, SiSScrn2Rel srel)
pScrn2->yDpi = pScrn1->yDpi;
xf86DrvMsg(pScrn1->scrnIndex, from, "MergedFB: DPI set to (%d, %d)\n",
- pScrn1->xDpi, pScrn1->yDpi);
+ pScrn1->xDpi, pScrn1->yDpi);
}
/* Pseudo-Xinerama extension for MergedFB mode */
@@ -1631,6 +1738,11 @@ SiSUpdateXineramaScreenInfo(ScrnInfoPtr pScrn1)
int realvirtX, realvirtY;
DisplayModePtr currentMode, firstMode;
Bool infochanged = FALSE;
+ Bool usenonrect = pSiS->NonRect;
+ const char *rectxine = "\t... setting up rectangular Xinerama layout\n";
+
+ pSiS->MBXNR1XMAX = pSiS->MBXNR1YMAX = pSiS->MBXNR2XMAX = pSiS->MBXNR2YMAX = 65536;
+ pSiS->HaveNonRect = pSiS->HaveOffsRegions = FALSE;
if(!pSiS->MergedFB) return;
@@ -1643,12 +1755,11 @@ SiSUpdateXineramaScreenInfo(ScrnInfoPtr pScrn1)
crt2scrnnum = 0;
}
- /* Attention: Usage of RandR may lead into virtual X and Y values
- * actually smaller than our MetaModes! To avoid this, we calculate
+ /* Attention: Usage of RandR may lead to virtual X and Y dimensions
+ * actually smaller than our MetaModes. To avoid this, we calculate
* the maxCRT fields here (and not somewhere else, like in CopyNLink)
*
- * *** For now: RandR will be disabled if SiS pseudo-Xinerama is on
- * or one of CRTxxOffs is non-zero.
+ * *** Note: RandR is disabled if one of CRTxxOffs is non-zero.
*/
/* "Real" virtual: Virtual without the Offset */
@@ -1675,50 +1786,59 @@ SiSUpdateXineramaScreenInfo(ScrnInfoPtr pScrn1)
DisplayModePtr j = ((SiSMergedDisplayModePtr)currentMode->Private)->CRT2;
SiSScrn2Rel srel = ((SiSMergedDisplayModePtr)currentMode->Private)->CRT2Position;
- if((i->HDisplay <= realvirtX) && (j->HDisplay <= realvirtX) &&
- (i->VDisplay <= realvirtY) && (j->VDisplay <= realvirtY)) {
-
- if(srel != sisClone) {
- if(pSiS->maxCRT1_X1 <= i->HDisplay) {
- pSiS->maxCRT1_X1 = i->HDisplay; /* Largest CRT1 mode */
- if(pSiS->maxCRT1_X2 < j->HDisplay) {
- pSiS->maxCRT1_X2 = j->HDisplay; /* Largest X of CRT2 mode displayed with largest CRT1 mode */
- }
- }
- if(pSiS->maxCRT2_X2 <= j->HDisplay) {
- pSiS->maxCRT2_X2 = j->HDisplay; /* Largest CRT2 mode */
- if(pSiS->maxCRT2_X1 < i->HDisplay) {
- pSiS->maxCRT2_X1 = i->HDisplay; /* Largest X of CRT1 mode displayed with largest CRT2 mode */
- }
- }
- if(pSiS->maxCRT1_Y1 <= i->VDisplay) {
- pSiS->maxCRT1_Y1 = i->VDisplay;
- if(pSiS->maxCRT1_Y2 < j->VDisplay) {
- pSiS->maxCRT1_Y2 = j->VDisplay;
- }
- }
- if(pSiS->maxCRT2_Y2 <= j->VDisplay) {
- pSiS->maxCRT2_Y2 = j->VDisplay;
- if(pSiS->maxCRT2_Y1 < i->VDisplay) {
- pSiS->maxCRT2_Y1 = i->VDisplay;
- }
- }
- } else {
- if(pSiS->maxClone_X1 < i->HDisplay) {
- pSiS->maxClone_X1 = i->HDisplay;
- }
- if(pSiS->maxClone_X2 < j->HDisplay) {
- pSiS->maxClone_X2 = j->HDisplay;
- }
- if(pSiS->maxClone_Y1 < i->VDisplay) {
- pSiS->maxClone_Y1 = i->VDisplay;
- }
- if(pSiS->maxClone_Y2 < j->VDisplay) {
- pSiS->maxClone_Y2 = j->VDisplay;
- }
- }
- }
- currentMode = p;
+ if((currentMode->HDisplay <= realvirtX) && (currentMode->VDisplay <= realvirtY) &&
+ (i->HDisplay <= realvirtX) && (j->HDisplay <= realvirtX) &&
+ (i->VDisplay <= realvirtY) && (j->VDisplay <= realvirtY)) {
+
+ if(srel != sisClone) {
+ if(pSiS->maxCRT1_X1 == i->HDisplay) {
+ if(pSiS->maxCRT1_X2 < j->HDisplay) {
+ pSiS->maxCRT1_X2 = j->HDisplay; /* Widest CRT2 mode displayed with widest CRT1 mode */
+ }
+ } else if(pSiS->maxCRT1_X1 < i->HDisplay) {
+ pSiS->maxCRT1_X1 = i->HDisplay; /* Widest CRT1 mode */
+ pSiS->maxCRT1_X2 = j->HDisplay;
+ }
+ if(pSiS->maxCRT2_X2 == j->HDisplay) {
+ if(pSiS->maxCRT2_X1 < i->HDisplay) {
+ pSiS->maxCRT2_X1 = i->HDisplay; /* Widest CRT1 mode displayed with widest CRT2 mode */
+ }
+ } else if(pSiS->maxCRT2_X2 < j->HDisplay) {
+ pSiS->maxCRT2_X2 = j->HDisplay; /* Widest CRT2 mode */
+ pSiS->maxCRT2_X1 = i->HDisplay;
+ }
+ if(pSiS->maxCRT1_Y1 == i->VDisplay) { /* Same as above, but tallest instead of widest */
+ if(pSiS->maxCRT1_Y2 < j->VDisplay) {
+ pSiS->maxCRT1_Y2 = j->VDisplay;
+ }
+ } else if(pSiS->maxCRT1_Y1 < i->VDisplay) {
+ pSiS->maxCRT1_Y1 = i->VDisplay;
+ pSiS->maxCRT1_Y2 = j->VDisplay;
+ }
+ if(pSiS->maxCRT2_Y2 == j->VDisplay) {
+ if(pSiS->maxCRT2_Y1 < i->VDisplay) {
+ pSiS->maxCRT2_Y1 = i->VDisplay;
+ }
+ } else if(pSiS->maxCRT2_Y2 < j->VDisplay) {
+ pSiS->maxCRT2_Y2 = j->VDisplay;
+ pSiS->maxCRT2_Y1 = i->VDisplay;
+ }
+ } else {
+ if(pSiS->maxClone_X1 < i->HDisplay) {
+ pSiS->maxClone_X1 = i->HDisplay;
+ }
+ if(pSiS->maxClone_X2 < j->HDisplay) {
+ pSiS->maxClone_X2 = j->HDisplay;
+ }
+ if(pSiS->maxClone_Y1 < i->VDisplay) {
+ pSiS->maxClone_Y1 = i->VDisplay;
+ }
+ if(pSiS->maxClone_Y2 < j->VDisplay) {
+ pSiS->maxClone_Y2 = j->VDisplay;
+ }
+ }
+ }
+ currentMode = p;
} while((currentMode) && (currentMode != firstMode));
@@ -1728,56 +1848,212 @@ SiSUpdateXineramaScreenInfo(ScrnInfoPtr pScrn1)
}
- switch(pSiS->CRT2Position) {
- case sisLeftOf:
- x1 = min(pSiS->maxCRT1_X2, pScrn1->virtualX - pSiS->maxCRT1_X1);
- if(x1 < 0) x1 = 0;
- y1 = pSiS->CRT1YOffs;
- w1 = pScrn1->virtualX - x1;
- h1 = realvirtY;
- x2 = 0;
- y2 = pSiS->CRT2YOffs;
- w2 = max(pSiS->maxCRT2_X2, pScrn1->virtualX - pSiS->maxCRT2_X1);
- if(w2 > pScrn1->virtualX) w2 = pScrn1->virtualX;
- h2 = realvirtY;
- break;
- case sisRightOf:
- x1 = 0;
- y1 = pSiS->CRT1YOffs;
- w1 = max(pSiS->maxCRT1_X1, pScrn1->virtualX - pSiS->maxCRT1_X2);
- if(w1 > pScrn1->virtualX) w1 = pScrn1->virtualX;
- h1 = realvirtY;
- x2 = min(pSiS->maxCRT2_X1, pScrn1->virtualX - pSiS->maxCRT2_X2);
- if(x2 < 0) x2 = 0;
- y2 = pSiS->CRT2YOffs;
- w2 = pScrn1->virtualX - x2;
- h2 = realvirtY;
- break;
- case sisAbove:
- x1 = pSiS->CRT1XOffs;
- y1 = min(pSiS->maxCRT1_Y2, pScrn1->virtualY - pSiS->maxCRT1_Y1);
- if(y1 < 0) y1 = 0;
- w1 = realvirtX;
- h1 = pScrn1->virtualY - y1;
- x2 = pSiS->CRT2XOffs;
- y2 = 0;
- w2 = realvirtX;
- h2 = max(pSiS->maxCRT2_Y2, pScrn1->virtualY - pSiS->maxCRT2_Y1);
- if(h2 > pScrn1->virtualY) h2 = pScrn1->virtualY;
- break;
- case sisBelow:
- x1 = pSiS->CRT1XOffs;
- y1 = 0;
- w1 = realvirtX;
- h1 = max(pSiS->maxCRT1_Y1, pScrn1->virtualY - pSiS->maxCRT1_Y2);
- if(h1 > pScrn1->virtualY) h1 = pScrn1->virtualY;
- x2 = pSiS->CRT2XOffs;
- y2 = min(pSiS->maxCRT2_Y1, pScrn1->virtualY - pSiS->maxCRT2_Y2);
- if(y2 < 0) y2 = 0;
- w2 = realvirtX;
- h2 = pScrn1->virtualY - y2;
- default:
- break;
+ if((usenonrect) && (pSiS->CRT2Position != sisClone) && pSiS->maxCRT1_X1) {
+ switch(pSiS->CRT2Position) {
+ case sisLeftOf:
+ case sisRightOf:
+ if((pSiS->maxCRT1_Y1 != realvirtY) && (pSiS->maxCRT2_Y1 != realvirtY)) {
+ usenonrect = FALSE;
+ }
+ break;
+ case sisAbove:
+ case sisBelow:
+ if((pSiS->maxCRT1_X1 != realvirtX) && (pSiS->maxCRT2_X1 != realvirtX)) {
+ usenonrect = FALSE;
+ }
+ break;
+ case sisClone:
+ break;
+ }
+ if(infochanged && !usenonrect) {
+ xf86DrvMsg(pScrn1->scrnIndex, X_INFO,
+ "Virtual screen size does not match maximum display modes...\n");
+ xf86DrvMsg(pScrn1->scrnIndex, X_INFO, rectxine);
+
+ }
+ } else if(infochanged && usenonrect) {
+ usenonrect = FALSE;
+ xf86DrvMsg(pScrn1->scrnIndex, X_INFO,
+ "Only clone modes available for this virtual screen size...\n");
+ xf86DrvMsg(pScrn1->scrnIndex, X_INFO, rectxine);
+ }
+
+ if(pSiS->maxCRT1_X1) { /* Means we have at least one non-clone mode */
+ switch(pSiS->CRT2Position) {
+ case sisLeftOf:
+ x1 = min(pSiS->maxCRT1_X2, pScrn1->virtualX - pSiS->maxCRT1_X1);
+ if(x1 < 0) x1 = 0;
+ y1 = pSiS->CRT1YOffs;
+ w1 = pScrn1->virtualX - x1;
+ h1 = realvirtY;
+ if((usenonrect) && (pSiS->maxCRT1_Y1 != realvirtY)) {
+ h1 = pSiS->MBXNR1YMAX = pSiS->maxCRT1_Y1;
+ pSiS->NonRectDead.x0 = x1;
+ pSiS->NonRectDead.x1 = x1 + w1 - 1;
+ pSiS->NonRectDead.y0 = y1 + h1;
+ pSiS->NonRectDead.y1 = pScrn1->virtualY - 1;
+ pSiS->HaveNonRect = TRUE;
+ }
+ x2 = 0;
+ y2 = pSiS->CRT2YOffs;
+ w2 = max(pSiS->maxCRT2_X2, pScrn1->virtualX - pSiS->maxCRT2_X1);
+ if(w2 > pScrn1->virtualX) w2 = pScrn1->virtualX;
+ h2 = realvirtY;
+ if((usenonrect) && (pSiS->maxCRT2_Y2 != realvirtY)) {
+ h2 = pSiS->MBXNR2YMAX = pSiS->maxCRT2_Y2;
+ pSiS->NonRectDead.x0 = x2;
+ pSiS->NonRectDead.x1 = x2 + w2 - 1;
+ pSiS->NonRectDead.y0 = y2 + h2;
+ pSiS->NonRectDead.y1 = pScrn1->virtualY - 1;
+ pSiS->HaveNonRect = TRUE;
+ }
+ break;
+ case sisRightOf:
+ x1 = 0;
+ y1 = pSiS->CRT1YOffs;
+ w1 = max(pSiS->maxCRT1_X1, pScrn1->virtualX - pSiS->maxCRT1_X2);
+ if(w1 > pScrn1->virtualX) w1 = pScrn1->virtualX;
+ h1 = realvirtY;
+ if((usenonrect) && (pSiS->maxCRT1_Y1 != realvirtY)) {
+ h1 = pSiS->MBXNR1YMAX = pSiS->maxCRT1_Y1;
+ pSiS->NonRectDead.x0 = x1;
+ pSiS->NonRectDead.x1 = x1 + w1 - 1;
+ pSiS->NonRectDead.y0 = y1 + h1;
+ pSiS->NonRectDead.y1 = pScrn1->virtualY - 1;
+ pSiS->HaveNonRect = TRUE;
+ }
+ x2 = min(pSiS->maxCRT2_X1, pScrn1->virtualX - pSiS->maxCRT2_X2);
+ if(x2 < 0) x2 = 0;
+ y2 = pSiS->CRT2YOffs;
+ w2 = pScrn1->virtualX - x2;
+ h2 = realvirtY;
+ if((usenonrect) && (pSiS->maxCRT2_Y2 != realvirtY)) {
+ h2 = pSiS->MBXNR2YMAX = pSiS->maxCRT2_Y2;
+ pSiS->NonRectDead.x0 = x2;
+ pSiS->NonRectDead.x1 = x2 + w2 - 1;
+ pSiS->NonRectDead.y0 = y2 + h2;
+ pSiS->NonRectDead.y1 = pScrn1->virtualY - 1;
+ pSiS->HaveNonRect = TRUE;
+ }
+ break;
+ case sisAbove:
+ x1 = pSiS->CRT1XOffs;
+ y1 = min(pSiS->maxCRT1_Y2, pScrn1->virtualY - pSiS->maxCRT1_Y1);
+ if(y1 < 0) y1 = 0;
+ w1 = realvirtX;
+ h1 = pScrn1->virtualY - y1;
+ if((usenonrect) && (pSiS->maxCRT1_X1 != realvirtX)) {
+ w1 = pSiS->MBXNR1XMAX = pSiS->maxCRT1_X1;
+ pSiS->NonRectDead.x0 = x1 + w1;
+ pSiS->NonRectDead.x1 = pScrn1->virtualX - 1;
+ pSiS->NonRectDead.y0 = y1;
+ pSiS->NonRectDead.y1 = y1 + h1 - 1;
+ pSiS->HaveNonRect = TRUE;
+ }
+ x2 = pSiS->CRT2XOffs;
+ y2 = 0;
+ w2 = realvirtX;
+ h2 = max(pSiS->maxCRT2_Y2, pScrn1->virtualY - pSiS->maxCRT2_Y1);
+ if(h2 > pScrn1->virtualY) h2 = pScrn1->virtualY;
+ if((usenonrect) && (pSiS->maxCRT2_X2 != realvirtX)) {
+ w2 = pSiS->MBXNR2XMAX = pSiS->maxCRT2_X2;
+ pSiS->NonRectDead.x0 = x2 + w2;
+ pSiS->NonRectDead.x1 = pScrn1->virtualX - 1;
+ pSiS->NonRectDead.y0 = y2;
+ pSiS->NonRectDead.y1 = y2 + h2 - 1;
+ pSiS->HaveNonRect = TRUE;
+ }
+ break;
+ case sisBelow:
+ x1 = pSiS->CRT1XOffs;
+ y1 = 0;
+ w1 = realvirtX;
+ h1 = max(pSiS->maxCRT1_Y1, pScrn1->virtualY - pSiS->maxCRT1_Y2);
+ if(h1 > pScrn1->virtualY) h1 = pScrn1->virtualY;
+ if((usenonrect) && (pSiS->maxCRT1_X1 != realvirtX)) {
+ w1 = pSiS->MBXNR1XMAX = pSiS->maxCRT1_X1;
+ pSiS->NonRectDead.x0 = x1 + w1;
+ pSiS->NonRectDead.x1 = pScrn1->virtualX - 1;
+ pSiS->NonRectDead.y0 = y1;
+ pSiS->NonRectDead.y1 = y1 + h1 - 1;
+ pSiS->HaveNonRect = TRUE;
+ }
+ x2 = pSiS->CRT2XOffs;
+ y2 = min(pSiS->maxCRT2_Y1, pScrn1->virtualY - pSiS->maxCRT2_Y2);
+ if(y2 < 0) y2 = 0;
+ w2 = realvirtX;
+ h2 = pScrn1->virtualY - y2;
+ if((usenonrect) && (pSiS->maxCRT2_X2 != realvirtX)) {
+ w2 = pSiS->MBXNR2XMAX = pSiS->maxCRT2_X2;
+ pSiS->NonRectDead.x0 = x2 + w2;
+ pSiS->NonRectDead.x1 = pScrn1->virtualX - 1;
+ pSiS->NonRectDead.y0 = y2;
+ pSiS->NonRectDead.y1 = y2 + h2 - 1;
+ pSiS->HaveNonRect = TRUE;
+ }
+ default:
+ break;
+ }
+
+ switch(pSiS->CRT2Position) {
+ case sisLeftOf:
+ case sisRightOf:
+ if(pSiS->CRT1YOffs) {
+ pSiS->OffDead1.x0 = x1;
+ pSiS->OffDead1.x1 = x1 + w1 - 1;
+ pSiS->OffDead1.y0 = 0;
+ pSiS->OffDead1.y1 = y1 - 1;
+ pSiS->OffDead2.x0 = x2;
+ pSiS->OffDead2.x1 = x2 + w2 - 1;
+ pSiS->OffDead2.y0 = y2 + h2;
+ pSiS->OffDead2.y1 = pScrn1->virtualY - 1;
+ pSiS->HaveOffsRegions = TRUE;
+ } else if(pSiS->CRT2YOffs) {
+ pSiS->OffDead1.x0 = x2;
+ pSiS->OffDead1.x1 = x2 + w2 - 1;
+ pSiS->OffDead1.y0 = 0;
+ pSiS->OffDead1.y1 = y2 - 1;
+ pSiS->OffDead2.x0 = x1;
+ pSiS->OffDead2.x1 = x1 + w1 - 1;
+ pSiS->OffDead2.y0 = y1 + h1;
+ pSiS->OffDead2.y1 = pScrn1->virtualY - 1;
+ pSiS->HaveOffsRegions = TRUE;
+ }
+ break;
+ case sisAbove:
+ case sisBelow:
+ if(pSiS->CRT1XOffs) {
+ pSiS->OffDead1.x0 = x2 + w2;
+ pSiS->OffDead1.x1 = pScrn1->virtualX - 1;
+ pSiS->OffDead1.y0 = y2;
+ pSiS->OffDead1.y1 = y2 + h2 - 1;
+ pSiS->OffDead2.x0 = 0;
+ pSiS->OffDead2.x1 = x1 - 1;
+ pSiS->OffDead2.y0 = y1;
+ pSiS->OffDead2.y1 = y1 + h1 - 1;
+ pSiS->HaveOffsRegions = TRUE;
+ } else if(pSiS->CRT2XOffs) {
+ pSiS->OffDead1.x0 = x1 + w1;
+ pSiS->OffDead1.x1 = pScrn1->virtualX - 1;
+ pSiS->OffDead1.y0 = y1;
+ pSiS->OffDead1.y1 = y1 + h1 - 1;
+ pSiS->OffDead2.x0 = 0;
+ pSiS->OffDead2.x1 = x2 - 1;
+ pSiS->OffDead2.y0 = y2;
+ pSiS->OffDead2.y1 = y2 + h2 - 1;
+ pSiS->HaveOffsRegions = TRUE;
+ }
+ default:
+ break;
+ }
+
+ } else { /* Only clone-modes left */
+
+ x1 = x2 = 0;
+ y1 = y2 = 0;
+ w1 = w2 = max(pSiS->maxClone_X1, pSiS->maxClone_X2);
+ h1 = h2 = max(pSiS->maxClone_Y1, pSiS->maxClone_Y2);
+
}
SiSXineramadataPtr[crt1scrnnum].x = x1;
@@ -1791,11 +2067,32 @@ SiSUpdateXineramaScreenInfo(ScrnInfoPtr pScrn1)
if(infochanged) {
xf86DrvMsg(pScrn1->scrnIndex, X_INFO,
- "Pseudo-Xinerama: CRT1 (Screen %d) (%d,%d)-(%d,%d)\n",
- crt1scrnnum, x1, y1, w1+x1-1, h1+y1-1);
+ "Pseudo-Xinerama: CRT1 (Screen %d) (%d,%d)-(%d,%d)\n",
+ crt1scrnnum, x1, y1, w1+x1-1, h1+y1-1);
xf86DrvMsg(pScrn1->scrnIndex, X_INFO,
- "Pseudo-Xinerama: CRT2 (Screen %d) (%d,%d)-(%d,%d)\n",
- crt2scrnnum, x2, y2, w2+x2-1, h2+y2-1);
+ "Pseudo-Xinerama: CRT2 (Screen %d) (%d,%d)-(%d,%d)\n",
+ crt2scrnnum, x2, y2, w2+x2-1, h2+y2-1);
+ if(pSiS->HaveNonRect) {
+ xf86DrvMsg(pScrn1->scrnIndex, X_INFO,
+ "Pseudo-Xinerama: Inaccessible area (%d,%d)-(%d,%d)\n",
+ pSiS->NonRectDead.x0, pSiS->NonRectDead.y0,
+ pSiS->NonRectDead.x1, pSiS->NonRectDead.y1);
+ }
+ if(pSiS->HaveOffsRegions) {
+ xf86DrvMsg(pScrn1->scrnIndex, X_INFO,
+ "Pseudo-Xinerama: Inaccessible offset area (%d,%d)-(%d,%d)\n",
+ pSiS->OffDead1.x0, pSiS->OffDead1.y0,
+ pSiS->OffDead1.x1, pSiS->OffDead1.y1);
+ xf86DrvMsg(pScrn1->scrnIndex, X_INFO,
+ "Pseudo-Xinerama: Inaccessible offset area (%d,%d)-(%d,%d)\n",
+ pSiS->OffDead2.x0, pSiS->OffDead2.y0,
+ pSiS->OffDead2.x1, pSiS->OffDead2.y1);
+ }
+ if(pSiS->HaveNonRect || pSiS->HaveOffsRegions) {
+ xf86DrvMsg(pScrn1->scrnIndex, X_INFO,
+ "Mouse restriction for inaccessible areas is %s\n",
+ pSiS->MouseRestrictions ? "enabled" : "disabled");
+ }
}
}
@@ -1954,7 +2251,7 @@ SiSProcXineramaQueryScreens(ClientPtr client)
swaps(&scratch.x_org, n);
swaps(&scratch.y_org, n);
swaps(&scratch.width, n);
- swaps(&scratch.height, n);
+ swaps(&scratch.height, n);
}
WriteToClient(client, sz_XineramaScreenInfo, (char *)&scratch);
}
@@ -2080,43 +2377,48 @@ SiSXineramaResetProc(ExtensionEntry* extEntry)
static void
SiSXineramaExtensionInit(ScrnInfoPtr pScrn)
{
- SISPtr pSiS = SISPTR(pScrn);
+ SISPtr pSiS = SISPTR(pScrn);
Bool success = FALSE;
if(!(SiSXineramadataPtr)) {
if(!pSiS->MergedFB) {
- SiSnoPanoramiXExtension = TRUE;
- return;
+ SiSnoPanoramiXExtension = TRUE;
+ pSiS->MouseRestrictions = FALSE;
+ return;
}
#ifdef PANORAMIX
if(!noPanoramiXExtension) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Xinerama active, not initializing SiS Pseudo-Xinerama\n");
- SiSnoPanoramiXExtension = TRUE;
- return;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Xinerama active, not initializing SiS Pseudo-Xinerama\n");
+ SiSnoPanoramiXExtension = TRUE;
+ pSiS->MouseRestrictions = FALSE;
+ return;
}
#endif
if(SiSnoPanoramiXExtension) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "SiS Pseudo-Xinerama disabled\n");
- return;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "SiS Pseudo-Xinerama disabled\n");
+ pSiS->MouseRestrictions = FALSE;
+ return;
}
if(pSiS->CRT2Position == sisClone) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Running MergedFB in Clone mode, SiS Pseudo-Xinerama disabled\n");
- SiSnoPanoramiXExtension = TRUE;
- return;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Running MergedFB in Clone mode, SiS Pseudo-Xinerama disabled\n");
+ SiSnoPanoramiXExtension = TRUE;
+ pSiS->MouseRestrictions = FALSE;
+ return;
}
if(!(pSiS->AtLeastOneNonClone)) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Only Clone modes defined, SiS Pseudo-Xinerama disabled\n");
- SiSnoPanoramiXExtension = TRUE;
- return;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Only Clone modes defined, SiS Pseudo-Xinerama disabled\n");
+ SiSnoPanoramiXExtension = TRUE;
+ pSiS->MouseRestrictions = FALSE;
+ return;
}
SiSXineramaNumScreens = 2;
@@ -2139,13 +2441,14 @@ SiSXineramaExtensionInit(ScrnInfoPtr pScrn)
}
if(!success) {
- SISErrorLog(pScrn, "Failed to initialize SiS Pseudo-Xinerama extension\n");
- SiSnoPanoramiXExtension = TRUE;
- return;
+ SISErrorLog(pScrn, "Failed to initialize SiS Pseudo-Xinerama extension\n");
+ SiSnoPanoramiXExtension = TRUE;
+ pSiS->MouseRestrictions = FALSE;
+ return;
}
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "SiS Pseudo-Xinerama extension initialized\n");
+ "SiS Pseudo-Xinerama extension initialized\n");
pSiS->SiSXineramaVX = 0;
pSiS->SiSXineramaVY = 0;
@@ -2162,13 +2465,13 @@ SiSFreeCRT2Structs(SISPtr pSiS)
{
if(pSiS->CRT2pScrn) {
if(pSiS->CRT2pScrn->modes) {
- while(pSiS->CRT2pScrn->modes)
- xf86DeleteMode(&pSiS->CRT2pScrn->modes, pSiS->CRT2pScrn->modes);
+ while(pSiS->CRT2pScrn->modes)
+ xf86DeleteMode(&pSiS->CRT2pScrn->modes, pSiS->CRT2pScrn->modes);
}
if(pSiS->CRT2pScrn->monitor) {
- if(pSiS->CRT2pScrn->monitor->Modes) {
- while(pSiS->CRT2pScrn->monitor->Modes)
- xf86DeleteMode(&pSiS->CRT2pScrn->monitor->Modes, pSiS->CRT2pScrn->monitor->Modes);
+ if(pSiS->CRT2pScrn->monitor->Modes) {
+ while(pSiS->CRT2pScrn->monitor->Modes)
+ xf86DeleteMode(&pSiS->CRT2pScrn->monitor->Modes, pSiS->CRT2pScrn->monitor->Modes);
}
if(pSiS->CRT2pScrn->monitor->DDC) xfree(pSiS->CRT2pScrn->monitor->DDC);
xfree(pSiS->CRT2pScrn->monitor);
@@ -2273,13 +2576,51 @@ SiSDoPrivateDDC(ScrnInfoPtr pScrn, int *crtnum)
}
}
+static void
+SiSFindAspect(ScrnInfoPtr pScrn, xf86MonPtr pMonitor, int crtnum)
+{
+ SISPtr pSiS = SISPTR(pScrn);
+ int UseWide = 0;
+ int aspect = 0;
+ Bool fromdim = FALSE;
+
+ if((pSiS->VGAEngine == SIS_315_VGA) && (!DIGITAL(pMonitor->features.input_type))) {
+ if(pMonitor->features.hsize && pMonitor->features.vsize) {
+ aspect = (pMonitor->features.hsize * 1000) / pMonitor->features.vsize;
+ if(aspect >= 1400) UseWide = 1;
+ fromdim = TRUE;
+ } else if((PREFERRED_TIMING_MODE(pMonitor->features.msc)) &&
+ (pMonitor->det_mon[0].type == DT)) {
+ aspect = (pMonitor->det_mon[0].section.d_timings.h_active * 1000) /
+ pMonitor->det_mon[0].section.d_timings.v_active;
+ if(aspect >= 1400) UseWide = 1;
+ }
+ if(aspect) {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "According to %s, CRT%d aspect ratio is %.2f:1 (%s)\n",
+ fromdim ? "DDC size" : "preferred mode",
+ crtnum, (float)aspect / 1000.0, UseWide ? "wide" : "normal");
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Unable to determine CRT%d aspect ratio, assuming \"normal\"\n",
+ crtnum);
+ }
+ }
+
+ if((crtnum == 1) && (pSiS->SiS_Pr->SiS_UseWide == -1)) {
+ pSiS->SiS_Pr->SiS_UseWide = UseWide;
+ } else if((crtnum == 2) && (pSiS->SiS_Pr->SiS_UseWideCRT2 == -1)) {
+ pSiS->SiS_Pr->SiS_UseWideCRT2 = UseWide;
+ }
+}
+
static Bool
SiSMakeOwnModeList(ScrnInfoPtr pScrn, Bool acceptcustommodes, Bool includelcdmodes,
- Bool isfordvi, Bool *havecustommodes, Bool fakecrt2modes)
+ Bool isfordvi, Bool *havecustommodes, Bool fakecrt2modes, Bool IsForCRT2)
{
DisplayModePtr tempmode, delmode, mymodes;
- if((mymodes = SiSBuildBuiltInModeList(pScrn, includelcdmodes, isfordvi, fakecrt2modes))) {
+ if((mymodes = SiSBuildBuiltInModeList(pScrn, includelcdmodes, isfordvi, fakecrt2modes, IsForCRT2))) {
if(!acceptcustommodes) {
while(pScrn->monitor->Modes)
xf86DeleteMode(&pScrn->monitor->Modes, pScrn->monitor->Modes);
@@ -2460,7 +2801,7 @@ SiS_MapVGAMem(ScrnInfoPtr pScrn)
}
if(!SiSVGAMapMem(pScrn)) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Failed to map VGA memory (0x%lx), can't save/restore console fonts\n",
+ "Failed to map VGA memory (0x%lx), can't save/restore console fonts\n",
pSiS->VGAMapPhys);
}
}
@@ -2493,18 +2834,18 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
Bool crt2freqoverruled = FALSE;
#endif
- static const char *ddcsstr = "CRT%d DDC monitor info: ************************************\n";
- static const char *ddcestr = "End of CRT%d DDC monitor info ******************************\n";
- 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";
+ static const char *ddcsstr = "CRT%d DDC monitor info: *******************************************\n";
+ static const char *ddcestr = "End of CRT%d DDC monitor info *************************************\n";
+ static const char *subshstr = "Substituting missing CRT%d monitor HSync range by DDC data\n";
+ static const char *subsvstr = "Substituting missing CRT%d monitor VRefresh range by DDC data\n";
static const char *saneh = "Correcting %s CRT%d monitor HSync range\n";
static const char *sanev = "Correcting %s 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";
+ static const char *mergednocrt2 = "No CRT2 output selected or no video bridge detected. %s.\n";
static const char *mergeddisstr = "MergedFB mode disabled";
- static const char *modesforstr = "Modes for CRT%d: *********************************************\n";
- static const char *crtsetupstr = "------------------------ CRT%d setup -------------------------\n";
+ static const char *modesforstr = "Modes for CRT%d: **************************************************\n";
+ static const char *crtsetupstr = "*************************** CRT%d setup ***************************\n";
static const char *crt2monname = "CRT2";
#endif
#if defined(SISDUALHEAD) || defined(SISMERGED)
@@ -2556,11 +2897,11 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
*/
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "SiS driver (%d/%02d/%02d-%d, compiled for " SISMYSERVERNAME " %d.%d.%d.%d)\n",
+ "SiS driver (%d/%02d/%02d-%d, compiled for " SISMYSERVERNAME " %d.%d.%d.%d)\n",
SISDRIVERVERSIONYEAR + 2000, SISDRIVERVERSIONMONTH,
SISDRIVERVERSIONDAY, SISDRIVERREVISION,
#ifdef XORG_VERSION_CURRENT
- XORG_VERSION_MAJOR, XORG_VERSION_MINOR,
+ XORG_VERSION_MAJOR, XORG_VERSION_MINOR,
XORG_VERSION_PATCH, XORG_VERSION_SNAP
#else
XF86_VERSION_MAJOR, XF86_VERSION_MINOR,
@@ -2570,7 +2911,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Copyright (C) 2001-2005 Thomas Winischhofer <thomas@winischhofer.net> and others\n");
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "*** See http://www.winischhofer.at/linuxsisvga.shtml\n");
+ "*** See http://www.winischhofer.at/linuxsisvga.shtml\n");
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"*** for documentation and updates.\n");
@@ -2638,7 +2979,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->Primary = xf86IsPrimaryPci(pSiS->PciInfo);
if(!pSiS->Primary) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "This adapter is a secondary display adapter\n");
+ "This adapter is a secondary display adapter\n");
}
#ifdef SIS_NEED_MAP_IOP
@@ -2691,27 +3032,27 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if(!pSiS->Primary) {
#if !defined(__alpha__)
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Initializing display adapter through int10\n");
+ "Initializing display adapter through int10\n");
#endif
if(xf86LoadSubModule(pScrn, "int10")) {
- xf86LoaderReqSymLists(int10Symbols, NULL);
+ xf86LoaderReqSymLists(int10Symbols, NULL);
#if !defined(__alpha__)
- pSiS->pInt = xf86InitInt10(pSiS->pEnt->index);
+ pSiS->pInt = xf86InitInt10(pSiS->pEnt->index);
#endif
} else {
- SISErrorLog(pScrn, "Could not load int10 module\n");
+ SISErrorLog(pScrn, "Could not load int10 module\n");
}
}
#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
{
- resRange vgamem[] = {
+ resRange vgamem[] = {
{ResShrMemBlock,0xA0000,0xAFFFF},
{ResShrMemBlock,0xB0000,0xB7FFF},
{ResShrMemBlock,0xB8000,0xBFFFF},
_END
};
- xf86SetOperatingState(vgamem, pSiS->pEnt->index, ResUnusedOpr);
+ xf86SetOperatingState(vgamem, pSiS->pEnt->index, ResUnusedOpr);
}
#else
xf86SetOperatingState(resVgaMem, pSiS->pEnt->index, ResUnusedOpr);
@@ -2782,7 +3123,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
((pSiS->ChipRev == 0x0a) ? "AGP (G0)" :
((pSiS->ChipRev == 0x0b) ? "AGP (H0)" :
(((pSiS->ChipRev & 0xf0) == 0xd0) ? "DVD (Dx/H0)" :
- (((pSiS->ChipRev & 0xf0) == 0x90) ? "(9x)" :
+ (((pSiS->ChipRev & 0xf0) == 0x90) ? "(9x)" :
(((pSiS->ChipRev & 0xf0) == 0xc0) ? "(Cx)" :
"(unknown)"))))),
pSiS->ChipRev);
@@ -2815,7 +3156,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
/* Reset some entries */
- pSiS->SiSFastVidCopy = pSiS->SiSFastMemCopy = SiSVidCopyGetDefault();
+ pSiS->SiSFastVidCopy = SiSVidCopyGetDefault();
+ pSiS->SiSFastMemCopy = SiSVidCopyGetDefault();
pSiS->SiSFastVidCopyDone = FALSE;
/* Always do a ValidMode() inside Switchmode() */
@@ -2827,6 +3169,9 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->HWCursorMBufNum = pSiS->HWCursorCBufNum = 0;
pSiS->NeedFlush = FALSE;
pSiS->NewCRLayout = FALSE;
+ pSiS->SiS760VLFB = FALSE;
+ pSiS->SiS760VLFBBase = 0;
+ pSiS->SiS760VLFBSize = 0;
switch(pSiS->Chipset) {
case PCI_CHIP_SIS530:
@@ -2885,8 +3230,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
break;
case PCI_CHIP_SIS550:
pSiS->sishw_ext.jChipType = SIS_550;
- pSiS->VGAEngine = SIS_315_VGA;
pSiS->ChipFlags |= (SiSCF_Integrated | SiSCF_MMIOPalette);
+ pSiS->VGAEngine = SIS_315_VGA;
pSiS->SiS_SD_Flags |= SiS_SD_IS315SERIES;
pSiS->myCR63 = 0x63;
pSiS->mmioSize = 128;
@@ -2910,7 +3255,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->myCR63 = 0x53; /* sic! */
pSiS->mmioSize = 256;
break;
- case PCI_CHIP_SIS660: /* 660, 661, 741, 760 */
+ case PCI_CHIP_SIS660: /* 660, 661, 741, 760, 761 */
{
ULong hpciid = pciReadLong(0x00000000, 0x00);
switch(hpciid) {
@@ -2926,6 +3271,18 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->mmioSize = 256;
pSiS->NeedFlush = TRUE;
break;
+ case 0x07611039:
+ pSiS->sishw_ext.jChipType = SIS_761;
+ pSiS->ChipFlags |= SiSCF_Ultra256Core;
+ pSiS->mmioSize = 256;
+ pSiS->NeedFlush = TRUE;
+ break;
+ case 0x07701039:
+ pSiS->sishw_ext.jChipType = SIS_770;
+ pSiS->ChipFlags |= SiSCF_Ultra256Core;
+ pSiS->mmioSize = 256;
+ pSiS->NeedFlush = TRUE;
+ break;
case 0x07411039:
pSiS->sishw_ext.jChipType = SIS_741;
pSiS->ChipFlags |= SiSCF_Real256ECore;
@@ -2936,6 +3293,11 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->sishw_ext.jChipType = SIS_661;
pSiS->ChipFlags |= SiSCF_Real256ECore;
pSiS->mmioSize = 128;
+ break;
+ case 0x06701039:
+ pSiS->sishw_ext.jChipType = SIS_670;
+ pSiS->ChipFlags |= SiSCF_Real256ECore;
+ pSiS->mmioSize = 128;
}
/* Detection could also be done by CR5C & 0xf8:
* 0x10 = 661 (CR5F & 0xc0: 0x00 both A0 and A1)
@@ -2943,7 +3305,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
* 0x90 = 741 (CR5F & 0xc0: 0x00 A0,A1 0x40 A2)
* other: 660 (CR5F & 0xc0: 0x00 A0 0x40 A1) (DOA?)
* !!! BUT WE DO NOT HAVE RelIO AT THIS POINT YET !!!
- */
+ */
pSiS->VGAEngine = SIS_315_VGA;
pSiS->ChipFlags |= (SiSCF_Integrated | SiSCF_MMIOPalette);
pSiS->SiS_SD_Flags |= SiS_SD_IS330SERIES;
@@ -2956,7 +3318,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->VGAEngine = SIS_315_VGA;
pSiS->ChipFlags |= (SiSCF_XabreCore | SiSCF_MMIOPalette);
pSiS->SiS_SD_Flags |= SiS_SD_IS340SERIES;
- pSiS->myCR63 = 0x53; /* sic! */
+ pSiS->myCR63 = 0x53;
pSiS->mmioSize = 256;
pSiS->NewCRLayout = TRUE;
break;
@@ -2968,7 +3330,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
/* Now check if sisfb is loaded. Since sisfb only supports
- * the 300 and 315 series, we only do this for these chips.
+ * the 300 and 315/330 series, we only do this for these chips.
* 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).
@@ -2991,6 +3353,10 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->sisfb_tvposvalid = FALSE;
pSiS->sisfbdevname[0] = 0;
pSiS->sisfb_havelock = FALSE;
+ pSiS->sisfbHaveNewHeapDef = FALSE;
+ pSiS->sisfbHeapSize = 0;
+ pSiS->sisfbVideoOffset = 0;
+ pSiS->sisfbxSTN = FALSE;
if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) {
@@ -3036,71 +3402,85 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if(gotit) {
- if(mysisfbinfo->sisfb_id == SISFB_ID) {
+ if(mysisfbinfo->sisfb_id == SISFB_ID) {
- sisfbversion = (mysisfbinfo->sisfb_version << 16) |
- (mysisfbinfo->sisfb_revision << 8) |
- (mysisfbinfo->sisfb_patchlevel);
+ 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;
+ (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,
- "%s: SiS kernel fb driver (sisfb) %d.%d.%d detected (PCI: %d:%d.%d)\n",
- &name[5],
- mysisfbinfo->sisfb_version,
- mysisfbinfo->sisfb_revision,
- mysisfbinfo->sisfb_patchlevel,
- pSiS->PciInfo->bus,
- pSiS->PciInfo->device,
- pSiS->PciInfo->func);
+ "%s: SiS kernel fb driver (sisfb) %d.%d.%d detected (PCI: %d:%d.%d)\n",
+ &name[5],
+ 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");
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Old version of sisfb found. Please update.\n");
}
/* Basically, we can't trust the pdc register if sisfb is loaded */
pSiS->donttrustpdc = TRUE;
- pSiS->sisfbMem = mysisfbinfo->heapstart;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "sisfb: memory heap starts at %dKB\n", (int)pSiS->sisfbMem);
+ pSiS->sisfbHeapStart = mysisfbinfo->heapstart;
+
+ if(sisfbversion >= 0x010714) {
+ pSiS->sisfbHeapSize = mysisfbinfo->sisfb_heapsize;
+ pSiS->sisfbVideoOffset = mysisfbinfo->sisfb_videooffset;
+ pSiS->sisfbHaveNewHeapDef = TRUE;
+ pSiS->sisfbFSTN = mysisfbinfo->sisfb_curfstn;
+ pSiS->sisfbDSTN = mysisfbinfo->sisfb_curdstn;
+ pSiS->sisfbxSTN = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "sisfb: memory heap starts at %dKB, size %dKB, viewport at %dKB\n",
+ (int)pSiS->sisfbHeapStart, (int)pSiS->sisfbHeapSize,
+ (int)pSiS->sisfbVideoOffset/1024);
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "sisfb: memory heap starts at %dKB\n", (int)pSiS->sisfbHeapStart);
+ }
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "sisfb: using video mode 0x%02x\n", mysisfbinfo->fbvidmode);
+ "sisfb: using video mode 0x%02x\n", mysisfbinfo->fbvidmode);
pSiS->OldMode = mysisfbinfo->fbvidmode;
if(sisfbversion >= 0x010506) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "sisfb: %sreserved HW cursor, using %s cmd queue\n",
- (mysisfbinfo->sisfb_caps & 0x80) ? "" : "not ",
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "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");
+ (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;
+ /* 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;
+ /* 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(pSiS->VGAEngine == SIS_315_VGA) {
+ pSiS->sisfblcda = mysisfbinfo->sisfb_lcda;
}
}
if(sisfbversion >= 0x01060D) {
@@ -3126,8 +3506,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->sisfbpdca = mysisfbinfo->sisfb_lcdpdca;
} else {
if(pSiS->sisfbpdc) {
- pSiS->sisfbpdca = (pSiS->sisfbpdc & 0xf0) >> 3;
- pSiS->sisfbpdc = (pSiS->sisfbpdc & 0x0f) << 1;
+ pSiS->sisfbpdca = (pSiS->sisfbpdc & 0xf0) >> 3;
+ pSiS->sisfbpdc = (pSiS->sisfbpdc & 0x0f) << 1;
} else {
pSiS->sisfbpdca = pSiS->sisfbpdc = 0xff;
}
@@ -3167,22 +3547,22 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
*/
switch(pSiS->VGAEngine) {
case SIS_300_VGA:
- pSiS->CursorSize = 4096;
- pix24flags = Support32bppFb;
+ pSiS->CursorSize = 4096;
+ pix24flags = Support32bppFb;
break;
case SIS_315_VGA:
- pSiS->CursorSize = 16384;
- pix24flags = Support32bppFb;
+ pSiS->CursorSize = 16384;
+ pix24flags = Support32bppFb;
break;
case SIS_530_VGA:
- pSiS->CursorSize = 2048;
- pix24flags = Support32bppFb |
- Support24bppFb |
+ pSiS->CursorSize = 2048;
+ pix24flags = Support32bppFb |
+ Support24bppFb |
SupportConvert32to24;
break;
default:
- pSiS->CursorSize = 2048;
- pix24flags = Support24bppFb |
+ pSiS->CursorSize = 2048;
+ pix24flags = Support24bppFb |
SupportConvert32to24 |
PreferConvert32to24;
break;
@@ -3197,7 +3577,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
*/
if(xf86IsEntityShared(pScrn->entityList[0])) {
if(pSiSEnt->lastInstance > 0) {
- if(!xf86IsPrimInitDone(pScrn->entityList[0])) {
+ if(!xf86IsPrimInitDone(pScrn->entityList[0])) {
/* First Head (always CRT2) */
pSiS->SecondHead = FALSE;
pSiSEnt->pScrn_1 = pScrn;
@@ -3217,8 +3597,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->DualHeadMode = TRUE;
}
} else {
- /* Only one screen in config file - disable dual head mode */
- pSiS->SecondHead = FALSE;
+ /* Only one screen in config file - disable dual head mode */
+ pSiS->SecondHead = FALSE;
pSiS->DualHeadMode = FALSE;
pSiSEnt->DisableDual = TRUE;
}
@@ -3240,13 +3620,13 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
#endif
if(!pSiS->SiS_Pr) {
if(!(pSiS->SiS_Pr = xnfcalloc(sizeof(SiS_Private), 1))) {
- SISErrorLog(pScrn, "Could not allocate memory for SiS_Pr structure\n");
+ SISErrorLog(pScrn, "Could not allocate memory for SiS_Pr structure\n");
#ifdef SISDUALHEAD
if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE;
#endif
if(pSiS->pInt) xf86FreeInt10(pSiS->pInt);
SISFreeRec(pScrn);
- return FALSE;
+ return FALSE;
}
#ifdef SISDUALHEAD
if(pSiSEnt) pSiSEnt->SiS_Pr = pSiS->SiS_Pr;
@@ -3256,6 +3636,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->SiS_Pr->SiS_CHOverScan = -1;
pSiS->SiS_Pr->SiS_ChSW = FALSE;
pSiS->SiS_Pr->SiS_CustomT = CUT_NONE;
+ pSiS->SiS_Pr->SiS_UseWide = -1;
+ pSiS->SiS_Pr->SiS_UseWideCRT2 = -1;
pSiS->SiS_Pr->PanelSelfDetected = FALSE;
pSiS->SiS_Pr->UsePanelScaler = -1;
pSiS->SiS_Pr->CenterScreen = -1;
@@ -3292,38 +3674,38 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if(pSiS->VGAEngine == SIS_OLD_VGA || pSiS->VGAEngine == SIS_530_VGA) {
switch(pSiS->Chipset) {
case PCI_CHIP_SG86C201:
- pSiS->oldChipset = OC_SIS86201; break;
+ pSiS->oldChipset = OC_SIS86201; break;
case PCI_CHIP_SG86C202:
- pSiS->oldChipset = OC_SIS86202; break;
+ pSiS->oldChipset = OC_SIS86202; break;
case PCI_CHIP_SG86C205:
- {
+ {
UChar temp;
sisSaveUnlockExtRegisterLock(pSiS, &srlockReg, &crlockReg);
inSISIDXREG(SISSR, 0x10, temp);
if(temp & 0x80) pSiS->oldChipset = OC_SIS6205B;
else pSiS->oldChipset = (pSiS->ChipRev == 0x11) ?
- OC_SIS6205C : OC_SIS6205A;
- break;
+ OC_SIS6205C : OC_SIS6205A;
+ break;
}
case PCI_CHIP_SIS82C204:
- pSiS->oldChipset = OC_SIS82204; break;
+ pSiS->oldChipset = OC_SIS82204; break;
case 0x6225:
- pSiS->oldChipset = OC_SIS6225; break;
+ pSiS->oldChipset = OC_SIS6225; break;
case PCI_CHIP_SIS5597:
- pSiS->oldChipset = OC_SIS5597; break;
+ pSiS->oldChipset = OC_SIS5597; break;
case PCI_CHIP_SIS6326:
- pSiS->oldChipset = OC_SIS6326; break;
+ pSiS->oldChipset = OC_SIS6326; break;
case PCI_CHIP_SIS530:
- if(pciReadLong(0x00000000, 0x00) == 0x06201039) {
+ if(pciReadLong(0x00000000, 0x00) == 0x06201039) {
pSiS->oldChipset = OC_SIS620;
} else {
- if((pSiS->ChipRev & 0x0f) < 0x0a)
- pSiS->oldChipset = OC_SIS530A;
+ if((pSiS->ChipRev & 0x0f) < 0x0a)
+ pSiS->oldChipset = OC_SIS530A;
else pSiS->oldChipset = OC_SIS530B;
}
break;
default:
- pSiS->oldChipset = OC_UNKNOWN;
+ pSiS->oldChipset = OC_UNKNOWN;
}
}
@@ -3349,7 +3731,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
(pSiS->VGAEngine == SIS_315_VGA)) {
temp = 1;
}
- break;
+ break;
default:
temp = 1;
}
@@ -3395,10 +3777,10 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
#endif
if(pSiS->pInt) xf86FreeInt10(pSiS->pInt);
SISFreeRec(pScrn);
- return FALSE;
+ return FALSE;
} else {
- Bool ret = FALSE;
- switch(pScrn->depth) {
+ Bool ret = FALSE;
+ switch(pScrn->depth) {
case 15:
if((pScrn->weight.red != 5) ||
(pScrn->weight.green != 5) ||
@@ -3414,10 +3796,10 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
(pScrn->weight.green != 8) ||
(pScrn->weight.blue != 8)) ret = TRUE;
break;
- }
+ }
if(ret) {
SISErrorLog(pScrn,
- "RGB weight %d%d%d at depth %d not supported by hardware\n",
+ "RGB weight %d%d%d at depth %d not supported by hardware\n",
(int)pScrn->weight.red, (int)pScrn->weight.green,
(int)pScrn->weight.blue, pScrn->depth);
#ifdef SISDUALHEAD
@@ -3425,7 +3807,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
#endif
if(pSiS->pInt) xf86FreeInt10(pSiS->pInt);
SISFreeRec(pScrn);
- return FALSE;
+ return FALSE;
}
}
}
@@ -3446,15 +3828,15 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
} else {
/* We don't support DirectColor at > 8bpp */
if(pScrn->depth > 8 && pScrn->defaultVisual != TrueColor) {
- SISErrorLog(pScrn,
+ SISErrorLog(pScrn,
"Given default visual (%s) is not supported at depth %d\n",
- xf86GetVisualName(pScrn->defaultVisual), pScrn->depth);
+ xf86GetVisualName(pScrn->defaultVisual), pScrn->depth);
#ifdef SISDUALHEAD
if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE;
#endif
if(pSiS->pInt) xf86FreeInt10(pSiS->pInt);
SISFreeRec(pScrn);
- return FALSE;
+ return FALSE;
}
}
@@ -3462,7 +3844,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
/* Due to palette & timing problems we don't support 8bpp in DHM */
if((pSiS->DualHeadMode) && (pScrn->bitsPerPixel <= 8)) {
SISErrorLog(pScrn, "Color depth %d not supported in Dual Head mode.\n",
- pScrn->bitsPerPixel);
+ pScrn->bitsPerPixel);
if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE;
if(pSiS->pInt) xf86FreeInt10(pSiS->pInt);
SISFreeRec(pScrn);
@@ -3482,20 +3864,20 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
#ifdef SISDUALHEAD
if(pSiSEnt) {
- if(pSiSEnt->BIOS) {
+ if(pSiSEnt->BIOS) {
pSiS->BIOS = pSiSEnt->BIOS;
pSiS->sishw_ext.pjVirtualRomBase = pSiS->BIOS;
pSiS->ROM661New = pSiSEnt->ROM661New;
- }
+ }
}
#endif
if(!pSiS->BIOS) {
- if(!(pSiS->BIOS = xcalloc(1, BIOS_SIZE))) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ if(!(pSiS->BIOS = xcalloc(1, BIOS_SIZE))) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Could not allocate memory for video BIOS image\n");
- } else {
+ } else {
ULong segstart;
- UShort mypciid = pSiS->Chipset;
+ UShort mypciid = pSiS->Chipset;
Bool found = FALSE, readpci = FALSE;
switch(pSiS->sishw_ext.jChipType) {
@@ -3508,17 +3890,17 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
if(readpci) {
- xf86ReadPciBIOS(0, pSiS->PciTag, 0, pSiS->BIOS, BIOS_SIZE);
+ 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) {
+ 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(!SISCheckBIOS(pSiS, mypciid)) continue;
@@ -3529,25 +3911,25 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
if(!found) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Could not find/read video BIOS\n");
- xfree(pSiS->BIOS);
- pSiS->BIOS = NULL;
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Could not find/read video BIOS\n");
+ xfree(pSiS->BIOS);
+ pSiS->BIOS = NULL;
} else {
- UShort romptr;
- pSiS->sishw_ext.pjVirtualRomBase = pSiS->BIOS;
+ UShort 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 (%s data layout)\n",
&pSiS->BIOS[romptr], pSiS->ROM661New ? "new" : "old");
#ifdef SISDUALHEAD
- if(pSiSEnt) {
+ if(pSiSEnt) {
pSiSEnt->BIOS = pSiS->BIOS;
pSiSEnt->ROM661New = pSiS->ROM661New;
}
#endif
- }
+ }
}
}
if(pSiS->BIOS) pSiS->sishw_ext.UseROM = TRUE;
@@ -3561,7 +3943,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
/* Due to palette & timing problems we don't support 8bpp in MFBM */
if((pSiS->MergedFB) && (pScrn->bitsPerPixel <= 8)) {
SISErrorLog(pScrn, "MergedFB: Color depth %d not supported, %s\n",
- pScrn->bitsPerPixel, mergeddisstr);
+ pScrn->bitsPerPixel, mergeddisstr);
pSiS->MergedFB = pSiS->MergedFBAuto = FALSE;
}
#endif
@@ -3590,7 +3972,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if(pSiS->DualHeadMode) {
if(!pSiS->SecondHead) {
/* Copy some option settings to entity private */
- pSiSEnt->HWCursor = pSiS->HWCursor;
+ pSiSEnt->HWCursor = pSiS->HWCursor;
pSiSEnt->NoAccel = pSiS->NoAccel;
pSiSEnt->restorebyset = pSiS->restorebyset;
pSiSEnt->OptROMUsage = pSiS->OptROMUsage;
@@ -3598,6 +3980,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiSEnt->TurboQueue = pSiS->TurboQueue;
pSiSEnt->forceCRT1 = pSiS->forceCRT1;
pSiSEnt->ForceCRT1Type = pSiS->ForceCRT1Type;
+ pSiSEnt->CRT1TypeForced = pSiS->CRT1TypeForced;
pSiSEnt->ForceCRT2Type = pSiS->ForceCRT2Type;
pSiSEnt->ForceTVType = pSiS->ForceTVType;
pSiSEnt->ForceYPbPrType = pSiS->ForceYPbPrType;
@@ -3605,6 +3988,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiSEnt->UsePanelScaler = pSiS->UsePanelScaler;
pSiSEnt->CenterLCD = pSiS->CenterLCD;
pSiSEnt->DSTN = pSiS->DSTN;
+ pSiSEnt->FSTN = pSiS->FSTN;
pSiSEnt->OptTVStand = pSiS->OptTVStand;
pSiSEnt->NonDefaultPAL = pSiS->NonDefaultPAL;
pSiSEnt->NonDefaultNTSC = pSiS->NonDefaultNTSC;
@@ -3642,7 +4026,6 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiSEnt->AllowHotkey = pSiS->AllowHotkey;
pSiSEnt->enablesisctrl = pSiS->enablesisctrl;
pSiSEnt->SenseYPbPr = pSiS->SenseYPbPr;
- pSiSEnt->XvDefAdaptorBlit = pSiS->XvDefAdaptorBlit;
pSiSEnt->XvUseMemcpy = pSiS->XvUseMemcpy;
pSiSEnt->BenchMemCpy = pSiS->BenchMemCpy;
#ifdef SIS_CP
@@ -3663,9 +4046,11 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->forcecrt2redetection = FALSE;
pSiS->ForceCRT1Type = pSiSEnt->ForceCRT1Type;
pSiS->ForceCRT2Type = pSiSEnt->ForceCRT2Type;
+ pSiS->CRT1TypeForced = pSiSEnt->CRT1TypeForced;
pSiS->UsePanelScaler = pSiSEnt->UsePanelScaler;
pSiS->CenterLCD = pSiSEnt->CenterLCD;
pSiS->DSTN = pSiSEnt->DSTN;
+ pSiS->FSTN = pSiSEnt->FSTN;
pSiS->OptTVStand = pSiSEnt->OptTVStand;
pSiS->NonDefaultPAL = pSiSEnt->NonDefaultPAL;
pSiS->NonDefaultNTSC = pSiSEnt->NonDefaultNTSC;
@@ -3710,7 +4095,6 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
pSiS->XvOnCRT2 = pSiSEnt->XvOnCRT2;
pSiS->enablesisctrl = pSiSEnt->enablesisctrl;
- pSiS->XvDefAdaptorBlit = pSiSEnt->XvDefAdaptorBlit;
pSiS->XvUseMemcpy = pSiSEnt->XvUseMemcpy;
pSiS->BenchMemCpy = pSiSEnt->BenchMemCpy;
/* Copy gamma brightness to Ent (sic!) for Xinerama */
@@ -3731,13 +4115,13 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
from = X_PROBED;
if(pSiS->OptROMUsage == 0) {
- pSiS->sishw_ext.UseROM = FALSE;
+ pSiS->sishw_ext.UseROM = FALSE;
from = X_CONFIG;
xf86DrvMsg(pScrn->scrnIndex, from, "Video ROM data usage is disabled\n");
}
if(!pSiS->OptUseOEM) {
- xf86DrvMsg(pScrn->scrnIndex, from, "Internal OEM LCD/TV/VGA2 data usage is disabled\n");
+ xf86DrvMsg(pScrn->scrnIndex, from, "Internal OEM LCD/TV/VGA2 data usage is disabled\n");
}
pSiS->SiS_Pr->UsePanelScaler = pSiS->UsePanelScaler;
@@ -3750,9 +4134,9 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
/* Get framebuffer address */
if(pSiS->pEnt->device->MemBase != 0) {
/*
- * XXX Should check that the config file value matches one of the
- * PCI base address values.
- */
+ * XXX Should check that the config file value matches one of the
+ * PCI base address values.
+ */
pSiS->FbAddress = pSiS->pEnt->device->MemBase;
from = X_CONFIG;
} else {
@@ -3762,20 +4146,20 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode)
xf86DrvMsg(pScrn->scrnIndex, from, "Global linear framebuffer at 0x%lX\n",
- (ULong)pSiS->FbAddress);
+ (ULong)pSiS->FbAddress);
else
#endif
xf86DrvMsg(pScrn->scrnIndex, from, "Linear framebuffer at 0x%lX\n",
- (ULong)pSiS->FbAddress);
+ (ULong)pSiS->FbAddress);
pSiS->realFbAddress = pSiS->FbAddress;
/* Get MMIO address */
if(pSiS->pEnt->device->IOBase != 0) {
- /*
- * XXX Should check that the config file value matches one of the
- * PCI base address values.
- */
+ /*
+ * XXX Should check that the config file value matches one of the
+ * PCI base address values.
+ */
pSiS->IOAddress = pSiS->pEnt->device->IOBase;
from = X_CONFIG;
} else {
@@ -3783,7 +4167,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
from = X_PROBED;
}
xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX (size %ldK)\n",
- (ULong)pSiS->IOAddress, pSiS->mmioSize);
+ (ULong)pSiS->IOAddress, pSiS->mmioSize);
pSiS->sishw_ext.bIntegratedMMEnabled = TRUE;
@@ -3802,11 +4186,11 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
from = X_PROBED;
if(pSiS->pEnt->device->videoRam != 0) {
if(pSiS->Chipset == PCI_CHIP_SIS6326) {
- pScrn->videoRam = pSiS->pEnt->device->videoRam;
- from = X_CONFIG;
+ pScrn->videoRam = pSiS->pEnt->device->videoRam;
+ from = X_CONFIG;
} else {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Option \"VideoRAM\" ignored\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Option \"VideoRAM\" ignored\n");
}
}
@@ -3818,7 +4202,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pScrn->videoRam = 4096;
xf86DrvMsg(pScrn->scrnIndex, from,
"SiS6326: Detected %d KB VideoRAM, limiting to %d KB\n",
- pSiS->RealVideoRam, pScrn->videoRam);
+ pSiS->RealVideoRam, pScrn->videoRam);
} else {
xf86DrvMsg(pScrn->scrnIndex, from, "VideoRAM: %d KB\n", pScrn->videoRam);
}
@@ -3826,9 +4210,9 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if((pSiS->Chipset == PCI_CHIP_SIS6326) &&
(pScrn->videoRam > 4096)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "SiS6326 engines do not support more than 4096KB RAM, therefore\n");
+ "SiS6326 engines do not support more than 4096KB RAM, therefore\n");
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "TurboQueue, HWCursor, 2D acceleration and XVideo are disabled.\n");
+ "TurboQueue, HWCursor, 2D acceleration and XVideo are disabled.\n");
pSiS->TurboQueue = FALSE;
pSiS->HWCursor = FALSE;
pSiS->NoXvideo = TRUE;
@@ -3845,15 +4229,16 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->CurARGBDest = NULL;
pSiS->CurMonoSrc = NULL;
pSiS->CurFGCol = pSiS->CurBGCol = 0;
+ pSiS->FbBaseOffset = 0;
switch(pSiS->VGAEngine) {
case SIS_300_VGA:
- pSiS->TurboQueueLen = 512;
- if(pSiS->TurboQueue) {
+ pSiS->TurboQueueLen = 512;
+ if(pSiS->TurboQueue) {
pSiS->availMem -= (pSiS->TurboQueueLen*1024);
pSiS->cursorOffset = 512;
- }
+ }
if(pSiS->HWCursor) {
pSiS->availMem -= pSiS->CursorSize;
if(pSiS->OptUseColorCursor) pSiS->availMem -= pSiS->CursorSize;
@@ -3871,32 +4256,37 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->cmdQueueSizeMask = pSiS->cmdQueueSize - 1; /* VRAM Command Queue is variable (in therory) */
pSiS->cmdQueueOffset = (pScrn->videoRam * 1024) - pSiS->cmdQueueSize;
pSiS->cmdQueueLen = 0;
- pSiS->cmdQueueLenMin = 0x200;
- pSiS->cmdQueueLenMax = pSiS->cmdQueueSize - pSiS->cmdQueueLenMin;
+ pSiS->cmdQueueLenMin = 0x200;
+ pSiS->cmdQueueLenMax = pSiS->cmdQueueSize - pSiS->cmdQueueLenMin;
pSiS->cmdQueueSize_div2 = pSiS->cmdQueueSize / 2;
pSiS->cmdQueueSize_div4 = pSiS->cmdQueueSize / 4;
pSiS->cmdQueueSize_4_3 = (pSiS->cmdQueueSize / 4) * 3;
pSiS->availMem -= pSiS->cmdQueueSize;
- pSiS->cursorOffset = (pSiS->cmdQueueSize / 1024);
+ pSiS->cursorOffset = (pSiS->cmdQueueSize / 1024);
#else
- if(pSiS->TurboQueue) {
- pSiS->availMem -= (512*1024); /* MMIO Command Queue is 512k (variable in theory) */
+ if(pSiS->TurboQueue) {
+ pSiS->availMem -= (512*1024); /* MMIO Command Queue is 512k (variable in theory) */
pSiS->cursorOffset = 512;
}
#endif
if(pSiS->HWCursor) {
- pSiS->availMem -= (pSiS->CursorSize * 2);
+ pSiS->availMem -= (pSiS->CursorSize * 2);
if(pSiS->OptUseColorCursor) pSiS->availMem -= (pSiS->CursorSize * 2);
-
}
pSiS->cursorBufferNum = 0;
#ifdef SISDUALHEAD
if(pSiSEnt) pSiSEnt->cursorBufferNum = 0;
#endif
+
+ if((pSiS->SiS76xLFBSize) && (pSiS->SiS76xUMASize)) {
+ pSiS->availMem -= pSiS->SiS76xUMASize;
+ pSiS->FbBaseOffset = pSiS->SiS76xUMASize;
+ }
+
break;
default:
- /* cursorOffset not used in cursor functions for 530 and
+ /* cursorOffset not used in cursor functions for 530 and
* older chips, because the cursor is *above* the TQ.
* On 5597 and older revisions of the 6326, the TQ is
* max 32K, on newer 6326 revisions and the 530 either 30
@@ -3916,11 +4306,11 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
}
pSiS->CmdQueMaxLen = 32;
- if(pSiS->TurboQueue) {
- pSiS->availMem -= (64*1024);
+ if(pSiS->TurboQueue) {
+ pSiS->availMem -= (64*1024);
pSiS->CmdQueMaxLen = 900; /* To make sure; should be 992 */
} else if(pSiS->HWCursor) {
- pSiS->availMem -= pSiS->CursorSize;
+ pSiS->availMem -= pSiS->CursorSize;
}
if(pSiS->Chipset == PCI_CHIP_SIS530) {
/* Check if Flat Panel is enabled */
@@ -3958,41 +4348,92 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
/* Check MaxXFBMem setting */
#ifdef SISDUALHEAD
- /* Since DRI is not supported in dual head mode, we
- don't need the MaxXFBMem setting. */
if(pSiS->DualHeadMode) {
- if(pSiS->maxxfbmem) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "MaxXFBMem not used in Dual Head mode.\n");
- }
- pSiS->maxxfbmem = pSiS->availMem;
+ /* 1. Since DRI is not supported in dual head mode, we
+ * don't need the MaxXFBMem setting - ignore it.
+ */
+ if(pSiS->maxxfbmem) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "MaxXFBMem ignored in Dual Head mode\n");
+ }
+ pSiS->maxxfbmem = pSiS->availMem;
} else
#endif
- if(pSiS->maxxfbmem) {
- if(pSiS->maxxfbmem > pSiS->availMem) {
- if(pSiS->sisfbMem) {
- pSiS->maxxfbmem = pSiS->sisfbMem * 1024;
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Invalid MaxXFBMem setting. Using sisfb heap start information.\n");
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Invalid MaxXFBMem setting.\n");
- pSiS->maxxfbmem = pSiS->availMem;
- }
- } else if(pSiS->sisfbMem) {
- if(pSiS->maxxfbmem > pSiS->sisfbMem * 1024) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "MaxXFBMem beyond sisfb heap start. Using sisfb heap start information.\n");
- pSiS->maxxfbmem = pSiS->sisfbMem * 1024;
- }
- }
- } else if(pSiS->sisfbMem) {
- pSiS->maxxfbmem = pSiS->sisfbMem * 1024;
+ if((pSiS->sisfbHeapStart) || (pSiS->sisfbHaveNewHeapDef)) {
+
+ /*
+ * 2. We have memory layout info from sisfb - ignore MaxXFBMem
+ */
+ if(pSiS->maxxfbmem) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Got memory layout info from sisfb, ignoring MaxXFBMem option\n");
+ }
+ if((pSiS->FbBaseOffset) && (!pSiS->sisfbHaveNewHeapDef)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Incompatible sisfb version detected, DRI disabled\n");
+ pSiS->loadDRI = FALSE;
+ pSiS->maxxfbmem = pSiS->availMem;
+ } else {
+ if(pSiS->FbBaseOffset) {
+ /* Revert our changes to FbBaseOffset and availMem; use sisfb's info */
+ pSiS->availMem += pSiS->FbBaseOffset;
+ pSiS->FbBaseOffset = 0;
+ }
+ if(pSiS->sisfbVideoOffset) {
+ /* a. DRI heap BELOW framebuffer */
+ pSiS->FbBaseOffset = pSiS->sisfbVideoOffset;
+ pSiS->availMem -= pSiS->FbBaseOffset;
+ pSiS->maxxfbmem = pSiS->availMem;
+ } else {
+ /* b. DRI heap ABOVE framebuffer (traditional layout) */
+ if(pSiS->availMem < (pSiS->sisfbHeapStart * 1024)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Internal error - sisfb memory layout corrupt\n");
+ pSiS->loadDRI = FALSE;
+ pSiS->maxxfbmem = pSiS->availMem;
+ } else {
+ pSiS->maxxfbmem = pSiS->sisfbHeapStart * 1024;
+ }
+ }
+ }
+
+ } else if(pSiS->maxxfbmem) {
+
+ /*
+ * 3. No sisfb, but user gave "MaxXFBMem"
+ */
+ if(pSiS->FbBaseOffset) {
+ /* a. DRI heap BELOW framebuffer */
+ if(pSiS->maxxfbmem > (pSiS->availMem + pSiS->FbBaseOffset - pSiS->SiS76xUMASize)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Invalid MaxXFBMem setting\n");
+ pSiS->maxxfbmem = pSiS->availMem;
+ } else {
+ /* Revert our changes */
+ pSiS->availMem += pSiS->FbBaseOffset;
+ /* Use user's MaxXFBMem setting */
+ pSiS->FbBaseOffset = pSiS->availMem - pSiS->maxxfbmem;
+ pSiS->availMem -= pSiS->FbBaseOffset;
+ }
+ } else {
+ /* b. DRI heap ABOVE framebuffer (traditional layout) */
+ if(pSiS->maxxfbmem > pSiS->availMem) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Invalid MaxXFBMem setting.\n");
+ pSiS->maxxfbmem = pSiS->availMem;
+ }
+ }
+
+ } else {
+
+ /*
+ * 4. No MaxXFBMem, no sisfb: Use all memory
+ */
+ pSiS->maxxfbmem = pSiS->availMem;
}
- else pSiS->maxxfbmem = pSiS->availMem;
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using %ldK of framebuffer memory\n",
- pSiS->maxxfbmem / 1024);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using %ldK of framebuffer memory at offset %ldK\n",
+ pSiS->maxxfbmem / 1024, pSiS->FbBaseOffset / 1024);
/* Find out about sub-classes of some chipsets and check
* if the chipset supports two video overlays
@@ -4004,49 +4445,28 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->Chipset == PCI_CHIP_SIS5597) {
pSiS->hasTwoOverlays = FALSE;
switch(pSiS->Chipset) {
- case PCI_CHIP_SIS300:
- case PCI_CHIP_SIS630:
- case PCI_CHIP_SIS550:
+ case PCI_CHIP_SIS300:
+ case PCI_CHIP_SIS630:
+ case PCI_CHIP_SIS550:
pSiS->hasTwoOverlays = TRUE;
pSiS->SiS_SD_Flags |= SiS_SD_SUPPORT2OVL;
break;
case PCI_CHIP_SIS315PRO:
pSiS->ChipFlags |= SiSCF_LARGEOVERLAY;
break;
- case PCI_CHIP_SIS330:
- pSiS->ChipFlags |= SiSCF_CRT2HWCKaputt;
- /* Fall through */
+ case PCI_CHIP_SIS330:
+ pSiS->ChipFlags |= (SiSCF_CRT2HWCKaputt | SiSCF_LARGEOVERLAY);
+ break;
case PCI_CHIP_SIS340:
pSiS->ChipFlags |= SiSCF_LARGEOVERLAY;
+ pSiS->hasTwoOverlays = TRUE;
+ pSiS->SiS_SD_Flags |= SiS_SD_SUPPORT2OVL;
break;
- case PCI_CHIP_SIS660:
- {
-#if 0
- static const char *id661str[] = {
- "661 ?", "661 ?", "661 ?", "661 ?",
- "661 ?", "661 ?", "661 ?", "661 ?",
- "661 ?", "661 ?", "661 ?", "661 ?",
- "661 ?", "661 ?", "661 ?", "661 ?"
- };
-#endif
- pSiS->ChipFlags |= SiSCF_LARGEOVERLAY;
- pSiS->hasTwoOverlays = TRUE;
- pSiS->SiS_SD_Flags |= SiS_SD_SUPPORT2OVL;
-#if 0
- if(pSiS->sishw_ext.jChipType == SIS_661) {
- inSISIDXREG(SISCR, 0x5f, CR5F);
- CR5F &= 0xf0;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "SiS661FX revision ID %x (%s)\n", CR5F, id661str[CR5F >> 4]);
- }
-#endif
- break;
- }
- case PCI_CHIP_SIS650:
+ case PCI_CHIP_SIS650:
{
UChar tempreg1, tempreg2;
static const char *id650str[] = {
- "650", "650", "650", "650",
+ "650", "650", "650", "650",
"650 A0 AA", "650 A2 CA", "650", "650",
"M650 A0", "M650 A1 AA","651 A0 AA", "651 A1 AA",
"M650", "65?", "651", "65?"
@@ -4054,20 +4474,20 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->ChipFlags |= SiSCF_LARGEOVERLAY;
if(pSiS->sishw_ext.jChipType == SIS_650) {
inSISIDXREG(SISCR, 0x5f, CR5F);
- CR5F &= 0xf0;
- andSISIDXREG(SISCR, 0x5c, 0x07);
+ CR5F &= 0xf0;
+ andSISIDXREG(SISCR, 0x5c, 0x07);
inSISIDXREG(SISCR, 0x5c, tempreg1);
tempreg1 &= 0xf8;
orSISIDXREG(SISCR, 0x5c, 0xf8);
inSISIDXREG(SISCR, 0x5c, tempreg2);
tempreg2 &= 0xf8;
if((!tempreg1) || (tempreg2)) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "SiS650 revision ID %x (%s)\n", CR5F, id650str[CR5F >> 4]);
- if(CR5F & 0x80) {
- pSiS->hasTwoOverlays = TRUE; /* M650 or 651 */
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "SiS650 revision ID %x (%s)\n", CR5F, id650str[CR5F >> 4]);
+ if(CR5F & 0x80) {
+ pSiS->hasTwoOverlays = TRUE; /* M650 or 651 */
pSiS->SiS_SD_Flags |= SiS_SD_SUPPORT2OVL;
- }
+ }
switch(CR5F) {
case 0xa0:
case 0xb0:
@@ -4085,48 +4505,74 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->SiS_SD_Flags |= SiS_SD_SUPPORT2OVL;
switch(CR5F) {
case 0x90:
- inSISIDXREG(SISCR, 0x5c, tempreg1);
+ inSISIDXREG(SISCR, 0x5c, tempreg1);
tempreg1 &= 0xf8;
switch(tempreg1) {
case 0x00:
pSiS->ChipFlags |= SiSCF_IsM652;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "SiSM652 revision ID %x\n", CR5F);
+ "SiSM652 revision ID %x\n", CR5F);
break;
case 0x40:
pSiS->ChipFlags |= SiSCF_IsM653;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "SiSM653 revision ID %x\n", CR5F);
+ "SiSM653 revision ID %x\n", CR5F);
break;
default:
pSiS->ChipFlags |= SiSCF_IsM650;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "SiSM650 revision ID %x\n", CR5F);
+ "SiSM650 revision ID %x\n", CR5F);
break;
}
break;
case 0xb0:
- pSiS->ChipFlags |= SiSCF_Is652;
+ pSiS->ChipFlags |= SiSCF_Is652;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "SiS652 revision ID %x\n", CR5F);
+ "SiS652 revision ID %x\n", CR5F);
break;
default:
- pSiS->ChipFlags |= SiSCF_IsM650;
+ pSiS->ChipFlags |= SiSCF_IsM650;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "SiSM650 revision ID %x\n", CR5F);
+ "SiSM650 revision ID %x\n", CR5F);
break;
}
}
}
- break;
+ break;
+ }
+ case PCI_CHIP_SIS660:
+ {
+ pSiS->ChipFlags |= SiSCF_LARGEOVERLAY;
+ pSiS->hasTwoOverlays = TRUE;
+ pSiS->SiS_SD_Flags |= SiS_SD_SUPPORT2OVL;
+ /* 760/761: - UMA only: one/two overlays - dotclock dependent
+ - UMA+LFB: two overlays if video data in LFB
+ - LFB only: two overlays
+ If UMA only: Must switch between one/two overlays on the fly (done
+ in PostSetMode())
+ If LFB+UMA: We use LFB memory only and leave UMA to an eventually
+ written DRI driver.
+ */
+ break;
}
}
+
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"Hardware supports %s video overlay%s\n",
pSiS->hasTwoOverlays ? "two" : "one",
pSiS->hasTwoOverlays ? "s" : "");
- }
+ if(pSiS->SiS_SD2_Flags & SiS_SD2_SUPPORT760OO) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "\n\tDear SiS76x user, your machine is using a shared memory framebuffer.\n"
+ "\tDue to hardware limitations of the SiS chip in combination with the\n"
+ "\tAMD CPU, video overlay support is very limited on this machine. If you\n"
+ "\texperience flashing lines in the video and/or the graphics display\n"
+ "\tduring video playback, reduce the color depth and/or the resolution\n"
+ "\tand/or the refresh rate. Alternatively, use the video blitter.\n");
+ }
+
+ }
/* Backup VB connection and CRT1 on/off register */
if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
@@ -4201,8 +4647,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
for(j=0; j<5; j++) {
if(mycustomttable[i].biosFootprintAddr[j]) {
if(pSiS->sishw_ext.UseROM) {
- if(pSiS->BIOS[mycustomttable[i].biosFootprintAddr[j]] !=
- mycustomttable[i].biosFootprintData[j])
+ if(pSiS->BIOS[mycustomttable[i].biosFootprintAddr[j]] !=
+ mycustomttable[i].biosFootprintData[j])
footprint = FALSE;
} else footprint = FALSE;
}
@@ -4239,50 +4685,51 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if( ((pSiS->sishw_ext.jChipType != SIS_650) &&
(pSiS->sishw_ext.jChipType < SIS_661)) ||
(!(pSiS->VBFlags & VB_SISLCDABRIDGE)) ) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Chipset/Video bridge does not support LCD-via-CRT1\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Chipset/Video bridge does not support LCD-via-CRT1\n");
pSiS->ForceCRT1Type = CRT1_VGA;
} else if(!(pSiS->VBFlags & CRT2_LCD)) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "No digital LCD panel found, LCD-via-CRT1 disabled\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "No digital LCD panel found, LCD-via-CRT1 disabled\n");
pSiS->ForceCRT1Type = CRT1_VGA;
}
}
/* Setup SD flags */
pSiS->SiS_SD_Flags |= SiS_SD_ADDLSUPFLAG;
+ pSiS->SiS_SD2_Flags |= SiS_SD2_MERGEDUCLOCK;
if(pSiS->VBFlags & VB_VIDEOBRIDGE) {
pSiS->SiS_SD2_Flags |= SiS_SD2_VIDEOBRIDGE;
if(pSiS->VBFlags & VB_SISBRIDGE) {
- pSiS->SiS_SD2_Flags |= ( SiS_SD2_SISBRIDGE |
- SiS_SD2_SUPPORTGAMMA2 );
+ pSiS->SiS_SD2_Flags |= ( SiS_SD2_SISBRIDGE |
+ SiS_SD2_SUPPORTGAMMA2 );
if(pSiS->VBFlags & VB_SISLVDSBRIDGE) {
pSiS->SiS_SD2_Flags |= ( SiS_SD2_LCDLVDS |
- SiS_SD2_SUPPORTLCD );
+ SiS_SD2_SUPPORTLCD );
} else if(pSiS->VBFlags & VB_SISTMDSBRIDGE) {
if(!(pSiS->VBFlags & VB_30xBDH)) {
- pSiS->SiS_SD2_Flags |= ( SiS_SD2_LCDTMDS |
- SiS_SD2_SUPPORTLCD );
+ pSiS->SiS_SD2_Flags |= ( SiS_SD2_LCDTMDS |
+ SiS_SD2_SUPPORTLCD );
} else if(pSiS->VBFlags & CRT2_LCD) {
- pSiS->SiS_SD2_Flags |= ( SiS_SD2_THIRDPARTYLVDS |
- SiS_SD2_SUPPORTLCD );
+ pSiS->SiS_SD2_Flags |= ( SiS_SD2_THIRDPARTYLVDS |
+ SiS_SD2_SUPPORTLCD );
}
}
} else if(pSiS->VBFlags & VB_LVDS) {
- pSiS->SiS_SD2_Flags |= ( SiS_SD2_THIRDPARTYLVDS |
- SiS_SD2_SUPPORTLCD );
+ pSiS->SiS_SD2_Flags |= ( SiS_SD2_THIRDPARTYLVDS |
+ SiS_SD2_SUPPORTLCD );
}
if(pSiS->VBFlags & (VB_SISTVBRIDGE | VB_CHRONTEL)) {
- pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTTV;
+ pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTTV;
if(pSiS->VBFlags & VB_SISBRIDGE) {
pSiS->SiS_SD2_Flags |= ( SiS_SD2_SUPPORTTVTYPE |
SiS_SD2_SUPPORTTVSIZE );
if(!(pSiS->VBFlags & VB_301)) {
- pSiS->SiS_SD2_Flags |= SiS_SD2_SUPPTVSAT;
+ pSiS->SiS_SD2_Flags |= SiS_SD2_SUPPTVSAT;
} else {
- pSiS->SiS_SD2_Flags |= SiS_SD2_SUPPTVEDGE;
+ pSiS->SiS_SD2_Flags |= SiS_SD2_SUPPTVEDGE;
}
}
}
@@ -4331,14 +4778,14 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if(!(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPR)) {
if((pSiS->ForceTVType != -1) && (pSiS->ForceTVType & TV_YPBPR)) {
- pSiS->ForceTVType = -1;
+ pSiS->ForceTVType = -1;
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "YPbPr TV output not supported\n");
}
}
if(!(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTHIVISION)) {
if((pSiS->ForceTVType != -1) && (pSiS->ForceTVType & TV_HIVISION)) {
- pSiS->ForceTVType = -1;
+ pSiS->ForceTVType = -1;
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "HiVision TV output not supported\n");
}
}
@@ -4358,16 +4805,52 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTOVERSCAN;
pSiS->SiS_SD2_Flags |= SiS_SD2_CHRONTEL;
if(pSiS->ChrontelType == CHRONTEL_700x) {
- pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTSOVER;
+ pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTSOVER;
}
}
+ /* Determine if chipset LCDA-capable */
SISDetermineLCDACap(pScrn);
+
+ /* Default to LCDA if LCD detected and
+ * - TV detected (hence default to LCDA+TV), or
+ * - in single head mode, on LCD panels with xres > 1600
+ * (Don't do this in MergedFB or DHM; LCDA and CRT1/VGA
+ * are mutually exclusive; if no TV is detected, the
+ * code below will default to VGA+LCD, so LCD is driven
+ * via CRT2.)
+ */
+ if((pSiS->SiS_SD_Flags & SiS_SD_SUPPORTLCDA) &&
+ (pSiS->VBFlags & CRT2_LCD) &&
+ (pSiS->SiS_Pr->SiS_CustomT != CUT_UNKNOWNLCD)) {
+ if((!pSiS->CRT1TypeForced) && (pSiS->ForceCRT2Type == CRT2_DEFAULT)) {
+ if(pSiS->VBFlags & CRT2_TV) {
+ /* If both LCD and TV present, default to LCDA+TV */
+ pSiS->ForceCRT1Type = CRT1_LCDA;
+ pSiS->ForceCRT2Type = CRT2_TV;
+ } else if(pSiS->LCDwidth > 1600) {
+ /* If LCD is > 1600, default to LCDA if we don't need CRT1/VGA for other head */
+ Bool NeedCRT1VGA = FALSE;
+#ifdef SISDUALHEAD
+ if(pSiS->DualHeadMode) NeedCRT1VGA = TRUE;
+#endif
+#ifdef SISMERGED
+ if(pSiS->MergedFB &&
+ (!pSiS->MergedFBAuto || pSiS->CRT1Detected)) NeedCRT1VGA = TRUE;
+#endif
+ if(!NeedCRT1VGA) {
+ pSiS->ForceCRT1Type = CRT1_LCDA;
+ }
+ }
+ }
+ }
+
+ /* Set up pseudo-panel if LCDA forced on TMDS bridges */
if(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTLCDA) {
if(pSiS->ForceCRT1Type == CRT1_LCDA) {
if(pSiS->VBFlags & VB_SISTMDSLCDABRIDGE) {
if(!(pSiS->VBLCDFlags)) {
- SiSSetupPseudoPanel(pScrn);
+ SiSSetupPseudoPanel(pScrn);
pSiS->detectedCRT2Devices |= CRT2_LCD;
}
} else if(!(pSiS->VBLCDFlags)) {
@@ -4391,51 +4874,51 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
*/
if(pSiS->ForceCRT2Type == CRT2_DEFAULT) {
if((pSiS->VBFlags & CRT2_TV) && (!((pSiS->VBFlags & VB_CHRONTEL) && (pSiS->VGAEngine == SIS_300_VGA))))
- pSiS->ForceCRT2Type = CRT2_TV;
+ pSiS->ForceCRT2Type = CRT2_TV;
else if((pSiS->VBFlags & CRT2_LCD) && (pSiS->ForceCRT1Type == CRT1_VGA))
- pSiS->ForceCRT2Type = CRT2_LCD;
+ pSiS->ForceCRT2Type = CRT2_LCD;
else if(pSiS->VBFlags & CRT2_TV)
pSiS->ForceCRT2Type = CRT2_TV;
else if((pSiS->VBFlags & CRT2_VGA) && (pSiS->ForceCRT1Type == CRT1_VGA))
- pSiS->ForceCRT2Type = CRT2_VGA;
+ pSiS->ForceCRT2Type = CRT2_VGA;
}
switch(pSiS->ForceCRT2Type) {
case CRT2_TV:
- pSiS->VBFlags &= ~(CRT2_LCD | CRT2_VGA);
- if(pSiS->VBFlags & (VB_SISTVBRIDGE | VB_CHRONTEL)) {
- pSiS->VBFlags |= CRT2_TV;
- } else {
- pSiS->VBFlags &= ~(CRT2_TV);
+ pSiS->VBFlags &= ~(CRT2_LCD | CRT2_VGA);
+ if(pSiS->VBFlags & (VB_SISTVBRIDGE | VB_CHRONTEL)) {
+ pSiS->VBFlags |= CRT2_TV;
+ } else {
+ pSiS->VBFlags &= ~(CRT2_TV);
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Hardware does not support TV output\n");
- }
- break;
+ "Hardware does not support TV output\n");
+ }
+ break;
case CRT2_LCD:
- pSiS->VBFlags &= ~(CRT2_TV | CRT2_VGA);
- if((pSiS->VBFlags & VB_VIDEOBRIDGE) && (pSiS->VBLCDFlags)) {
- pSiS->VBFlags |= CRT2_LCD;
+ pSiS->VBFlags &= ~(CRT2_TV | CRT2_VGA);
+ if((pSiS->VBFlags & VB_VIDEOBRIDGE) && (pSiS->VBLCDFlags)) {
+ pSiS->VBFlags |= CRT2_LCD;
} else if((pSiS->VBFlags & VB_SISTMDSBRIDGE) && (!(pSiS->VBFlags & VB_30xBDH))) {
SiSSetupPseudoPanel(pScrn);
pSiS->detectedCRT2Devices |= CRT2_LCD;
- } else {
- pSiS->VBFlags &= ~(CRT2_LCD);
+ } else {
+ pSiS->VBFlags &= ~(CRT2_LCD);
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Can't force CRT2 to LCD, no LCD detected\n");
+ "Can't force CRT2 to LCD, no LCD detected\n");
}
- break;
+ break;
case CRT2_VGA:
- pSiS->VBFlags &= ~(CRT2_TV | CRT2_LCD);
- if(pSiS->VBFlags & VB_SISVGA2BRIDGE) {
+ pSiS->VBFlags &= ~(CRT2_TV | CRT2_LCD);
+ if(pSiS->VBFlags & VB_SISVGA2BRIDGE) {
pSiS->VBFlags |= CRT2_VGA;
} else {
pSiS->VBFlags &= ~(CRT2_VGA);
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Hardware does not support secondary VGA\n");
+ "Hardware does not support secondary VGA\n");
}
- break;
+ break;
default:
- pSiS->VBFlags &= ~(CRT2_TV | CRT2_LCD | CRT2_VGA);
+ pSiS->VBFlags &= ~(CRT2_TV | CRT2_LCD | CRT2_VGA);
}
/* Setup gamma (the cmap layer needs this to be initialised) */
@@ -4449,21 +4932,21 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if((!pSiS->DualHeadMode) || (pSiS->SecondHead)) {
#endif
xf86DrvMsg(pScrn->scrnIndex, pSiS->CRT1gammaGiven ? X_CONFIG : X_INFO,
- "CRT1 gamma correction is %s\n",
- pSiS->CRT1gamma ? "enabled" : "disabled");
+ "CRT1 gamma correction is %s\n",
+ pSiS->CRT1gamma ? "enabled" : "disabled");
if((pSiS->VGAEngine == SIS_315_VGA) && (!(pSiS->NoXvideo))) {
- xf86DrvMsg(pScrn->scrnIndex, pSiS->XvGammaGiven ? X_CONFIG : X_INFO,
- "Separate Xv gamma correction for CRT1 is %s\n",
+ xf86DrvMsg(pScrn->scrnIndex, pSiS->XvGammaGiven ? X_CONFIG : X_INFO,
+ "Separate Xv gamma correction for CRT1 is %s\n",
pSiS->XvGamma ? "enabled" : "disabled");
if(pSiS->XvGamma) {
xf86DrvMsg(pScrn->scrnIndex, pSiS->XvGammaGiven ? X_CONFIG : X_INFO,
- "Xv gamma correction: %.3f %.3f %.3f\n",
+ "Xv gamma correction: %.3f %.3f %.3f\n",
(float)((float)pSiS->XvGammaRed / 1000),
(float)((float)pSiS->XvGammaGreen / 1000),
(float)((float)pSiS->XvGammaBlue / 1000));
if(!pSiS->CRT1gamma) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Xv gamma correction requires CRT1 gamma correction enabled\n");
}
}
@@ -4485,17 +4968,17 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if( ((pSiS->VGAEngine != SIS_300_VGA) && (pSiS->VGAEngine != SIS_315_VGA)) ||
(!(pSiS->VBFlags & VB_SISBRIDGE)) ) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "CRT2 gamma correction not supported by hardware\n");
+ "CRT2 gamma correction not supported by hardware\n");
pSiS->CRT2gamma = pSiS->CRT2SepGamma = FALSE;
} else if((pSiS->VBFlags & VB_30xBDH) && (pSiS->VBFlags & CRT2_LCD)) {
isDH = TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "CRT2 gamma correction not supported for LCD\n");
+ "CRT2 gamma correction not supported for LCD\n");
/* But leave it on, will be caught in LoadPalette */
}
}
if(pSiS->VBFlags & VB_SISBRIDGE) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CRT2 gamma correction is %s%s%s\n",
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CRT2 gamma correction is %s%s%s\n",
pSiS->CRT2gamma ? "enabled" : "disabled",
isDH ? " (for TV and VGA2) " : "",
pSiS->CRT2SepGamma ? " (separate from CRT1)" : "");
@@ -4505,7 +4988,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
/* Eventually overrule TV Type (SVIDEO, COMPOSITE, SCART, HIVISION, YPBPR) */
if(pSiS->VBFlags & VB_SISTVBRIDGE) {
if(pSiS->ForceTVType != -1) {
- pSiS->VBFlags &= ~(TV_INTERFACE);
+ pSiS->VBFlags &= ~(TV_INTERFACE);
if(!(pSiS->VBFlags & VB_CHRONTEL)) {
pSiS->VBFlags &= ~(TV_CHSCART | TV_CHYPBPR525I);
}
@@ -4535,9 +5018,9 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
#else
if(pSiS->forceCRT1 != -1) {
#endif
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "CRT1 detection overruled by ForceCRT1 option\n");
- if(pSiS->forceCRT1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "CRT1 detection overruled by ForceCRT1 option\n");
+ if(pSiS->forceCRT1) {
pSiS->CRT1off = 0;
if(pSiS->VGAEngine == SIS_300_VGA) {
if(!(usScratchCR17 & 0x80)) pSiS->CRT1changed = TRUE;
@@ -4549,7 +5032,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
usScratchCR63 &= ~0x40;
usScratchSR1F &= ~0xc0;
} else {
- if( ! ( (pScrn->bitsPerPixel == 8) &&
+ if( ! ( (pScrn->bitsPerPixel == 8) &&
( (pSiS->VBFlags & (VB_LVDS | VB_CHRONTEL)) ||
((pSiS->VBFlags & VB_30xBDH) && (pSiS->VBFlags & CRT2_LCD)) ) ) ) {
pSiS->CRT1off = 1;
@@ -4567,15 +5050,15 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
*/
outSISIDXREG(SISCR, 0x17, usScratchCR17);
if(pSiS->VGAEngine == SIS_315_VGA) {
- outSISIDXREG(SISCR, pSiS->myCR63, usScratchCR63);
+ outSISIDXREG(SISCR, pSiS->myCR63, usScratchCR63);
}
outSISIDXREG(SISCR, 0x32, usScratchCR32);
if(pSiS->CRT1changed) {
- outSISIDXREG(SISSR, 0x00, 0x01); /* Synchronous Reset */
- usleep(10000);
- outSISIDXREG(SISSR, 0x00, 0x03); /* End Reset */
+ outSISIDXREG(SISSR, 0x00, 0x01); /* Synchronous Reset */
+ usleep(10000);
+ outSISIDXREG(SISSR, 0x00, 0x03); /* End Reset */
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "CRT1 status changed by ForceCRT1 option\n");
+ "CRT1 status changed by ForceCRT1 option\n");
}
outSISIDXREG(SISSR, 0x1f, usScratchSR1F);
}
@@ -4590,7 +5073,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
/* No CRT2 output? Then we NEED CRT1!
* We also need CRT1 if depth = 8 and bridge=LVDS|301B-DH
*/
- if( (!(pSiS->VBFlags & (CRT2_VGA | CRT2_LCD | CRT2_TV))) ||
+ if( (!(pSiS->VBFlags & (CRT2_VGA | CRT2_LCD | CRT2_TV))) ||
( (pScrn->bitsPerPixel == 8) &&
( (pSiS->VBFlags & (VB_LVDS | VB_CHRONTEL)) ||
((pSiS->VBFlags & VB_30xBDH) && (pSiS->VBFlags & CRT2_LCD)) ) ) ) {
@@ -4602,8 +5085,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
} else { /* no video bridge? */
- /* Then we NEED CRT1... */
- pSiS->CRT1off = 0;
+ /* Then we NEED CRT1... */
+ pSiS->CRT1off = 0;
/* ... and can't use CRT2 for Xv output */
pSiS->XvOnCRT2 = FALSE;
}
@@ -4617,7 +5100,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
(!((pSiS->VBFlags & VB_CHRONTEL)) && (pSiS->ChrontelType == CHRONTEL_701x)) ) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"PALM, PALN and NTSCJ not supported on this hardware\n");
- pSiS->NonDefaultPAL = pSiS->NonDefaultNTSC = -1;
+ pSiS->NonDefaultPAL = pSiS->NonDefaultNTSC = -1;
pSiS->VBFlags &= ~(TV_PALN | TV_PALM | TV_NTSCJ);
pSiS->SiS_SD_Flags &= ~(SiS_SD_SUPPORTPALMN | SiS_SD_SUPPORTNTSCJ);
}
@@ -4626,8 +5109,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
if( (!((pSiS->VBFlags & VB_CHRONTEL) && (pSiS->VBFlags & (TV_CHSCART | TV_CHYPBPR525I)))) &&
(!(pSiS->VBFlags & (TV_HIVISION | TV_YPBPR))) ) {
- pSiS->VBFlags &= ~(TV_PAL | TV_NTSC | TV_PALN | TV_PALM | TV_NTSCJ);
- if(pSiS->OptTVStand) {
+ pSiS->VBFlags &= ~(TV_PAL | TV_NTSC | TV_PALN | TV_PALM | TV_NTSCJ);
+ if(pSiS->OptTVStand) {
pSiS->VBFlags |= TV_PAL;
if(pSiS->NonDefaultPAL == 1) pSiS->VBFlags |= TV_PALM;
else if(!pSiS->NonDefaultPAL) pSiS->VBFlags |= TV_PALN;
@@ -4686,7 +5169,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
} else {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"CHTVOverscan only supported on CHRONTEL 70xx\n");
- pSiS->UseCHOverScan = -1;
+ pSiS->UseCHOverScan = -1;
}
} else pSiS->UseCHOverScan = -1;
@@ -4728,10 +5211,10 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if(pSiS->CRT1off) { /* CRT2 only ------------------------------- */
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
- SISErrorLog(pScrn,
+ SISErrorLog(pScrn,
"CRT1 not detected or forced off. Dual Head mode can't initialize.\n");
- if(pSiSEnt) pSiSEnt->DisableDual = TRUE;
- if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE;
+ if(pSiSEnt) pSiSEnt->DisableDual = TRUE;
+ if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE;
if(pSiS->pInt) xf86FreeInt10(pSiS->pInt);
pSiS->pInt = NULL;
sisRestoreExtRegisterLock(pSiS,srlockReg,crlockReg);
@@ -4741,10 +5224,10 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
#endif
#ifdef SISMERGED
if(pSiS->MergedFB) {
- if(pSiS->MergedFBAuto) {
+ if(pSiS->MergedFBAuto) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, mergednocrt1, mergeddisstr);
} else {
- SISErrorLog(pScrn, mergednocrt1, mergeddisstr);
+ SISErrorLog(pScrn, mergednocrt1, mergeddisstr);
}
if(pSiS->CRT2pScrn) xfree(pSiS->CRT2pScrn);
pSiS->CRT2pScrn = NULL;
@@ -4758,7 +5241,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
pSiS->VBFlags |= (VB_DISPMODE_DUAL | DISPTYPE_CRT1);
- if(pSiS->VESA != -1) {
+ if(pSiS->VESA != -1) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"VESA option not used in Dual Head mode. VESA disabled.\n");
}
@@ -4767,7 +5250,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
} else
#endif
#ifdef SISMERGED
- if(pSiS->MergedFB) {
+ if(pSiS->MergedFB) {
pSiS->VBFlags |= (VB_DISPMODE_MIRROR | DISPTYPE_CRT1);
if(pSiS->VESA != -1) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -4780,10 +5263,10 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
} else { /* CRT1 only ------------------------------- */
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
- SISErrorLog(pScrn,
+ SISErrorLog(pScrn,
"No CRT2 output selected or no bridge detected. "
"Dual Head mode can't initialize.\n");
- if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE;
+ if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE;
if(pSiS->pInt) xf86FreeInt10(pSiS->pInt);
pSiS->pInt = NULL;
sisRestoreExtRegisterLock(pSiS,srlockReg,crlockReg);
@@ -4793,10 +5276,10 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
#endif
#ifdef SISMERGED
if(pSiS->MergedFB) {
- if(pSiS->MergedFBAuto) {
+ if(pSiS->MergedFBAuto) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO, mergednocrt2, mergeddisstr);
} else {
- SISErrorLog(pScrn, mergednocrt2, mergeddisstr);
+ SISErrorLog(pScrn, mergednocrt2, mergeddisstr);
}
if(pSiS->CRT2pScrn) xfree(pSiS->CRT2pScrn);
pSiS->CRT2pScrn = NULL;
@@ -4853,67 +5336,67 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
inSISIDXREG(SISPART1, 0x13, pSiS->SiS_Pr->PDC);
} else {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Unable to detect LCD PanelDelayCompensation, LCD is not active\n");
+ "Unable to detect LCD PanelDelayCompensation, LCD is not active\n");
}
} else {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Unable to detect LCD PanelDelayCompensation, please update sisfb\n");
+ "Unable to detect LCD PanelDelayCompensation, please update sisfb\n");
}
}
if(pSiS->SiS_Pr->PDC != -1) {
pSiS->SiS_Pr->PDC &= 0x3c;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Detected LCD PanelDelayCompensation 0x%02x\n",
+ "Detected LCD PanelDelayCompensation 0x%02x\n",
pSiS->SiS_Pr->PDC);
}
/* If we haven't been able to find out, use our other methods */
if(pSiS->SiS_Pr->PDC == -1) {
- int i=0;
- do {
- if(mypdctable[i].subsysVendor == pSiS->PciInfo->subsysVendor &&
- mypdctable[i].subsysCard == pSiS->PciInfo->subsysCard) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "PCI card/vendor identified for non-default PanelDelayCompensation\n");
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Vendor: %s, card: %s (ID %04x), PanelDelayCompensation: 0x%02x\n",
- mypdctable[i].vendorName, mypdctable[i].cardName,
- pSiS->PciInfo->subsysCard, mypdctable[i].pdc);
- if(pSiS->PDC == -1) {
- pSiS->PDC = mypdctable[i].pdc;
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "PanelDelayCompensation overruled by option\n");
- }
- break;
- }
- i++;
- } while(mypdctable[i].subsysVendor != 0);
- }
+ int i=0;
+ do {
+ if(mypdctable[i].subsysVendor == pSiS->PciInfo->subsysVendor &&
+ mypdctable[i].subsysCard == pSiS->PciInfo->subsysCard) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "PCI card/vendor identified for non-default PanelDelayCompensation\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Vendor: %s, card: %s (ID %04x), PanelDelayCompensation: 0x%02x\n",
+ mypdctable[i].vendorName, mypdctable[i].cardName,
+ pSiS->PciInfo->subsysCard, mypdctable[i].pdc);
+ if(pSiS->PDC == -1) {
+ pSiS->PDC = mypdctable[i].pdc;
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "PanelDelayCompensation overruled by option\n");
+ }
+ break;
+ }
+ i++;
+ } while(mypdctable[i].subsysVendor != 0);
+ }
if(pSiS->PDC != -1) {
- if(pSiS->BIOS) {
- if(pSiS->VBFlags & VB_LVDS) {
- if(pSiS->BIOS[0x220] & 0x80) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "BIOS contains custom LCD Panel Delay Compensation 0x%02x\n",
- pSiS->BIOS[0x220] & 0x3c);
- pSiS->BIOS[0x220] &= 0x7f;
+ if(pSiS->BIOS) {
+ if(pSiS->VBFlags & VB_LVDS) {
+ if(pSiS->BIOS[0x220] & 0x80) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "BIOS uses OEM LCD Panel Delay Compensation 0x%02x\n",
+ pSiS->BIOS[0x220] & 0x3c);
+ pSiS->BIOS[0x220] &= 0x7f;
}
- }
- if(pSiS->VBFlags & (VB_301B|VB_302B)) {
- if(pSiS->BIOS[0x220] & 0x80) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "BIOS contains custom LCD Panel Delay Compensation 0x%02x\n",
- ( (pSiS->VBLCDFlags & VB_LCD_1280x1024) ?
+ }
+ if(pSiS->VBFlags & (VB_301B|VB_302B)) {
+ if(pSiS->BIOS[0x220] & 0x80) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "BIOS uses OEM LCD Panel Delay Compensation 0x%02x\n",
+ ( (pSiS->VBLCDFlags & VB_LCD_1280x1024) ?
pSiS->BIOS[0x223] : pSiS->BIOS[0x224] ) & 0x3c);
- pSiS->BIOS[0x220] &= 0x7f;
+ pSiS->BIOS[0x220] &= 0x7f;
}
}
- }
- pSiS->SiS_Pr->PDC = (pSiS->PDC & 0x3c);
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Using LCD Panel Delay Compensation 0x%02x\n", pSiS->SiS_Pr->PDC);
+ }
+ pSiS->SiS_Pr->PDC = (pSiS->PDC & 0x3c);
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Using LCD Panel Delay Compensation 0x%02x\n", pSiS->SiS_Pr->PDC);
}
}
@@ -4921,7 +5404,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if(pSiS->VGAEngine == SIS_315_VGA) {
- UChar tmp, tmp2;
+ UChar tmp, tmp2;
inSISIDXREG(SISCR, 0x30, tmp);
/* Save the current PDC if the panel is used at the moment. */
@@ -4950,8 +5433,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->SiS_Pr->PDCA = tempa;
pSiS->SiS_Pr->PDC = tempb;
} else {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Unable to detect PanelDelayCompensation, LCD is not active\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Unable to detect PanelDelayCompensation, LCD is not active\n");
}
} else {
if(tmp2 & 0x04) {
@@ -4959,23 +5442,23 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
} else if(tmp & 0x20) {
pSiS->SiS_Pr->PDC = tempb;
} else {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Unable to detect PanelDelayCompensation, LCD is not active\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Unable to detect PanelDelayCompensation, LCD is not active\n");
}
}
}
} else {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Unable to detect PanelDelayCompensation, please update sisfb\n");
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Unable to detect PanelDelayCompensation, please update sisfb\n");
}
if(pSiS->SiS_Pr->PDC != -1) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Detected LCD PanelDelayCompensation 0x%02x (for LCD=CRT2)\n",
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Detected LCD PanelDelayCompensation 0x%02x (for LCD=CRT2)\n",
pSiS->SiS_Pr->PDC);
}
if(pSiS->SiS_Pr->PDCA != -1) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Detected LCD PanelDelayCompensation1 0x%02x (for LCD=CRT1)\n",
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Detected LCD PanelDelayCompensation1 0x%02x (for LCD=CRT1)\n",
pSiS->SiS_Pr->PDCA);
}
}
@@ -4984,14 +5467,14 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
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,
- "Using LCD PanelDelayCompensation 0x%02x (for LCD=CRT2)\n",
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Using LCD PanelDelayCompensation 0x%02x (for LCD=CRT2)\n",
pSiS->SiS_Pr->PDC);
}
if(pSiS->PDCA != -1) {
- pSiS->SiS_Pr->PDCA = pSiS->PDCA & 0x1f;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Using LCD PanelDelayCompensation1 0x%02x (for LCD=CRT1)\n",
+ pSiS->SiS_Pr->PDCA = pSiS->PDCA & 0x1f;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Using LCD PanelDelayCompensation1 0x%02x (for LCD=CRT1)\n",
pSiS->SiS_Pr->PDCA);
}
}
@@ -5000,23 +5483,23 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if(pSiS->VBFlags & (VB_302LV | VB_302ELV)) {
MessageType from = X_PROBED;
if(pSiS->EMI != -1) {
- pSiS->SiS_Pr->EMI_30 = (pSiS->EMI >> 24) & 0x60;
- pSiS->SiS_Pr->EMI_31 = (pSiS->EMI >> 16) & 0xff;
- pSiS->SiS_Pr->EMI_32 = (pSiS->EMI >> 8) & 0xff;
- pSiS->SiS_Pr->EMI_33 = pSiS->EMI & 0xff;
+ pSiS->SiS_Pr->EMI_30 = (pSiS->EMI >> 24) & 0x60;
+ pSiS->SiS_Pr->EMI_31 = (pSiS->EMI >> 16) & 0xff;
+ pSiS->SiS_Pr->EMI_32 = (pSiS->EMI >> 8) & 0xff;
+ pSiS->SiS_Pr->EMI_33 = pSiS->EMI & 0xff;
pSiS->SiS_Pr->HaveEMI = pSiS->SiS_Pr->HaveEMILCD = TRUE;
pSiS->SiS_Pr->OverruleEMI = TRUE;
from = X_CONFIG;
} else if((pSiS->sisfbfound) && (pSiS->sisfb_haveemi)) {
- pSiS->SiS_Pr->EMI_30 = pSiS->sisfb_emi30;
- pSiS->SiS_Pr->EMI_31 = pSiS->sisfb_emi31;
- pSiS->SiS_Pr->EMI_32 = pSiS->sisfb_emi32;
- pSiS->SiS_Pr->EMI_33 = pSiS->sisfb_emi33;
+ pSiS->SiS_Pr->EMI_30 = pSiS->sisfb_emi30;
+ pSiS->SiS_Pr->EMI_31 = pSiS->sisfb_emi31;
+ pSiS->SiS_Pr->EMI_32 = pSiS->sisfb_emi32;
+ pSiS->SiS_Pr->EMI_33 = pSiS->sisfb_emi33;
pSiS->SiS_Pr->HaveEMI = TRUE;
if(pSiS->sisfb_haveemilcd) pSiS->SiS_Pr->HaveEMILCD = TRUE;
pSiS->SiS_Pr->OverruleEMI = FALSE;
} else {
- inSISIDXREG(SISPART4, 0x30, pSiS->SiS_Pr->EMI_30);
+ inSISIDXREG(SISPART4, 0x30, pSiS->SiS_Pr->EMI_30);
inSISIDXREG(SISPART4, 0x31, pSiS->SiS_Pr->EMI_31);
inSISIDXREG(SISPART4, 0x32, pSiS->SiS_Pr->EMI_32);
inSISIDXREG(SISPART4, 0x33, pSiS->SiS_Pr->EMI_33);
@@ -5025,7 +5508,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->SiS_Pr->OverruleEMI = FALSE;
}
xf86DrvMsg(pScrn->scrnIndex, from,
- "302LV/302ELV: Using EMI 0x%02x%02x%02x%02x%s\n",
+ "302LV/302ELV: Using EMI 0x%02x%02x%02x%02x%s\n",
pSiS->SiS_Pr->EMI_30,pSiS->SiS_Pr->EMI_31,
pSiS->SiS_Pr->EMI_32,pSiS->SiS_Pr->EMI_33,
pSiS->SiS_Pr->HaveEMILCD ? " (LCD)" : "");
@@ -5041,20 +5524,22 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
* If memory sharing is done differently, the following has to be changed;
* the other modules (eg. accel and Xv) use dhmOffset for hardware
* pointer settings relative to VideoRAM start and won't need to be changed.
+ *
+ * Addendum: dhmoffset is also used for skipping the UMA area on SiS76x.
*/
+
+ pSiS->dhmOffset = pSiS->FbBaseOffset;
+ pSiS->FbAddress += pSiS->dhmOffset;
+
#ifdef SISDUALHEAD
- pSiS->dhmOffset = 0;
if(pSiS->DualHeadMode) {
+ pSiS->FbAddress = pSiS->realFbAddress;
if(!pSiS->SecondHead) {
/* ===== First head (always CRT2) ===== */
/* We use only half of the memory available */
pSiS->maxxfbmem /= 2;
- /* dhmOffset is 0 */
- /* Copy framebuffer addresses & sizes to entity */
- pSiSEnt->masterFbAddress = pSiS->FbAddress;
- pSiSEnt->masterFbSize = pSiS->maxxfbmem;
- pSiSEnt->slaveFbAddress = pSiS->FbAddress + pSiS->maxxfbmem;
- pSiSEnt->slaveFbSize = pSiS->maxxfbmem;
+ /* dhmOffset is 0 (or LFB-base for SiS76x UMA skipping) */
+ pSiS->FbAddress += pSiS->dhmOffset;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"%ldKB video RAM at 0x%lx available for master head (CRT2)\n",
pSiS->maxxfbmem/1024, pSiS->FbAddress);
@@ -5062,10 +5547,10 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
/* ===== Second head (always CRT1) ===== */
/* We use only half of the memory available */
pSiS->maxxfbmem /= 2;
- /* Adapt FBAddress */
- pSiS->FbAddress += pSiS->maxxfbmem;
/* Initialize dhmOffset */
- pSiS->dhmOffset = pSiS->availMem - pSiS->maxxfbmem;
+ pSiS->dhmOffset += pSiS->maxxfbmem;
+ /* Adapt FBAddress */
+ pSiS->FbAddress += pSiS->dhmOffset;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"%ldKB video RAM at 0x%lx available for slave head (CRT1)\n",
pSiS->maxxfbmem/1024, pSiS->FbAddress);
@@ -5078,17 +5563,22 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
* mode into account.)
*/
- pSiS->DRIheapstart = pSiS->maxxfbmem;
- pSiS->DRIheapend = pSiS->availMem;
+ if(pSiS->FbBaseOffset) {
+ pSiS->DRIheapstart = 0;
+ pSiS->DRIheapend = pSiS->FbBaseOffset;
+ } else {
+ pSiS->DRIheapstart = pSiS->maxxfbmem;
+ pSiS->DRIheapend = pSiS->availMem;
+ }
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
pSiS->DRIheapstart = pSiS->DRIheapend = 0;
} else
#endif
- if(pSiS->DRIheapstart == pSiS->DRIheapend) {
+ if(pSiS->DRIheapstart >= pSiS->DRIheapend) {
#if 0 /* For future use */
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "No memory for DRI heap. Please set the option \"MaxXFBMem\" to\n"
+ "No memory for DRI heap. Please set the option \"MaxXFBMem\" to\n"
"\tlimit the memory X should use and leave the rest to DRI\n");
#endif
pSiS->DRIheapstart = pSiS->DRIheapend = 0;
@@ -5107,16 +5597,18 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
if(xf86LoadSubModule(pScrn, "ddc")) {
- int crtnum = 0;
- xf86LoaderReqSymLists(ddcSymbols, NULL);
+ int crtnum = 0;
+ xf86LoaderReqSymLists(ddcSymbols, NULL);
if((pMonitor = SiSDoPrivateDDC(pScrn, &crtnum))) {
didddc2 = TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, ddcsstr, crtnum);
xf86PrintEDID(pMonitor);
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, ddcestr, crtnum);
xf86SetDDCproperties(pScrn, pMonitor);
pScrn->monitor->DDC = pMonitor;
- }
+ /* Now try to find out aspect ratio */
+ SiSFindAspect(pScrn, pMonitor, crtnum);
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, ddcestr, crtnum);
+ }
}
}
@@ -5139,21 +5631,23 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if(xf86LoadSubModule(pScrn, "ddc")) {
- xf86LoaderReqSymLists(ddcSymbols, NULL);
+ xf86LoaderReqSymLists(ddcSymbols, NULL);
- /* Now load and initialize VBE module. */
+ /* Now load and initialize VBE module. */
SiS_LoadInitVBE(pScrn);
- if(pSiS->pVbe) {
+ if(pSiS->pVbe) {
if((pMonitor = vbeDoEDID(pSiS->pVbe,NULL))) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "VBE CRT1 DDC monitor info:\n");
- xf86SetDDCproperties(pScrn, xf86PrintEDID(pMonitor));
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "End of VBE CRT1 DDC monitor info\n");
+ "VBE CRT1 DDC monitor info:\n");
+ xf86SetDDCproperties(pScrn, xf86PrintEDID(pMonitor));
pScrn->monitor->DDC = pMonitor;
- }
- } else {
+ /* Now try to find out aspect ratio */
+ SiSFindAspect(pScrn, pMonitor, 1);
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "End of VBE CRT1 DDC monitor info\n");
+ }
+ } else {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Failed to read DDC data\n");
}
@@ -5164,9 +5658,9 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if(pSiS->MergedFB) {
pSiS->CRT2pScrn->monitor = xalloc(sizeof(MonRec));
if(pSiS->CRT2pScrn->monitor) {
- DisplayModePtr tempm = NULL, currentm = NULL, newm = NULL;
- memcpy(pSiS->CRT2pScrn->monitor, pScrn->monitor, sizeof(MonRec));
- pSiS->CRT2pScrn->monitor->DDC = NULL;
+ DisplayModePtr tempm = NULL, currentm = NULL, newm = NULL;
+ memcpy(pSiS->CRT2pScrn->monitor, pScrn->monitor, sizeof(MonRec));
+ pSiS->CRT2pScrn->monitor->DDC = NULL;
pSiS->CRT2pScrn->monitor->Modes = NULL;
pSiS->CRT2pScrn->monitor->id = (char *)crt2monname;
tempm = pScrn->monitor->Modes;
@@ -5186,20 +5680,22 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
currentm = newm;
tempm = tempm->next;
}
- if(pSiS->CRT2HSync) {
- pSiS->CRT2pScrn->monitor->nHsync =
- SiSStrToRanges(pSiS->CRT2pScrn->monitor->hsync, pSiS->CRT2HSync, MAX_HSYNC);
- }
- if(pSiS->CRT2VRefresh) {
- pSiS->CRT2pScrn->monitor->nVrefresh =
- SiSStrToRanges(pSiS->CRT2pScrn->monitor->vrefresh, pSiS->CRT2VRefresh, MAX_VREFRESH);
- }
+ if(pSiS->CRT2HSync) {
+ pSiS->CRT2pScrn->monitor->nHsync =
+ SiSStrToRanges(pSiS->CRT2pScrn->monitor->hsync, pSiS->CRT2HSync, MAX_HSYNC);
+ }
+ if(pSiS->CRT2VRefresh) {
+ pSiS->CRT2pScrn->monitor->nVrefresh =
+ SiSStrToRanges(pSiS->CRT2pScrn->monitor->vrefresh, pSiS->CRT2VRefresh, MAX_VREFRESH);
+ }
if((pMonitor = SiSInternalDDC(pSiS->CRT2pScrn, 1))) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, ddcsstr, 2);
xf86PrintEDID(pMonitor);
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, ddcestr, 2);
xf86SetDDCproperties(pSiS->CRT2pScrn, pMonitor);
pSiS->CRT2pScrn->monitor->DDC = pMonitor;
+ /* Now try to find out aspect ratio */
+ SiSFindAspect(pScrn, pMonitor, 2);
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, ddcestr, 2);
/* use DDC data if no ranges in config file */
if(!pSiS->CRT2HSync) {
pSiS->CRT2pScrn->monitor->nHsync = 0;
@@ -5207,15 +5703,15 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if(!pSiS->CRT2VRefresh) {
pSiS->CRT2pScrn->monitor->nVrefresh = 0;
}
- } else {
+ } else {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Failed to read DDC data for CRT2\n");
+ "Failed to read DDC data for CRT2\n");
}
} else {
- SISErrorLog(pScrn, "Failed to allocate memory for CRT2 monitor, %s.\n",
+ SISErrorLog(pScrn, "Failed to allocate memory for CRT2 monitor, %s.\n",
mergeddisstr);
if(pSiS->CRT2pScrn) xfree(pSiS->CRT2pScrn);
- pSiS->CRT2pScrn = NULL;
+ pSiS->CRT2pScrn = NULL;
pSiS->MergedFB = FALSE;
}
}
@@ -5286,12 +5782,13 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
Bool includelcdmodes = TRUE; /* Include modes reported by DDC */
Bool isfordvi = FALSE; /* Is for digital DVI output */
Bool fakecrt2modes = FALSE; /* Fake some modes for CRT2 */
- if(pSiS->UseVESA) {
+ Bool IsForCRT2 = FALSE;
+ if(pSiS->UseVESA) {
acceptcustommodes = FALSE;
includelcdmodes = FALSE;
}
#ifdef SISDUALHEAD /* Dual head is static. Output devices will not change. */
- if(pSiS->DualHeadMode) {
+ if(pSiS->DualHeadMode) {
if(!pSiS->SecondHead) { /* CRT2: */
if(pSiS->VBFlags & VB_SISTMDSBRIDGE) {
if(!(pSiS->VBFlags & VB_30xBDH)) {
@@ -5313,6 +5810,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
}
}
clockRanges->interlaceAllowed = FALSE;
+ IsForCRT2 = TRUE;
} else { /* CRT1: */
if(pSiS->VBFlags & CRT1_LCDA) {
if(!(pSiS->VBFlags & VB_SISTMDSLCDABRIDGE)) {
@@ -5351,13 +5849,16 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
#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;
+ 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;
}
+ if((!(pSiS->VBFlags & DISPTYPE_CRT1)) && (!(pSiS->VBFlags & CRT1_LCDA))) {
+ IsForCRT2 = 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.
@@ -5366,11 +5867,12 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
* taken care of by ValidMode() and ModeInit()/PresetMode().
*/
} else {
- if(pSiS->VBFlags & (CRT2_TV|CRT2_LCD)) {
+ if(pSiS->VBFlags & (CRT2_TV|CRT2_LCD)) {
acceptcustommodes = FALSE;
includelcdmodes = FALSE;
if(!(pSiS->VBFlags & DISPTYPE_CRT1)) {
fakecrt2modes = TRUE;
+ IsForCRT2 = TRUE;
}
}
}
@@ -5379,6 +5881,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
includelcdmodes = FALSE;
if((pSiS->VBFlags & CRT1_LCDA) || (!(pSiS->VBFlags & DISPTYPE_CRT1))) {
fakecrt2modes = TRUE;
+ IsForCRT2 = TRUE;
}
} else {
includelcdmodes = FALSE;
@@ -5386,11 +5889,23 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
/* Ignore interlace, mode switching code will handle this */
pSiS->HaveCustomModes = FALSE;
- if(SiSMakeOwnModeList(pScrn, acceptcustommodes, includelcdmodes,
- isfordvi, &pSiS->HaveCustomModes, FALSE /*fakecrt2modes*/ )) {
+ if(SiSMakeOwnModeList(pScrn, acceptcustommodes, includelcdmodes,
+ isfordvi, &pSiS->HaveCustomModes, FALSE /*fakecrt2modes*/, IsForCRT2)) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Replaced %s mode list with built-in modes\n",
+ "Replaced %s mode list with built-in modes\n",
pSiS->HaveCustomModes ? "default" : "entire");
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ int UseWide = pSiS->SiS_Pr->SiS_UseWide;
+ if(IsForCRT2) UseWide = pSiS->SiS_Pr->SiS_UseWideCRT2;
+ if((!IsForCRT2) || (pSiS->VBFlags & VB_SISVGA2BRIDGE)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Using %s widescreen modes for CRT%d VGA devices\n",
+ UseWide ? "real" : "fake", IsForCRT2 ? 2 : 1);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "\tUse option \"ForceCRT%dVGAAspect\" to overrule\n",
+ IsForCRT2 ? 2 : 1);
+ }
+ }
#ifdef TWDEBUG
pScrn->modes = pScrn->monitor->Modes;
xf86PrintModes(pScrn);
@@ -5398,7 +5913,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
#endif
} else {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Building list of built-in modes failed, using server defaults\n");
+ "Building list of built-in modes failed, using server defaults\n");
}
} else {
pSiS->HaveCustomModes = TRUE;
@@ -5408,32 +5923,32 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
/* Add our built-in hi-res and TV modes on the 6326 */
if(pSiS->Chipset == PCI_CHIP_SIS6326) {
if(pScrn->bitsPerPixel == 8) {
- SiS6326SIS1600x1200_60Mode.next = pScrn->monitor->Modes;
- pScrn->monitor->Modes = &SiS6326SIS1600x1200_60Mode;
+ SiS6326SIS1600x1200_60Mode.next = pScrn->monitor->Modes;
+ pScrn->monitor->Modes = &SiS6326SIS1600x1200_60Mode;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Adding mode \"SIS1600x1200-60\" (depth 8 only)\n");
}
if(pScrn->bitsPerPixel <= 16) {
- SiS6326SIS1280x1024_75Mode.next = pScrn->monitor->Modes;
- pScrn->monitor->Modes = &SiS6326SIS1280x1024_75Mode;
+ SiS6326SIS1280x1024_75Mode.next = pScrn->monitor->Modes;
+ pScrn->monitor->Modes = &SiS6326SIS1280x1024_75Mode;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Adding mode \"SIS1280x1024-75\" (depths 8, 15 and 16 only)\n");
}
if((pSiS->SiS6326Flags & SIS6326_HASTV) &&
- (pSiS->SiS6326Flags & SIS6326_TVDETECTED)) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Adding %s TV modes to mode list:\n",
+ (pSiS->SiS6326Flags & SIS6326_TVDETECTED)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Adding %s TV modes to mode list:\n",
(pSiS->SiS6326Flags & SIS6326_TVPAL) ? "PAL" : "NTSC");
- if(pSiS->SiS6326Flags & SIS6326_TVPAL) {
- SiS6326PAL800x600Mode.next = pScrn->monitor->Modes;
- pScrn->monitor->Modes = &SiS6326PAL640x480Mode;
+ if(pSiS->SiS6326Flags & SIS6326_TVPAL) {
+ SiS6326PAL800x600Mode.next = pScrn->monitor->Modes;
+ pScrn->monitor->Modes = &SiS6326PAL640x480Mode;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "\t\"PAL800x600\" \"PAL800x600U\" \"PAL720x540\" \"PAL640x480\"\n");
+ "\t\"PAL800x600\" \"PAL800x600U\" \"PAL720x540\" \"PAL640x480\"\n");
} else {
SiS6326NTSC640x480Mode.next = pScrn->monitor->Modes;
- pScrn->monitor->Modes = &SiS6326NTSC640x400Mode;
+ pScrn->monitor->Modes = &SiS6326NTSC640x400Mode;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "\t\"NTSC640x480\" \"NTSC640x480U\" \"NTSC640x400\"\n");
+ "\t\"NTSC640x480\" \"NTSC640x480U\" \"NTSC640x400\"\n");
}
}
}
@@ -5456,29 +5971,29 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
fromDDC = FALSE;
if((pScrn->monitor->nHsync <= 0) || (pSiS->OverruleRanges)) {
if((pScrn->monitor->nHsync <= 0) && (pScrn->monitor->DDC)) {
- SiSSetSyncRangeFromEdid(pScrn, 1);
+ SiSSetSyncRangeFromEdid(pScrn, 1);
if(pScrn->monitor->nHsync > 0) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, subshstr,
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, subshstr,
#ifdef SISDUALHEAD
pSiS->DualHeadMode ? (pSiS->SecondHead ? 1 : 2) :
#endif
- pSiS->CRT1off ? 2 : 1);
+ pSiS->CRT1off ? 2 : 1);
fromDDC = TRUE;
- }
+ }
}
if((pScrn->monitor->nHsync <= 0) || (pSiS->OverruleRanges)) {
- if(SiSAllowSyncOverride(pSiS, fromDDC)) {
+ if(SiSAllowSyncOverride(pSiS, fromDDC)) {
Bool HaveNoRanges = (pScrn->monitor->nHsync <= 0);
/* Set sane ranges for LCD and TV
* (our strict checking will filter out invalid ones anyway)
*/
if((crt1freqoverruled = CheckAndOverruleH(pScrn, pScrn->monitor))) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, saneh,
- HaveNoRanges ? "missing" : "bogus",
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, saneh,
+ HaveNoRanges ? "missing" : "bogus",
#ifdef SISDUALHEAD
pSiS->DualHeadMode ? (pSiS->SecondHead ? 1 : 2) :
#endif
- pSiS->CRT1off ? 2 : 1);
+ pSiS->CRT1off ? 2 : 1);
}
}
}
@@ -5487,27 +6002,27 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
fromDDC = FALSE;
if((pScrn->monitor->nVrefresh <= 0) || (pSiS->OverruleRanges)) {
if((pScrn->monitor->nVrefresh <= 0) && (pScrn->monitor->DDC)) {
- SiSSetSyncRangeFromEdid(pScrn, 0);
+ SiSSetSyncRangeFromEdid(pScrn, 0);
if(pScrn->monitor->nVrefresh > 0) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, subsvstr,
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, subsvstr,
#ifdef SISDUALHEAD
pSiS->DualHeadMode ? (pSiS->SecondHead ? 1 : 2) :
#endif
- pSiS->CRT1off ? 2 : 1);
+ pSiS->CRT1off ? 2 : 1);
fromDDC = TRUE;
}
}
if((pScrn->monitor->nVrefresh <= 0) || (pSiS->OverruleRanges)) {
- if(SiSAllowSyncOverride(pSiS, fromDDC)) {
+ if(SiSAllowSyncOverride(pSiS, fromDDC)) {
Bool HaveNoRanges = (pScrn->monitor->nVrefresh <= 0);
/* Set sane ranges for LCD and TV */
if((crt1freqoverruled = CheckAndOverruleV(pScrn, pScrn->monitor))) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, sanev,
- HaveNoRanges ? "missing" : "bogus",
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, sanev,
+ HaveNoRanges ? "missing" : "bogus",
#ifdef SISDUALHEAD
pSiS->DualHeadMode ? (pSiS->SecondHead ? 1 : 2) :
#endif
- pSiS->CRT1off ? 2 : 1);
+ pSiS->CRT1off ? 2 : 1);
}
}
}
@@ -5515,9 +6030,9 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "\"Unknown reason\" in the following list means that the mode\n");
+ "\"Unknown reason\" in the following list means that the mode\n");
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "is not supported on the chipset/bridge/current output device.\n");
+ "is not supported on the chipset/bridge/current output device.\n");
}
/*
@@ -5562,14 +6077,14 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if(crt1freqoverruled) pScrn->monitor->DDC = NULL;
i = xf86ValidateModes(pScrn, pScrn->monitor->Modes,
- pScrn->display->modes, clockRanges, NULL,
- minpitch, maxpitch,
- pScrn->bitsPerPixel * 8,
- minheight, maxheight,
- pScrn->display->virtualX,
- pScrn->display->virtualY,
- pSiS->maxxfbmem,
- LOOKUP_BEST_REFRESH);
+ pScrn->display->modes, clockRanges, NULL,
+ minpitch, maxpitch,
+ pScrn->bitsPerPixel * 8,
+ minheight, maxheight,
+ pScrn->display->virtualX,
+ pScrn->display->virtualY,
+ pSiS->maxxfbmem,
+ LOOKUP_BEST_REFRESH);
pScrn->monitor->DDC = backupddc;
}
@@ -5590,17 +6105,17 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
ULong memreq = (pScrn->virtualX * ((pScrn->bitsPerPixel + 7) / 8)) * pScrn->virtualY;
if(memreq > pSiS->maxxfbmem) {
- SISErrorLog(pScrn,
- "Virtual screen too big for memory; %ldK needed, %ldK available\n",
+ SISErrorLog(pScrn,
+ "Virtual screen too big for memory; %ldK needed, %ldK available\n",
memreq/1024, pSiS->maxxfbmem/1024);
#ifdef SISDUALHEAD
- if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE;
+ if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE;
#endif
- if(pSiS->pInt) xf86FreeInt10(pSiS->pInt);
- pSiS->pInt = NULL;
- sisRestoreExtRegisterLock(pSiS,srlockReg,crlockReg);
- SISFreeRec(pScrn);
- return FALSE;
+ if(pSiS->pInt) xf86FreeInt10(pSiS->pInt);
+ pSiS->pInt = NULL;
+ sisRestoreExtRegisterLock(pSiS,srlockReg,crlockReg);
+ SISFreeRec(pScrn);
+ return FALSE;
}
}
@@ -5616,20 +6131,20 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if((p = first = pScrn->modes)) {
- do {
+ do {
n = p->next;
/* Modes that require the bridge to operate in SlaveMode
- * are not suitable for Dual Head mode.
- */
+ * are not suitable for Dual Head mode.
+ */
if( (pSiS->VGAEngine == SIS_300_VGA) &&
( (strcmp(p->name, "320x200") == 0) ||
(strcmp(p->name, "320x240") == 0) ||
(strcmp(p->name, "400x300") == 0) ||
(strcmp(p->name, "512x384") == 0) ||
(strcmp(p->name, "640x400") == 0) ) ) {
- p->status = MODE_BAD;
+ p->status = MODE_BAD;
xf86DrvMsg(pScrn->scrnIndex, X_INFO, notsuitablestr, p->name, "dual head");
}
@@ -5642,7 +6157,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
p = n;
- } while (p != NULL && p != first);
+ } while (p != NULL && p != first);
}
}
@@ -5684,7 +6199,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
- if(pSiS->SecondHead) {
+ if(pSiS->SecondHead) {
if(pSiS->VBFlags & CRT1_LCDA) usemyprint = TRUE;
} else {
if(pSiS->VBFlags & (CRT2_LCD | CRT2_TV)) usemyprint = TRUE;
@@ -5693,19 +6208,19 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
#endif
#ifdef SISMERGED
if(pSiS->MergedFB) {
- if(pSiS->VBFlags & CRT1_LCDA) usemyprint = TRUE;
+ if(pSiS->VBFlags & CRT1_LCDA) usemyprint = TRUE;
} else
#endif
{
- if( (pSiS->VBFlags & (CRT2_LCD | CRT2_TV)) &&
+ if( (pSiS->VBFlags & (CRT2_LCD | CRT2_TV)) &&
(!(pSiS->VBFlags & DISPTYPE_DISP1)) )
usemyprint = TRUE;
}
if(usemyprint) {
- SiSPrintModes(pScrn);
+ SiSPrintModes(pScrn);
} else {
- xf86PrintModes(pScrn);
+ xf86PrintModes(pScrn);
}
}
@@ -5740,13 +6255,13 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
/* See above for a remark on handling CRT2 = TV */
} else {
if(pSiS->VBFlags & (CRT2_LCD|CRT2_TV)) {
- includelcdmodes = FALSE;
- acceptcustommodes = FALSE;
+ includelcdmodes = FALSE;
+ acceptcustommodes = FALSE;
fakecrt2modes = TRUE;
}
}
} else {
- includelcdmodes = FALSE;
+ includelcdmodes = FALSE;
acceptcustommodes = FALSE;
if(pSiS->VBFlags & (CRT2_LCD|CRT2_TV)) {
fakecrt2modes = TRUE;
@@ -5755,17 +6270,22 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->HaveCustomModes2 = FALSE;
if(!SiSMakeOwnModeList(pSiS->CRT2pScrn, acceptcustommodes, includelcdmodes,
- isfordvi, &pSiS->HaveCustomModes2, FALSE /* fakecrt2modes */ )) {
+ isfordvi, &pSiS->HaveCustomModes2, FALSE /* fakecrt2modes */, TRUE )) {
SISErrorLog(pScrn, "Building list of built-in modes for CRT2 failed, %s\n",
- mergeddisstr);
+ mergeddisstr);
SiSFreeCRT2Structs(pSiS);
pSiS->MergedFB = FALSE;
} else {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Replaced %s mode list for CRT2 with built-in modes\n",
- pSiS->HaveCustomModes2 ? "default" : "entire");
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Replaced %s mode list for CRT2 with built-in modes\n",
+ pSiS->HaveCustomModes2 ? "default" : "entire");
+ if((pSiS->VGAEngine == SIS_315_VGA) && (pSiS->VBFlags & VB_SISVGA2BRIDGE)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Using %s widescreen modes for CRT2 VGA devices\n",
+ pSiS->SiS_Pr->SiS_UseWideCRT2 ? "real" : "fake");
+ } else pSiS->SiS_Pr->SiS_UseWideCRT2 = 0;
}
}
@@ -5781,11 +6301,11 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if((pSiS->CRT2pScrn->monitor->nHsync <= 0) && (pSiS->CRT2pScrn->monitor->DDC)) {
SiSSetSyncRangeFromEdid(pSiS->CRT2pScrn, 1);
if(pSiS->CRT2pScrn->monitor->nHsync > 0) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, subshstr, 2);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, subshstr, 2);
fromDDC = TRUE;
}
- }
- if((pSiS->CRT2pScrn->monitor->nHsync <= 0) || (pSiS->OverruleRanges)) {
+ }
+ if((pSiS->CRT2pScrn->monitor->nHsync <= 0) || (pSiS->OverruleRanges)) {
if( (pSiS->VBFlags & CRT2_TV) ||
((pSiS->VBFlags & CRT2_LCD) && (!fromDDC)) ) {
Bool HaveNoRanges = (pSiS->CRT2pScrn->monitor->nHsync <= 0);
@@ -5800,14 +6320,14 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
fromDDC = FALSE;
if((pSiS->CRT2pScrn->monitor->nVrefresh <= 0) || (pSiS->OverruleRanges)) {
- if((pSiS->CRT2pScrn->monitor->nVrefresh <= 0) && (pSiS->CRT2pScrn->monitor->DDC)) {
- SiSSetSyncRangeFromEdid(pSiS->CRT2pScrn, 0);
+ if((pSiS->CRT2pScrn->monitor->nVrefresh <= 0) && (pSiS->CRT2pScrn->monitor->DDC)) {
+ SiSSetSyncRangeFromEdid(pSiS->CRT2pScrn, 0);
if(pSiS->CRT2pScrn->monitor->nVrefresh > 0) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, subsvstr, 2);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, subsvstr, 2);
fromDDC = TRUE;
}
}
- if((pSiS->CRT2pScrn->monitor->nVrefresh <= 0) || (pSiS->OverruleRanges)) {
+ if((pSiS->CRT2pScrn->monitor->nVrefresh <= 0) || (pSiS->OverruleRanges)) {
if( (pSiS->VBFlags & CRT2_TV) ||
((pSiS->VBFlags & CRT2_LCD) && (!fromDDC)) ) {
Bool HaveNoRanges = (pSiS->CRT2pScrn->monitor->nVrefresh <= 0);
@@ -5817,7 +6337,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
HaveNoRanges ? "missing" : "bogus", 2);
}
}
- }
+ }
}
backupddc = pSiS->CRT2pScrn->monitor->DDC;
@@ -5828,21 +6348,21 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
pSiS->CheckForCRT2 = TRUE;
i = xf86ValidateModes(pSiS->CRT2pScrn, pSiS->CRT2pScrn->monitor->Modes,
- pSiS->CRT2pScrn->display->modes, clockRanges,
- NULL, 256, 4088,
- pSiS->CRT2pScrn->bitsPerPixel * 8, 128, 4096,
- pScrn->display->virtualX ? pScrn->virtualX : 0,
- pScrn->display->virtualY ? pScrn->virtualY : 0,
- pSiS->maxxfbmem,
- LOOKUP_BEST_REFRESH);
+ pSiS->CRT2pScrn->display->modes, clockRanges,
+ NULL, 256, 4088,
+ pSiS->CRT2pScrn->bitsPerPixel * 8, 128, 4096,
+ pScrn->display->virtualX ? pScrn->virtualX : 0,
+ pScrn->display->virtualY ? pScrn->virtualY : 0,
+ pSiS->maxxfbmem,
+ LOOKUP_BEST_REFRESH);
pSiS->CheckForCRT2 = FALSE;
pSiS->CRT2pScrn->monitor->DDC = backupddc;
if(i == -1) {
- SISErrorLog(pScrn, "xf86ValidateModes() error, %s.\n", mergeddisstr);
+ SISErrorLog(pScrn, "xf86ValidateModes() error, %s.\n", mergeddisstr);
SiSFreeCRT2Structs(pSiS);
- pSiS->MergedFB = FALSE;
+ pSiS->MergedFB = FALSE;
}
}
@@ -5858,7 +6378,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
(strcmp(p->name, "400x300") == 0) ||
(strcmp(p->name, "512x384") == 0) ||
(strcmp(p->name, "640x400") == 0) ) ) {
- p->status = MODE_BAD;
+ p->status = MODE_BAD;
xf86DrvMsg(pScrn->scrnIndex, X_INFO, notsuitablestr, p->name, "MergedFB");
}
p = n;
@@ -5868,7 +6388,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
xf86PruneDriverModes(pSiS->CRT2pScrn);
if(i == 0 || pSiS->CRT2pScrn->modes == NULL) {
- SISErrorLog(pScrn, "No valid modes found for CRT2; %s\n", mergeddisstr);
+ SISErrorLog(pScrn, "No valid modes found for CRT2; %s\n", mergeddisstr);
SiSFreeCRT2Structs(pSiS);
pSiS->MergedFB = FALSE;
}
@@ -5882,9 +6402,9 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn->scrnIndex, X_INFO, modesforstr, 2);
if(pSiS->VBFlags & (CRT2_LCD | CRT2_TV)) {
- SiSPrintModes(pSiS->CRT2pScrn);
+ SiSPrintModes(pSiS->CRT2pScrn);
} else {
- xf86PrintModes(pSiS->CRT2pScrn);
+ xf86PrintModes(pSiS->CRT2pScrn);
}
pSiS->CRT1Modes = pScrn->modes;
@@ -5893,13 +6413,13 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "MergedFB: Generating mode list\n");
pScrn->modes = SiSGenerateModeList(pScrn, pSiS->MetaModes,
- pSiS->CRT1Modes, pSiS->CRT2pScrn->modes,
+ pSiS->CRT1Modes, pSiS->CRT2pScrn->modes,
pSiS->CRT2Position);
if(!pScrn->modes) {
SISErrorLog(pScrn, "Failed to parse MetaModes or no modes found. %s.\n",
- mergeddisstr);
+ mergeddisstr);
SiSFreeCRT2Structs(pSiS);
pScrn->modes = pSiS->CRT1Modes;
pSiS->CRT1Modes = NULL;
@@ -5912,7 +6432,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if(pSiS->MergedFB) {
/* If no virtual dimension was given by the user,
- * calculate a sane one now. Adapts pScrn->virtualX,
+ * calculate a sane one now. Adapts pScrn->virtualX,
* pScrn->virtualY and pScrn->displayWidth.
*/
SiSRecalcDefaultVirtualSize(pScrn);
@@ -5949,19 +6469,19 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
#endif
if(pSiS->pInt) xf86FreeInt10(pSiS->pInt);
sisRestoreExtRegisterLock(pSiS,srlockReg,crlockReg);
- SISFreeRec(pScrn);
- return FALSE;
- }
+ SISFreeRec(pScrn);
+ return FALSE;
+ }
break;
default:
- SISErrorLog(pScrn, "Unsupported framebuffer bpp (%d)\n", pScrn->bitsPerPixel);
+ SISErrorLog(pScrn, "Unsupported framebuffer bpp (%d)\n", pScrn->bitsPerPixel);
#ifdef SISDUALHEAD
if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE;
#endif
if(pSiS->pInt) xf86FreeInt10(pSiS->pInt);
sisRestoreExtRegisterLock(pSiS,srlockReg,crlockReg);
- SISFreeRec(pScrn);
- return FALSE;
+ SISFreeRec(pScrn);
+ return FALSE;
}
xf86LoaderReqSymLists(fbSymbols, NULL);
@@ -5975,8 +6495,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
#endif
if(pSiS->pInt) xf86FreeInt10(pSiS->pInt);
sisRestoreExtRegisterLock(pSiS,srlockReg,crlockReg);
- SISFreeRec(pScrn);
- return FALSE;
+ SISFreeRec(pScrn);
+ return FALSE;
}
xf86LoaderReqSymLists(xaaSymbols, NULL);
}
@@ -5991,7 +6511,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if(pSiS->pInt) xf86FreeInt10(pSiS->pInt);
sisRestoreExtRegisterLock(pSiS,srlockReg,crlockReg);
SISFreeRec(pScrn);
- return FALSE;
+ return FALSE;
}
xf86LoaderReqSymLists(shadowSymbols, NULL);
}
@@ -6000,10 +6520,10 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
#ifdef XF86DRI
if(pSiS->loadDRI) {
if(!xf86LoaderCheckSymbol("DRIScreenInit")) {
- if(xf86LoadSubModule(pScrn, "dri")) {
+ if(xf86LoadSubModule(pScrn, "dri")) {
if(!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) {
if(xf86LoadSubModule(pScrn, "glx")) {
- xf86LoaderReqSymLists(driSymbols, drmSymbols, NULL);
+ xf86LoaderReqSymLists(driSymbols, drmSymbols, NULL);
} else {
SISErrorLog(pScrn, "Failed to load glx module\n");
}
@@ -6020,20 +6540,20 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
if(pSiS->VESA == 1) {
SiS_LoadInitVBE(pScrn);
if(pSiS->pVbe) {
- VbeInfoBlock *vbe;
- if((vbe = VBEGetVBEInfo(pSiS->pVbe))) {
- pSiS->vesamajor = (unsigned)(vbe->VESAVersion >> 8);
- pSiS->vesaminor = vbe->VESAVersion & 0xff;
- SiSBuildVesaModeList(pScrn, pSiS->pVbe, vbe);
- VBEFreeVBEInfo(vbe);
- pSiS->UseVESA = 1;
- } else {
+ VbeInfoBlock *vbe;
+ if((vbe = VBEGetVBEInfo(pSiS->pVbe))) {
+ pSiS->vesamajor = (unsigned)(vbe->VESAVersion >> 8);
+ pSiS->vesaminor = vbe->VESAVersion & 0xff;
+ SiSBuildVesaModeList(pScrn, pSiS->pVbe, vbe);
+ VBEFreeVBEInfo(vbe);
+ pSiS->UseVESA = 1;
+ } else {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Failed to read VBE Info Block\n");
}
}
if(pSiS->UseVESA == 0) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"VESA mode switching disabled.\n");
}
}
@@ -6058,7 +6578,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags)
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
- pSiS->SiS_SD_Flags |= SiS_SD_ISDUALHEAD;
+ pSiS->SiS_SD_Flags |= SiS_SD_ISDUALHEAD;
if(pSiS->SecondHead) pSiS->SiS_SD_Flags |= SiS_SD_ISDHSECONDHEAD;
else pSiS->SiS_SD_Flags &= ~(SiS_SD_SUPPORTXVGAMMA1);
#ifdef PANORAMIX
@@ -6097,18 +6617,18 @@ SISMapIOPMem(ScrnInfoPtr pScrn)
pSiSEnt->MapCountIOPBase++;
if(!(pSiSEnt->IOPBase)) {
/* Only map if not mapped previously */
- pSiSEnt->IOPBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO,
- pSiS->PciTag, pSiS->IOPAddress, 128);
+ 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);
+ 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;
+ SISErrorLog(pScrn, "Could not map I/O port area\n");
+ return FALSE;
}
return TRUE;
@@ -6130,8 +6650,8 @@ SISUnmapIOPMem(ScrnInfoPtr pScrn)
if(pSiSEnt->MapCountIOPBase) {
pSiSEnt->MapCountIOPBase--;
if((pSiSEnt->MapCountIOPBase == 0) || (pSiSEnt->forceUnmapIOPBase)) {
- xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOPBase, 2048);
- pSiSEnt->IOPBase = NULL;
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOPBase, 2048);
+ pSiSEnt->IOPBase = NULL;
pSiSEnt->MapCountIOPBase = 0;
pSiSEnt->forceUnmapIOPBase = FALSE;
}
@@ -6139,8 +6659,8 @@ SISUnmapIOPMem(ScrnInfoPtr pScrn)
}
} else {
#endif
- xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOPBase, 2048);
- pSiS->IOPBase = NULL;
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOPBase, 2048);
+ pSiS->IOPBase = NULL;
#ifdef SISDUALHEAD
}
#endif
@@ -6216,21 +6736,24 @@ SISMapMem(ScrnInfoPtr pScrn)
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
- pSiSEnt->MapCountFbBase++;
- if(!(pSiSEnt->FbBase)) {
+ pSiSEnt->MapCountFbBase++;
+ if(!(pSiSEnt->FbBase)) {
/* Only map if not mapped previously */
- pSiSEnt->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
- pSiS->PciTag, (ULong)pSiS->realFbAddress,
- pSiS->FbMapSize);
- }
- pSiS->FbBase = pSiSEnt->FbBase;
- /* Adapt FbBase (for DHM; dhmOffset is 0 otherwise) */
+ pSiSEnt->FbBase = pSiSEnt->RealFbBase =
+ xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
+ pSiS->PciTag, (ULong)pSiS->realFbAddress,
+ pSiS->FbMapSize);
+ }
+ pSiS->FbBase = pSiS->RealFbBase = pSiSEnt->FbBase;
+ /* Adapt FbBase (for DHM and SiS76x UMA skipping; dhmOffset is 0 otherwise) */
pSiS->FbBase += pSiS->dhmOffset;
} else {
#endif
- pSiS->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
- pSiS->PciTag, (ULong)pSiS->FbAddress,
- pSiS->FbMapSize);
+ pSiS->FbBase = pSiS->RealFbBase =
+ xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
+ pSiS->PciTag, (ULong)pSiS->realFbAddress,
+ pSiS->FbMapSize);
+ pSiS->FbBase += pSiS->dhmOffset;
#ifdef SISDUALHEAD
}
#endif
@@ -6240,6 +6763,10 @@ SISMapMem(ScrnInfoPtr pScrn)
return FALSE;
}
+#ifdef TWDEBUG
+ xf86DrvMsg(0, 0, "Framebuffer mapped to %p\n", pSiS->FbBase);
+#endif
+
return TRUE;
}
@@ -6264,8 +6791,8 @@ SISUnmapMem(ScrnInfoPtr pScrn)
if(pSiSEnt->MapCountIOBase) {
pSiSEnt->MapCountIOBase--;
if((pSiSEnt->MapCountIOBase == 0) || (pSiSEnt->forceUnmapIOBase)) {
- xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOBase, (pSiS->mmioSize * 1024));
- pSiSEnt->IOBase = NULL;
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOBase, (pSiS->mmioSize * 1024));
+ pSiSEnt->IOBase = NULL;
pSiSEnt->MapCountIOBase = 0;
pSiSEnt->forceUnmapIOBase = FALSE;
}
@@ -6275,8 +6802,8 @@ SISUnmapMem(ScrnInfoPtr pScrn)
if(pSiSEnt->MapCountIOBaseDense) {
pSiSEnt->MapCountIOBaseDense--;
if((pSiSEnt->MapCountIOBaseDense == 0) || (pSiSEnt->forceUnmapIOBaseDense)) {
- xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOBaseDense, (pSiS->mmioSize * 1024));
- pSiSEnt->IOBaseDense = NULL;
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->IOBaseDense, (pSiS->mmioSize * 1024));
+ pSiSEnt->IOBaseDense = NULL;
pSiSEnt->MapCountIOBaseDense = 0;
pSiSEnt->forceUnmapIOBaseDense = FALSE;
}
@@ -6286,24 +6813,24 @@ SISUnmapMem(ScrnInfoPtr pScrn)
if(pSiSEnt->MapCountFbBase) {
pSiSEnt->MapCountFbBase--;
if((pSiSEnt->MapCountFbBase == 0) || (pSiSEnt->forceUnmapFbBase)) {
- xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->FbBase, pSiS->FbMapSize);
- pSiSEnt->FbBase = NULL;
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiSEnt->RealFbBase, pSiS->FbMapSize);
+ pSiSEnt->FbBase = pSiSEnt->RealFbBase = NULL;
pSiSEnt->MapCountFbBase = 0;
pSiSEnt->forceUnmapFbBase = FALSE;
}
- pSiS->FbBase = NULL;
+ pSiS->FbBase = pSiS->RealFbBase = NULL;
}
} else {
#endif
- xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOBase, (pSiS->mmioSize * 1024));
- pSiS->IOBase = NULL;
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOBase, (pSiS->mmioSize * 1024));
+ pSiS->IOBase = NULL;
#ifdef __alpha__
- xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOBaseDense, (pSiS->mmioSize * 1024));
- pSiS->IOBaseDense = NULL;
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->IOBaseDense, (pSiS->mmioSize * 1024));
+ pSiS->IOBaseDense = NULL;
#endif
- xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->FbBase, pSiS->FbMapSize);
- pSiS->FbBase = NULL;
+ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pSiS->RealFbBase, pSiS->FbMapSize);
+ pSiS->FbBase = pSiS->RealFbBase = NULL;
#ifdef SISDUALHEAD
}
#endif
@@ -6432,7 +6959,7 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
SISEntPtr pSiSEnt = NULL;
#endif
- andSISIDXREG(SISCR,0x11,0x7f); /* Unlock CRTC registers */
+ andSISIDXREG(SISCR,0x11,0x7f); /* Unlock CRTC registers */
SISModifyModeInfo(mode); /* Quick check of the mode parameters */
@@ -6488,7 +7015,7 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
- if(!(*pSiS->ModeInit)(pScrn, mode)) {
+ if(!(*pSiS->ModeInit)(pScrn, mode)) {
SISErrorLog(pScrn, "ModeInit() failed\n");
return FALSE;
}
@@ -6505,9 +7032,11 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
return FALSE;
}
SiSPostSetMode(pScrn, &pSiS->ModeReg);
- SISAdjustFrame(pSiSEnt->pScrn_2->scrnIndex,
- pSiSEnt->pScrn_2->frameX0,
- pSiSEnt->pScrn_2->frameY0, 0);
+ if(pSiSEnt->pScrn_2) {
+ SISAdjustFrame(pSiSEnt->pScrn_2->scrnIndex,
+ pSiSEnt->pScrn_2->frameX0,
+ pSiSEnt->pScrn_2->frameY0, 0);
+ }
} else {
/* Head 2 (slave) is always CRT1 */
SiSPreSetMode(pScrn, mode, SIS_MODE_CRT1);
@@ -6516,9 +7045,11 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
return FALSE;
}
SiSPostSetMode(pScrn, &pSiS->ModeReg);
- SISAdjustFrame(pSiSEnt->pScrn_1->scrnIndex,
- pSiSEnt->pScrn_1->frameX0,
- pSiSEnt->pScrn_1->frameY0, 0);
+ if(pSiSEnt->pScrn_1) {
+ SISAdjustFrame(pSiSEnt->pScrn_1->scrnIndex,
+ pSiSEnt->pScrn_1->frameX0,
+ pSiSEnt->pScrn_1->frameY0, 0);
+ }
}
} else {
@@ -6526,7 +7057,7 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) {
- if(!(*pSiS->ModeInit)(pScrn, mode)) {
+ if(!(*pSiS->ModeInit)(pScrn, mode)) {
SISErrorLog(pScrn, "ModeInit() failed\n");
return FALSE;
}
@@ -6536,16 +7067,16 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
#ifdef SISMERGED
if(pSiS->MergedFB) {
- xf86DrvMsg(0, X_INFO, "Setting MergedFB mode %dx%d\n",
- mode->HDisplay, mode->VDisplay);
+ xf86DrvMsg(0, X_INFO, "Setting MergedFB mode %dx%d\n",
+ mode->HDisplay, mode->VDisplay);
SiSPreSetMode(pScrn, mode, SIS_MODE_CRT1);
if(!SiSBIOSSetModeCRT1(pSiS->SiS_Pr, &pSiS->sishw_ext, pScrn,
((SiSMergedDisplayModePtr)mode->Private)->CRT1,
pSiS->IsCustom)) {
- SISErrorLog(pScrn, "SiSBIOSSetModeCRT1() failed\n");
- return FALSE;
+ SISErrorLog(pScrn, "SiSBIOSSetModeCRT1() failed\n");
+ return FALSE;
}
SiSPreSetMode(pScrn, mode, SIS_MODE_CRT2);
@@ -6553,27 +7084,27 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
if(!SiSBIOSSetModeCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext, pScrn,
((SiSMergedDisplayModePtr)mode->Private)->CRT2,
pSiS->IsCustom)) {
- SISErrorLog(pScrn, "SiSBIOSSetModeCRT2() failed\n");
+ SISErrorLog(pScrn, "SiSBIOSSetModeCRT2() failed\n");
return FALSE;
- }
+ }
} else {
#endif
if((pSiS->VBFlags & CRT1_LCDA) || (!(mode->type & M_T_DEFAULT))) {
- SiSPreSetMode(pScrn, mode, SIS_MODE_CRT1);
+ SiSPreSetMode(pScrn, mode, SIS_MODE_CRT1);
- if(!SiSBIOSSetModeCRT1(pSiS->SiS_Pr, &pSiS->sishw_ext, pScrn,
- mode, pSiS->IsCustom)) {
+ 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)) {
+ if(!SiSBIOSSetModeCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext, pScrn,
+ mode, pSiS->IsCustom)) {
SISErrorLog(pScrn, "SiSBIOSSetModeCRT2() failed\n");
return FALSE;
}
@@ -6582,8 +7113,8 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
SiSPreSetMode(pScrn, mode, SIS_MODE_SIMU);
- if(!SiSBIOSSetMode(pSiS->SiS_Pr, &pSiS->sishw_ext, pScrn,
- mode, pSiS->IsCustom)) {
+ if(!SiSBIOSSetMode(pSiS->SiS_Pr, &pSiS->sishw_ext, pScrn,
+ mode, pSiS->IsCustom)) {
SISErrorLog(pScrn, "SiSBIOSSetMode() failed\n");
return FALSE;
}
@@ -6619,11 +7150,11 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
sisReg = &pSiS->ModeReg;
sisReg->sisRegsATTR[0x10] = 0x01;
- if(pScrn->bitsPerPixel > 8) {
- sisReg->sisRegsGR[0x05] = 0x00;
+ if(pScrn->bitsPerPixel > 8) {
+ sisReg->sisRegsGR[0x05] = 0x00;
}
- SiSVGARestore(pScrn, sisReg, SISVGA_SR_MODE);
+ SiSVGARestore(pScrn, sisReg, SISVGA_SR_MODE);
(*pSiS->SiSRestore)(pScrn, sisReg);
@@ -6634,10 +7165,10 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
#ifdef TWDEBUG
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"REAL REGISTER CONTENTS AFTER SETMODE:\n");
- (*pSiS->ModeInit)(pScrn, mode);
+ (*pSiS->ModeInit)(pScrn, mode);
#endif
- SiSVGAProtect(pScrn, FALSE);
+ SiSVGAProtect(pScrn, FALSE);
}
@@ -6837,63 +7368,63 @@ SISRestore(ScrnInfoPtr pScrn)
/* We must not disable the sequencer if the bridge is in SlaveMode! */
if(!(SiSBridgeIsInSlaveMode(pScrn))) {
- SiSVGAProtect(pScrn, TRUE);
+ SiSVGAProtect(pScrn, TRUE);
}
/* First, restore CRT1 on/off and VB connection registers */
outSISIDXREG(SISCR, 0x32, pSiS->oldCR32);
if(!(pSiS->oldCR17 & 0x80)) { /* CRT1 was off */
- if(!(SiSBridgeIsInSlaveMode(pScrn))) { /* Bridge is NOT in SlaveMode now -> do it */
+ if(!(SiSBridgeIsInSlaveMode(pScrn))) { /* Bridge is NOT in SlaveMode now -> do it */
doit = TRUE;
} else {
doitlater = TRUE;
}
} else { /* CRT1 was on -> do it now */
- doit = TRUE;
+ doit = TRUE;
}
if(doit) {
- outSISIDXREG(SISCR, 0x17, pSiS->oldCR17);
+ outSISIDXREG(SISCR, 0x17, pSiS->oldCR17);
}
if(pSiS->VGAEngine == SIS_315_VGA) {
- outSISIDXREG(SISCR, pSiS->myCR63, pSiS->oldCR63);
+ outSISIDXREG(SISCR, pSiS->myCR63, pSiS->oldCR63);
}
outSISIDXREG(SISSR, 0x1f, pSiS->oldSR1F);
/* For 30xB/LV, restoring the registers does not
- * work. We "manually" set the old mode, instead.
+ * work. We "manually" set the old mode, instead.
* The same applies for SiS730 machines with LVDS.
* Finally, this behavior can be forced by setting
* the option RestoreBySetMode.
- */
- if( ( (pSiS->restorebyset) ||
+ */
+ 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->OldMode) ) {
Bool changedmode = FALSE;
- xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
"Restoring by setting old mode 0x%02x\n", pSiS->OldMode);
- if(((pSiS->OldMode <= 0x13) || (!pSiS->sisfbfound)) && (pSiS->pVbe)) {
+ if(((pSiS->OldMode <= 0x13) || (!pSiS->sisfbfound)) && (pSiS->pVbe)) {
int vmode = SiSTranslateToVESA(pScrn, pSiS->OldMode);
if(vmode > 0) {
- if(vmode > 0x13) vmode |= ((1 << 15) | (1 << 14));
- if(VBESetVBEMode(pSiS->pVbe, vmode, NULL) == TRUE) {
- SISSpecialRestore(pScrn);
+ if(vmode > 0x13) vmode |= ((1 << 15) | (1 << 14));
+ if(VBESetVBEMode(pSiS->pVbe, vmode, NULL) == TRUE) {
+ SISSpecialRestore(pScrn);
SiS_GetSetModeID(pScrn,pSiS->OldMode);
- vesasuccess = TRUE;
- } else {
- xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
- "VBE failed to restore mode 0x%x\n", pSiS->OldMode);
- }
+ vesasuccess = TRUE;
+ } else {
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "VBE failed to restore mode 0x%x\n", pSiS->OldMode);
+ }
} else {
- xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
"Can't identify VESA mode number for mode 0x%x\n", pSiS->OldMode);
}
- }
+ }
if(vesasuccess == FALSE) {
@@ -6917,7 +7448,7 @@ SISRestore(ScrnInfoPtr pScrn)
inSISIDXREG(SISCR, 0x30, temp);
if(temp & 0x20) {
if(mymode == 0x03) {
- mymode = 0x13;
+ mymode = 0x13;
changedmode = TRUE;
}
}
@@ -6927,12 +7458,22 @@ SISRestore(ScrnInfoPtr pScrn)
pSiS->SiS_Pr->CRT1UsesCustomMode = FALSE;
pSiS->SiS_Pr->CenterScreen = 0;
if(pSiS->sisfbfound) {
- pSiS->SiS_Pr->UsePanelScaler = pSiS->sisfbscalelcd;
- pSiS->SiS_Pr->SiS_CustomT = pSiS->sisfbspecialtiming;
+ pSiS->SiS_Pr->UsePanelScaler = pSiS->sisfbscalelcd;
+ pSiS->SiS_Pr->SiS_CustomT = pSiS->sisfbspecialtiming;
} else {
- pSiS->SiS_Pr->UsePanelScaler = -1;
+ pSiS->SiS_Pr->UsePanelScaler = -1;
/* Leave CustomT as it is */
}
+ SiS_SetEnableDstn(pSiS->SiS_Pr, FALSE);
+ SiS_SetEnableFstn(pSiS->SiS_Pr, FALSE);
+ if((pSiS->sishw_ext.jChipType == SIS_550) && (pSiS->sisfbfound)) {
+ if(pSiS->sisfbxSTN) {
+ SiS_SetEnableDstn(pSiS->SiS_Pr, pSiS->sisfbDSTN);
+ SiS_SetEnableFstn(pSiS->SiS_Pr, pSiS->sisfbFSTN);
+ } else if(mymode == 0x5a || mymode == 0x5b) {
+ SiS_SetEnableFstn(pSiS->SiS_Pr, TRUE);
+ }
+ }
SiSSetMode(pSiS->SiS_Pr, &pSiS->sishw_ext, pScrn, mymode, FALSE);
if(changedmode) {
outSISIDXREG(SISCR,0x34,0x03);
@@ -7115,12 +7656,12 @@ SISBridgeRestore(ScrnInfoPtr pScrn)
}
}
-/* Our generic BlockHandler for Xv */
+/* Our BlockHandler */
static void
SISBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask)
{
ScreenPtr pScreen = screenInfo.screens[i];
- ScrnInfoPtr pScrn = xf86Screens[i];
+ ScrnInfoPtr pScrn = xf86Screens[i];
SISPtr pSiS = SISPTR(pScrn);
pScreen->BlockHandler = pSiS->BlockHandler;
@@ -7131,8 +7672,8 @@ SISBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask)
if(pSiS->NeedCopyFastVidCpy) {
SISEntPtr pSiSEnt = pSiS->entityPrivate;
if(pSiSEnt->HaveFastVidCpy) {
- pSiS->NeedCopyFastVidCpy = FALSE;
- pSiS->SiSFastVidCopy = pSiSEnt->SiSFastVidCopy;
+ pSiS->NeedCopyFastVidCpy = FALSE;
+ pSiS->SiSFastVidCopy = pSiSEnt->SiSFastVidCopy;
pSiS->SiSFastMemCopy = pSiSEnt->SiSFastMemCopy;
}
}
@@ -7166,30 +7707,30 @@ SISHandleMessage(int scrnIndex, const char *msgtype, const char *msgval, char **
} else if(!strncmp(msgval, "SD_CHECKMODEINDEXFORCRT2", 24)) {
- ULong ulbuf;
+ ULong ulbuf;
if(sscanf((char *)(msgval + 24), "%lx", &ulbuf) == 1) {
- result = (ulbuf & 0xffffff00);
- result |= (SISCheckModeIndexForCRT2Type(pScrn, (UShort)(ulbuf & 0xff),
- (UShort)((ulbuf >> 8) & 0xff),
- FALSE)) & 0xff;
- sprintf(pSiS->messagebuffer, "OK %lx", result);
+ result = (ulbuf & 0xffffff00);
+ result |= (SISCheckModeIndexForCRT2Type(pScrn, (UShort)(ulbuf & 0xff),
+ (UShort)((ulbuf >> 8) & 0xff),
+ FALSE)) & 0xff;
+ sprintf(pSiS->messagebuffer, "OK %lx", result);
} else {
strcpy(pSiS->messagebuffer, "ERROR");
}
} else if(!strncmp(msgval, "SD_CHECKMODETIMINGFORCRT2", 25)) {
- int hd, hss, hse, ht, vd, vss, vse, vt, clk;
+ int hd, hss, hse, ht, vd, vss, vse, vt, clk;
ULong ulbuf;
- if(sscanf((char *)(msgval + 25), "%lx %d %d %d %d %d %d %d %d %d",
+ if(sscanf((char *)(msgval + 25), "%lx %d %d %d %d %d %d %d %d %d",
&ulbuf, &clk, &hd, &hss, &hse, &ht, &vd, &vss, &vse, &vt) == 10) {
- result = SISCheckModeTimingForCRT2Type(pScrn, (UShort)(ulbuf & 0xff),
- hd, vd, ht, vt, hss, hse, vss, vse, clk, FALSE) & 0xff;
+ result = SISCheckModeTimingForCRT2Type(pScrn, (UShort)(ulbuf & 0xff),
+ hd, vd, ht, vt, hss, hse, vss, vse, clk, FALSE) & 0xff;
- sprintf(pSiS->messagebuffer, "OK %lx", result);
+ sprintf(pSiS->messagebuffer, "OK %lx", result);
} else {
strcpy(pSiS->messagebuffer, "ERROR");
}
@@ -7204,83 +7745,62 @@ SISHandleMessage(int scrnIndex, const char *msgtype, const char *msgval, char **
/* Do screen blanking; DPMS handling
*
- * Mandatory; optional
+ * Mandatory; latter optional
*/
-static Bool
-SISSaveScreen(ScreenPtr pScreen, int mode)
+
+static void
+SiSHandleBackLight(SISPtr pSiS, Bool blon)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ UChar sr11mask = (pSiS->SiS_Pr->SiS_SensibleSR11) ? 0x03 : 0xf3;
- if((pScrn != NULL) && pScrn->vtSema) {
+ if(pSiS->VBFlags & VB_SISLVDSBRIDGE) {
- SISPtr pSiS = SISPTR(pScrn);
+ if(!blon) {
+ SiS_SiS30xBLOff(pSiS->SiS_Pr, &pSiS->sishw_ext);
+ } else {
+ SiS_SiS30xBLOn(pSiS->SiS_Pr, &pSiS->sishw_ext);
+ }
-#ifdef UNLOCK_ALWAYS
- sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
-#endif
+ } else if( ((pSiS->VGAEngine == SIS_300_VGA) &&
+ (pSiS->VBFlags & (VB_LVDS|VB_30xBDH))) ||
+ ((pSiS->VGAEngine == SIS_315_VGA) &&
+ ((pSiS->VBFlags & (VB_LVDS | VB_CHRONTEL)) == VB_LVDS)) ) {
- if(pSiS->VBFlags & (CRT2_LCD | CRT1_LCDA)) {
+ if(!blon) {
+ setSISIDXREG(SISSR, 0x11, sr11mask, 0x08);
+ } else {
+ setSISIDXREG(SISSR, 0x11, sr11mask, 0x00);
+ }
- if(pSiS->VGAEngine == SIS_300_VGA) {
+ } else if((pSiS->VGAEngine == SIS_315_VGA) &&
+ (pSiS->VBFlags & VB_CHRONTEL)) {
- if(pSiS->VBFlags & VB_SISLVDSBRIDGE) {
- if(!xf86IsUnblank(mode)) {
- pSiS->Blank = TRUE;
- SiS_SiS30xBLOff(pSiS->SiS_Pr,&pSiS->sishw_ext);
- } else {
- pSiS->Blank = FALSE;
- SiS_SiS30xBLOn(pSiS->SiS_Pr,&pSiS->sishw_ext);
- }
- } else if(pSiS->VBFlags & (VB_LVDS | VB_30xBDH)) {
- if(!pSiS->Blank) {
- inSISIDXREG(SISSR, 0x11, pSiS->LCDon);
- }
- if(!xf86IsUnblank(mode)) {
- pSiS->Blank = TRUE;
- outSISIDXREG(SISSR, 0x11, pSiS->LCDon | 0x08);
- } else {
- pSiS->Blank = FALSE;
- outSISIDXREG(SISSR, 0x11, pSiS->LCDon);
- }
- }
+ if(!blon) {
+ SiS_Chrontel701xBLOff(pSiS->SiS_Pr);
+ } else {
+ SiS_Chrontel701xBLOn(pSiS->SiS_Pr, &pSiS->sishw_ext);
+ }
- } else if(pSiS->VGAEngine == SIS_315_VGA) {
+ }
+}
- if(!pSiS->Blank) {
- inSISIDXREG(SISSR, 0x11, pSiS->LCDon);
- if(pSiS->sishw_ext.jChipType >= SIS_661) pSiS->LCDon &= 0x0f;
- }
+static Bool
+SISSaveScreen(ScreenPtr pScreen, int mode)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ SISPtr pSiS;
+ Bool IsUnblank = xf86IsUnblank(mode) ? TRUE : FALSE;
- if(pSiS->VBFlags & VB_CHRONTEL) {
- if(!xf86IsUnblank(mode)) {
- pSiS->Blank = TRUE;
- SiS_Chrontel701xBLOff(pSiS->SiS_Pr);
- } else {
- pSiS->Blank = FALSE;
- SiS_Chrontel701xBLOn(pSiS->SiS_Pr,&pSiS->sishw_ext);
- }
- } else if(pSiS->VBFlags & VB_LVDS) {
- if(!xf86IsUnblank(mode)) {
- pSiS->Blank = TRUE;
- outSISIDXREG(SISSR, 0x11, pSiS->LCDon | 0x08);
- } else {
- pSiS->Blank = FALSE;
- outSISIDXREG(SISSR, 0x11, pSiS->LCDon);
- }
- } else if(pSiS->VBFlags & VB_SISLVDSBRIDGE) {
- if(!xf86IsUnblank(mode)) {
- pSiS->Blank = TRUE;
- SiS_SiS30xBLOff(pSiS->SiS_Pr,&pSiS->sishw_ext);
- } else {
- pSiS->Blank = FALSE;
- SiS_SiS30xBLOn(pSiS->SiS_Pr,&pSiS->sishw_ext);
- }
- }
+ if((pScrn == NULL) || (!pScrn->vtSema)) return TRUE;
- }
+ pSiS = SISPTR(pScrn);
- }
+#ifdef UNLOCK_ALWAYS
+ sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
+#endif
+ if(pSiS->VBFlags & (CRT2_LCD | CRT1_LCDA)) {
+ SiSHandleBackLight(pSiS, IsUnblank);
}
if(!SiSBridgeIsInSlaveMode(pScrn)) {
@@ -7296,91 +7816,35 @@ static Bool
SISSaveScreenDH(ScreenPtr pScreen, int mode)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- Bool checkit = FALSE;
-
- if((pScrn != NULL) && pScrn->vtSema) {
+ SISPtr pSiS;
+ Bool IsUnblank = xf86IsUnblank(mode) ? TRUE : FALSE;
- SISPtr pSiS = SISPTR(pScrn);
+ if((pScrn == NULL) || (!pScrn->vtSema)) return TRUE;
- if((pSiS->SecondHead) && ((!(pSiS->VBFlags & CRT1_LCDA)) || (pSiS->VBFlags & VB_SISTMDSLCDABRIDGE))) {
+ pSiS = SISPTR(pScrn);
- /* Slave head is always CRT1 */
- if(pSiS->VBFlags & CRT1_LCDA) pSiS->Blank = xf86IsUnblank(mode) ? FALSE : TRUE;
+ if( (pSiS->SecondHead) &&
+ ((!(pSiS->VBFlags & CRT1_LCDA)) || (pSiS->VBFlags & VB_SISTMDSLCDABRIDGE)) ) {
- return SiSVGASaveScreen(pScreen, mode);
+ /* Slave head is always CRT1 */
+ /* (No backlight handling on TMDS bridges) */
+ return SiSVGASaveScreen(pScreen, mode);
- } else {
+ } else {
- /* Master head is always CRT2 */
- /* But we land here if CRT1 is LCDA, too */
+ /* Master head is always CRT2 */
+ /* But we land here for LCDA, too (if bridge is SiS LVDS type) */
- /* We can only blank LCD, not other CRT2 devices */
- if(!(pSiS->VBFlags & (CRT2_LCD|CRT1_LCDA))) return TRUE;
+ /* We can only blank LCD, not other CRT2 devices */
+ if(pSiS->VBFlags & (CRT2_LCD|CRT1_LCDA)) {
- /* enable access to extended sequencer registers */
#ifdef UNLOCK_ALWAYS
- sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
+ sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
#endif
-
- if(pSiS->VGAEngine == SIS_300_VGA) {
-
- if(pSiS->VBFlags & VB_SISLVDSBRIDGE) {
- checkit = TRUE;
- if(!xf86IsUnblank(mode)) {
- SiS_SiS30xBLOff(pSiS->SiS_Pr,&pSiS->sishw_ext);
- } else {
- SiS_SiS30xBLOn(pSiS->SiS_Pr,&pSiS->sishw_ext);
- }
- } else if(pSiS->VBFlags & (VB_LVDS|VB_30xBDH)) {
- if(!pSiS->BlankCRT2) {
- inSISIDXREG(SISSR, 0x11, pSiS->LCDon);
- }
- checkit = TRUE;
- if(!xf86IsUnblank(mode)) {
- outSISIDXREG(SISSR, 0x11, pSiS->LCDon | 0x08);
- } else {
- outSISIDXREG(SISSR, 0x11, pSiS->LCDon);
- }
- }
-
- } else if(pSiS->VGAEngine == SIS_315_VGA) {
-
- if(!pSiS->BlankCRT2) {
- inSISIDXREG(SISSR, 0x11, pSiS->LCDon);
- if(pSiS->sishw_ext.jChipType >= SIS_661) pSiS->LCDon &= 0x0f;
- }
-
- if(pSiS->VBFlags & VB_CHRONTEL) {
- checkit = TRUE;
- if(!xf86IsUnblank(mode)) {
- SiS_Chrontel701xBLOff(pSiS->SiS_Pr);
- } else {
- SiS_Chrontel701xBLOn(pSiS->SiS_Pr,&pSiS->sishw_ext);
- }
- } else if(pSiS->VBFlags & VB_LVDS) {
- checkit = TRUE;
- if(!xf86IsUnblank(mode)) {
- outSISIDXREG(SISSR, 0x11, pSiS->LCDon | 0x08);
- } else {
- outSISIDXREG(SISSR, 0x11, pSiS->LCDon);
- }
- } else if(pSiS->VBFlags & VB_SISLVDSBRIDGE) {
- checkit = TRUE;
- if(!xf86IsUnblank(mode)) {
- SiS_SiS30xBLOff(pSiS->SiS_Pr,&pSiS->sishw_ext);
- } else {
- SiS_SiS30xBLOn(pSiS->SiS_Pr,&pSiS->sishw_ext);
- }
- }
-
- }
-
- if(checkit) {
- if(!pSiS->SecondHead) pSiS->BlankCRT2 = xf86IsUnblank(mode) ? FALSE : TRUE;
- else if(pSiS->VBFlags & CRT1_LCDA) pSiS->Blank = xf86IsUnblank(mode) ? FALSE : TRUE;
- }
+ SiSHandleBackLight(pSiS, IsUnblank);
}
+
}
return TRUE;
}
@@ -7390,15 +7854,14 @@ static void
SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags)
{
SISPtr pSiS = SISPTR(pScrn);
- Bool docrt1 = TRUE, docrt2 = TRUE;
- UChar sr1=0, cr17=0, cr63=0, sr11=0, pmreg=0, sr7=0;
+ Bool docrt1 = TRUE, docrt2 = TRUE, backlight = TRUE;
+ UChar sr1=0, cr17=0, cr63=0, pmreg=0, sr7=0;
UChar p1_13=0, p2_0=0, oldpmreg=0;
- Bool backlight = TRUE;
if(!pScrn->vtSema) return;
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4,
- "SISDisplayPowerManagementSet(%d)\n",PowerManagementMode);
+ "SISDisplayPowerManagementSet(%d)\n", PowerManagementMode);
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
@@ -7420,120 +7883,61 @@ SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int fla
sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
#endif
- if(docrt2) {
- if(pSiS->VBFlags & CRT2_LCD) {
- if(((pSiS->VGAEngine == SIS_300_VGA) &&
- (pSiS->VBFlags & (VB_301|VB_30xBDH|VB_LVDS))) ||
- ((pSiS->VGAEngine == SIS_315_VGA) &&
- ((pSiS->VBFlags & (VB_LVDS | VB_CHRONTEL)) == VB_LVDS))) {
-#ifdef SISDUALHEAD
- if(pSiS->DualHeadMode) {
- if(!pSiS->BlankCRT2) {
- inSISIDXREG(SISSR, 0x11, pSiS->LCDon);
- if(pSiS->sishw_ext.jChipType >= SIS_661) pSiS->LCDon &= 0x0f;
- }
- } else
-#endif
- if(!pSiS->Blank) {
- inSISIDXREG(SISSR, 0x11, pSiS->LCDon);
- if(pSiS->sishw_ext.jChipType >= SIS_661) pSiS->LCDon &= 0x0f;
- }
- }
- }
- }
-
- switch (PowerManagementMode) {
+ switch(PowerManagementMode) {
case DPMSModeOn: /* HSync: On, VSync: On */
- if(docrt1) pSiS->Blank = FALSE;
-#ifdef SISDUALHEAD
- else pSiS->BlankCRT2 = FALSE;
-#endif
- sr1 = 0x00;
- cr17 = 0x80;
- pmreg = 0x00;
- cr63 = 0x00;
- sr7 = 0x10;
- sr11 = (pSiS->LCDon & 0x0C);
- p2_0 = 0x20;
- p1_13 = 0x00;
- backlight = TRUE;
- break;
+ sr1 = 0x00;
+ cr17 = 0x80;
+ pmreg = 0x00;
+ cr63 = 0x00;
+ sr7 = 0x10;
+ p2_0 = 0x20;
+ p1_13 = 0x00;
+ backlight = TRUE;
+ break;
case DPMSModeSuspend: /* HSync: On, VSync: Off */
- if(docrt1) pSiS->Blank = TRUE;
-#ifdef SISDUALHEAD
- else pSiS->BlankCRT2 = TRUE;
-#endif
- sr1 = 0x20;
- cr17 = 0x80;
- pmreg = 0x80;
- cr63 = 0x40;
- sr7 = 0x00;
- sr11 = 0x08;
- p2_0 = 0x40;
- p1_13 = 0x80;
- backlight = FALSE;
- break;
+ sr1 = 0x20;
+ cr17 = 0x80;
+ pmreg = 0x80;
+ cr63 = 0x40;
+ sr7 = 0x00;
+ p2_0 = 0x40;
+ p1_13 = 0x80;
+ backlight = FALSE;
+ break;
case DPMSModeStandby: /* HSync: Off, VSync: On */
- if(docrt1) pSiS->Blank = TRUE;
-#ifdef SISDUALHEAD
- else pSiS->BlankCRT2 = TRUE;
-#endif
- sr1 = 0x20;
- cr17 = 0x80;
- pmreg = 0x40;
- cr63 = 0x40;
- sr7 = 0x00;
- sr11 = 0x08;
- p2_0 = 0x80;
- p1_13 = 0x40;
- backlight = FALSE;
- break;
+ sr1 = 0x20;
+ cr17 = 0x80;
+ pmreg = 0x40;
+ cr63 = 0x40;
+ sr7 = 0x00;
+ p2_0 = 0x80;
+ p1_13 = 0x40;
+ backlight = FALSE;
+ break;
case DPMSModeOff: /* HSync: Off, VSync: Off */
- if(docrt1) pSiS->Blank = TRUE;
-#ifdef SISDUALHEAD
- else pSiS->BlankCRT2 = TRUE;
-#endif
- sr1 = 0x20;
- cr17 = 0x00;
- pmreg = 0xc0;
- cr63 = 0x40;
- sr7 = 0x00;
- sr11 = 0x08;
- p2_0 = 0xc0;
- p1_13 = 0xc0;
- backlight = FALSE;
- break;
+ sr1 = 0x20;
+ cr17 = 0x00;
+ pmreg = 0xc0;
+ cr63 = 0x40;
+ sr7 = 0x00;
+ p2_0 = 0xc0;
+ p1_13 = 0xc0;
+ backlight = FALSE;
+ break;
default:
return;
}
- if(docrt2) {
- if(pSiS->VGAEngine == SIS_315_VGA) {
- if(pSiS->VBFlags & CRT2_LCD) {
- if(pSiS->VBFlags & VB_CHRONTEL) {
- if(backlight) {
- SiS_Chrontel701xBLOn(pSiS->SiS_Pr,&pSiS->sishw_ext);
- } else {
- SiS_Chrontel701xBLOff(pSiS->SiS_Pr);
- }
- }
- }
- }
- }
+ oldpmreg = pmreg;
- 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);
- } else {
- SiS_SiS30xBLOff(pSiS->SiS_Pr,&pSiS->sishw_ext);
- }
- }
+ if((docrt2 && (pSiS->VBFlags & CRT2_LCD)) ||
+ (docrt1 && (pSiS->VBFlags & CRT1_LCDA))) {
+ SiSHandleBackLight(pSiS, backlight);
}
if(docrt1) {
@@ -7546,7 +7950,8 @@ SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int fla
setSISIDXREG(SISSR, 0x11, 0x3f, pmreg);
break;
case SIS_315_VGA:
- if((!pSiS->CRT1off) && ((!(pSiS->VBFlags & CRT1_LCDA)) || (pSiS->VBFlags & VB_SISTMDSLCDABRIDGE))) {
+ if( (!pSiS->CRT1off) &&
+ ((!(pSiS->VBFlags & CRT1_LCDA)) || (pSiS->VBFlags & VB_SISTMDSLCDABRIDGE)) ) {
setSISIDXREG(SISCR, pSiS->myCR63, 0xbf, cr63);
setSISIDXREG(SISSR, 0x07, 0xef, sr7);
}
@@ -7555,10 +7960,10 @@ SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int fla
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) && (!SiSBridgeIsInSlaveMode(pScrn))) {
- setSISIDXREG(SISSR, 0x1f, 0x3f, pmreg);
+ if((!(pSiS->VBFlags & CRT1_LCDA)) || (pSiS->VBFlags & VB_SISTMDSLCDABRIDGE)) {
+ inSISIDXREG(SISSR, 0x1f, oldpmreg);
+ if((!pSiS->CRT1off) && (!SiSBridgeIsInSlaveMode(pScrn))) {
+ setSISIDXREG(SISSR, 0x1f, 0x3f, pmreg);
}
}
}
@@ -7567,36 +7972,24 @@ SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int fla
if(docrt2) {
if(pSiS->VBFlags & CRT2_LCD) {
- if(((pSiS->VGAEngine == SIS_300_VGA) &&
- (pSiS->VBFlags & (VB_301|VB_30xBDH|VB_LVDS))) ||
- ((pSiS->VGAEngine == SIS_315_VGA) &&
- ((pSiS->VBFlags & (VB_LVDS | VB_CHRONTEL)) == VB_LVDS))) {
- if(pSiS->sishw_ext.jChipType >= SIS_661) {
- setSISIDXREG(SISSR, 0x11, 0x03, sr11);
- } else {
- setSISIDXREG(SISSR, 0x11, 0xf3, sr11);
- }
- }
- if(pSiS->VGAEngine == SIS_300_VGA) {
- if((pSiS->VBFlags & (VB_301B|VB_301C|VB_302B)) &&
- (!(pSiS->VBFlags & VB_30xBDH))) {
+ if((pSiS->VBFlags & VB_SISBRIDGE) &&
+ (!(pSiS->VBFlags & VB_30xBDH))) {
+ if(pSiS->VGAEngine == SIS_300_VGA) {
setSISIDXREG(SISPART1, 0x13, 0x3f, p1_13);
}
- } else if(pSiS->VGAEngine == SIS_315_VGA) {
- if((pSiS->VBFlags & (VB_301B|VB_301C|VB_302B)) &&
- (!(pSiS->VBFlags & VB_30xBDH))) {
- setSISIDXREG(SISPART2, 0x00, 0x1f, p2_0);
- }
- }
- } else if(pSiS->VBFlags & CRT2_VGA) {
- if(pSiS->VBFlags & (VB_301B|VB_301C|VB_302B)) {
+ if(pSiS->VBFlags & VB_SISLVDSBRIDGE) p2_0 |= 0x20;
setSISIDXREG(SISPART2, 0x00, 0x1f, p2_0);
- }
+ }
+ } else if(pSiS->VBFlags & (CRT2_VGA | CRT2_TV)) {
+ if(pSiS->VBFlags & VB_SISBRIDGE) {
+ setSISIDXREG(SISPART2, 0x00, 0x1f, p2_0);
+ }
}
}
- if((docrt1) && (pmreg != oldpmreg) &&
- ((!(pSiS->VBFlags & CRT1_LCDA)) || (pSiS->VBFlags & VB_SISTMDSLCDABRIDGE))) {
+ 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 */
@@ -7616,10 +8009,9 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
SISPtr pSiS = SISPTR(pScrn);
- int ret;
VisualPtr visual;
ULong OnScreenSize;
- int height, width, displayWidth;
+ int ret, height, width, displayWidth;
UChar *FBStart;
#ifdef SISDUALHEAD
SISEntPtr pSiSEnt = NULL;
@@ -7737,7 +8129,7 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pSiS->VBFlags = pSiS->VBFlags_backup = pSiS->VBFlagsInit;
}
- /* Initialise the first mode */
+ /* Initialize the first mode */
if(!SISModeInit(pScrn, pScrn->currentMode)) {
SISErrorLog(pScrn, "SiSModeInit() failed\n");
return FALSE;
@@ -7763,12 +8155,12 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
* support TrueColor and not DirectColor.
*/
if(!miSetVisualTypes(pScrn->depth,
- (pScrn->bitsPerPixel > 8) ?
- TrueColorMask : miGetDefaultVisualMask(pScrn->depth),
+ (pScrn->bitsPerPixel > 8) ?
+ TrueColorMask : miGetDefaultVisualMask(pScrn->depth),
pScrn->rgbBits, pScrn->defaultVisual)) {
SISSaveScreen(pScreen, SCREEN_SAVER_OFF);
SISErrorLog(pScrn, "miSetVisualTypes() failed (bpp %d)\n",
- pScrn->bitsPerPixel);
+ pScrn->bitsPerPixel);
return FALSE;
}
@@ -7816,52 +8208,52 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
#ifdef SISDUALHEAD
/* No DRI in dual head mode */
if(pSiS->DualHeadMode) {
- pSiS->directRenderingEnabled = FALSE;
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ pSiS->directRenderingEnabled = FALSE;
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"DRI not supported in Dual Head mode\n");
} else
#endif
- /* Force the initialization of the context */
- if(pSiS->VGAEngine != SIS_315_VGA) {
- pSiS->directRenderingEnabled = SISDRIScreenInit(pScreen);
+ if(pSiS->VGAEngine != SIS_315_VGA) {
+ /* Force the initialization of the context */
+ pSiS->directRenderingEnabled = SISDRIScreenInit(pScreen);
} else {
- xf86DrvMsg(pScrn->scrnIndex, X_NOT_IMPLEMENTED,
- "DRI not supported on this chipset\n");
- pSiS->directRenderingEnabled = FALSE;
+ xf86DrvMsg(pScrn->scrnIndex, X_NOT_IMPLEMENTED,
+ "DRI not supported on this chipset\n");
+ pSiS->directRenderingEnabled = FALSE;
}
}
#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) {
- case 24:
- if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
- ret = FALSE;
- break;
- }
- case 8:
- case 16:
- case 32:
- ret = fbScreenInit(pScreen, FBStart, width,
- height, pScrn->xDpi, pScrn->yDpi,
- displayWidth, pScrn->bitsPerPixel);
- break;
- default:
- ret = FALSE;
- break;
+ case 24:
+ if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
+ ret = FALSE;
+ break;
+ }
+ /* fall through */
+ case 8:
+ case 16:
+ case 32:
+ ret = fbScreenInit(pScreen, FBStart, width,
+ height, pScrn->xDpi, pScrn->yDpi,
+ displayWidth, pScrn->bitsPerPixel);
+ break;
+ default:
+ ret = FALSE;
+ break;
}
if(!ret) {
SISErrorLog(pScrn, "Unsupported bpp (%d) or fbScreenInit() failed\n",
- pScrn->bitsPerPixel);
+ pScrn->bitsPerPixel);
SISSaveScreen(pScreen, SCREEN_SAVER_OFF);
return FALSE;
}
+ /* Fixup RGB ordering */
if(pScrn->bitsPerPixel > 8) {
- /* Fixup RGB ordering */
visual = pScreen->visuals + pScreen->numVisuals;
while (--visual >= pScreen->visuals) {
if((visual->class | DynamicClass) == DirectColor) {
@@ -7875,10 +8267,10 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
}
}
- /* Initialize RENDER ext; must be after RGB ordering fixed */
+ /* Initialize RENDER extension (must be after RGB ordering fixed) */
fbPictureInit(pScreen, 0, 0);
- /* hardware cursor needs to wrap this layer */
+ /* Hardware cursor needs to wrap this layer */
if(!pSiS->ShadowFB) SISDGAInit(pScreen);
xf86SetBlackWhitePixels(pScreen);
@@ -7906,14 +8298,14 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if(!pSiS->SiSFastVidCopyDone) {
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
- if(pSiS->SecondHead) {
+ if(pSiS->SecondHead) {
pSiSEnt->SiSFastVidCopy = SiSVidCopyInit(pScreen, &pSiSEnt->SiSFastMemCopy);
pSiSEnt->HaveFastVidCpy = TRUE;
+ pSiS->SiSFastVidCopy = pSiSEnt->SiSFastVidCopy;
+ pSiS->SiSFastMemCopy = pSiSEnt->SiSFastMemCopy;
} else {
pSiS->NeedCopyFastVidCpy = TRUE;
}
- pSiS->SiSFastVidCopy = pSiSEnt->SiSFastVidCopy;
- pSiS->SiSFastMemCopy = pSiSEnt->SiSFastMemCopy;
} else {
#endif
pSiS->SiSFastVidCopy = SiSVidCopyInit(pScreen, &pSiS->SiSFastMemCopy);
@@ -7941,14 +8333,14 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pSiS->CRT2ColNum = 1 << pScrn->rgbBits;
- if((pSiS->crt2gcolortable = xalloc(pSiS->CRT2ColNum * 2 * sizeof(LOCO)))) {
+ if((pSiS->crt2gcolortable = xalloc(pSiS->CRT2ColNum * 2 * sizeof(LOCO)))) {
pSiS->crt2colors = &pSiS->crt2gcolortable[pSiS->CRT2ColNum];
- if((pSiS->crt2cindices = xalloc(256 * sizeof(int)))) {
- int i = pSiS->CRT2ColNum;
- SISCalculateGammaRampCRT2(pScrn);
+ if((pSiS->crt2cindices = xalloc(256 * sizeof(int)))) {
+ int i = pSiS->CRT2ColNum;
+ SISCalculateGammaRampCRT2(pScrn);
while(i--) pSiS->crt2cindices[i] = i;
} else {
- xfree(pSiS->crt2gcolortable);
+ xfree(pSiS->crt2gcolortable);
pSiS->crt2gcolortable = NULL;
pSiS->CRT2SepGamma = FALSE;
}
@@ -7956,7 +8348,7 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pSiS->CRT2SepGamma = FALSE;
}
- if(!pSiS->crt2cindices) {
+ if(!pSiS->crt2cindices) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Failed to allocate cmap for CRT2, separate gamma correction disabled\n");
}
@@ -7981,6 +8373,7 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
return FALSE;
}
+ /* Recalculate our gamma ramp for (pre)brightness feature */
#ifdef SISGAMMARAMP
if((pSiS->GammaBriR != 1000) || (pSiS->GammaBriG != 1000) ||
(pSiS->GammaBriB != 1000) || (pSiS->GammaPBriR != 1000) ||
@@ -7989,24 +8382,42 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
}
#endif
+ /* Initialize Shadow framebuffer and screen rotation/reflection */
if(pSiS->ShadowFB) {
RefreshAreaFuncPtr refreshArea = SISRefreshArea;
if(pSiS->Rotate) {
- if(!pSiS->PointerMoved) pSiS->PointerMoved = pScrn->PointerMoved;
- if(pSiS->RotateMouse) pScrn->PointerMoved = SISPointerMoved;
-
- switch(pScrn->bitsPerPixel) {
- case 8: refreshArea = SISRefreshArea8; break;
- case 16: refreshArea = SISRefreshArea16; break;
- case 24: refreshArea = SISRefreshArea24; break;
- case 32: refreshArea = SISRefreshArea32; break;
- }
+ if(!pSiS->PointerMoved) pSiS->PointerMoved = pScrn->PointerMoved;
+ pScrn->PointerMoved = SISPointerMoved;
+ switch(pScrn->bitsPerPixel) {
+ case 8: refreshArea = SISRefreshArea8; break;
+ case 16: refreshArea = SISRefreshArea16; break;
+ case 24: refreshArea = SISRefreshArea24; break;
+ case 32: refreshArea = SISRefreshArea32; break;
+ }
#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,0,0,0)
xf86DisableRandR();
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Driver rotation enabled, RandR disabled\n");
+ "Driver rotation enabled, disabling RandR\n");
#endif
+ } else if(pSiS->Reflect) {
+ switch(pScrn->bitsPerPixel) {
+ case 8:
+ case 16:
+ case 32:
+ if(!pSiS->PointerMoved) pSiS->PointerMoved = pScrn->PointerMoved;
+ pScrn->PointerMoved = SISPointerMovedReflect;
+ refreshArea = SISRefreshAreaReflect;
+#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,0,0,0)
+ xf86DisableRandR();
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Driver reflection enabled, disabling RandR\n");
+#endif
+ break;
+ default:
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Reflection not supported at this framebuffer depth\n");
+ }
}
ShadowFBInit(pScreen, refreshArea);
@@ -8018,64 +8429,68 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pScrn->memPhysBase = pSiS->FbAddress;
pScrn->fbOffset = 0;
- pSiS->ResetXv = pSiS->ResetXvGamma = NULL;
-
+ /* Initialize Xv */
+ pSiS->ResetXv = pSiS->ResetXvGamma = pSiS->ResetXvDisplay = NULL;
#if (XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,99,0,0)) || (defined(XvExtension))
if(!pSiS->NoXvideo) {
- if( (pSiS->VGAEngine == SIS_300_VGA) ||
- (pSiS->VGAEngine == SIS_315_VGA) ) {
+
+ if((pSiS->VGAEngine == SIS_300_VGA) ||
+ (pSiS->VGAEngine == SIS_315_VGA)) {
+
+ const char *using = "Using SiS300/315/330/340 series HW Xv";
+
#ifdef SISDUALHEAD
- if(pSiS->DualHeadMode) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Using SiS300/315/330/340 series HW Xv on CRT%d\n",
- (pSiS->SecondHead ? 1 : 2));
- if(!pSiS->hasTwoOverlays) {
- if( (pSiS->XvOnCRT2 && pSiS->SecondHead) ||
- (!pSiS->XvOnCRT2 && !pSiS->SecondHead) ) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "However, overlay will by default only be visible on CRT%d\n",
- pSiS->XvOnCRT2 ? 2 : 1);
- }
- }
- SISInitVideo(pScreen);
- } else {
-#endif
- if(pSiS->hasTwoOverlays)
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Using SiS300/315/330/340 series HW Xv\n" );
- else
+ if(pSiS->DualHeadMode) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s on CRT%d\n", using, (pSiS->SecondHead ? 1 : 2));
+ if(!pSiS->hasTwoOverlays) {
+ if( (pSiS->XvOnCRT2 && pSiS->SecondHead) ||
+ (!pSiS->XvOnCRT2 && !pSiS->SecondHead) ) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Using SiS300/315/330/340 series HW Xv by default on CRT%d\n",
- (pSiS->XvOnCRT2 ? 2 : 1));
- SISInitVideo(pScreen);
+ "However, video overlay will by default only be visible on CRT%d\n",
+ pSiS->XvOnCRT2 ? 2 : 1);
+ }
+ }
+ } else {
+#endif
+ if(pSiS->hasTwoOverlays) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s\n", using);
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s by default on CRT%d\n",
+ using, (pSiS->XvOnCRT2 ? 2 : 1));
+ }
#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 ) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ SISInitVideo(pScreen);
+
+ if(pSiS->blitadaptor) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "Default Xv adaptor is Video %s\n",
+ pSiS->XvDefAdaptorBlit ? "Blitter" : "Overlay");
+ }
+
+ } else if(pSiS->Chipset == PCI_CHIP_SIS530 ||
+ pSiS->Chipset == PCI_CHIP_SIS6326 ||
+ pSiS->Chipset == PCI_CHIP_SIS5597) {
+
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Using SiS5597/5598/6326/530/620 HW Xv\n" );
- SIS6326InitVideo(pScreen);
- } else { /* generic Xv */
+ SIS6326InitVideo(pScreen);
- XF86VideoAdaptorPtr *ptr;
- int n;
+ } else { /* generic Xv */
- n = xf86XVListGenericAdaptors(pScrn, &ptr);
- if(n) {
- xf86XVScreenInit(pScreen, ptr, n);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using generic Xv\n" );
- }
+ XF86VideoAdaptorPtr *ptr;
+ int n = xf86XVListGenericAdaptors(pScrn, &ptr);
- }
+ if(n) {
+ xf86XVScreenInit(pScreen, ptr, n);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using generic Xv\n" );
+ }
+
+ }
}
#endif
@@ -8087,42 +8502,49 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
*/
pSiS->directRenderingEnabled = SISDRIFinishScreenInit(pScreen);
}
- if(pSiS->directRenderingEnabled) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Direct rendering enabled\n");
- /* TODO */
- /* SISSetLFBConfig(pSiS); */
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Direct rendering disabled\n");
- }
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Direct rendering %s\n",
+ pSiS->directRenderingEnabled ? "enabled" : "disabled");
+ /* TODO */
+ /* if(pSiS->directRenderingEnabled) SISSetLFBConfig(pSiS); */
}
#endif
- /* Wrap some funcs and setup remaining SD flags */
+ /* Wrap some funcs, initialize pseudo-Xinerama and setup remaining SD flags */
pSiS->SiS_SD_Flags &= ~(SiS_SD_PSEUDOXINERAMA);
#ifdef SISMERGED
if(pSiS->MergedFB) {
pSiS->PointerMoved = pScrn->PointerMoved;
- pScrn->PointerMoved = SISMergePointerMoved;
- pSiS->Rotate = FALSE;
+ pScrn->PointerMoved = SISMergedPointerMoved;
+ pSiS->Rotate = 0;
+ pSiS->Reflect = 0;
pSiS->ShadowFB = FALSE;
+#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,0,0,0)
+ if(pSiS->CRT1XOffs || pSiS->CRT1YOffs || pSiS->CRT2XOffs || pSiS->CRT2YOffs) {
+ xf86DisableRandR();
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "MergedFB: CRT2Position offset used, disabling RandR\n");
+ }
+#endif
#ifdef SISXINERAMA
if(pSiS->UseSiSXinerama) {
- SiSnoPanoramiXExtension = FALSE;
- SiSXineramaExtensionInit(pScrn);
+ SiSnoPanoramiXExtension = FALSE;
+ SiSXineramaExtensionInit(pScrn);
if(!SiSnoPanoramiXExtension) {
-#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,0,0,0)
- xf86DisableRandR();
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "SiS Pseudo-Xinerama enabled, RandR disabled\n");
-#endif
pSiS->SiS_SD_Flags |= SiS_SD_PSEUDOXINERAMA;
+ if(pSiS->HaveNonRect) {
+ /* Reset the viewport (now eventually non-recangular) */
+ SISAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
+ }
}
+ } else {
+ pSiS->MouseRestrictions = FALSE;
}
#endif
}
#endif
+ /* Wrap CloseScreen and set up SaveScreen */
pSiS->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = SISCloseScreen;
#ifdef SISDUALHEAD
@@ -8157,11 +8579,11 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
if(pSiS->SecondHead) {
- sisclearvram(pSiS->FbBase, OnScreenSize);
+ sisclearvram(pSiS->FbBase, OnScreenSize);
sisclearvram(pSiSEnt->FbBase1, pSiSEnt->OnScreenSize1);
- SISSaveScreen(pScreen, SCREEN_SAVER_OFF);
+ SISSaveScreen(pScreen, SCREEN_SAVER_OFF);
} else {
- pSiSEnt->FbBase1 = pSiS->FbBase;
+ pSiSEnt->FbBase1 = pSiS->FbBase;
pSiSEnt->OnScreenSize1 = OnScreenSize;
}
} else {
@@ -8187,9 +8609,9 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
pSiS->SiS_SD_Flags &= ~SiS_SD_ISDEPTH8;
if(pSiS->CurrentLayout.bitsPerPixel == 8) {
- pSiS->SiS_SD_Flags |= SiS_SD_ISDEPTH8;
- pSiS->SiS_SD_Flags &= ~SiS_SD_SUPPORTXVGAMMA1;
- pSiS->SiS_SD_Flags &= ~SiS_SD_SUPPORTSGRCRT2;
+ pSiS->SiS_SD_Flags |= SiS_SD_ISDEPTH8;
+ pSiS->SiS_SD_Flags &= ~SiS_SD_SUPPORTXVGAMMA1;
+ pSiS->SiS_SD_Flags &= ~SiS_SD_SUPPORTSGRCRT2;
}
#ifdef SISGAMMARAMP
@@ -8295,9 +8717,9 @@ SISSwitchCRT2Type(ScrnInfoPtr pScrn, ULong newvbflags)
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;
+ 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) {
@@ -8359,9 +8781,9 @@ static ULong SiSCondToVBFlags(UShort cond, ULong GivenVBFlags)
if(cond) {
vbflags &= ~(CRT2_ENABLE | CRT1_LCDA | TV_STANDARD | TV_INTERFACE);
if((cond & SiS_CF2_TYPEMASK) == SiS_CF2_LCD) {
- vbflags |= CRT2_LCD;
+ vbflags |= CRT2_LCD;
} else if((cond & SiS_CF2_TYPEMASK) == SiS_CF2_TV) {
- vbflags |= (CRT2_TV | TV_SVIDEO);
+ vbflags |= (CRT2_TV | TV_SVIDEO);
if(cond & SiS_CF2_TVPAL) vbflags |= TV_PAL;
else if(cond & SiS_CF2_TVPALM) vbflags |= (TV_PAL | TV_PALM);
else if(cond & SiS_CF2_TVPALN) vbflags |= (TV_PAL | TV_PALN);
@@ -8369,19 +8791,19 @@ static ULong SiSCondToVBFlags(UShort cond, ULong GivenVBFlags)
} else if((cond & SiS_CF2_TYPEMASK) == SiS_CF2_TVSPECIAL) {
vbflags |= CRT2_TV;
if((cond & SiS_CF2_TVSPECMASK) == SiS_CF2_TVHIVISION)
- vbflags |= TV_HIVISION;
+ vbflags |= TV_HIVISION;
else if((cond & SiS_CF2_TVSPECMASK) == SiS_CF2_TVYPBPR525I)
- vbflags |= (TV_YPBPR | TV_YPBPR525I);
+ vbflags |= (TV_YPBPR | TV_YPBPR525I);
else if((cond & SiS_CF2_TVSPECMASK) == SiS_CF2_TVYPBPR525P)
- vbflags |= (TV_YPBPR | TV_YPBPR525P);
+ vbflags |= (TV_YPBPR | TV_YPBPR525P);
else if((cond & SiS_CF2_TVSPECMASK) == SiS_CF2_TVYPBPR750P)
- vbflags |= (TV_YPBPR | TV_YPBPR750P);
+ vbflags |= (TV_YPBPR | TV_YPBPR750P);
else if((cond & SiS_CF2_TVSPECMASK) == SiS_CF2_TVYPBPR1080I)
- vbflags |= (TV_YPBPR | TV_YPBPR1080I);
+ vbflags |= (TV_YPBPR | TV_YPBPR1080I);
} else if((cond & SiS_CF2_TYPEMASK) == SiS_CF2_VGA2) {
- vbflags |= CRT2_VGA;
+ vbflags |= CRT2_VGA;
} else if((cond & SiS_CF2_TYPEMASK) == SiS_CF2_CRT1LCDA) {
- vbflags |= CRT1_LCDA;
+ vbflags |= CRT1_LCDA;
}
}
return(vbflags);
@@ -8453,23 +8875,23 @@ SISCheckModeForCRT2Type(ScrnInfoPtr pScrn, DisplayModePtr mode, ULong vbflags, U
}
#endif
- /* For RandR */
- if((mode->HDisplay > pScrn->virtualX) || (mode->VDisplay > pScrn->virtualY)) {
- if(!quiet) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ /* For RandR */
+ if((mode->HDisplay > pScrn->virtualX) || (mode->VDisplay > pScrn->virtualY)) {
+ if(!quiet) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Desired mode too large for current screen size\n");
- }
- result |= 0x02;
- }
+ }
+ result |= 0x02;
+ }
- /* Check if the desired mode is suitable for current CRT1 output device */
- 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");
- }
- result |= 0x01;
- }
+ /* Check if the desired mode is suitable for current CRT1 output device */
+ 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");
+ }
+ result |= 0x01;
+ }
}
@@ -8663,7 +9085,7 @@ SISSwitchCRT1Status(ScrnInfoPtr pScrn, int onoff)
vbflags |= DISPTYPE_CRT1;
crt1off = 0;
if(onoff == 2) {
- vbflags |= CRT1_LCDA;
+ vbflags |= CRT1_LCDA;
vbflags &= ~(CRT2_LCD|CRT2_VGA);
}
/* Remember: Dualhead not supported */
@@ -8687,7 +9109,7 @@ SISSwitchCRT1Status(ScrnInfoPtr pScrn, int onoff)
/* Sync the accelerators */
if(!pSiS->NoAccel) {
if(pSiS->AccelInfoPtr) {
- (*pSiS->AccelInfoPtr->Sync)(pScrn);
+ (*pSiS->AccelInfoPtr->Sync)(pScrn);
}
}
@@ -8750,6 +9172,7 @@ SISAdjustFrameHW_CRT1(ScrnInfoPtr pScrn, int x, int y)
case 32: break;
default: base >>= 2;
}
+ base += (pSiS->dhmOffset/4);
SISSetStartAddressCRT1(pSiS, base);
}
@@ -8765,36 +9188,92 @@ SISAdjustFrameHW_CRT2(ScrnInfoPtr pScrn, int x, int y)
case 32: break;
default: base >>= 2;
}
+ base += (pSiS->dhmOffset/4);
SISSetStartAddressCRT2(pSiS, base);
}
static void
-SISMergePointerMoved(int scrnIndex, int x, int y)
-{
- ScrnInfoPtr pScrn1 = xf86Screens[scrnIndex];
- SISPtr pSiS = SISPTR(pScrn1);
- ScrnInfoPtr pScrn2 = pSiS->CRT2pScrn;
- region out, in1, in2, f2, f1;
- int deltax, deltay;
- int temp1, temp2;
+SISMergedPointerMoved(int scrnIndex, int x, int y)
+{
+ ScrnInfoPtr pScrn1 = xf86Screens[scrnIndex];
+ SISPtr pSiS = SISPTR(pScrn1);
+ ScrnInfoPtr pScrn2 = pSiS->CRT2pScrn;
+ region out, in1, in2, f2, f1;
+ int deltax, deltay;
+ int temp1, temp2;
int old1x0, old1y0, old2x0, old2y0;
- int CRT1XOffs = 0, CRT1YOffs = 0, CRT2XOffs = 0, CRT2YOffs = 0;
- int HVirt = pScrn1->virtualX;
- int VVirt = pScrn1->virtualY;
+ int CRT1XOffs = 0, CRT1YOffs = 0, CRT2XOffs = 0, CRT2YOffs = 0;
+ int HVirt = pScrn1->virtualX;
+ int VVirt = pScrn1->virtualY;
+ int sigstate;
+ Bool doit = FALSE, HaveNonRect = FALSE, HaveOffsRegions = FALSE;
+ SiSScrn2Rel srel = ((SiSMergedDisplayModePtr)pSiS->CurrentLayout.mode->Private)->CRT2Position;
if(pSiS->DGAactive) {
- /* DGA: No panning, since all DGA modes match a screen mode */
return;
+ /* DGA: There is no cursor and no panning while DGA is active. */
+ /* If it were, we would need to do: */
/* HVirt = pSiS->CurrentLayout.displayWidth;
VVirt = pSiS->CurrentLayout.displayHeight;
BOUND(x, pSiS->CurrentLayout.DGAViewportX, HVirt);
- BOUND(y, pSiS->CurrentLayout.DGAViewportY, VVirt);
- */
+ BOUND(y, pSiS->CurrentLayout.DGAViewportY, VVirt); */
} else {
CRT1XOffs = pSiS->CRT1XOffs;
CRT1YOffs = pSiS->CRT1YOffs;
CRT2XOffs = pSiS->CRT2XOffs;
CRT2YOffs = pSiS->CRT2YOffs;
+ HaveNonRect = pSiS->HaveNonRect;
+ HaveOffsRegions = pSiS->HaveOffsRegions;
+ }
+
+ /* Check if the pointer is inside our dead areas */
+ if((pSiS->MouseRestrictions) && (srel != sisClone) && !SiSnoPanoramiXExtension) {
+ if(HaveNonRect) {
+ if(InRegion(x, y, pSiS->NonRectDead)) {
+ switch(srel) {
+ case sisLeftOf:
+ case sisRightOf: y = pSiS->NonRectDead.y0 - 1;
+ doit = TRUE;
+ break;
+ case sisAbove:
+ case sisBelow: x = pSiS->NonRectDead.x0 - 1;
+ doit = TRUE;
+ default: break;
+ }
+ }
+ }
+ if(HaveOffsRegions) {
+ if(InRegion(x, y, pSiS->OffDead1)) {
+ switch(srel) {
+ case sisLeftOf:
+ case sisRightOf: y = pSiS->OffDead1.y1;
+ doit = TRUE;
+ break;
+ case sisAbove:
+ case sisBelow: x = pSiS->OffDead1.x1;
+ doit = TRUE;
+ default: break;
+ }
+ } else if(InRegion(x, y, pSiS->OffDead2)) {
+ switch(srel) {
+ case sisLeftOf:
+ case sisRightOf: y = pSiS->OffDead2.y0 - 1;
+ doit = TRUE;
+ break;
+ case sisAbove:
+ case sisBelow: x = pSiS->OffDead2.x0 - 1;
+ doit = TRUE;
+ default: break;
+ }
+ }
+ }
+ if(doit) {
+ UpdateCurrentTime();
+ sigstate = xf86BlockSIGIO();
+ miPointerAbsoluteCursor(x, y, currentTime.milliseconds);
+ xf86UnblockSIGIO(sigstate);
+ return;
+ }
}
f1.x0 = old1x0 = pSiS->CRT1frameX0;
@@ -8818,7 +9297,7 @@ SISMergePointerMoved(int scrnIndex, int x, int y)
*/
in1 = out;
in2 = out;
- switch(((SiSMergedDisplayModePtr)pSiS->CurrentLayout.mode->Private)->CRT2Position) {
+ switch(srel) {
case sisLeftOf:
in1.x0 = f1.x0;
in2.x1 = f2.x1;
@@ -8845,67 +9324,67 @@ SISMergePointerMoved(int scrnIndex, int x, int y)
if(InRegion(x, y, out)) { /* inside outer region */
if(InRegion(x, y, in1) && !InRegion(x, y, f1)) {
- REBOUND(f1.x0, f1.x1, x);
- REBOUND(f1.y0, f1.y1, y);
- deltax = 1;
+ REBOUND(f1.x0, f1.x1, x);
+ REBOUND(f1.y0, f1.y1, y);
+ deltax = 1;
}
if(InRegion(x, y, in2) && !InRegion(x, y, f2)) {
- REBOUND(f2.x0, f2.x1, x);
- REBOUND(f2.y0, f2.y1, y);
- deltax = 1;
+ REBOUND(f2.x0, f2.x1, x);
+ REBOUND(f2.y0, f2.y1, y);
+ deltax = 1;
}
} else { /* outside outer region */
if(out.x0 > x) {
- deltax = x - out.x0;
+ deltax = x - out.x0;
}
if(out.x1 < x) {
- deltax = x - out.x1;
+ deltax = x - out.x1;
}
if(deltax) {
- pScrn1->frameX0 += deltax;
- pScrn1->frameX1 += deltax;
+ pScrn1->frameX0 += deltax;
+ pScrn1->frameX1 += deltax;
f1.x0 += deltax;
- f1.x1 += deltax;
- f2.x0 += deltax;
- f2.x1 += deltax;
+ f1.x1 += deltax;
+ f2.x0 += deltax;
+ f2.x1 += deltax;
}
if(out.y0 > y) {
- deltay = y - out.y0;
+ deltay = y - out.y0;
}
if(out.y1 < y) {
- deltay = y - out.y1;
+ deltay = y - out.y1;
}
if(deltay) {
- pScrn1->frameY0 += deltay;
- pScrn1->frameY1 += deltay;
+ pScrn1->frameY0 += deltay;
+ pScrn1->frameY1 += deltay;
f1.y0 += deltay;
- f1.y1 += deltay;
- f2.y0 += deltay;
- f2.y1 += deltay;
+ f1.y1 += deltay;
+ f2.y0 += deltay;
+ f2.y1 += deltay;
}
- switch(((SiSMergedDisplayModePtr)pSiS->CurrentLayout.mode->Private)->CRT2Position) {
- case sisLeftOf:
+ switch(srel) {
+ case sisLeftOf:
if(x >= f1.x0) { REBOUND(f1.y0, f1.y1, y); }
if(x <= f2.x1) { REBOUND(f2.y0, f2.y1, y); }
- break;
- case sisRightOf:
+ break;
+ case sisRightOf:
if(x <= f1.x1) { REBOUND(f1.y0, f1.y1, y); }
if(x >= f2.x0) { REBOUND(f2.y0, f2.y1, y); }
- break;
- case sisBelow:
+ break;
+ case sisBelow:
if(y <= f1.y1) { REBOUND(f1.x0, f1.x1, x); }
if(y >= f2.y0) { REBOUND(f2.x0, f2.x1, x); }
- break;
- case sisAbove:
+ break;
+ case sisAbove:
if(y >= f1.y0) { REBOUND(f1.x0, f1.x1, x); }
if(y <= f2.y1) { REBOUND(f2.x0, f2.x1, x); }
- break;
- case sisClone:
- break;
+ break;
+ case sisClone:
+ break;
}
}
@@ -8916,16 +9395,16 @@ SISMergePointerMoved(int scrnIndex, int x, int y)
pScrn2->frameX0 = f2.x0;
pScrn2->frameY0 = f2.y0;
- switch(((SiSMergedDisplayModePtr)pSiS->CurrentLayout.mode->Private)->CRT2Position) {
- case sisLeftOf:
- case sisRightOf:
- if(CRT1YOffs || CRT2YOffs) {
+ switch(srel) {
+ case sisLeftOf:
+ case sisRightOf:
+ if(CRT1YOffs || CRT2YOffs || HaveNonRect) {
if(pSiS->CRT1frameY0 != old1y0) {
if(pSiS->CRT1frameY0 < CRT1YOffs)
pSiS->CRT1frameY0 = CRT1YOffs;
temp1 = pSiS->CRT1frameY0 + CDMPTR->CRT1->VDisplay;
- temp2 = VVirt - CRT2YOffs;
+ temp2 = min((VVirt - CRT2YOffs), (CRT1YOffs + pSiS->MBXNR1YMAX));
if(temp1 > temp2)
pSiS->CRT1frameY0 -= (temp1 - temp2);
}
@@ -8933,22 +9412,22 @@ SISMergePointerMoved(int scrnIndex, int x, int y)
if(pScrn2->frameY0 < CRT2YOffs)
pScrn2->frameY0 = CRT2YOffs;
- temp1 = pScrn2->frameY0 + CDMPTR->CRT2->VDisplay;
- temp2 = VVirt - CRT1YOffs;
+ temp1 = pScrn2->frameY0 + CDMPTR->CRT2->VDisplay;
+ temp2 = min((VVirt - CRT1YOffs), (CRT2YOffs + pSiS->MBXNR2YMAX));
if(temp1 > temp2)
pScrn2->frameY0 -= (temp1 - temp2);
}
}
- break;
- case sisBelow:
- case sisAbove:
- if(CRT1XOffs || CRT2XOffs) {
+ break;
+ case sisBelow:
+ case sisAbove:
+ if(CRT1XOffs || CRT2XOffs || HaveNonRect) {
if(pSiS->CRT1frameX0 != old1x0) {
if(pSiS->CRT1frameX0 < CRT1XOffs)
pSiS->CRT1frameX0 = CRT1XOffs;
temp1 = pSiS->CRT1frameX0 + CDMPTR->CRT1->HDisplay;
- temp2 = HVirt - CRT2XOffs;
+ temp2 = min((HVirt - CRT2XOffs), (CRT1XOffs + pSiS->MBXNR1XMAX));
if(temp1 > temp2)
pSiS->CRT1frameX0 -= (temp1 - temp2);
}
@@ -8956,15 +9435,15 @@ SISMergePointerMoved(int scrnIndex, int x, int y)
if(pScrn2->frameX0 < CRT2XOffs)
pScrn2->frameX0 = CRT2XOffs;
- temp1 = pScrn2->frameX0 + CDMPTR->CRT2->HDisplay;
- temp2 = HVirt - CRT1XOffs;
+ temp1 = pScrn2->frameX0 + CDMPTR->CRT2->HDisplay;
+ temp2 = min((HVirt - CRT1XOffs), (CRT2XOffs + pSiS->MBXNR2XMAX));
if(temp1 > temp2)
pScrn2->frameX0 -= (temp1 - temp2);
}
}
- break;
- case sisClone:
- break;
+ break;
+ case sisClone:
+ break;
}
pSiS->CRT1frameX1 = pSiS->CRT1frameX0 + CDMPTR->CRT1->HDisplay - 1;
@@ -8994,6 +9473,7 @@ SISAdjustFrameMerged(int scrnIndex, int x, int y, int flags)
int x1 = x, x2 = x;
int y1 = y, y2 = y;
int CRT1XOffs = 0, CRT1YOffs = 0, CRT2XOffs = 0, CRT2YOffs = 0;
+ int MBXNR1XMAX = 65536, MBXNR1YMAX = 65536, MBXNR2XMAX = 65536, MBXNR2YMAX = 65536;
if(pSiS->DGAactive) {
HVirt = pSiS->CurrentLayout.displayWidth;
@@ -9003,40 +9483,44 @@ SISAdjustFrameMerged(int scrnIndex, int x, int y, int flags)
CRT1YOffs = pSiS->CRT1YOffs;
CRT2XOffs = pSiS->CRT2XOffs;
CRT2YOffs = pSiS->CRT2YOffs;
+ MBXNR1XMAX = pSiS->MBXNR1XMAX;
+ MBXNR1YMAX = pSiS->MBXNR1YMAX;
+ MBXNR2XMAX = pSiS->MBXNR2XMAX;
+ MBXNR2YMAX = pSiS->MBXNR2YMAX;
}
BOUND(x, 0, HVirt - HTotal);
BOUND(y, 0, VVirt - VTotal);
if(SDMPTR(pScrn1)->CRT2Position != sisClone) {
- BOUND(x1, CRT1XOffs, HVirt - HTotal - CRT2XOffs);
- BOUND(y1, CRT1YOffs, VVirt - VTotal - CRT2YOffs);
- BOUND(x2, CRT2XOffs, HVirt - HTotal - CRT1XOffs);
- BOUND(y2, CRT2YOffs, VVirt - VTotal - CRT1YOffs);
+ BOUND(x1, CRT1XOffs, min(HVirt, MBXNR1XMAX + CRT1XOffs) - min(HTotal, MBXNR1XMAX) - CRT2XOffs);
+ BOUND(y1, CRT1YOffs, min(VVirt, MBXNR1YMAX + CRT1YOffs) - min(VTotal, MBXNR1YMAX) - CRT2YOffs);
+ BOUND(x2, CRT2XOffs, min(HVirt, MBXNR2XMAX + CRT2XOffs) - min(HTotal, MBXNR2XMAX) - CRT1XOffs);
+ BOUND(y2, CRT2YOffs, min(VVirt, MBXNR2YMAX + CRT2YOffs) - min(VTotal, MBXNR2YMAX) - CRT1YOffs);
}
switch(SDMPTR(pScrn1)->CRT2Position) {
case sisLeftOf:
pScrn2->frameX0 = x2;
- BOUND(pScrn2->frameY0, y2, y2 + VMax - CDMPTR->CRT2->VDisplay);
+ BOUND(pScrn2->frameY0, y2, y2 + min(VMax, MBXNR2YMAX) - CDMPTR->CRT2->VDisplay);
pSiS->CRT1frameX0 = x1 + CDMPTR->CRT2->HDisplay;
- BOUND(pSiS->CRT1frameY0, y1, y1 + VMax - CDMPTR->CRT1->VDisplay);
+ BOUND(pSiS->CRT1frameY0, y1, y1 + min(VMax, MBXNR1YMAX) - CDMPTR->CRT1->VDisplay);
break;
case sisRightOf:
pSiS->CRT1frameX0 = x1;
- BOUND(pSiS->CRT1frameY0, y1, y1 + VMax - CDMPTR->CRT1->VDisplay);
+ BOUND(pSiS->CRT1frameY0, y1, y1 + min(VMax, MBXNR1YMAX) - CDMPTR->CRT1->VDisplay);
pScrn2->frameX0 = x2 + CDMPTR->CRT1->HDisplay;
- BOUND(pScrn2->frameY0, y2, y2 + VMax - CDMPTR->CRT2->VDisplay);
+ BOUND(pScrn2->frameY0, y2, y2 + min(VMax, MBXNR2YMAX) - CDMPTR->CRT2->VDisplay);
break;
case sisAbove:
- BOUND(pScrn2->frameX0, x2, x2 + HMax - CDMPTR->CRT2->HDisplay);
+ BOUND(pScrn2->frameX0, x2, x2 + min(HMax, MBXNR2XMAX) - CDMPTR->CRT2->HDisplay);
pScrn2->frameY0 = y2;
- BOUND(pSiS->CRT1frameX0, x1, x1 + HMax - CDMPTR->CRT1->HDisplay);
+ BOUND(pSiS->CRT1frameX0, x1, x1 + min(HMax, MBXNR1XMAX) - CDMPTR->CRT1->HDisplay);
pSiS->CRT1frameY0 = y1 + CDMPTR->CRT2->VDisplay;
break;
case sisBelow:
- BOUND(pSiS->CRT1frameX0, x1, x1 + HMax - CDMPTR->CRT1->HDisplay);
+ BOUND(pSiS->CRT1frameX0, x1, x1 + min(HMax, MBXNR1XMAX) - CDMPTR->CRT1->HDisplay);
pSiS->CRT1frameY0 = y1;
- BOUND(pScrn2->frameX0, x2, x2 + HMax - CDMPTR->CRT2->HDisplay);
+ BOUND(pScrn2->frameX0, x2, x2 + min(HMax, MBXNR2XMAX) - CDMPTR->CRT2->HDisplay);
pScrn2->frameY0 = y2 + CDMPTR->CRT1->VDisplay;
break;
case sisClone:
@@ -9088,7 +9572,7 @@ SISAdjustFrame(int scrnIndex, int x, int y, int flags)
#ifdef SISMERGED
if(pSiS->MergedFB) {
- SISAdjustFrameMerged(scrnIndex, x, y, flags);
+ SISAdjustFrameMerged(scrnIndex, x, y, flags);
return;
}
#endif
@@ -9124,32 +9608,33 @@ SISAdjustFrame(int scrnIndex, int x, int y, int flags)
sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
#endif
+ base += (pSiS->dhmOffset/4);
+
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
if(!pSiS->SecondHead) {
/* Head 1 (master) is always CRT2 */
- SISSetStartAddressCRT2(pSiS, base);
+ SISSetStartAddressCRT2(pSiS, base);
} else {
- /* Head 2 (slave) is always CRT1 */
- base += (pSiS->dhmOffset/4);
+ /* Head 2 (slave) is always CRT1 */
SISSetStartAddressCRT1(pSiS, base);
}
} else {
#endif
switch(pSiS->VGAEngine) {
- case SIS_300_VGA:
+ case SIS_300_VGA:
case SIS_315_VGA:
SISSetStartAddressCRT1(pSiS, base);
- if(pSiS->VBFlags & CRT2_ENABLE) {
- if(!SiSBridgeIsInSlaveMode(pScrn)) {
+ if(pSiS->VBFlags & CRT2_ENABLE) {
+ if(!SiSBridgeIsInSlaveMode(pScrn)) {
SISSetStartAddressCRT2(pSiS, base);
}
}
- break;
- default:
+ break;
+ default:
/* Unlock CRTC registers */
- inSISIDXREG(SISCR, 0x11, cr11backup);
- andSISIDXREG(SISCR, 0x11, 0x7F);
+ inSISIDXREG(SISCR, 0x11, cr11backup);
+ andSISIDXREG(SISCR, 0x11, 0x7F);
outSISIDXREG(SISCR, 0x0D, base & 0xFF);
outSISIDXREG(SISCR, 0x0C, (base >> 8) & 0xFF);
inSISIDXREG(SISSR, 0x27, temp);
@@ -9404,7 +9889,7 @@ SISCloseScreen(int scrnIndex, ScreenPtr pScreen)
if(pSiS->adaptor) {
xfree(pSiS->adaptor);
pSiS->adaptor = NULL;
- pSiS->ResetXv = pSiS->ResetXvGamma = NULL;
+ pSiS->ResetXv = pSiS->ResetXvGamma = pSiS->ResetXvDisplay = NULL;
}
if(pSiS->blitadaptor) {
@@ -9565,14 +10050,14 @@ SiSEnableTurboQueue(ScrnInfoPtr pScrn)
switch(pSiS->VGAEngine) {
case SIS_300_VGA:
if((!pSiS->NoAccel) && (pSiS->TurboQueue)) {
- /* TQ size is always 512k */
- temp = (pScrn->videoRam/64) - 8;
- SR26 = temp & 0xFF;
- inSISIDXREG(SISSR, 0x27, SR27);
+ /* TQ size is always 512k */
+ temp = (pScrn->videoRam/64) - 8;
+ SR26 = temp & 0xFF;
+ inSISIDXREG(SISSR, 0x27, SR27);
SR27 &= 0xFC;
SR27 |= (0xF0 | ((temp >> 8) & 3));
- outSISIDXREG(SISSR, 0x26, SR26);
- outSISIDXREG(SISSR, 0x27, SR27);
+ outSISIDXREG(SISSR, 0x26, SR26);
+ outSISIDXREG(SISSR, 0x27, SR27);
}
break;
@@ -9614,42 +10099,47 @@ SiSEnableTurboQueue(ScrnInfoPtr pScrn)
outSISIDXREG(SISSR, 0x27, 0x1F);
/* Disable queue flipping */
inSISIDXREG(SISCR, 0x55, tempCR55) ;
- andSISIDXREG(SISCR, 0x55, 0x33) ;
+ andSISIDXREG(SISCR, 0x55, 0x33) ;
/* Syncronous reset for Command Queue */
outSISIDXREG(SISSR, 0x26, 0x01);
SIS_MMIO_OUT32(pSiS->IOBase, 0x85c4, 0);
/* Enable VRAM Command Queue mode */
switch(pSiS->cmdQueueSize) {
- case 1*1024*1024: SR26 = (0x40 | 0x04 | 0x01); break;
- case 2*1024*1024: SR26 = (0x40 | 0x08 | 0x01); break;
- case 4*1024*1024: SR26 = (0x40 | 0x0C | 0x01); break;
+ case 1*1024*1024: SR26 = (0x40 | 0x04 | 0x01); break;
+ case 2*1024*1024: SR26 = (0x40 | 0x08 | 0x01); break;
+ case 4*1024*1024: SR26 = (0x40 | 0x0C | 0x01); break;
default:
pSiS->cmdQueueSize = 512 * 1024;
case 512*1024: SR26 = (0x40 | 0x00 | 0x01);
}
- outSISIDXREG(SISSR, 0x26, SR26);
+ outSISIDXREG(SISSR, 0x26, SR26);
SR26 &= 0xfe;
outSISIDXREG(SISSR, 0x26, SR26);
pSiS->cmdQ_SharedWritePort_2D = (ULong)(SIS_MMIO_IN32(pSiS->IOBase, 0x85c8));
- *(pSiS->cmdQ_SharedWritePort) = pSiS->cmdQ_SharedWritePort_2D;
- SIS_MMIO_OUT32(pSiS->IOBase, 0x85c4, pSiS->cmdQ_SharedWritePort_2D);
+ *(pSiS->cmdQ_SharedWritePort) = pSiS->cmdQ_SharedWritePort_2D;
+ SIS_MMIO_OUT32(pSiS->IOBase, 0x85c4, pSiS->cmdQ_SharedWritePort_2D);
SIS_MMIO_OUT32(pSiS->IOBase, 0x85C0, pSiS->cmdQueueOffset);
- temp = (ULong)pSiS->FbBase;
+ temp = (ULong)pSiS->RealFbBase;
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
SISEntPtr pSiSEnt = pSiS->entityPrivate;
- temp = (ULong)pSiSEnt->FbBase;
+ temp = (ULong)pSiSEnt->RealFbBase;
}
#endif
- temp += pSiS->cmdQueueOffset;
- pSiS->cmdQueueBase = (ULong *)temp;
- outSISIDXREG(SISCR, 0x55, tempCR55);
+ temp += pSiS->cmdQueueOffset;
+ pSiS->cmdQueueBase = (ULong *)temp;
+ outSISIDXREG(SISCR, 0x55, tempCR55);
+#ifdef TWDEBUG
+ xf86DrvMsg(0, 0, "CmdQueueOffs 0x%x, CmdQueueAdd %p, shwrp 0x%x, status %x, base %p\n",
+ pSiS->cmdQueueOffset, pSiS->cmdQueueBase, pSiS->cmdQ_SharedWritePort_2D,
+ SIS_MMIO_IN32(pSiS->IOBase, 0x85cc), (ULong *)temp);
+#endif
#else
/* For MMIO */
+ /* Syncronous reset for Command Queue */
+ orSISIDXREG(SISSR, 0x26, 0x01);
/* Set Command Queue Threshold to max value 11111b */
outSISIDXREG(SISSR, 0x27, 0x1F);
- /* Syncronous reset for Command Queue */
- outSISIDXREG(SISSR, 0x26, 0x01);
/* Do some magic (cp readport to writeport) */
temp = SIS_MMIO_IN32(pSiS->IOBase, 0x85C8);
SIS_MMIO_OUT32(pSiS->IOBase, 0x85C4, temp);
@@ -9657,7 +10147,7 @@ SiSEnableTurboQueue(ScrnInfoPtr pScrn)
* Enable_command_queue_auto_correction (0x02)
* (no idea, but sounds good, so use it)
* 512k (0x00) (does this apply to MMIO mode?) */
- outSISIDXREG(SISSR, 0x26, 0x22);
+ outSISIDXREG(SISSR, 0x26, 0x22);
/* Calc Command Queue position (Q is always 512k)*/
temp = (pScrn->videoRam - 512) * 1024;
/* Set Q position */
@@ -9714,10 +10204,10 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
if(pSiS->MergedFB) {
switch(viewmode) {
case SIS_MODE_CRT1:
- mymode = ((SiSMergedDisplayModePtr)mode->Private)->CRT1;
+ mymode = ((SiSMergedDisplayModePtr)mode->Private)->CRT1;
break;
case SIS_MODE_CRT2:
- mymode = ((SiSMergedDisplayModePtr)mode->Private)->CRT2;
+ mymode = ((SiSMergedDisplayModePtr)mode->Private)->CRT2;
hcm = pSiS->HaveCustomModes2;
}
}
@@ -9837,8 +10327,8 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
CR35 |= 0x01;
} else if(vbflag & TV_YPBPR) { /* SiS bridge */
if(pSiS->NewCRLayout) {
- CR38 |= 0x04;
- if(vbflag & TV_YPBPR525P) CR35 |= 0x20;
+ CR38 |= 0x04;
+ if(vbflag & TV_YPBPR525P) CR35 |= 0x20;
else if(vbflag & TV_YPBPR750P) CR35 |= 0x40;
else if(vbflag & TV_YPBPR1080I) CR35 |= 0x60;
CR31 &= ~0x01;
@@ -9849,9 +10339,9 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
else if((vbflag & TV_YPBPRAR) == TV_YPBPR169) CR39 |= 0x02;
else CR39 |= 0x03;
} else if(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTYPBPR) {
- CR30 |= 0x80;
+ CR30 |= 0x80;
CR38 |= 0x08;
- if(vbflag & TV_YPBPR525P) CR38 |= 0x10;
+ if(vbflag & TV_YPBPR525P) CR38 |= 0x10;
else if(vbflag & TV_YPBPR750P) CR38 |= 0x20;
else if(vbflag & TV_YPBPR1080I) CR38 |= 0x30;
CR31 &= ~0x01;
@@ -9880,7 +10370,7 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
} else if(vbflag & TV_PALN) {
CR38 |= 0x80;
CR35 |= 0x08;
- }
+ }
}
} else {
CR31 &= ~0x01;
@@ -9888,10 +10378,10 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
if(vbflag & TV_NTSCJ) {
CR38 |= 0x40; /* TW, not BIOS */
CR35 |= 0x02;
- }
+ }
}
if(vbflag & TV_SCART) {
- CR31 |= 0x01;
+ CR31 |= 0x01;
CR35 |= 0x01;
}
}
@@ -9906,21 +10396,21 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
#ifdef SIS_CP
SIS_CP_DRIVER_CONFIG
#endif
- break;
+ break;
case CRT2_LCD:
- CR30 |= 0x20;
+ CR30 |= 0x20;
SiS_SetEnableDstn(pSiS->SiS_Pr, pSiS->DSTN);
SiS_SetEnableFstn(pSiS->SiS_Pr, pSiS->FSTN);
- break;
+ break;
case CRT2_VGA:
- CR30 |= 0x40;
- break;
+ CR30 |= 0x40;
+ break;
default:
- CR30 |= 0x00;
- CR31 |= 0x20; /* VB_OUTPUT_DISABLE */
+ CR30 |= 0x00;
+ CR31 |= 0x20; /* VB_OUTPUT_DISABLE */
if(pSiS->UseVESA) {
crt1rateindex = SISSearchCRT1Rate(pScrn, mymode);
}
@@ -9931,22 +10421,22 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
if(vbflag & CRT1_LCDA) {
switch(viewmode) {
case SIS_MODE_CRT1:
- CR38 |= 0x01;
- break;
+ CR38 |= 0x01;
+ break;
case SIS_MODE_CRT2:
- if(vbflag & (CRT2_TV|CRT2_VGA)) {
- CR30 |= 0x02;
+ if(vbflag & (CRT2_TV|CRT2_VGA)) {
+ CR30 |= 0x02;
CR38 |= 0x01;
} else {
CR38 |= 0x03;
}
- break;
+ break;
case SIS_MODE_SIMU:
default:
- if(vbflag & (CRT2_TV|CRT2_LCD|CRT2_VGA)) {
- CR30 |= 0x01;
+ if(vbflag & (CRT2_TV|CRT2_LCD|CRT2_VGA)) {
+ CR30 |= 0x01;
}
- break;
+ break;
}
} else {
if(vbflag & (CRT2_TV|CRT2_LCD|CRT2_VGA)) {
@@ -9954,29 +10444,29 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
}
}
- if(pSiS->UseVESA) {
- CR31 &= ~0x40; /* Clear Drivermode */
- CR31 |= 0x06; /* Set SlaveMode, Enable SimuMode in Slavemode */
+ if(pSiS->UseVESA) {
+ CR31 &= ~0x40; /* Clear Drivermode */
+ CR31 |= 0x06; /* Set SlaveMode, Enable SimuMode in Slavemode */
#ifdef TWDEBUG
- CR31 |= 0x40; /* DEBUG (for non-slave mode VESA) */
- crt1rateindex = SISSearchCRT1Rate(pScrn, mymode);
+ CR31 |= 0x40; /* DEBUG (for non-slave mode VESA) */
+ crt1rateindex = SISSearchCRT1Rate(pScrn, mymode);
#endif
- } else {
- CR31 |= 0x40; /* Set Drivermode */
- CR31 &= ~0x06; /* Disable SlaveMode, disable SimuMode in SlaveMode */
- if(!pSiS->IsCustom) {
- crt1rateindex = SISSearchCRT1Rate(pScrn, mymode);
- }
- }
+ } else {
+ CR31 |= 0x40; /* Set Drivermode */
+ CR31 &= ~0x06; /* Disable SlaveMode, disable SimuMode in SlaveMode */
+ if(!pSiS->IsCustom) {
+ crt1rateindex = SISSearchCRT1Rate(pScrn, mymode);
+ }
+ }
- switch(viewmode) {
+ switch(viewmode) {
case SIS_MODE_SIMU:
- CR33 = 0;
+ CR33 = 0;
if(!(vbflag & CRT1_LCDA)) {
CR33 |= (crt1rateindex & 0x0f);
}
- if(vbflag & CRT2_VGA) {
- CR33 |= ((crt1rateindex & 0x0f) << 4);
+ if(vbflag & CRT2_VGA) {
+ CR33 |= ((crt1rateindex & 0x0f) << 4);
}
break;
case SIS_MODE_CRT1:
@@ -9988,7 +10478,7 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
case SIS_MODE_CRT2:
CR33 &= 0x0f;
if(vbflag & CRT2_VGA) {
- CR33 |= ((crt1rateindex & 0x0f) << 4);
+ CR33 |= ((crt1rateindex & 0x0f) << 4);
}
break;
}
@@ -9999,7 +10489,7 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
if(pSiS->NewCRLayout) {
- CR31 &= 0xfe; /* Clear PAL flag (now in CR35) */
+ CR31 &= 0xfe; /* Clear PAL flag (now in CR35) */
CR38 &= 0x07; /* Use only LCDA and HiVision/YPbPr bits */
outSISIDXREG(SISCR, 0x30, CR30);
outSISIDXREG(SISCR, 0x31, CR31);
@@ -10014,12 +10504,12 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
} else {
- outSISIDXREG(SISCR, 0x30, CR30);
- outSISIDXREG(SISCR, 0x31, CR31);
- outSISIDXREG(SISCR, 0x33, CR33);
- if(temp) {
- outSISIDXREG(SISCR, temp, CR38);
- }
+ outSISIDXREG(SISCR, 0x30, CR30);
+ outSISIDXREG(SISCR, 0x31, CR31);
+ outSISIDXREG(SISCR, 0x33, CR33);
+ if(temp) {
+ outSISIDXREG(SISCR, temp, CR38);
+ }
if(pSiS->VGAEngine == SIS_315_VGA) {
outSISIDXREG(SISCR, 0x3b, CR3B);
outSISIDXREG(SISCR, 0x79, CR79);
@@ -10036,17 +10526,17 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode)
#ifdef SISVRAMQ
if(pSiS->VGAEngine != SIS_315_VGA)
#endif
- SiSEnableTurboQueue(pScrn);
+ SiSEnableTurboQueue(pScrn);
if((!pSiS->UseVESA) && (pSiS->VBFlags & CRT2_ENABLE)) {
- /* Switch on CRT1 for modes that require the bridge in SlaveMode */
+ /* Switch on CRT1 for modes that require the bridge in SlaveMode */
andSISIDXREG(SISSR,0x1f,0x3f);
inSISIDXREG(SISCR, 0x17, CR17);
if(!(CR17 & 0x80)) {
- orSISIDXREG(SISCR, 0x17, 0x80);
+ orSISIDXREG(SISCR, 0x17, 0x80);
outSISIDXREG(SISSR, 0x00, 0x01);
usleep(10000);
- outSISIDXREG(SISSR, 0x00, 0x03);
+ outSISIDXREG(SISSR, 0x00, 0x03);
}
}
}
@@ -11537,6 +12027,12 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val)
inSISIDXREG(SISCR,0x34,p3d4_34);
switch((p3d4_34 & 0x7f)) {
+ case 0x70: /* 800x480 */
+ case 0x7a:
+ case 0x76:
+ /* can scale PAL only */
+ if(usentsc) break;
+ /* fall through */
#if 0
case 0x50: /* 320x240 - hdclk mode */
case 0x56:
@@ -11582,14 +12078,14 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val)
Bool found = FALSE;
if(pSiS->tvyscale != 0) {
for(j=0; j<=1; j++) {
- for(i=0; i<=6; i++) {
- if(SiSTVVScale[srindex+i].sindex == pSiS->tvyscale) {
+ for(i=0; i<=6; i++) {
+ if(SiSTVVScale[srindex+i].sindex == pSiS->tvyscale) {
found = TRUE;
break;
}
- }
+ }
if(found) break;
- if(pSiS->tvyscale > 0) pSiS->tvyscale--;
+ if(pSiS->tvyscale > 0) pSiS->tvyscale--;
else pSiS->tvyscale++;
}
}
@@ -11606,25 +12102,25 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val)
UChar *p2scaling;
for(i=0; i<9; i++) {
- p1scaling[i] = pSiS->scalingp1[i];
+ p1scaling[i] = pSiS->scalingp1[i];
}
for(i=0; i<9; i++) {
- p4scaling[i] = pSiS->scalingp4[i];
+ p4scaling[i] = pSiS->scalingp4[i];
}
p2scaling = &pSiS->scalingp2[0];
#ifdef SISDUALHEAD
- if(pSiSEnt && pSiS->DualHeadMode) {
- p2_0a = pSiSEnt->p2_0a;
+ if(pSiSEnt && pSiS->DualHeadMode) {
+ p2_0a = pSiSEnt->p2_0a;
p2_2f = pSiSEnt->p2_2f;
- p2_30 = pSiSEnt->p2_30;
+ p2_30 = pSiSEnt->p2_30;
p2_46 = pSiSEnt->p2_46;
p2_47 = pSiSEnt->p2_47;
- for(i=0; i<9; i++) {
- p1scaling[i] = pSiSEnt->scalingp1[i];
- }
- for(i=0; i<9; i++) {
- p4scaling[i] = pSiSEnt->scalingp4[i];
- }
+ for(i=0; i<9; i++) {
+ p1scaling[i] = pSiSEnt->scalingp1[i];
+ }
+ for(i=0; i<9; i++) {
+ p4scaling[i] = pSiSEnt->scalingp4[i];
+ }
p2scaling = &pSiSEnt->scalingp2[0];
}
#endif
@@ -11661,9 +12157,9 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val)
realvde = SiSTVVScale[srindex].RealVDE;
do {
- inSISIDXREG(SISPART2,0x01,temp);
- temp = vlimit - (temp & 0x7f);
- if((temp - (((newvde >> 1) - 2) + 9)) > 0) break;
+ inSISIDXREG(SISPART2,0x01,temp);
+ temp = vlimit - (temp & 0x7f);
+ if((temp - (((newvde >> 1) - 2) + 9)) > 0) break;
myypos = pSiS->tvypos - 1;
#ifdef SISDUALHEAD
if(pSiSEnt && pSiS->DualHeadMode) myypos = pSiSEnt->tvypos - 1;
@@ -11677,15 +12173,15 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val)
#ifdef TWDEBUG
xf86DrvMsg(0, X_INFO, "301C scaler: Table index %d\n", srindex301c);
#endif
- for(j=0; j<64; j++) {
+ for(j=0; j<64; j++) {
outSISIDXREG(SISPART2,(0xc0 + j), SiS301CScaling[srindex301c + j]);
}
}
if(!(pSiS->VBFlags & VB_301)) {
- temp = (newvde >> 1) - 3;
- setSISIDXREG(SISPART2,0x46,0x9f,((temp & 0x0300) >> 3));
- outSISIDXREG(SISPART2,0x47,(temp & 0xff));
+ temp = (newvde >> 1) - 3;
+ setSISIDXREG(SISPART2,0x46,0x9f,((temp & 0x0300) >> 3));
+ outSISIDXREG(SISPART2,0x47,(temp & 0xff));
}
outSISIDXREG(SISPART1,0x08,(SiSTVVScale[srindex].reg[so+0] & 0xff));
setSISIDXREG(SISPART1,0x09,0x0f,((SiSTVVScale[srindex].reg[so+0] >> 4) & 0xf0));
@@ -11715,7 +12211,7 @@ void SiS_SetTVyscale(ScrnInfoPtr pScrn, int val)
outSISIDXREG(SISPART4,0x18,(SiSTVVScale[srindex].reg[so+11] & 0xff));
setSISIDXREG(SISPART4,0x19,0xf0,((SiSTVVScale[srindex].reg[so+11] >> 8) & 0x0f));
- temp = 0x40;
+ temp = 0x40;
if(realvde <= newvde) temp = 0;
else realvde -= newvde;
@@ -11779,7 +12275,7 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg)
SISEntPtr pSiSEnt = pSiS->entityPrivate;
#endif
UChar usScratchCR17, sr2b, sr2c, tmpreg;
- int myclock1, myclock2, temp;
+ int myclock1, myclock2, mycoldepth1, mycoldepth2, temp;
Bool flag = FALSE;
Bool doit = TRUE;
Bool IsInSlaveMode;
@@ -11832,121 +12328,324 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg)
if((pSiS->CRT1off) && (doit)) {
orSISIDXREG(SISCR,pSiS->myCR63,0x40);
orSISIDXREG(SISSR,0x1f,0xc0);
+ andSISIDXREG(SISSR,0x07,~0x10);
+ andSISIDXREG(SISSR,0x06,0xe2);
+ andSISIDXREG(SISSR,0x31,0xcf);
+ outSISIDXREG(SISSR,0x2b,0x1b);
+ outSISIDXREG(SISSR,0x2c,0xe1);
+ outSISIDXREG(SISSR,0x2d,0x01);
+ outSISIDXREG(SISSR, 0x00, 0x01); /* Synchronous Reset */
+ usleep(10000);
+ outSISIDXREG(SISSR, 0x00, 0x03); /* End Reset */
} else {
andSISIDXREG(SISCR,pSiS->myCR63,0xBF);
andSISIDXREG(SISSR,0x1f,0x3f);
+ orSISIDXREG(SISSR,0x07,0x10);
}
} else {
if(doit) {
- inSISIDXREG(SISCR, 0x17, usScratchCR17);
- if(pSiS->CRT1off) {
- if(usScratchCR17 & 0x80) {
+ inSISIDXREG(SISCR, 0x17, usScratchCR17);
+ if(pSiS->CRT1off) {
+ if(usScratchCR17 & 0x80) {
flag = TRUE;
usScratchCR17 &= ~0x80;
}
orSISIDXREG(SISSR,0x1f,0xc0);
- } else {
- if(!(usScratchCR17 & 0x80)) {
+ } else {
+ if(!(usScratchCR17 & 0x80)) {
flag = TRUE;
- usScratchCR17 |= 0x80;
+ usScratchCR17 |= 0x80;
}
andSISIDXREG(SISSR,0x1f,0x3f);
- }
+ }
/* Reset only if status changed */
if(flag) {
- outSISIDXREG(SISCR, 0x17, usScratchCR17);
- outSISIDXREG(SISSR, 0x00, 0x01); /* Synchronous Reset */
- usleep(10000);
- outSISIDXREG(SISSR, 0x00, 0x03); /* End Reset */
+ outSISIDXREG(SISCR, 0x17, usScratchCR17);
+ outSISIDXREG(SISSR, 0x00, 0x01); /* Synchronous Reset */
+ usleep(10000);
+ outSISIDXREG(SISSR, 0x00, 0x03); /* End Reset */
}
}
}
}
+ /* Set bridge to "disable CRT2" mode if CRT2 is disabled, LCD-A is enabled */
+ /* (Not needed for CRT1=VGA since CRT2 will really be disabled then) */
+#ifdef SISDUALHEAD
+ if(!pSiS->DualHeadMode) {
+#endif
+ if((pSiS->VGAEngine == SIS_315_VGA) && (pSiS->VBFlags & VB_SISLCDABRIDGE)) {
+ if((!pSiS->UseVESA) && (!(pSiS->VBFlags & CRT2_ENABLE)) && (pSiS->VBFlags & CRT1_LCDA)) {
+ if(!IsInSlaveMode) {
+ andSISIDXREG(SISPART4,0x0d,~0x07);
+ }
+ }
+ }
+#ifdef SISDUALHEAD
+ }
+#endif
+
/* Determine if the video overlay can be used */
if(!pSiS->NoXvideo) {
+
int clklimit1=0, clklimit2=0, clklimitg=0;
+ Bool OverlayHandled = FALSE;
+
inSISIDXREG(SISSR,0x2b,sr2b);
inSISIDXREG(SISSR,0x2c,sr2c);
myclock1 = myclock2 = SiSGetClockFromRegs(sr2b, sr2c);
+ inSISIDXREG(SISSR,0x06,tmpreg);
+ switch((tmpreg & 0x1c) >> 2) {
+ case 0: mycoldepth1 = 1; break;
+ case 1:
+ case 2: mycoldepth1 = 2; break;
+ default: mycoldepth1 = 4;
+ }
+ mycoldepth2 = mycoldepth1;
+
if((!IsInSlaveMode) && (pSiS->VBFlags & CRT2_ENABLE)) {
- if(pSiS->VBFlags & VB_SISBRIDGE) {
+ if(pSiS->VBFlags & VB_SISBRIDGE) {
inSISIDXREG(SISPART4,0x0a,sr2b);
- inSISIDXREG(SISPART4,0x0b,sr2c);
+ inSISIDXREG(SISPART4,0x0b,sr2c);
} else {
inSISIDXREG(SISSR,0x2e,sr2b);
- inSISIDXREG(SISSR,0x2f,sr2c);
+ inSISIDXREG(SISSR,0x2f,sr2c);
}
myclock2 = SiSGetClockFromRegs(sr2b, sr2c);
+ inSISIDXREG(SISPART1,0x00,tmpreg);
+ tmpreg &= 0x0f;
+ switch(tmpreg) {
+ case 8: mycoldepth2 = 1; break;
+ case 4:
+ case 2: mycoldepth2 = 2; break;
+ default: mycoldepth2 = 4;
+ }
}
- pSiS->MiscFlags &= ~(MISC_CRT1OVERLAY | MISC_CRT2OVERLAY | MISC_CRT1OVERLAYGAMMA);
+ pSiS->MiscFlags &= ~( MISC_CRT1OVERLAY |
+ MISC_CRT2OVERLAY |
+ MISC_CRT1OVERLAYGAMMA |
+ MISC_SIS760ONEOVERLAY );
+ pSiS->SiS_SD2_Flags &= ~SiS_SD2_SIS760ONEOVL;
+#ifdef SISDUALHEAD
+ if(pSiS->DualHeadMode) {
+ if(pSiSEnt->pScrn_1) {
+ SISPTR(pSiSEnt->pScrn_1)->MiscFlags &= ~(MISC_SIS760ONEOVERLAY |
+ MISC_CRT1OVERLAY |
+ MISC_CRT2OVERLAY |
+ MISC_CRT1OVERLAYGAMMA);
+ SISPTR(pSiSEnt->pScrn_1)->SiS_SD2_Flags &= ~SiS_SD2_SIS760ONEOVL;
+ }
+ if(pSiSEnt->pScrn_2) {
+ SISPTR(pSiSEnt->pScrn_2)->MiscFlags &= ~(MISC_SIS760ONEOVERLAY |
+ MISC_CRT1OVERLAY |
+ MISC_CRT2OVERLAY |
+ MISC_CRT1OVERLAYGAMMA);
+ SISPTR(pSiSEnt->pScrn_2)->SiS_SD2_Flags &= ~SiS_SD2_SIS760ONEOVL;
+ }
+ }
+#endif
+
switch(pSiS->sishw_ext.jChipType) {
- case SIS_300:
- case SIS_540:
- case SIS_630:
- case SIS_730:
+
+ case SIS_300:
+ case SIS_540:
+ case SIS_630:
+ case SIS_730:
clklimit1 = clklimit2 = clklimitg = 150;
- break;
- case SIS_550:
- case SIS_650:
- case SIS_740:
+ break;
+
+ case SIS_550:
+ case SIS_650:
+ case SIS_740:
+ clklimit1 = clklimit2 = 175; /* verified for 65x */
+ clklimitg = 166; /* ? */
+ break;
+
case SIS_661:
case SIS_741:
- clklimit1 = clklimit2 = 175; /* verified for 6xx */
- clklimitg = 166; /* ? */
- break;
- case SIS_660:
+ clklimit1 = clklimit2 = 190; /* ? */
+ clklimitg = 180; /* ? */
+ break;
+
case SIS_760:
case SIS_761:
- clklimit1 = clklimit2 = 175; /* ? */
- if(!(pSiS->ChipFlags & SiSCF_760UMA)) clklimit1 = clklimit2 = 180;
- clklimitg = 166; /* ? */
+ clklimit1 = clklimit2 = 190; /* ? */
+ if(pSiS->ChipFlags & SiSCF_760LFB) { /* LFB only or hybrid */
+ clklimit1 = clklimit2 = 220; /* ? */
+ }
+ clklimitg = 200; /* ? */
+
+ if(pSiS->SiS_SD2_Flags & SiS_SD2_SUPPORT760OO) { /* UMA only */
+
+ Bool OnlyOne = FALSE, NoOverlay = FALSE;
+ int dotclocksum = 0;
+
+ if(pSiS->VBFlags & DISPTYPE_CRT1) dotclocksum += myclock1;
+ if((!IsInSlaveMode) && (pSiS->VBFlags & CRT2_ENABLE)) dotclocksum += myclock2;
+
+ /* TODO: Find out under what circumstances only one
+ * overlay is usable in UMA-only mode.
+ * This is not entirely accurate; the overlay
+ * scaler also requires some time, so even though
+ * the dotclocks are below these values, some
+ * distortions in the overlay may occure.
+ * Solution: Don't use a 760 with shared memory.
+ */
+ if( (pSiS->VBFlags & DISPTYPE_CRT1) &&
+ (pSiS->VBFlags & CRT2_ENABLE) &&
+ (mycoldepth1 != mycoldepth2) ) {
+
+ /* 0. If coldepths are different (only possible in dual head mode),
+ * I have no idea to calculate the limits; hence, allow only one
+ * overlay in all cases.
+ */
+ OnlyOne = TRUE;
+
+ } else if(pSiS->MemClock < 150000) {
+
+ /* 1. MCLK <150: If someone seriously considers using such
+ * slow RAM, so be it. Only one overlay in call cases.
+ */
+ OnlyOne = TRUE;
+
+ } else if(pSiS->MemClock < 170000) {
+
+ /* 2. MCLK 166 */
+ switch(pSiS->CurrentLayout.bitsPerPixel) {
+ case 32: if(dotclocksum > 133) OnlyOne = TRUE; /* One overlay; verified */
+ if(dotclocksum > 180) NoOverlay = TRUE; /* No overlay; verified */
+ break;
+ case 16: if(dotclocksum > 175) OnlyOne = TRUE; /* One overlay; verified */
+ if(dotclocksum > 260) NoOverlay = TRUE;; /* No overlay; FIXME */
+ break;
+ }
+
+ } else if(pSiS->MemClock < 210000) {
+
+ /* 3. MCLK 200 */
+ switch(pSiS->CurrentLayout.bitsPerPixel) {
+ case 32: if(dotclocksum > 160) OnlyOne = TRUE; /* One overlay; FIXME */
+ if(dotclocksum > 216) NoOverlay = TRUE;; /* No overlay; FIXME */
+ break;
+ case 16: if(dotclocksum > 210) OnlyOne = TRUE; /* One overlay; FIXME */
+ if(dotclocksum > 312) NoOverlay = TRUE;; /* No overlay; FIXME */
+ break;
+ }
+
+ }
+
+ if(OnlyOne || NoOverlay) {
+
+ ULong tmpflags = 0;
+
+ if(!NoOverlay) {
+ if(myclock1 <= clklimit1) tmpflags |= MISC_CRT1OVERLAY;
+ if(myclock2 <= clklimit2) tmpflags |= MISC_CRT2OVERLAY;
+ if(myclock1 <= clklimitg) tmpflags |= MISC_CRT1OVERLAYGAMMA;
+ pSiS->MiscFlags |= tmpflags;
+ }
+ pSiS->MiscFlags |= MISC_SIS760ONEOVERLAY;
+ pSiS->SiS_SD2_Flags |= SiS_SD2_SIS760ONEOVL;
+#ifdef SISDUALHEAD
+ if(pSiS->DualHeadMode) {
+ if(pSiSEnt->pScrn_1) {
+ SISPTR(pSiSEnt->pScrn_1)->MiscFlags |= (tmpflags | MISC_SIS760ONEOVERLAY);
+ SISPTR(pSiSEnt->pScrn_1)->SiS_SD2_Flags |= SiS_SD2_SIS760ONEOVL;
+ }
+ if(pSiSEnt->pScrn_2) {
+ SISPTR(pSiSEnt->pScrn_2)->MiscFlags |= (tmpflags | MISC_SIS760ONEOVERLAY);
+ SISPTR(pSiSEnt->pScrn_2)->SiS_SD2_Flags |= SiS_SD2_SIS760ONEOVL;
+ }
+ }
+#endif
+ OverlayHandled = TRUE;
+ }
+
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3,
+ "SiS76x/UMA: %s video overlay(s) available in current mode\n",
+ NoOverlay ? "no" : ((pSiS->MiscFlags & MISC_SIS760ONEOVERLAY) ? "one" : "two"));
+
+#ifdef TWDEBUG
+ xf86DrvMsg(0, 0, "SiS760: Memclock %d, c1 %d/%d c2 %d/%d, sum %d / %x\n",
+ pSiS->MemClock, myclock1, mycoldepth1,
+ myclock2, mycoldepth2, dotclocksum, pSiS->SiS_SD2_Flags);
+#endif
+ }
break;
+
+ case SIS_660:
+ clklimit1 = clklimit2 = 200; /* ? */
+ if(pSiS->ChipFlags & SiSCF_760LFB) { /* LFB only */
+ clklimit1 = clklimit2 = 220;
+ }
+ clklimitg = 200; /* ? */
+ break;
+
case SIS_315H:
- case SIS_315:
- case SIS_315PRO:
- case SIS_330:
- case SIS_340: /* ? */
+ case SIS_315:
+ case SIS_315PRO:
+ case SIS_330:
clklimit1 = clklimit2 = 180; /* ? */
clklimitg = 166; /* ? */
- break;
+ break;
+
+ case SIS_340: /* ? */
+ clklimit1 = clklimit2 = 240; /* ? */
+ clklimitg = 200; /* ? */
+ break;
}
- if(myclock1 <= clklimit1) pSiS->MiscFlags |= MISC_CRT1OVERLAY;
- if(myclock2 <= clklimit2) pSiS->MiscFlags |= MISC_CRT2OVERLAY;
- if(myclock1 <= clklimitg) pSiS->MiscFlags |= MISC_CRT1OVERLAYGAMMA;
- if(!(pSiS->MiscFlags & MISC_CRT1OVERLAY)) {
+
+ if(!OverlayHandled) {
+ ULong tmpflags = 0;
+ if(myclock1 <= clklimit1) tmpflags |= MISC_CRT1OVERLAY;
+ if(myclock2 <= clklimit2) tmpflags |= MISC_CRT2OVERLAY;
+ if(myclock1 <= clklimitg) tmpflags |= MISC_CRT1OVERLAYGAMMA;
+ pSiS->MiscFlags |= tmpflags;
#ifdef SISDUALHEAD
- if((!pSiS->DualHeadMode) || (pSiS->SecondHead))
+ if(pSiS->DualHeadMode) {
+ if(pSiSEnt->pScrn_1) {
+ SISPTR(pSiSEnt->pScrn_1)->MiscFlags |= tmpflags;
+ }
+ if(pSiSEnt->pScrn_2) {
+ SISPTR(pSiSEnt->pScrn_2)->MiscFlags |= tmpflags;
+ }
+ }
#endif
- xf86DrvMsgVerb(pScrn->scrnIndex, X_WARNING, 3,
- "Current dotclock (%dMhz) too high for video overlay on CRT1\n",
- myclock1);
- }
- if((pSiS->VBFlags & CRT2_ENABLE) && (!(pSiS->MiscFlags & MISC_CRT2OVERLAY))) {
+ if(!(pSiS->MiscFlags & MISC_CRT1OVERLAY)) {
#ifdef SISDUALHEAD
- if((!pSiS->DualHeadMode) || (!pSiS->SecondHead))
+ if((!pSiS->DualHeadMode) || (pSiS->SecondHead))
#endif
- xf86DrvMsgVerb(pScrn->scrnIndex, X_WARNING, 3,
- "Current dotclock (%dMhz) too high for video overlay on CRT2\n",
- myclock2);
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_WARNING, 3,
+ "Current dotclock (%dMhz) too high for video overlay on CRT1\n",
+ myclock1);
+ }
+ if((pSiS->VBFlags & CRT2_ENABLE) && (!(pSiS->MiscFlags & MISC_CRT2OVERLAY))) {
+#ifdef SISDUALHEAD
+ if((!pSiS->DualHeadMode) || (!pSiS->SecondHead))
+#endif
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_WARNING, 3,
+ "Current dotclock (%dMhz) too high for video overlay on CRT2\n",
+ myclock2);
+ }
}
+
}
/* Determine if the Panel Link scaler is active */
pSiS->MiscFlags &= ~MISC_PANELLINKSCALER;
if(pSiS->VBFlags & (CRT2_LCD | CRT1_LCDA)) {
if(pSiS->VGAEngine == SIS_300_VGA) {
- if(pSiS->VBFlags & (VB_LVDS | VB_30xBDH)) {
+ if(pSiS->VBFlags & (VB_LVDS | VB_30xBDH)) {
inSISIDXREG(SISPART1,0x1e,tmpreg);
tmpreg &= 0x3f;
if(tmpreg) pSiS->MiscFlags |= MISC_PANELLINKSCALER;
}
} else {
- if(pSiS->VBFlags & (VB_LVDS | VB_30xBDH | CRT1_LCDA)) {
+ if(pSiS->VBFlags & (VB_LVDS | VB_30xBDH | CRT1_LCDA)) {
inSISIDXREG(SISPART1,0x35,tmpreg);
tmpreg &= 0x04;
if(!tmpreg) pSiS->MiscFlags |= MISC_PANELLINKSCALER;
@@ -11954,12 +12653,24 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg)
}
}
+ /* Determine if STN is active */
+ pSiS->MiscFlags &= ~MISC_STNMODE;
+ if(pSiS->sishw_ext.jChipType == SIS_550) {
+ if((pSiS->VBFlags & CRT2_LCD) && (pSiS->FSTN || pSiS->DSTN)) {
+ inSISIDXREG(SISCR,0x34,tmpreg);
+ tmpreg &= 0x7f;
+ if(tmpreg == 0x5a || tmpreg == 0x5b) {
+ pSiS->MiscFlags |= MISC_STNMODE;
+ }
+ }
+ }
+
/* Determine if our very special TV mode is active */
pSiS->MiscFlags &= ~MISC_TVNTSC1024;
if((pSiS->VBFlags & VB_SISBRIDGE) && (pSiS->VBFlags & CRT2_TV) && (!(pSiS->VBFlags & TV_HIVISION))) {
if( ((pSiS->VBFlags & TV_YPBPR) && (pSiS->VBFlags & TV_YPBPR525I)) ||
- ((!(pSiS->VBFlags & TV_YPBPR)) && (pSiS->VBFlags & (TV_NTSC | TV_PALM))) ) {
- inSISIDXREG(SISCR,0x34,tmpreg);
+ ((!(pSiS->VBFlags & TV_YPBPR)) && (pSiS->VBFlags & (TV_NTSC | TV_PALM))) ) {
+ inSISIDXREG(SISCR,0x34,tmpreg);
tmpreg &= 0x7f;
if((tmpreg == 0x64) || (tmpreg == 0x4a) || (tmpreg == 0x38)) {
pSiS->MiscFlags |= MISC_TVNTSC1024;
@@ -11971,7 +12682,7 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg)
if(pSiS->VGAEngine == SIS_315_VGA) {
int i;
#ifdef SISVRAMQ
- /* Re-Enable command queue */
+ /* Re-Enable and reset command queue */
SiSEnableTurboQueue(pScrn);
#endif
/* Get HWCursor register contents for backup */
@@ -11984,6 +12695,28 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg)
}
}
+ /* Reset XV display properties (such as number of overlays, etc) */
+#ifdef SISDUALHEAD
+ if(pSiS->DualHeadMode) {
+ if(pSiSEnt->pScrn_1) {
+ if(SISPTR(pSiSEnt->pScrn_1)->ResetXvDisplay) {
+ (SISPTR(pSiSEnt->pScrn_1)->ResetXvDisplay)(pSiSEnt->pScrn_1);
+ }
+ }
+ if(pSiSEnt->pScrn_2) {
+ if(SISPTR(pSiSEnt->pScrn_2)->ResetXvDisplay) {
+ (SISPTR(pSiSEnt->pScrn_1)->ResetXvDisplay)(pSiSEnt->pScrn_2);
+ }
+ }
+ } else {
+#endif
+ if(pSiS->ResetXvDisplay) {
+ (pSiS->ResetXvDisplay)(pScrn);
+ }
+#ifdef SISDUALHEAD
+ }
+#endif
+
/* Reset XV gamma correction */
if(pSiS->ResetXvGamma) {
(pSiS->ResetXvGamma)(pScrn);
@@ -11998,7 +12731,7 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg)
if(pSiS->VBFlags & CRT2_TV) {
int val;
if(pSiS->VBFlags & VB_CHRONTEL) {
- int mychtvlumabandwidthcvbs = pSiS->chtvlumabandwidthcvbs;
+ int mychtvlumabandwidthcvbs = pSiS->chtvlumabandwidthcvbs;
int mychtvlumabandwidthsvideo = pSiS->chtvlumabandwidthsvideo;
int mychtvlumaflickerfilter = pSiS->chtvlumaflickerfilter;
int mychtvchromabandwidth = pSiS->chtvchromabandwidth;
@@ -12055,7 +12788,7 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg)
pSiS->tvy |= ((SiS_GetCH700x(pSiS->SiS_Pr, 0x08) & 0x01) << 8);
#ifdef SISDUALHEAD
if(pSiSEnt) {
- pSiSEnt->tvx = pSiS->tvx;
+ pSiSEnt->tvx = pSiS->tvx;
pSiSEnt->tvy = pSiS->tvy;
}
#endif
@@ -12375,7 +13108,7 @@ SiSCalcVESAModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode)
j = 0;
while(VESAModeIndices[j] != 9999) {
if( (mode->HDisplay == VESAModeIndices[j]) &&
- (mode->VDisplay == VESAModeIndices[j+1]) ) {
+ (mode->VDisplay == VESAModeIndices[j+1]) ) {
ModeNumber = VESAModeIndices[j + 2 + i];
break;
}
@@ -12383,8 +13116,8 @@ SiSCalcVESAModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
if(!ModeNumber) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "No valid mode found for %dx%dx%d in built-in table either.\n",
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "No valid mode found for %dx%dx%d in built-in table either.\n",
mode->HDisplay, mode->VDisplay, pScrn->bitsPerPixel);
}
}
@@ -12397,9 +13130,14 @@ SiS_GetModeNumber(ScrnInfoPtr pScrn, DisplayModePtr mode, ULong VBFlags)
{
SISPtr pSiS = SISPTR(pScrn);
UShort i = (pSiS->CurrentLayout.bitsPerPixel+7)/8 - 1;
+ BOOLEAN FSTN = pSiS->FSTN ? TRUE : FALSE;
+
+#ifdef SISDUALHEAD
+ if(pSiS->DualHeadMode && pSiS->SecondHead) FSTN = FALSE;
+#endif
return(SiS_GetModeID(pSiS->VGAEngine, VBFlags, mode->HDisplay, mode->VDisplay,
- i, pSiS->FSTN, pSiS->LCDwidth, pSiS->LCDheight));
+ i, FSTN, pSiS->LCDwidth, pSiS->LCDheight));
}
static Bool
@@ -12519,7 +13257,7 @@ SiS_CheckModeCRT2(ScrnInfoPtr pScrn, DisplayModePtr mode, ULong VBFlags, Bool ha
#ifdef TWDEBUG
xf86DrvMsg(0, X_INFO, "Inside CheckCalcModeIndex (VBFlags %lx, mode %dx%d)\n",
- VBFlags,mode->HDisplay, mode->VDisplay);
+ VBFlags,mode->HDisplay, mode->VDisplay);
#endif
if(VBFlags & CRT2_LCD) { /* CRT2 is LCD */
@@ -12558,8 +13296,8 @@ SiS_CheckModeCRT2(ScrnInfoPtr pScrn, DisplayModePtr mode, ULong VBFlags, Bool ha
((mode->HDisplay == 1024) && (mode->HDisplay == 768)) ||
((mode->HDisplay == 800) && (mode->HDisplay == 600)))) ) {
- ModeIndex = SiS_GetModeID_LCD(pSiS->VGAEngine, VBFlags, mode->HDisplay, mode->VDisplay, i,
- pSiS->FSTN, pSiS->SiS_Pr->SiS_CustomT, pSiS->LCDwidth, pSiS->LCDheight);
+ ModeIndex = SiS_GetModeID_LCD(pSiS->VGAEngine, VBFlags, mode->HDisplay, mode->VDisplay, i,
+ pSiS->FSTN, pSiS->SiS_Pr->SiS_CustomT, pSiS->LCDwidth, pSiS->LCDheight);
}
@@ -12590,7 +13328,7 @@ SiS_CheckModeCRT2(ScrnInfoPtr pScrn, DisplayModePtr mode, ULong VBFlags, Bool ha
}
/* Calculate the vertical refresh rate from a mode */
-int
+float
SiSCalcVRate(DisplayModePtr mode)
{
float hsync, refresh = 0;
@@ -12615,11 +13353,11 @@ SiSCalcVRate(DisplayModePtr mode)
refresh /= mode->VScan;
if(mode->VRefresh > 0.0)
- refresh = mode->VRefresh;
+ refresh = mode->VRefresh;
if(hsync == 0 || refresh == 0) return(0);
- return((int)(refresh));
+ return refresh;
}
/* Calculate CR33 (rate index) for CRT1.
@@ -12639,7 +13377,7 @@ SISSearchCRT1Rate(ScrnInfoPtr pScrn, DisplayModePtr mode)
defindex = (xres == 800 || xres == 1024 || xres == 1280) ? 0x02 : 0x01;
- irefresh = SiSCalcVRate(mode);
+ irefresh = (int)SiSCalcVRate(mode);
if(!irefresh) return defindex;
/* SiS730 has troubles on CRT2 if CRT1 is at 32bpp */
diff --git a/src/sis_driver.h b/src/sis_driver.h
index bd151a3..b4cdeab 100644
--- a/src/sis_driver.h
+++ b/src/sis_driver.h
@@ -37,7 +37,7 @@
* -) VBE 3.0 on SiS300 and 315 series do not support 24 fpp modes
* -) Only SiS315 series support 1920x1440x32
*/
-
+
static const UShort VESAModeIndices[] = {
/* x y 8 16 (24) 32 */
320, 200, 0x138, 0x10e, 0x000, 0x000,
@@ -52,7 +52,7 @@ static const UShort VESAModeIndices[] = {
1600,1200, 0x130, 0x131, 0x000, 0x13e,
1920,1440, 0x13f, 0x140, 0x000, 0x141,
9999,9999, 0, 0, 0, 0
-};
+};
/* For calculating refresh rate index (CR33) */
static const struct _sis_vrate {
@@ -67,15 +67,15 @@ static const struct _sis_vrate {
{1, 400, 300, 60, TRUE},
{1, 512, 384, 60, TRUE},
{1, 640, 400, 60, TRUE}, {1, 640, 400, 72, TRUE},
- {1, 640, 480, 60, TRUE}, {2, 640, 480, 72, TRUE}, {3, 640, 480, 75, TRUE},
- {4, 640, 480, 85, TRUE}, {5, 640, 480, 100, TRUE}, {6, 640, 480, 120, TRUE},
+ {1, 640, 480, 60, TRUE}, {2, 640, 480, 72, TRUE}, {3, 640, 480, 75, TRUE},
+ {4, 640, 480, 85, TRUE}, {5, 640, 480, 100, TRUE}, {6, 640, 480, 120, TRUE},
{7, 640, 480, 160, FALSE}, {8, 640, 480, 200, FALSE},
{1, 720, 480, 60, TRUE},
{1, 720, 576, 60, TRUE},
{1, 768, 576, 60, TRUE},
{1, 800, 480, 60, TRUE}, {2, 800, 480, 75, TRUE}, {3, 800, 480, 85, TRUE},
- {1, 800, 600, 56, TRUE}, {2, 800, 600, 60, TRUE}, {3, 800, 600, 72, TRUE},
- {4, 800, 600, 75, TRUE}, {5, 800, 600, 85, TRUE}, {6, 800, 600, 105, TRUE},
+ {1, 800, 600, 56, TRUE}, {2, 800, 600, 60, TRUE}, {3, 800, 600, 72, TRUE},
+ {4, 800, 600, 75, TRUE}, {5, 800, 600, 85, TRUE}, {6, 800, 600, 105, TRUE},
{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},
@@ -89,8 +89,8 @@ static const struct _sis_vrate {
{1, 1152, 768, 60, TRUE},
{1, 1152, 864, 60, TRUE}, {1, 1152, 864, 75, TRUE}, {2, 1152, 864, 84, FALSE},
{1, 1280, 720, 60, TRUE}, {2, 1280, 720, 75, FALSE}, {3, 1280, 720, 85, TRUE},
- {1, 1280, 768, 60, TRUE},
- {1, 1280, 800, 60, TRUE},
+ {1, 1280, 768, 60, TRUE}, {2, 1280, 768, 75, TRUE}, {3, 1280, 768, 85, TRUE},
+ {1, 1280, 800, 60, TRUE}, {2, 1280, 800, 75, TRUE}, {3, 1280, 800, 85, TRUE},
{1, 1280, 960, 60, TRUE}, {2, 1280, 960, 85, TRUE},
{1, 1280, 1024, 43, FALSE}, {2, 1280, 1024, 60, TRUE}, {3, 1280, 1024, 75, FALSE},
{4, 1280, 1024, 85, TRUE},
@@ -103,7 +103,7 @@ static const struct _sis_vrate {
{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},
+ {1, 2048, 1536, 60, TRUE}, {2, 2048, 1536, 65, TRUE}, {3, 2048, 1536, 70, TRUE},
{4, 2048, 1536, 75, TRUE}, {5, 2048, 1536, 85, TRUE},
{0, 0, 0, 0, FALSE}
};
@@ -130,7 +130,7 @@ static const chswtable mychswtable[] = {
};
/* These machines require special timing/handling
- */
+ */
const customttable mycustomttable[] = {
{ SIS_630, "2.00.07", "09/27/2002-13:38:25",
0x3240A8,
@@ -244,6 +244,15 @@ const customttable mycustomttable[] = {
0x1043, 0x1612,
"Asus", "A2H (V2)", CUT_ASUSA2H_2, "ASUS_A2H_2"
},
+#if 0
+ { SIS_550, "1.02.0z", "",
+ 0x317f37, /* 320x240 LCD panel */
+ { 0, 0, 0, 0, 0 },
+ { 0, 0, 0, 0, 0 },
+ 0, 0,
+ "AAEON", "AOP-8060", CUT_AOP8060, "AAEON_AOP_8060"
+ },
+#endif
{ 4321, "", "", /* never autodetected */
0,
{ 0, 0, 0, 0, 0 },
@@ -656,7 +665,7 @@ static DisplayModeRec SiS6326SIS1600x1200_60Mode = {
};
/* TV filters for SiS video bridges
- */
+ */
static const struct _SiSTVFilter301 {
UChar filter[7][4];
} SiSTVFilter301[] = {
@@ -780,7 +789,7 @@ static const struct _SiSTVFilter301B {
};
/* TV scaling data for SiS video bridges
- */
+ */
typedef struct _SiSTVVScale {
UShort ScaleVDE;
int sindex;
@@ -1281,12 +1290,12 @@ static void SISAdjustFrame(int scrnIndex, int x, int y, int flags);
static Bool SISSaveScreenDH(ScreenPtr pScreen, int mode);
#endif
#ifdef X_XF86MiscPassMessage
-static int SISHandleMessage(int scrnIndex, const char *msgtype,
+static int SISHandleMessage(int scrnIndex, const char *msgtype,
const char *msgval, char **retmsg);
-static int SISCheckModeTimingForCRT2Type(ScrnInfoPtr pScrn, UShort cond, UShort hdisplay,
- UShort vdisplay, UShort htotal, UShort vtotal,
+static int SISCheckModeTimingForCRT2Type(ScrnInfoPtr pScrn, UShort cond, UShort hdisplay,
+ UShort vdisplay, UShort htotal, UShort vtotal,
UShort hsyncstart, UShort hsyncend, UShort vsyncstart,
- UShort vsyncend, int clock, Bool quiet);
+ UShort vsyncend, int clock, Bool quiet);
#endif
/* Optional functions */
@@ -1324,10 +1333,10 @@ static UShort SiS_CheckModeCRT1(ScrnInfoPtr pScrn, DisplayModePtr mode,
ULong VBFlags, Bool hcm);
static UShort SiS_CheckModeCRT2(ScrnInfoPtr pScrn, DisplayModePtr mode,
ULong VBFlags, Bool hcm);
-
+
#ifdef SISMERGED
static Bool InRegion(int x, int y, region r);
-static void SISMergePointerMoved(int scrnIndex, int x, int y);
+static void SISMergedPointerMoved(int scrnIndex, int x, int y);
#endif
Bool SiSBridgeIsInSlaveMode(ScrnInfoPtr pScrn);
UShort SiS_GetModeNumber(ScrnInfoPtr pScrn, DisplayModePtr mode, ULong VBFlags);
@@ -1352,7 +1361,9 @@ extern Bool SiSVGASaveScreen(ScreenPtr pScreen, int mode);
/* shadow */
extern void SISPointerMoved(int index, int x, int y);
+extern void SISPointerMovedReflect(int index, int x, int y);
extern void SISRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
+extern void SISRefreshAreaReflect(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
extern void SISRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
extern void SISRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
extern void SISRefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
@@ -1385,9 +1396,9 @@ extern BOOLEAN SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwDeviceExtension,
extern BOOLEAN SiSBIOSSetModeCRT1(SiS_Private *SiS_Pr, PSIS_HW_INFO HwDeviceExtension,
ScrnInfoPtr pScrn, DisplayModePtr mode, BOOLEAN IsCustom);
extern BOOLEAN SiSBIOSSetModeCRT2(SiS_Private *SiS_Pr, PSIS_HW_INFO HwDeviceExtension,
- ScrnInfoPtr pScrn, DisplayModePtr mode, BOOLEAN IsCustom);
+ ScrnInfoPtr pScrn, DisplayModePtr mode, BOOLEAN IsCustom);
extern DisplayModePtr SiSBuildBuiltInModeList(ScrnInfoPtr pScrn, BOOLEAN includelcdmodes,
- BOOLEAN isfordvi, BOOLEAN fakecrt2modes);
+ BOOLEAN isfordvi, BOOLEAN fakecrt2modes, BOOLEAN IsForCRT2);
extern void SiS_Chrontel701xBLOn(SiS_Private *SiS_Pr, PSIS_HW_INFO HwDeviceExtension);
extern void SiS_Chrontel701xBLOff(SiS_Private *SiS_Pr);
extern void SiS_SiS30xBLOn(SiS_Private *SiS_Pr, PSIS_HW_INFO HwDeviceExtension);
diff --git a/src/sis_memcpy.c b/src/sis_memcpy.c
index 706d659..33bf793 100644
--- a/src/sis_memcpy.c
+++ b/src/sis_memcpy.c
@@ -369,6 +369,11 @@ vidCopyFunc SiSVidCopyInit(ScreenPtr pScreen, vidCopyFunc *UMemCpy)
return SiS_libc_memcpy;
}
+vidCopyFunc SiSVidCopyGetDefault(void)
+{
+ return SiS_libc_memcpy;
+}
+
#else /* ! Everything below is gcc specific ! */
/************************************************************************/
@@ -1023,7 +1028,8 @@ static unsigned int SiS_GetCpuFeatures(ScrnInfoPtr pScrn)
/**********************************************************************/
#ifdef SiS_canBenchmark
-static vidCopyFunc SiSVidCopyInitGen(ScreenPtr pScreen, SISMCFuncData *MCFunctions, vidCopyFunc *UMemCpy)
+static vidCopyFunc
+SiSVidCopyInitGen(ScreenPtr pScreen, SISMCFuncData *MCFunctions, vidCopyFunc *UMemCpy)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
SISPtr pSiS = SISPTR(pScrn);
@@ -1085,7 +1091,8 @@ static vidCopyFunc SiSVidCopyInitGen(ScreenPtr pScreen, SISMCFuncData *MCFunctio
/* (called externally) */
/**********************************************************************/
-unsigned int SiSGetCPUFlags(ScrnInfoPtr pScrn)
+unsigned int
+SiSGetCPUFlags(ScrnInfoPtr pScrn)
{
unsigned int myCPUflags = SiS_GetCpuFeatures(pScrn);
diff --git a/src/sis_opt.c b/src/sis_opt.c
index d6b8f40..ce6b975 100644
--- a/src/sis_opt.c
+++ b/src/sis_opt.c
@@ -41,10 +41,10 @@ extern const customttable mycustomttable[];
typedef enum {
OPTION_SW_CURSOR,
OPTION_HW_CURSOR,
- OPTION_NOACCEL,
+ OPTION_ACCEL,
OPTION_TURBOQUEUE,
OPTION_FAST_VRAM,
- OPTION_NOHOSTBUS,
+ OPTION_HOSTBUS,
OPTION_RENDER,
OPTION_FORCE_CRT1TYPE,
OPTION_FORCE_CRT2TYPE,
@@ -53,8 +53,8 @@ typedef enum {
OPTION_DRI,
OPTION_AGP_SIZE,
OPTION_ROTATE,
- OPTION_ROTATEMOUSE,
- OPTION_NOXVIDEO,
+ OPTION_REFLECT,
+ OPTION_XVIDEO,
OPTION_VESA,
OPTION_MAXXFBMEM,
OPTION_FORCECRT1,
@@ -64,9 +64,9 @@ typedef enum {
OPTION_EMI,
OPTION_TVSTANDARD,
OPTION_USEROMDATA,
- OPTION_NOINTERNALMODES,
+ OPTION_INTERNALMODES,
OPTION_USEOEM,
- OPTION_NOYV12,
+ OPTION_YV12,
OPTION_CHTVOVERSCAN,
OPTION_CHTVSOVERSCAN,
OPTION_CHTVLUMABANDWIDTHCVBS,
@@ -98,7 +98,7 @@ typedef enum {
OPTION_USERGBCURSORBLEND,
OPTION_USERGBCURSORBLENDTH,
OPTION_RESTOREBYSET,
- OPTION_NODDCFORCRT2,
+ OPTION_DDCFORCRT2,
OPTION_FORCECRT2REDETECTION,
OPTION_SENSEYPBPR,
OPTION_CRT1GAMMA,
@@ -134,15 +134,19 @@ typedef enum {
OPTION_CRT2VREFRESH,
OPTION_CRT2POS,
OPTION_METAMODES,
- OPTION_NOSISXINERAMA,
+ OPTION_SISXINERAMA,
OPTION_CRT2ISSCRN0,
OPTION_MERGEDDPI,
+ OPTION_MERGEDFBNONRECT,
+ OPTION_MERGEDFBMOUSER,
OPTION_ENABLESISCTRL,
OPTION_STOREDBRI,
OPTION_STOREDPBRI,
OPTION_STOREDBRI2,
OPTION_STOREDPBRI2,
OPTION_OVERRULERANGES,
+ OPTION_FORCE1ASPECT,
+ OPTION_FORCE2ASPECT,
#ifdef SIS_CP
SIS_CP_OPT_OPTIONS
#endif
@@ -150,128 +154,134 @@ typedef enum {
} SISOpts;
static const OptionInfoRec SISOptions[] = {
- { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_TURBOQUEUE, "TurboQueue", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_FAST_VRAM, "FastVram", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_NOHOSTBUS, "NoHostBus", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_RENDER, "RenderAcceleration", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_FORCE_CRT1TYPE, "ForceCRT1Type", OPTV_STRING, {0}, FALSE },
- { OPTION_FORCE_CRT2TYPE, "ForceCRT2Type", OPTV_STRING, {0}, FALSE },
- { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_AGP_SIZE, "AGPSize", OPTV_INTEGER, {0}, FALSE },
- { OPTION_AGP_SIZE, "GARTSize", OPTV_INTEGER, {0}, FALSE },
- { OPTION_VESA, "Vesa", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_MAXXFBMEM, "MaxXFBMem", OPTV_INTEGER, {0}, FALSE },
- { OPTION_ENABLESISCTRL, "EnableSiSCtrl", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_SW_CURSOR, "SWCursor", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_HW_CURSOR, "HWCursor", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_USERGBCURSOR, "UseColorHWCursor", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_ROTATE, "Rotate", OPTV_STRING, {0}, FALSE },
- { OPTION_ROTATEMOUSE, "RotateMouse", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_NOXVIDEO, "NoXvideo", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_NOINTERNALMODES, "NoInternalModes", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_OVERRULERANGES, "OverruleFrequencyRanges",OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_RESTOREBYSET, "RestoreBySetMode", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_FORCECRT1, "ForceCRT1", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_XVONCRT2, "XvOnCRT2", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_PDC, "PanelDelayCompensation", OPTV_INTEGER, {0}, FALSE },
- { OPTION_PDC, "PDC", OPTV_INTEGER, {0}, FALSE },
- { OPTION_PDCA, "PanelDelayCompensation1",OPTV_INTEGER, {0}, FALSE },
- { OPTION_PDCA, "PDC1", OPTV_INTEGER, {0}, FALSE },
- { OPTION_EMI, "EMI", OPTV_INTEGER, {0}, FALSE },
- { OPTION_LVDSHL, "LVDSHL", OPTV_INTEGER, {0}, FALSE },
- { OPTION_PRGB, "ForcePanelRGB", OPTV_INTEGER, {0}, FALSE },
- { OPTION_SPECIALTIMING, "SpecialTiming", OPTV_STRING, {0}, FALSE },
- { OPTION_TVSTANDARD, "TVStandard", OPTV_STRING, {0}, FALSE },
- { OPTION_USEROMDATA, "UseROMData", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_USEOEM, "UseOEMData", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_NOYV12, "NoYV12", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_CHTVTYPE, "CHTVType", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_CHTVOVERSCAN, "CHTVOverscan", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_CHTVSOVERSCAN, "CHTVSuperOverscan", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_CHTVLUMABANDWIDTHCVBS, "CHTVLumaBandwidthCVBS", OPTV_INTEGER, {0}, FALSE },
- { OPTION_CHTVLUMABANDWIDTHSVIDEO, "CHTVLumaBandwidthSVIDEO",OPTV_INTEGER, {0}, FALSE },
- { OPTION_CHTVLUMAFLICKERFILTER, "CHTVLumaFlickerFilter", OPTV_INTEGER, {0}, FALSE },
- { OPTION_CHTVCHROMABANDWIDTH, "CHTVChromaBandwidth", OPTV_INTEGER, {0}, FALSE },
- { OPTION_CHTVCHROMAFLICKERFILTER, "CHTVChromaFlickerFilter",OPTV_INTEGER, {0}, FALSE },
- { OPTION_CHTVCVBSCOLOR, "CHTVCVBSColor", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_CHTVTEXTENHANCE, "CHTVTextEnhance", OPTV_INTEGER, {0}, FALSE },
- { OPTION_CHTVCONTRAST, "CHTVContrast", OPTV_INTEGER, {0}, FALSE },
- { OPTION_SISTVEDGEENHANCE, "SISTVEdgeEnhance", OPTV_INTEGER, {0}, FALSE },
- { OPTION_SISTVANTIFLICKER, "SISTVAntiFlicker", OPTV_STRING, {0}, FALSE },
- { OPTION_SISTVSATURATION, "SISTVSaturation", OPTV_INTEGER, {0}, FALSE },
- { OPTION_SISTVCHROMAFILTER, "SISTVCFilter", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_SISTVLUMAFILTER, "SISTVYFilter", OPTV_INTEGER, {0}, FALSE },
- { OPTION_SISTVCOLCALIBFINE, "SISTVColorCalibFine", OPTV_INTEGER, {0}, FALSE },
- { OPTION_SISTVCOLCALIBCOARSE, "SISTVColorCalibCoarse", OPTV_INTEGER, {0}, FALSE },
- { OPTION_TVXSCALE, "SISTVXScale", OPTV_INTEGER, {0}, FALSE },
- { OPTION_TVYSCALE, "SISTVYScale", OPTV_INTEGER, {0}, FALSE },
- { OPTION_TVXPOSOFFSET, "TVXPosOffset", OPTV_INTEGER, {0}, FALSE },
- { OPTION_TVYPOSOFFSET, "TVYPosOffset", OPTV_INTEGER, {0}, FALSE },
- { OPTION_SIS6326ANTIFLICKER, "SIS6326TVAntiFlicker", OPTV_STRING, {0}, FALSE },
- { OPTION_SIS6326ENABLEYFILTER, "SIS6326TVEnableYFilter", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_SIS6326YFILTERSTRONG, "SIS6326TVYFilterStrong", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_SIS6326FORCETVPPLUG, "SIS6326TVForcePlug", OPTV_STRING, {0}, FALSE },
- { OPTION_SIS6326FSCADJUST, "SIS6326FSCAdjust", OPTV_INTEGER, {0}, FALSE },
- { OPTION_YPBPRAR, "YPbPrAspectRatio", OPTV_STRING, {0}, FALSE },
- { OPTION_USERGBCURSORBLEND, "ColorHWCursorBlending", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_USERGBCURSORBLENDTH, "ColorHWCursorBlendThreshold", OPTV_INTEGER,{0},FALSE},
- { OPTION_NODDCFORCRT2, "NoCRT2Detection", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_FORCECRT2REDETECTION, "ForceCRT2ReDetection", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_SENSEYPBPR, "SenseYPbPr", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_CRT1GAMMA, "CRT1Gamma", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_CRT2GAMMA, "CRT2Gamma", OPTV_STRING, {0}, FALSE },
- { OPTION_STOREDBRI, "GammaBrightness", OPTV_STRING, {0}, FALSE },
- { OPTION_STOREDPBRI, "GammaPreBrightness", OPTV_STRING, {0}, FALSE },
- { OPTION_STOREDBRI, "StoredGammaBrightness", OPTV_STRING, {0}, FALSE },
- { OPTION_STOREDPBRI, "StoredGammaPreBrightness",OPTV_STRING, {0}, FALSE },
- { OPTION_STOREDBRI2, "GammaBrightnessCRT2", OPTV_STRING, {0}, FALSE },
- { OPTION_STOREDPBRI2, "GammaPreBrightnessCRT2", OPTV_STRING, {0}, FALSE },
- { OPTION_XVGAMMA, "XvGamma", OPTV_STRING, {0}, FALSE },
- { OPTION_XVDEFCONTRAST, "XvDefaultContrast", OPTV_INTEGER, {0}, FALSE },
- { OPTION_XVDEFBRIGHTNESS, "XvDefaultBrightness", OPTV_INTEGER, {0}, FALSE },
- { OPTION_XVDEFHUE, "XvDefaultHue", OPTV_INTEGER, {0}, FALSE },
- { OPTION_XVDEFSATURATION, "XvDefaultSaturation", OPTV_INTEGER, {0}, FALSE },
- { OPTION_XVDEFDISABLEGFX, "XvDefaultDisableGfx", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_XVDEFDISABLEGFXLR, "XvDefaultDisableGfxLR", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_XVCHROMAMIN, "XvChromaMin", OPTV_INTEGER, {0}, FALSE },
- { OPTION_XVCHROMAMAX, "XvChromaMax", OPTV_INTEGER, {0}, FALSE },
- { OPTION_XVUSECHROMAKEY, "XvUseChromaKey", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_XVINSIDECHROMAKEY, "XvInsideChromaKey", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_XVYUVCHROMAKEY, "XvYUVChromaKey", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_XVDISABLECOLORKEY, "XvDisableColorKey", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_XVMEMCPY, "XvUseMemcpy", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_XVBENCHCPY, "BenchmarkMemcpy", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_ACCEL, "Accel", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_TURBOQUEUE, "TurboQueue", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_FAST_VRAM, "FastVram", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_HOSTBUS, "HostBus", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_RENDER, "RenderAcceleration", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_FORCE_CRT1TYPE, "ForceCRT1Type", OPTV_STRING, {0}, FALSE },
+ { OPTION_FORCE_CRT2TYPE, "ForceCRT2Type", OPTV_STRING, {0}, FALSE },
+ { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_AGP_SIZE, "AGPSize", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_AGP_SIZE, "GARTSize", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_VESA, "Vesa", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_MAXXFBMEM, "MaxXFBMem", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_ENABLESISCTRL, "EnableSiSCtrl", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_SW_CURSOR, "SWCursor", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_HW_CURSOR, "HWCursor", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_USERGBCURSOR, "UseColorHWCursor", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_ROTATE, "Rotate", OPTV_STRING, {0}, FALSE },
+ { OPTION_REFLECT, "Reflect", OPTV_STRING, {0}, FALSE },
+ { OPTION_XVIDEO, "Xvideo", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_INTERNALMODES, "InternalModes", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_OVERRULERANGES, "OverruleFrequencyRanges", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_RESTOREBYSET, "RestoreBySetMode", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_FORCECRT1, "ForceCRT1", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_XVONCRT2, "XvOnCRT2", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_PDC, "PanelDelayCompensation", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_PDC, "PDC", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_PDC, "PanelDelayCompensation2", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_PDC, "PDC2", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_PDCA, "PanelDelayCompensation1", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_PDCA, "PDC1", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_EMI, "EMI", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_LVDSHL, "LVDSHL", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_PRGB, "ForcePanelRGB", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_SPECIALTIMING, "SpecialTiming", OPTV_STRING, {0}, FALSE },
+ { OPTION_TVSTANDARD, "TVStandard", OPTV_STRING, {0}, FALSE },
+ { OPTION_USEROMDATA, "UseROMData", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_USEOEM, "UseOEMData", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_YV12, "YV12", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_CHTVTYPE, "CHTVType", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_CHTVOVERSCAN, "CHTVOverscan", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_CHTVSOVERSCAN, "CHTVSuperOverscan", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_CHTVLUMABANDWIDTHCVBS, "CHTVLumaBandwidthCVBS", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_CHTVLUMABANDWIDTHSVIDEO, "CHTVLumaBandwidthSVIDEO", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_CHTVLUMAFLICKERFILTER, "CHTVLumaFlickerFilter", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_CHTVCHROMABANDWIDTH, "CHTVChromaBandwidth", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_CHTVCHROMAFLICKERFILTER, "CHTVChromaFlickerFilter", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_CHTVCVBSCOLOR, "CHTVCVBSColor", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_CHTVTEXTENHANCE, "CHTVTextEnhance", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_CHTVCONTRAST, "CHTVContrast", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_SISTVEDGEENHANCE, "SISTVEdgeEnhance", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_SISTVANTIFLICKER, "SISTVAntiFlicker", OPTV_STRING, {0}, FALSE },
+ { OPTION_SISTVSATURATION, "SISTVSaturation", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_SISTVCHROMAFILTER, "SISTVCFilter", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_SISTVLUMAFILTER, "SISTVYFilter", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_SISTVCOLCALIBFINE, "SISTVColorCalibFine", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_SISTVCOLCALIBCOARSE, "SISTVColorCalibCoarse", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_TVXSCALE, "SISTVXScale", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_TVYSCALE, "SISTVYScale", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_TVXPOSOFFSET, "TVXPosOffset", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_TVYPOSOFFSET, "TVYPosOffset", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_SIS6326ANTIFLICKER, "SIS6326TVAntiFlicker", OPTV_STRING, {0}, FALSE },
+ { OPTION_SIS6326ENABLEYFILTER, "SIS6326TVEnableYFilter", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_SIS6326YFILTERSTRONG, "SIS6326TVYFilterStrong", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_SIS6326FORCETVPPLUG, "SIS6326TVForcePlug", OPTV_STRING, {0}, FALSE },
+ { OPTION_SIS6326FSCADJUST, "SIS6326FSCAdjust", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_YPBPRAR, "YPbPrAspectRatio", OPTV_STRING, {0}, FALSE },
+ { OPTION_USERGBCURSORBLEND, "ColorHWCursorBlending", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_USERGBCURSORBLENDTH, "ColorHWCursorBlendThreshold", OPTV_INTEGER, {0},FALSE},
+ { OPTION_DDCFORCRT2, "CRT2Detection", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_FORCECRT2REDETECTION, "ForceCRT2ReDetection", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_SENSEYPBPR, "SenseYPbPr", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_CRT1GAMMA, "CRT1Gamma", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_CRT2GAMMA, "CRT2Gamma", OPTV_ANYSTR, {0}, FALSE },
+ { OPTION_STOREDBRI, "GammaBrightness", OPTV_STRING, {0}, FALSE },
+ { OPTION_STOREDPBRI, "GammaPreBrightness", OPTV_STRING, {0}, FALSE },
+ { OPTION_STOREDBRI, "StoredGammaBrightness", OPTV_STRING, {0}, FALSE },
+ { OPTION_STOREDPBRI, "StoredGammaPreBrightness", OPTV_STRING, {0}, FALSE },
+ { OPTION_STOREDBRI2, "GammaBrightnessCRT2", OPTV_STRING, {0}, FALSE },
+ { OPTION_STOREDPBRI2, "GammaPreBrightnessCRT2", OPTV_STRING, {0}, FALSE },
+ { OPTION_XVGAMMA, "XvGamma", OPTV_ANYSTR, {0}, FALSE },
+ { OPTION_XVDEFCONTRAST, "XvDefaultContrast", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_XVDEFBRIGHTNESS, "XvDefaultBrightness", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_XVDEFHUE, "XvDefaultHue", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_XVDEFSATURATION, "XvDefaultSaturation", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_XVDEFDISABLEGFX, "XvDefaultDisableGfx", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_XVDEFDISABLEGFXLR, "XvDefaultDisableGfxLR", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_XVCHROMAMIN, "XvChromaMin", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_XVCHROMAMAX, "XvChromaMax", OPTV_INTEGER, {0}, FALSE },
+ { OPTION_XVUSECHROMAKEY, "XvUseChromaKey", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_XVINSIDECHROMAKEY, "XvInsideChromaKey", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_XVYUVCHROMAKEY, "XvYUVChromaKey", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_XVDISABLECOLORKEY, "XvDisableColorKey", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_XVMEMCPY, "XvUseMemcpy", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_XVBENCHCPY, "BenchmarkMemcpy", OPTV_BOOLEAN, {0}, FALSE },
#ifndef SISCHECKOSSSE
- { OPTION_XVSSECOPY, "UseSSE", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_XVSSECOPY, "UseSSE", OPTV_BOOLEAN, {0}, FALSE },
#endif
- { OPTION_XVDEFAULTADAPTOR, "XvDefaultAdaptor", OPTV_STRING, {0}, FALSE },
- { OPTION_SCALELCD, "ScaleLCD", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_CENTERLCD, "CenterLCD", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_ENABLEHOTKEY, "EnableHotkey", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_XVDEFAULTADAPTOR, "XvDefaultAdaptor", OPTV_STRING, {0}, FALSE },
+ { OPTION_SCALELCD, "ScaleLCD", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_CENTERLCD, "CenterLCD", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_ENABLEHOTKEY, "EnableHotkey", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_FORCE1ASPECT, "ForceCRT1VGAAspect", OPTV_STRING, {0}, FALSE },
+ { OPTION_FORCE2ASPECT, "ForceCRT2VGAAspect", OPTV_STRING, {0}, FALSE },
#ifdef SISMERGED
- { OPTION_MERGEDFB, "MergedFB", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_MERGEDFB, "TwinView", OPTV_BOOLEAN, {0}, FALSE }, /* alias */
- { OPTION_MERGEDFBAUTO, "MergedFBAuto", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_CRT2HSYNC, "CRT2HSync", OPTV_STRING, {0}, FALSE },
- { OPTION_CRT2HSYNC, "SecondMonitorHorizSync", OPTV_STRING, {0}, FALSE }, /* alias */
- { OPTION_CRT2VREFRESH, "CRT2VRefresh", OPTV_STRING, {0}, FALSE },
- { OPTION_CRT2VREFRESH, "SecondMonitorVertRefresh", OPTV_STRING, {0}, FALSE }, /* alias */
- { OPTION_CRT2POS, "CRT2Position", OPTV_STRING, {0}, FALSE },
- { OPTION_CRT2POS, "TwinViewOrientation", OPTV_STRING, {0}, FALSE }, /* alias */
- { OPTION_METAMODES, "MetaModes", OPTV_STRING, {0}, FALSE },
- { OPTION_MERGEDDPI, "MergedDPI", OPTV_STRING, {0}, FALSE },
+ { OPTION_MERGEDFB, "MergedFB", OPTV_ANYSTR, {0}, FALSE },
+ { OPTION_MERGEDFB, "TwinView", OPTV_ANYSTR, {0}, FALSE }, /* alias */
+ { OPTION_MERGEDFBAUTO, "MergedFBAuto", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_CRT2HSYNC, "CRT2HSync", OPTV_STRING, {0}, FALSE },
+ { OPTION_CRT2HSYNC, "SecondMonitorHorizSync", OPTV_STRING, {0}, FALSE }, /* alias */
+ { OPTION_CRT2VREFRESH, "CRT2VRefresh", OPTV_STRING, {0}, FALSE },
+ { OPTION_CRT2VREFRESH, "SecondMonitorVertRefresh", OPTV_STRING, {0}, FALSE }, /* alias */
+ { OPTION_CRT2POS, "CRT2Position", OPTV_STRING, {0}, FALSE },
+ { OPTION_CRT2POS, "TwinViewOrientation", OPTV_STRING, {0}, FALSE }, /* alias */
+ { OPTION_METAMODES, "MetaModes", OPTV_STRING, {0}, FALSE },
+ { OPTION_MERGEDDPI, "MergedDPI", OPTV_STRING, {0}, FALSE },
#ifdef SISXINERAMA
- { OPTION_NOSISXINERAMA, "NoMergedXinerama", OPTV_BOOLEAN, {0}, FALSE },
- { OPTION_NOSISXINERAMA, "NoTwinviewXineramaInfo", OPTV_BOOLEAN, {0}, FALSE }, /* alias */
- { OPTION_CRT2ISSCRN0, "MergedXineramaCRT2IsScreen0",OPTV_BOOLEAN,{0},FALSE },
+ { OPTION_SISXINERAMA, "MergedXinerama", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_SISXINERAMA, "TwinviewXineramaInfo", OPTV_BOOLEAN, {0}, FALSE }, /* alias */
+ { OPTION_CRT2ISSCRN0, "MergedXineramaCRT2IsScreen0", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_MERGEDFBNONRECT, "MergedNonRectangular", OPTV_BOOLEAN, {0}, FALSE },
+ { OPTION_MERGEDFBMOUSER, "MergedMouseRestriction", OPTV_BOOLEAN, {0}, FALSE },
#endif
#endif
#ifdef SIS_CP
SIS_CP_OPTION_DETAIL
#endif
- { -1, NULL, OPTV_NONE, {0}, FALSE }
+ { -1, NULL, OPTV_NONE, {0}, FALSE }
};
static int
@@ -292,7 +302,7 @@ SiS_PrintBadOpt(ScrnInfoPtr pScrn, char *strptr, int token)
SISPtr pSiS = SISPTR(pScrn);
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "\"%s\" is is not a valid parameter for option \"%s\"\n",
+ "\"%s\" is is not a valid parameter for option \"%s\"\n",
strptr, pSiS->Options[SiS_FIFT(pSiS->Options, token)].name);
}
@@ -304,7 +314,7 @@ SiS_PrintIlRange(ScrnInfoPtr pScrn, int token, int min, int max, UChar showhex)
static const char *ilparmh = "Invalid parameter for \"%s\". Valid range is 0x%x - 0x%x\n";
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- showhex ? ilparmh : ilparmd,
+ showhex ? ilparmh : ilparmd,
pSiS->Options[SiS_FIFT(pSiS->Options, token)].name, min, max);
}
@@ -315,29 +325,30 @@ SiS_PrintOverruleDHM(ScrnInfoPtr pScrn, int token1, int token2)
SISPtr pSiS = SISPTR(pScrn);
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "\"%s\" overrules \"%s\" in CRT2 (Master) device section\n",
+ "\"%s\" overrules \"%s\" in CRT2 (Master) device section\n",
pSiS->Options[SiS_FIFT(pSiS->Options, token1)].name,
pSiS->Options[SiS_FIFT(pSiS->Options, token2)].name);
}
#endif
static Bool
-SiS_StrIsBoolOff(char *strptr)
+SiS_StrIsBoolOn(char *strptr)
{
- if( (!xf86NameCmp(strptr,"off")) ||
- (!xf86NameCmp(strptr,"false")) ||
- (!xf86NameCmp(strptr,"no")) ||
- (!xf86NameCmp(strptr,"0")) ) return TRUE;
+ if( (*strptr == '\0') ||
+ (!xf86NameCmp(strptr,"on")) ||
+ (!xf86NameCmp(strptr,"true")) ||
+ (!xf86NameCmp(strptr,"yes")) ||
+ (!xf86NameCmp(strptr,"1")) ) return TRUE;
return FALSE;
}
static Bool
-SiS_StrIsBoolOn(char *strptr)
+SiS_StrIsBoolOff(char *strptr)
{
- if( (!xf86NameCmp(strptr,"on")) ||
- (!xf86NameCmp(strptr,"true")) ||
- (!xf86NameCmp(strptr,"yes")) ||
- (!xf86NameCmp(strptr,"1")) ) return TRUE;
+ if( (!xf86NameCmp(strptr,"off")) ||
+ (!xf86NameCmp(strptr,"false")) ||
+ (!xf86NameCmp(strptr,"no")) ||
+ (!xf86NameCmp(strptr,"0")) ) return TRUE;
return FALSE;
}
@@ -351,8 +362,8 @@ SiS_EvalOneOrThreeFloats(ScrnInfoPtr pScrn, int token, const char *myerror,
int result = sscanf(strptr, "%f %f %f", &val1, &val2, &val3);
if(result == 1) {
if((val1 >= 0.1) && (val1 <= 10.0)) {
- valid = TRUE;
- *v1 = *v2 = *v3 = (int)(val1 * 1000);
+ valid = TRUE;
+ *v1 = *v2 = *v3 = (int)(val1 * 1000);
}
} else if(result == 3) {
if((val1 >= 0.1) && (val1 <= 10.0) &&
@@ -400,7 +411,7 @@ SiSOptions(ScrnInfoPtr pScrn)
/* Set defaults */
pSiS->newFastVram = -1;
- pSiS->NoHostBus = FALSE;
+ pSiS->HostBus = TRUE;
pSiS->TurboQueue = TRUE;
#ifdef SISVRAMQ
/* TODO: Option (315 series VRAM command queue) */
@@ -410,7 +421,7 @@ SiSOptions(ScrnInfoPtr pScrn)
pSiS->doRender = TRUE;
pSiS->HWCursor = TRUE;
pSiS->Rotate = 0;
- pSiS->RotateMouse = FALSE;
+ pSiS->Reflect = 0;
pSiS->NoAccel = FALSE;
pSiS->ShadowFB = FALSE;
pSiS->loadDRI = FALSE;
@@ -463,6 +474,7 @@ SiSOptions(ScrnInfoPtr pScrn)
pSiS->forcecrt2redetection = TRUE;
pSiS->SenseYPbPr = TRUE;
pSiS->ForceCRT1Type = CRT1_VGA;
+ pSiS->CRT1TypeForced = FALSE;
pSiS->ForceCRT2Type = CRT2_DEFAULT;
pSiS->ForceYPbPrAR = TV_YPBPR169;
pSiS->ForceTVType = -1;
@@ -516,6 +528,9 @@ SiSOptions(ScrnInfoPtr pScrn)
pSiS->MetaModes = NULL;
pSiS->MergedFBXDPI = pSiS->MergedFBYDPI = 0;
pSiS->CRT1XOffs = pSiS->CRT1YOffs = pSiS->CRT2XOffs = pSiS->CRT2YOffs = 0;
+ pSiS->NonRect = pSiS->HaveNonRect = pSiS->HaveOffsRegions = FALSE;
+ pSiS->MBXNR1XMAX = pSiS->MBXNR1YMAX = pSiS->MBXNR2XMAX = pSiS->MBXNR2YMAX = 65536;
+ pSiS->MouseRestrictions = TRUE;
#ifdef SISXINERAMA
pSiS->UseSiSXinerama = TRUE;
pSiS->CRT2IsScrn0 = FALSE;
@@ -528,18 +543,23 @@ SiSOptions(ScrnInfoPtr pScrn)
/* Chipset dependent defaults */
if(pSiS->Chipset == PCI_CHIP_SIS530) {
- /* TQ still broken on 530/620? */
- pSiS->TurboQueue = FALSE;
+ /* TQ still broken on 530/620? */
+ pSiS->TurboQueue = FALSE;
}
if(pSiS->Chipset == PCI_CHIP_SIS6326) {
- pSiS->newFastVram = 1;
+ pSiS->newFastVram = 1;
}
if(pSiS->sishw_ext.jChipType == SIS_315H ||
pSiS->sishw_ext.jChipType == SIS_315) {
- /* Cursor engine seriously broken */
- pSiS->HWCursor = FALSE;
+ /* Cursor engine seriously broken */
+ pSiS->HWCursor = FALSE;
+ }
+
+ if(pSiS->Chipset == PCI_CHIP_SIS550) {
+ /* Alpha blending not supported */
+ pSiS->doRender = FALSE;
}
/* DRI only supported on 300 series,
@@ -554,11 +574,11 @@ SiSOptions(ScrnInfoPtr pScrn)
pSiS->OptUseColorCursor = 0;
#else
if(pSiS->VGAEngine == SIS_300_VGA) {
- pSiS->OptUseColorCursor = 0;
- pSiS->OptUseColorCursorBlend = 1;
- pSiS->OptColorCursorBlendThreshold = 0x37000000;
+ pSiS->OptUseColorCursor = 0;
+ pSiS->OptUseColorCursorBlend = 1;
+ pSiS->OptColorCursorBlendThreshold = 0x37000000;
} else if(pSiS->VGAEngine == SIS_315_VGA) {
- pSiS->OptUseColorCursor = 1;
+ pSiS->OptUseColorCursor = 1;
}
#endif
@@ -578,21 +598,21 @@ SiSOptions(ScrnInfoPtr pScrn)
from = X_CONFIG;
}
xf86DrvMsg(pScrn->scrnIndex, from, "Fast VRAM timing %s\n",
- (pSiS->newFastVram == -1) ?
- ((pSiS->oldChipset == OC_SIS620) ? "enabled (for read only)" :
- "enabled (for write only)") :
- (pSiS->newFastVram ? "enabled (for read and write)" : disabledstr));
+ (pSiS->newFastVram == -1) ?
+ ((pSiS->oldChipset == OC_SIS620) ? "enabled (for read only)" :
+ "enabled (for write only)") :
+ (pSiS->newFastVram ? "enabled (for read and write)" : disabledstr));
}
- /* NoHostBus (5597/5598 only)
+ /* HostBus (5597/5598 only)
*/
if(pSiS->Chipset == PCI_CHIP_SIS5597) {
from = X_DEFAULT;
- if(xf86GetOptValBool(pSiS->Options, OPTION_NOHOSTBUS, &pSiS->NoHostBus)) {
+ if(xf86GetOptValBool(pSiS->Options, OPTION_HOSTBUS, &pSiS->HostBus)) {
from = X_CONFIG;
}
xf86DrvMsg(pScrn->scrnIndex, from, "SiS5597/5598 VGA-to-CPU host bus %s\n",
- pSiS->NoHostBus ? disabledstr : enabledstr);
+ pSiS->HostBus ? enabledstr : disabledstr);
}
/* MaxXFBMem
@@ -605,16 +625,22 @@ SiSOptions(ScrnInfoPtr pScrn)
* and X is avoided. The amount is to be specified in KB.
*/
if(xf86GetOptValULong(pSiS->Options, OPTION_MAXXFBMEM, &pSiS->maxxfbmem)) {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "MaxXFBMem: Framebuffer memory shall be limited to %ld KB\n",
+ if(pSiS->maxxfbmem >= 2048) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "MaxXFBMem: Framebuffer memory shall be limited to %ld KB\n",
pSiS->maxxfbmem);
- pSiS->maxxfbmem *= 1024;
+ pSiS->maxxfbmem *= 1024;
+ } else {
+ pSiS->maxxfbmem = 0;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Invalid MaxXFBMem setting; minimum is 2048\n");
+ }
}
- /* NoAccel
- * Turns off 2D acceleration
+ /* Accel
+ * Turns on/off 2D acceleration
*/
- if(xf86ReturnOptValBool(pSiS->Options, OPTION_NOACCEL, FALSE)) {
+ if(!xf86ReturnOptValBool(pSiS->Options, OPTION_ACCEL, TRUE)) {
pSiS->NoAccel = TRUE;
#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
pSiS->NoXvideo = TRUE;
@@ -625,11 +651,11 @@ SiSOptions(ScrnInfoPtr pScrn)
}
/* RenderAcceleration
- * En/Disables RENDER acceleration (315/330 series only)
+ * En/Disables RENDER acceleration (315/330 series only, not 550)
*/
- if((pSiS->VGAEngine == SIS_315_VGA) && (!pSiS->NoAccel)) {
+ if((pSiS->VGAEngine == SIS_315_VGA) && (pSiS->Chipset != PCI_CHIP_SIS550) && (!pSiS->NoAccel)) {
if(xf86GetOptValBool(pSiS->Options, OPTION_RENDER, &pSiS->doRender)) {
- if(!pSiS->doRender) {
+ if(!pSiS->doRender) {
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "RENDER Acceleration disabled\n");
}
}
@@ -667,28 +693,28 @@ SiSOptions(ScrnInfoPtr pScrn)
from = X_DEFAULT;
if(xf86GetOptValBool(pSiS->Options, OPTION_USERGBCURSOR, &pSiS->OptUseColorCursor)) {
- from = X_CONFIG;
+ from = X_CONFIG;
}
xf86DrvMsg(pScrn->scrnIndex, from, "Color HW cursor is %s\n",
- pSiS->OptUseColorCursor ? enabledstr : disabledstr);
+ pSiS->OptUseColorCursor ? enabledstr : disabledstr);
if(pSiS->VGAEngine == SIS_300_VGA) {
- from = X_DEFAULT;
- if(xf86GetOptValBool(pSiS->Options, OPTION_USERGBCURSORBLEND, &pSiS->OptUseColorCursorBlend)) {
- from = X_CONFIG;
- }
- if(pSiS->OptUseColorCursor) {
- xf86DrvMsg(pScrn->scrnIndex, from,
- "HW cursor color blending emulation is %s\n",
+ from = X_DEFAULT;
+ if(xf86GetOptValBool(pSiS->Options, OPTION_USERGBCURSORBLEND, &pSiS->OptUseColorCursorBlend)) {
+ from = X_CONFIG;
+ }
+ if(pSiS->OptUseColorCursor) {
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "HW cursor color blending emulation is %s\n",
(pSiS->OptUseColorCursorBlend) ? enabledstr : disabledstr);
}
from = X_DEFAULT;
if(xf86GetOptValInteger(pSiS->Options, OPTION_USERGBCURSORBLENDTH, &ival)) {
if((ival >= 0) && (ival <= 255)) {
- from = X_CONFIG;
+ from = X_CONFIG;
pSiS->OptColorCursorBlendThreshold = (ival << 24);
} else {
- ival = pSiS->OptColorCursorBlendThreshold >> 24;
+ ival = pSiS->OptColorCursorBlendThreshold >> 24;
SiS_PrintIlRange(pScrn, OPTION_USERGBCURSORBLENDTH, 0, 255, 0);
}
} else {
@@ -696,9 +722,9 @@ SiSOptions(ScrnInfoPtr pScrn)
}
if(pSiS->OptUseColorCursor) {
if(pSiS->OptUseColorCursorBlend) {
- xf86DrvMsg(pScrn->scrnIndex, from,
- "HW cursor color blending emulation threshold is %d\n", ival);
- }
+ xf86DrvMsg(pScrn->scrnIndex, from,
+ "HW cursor color blending emulation threshold is %d\n", ival);
+ }
}
}
}
@@ -707,12 +733,11 @@ SiSOptions(ScrnInfoPtr pScrn)
#endif
/* OverruleFrequencyRanges
- *
* Enable/disable overruling bogus frequency ranges for TV and LCD(A)
*/
if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
if(xf86GetOptValBool(pSiS->Options, OPTION_OVERRULERANGES, &val)) {
- if(!val) {
+ if(!val) {
pSiS->OverruleRanges = FALSE;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Overruling frequency ranges disabled\n");
}
@@ -726,50 +751,50 @@ SiSOptions(ScrnInfoPtr pScrn)
}
#endif
- /*
- * MergedFB
- *
+ /* MergedFB
* Enable/disable and configure merged framebuffer mode
- *
*/
#ifdef SISMERGED
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
if(xf86IsOptionSet(pSiS->Options, OPTION_MERGEDFB)) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING, baddhm,
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, baddhm,
pSiS->Options[SiS_FIFT(pSiS->Options, OPTION_MERGEDFB)].name);
}
if(xf86IsOptionSet(pSiS->Options, OPTION_MERGEDFBAUTO)) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING, baddhm,
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, baddhm,
pSiS->Options[SiS_FIFT(pSiS->Options, OPTION_MERGEDFBAUTO)].name);
}
} else
#endif
if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
- if(xf86GetOptValBool(pSiS->Options, OPTION_MERGEDFB, &val)) {
- if(val) {
+ if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_MERGEDFB))) {
+ if(SiS_StrIsBoolOn(strptr)) {
pSiS->MergedFB = TRUE;
pSiS->MergedFBAuto = FALSE;
+ } else if(!xf86NameCmp(strptr, "AUTO")) {
+ pSiS->MergedFB = TRUE;
+ pSiS->MergedFBAuto = TRUE;
}
}
if(xf86GetOptValBool(pSiS->Options, OPTION_MERGEDFBAUTO, &val)) {
- if(!pSiS->MergedFB) {
+ if(!pSiS->MergedFB) {
if(val) pSiS->MergedFB = pSiS->MergedFBAuto = TRUE;
} else {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Option \"MergedFB\" overrules option \"MergedFBAuto\"\n");
+ "Option \"MergedFB\" overrules option \"MergedFBAuto\"\n");
}
}
if(pSiS->MergedFB) {
if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2POS))) {
- int result;
+ int result;
Bool valid = FALSE;
char *tempstr = xalloc(strlen(strptr) + 1);
result = sscanf(strptr, "%s %d", tempstr, &ival);
if(result >= 1) {
- if(!xf86NameCmp(tempstr,"LeftOf")) {
- pSiS->CRT2Position = sisLeftOf;
+ if(!xf86NameCmp(tempstr,"LeftOf")) {
+ pSiS->CRT2Position = sisLeftOf;
valid = TRUE;
if(result == 2) {
if(ival < 0) pSiS->CRT1YOffs = -ival;
@@ -778,8 +803,8 @@ SiSOptions(ScrnInfoPtr pScrn)
#ifdef SISXINERAMA
pSiS->CRT2IsScrn0 = TRUE;
#endif
- } else if(!xf86NameCmp(tempstr,"RightOf")) {
- pSiS->CRT2Position = sisRightOf;
+ } else if(!xf86NameCmp(tempstr,"RightOf")) {
+ pSiS->CRT2Position = sisRightOf;
if(result == 2) {
if(ival < 0) pSiS->CRT1YOffs = -ival;
else pSiS->CRT2YOffs = ival;
@@ -787,8 +812,8 @@ SiSOptions(ScrnInfoPtr pScrn)
#ifdef SISXINERAMA
pSiS->CRT2IsScrn0 = FALSE;
#endif
- } else if(!xf86NameCmp(tempstr,"Above")) {
- pSiS->CRT2Position = sisAbove;
+ } else if(!xf86NameCmp(tempstr,"Above")) {
+ pSiS->CRT2Position = sisAbove;
valid = TRUE;
if(result == 2) {
if(ival < 0) pSiS->CRT1XOffs = -ival;
@@ -797,8 +822,8 @@ SiSOptions(ScrnInfoPtr pScrn)
#ifdef SISXINERAMA
pSiS->CRT2IsScrn0 = FALSE;
#endif
- } else if(!xf86NameCmp(tempstr,"Below")) {
- pSiS->CRT2Position = sisBelow;
+ } else if(!xf86NameCmp(tempstr,"Below")) {
+ pSiS->CRT2Position = sisBelow;
valid = TRUE;
if(result == 2) {
if(ival < 0) pSiS->CRT1XOffs = -ival;
@@ -807,20 +832,20 @@ SiSOptions(ScrnInfoPtr pScrn)
#ifdef SISXINERAMA
pSiS->CRT2IsScrn0 = TRUE;
#endif
- } else if(!xf86NameCmp(tempstr,"Clone")) {
- pSiS->CRT2Position = sisClone;
+ } else if(!xf86NameCmp(tempstr,"Clone")) {
+ pSiS->CRT2Position = sisClone;
if(result == 1) valid = TRUE;
#ifdef SISXINERAMA
pSiS->CRT2IsScrn0 = TRUE;
#endif
- }
+ }
}
if(!valid) {
- SiS_PrintBadOpt(pScrn, strptr, OPTION_CRT2POS);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "%s \"RightOf\", \"LeftOf\", \"Above\", \"Below\", or \"Clone\"\n", validparm);
+ SiS_PrintBadOpt(pScrn, strptr, OPTION_CRT2POS);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s \"RightOf\", \"LeftOf\", \"Above\", \"Below\", or \"Clone\"\n", validparm);
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "Except for \"Clone\", the parameter may be followed by an integer.\n");
+ "Except for \"Clone\", the parameter may be followed by an integer.\n");
}
xfree(tempstr);
}
@@ -840,21 +865,27 @@ SiSOptions(ScrnInfoPtr pScrn)
int val1 = 0, val2 = 0;
sscanf(strptr, "%d %d", &val1, &val2);
if(val1 && val2) {
- pSiS->MergedFBXDPI = val1;
+ pSiS->MergedFBXDPI = val1;
pSiS->MergedFBYDPI = val2;
} else {
- SiS_PrintBadOpt(pScrn, strptr, OPTION_MERGEDDPI);
+ SiS_PrintBadOpt(pScrn, strptr, OPTION_MERGEDDPI);
}
}
#ifdef SISXINERAMA
if(pSiS->MergedFB) {
- if(xf86GetOptValBool(pSiS->Options, OPTION_NOSISXINERAMA, &val)) {
- if(val) pSiS->UseSiSXinerama = FALSE;
+ if(xf86GetOptValBool(pSiS->Options, OPTION_SISXINERAMA, &val)) {
+ if(!val) pSiS->UseSiSXinerama = FALSE;
}
if(pSiS->UseSiSXinerama) {
- if(xf86GetOptValBool(pSiS->Options, OPTION_CRT2ISSCRN0, &val)) {
+ if(xf86GetOptValBool(pSiS->Options, OPTION_CRT2ISSCRN0, &val)) {
pSiS->CRT2IsScrn0 = val ? TRUE : FALSE;
}
+ if(xf86GetOptValBool(pSiS->Options, OPTION_MERGEDFBNONRECT, &val)) {
+ pSiS->NonRect = val ? TRUE : FALSE;
+ }
+ if(xf86GetOptValBool(pSiS->Options, OPTION_MERGEDFBMOUSER, &val)) {
+ pSiS->MouseRestrictions = val ? TRUE : FALSE;
+ }
}
}
#endif
@@ -870,9 +901,9 @@ SiSOptions(ScrnInfoPtr pScrn)
static const char *mystring = "Option \"%s\" only accepted in CRT2 (Master) Device section\n";
int i;
const short forbiddenopts[] = {
- OPTION_TURBOQUEUE, OPTION_RESTOREBYSET, OPTION_ENABLEHOTKEY,
+ OPTION_TURBOQUEUE, OPTION_RESTOREBYSET, OPTION_ENABLEHOTKEY,
OPTION_ENABLESISCTRL, OPTION_USEROMDATA, OPTION_USEOEM,
- OPTION_FORCECRT1, OPTION_NODDCFORCRT2, OPTION_FORCECRT2REDETECTION,
+ OPTION_FORCECRT1, OPTION_DDCFORCRT2, OPTION_FORCECRT2REDETECTION,
OPTION_SENSEYPBPR, OPTION_FORCE_CRT1TYPE, OPTION_FORCE_CRT2TYPE,
OPTION_YPBPRAR, OPTION_SCALELCD, OPTION_CENTERLCD, OPTION_PDC,
OPTION_PDCA, OPTION_EMI, OPTION_SPECIALTIMING, OPTION_LVDSHL,
@@ -885,9 +916,9 @@ SiSOptions(ScrnInfoPtr pScrn)
OPTION_SISTVCHROMAFILTER, OPTION_SISTVLUMAFILTER, OPTION_SISTVCOLCALIBCOARSE,
OPTION_SISTVCOLCALIBFINE, OPTION_TVXPOSOFFSET, OPTION_TVYPOSOFFSET,
OPTION_TVXSCALE, OPTION_TVYSCALE, OPTION_CRT2GAMMA, OPTION_XVONCRT2,
- OPTION_XVDEFAULTADAPTOR, OPTION_XVMEMCPY, OPTION_XVBENCHCPY,
+ OPTION_XVDEFAULTADAPTOR, OPTION_XVMEMCPY, OPTION_XVBENCHCPY, OPTION_FORCE2ASPECT,
#ifndef SISCHECKOSSSE
- OPTION_XVSSECOPY,
+ OPTION_XVSSECOPY,
#endif
#ifdef SIS_CP
SIS_CP_OPT_DH_WARN
@@ -897,11 +928,11 @@ SiSOptions(ScrnInfoPtr pScrn)
i = 0;
while(forbiddenopts[i] >= 0) {
- if(xf86IsOptionSet(pSiS->Options, (int)forbiddenopts[i])) {
+ if(xf86IsOptionSet(pSiS->Options, (int)forbiddenopts[i])) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, mystring,
- pSiS->Options[SiS_FIFT(pSiS->Options, (int)forbiddenopts[i])].name);
+ pSiS->Options[SiS_FIFT(pSiS->Options, (int)forbiddenopts[i])].name);
}
- i++;
+ i++;
}
} else
@@ -911,7 +942,7 @@ SiSOptions(ScrnInfoPtr pScrn)
#ifdef SISVRAMQ
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using VRAM command queue, size %dk\n",
- pSiS->cmdQueueSize / 1024);
+ pSiS->cmdQueueSize / 1024);
#else
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using MMIO command queue, size 512k\n");
#endif
@@ -919,24 +950,24 @@ SiSOptions(ScrnInfoPtr pScrn)
} else {
/* TurboQueue */
- from = X_DEFAULT;
- if(xf86GetOptValBool(pSiS->Options, OPTION_TURBOQUEUE, &pSiS->TurboQueue)) {
- from = X_CONFIG;
- }
- xf86DrvMsg(pScrn->scrnIndex, from, "TurboQueue %s\n",
- pSiS->TurboQueue ? enabledstr : disabledstr);
+ from = X_DEFAULT;
+ if(xf86GetOptValBool(pSiS->Options, OPTION_TURBOQUEUE, &pSiS->TurboQueue)) {
+ from = X_CONFIG;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, from, "TurboQueue %s\n",
+ pSiS->TurboQueue ? enabledstr : disabledstr);
}
if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
/* RestoreBySetMode (300/315/330 series only)
- * Set this to force the driver to set the old mode instead of restoring
- * the register contents. This can be used to overcome problems with
- * LCD panels and video bridges.
- */
- if(xf86GetOptValBool(pSiS->Options, OPTION_RESTOREBYSET, &val)) {
- pSiS->restorebyset = val ? TRUE : FALSE;
- }
+ * Set this to force the driver to set the old mode instead of restoring
+ * the register contents. This can be used to overcome problems with
+ * LCD panels and video bridges.
+ */
+ if(xf86GetOptValBool(pSiS->Options, OPTION_RESTOREBYSET, &val)) {
+ pSiS->restorebyset = val ? TRUE : FALSE;
+ }
/* EnableHotkey (300/315/330 series only)
* Enables or disables the BIOS hotkey switch for
@@ -952,7 +983,7 @@ SiSOptions(ScrnInfoPtr pScrn)
ival = 0;
from = X_DEFAULT;
#ifdef SISDUALHEAD
- if(pSiS->DualHeadMode) {
+ if(pSiS->DualHeadMode) {
pSiS->AllowHotkey = 0;
ival = 1;
} else
@@ -960,169 +991,176 @@ SiSOptions(ScrnInfoPtr pScrn)
if(xf86GetOptValBool(pSiS->Options, OPTION_ENABLEHOTKEY, &val)) {
pSiS->AllowHotkey = val ? 1 : 0;
from = X_CONFIG;
- }
+ }
xf86DrvMsg(pScrn->scrnIndex, from, "Hotkey display switching is %s%s\n",
- pSiS->AllowHotkey ? enabledstr : disabledstr,
- ival ? " in dual head mode" : "");
+ pSiS->AllowHotkey ? enabledstr : disabledstr,
+ ival ? " in dual head mode" : "");
if(pSiS->Chipset == PCI_CHIP_SIS630 ||
pSiS->Chipset == PCI_CHIP_SIS650 ||
pSiS->Chipset == PCI_CHIP_SIS660) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "WARNING: Using the Hotkey might freeze your machine, regardless\n");
+ "WARNING: Using the Hotkey might freeze your machine, regardless\n");
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
" whether enabled or disabled. This is no driver bug.\n");
}
- /* UseROMData (300/315/330 series only)
- * This option is enabling/disabling usage of some machine
- * specific data from the BIOS ROM. This option can - and
- * should - be used in case the driver makes problems
- * because SiS changed the location of this data.
- */
+ /* UseROMData (300/315/330 series only)
+ * This option is enabling/disabling usage of some machine
+ * specific data from the BIOS ROM. This option can - and
+ * should - be used in case the driver makes problems
+ * because SiS changed the location of this data.
+ */
if(xf86GetOptValBool(pSiS->Options, OPTION_USEROMDATA, &val)) {
pSiS->OptROMUsage = val ? 1 : 0;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Video ROM data usage shall be %s\n",
- val ? enabledstr : disabledstr);
+ "Video ROM data usage shall be %s\n",
+ val ? enabledstr : disabledstr);
}
- /* UseOEMData (300/315/330 series only)
- * The driver contains quite a lot data for OEM LCD panels
- * and TV connector specifics which override the defaults.
- * If this data is incorrect, the TV may lose color and
- * the LCD panel might show some strange effects. Use this
- * option to disable the usage of this data.
- */
+ /* UseOEMData (300/315/330 series only)
+ * The driver contains quite a lot data for OEM LCD panels
+ * and TV connector specifics which override the defaults.
+ * If this data is incorrect, the TV may lose color and
+ * the LCD panel might show some strange effects. Use this
+ * option to disable the usage of this data.
+ */
if(xf86GetOptValBool(pSiS->Options, OPTION_USEOEM, &val)) {
pSiS->OptUseOEM = val ? 1 : 0;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Internal CRT2 OEM data usage shall be %s\n",
- val ? enabledstr : disabledstr);
+ "Internal CRT2 OEM data usage shall be %s\n",
+ val ? enabledstr : disabledstr);
}
- /* NoCRT2DDCDetection (315/330 series only)
- * If set to true, this disables CRT2 detection using DDC. This is
- * to avoid problems with not entirely DDC compiant LCD panels or
- * VGA monitors connected to the secondary VGA plug. Since LCD and
- * VGA share the same DDC channel, it might in some cases be impossible
- * to determine if the device is a CRT monitor or a flat panel.
- */
- if(xf86GetOptValBool(pSiS->Options, OPTION_NODDCFORCRT2, &val)) {
- pSiS->nocrt2ddcdetection = val ? TRUE : FALSE;
- }
+ /* CRT2DDCDetection (315/330 series only)
+ * If set to true, this disables CRT2 detection using DDC. This is
+ * to avoid problems with not entirely DDC compiant LCD panels or
+ * VGA monitors connected to the secondary VGA plug. Since LCD and
+ * VGA share the same DDC channel, it might in some cases be impossible
+ * to determine if the device is a CRT monitor or a flat panel.
+ */
+ if(xf86GetOptValBool(pSiS->Options, OPTION_DDCFORCRT2, &val)) {
+ pSiS->nocrt2ddcdetection = val ? FALSE : TRUE;
+ }
/* ForceCRT2ReDetection (315/330 series only)
- * If set to true, it forces re-detection of the LCD panel and
+ * If set to true, it forces re-detection of the LCD panel and
* a secondary VGA connection even if the BIOS already had found
* about it. This is meant for custom panels (ie such with
* non-standard resolutions) which the BIOS will "detect" according
* to the established timings, resulting in only a very vague idea
* about the panels real resolution. As for secondary VGA, this
* enables us to include a Plasma panel's proprietary modes.
- */
- if(xf86GetOptValBool(pSiS->Options, OPTION_FORCECRT2REDETECTION, &val)) {
- if(val) {
- pSiS->forcecrt2redetection = TRUE;
- pSiS->nocrt2ddcdetection = FALSE;
- } else pSiS->forcecrt2redetection = FALSE;
- }
+ */
+ if(xf86GetOptValBool(pSiS->Options, OPTION_FORCECRT2REDETECTION, &val)) {
+ if(val) {
+ pSiS->forcecrt2redetection = TRUE;
+ pSiS->nocrt2ddcdetection = FALSE;
+ } else
+ pSiS->forcecrt2redetection = FALSE;
+ }
/* SenseYPbPr (315/330 series only)
- * If set to true, the driver will sense for YPbPr TV. This is
+ * If set to true, the driver will sense for YPbPr TV. This is
* inconvenient for folks connecting SVideo and CVBS at the same
* time, because this condition will be detected as YPbPr (since
* the TV output pins are shared). "False" will not sense for
* YPbPr and detect SVideo or CVBS only.
- */
- if(xf86GetOptValBool(pSiS->Options, OPTION_SENSEYPBPR, &val)) {
- if(val) pSiS->SenseYPbPr = TRUE;
+ */
+ if(xf86GetOptValBool(pSiS->Options, OPTION_SENSEYPBPR, &val)) {
+ if(val) pSiS->SenseYPbPr = TRUE;
else pSiS->SenseYPbPr = FALSE;
- }
+ }
/* ForceCRT1Type (315/330 series only)
* Used for forcing the driver to initialize CRT1 as
* VGA (analog) or LCDA (for simultanious LCD and TV
- * display) - on M650/651 and 661 or later with 301C/30xLV only!
- */
+ * display) - on M650/651 and 661 or later with 301C/30xLV only!
+ */
if(pSiS->VGAEngine == SIS_315_VGA) {
- if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_FORCE_CRT1TYPE))) {
- if((!xf86NameCmp(strptr,"VGA")) || (!xf86NameCmp(strptr,"CRT"))) {
- pSiS->ForceCRT1Type = CRT1_VGA;
+ if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_FORCE_CRT1TYPE))) {
+ if((!xf86NameCmp(strptr,"VGA")) || (!xf86NameCmp(strptr,"CRT"))) {
+ pSiS->ForceCRT1Type = CRT1_VGA;
+ pSiS->CRT1TypeForced = TRUE;
} else if( (!xf86NameCmp(strptr,"LCD")) ||
- (!xf86NameCmp(strptr,"LCDA")) ||
+ (!xf86NameCmp(strptr,"LCDA")) ||
(!xf86NameCmp(strptr,"DVI-D")) ||
(!xf86NameCmp(strptr,"DVID")) ||
(!xf86NameCmp(strptr,"DVI")) ||
(!xf86NameCmp(strptr,"LCD-A")) ) {
pSiS->ForceCRT1Type = CRT1_LCDA;
+ pSiS->CRT1TypeForced = TRUE;
+ } else if((!xf86NameCmp(strptr,"NONE")) || (!xf86NameCmp(strptr,"OFF"))) {
+ pSiS->ForceCRT1Type = CRT1_VGA;
+ pSiS->forceCRT1 = 0;
+ pSiS->CRT1TypeForced = TRUE;
} else {
SiS_PrintBadOpt(pScrn, strptr, OPTION_FORCE_CRT1TYPE);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "%s \"VGA\" (alias \"CRT\") or \"LCD\" (alias \"DVI-D\")\n", validparm);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s \"VGA\" (alias \"CRT\"), \"LCD\" (alias \"DVI-D\") or NONE\n", validparm);
}
}
}
/* ForceCRT1 (300/315/330 series only)
- * This option can be used to force CRT1 to be switched on/off. Its
- * intention is mainly for old monitors that can't be detected
- * automatically. This is only useful on machines with a video bridge.
- * In normal cases, this option won't be necessary.
- */
- if(xf86GetOptValBool(pSiS->Options, OPTION_FORCECRT1, &val)) {
- pSiS->forceCRT1 = val ? 1 : 0;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "CRT1 shall be forced %s\n",
- val ? "ON" : "OFF");
- if(!pSiS->forceCRT1) pSiS->ForceCRT1Type = CRT1_VGA;
+ * This option can be used to force CRT1 (VGA) to be switched on/off. Its
+ * intention is mainly for old monitors that can't be detected
+ * automatically. This is only useful on machines with a video bridge.
+ * In normal cases, this option won't be necessary.
+ */
+ if(pSiS->ForceCRT1Type == CRT1_VGA) {
+ if(xf86GetOptValBool(pSiS->Options, OPTION_FORCECRT1, &val)) {
+ pSiS->forceCRT1 = val ? 1 : 0;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "CRT1 shall be forced %s\n",
+ val ? "ON" : "OFF");
+ }
}
/* ForceCRT2Type (300/315/330 series only)
- * Used for forcing the driver to initialize a given
- * CRT2 device type.
- * (SVIDEO, COMPOSITE and SCART for overriding detection)
- */
- strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_FORCE_CRT2TYPE);
- if(strptr != NULL) {
- if(!xf86NameCmp(strptr,"TV"))
- pSiS->ForceCRT2Type = CRT2_TV;
- else if( (!xf86NameCmp(strptr,"SVIDEO")) ||
- (!xf86NameCmp(strptr,"SVHS")) ) {
- pSiS->ForceCRT2Type = CRT2_TV;
- pSiS->ForceTVType = TV_SVIDEO;
+ * Used for forcing the driver to use a given CRT2 device type.
+ * (SVIDEO, COMPOSITE and SCART for overriding detection)
+ */
+ strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_FORCE_CRT2TYPE);
+ if(strptr != NULL) {
+ if(!xf86NameCmp(strptr,"TV"))
+ pSiS->ForceCRT2Type = CRT2_TV;
+ else if( (!xf86NameCmp(strptr,"SVIDEO")) ||
+ (!xf86NameCmp(strptr,"SVHS")) ) {
+ pSiS->ForceCRT2Type = CRT2_TV;
+ pSiS->ForceTVType = TV_SVIDEO;
} else if( (!xf86NameCmp(strptr,"COMPOSITE")) ||
- (!xf86NameCmp(strptr,"CVBS")) ) {
- pSiS->ForceCRT2Type = CRT2_TV;
- pSiS->ForceTVType = TV_AVIDEO;
+ (!xf86NameCmp(strptr,"CVBS")) ) {
+ pSiS->ForceCRT2Type = CRT2_TV;
+ pSiS->ForceTVType = TV_AVIDEO;
} else if( (!xf86NameCmp(strptr,"COMPOSITE SVIDEO")) || /* Ugly, but shorter than a parsing function */
- (!xf86NameCmp(strptr,"COMPOSITE+SVIDEO")) ||
+ (!xf86NameCmp(strptr,"COMPOSITE+SVIDEO")) ||
(!xf86NameCmp(strptr,"SVIDEO+COMPOSITE")) ||
(!xf86NameCmp(strptr,"SVIDEO COMPOSITE")) ) {
- pSiS->ForceCRT2Type = CRT2_TV;
+ pSiS->ForceCRT2Type = CRT2_TV;
pSiS->ForceTVType = (TV_SVIDEO | TV_AVIDEO);
- } else if(!xf86NameCmp(strptr,"SCART")) {
- pSiS->ForceCRT2Type = CRT2_TV;
- pSiS->ForceTVType = TV_SCART;
- } else if((!xf86NameCmp(strptr,"LCD")) || (!xf86NameCmp(strptr,"DVI-D"))) {
- if(pSiS->ForceCRT1Type == CRT1_VGA) {
- pSiS->ForceCRT2Type = CRT2_LCD;
+ } else if(!xf86NameCmp(strptr,"SCART")) {
+ pSiS->ForceCRT2Type = CRT2_TV;
+ pSiS->ForceTVType = TV_SCART;
+ } else if((!xf86NameCmp(strptr,"LCD")) || (!xf86NameCmp(strptr,"DVI-D"))) {
+ if(pSiS->ForceCRT1Type == CRT1_VGA) {
+ pSiS->ForceCRT2Type = CRT2_LCD;
} else {
pSiS->ForceCRT2Type = 0;
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Can't set both CRT1 and CRT2 type to LCD; CRT2 disabled\n");
}
- } else if((!xf86NameCmp(strptr,"VGA")) ||
- (!xf86NameCmp(strptr,"DVI-A")) ||
+ } else if((!xf86NameCmp(strptr,"VGA")) ||
+ (!xf86NameCmp(strptr,"DVI-A")) ||
(!xf86NameCmp(strptr,"CRT"))) {
- if(pSiS->ForceCRT1Type == CRT1_VGA) {
- pSiS->ForceCRT2Type = CRT2_VGA;
+ 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,"NONE"))
- pSiS->ForceCRT2Type = 0;
+ } else if(!xf86NameCmp(strptr,"NONE"))
+ pSiS->ForceCRT2Type = 0;
else if((!xf86NameCmp(strptr,"DSTN")) && (pSiS->Chipset == PCI_CHIP_SIS550)) {
if(pSiS->ForceCRT1Type == CRT1_VGA) {
pSiS->ForceCRT2Type = CRT2_LCD;
@@ -1136,18 +1174,18 @@ SiSOptions(ScrnInfoPtr pScrn)
#ifdef ENABLE_YPBPR
} else if(!xf86NameCmp(strptr,"HIVISION")) {
pSiS->ForceCRT2Type = CRT2_TV;
- pSiS->ForceTVType = TV_HIVISION;
+ pSiS->ForceTVType = TV_HIVISION;
} else if((!xf86NameCmp(strptr,"YPBPR1080I")) && (pSiS->VGAEngine == SIS_315_VGA)) {
- pSiS->ForceCRT2Type = CRT2_TV;
+ pSiS->ForceCRT2Type = CRT2_TV;
pSiS->ForceTVType = TV_YPBPR;
pSiS->ForceYPbPrType = TV_YPBPR1080I;
} else if(((!xf86NameCmp(strptr,"YPBPR525I")) || (!xf86NameCmp(strptr,"YPBPR480I"))) &&
- (pSiS->VGAEngine == SIS_315_VGA)) {
+ (pSiS->VGAEngine == SIS_315_VGA)) {
pSiS->ForceCRT2Type = CRT2_TV;
pSiS->ForceTVType = TV_YPBPR;
pSiS->ForceYPbPrType = TV_YPBPR525I;
} else if(((!xf86NameCmp(strptr,"YPBPR525P")) || (!xf86NameCmp(strptr,"YPBPR480P"))) &&
- (pSiS->VGAEngine == SIS_315_VGA)) {
+ (pSiS->VGAEngine == SIS_315_VGA)) {
pSiS->ForceCRT2Type = CRT2_TV;
pSiS->ForceTVType = TV_YPBPR;
pSiS->ForceYPbPrType = TV_YPBPR525P;
@@ -1158,9 +1196,9 @@ SiSOptions(ScrnInfoPtr pScrn)
pSiS->ForceYPbPrType = TV_YPBPR750P;
#endif
} else {
- SiS_PrintBadOpt(pScrn, strptr, OPTION_FORCE_CRT2TYPE);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "%s \"LCD\" (=\"DVI-D\"), \"TV\", \"SVIDEO\", \"COMPOSITE\",\n"
+ SiS_PrintBadOpt(pScrn, strptr, OPTION_FORCE_CRT2TYPE);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s \"LCD\" (=\"DVI-D\"), \"TV\", \"SVIDEO\", \"COMPOSITE\",\n"
"\t\"SVIDEO+COMPOSITE\", \"SCART\", \"VGA\" (=\"DVI-A\") or \"NONE\"; on the SiS550\n"
"\talso \"DSTN\" and \"FSTN\""
#ifdef ENABLE_YPBPR
@@ -1171,48 +1209,48 @@ SiSOptions(ScrnInfoPtr pScrn)
"\n", validparm);
}
- if(pSiS->ForceCRT2Type != CRT2_DEFAULT)
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "CRT2 type shall be %s\n", strptr);
- }
+ if(pSiS->ForceCRT2Type != CRT2_DEFAULT)
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "CRT2 type shall be %s\n", strptr);
+ }
if(pSiS->ForceTVType == TV_YPBPR) {
strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_YPBPRAR);
- if(strptr != NULL) {
- if(!xf86NameCmp(strptr,"4:3LB"))
- pSiS->ForceYPbPrAR = TV_YPBPR43LB;
+ if(strptr != NULL) {
+ if(!xf86NameCmp(strptr,"4:3LB"))
+ pSiS->ForceYPbPrAR = TV_YPBPR43LB;
else if(!xf86NameCmp(strptr,"4:3"))
- pSiS->ForceYPbPrAR = TV_YPBPR43;
+ pSiS->ForceYPbPrAR = TV_YPBPR43;
else if(!xf86NameCmp(strptr,"16:9"))
- pSiS->ForceYPbPrAR = TV_YPBPR169;
+ pSiS->ForceYPbPrAR = TV_YPBPR169;
else {
SiS_PrintBadOpt(pScrn, strptr, OPTION_YPBPRAR);
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "%s \"4:3LB\", \"4:3\" and \"16:9\"\n", validparm);
+ "%s \"4:3LB\", \"4:3\" and \"16:9\"\n", validparm);
}
}
}
strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SPECIALTIMING);
- if(strptr != NULL) {
+ if(strptr != NULL) {
int i = 0;
Bool found = FALSE;
if(!xf86NameCmp(strptr,"NONE")) {
- pSiS->SiS_Pr->SiS_CustomT = CUT_FORCENONE;
+ pSiS->SiS_Pr->SiS_CustomT = CUT_FORCENONE;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
"Special timing disabled\n");
} else {
while(mycustomttable[i].chipID != 0) {
- if(!xf86NameCmp(strptr,mycustomttable[i].optionName)) {
+ if(!xf86NameCmp(strptr,mycustomttable[i].optionName)) {
pSiS->SiS_Pr->SiS_CustomT = mycustomttable[i].SpecialID;
found = TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Special timing for %s %s forced\n",
+ "Special timing for %s %s forced\n",
mycustomttable[i].vendorName, mycustomttable[i].cardName);
break;
}
i++;
- }
+ }
if(!found) {
SiS_PrintBadOpt(pScrn, strptr, OPTION_SPECIALTIMING);
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s:\n", validparm);
@@ -1220,33 +1258,55 @@ SiSOptions(ScrnInfoPtr pScrn)
i = 0;
while(mycustomttable[i].chipID != 0) {
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "\t\"%s\" (for %s %s)\n",
+ "\t\"%s\" (for %s %s)\n",
mycustomttable[i].optionName,
mycustomttable[i].vendorName,
mycustomttable[i].cardName);
i++;
}
- }
- }
+ }
+ }
}
/* EnableSiSCtrl */
/* Allow sisctrl tool to change driver settings */
from = X_DEFAULT;
if(xf86GetOptValBool(pSiS->Options, OPTION_ENABLESISCTRL, &val)) {
- if(val) pSiS->enablesisctrl = TRUE;
+ if(val) pSiS->enablesisctrl = TRUE;
from = X_CONFIG;
}
xf86DrvMsg(pScrn->scrnIndex, from, "SiSCtrl utility interface is %s\n",
- pSiS->enablesisctrl ? enabledstr : disabledstr);
+ pSiS->enablesisctrl ? enabledstr : disabledstr);
+
+
+ /* ForceCRT1Aspect, ForceCRT2Aspect */
+ /* Make driver believe that a connected CRT/VGA device is 4:3 ("normal")
+ * or 16:9 ("wide"). Note: This affects only for real VGA (analog)
+ * output devices, not TV or DVI/LCD.
+ */
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_FORCE2ASPECT);
+ if(strptr != NULL) {
+ if(!xf86NameCmp(strptr,"WIDE")) {
+ pSiS->SiS_Pr->SiS_UseWideCRT2 = TRUE;
+ } else if(!xf86NameCmp(strptr,"NORMAL")) {
+ pSiS->SiS_Pr->SiS_UseWideCRT2 = FALSE;
+ } else {
+ SiS_PrintBadOpt(pScrn, strptr, OPTION_FORCE2ASPECT);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s:\n", validparm);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\t\"NORMAL\" or \"WIDE\"\n");
+ }
+ /* Print status later */
+ }
+ }
- /* ScaleLCD (300/315/330 series only)
- * Can be used to force the bridge/panel link to [do|not do] the
+ /* ScaleLCD (300/315/330 series only)
+ * Can be used to force the bridge/panel link to [do|not do] the
* scaling of modes lower than the panel's native resolution.
- * Setting this to TRUE will force the bridge/panel link
+ * Setting this to TRUE will force the bridge/panel link
* to scale; FALSE will rely on the panel's capabilities.
* Not supported on all machines.
- */
+ */
if(xf86GetOptValBool(pSiS->Options, OPTION_SCALELCD, &val)) {
pSiS->UsePanelScaler = val ? 0 : 1;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "LCD scaling is %s\n",
@@ -1254,103 +1314,103 @@ SiSOptions(ScrnInfoPtr pScrn)
}
/* CenterLCD (300/315/330 + SiS video bridge only)
- * If LCD shall not be scaled, this selects whether 1:1 data
+ * If LCD shall not be scaled, this selects whether 1:1 data
* will be sent to the output, or the image shall be centered
* on the LCD. For LVDS panels, screen will always be centered,
* since these have no built-in scaler. For TMDS, this is
* selectable. Non-centered means that the driver will pass
* 1:1 data to the output and that the panel will have to
* scale by itself (if supported by the panel).
- */
+ */
if(xf86GetOptValBool(pSiS->Options, OPTION_CENTERLCD, &val)) {
pSiS->CenterLCD = val ? 1 : 0;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Non-scaled LCD output will %sbe centered\n",
pSiS->CenterLCD ? "not " : "");
}
- /* PanelDelayCompensation (300/315/330 series only)
- * This might be required if the LCD panel shows "small waves"
+ /* PanelDelayCompensation (300/315/330 series only)
+ * This might be required if the LCD panel shows "small waves"
* or wrong colors.
- * The parameter is an integer, (on 300 series usually either
+ * The parameter is an integer, (on 300 series usually either
* 4, 32 or 24; on 315 series + LV bridge usually 3 or 51)
- * Why this option? Simply because SiS did poor BIOS design.
- * The PDC value depends on the very LCD panel used in a
- * particular machine. For most panels, the driver is able
- * to detect the correct value. However, some panels require
- * a different setting. For 300 series, the value given must
+ * Why this option? Simply because SiS did poor BIOS design.
+ * The PDC value depends on the very LCD panel used in a
+ * particular machine. For most panels, the driver is able
+ * to detect the correct value. However, some panels require
+ * a different setting. For 300 series, the value given must
* be within the mask 0x3c. For 661 and later, if must be
* within the range of 0 to 31.
- */
+ */
ival = -1;
- xf86GetOptValInteger(pSiS->Options, OPTION_PDC, &ival);
+ xf86GetOptValInteger(pSiS->Options, OPTION_PDC, &ival);
if(ival != -1) {
pSiS->PDC = ival;
if((pSiS->VGAEngine == SIS_300_VGA) && (pSiS->PDC & ~0x3c)) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Invalid PanelDelayCompensation parameter\n");
- pSiS->PDC = -1;
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Invalid PanelDelayCompensation parameter\n");
+ pSiS->PDC = -1;
} else {
- if(pSiS->VGAEngine == SIS_315_VGA) pSiS->PDC &= 0x1f;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Panel delay compensation shall be %d (for LCD=CRT2)\n",
- pSiS->PDC);
+ if(pSiS->VGAEngine == SIS_315_VGA) pSiS->PDC &= 0x1f;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Panel delay compensation shall be %d (for LCD=CRT2)\n",
+ pSiS->PDC);
}
}
- /* PanelDelayCompensation1 (315 series only)
- * Same as above, but for LCD-via-CRT1 ("LCDA")
- */
+ /* PanelDelayCompensation1 (315/330 series only)
+ * Same as above, but for LCD-via-CRT1 ("LCDA")
+ */
if(pSiS->VGAEngine == SIS_315_VGA) {
ival = -1;
- xf86GetOptValInteger(pSiS->Options, OPTION_PDCA, &ival);
+ xf86GetOptValInteger(pSiS->Options, OPTION_PDCA, &ival);
if(ival != -1) {
- pSiS->PDCA = ival;
- if(pSiS->PDCA > 0x1f) {
+ pSiS->PDCA = ival;
+ if(pSiS->PDCA > 0x1f) {
SiS_PrintIlRange(pScrn, OPTION_PDCA, 0, 31, 0);
- pSiS->PDCA = -1;
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Panel delay compensation shall be %d (for LCD=CRT1)\n",
- pSiS->PDCA);
- }
+ pSiS->PDCA = -1;
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Panel delay compensation shall be %d (for LCD=CRT1)\n",
+ pSiS->PDCA);
+ }
}
}
/* LVDSHL (300/315/330 series + 30xLV bridge only)
- * This might be required if the LCD panel is too dark.
- * The parameter is an integer from 0 to 3.
- */
- if(xf86GetOptValInteger(pSiS->Options, OPTION_LVDSHL, &pSiS->SiS_Pr->LVDSHL)) {
+ * This might be required if the LCD panel is too dark.
+ * The parameter is an integer from 0 to 3.
+ */
+ if(xf86GetOptValInteger(pSiS->Options, OPTION_LVDSHL, &pSiS->SiS_Pr->LVDSHL)) {
if((pSiS->SiS_Pr->LVDSHL < 0) || (pSiS->SiS_Pr->LVDSHL > 3)) {
- SiS_PrintIlRange(pScrn, OPTION_LVDSHL, 0, 3, 0);
- pSiS->SiS_Pr->LVDSHL = -1;
+ SiS_PrintIlRange(pScrn, OPTION_LVDSHL, 0, 3, 0);
+ pSiS->SiS_Pr->LVDSHL = -1;
} else {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "LVDSHL will be %d\n",
- pSiS->SiS_Pr->LVDSHL);
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "LVDSHL will be %d\n",
+ pSiS->SiS_Pr->LVDSHL);
}
}
/* EMI (315/330 series + 302LV/302ELV bridge only)
- * This might be required if the LCD panel loses sync on
+ * This might be required if the LCD panel loses sync on
* mode switches. So far, this problem should not show up
* due to the auto-detection (from reading the values set
* by the BIOS; however, the BIOS values are wrong sometimes
* such as in the case of some Compal machines with a
* 1400x1050, or some Inventec(Compaq) machines with a
* 1280x1024 panel.
- * The parameter is an integer from 0 to 0x60ffffff.
- */
- if(xf86GetOptValInteger(pSiS->Options, OPTION_EMI, &pSiS->EMI)) {
+ * The parameter is an integer from 0 to 0x60ffffff.
+ */
+ if(xf86GetOptValInteger(pSiS->Options, OPTION_EMI, &pSiS->EMI)) {
if((pSiS->EMI < 0) || (pSiS->EMI > 0x60ffffff)) {
- SiS_PrintIlRange(pScrn, OPTION_LVDSHL, 0, 0x60ffffff, 1);
- pSiS->EMI = -1;
+ SiS_PrintIlRange(pScrn, OPTION_LVDSHL, 0, 0x60ffffff, 1);
+ pSiS->EMI = -1;
} else {
- pSiS->EMI &= 0x60ffffff;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "EMI will be 0x%04x\n", pSiS->EMI);
+ pSiS->EMI &= 0x60ffffff;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "EMI will be 0x%04x\n", pSiS->EMI);
}
- }
+ }
/* ForcePanelRGB (300/315/330 series only)
* Can be used to force the bridge/panel link to assume a
@@ -1360,7 +1420,7 @@ SiSOptions(ScrnInfoPtr pScrn)
*/
if(xf86GetOptValInteger(pSiS->Options, OPTION_PRGB, &pSiS->PRGB)) {
if((pSiS->PRGB != 18 && pSiS->PRGB != 24)) {
- pSiS->PRGB = -1;
+ pSiS->PRGB = -1;
SiS_PrintBadOpt(pScrn, strptr, OPTION_PRGB);
} else {
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
@@ -1372,86 +1432,86 @@ SiSOptions(ScrnInfoPtr pScrn)
}
- /* TVStandard (300/315/330 series and 6326 w/ TV only)
- * This option is for overriding the autodetection of
- * the BIOS/Jumper option for PAL / NTSC
- */
+ /* TVStandard (300/315/330 series and 6326 w/ TV only)
+ * This option is for overriding the autodetection of
+ * the BIOS/Jumper option for PAL / NTSC
+ */
if((pSiS->VGAEngine == SIS_300_VGA) ||
- (pSiS->VGAEngine == SIS_315_VGA) ||
- ((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV))) {
- strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_TVSTANDARD);
- if(strptr != NULL) {
- if(!xf86NameCmp(strptr,"PAL"))
- pSiS->OptTVStand = 1;
+ (pSiS->VGAEngine == SIS_315_VGA) ||
+ ((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV))) {
+ strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_TVSTANDARD);
+ if(strptr != NULL) {
+ if(!xf86NameCmp(strptr,"PAL"))
+ pSiS->OptTVStand = 1;
else if((!xf86NameCmp(strptr,"PALM")) ||
- (!xf86NameCmp(strptr,"PAL-M"))) {
- pSiS->OptTVStand = 1;
- pSiS->NonDefaultPAL = 1;
- } else if((!xf86NameCmp(strptr,"PALN")) ||
- (!xf86NameCmp(strptr,"PAL-N"))) {
- pSiS->OptTVStand = 1;
- pSiS->NonDefaultPAL = 0;
+ (!xf86NameCmp(strptr,"PAL-M"))) {
+ pSiS->OptTVStand = 1;
+ pSiS->NonDefaultPAL = 1;
+ } else if((!xf86NameCmp(strptr,"PALN")) ||
+ (!xf86NameCmp(strptr,"PAL-N"))) {
+ pSiS->OptTVStand = 1;
+ pSiS->NonDefaultPAL = 0;
} else if((!xf86NameCmp(strptr,"NTSCJ")) ||
- (!xf86NameCmp(strptr,"NTSC-J"))) {
- pSiS->OptTVStand = 0;
- pSiS->NonDefaultNTSC = 1;
- } else if(!xf86NameCmp(strptr,"NTSC"))
- pSiS->OptTVStand = 0;
+ (!xf86NameCmp(strptr,"NTSC-J"))) {
+ pSiS->OptTVStand = 0;
+ pSiS->NonDefaultNTSC = 1;
+ } else if(!xf86NameCmp(strptr,"NTSC"))
+ pSiS->OptTVStand = 0;
else {
- SiS_PrintBadOpt(pScrn, strptr, OPTION_TVSTANDARD);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "%s \"PAL\", \"PALM\", \"PALN\", \"NTSC\", \"NTSCJ\"\n", validparm);
+ SiS_PrintBadOpt(pScrn, strptr, OPTION_TVSTANDARD);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s \"PAL\", \"PALM\", \"PALN\", \"NTSC\", \"NTSCJ\"\n", validparm);
}
if(pSiS->OptTVStand != -1) {
- static const char *tvstdstr = "TV standard shall be %s\n";
- if(pSiS->Chipset == PCI_CHIP_SIS6326) {
- pSiS->NonDefaultPAL = -1;
+ static const char *tvstdstr = "TV standard shall be %s\n";
+ if(pSiS->Chipset == PCI_CHIP_SIS6326) {
+ pSiS->NonDefaultPAL = -1;
pSiS->NonDefaultNTSC = -1;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, tvstdstr,
- pSiS->OptTVStand ? "PAL" : "NTSC");
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, tvstdstr,
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, tvstdstr,
+ pSiS->OptTVStand ? "PAL" : "NTSC");
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, tvstdstr,
(pSiS->OptTVStand ?
- ( (pSiS->NonDefaultPAL == -1) ? "PAL" :
+ ( (pSiS->NonDefaultPAL == -1) ? "PAL" :
((pSiS->NonDefaultPAL) ? "PALM" : "PALN") ) :
(pSiS->NonDefaultNTSC == -1) ? "NTSC" : "NTSCJ"));
- }
+ }
}
- }
+ }
}
- /* CHTVType (315/330 series + Chrontel only)
- * Used for telling the driver if the TV output shall
- * be 525i YPbPr or SCART.
- */
+ /* CHTVType (315/330 series + Chrontel only)
+ * Used for telling the driver if the TV output shall
+ * be 525i YPbPr or SCART.
+ */
if(pSiS->VGAEngine == SIS_315_VGA) {
- strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CHTVTYPE);
- if(strptr != NULL) {
- if(!xf86NameCmp(strptr,"SCART"))
- pSiS->chtvtype = 1;
- else if(!xf86NameCmp(strptr,"YPBPR525I"))
- pSiS->chtvtype = 0;
+ strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CHTVTYPE);
+ if(strptr != NULL) {
+ if(!xf86NameCmp(strptr,"SCART"))
+ pSiS->chtvtype = 1;
+ else if(!xf86NameCmp(strptr,"YPBPR525I"))
+ pSiS->chtvtype = 0;
else {
- SiS_PrintBadOpt(pScrn, strptr, OPTION_CHTVTYPE);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "%s \"SCART\" or \"YPBPR525I\"\n", validparm);
+ SiS_PrintBadOpt(pScrn, strptr, OPTION_CHTVTYPE);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s \"SCART\" or \"YPBPR525I\"\n", validparm);
}
- if(pSiS->chtvtype != -1)
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Chrontel: TV type shall be %s\n", strptr);
- }
+ if(pSiS->chtvtype != -1)
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Chrontel: TV type shall be %s\n", strptr);
+ }
}
/* CHTVOverscan (300/315/330 series only)
- * CHTVSuperOverscan (300/315/330 series only)
- * These options are for overriding the BIOS option for
- * TV Overscan. Some BIOS don't even have such an option.
- * SuperOverscan is only supported with PAL.
- * Both options are only effective on machines with a
- * CHRONTEL TV encoder. SuperOverscan is only available
- * on the 700x.
- */
+ * CHTVSuperOverscan (300/315/330 series only)
+ * These options are for overriding the BIOS option for
+ * TV Overscan. Some BIOSes don't even have such an option.
+ * SuperOverscan is only supported with PAL.
+ * Both options are only effective on machines with a
+ * CHRONTEL TV encoder. SuperOverscan is only available
+ * on the 700x.
+ */
if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
if(xf86GetOptValBool(pSiS->Options, OPTION_CHTVOVERSCAN, &val)) {
pSiS->OptTVOver = val ? 1 : 0;
@@ -1459,7 +1519,7 @@ SiSOptions(ScrnInfoPtr pScrn)
"Chrontel: TV overscan shall be %s\n",
val ? enabledstr : disabledstr);
}
- if(xf86GetOptValBool(pSiS->Options, OPTION_CHTVSOVERSCAN, &pSiS->OptTVSOver)) {
+ if(xf86GetOptValBool(pSiS->Options, OPTION_CHTVSOVERSCAN, &pSiS->OptTVSOver)) {
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
"Chrontel: TV super overscan shall be %s\n",
pSiS->OptTVSOver ? enabledstr : disabledstr);
@@ -1469,40 +1529,40 @@ SiSOptions(ScrnInfoPtr pScrn)
/* Various parameters for TV output via SiS bridge, Chrontel or SiS6326
*/
if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
- int tmp = 0;
- xf86GetOptValInteger(pSiS->Options, OPTION_CHTVLUMABANDWIDTHCVBS,
- &pSiS->chtvlumabandwidthcvbs);
+ int tmp = 0;
+ xf86GetOptValInteger(pSiS->Options, OPTION_CHTVLUMABANDWIDTHCVBS,
+ &pSiS->chtvlumabandwidthcvbs);
xf86GetOptValInteger(pSiS->Options, OPTION_CHTVLUMABANDWIDTHSVIDEO,
- &pSiS->chtvlumabandwidthsvideo);
+ &pSiS->chtvlumabandwidthsvideo);
xf86GetOptValInteger(pSiS->Options, OPTION_CHTVLUMAFLICKERFILTER,
- &pSiS->chtvlumaflickerfilter);
+ &pSiS->chtvlumaflickerfilter);
xf86GetOptValInteger(pSiS->Options, OPTION_CHTVCHROMABANDWIDTH,
- &pSiS->chtvchromabandwidth);
+ &pSiS->chtvchromabandwidth);
xf86GetOptValInteger(pSiS->Options, OPTION_CHTVCHROMAFLICKERFILTER,
- &pSiS->chtvchromaflickerfilter);
+ &pSiS->chtvchromaflickerfilter);
xf86GetOptValBool(pSiS->Options, OPTION_CHTVCVBSCOLOR,
&pSiS->chtvcvbscolor);
xf86GetOptValInteger(pSiS->Options, OPTION_CHTVTEXTENHANCE,
- &pSiS->chtvtextenhance);
+ &pSiS->chtvtextenhance);
xf86GetOptValInteger(pSiS->Options, OPTION_CHTVCONTRAST,
- &pSiS->chtvcontrast);
+ &pSiS->chtvcontrast);
xf86GetOptValInteger(pSiS->Options, OPTION_SISTVEDGEENHANCE,
- &pSiS->sistvedgeenhance);
+ &pSiS->sistvedgeenhance);
xf86GetOptValInteger(pSiS->Options, OPTION_SISTVSATURATION,
- &pSiS->sistvsaturation);
+ &pSiS->sistvsaturation);
xf86GetOptValInteger(pSiS->Options, OPTION_SISTVLUMAFILTER,
- &pSiS->sistvyfilter);
- if((pSiS->sistvyfilter < 0) || (pSiS->sistvyfilter > 8)) {
+ &pSiS->sistvyfilter);
+ if((pSiS->sistvyfilter < 0) || (pSiS->sistvyfilter > 8)) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "Illegal Y Filter number; valid is 0 (off), 1 (default), 2-8 (filter number 1-7)\n");
+ "Illegal Y Filter number; valid is 0 (off), 1 (default), 2-8 (filter number 1-7)\n");
pSiS->sistvyfilter = 1;
}
- xf86GetOptValBool(pSiS->Options, OPTION_SISTVCHROMAFILTER,
+ xf86GetOptValBool(pSiS->Options, OPTION_SISTVCHROMAFILTER,
&pSiS->sistvcfilter);
xf86GetOptValInteger(pSiS->Options, OPTION_SISTVCOLCALIBCOARSE,
- &pSiS->sistvcolcalibc);
- xf86GetOptValInteger(pSiS->Options, OPTION_SISTVCOLCALIBFINE,
- &pSiS->sistvcolcalibf);
+ &pSiS->sistvcolcalibc);
+ xf86GetOptValInteger(pSiS->Options, OPTION_SISTVCOLCALIBFINE,
+ &pSiS->sistvcolcalibf);
if((pSiS->sistvcolcalibf > 127) || (pSiS->sistvcolcalibf < -128) ||
(pSiS->sistvcolcalibc > 120) || (pSiS->sistvcolcalibc < -120)) {
pSiS->sistvcolcalibf = pSiS->sistvcolcalibc = 0;
@@ -1510,20 +1570,20 @@ SiSOptions(ScrnInfoPtr pScrn)
"Illegal Color Calibration. Range is -128 to 127 (fine), -120 to 120 (coarse)\n");
}
xf86GetOptValInteger(pSiS->Options, OPTION_TVXPOSOFFSET,
- &pSiS->tvxpos);
+ &pSiS->tvxpos);
xf86GetOptValInteger(pSiS->Options, OPTION_TVYPOSOFFSET,
- &pSiS->tvypos);
+ &pSiS->tvypos);
if(pSiS->tvxpos > 32) { pSiS->tvxpos = 32; tmp = 1; }
if(pSiS->tvxpos < -32) { pSiS->tvxpos = -32; tmp = 1; }
if(pSiS->tvypos > 32) { pSiS->tvypos = 32; tmp = 1; }
if(pSiS->tvypos < -32) { pSiS->tvypos = -32; tmp = 1; }
if(tmp) xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Illegal TV x or y offset. Range is from -32 to 32\n");
- tmp = 0;
+ tmp = 0;
xf86GetOptValInteger(pSiS->Options, OPTION_TVXSCALE,
- &pSiS->tvxscale);
+ &pSiS->tvxscale);
xf86GetOptValInteger(pSiS->Options, OPTION_TVYSCALE,
- &pSiS->tvyscale);
+ &pSiS->tvyscale);
if(pSiS->tvxscale > 16) { pSiS->tvxscale = 16; tmp = 1; }
if(pSiS->tvxscale < -16) { pSiS->tvxscale = -16; tmp = 1; }
if(pSiS->tvyscale > 3) { pSiS->tvyscale = 3; tmp = 1; }
@@ -1533,27 +1593,27 @@ SiSOptions(ScrnInfoPtr pScrn)
}
if((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV)) {
- int tmp = 0;
+ int tmp = 0;
strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SIS6326FORCETVPPLUG);
- if(strptr) {
- if(!xf86NameCmp(strptr,"COMPOSITE"))
- pSiS->sis6326tvplug = 1;
- else if(!xf86NameCmp(strptr,"SVIDEO"))
- pSiS->sis6326tvplug = 0;
+ if(strptr) {
+ if(!xf86NameCmp(strptr,"COMPOSITE"))
+ pSiS->sis6326tvplug = 1;
+ else if(!xf86NameCmp(strptr,"SVIDEO"))
+ pSiS->sis6326tvplug = 0;
else {
- SiS_PrintBadOpt(pScrn, strptr, OPTION_SIS6326FORCETVPPLUG);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "%s \"COMPOSITE\" or \"SVIDEO\"\n", validparm);
+ SiS_PrintBadOpt(pScrn, strptr, OPTION_SIS6326FORCETVPPLUG);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s \"COMPOSITE\" or \"SVIDEO\"\n", validparm);
}
}
xf86GetOptValBool(pSiS->Options, OPTION_SIS6326ENABLEYFILTER,
- &pSiS->sis6326enableyfilter);
+ &pSiS->sis6326enableyfilter);
xf86GetOptValBool(pSiS->Options, OPTION_SIS6326YFILTERSTRONG,
- &pSiS->sis6326yfilterstrong);
+ &pSiS->sis6326yfilterstrong);
xf86GetOptValInteger(pSiS->Options, OPTION_TVXPOSOFFSET,
- &pSiS->tvxpos);
+ &pSiS->tvxpos);
xf86GetOptValInteger(pSiS->Options, OPTION_TVYPOSOFFSET,
- &pSiS->tvypos);
+ &pSiS->tvypos);
if(pSiS->tvxpos > 16) { pSiS->tvxpos = 16; tmp = 1; }
if(pSiS->tvxpos < -16) { pSiS->tvxpos = -16; tmp = 1; }
if(pSiS->tvypos > 16) { pSiS->tvypos = 16; tmp = 1; }
@@ -1561,93 +1621,93 @@ SiSOptions(ScrnInfoPtr pScrn)
if(tmp) xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Illegal TV x or y offset. Range is from -16 to 16\n");
xf86GetOptValInteger(pSiS->Options, OPTION_SIS6326FSCADJUST,
- &pSiS->sis6326fscadjust);
+ &pSiS->sis6326fscadjust);
if(pSiS->sis6326fscadjust) {
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Adjusting the default FSC by %d\n",
+ "Adjusting the default FSC by %d\n",
pSiS->sis6326fscadjust);
}
}
if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA) ||
- ((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV))) {
+ ((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV))) {
Bool Is6326 = FALSE;
- strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SISTVANTIFLICKER);
- if(!strptr) {
- strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SIS6326ANTIFLICKER);
+ strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SISTVANTIFLICKER);
+ if(!strptr) {
+ strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_SIS6326ANTIFLICKER);
Is6326 = TRUE;
- }
- if(strptr) {
- if(!xf86NameCmp(strptr,"OFF"))
- pSiS->sistvantiflicker = 0;
- else if(!xf86NameCmp(strptr,"LOW"))
- pSiS->sistvantiflicker = 1;
+ }
+ if(strptr) {
+ if(!xf86NameCmp(strptr,"OFF"))
+ pSiS->sistvantiflicker = 0;
+ else if(!xf86NameCmp(strptr,"LOW"))
+ pSiS->sistvantiflicker = 1;
else if(!xf86NameCmp(strptr,"MED"))
- pSiS->sistvantiflicker = 2;
+ pSiS->sistvantiflicker = 2;
else if(!xf86NameCmp(strptr,"HIGH"))
- pSiS->sistvantiflicker = 3;
+ pSiS->sistvantiflicker = 3;
else if(!xf86NameCmp(strptr,"ADAPTIVE"))
- pSiS->sistvantiflicker = 4;
+ pSiS->sistvantiflicker = 4;
else {
- pSiS->sistvantiflicker = -1;
+ pSiS->sistvantiflicker = -1;
SiS_PrintBadOpt(pScrn, strptr, Is6326 ? OPTION_SIS6326FORCETVPPLUG : OPTION_SISTVANTIFLICKER);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "%s \"OFF\", \"LOW\", \"MED\", \"HIGH\" or \"ADAPTIVE\"\n", validparm);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s \"OFF\", \"LOW\", \"MED\", \"HIGH\" or \"ADAPTIVE\"\n", validparm);
}
}
}
/* CRT2Gamma - enable/disable/set gamma correction for CRT2
- * Since 2004/11/26, this option is a boolean and string option
+ * Since 2004/11/26, this option is a boolean and string option
* simulaniously. "TRUE" (or other valid bool values) have the
* same effect as before: The driver uses the (global) Gamma
* for both CRT1 and CRT2. Otherwise, this option takes one or
* three floats between 0.1 and 10.0 which define a separate
* gamma correction for CRT2. (SiS video bridges only.)
- */
+ */
if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
- if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2GAMMA))) {
- if(SiS_StrIsBoolOff(strptr)) {
- pSiS->CRT2gamma = pSiS->CRT2SepGamma = FALSE;
- } else if(SiS_StrIsBoolOn(strptr)) {
- pSiS->CRT2gamma = TRUE;
+ if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_CRT2GAMMA))) {
+ if(SiS_StrIsBoolOn(strptr)) {
+ pSiS->CRT2gamma = TRUE;
pSiS->CRT2SepGamma = FALSE;
+ } else if(SiS_StrIsBoolOff(strptr)) {
+ pSiS->CRT2gamma = pSiS->CRT2SepGamma = FALSE;
} else {
- if(SiS_EvalOneOrThreeFloats(pScrn, OPTION_CRT2GAMMA, gammaopt, strptr,
- &pSiS->GammaR2i, &pSiS->GammaG2i, &pSiS->GammaB2i)) {
- pSiS->GammaR2 = (float)pSiS->GammaR2i / 1000;
- pSiS->GammaG2 = (float)pSiS->GammaG2i / 1000;
- pSiS->GammaB2 = (float)pSiS->GammaB2i / 1000;
+ if(SiS_EvalOneOrThreeFloats(pScrn, OPTION_CRT2GAMMA, gammaopt, strptr,
+ &pSiS->GammaR2i, &pSiS->GammaG2i, &pSiS->GammaB2i)) {
+ pSiS->GammaR2 = (float)pSiS->GammaR2i / 1000.0;
+ pSiS->GammaG2 = (float)pSiS->GammaG2i / 1000.0;
+ pSiS->GammaB2 = (float)pSiS->GammaB2i / 1000.0;
pSiS->CRT2gamma = TRUE;
if(!IsDHM) pSiS->CRT2SepGamma = TRUE;
else {
#ifdef SISDUALHEAD
pSiS->CRT2SepGamma = FALSE;
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "CRT2Gamma values overrule default and Monitor Gamma\n");
+ "CRT2Gamma values overrule default and Monitor Gamma\n");
if(pScrn->monitor) {
- pScrn->monitor->gamma.red = pSiS->GammaR2;
+ pScrn->monitor->gamma.red = pSiS->GammaR2;
pScrn->monitor->gamma.green = pSiS->GammaG2;
pScrn->monitor->gamma.blue = pSiS->GammaB2;
}
#endif
}
}
- }
- }
+ }
+ }
}
/* 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;
+ if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_XVDEFAULTADAPTOR))) {
+ if(!xf86NameCmp(strptr, "OVERLAY")) {
+ pSiS->XvDefAdaptorBlit = FALSE;
} else if(!xf86NameCmp(strptr, "BLITTER")) {
- pSiS->XvDefAdaptorBlit = TRUE;
+ pSiS->XvDefAdaptorBlit = TRUE;
} else {
- SiS_PrintBadOpt(pScrn, strptr, OPTION_XVDEFAULTADAPTOR);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "%s \"OVERLAY\" or \"BLITTER\"\n", validparm);
+ SiS_PrintBadOpt(pScrn, strptr, OPTION_XVDEFAULTADAPTOR);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s \"OVERLAY\" or \"BLITTER\"\n", validparm);
}
}
}
@@ -1655,13 +1715,14 @@ SiSOptions(ScrnInfoPtr pScrn)
if(xf86GetOptValBool(pSiS->Options, OPTION_XVMEMCPY, &val)) {
pSiS->XvUseMemcpy = val ? TRUE : FALSE;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Xv will %suse memcpy()\n",
- val ? "" : "not ");
+ val ? "" : "not ");
}
+#if defined(__i386__) || defined(__AMD64__) || defined(__amd64__)
if(xf86GetOptValBool(pSiS->Options, OPTION_XVBENCHCPY, &val)) {
pSiS->BenchMemCpy = val ? TRUE : FALSE;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Will %sbenchmark methods for system RAM to video RAM transfers\n",
+ "Will %sbenchmark methods for system RAM to video RAM transfers\n",
val ? "" : "not ");
}
@@ -1673,6 +1734,7 @@ SiSOptions(ScrnInfoPtr pScrn)
val ? "eventually" : "not");
}
#endif
+#endif /* __i386__ || __AMD64__ || __amd64__ */
#ifdef SIS_CP
SIS_CP_OPT_DOOPT
@@ -1687,38 +1749,66 @@ SiSOptions(ScrnInfoPtr pScrn)
pSiS->CRT1gammaGiven = TRUE;
}
+ /* ForceCRT1Aspect, ForceCRT2Aspect */
+ /* Make driver believe that a connected CRT/VGA device is 4:3 ("normal")
+ * or 16:9 ("wide"). Note: This affects only for real VGA (analog)
+ * output devices, not TV or DVI/LCD.
+ */
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_FORCE1ASPECT);
+ if(strptr != NULL) {
+ if(!xf86NameCmp(strptr,"WIDE")) {
+ pSiS->SiS_Pr->SiS_UseWide = 1;
+ } else if(!xf86NameCmp(strptr,"NORMAL")) {
+ pSiS->SiS_Pr->SiS_UseWide = 0;
+ } else {
+ SiS_PrintBadOpt(pScrn, strptr, OPTION_FORCE1ASPECT);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s:\n", validparm);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\t\"NORMAL\" or \"WIDE\"\n");
+ }
+ if(pSiS->SiS_Pr->SiS_UseWide != -1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "CRT1 (VGA) aspect ratio will be assumed %s\n",
+ pSiS->SiS_Pr->SiS_UseWide ? "wide" : "normal");
+ }
+ }
+ if(pSiS->SiS_Pr->SiS_UseWideCRT2 != -1) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "CRT2 (VGA) aspect ratio will be assumed %s\n",
+ pSiS->SiS_Pr->SiS_UseWideCRT2 ? "wide" : "normal");
+ }
+ }
+
/* VESA - DEPRECATED
* This option is for forcing the driver to use
* the VESA BIOS extension for mode switching.
*/
if(xf86GetOptValBool(pSiS->Options, OPTION_VESA, &val)) {
if(IsDHM) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING, baddhm,
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, baddhm,
pSiS->Options[SiS_FIFT(pSiS->Options, OPTION_VESA)].name);
} else {
- pSiS->VESA = val ? 1 : 0;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "VESA: VESA usage shall be %s\n",
+ pSiS->VESA = val ? 1 : 0;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "VESA: VESA usage shall be %s\n",
val ? enabledstr : disabledstr);
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "*** Option \"VESA\" is deprecated. *** \n");
- if(pSiS->VESA) pSiS->ForceCRT1Type = CRT1_VGA;
+ "*** Option \"VESA\" is deprecated. *** \n");
+ if(pSiS->VESA) pSiS->ForceCRT1Type = CRT1_VGA;
}
}
if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
- /* NoInternalModes (300/315/330 series only)
- * Since the mode switching code for these chipsets is a
- * Asm-to-C translation of BIOS code, we only have timings
- * for a pre-defined number of modes. The default behavior
- * is to replace XFree's default modes with a mode list
- * generated out of the known and supported modes. Use
- * this option to disable this. NOT RECOMMENDED.
- */
- if(xf86GetOptValBool(pSiS->Options, OPTION_NOINTERNALMODES, &pSiS->noInternalModes)) {
+ /* InternalModes (300/315/330 series only)
+ * The default behavior is to replace X's default modes with
+ * a mode list generated out of the known and supported modes. Use
+ * this option to disable this. NOT RECOMMENDED.
+ */
+ if(xf86GetOptValBool(pSiS->Options, OPTION_INTERNALMODES, &val)) {
+ pSiS->noInternalModes = val ? FALSE : TRUE;
if(pSiS->noInternalModes) {
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Usage of built-in modes is %s\n", disabledstr);
- }
+ }
}
}
@@ -1728,26 +1818,26 @@ SiSOptions(ScrnInfoPtr pScrn)
if(xf86GetOptValBool(pSiS->Options, OPTION_SHADOW_FB, &pSiS->ShadowFB)) {
#ifdef SISMERGED
if(pSiS->MergedFB) {
- pSiS->ShadowFB = FALSE;
+ pSiS->ShadowFB = FALSE;
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Shadow Framebuffer not supported in MergedFB mode\n");
} else
#endif
- from = X_CONFIG;
+ from = X_CONFIG;
}
if(pSiS->ShadowFB) {
pSiS->NoAccel = TRUE;
#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
pSiS->NoXvideo = TRUE;
- xf86DrvMsg(pScrn->scrnIndex, from,
+ xf86DrvMsg(pScrn->scrnIndex, from,
"Using \"Shadow Framebuffer\" - 2D acceleration and Xv disabled\n");
#else
- xf86DrvMsg(pScrn->scrnIndex, from,
+ xf86DrvMsg(pScrn->scrnIndex, from,
"Using \"Shadow Framebuffer\" - 2D acceleration disabled\n");
#endif
}
- /* Rotate, RotateMouse */
+ /* Rotate */
if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_ROTATE))) {
#ifdef SISMERGED
if(pSiS->MergedFB) {
@@ -1756,31 +1846,63 @@ SiSOptions(ScrnInfoPtr pScrn)
} else
#endif
if(IsDHM) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING, baddhm,
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, baddhm,
pSiS->Options[SiS_FIFT(pSiS->Options, OPTION_ROTATE)].name);
} else if(!xf86NameCmp(strptr, "CW")) {
- pSiS->Rotate = 1;
+ pSiS->Rotate = 1;
} else if(!xf86NameCmp(strptr, "CCW")) {
- pSiS->Rotate = -1;
+ pSiS->Rotate = -1;
} else {
- SiS_PrintBadOpt(pScrn, strptr, OPTION_ROTATE);
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "%s \"CW\" or \"CCW\"\n", validparm);
+ SiS_PrintBadOpt(pScrn, strptr, OPTION_ROTATE);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s \"CW\" or \"CCW\"\n", validparm);
}
if(pSiS->Rotate) {
- pSiS->ShadowFB = TRUE;
- pSiS->NoAccel = TRUE;
- pSiS->HWCursor = FALSE;
+ pSiS->ShadowFB = TRUE;
+ pSiS->NoAccel = TRUE;
+ pSiS->HWCursor = FALSE;
pSiS->NoXvideo = TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Rotating screen %sclockwise (2D acceleration and Xv disabled)\n",
+ "Rotating screen %sclockwise (2D acceleration and Xv disabled)\n",
(pSiS->Rotate == -1) ? "counter " : "");
- if(xf86GetOptValBool(pSiS->Options, OPTION_ROTATEMOUSE, &val)) {
- pSiS->RotateMouse = val ? TRUE : FALSE;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Rotation of mouse movements %s\n", pSiS->RotateMouse ? enabledstr : disabledstr);
- }
+ }
+ }
+
+ /* Reflect */
+ if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_REFLECT))) {
+#ifdef SISMERGED
+ if(pSiS->MergedFB) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Screen reflection not supported in MergedFB mode\n");
+ } else
+#endif
+ if(IsDHM) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, baddhm,
+ pSiS->Options[SiS_FIFT(pSiS->Options, OPTION_REFLECT)].name);
+ } else if(pSiS->Rotate) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "Screen rotation and reflection are mutually exclusive\n");
+ } else if(!xf86NameCmp(strptr, "X")) {
+ pSiS->Reflect = 1;
+ } else if(!xf86NameCmp(strptr, "Y")) {
+ pSiS->Reflect = 2;
+ } else if((!xf86NameCmp(strptr, "XY")) ||
+ (!xf86NameCmp(strptr, "YX"))) {
+ pSiS->Reflect = 3;
+ } else {
+ SiS_PrintBadOpt(pScrn, strptr, OPTION_REFLECT);
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s \"X\", \"Y\" or \"XY\"\n", validparm);
+ }
+
+ if(pSiS->Reflect) {
+ pSiS->ShadowFB = TRUE;
+ pSiS->NoAccel = TRUE;
+ pSiS->HWCursor = FALSE;
+ pSiS->NoXvideo = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Reflecting screen (2D acceleration and Xv disabled)\n");
}
}
@@ -1791,7 +1913,7 @@ SiSOptions(ScrnInfoPtr pScrn)
from = X_CONFIG;
}
xf86DrvMsg(pScrn->scrnIndex, from, "DRI %s\n",
- pSiS->loadDRI ? enabledstr : disabledstr);
+ pSiS->loadDRI ? enabledstr : disabledstr);
/* AGPSize = GARTSize */
if(xf86GetOptValInteger(pSiS->Options, OPTION_AGP_SIZE, &ival)) {
@@ -1803,23 +1925,23 @@ SiSOptions(ScrnInfoPtr pScrn)
}
#endif
- /* NoXVideo
- * Set this to TRUE to disable Xv hardware video acceleration
+ /* XVideo
+ * Set enables/disables Xv hardware video acceleration
*/
#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0)
if((!pSiS->NoAccel) && (!pSiS->NoXvideo)) {
#else
if(!pSiS->NoXvideo) {
#endif
- if(xf86ReturnOptValBool(pSiS->Options, OPTION_NOXVIDEO, FALSE)) {
- pSiS->NoXvideo = TRUE;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "XVideo extension (Xv) disabled\n");
+ if(!xf86ReturnOptValBool(pSiS->Options, OPTION_XVIDEO, TRUE)) {
+ pSiS->NoXvideo = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "XVideo extension (Xv) disabled\n");
}
if(!pSiS->NoXvideo) {
if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
- /* XvOnCRT2
+ /* XvOnCRT2
* On chipsets with only one overlay (315, 650, 740, 330), the user can
* choose to display the overlay on CRT1 or CRT2. By setting this
* option to TRUE, the overlay will be displayed on CRT2. The
@@ -1828,7 +1950,7 @@ SiSOptions(ScrnInfoPtr pScrn)
* Since implementation of the XV_SWITCHCRT Xv property this only
* selects the default CRT.
*/
- if(xf86GetOptValBool(pSiS->Options, OPTION_XVONCRT2, &val)) {
+ if(xf86GetOptValBool(pSiS->Options, OPTION_XVONCRT2, &val)) {
pSiS->XvOnCRT2 = val ? TRUE : FALSE;
}
}
@@ -1839,8 +1961,8 @@ SiSOptions(ScrnInfoPtr pScrn)
* allow the user to disable YV12 support to force the
* application to use YUV2 instead.
*/
- if(xf86GetOptValBool(pSiS->Options, OPTION_NOYV12, &val)) {
- pSiS->NoYV12 = val ? 1 : 0;
+ if(xf86GetOptValBool(pSiS->Options, OPTION_YV12, &val)) {
+ pSiS->NoYV12 = val ? 0 : 1;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
"Xv YV12/I420 support is %s\n",
pSiS->NoYV12 ? disabledstr : enabledstr);
@@ -1848,139 +1970,139 @@ SiSOptions(ScrnInfoPtr pScrn)
}
/* Some Xv properties' defaults can be set by options */
- if(xf86GetOptValInteger(pSiS->Options, OPTION_XVDEFCONTRAST, &ival)) {
- if((ival >= 0) && (ival <= 7)) pSiS->XvDefCon = ival;
- else SiS_PrintIlRange(pScrn, OPTION_XVDEFCONTRAST, 0, 7, 0);
- }
- if(xf86GetOptValInteger(pSiS->Options, OPTION_XVDEFBRIGHTNESS, &ival)) {
- if((ival >= -128) && (ival <= 127)) pSiS->XvDefBri = ival;
- else SiS_PrintIlRange(pScrn, OPTION_XVDEFBRIGHTNESS, -128, 127, 0);
- }
- if(pSiS->VGAEngine == SIS_315_VGA) {
- if(xf86GetOptValInteger(pSiS->Options, OPTION_XVDEFHUE, &ival)) {
- if((ival >= -8) && (ival <= 7)) pSiS->XvDefHue = ival;
- else SiS_PrintIlRange(pScrn, OPTION_XVDEFHUE, -8, 7, 0);
- }
- if(xf86GetOptValInteger(pSiS->Options, OPTION_XVDEFSATURATION, &ival)) {
- if((ival >= -7) && (ival <= 7)) pSiS->XvDefSat = ival;
- else SiS_PrintIlRange(pScrn, OPTION_XVDEFSATURATION, -7, 7, 0);
- }
- }
+ if(xf86GetOptValInteger(pSiS->Options, OPTION_XVDEFCONTRAST, &ival)) {
+ if((ival >= 0) && (ival <= 7)) pSiS->XvDefCon = ival;
+ else SiS_PrintIlRange(pScrn, OPTION_XVDEFCONTRAST, 0, 7, 0);
+ }
+ if(xf86GetOptValInteger(pSiS->Options, OPTION_XVDEFBRIGHTNESS, &ival)) {
+ if((ival >= -128) && (ival <= 127)) pSiS->XvDefBri = ival;
+ else SiS_PrintIlRange(pScrn, OPTION_XVDEFBRIGHTNESS, -128, 127, 0);
+ }
+ if(pSiS->VGAEngine == SIS_315_VGA) {
+ if(xf86GetOptValInteger(pSiS->Options, OPTION_XVDEFHUE, &ival)) {
+ if((ival >= -8) && (ival <= 7)) pSiS->XvDefHue = ival;
+ else SiS_PrintIlRange(pScrn, OPTION_XVDEFHUE, -8, 7, 0);
+ }
+ if(xf86GetOptValInteger(pSiS->Options, OPTION_XVDEFSATURATION, &ival)) {
+ if((ival >= -7) && (ival <= 7)) pSiS->XvDefSat = ival;
+ else SiS_PrintIlRange(pScrn, OPTION_XVDEFSATURATION, -7, 7, 0);
+ }
+ }
if(xf86GetOptValBool(pSiS->Options, OPTION_XVDEFDISABLEGFX, &val)) {
if(val) pSiS->XvDefDisableGfx = TRUE;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Graphics display will be %s during Xv usage\n",
- val ? disabledstr : enabledstr);
- }
+ "Graphics display will be %s during Xv usage\n",
+ val ? disabledstr : enabledstr);
+ }
if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
if(xf86GetOptValBool(pSiS->Options, OPTION_XVDEFDISABLEGFXLR, &val)) {
- if(val) pSiS->XvDefDisableGfxLR = TRUE;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Graphics display left/right of overlay will be %s during Xv usage\n",
+ if(val) pSiS->XvDefDisableGfxLR = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Graphics display left/right of overlay will be %s during Xv usage\n",
val ? disabledstr : enabledstr);
- }
+ }
if(xf86GetOptValBool(pSiS->Options, OPTION_XVDISABLECOLORKEY, &val)) {
- if(val) pSiS->XvDisableColorKey = TRUE;
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Xv Color key is %s\n",
+ if(val) pSiS->XvDisableColorKey = TRUE;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Xv Color key is %s\n",
val ? disabledstr : enabledstr);
- }
+ }
if(xf86GetOptValBool(pSiS->Options, OPTION_XVUSECHROMAKEY, &val)) {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Xv Chroma-keying is %s\n",
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Xv Chroma-keying is %s\n",
val ? enabledstr : disabledstr);
if(val) pSiS->XvUseChromaKey = TRUE;
}
if(xf86GetOptValBool(pSiS->Options, OPTION_XVINSIDECHROMAKEY, &val)) {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Xv: Video is transparent if %s chroma key range\n",
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Xv: Video is transparent if %s chroma key range\n",
val ? "inside" : "outside");
if(val) pSiS->XvInsideChromaKey = TRUE;
}
if(pSiS->VGAEngine == SIS_300_VGA) {
- if(xf86GetOptValBool(pSiS->Options, OPTION_XVYUVCHROMAKEY, &val)) {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Xv: Chroma key is in %s format\n",
+ if(xf86GetOptValBool(pSiS->Options, OPTION_XVYUVCHROMAKEY, &val)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Xv: Chroma key is in %s format\n",
val ? "YUV" : "RGB");
if(val) pSiS->XvYUVChromaKey = TRUE;
}
} else {
- xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4,
+ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4,
"Xv: Chroma key is of same format as video source\n");
}
if(xf86GetOptValInteger(pSiS->Options, OPTION_XVCHROMAMIN, &ival)) {
- if((ival >= 0) && (ival <= 0xffffff)) pSiS->XvChromaMin = ival;
- else SiS_PrintIlRange(pScrn, OPTION_XVCHROMAMIN, 0, 0xffffff, 1);
- }
+ if((ival >= 0) && (ival <= 0xffffff)) pSiS->XvChromaMin = ival;
+ else SiS_PrintIlRange(pScrn, OPTION_XVCHROMAMIN, 0, 0xffffff, 1);
+ }
if(xf86GetOptValInteger(pSiS->Options, OPTION_XVCHROMAMAX, &ival)) {
- if((ival >= 0) && (ival <= 0xffffff)) pSiS->XvChromaMax = ival;
- else SiS_PrintIlRange(pScrn, OPTION_XVCHROMAMAX, 0, 0xffffff, 1);
+ if((ival >= 0) && (ival <= 0xffffff)) pSiS->XvChromaMax = ival;
+ else SiS_PrintIlRange(pScrn, OPTION_XVCHROMAMAX, 0, 0xffffff, 1);
}
- }
+ }
- if(pSiS->VGAEngine == SIS_315_VGA) {
+ 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(SiS_StrIsBoolOff(strptr)) {
+ if(SiS_StrIsBoolOn(strptr)) {
+ pSiS->XvGamma = pSiS->XvGammaGiven = TRUE;
+ } else if(SiS_StrIsBoolOff(strptr)) {
pSiS->XvGamma = FALSE;
pSiS->XvGammaGiven = TRUE;
- } else if(SiS_StrIsBoolOn(strptr)) {
- pSiS->XvGamma = pSiS->XvGammaGiven = TRUE;
- } else {
+ } else {
if(SiS_EvalOneOrThreeFloats(pScrn, OPTION_XVGAMMA, gammaopt, strptr,
- &pSiS->XvGammaRed, &pSiS->XvGammaGreen, &pSiS->XvGammaBlue)) {
+ &pSiS->XvGammaRed, &pSiS->XvGammaGreen, &pSiS->XvGammaBlue)) {
pSiS->XvGamma = pSiS->XvGammaGiven = TRUE;
pSiS->XvGammaRedDef = pSiS->XvGammaRed;
pSiS->XvGammaGreenDef = pSiS->XvGammaGreen;
pSiS->XvGammaBlue = pSiS->XvGammaBlue;
}
- }
- }
- }
+ }
+ }
+ }
}
}
if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) {
Bool GotBri = FALSE, GotPBri = FALSE;
if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_STOREDBRI))) {
- SiS_EvalOneOrThreeFloats(pScrn, OPTION_STOREDBRI, briopt, strptr,
- &pSiS->GammaBriR, &pSiS->GammaBriG, &pSiS->GammaBriB);
+ SiS_EvalOneOrThreeFloats(pScrn, OPTION_STOREDBRI, briopt, strptr,
+ &pSiS->GammaBriR, &pSiS->GammaBriG, &pSiS->GammaBriB);
GotBri = TRUE;
}
if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_STOREDPBRI))) {
- SiS_EvalOneOrThreeFloats(pScrn, OPTION_STOREDPBRI, briopt, strptr,
- &pSiS->GammaPBriR, &pSiS->GammaPBriG, &pSiS->GammaPBriB);
+ SiS_EvalOneOrThreeFloats(pScrn, OPTION_STOREDPBRI, briopt, strptr,
+ &pSiS->GammaPBriR, &pSiS->GammaPBriG, &pSiS->GammaPBriB);
GotPBri = TRUE;
}
if((!IsDHM) || (IsDHM && !IsSecondHead)) {
- if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_STOREDBRI2))) {
+ if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_STOREDBRI2))) {
if(SiS_EvalOneOrThreeFloats(pScrn, OPTION_STOREDBRI2, briopt, strptr,
- &pSiS->GammaBriR2, &pSiS->GammaBriG2, &pSiS->GammaBriB2)) {
- if(IsDHM) {
+ &pSiS->GammaBriR2, &pSiS->GammaBriG2, &pSiS->GammaBriB2)) {
+ if(IsDHM) {
#ifdef SISDUALHEAD
- if(GotBri) SiS_PrintOverruleDHM(pScrn, OPTION_STOREDBRI2, OPTION_STOREDBRI);
+ if(GotBri) SiS_PrintOverruleDHM(pScrn, OPTION_STOREDBRI2, OPTION_STOREDBRI);
pSiS->GammaBriR = pSiS->GammaBriR2;
pSiS->GammaBriG = pSiS->GammaBriG2;
pSiS->GammaBriB = pSiS->GammaBriB2;
#endif
- } else pSiS->CRT2SepGamma = TRUE;
+ } else pSiS->CRT2SepGamma = TRUE;
}
- }
- if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_STOREDPBRI2))) {
+ }
+ if((strptr = (char *)xf86GetOptValString(pSiS->Options, OPTION_STOREDPBRI2))) {
if(SiS_EvalOneOrThreeFloats(pScrn, OPTION_STOREDPBRI2, briopt, strptr,
- &pSiS->GammaPBriR2, &pSiS->GammaPBriG2, &pSiS->GammaPBriB2)) {
- if(IsDHM) {
+ &pSiS->GammaPBriR2, &pSiS->GammaPBriG2, &pSiS->GammaPBriB2)) {
+ if(IsDHM) {
#ifdef SISDUALHEAD
- if(GotPBri) SiS_PrintOverruleDHM(pScrn, OPTION_STOREDPBRI2, OPTION_STOREDPBRI);
- pSiS->GammaPBriR = pSiS->GammaPBriR2;
+ if(GotPBri) SiS_PrintOverruleDHM(pScrn, OPTION_STOREDPBRI2, OPTION_STOREDPBRI);
+ pSiS->GammaPBriR = pSiS->GammaPBriR2;
pSiS->GammaPBriG = pSiS->GammaPBriG2;
pSiS->GammaPBriB = pSiS->GammaPBriB2;
#endif
- } else pSiS->CRT2SepGamma = TRUE;
+ } else pSiS->CRT2SepGamma = TRUE;
}
- }
+ }
}
}
diff --git a/src/sis_regs.h b/src/sis_regs.h
index f4ce227..193375e 100644
--- a/src/sis_regs.h
+++ b/src/sis_regs.h
@@ -1,7 +1,7 @@
/* $XFree86$ */
/* $XdotOrg$ */
/*
- * Register access macros and register definitions
+ * Register access macros and register definitions
*
* Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria
*
@@ -48,7 +48,7 @@
#define SIS_NEED_setSISIDXREG
#define SIS_NEED_setSISIDXREGmask
*/
-
+
/* Video RAM access macros */
/* (Currently, these are use on all platforms; USB2VGA is handled
@@ -98,7 +98,7 @@
UChar __Temp = inSISREG(base); \
outSISREG(base, __Temp | (val)); \
} while (0)
-
+
#define andSISREG(base,val) \
do { \
UChar __Temp = inSISREG(base); \
@@ -115,8 +115,8 @@
do { \
outSISREG(base, idx); \
outSISREG((base)+1, val); \
- } while (0)
-
+ } while (0)
+
#define orSISIDXREG(base,idx,val) \
do { \
UChar __Temp; \
@@ -124,7 +124,7 @@
__Temp = inSISREG((base)+1) | (val); \
outSISREG((base)+1, __Temp); \
} while (0)
-
+
#define andSISIDXREG(base,idx,and) \
do { \
UChar __Temp; \
@@ -132,7 +132,7 @@
__Temp = inSISREG((base)+1) & (and); \
outSISREG((base)+1, __Temp); \
} while (0)
-
+
#define setSISIDXREG(base,idx,and,or) \
do { \
UChar __Temp; \
@@ -148,8 +148,8 @@
__Temp = (inSISREG((base)+1)) & (~(mask));\
__Temp |= ((data) & (mask)); \
outSISREG((base)+1, __Temp); \
- } while(0)
-
+ } while(0)
+
#else /* USEDEVPORT */
extern int sisdevport;
@@ -217,7 +217,7 @@ static void orSISREG(ULong base, UChar val)
lseek(sisdevport, base, SEEK_SET);
read(sisdevport, &tmp, 1);
tmp |= val;
- lseek(sisdevport, base, SEEK_SET);
+ lseek(sisdevport, base, SEEK_SET);
write(sisdevport, &tmp, 1);
}
#endif
@@ -229,7 +229,7 @@ static void andSISREG(ULong base, UChar val)
lseek(sisdevport, base, SEEK_SET);
read(sisdevport, &tmp, 1);
tmp &= val;
- lseek(sisdevport, base, SEEK_SET);
+ lseek(sisdevport, base, SEEK_SET);
write(sisdevport, &tmp, 1);
}
#endif
@@ -256,7 +256,7 @@ static UChar __inSISIDXREG(ULong base, UChar idx)
}
#define inSISIDXREG(base,idx,var) var = __inSISIDXREG(base, idx);
#endif
-
+
#ifdef SIS_NEED_orSISIDXREG
static void orSISIDXREG(ULong base, UChar idx, UChar val)
{
@@ -265,7 +265,7 @@ static void orSISIDXREG(ULong base, UChar idx, UChar val)
write(sisdevport, &idx, 1);
read(sisdevport, &tmp, 1);
tmp |= val;
- lseek(sisdevport, base + 1, SEEK_SET);
+ lseek(sisdevport, base + 1, SEEK_SET);
write(sisdevport, &tmp, 1);
}
#endif
@@ -278,7 +278,7 @@ static void andSISIDXREG(ULong base, UChar idx, UChar val)
write(sisdevport, &idx, 1);
read(sisdevport, &tmp, 1);
tmp &= val;
- lseek(sisdevport, base + 1, SEEK_SET);
+ lseek(sisdevport, base + 1, SEEK_SET);
write(sisdevport, &tmp, 1);
}
#endif
@@ -293,13 +293,13 @@ static void setSISIDXREG(ULong base, UChar idx,
read(sisdevport, &tmp, 1);
tmp &= myand;
tmp |= myor;
- lseek(sisdevport, base + 1, SEEK_SET);
+ lseek(sisdevport, base + 1, SEEK_SET);
write(sisdevport, &tmp, 1);
-}
+}
#endif
-
+
#ifdef SIS_NEED_setSISIDXREGmask
-static void setSISIDXREGmask(ULong base, UChar idx,
+static void setSISIDXREGmask(ULong base, UChar idx,
UChar data, UChar mask)
{
UChar tmp;
@@ -308,7 +308,7 @@ static void setSISIDXREGmask(ULong base, UChar idx,
read(sisdevport, &tmp, 1);
tmp &= ~(mask);
tmp |= (data & mask);
- lseek(sisdevport, base + 1, SEEK_SET);
+ lseek(sisdevport, base + 1, SEEK_SET);
write(sisdevport, &tmp, 1);
}
#endif
@@ -542,30 +542,30 @@ static void setSISIDXREGmask(ULong base, UChar idx,
#define VI_Misc0_Fmt_YVU420P 0x0C /* YUV420 Planar (I420, YV12) */
#define VI_Misc0_Fmt_YUYV 0x28 /* YUYV Packed (=YUY2) */
#define VI_Misc0_Fmt_UYVY 0x08 /* (UYVY) */
-#define VI_Misc0_Fmt_YVYU 0x38 /* (YVYU) (315 series only?) */
+#define VI_Misc0_Fmt_YVYU 0x38 /* (YVYU) (315 series only?) */
#define VI_Misc0_Fmt_NV21 0x5c /* (330 series only?) */
#define VI_Misc0_Fmt_NV12 0x4c /* (330 series only?) */
-#define VI_Misc0_ChromaKeyRGBYUV 0x40 /* 300 series only: 0 = RGB, 1 = YUV */
+#define VI_Misc0_ChromaKeyRGBYUV 0x40 /* 300 series only: 0 = RGB, 1 = YUV */
/* Bits for Index_VI_Control_Misc1 */
-#define VI_Misc1_DisableGraphicsAtOverlay 0x01 /* Disables graphics display in overlay area */
+#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
#define VI_Misc1_Field_Mode 0x08 /* ? Assume even/odd fields interleaved in memory ? */
-#define VI_Misc1_Non_Interleave 0x10 /* ? Odd and Even fields are not interleaved ? */
+#define VI_Misc1_Non_Interleave 0x10 /* ? Odd and Even fields are not interleaved ? */
#define VI_Misc1_Buf_Addr_Lock 0x20 /* 315 series only? */
-/* #define VI_Misc1_? 0x40 */
-/* #define VI_Misc1_? 0x80 */
+/* #define VI_Misc1_? 0x40 */
+/* #define VI_Misc1_? 0x80 */
/* 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) */
+#define VI_Misc2_DisableGraphics 0x04 /* Disable graphics display entirely (<= 650 only, not >= M650, 651) */
#define VI_Misc2_Vertical_Interpol 0x08
-#define VI_Misc2_Dual_Line_Merge 0x10 /* dual-overlay chips only; "dual video windows relative line buffer merge" */
-#define VI_Misc2_All_Line_Merge 0x20 /* > 315 only */
+#define VI_Misc2_Dual_Line_Merge 0x10 /* dual-overlay chips only; "dual video windows relative line buffer merge" */
+#define VI_Misc2_All_Line_Merge 0x20 /* > 315 only */
#define VI_Misc2_Auto_Flip_Enable 0x40
-#define VI_Misc2_Video_Reg_Write_Enable 0x80 /* 315 series only? */
+#define VI_Misc2_Video_Reg_Write_Enable 0x80 /* 315 series only? */
/* Bits for Index_VI_Control_Misc3 */
#define VI_Misc3_Submit_Video_1 0x01 /* AKA "address ready" */
@@ -576,11 +576,11 @@ static void setSISIDXREGmask(ULong base, UChar idx,
#define VI_ROP_Never 0x00
#define VI_ROP_DestKey 0x03
#define VI_ROP_ChromaKey 0x05
-#define VI_ROP_NotChromaKey 0x0A
+#define VI_ROP_NotChromaKey 0x0A
#define VI_ROP_Always 0x0F
-/* Video registers (6326 and 530/620) --------------- */
+/* Video registers (559x, 6326 and 530/620) --------------- */
#define Index_VI6326_Passwd 0x80
/* Video overlay horizontal start/end, unit=screen pixels */
diff --git a/src/sis_setup.c b/src/sis_setup.c
index 08564f7..c2271cc 100644
--- a/src/sis_setup.c
+++ b/src/sis_setup.c
@@ -32,7 +32,7 @@
* Ideas and methods for old series based on code by Can-Ru Yeou, SiS Inc.
*
*/
-
+
#include "sis.h"
#define SIS_NEED_inSISREGW
#define SIS_NEED_inSISREGL
@@ -45,25 +45,26 @@
extern int SiSMclk(SISPtr pSiS);
static const char *dramTypeStr[] = {
- "Fast Page DRAM",
- "2 cycle EDO RAM",
- "1 cycle EDO RAM",
- "SDRAM/SGRAM",
- "SDR SDRAM",
- "SGRAM",
- "ESDRAM",
+ "Fast Page DRAM",
+ "2 cycle EDO RAM",
+ "1 cycle EDO RAM",
+ "SDRAM/SGRAM",
+ "SDR SDRAM",
+ "SGRAM",
+ "ESDRAM",
"DDR SDRAM", /* for 550/650/etc */
"DDR SDRAM", /* for 550/650/etc */
"VCM", /* for 630 */
- "DDR2 SDRAM",
- "" };
-
+ "DDR2 SDRAM", /* for 340 */
+ ""
+};
+
/* 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 */
- { 9, 11, 12, 13, 15, 16, 5, 7 }, /* 2 cycle EDO */
- { 10, 12, 14, 16, 17, 18, 19, 7 } /* ? (Not 1 cycle EDO) */
+ { 10, 12, 14, 16, 17, 18, 19, 7 }, /* SGRAM */
+ { 4, 6, 8, 10, 11, 12, 13, 3 }, /* Fast Page */
+ { 9, 11, 12, 13, 15, 16, 5, 7 }, /* 2 cycle EDO */
+ { 10, 12, 14, 16, 17, 18, 19, 7 } /* ? (Not 1 cycle EDO) */
};
static const struct _sis6326mclk {
@@ -95,7 +96,7 @@ static const struct _sis6326mclk {
};
/* For old chipsets, 5597, 6326, 530/620 */
-static void
+static void
sisOldSetup(ScrnInfoPtr pScrn)
{
SISPtr pSiS = SISPTR(pScrn);
@@ -111,12 +112,12 @@ sisOldSetup(ScrnInfoPtr pScrn)
pciConfigPtr pdptr, *systemPCIdevices = NULL;
if(pSiS->oldChipset <= OC_SIS6225) {
- inSISIDXREG(SISSR, 0x0F, temp);
+ inSISIDXREG(SISSR, 0x0F, temp);
pScrn->videoRam = (1 << (temp & 0x03)) * 1024;
if(pScrn->videoRam > 4096) pScrn->videoRam = 4096;
pSiS->BusWidth = 32;
} else if(pSiS->Chipset == PCI_CHIP_SIS5597) {
- inSISIDXREG(SISSR, 0x2F, temp);
+ inSISIDXREG(SISSR, 0x2F, temp);
pScrn->videoRam = ((temp & 0x07) + 1) * 256;
inSISIDXREG(SISSR, 0x0C, temp);
if(temp & 0x06) {
@@ -124,62 +125,64 @@ sisOldSetup(ScrnInfoPtr pScrn)
pSiS->BusWidth = 64;
} else pSiS->BusWidth = 32;
} else {
- inSISIDXREG(SISSR, 0x0C, temp);
- config = ((temp & 0x10) >> 2 ) | ((temp & 0x06) >> 1);
- pScrn->videoRam = ramsize[config] * 1024;
- pSiS->BusWidth = buswidth[config];
+ inSISIDXREG(SISSR, 0x0C, temp);
+ config = ((temp & 0x10) >> 2 ) | ((temp & 0x06) >> 1);
+ pScrn->videoRam = ramsize[config] * 1024;
+ pSiS->BusWidth = buswidth[config];
}
if(pSiS->Chipset == PCI_CHIP_SIS530) {
- inSISIDXREG(SISSR, 0x0D, temp);
+ inSISIDXREG(SISSR, 0x0D, temp);
pSiS->Flags &= ~(UMA);
if(temp & 0x01) {
pSiS->Flags |= UMA; /* Shared fb mode */
- inSISIDXREG(SISSR, 0x10, temp);
- pSiS->MemClock = clockTable[temp & 0x03] * 1000;
- } else pSiS->MemClock = SiSMclk(pSiS); /* Local fb mode */
+ inSISIDXREG(SISSR, 0x10, temp);
+ pSiS->MemClock = clockTable[temp & 0x03] * 1000;
+ } else {
+ pSiS->MemClock = SiSMclk(pSiS); /* Local fb mode */
+ }
} else if(pSiS->Chipset == PCI_CHIP_SIS6326) {
- inSISIDXREG(SISSR,0x0e,temp);
-
- i = temp & 0x03;
+ inSISIDXREG(SISSR,0x0e,temp);
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "DRAM type: %s\n",
+ i = temp & 0x03;
+
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "DRAM type: %s\n",
dramTypeStr[ramtype[i]]);
- temp = (temp >> 5) & 0x07;
- i = SiS6326MCLKIndex[i][temp];
- pSiS->MemClock = SiS6326MCLK[i].mclk;
+ temp = (temp >> 5) & 0x07;
+ i = SiS6326MCLKIndex[i][temp];
+ pSiS->MemClock = SiS6326MCLK[i].mclk;
#if 0
- /* Correct invalid MCLK settings by old BIOSes */
- newsr13 = SiS6326MCLK[i].sr13;
- newsr28 = SiS6326MCLK[i].sr28;
- newsr29 = SiS6326MCLK[i].sr29;
- if((pSiS->ChipRev == 0x92) ||
- (pSiS->ChipRev == 0xd1) ||
- (pSiS->ChipRev == 0xd2)) {
- if(pSiS->MemClock == 60) {
- newsr28 = 0xae;
- newsr29 = 0xc4;
- }
- }
+ /* Correct invalid MCLK settings by old BIOSes */
+ newsr13 = SiS6326MCLK[i].sr13;
+ newsr28 = SiS6326MCLK[i].sr28;
+ newsr29 = SiS6326MCLK[i].sr29;
+ if((pSiS->ChipRev == 0x92) ||
+ (pSiS->ChipRev == 0xd1) ||
+ (pSiS->ChipRev == 0xd2)) {
+ if(pSiS->MemClock == 60) {
+ newsr28 = 0xae;
+ newsr29 = 0xc4;
+ }
+ }
#endif
- pSiS->MemClock *= 1000;
+ pSiS->MemClock *= 1000;
#if 0
- inSISIDXREG(SISSR, 0x13, temp);
- temp &= 0x80;
- temp |= (newsr13 & 0x80);
- outSISIDXREG(SISSR,0x13,temp);
- outSISIDXREG(SISSR,0x28,newsr28);
- outSISIDXREG(SISSR,0x29,newsr29);
+ inSISIDXREG(SISSR, 0x13, temp);
+ temp &= 0x80;
+ temp |= (newsr13 & 0x80);
+ outSISIDXREG(SISSR,0x13,temp);
+ outSISIDXREG(SISSR,0x28,newsr28);
+ outSISIDXREG(SISSR,0x29,newsr29);
#endif
} else {
- pSiS->MemClock = SiSMclk(pSiS);
+ pSiS->MemClock = SiSMclk(pSiS);
}
@@ -188,8 +191,8 @@ sisOldSetup(ScrnInfoPtr pScrn)
inSISIDXREG(SISSR, 0x23, sr23);
inSISIDXREG(SISSR, 0x33, sr33);
if(pSiS->oldChipset >= OC_SIS530A) sr33 &= ~0x08;
- if(sr33 & 0x09) { /* 5597: Sync DRAM timing | One cycle EDO ram; */
- pSiS->Flags |= (sr33 & SYNCDRAM); /* 6326: Enable SGRam timing | One cycle EDO ram */
+ if(sr33 & 0x09) { /* 5597: Sync DRAM timing | One cycle EDO ram; */
+ pSiS->Flags |= (sr33 & SYNCDRAM); /* 6326: Enable SGRam timing | One cycle EDO ram */
pSiS->Flags |= RAMFLAG; /* 530: Enable SGRAM timing | reserved (0) */
} else if((pSiS->oldChipset < OC_SIS530A) && (sr23 & 0x20)) {
pSiS->Flags |= SYNCDRAM; /* 5597, 6326: EDO DRAM enabled */
@@ -201,10 +204,10 @@ sisOldSetup(ScrnInfoPtr pScrn)
if(pSiS->oldChipset == OC_SIS530A) {
if((systemPCIdevices = xf86GetPciConfigInfo())) {
i = 0;
- while((pdptr = systemPCIdevices[i])) {
- if((pdptr->pci_vendor == 0x1274) &&
- ((pdptr->pci_device == 0x5000) ||
- ((pdptr->pci_device & 0xFFF0) == 0x1370))) {
+ while((pdptr = systemPCIdevices[i])) {
+ if((pdptr->pci_vendor == 0x1274) &&
+ ((pdptr->pci_device == 0x5000) ||
+ ((pdptr->pci_device & 0xFFF0) == 0x1370))) {
pSiS->Flags |= ESS137xPRESENT;
break;
}
@@ -213,42 +216,42 @@ sisOldSetup(ScrnInfoPtr pScrn)
}
if(pSiS->Flags & ESS137xPRESENT) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "SiS530/620: Found ESS device\n");
+ "SiS530/620: Found ESS device\n");
}
}
}
pSiS->Flags &= ~(SECRETFLAG);
if(pSiS->oldChipset >= OC_SIS5597) {
- inSISIDXREG(SISSR, 0x37, sr37);
+ inSISIDXREG(SISSR, 0x37, sr37);
if(sr37 & 0x80) pSiS->Flags |= SECRETFLAG;
}
pSiS->Flags &= ~(A6326REVAB);
if(pSiS->Chipset == PCI_CHIP_SIS6326) {
if(((pSiS->ChipRev & 0x0f) == 0x0a) ||
- ((pSiS->ChipRev & 0x0f) == 0x0b)) {
+ ((pSiS->ChipRev & 0x0f) == 0x0b)) {
pSiS->Flags |= A6326REVAB;
}
}
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Memory clock: %3.3f MHz\n",
+ "Memory clock: %3.3f MHz\n",
pSiS->MemClock/1000.0);
if(pSiS->oldChipset > OC_SIS6225) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "DRAM bus width: %d bit\n",
+ "DRAM bus width: %d bit\n",
pSiS->BusWidth);
}
#ifdef TWDEBUG
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "oldChipset = %d, Flags %x\n", pSiS->oldChipset, pSiS->Flags);
-#endif
+ "oldChipset = %d, Flags %x\n", pSiS->oldChipset, pSiS->Flags);
+#endif
}
-static void
+static void
sis300Setup(ScrnInfoPtr pScrn)
{
SISPtr pSiS = SISPTR(pScrn);
@@ -272,14 +275,14 @@ sis300Setup(ScrnInfoPtr pScrn)
switch(pSiS->Chipset) {
case PCI_CHIP_SIS300:
- pScrn->videoRam = ((config & 0x3F) + 1) * 1024;
- pSiS->BusWidth = cpubuswidth;
+ pScrn->videoRam = ((config & 0x3F) + 1) * 1024;
+ pSiS->BusWidth = cpubuswidth;
pSiS->IsAGPCard = ((sr3a & 0x30) == 0x30) ? FALSE : TRUE;
break;
case PCI_CHIP_SIS540:
case PCI_CHIP_SIS630:
- pSiS->IsAGPCard = TRUE;
- pciconfig = pciReadByte(0x00000000, 0x63);
+ pSiS->IsAGPCard = TRUE;
+ pciconfig = pciReadByte(0x00000000, 0x63);
if(pciconfig & 0x80) {
pScrn->videoRam = (1 << (((pciconfig & 0x70) >> 4) + 21)) / 1024;
pSiS->BusWidth = 64;
@@ -291,7 +294,7 @@ sis300Setup(ScrnInfoPtr pScrn)
ramtype = pciReadByte(0x00000000,0x65);
ramtype &= 0x03;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Shared Memory Area is on DIMM%d\n", ramtype);
+ "Shared Memory Area is on DIMM%d\n", ramtype);
ramtype = pciReadByte(0x00000000,(0x60 + ramtype));
if(ramtype & 0x80) ramtype = 9;
else ramtype = 4;
@@ -305,41 +308,41 @@ sis300Setup(ScrnInfoPtr pScrn)
}
break;
default:
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Internal error: sis300setup() called with invalid chipset!\n");
pSiS->BusWidth = 64;
from = X_INFO;
}
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "DRAM type: %s\n",
+ "DRAM type: %s\n",
dramTypeStr[ramtype]);
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Memory clock: %3.3f MHz\n",
- pSiS->MemClock/1000.0);
+ "Memory clock: %3.3f MHz\n",
+ pSiS->MemClock/1000.0);
if(pSiS->Chipset == PCI_CHIP_SIS300) {
if(pSiS->ChipRev > 0x13) {
- inSISIDXREG(SISSR, 0x3A, temp);
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "(Adapter assumes MCLK being %d Mhz)\n",
+ inSISIDXREG(SISSR, 0x3A, temp);
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "(Adapter assumes MCLK being %d Mhz)\n",
adaptermclk300[(temp & 0x07)]);
}
} else {
inSISIDXREG(SISSR, 0x1A, temp);
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "(Adapter assumes MCLK being %d Mhz)\n",
+ "(Adapter assumes MCLK being %d Mhz)\n",
adaptermclk[(temp & 0x07)]);
}
-
+
xf86DrvMsg(pScrn->scrnIndex, from,
- "DRAM bus width: %d bit\n",
+ "DRAM bus width: %d bit\n",
pSiS->BusWidth);
}
/* For 315, 315H, 315PRO/E, 330, 340 */
-static void
+static void
sis315Setup(ScrnInfoPtr pScrn)
{
SISPtr pSiS = SISPTR(pScrn);
@@ -348,14 +351,14 @@ sis315Setup(ScrnInfoPtr pScrn)
int busDDRA[4] = {64+32, 64+32 , (64+32)*2, (64+32)*2};
unsigned int config, config1, config2, sr3a, cr5f;
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",
@@ -363,16 +366,17 @@ sis315Setup(ScrnInfoPtr pScrn)
"Dual channel SDR SDRAM",
"Dual channel SDR SGRAM",
"Dual channel DDR SDRAM",
- "Dual channel DDR SGRAM"};
+ "Dual channel DDR SGRAM"
+ };
char *dramTypeStr330[] = {
- "Single Channel SDR SDRAM",
- "",
- "Single Channel DDR SDRAM",
- "",
- "--unknown--",
- "",
- "--unknown--",
- "",
+ "Single Channel SDR SDRAM",
+ "",
+ "Single Channel DDR SDRAM",
+ "",
+ "--unknown--",
+ "",
+ "--unknown--",
+ "",
"Asymetric Dual Channel SDR SDRAM",
"",
"Asymetric Dual Channel DDR SDRAM",
@@ -380,16 +384,17 @@ sis315Setup(ScrnInfoPtr pScrn)
"Dual channel SDR SDRAM",
"",
"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",
- "",
+ "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",
@@ -397,137 +402,140 @@ sis315Setup(ScrnInfoPtr pScrn)
"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;
-
+
inSISIDXREG(SISSR, 0x3a, sr3a);
config2 = sr3a & 0x03;
-
+
inSISIDXREG(SISCR,0x5f,cr5f);
pScrn->videoRam = (1 << ((config & 0xf0) >> 4)) * 1024;
- if(pSiS->Chipset == PCI_CHIP_SIS340) {
-
+ switch(pSiS->Chipset) {
+
+ case 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);
+ 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 { /* 315, USB 315 */
-
- pSiS->IsAGPCard = ((sr3a & 0x30) == 0x30) ? FALSE : TRUE;
-
- if(cr5f & 0x10) pSiS->ChipFlags |= SiSCF_Is315E;
+ "DRAM type: %s\n", dramTypeStr340[(config1 * 4) + (config2 & 0x03)]);
- /* If SINGLE_CHANNEL_2_RANK or DUAL_CHANNEL_1_RANK -> mem * 2 */
- if((config1 == 0x01) || (config1 == 0x03)) {
- pScrn->videoRam <<= 1;
- }
+ pSiS->MemClock = SiSMclk(pSiS);
- /* If DDR asymetric -> mem * 1,5 */
- 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,
- "Memory clock: %3.3f MHz\n",
- pSiS->MemClock/1000.0);
-
- /* 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);
+ inSISIDXREG(SISSR,0x39,config);
config = (config & 0x02) >> 1;
} else config &= 0x01;
-
+
if(config) {
- pSiS->MemClock *= 2; /* DDR2 ? */
- pSiS->BusWidth = 32;
+ pSiS->MemClock *= 2; /* DDR2 ? */
+ pSiS->BusWidth = 32; /* DDR2 ? */
} else {
- pSiS->BusWidth = 64;
+ pSiS->BusWidth = 64;
}
-
- } else if(pSiS->Chipset == PCI_CHIP_SIS330) {
-
+
+ break;
+
+ case 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)]);
+
+ pSiS->MemClock = SiSMclk(pSiS);
+
if(config2 & 0x02) {
- pSiS->MemClock *= 2;
+ pSiS->MemClock *= 2;
if(config1 == 0x02) {
pSiS->BusWidth = busDDRA[0];
} else {
pSiS->BusWidth = busDDR[(config & 0x02)];
}
} else {
- if(config1 == 0x02) {
+ if(config1 == 0x02) {
pSiS->BusWidth = busDDRA[2];
} else {
- pSiS->BusWidth = busSDR[(config & 0x02)];
+ pSiS->BusWidth = busSDR[(config & 0x02)];
}
}
-
- } else { /* 315 */
-
+
+ break;
+
+ default: /* 315 */
+
+ pSiS->IsAGPCard = ((sr3a & 0x30) == 0x30) ? FALSE : TRUE;
+
+ if(cr5f & 0x10) pSiS->ChipFlags |= SiSCF_Is315E;
+
+ /* If SINGLE_CHANNEL_2_RANK or DUAL_CHANNEL_1_RANK -> mem * 2 */
+ if((config1 == 0x01) || (config1 == 0x03)) pScrn->videoRam <<= 1;
+
+ /* If DDR asymetric -> mem * 1,5 */
+ 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);
+
+ /* If DDR -> memclock * 2 */
if(config2 & 0x02) pSiS->MemClock *= 2;
+
if(config1 == 0x02)
- pSiS->BusWidth = busDDRA[(config & 0x03)];
+ pSiS->BusWidth = busDDRA[(config & 0x03)];
else if(config2 & 0x02)
- pSiS->BusWidth = busDDR[(config & 0x03)];
+ pSiS->BusWidth = busDDR[(config & 0x03)];
else
- pSiS->BusWidth = busSDR[(config & 0x03)];
+ pSiS->BusWidth = busSDR[(config & 0x03)];
+
+ if(pSiS->ChipFlags & SiSCF_Is315E) {
+ inSISIDXREG(SISSR,0x15,config);
+ if(config & 0x10) pSiS->BusWidth = 32;
+ }
- if(pSiS->ChipFlags & SiSCF_Is315E) {
- inSISIDXREG(SISSR,0x15,config);
- if(config & 0x10) pSiS->BusWidth = 32;
- }
-
}
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "DRAM bus width: %d bit\n",
- pSiS->BusWidth);
+ "Memory clock: %3.3f MHz\n",
+ pSiS->MemClock/1000.0);
+
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "DRAM bus width: %d bit\n",
+ pSiS->BusWidth);
}
-/* For 550, 65x, 740, 661, 741, 660, 760 */
-static void
+/* For 550, 65x, 740, 661, 741, 660, 760, 761 */
+static void
sis550Setup(ScrnInfoPtr pScrn)
{
SISPtr pSiS = SISPTR(pScrn);
unsigned int config, ramtype=0, i;
CARD8 pciconfig, temp;
Bool alldone = FALSE;
+ Bool ddrtimes2 = TRUE;
pSiS->IsAGPCard = TRUE;
- pSiS->ChipFlags &= ~SiSCF_760UMA;
+ pSiS->ChipFlags &= ~(SiSCF_760UMA | SiSCF_760LFB);
pSiS->MemClock = SiSMclk(pSiS);
@@ -535,24 +543,26 @@ sis550Setup(ScrnInfoPtr pScrn)
if(pSiS->sishw_ext.jChipType >= SIS_660) {
- /* UMA - shared fb */
- pciconfig = pciReadByte(0x00000000, 0x4c);
+ /* UMA - shared fb */
+ pScrn->videoRam = 0;
+ pciconfig = pciReadByte(0x00000000, 0x4c);
if(pciconfig & 0xe0) {
pScrn->videoRam = (1 << (((pciconfig & 0xe0) >> 5) - 2)) * 32768;
pSiS->ChipFlags |= SiSCF_760UMA;
+ pSiS->SiS76xUMASize = pScrn->videoRam * 1024;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "%dK shared video RAM (UMA)\n",
+ "%dK shared video RAM (UMA)\n",
pScrn->videoRam);
- } else pScrn->videoRam = 0;
+ }
/* LFB - local framebuffer: PCI reg hold total RAM (but configurable in BIOS) */
pciconfig = pciReadByte(0x00000800, 0xcd);
- pciconfig = (pciconfig >> 1) & 0x03;
- i = 0;
+ 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);
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "%dK total local video RAM (LFB)\n", i);
}
/* LFB: CR78 holds amount of LFB memory configured in the BIOS setup */
@@ -563,16 +573,17 @@ sis550Setup(ScrnInfoPtr pScrn)
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;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "%dK configured local video RAM (LFB)\n", i);
+ pScrn->videoRam += i;
pSiS->ChipFlags |= SiSCF_760LFB;
+ pSiS->SiS76xLFBSize = i * 1024;
}
}
if((pScrn->videoRam < 32768) || (pScrn->videoRam > 131072)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Illegal video RAM size (%dK) detected, using BIOS provided setting\n",
- pScrn->videoRam);
+ "Illegal video RAM size (%dK) detected, using BIOS provided setting\n",
+ pScrn->videoRam);
pSiS->ChipFlags &= ~(SiSCF_760LFB | SiSCF_760UMA);
} else {
pSiS->BusWidth = 64;
@@ -580,50 +591,39 @@ sis550Setup(ScrnInfoPtr pScrn)
alldone = TRUE;
}
- } else {
+ } else { /* 661, 741 */
- int dimmnum;
+ int dimmnum;
- if(pSiS->sishw_ext.jChipType == SIS_741) {
+ if(pSiS->sishw_ext.jChipType == SIS_741) {
dimmnum = 4;
- } else { /* 661 */
+ } else {
dimmnum = 3;
}
pciconfig = pciReadByte(0x00000000, 0x64);
- if(pciconfig & 0x80) {
- pScrn->videoRam = (1 << (((pciconfig & 0x70) >> 4) - 1)) * 32768;
+ if(pciconfig & 0x80) {
+ pScrn->videoRam = (1 << (((pciconfig & 0x70) >> 4) - 1)) * 32768;
if((pScrn->videoRam < 32768) || (pScrn->videoRam > (128 * 1024))) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Illegal video RAM size (%dK) detected, using BIOS provided setting\n",
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Illegal video RAM size (%dK) detected, using BIOS-provided info\n",
pScrn->videoRam);
} else {
- pSiS->BusWidth = 64;
- for(i=0; i<=(dimmnum - 1); i++) {
- if(pciconfig & (1 << i)) {
+ pSiS->BusWidth = 64;
+ for(i = 0; i <= (dimmnum - 1); i++) {
+ if(pciconfig & (1 << i)) {
temp = pciReadByte(0x00000000, 0x60 + i);
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "DIMM%d is %s SDRAM\n",
- i, (temp & 0x40) ? "DDR" : "SDR");
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "DIMM%d is not installed\n", i);
- }
- }
- pciconfig = pciReadByte(0x00000000, 0x7c);
- ramtype = (pciconfig & 0x02) ? 8 : 4;
-#if 0
- if(pSiS->sishw_ext.jChipType == SIS_741) {
- /* 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(SISCR, 0x79, config);
- ramtype = (config & 0x01) ? 8 : 4;
+ "DIMM%d is %s SDRAM\n",
+ i, (temp & 0x40) ? "DDR" : "SDR");
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "DIMM%d is not installed\n", i);
+ }
}
-#endif
- alldone = TRUE;
+ pciconfig = pciReadByte(0x00000000, 0x7c);
+ ramtype = (pciconfig & 0x02) ? 8 : 4;
+ alldone = TRUE;
}
}
@@ -642,8 +642,8 @@ sis550Setup(ScrnInfoPtr pScrn)
"DIMM%d is %s SDRAM\n",
i, (temp & 0x40) ? "DDR" : "SDR");
} else {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "DIMM%d is not installed\n", i);
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "DIMM%d is not installed\n", i);
}
}
pciconfig = pciReadByte(0x00000000, 0x7c);
@@ -669,58 +669,85 @@ sis550Setup(ScrnInfoPtr pScrn)
}
/* Fall back to BIOS detection results in case of problems: */
-
+
if(!alldone) {
+ pSiS->SiS76xLFBSize = pSiS->SiS76xUMASize = 0;
+
if(pSiS->Chipset == PCI_CHIP_SIS660) {
- inSISIDXREG(SISCR, 0x79, config);
+ inSISIDXREG(SISCR, 0x79, config);
pSiS->BusWidth = (config & 0x04) ? 128 : 64;
- ramtype = (config & 0x01) ? 8 : 4;
+ ramtype = (config & 0x01) ? 8 : 4;
if(pSiS->sishw_ext.jChipType >= SIS_660) {
pScrn->videoRam = 0;
if(config & 0xf0) {
- pScrn->videoRam = (1 << ((config & 0xf0) >> 4)) * 1024;
+ pScrn->videoRam = (1 << ((config & 0xf0) >> 4)) * 1024;
pSiS->ChipFlags |= SiSCF_760UMA;
+ pSiS->SiS76xUMASize = pScrn->videoRam * 1024;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "%dK shared video RAM (UMA)\n",
+ pScrn->videoRam);
}
inSISIDXREG(SISCR, 0x78, config);
config &= 0x30;
if(config) {
- if(config == 0x10) pScrn->videoRam += 32768;
- else pScrn->videoRam += 65536;
+ if(config == 0x10) {
+ pScrn->videoRam += 32768;
+ pSiS->SiS76xLFBSize = 32768 * 1024;
+ } else {
+ pScrn->videoRam += 65536;
+ pSiS->SiS76xLFBSize = 65536 * 1024;
+ }
pSiS->ChipFlags |= SiSCF_760LFB;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "%dK configured local video RAM (LFB)\n",
+ pSiS->SiS76xLFBSize / 1024);
}
} else {
pScrn->videoRam = (1 << ((config & 0xf0) >> 4)) * 1024;
}
} else {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Shared Memory Area is disabled - awaiting doom\n");
- inSISIDXREG(SISSR, 0x14, config);
- pScrn->videoRam = (((config & 0x3F) + 1) * 4) * 1024;
- if(pSiS->Chipset == PCI_CHIP_SIS650) {
- ramtype = (((config & 0x80) >> 7) << 2) + 4;
+ inSISIDXREG(SISSR, 0x14, config);
+ pScrn->videoRam = (((config & 0x3F) + 1) * 4) * 1024;
+ if(pSiS->Chipset == PCI_CHIP_SIS650) {
+ ramtype = (((config & 0x80) >> 7) << 2) + 4;
pSiS->BusWidth = 64; /* (config & 0x40) ? 128 : 64; */
- } else {
- ramtype = 4;
+ } else {
+ ramtype = 4;
pSiS->BusWidth = 64;
- }
+ }
}
}
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "DRAM type: %s\n",
- dramTypeStr[ramtype]);
+ /* These need special attention: Memory controller in CPU, hence
+ * - no DDR * 2 for bandwidth calculation,
+ * - overlay magic (bandwidth dependent one/two overlay stuff)
+ */
+ if((pSiS->sishw_ext.jChipType >= SIS_760) && (pSiS->sishw_ext.jChipType <= SIS_770)) {
+ if(!(pSiS->ChipFlags & SiSCF_760LFB)) {
+ ddrtimes2 = FALSE;
+ pSiS->SiS_SD2_Flags |= SiS_SD2_SUPPORT760OO;
+ }
+ }
+
+ /* DDR -> Mclk * 2 - needed for bandwidth calculation */
+ if(ddrtimes2) {
+ if(ramtype == 8) pSiS->MemClock *= 2;
+ }
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Memory clock: %3.3f MHz\n",
- pSiS->MemClock/1000.0);
+ "DRAM type: %s\n",
+ dramTypeStr[ramtype]);
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "DRAM bus width: %d bit\n",
- pSiS->BusWidth);
+ "Memory clock: %3.3f MHz\n",
+ pSiS->MemClock/1000.0);
- /* DDR -> Mclk * 2 - needed for bandwidth calculation */
- if(ramtype == 8) pSiS->MemClock *= 2;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "DRAM bus width: %d bit\n",
+ pSiS->BusWidth);
}
void
@@ -730,6 +757,7 @@ SiSSetup(ScrnInfoPtr pScrn)
pSiS->Flags = 0;
pSiS->VBFlags = 0;
+ pSiS->SiS76xLFBSize = pSiS->SiS76xUMASize = 0;
switch (SISPTR(pScrn)->Chipset) {
case PCI_CHIP_SIS300:
@@ -746,7 +774,7 @@ SiSSetup(ScrnInfoPtr pScrn)
break;
case PCI_CHIP_SIS550:
case PCI_CHIP_SIS650: /* + 740,M650,651 */
- case PCI_CHIP_SIS660: /* + (M)661,(M)741,(M)760 */
+ case PCI_CHIP_SIS660: /* + (M)661,(M)741,(M)760(GX), (M)761(GX), 770? */
sis550Setup(pScrn);
break;
case PCI_CHIP_SIS5597:
diff --git a/src/sis_shadow.c b/src/sis_shadow.c
index 223d131..8f2483b 100644
--- a/src/sis_shadow.c
+++ b/src/sis_shadow.c
@@ -32,7 +32,9 @@
#include "servermd.h"
void SISPointerMoved(int index, int x, int y);
+void SISPointerMovedReflect(int index, int x, int y);
void SISRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
+void SISRefreshAreaReflect(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
void SISRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
void SISRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
void SISRefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox);
@@ -52,17 +54,37 @@ SISPointerMoved(int index, int x, int y)
}
void
+SISPointerMovedReflect(int index, int x, int y)
+{
+ ScrnInfoPtr pScrn = xf86Screens[index];
+ SISPtr pSiS = SISPTR(pScrn);
+
+ switch(pSiS->Reflect) {
+ case 1: /* x */
+ (*pSiS->PointerMoved)(index, pScrn->pScreen->width - x - 1, y);
+ break;
+ case 2: /* y */
+ (*pSiS->PointerMoved)(index, x, pScrn->pScreen->height - y - 1);
+ break;
+ case 3: /* x + y */
+ (*pSiS->PointerMoved)(index, pScrn->pScreen->width - x - 1, pScrn->pScreen->height - y - 1);
+ }
+}
+
+/* Refresh area (unreflected, unrotated */
+
+void
SISRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
{
SISPtr pSiS = SISPTR(pScrn);
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);
@@ -73,10 +95,117 @@ SISRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
dst += FBPitch;
src += pSiS->ShadowPitch;
}
-
+
pbox++;
}
-}
+}
+
+/* RefreshArea for reflection */
+
+void
+SISRefreshAreaReflect(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
+{
+ SISPtr pSiS = SISPTR(pScrn);
+ int width, height, Bpp, FBPitch, twidth;
+ CARD8 *src, *dst, *tdst, *tsrc;
+ CARD16 *tdst16, *tsrc16;
+ CARD32 *tdst32, *tsrc32;
+
+ 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;
+ switch(pSiS->Reflect) {
+ case 1: /* x */
+ dst += (pbox->y1 * FBPitch) + ((pScrn->displayWidth - pbox->x1 - 1) * Bpp);
+ switch(Bpp) {
+ case 1:
+ while(height--) {
+ tdst = dst;
+ tsrc = src;
+ twidth = width;
+ while(twidth--) *tdst-- = *tsrc++;
+ dst += FBPitch;
+ src += pSiS->ShadowPitch;
+ }
+ break;
+ case 2:
+ width >>= 1;
+ while(height--) {
+ tdst16 = (CARD16 *)dst;
+ tsrc16 = (CARD16 *)src;
+ twidth = width;
+ while(twidth--) *tdst16-- = *tsrc16++;
+ dst += FBPitch;
+ src += pSiS->ShadowPitch;
+ }
+ break;
+ case 4:
+ width >>= 2;
+ while(height--) {
+ tdst32 = (CARD32 *)dst;
+ tsrc32 = (CARD32 *)src;
+ twidth = width;
+ while(twidth--) *tdst32-- = *tsrc32++;
+ dst += FBPitch;
+ src += pSiS->ShadowPitch;
+ }
+ }
+ break;
+ case 2: /* y */
+ dst += ((pScrn->virtualY - pbox->y1 - 1) * FBPitch) + (pbox->x1 * Bpp);
+ while(height--) {
+ SiSMemCopyToVideoRam(pSiS, dst, src, width);
+ dst -= FBPitch;
+ src += pSiS->ShadowPitch;
+ }
+ break;
+ case 3: /* x + y */
+ dst += ((pScrn->virtualY - pbox->y1 - 1) * FBPitch) + ((pScrn->displayWidth - pbox->x1 - 1) * Bpp);
+ switch(Bpp) {
+ case 1:
+ while(height--) {
+ tdst = dst;
+ tsrc = src;
+ twidth = width;
+ while(twidth--) *tdst-- = *tsrc++;
+ dst -= FBPitch;
+ src += pSiS->ShadowPitch;
+ }
+ break;
+ case 2:
+ width >>= 1;
+ while(height--) {
+ tdst16 = (CARD16 *)dst;
+ tsrc16 = (CARD16 *)src;
+ twidth = width;
+ while(twidth--) *tdst16-- = *tsrc16++;
+ dst -= FBPitch;
+ src += pSiS->ShadowPitch;
+ }
+ break;
+ case 4:
+ width >>= 2;
+ while(height--) {
+ tdst32 = (CARD32 *)dst;
+ tsrc32 = (CARD32 *)src;
+ twidth = width;
+ while(twidth--) *tdst32-- = *tsrc32++;
+ dst -= FBPitch;
+ src += pSiS->ShadowPitch;
+ }
+ break;
+ }
+ }
+ pbox++;
+ }
+}
+
+/* RefreshArea()s for rotation */
void
SISRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
@@ -108,9 +237,9 @@ SISRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
dst = (CARD32 *)dstPtr;
count = height;
while(count--) {
- *(dst++) = src[0] |
- (src[srcPitch] << 8) |
- (src[srcPitch * 2] << 16) |
+ *(dst++) = src[0] |
+ (src[srcPitch] << 8) |
+ (src[srcPitch * 2] << 16) |
(src[srcPitch * 3] << 24);
src += (srcPitch * 4);
}
@@ -120,7 +249,7 @@ SISRefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
pbox++;
}
-}
+}
void
SISRefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
@@ -194,23 +323,23 @@ SISRefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox)
dst = (CARD32 *)dstPtr;
count = height;
while(count--) {
- dst[0] = src[0] |
- (src[1] << 8) |
+ dst[0] = src[0] |
+ (src[1] << 8) |
(src[2] << 16) |
- (src[srcPitch] << 24);
- dst[1] = src[srcPitch + 1] |
+ (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 * 2) + 1] << 24);
+ dst[2] = src[(srcPitch * 2) + 2] |
(src[srcPitch * 3] << 8) |
(src[(srcPitch * 3) + 1] << 16) |
- (src[(srcPitch * 3) + 2] << 24);
+ (src[(srcPitch * 3) + 2] << 24);
dst += 3;
src += (srcPitch << 2);
}
srcPtr += pSiS->Rotate * 3;
- dstPtr += dstPitch;
+ dstPtr += dstPitch;
}
pbox++;
diff --git a/src/sis_vb.c b/src/sis_vb.c
index 87f26e0..b5dcb52 100644
--- a/src/sis_vb.c
+++ b/src/sis_vb.c
@@ -28,7 +28,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Author: Thomas Winischhofer <thomas@winischhofer.net>
- *
+ *
*/
#include "sis.h"
@@ -69,7 +69,7 @@ typedef struct _SiS_LCD_StStruct
static const SiS_LCD_StStruct SiS300_LCD_Type[]=
{
- { VB_LCD_1024x768, 1024, 768 }, /* 0 - invalid */
+ { 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 */
@@ -101,8 +101,8 @@ static const SiS_LCD_StStruct SiS315_LCD_Type[]=
{ 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_640x480_2, 640, 480 }, /* c FSTN */
+ { VB_LCD_640x480_3, 640, 480 }, /* d FSTN */
{ VB_LCD_320x480, 320, 480 }, /* e */
{ VB_LCD_CUSTOM, 0, 0 } /* f */
};
@@ -172,7 +172,7 @@ 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) {
@@ -190,7 +190,7 @@ SiS_SISDetectCRT1(ScrnInfoPtr pScrn)
outSISIDXREG(SISCR, 0x57, 0x00);
#ifdef TWDEBUG
xf86DrvMsg(0, X_INFO, "330: Found CRT1: %s\n", (temp == 1) ? "yes" : "no");
-#endif
+#endif
}
if(temp == 0xffff) {
@@ -203,7 +203,7 @@ SiS_SISDetectCRT1(ScrnInfoPtr pScrn)
if(TestDDC1(pScrn)) temp = 1;
}
}
-
+
if((temp) && (temp != 0xffff)) {
orSISIDXREG(SISCR,0x32,0x20);
ret = 1;
@@ -228,16 +228,19 @@ void SISCRT1PreInit(ScrnInfoPtr pScrn)
{
SISPtr pSiS = SISPTR(pScrn);
UChar CR32;
- UChar CRT1Detected = 0;
UChar OtherDevices = 0;
+ pSiS->CRT1Detected = FALSE;
+
if(!(pSiS->VBFlags & VB_VIDEOBRIDGE)) {
+ pSiS->CRT1Detected = TRUE;
pSiS->CRT1off = 0;
return;
}
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
+ pSiS->CRT1Detected = TRUE;
pSiS->CRT1off = 0;
return;
}
@@ -245,6 +248,7 @@ void SISCRT1PreInit(ScrnInfoPtr pScrn)
#ifdef SISMERGED
if((pSiS->MergedFB) && (!(pSiS->MergedFBAuto))) {
+ pSiS->CRT1Detected = TRUE;
pSiS->CRT1off = 0;
return;
}
@@ -254,33 +258,33 @@ void SISCRT1PreInit(ScrnInfoPtr pScrn)
if(pSiS->sishw_ext.jChipType >= SIS_330) {
/* Works reliably on 330 and later */
- CRT1Detected = SiS_SISDetectCRT1(pScrn);
+ pSiS->CRT1Detected = SiS_SISDetectCRT1(pScrn);
} else {
- if(CR32 & 0x20) CRT1Detected = 1;
- else CRT1Detected = SiS_SISDetectCRT1(pScrn);
+ if(CR32 & 0x20) pSiS->CRT1Detected = TRUE;
+ else pSiS->CRT1Detected = SiS_SISDetectCRT1(pScrn);
}
- if(CR32 & 0x5F) OtherDevices = 1;
+ if(CR32 & 0x5F) OtherDevices = 1;
if(pSiS->CRT1off == -1) {
- if(!CRT1Detected) {
+ if(!pSiS->CRT1Detected) {
- /* No CRT1 detected. */
+ /* No CRT1 detected. */
/* If other devices exist, switch it off */
if(OtherDevices) pSiS->CRT1off = 1;
else pSiS->CRT1off = 0;
} else {
- /* CRT1 detected, leave/switch it on */
+ /* CRT1 detected, leave/switch it on */
pSiS->CRT1off = 0;
}
}
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "%sCRT1/VGA detected\n",
- CRT1Detected ? "" : "No ");
+ "%sCRT1/VGA detected\n",
+ pSiS->CRT1Detected ? "" : "No ");
}
/* Detect CRT2-LCD and LCD size */
@@ -288,7 +292,7 @@ void SISLCDPreInit(ScrnInfoPtr pScrn, Bool quiet)
{
SISPtr pSiS = SISPTR(pScrn);
UChar CR32, CR36, CR37, CR7D=0, tmp;
-
+
pSiS->VBFlags &= ~(CRT2_LCD);
pSiS->VBLCDFlags = 0;
pSiS->LCDwidth = 0;
@@ -297,9 +301,9 @@ void SISLCDPreInit(ScrnInfoPtr pScrn, Bool quiet)
if(!(pSiS->VBFlags & VB_VIDEOBRIDGE)) return;
inSISIDXREG(SISCR, 0x32, CR32);
-
+
if(CR32 & 0x08) pSiS->VBFlags |= CRT2_LCD;
-
+
/* If no panel has been detected by the BIOS during booting,
* we try to detect it ourselves at this point. We do that
* if forcecrt2redetection was given, too.
@@ -312,7 +316,7 @@ void SISLCDPreInit(ScrnInfoPtr pScrn, Bool quiet)
* and VGA2 share the same DDC channel and might be misdetected
* as the wrong type (especially if the LCD panel only supports
* EDID Version 1).
- * Addendum: For DVI-I connected panels, this is not ideal.
+ * Addendum: For DVI-I connected panels, this is not ideal.
* Therefore, we disregard an eventually detected secondary
* VGA if the user forced CRT2 type to LCD.
*
@@ -325,42 +329,42 @@ void SISLCDPreInit(ScrnInfoPtr pScrn, Bool quiet)
*/
#ifdef SISDUALHEAD
if((!pSiS->DualHeadMode) || (!pSiS->SecondHead)) {
-#endif
+#endif
if((pSiS->VGAEngine == SIS_315_VGA) &&
- (pSiS->VBFlags & VB_SISTMDSBRIDGE) &&
- (!(pSiS->VBFlags & VB_30xBDH)) &&
+ (pSiS->VBFlags & VB_SISTMDSBRIDGE) &&
+ (!(pSiS->VBFlags & VB_30xBDH)) &&
(pSiS->VESA != 1)) {
- if(pSiS->forcecrt2redetection) {
- pSiS->VBFlags &= ~CRT2_LCD;
+ if(pSiS->forcecrt2redetection) {
+ pSiS->VBFlags &= ~CRT2_LCD;
/* Do NOT clear CR32[D3] here! */
- }
+ }
- if(!(pSiS->nocrt2ddcdetection)) {
- if((!(pSiS->VBFlags & CRT2_LCD)) &&
- ( (!(CR32 & 0x10)) ||
+ if(!(pSiS->nocrt2ddcdetection)) {
+ if((!(pSiS->VBFlags & CRT2_LCD)) &&
+ ( (!(CR32 & 0x10)) ||
(pSiS->ForceCRT2Type == CRT2_LCD) ) ) {
- if(!quiet) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "%s LCD/plasma panel, sensing via DDC\n",
+ if(!quiet) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s LCD/plasma panel, sensing via DDC\n",
pSiS->forcecrt2redetection ?
"(Re)-detecting" : "BIOS detected no");
}
- if(SiS_SenseLCDDDC(pSiS->SiS_Pr, pSiS)) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "DDC error during LCD panel detection\n");
- } else {
- inSISIDXREG(SISCR, 0x32, CR32);
- if(CR32 & 0x08) {
- pSiS->VBFlags |= CRT2_LCD;
+ if(SiS_SenseLCDDDC(pSiS->SiS_Pr, pSiS)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "DDC error during LCD panel detection\n");
+ } else {
+ inSISIDXREG(SISCR, 0x32, CR32);
+ if(CR32 & 0x08) {
+ pSiS->VBFlags |= CRT2_LCD;
pSiS->postVBCR32 |= 0x08;
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "No LCD/plasma panel detected\n");
- }
- }
- }
- }
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "No LCD/plasma panel detected\n");
+ }
+ }
+ }
+ }
}
#ifdef SISDUALHEAD
@@ -371,7 +375,7 @@ void SISLCDPreInit(ScrnInfoPtr pScrn, Bool quiet)
inSISIDXREG(SISCR, 0x36, CR36);
if(pSiS->VGAEngine == SIS_300_VGA) {
if(pSiS->VBFlags & VB_301) {
- if((CR36 & 0x0f) < 0x0f) CR36 &= 0xf7;
+ if((CR36 & 0x0f) < 0x0f) CR36 &= 0xf7;
}
}
if(pSiS->PRGB != -1) {
@@ -387,12 +391,12 @@ void SISLCDPreInit(ScrnInfoPtr pScrn, Bool quiet)
}
inSISIDXREG(SISCR, 0x37, CR37);
if(pSiS->sishw_ext.jChipType < SIS_661) {
- inSISIDXREG(SISCR, 0x3C, CR7D);
+ inSISIDXREG(SISCR, 0x3C, CR7D);
} else {
- inSISIDXREG(SISCR, 0x7D, CR7D);
+ inSISIDXREG(SISCR, 0x7D, CR7D);
}
if(pSiS->SiS_Pr->SiS_CustomT == CUT_BARCO1366) {
- pSiS->VBLCDFlags |= VB_LCD_BARCO1366;
+ pSiS->VBLCDFlags |= VB_LCD_BARCO1366;
pSiS->LCDwidth = 1360;
pSiS->LCDheight = 1024;
if(CR37 & 0x10) pSiS->VBLCDFlags |= VB_LCD_EXPANDING;
@@ -403,34 +407,41 @@ void SISLCDPreInit(ScrnInfoPtr pScrn, Bool quiet)
(CR37 & 0x10) ? "" : "non-",
(CR37 & 0x01) ? 18 : 24);
} else if(pSiS->SiS_Pr->SiS_CustomT == CUT_PANEL848) {
- pSiS->VBLCDFlags |= VB_LCD_848x480;
+ pSiS->VBLCDFlags |= VB_LCD_848x480;
pSiS->LCDwidth = pSiS->SiS_Pr->CP_MaxX = 848;
pSiS->LCDheight = pSiS->SiS_Pr->CP_MaxY = 480;
pSiS->VBLCDFlags |= VB_LCD_EXPANDING;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
- "Assuming LCD/plasma panel (848x480, expanding, RGB24)\n");
+ "Assuming LCD/plasma panel (848x480, expanding, RGB24)\n");
+ } else if(pSiS->FSTN) {
+ pSiS->VBLCDFlags |= VB_LCD_320x240;
+ pSiS->LCDwidth = pSiS->SiS_Pr->CP_MaxX = 320;
+ pSiS->LCDheight = pSiS->SiS_Pr->CP_MaxY = 240;
+ pSiS->VBLCDFlags &= ~VB_LCD_EXPANDING;
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
+ "Assuming FSTN LCD panel (320x240, non-expanding)\n");
} else {
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);
+ 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");
+ "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);
+ 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);
@@ -438,25 +449,25 @@ void SISLCDPreInit(ScrnInfoPtr pScrn, Bool quiet)
}
if((CR36 & 0x0f) == 0x0f) {
pSiS->VBLCDFlags |= VB_LCD_CUSTOM;
- pSiS->LCDheight = pSiS->SiS_Pr->CP_MaxY;
+ 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 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_MaxX, pSiS->SiS_Pr->CP_MaxY,
pSiS->SiS_Pr->CP_PreferredX, pSiS->SiS_Pr->CP_PreferredY,
(CR37 & 0x01) ? 18 : 24);
} else {
if(pSiS->VGAEngine == SIS_300_VGA) {
- pSiS->VBLCDFlags |= SiS300_LCD_Type[(CR36 & 0x0f)].VBLCD_lcdflag;
- pSiS->LCDheight = SiS300_LCD_Type[(CR36 & 0x0f)].LCDheight;
- pSiS->LCDwidth = SiS300_LCD_Type[(CR36 & 0x0f)].LCDwidth;
- if(CR37 & 0x10) pSiS->VBLCDFlags |= VB_LCD_EXPANDING;
+ pSiS->VBLCDFlags |= SiS300_LCD_Type[(CR36 & 0x0f)].VBLCD_lcdflag;
+ pSiS->LCDheight = SiS300_LCD_Type[(CR36 & 0x0f)].LCDheight;
+ pSiS->LCDwidth = SiS300_LCD_Type[(CR36 & 0x0f)].LCDwidth;
+ if(CR37 & 0x10) pSiS->VBLCDFlags |= VB_LCD_EXPANDING;
} else if((pSiS->sishw_ext.jChipType >= SIS_661) || (pSiS->ROM661New)) {
- pSiS->VBLCDFlags |= SiS661_LCD_Type[(CR36 & 0x0f)].VBLCD_lcdflag;
- pSiS->LCDheight = SiS661_LCD_Type[(CR36 & 0x0f)].LCDheight;
- pSiS->LCDwidth = SiS661_LCD_Type[(CR36 & 0x0f)].LCDwidth;
- if(CR37 & 0x10) pSiS->VBLCDFlags |= VB_LCD_EXPANDING;
+ pSiS->VBLCDFlags |= SiS661_LCD_Type[(CR36 & 0x0f)].VBLCD_lcdflag;
+ pSiS->LCDheight = SiS661_LCD_Type[(CR36 & 0x0f)].LCDheight;
+ pSiS->LCDwidth = SiS661_LCD_Type[(CR36 & 0x0f)].LCDwidth;
+ if(CR37 & 0x10) pSiS->VBLCDFlags |= VB_LCD_EXPANDING;
if(pSiS->sishw_ext.jChipType < SIS_661) {
if(!(pSiS->SiS_Pr->PanelSelfDetected)) {
inSISIDXREG(SISCR,0x35,tmp);
@@ -464,11 +475,11 @@ void SISLCDPreInit(ScrnInfoPtr pScrn, Bool quiet)
CR37 |= (tmp & 0x01);
}
}
- } else {
- pSiS->VBLCDFlags |= SiS315_LCD_Type[(CR36 & 0x0f)].VBLCD_lcdflag;
- pSiS->LCDheight = SiS315_LCD_Type[(CR36 & 0x0f)].LCDheight;
- pSiS->LCDwidth = SiS315_LCD_Type[(CR36 & 0x0f)].LCDwidth;
- if(CR37 & 0x10) pSiS->VBLCDFlags |= VB_LCD_EXPANDING;
+ } else {
+ pSiS->VBLCDFlags |= SiS315_LCD_Type[(CR36 & 0x0f)].VBLCD_lcdflag;
+ pSiS->LCDheight = SiS315_LCD_Type[(CR36 & 0x0f)].LCDheight;
+ pSiS->LCDwidth = SiS315_LCD_Type[(CR36 & 0x0f)].LCDwidth;
+ if(CR37 & 0x10) pSiS->VBLCDFlags |= VB_LCD_EXPANDING;
}
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"Detected LCD/plasma panel (%dx%d, %d, %sexp., RGB%d [%02x%02x%02x])\n",
@@ -484,15 +495,15 @@ void SISLCDPreInit(ScrnInfoPtr pScrn, Bool quiet)
}
void SiSSetupPseudoPanel(ScrnInfoPtr pScrn)
-{
- SISPtr pSiS = SISPTR(pScrn);
+{
+ SISPtr pSiS = SISPTR(pScrn);
int i;
-
+
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"No LCD detected, but forced to enable digital output\n");
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Will not be able to properly filter display modes!\n");
-
+
pSiS->VBFlags |= CRT2_LCD;
pSiS->SiS_Pr->SiS_CustomT = CUT_UNKNOWNLCD;
pSiS->SiS_Pr->CP_PrefClock = 0;
@@ -514,7 +525,7 @@ void SISTVPreInit(ScrnInfoPtr pScrn, Bool quiet)
SISPtr pSiS = SISPTR(pScrn);
UChar SR16, SR38, CR32, CR35=0, CR38=0, CR79, CR39;
int temp = 0;
-
+
if(!(pSiS->VBFlags & VB_VIDEOBRIDGE)) return;
inSISIDXREG(SISCR, 0x32, CR32);
@@ -522,7 +533,7 @@ void SISTVPreInit(ScrnInfoPtr pScrn, Bool quiet)
inSISIDXREG(SISSR, 0x16, SR16);
inSISIDXREG(SISSR, 0x38, SR38);
switch(pSiS->VGAEngine) {
- case SIS_300_VGA:
+ case SIS_300_VGA:
if(pSiS->Chipset == PCI_CHIP_SIS630) temp = 0x35;
break;
case SIS_315_VGA:
@@ -534,8 +545,8 @@ void SISTVPreInit(ScrnInfoPtr pScrn, Bool quiet)
}
#ifdef TWDEBUG
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "(vb.c: SISTVPreInit 1: CR32=%02x SR16=%02x SR38=%02x VBFlags 0x%x)\n",
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "(vb.c: SISTVPreInit 1: CR32=%02x SR16=%02x SR38=%02x VBFlags 0x%x)\n",
CR32, SR16, SR38, pSiS->VBFlags);
#endif
@@ -639,11 +650,11 @@ void SISTVPreInit(ScrnInfoPtr pScrn, Bool quiet)
pSiS->VBFlags |= TV_NTSC;
}
}
-
+
#ifdef TWDEBUG
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"(vb.c: SISTVPreInit 2: VBFlags 0x%x)\n", pSiS->VBFlags);
-#endif
+#endif
if((pSiS->VBFlags & (TV_SCART|TV_SVIDEO|TV_AVIDEO)) && !quiet) {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected default TV standard %s\n",
@@ -667,21 +678,21 @@ void SISTVPreInit(ScrnInfoPtr pScrn, Bool quiet)
(pSiS->VBFlags & TV_YPBPR525I) ? "480i" :
((pSiS->VBFlags & TV_YPBPR525P) ? "480p" :
((pSiS->VBFlags & TV_YPBPR750P) ? "720p" : "1080i")));
- }
+ }
}
/* Detect CRT2-VGA */
void SISCRT2PreInit(ScrnInfoPtr pScrn, Bool quiet)
{
SISPtr pSiS = SISPTR(pScrn);
- UChar CR32;
+ UChar CR32;
/* CRT2-VGA only supported on these bridges */
if(!(pSiS->VBFlags & VB_SISVGA2BRIDGE))
return;
inSISIDXREG(SISCR, 0x32, CR32);
-
+
if(CR32 & 0x10) pSiS->VBFlags |= CRT2_VGA;
#ifdef SISDUALHEAD
@@ -724,7 +735,7 @@ void SISCRT2PreInit(ScrnInfoPtr pScrn, Bool quiet)
}
#ifdef SISDUALHEAD
}
-#endif
+#endif
}
static int
@@ -774,15 +785,15 @@ SISSense30x(ScrnInfoPtr pScrn, Bool quiet)
UShort cvbs=0, cvbs_c=0;
UShort vga2=0, vga2_c=0;
int myflag, result; /* , i; */
-
+
if(!(pSiS->VBFlags & VB_SISBRIDGE)) return;
-
+
#ifdef TWDEBUG
inSISIDXREG(SISCR,0x32,backupP2_4d);
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"(vb.c: SISSense30c 1: CR32=%02x, VBFlags 0x%x)\n", backupP2_4d, pSiS->VBFlags);
-#endif
-
+#endif
+
if(pSiS->VBFlags & VB_301) {
svhs = 0x00b9; cvbs = 0x00b3; vga2 = 0x00d1;
inSISIDXREG(SISPART4,0x01,myflag);
@@ -821,9 +832,9 @@ SISSense30x(ScrnInfoPtr pScrn, Bool quiet)
(pSiS->Chipset == PCI_CHIP_SIS340)) {
if(pSiS->ROM661New) {
biosflag = 2;
- vga2 = GETROMWORD(0x63);
+ vga2 = GETROMWORD(0x63);
if(pSiS->BIOS[0x6f] & 0x01) {
- if(pSiS->VBFlags2 & VB_SISUMC) vga2 = GETROMWORD(0x4d);
+ if(pSiS->VBFlags2 & VB_SISUMC) vga2 = GETROMWORD(0x4d);
}
svhs = cvbs = GETROMWORD(0x65);
if(pSiS->BIOS[0x5d] & 0x04) biosflag |= 0x01;
@@ -855,10 +866,10 @@ SISSense30x(ScrnInfoPtr pScrn, Bool quiet)
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);
@@ -874,14 +885,14 @@ SISSense30x(ScrnInfoPtr pScrn, Bool quiet)
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) {
@@ -907,7 +918,7 @@ SISSense30x(ScrnInfoPtr pScrn, Bool quiet)
andSISIDXREG(SISCR, 0x32, 0x3f);
pSiS->postVBCR32 &= 0x3f;
-
+
if(pSiS->VBFlags & VB_301C) {
orSISIDXREG(SISPART4,0x0d,0x04);
}
@@ -966,7 +977,7 @@ SISSense30x(ScrnInfoPtr pScrn, Bool quiet)
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) {
@@ -976,14 +987,14 @@ SISSense30x(ScrnInfoPtr pScrn, Bool quiet)
}
}
}
-
+
outSISIDXREG(SISPART2,0x00,backupP2_00);
-
+
#ifdef TWDEBUG
inSISIDXREG(SISCR,0x32,backupP2_4d);
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"(vb.c: SISSense30c 2: CR32=0x%02x, VBFlags 0x%x)\n", backupP2_4d, pSiS->VBFlags);
-#endif
+#endif
}
void
@@ -1049,8 +1060,8 @@ SISSenseChrontel(ScrnInfoPtr pScrn, Bool quiet)
SiS_SetCH701x(pSiS->SiS_Pr, (temp2 << 8) | 0x20);
SiS_DDC2Delay(pSiS->SiS_Pr, 0x96);
-
- temp2 = SiS_GetCH701x(pSiS->SiS_Pr, 0x20);
+
+ temp2 = SiS_GetCH701x(pSiS->SiS_Pr, 0x20);
/* Restore Power register */
SiS_SetCH701x(pSiS->SiS_Pr, (temp1 << 8) | 0x49);
@@ -1106,7 +1117,7 @@ SISSenseChrontel(ScrnInfoPtr pScrn, Bool quiet)
andSISIDXREG(SISCR, 0x32, ~0x07);
pSiS->postVBCR32 &= ~0x07;
}
-}
+}
/* Redetect CRT2 devices. Calling this requires a reset
* of the current display mode if TRUE is returned.
@@ -1117,13 +1128,13 @@ Bool SISRedetectCRT2Type(ScrnInfoPtr pScrn)
ULong 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, TRUE);
@@ -1132,15 +1143,15 @@ Bool SISRedetectCRT2Type(ScrnInfoPtr pScrn)
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).
+ * there is no way of detecting this).
*/
if((pSiS->VGAEngine == SIS_315_VGA) &&
(pSiS->VBFlags & VB_SISTMDSBRIDGE) &&
@@ -1151,20 +1162,20 @@ Bool SISRedetectCRT2Type(ScrnInfoPtr pScrn)
} 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);
@@ -1176,18 +1187,18 @@ Bool SISRedetectCRT2Type(ScrnInfoPtr pScrn)
pSiS->CRT1off = 0;
}
/* If CRT1 was LCD, switch to CRT1-VGA. No need to adapt display mode flags. */
- pSiS->VBFlags &= ~(CRT1_LCDA);
+ 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;
+
+ return TRUE;
}
diff --git a/src/sis_vga.c b/src/sis_vga.c
index b0de31a..3230559 100644
--- a/src/sis_vga.c
+++ b/src/sis_vga.c
@@ -180,7 +180,7 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
int clock = mode->Clock;
int width = mode->HDisplay;
int height = mode->VDisplay;
- int rate = SiSCalcVRate(mode);
+ int rate = (int)SiSCalcVRate(mode);
int buswidth = pSiS->BusWidth;
unsigned int vclk[5];
UShort CRT_CPUthresholdLow, CRT_CPUthresholdHigh, CRT_ENGthreshold;
@@ -193,9 +193,11 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
(*pSiS->SiSSave)(pScrn, pReg);
/* Initialise the standard VGA registers */
- if(!SiSVGAInit(pScrn, mode, fixsync)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "SISInit: SiSVGAInit() failed\n");
- return FALSE;
+ if(!pSiS->UseVESA) {
+ if(!SiSVGAInit(pScrn, mode, fixsync)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "SISInit: SiSVGAInit() failed\n");
+ return FALSE;
+ }
}
/* Determine if chosen mode is suitable for TV on the 6326
@@ -205,21 +207,21 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
sis6326himode = FALSE;
if(pSiS->Chipset == PCI_CHIP_SIS6326) {
if(pSiS->SiS6326Flags & SIS6326_HASTV) {
- if((pSiS->SiS6326Flags & SIS6326_TVDETECTED) &&
- ((strcmp(mode->name, "PAL800x600") == 0) || /* Special TV modes */
- (strcmp(mode->name, "PAL800x600U") == 0) ||
+ if((pSiS->SiS6326Flags & SIS6326_TVDETECTED) &&
+ ((strcmp(mode->name, "PAL800x600") == 0) || /* Special TV modes */
+ (strcmp(mode->name, "PAL800x600U") == 0) ||
(strcmp(mode->name, "PAL720x540") == 0) ||
- (strcmp(mode->name, "PAL640x480") == 0) ||
+ (strcmp(mode->name, "PAL640x480") == 0) ||
(strcmp(mode->name, "NTSC640x480") == 0) ||
(strcmp(mode->name, "NTSC640x480U") == 0) ||
(strcmp(mode->name, "NTSC640x400") == 0))) {
sis6326tvmode = TRUE;
- } else {
- pReg->sis6326tv[0x00] &= 0xfb;
- }
+ } else {
+ pReg->sis6326tv[0x00] &= 0xfb;
+ }
}
if((strcmp(mode->name, "SIS1280x1024-75") == 0) || /* Special high-res modes */
- (strcmp(mode->name, "SIS1600x1200-60") == 0)) {
+ (strcmp(mode->name, "SIS1600x1200-60") == 0)) {
sis6326himode = TRUE;
}
}
@@ -233,12 +235,12 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
/* set interlace */
- if(!(mode->Flags & V_INTERLACE)) {
+ if(!(mode->Flags & V_INTERLACE)) {
offset = pSiS->CurrentLayout.displayWidth >> 3;
- } else {
+ } else {
offset = pSiS->CurrentLayout.displayWidth >> 2;
if(!pSiS->UseVESA) {
- pReg->sisRegs3C4[0x06] |= 0x20;
+ pReg->sisRegs3C4[0x06] |= 0x20;
}
}
@@ -260,73 +262,73 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
/* Enable 32bit mem access (D7), read-ahead cache (D5) */
pReg->sisRegs3C4[0x0C] |= 0x80;
if(pSiS->oldChipset > OC_SIS6225) {
- pReg->sisRegs3C4[0x0C] |= 0x20;
+ pReg->sisRegs3C4[0x0C] |= 0x20;
}
/* Some speed-up stuff */
switch(pSiS->Chipset) {
case PCI_CHIP_SIS5597:
- /* enable host bus */
- if(pSiS->NoHostBus) {
+ /* enable host bus */
+ if(!pSiS->HostBus) {
pReg->sisRegs3C4[0x34] &= ~0x08;
} else {
- pReg->sisRegs3C4[0x34] |= 0x08;
+ pReg->sisRegs3C4[0x34] |= 0x08;
}
- /* fall through */
+ /* fall through */
case PCI_CHIP_SIS6326:
case PCI_CHIP_SIS530:
- /* Enable "dual segment register mode" (D2) and "i/o gating while
- * write buffer is not empty" (D3)
- */
- pReg->sisRegs3C4[0x0B] |= 0x0C;
+ /* Enable "dual segment register mode" (D2) and "i/o gating while
+ * write buffer is not empty" (D3)
+ */
+ pReg->sisRegs3C4[0x0B] |= 0x0C;
}
/* set colordepth */
if(pSiS->Chipset == PCI_CHIP_SIS530) {
- pReg->sisRegs3C4[0x09] &= 0x7F;
+ pReg->sisRegs3C4[0x09] &= 0x7F;
}
switch(pSiS->CurrentLayout.bitsPerPixel) {
- case 8:
- break;
- case 16:
+ case 8:
+ break;
+ case 16:
offset <<= 1;
if(pSiS->CurrentLayout.depth == 15)
- pReg->sisRegs3C4[0x06] |= 0x04;
+ pReg->sisRegs3C4[0x06] |= 0x04;
else
- pReg->sisRegs3C4[0x06] |= 0x08;
- break;
- case 24:
- offset += (offset << 1);
- pReg->sisRegs3C4[0x06] |= 0x10;
- pReg->sisRegs3C4[0x0B] |= 0x90;
- break;
- case 32:
- if(pSiS->Chipset == PCI_CHIP_SIS530) {
- offset <<= 2;
- if(pSiS->oldChipset != OC_SIS620) {
- pReg->sisRegs3C4[0x06] |= 0x10;
- }
- pReg->sisRegs3C4[0x0B] |= 0x90;
- pReg->sisRegs3C4[0x09] |= 0x80;
- } else return FALSE;
- break;
+ pReg->sisRegs3C4[0x06] |= 0x08;
+ break;
+ case 24:
+ offset += (offset << 1);
+ pReg->sisRegs3C4[0x06] |= 0x10;
+ pReg->sisRegs3C4[0x0B] |= 0x90;
+ break;
+ case 32:
+ if(pSiS->Chipset == PCI_CHIP_SIS530) {
+ offset <<= 2;
+ if(pSiS->oldChipset != OC_SIS620) {
+ pReg->sisRegs3C4[0x06] |= 0x10;
+ }
+ pReg->sisRegs3C4[0x0B] |= 0x90;
+ pReg->sisRegs3C4[0x09] |= 0x80;
+ } else return FALSE;
+ break;
}
}
/* save screen pitch for acceleration functions */
pSiS->scrnOffset = pSiS->CurrentLayout.displayWidth *
- ((pSiS->CurrentLayout.bitsPerPixel + 7) / 8);
+ ((pSiS->CurrentLayout.bitsPerPixel + 7) / 8);
if(!pSiS->UseVESA) {
/* set linear framebuffer addresses */
- switch(pScrn->videoRam) {
- case 512: temp = 0x00; break;
- case 1024: temp = 0x20; break;
- case 2048: temp = 0x40; break;
- case 4096: temp = 0x60; break;
- case 8192: temp = 0x80; break;
- default: temp = 0x20;
+ switch(pScrn->videoRam) {
+ case 512: temp = 0x00; break;
+ case 1024: temp = 0x20; break;
+ case 2048: temp = 0x40; break;
+ case 4096: temp = 0x60; break;
+ case 8192: temp = 0x80; break;
+ default: temp = 0x20;
}
pReg->sisRegs3C4[0x20] = (pSiS->FbAddress & 0x07F80000) >> 19;
pReg->sisRegs3C4[0x21] = ((pSiS->FbAddress & 0xF8000000) >> 27) | temp;
@@ -345,38 +347,38 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
else index = 8;
} else {
if(pSiS->SiS6326Flags & SIS6326_TVPAL) {
- switch(width) {
- case 800:
- if((strcmp(mode->name, "PAL800x600U") == 0))
- index = 4;
- else
- index = 0;
- break;
- case 720:
- index = 5;
- break;
- case 640:
- default:
- index = 1;
- }
+ switch(width) {
+ case 800:
+ if((strcmp(mode->name, "PAL800x600U") == 0))
+ index = 4;
+ else
+ index = 0;
+ break;
+ case 720:
+ index = 5;
+ break;
+ case 640:
+ default:
+ index = 1;
+ }
} else {
- switch(height) {
- case 400:
- index = 3;
- break;
- case 480:
- default:
- if((strcmp(mode->name, "NTSC640x480U") == 0))
- index = 6;
- else
- index = 2;
- }
+ switch(height) {
+ case 400:
+ index = 3;
+ break;
+ case 480:
+ default:
+ if((strcmp(mode->name, "NTSC640x480U") == 0))
+ index = 6;
+ else
+ index = 2;
+ }
}
- }
+ }
for(i=0; i<=5; i++) {
pReg->sisRegs3D4[i] = SiS6326CR[index][i];
}
- pReg->sisRegs3C4[0x12] = SiS6326CR[index][6];
+ pReg->sisRegs3C4[0x12] = SiS6326CR[index][6];
pReg->sisRegs3D4[6] = SiS6326CR[index][7];
pReg->sisRegs3D4[7] = SiS6326CR[index][8];
pReg->sisRegs3D4[0x10] = SiS6326CR[index][9];
@@ -390,42 +392,42 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
} else {
- /* Set extended vertical overflow register */
- pReg->sisRegs3C4[0x0A] = (
+ /* Set extended vertical overflow register */
+ pReg->sisRegs3C4[0x0A] = (
((offset & 0xF00) >> 4) |
- (((mode->CrtcVTotal - 2) & 0x400) >> 10) |
- (((mode->CrtcVDisplay - 1) & 0x400) >> 9) |
+ (((mode->CrtcVTotal - 2) & 0x400) >> 10) |
+ (((mode->CrtcVDisplay - 1) & 0x400) >> 9) |
(((mode->CrtcVBlankStart - 1) & 0x400) >> 8) |
- (((mode->CrtcVSyncStart - fixsync) & 0x400) >> 7));
-
- /* Set extended horizontal overflow register */
- pReg->sisRegs3C4[0x12] &= 0xE0;
- pReg->sisRegs3C4[0x12] |= (
- ((((mode->CrtcHTotal >> 3) - 5) & 0x100) >> 8) |
- ((((mode->CrtcHDisplay >> 3) - 1) & 0x100) >> 7) |
- ((((mode->CrtcHBlankStart >> 3) - 1) & 0x100) >> 6) |
- ((((mode->CrtcHSyncStart >> 3) - fixsync)& 0x100) >> 5) |
- ((((mode->CrtcHBlankEnd >> 3) - 1) & 0x40) >> 2));
+ (((mode->CrtcVSyncStart - fixsync) & 0x400) >> 7));
+
+ /* Set extended horizontal overflow register */
+ pReg->sisRegs3C4[0x12] &= 0xE0;
+ pReg->sisRegs3C4[0x12] |= (
+ ((((mode->CrtcHTotal >> 3) - 5) & 0x100) >> 8) |
+ ((((mode->CrtcHDisplay >> 3) - 1) & 0x100) >> 7) |
+ ((((mode->CrtcHBlankStart >> 3) - 1) & 0x100) >> 6) |
+ ((((mode->CrtcHSyncStart >> 3) - fixsync)& 0x100) >> 5) |
+ ((((mode->CrtcHBlankEnd >> 3) - 1) & 0x40) >> 2));
}
/* enable (or disable) line compare */
if(mode->CrtcVDisplay >= 1024)
- pReg->sisRegs3C4[0x38] |= 0x04;
+ pReg->sisRegs3C4[0x38] |= 0x04;
else
- pReg->sisRegs3C4[0x38] &= 0xFB;
+ pReg->sisRegs3C4[0x38] &= 0xFB;
/* Enable (or disable) high speed DCLK (some 6326 and 530/620 only) */
if( ( (pSiS->Chipset == PCI_CHIP_SIS6326) &&
- ( (pSiS->ChipRev == 0xd0) || (pSiS->ChipRev == 0xd1) ||
- (pSiS->ChipRev == 0xd2) || (pSiS->ChipRev == 0x92) ||
+ ( (pSiS->ChipRev == 0xd0) || (pSiS->ChipRev == 0xd1) ||
+ (pSiS->ChipRev == 0xd2) || (pSiS->ChipRev == 0x92) ||
(pSiS->Flags & A6326REVAB) ) ) ||
- (pSiS->oldChipset > OC_SIS6326) ) {
- if( (pSiS->CurrentLayout.bitsPerPixel == 24) ||
- (pSiS->CurrentLayout.bitsPerPixel == 32) ||
- (mode->CrtcHDisplay >= 1280) )
- pReg->sisRegs3C4[0x3E] |= 0x01;
- else
- pReg->sisRegs3C4[0x3E] &= 0xFE;
+ (pSiS->oldChipset > OC_SIS6326) ) {
+ if( (pSiS->CurrentLayout.bitsPerPixel == 24) ||
+ (pSiS->CurrentLayout.bitsPerPixel == 32) ||
+ (mode->CrtcHDisplay >= 1280) )
+ pReg->sisRegs3C4[0x3E] |= 0x01;
+ else
+ pReg->sisRegs3C4[0x3E] &= 0xFE;
}
/* We use the internal VCLK */
@@ -436,7 +438,7 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
#if 0
if(pSiS->oldChipset <= OC_SIS86202) {
- /* TODO: Handle SR07 for clock selection */
+ /* TODO: Handle SR07 for clock selection */
/* 86C201 does not even have a programmable clock... */
/* pReg->sisRegs3C4[0x07] &= 0x??; */
}
@@ -445,52 +447,52 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
/* Set VCLK */
if((sis6326tvmode) || (sis6326himode)) {
- /* For our built-in modes, the calculation is not suitable */
- if(sis6326himode) {
- if((strcmp(mode->name, "SIS1280x1024-75") == 0)) {
- pReg->sisRegs3C4[0x2A] = 0x5d; /* 1280x1024-75 */
- pReg->sisRegs3C4[0x2B] = 0xa4;
+ /* For our built-in modes, the calculation is not suitable */
+ if(sis6326himode) {
+ if((strcmp(mode->name, "SIS1280x1024-75") == 0)) {
+ pReg->sisRegs3C4[0x2A] = 0x5d; /* 1280x1024-75 */
+ pReg->sisRegs3C4[0x2B] = 0xa4;
} else {
- pReg->sisRegs3C4[0x2A] = 0x59; /* 1600x1200-60 */
- pReg->sisRegs3C4[0x2B] = 0xa3;
- }
+ pReg->sisRegs3C4[0x2A] = 0x59; /* 1600x1200-60 */
+ pReg->sisRegs3C4[0x2B] = 0xa3;
+ }
pReg->sisRegs3C4[0x13] &= ~0x40;
- } else {
+ } else {
if(pSiS->SiS6326Flags & SIS6326_TVPAL) {
- /* PAL: 31.500 Mhz */
- if((strcmp(mode->name, "PAL800x600U") == 0)) {
- pReg->sisRegs3C4[0x2A] = 0x46;
- pReg->sisRegs3C4[0x2B] = 0x49;
- } else {
- pReg->sisRegs3C4[0x2A] = 0xab;
- pReg->sisRegs3C4[0x2B] = 0xe9;
- }
- pReg->sisRegs3C4[0x13] &= ~0x40;
+ /* PAL: 31.500 Mhz */
+ if((strcmp(mode->name, "PAL800x600U") == 0)) {
+ pReg->sisRegs3C4[0x2A] = 0x46;
+ pReg->sisRegs3C4[0x2B] = 0x49;
+ } else {
+ pReg->sisRegs3C4[0x2A] = 0xab;
+ pReg->sisRegs3C4[0x2B] = 0xe9;
+ }
+ pReg->sisRegs3C4[0x13] &= ~0x40;
} else {
- /* NTSC: 27.000 Mhz */
- if((strcmp(mode->name, "NTSC640x480U") == 0)) {
- pReg->sisRegs3C4[0x2A] = 0x5a;
- pReg->sisRegs3C4[0x2B] = 0x65;
- } else {
- pReg->sisRegs3C4[0x2A] = 0x29;
- pReg->sisRegs3C4[0x2B] = 0xe2;
- }
- pReg->sisRegs3C4[0x13] |= 0x40;
+ /* NTSC: 27.000 Mhz */
+ if((strcmp(mode->name, "NTSC640x480U") == 0)) {
+ pReg->sisRegs3C4[0x2A] = 0x5a;
+ pReg->sisRegs3C4[0x2B] = 0x65;
+ } else {
+ pReg->sisRegs3C4[0x2A] = 0x29;
+ pReg->sisRegs3C4[0x2B] = 0xe2;
+ }
+ pReg->sisRegs3C4[0x13] |= 0x40;
}
- }
+ }
} else if(SiS_compute_vclk(clock, &num, &denum, &div, &sbit, &scale)) {
- pReg->sisRegs3C4[0x2A] = (num - 1) & 0x7f ;
- pReg->sisRegs3C4[0x2A] |= (div == 2) ? 0x80 : 0;
- pReg->sisRegs3C4[0x2B] = ((denum - 1) & 0x1f);
- pReg->sisRegs3C4[0x2B] |= (((scale -1) & 3) << 5);
+ pReg->sisRegs3C4[0x2A] = (num - 1) & 0x7f ;
+ pReg->sisRegs3C4[0x2A] |= (div == 2) ? 0x80 : 0;
+ pReg->sisRegs3C4[0x2B] = ((denum - 1) & 0x1f);
+ pReg->sisRegs3C4[0x2B] |= (((scale -1) & 3) << 5);
/* When setting VCLK, we should set SR13 first */
- if(sbit)
- pReg->sisRegs3C4[0x13] |= 0x40;
- else
- pReg->sisRegs3C4[0x13] &= 0xBF;
+ if(sbit)
+ pReg->sisRegs3C4[0x13] |= 0x40;
+ else
+ pReg->sisRegs3C4[0x13] &= 0xBF;
#ifdef TWDEBUG
xf86DrvMsg(0, X_INFO, "2a: %x 2b: %x 13: %x clock %d\n",
@@ -499,8 +501,8 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
} else {
- /* if SiS_compute_vclk cannot handle the requested clock, try sisCalcClock */
- SiSCalcClock(pScrn, clock, 2, vclk);
+ /* if SiS_compute_vclk cannot handle the requested clock, try sisCalcClock */
+ SiSCalcClock(pScrn, clock, 2, vclk);
#define Midx 0
#define Nidx 1
@@ -508,53 +510,53 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
#define Pidx 3
#define PSNidx 4
- pReg->sisRegs3C4[0x2A] = (vclk[Midx] - 1) & 0x7f;
- pReg->sisRegs3C4[0x2A] |= ((vclk[VLDidx] == 2) ? 1 : 0) << 7;
+ pReg->sisRegs3C4[0x2A] = (vclk[Midx] - 1) & 0x7f;
+ pReg->sisRegs3C4[0x2A] |= ((vclk[VLDidx] == 2) ? 1 : 0) << 7;
/* D[4:0]: denumerator */
- pReg->sisRegs3C4[0x2B] = (vclk[Nidx] - 1) & 0x1f;
-
- if(vclk[Pidx] <= 4){
- /* postscale 1,2,3,4 */
- pReg->sisRegs3C4[0x2B] |= (vclk[Pidx] - 1) << 5;
- pReg->sisRegs3C4[0x13] &= 0xBF;
- } else {
- /* postscale 6,8 */
- pReg->sisRegs3C4[0x2B] |= ((vclk[Pidx] / 2) - 1) << 5;
- pReg->sisRegs3C4[0x13] |= 0x40;
- }
- pReg->sisRegs3C4[0x2B] |= 0x80 ; /* gain for high frequency */
+ pReg->sisRegs3C4[0x2B] = (vclk[Nidx] - 1) & 0x1f;
+
+ if(vclk[Pidx] <= 4){
+ /* postscale 1,2,3,4 */
+ pReg->sisRegs3C4[0x2B] |= (vclk[Pidx] - 1) << 5;
+ pReg->sisRegs3C4[0x13] &= 0xBF;
+ } else {
+ /* postscale 6,8 */
+ pReg->sisRegs3C4[0x2B] |= ((vclk[Pidx] / 2) - 1) << 5;
+ pReg->sisRegs3C4[0x13] |= 0x40;
+ }
+ pReg->sisRegs3C4[0x2B] |= 0x80 ; /* gain for high frequency */
}
/* High speed DAC */
if(clock > 135000)
- pReg->sisRegs3C4[0x07] |= 0x02;
+ pReg->sisRegs3C4[0x07] |= 0x02;
if(pSiS->oldChipset > OC_SIS6225) {
- /* 1 or 2 cycle DRAM (set by option FastVram) */
- if(pSiS->newFastVram == -1) {
- if(pSiS->oldChipset == OC_SIS620) {
- /* Use different default on the 620 */
- pReg->sisRegs3C4[0x34] |= 0x40;
- pReg->sisRegs3C4[0x34] &= ~0x80;
- } else {
- pReg->sisRegs3C4[0x34] |= 0x80;
- pReg->sisRegs3C4[0x34] &= ~0x40;
- }
- } else if(pSiS->newFastVram == 1)
- pReg->sisRegs3C4[0x34] |= 0xC0;
- else
- pReg->sisRegs3C4[0x34] &= ~0xC0;
-
- if(pSiS->oldChipset == OC_SIS620) {
- /* Enable SGRAM burst timing (= bit clear) on the 620 */
- if(pSiS->Flags & SYNCDRAM) {
- pReg->sisRegs3C4[0x35] &= ~0x20;
- } else {
- pReg->sisRegs3C4[0x35] |= 0x20;
- }
- }
+ /* 1 or 2 cycle DRAM (set by option FastVram) */
+ if(pSiS->newFastVram == -1) {
+ if(pSiS->oldChipset == OC_SIS620) {
+ /* Use different default on the 620 */
+ pReg->sisRegs3C4[0x34] |= 0x40;
+ pReg->sisRegs3C4[0x34] &= ~0x80;
+ } else {
+ pReg->sisRegs3C4[0x34] |= 0x80;
+ pReg->sisRegs3C4[0x34] &= ~0x40;
+ }
+ } else if(pSiS->newFastVram == 1)
+ pReg->sisRegs3C4[0x34] |= 0xC0;
+ else
+ pReg->sisRegs3C4[0x34] &= ~0xC0;
+
+ if(pSiS->oldChipset == OC_SIS620) {
+ /* Enable SGRAM burst timing (= bit clear) on the 620 */
+ if(pSiS->Flags & SYNCDRAM) {
+ pReg->sisRegs3C4[0x35] &= ~0x20;
+ } else {
+ pReg->sisRegs3C4[0x35] |= 0x20;
+ }
+ }
}
} /* VESA */
@@ -563,36 +565,36 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
pSiS->ValidWidth = TRUE;
pReg->sisRegs3C4[0x27] &= 0xCF;
if(pSiS->CurrentLayout.bitsPerPixel == 24) {
- /* "Invalid logical width" */
- pReg->sisRegs3C4[0x27] |= 0x30;
- pSiS->ValidWidth = FALSE;
+ /* "Invalid logical width" */
+ pReg->sisRegs3C4[0x27] |= 0x30;
+ pSiS->ValidWidth = FALSE;
} else {
- switch(pScrn->virtualX * (pSiS->CurrentLayout.bitsPerPixel >> 3)) {
- case 1024:
- pReg->sisRegs3C4[0x27] |= 0x00;
- break;
- case 2048:
- pReg->sisRegs3C4[0x27] |= 0x10;
- break;
- case 4096:
- pReg->sisRegs3C4[0x27] |= 0x20;
- break;
- default:
- /* Invalid logical width */
- pReg->sisRegs3C4[0x27] |= 0x30;
- pSiS->ValidWidth = FALSE;
- break;
- }
+ switch(pScrn->virtualX * (pSiS->CurrentLayout.bitsPerPixel >> 3)) {
+ case 1024:
+ pReg->sisRegs3C4[0x27] |= 0x00;
+ break;
+ case 2048:
+ pReg->sisRegs3C4[0x27] |= 0x10;
+ break;
+ case 4096:
+ pReg->sisRegs3C4[0x27] |= 0x20;
+ break;
+ default:
+ /* Invalid logical width */
+ pReg->sisRegs3C4[0x27] |= 0x30;
+ pSiS->ValidWidth = FALSE;
+ break;
+ }
}
/* Acceleration stuff */
if(!pSiS->NoAccel) {
pReg->sisRegs3C4[0x27] |= 0x40; /* Enable engine programming registers */
if( (pSiS->TurboQueue) && /* Handle TurboQueue */
- (pSiS->oldChipset > OC_SIS6225) &&
- ( (pSiS->Chipset != PCI_CHIP_SIS530) ||
+ (pSiS->oldChipset > OC_SIS6225) &&
+ ( (pSiS->Chipset != PCI_CHIP_SIS530) ||
(pSiS->CurrentLayout.bitsPerPixel != 24) ) ) {
- pReg->sisRegs3C4[0x27] |= 0x80; /* Enable TQ */
+ pReg->sisRegs3C4[0x27] |= 0x80; /* Enable TQ */
if((pSiS->Chipset == PCI_CHIP_SIS530) ||
((pSiS->Chipset == PCI_CHIP_SIS6326 &&
(pSiS->ChipRev == 0xd0 || pSiS->ChipRev == 0xd1 ||
@@ -608,7 +610,7 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
*/
pReg->sisRegs3C4[0x2C] = (pScrn->videoRam - 64) / 32;
if(pSiS->Chipset != PCI_CHIP_SIS530) { /* 530/620: Reserved (don't touch) */
- pReg->sisRegs3C4[0x3C] &= 0xFC; /* 6326: Queue is all for 2D */
+ pReg->sisRegs3C4[0x3C] &= 0xFC; /* 6326: Queue is all for 2D */
} /* 5597: Must be 0 */
} else {
pReg->sisRegs3C4[0x27] &= 0x7F;
@@ -618,17 +620,17 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
if(!pSiS->UseVESA) {
- /* TW: No idea what this does. The Windows driver does it, so we do it as well */
+ /* No idea what this does. The Windows driver does it, so we do it as well */
if(pSiS->Chipset == PCI_CHIP_SIS6326) {
- if((pSiS->ChipRev == 0xd0) || (pSiS->ChipRev == 0xd1) ||
- (pSiS->ChipRev == 0xd2) || (pSiS->ChipRev == 0x92) ||
+ if((pSiS->ChipRev == 0xd0) || (pSiS->ChipRev == 0xd1) ||
+ (pSiS->ChipRev == 0xd2) || (pSiS->ChipRev == 0x92) ||
(pSiS->Flags & A6326REVAB)) {
if((pSiS->Flags & (SYNCDRAM | RAMFLAG)) == (SYNCDRAM | RAMFLAG)) {
if(!(pReg->sisRegs3C4[0x0E] & 0x03)) {
pReg->sisRegs3C4[0x3E] |= 0x02;
}
}
- }
+ }
}
/* Set memclock */
@@ -711,55 +713,55 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
#if 0 /* See comment in sis_dac.c on why this is commented */
if(pSiS->Chipset == PCI_CHIP_SIS530) {
- if((pSiS->oldChipset == OC_SIS530A) &&
+ if((pSiS->oldChipset == OC_SIS530A) &&
(pSiS->Flags & UMA) &&
(mclk == 100000) &&
(pSiS->Flags & ESS137xPRESENT)) {
if(!(pSiS->Flags & SECRETFLAG)) index = 0;
- if((temp = SiS_CalcSpecial530Threshold(pSiS, mode, index)) {
- CRT_CPUthresholdLow = temp;
- break;
+ if((temp = SiS_CalcSpecial530Threshold(pSiS, mode, index)) {
+ CRT_CPUthresholdLow = temp;
+ break;
}
- }
+ }
}
#endif
switch(pSiS->Chipset) {
case PCI_CHIP_SIS530:
- if(CRT_CPUthresholdLow > 0x1f) CRT_CPUthresholdLow = 0x1f;
- CRT_CPUthresholdHigh = 0x1f;
- break;
+ if(CRT_CPUthresholdLow > 0x1f) CRT_CPUthresholdLow = 0x1f;
+ CRT_CPUthresholdHigh = 0x1f;
+ break;
case PCI_CHIP_SIS5597:
case PCI_CHIP_SIS6326:
default:
- if(CRT_CPUthresholdLow > 0x0f) CRT_CPUthresholdLow = 0x0f;
- if(CRT_CPUthresholdHigh > 0x0f) CRT_CPUthresholdHigh = 0x0f;
+ if(CRT_CPUthresholdLow > 0x0f) CRT_CPUthresholdLow = 0x0f;
+ if(CRT_CPUthresholdHigh > 0x0f) CRT_CPUthresholdHigh = 0x0f;
}
pReg->sisRegs3C4[0x08] = ((CRT_CPUthresholdLow & 0x0F) << 4) |
- (CRT_ENGthreshold & 0x0F);
+ (CRT_ENGthreshold & 0x0F);
pReg->sisRegs3C4[0x09] &= 0xF0;
pReg->sisRegs3C4[0x09] |= (CRT_CPUthresholdHigh & 0x0F);
pReg->sisRegs3C4[0x3F] &= 0xEB;
pReg->sisRegs3C4[0x3F] |= ((CRT_CPUthresholdHigh & 0x10) |
- ((CRT_CPUthresholdLow & 0x10) >> 2));
+ ((CRT_CPUthresholdLow & 0x10) >> 2));
if(pSiS->oldChipset >= OC_SIS530A) {
- pReg->sisRegs3C4[0x3F] &= 0xDF;
+ pReg->sisRegs3C4[0x3F] &= 0xDF;
pReg->sisRegs3C4[0x3F] |= 0x58;
}
/* Set SiS6326 TV registers */
if((pSiS->Chipset == PCI_CHIP_SIS6326) && (sis6326tvmode)) {
- UChar tmp;
- int index=0, i, j, k;
- int fsc;
+ UChar tmp;
+ int index=0, i, j, k;
+ int fsc;
- if(pSiS->SiS6326Flags & SIS6326_TVPAL) {
- pReg->sisRegs3C4[0x0D] |= 0x04;
- switch(width) {
+ if(pSiS->SiS6326Flags & SIS6326_TVPAL) {
+ pReg->sisRegs3C4[0x0D] |= 0x04;
+ switch(width) {
case 800:
if((strcmp(mode->name, "PAL800x600U") == 0)) index = 4;
else index = 3;
@@ -771,34 +773,34 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
for(i=0; i<14; i++) {
pReg->sis6326tv[SiS6326TVRegs1[i]] = SiS6326TVRegs1_PAL[index][i];
}
- fsc = (SiS6326TVRegs1_PAL[index][2] << 16) |
- (SiS6326TVRegs1_PAL[index][3] << 8) |
- (SiS6326TVRegs1_PAL[index][4]);
- } else {
+ fsc = (SiS6326TVRegs1_PAL[index][2] << 16) |
+ (SiS6326TVRegs1_PAL[index][3] << 8) |
+ (SiS6326TVRegs1_PAL[index][4]);
+ } else {
pReg->sisRegs3C4[0x0D] &= ~0x04;
if((strcmp(mode->name, "NTSC640x480U") == 0)) index = 5;
else index = 4;
- for(i=0; i<14; i++) {
+ for(i=0; i<14; i++) {
pReg->sis6326tv[SiS6326TVRegs1[i]] = SiS6326TVRegs1_NTSC[index][i];
}
- fsc = (SiS6326TVRegs1_NTSC[index][2] << 16) |
+ fsc = (SiS6326TVRegs1_NTSC[index][2] << 16) |
(SiS6326TVRegs1_NTSC[index][3] << 8) |
(SiS6326TVRegs1_NTSC[index][4]);
- }
- if(pSiS->sis6326fscadjust) {
+ }
+ if(pSiS->sis6326fscadjust) {
fsc += pSiS->sis6326fscadjust;
pReg->sis6326tv[2] = (fsc >> 16) & 0xff;
pReg->sis6326tv[3] = (fsc >> 8) & 0xff;
pReg->sis6326tv[4] = fsc & 0xff;
- }
- tmp = pReg->sis6326tv[0x43];
- if(pSiS->SiS6326Flags & SIS6326_TVCVBS) tmp |= 0x10;
- tmp |= 0x08;
- pReg->sis6326tv[0x43] = tmp;
- j = 0; k = 0;
- for(i=0; i<=0x44; i++) {
+ }
+ tmp = pReg->sis6326tv[0x43];
+ if(pSiS->SiS6326Flags & SIS6326_TVCVBS) tmp |= 0x10;
+ tmp |= 0x08;
+ pReg->sis6326tv[0x43] = tmp;
+ j = 0; k = 0;
+ for(i=0; i<=0x44; i++) {
if(SiS6326TVRegs1[j] == i) {
- j++;
+ j++;
continue;
}
if(pSiS->SiS6326Flags & SIS6326_TVPAL) {
@@ -808,23 +810,23 @@ SISInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
pReg->sis6326tv[i] = tmp;
k++;
- }
- pReg->sis6326tv[0x43] |= 0x08;
- if((pSiS->ChipRev == 0xc1) || (pSiS->ChipRev == 0xc2)) {
- pReg->sis6326tv[0x43] &= ~0x08;
- }
+ }
+ pReg->sis6326tv[0x43] |= 0x08;
+ if((pSiS->ChipRev == 0xc1) || (pSiS->ChipRev == 0xc2)) {
+ pReg->sis6326tv[0x43] &= ~0x08;
+ }
- tmp = pReg->sis6326tv[0];
- tmp |= 0x18;
- if(pSiS->SiS6326Flags & SIS6326_TVCVBS) tmp &= ~0x10;
- if(pSiS->SiS6326Flags & SIS6326_TVSVIDEO) tmp &= ~0x08;
- tmp |= 0x04;
- pReg->sis6326tv[0] = tmp;
+ tmp = pReg->sis6326tv[0];
+ tmp |= 0x18;
+ if(pSiS->SiS6326Flags & SIS6326_TVCVBS) tmp &= ~0x10;
+ if(pSiS->SiS6326Flags & SIS6326_TVSVIDEO) tmp &= ~0x08;
+ tmp |= 0x04;
+ pReg->sis6326tv[0] = tmp;
}
} /* VESA */
- return(TRUE);
+ return TRUE;
}
/* Init a mode for SiS 300, 315, 330, 340 series
@@ -842,9 +844,9 @@ SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode)
PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, "SIS300Init()\n"));
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4,
- "virtualX = %d depth = %d Logical width = %d\n",
+ "virtualX = %d depth = %d Logical width = %d\n",
pScrn->virtualX, pSiS->CurrentLayout.bitsPerPixel,
- pScrn->virtualX * pSiS->CurrentLayout.bitsPerPixel/8);
+ pScrn->virtualX * pSiS->CurrentLayout.bitsPerPixel/8);
#ifdef SISMERGED
if(pSiS->MergedFB) {
@@ -870,23 +872,23 @@ SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode)
#endif
switch(pSiS->CurrentLayout.bitsPerPixel) {
- case 8:
- pSiS->DstColor = 0x0000;
+ case 8:
+ pSiS->DstColor = 0x0000;
pSiS->SiS310_AccelDepth = 0x00000000;
- break;
- case 16:
+ break;
+ case 16:
if(pSiS->CurrentLayout.depth == 15)
pSiS->DstColor = (short) 0x4000;
else
- pSiS->DstColor = (short) 0x8000;
+ pSiS->DstColor = (short) 0x8000;
pSiS->SiS310_AccelDepth = 0x00010000;
- break;
- case 24:
- break;
- case 32:
- pSiS->DstColor = (short) 0xC000;
+ break;
+ case 24:
+ break;
+ case 32:
+ pSiS->DstColor = (short) 0xC000;
pSiS->SiS310_AccelDepth = 0x00020000;
- break;
+ break;
}
/* Enable PCI LINEAR ADDRESSING (0x80), MMIO (0x01), PCI_IO (0x20) */
@@ -897,16 +899,16 @@ SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode)
* be limited by MaxXFbMem when using DRI). Also, enable the accelerators.
*/
if(!pSiS->NoAccel) {
- pReg->sisRegs3C4[0x1E] |= 0x42; /* Enable 2D accelerator */
+ pReg->sisRegs3C4[0x1E] |= 0x42; /* Enable 2D accelerator */
pReg->sisRegs3C4[0x1E] |= 0x18; /* Enable 3D accelerator */
switch(pSiS->VGAEngine) {
case SIS_300_VGA:
if(pSiS->TurboQueue) { /* set Turbo Queue as 512k */
temp = ((pScrn->videoRam/64)-8); /* 8=512k, 4=256k, 2=128k, 1=64k */
- pReg->sisRegs3C4[0x26] = temp & 0xFF;
+ pReg->sisRegs3C4[0x26] = temp & 0xFF;
pReg->sisRegs3C4[0x27] =
(pReg->sisRegs3C4[0x27] & 0xfc) | (((temp >> 8) & 3) | 0xF0);
- } /* line above new for saving D2&3 of status register */
+ } /* line above new for saving D2&3 of status register */
break;
case SIS_315_VGA:
#ifndef SISVRAMQ
@@ -919,7 +921,7 @@ SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
}
- return(TRUE);
+ return TRUE;
}
static void
@@ -952,7 +954,7 @@ SIS6326DoSense(ScrnInfoPtr pScrn, int tempbh, int tempbl, int tempch, int tempcl
SiS6326TVDelay(pScrn, 0x8000);
temp = SiS6326GetTVReg(pScrn, 0x44);
if(!(tempch & temp)) tempcl = 0;
- return(tempcl);
+ return tempcl;
}
static void
@@ -979,9 +981,9 @@ SISSense6326(ScrnInfoPtr pScrn)
"SiS6326: Detected TV connected to %s output\n",
(((pSiS->SiS6326Flags & (SIS6326_TVSVIDEO | SIS6326_TVCVBS)) ==
(SIS6326_TVSVIDEO | SIS6326_TVCVBS)) ?
- "both SVIDEO and COMPOSITE" :
- ((pSiS->SiS6326Flags & SIS6326_TVSVIDEO) ?
- "SVIDEO" : "COMPOSITE")));
+ "both SVIDEO and COMPOSITE" :
+ ((pSiS->SiS6326Flags & SIS6326_TVSVIDEO) ?
+ "SVIDEO" : "COMPOSITE")));
} else {
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"SiS6326: No TV detected\n");
@@ -1019,7 +1021,7 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
UChar sr17=0;
#endif
static const char *ChrontelTypeStr[] = {
- "7004",
+ "7004",
"7005",
"7007",
"7006",
@@ -1030,7 +1032,7 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
"(unknown)"
};
static const char *SiSVBTypeStr[] = {
- "301", /* 0 */
+ "301", /* 0 */
"301B", /* 1 */
"301B-DH", /* 2 */
"301LV", /* 3 */
@@ -1087,22 +1089,22 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
}
if(temp1 >= 0xE0) {
- inSISIDXREG(SISPART4, 0x39, temp2);
+ inSISIDXREG(SISPART4, 0x39, temp2);
if(temp2 == 0xff) {
- pSiS->VBFlags |= VB_302LV;
+ pSiS->VBFlags |= VB_302LV;
sistypeidx = 4;
} else {
pSiS->VBFlags |= VB_301C; /* VB_302ELV; */
sistypeidx = 5; /* 6; */
}
} else if(temp1 >= 0xD0) {
- pSiS->VBFlags |= VB_301LV;
+ pSiS->VBFlags |= VB_301LV;
sistypeidx = 3;
} else if(temp1 >= 0xC0) {
- pSiS->VBFlags |= VB_301C;
+ pSiS->VBFlags |= VB_301C;
sistypeidx = 5;
} else if(temp1 >= 0xB0) {
- pSiS->VBFlags |= VB_301B;
+ pSiS->VBFlags |= VB_301B;
sistypeidx = 1;
inSISIDXREG(SISPART4, 0x23, temp2);
if(!(temp2 & 0x02)) {
@@ -1110,18 +1112,18 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
sistypeidx = 2;
}
} else {
- pSiS->VBFlags |= VB_301;
+ pSiS->VBFlags |= VB_301;
sistypeidx = 0;
}
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, SiSVBTypeStr[sistypeidx],
- (pSiS->VBFlags2 & VB_SISUMC) ? "UMC-0" : "Charter/UMC-1", 1, temp1);
+ (pSiS->VBFlags2 & VB_SISUMC) ? "UMC-0" : "Charter/UMC-1", 1, temp1);
SISSense30x(pScrn, FALSE);
} else if(temp == 2) {
- inSISIDXREG(SISPART4, 0x01, temp1);
+ inSISIDXREG(SISPART4, 0x01, temp1);
temp1 &= 0xff;
if(temp1 >= 0xC0) {
@@ -1129,40 +1131,40 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
}
if(temp1 >= 0xE0) {
- pSiS->VBFlags |= VB_302LV;
+ pSiS->VBFlags |= VB_302LV;
sistypeidx = 4;
} else if(temp1 >= 0xD0) {
- pSiS->VBFlags |= VB_301LV;
+ pSiS->VBFlags |= VB_301LV;
sistypeidx = 3;
} else {
- pSiS->VBFlags |= VB_302B;
+ pSiS->VBFlags |= VB_302B;
sistypeidx = 7;
}
xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, SiSVBTypeStr[sistypeidx],
- (pSiS->VBFlags2 & VB_SISUMC) ? "UMC-0" : "Charter/UMC-1", 2, temp1);
+ (pSiS->VBFlags2 & VB_SISUMC) ? "UMC-0" : "Charter/UMC-1", 2, temp1);
SISSense30x(pScrn, FALSE);
} else if (temp == 3) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "303", "unsupported, unknown", temp, 0);
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, detectvb, "303", "unsupported, unknown", temp, 0);
} else {
if(pSiS->NewCRLayout) {
inSISIDXREG(SISCR, 0x38, temp);
- temp = (temp >> 5) & 0x07;
+ temp = (temp >> 5) & 0x07;
} else {
inSISIDXREG(SISCR, 0x37, temp);
- temp = (temp >> 1) & 0x07;
+ temp = (temp >> 1) & 0x07;
}
- if(pSiS->VGAEngine == SIS_300_VGA) {
+ if(pSiS->VGAEngine == SIS_300_VGA) {
lowerlimitlvds = 2; upperlimitlvds = 4;
lowerlimitch = 4; upperlimitch = 5;
chronteltype = 1; chrontelidreg = 0x25;
upperlimitvb = upperlimitlvds;
- } else {
+ } else {
lowerlimitlvds = 2; upperlimitlvds = 3;
lowerlimitch = 3; upperlimitch = 3;
chronteltype = 2; chrontelidreg = 0x4b;
@@ -1173,76 +1175,75 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
}
if((temp >= lowerlimitlvds) && (temp <= upperlimitlvds)) {
- pSiS->VBFlags |= VB_LVDS;
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Detected LVDS transmitter (External chip ID %d)\n", temp);
+ pSiS->VBFlags |= VB_LVDS;
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Detected LVDS transmitter (External chip ID %d)\n", temp);
}
- if((temp >= lowerlimitch) && (temp <= upperlimitch)) {
- /* Set global for init301.c */
- pSiS->SiS_Pr->SiS_IF_DEF_CH70xx = chronteltype;
-
- if(chronteltype == 1) {
- /* Set general purpose IO for Chrontel communication */
- SiS_SetChrontelGPIO(pSiS->SiS_Pr, 0x9c);
- }
-
- /* Read Chrontel version number */
- temp1 = SiS_GetCH70xx(pSiS->SiS_Pr, chrontelidreg);
- if(chronteltype == 1) {
- /* See Chrontel TB31 for explanation */
- temp2 = SiS_GetCH700x(pSiS->SiS_Pr, 0x0e);
- if(((temp2 & 0x07) == 0x01) || (temp2 & 0x04)) {
- SiS_SetCH700x(pSiS->SiS_Pr, 0x0b0e);
- SiS_DDC2Delay(pSiS->SiS_Pr, 300);
- }
- temp2 = SiS_GetCH70xx(pSiS->SiS_Pr, chrontelidreg);
- if(temp2 != temp1) temp1 = temp2;
- }
- if(temp1 == 0xFFFF) { /* 0xFFFF = error reading DDC port */
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ if((temp >= lowerlimitch) && (temp <= upperlimitch)) {
+ /* Set global for init301.c */
+ pSiS->SiS_Pr->SiS_IF_DEF_CH70xx = chronteltype;
+
+ if(chronteltype == 1) {
+ /* Set general purpose IO for Chrontel communication */
+ SiS_SetChrontelGPIO(pSiS->SiS_Pr, 0x9c);
+ }
+
+ /* Read Chrontel version number */
+ temp1 = SiS_GetCH70xx(pSiS->SiS_Pr, chrontelidreg);
+ if(chronteltype == 1) {
+ /* See Chrontel TB31 for explanation */
+ temp2 = SiS_GetCH700x(pSiS->SiS_Pr, 0x0e);
+ if(((temp2 & 0x07) == 0x01) || (temp2 & 0x04)) {
+ SiS_SetCH700x(pSiS->SiS_Pr, 0x0b0e);
+ SiS_DDC2Delay(pSiS->SiS_Pr, 300);
+ }
+ temp2 = SiS_GetCH70xx(pSiS->SiS_Pr, chrontelidreg);
+ if(temp2 != temp1) temp1 = temp2;
+ }
+ if(temp1 == 0xFFFF) { /* 0xFFFF = error reading DDC port */
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Detected Chrontel 70xx, but encountered error reading I2C port\n");
- andSISIDXREG(SISCR, 0x32, ~0x07);
- pSiS->postVBCR32 &= ~0x07;
- }
- /* TW: We only support device ids 0x19-200; other values may indicate DDC problems */
- else if((temp1 >= 0x19) && (temp1 <= 200)) {
- pSiS->VBFlags |= VB_CHRONTEL;
- switch (temp1) {
- case 0x32: temp2 = 0; pSiS->ChrontelType = CHRONTEL_700x; break;
- case 0x3A: temp2 = 1; pSiS->ChrontelType = CHRONTEL_700x; break;
- case 0x50: temp2 = 2; pSiS->ChrontelType = CHRONTEL_700x; break;
- case 0x2A: temp2 = 3; pSiS->ChrontelType = CHRONTEL_700x; break;
- case 0x40: temp2 = 4; pSiS->ChrontelType = CHRONTEL_700x; break;
- case 0x22: temp2 = 5; pSiS->ChrontelType = CHRONTEL_700x; break;
- case 0x19: temp2 = 6; pSiS->ChrontelType = CHRONTEL_701x; break;
- case 0x20: temp2 = 7; pSiS->ChrontelType = CHRONTEL_701x; break; /* ID for 7020? */
- default: temp2 = 8; pSiS->ChrontelType = CHRONTEL_701x; break;
- }
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "Detected Chrontel %s TV encoder (ID 0x%02x; chip ID %d)\n",
- ChrontelTypeStr[temp2], temp1, temp);
-
- /* Sense connected TV's */
- 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.
- */
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ andSISIDXREG(SISCR, 0x32, ~0x07);
+ pSiS->postVBCR32 &= ~0x07;
+ } else if((temp1 >= 0x19) && (temp1 <= 200)) {
+ /* We only support device ids 0x19-200; other values may indicate DDC problems */
+ pSiS->VBFlags |= VB_CHRONTEL;
+ switch (temp1) {
+ case 0x32: temp2 = 0; pSiS->ChrontelType = CHRONTEL_700x; break;
+ case 0x3A: temp2 = 1; pSiS->ChrontelType = CHRONTEL_700x; break;
+ case 0x50: temp2 = 2; pSiS->ChrontelType = CHRONTEL_700x; break;
+ case 0x2A: temp2 = 3; pSiS->ChrontelType = CHRONTEL_700x; break;
+ case 0x40: temp2 = 4; pSiS->ChrontelType = CHRONTEL_700x; break;
+ case 0x22: temp2 = 5; pSiS->ChrontelType = CHRONTEL_700x; break;
+ case 0x19: temp2 = 6; pSiS->ChrontelType = CHRONTEL_701x; break;
+ case 0x20: temp2 = 7; pSiS->ChrontelType = CHRONTEL_701x; break; /* ID for 7020? */
+ default: temp2 = 8; pSiS->ChrontelType = CHRONTEL_701x; break;
+ }
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Detected Chrontel %s TV encoder (ID 0x%02x; chip ID %d)\n",
+ ChrontelTypeStr[temp2], temp1, temp);
+
+ /* Sense connected TV's */
+ 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.
+ */
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"Detected Chrontel TV encoder in promiscuous state (DDC/I2C mix-up)\n");
- andSISIDXREG(SISCR, 0x32, ~0x07);
- pSiS->postVBCR32 &= ~0x07;
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ andSISIDXREG(SISCR, 0x32, ~0x07);
+ pSiS->postVBCR32 &= ~0x07;
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
"Chrontel: Unsupported device id (%d) detected\n",temp1);
- andSISIDXREG(SISCR, 0x32, ~0x07);
- pSiS->postVBCR32 &= ~0x07;
- }
- if(chronteltype == 1) {
- /* Set general purpose IO for Chrontel communication */
- SiS_SetChrontelGPIO(pSiS->SiS_Pr, 0x00);
- }
+ andSISIDXREG(SISCR, 0x32, ~0x07);
+ pSiS->postVBCR32 &= ~0x07;
+ }
+ if(chronteltype == 1) {
+ /* Set general purpose IO for Chrontel communication */
+ SiS_SetChrontelGPIO(pSiS->SiS_Pr, 0x00);
+ }
}
if((pSiS->NewCRLayout) && (temp == 4)) {
pSiS->VBFlags |= VB_CONEXANT;
@@ -1283,18 +1284,18 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
"Converting SR17 (%02x) to CR32 (%02x)\n", sr17, cr32);
if(sr17 & 0x01) { /* CRT1 */
- orSISIDXREG(SISCR, 0x32, 0x20);
+ orSISIDXREG(SISCR, 0x32, 0x20);
pSiS->postVBCR32 |= 0x20;
} else {
- andSISIDXREG(SISCR, 0x32, ~0x20);
+ andSISIDXREG(SISCR, 0x32, ~0x20);
pSiS->postVBCR32 &= ~0x20;
}
if(sr17 & 0x02) { /* LCD */
- orSISIDXREG(SISCR, 0x32, 0x08);
+ orSISIDXREG(SISCR, 0x32, 0x08);
pSiS->postVBCR32 |= 0x08;
} else {
- andSISIDXREG(SISCR, 0x32, ~0x08);
+ andSISIDXREG(SISCR, 0x32, ~0x08);
pSiS->postVBCR32 &= ~0x08;
}
@@ -1314,43 +1315,43 @@ void SISVGAPreInit(ScrnInfoPtr pScrn)
if(pSiS->VBFlags & (VB_301C | VB_302B | VB_301LV | VB_302LV | VB_302ELV)) {
if(pSiS->sisfblcda != 0xff) {
if((pSiS->sisfblcda & 0x03) == 0x03) {
- pSiS->SiS_Pr->SiS_UseLCDA = TRUE;
- pSiS->ChipFlags |= SiSCF_UseLCDA;
+ pSiS->SiS_Pr->SiS_UseLCDA = TRUE;
+ pSiS->ChipFlags |= SiSCF_UseLCDA;
}
} else {
inSISIDXREG(SISCR,0x34,temp);
if(temp <= 0x13) {
- inSISIDXREG(SISCR,0x38,temp);
- if((temp & 0x03) == 0x03) {
- pSiS->SiS_Pr->SiS_UseLCDA = TRUE;
- pSiS->ChipFlags |= SiSCF_UseLCDA;
+ inSISIDXREG(SISCR,0x38,temp);
+ if((temp & 0x03) == 0x03) {
+ pSiS->SiS_Pr->SiS_UseLCDA = TRUE;
+ pSiS->ChipFlags |= SiSCF_UseLCDA;
pSiS->SiS_Pr->Backup = TRUE;
- } else {
+ } else {
orSISIDXREG(SISPART1,0x2f,0x01); /* Unlock CRT2 */
inSISIDXREG(SISPART1,0x13,temp);
if(temp & 0x04) {
pSiS->SiS_Pr->SiS_UseLCDA = TRUE;
- pSiS->ChipFlags |= SiSCF_UseLCDA;
+ pSiS->ChipFlags |= SiSCF_UseLCDA;
pSiS->SiS_Pr->Backup = TRUE;
}
- }
+ }
}
}
if(pSiS->ChipFlags & SiSCF_UseLCDA) {
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);
- inSISIDXREG(SISPART1,0x14,pSiS->SiS_Pr->Backup_14);
- inSISIDXREG(SISPART1,0x15,pSiS->SiS_Pr->Backup_15);
- inSISIDXREG(SISPART1,0x16,pSiS->SiS_Pr->Backup_16);
- inSISIDXREG(SISPART1,0x17,pSiS->SiS_Pr->Backup_17);
- inSISIDXREG(SISPART1,0x18,pSiS->SiS_Pr->Backup_18);
- inSISIDXREG(SISPART1,0x19,pSiS->SiS_Pr->Backup_19);
- inSISIDXREG(SISPART1,0x1a,pSiS->SiS_Pr->Backup_1a);
- inSISIDXREG(SISPART1,0x1b,pSiS->SiS_Pr->Backup_1b);
- inSISIDXREG(SISPART1,0x1c,pSiS->SiS_Pr->Backup_1c);
- inSISIDXREG(SISPART1,0x1d,pSiS->SiS_Pr->Backup_1d);
+ inSISIDXREG(SISCR,0x34,pSiS->SiS_Pr->Backup_Mode);
+ inSISIDXREG(SISPART1,0x14,pSiS->SiS_Pr->Backup_14);
+ inSISIDXREG(SISPART1,0x15,pSiS->SiS_Pr->Backup_15);
+ inSISIDXREG(SISPART1,0x16,pSiS->SiS_Pr->Backup_16);
+ inSISIDXREG(SISPART1,0x17,pSiS->SiS_Pr->Backup_17);
+ inSISIDXREG(SISPART1,0x18,pSiS->SiS_Pr->Backup_18);
+ inSISIDXREG(SISPART1,0x19,pSiS->SiS_Pr->Backup_19);
+ inSISIDXREG(SISPART1,0x1a,pSiS->SiS_Pr->Backup_1a);
+ inSISIDXREG(SISPART1,0x1b,pSiS->SiS_Pr->Backup_1b);
+ inSISIDXREG(SISPART1,0x1c,pSiS->SiS_Pr->Backup_1c);
+ inSISIDXREG(SISPART1,0x1d,pSiS->SiS_Pr->Backup_1d);
}
}
}
@@ -1421,7 +1422,7 @@ SiSVGASaveFonts(ScrnInfoPtr pScrn)
if(!(pSiS->fonts = xalloc(SIS_FONTS_SIZE * 2))) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Could not save console fonts, mem allocation failed\n");
+ "Could not save console fonts, mem allocation failed\n");
return;
}
@@ -1706,7 +1707,7 @@ SiSVGAMapMem(ScrnInfoPtr pScrn)
#if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(4,3,0,0,0)
pSiS->VGAMemBase = xf86MapDomainMemory(pScrn->scrnIndex, VIDMEM_MMIO_32BIT,
- pSiS->PciTag, pSiS->VGAMapPhys, pSiS->VGAMapSize);
+ pSiS->PciTag, pSiS->VGAMapPhys, pSiS->VGAMapSize);
#else
pSiS->VGAMemBase = xf86MapVidMem(pScrn->scrnIndex, VIDMEM_MMIO_32BIT,
pSiS->VGAMapPhys, pSiS->VGAMapSize);
@@ -1805,8 +1806,8 @@ SiSVGAInit(ScrnInfoPtr pScrn, DisplayModePtr mode, int fixsync)
} else {
int VDisplay = mode->VDisplay;
- if(mode->Flags & V_DBLSCAN) VDisplay *= 2;
- if(mode->VScan > 1) VDisplay *= mode->VScan;
+ if(mode->Flags & V_DBLSCAN) VDisplay *= 2;
+ if(mode->VScan > 1) VDisplay *= mode->VScan;
if(VDisplay < 400) regp->sisRegMiscOut = 0xA3; /* +hsync -vsync */
else if (VDisplay < 480) regp->sisRegMiscOut = 0x63; /* -hsync +vsync */
@@ -1839,16 +1840,16 @@ SiSVGAInit(ScrnInfoPtr pScrn, DisplayModePtr mode, int fixsync)
if(i < 0x80) regp->sisRegs3D4[3] |= i;
regp->sisRegs3D4[4] = (mode->CrtcHSyncStart >> 3) - fixsync;
regp->sisRegs3D4[5] = ((((mode->CrtcHBlankEnd >> 3) - 1) & 0x20) << 2) |
- (((mode->CrtcHSyncEnd >> 3) - fixsync) & 0x1F);
+ (((mode->CrtcHSyncEnd >> 3) - fixsync) & 0x1F);
regp->sisRegs3D4[6] = (mode->CrtcVTotal - 2) & 0xFF;
regp->sisRegs3D4[7] = (((mode->CrtcVTotal - 2) & 0x100) >> 8) |
- (((mode->CrtcVDisplay - 1) & 0x100) >> 7) |
- (((mode->CrtcVSyncStart - fixsync) & 0x100) >> 6) |
- (((mode->CrtcVBlankStart - 1) & 0x100) >> 5) |
- 0x10 |
- (((mode->CrtcVTotal - 2) & 0x200) >> 4) |
- (((mode->CrtcVDisplay - 1) & 0x200) >> 3) |
- (((mode->CrtcVSyncStart - fixsync) & 0x200) >> 2);
+ (((mode->CrtcVDisplay - 1) & 0x100) >> 7) |
+ (((mode->CrtcVSyncStart - fixsync) & 0x100) >> 6) |
+ (((mode->CrtcVBlankStart - 1) & 0x100) >> 5) |
+ 0x10 |
+ (((mode->CrtcVTotal - 2) & 0x200) >> 4) |
+ (((mode->CrtcVDisplay - 1) & 0x200) >> 3) |
+ (((mode->CrtcVSyncStart - fixsync) & 0x200) >> 2);
regp->sisRegs3D4[8] = 0x00;
regp->sisRegs3D4[9] = (((mode->CrtcVBlankStart - 1) & 0x200) >> 4) | 0x40;
if(mode->Flags & V_DBLSCAN) regp->sisRegs3D4[9] |= 0x80;
@@ -1868,7 +1869,7 @@ SiSVGAInit(ScrnInfoPtr pScrn, DisplayModePtr mode, int fixsync)
regp->sisRegs3D4[21] = (mode->CrtcVBlankStart - 1) & 0xFF;
regp->sisRegs3D4[22] = (mode->CrtcVBlankEnd - 1) & 0xFF;
if(depth < 8) regp->sisRegs3D4[23] = 0xE3;
- else regp->sisRegs3D4[23] = 0xC3;
+ else regp->sisRegs3D4[23] = 0xC3;
regp->sisRegs3D4[24] = 0xFF;
#if 0
@@ -1889,22 +1890,9 @@ SiSVGAInit(ScrnInfoPtr pScrn, DisplayModePtr mode, int fixsync)
regp->sisRegsGR[8] = 0xFF;
/* Attr */
- regp->sisRegsATTR[0] = 0x00; /* standard colormap translation */
- regp->sisRegsATTR[1] = 0x01;
- regp->sisRegsATTR[2] = 0x02;
- regp->sisRegsATTR[3] = 0x03;
- regp->sisRegsATTR[4] = 0x04;
- regp->sisRegsATTR[5] = 0x05;
- regp->sisRegsATTR[6] = 0x06;
- regp->sisRegsATTR[7] = 0x07;
- regp->sisRegsATTR[8] = 0x08;
- regp->sisRegsATTR[9] = 0x09;
- regp->sisRegsATTR[10] = 0x0A;
- regp->sisRegsATTR[11] = 0x0B;
- regp->sisRegsATTR[12] = 0x0C;
- regp->sisRegsATTR[13] = 0x0D;
- regp->sisRegsATTR[14] = 0x0E;
- regp->sisRegsATTR[15] = 0x0F;
+ for(i = 0; i <= 15; i++) { /* standard colormap translation */
+ regp->sisRegsATTR[i] = i;
+ }
if(depth == 4) regp->sisRegsATTR[16] = 0x81;
else regp->sisRegsATTR[16] = 0x41;
if(depth >= 4) regp->sisRegsATTR[17] = 0xFF;
@@ -1913,7 +1901,7 @@ SiSVGAInit(ScrnInfoPtr pScrn, DisplayModePtr mode, int fixsync)
regp->sisRegsATTR[19] = 0x00;
regp->sisRegsATTR[20] = 0x00;
- return(TRUE);
+ return TRUE;
}
static void
diff --git a/src/sis_video.c b/src/sis_video.c
index b690a63..3c99b4f 100644
--- a/src/sis_video.c
+++ b/src/sis_video.c
@@ -47,11 +47,12 @@
* 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
+ * SiS340: - not finished yet; dda stuff missing - 2 overlays. Extended registers for DDA.
+ * SiS761: - 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
- * 300/630/730 = SIS_300_VGA
+ * 315/550/650/740/M650/651/330/661/741/760/340/761 = SIS_315_VGA
+ * 300/630/730 = SIS_300_VGA
* For chipsets with 2 overlays, hasTwoOverlays will be true
*
* Notes on display modes:
@@ -164,24 +165,20 @@ extern void SISWriteBlitPacket(SISPtr pSiS, CARD32 *packet);
#define IMAGE_MAX_WIDTH_300 720
#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 IMAGE_MAX_WIDTH_761 1920 /* ? */
+#define IMAGE_MAX_HEIGHT_315 1080
#define OVERLAY_MIN_WIDTH 32 /* Minimum overlay sizes */
#define OVERLAY_MIN_HEIGHT 24
-#define DISPMODE_SINGLE1 0x1 /* CRT1 only */
-#define DISPMODE_SINGLE2 0x2 /* CRT2 only */
-#define DISPMODE_MIRROR 0x4 /* CRT1 + CRT2 MIRROR (see note below) */
+#define DISPMODE_SINGLE1 0x1 /* CRT1 only */
+#define DISPMODE_SINGLE2 0x2 /* CRT2 only */
+#define DISPMODE_MIRROR 0x4 /* CRT1 + CRT2 MIRROR (see note below) */
-#define LINEBUFLIMIT1 384 /* Limits at which line buffers must be merged */
-#define LINEBUFLIMIT2 720
-#define LINEBUFLIMIT3 576
-#define LINEBUFLIMIT4 1280 /* 340 */
+#define SISPRIVLINID 0x53495337 /* Private ID for private linears */
-#ifdef SISDUALHEAD
-#define HEADOFFSET (pSiS->dhmOffset)
-#endif
+#define FBOFFSET (pSiS->dhmOffset)
/* Note on "MIRROR":
* When using VESA on machines with an enabled video bridge, this means
@@ -666,7 +663,10 @@ typedef struct {
int tvxpos, tvypos;
Bool updatetvxpos, updatetvypos;
+ Bool is661741760;
+ Bool is760;
Bool is340;
+ Bool is761;
} SISPortPrivRec, *SISPortPrivPtr;
@@ -863,14 +863,14 @@ static CARD8 getsrreg(SISPtr pSiS, CARD8 reg)
{
CARD8 ret;
inSISIDXREG(SISSR, reg, ret);
- return(ret);
+ return ret;
}
static CARD8 getvideoreg(SISPtr pSiS, CARD8 reg)
{
CARD8 ret;
inSISIDXREG(SISVID, reg, ret);
- return(ret);
+ return ret;
}
static __inline void setvideoreg(SISPtr pSiS, CARD8 reg, CARD8 data)
@@ -964,7 +964,7 @@ SiSSetXvGamma(SISPtr pSiS)
setsrregmask(pSiS, 0x1f, 0x08, 0x18);
for(i = 0; i <= 255; i++) {
SIS_MMIO_OUT32(pSiS->IOBase, 0x8570,
- (i << 24) |
+ (i << 24) |
(pSiS->XvGammaRampBlue[i] << 16) |
(pSiS->XvGammaRampGreen[i] << 8) |
pSiS->XvGammaRampRed[i]);
@@ -1128,10 +1128,10 @@ SISResetVideo(ScrnInfoPtr pScrn)
sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL);
#endif
if(getvideoreg (pSiS, Index_VI_Passwd) != 0xa1) {
- setvideoreg (pSiS, Index_VI_Passwd, 0x86);
- if(getvideoreg (pSiS, Index_VI_Passwd) != 0xa1)
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Xv: Video password could not unlock registers\n");
+ setvideoreg (pSiS, Index_VI_Passwd, 0x86);
+ if(getvideoreg (pSiS, Index_VI_Passwd) != 0xa1)
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Xv: Video password could not unlock registers\n");
}
/* Initialize first overlay (CRT1) ------------------------------- */
@@ -1168,21 +1168,29 @@ 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) { /* 340? */
+ if(pSiS->Chipset == PCI_CHIP_SIS330) {
setvideoregmask(pSiS, Index_VI_Key_Overlay_OP, 0x00, 0x10);
- } else if(pSiS->Chipset == PCI_CHIP_SIS660) {
+ } else if(pPriv->is661741760) {
setvideoregmask(pSiS, Index_VI_Key_Overlay_OP, 0x00, 0xE0);
- }
- if(pSiS->sishw_ext.jChipType == SIS_661) {
- setvideoregmask(pSiS, Index_VI_V_Buf_Start_Over, 0x2c, 0x3c);
+ if(pPriv->is760) {
+ setvideoregmask(pSiS, Index_VI_V_Buf_Start_Over, 0x3c, 0x3c);
+ } else { /* 661, 741 */
+ setvideoregmask(pSiS, Index_VI_V_Buf_Start_Over, 0x2c, 0x3c);
+ }
+ } else if(pSiS->Chipset == PCI_CHIP_SIS340) {
+ setvideoregmask(pSiS, 0xb5, 0x00, 0x01); /* Threshold high? */
+ setvideoregmask(pSiS, 0xb6, 0x00, 0x01);
+ setvideoregmask(pSiS, Index_VI_Key_Overlay_OP, 0x40, 0x40);
+ setvideoregmask(pSiS, Index_VI_Key_Overlay_OP, 0x00, 0x80);
+ /* CalcDDAScaler(pSiS, pPriv, ?); */
+ } else if(pPriv->is761) {
+ setvideoregmask(pSiS, Index_VI_Key_Overlay_OP, 0x40, 0x40);
+ setvideoregmask(pSiS, Index_VI_Key_Overlay_OP, 0x00, 0x80);
+ setvideoregmask(pSiS, 0xb6, 0x02, 0x02);
+ /* CalcDDAScaler(pSiS, pPriv, ?); */
}
- if((pSiS->ChipFlags & SiSCF_Is65x) || (pSiS->Chipset == PCI_CHIP_SIS660)) {
+ if((pSiS->ChipFlags & SiSCF_Is65x) || (pPriv->is661741760)) {
setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x00, 0x04);
}
@@ -1191,48 +1199,56 @@ SISResetVideo(ScrnInfoPtr pScrn)
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) {
+ if(pSiS->hasTwoOverlays) {
- if(pSiS->VGAEngine == SIS_300_VGA) {
- /* Write-enable video registers */
- setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x81, 0x81);
+ if(pSiS->VGAEngine == SIS_300_VGA) {
+ /* Write-enable video registers */
+ setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x81, 0x81);
} else {
/* Select overlay 2, clear all linebuffer related bits */
- setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x01, 0xb1);
- }
+ setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x01, 0xb1);
+ }
- /* Disable overlay */
- setvideoregmask(pSiS, Index_VI_Control_Misc0, 0x00, 0x02);
+ /* Disable overlay */
+ setvideoregmask(pSiS, Index_VI_Control_Misc0, 0x00, 0x02);
- /* Disable bob de-interlacer and some strange bit */
- setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x82);
+ /* Disable bob de-interlacer and some strange bit */
+ setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x82);
/* Select RGB chroma key format */
if(pSiS->VGAEngine == SIS_300_VGA) {
setvideoregmask(pSiS, Index_VI_Control_Misc0, 0x00, 0x40);
}
- /* Reset scale control and contrast */
+ /* Reset scale control and contrast */
/* (Enable DDA (interpolation)) */
- setvideoregmask(pSiS, Index_VI_Scale_Control, 0x60, 0x60);
- setvideoregmask(pSiS, Index_VI_Contrast_Enh_Ctrl, 0x04, 0x1F);
-
- setvideoreg(pSiS, Index_VI_Disp_Y_Buf_Preset_Low, 0x00);
- setvideoreg(pSiS, Index_VI_Disp_Y_Buf_Preset_Middle, 0x00);
- setvideoreg(pSiS, Index_VI_UV_Buf_Preset_Low, 0x00);
- setvideoreg(pSiS, Index_VI_UV_Buf_Preset_Middle, 0x00);
- 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_SIS330) {
- 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);
- }
- if(pSiS->sishw_ext.jChipType == SIS_661) {
- setvideoregmask(pSiS, Index_VI_V_Buf_Start_Over, 0x24, 0x3c);
- }
+ setvideoregmask(pSiS, Index_VI_Scale_Control, 0x60, 0x60);
+ setvideoregmask(pSiS, Index_VI_Contrast_Enh_Ctrl, 0x04, 0x1F);
+
+ setvideoreg(pSiS, Index_VI_Disp_Y_Buf_Preset_Low, 0x00);
+ setvideoreg(pSiS, Index_VI_Disp_Y_Buf_Preset_Middle, 0x00);
+ setvideoreg(pSiS, Index_VI_UV_Buf_Preset_Low, 0x00);
+ setvideoreg(pSiS, Index_VI_UV_Buf_Preset_Middle, 0x00);
+ 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(pPriv->is661741760) {
+ CARD8 temp;
+ setvideoregmask(pSiS, Index_VI_Key_Overlay_OP, 0x00, 0xE0);
+ switch(pSiS->sishw_ext.jChipType) {
+ case SIS_661: temp = 0x24; break;
+ case SIS_741: temp = 0x2c; break;
+ default: temp = 0x3c;
+ }
+ setvideoregmask(pSiS, Index_VI_V_Buf_Start_Over, temp, 0x3c);
+ } else if(pSiS->Chipset == PCI_CHIP_SIS340) {
+ setvideoregmask(pSiS, 0xb5, 0x00, 0x01); /* Threshold high? */
+ setvideoregmask(pSiS, 0xb6, 0x00, 0x01);
+ setvideoregmask(pSiS, Index_VI_Key_Overlay_OP, 0x40, 0x40);
+ setvideoregmask(pSiS, Index_VI_Key_Overlay_OP, 0x00, 0x80);
+ /* CalcDDAScaler(pSiS, pPriv, ?); */
+ }
setvideoreg(pSiS, Index_VI_Win_Ver_Disp_Start_Low, 0x00);
setvideoreg(pSiS, Index_VI_Win_Ver_Over, 0x00);
@@ -1249,7 +1265,7 @@ SISResetVideo(ScrnInfoPtr pScrn)
}
/* set default properties for overlay 2(CRT2) -------------------------- */
- if(pPriv->hasTwoOverlays) {
+ if(pSiS->hasTwoOverlays) {
setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x01, 0x01);
setvideoregmask(pSiS, Index_VI_Contrast_Enh_Ctrl, 0x04, 0x07);
setvideoreg(pSiS, Index_VI_Brightness, 0x20);
@@ -1279,12 +1295,14 @@ set_dispmode(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
pPriv->dualHeadMode = pPriv->bridgeIsSlave = FALSE;
- if(SiSBridgeIsInSlaveMode(pScrn)) pPriv->bridgeIsSlave = TRUE;
+ if(SiSBridgeIsInSlaveMode(pScrn)) {
+ pPriv->bridgeIsSlave = TRUE;
+ }
if( (pSiS->VBFlags & VB_DISPMODE_MIRROR) ||
((pPriv->bridgeIsSlave) && (pSiS->VBFlags & DISPTYPE_DISP2)) ) {
if(pPriv->hasTwoOverlays)
- pPriv->displayMode = DISPMODE_MIRROR; /* CRT1+CRT2 (2 overlays) */
+ pPriv->displayMode = DISPMODE_MIRROR; /* CRT1+CRT2 (2 overlays) */
else if(pPriv->crtnum)
pPriv->displayMode = DISPMODE_SINGLE2; /* CRT2 only */
else
@@ -1292,17 +1310,17 @@ set_dispmode(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
} else {
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
- pPriv->dualHeadMode = TRUE;
- if(pSiS->SecondHead)
+ pPriv->dualHeadMode = TRUE;
+ if(pSiS->SecondHead)
pPriv->displayMode = DISPMODE_SINGLE1; /* CRT1 only */
else
pPriv->displayMode = DISPMODE_SINGLE2; /* CRT2 only */
} else
#endif
if(pSiS->VBFlags & DISPTYPE_DISP1) {
- pPriv->displayMode = DISPMODE_SINGLE1; /* CRT1 only */
+ pPriv->displayMode = DISPMODE_SINGLE1; /* CRT1 only */
} else {
- pPriv->displayMode = DISPMODE_SINGLE2; /* CRT2 only */
+ pPriv->displayMode = DISPMODE_SINGLE2; /* CRT2 only */
}
}
}
@@ -1348,120 +1366,157 @@ set_disptype_regs(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
switch (pPriv->displayMode)
{
- case DISPMODE_SINGLE1: /* CRT1-only mode: */
+ case DISPMODE_SINGLE1: /* CRT1-only mode: */
if(pPriv->hasTwoOverlays) {
if(pPriv->dualHeadMode) {
- setsrregmask(pSiS, 0x06, 0x00, 0x40); /* overlay 0 -> CRT1 */
- setsrregmask(pSiS, 0x32, 0x00, 0x40);
+ setsrregmask(pSiS, 0x06, 0x00, 0x40); /* overlay 0 -> CRT1 */
+ setsrregmask(pSiS, 0x32, 0x00, 0x40);
} else {
- setsrregmask(pSiS, 0x06, 0x00, 0xc0); /* both overlays -> CRT1 */
- setsrregmask(pSiS, 0x32, 0x00, 0xc0);
- }
+ setsrregmask(pSiS, 0x06, 0x00, 0xc0); /* both overlays -> CRT1 */
+ setsrregmask(pSiS, 0x32, 0x00, 0xc0);
+ }
} else {
#ifdef SISDUALHEAD
if((!pPriv->dualHeadMode) || (crtnum == 0)) {
#endif
- setsrregmask(pSiS, 0x06, 0x00, 0xc0); /* only overlay -> CRT1 */
- setsrregmask(pSiS, 0x32, 0x00, 0xc0);
+ setsrregmask(pSiS, 0x06, 0x00, 0xc0); /* only overlay -> CRT1 */
+ setsrregmask(pSiS, 0x32, 0x00, 0xc0);
#ifdef SISDUALHEAD
}
#endif
}
break;
- case DISPMODE_SINGLE2: /* CRT2-only mode: */
+ case DISPMODE_SINGLE2: /* CRT2-only mode: */
if(pPriv->hasTwoOverlays) {
if(pPriv->dualHeadMode) {
- setsrregmask(pSiS, 0x06, 0x80, 0x80); /* overlay 1 -> CRT2 */
- setsrregmask(pSiS, 0x32, 0x80, 0x80);
+ setsrregmask(pSiS, 0x06, 0x80, 0x80); /* overlay 1 -> CRT2 */
+ setsrregmask(pSiS, 0x32, 0x80, 0x80);
} else {
- setsrregmask(pSiS, 0x06, 0x40, 0xc0); /* overlay 0 -> CRT2 */
- setsrregmask(pSiS, 0x32, 0xc0, 0xc0); /* (although both clocks for CRT2!) */
+ setsrregmask(pSiS, 0x06, 0x40, 0xc0); /* overlay 0 -> CRT2 */
+ setsrregmask(pSiS, 0x32, 0xc0, 0xc0); /* (although both clocks for CRT2!) */
}
} else {
#ifdef SISDUALHEAD
if((!pPriv->dualHeadMode) || (crtnum == 1)) {
#endif
- setsrregmask(pSiS, 0x06, 0x40, 0xc0); /* only overlay -> CRT2 */
- setsrregmask(pSiS, 0x32, 0x40, 0xc0);
+ if(pSiS->MiscFlags & MISC_SIS760ONEOVERLAY) {
+ setsrregmask(pSiS, 0x06, 0x40, 0xc0); /* overlay 0 -> CRT2 */
+ setsrregmask(pSiS, 0x32, 0xc0, 0xc0); /* (although both clocks for CRT2!) */
+ } else {
+ setsrregmask(pSiS, 0x06, 0x40, 0xc0); /* only overlay -> CRT2 */
+ setsrregmask(pSiS, 0x32, 0x40, 0xc0);
+ }
#ifdef SISDUALHEAD
}
#endif
}
break;
- case DISPMODE_MIRROR: /* CRT1+CRT2-mode: (only on chips with 2 overlays) */
- default:
- setsrregmask(pSiS, 0x06, 0x80, 0xc0); /* overlay 0 -> CRT1, overlay 1 -> CRT2 */
- setsrregmask(pSiS, 0x32, 0x80, 0xc0);
+ case DISPMODE_MIRROR: /* CRT1+CRT2-mode: (only on chips with 2 overlays) */
+ default:
+ setsrregmask(pSiS, 0x06, 0x80, 0xc0); /* overlay 0 -> CRT1, overlay 1 -> CRT2 */
+ setsrregmask(pSiS, 0x32, 0x80, 0xc0);
break;
}
}
static void
-set_allowswitchcrt(SISPtr pSiS, SISPortPrivPtr pPriv)
+set_hastwooverlays(SISPtr pSiS, SISPortPrivPtr pPriv)
{
+ int temp, watchdog;
+
if(pSiS->hasTwoOverlays) {
- pPriv->AllowSwitchCRT = FALSE;
- } else {
- pPriv->AllowSwitchCRT = TRUE;
- if(pSiS->XvOnCRT2) {
- if(!(pSiS->VBFlags & DISPTYPE_DISP1)) {
- pPriv->AllowSwitchCRT = FALSE;
+ if(pSiS->MiscFlags & MISC_SIS760ONEOVERLAY) {
+ if(pPriv->hasTwoOverlays) {
+ /* Disable overlay 1 on change */
+ setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x01, 0x01);
+ setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x01);
+ temp = getvideoreg(pSiS,Index_VI_Control_Misc0);
+ if(temp & 0x02) {
+ 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);
+ }
}
+ pPriv->hasTwoOverlays = FALSE;
} else {
- if(!(pSiS->VBFlags & DISPTYPE_DISP2)) {
- pPriv->AllowSwitchCRT = FALSE;
- }
+ pPriv->hasTwoOverlays = TRUE;
}
+ } else {
+ pPriv->hasTwoOverlays = FALSE;
+ }
+}
+
+static void
+set_allowswitchcrt(SISPtr pSiS, SISPortPrivPtr pPriv)
+{
+ if(pPriv->hasTwoOverlays) {
+ pPriv->AllowSwitchCRT = FALSE;
+ } else if((!(pSiS->VBFlags & DISPTYPE_DISP1)) || (!(pSiS->VBFlags & DISPTYPE_DISP2))) {
+ pPriv->AllowSwitchCRT = FALSE;
+ if(!(pSiS->VBFlags & DISPTYPE_DISP1)) pPriv->crtnum = 1;
+ else pPriv->crtnum = 0;
+ } else {
+ pPriv->AllowSwitchCRT = TRUE;
}
}
static void
set_maxencoding(SISPtr pSiS, SISPortPrivPtr pPriv)
{
+ int half;
+
if(pSiS->VGAEngine == SIS_300_VGA) {
DummyEncoding.width = IMAGE_MAX_WIDTH_300;
DummyEncoding.height = IMAGE_MAX_HEIGHT_300;
} else {
DummyEncoding.width = IMAGE_MAX_WIDTH_315;
DummyEncoding.height = IMAGE_MAX_HEIGHT_315;
- if(pSiS->Chipset == PCI_CHIP_SIS340) {
+ half = IMAGE_MAX_WIDTH_315 >> 1;
+ if(pPriv->is661741760) {
+ half = 768 * 2;
+ } else if(pPriv->is340) {
DummyEncoding.width = IMAGE_MAX_WIDTH_340;
+ half = 1280; /* ? */
+ } else if(pPriv->is761) {
+ DummyEncoding.width = IMAGE_MAX_WIDTH_761;
+ half = 1920; /* ? */
}
if(pPriv->hasTwoOverlays) {
- /* Only half width available if both overlays
- * are going to be used
- */
#ifdef SISDUALHEAD
if(pSiS->DualHeadMode) {
- if(pSiS->Chipset == PCI_CHIP_SIS660) {
- DummyEncoding.width = 1536;
- } else {
- DummyEncoding.width >>= 1;
- }
+ DummyEncoding.width = half;
} else
#endif
#ifdef SISMERGED
if(pSiS->MergedFB) {
- if(pSiS->Chipset == PCI_CHIP_SIS660) {
- DummyEncoding.width = 1536;
- } else {
- DummyEncoding.width >>= 1;
- }
+ DummyEncoding.width = half;
} else
#endif
if(pPriv->displayMode == DISPMODE_MIRROR) {
- if(pSiS->Chipset == PCI_CHIP_SIS660) {
- DummyEncoding.width = 1536;
- } else {
- DummyEncoding.width >>= 1;
- }
+ DummyEncoding.width = half;
}
}
}
}
+static void
+SISResetXvDisplay(ScrnInfoPtr pScrn)
+{
+ SISPtr pSiS = SISPTR(pScrn);
+ SISPortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn);
+
+ if(!pPriv) return;
+
+ set_hastwooverlays(pSiS, pPriv);
+ set_allowswitchcrt(pSiS, pPriv);
+ set_dispmode(pScrn, pPriv);
+ set_maxencoding(pSiS, pPriv);
+}
+
static XF86VideoAdaptorPtr
SISSetupImageVideo(ScreenPtr pScreen)
{
@@ -1473,14 +1528,16 @@ SISSetupImageVideo(ScreenPtr pScreen)
#if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,1,99,1,0)
XAAInfoRecPtr pXAA = pSiS->AccelInfoPtr;
- if (!pXAA || !pXAA->FillSolidRects)
- return NULL;
+ if(!pXAA || !pXAA->FillSolidRects) {
+ return NULL;
+ }
#endif
if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) +
sizeof(SISPortPrivRec) +
- sizeof(DevUnion))))
- return NULL;
+ sizeof(DevUnion)))) {
+ return NULL;
+ }
adapt->type = XvWindowMask | XvInputMask | XvImageMask;
adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT;
@@ -1495,24 +1552,20 @@ SISSetupImageVideo(ScreenPtr pScreen)
pPriv = (SISPortPrivPtr)(&adapt->pPortPrivates[1]);
- /* Setup chipset type helpers */
- if(pSiS->hasTwoOverlays) {
- pPriv->hasTwoOverlays = TRUE;
- pPriv->AllowSwitchCRT = FALSE;
- } else {
- pPriv->hasTwoOverlays = FALSE;
- pPriv->AllowSwitchCRT = TRUE;
- if(pSiS->XvOnCRT2) {
- if(!(pSiS->VBFlags & DISPTYPE_DISP1)) {
- pPriv->AllowSwitchCRT = FALSE;
- }
- } else {
- if(!(pSiS->VBFlags & DISPTYPE_DISP2)) {
- pPriv->AllowSwitchCRT = FALSE;
- }
- }
- }
+ pPriv->videoStatus = 0;
+ pPriv->currentBuf = 0;
+ pPriv->linear = NULL;
+ pPriv->grabbedByV4L= FALSE;
+ pPriv->NoOverlay = FALSE;
+ pPriv->PrevOverlay = FALSE;
+ pPriv->is661741760 = ((pSiS->sishw_ext.jChipType >= SIS_661) &&
+ (pSiS->sishw_ext.jChipType <= SIS_760)) ? TRUE : FALSE;
+ pPriv->is760 = (pSiS->sishw_ext.jChipType == SIS_760) ? TRUE : FALSE;
+ pPriv->is761 = (pSiS->sishw_ext.jChipType == SIS_761) ? TRUE : FALSE;
+ pPriv->is340 = (pSiS->Chipset == PCI_CHIP_SIS340) ? TRUE : FALSE;
+ /* Setup chipset type helpers */
+ set_hastwooverlays(pSiS, pPriv);
set_allowswitchcrt(pSiS, pPriv);
adapt->pPortPrivates[0].ptr = (pointer)(pPriv);
@@ -1528,7 +1581,9 @@ SISSetupImageVideo(ScreenPtr pScreen)
}
adapt->pAttributes = SISAttributes_315;
adapt->nAttributes = NUM_ATTRIBUTES_315;
- if(pPriv->hasTwoOverlays) adapt->nAttributes--;
+ if((pSiS->hasTwoOverlays) && (!(pSiS->SiS_SD2_Flags & SiS_SD2_SUPPORT760OO))) {
+ adapt->nAttributes--;
+ }
}
adapt->pImages = SISImages;
@@ -1543,14 +1598,6 @@ SISSetupImageVideo(ScreenPtr pScreen)
adapt->PutImage = SISPutImage;
adapt->QueryImageAttributes = SISQueryImageAttributes;
- pPriv->videoStatus = 0;
- pPriv->currentBuf = 0;
- pPriv->linear = NULL;
- 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)
REGION_NULL(pScreen, &pPriv->clip);
@@ -1560,21 +1607,21 @@ SISSetupImageVideo(ScreenPtr pScreen)
pSiS->adaptor = adapt;
- pSiS->xvBrightness = MAKE_ATOM(sisxvbrightness);
- pSiS->xvContrast = MAKE_ATOM(sisxvcontrast);
- pSiS->xvColorKey = MAKE_ATOM(sisxvcolorkey);
- pSiS->xvSaturation = MAKE_ATOM(sisxvsaturation);
- pSiS->xvHue = MAKE_ATOM(sisxvhue);
- pSiS->xvSwitchCRT = MAKE_ATOM(sisxvswitchcrt);
+ pSiS->xvBrightness = MAKE_ATOM(sisxvbrightness);
+ pSiS->xvContrast = MAKE_ATOM(sisxvcontrast);
+ pSiS->xvColorKey = MAKE_ATOM(sisxvcolorkey);
+ pSiS->xvSaturation = MAKE_ATOM(sisxvsaturation);
+ pSiS->xvHue = MAKE_ATOM(sisxvhue);
+ pSiS->xvSwitchCRT = MAKE_ATOM(sisxvswitchcrt);
pSiS->xvAutopaintColorKey = MAKE_ATOM(sisxvautopaintcolorkey);
pSiS->xvSetDefaults = MAKE_ATOM(sisxvsetdefaults);
pSiS->xvDisableGfx = MAKE_ATOM(sisxvdisablegfx);
pSiS->xvDisableGfxLR = MAKE_ATOM(sisxvdisablegfxlr);
pSiS->xvTVXPosition = MAKE_ATOM(sisxvtvxposition);
pSiS->xvTVYPosition = MAKE_ATOM(sisxvtvyposition);
- pSiS->xvGammaRed = MAKE_ATOM(sisxvgammared);
- pSiS->xvGammaGreen = MAKE_ATOM(sisxvgammagreen);
- pSiS->xvGammaBlue = MAKE_ATOM(sisxvgammablue);
+ pSiS->xvGammaRed = MAKE_ATOM(sisxvgammared);
+ pSiS->xvGammaGreen = MAKE_ATOM(sisxvgammagreen);
+ pSiS->xvGammaBlue = MAKE_ATOM(sisxvgammablue);
pSiS->xvDisableColorkey = MAKE_ATOM(sisxvdisablecolorkey);
pSiS->xvUseChromakey = MAKE_ATOM(sisxvusechromakey);
pSiS->xvInsideChromakey = MAKE_ATOM(sisxvinsidechromakey);
@@ -1653,11 +1700,11 @@ SISSetupImageVideo(ScreenPtr pScreen)
*/
switch (pSiS->VGAEngine) {
case SIS_315_VGA:
- pPriv->shiftValue = 1;
+ pPriv->shiftValue = 1;
break;
case SIS_300_VGA:
default:
- pPriv->shiftValue = 2;
+ pPriv->shiftValue = 2;
break;
}
@@ -1667,15 +1714,17 @@ SISSetupImageVideo(ScreenPtr pScreen)
/* Now for the linebuffer stuff.
* All chipsets have a certain number of linebuffers, each of a certain
* size. The number of buffers is per overlay.
- * Chip number size max video size
- * 300 2 ? 720x576
- * 630/730 2 ? 720x576
- * 315 2 960? 1920x1080
- * 650/740 2 960 ("120x128") 1920x1080
- * M650/651.. 4 480 1920x1080
- * 330 2 960 1920x1080
- * 661/741/760 4 768 1920x1080
- * 340 2 1280? ?
+ * Chip number size max video size
+ * 300 2 ? 720x576
+ * 630/730 2 ? 720x576
+ * 315 2 960? 1920x1080
+ * 550 2? 960? 1920x1080?
+ * 650/740 2 960 ("120x128") 1920x1080
+ * M650/651.. 4 480 1920x1080
+ * 330 2 960 1920x1080
+ * 661/741/760 4 768 1920x1080
+ * 340 4 1280? 1920x1080?
+ * 761 4 1536? 1920x1080?
* 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).
@@ -1686,30 +1735,33 @@ SISSetupImageVideo(ScreenPtr pScreen)
* If both overlays are going to be used (such as in modes were both
* CRT1 and CRT2 are active), we are limited to the half of the
* maximum width, or 1536 on 661/741/760.
+ * There is a known hardware problem with the 760 and 761 if the video
+ * data is in the UMA area: The memory access latency is too big to
+ * allow two overlays under some circumstances. Therefore, we must
+ * support switching between hasTwoOverlays and !hasTwoOverlays on
+ * the fly.
*/
- pPriv->linebufMergeLimit = LINEBUFLIMIT1;
- if(pSiS->Chipset == PCI_CHIP_SIS660) {
- pPriv->linebufMergeLimit = LINEBUFLIMIT3;
- }
-
- set_maxencoding(pSiS, pPriv);
-
if(pSiS->VGAEngine == SIS_300_VGA) {
pPriv->linebufmask = 0x11;
+ pPriv->linebufMergeLimit = 384;
} else {
pPriv->linebufmask = 0xb1;
- if(!(pPriv->hasTwoOverlays)) {
- /* On machines with only one overlay, the linebuffers are
- * generally larger, so our merging-limit is higher, too.
- */
- pPriv->linebufMergeLimit = LINEBUFLIMIT2;
- if(pSiS->Chipset == PCI_CHIP_SIS340) {
- pPriv->linebufMergeLimit = LINEBUFLIMIT4;
- }
+ pPriv->linebufMergeLimit = 384; /* should be 480 */
+ if(pPriv->is661741760) {
+ pPriv->linebufMergeLimit = 576; /* should be 768 */
+ } else if(pPriv->is340) {
+ pPriv->linebufMergeLimit = 1280; /* should be 1280 */
+ } else if(pPriv->is761) {
+ pPriv->linebufMergeLimit = 1536; /* should be 1536 */
+ } else if(!(pPriv->hasTwoOverlays)) {
+ pPriv->linebufMergeLimit = 720; /* should be 960 */
}
+ /* No special treatment for 760/761 required */
}
+ set_maxencoding(pSiS, pPriv);
+
/* Reset the properties to their defaults */
SISSetPortDefaults(pScrn, pPriv);
@@ -1718,6 +1770,7 @@ SISSetupImageVideo(ScreenPtr pScreen)
SISResetVideo(pScrn);
pSiS->ResetXv = SISResetVideo;
+ pSiS->ResetXvDisplay = SISResetXvDisplay;
if(pSiS->VGAEngine == SIS_315_VGA) {
pSiS->ResetXvGamma = SISResetXvGamma;
}
@@ -1734,20 +1787,20 @@ RegionsEqual(RegionPtr A, RegionPtr B)
num = REGION_NUM_RECTS(A);
if(num != REGION_NUM_RECTS(B))
- return FALSE;
+ return FALSE;
if((A->extents.x1 != B->extents.x1) ||
(A->extents.x2 != B->extents.x2) ||
(A->extents.y1 != B->extents.y1) ||
(A->extents.y2 != B->extents.y2))
- return FALSE;
+ return FALSE;
dataA = (int*)REGION_RECTS(A);
dataB = (int*)REGION_RECTS(B);
while(num--) {
if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1]))
- return FALSE;
+ return FALSE;
dataA += 2;
dataB += 2;
}
@@ -1861,8 +1914,9 @@ SISSetPortAttribute(ScrnInfoPtr pScrn, Atom attribute,
#endif
if(pSiS->xv_sisdirectunlocked) {
SISSwitchCRT2Type(pScrn, (ULong)value);
- set_dispmode(pScrn, pPriv);
+ set_hastwooverlays(pSiS, pPriv);
set_allowswitchcrt(pSiS, pPriv);
+ set_dispmode(pScrn, pPriv);
set_maxencoding(pSiS, pPriv);
}
} else if(attribute == pSiS->xv_CT1) {
@@ -1871,8 +1925,9 @@ SISSetPortAttribute(ScrnInfoPtr pScrn, Atom attribute,
#endif
if(pSiS->xv_sisdirectunlocked) {
SISSwitchCRT1Status(pScrn, (ULong)value);
- set_dispmode(pScrn, pPriv);
+ set_hastwooverlays(pSiS, pPriv);
set_allowswitchcrt(pSiS, pPriv);
+ set_dispmode(pScrn, pPriv);
set_maxencoding(pSiS, pPriv);
}
} else if(attribute == pSiS->xv_RDT) {
@@ -2524,7 +2579,7 @@ calc_scale_factor(SISOverlayPtr pOverlay, ScrnInfoPtr pScrn,
{
SISPtr pSiS = SISPTR(pScrn);
CARD32 I=0,mult=0;
- int flag=0;
+ int flag=0, flag2=0;
int dstW = pOverlay->dstBox.x2 - pOverlay->dstBox.x1;
int dstH = pOverlay->dstBox.y2 - pOverlay->dstBox.y1;
@@ -2538,19 +2593,23 @@ calc_scale_factor(SISOverlayPtr pOverlay, ScrnInfoPtr pScrn,
/* Stretch image due to panel link scaling */
if(pSiS->VBFlags & (CRT2_LCD | CRT1_LCDA)) {
if(pPriv->bridgeIsSlave) {
- if(pSiS->VBFlags & (VB_LVDS | VB_30xBDH)) {
- if(pSiS->MiscFlags & MISC_PANELLINKSCALER) {
- dstH = (dstH * LCDheight) / pOverlay->SCREENheight;
- }
+ if(pSiS->VBFlags & (VB_LVDS | VB_30xBDH)) {
+ if(pSiS->MiscFlags & MISC_PANELLINKSCALER) {
+ dstH = (dstH * LCDheight) / pOverlay->SCREENheight;
+ }
}
} else if((iscrt2 && (pSiS->VBFlags & CRT2_LCD)) ||
- (!iscrt2 && (pSiS->VBFlags & CRT1_LCDA))) {
- if(pSiS->VBFlags & (VB_LVDS | VB_30xBDH | CRT1_LCDA)) {
+ (!iscrt2 && (pSiS->VBFlags & CRT1_LCDA))) {
+ if(pSiS->VBFlags & (VB_LVDS | VB_30xBDH | CRT1_LCDA)) {
if(pSiS->MiscFlags & MISC_PANELLINKSCALER) {
- dstH = (dstH * LCDheight) / pOverlay->SCREENheight;
+ dstH = (dstH * LCDheight) / pOverlay->SCREENheight;
if(pPriv->displayMode == DISPMODE_MIRROR) flag = 1;
}
- }
+ }
+ }
+ if((pPriv->bridgeIsSlave || iscrt2) &&
+ (pSiS->MiscFlags & MISC_STNMODE)) {
+ flag2 = 1;
}
}
@@ -2558,15 +2617,14 @@ calc_scale_factor(SISOverlayPtr pOverlay, ScrnInfoPtr pScrn,
* On 315 and 550 (?), we need to double the width as well.
* Interlace mode vice versa.
*/
- if(modeflags & V_DBLSCAN) {
+ if((modeflags & V_DBLSCAN) && !flag2) {
dstH = origdstH << 1;
flag = 0;
if((pSiS->sishw_ext.jChipType >= SIS_315H) &&
(pSiS->sishw_ext.jChipType <= SIS_550)) {
dstW <<= 1;
}
- }
- if(modeflags & V_INTERLACE) {
+ } else if(modeflags & V_INTERLACE) {
dstH = origdstH >> 1;
flag = 0;
}
@@ -2603,7 +2661,7 @@ calc_scale_factor(SISOverlayPtr pOverlay, ScrnInfoPtr pScrn,
if((srcW % dstW))
pOverlay->HUSF = ((srcW - dstW) << 16) / dstW;
else
- pOverlay->HUSF = 0x00;
+ pOverlay->HUSF = 0;
}
if(dstH < OVERLAY_MIN_HEIGHT) dstH = OVERLAY_MIN_HEIGHT;
@@ -2611,7 +2669,7 @@ calc_scale_factor(SISOverlayPtr pOverlay, ScrnInfoPtr pScrn,
pOverlay->VUSF = 0x00;
pOverlay->IntBit |= 0x0A;
} else if(dstH > srcH) {
- dstH += 0x02;
+ dstH += 2;
pOverlay->VUSF = (srcH << 16) / dstH;
pOverlay->IntBit |= 0x08;
} else {
@@ -2620,31 +2678,31 @@ calc_scale_factor(SISOverlayPtr pOverlay, ScrnInfoPtr pScrn,
pOverlay->IntBit |= 0x02;
if(I < 2) {
- pOverlay->VUSF = ((srcH - dstH) << 16) / dstH;
+ pOverlay->VUSF = ((srcH - dstH) << 16) / dstH;
/* 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)){
- pOverlay->bobEnable |= 0x08;
- srcPitch >>= 1;
- }
+ if(((pOverlay->bobEnable & 0x08) == 0x00) &&
+ (((srcPitch * I) >> 2) > 0xFFF)){
+ pOverlay->bobEnable |= 0x08;
+ srcPitch >>= 1;
+ }
#endif
- if(((srcPitch * I) >> 2) > 0xFFF) {
- I = (0xFFF * 2 / srcPitch);
- pOverlay->VUSF = 0xFFFF;
- } else {
- dstH = I * dstH;
- if(srcH % dstH)
- pOverlay->VUSF = ((srcH - dstH) << 16) / dstH;
- else
- pOverlay->VUSF = 0x00;
- }
- /* set video frame buffer offset */
- pOverlay->pitch = (CARD16)(srcPitch * I);
+ if(((srcPitch * I) >> 2) > 0xFFF) {
+ I = (0xFFF * 2 / srcPitch);
+ pOverlay->VUSF = 0xFFFF;
+ } else {
+ dstH = I * dstH;
+ if(srcH % dstH)
+ pOverlay->VUSF = ((srcH - dstH) << 16) / dstH;
+ else
+ pOverlay->VUSF = 0;
+ }
+ /* set video frame buffer offset */
+ pOverlay->pitch = (CARD16)(srcPitch * I);
}
}
}
@@ -2656,7 +2714,7 @@ calc_scale_factor_2(SISOverlayPtr pOverlay, ScrnInfoPtr pScrn,
{
SISPtr pSiS = SISPTR(pScrn);
CARD32 I=0,mult=0;
- int flag=0;
+ int flag=0, flag2=0;
int dstW = pOverlay->dstBox2.x2 - pOverlay->dstBox2.x1;
int dstH = pOverlay->dstBox2.y2 - pOverlay->dstBox2.y1;
@@ -2671,21 +2729,22 @@ calc_scale_factor_2(SISOverlayPtr pOverlay, ScrnInfoPtr pScrn,
if(pSiS->VBFlags & CRT2_LCD) {
if(pSiS->VBFlags & (VB_LVDS | VB_30xBDH)) {
if(pSiS->MiscFlags & MISC_PANELLINKSCALER) {
- dstH = (dstH * LCDheight) / pOverlay->SCREENheight2;
+ dstH = (dstH * LCDheight) / pOverlay->SCREENheight2;
flag = 1;
}
+ if(pSiS->MiscFlags & MISC_STNMODE) flag2 = 1;
}
}
/* For double scan modes, we need to double the height
* On 315 and 550 (?), we need to double the width as well.
* Interlace mode vice versa.
*/
- if(modeflags & V_DBLSCAN) {
+ if((modeflags & V_DBLSCAN) && !flag2) {
dstH = origdstH << 1;
flag = 0;
if((pSiS->sishw_ext.jChipType >= SIS_315H) &&
(pSiS->sishw_ext.jChipType <= SIS_550)) {
- dstW <<= 1;
+ dstW <<= 1;
}
}
if(modeflags & V_INTERLACE) {
@@ -2708,7 +2767,7 @@ calc_scale_factor_2(SISOverlayPtr pOverlay, ScrnInfoPtr pScrn,
/* It seems, the hardware can't scale below factor .125 (=1/8) if the
pitch isn't a multiple of 256.
- TODO: Test this on the 315 series!
+ TODO: Test this on the 315 series!
*/
if((srcPitch % 256) || (srcPitch < 256)) {
if(((dstW * 1000) / srcW) < 125) dstW = tmpW = ((srcW * 125) / 1000) + 1;
@@ -2742,31 +2801,31 @@ calc_scale_factor_2(SISOverlayPtr pOverlay, ScrnInfoPtr pScrn,
pOverlay->IntBit2 |= 0x02;
if(I < 2) {
- pOverlay->VUSF2 = ((srcH - dstH) << 16) / dstH;
+ pOverlay->VUSF2 = ((srcH - dstH) << 16) / dstH;
/* Needed for LCD-scaling modes */
if(flag && ((mult = (srcH / origdstH)) >= 2)) {
pOverlay->pitch2 /= mult;
}
} else {
#if 0
- if(((pOverlay->bobEnable & 0x08) == 0x00) &&
- (((srcPitch * I)>>2) > 0xFFF)){
- pOverlay->bobEnable |= 0x08;
- srcPitch >>= 1;
- }
+ if(((pOverlay->bobEnable & 0x08) == 0x00) &&
+ (((srcPitch * I)>>2) > 0xFFF)){
+ pOverlay->bobEnable |= 0x08;
+ srcPitch >>= 1;
+ }
#endif
- if(((srcPitch * I) >> 2) > 0xFFF) {
- I = (0xFFF * 2 / srcPitch);
- pOverlay->VUSF2 = 0xFFFF;
- } else {
- dstH = I * dstH;
- if(srcH % dstH)
- pOverlay->VUSF2 = ((srcH - dstH) << 16) / dstH;
- else
- pOverlay->VUSF2 = 0x00;
- }
- /* set video frame buffer offset */
- pOverlay->pitch2 = (CARD16)(srcPitch * I);
+ if(((srcPitch * I) >> 2) > 0xFFF) {
+ I = (0xFFF * 2 / srcPitch);
+ pOverlay->VUSF2 = 0xFFFF;
+ } else {
+ dstH = I * dstH;
+ if(srcH % dstH)
+ pOverlay->VUSF2 = ((srcH - dstH) << 16) / dstH;
+ else
+ pOverlay->VUSF2 = 0x00;
+ }
+ /* set video frame buffer offset */
+ pOverlay->pitch2 = (CARD16)(srcPitch * I);
}
}
}
@@ -2775,46 +2834,58 @@ calc_scale_factor_2(SISOverlayPtr pOverlay, ScrnInfoPtr pScrn,
static CARD16
calc_line_buf_size(CARD32 srcW, CARD8 wHPre, CARD8 planar, SISPortPrivPtr pPriv)
{
- CARD32 I;
+ CARD32 I, mask = 0xffffffff, shift = pPriv->is761 ? 1 : 0;
if(planar) {
switch(wHPre & 0x07) {
case 3:
- I = (srcW >> 8);
- if(srcW & 0xff) I++;
+ shift += 8;
+ mask <<= shift;
+ I = srcW >> shift;
+ if((mask & srcW) != srcW) I++;
I <<= 5;
break;
case 4:
- I = (srcW >> 9);
- if(srcW & 0x1ff) I++;
+ shift += 9;
+ mask <<= shift;
+ I = srcW >> shift;
+ if((mask & srcW) != srcW) I++;
I <<= 6;
break;
case 5:
- I = (srcW >> 10);
- if(srcW & 0x3ff) I++;
+ shift += 10;
+ mask <<= shift;
+ I = srcW >> shift;
+ if((mask & srcW) != srcW) I++;
I <<= 7;
break;
case 6:
- if(pPriv->is340) {
- I = (srcW >> 11);
- if(srcW & 0x7ff) I++;
+ if(pPriv->is340) { /* 761 ? */
+ shift += 11;
+ mask <<= shift;
+ I = srcW >> shift;
+ if((mask & srcW) != srcW) I++;
I <<= 8;
break;
} else {
- return((CARD16)(255));
+ return((CARD16)(255));
}
default:
- I = (srcW >> 7);
- if(srcW & 0x7f) I++;
+ shift += 7;
+ mask <<= shift;
+ I = srcW >> shift;
+ if((mask & srcW) != srcW) I++;
I <<= 4;
break;
}
} else { /* packed */
- I = (srcW >> 3);
- if(srcW & 0x07) I++;
+ shift += 3;
+ mask <<= shift;
+ I = srcW >> shift;
+ if((mask & srcW) != srcW) I++;
}
@@ -2827,7 +2898,7 @@ static __inline void
calc_line_buf_size_1(SISOverlayPtr pOverlay, SISPortPrivPtr pPriv)
{
pOverlay->lineBufSize =
- calc_line_buf_size(pOverlay->srcW, pOverlay->wHPre, pOverlay->planar, pPriv);
+ calc_line_buf_size(pOverlay->srcW, pOverlay->wHPre, pOverlay->planar, pPriv);
}
#ifdef SISMERGED
@@ -2835,7 +2906,7 @@ static __inline void
calc_line_buf_size_2(SISOverlayPtr pOverlay, SISPortPrivPtr pPriv)
{
pOverlay->lineBufSize2 =
- calc_line_buf_size(pOverlay->srcW2, pOverlay->wHPre2, pOverlay->planar, pPriv);
+ calc_line_buf_size(pOverlay->srcW2, pOverlay->wHPre2, pOverlay->planar, pPriv);
}
static void
@@ -2861,8 +2932,20 @@ merge_line_buf_mfb(SISPtr pSiS, SISPortPrivPtr pPriv, Bool enable1, Bool enable2
} else { /* This means we are either in SINGLE1 or SINGLE2 mode */
misc2 = 0x00;
- if(enable1 || enable2) misc1 = 0x04;
- else misc1 = 0x00;
+ if(enable1 || enable2) {
+ if(pSiS->MiscFlags & MISC_SIS760ONEOVERLAY) {
+ if((width1 > (limit * 2)) || (width2 > (limit * 2))) {
+ misc2 = 0x20;
+ } else {
+ misc2 = 0x10;
+ }
+ misc1 = 0x00;
+ } else {
+ misc1 = 0x04;
+ }
+ } else {
+ misc1 = 0x00;
+ }
setvideoregmask(pSiS, Index_VI_Control_Misc2, misc2, mask);
setvideoregmask(pSiS, Index_VI_Control_Misc1, misc1, 0x04);
@@ -2920,16 +3003,23 @@ merge_line_buf(SISPtr pSiS, SISPortPrivPtr pPriv, Bool enable, short width, shor
} else {
if(pPriv->hasTwoOverlays) {
if(pPriv->dualHeadMode) {
- misc2 = 0x00;
+ misc2 = 0x00;
misc1 = 0x04;
} else {
- if(width > (limit * 2)) {
+ if(width > (limit * 2)) {
misc2 = 0x20;
} else {
- misc2 = 0x10;
+ misc2 = 0x10;
}
misc1 = 0x00;
}
+ } else if(pSiS->MiscFlags & MISC_SIS760ONEOVERLAY) {
+ if(width > (limit * 2)) {
+ misc2 = 0x20;
+ } else {
+ misc2 = 0x10;
+ }
+ misc1 = 0x00;
} else {
misc2 = 0x00;
misc1 = 0x04;
@@ -2951,16 +3041,23 @@ merge_line_buf(SISPtr pSiS, SISPortPrivPtr pPriv, Bool enable, short width, shor
} else {
if(pPriv->hasTwoOverlays) {
if(pPriv->dualHeadMode) {
- misc2 = 0x01;
+ misc2 = 0x01;
misc1 = 0x04;
} else {
- if(width > (limit * 2)) {
+ if(width > (limit * 2)) {
misc2 = 0x20;
} else {
- misc2 = 0x10;
+ misc2 = 0x10;
}
misc1 = 0x00;
}
+ } else if(pSiS->MiscFlags & MISC_SIS760ONEOVERLAY) {
+ if(width > (limit * 2)) {
+ misc2 = 0x20;
+ } else {
+ misc2 = 0x10;
+ }
+ misc1 = 0x00;
} else {
misc2 = 0x00;
misc1 = 0x04;
@@ -2979,21 +3076,21 @@ merge_line_buf(SISPtr pSiS, SISPortPrivPtr pPriv, Bool enable, short width, shor
break;
}
- } else { /* ----- disable linebuffer merge */
+ } else { /* ----- disable linebuffer merge */
switch(pPriv->displayMode) {
case DISPMODE_SINGLE1:
setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x00, mask);
- setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x04);
- break;
+ setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x04);
+ break;
case DISPMODE_SINGLE2:
- if(pSiS->VGAEngine == SIS_300_VGA) {
+ if(pSiS->VGAEngine == SIS_300_VGA) {
if(pPriv->dualHeadMode) misc2 = 0x01;
else misc2 = 0x00;
- } else {
- if(pPriv->hasTwoOverlays) {
+ } else {
+ if(pPriv->hasTwoOverlays) {
if(pPriv->dualHeadMode) misc2 = 0x01;
else misc2 = 0x00;
} else {
@@ -3001,16 +3098,16 @@ merge_line_buf(SISPtr pSiS, SISPortPrivPtr pPriv, Bool enable, short width, shor
}
}
setvideoregmask(pSiS, Index_VI_Control_Misc2, misc2, mask);
- setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x04);
+ setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x04);
break;
case DISPMODE_MIRROR: /* This can only be on chips with 2 overlays */
default:
- setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x00, mask);
- setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x04);
+ setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x00, mask);
+ setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x04);
setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x01, mask);
- setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x04);
- break;
+ setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x04);
+ break;
}
}
}
@@ -3059,8 +3156,8 @@ set_colorkey(SISPtr pSiS, CARD32 colorkey)
CARD8 r, g, b;
b = (CARD8)(colorkey & 0xFF);
- g = (CARD8)((colorkey>>8) & 0xFF);
- r = (CARD8)((colorkey>>16) & 0xFF);
+ g = (CARD8)((colorkey >> 8) & 0xFF);
+ r = (CARD8)((colorkey >> 16) & 0xFF);
setvideoreg(pSiS, Index_VI_Overlay_ColorKey_Blue_Min ,(CARD8)b);
setvideoreg(pSiS, Index_VI_Overlay_ColorKey_Green_Min ,(CARD8)g);
@@ -3078,11 +3175,11 @@ set_chromakey(SISPtr pSiS, CARD32 chromamin, CARD32 chromamax)
CARD8 r2, g2, b2;
b1 = (CARD8)(chromamin & 0xFF);
- g1 = (CARD8)((chromamin>>8) & 0xFF);
- r1 = (CARD8)((chromamin>>16) & 0xFF);
+ g1 = (CARD8)((chromamin >> 8) & 0xFF);
+ r1 = (CARD8)((chromamin >> 16) & 0xFF);
b2 = (CARD8)(chromamax & 0xFF);
- g2 = (CARD8)((chromamax>>8) & 0xFF);
- r2 = (CARD8)((chromamax>>16) & 0xFF);
+ g2 = (CARD8)((chromamax >> 8) & 0xFF);
+ r2 = (CARD8)((chromamax >> 16) & 0xFF);
setvideoreg(pSiS, Index_VI_Overlay_ChromaKey_Blue_V_Min ,(CARD8)b1);
setvideoreg(pSiS, Index_VI_Overlay_ChromaKey_Green_U_Min ,(CARD8)g1);
@@ -3192,15 +3289,15 @@ set_overlay(SISPtr pSiS, SISOverlayPtr pOverlay, SISPortPrivPtr pPriv, int index
right = screenX;
}
- /* DoubleScan modes require Y coordinates * 2 */
- if(modeflags & V_DBLSCAN) {
- top <<= 1;
- bottom <<= 1;
- }
- /* Interlace modes require Y coordinates / 2 */
- if(modeflags & V_INTERLACE) {
- top >>= 1;
- bottom >>= 1;
+ if( (modeflags & V_DBLSCAN) &&
+ (!((pPriv->bridgeIsSlave || iscrt2) && (pSiS->MiscFlags & MISC_STNMODE))) ) {
+ /* DoubleScan modes require Y coordinates * 2 */
+ top <<= 1;
+ bottom <<= 1;
+ } else if(modeflags & V_INTERLACE) {
+ /* Interlace modes require Y coordinates / 2 */
+ top >>= 1;
+ bottom >>= 1;
}
h_over = (((left>>8) & 0x0f) | ((right>>4) & 0xf0));
@@ -3211,12 +3308,14 @@ set_overlay(SISPtr pSiS, SISOverlayPtr pOverlay, SISPortPrivPtr pPriv, int index
if(pSiS->MergedFB && iscrt2) {
setvideoreg(pSiS, Index_VI_Line_Buffer_Size, (CARD8)pOverlay->lineBufSize2);
if(pPriv->is340) {
+ /* FIXME */
setvideoreg(pSiS, Index_VI_Line_Buffer_Size_High, (CARD8)(pOverlay->lineBufSize2 >> 8));
}
} else {
#endif
setvideoreg(pSiS, Index_VI_Line_Buffer_Size, (CARD8)pOverlay->lineBufSize);
if(pPriv->is340) {
+ /* FIXME */
setvideoreg(pSiS, Index_VI_Line_Buffer_Size_High, (CARD8)(pOverlay->lineBufSize >> 8));
}
#ifdef SISMERGED
@@ -3232,23 +3331,23 @@ set_overlay(SISPtr pSiS, SISOverlayPtr pOverlay, SISPortPrivPtr pPriv, int index
if(index) {
CARD16 mytop = getvideoreg(pSiS, Index_VI_Win_Ver_Disp_Start_Low);
- mytop |= ((getvideoreg(pSiS, Index_VI_Win_Ver_Over) & 0x0f) << 8);
+ 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));
+ 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);
+ watchdog = WATCHDOG_DELAY;
+ while(pOverlay->VBlankActiveFunc(pSiS, pPriv) && --watchdog);
+ watchdog = WATCHDOG_DELAY;
+ while((!pOverlay->VBlankActiveFunc(pSiS, pPriv)) && --watchdog);
}
}
@@ -3290,36 +3389,36 @@ set_overlay(SISPtr pSiS, SISOverlayPtr pOverlay, SISPortPrivPtr pPriv, int index
/* Set U/V data if using planar formats */
if(pOverlay->planar) {
- CARD32 PSU = pOverlay->PSU;
+ CARD32 PSU = pOverlay->PSU;
CARD32 PSV = pOverlay->PSV;
#ifdef SISMERGED
- if(pSiS->MergedFB && iscrt2) {
+ if(pSiS->MergedFB && iscrt2) {
PSU = pOverlay->PSU2;
- PSV = pOverlay->PSV2;
+ PSV = pOverlay->PSV2;
}
#endif
- if(pOverlay->planar_shiftpitch) pitch >>= 1;
+ if(pOverlay->planar_shiftpitch) pitch >>= 1;
/* Set U/V pitch */
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);
+ 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));
+ /* 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_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)(pitch >> 12));
setvideoreg(pSiS, Index_VI_U_Buf_Start_Over, ((CARD8)(PSU >> 24) & 0x03));
- if(pSiS->sishw_ext.jChipType == SIS_661) {
+ if(pPriv->is661741760) {
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));
@@ -3376,8 +3475,8 @@ close_overlay(SISPtr pSiS, SISPortPrivPtr pPriv)
if(pPriv->hasTwoOverlays) {
- if((pPriv->dualHeadMode) || (pPriv->displayMode == DISPMODE_MIRROR)) {
- setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x01, 0x01);
+ if((pPriv->dualHeadMode) || (pPriv->displayMode == DISPMODE_MIRROR)) {
+ setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x01, 0x01);
} else {
setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x00, 0x01);
}
@@ -3385,12 +3484,12 @@ close_overlay(SISPtr pSiS, SISPortPrivPtr pPriv)
} else if(pPriv->displayMode == DISPMODE_SINGLE2) {
#ifdef SISDUALHEAD
- if(pPriv->dualHeadMode) {
+ if(pPriv->dualHeadMode) {
/* Check if overlay already grabbed by other head */
if(!(getsrreg(pSiS, 0x06) & 0x40)) return;
}
#endif
- setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x00, 0x01);
+ setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x00, 0x01);
}
@@ -3419,7 +3518,7 @@ close_overlay(SISPtr pSiS, SISPortPrivPtr pPriv)
#ifdef SISDUALHEAD
if(pPriv->dualHeadMode) {
- if(!pPriv->hasTwoOverlays) {
+ if(!pPriv->hasTwoOverlays) {
/* Check if overlay already grabbed by other head */
if(getsrreg(pSiS, 0x06) & 0x40) return;
}
@@ -3463,22 +3562,25 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
int sx2 = 0, sy2 = 0;
#endif
+ /* Determine whether we have two overlays or only one */
+ set_hastwooverlays(pSiS, pPriv);
+
pPriv->NoOverlay = FALSE;
#ifdef SISDUALHEAD
if(pPriv->dualHeadMode) {
if(!pPriv->hasTwoOverlays) {
- if(pSiS->SecondHead) {
+ if(pSiS->SecondHead) {
if(pSiSEnt->curxvcrtnum != 0) {
if(pPriv->overlayStatus) {
- close_overlay(pSiS, pPriv);
+ close_overlay(pSiS, pPriv);
}
pPriv->NoOverlay = TRUE;
return;
}
- } else {
+ } else {
if(pSiSEnt->curxvcrtnum != 1) {
if(pPriv->overlayStatus) {
- close_overlay(pSiS, pPriv);
+ close_overlay(pSiS, pPriv);
}
pPriv->NoOverlay = TRUE;
return;
@@ -3669,40 +3771,40 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
/* If neither overlay is to be displayed, disable them if they are currently enabled */
if((!overlay.DoFirst) && (!overlay.DoSecond)) {
setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x00, 0x05);
- setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x01);
+ setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x01);
temp = getvideoreg(pSiS,Index_VI_Control_Misc0);
if(temp & 0x02) {
watchdog = WATCHDOG_DELAY;
if(pPriv->hasTwoOverlays) {
while((!vblank_active_CRT1(pSiS, pPriv)) && --watchdog);
- watchdog = WATCHDOG_DELAY;
+ watchdog = WATCHDOG_DELAY;
while(vblank_active_CRT1(pSiS, pPriv) && --watchdog);
} else {
temp = getsrreg(pSiS, 0x06);
if(!(temp & 0x40)) {
- while((!vblank_active_CRT1(pSiS, pPriv)) && --watchdog);
- watchdog = WATCHDOG_DELAY;
+ while((!vblank_active_CRT1(pSiS, pPriv)) && --watchdog);
+ watchdog = WATCHDOG_DELAY;
while(vblank_active_CRT1(pSiS, pPriv) && --watchdog);
} else {
- while((!vblank_active_CRT2(pSiS, pPriv)) && --watchdog);
- 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);
+ setvideoregmask(pSiS, Index_VI_Control_Misc0, 0x00, 0x02);
}
if(pPriv->hasTwoOverlays) {
- setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x01, 0x01);
- setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x01);
+ setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x01, 0x01);
+ setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x01);
temp = getvideoreg(pSiS,Index_VI_Control_Misc0);
if(temp & 0x02) {
watchdog = WATCHDOG_DELAY;
while((!vblank_active_CRT2(pSiS, pPriv)) && --watchdog);
- watchdog = WATCHDOG_DELAY;
+ watchdog = WATCHDOG_DELAY;
while(vblank_active_CRT2(pSiS, pPriv) && --watchdog);
- setvideoregmask(pSiS, Index_VI_Control_Misc0, 0x00, 0x02);
+ setvideoregmask(pSiS, Index_VI_Control_Misc0, 0x00, 0x02);
}
- }
+ }
pPriv->overlayStatus = FALSE;
return;
}
@@ -3722,11 +3824,9 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
overlay.PSY = pPriv->bufAddr[pPriv->currentBuf] + sx + sy*srcPitch;
overlay.PSV = pPriv->bufAddr[pPriv->currentBuf] + height*srcPitch + ((sx + sy*srcPitch/2) >> 1);
overlay.PSU = pPriv->bufAddr[pPriv->currentBuf] + height*srcPitch*5/4 + ((sx + sy*srcPitch/2) >> 1);
-#ifdef SISDUALHEAD
- overlay.PSY += HEADOFFSET;
- overlay.PSV += HEADOFFSET;
- overlay.PSU += HEADOFFSET;
-#endif
+ overlay.PSY += FBOFFSET;
+ overlay.PSV += FBOFFSET;
+ overlay.PSU += FBOFFSET;
overlay.PSY >>= pPriv->shiftValue;
overlay.PSV >>= pPriv->shiftValue;
overlay.PSU >>= pPriv->shiftValue;
@@ -3756,11 +3856,9 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
overlay.PSY = pPriv->bufAddr[pPriv->currentBuf] + sx + sy*srcPitch;
overlay.PSV = pPriv->bufAddr[pPriv->currentBuf] + height*srcPitch*5/4 + ((sx + sy*srcPitch/2) >> 1);
overlay.PSU = pPriv->bufAddr[pPriv->currentBuf] + height*srcPitch + ((sx + sy*srcPitch/2) >> 1);
-#ifdef SISDUALHEAD
- overlay.PSY += HEADOFFSET;
- overlay.PSV += HEADOFFSET;
- overlay.PSU += HEADOFFSET;
-#endif
+ overlay.PSY += FBOFFSET;
+ overlay.PSV += FBOFFSET;
+ overlay.PSU += FBOFFSET;
overlay.PSY >>= pPriv->shiftValue;
overlay.PSV >>= pPriv->shiftValue;
overlay.PSU >>= pPriv->shiftValue;
@@ -3790,10 +3888,8 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
sy = (pPriv->src_y + srcOffsetY) & ~1;
overlay.PSY = pPriv->bufAddr[pPriv->currentBuf] + sx + sy*srcPitch;
overlay.PSV = pPriv->bufAddr[pPriv->currentBuf] + height*srcPitch + ((sx + sy*srcPitch/2) >> 1);
-#ifdef SISDUALHEAD
- overlay.PSY += HEADOFFSET;
- overlay.PSV += HEADOFFSET;
-#endif
+ overlay.PSY += FBOFFSET;
+ overlay.PSV += FBOFFSET;
overlay.PSY >>= pPriv->shiftValue;
overlay.PSV >>= pPriv->shiftValue;
overlay.PSU = overlay.PSV;
@@ -3824,9 +3920,7 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
sx = (pPriv->src_x + srcOffsetX) & ~1;
sy = (pPriv->src_y + srcOffsetY);
overlay.PSY = (pPriv->bufAddr[pPriv->currentBuf] + sx*2 + sy*srcPitch);
-#ifdef SISDUALHEAD
- overlay.PSY += HEADOFFSET;
-#endif
+ overlay.PSY += FBOFFSET;
overlay.PSY >>= pPriv->shiftValue;
#ifdef SISMERGED
}
@@ -3847,7 +3941,7 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
overlay.srcW = pPriv->src_w - (sx - pPriv->src_x);
overlay.srcH = pPriv->src_h - (sy - pPriv->src_y);
if( (pPriv->oldx1 != overlay.dstBox.x1) ||
- (pPriv->oldx2 != overlay.dstBox.x2) ||
+ (pPriv->oldx2 != overlay.dstBox.x2) ||
(pPriv->oldy1 != overlay.dstBox.y1) ||
(pPriv->oldy2 != overlay.dstBox.y2) ) {
pPriv->mustwait = 1;
@@ -3860,7 +3954,7 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
overlay.srcW2 = pPriv->src_w - (sx2 - pPriv->src_x);
overlay.srcH2 = pPriv->src_h - (sy2 - pPriv->src_y);
if( (pPriv->oldx1_2 != overlay.dstBox2.x1) ||
- (pPriv->oldx2_2 != overlay.dstBox2.x2) ||
+ (pPriv->oldx2_2 != overlay.dstBox2.x2) ||
(pPriv->oldy1_2 != overlay.dstBox2.y1) ||
(pPriv->oldy2_2 != overlay.dstBox2.y2) ) {
pPriv->mustwait = 1;
@@ -3875,25 +3969,25 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
if((pSiS->MergedFB) && (pPriv->hasTwoOverlays)) {
if(!overlay.DoFirst) {
setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x00, 0x05);
- setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x01);
+ setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x01);
temp = getvideoreg(pSiS,Index_VI_Control_Misc0);
if(temp & 0x02) {
watchdog = WATCHDOG_DELAY;
while((!vblank_active_CRT1(pSiS, pPriv)) && --watchdog);
- watchdog = WATCHDOG_DELAY;
+ watchdog = WATCHDOG_DELAY;
while(vblank_active_CRT1(pSiS, pPriv) && --watchdog);
- setvideoregmask(pSiS, Index_VI_Control_Misc0, 0x00, 0x02);
+ setvideoregmask(pSiS, Index_VI_Control_Misc0, 0x00, 0x02);
}
} else if(!overlay.DoSecond) {
- setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x01, 0x01);
- setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x01);
+ setvideoregmask(pSiS, Index_VI_Control_Misc2, 0x01, 0x01);
+ setvideoregmask(pSiS, Index_VI_Control_Misc1, 0x00, 0x01);
temp = getvideoreg(pSiS,Index_VI_Control_Misc0);
if(temp & 0x02) {
watchdog = WATCHDOG_DELAY;
while((!vblank_active_CRT2(pSiS, pPriv)) && --watchdog);
- watchdog = WATCHDOG_DELAY;
+ watchdog = WATCHDOG_DELAY;
while(vblank_active_CRT2(pSiS, pPriv) && --watchdog);
- setvideoregmask(pSiS, Index_VI_Control_Misc0, 0x00, 0x02);
+ setvideoregmask(pSiS, Index_VI_Control_Misc0, 0x00, 0x02);
}
}
}
@@ -3908,24 +4002,24 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
* is only used for CRT2.
*/
if(pPriv->displayMode & DISPMODE_SINGLE2) {
- if(pPriv->hasTwoOverlays) { /* We have 2 overlays: */
- if(pPriv->dualHeadMode) {
+ if(pPriv->hasTwoOverlays) { /* We have 2 overlays: */
+ if(pPriv->dualHeadMode) {
/* Dual head: We use overlay 2 for CRT2 */
- index = 1; iscrt2 = 1;
+ index = 1; iscrt2 = 1;
} else {
/* Single head: We use overlay 1 for CRT2 */
index = 0; iscrt2 = 1;
}
- } else { /* We have 1 overlay */
- /* We use that only overlay for CRT2 */
- index = 0; iscrt2 = 1;
+ } else { /* We have 1 overlay */
+ /* We use that only overlay for CRT2 */
+ index = 0; iscrt2 = 1;
}
overlay.VBlankActiveFunc = vblank_active_CRT2;
#ifdef SISMERGED
if(!pPriv->hasTwoOverlays) {
- if((pSiS->MergedFB) && (!overlay.DoSecond)) {
+ if((pSiS->MergedFB) && (!overlay.DoSecond)) {
index = 0; iscrt2 = 0;
- overlay.VBlankActiveFunc = vblank_active_CRT1;
+ overlay.VBlankActiveFunc = vblank_active_CRT1;
pPriv->displayMode = DISPMODE_SINGLE1;
}
}
@@ -3935,8 +4029,8 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
overlay.VBlankActiveFunc = vblank_active_CRT1;
#ifdef SISMERGED
if((pSiS->MergedFB) && (!overlay.DoFirst)) {
- if(pPriv->hasTwoOverlays) index = 1;
- iscrt2 = 1;
+ if(pPriv->hasTwoOverlays) index = 1;
+ iscrt2 = 1;
overlay.VBlankActiveFunc = vblank_active_CRT2;
if(!pPriv->hasTwoOverlays) {
pPriv->displayMode = DISPMODE_SINGLE2;
@@ -3963,7 +4057,8 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv)
if(overlay.DoSecond) {
if(overlay.srcW2 > pPriv->linebufMergeLimit) temp2 = TRUE;
}
- merge_line_buf_mfb(pSiS, pPriv, temp1, temp2, overlay.srcW, overlay.srcW2, pPriv->linebufMergeLimit);
+ merge_line_buf_mfb(pSiS, pPriv, temp1, temp2, overlay.srcW, overlay.srcW2,
+ pPriv->linebufMergeLimit);
}
#endif
@@ -4052,8 +4147,9 @@ MIRROR:
* (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) {
+ if(!iscrt2) {
+ set_disablegfx(pSiS, pPriv->disablegfx, &overlay);
+ } else if(!pSiS->hasTwoOverlays) {
set_disablegfx(pSiS, FALSE, &overlay);
}
set_disablegfxlr(pSiS, pPriv->disablegfxlr, &overlay);
@@ -4098,8 +4194,8 @@ MIRROR:
* 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
+ * - New data written to the registers is 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)
@@ -4201,13 +4297,52 @@ SISAllocateOverlayMemory(
return new_linear;
}
+static FBLinearPtr
+SISAllocateRealOverlayMemory(
+ ScrnInfoPtr pScrn,
+ FBLinearPtr linear,
+ int size,
+ int bytesize
+){
+ SISPtr pSiS = SISPTR(pScrn);
+
+ if(!pSiS->SiS760VLFB) {
+
+ return(SISAllocateOverlayMemory(pScrn, linear, size));
+
+ } else {
+
+ int depth = pSiS->CurrentLayout.bitsPerPixel >> 3;
+
+ if(bytesize > pSiS->SiS760VLFBHSize) return NULL;
+
+ if(linear == NULL) {
+ linear = xalloc(sizeof(FBLinear));
+ if(linear == NULL) return NULL;
+ linear->pScreen = NULL;
+ linear->granularity = 0;
+ linear->MoveLinearCallback = NULL;
+ linear->RemoveLinearCallback = NULL;
+ linear->devPrivate.uval = SISPRIVLINID;
+ }
+ linear->offset = pSiS->SiS760VLFBOffset / depth;
+ linear->size = pSiS->SiS760VLFBHSize / depth;
+ return linear;
+
+ }
+}
+
static void
SISFreeOverlayMemory(ScrnInfoPtr pScrn)
{
SISPortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn);
if(pPriv->linear) {
- xf86FreeOffscreenLinear(pPriv->linear);
+ if(pPriv->linear->devPrivate.uval != SISPRIVLINID) {
+ xf86FreeOffscreenLinear(pPriv->linear);
+ } else {
+ xfree(pPriv->linear);
+ }
pPriv->linear = NULL;
}
}
@@ -4263,7 +4398,7 @@ SISPutImage(
#if 0
xf86DrvMsg(0, X_INFO, "PutImage: src %dx%d-%dx%d, drw %dx%d-%dx%d, id %x, w %d h %d, buf %p\n",
- src_x, src_y, src_w, src_h, drw_x, drw_y, drw_w, drw_h, id, width, height, buf);
+ src_x, src_y, src_w, src_h, drw_x, drw_y, drw_w, drw_h, id, width, height, buf);
#endif
#if 0
@@ -4291,12 +4426,12 @@ SISPutImage(
V sample period 2 2 (8 bit per pixel, subsampled)
U sample period 2 2 (8 bit per pixel, subsampled)
- Y plane is fully sampled (width*height), U and V planes
+ Y plane is fully sampled (width*height), U and V planes
are sampled in 2x2 blocks, hence a group of 4 pixels requires
4 + 1 + 1 = 6 bytes. The data is planar, ie in single planes
for Y, U and V.
2. UYVY: 3 planes: H V
- Y sample period 1 1 (8 bit per pixel)
+ 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 sampled (width*height), U and V planes
@@ -4306,11 +4441,11 @@ SISPutImage(
Bit order: U0 Y0 V0 Y1 U2 Y2 V2 Y3 ...
3. I420: Like YU12, but planes U and V are in reverse order.
4. YUY2: Like UYVY, but order is
- Y0 U0 Y1 V0 Y2 U2 Y3 V2 ...
+ Y0 U0 Y1 V0 Y2 U2 Y3 V2 ...
5. YVYU: Like YUY2, but order is
- Y0 V0 Y1 U0 Y2 V2 Y3 U2 ...
+ Y0 V0 Y1 U0 Y2 V2 Y3 U2 ...
6. NV12, NV21: 2 planes H V
- Y sample period 1 1 (8 bit per pixel)
+ 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
@@ -4344,8 +4479,8 @@ SISPutImage(
totalSize &= ~15; /* in bytes */
/* allocate memory (we do doublebuffering) - size is in pixels! */
- if(!(pPriv->linear = SISAllocateOverlayMemory(pScrn, pPriv->linear,
- ((totalSize + depth - 1) / depth) << 1)))
+ if(!(pPriv->linear = SISAllocateRealOverlayMemory(pScrn, pPriv->linear,
+ ((totalSize + depth - 1) / depth) << 1, totalSize)))
return BadAlloc;
/* fixup pointers */
@@ -4537,7 +4672,8 @@ SISAllocSurface (
w = (w + 1) & ~1;
pPriv->pitch = ((w << 1) + 63) & ~63; /* Only packed pixel modes supported */
size = h * pPriv->pitch;
- pPriv->linear = SISAllocateOverlayMemory(pScrn, pPriv->linear, ((size + depth - 1) / depth));
+ pPriv->linear = SISAllocateRealOverlayMemory(pScrn, pPriv->linear,
+ ((size + depth - 1) / depth), size);
if(!pPriv->linear)
return BadAlloc;
@@ -4753,10 +4889,9 @@ SISInitOffscreenImages(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
SISPtr pSiS = SISPTR(pScrn);
- SISPortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn);
int i, num;
- if(pSiS->VGAEngine == SIS_300_VGA) num = NUMOFFSCRIMAGES_300;
+ if(pSiS->VGAEngine == SIS_300_VGA) num = NUMOFFSCRIMAGES_300;
else num = NUMOFFSCRIMAGES_315;
for(i = 0; i < num; i++) {
@@ -4766,7 +4901,7 @@ SISInitOffscreenImages(ScreenPtr pScreen)
SISOffscreenImages[i].num_attributes = NUM_ATTRIBUTES_300;
SISOffscreenImages[i].attributes = &SISAttributes_300[0];
} else {
- if(pPriv->hasTwoOverlays) {
+ if((pSiS->hasTwoOverlays) && (!(pSiS->SiS_SD2_Flags & SiS_SD2_SUPPORT760OO))) {
SISOffscreenImages[i].num_attributes = NUM_ATTRIBUTES_315 - 1;
} else {
SISOffscreenImages[i].num_attributes = NUM_ATTRIBUTES_315;
@@ -4936,8 +5071,6 @@ SISStopVideoBlit(ScrnInfoPtr pScrn, ULong index, Bool shutdown)
}
}
-
-
static int
SISPutImageBlit(
ScrnInfoPtr pScrn,
@@ -5097,9 +5230,7 @@ SISPutImageBlit(
SiSMemCopyToVideoRam(pSiS, ybased, ybases, totalSize);
}
-#ifdef SISDUALHEAD
- dstbase += HEADOFFSET;
-#endif
+ dstbase += FBOFFSET;
MyPacket.P12_Header0 = SIS_PACKET12_HEADER0;
MyPacket.P12_Header1 = SIS_PACKET12_HEADER1;
@@ -5111,10 +5242,10 @@ SISPutImageBlit(
MyPacket.P12_DstHeight = 0xffff;
MyPacket.P12_Command |= pPriv->AccelCmd |
- SRCVIDEO |
+ SRCVIDEO |
PATFG |
- pSiS->SiS310_AccelDepth |
- YUV_CMD_YUV |
+ pSiS->SiS310_AccelDepth |
+ YUV_CMD_YUV |
DSTVIDEO;
diff --git a/src/vgatypes.h b/src/vgatypes.h
index b87de9e..cdec97c 100644
--- a/src/vgatypes.h
+++ b/src/vgatypes.h
@@ -135,10 +135,15 @@ enum _SIS_CHIP_TYPE {
SIS_330,
SIS_661,
SIS_741,
+ SIS_670,
SIS_660,
SIS_760,
SIS_761,
+ SIS_762,
+ SIS_770,
SIS_340,
+ SIS_341,
+ SIS_342,
MAX_SIS_CHIP
};
@@ -155,11 +160,11 @@ struct _SIS_HW_INFO
BOOLEAN UseROM; /* Use the ROM image if provided */
-#ifdef LINUX_KERNEL
- UCHAR SISIOMEMTYPE *pjVideoMemoryAddress;
+#ifdef LINUX_KERNEL
+ UCHAR SISIOMEMTYPE *pjVideoMemoryAddress;
/* base virtual memory address */
/* of Linear VGA memory */
-
+
ULONG ulVideoMemorySize; /* size, in bytes, of the memory on the board */
#endif
@@ -183,7 +188,7 @@ struct _SIS_HW_INFO
#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
+#define SISFB_GET_INFO_OLD 0x80046ef8
/* ioctls for tv parameters (position) */
#define SISFB_SET_TVPOSOFFSET 0x4004f304
@@ -236,10 +241,16 @@ struct _SISFB_INFO {
CARD8 sisfb_haveemilcd;
CARD8 sisfb_lcdpdca;
-
+
CARD16 sisfb_tvxpos, sisfb_tvypos; /* Warning: Values + 32 ! */
- CARD8 reserved[208]; /* for future use */
+ CARD32 sisfb_heapsize; /* heap size (in KB) */
+ CARD32 sisfb_videooffset; /* Offset of viewport in video memory (in bytes) */
+
+ CARD32 sisfb_curfstn; /* currently running FSTN/DSTN mode */
+ CARD32 sisfb_curdstn;
+
+ CARD8 reserved[192]; /* for future use */
};
#endif /* LINUX_XF86 */
diff --git a/src/vstruct.h b/src/vstruct.h
index 11693ab..503b5a2 100644
--- a/src/vstruct.h
+++ b/src/vstruct.h
@@ -175,6 +175,10 @@ typedef struct _SiS_Ext2Struct
UCHAR Ext_PDC;
UCHAR Ext_FakeCRT2CRTC;
UCHAR Ext_FakeCRT2Clk;
+ UCHAR Ext_CRT1CRTC_NORM;
+ UCHAR Ext_CRTVCLK_NORM;
+ UCHAR Ext_CRT1CRTC_WIDE;
+ UCHAR Ext_CRTVCLK_WIDE;
} SiS_Ext2Struct;
typedef struct _SiS_Part2PortTblStruct
@@ -243,11 +247,12 @@ typedef UCHAR DRAM4Type[4];
#define CUT_ASUSA2H_1 17
#define CUT_ASUSA2H_2 18
#define CUT_UNKNOWNLCD 19
+#define CUT_AOP8060 20
typedef struct _SiS_Private
{
#ifdef LINUX_KERNEL
- SISIOADDRESS RelIO;
+ SISIOADDRESS RelIO;
#endif
SISIOADDRESS SiS_P3c4;
SISIOADDRESS SiS_P3d4;
@@ -278,7 +283,7 @@ typedef struct _SiS_Private
USHORT SiS_SysFlags;
UCHAR SiS_VGAINFO;
#ifdef LINUX_XF86
- USHORT SiS_CP1, SiS_CP2, SiS_CP3, SiS_CP4;
+ USHORT SiS_CP1, SiS_CP2, SiS_CP3, SiS_CP4;
#endif
BOOLEAN SiS_UseROM;
BOOLEAN SiS_ROMNew;
@@ -290,12 +295,14 @@ typedef struct _SiS_Private
BOOLEAN SiS_UseLCDA;
int SiS_UseOEM;
ULONG SiS_CustomT;
+ int SiS_UseWide, SiS_UseWideCRT2;
USHORT SiS_Backup70xx;
BOOLEAN HaveEMI;
BOOLEAN HaveEMILCD;
BOOLEAN OverruleEMI;
UCHAR EMI_30,EMI_31,EMI_32,EMI_33;
USHORT SiS_EMIOffset;
+ USHORT SiS_PWDOffset;
SHORT PDC, PDCA;
UCHAR SiS_MyCR63;
USHORT SiS_CRT1Mode;
@@ -455,9 +462,9 @@ typedef struct _SiS_Private
/* LVDS, Chrontel */
- const SiS_LVDSDataStruct *SiS_LVDS320x480Data_1;
+ const SiS_LVDSDataStruct *SiS_LVDS320x240Data_1;
+ const SiS_LVDSDataStruct *SiS_LVDS320x240Data_2;
const SiS_LVDSDataStruct *SiS_LVDS640x480Data_1;
- const SiS_LVDSDataStruct *SiS_LVDS640x480Data_2;
const SiS_LVDSDataStruct *SiS_LVDS800x600Data_1;
const SiS_LVDSDataStruct *SiS_LVDS1024x600Data_1;
const SiS_LVDSDataStruct *SiS_LVDS1024x768Data_1;
@@ -475,25 +482,25 @@ typedef struct _SiS_Private
const SiS_LVDSDataStruct *SiS_CHTVUPALNData;
const SiS_LVDSDataStruct *SiS_CHTVOPALNData;
const SiS_LVDSDataStruct *SiS_CHTVSOPALData;
-
+
const SiS_LVDSDesStruct *SiS_PanelType04_1a;
const SiS_LVDSDesStruct *SiS_PanelType04_2a;
const SiS_LVDSDesStruct *SiS_PanelType04_1b;
const SiS_LVDSDesStruct *SiS_PanelType04_2b;
-
- const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1320x480_1;
+
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1320x240_1;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1320x240_2;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1320x240_2_H;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1320x240_3;
+ const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1320x240_3_H;
const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1640x480_1;
const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1640x480_1_H;
- const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1640x480_2;
- const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1640x480_2_H;
- const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1640x480_3;
- const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1640x480_3_H;
-#if 0
+#if 0
const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x600_1;
const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x600_1_H;
const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x600_2;
const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x600_2_H;
-#endif
+#endif
const SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1UNTSC;
const SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1ONTSC;
const SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1UPAL;
@@ -523,7 +530,7 @@ typedef struct _SiS_Private
USHORT PanelXRes, PanelHT;
USHORT PanelYRes, PanelVT;
USHORT PanelHRS, PanelHRE;
- USHORT PanelVRS, PanelVRE;
+ USHORT PanelVRS, PanelVRE;
USHORT PanelVCLKIdx300;
USHORT PanelVCLKIdx315;
BOOLEAN Alternate1600x1200;
@@ -543,7 +550,7 @@ typedef struct _SiS_Private
USHORT CVBlankStart;
USHORT CVBlankEnd;
ULONG CDClock;
- ULONG CFlags;
+ ULONG CFlags;
UCHAR CCRT1CRTC[17];
UCHAR CSR2B;
UCHAR CSR2C;
@@ -554,7 +561,7 @@ typedef struct _SiS_Private
USHORT CInfoFlag;
int LVDSHL;
-
+
BOOLEAN Backup;
UCHAR Backup_Mode;
UCHAR Backup_14;
@@ -567,7 +574,9 @@ typedef struct _SiS_Private
UCHAR Backup_1b;
UCHAR Backup_1c;
UCHAR Backup_1d;
-
+
+ UCHAR Init_P4_0E;
+
int UsePanelScaler;
int CenterScreen;
@@ -579,12 +588,12 @@ typedef struct _SiS_Private
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];
- int CP_HSyncStart[7], CP_VSyncStart[7];
- int CP_HSyncEnd[7], CP_VSyncEnd[7];
+ int CP_HTotal[7], CP_VTotal[7];
+ int CP_HSyncStart[7], CP_VSyncStart[7];
+ int CP_HSyncEnd[7], CP_VSyncEnd[7];
int CP_HBlankStart[7], CP_VBlankStart[7];
int CP_HBlankEnd[7], CP_VBlankEnd[7];
- int CP_Clock[7];
+ int CP_Clock[7];
BOOLEAN CP_DataValid[7];
BOOLEAN CP_HSync_P[7], CP_VSync_P[7], CP_SyncValid[7];
} SiS_Private;