From 5a253b1f4f639b8a49d9458e44af63e58c5a7965 Mon Sep 17 00:00:00 2001 From: Thomas Winischhofer Date: Wed, 19 Jan 2005 16:19:40 +0000 Subject: [PATCH] SiS driver: - Fix off-by-one error in setting up offscreen-images - Fix for retrieval of mode timing from BIOS for LCD - Fix for DGA in MergedFB mode - Code size reduction by more calculations, less tables - ShadowFB uses fast memcpy (correctly) now - Prefer user given modes over default ones - Add ForcePanelRGB option --- man/sis.man | 13 +- src/300vtbl.h | 986 +++--------------------------- src/310vtbl.h | 1361 +---------------------------------------- src/init.c | 455 ++++++-------- src/init.h | 717 +++++----------------- src/init301.c | 1400 ++++++++++++++++++------------------------- src/init301.h | 6 +- src/initdef.h | 20 +- src/oem300.h | 2 +- src/oem310.h | 2 +- src/osdef.h | 8 +- src/sis.h | 110 ++-- src/sis300_accel.c | 23 +- src/sis300_accel.h | 84 +-- src/sis310_accel.c | 31 +- src/sis310_accel.h | 357 +++++------ src/sis6326_video.c | 27 +- src/sis_accel.c | 33 +- src/sis_accel.h | 48 +- src/sis_cursor.c | 269 ++++----- src/sis_cursor.h | 204 +++---- src/sis_dac.c | 115 ++-- src/sis_dac.h | 2 +- src/sis_dga.c | 28 +- src/sis_dri.c | 29 +- src/sis_dri.h | 2 +- src/sis_driver.c | 1380 +++++++++++++++++++++++++++--------------- src/sis_driver.h | 41 +- src/sis_memcpy.c | 111 ++-- src/sis_opt.c | 138 +++-- src/sis_regs.h | 109 +++- src/sis_setup.c | 34 +- src/sis_shadow.c | 13 +- src/sis_vb.c | 76 ++- src/sis_vga.c | 23 +- src/sis_video.c | 106 ++-- src/vgatypes.h | 16 +- src/vstruct.h | 129 +--- 38 files changed, 3129 insertions(+), 5379 deletions(-) diff --git a/man/sis.man b/man/sis.man index 2b3f054..3825a3a 100644 --- a/man/sis.man +++ b/man/sis.man @@ -2,8 +2,8 @@ .\" $XdotOrg$ .\" shorthand for double quote that works everywhere. .ds q \N'34' -#ifdef __servername__ -#define __myservername__ __servername__ +#ifdef __xservername__ +#define __myservername__ __xservername__ #else #define __myservername__ XFree86 #endif @@ -43,7 +43,7 @@ driver supports PCI and AGP video cards based on the following chipsets: .B SiS550/551/552 .B SiS650/651/M650/661FX/M661FX/M661MX/740/741/741GX/M741 .B SiS330 (Xabre) -.B SiS760/M760 +.B SiS760/760GX/M760 .PP In the following text, the following terms are used: .PP @@ -54,7 +54,7 @@ for SiS5597/5598, 530/620 and 6326/AGP/DVD for SiS300/305, 540 and 630/730 .PP .B 315/330 series -for SiS315, 55x and (M)65x/(M)661xX/74x(GX), 330, 760 +for SiS315, 55x and (M)65x/(M)661xX/74x(GX), 330, (M)760(GX) .PP .SH CONFIGURATION DETAILS Please refer to __myxconfigfile__(__filemansuffix__) for general configuration @@ -436,5 +436,6 @@ XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscma .B "http://www.winischhofer.net/linuxsisvga.shtml" for more information and updates .SH AUTHORS -Authors include: Alan Hourihane, Mike Chapman, Juanjo Santamarta, Mitani -Hiroshi, David Thomas, Sung-Ching Lin, Ademar Reis, Thomas Winischhofer +Author: Thomas Winischhofer. Formerly based on code by Alan Hourihane, +Mike Chapman, Juanjo Santamarta, Mitani Hiroshi, David Thomas, Sung-Ching Lin, +Ademar Reis. diff --git a/src/300vtbl.h b/src/300vtbl.h index 7aa26cc..3477eaa 100644 --- a/src/300vtbl.h +++ b/src/300vtbl.h @@ -3,7 +3,7 @@ /* * Register settings for SiS 300 series * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * If distributed as part of the Linux kernel, the following license terms * apply: @@ -50,30 +50,6 @@ * */ -static const SiS_StStruct SiS300_SModeIDTable[] = -{ - {0x01,0x9208,0x01,0x00,0x00,0x00,0x00,0x00, 0}, - {0x01,0x1210,0x14,0x01,0x01,0x00,0x00,0x00, 0}, - {0x01,0x1010,0x17,0x02,0x02,0x00,0x00,0x00, 0}, - {0x03,0x8208,0x03,0x00,0x00,0x00,0x00,0x00, 0}, - {0x03,0x0210,0x16,0x01,0x01,0x00,0x00,0x00, 0}, - {0x03,0x0010,0x18,0x02,0x02,0x00,0x00,0x00, 0}, - {0x05,0x9209,0x05,0x00,0x00,0x00,0x00,0x00, 0}, - {0x06,0x8209,0x06,0x00,0x00,0x00,0x00,0x00, 0}, - {0x07,0x0000,0x07,0x03,0x03,0x00,0x00,0x00, 0}, - {0x07,0x0000,0x19,0x02,0x02,0x00,0x00,0x00, 0}, - {0x0d,0x920a,0x0d,0x00,0x00,0x00,0x00,0x00, 0}, - {0x0e,0x820a,0x0e,0x00,0x00,0x00,0x00,0x00, 0}, - {0x0f,0x0202,0x11,0x01,0x01,0x00,0x00,0x00, 0}, - {0x10,0x0212,0x12,0x01,0x01,0x00,0x00,0x00, 0}, - {0x11,0x0212,0x1a,0x04,0x04,0x00,0x00,0x00, 0}, - {0x12,0x0212,0x1b,0x04,0x04,0x00,0x00,0x00, 0}, - {0x13,0x021b,0x1c,0x00,0x00,0x00,0x00,0x00, 0}, - {0x12,0x0010,0x18,0x02,0x02,0x00,0x00,0x00, 0}, - {0x12,0x0210,0x18,0x01,0x01,0x00,0x00,0x00, 0}, - {0xff, 0, 0, 0, 0, 0, 0, 0, 0} -}; - static const SiS_ExtStruct SiS300_EModeIDTable[] = { {0x6a,0x2212,0x0102,SIS_RI_800x600, 0x00,0x00,0x00,0x00,0x00,-1}, /* 800x600x? */ @@ -846,32 +822,17 @@ static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1024x768_1[] = static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1024x768_2[] = { /* Non-VESA */ - {{0x28,0x12,0xa3,0xd0,0xaa,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, - {{0x2c,0x12,0x9a,0xae,0x88,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, - {{0x28,0x12,0xa3,0xd0,0xaa,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, - {{0x2c,0x12,0x9a,0xae,0x88,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, - {{0x28,0x13,0xe7,0x0b,0xe8,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, - {{0x38,0x18,0x16,0x00,0x00,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, - {{0x36,0x13,0x13,0x25,0xff,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}} + {{0x28,0x12,0xa3,0xd0,0xaa,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x2c,0x12,0x9a,0xae,0x88,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x28,0x12,0xa3,0xd0,0xaa,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x2c,0x12,0x9a,0xae,0x88,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x28,0x13,0xe7,0x0b,0xe8,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x38,0x18,0x16,0x00,0x00,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}}, + {{0x36,0x13,0x13,0x25,0xff,0x5a,0x45,0x0a,0x07,0xfa,0x0a,0x24}} }; static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1024x768_3[] = { - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} -}; - -static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_1[] = -{ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} -}; - -static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_2[] = -{ - {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} -}; - -static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_3[] = -{ {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}} }; @@ -879,6 +840,82 @@ static const SiS_Part2PortTblStruct SiS300_CRT2Part2_1280x1024_3[] = /* LVDS/Chrontel -------------------------------------------- */ /**************************************************************/ +/* Custom data for Barco iQ R series */ +static const SiS_LVDSDataStruct SiS300_LVDSBARCO1366Data_1[]= +{ + { 832, 438,1331, 806}, + { 832, 388,1331, 806}, + { 832, 438,1331, 806}, + { 832, 388,1331, 806}, + { 832, 518,1331, 806}, + {1050, 638,1344, 806}, + {1344, 806,1344, 806}, + {1688,1066,1688,1066}, + {1688,1066,1688,1066} /* 1360x1024 */ +}; + +/* Custom data for Barco iQ R series */ +static const SiS_LVDSDataStruct SiS300_LVDSBARCO1366Data_2[]= +{ + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1344, 806,1344, 806}, + {1688,1066,1688,1066}, + {1688,1066,1688,1066} /* 1360x1024 */ +}; + +/* Custom data for Barco iQ G series */ +static const SiS_LVDSDataStruct SiS300_LVDSBARCO1024Data_1[]= +{ + { 832, 438,1331, 806}, + { 832, 409,1331, 806}, + { 832, 438,1331, 806}, + { 832, 409,1331, 806}, + { 832, 518,1331, 806}, /* 640x480 */ + {1050, 638,1344, 806}, /* 800x600 */ + {1344, 806,1344, 806}, /* 1024x768 */ +}; + +/* Custom data for 848x480 parallel panel */ +static const SiS_LVDSDataStruct SiS300_LVDS848x480Data_1[]= +{ + { 0, 0, 0, 0}, + { 0, 0, 0, 0}, + { 0, 0, 0, 0}, + { 0, 0, 0, 0}, + {1088, 525,1088, 525}, /* 640x480 TODO */ + {1088, 525,1088, 525}, /* 800x600 TODO */ + {1088, 525,1088, 525}, /* 1024x768 TODO */ + { 0, 0, 0, 0}, + { 0, 0, 0, 0}, + { 0, 0, 0, 0}, + { 0, 0, 0, 0}, + {1088, 525,1088, 525}, /* 848x480 */ + {1088, 525,1088, 525} /* 1360x768 TODO */ +}; + +/* Custom data for 848x480 parallel panel */ +static const SiS_LVDSDataStruct SiS300_LVDS848x480Data_2[]= +{ + { 0, 0, 0, 0}, + { 0, 0, 0, 0}, + { 0, 0, 0, 0}, + { 0, 0, 0, 0}, + {1088, 525,1088, 525}, /* 640x480 */ + {1088, 525,1088, 525}, /* 800x600 */ + {1088, 525,1088, 525}, /* 1024x768 */ + { 0, 0, 0, 0}, + { 0, 0, 0, 0}, + { 0, 0, 0, 0}, + { 0, 0, 0, 0}, + {1088, 525,1088, 525}, /* 848x480 */ + {1088, 525,1088, 525} /* 1360x768 TODO */ +}; + static const SiS_LVDSDataStruct SiS300_CHTVUPALData[] = { {1008, 625,1008, 625}, @@ -909,485 +946,7 @@ static const SiS_LVDSDataStruct SiS300_CHTVSOPALData[] = { 944, 625, 944, 625} }; - -static const SiS_LVDSDesStruct SiS300_PanelType00_1[] = -{ - { 1059, 626 }, /* 2.08 */ - { 1059, 624 }, - { 1059, 626 }, - { 1059, 624 }, - { 1059, 624 }, - { 0, 627 }, - { 0, 627 }, - { 0, 0 }, - { 0, 0 } -#if 0 - {0, 626}, - {0, 624}, - {0, 626}, - {0, 624}, - {0, 624}, - {0, 627}, - {0, 627}, - {0, 0}, - {0, 0} -#endif -}; - -static const SiS_LVDSDesStruct SiS300_PanelType01_1[] = -{ - { 0, 0 }, /* 2.08 */ - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 }, - { 0, 0 } -#if 0 - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -#endif -}; - -static const SiS_LVDSDesStruct SiS300_PanelType02_1[] = -{ - { 1059, 626 }, /* 2.08 */ - { 1059, 624 }, - { 1059, 626 }, - { 1059, 624 }, - { 1059, 624 }, - { 0, 627 }, - { 0, 627 }, - { 0, 0 }, - { 0, 0 } -#if 0 - {0, 626}, - {0, 624}, - {0, 626}, - {0, 624}, - {0, 624}, - {0, 627}, - {0, 627}, - {0, 0}, - {0, 0} -#endif -}; - -static const SiS_LVDSDesStruct SiS300_PanelType03_1[] = -{ - { 8, 436}, - { 8, 440}, - { 8, 436}, - { 8, 440}, - { 8, 512}, - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType04_1[] = /* 1280x1024 */ -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType05_1[] = -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType06_1[] = /* Clevo Trumpion 1024x768 */ -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType07_1[] = -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType08_1[] = -{ - {1059, 626}, - {1059, 624}, - {1059, 626}, - {1059, 624}, - {1059, 624}, - { 0, 627}, - { 0, 627}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType09_1[] = -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType0a_1[] = -{ - {1059, 626}, - {1059, 624}, - {1059, 626}, - {1059, 624}, - {1059, 624}, - { 0, 627}, - { 0, 627}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType0b_1[] = -{ - {1343, 0}, - {1343, 0}, - {1343, 0}, - {1343, 0}, - {1343, 0}, - {1343, 0}, - { 0, 799}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType0c_1[] = -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType0d_1[] = -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType0e_1[] = -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, /* 640x480 */ - {1343, 0}, /* 800x600 */ - { 0, 805}, /* 1024x768 */ - { 0, 794}, /* 1280x1024 */ - { 0, 0} /* 1280x960 - not applicable */ -}; - -static const SiS_LVDSDesStruct SiS300_PanelType0f_1[] = -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType00_2[] = -{ - {976, 527}, - {976, 502}, - {976, 527}, - {976, 502}, - {976, 567}, - { 0, 627}, - { 0, 627}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType01_2[] = -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType02_2[] = -{ - {976, 527}, - {976, 502}, - {976, 527}, - {976, 502}, - {976, 567}, - { 0, 627}, - { 0, 627}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType03_2[] = -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - {1152, 622}, - {1152, 597} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType04_2[] = -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType05_2[] = -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType06_2[] = -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType07_2[] = -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType08_2[] = -{ - {976, 527}, - {976, 502}, - {976, 527}, - {976, 502}, - {976, 567}, - { 0, 627}, - { 0, 627}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType09_2[] = -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType0a_2[] = -{ - {976, 527}, - {976, 502}, - {976, 527}, - {976, 502}, - {976, 567}, - { 0, 627}, - { 0, 627}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType0b_2[] = -{ - { 1152, 700}, - { 1152, 675}, - { 1152, 700}, - { 1152, 675}, - { 1152, 740}, - { 1232, 799}, - { 0, 799}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType0c_2[] = -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType0d_2[] = -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType0e_2[] = -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelType0f_2[] = -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelTypeNS_1[]= -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 805}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS300_PanelTypeNS_2[] = -{ - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0} -}; - -/* Custom data for Barco iQ R200/300/400 (BIOS 2.00.07) */ +/* Custom des data for Barco iQ R200/300/400 (BIOS 2.00.07) */ static const SiS_LVDSDesStruct SiS300_PanelType04_1a[] = /* 1280x1024 (1366x1024) */ { {1330, 798}, /* 320x200 */ @@ -1414,7 +973,7 @@ static const SiS_LVDSDesStruct SiS300_PanelType04_2a[] = { 0, 0} }; -/* Custom data for Barco iQ G200/300/400 (BIOS 2.00.07) */ +/* Custom des data for Barco iQ G200/300/400 (BIOS 2.00.07) */ static const SiS_LVDSDesStruct SiS300_PanelType04_1b[] = /* 1024x768 */ { {1330, 798}, /* 320x200 */ @@ -1439,375 +998,6 @@ static const SiS_LVDSDesStruct SiS300_PanelType04_2b[] = /* CRT1 CRTC for slave modes */ -static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_1[] = -{ - {{0x65,0x4f,0x89,0x56,0x83,0xaf,0x1f, - 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, - 0x00 }}, - {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f, - 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, - 0x00 }}, - {{0x65,0x4f,0x89,0x56,0x83,0xaf,0x1f, - 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, - 0x00 }}, - {{0x65,0x4f,0x89,0x56,0x83,0x83,0x1f, - 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, - 0x00 }}, - {{0x65,0x4f,0x89,0x56,0x83,0x04,0x3e, - 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05, - 0x00 }}, - {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0, - 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, - 0x01 }} -}; - -static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_1_H[] = -{ - {{0x30,0x27,0x94,0x2c,0x92,0xaf,0x1f, - 0x90,0x85,0x8f,0xab,0x30,0x00,0x04, - 0x00 }}, - {{0x30,0x27,0x94,0x2c,0x92,0x83,0x1f, - 0x5e,0x83,0x5d,0x79,0x10,0x00,0x04, - 0x00 }}, - {{0x30,0x27,0x94,0x2c,0x92,0xaf,0x1f, - 0x90,0x85,0x8f,0xab,0x30,0x00,0x04, - 0x00 }}, - {{0x30,0x27,0x94,0x2c,0x92,0x83,0x1f, - 0x5e,0x83,0x5d,0x79,0x10,0x00,0x04, - 0x00 }}, - {{0x30,0x27,0x94,0x2c,0x92,0x04,0x3e, - 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x04, - 0x00 }}, - {{0x3d,0x31,0x81,0x37,0x1f,0x72,0xf0, - 0x58,0x8c,0x57,0x73,0x20,0x00,0x05, - 0x01 }} -}; - -static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_1[] = -{ - {{0x64,0x4f,0x88,0x54,0x9f,0xc4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, - 0x00}}, - {{0x64,0x4f,0x88,0x54,0x9f,0x97,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, - 0x00}}, - {{0x64,0x4f,0x88,0x54,0x9f,0xc4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, - 0x00}}, - {{0x64,0x4f,0x88,0x54,0x9f,0x97,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, - 0x00}}, - {{0x64,0x4f,0x88,0x54,0x9f,0x04,0x3e, - 0xe2,0x89,0xdf,0x05,0x00,0x00,0x01, - 0x00}}, - {{0x7e,0x63,0x82,0x68,0x15,0x7c,0xf0, - 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x26, - 0x01}}, - {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x02, - 0x01}} -}; - -static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_1_H[] = -{ - {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, - 0x00 }}, - {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, - 0x60,0x87,0x5D,0x83,0x10,0x00,0x44, - 0x00}}, - {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, - 0x00}}, - {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, - 0x60,0x87,0x5D,0x83,0x10,0x00,0x44, - 0x00}}, - {{0x2f,0x27,0x93,0x2b,0x90,0x04,0x3e, - 0xE2,0x89,0xdf,0x05,0x00,0x00,0x44, - 0x00}}, - {{0x3c,0x31,0x80,0x35,0x1c,0x7c,0xf0, - 0x5A,0x8F,0x57,0x7D,0x20,0x00,0x55, - 0x01}}, - {{0x4f,0x3F,0x93,0x45,0x0D,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x01, - 0x01 }} - -#if 0 - {{0x37,0x27,0x9B,0x2b,0x94,0xc4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, - 0x00 }}, - {{0x37,0x27,0x9B,0x2b,0x94,0x97,0x1f, - 0x60,0x87,0x5D,0x83,0x01,0x00,0x44, - 0x00}}, - {{0x37,0x27,0x9B,0x2b,0x94,0xc4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, - 0x00}}, - {{0x37,0x27,0x9B,0x2b,0x94,0x97,0x1f, - 0x60,0x87,0x5D,0x83,0x01,0x00,0x44, - 0x00}}, - {{0x37,0x27,0x9B,0x2b,0x94,0x04,0x3e, - 0xE2,0x89,0xDf,0x05,0x00,0x00,0x44, - 0x00}}, - {{0x41,0x31,0x85,0x35,0x1d,0x7c,0xf0, - 0x5A,0x8F,0x57,0x7D,0x20,0x00,0x55, - 0x01}}, - {{0x4f,0x3F,0x93,0x45,0x0D,0x24,0xf5, - 0x02,0x88,0xFf,0x25,0x10,0x00,0x01, - 0x01 }} -#endif -}; - -static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_1[] = -{ - {{0x63,0x4f,0x87,0x54,0x9f,0xb4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, - 0x00 }}, - {{0x63,0x4f,0x87,0x54,0x9f,0x82,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, - 0x00 }}, - {{0x63,0x4f,0x87,0x54,0x9f,0xb4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, - 0x00 }}, - {{0x63,0x4f,0x87,0x54,0x9f,0x82,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, - 0x00 }}, - {{0x63,0x4f,0x87,0x54,0x9f,0x04,0x3e, - 0xe2,0x89,0xdf,0x05,0x00,0x00,0x01, - 0x00 }}, - {{0x7e,0x63,0x82,0x68,0x15,0x7c,0xf0, - 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x26, - 0x01 }}, - {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x02, - 0x01 }} -}; - -static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_1_H[] = -{ - {{0x2f,0x27,0x93,0x2b,0x90,0xb4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x04, - 0x00 }}, - {{0x2f,0x27,0x93,0x2b,0x90,0x82,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x04, - 0x00 }}, - {{0x2f,0x27,0x93,0x2b,0x90,0xb4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x04, - 0x00 }}, - {{0x2f,0x27,0x93,0x2b,0x90,0x82,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x04, - 0x00 }}, - {{0x2f,0x27,0x93,0x2b,0x90,0x04,0x3e, - 0xe2,0x89,0xdf,0x05,0x00,0x00,0x04, - 0x00 }}, - {{0x3c,0x31,0x80,0x35,0x1c,0x7c,0xf0, - 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x55, - 0x01 }}, - {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x01, - 0x01 }} -}; - -static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_2[] = -{ - {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, - 0xf4,0x88,0x8f,0x73,0x20,0x00,0x06, - 0x00 }}, - {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, - 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x06, - 0x00 }}, - {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, - 0xf4,0x88,0x8f,0x73,0x20,0x00,0x06, - 0x00 }}, - {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, - 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x06, - 0x00 }}, - {{0x7f,0x4f,0x83,0x62,0x12,0x72,0xba, - 0x1c,0x80,0xdf,0x73,0x00,0x00,0x06, - 0x00 }}, - {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0, - 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, - 0x01 }} -}; - -static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT1800x600_2_H[] = -{ - {{0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e, - 0xf4,0x88,0x8f,0x73,0x20,0x00,0x05, - 0x00 }}, - {{0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e, - 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x05, - 0x00 }}, - {{0x3d,0x27,0x81,0x32,0x1a,0x72,0x3e, - 0xf4,0x88,0x8f,0x73,0x20,0x00,0x05, - 0x00 }}, - {{0x3d,0x27,0x81,0x3a,0x1a,0x72,0x3e, - 0xdb,0x8f,0x5d,0x73,0x20,0x00,0x05, - 0x00 }}, - {{0x3d,0x27,0x81,0x32,0x1a,0x72,0xba, - 0x1c,0x80,0xdf,0x73,0x00,0x00,0x05, - 0x00 }}, - {{0x3d,0x31,0x81,0x37,0x1f,0x72,0xf0, - 0x58,0x8c,0x57,0x73,0x20,0x00,0x05, - 0x01 }} -}; - -static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_2[] = -{ - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, - 0x00 }}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, - 0x00 }}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, - 0x00 }}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, - 0x00 }}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x72,0x88,0xdf,0x25,0x30,0x00,0x06, - 0x00 }}, - {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, - 0xae,0x84,0x57,0x25,0x30,0x00,0x02, - 0x01 }}, - {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x02, - 0x01 }} -}; - -static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT11024x768_2_H[] = -{ - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x72,0x88,0xdf,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x4f,0x31,0x93,0x3e,0x06,0x24,0xf1, - 0xae,0x84,0x57,0x25,0x30,0x00,0x01, - 0x01 }}, - {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x01, - 0x01 }} -}; - -static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_2[] = -{ - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, - 0x00 }}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, - 0x00 }}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, - 0x00 }}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, - 0x00 }}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x72,0x88,0xdf,0x25,0x30,0x00,0x06, - 0x00 }}, - {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, - 0xae,0x84,0x57,0x25,0x30,0x00,0x02, - 0x01 }}, - {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x02, - 0x01 }} -}; - -static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT11280x1024_2_H[] = -{ - {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x4f,0x27,0x93,0x39,0x81,0x24,0xbb, - 0x72,0x88,0xdf,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x4f,0x31,0x93,0x3e,0x86,0x24,0xf1, - 0xae,0x84,0x57,0x25,0x30,0x00,0x01, - 0x01 }}, - {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x01, - 0x01}} -}; - -static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT1XXXxXXX_1[] = -{ - {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e, - 0xe9,0x8b,0xe7,0x04,0x00,0x00,0x05, - 0x00}}, - {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0, - 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, - 0x01}}, - {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x02, - 0x01}}, - {{0xce,0x9f,0x92,0xa8,0x14,0x28,0x5a, - 0x00,0x84,0xff,0x29,0x09,0x00,0x07, - 0x01}}, - {{0xce,0x9f,0x92,0xa9,0x17,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x07, - 0x01}} -}; - -static const SiS_LVDSCRT1DataStruct SiS300_LVDSCRT1XXXxXXX_1_H[] = -{ - {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, - 0x00}}, - {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, - 0x00}}, - {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, - 0x00}}, - {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, - 0x00}}, - {{0x38,0x27,0x9c,0x2c,0x80,0x0b,0x3e, - 0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00, - 0x00}}, - {{0x4d,0x31,0x91,0x3b,0x03,0x72,0xf0, - 0x58,0x8c,0x57,0x73,0x20,0x00,0x01, - 0x01}}, - {{0x63,0x3f,0x87,0x4a,0x92,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x01, - 0x01}} -}; - - static const SiS_LVDSCRT1DataStruct SiS300_CHTVCRT1UNTSC[] = { {{0x64,0x4f,0x88,0x56,0x9f,0x56,0x3e, @@ -1966,8 +1156,8 @@ static const SiS_CHTVRegDataStruct SiS300_CHTVReg_SOPAL[] = {{0x41,0x12,0x00,0x50,0x00,0,0,0,0,0,0,0,0,0,0,0}}, {{0x41,0x12,0x01,0x50,0x34,0,0,0,0,0,0,0,0,0,0,0}}, {{0x41,0x12,0x00,0x50,0x00,0,0,0,0,0,0,0,0,0,0,0}}, - {{0x60,0x30,0x00,0x10,0x00,0,0,0,0,0,0,0,0,0,0,0}}, /* TW: Mode 13: 640x480 PAL 5/4 */ - {{0x81,0x50,0x00,0x1b,0x00,0,0,0,0,0,0,0,0,0,0,0}} /* TW: Mode 19: 800x600 PAL 1/1 */ + {{0x60,0x30,0x00,0x10,0x00,0,0,0,0,0,0,0,0,0,0,0}}, /* Mode 13: 640x480 PAL 5/4 */ + {{0x81,0x50,0x00,0x1b,0x00,0,0,0,0,0,0,0,0,0,0,0}} /* Mode 19: 800x600 PAL 1/1 */ }; static const UCHAR SiS300_CHTVVCLKUNTSC[] = {0x29,0x29,0x29,0x29,0x2a,0x2e}; diff --git a/src/310vtbl.h b/src/310vtbl.h index 5dc3b1d..2df8db3 100644 --- a/src/310vtbl.h +++ b/src/310vtbl.h @@ -3,7 +3,7 @@ /* * Register settings for SiS 315/330 series * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * If distributed as part of the Linux kernel, the following license terms * apply: @@ -50,30 +50,6 @@ * */ -static const SiS_StStruct SiS310_SModeIDTable[]= -{ - {0x01,0x9208,0x01,0x00,0x00,0x00,0x01,0x00, 0x40}, - {0x01,0x1210,0x14,0x01,0x01,0x00,0x01,0x00, 0x40}, - {0x01,0x1010,0x17,0x02,0x02,0x00,0x01,0x01, 0x40}, - {0x03,0x8208,0x03,0x00,0x00,0x00,0x01,0x02, 0x40}, - {0x03,0x0210,0x16,0x01,0x01,0x00,0x01,0x02, 0x40}, - {0x03,0x0010,0x18,0x02,0x02,0x00,0x01,0x03, 0x40}, - {0x05,0x9209,0x05,0x00,0x00,0x00,0x00,0x04, 0x40}, - {0x06,0x8209,0x06,0x00,0x00,0x00,0x00,0x05, 0x40}, - {0x07,0x0000,0x07,0x03,0x03,0x00,0x01,0x03, 0x40}, - {0x07,0x0000,0x19,0x02,0x02,0x00,0x01,0x03, 0x40}, - {0x0d,0x920a,0x0d,0x00,0x00,0x00,0x00,0x04, 0x40}, - {0x0e,0x820a,0x0e,0x00,0x00,0x00,0x00,0x05, 0x40}, - {0x0f,0x0202,0x11,0x01,0x01,0x00,0x00,0x05, 0x40}, - {0x10,0x0212,0x12,0x01,0x01,0x00,0x00,0x05, 0x40}, - {0x11,0x0212,0x1a,0x04,0x04,0x00,0x00,0x05, 0x40}, - {0x12,0x0212,0x1b,0x04,0x04,0x00,0x00,0x05, 0x40}, - {0x13,0x021b,0x1c,0x00,0x00,0x00,0x00,0x04, 0x40}, - {0x12,0x0010,0x18,0x02,0x02,0x00,0x00,0x05, 0x40}, - {0x12,0x0210,0x18,0x01,0x01,0x00,0x00,0x05, 0x40}, - {0xff,0x0000,0x00,0x00,0x00,0x00,0x00,0x00, 0x40} -}; - static const SiS_ExtStruct SiS310_EModeIDTable[]= { {0x6a,0x2212,0x0102,SIS_RI_800x600, 0x00,0x00,0x07,0x06,0x00, 3}, /* 800x600x? */ @@ -617,7 +593,10 @@ static const SiS_CRT1TableStruct SiS310_CRT1Table[]= 0x40}}, /* 0x55 */ {{0x2c,0x27,0x27,0x90,0x2d,0x92,0xa4,0x1f, /* fake 320x200@60Hz (for LCD and TV, not actually used) */ 0x98,0x8c,0x8f,0x96,0xa5,0x30,0x00,0x04, - 0x00}} /* 0x56 */ + 0x00}}, /* 0x56 */ + {{0xd7,0xc7,0xc7,0x9b,0xd1,0x15,0xd1,0x10, /* 1600x1200 for LCDA */ + 0xb2,0x86,0xaf,0xb0,0xd2,0x2f,0x00,0x03, + 0x00}} /* 0x57 */ }; static const SiS_MCLKDataStruct SiS310_MCLKData_0_315[] = @@ -843,7 +822,8 @@ 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 */ + { 0x2b,0xc2, 35}, /* 0x71 768@576@60 */ + { 0xa8,0x42,131} /* 0x72 1600x1200@60 for LCDA */ }; static SiS_VBVCLKDataStruct SiS310_VBVCLKData[]= @@ -967,7 +947,8 @@ static SiS_VBVCLKDataStruct SiS310_VBVCLKData[]= { 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 */ + { 0x2b,0xc2, 35}, /* 0x71 768@576@60 */ + { 0xa8,0x42,131} /* 0x72 1600x1200@60 for LCDA */ }; static const DRAM4Type SiS310_SR15[8] = { @@ -1220,1329 +1201,6 @@ static const SiS_LVDSDataStruct SiS310_CHTVSOPALData[]= /* (super overscan - {1400, 875,1400, 875} }; - -static const SiS_LVDSDesStruct SiS310_PanelType00_1[]= /* 800x600 */ -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType01_1[]= /* 1024x768 */ -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 805}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType02_1[]= /* 1280x1024 */ -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 1065}, - { 0, 0}, - { 0, 0} -}; - - -static const SiS_LVDSDesStruct SiS310_PanelType03_1[]= -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType04_1[]= -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType05_1[]= -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType06_1[]= -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType07_1[]= -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType08_1[]= /* 1400x1050 */ -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType09_1[]= /* 1280x768 */ -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType0a_1[]= /* 1600x1200 */ -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType0b_1[]= /* 640x480_2 */ -{ - { 0, 524}, - { 0, 524}, - { 0, 524}, - { 0, 524}, - { 0, 524}, - { 0, 524}, - { 8, 524}, - { 0, 524} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType0c_1[]= /* 640x480_3 */ -{ - { 0, 524}, - { 0, 524}, - { 0, 524}, - { 0, 524}, - { 0, 524}, - { 0, 524}, - { 8, 524}, - { 0, 524} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType0d_1[]= -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType0e_1[]= -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType0f_1[]= -{ - {1343, 798}, - {1343, 794}, - {1343, 798}, - {1343, 794}, - {1343, 0}, - {1343, 0}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType00_2[]= -{ - {980, 528}, - {980, 503}, - {980, 528}, - {980, 503}, - {980, 568}, - { 0, 628}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType01_2[]= -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 806}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType02_2[]= -{ - {1368, 754}, - {1368, 729}, - {1368, 754}, - {1368, 729}, - {1368, 794}, - {1448, 854}, - {1560, 938}, - { 0,1066}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType03_2[]= -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType04_2[]= -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType05_2[]= -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType06_2[]= -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType07_2[]= -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType08_2[]= /* 1400x1050 */ -{ - {1308, 741}, - {1308, 716}, - {1308, 741}, - {1308, 716}, - {1308, 781}, - {1388, 841}, - {1500, 925}, - {1628,1053}, - { 0,1065}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType09_2[]= /* 1280x768 */ -{ - {1083, 622}, - {1083, 597}, - {1083, 622}, - {1083, 597}, - {1083, 662}, - {1163, 722}, - {1286, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType0a_2[]= /* 1600x1200 */ -{ - {1568, 920}, - {1568, 895}, - {1568, 920}, - {1568, 895}, - {1568, 960}, - {1648,1020}, - {1760,1104}, - {1888,1232}, - {1948,1245}, - { 0, 0} -#if 0 - {1568, 850}, - {1568, 825}, - {1568, 850}, - {1568, 825}, - {1568, 890}, - {1648, 950}, - {1760,1034}, - {1888,1162}, - {1948,1175}, - { 0, 0} -#endif -}; - -static const SiS_LVDSDesStruct SiS310_PanelType0b_2[]= /* 640x480_2 */ -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType0c_2[]= /* 640x480_3 */ -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType0d_2[]= -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType0e_2[]= -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelType0f_2[] = -{ - {1152, 622}, - {1152, 597}, - {1152, 622}, - {1152, 597}, - {1152, 662}, - {1232, 722}, - { 0, 805}, - { 0, 794}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelTypeNS_1[]= -{ - { 8, 0}, - { 8, 0}, - { 8, 0}, - { 8, 0}, - { 8, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 806}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS310_PanelTypeNS_2[] = -{ - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0}, - { 0 , 0} -}; - -/* CRT1 CRTC for SlaveModes and LCDA */ - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1[] = -{ - {{0x6b,0x4f,0x8f,0x55,0x85,0xaa,0x1f, - 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, - 0x00 }}, - {{0x6b,0x4f,0x8f,0x55,0x85,0x78,0x1f, - 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, - 0x00 }}, - {{0x6b,0x4f,0x8f,0x55,0x85,0xaa,0x1f, - 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, - 0x00 }}, - {{0x6b,0x4f,0x8f,0x55,0x85,0x78,0x1f, - 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, - 0x00 }}, - {{0x6b,0x4f,0x8f,0x55,0x85,0xfa,0x1f, - 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05, - 0x00 }}, - {{0x7f,0x63,0x83,0x69,0x19,0x72,0xf0, - 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, - 0x01 }} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_1_H[] = -{ - {{0x43,0x27,0x87,0x2d,0x1d,0xaa,0x1f, - 0x90,0x85,0x8f,0xab,0x30,0x00,0x05, - 0x00 }}, - {{0x43,0x27,0x87,0x2d,0x1d,0x78,0x1f, - 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, - 0x00 }}, - {{0x43,0x27,0x87,0x2d,0x1d,0xfa,0x1f, - 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05, - 0x00 }}, - {{0x43,0x27,0x87,0x2d,0x1d,0x78,0x1f, - 0x5e,0x83,0x5d,0x79,0x10,0x00,0x05, - 0x00 }}, - {{0x43,0x27,0x87,0x2d,0x1d,0xfa,0x1f, - 0xe0,0x85,0xdf,0xfb,0x10,0x00,0x05, - 0x00 }}, - {{0x4d,0x31,0x91,0x37,0x07,0x72,0xf0, - 0x58,0x8d,0x57,0x73,0x20,0x00,0x01, - 0x01 }} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2[]= -{ - {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, - 0xff,0x84,0x8f,0x73,0x00,0x00,0x06, - 0x00 }}, - {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, - 0xe6,0x8b,0x5d,0x73,0x00,0x00,0x06, - 0x00 }}, - {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, - 0xff,0x84,0x8f,0x73,0x00,0x00,0x06, - 0x00 }}, - {{0x7f,0x4f,0x83,0x62,0x12,0x72,0x3e, - 0xe6,0x8b,0x5d,0x73,0x00,0x00,0x06, - 0x00 }}, - {{0x7f,0x4f,0x83,0x62,0x12,0x72,0xba, - 0x27,0x8c,0xdf,0x73,0x00,0x00,0x06, - 0x00 }}, - {{0x7f,0x63,0x83,0x69,0x19,0x72,0xf0, - 0x58,0x8d,0x57,0x73,0x20,0x00,0x06, - 0x01 }} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT1800x600_2_H[] = -{ - {{0x57,0x27,0x9b,0x3a,0x0a,0x72,0x3e, - 0xff,0x84,0x8f,0x73,0x00,0x00,0x01, - 0x00 }}, - {{0x57,0x27,0x9b,0x3a,0x0a,0x72,0x3e, - 0xd6,0x8b,0x5d,0x73,0x00,0x00,0x01, - 0x00 }}, - {{0x57,0x27,0x9b,0x3a,0x0a,0x72,0x3e, - 0xff,0x84,0x8f,0x73,0x00,0x00,0x01, - 0x00 }}, - {{0x57,0x27,0x9b,0x3a,0x0a,0x72,0x3e, - 0xd6,0x8b,0x5d,0x73,0x00,0x00,0x01, - 0x00 }}, - {{0x57,0x27,0x9b,0x3a,0x0a,0x72,0xba, - 0x27,0x8c,0xdf,0x73,0x00,0x00,0x01, - 0x00 }}, - {{0x4d,0x31,0x91,0x3a,0x0a,0x72,0xf0, - 0x63,0x88,0x57,0x73,0x00,0x00,0x01, - 0x01 }} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1[] = -{ - {{0x73,0x4f,0x97,0x53,0x84,0xb4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x05, - 0x00}}, - {{0x73,0x4f,0x97,0x53,0x84,0x82,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x05, - 0x00}}, - {{0x73,0x4f,0x97,0x53,0x84,0xb4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x05, - 0x00}}, - {{0x73,0x4f,0x97,0x53,0x84,0x82,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x05, - 0x00}}, - {{0x73,0x4f,0x97,0x53,0x84,0x04,0x3e, - 0xE2,0x89,0xDf,0x05,0x00,0x00,0x05, - 0x00}}, - {{0x87,0x63,0x8B,0x67,0x18,0x7c,0xf0, - 0x5A,0x81,0x57,0x7D,0x00,0x00,0x06, - 0x01}}, - {{0xA3,0x7f,0x87,0x83,0x94,0x24,0xf5, - 0x02,0x89,0xFf,0x25,0x10,0x00,0x02, - 0x01}} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_1_H[] = -{ - {{0x4b,0x27,0x8f,0x2b,0x1c,0xb4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x05, - 0x00 }}, - {{0x4b,0x27,0x8f,0x2b,0x1c,0x82,0x1f, - 0x60,0x87,0x5D,0x83,0x01,0x00,0x05, - 0x00}}, - {{0x4b,0x27,0x8f,0x2b,0x1c,0xb4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x05, - 0x00}}, - {{0x4b,0x27,0x8f,0x2b,0x1c,0x82,0x1f, - 0x60,0x87,0x5D,0x83,0x01,0x00,0x05, - 0x00}}, - {{0x4b,0x27,0x8f,0x2b,0x1c,0x04,0x3e, - 0xE2,0x89,0xDf,0x05,0x00,0x00,0x05, - 0x00}}, - {{0x55,0x31,0x99,0x35,0x06,0x7c,0xf0, - 0x5A,0x81,0x57,0x7D,0x00,0x00,0x01, - 0x01}}, - {{0x63,0x3F,0x87,0x43,0x94,0x24,0xf5, - 0x02,0x89,0xFf,0x25,0x10,0x00,0x01, - 0x01 }} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2[] = -{ - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x57,0x8e,0x8f,0x25,0x30,0x00,0x06, - 0x00 }}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x3e,0x85,0x5d,0x25,0x10,0x00,0x06, - 0x00 }}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x57,0x8e,0x8f,0x25,0x30,0x00,0x06, - 0x00 }}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x3e,0x85,0x5d,0x25,0x10,0x00,0x06, - 0x01 }}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x7f,0x86,0xdf,0x25,0x10,0x00,0x06, - 0x00 }}, - {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, - 0xbb,0x82,0x57,0x25,0x10,0x00,0x02, - 0x01 }}, - {{0xa3,0x7f,0x87,0x83,0x94,0x24,0xf5, - 0x02,0x89,0xff,0x25,0x10,0x00,0x02, - 0x01 }} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11024x768_2_H[] = -{ - {{0x7b,0x27,0x9f,0x46,0x97,0x24,0xbb, - 0x57,0x8e,0x8f,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x7b,0x27,0x9f,0x46,0x97,0x24,0xbb, - 0x3e,0x85,0x5d,0x25,0x10,0x00,0x01, - 0x00 }}, - {{0x7b,0x27,0x9f,0x46,0x97,0x24,0xbb, - 0x57,0x8e,0x8f,0x25,0x30,0x00,0x01, - 0x00 }}, - {{0x7b,0x27,0x9f,0x46,0x97,0x24,0xbb, - 0x3e,0x85,0x5d,0x25,0x10,0x00,0x01, - 0x00 }}, - {{0x7b,0x27,0x9f,0x46,0x97,0x24,0xbb, - 0x7f,0x86,0xdf,0x25,0x10,0x00,0x01, - 0x00 }}, - {{0x71,0x31,0x95,0x46,0x97,0x24,0xf1, - 0xbb,0x82,0x57,0x25,0x10,0x00,0x01, - 0x01 }}, - {{0x63,0x3f,0x87,0x46,0x97,0x24,0xf5, - 0x0f,0x86,0xff,0x25,0x30,0x00,0x01, - 0x01 }} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1[] = -{ - {{0x7e,0x4f,0x82,0x58,0x04,0xb8,0x1f, - 0x90,0x84,0x8f,0xb9,0x30,0x00,0x06, - 0x00}}, - {{0x7e,0x4f,0x82,0x58,0x04,0x86,0x1f, - 0x5e,0x82,0x5d,0x87,0x10,0x00,0x06, - 0x00}}, - {{0x7e,0x4f,0x82,0x58,0x04,0xb8,0x1f, - 0x90,0x84,0x8f,0xb9,0x30,0x00,0x06, - 0x00}}, - {{0x7e,0x4f,0x82,0x58,0x04,0x86,0x1f, - 0x5e,0x82,0x5d,0x87,0x10,0x00,0x06, - 0x00}}, - {{0x7e,0x4f,0x82,0x58,0x04,0x08,0x3e, - 0xe0,0x84,0xdf,0x09,0x00,0x00,0x06, - 0x00}}, - {{0x92,0x63,0x96,0x6c,0x18,0x80,0xf0, - 0x58,0x8c,0x57,0x81,0x20,0x00,0x06, - 0x01}}, - {{0xae,0x7f,0x92,0x88,0x94,0x28,0xf5, - 0x00,0x84,0xff,0x29,0x10,0x00,0x02, - 0x01}}, - {{0xce,0x9f,0x92,0xa8,0x14,0x28,0x5a, - 0x00,0x84,0xff,0x29,0x09,0x00,0x07, - 0x01}} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_1_H[] = -{ - {{0x56,0x27,0x9a,0x31,0x1c,0xb8,0x1f, - 0x90,0x84,0x8f,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x56,0x27,0x9a,0x31,0x1c,0x86,0x1f, - 0x5e,0x82,0x5d,0x87,0x10,0x00,0x05, - 0x00}}, - {{0x56,0x27,0x9a,0x31,0x1c,0xb8,0x1f, - 0x90,0x84,0x8f,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x56,0x27,0x9a,0x31,0x1c,0x86,0x1f, - 0x5e,0x82,0x5d,0x87,0x10,0x00,0x05, - 0x01}}, - {{0x56,0x27,0x9a,0x31,0x1c,0x08,0x3e, - 0xe0,0x84,0xdf,0x09,0x00,0x00,0x05, - 0x00}}, - {{0x60,0x31,0x84,0x3a,0x86,0x80,0xf0, - 0x58,0x8c,0x57,0x81,0x20,0x00,0x01, - 0x01}}, - {{0x6e,0x3f,0x92,0x48,0x94,0x28,0xf5, - 0x00,0x84,0xff,0x29,0x10,0x00,0x01, - 0x01}} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2[] = -{ - {{0xce,0x72,0x91,0x81,0x8f,0x28,0x92, - 0xc8,0x8c,0x5d,0x5c,0x01,0x00,0x02, - 0x01}}, - {{0xce,0x72,0x91,0x81,0x8f,0x28,0x92, - 0xaf,0x83,0x44,0x43,0x21,0x00,0x02, - 0x01}}, - {{0xce,0x72,0x91,0x81,0x8f,0x28,0x92, - 0xc8,0x8c,0x5d,0x5c,0x01,0x00,0x02, - 0x01}}, - {{0xce,0x72,0x91,0x81,0x8f,0x28,0x92, - 0xaf,0x83,0x44,0x43,0x21,0x00,0x02, - 0x01}}, - {{0xce,0x72,0x91,0x81,0x8f,0x28,0x92, - 0xf0,0x84,0x85,0x84,0x11,0x00,0x02, - 0x01}}, - {{0xce,0x63,0x92,0x8b,0x19,0x28,0xd4, - 0x3f,0x83,0x57,0x29,0x01,0x00,0x03, - 0x01}}, - {{0xce,0x7f,0x92,0x99,0x07,0x28,0xd4, - 0x93,0x87,0xff,0x29,0x21,0x00,0x07, - 0x01}}, - {{0xce,0x9f,0x92,0xa8,0x14,0x28,0x5a, - 0x00,0x84,0xff,0x29,0x09,0x00,0x07, - 0x01}} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11280x1024_2_H[] = -{ - {{0xa6,0x4a,0x89,0x59,0x07,0x28,0x92, - 0xc8,0x8c,0x5d,0x5c,0x01,0x00,0x06, - 0x01}}, - {{0xa6,0x4a,0x89,0x59,0x07,0x28,0x92, - 0xaf,0x83,0x44,0x43,0x21,0x00,0x06, - 0x01}}, - {{0xa6,0x4a,0x89,0x59,0x07,0x28,0x92, - 0xc8,0x8c,0x5d,0x5c,0x01,0x00,0x06, - 0x01}}, - {{0xa6,0x4a,0x89,0x59,0x07,0x28,0x92, - 0xfa,0x83,0x44,0x43,0x31,0x00,0x06, - 0x01}}, - {{0xa6,0x4a,0x89,0x59,0x07,0x28,0x92, - 0xf0,0x84,0x85,0x84,0x11,0x00,0x06, - 0x01}}, - {{0x9c,0x31,0x80,0x59,0x87,0x28,0xd4, - 0x3f,0x83,0x57,0x29,0x01,0x00,0x06, - 0x01}}, - {{0x8e,0x3f,0x92,0x59,0x07,0x28,0xd4, - 0x93,0x87,0xff,0x29,0x21,0x00,0x06, - 0x01}} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_1[] = -{ - {{0x6f,0x4f,0x93,0x54,0x82,0x9e,0x1f, - 0x8f,0x81,0x8f,0x9f,0x30,0x00,0x05, - 0x00}}, - {{0x6f,0x4f,0x93,0x54,0x82,0x6c,0x1f, - 0x5e,0x81,0x5d,0x6d,0x10,0x00,0x05, - 0x00}}, - {{0x6f,0x4f,0x93,0x54,0x82,0x9e,0x1f, - 0x90,0x83,0x8f,0x9f,0x30,0x00,0x05, - 0x00}}, - {{0x6f,0x4f,0x93,0x54,0x82,0x6c,0x1f, - 0x60,0x84,0x5d,0x6d,0x10,0x00,0x05, - 0x00}}, - {{0x6f,0x4f,0x93,0x54,0x82,0xee,0x1f, - 0xdf,0x82,0xdf,0xef,0x10,0x00,0x05, - 0x00}}, - {{0x83,0x63,0x87,0x68,0x16,0x66,0xf0, - 0x57,0x8e,0x57,0x67,0x20,0x00,0x06, - 0x01}}, - {{0x9f,0x7f,0x83,0x84,0x92,0x0e,0xf1, - 0xff,0x86,0xff,0x0f,0x10,0x00,0x02, - 0x01,}}, - {{0xbf,0x9f,0x83,0xa4,0x12,0x0e,0xde, - 0xff,0x86,0xff,0x0f,0x01,0x00,0x07, - 0x01}}, - {{0xce,0xae,0x92,0xb3,0x01,0x28,0x10, - 0x19,0x80,0x19,0x29,0x0f,0x00,0x03, - 0x00}} -#if 0 - {{0x6f,0x4f,0x93,0x54,0x82,0x9e,0x1f, - 0x93,0x86,0x8f,0x9f,0x30,0x00,0x05, - 0x00}}, - {{0x6f,0x4f,0x93,0x54,0x82,0x6c,0x1f, - 0x60,0x84,0x5d,0x6d,0x10,0x00,0x05, - 0x00}}, - {{0x6f,0x4f,0x93,0x54,0x82,0x9e,0x1f, - 0x93,0x86,0x8f,0x9f,0x30,0x00,0x05, - 0x00}}, - {{0x6f,0x4f,0x93,0x54,0x82,0x6c,0x1f, - 0x60,0x84,0x5d,0x6d,0x10,0x00,0x05, - 0x00}}, - {{0x6f,0x4f,0x93,0x54,0x82,0xee,0x1f, - 0xe2,0x86,0xdf,0xef,0x10,0x00,0x05, - 0x00}}, - {{0x83,0x63,0x87,0x68,0x16,0x66,0xf0, - 0x5a,0x8e,0x57,0x67,0x20,0x00,0x06, - 0x01}}, - {{0x9f,0x7f,0x83,0x84,0x92,0x0e,0xf5, - 0x02,0x86,0xff,0x0f,0x10,0x00,0x02, - 0x01}}, - {{0xbf,0x9f,0x83,0xa4,0x12,0x0e,0x5a, - 0x02,0x86,0xff,0x0f,0x09,0x00,0x07, - 0x01}}, - {{0xce,0xae,0x92,0xb3,0x01,0x28,0x10, - 0x1a,0x80,0x19,0x29,0x0f,0x00,0x03, - 0x00}} -#endif -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_1_H[] = -{ - {{0x47,0x27,0x8b,0x2c,0x1a,0x9e,0x1f, - 0x8f,0x81,0x8f,0x9f,0x30,0x00,0x05, - 0x00}}, - {{0x47,0x27,0x8b,0x2c,0x1a,0x6c,0x1f, - 0x60,0x84,0x5d,0x6d,0x10,0x00,0x05, - 0x00}}, - {{0x47,0x27,0x8b,0x30,0x1e,0x9e,0x1f, - 0x90,0x83,0x8f,0x9f,0x30,0x00,0x05, - 0x00}}, - {{0x47,0x27,0x8b,0x2c,0x1a,0x6c,0x1f, - 0x60,0x84,0x5d,0x6d,0x10,0x00,0x05, - 0x00}}, - {{0x47,0x27,0x8b,0x2c,0x1a,0xee,0x1f, - 0xdf,0x86,0xdf,0xef,0x10,0x00,0x05, - 0x00}}, - {{0x51,0x31,0x95,0x36,0x04,0x66,0xf0, - 0x57,0x8e,0x57,0x67,0x20,0x00,0x01, - 0x01}}, - {{0x5f,0x3f,0x83,0x44,0x92,0x0e,0xf1, - 0xff,0x86,0xff,0x0f,0x10,0x00,0x01, - 0x01}}, - {{0x6f,0x4f,0x93,0x54,0x82,0x0e,0x5a, - 0x02,0x86,0xff,0x0f,0x09,0x00,0x05, - 0x01}}, - {{0x76,0x56,0x9a,0x5b,0x89,0x28,0x10, - 0x1c,0x80,0x19,0x29,0x0b,0x00,0x05, - 0x00}} -#if 0 - {{0x47,0x27,0x8b,0x2c,0x1a,0x9e,0x1f, - 0x93,0x86,0x8f,0x9f,0x30,0x00,0x05, - 0x00}}, - {{0x47,0x27,0x8b,0x2c,0x1a,0x6c,0x1f, - 0x60,0x84,0x5d,0x6d,0x10,0x00,0x05, - 0x00}}, - {{0x47,0x27,0x8b,0x30,0x1e,0x9e,0x1f, - 0x92,0x86,0x8f,0x9f,0x30,0x00,0x05, - 0x00}}, - {{0x47,0x27,0x8b,0x2c,0x1a,0x6c,0x1f, - 0x60,0x84,0x5d,0x6d,0x10,0x00,0x05, - 0x00}}, - {{0x47,0x27,0x8b,0x2c,0x1a,0xee,0x1f, - 0xe2,0x86,0xdf,0xef,0x10,0x00,0x05, - 0x00}}, - {{0x51,0x31,0x95,0x36,0x04,0x66,0xf0, - 0x5a,0x8e,0x57,0x67,0x20,0x00,0x01, - 0x01}}, - {{0x5f,0x3f,0x83,0x44,0x92,0x0e,0xf5, - 0x02,0x86,0xff,0x0f,0x10,0x00,0x01, - 0x01}}, - {{0x6f,0x4f,0x93,0x54,0x82,0x0e,0x5a, - 0x02,0x86,0xff,0x0f,0x09,0x00,0x05, - 0x01}}, - {{0x76,0x56,0x9a,0x5b,0x89,0x28,0x10, - 0x1c,0x80,0x19,0x29,0x0b,0x00,0x05, - 0x00}} -#endif -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_2[] = -{ - {{0xce,0x72,0x91,0x84,0x92,0x28,0x92, - 0xd7,0x8b,0x5d,0x5c,0x21,0x00,0x02, - 0x01}}, - {{0xce,0x72,0x91,0x84,0x92,0x28,0x92, - 0xbe,0x82,0x44,0x43,0x01,0x00,0x02, - 0x01}}, - {{0xce,0x72,0x91,0x84,0x92,0x28,0x92, - 0xd7,0x8b,0x5d,0x5c,0x21,0x00,0x02, - 0x01}}, - {{0xce,0x72,0x91,0x84,0x92,0x28,0x92, - 0xbe,0x82,0x44,0x43,0x01,0x00,0x02, - 0x01}}, - {{0xce,0x72,0x91,0x84,0x92,0x28,0x92, - 0xff,0x83,0x85,0x84,0x11,0x00,0x02, - 0x01}}, - {{0xce,0x63,0x92,0x8e,0x1c,0x28,0xd4, - 0x3f,0x83,0x57,0x29,0x01,0x00,0x03, - 0x01}}, - {{0xce,0x7f,0x92,0x9c,0x0a,0x28,0xd4, - 0x93,0x87,0xff,0x29,0x21,0x00,0x07, - 0x01}}, - {{0xce,0x9f,0x92,0xac,0x1a,0x28,0x5a, - 0x13,0x87,0xff,0x29,0x29,0x00,0x07, - 0x01}}, - {{0xce,0xae,0x92,0xbc,0x0a,0x28,0x10, - 0x20,0x84,0x19,0x29,0x0f,0x00,0x03, - 0x00}} -#if 0 - {{0xce,0x4f,0x92,0x8c,0x1a,0x28,0x9a, - 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x03, - 0x00}}, - {{0xce,0x4f,0x92,0x8c,0x1a,0x28,0x9a, - 0xc2,0x86,0x5d,0x29,0x01,0x00,0x03, - 0x01}}, - {{0xce,0x4f,0x92,0x8c,0x1a,0x28,0x9a, - 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x03, - 0x00}}, - {{0xce,0x4f,0x92,0x8c,0x1a,0x28,0x9a, - 0xc2,0x86,0x5d,0x29,0x01,0x00,0x03, - 0x00}}, - {{0xce,0x4f,0x92,0x8c,0x1a,0x28,0x9e, - 0x03,0x87,0xdf,0x29,0x01,0x00,0x03, - 0x00}}, - {{0xce,0x63,0x92,0x96,0x04,0x28,0xd4, - 0x3f,0x83,0x57,0x29,0x01,0x00,0x07, - 0x01}}, - {{0xce,0x7f,0x92,0xa4,0x12,0x28,0xd4, - 0x93,0x87,0xff,0x29,0x21,0x00,0x07, - 0x01}}, - {{0xce,0x9f,0x92,0xb4,0x02,0x28,0x5a, - 0x13,0x87,0xff,0x29,0x29,0x00,0x03, - 0x01}}, - {{0xce,0xae,0x92,0xbc,0x0a,0x28,0x10, - 0x20,0x84,0x19,0x29,0x0f,0x00,0x03, - 0x00}} -#endif -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11400x1050_2_H[] = -{ - {{0xa6,0x4a,0x89,0x5c,0x0a,0x28,0x92, - 0xd7,0x8b,0x5d,0x5c,0x21,0x00,0x06, - 0x01}}, - {{0xa6,0x4a,0x89,0x5c,0x0a,0x28,0x92, - 0xbe,0x82,0x44,0x43,0x01,0x00,0x06, - 0x01}}, - {{0xa6,0x4a,0x89,0x5c,0x0a,0x28,0x92, - 0xd7,0x8b,0x5d,0x5c,0x21,0x00,0x06, - 0x01}}, - {{0xa6,0x4a,0x89,0x5c,0x0a,0x28,0x92, - 0xbe,0x82,0x44,0x43,0x01,0x00,0x06, - 0x01}}, - {{0xa6,0x4a,0x89,0x5c,0x0a,0x28,0x92, - 0xff,0x83,0x85,0x84,0x11,0x00,0x06, - 0x01}}, - {{0x9c,0x31,0x80,0x5c,0x8a,0x28,0xd4, - 0x3f,0x83,0x57,0x29,0x01,0x00,0x06, - 0x01}}, - {{0x8e,0x3f,0x92,0x5c,0x0a,0x28,0xd4, - 0x93,0x87,0xff,0x29,0x21,0x00,0x06, - 0x01}}, - {{0x7e,0x4f,0x82,0x5c,0x0a,0x28,0x5a, - 0x13,0x87,0xff,0x29,0x29,0x00,0x06, - 0x01}}, - {{0x76,0x56,0x9a,0x64,0x92,0x28,0x10, - 0x20,0x84,0x19,0x29,0x0f,0x00,0x05, - 0x00}} -#if 0 - {{0xa6,0x27,0x8a,0x64,0x92,0x28,0x9a, - 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x06, - 0x00}}, - {{0xa6,0x27,0x8a,0x64,0x92,0x28,0x9a, - 0xc2,0x86,0x5d,0x29,0x01,0x00,0x06, - 0x00}}, - {{0xa6,0x27,0x8a,0x64,0x92,0x28,0x9a, - 0xdb,0x8f,0x8f,0x29,0x21,0x00,0x06, - 0x00}}, - {{0xa6,0x27,0x8a,0x64,0x92,0x28,0x9a, - 0xc2,0x86,0x5d,0x29,0x01,0x00,0x06, - 0x00}}, - {{0xa6,0x27,0x8a,0x64,0x92,0x28,0x9e, - 0x03,0x87,0xdf,0x29,0x01,0x00,0x06, - 0x00}}, - {{0x9c,0x31,0x80,0x64,0x92,0x28,0xd4, - 0x3f,0x83,0x57,0x29,0x01,0x00,0x06, - 0x01}}, - {{0x8e,0x3f,0x92,0x64,0x12,0x28,0xd4, - 0x93,0x87,0xff,0x29,0x21,0x00,0x06, - 0x01}}, - {{0x7e,0x4f,0x82,0x64,0x12,0x28,0x5a, - 0x13,0x87,0xff,0x29,0x29,0x00,0x06, - 0x01}}, - {{0x76,0x56,0x9a,0x64,0x92,0x28,0x10, - 0x20,0x84,0x19,0x29,0x0f,0x00,0x05, - 0x00}} -#endif -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_1[] = -{ - {{0x83,0x4F,0x87,0x5B,0x13,0x06,0x3E, - 0xB3,0x86,0x8F,0x07,0x20,0x00,0x06, - 0x00}}, - {{0x83,0x4F,0x87,0x5B,0x13,0xD4,0x1F, - 0x81,0x84,0x5D,0xD5,0x10,0x00,0x06, - 0x00}}, - {{0x83,0x4F,0x87,0x5B,0x13,0x06,0x3E, - 0xB3,0x86,0x8F,0x07,0x20,0x00,0x06, - 0x00}}, - {{0x83,0x4F,0x87,0x5B,0x13,0xD4,0x1F, - 0x81,0x84,0x5D,0xD5,0x10,0x00,0x06, - 0x00}}, - {{0x83,0x4F,0x87,0x5B,0x13,0x56,0xBA, - 0x03,0x86,0xDF,0x57,0x00,0x00,0x06, - 0x00}}, - {{0x97,0x63,0x9B,0x6F,0x07,0xCE,0xF0, - 0x7B,0x8E,0x57,0xCF,0x20,0x00,0x02, - 0x01}}, - {{0xB3,0x7F,0x97,0x8B,0x83,0x76,0xF5, - 0x23,0x86,0xFF,0x77,0x10,0x00,0x06, - 0x01}}, - {{0xD3,0x9F,0x97,0xAB,0x03,0x76,0x5A, - 0x23,0x86,0xFF,0x77,0x09,0x00,0x03, - 0x01}}, - {{0xE2,0xAE,0x86,0xBA,0x92,0x90,0x10, - 0x3D,0x80,0x19,0x91,0x0F,0x00,0x03, - 0x00}}, - {{0xFB,0xC7,0x9F,0xD3,0x8B,0x26,0x11, - 0xD3,0x86,0xAF,0x27,0x3F,0x00,0x07, - 0x00}} -#if 0 - {{0x83,0x4f,0x87,0x51,0x09,0xc0,0x1f, - 0x90,0x84,0x8f,0xc1,0x30,0x00,0x06, - 0x00}}, - {{0x83,0x4f,0x87,0x51,0x09,0x8e,0x1f, - 0x5e,0x82,0x5d,0x8f,0x10,0x00,0x06, - 0x00}}, - {{0x83,0x4f,0x87,0x51,0x09,0xc0,0x1f, - 0x90,0x84,0x8f,0xc1,0x30,0x00,0x06, - 0x00}}, - {{0x83,0x4f,0x87,0x51,0x09,0x8e,0x1f, - 0x5e,0x82,0x5d,0x8f,0x10,0x00,0x06, - 0x00}}, - {{0x83,0x4f,0x87,0x51,0x09,0x10,0x3e, - 0xe0,0x84,0xdf,0x11,0x00,0x00,0x06, - 0x00}}, - {{0x97,0x63,0x9b,0x65,0x1d,0x88,0xf0, - 0x58,0x8c,0x57,0x89,0x20,0x00,0x06, - 0x01}}, - {{0xb3,0x7f,0x97,0x81,0x99,0x30,0xf5, - 0x00,0x84,0xff,0x31,0x10,0x00,0x02, - 0x01}}, - {{0xd3,0x9f,0x97,0xa1,0x19,0x30,0x5a, - 0x00,0x84,0xff,0x31,0x09,0x00,0x07, - 0x01}}, - {{0xe2,0xae,0x86,0xb0,0x88,0x4a,0x10, - 0x1a,0x8e,0x19,0x4b,0x2f,0x00,0x03, - 0x00}}, - {{0xfb,0xc7,0x9f,0xc9,0x81,0xe0,0x10, - 0xb0,0x84,0xaf,0xe1,0x2f,0x00,0x07, - 0x00}} -#endif -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_1_H[] = -{ - {{0x5B,0x27,0x9F,0x33,0x0B,0x06,0x2E, - 0xB3,0x86,0x8F,0x07,0x20,0x00,0x01, - 0x00}}, - {{0x5B,0x27,0x9F,0x29,0x01,0x8E,0x1F, - 0x81,0x84,0x5D,0xD5,0x10,0x00,0x06, - 0x00}}, - {{0x5B,0x27,0x9F,0x33,0x0B,0x06,0x2E, - 0xB3,0x86,0x8F,0x07,0x20,0x00,0x01, - 0x00}}, - {{0x83,0x4F,0x87,0x5B,0x13,0xD4,0x1F, - 0x81,0x84,0x5D,0xD5,0x10,0x00,0x06, - 0x00}}, - {{0x5B,0x27,0x9F,0x33,0x0B,0x56,0xBA, - 0x03,0x86,0xDF,0x57,0x00,0x00,0x01, - 0x00}}, - {{0x65,0x31,0x89,0x3D,0x95,0xCE,0xF0, - 0x7B,0x8E,0x57,0xCF,0x20,0x00,0x01, - 0x01}}, - {{0x73,0x3F,0x97,0x4B,0x83,0x76,0xF5, - 0x23,0x86,0xFF,0x77,0x10,0x00,0x05, - 0x01}}, - {{0xD3,0x9F,0x97,0xAB,0x03,0x76,0x5A, - 0x23,0x86,0xFF,0x77,0x09,0x00,0x03, - 0x01}}, - {{0xE2,0xAE,0x86,0xBA,0x92,0x90,0x10, - 0x3D,0x80,0x19,0x91,0x0F,0x00,0x03, - 0x00}}, - {{0x97,0x63,0x9B,0x6F,0x07,0xE0,0x10, - 0xB0,0x84,0xAF,0xE1,0x2F,0x00,0x06, - 0x00}} -#if 0 - {{0x5b,0x27,0x9f,0x29,0x01,0xc0,0x1f, - 0x90,0x84,0x8f,0xc1,0x30,0x00,0x01, - 0x00}}, - {{0x5b,0x27,0x9f,0x29,0x01,0x8e,0x1f, - 0x5e,0x82,0x5d,0x8f,0x10,0x00,0x01, - 0x00}}, - {{0x5b,0x27,0x9f,0x29,0x01,0xc0,0x1f, - 0x90,0x84,0x8f,0xc1,0x30,0x00,0x01, - 0x00}}, - {{0x5b,0x27,0x9f,0x29,0x01,0x8e,0x1f, - 0x5e,0x82,0x5d,0x8f,0x10,0x00,0x01, - 0x00}}, - {{0x5b,0x27,0x9f,0x29,0x01,0x10,0x3e, - 0xe0,0x84,0xdf,0x11,0x00,0x00,0x01, - 0x00}}, - {{0x65,0x31,0x89,0x33,0x8b,0x88,0xf0, - 0x58,0x8c,0x57,0x89,0x20,0x00,0x01, - 0x01}}, - {{0x73,0x3f,0x97,0x41,0x99,0x30,0xf5, - 0x00,0x84,0xff,0x31,0x10,0x00,0x01, - 0x01}}, - {{0x83,0x4f,0x87,0x51,0x09,0x30,0x5a, - 0x00,0x84,0xff,0x31,0x09,0x00,0x06, - 0x01}}, - {{0x8a,0x56,0x8e,0x58,0x10,0x4a,0x10, - 0x1a,0x8e,0x19,0x4b,0x2f,0x00,0x06, - 0x00}}, - {{0x97,0x63,0x9b,0x65,0x1d,0xe0,0x10, - 0xb0,0x84,0xaf,0xe1,0x2f,0x00,0x06, - 0x00}} -#endif -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_2[] = -{ - {{0xFB,0x87,0x86,0x97,0x0F,0x26,0x97, - 0x43,0x86,0xDB,0xDA,0x11,0x00,0x07, - 0x01}}, - {{0xFB,0x87,0x86,0x97,0x0F,0x26,0x97, - 0x2A,0x8D,0xC2,0xC1,0x11,0x00,0x07, - 0x01}}, - {{0xFB,0x87,0x86,0x97,0x0F,0x26,0x97, - 0x43,0x86,0xDB,0xDA,0x11,0x00,0x07, - 0x01}}, - {{0xFB,0x87,0x86,0x97,0x0F,0x26,0x97, - 0x2A,0x8D,0xC2,0xC1,0x11,0x00,0x07, - 0x01}}, - {{0xFB,0x87,0x86,0x97,0x0F,0x26,0x9F, - 0x6B,0x8E,0x03,0x02,0x01,0x00,0x07, - 0x01}}, - {{0xFB,0x63,0x9F,0xA1,0x99,0x26,0xD5, - 0xA7,0x8A,0xBF,0xBE,0x01,0x00,0x07, - 0x01}}, - {{0xFB,0x7F,0x9F,0xAF,0x87,0x26,0xDD, - 0xFB,0x8E,0x13,0x12,0x31,0x00,0x03, - 0x01}}, - {{0xFB,0x9F,0x9F,0xBF,0x97,0x26,0x5B, - 0x7B,0x8E,0xFF,0x27,0x39,0x00,0x03, - 0x01}}, - {{0xFB,0xAE,0x9F,0xC6,0x9E,0x26,0x11, - 0x88,0x8B,0x19,0x27,0x1F,0x00,0x03, - 0x00}}, - {{0xFB,0xC7,0x9F,0xD3,0x8B,0x26,0x11, - 0xD3,0x86,0xAF,0x27,0x3F,0x00,0x07, - 0x00}} -#if 0 - {{0xfb,0x88,0x87,0x90,0x08,0xe0,0x96, - 0x20,0x84,0xb9,0xb8,0x01,0x00,0x07, - 0x01}}, - {{0xfb,0x88,0x87,0x90,0x08,0xe0,0x96, - 0x07,0x8b,0xa0,0x9f,0x01,0x00,0x07, - 0x01}}, - {{0xfb,0x88,0x87,0x90,0x08,0xe0,0x96, - 0x20,0x84,0xb9,0xb8,0x01,0x00,0x07, - 0x01}}, - {{0xfb,0x88,0x87,0x90,0x08,0xe0,0x96, - 0x07,0x8b,0xa0,0x9f,0x01,0x00,0x07, - 0x01}}, - {{0xfb,0x88,0x87,0x90,0x08,0xe0,0x96, - 0x48,0x8c,0xe1,0xe0,0x11,0x00,0x07, - 0x01}}, - {{0xfb,0x63,0x9f,0x9a,0x92,0xe0,0xd4, - 0x9b,0x8f,0x9d,0x9c,0x21,0x00,0x07, - 0x01}}, - {{0xfb,0x7f,0x9f,0xa8,0x80,0xe0,0xd4, - 0xef,0x83,0xff,0xe1,0x21,0x00,0x03, - 0x01}}, - {{0xfb,0x9f,0x9f,0xb8,0x90,0xe0,0x5a, - 0x6f,0x83,0xff,0xe1,0x29,0x00,0x03, - 0x01}}, - {{0xfb,0xae,0x9f,0xbf,0x97,0xe0,0x10, - 0x7c,0x80,0x19,0xe1,0x0f,0x00,0x03, - 0x00}}, - {{0xfb,0xc7,0x9f,0xc9,0x84,0xe0,0x10, - 0xc7,0x8b,0xaf,0xe1,0x0f,0x00,0x07, - 0x00}} -#endif -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT11600x1200_2_H[] = -{ - {{0xD3,0x5F,0x9E,0x6F,0x07,0x26,0x97, - 0x43,0x86,0xDB,0xDA,0x11,0x00,0x02, - 0x01}}, - {{0xD3,0x27,0x97,0x6F,0x07,0x26,0x97, - 0x6B,0x8E,0x83,0x82,0x01,0x00,0x03, - 0x01}}, - {{0xD3,0x5F,0x9E,0x6F,0x07,0x26,0x97, - 0x43,0x86,0xDB,0xDA,0x11,0x00,0x02, - 0x01}}, - {{0xD3,0x27,0x97,0x6F,0x07,0x26,0x97, - 0x07,0x8B,0xA0,0x9F,0x01,0x00,0x02, - 0x01}}, - {{0xD3,0x27,0x97,0x6F,0x07,0x26,0x97, - 0x6B,0x8E,0x83,0x82,0x01,0x00,0x03, - 0x01}}, - {{0xC9,0x31,0x8D,0x6F,0x07,0x26,0xD5, - 0xA7,0x8A,0xBF,0xBE,0x01,0x00,0x03, - 0x01}}, - {{0xBB,0x3F,0x9F,0x6F,0x87,0x26,0xDD, - 0xFB,0x8E,0x13,0x12,0x31,0x00,0x02, - 0x01}}, - {{0xAB,0x4F,0x8F,0x68,0x80,0xE0,0x5A, - 0x6F,0x83,0xFF,0xE1,0x29,0x00,0x02, - 0x01}}, - {{0xA3,0x56,0x87,0x67,0x9F,0xE0,0x10, - 0x7C,0x80,0x19,0xE1,0x0F,0x00,0x06, - 0x00}}, - {{0x97,0x63,0x9B,0x68,0x00,0xE0,0x10, - 0xC7,0x8B,0xAF,0xE1,0x0F,0x00,0x02, - 0x00}} -#if 0 - {{0xd3,0x60,0x9f,0x68,0x00,0xe0,0x96, - 0x20,0x84,0xb9,0xb8,0x01,0x00,0x02, - 0x01}}, - {{0xd3,0x60,0x9f,0x68,0x00,0xe0,0x96, - 0x07,0x8b,0xa0,0x9f,0x01,0x00,0x02, - 0x01}}, - {{0xd3,0x60,0x9f,0x68,0x00,0xe0,0x96, - 0x20,0x84,0xb9,0xb8,0x01,0x00,0x02, - 0x01}}, - {{0xd3,0x60,0x9f,0x68,0x00,0xe0,0x96, - 0x07,0x8b,0xa0,0x9f,0x01,0x00,0x02, - 0x01}}, - {{0xd3,0x60,0x9f,0x68,0x00,0xe0,0x96, - 0x48,0x8c,0xe1,0xe0,0x11,0x00,0x02, - 0x01}}, - {{0xc9,0x31,0x8d,0x68,0x00,0xe0,0xd4, - 0x9b,0x8f,0x9d,0x9c,0x21,0x00,0x03, - 0x01}}, - {{0xbb,0x3f,0x9f,0x68,0x80,0xe0,0xd4, - 0xef,0x83,0xff,0xe1,0x21,0x00,0x02, - 0x01}}, - {{0xab,0x4f,0x8f,0x68,0x80,0xe0,0x5a, - 0x6f,0x83,0xff,0xe1,0x29,0x00,0x02, - 0x01}}, - {{0xa3,0x56,0x87,0x67,0x9f,0xe0,0x10, - 0x7c,0x80,0x19,0xe1,0x0f,0x00,0x06, - 0x00}}, - {{0x97,0x63,0x9b,0x68,0x00,0xe0,0x10, - 0xc7,0x8b,0xaf,0xe1,0x0f,0x00,0x02, - 0x00}} -#endif -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT1XXXxXXX_1[] = -{ - {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x5f,0x4f,0x82,0x55,0x81,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x05, - 0x00}}, - {{0x5f,0x4f,0x82,0x55,0x81,0x0b,0x3e, - 0xe9,0x8b,0xe7,0x04,0x00,0x00,0x05, - 0x00}}, - {{0x7f,0x63,0x83,0x6c,0x1c,0x72,0xf0, - 0x58,0x8c,0x57,0x73,0x20,0x00,0x06, - 0x01}}, - {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x02, - 0x01}}, - {{0xce,0x9f,0x92,0xa8,0x14,0x28,0x5a, - 0x00,0x84,0xff,0x29,0x09,0x00,0x07, - 0x01}}, - {{0xce,0x9f,0x92,0xa9,0x17,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x07, - 0x01}} -}; - -static const SiS_LVDSCRT1DataStruct SiS310_LVDSCRT1XXXxXXX_1_H[] = -{ - {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, - 0x00}}, - {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, - 0x00}}, - {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, - 0x00}}, - {{0x38,0x27,0x9c,0x2c,0x80,0xbf,0x1f, - 0x9c,0x8e,0x96,0xb9,0x30,0x00,0x00, - 0x00}}, - {{0x38,0x27,0x9c,0x2c,0x80,0x0b,0x3e, - 0xe9,0x8b,0xe7,0x04,0x00,0x00,0x00, - 0x00}}, - {{0x4d,0x31,0x91,0x3b,0x03,0x72,0xf0, - 0x58,0x8c,0x57,0x73,0x20,0x00,0x01, - 0x01}}, - {{0x63,0x3f,0x87,0x4a,0x92,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x01, - 0x01}} -}; - - /* CRT1 CRTC for Chrontel TV slave modes */ static const SiS_LVDSCRT1DataStruct SiS310_CHTVCRT1UNTSC[] = @@ -2645,7 +1303,6 @@ static const SiS_LVDSCRT1DataStruct SiS310_CHTVCRT1OPAL[] = 0x01 }} }; - static const SiS_CHTVRegDataStruct SiS310_CHTVReg_UNTSC[] = { {{0x4a,0x77,0xbb,0x94,0x84,0x48,0xfe,0x50,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x01}}, diff --git a/src/init.c b/src/init.c index 6cc2197..6330b6e 100644 --- a/src/init.c +++ b/src/init.c @@ -6,7 +6,7 @@ * SiS 315/550/650/M650/651/661FX/M661FX/740/741(GX)/M741/330/660/M660/760/M760 * (Universal module for Linux kernel framebuffer and XFree86 4.x) * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * If distributed as part of the Linux kernel, the following license terms * apply: @@ -86,6 +86,7 @@ static void InitCommonPointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { + SiS_Pr->SiS_SModeIDTable = SiS_SModeIDTable; SiS_Pr->SiS_StResInfo = SiS_StResInfo; SiS_Pr->SiS_ModeResInfo = SiS_ModeResInfo; SiS_Pr->SiS_StandTable = SiS_StandTable; @@ -146,50 +147,13 @@ InitCommonPointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_Pr->SiS_NoScaleData = SiS_NoScaleData; SiS_Pr->SiS_LVDS320x480Data_1 = SiS_LVDS320x480Data_1; - SiS_Pr->SiS_LVDS800x600Data_1 = SiS_LVDS800x600Data_1; - SiS_Pr->SiS_LVDS800x600Data_2 = SiS_LVDS800x600Data_2; - SiS_Pr->SiS_LVDS1024x768Data_1 = SiS_LVDS1024x768Data_1; - SiS_Pr->SiS_LVDS1024x768Data_2 = SiS_LVDS1024x768Data_2; - SiS_Pr->SiS_LVDS1280x1024Data_1 = SiS_LVDS1280x1024Data_1; - SiS_Pr->SiS_LVDS1280x1024Data_2 = SiS_LVDS1280x1024Data_2; - SiS_Pr->SiS_LVDS1400x1050Data_1 = SiS_LVDS1400x1050Data_1; - SiS_Pr->SiS_LVDS1400x1050Data_2 = SiS_LVDS1400x1050Data_2; - SiS_Pr->SiS_LVDS1600x1200Data_1 = SiS_LVDS1600x1200Data_1; - SiS_Pr->SiS_LVDS1600x1200Data_2 = SiS_LVDS1600x1200Data_2; - SiS_Pr->SiS_LVDS1280x768Data_1 = SiS_LVDS1280x768Data_1; - SiS_Pr->SiS_LVDS1280x768Data_2 = SiS_LVDS1280x768Data_2; - SiS_Pr->SiS_LVDS1024x600Data_1 = SiS_LVDS1024x600Data_1; - SiS_Pr->SiS_LVDS1024x600Data_2 = SiS_LVDS1024x600Data_2; - SiS_Pr->SiS_LVDS1152x768Data_1 = SiS_LVDS1152x768Data_1; - SiS_Pr->SiS_LVDS1152x768Data_2 = SiS_LVDS1152x768Data_2; - SiS_Pr->SiS_LVDSXXXxXXXData_1 = SiS_LVDSXXXxXXXData_1; - SiS_Pr->SiS_LVDS1280x960Data_1 = SiS_LVDS1280x960Data_1; - SiS_Pr->SiS_LVDS1280x960Data_2 = SiS_LVDS1280x960Data_2; SiS_Pr->SiS_LVDS640x480Data_1 = SiS_LVDS640x480Data_1; - SiS_Pr->SiS_LVDS1280x960Data_1 = SiS_LVDS1280x1024Data_1; - SiS_Pr->SiS_LVDS1280x960Data_2 = SiS_LVDS1280x1024Data_2; 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_LVDS848x480Data_1 = SiS_LVDS848x480Data_1; - SiS_Pr->SiS_LVDS848x480Data_2 = SiS_LVDS848x480Data_2; - SiS_Pr->SiS_LVDSBARCO1024Data_1 = SiS_LVDSBARCO1024Data_1; - SiS_Pr->SiS_LVDSBARCO1024Data_2 = SiS_LVDSBARCO1024Data_2; - SiS_Pr->SiS_LVDSBARCO1366Data_1 = SiS_LVDSBARCO1366Data_1; - SiS_Pr->SiS_LVDSBARCO1366Data_2 = SiS_LVDSBARCO1366Data_2; - - SiS_Pr->SiS_LVDSCRT11280x768_1 = SiS_LVDSCRT11280x768_1; - SiS_Pr->SiS_LVDSCRT11024x600_1 = SiS_LVDSCRT11024x600_1; - SiS_Pr->SiS_LVDSCRT11152x768_1 = SiS_LVDSCRT11152x768_1; - SiS_Pr->SiS_LVDSCRT11280x768_1_H = SiS_LVDSCRT11280x768_1_H; - SiS_Pr->SiS_LVDSCRT11024x600_1_H = SiS_LVDSCRT11024x600_1_H; - SiS_Pr->SiS_LVDSCRT11152x768_1_H = SiS_LVDSCRT11152x768_1_H; - SiS_Pr->SiS_LVDSCRT11280x768_2 = SiS_LVDSCRT11280x768_2; - SiS_Pr->SiS_LVDSCRT11024x600_2 = SiS_LVDSCRT11024x600_2; - SiS_Pr->SiS_LVDSCRT11152x768_2 = SiS_LVDSCRT11152x768_2; - SiS_Pr->SiS_LVDSCRT11280x768_2_H = SiS_LVDSCRT11280x768_2_H; - SiS_Pr->SiS_LVDSCRT11024x600_2_H = SiS_LVDSCRT11024x600_2_H; - SiS_Pr->SiS_LVDSCRT11152x768_2_H = SiS_LVDSCRT11152x768_2_H; SiS_Pr->SiS_LVDSCRT1320x480_1 = SiS_LVDSCRT1320x480_1; SiS_Pr->SiS_LVDSCRT1640x480_1 = SiS_LVDSCRT1640x480_1; SiS_Pr->SiS_LVDSCRT1640x480_1_H = SiS_LVDSCRT1640x480_1_H; @@ -197,15 +161,16 @@ InitCommonPointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) 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; + SiS_Pr->SiS_LVDSCRT11024x600_2 = SiS_LVDSCRT11024x600_2; + SiS_Pr->SiS_LVDSCRT11024x600_2_H = SiS_LVDSCRT11024x600_2_H; +#endif + SiS_Pr->SiS_CHTVUNTSCData = SiS_CHTVUNTSCData; SiS_Pr->SiS_CHTVONTSCData = SiS_CHTVONTSCData; - SiS_Pr->SiS_CHTVUNTSCDesData = SiS_CHTVUNTSCDesData; - SiS_Pr->SiS_CHTVONTSCDesData = SiS_CHTVONTSCDesData; - SiS_Pr->SiS_CHTVUPALDesData = SiS_CHTVUPALDesData; - SiS_Pr->SiS_CHTVOPALDesData = SiS_CHTVOPALDesData; - SiS_Pr->SiS_PanelMinLVDS = Panel_800x600; /* lowest value LVDS/LCDA */ SiS_Pr->SiS_PanelMin301 = Panel_1024x768; /* lowest value 301 */ } @@ -217,7 +182,6 @@ InitTo300Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { InitCommonPointer(SiS_Pr, HwInfo); - SiS_Pr->SiS_SModeIDTable = SiS300_SModeIDTable; SiS_Pr->SiS_VBModeIDTable = SiS300_VBModeIDTable; SiS_Pr->SiS_EModeIDTable = SiS300_EModeIDTable; SiS_Pr->SiS_RefIndex = SiS300_RefIndex; @@ -266,11 +230,8 @@ InitTo300Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_Pr->SiS_St2LCD1280x1024Data = SiS300_St2LCD1280x1024Data; SiS_Pr->SiS_CRT2Part2_1024x768_1 = SiS300_CRT2Part2_1024x768_1; - SiS_Pr->SiS_CRT2Part2_1280x1024_1 = SiS300_CRT2Part2_1280x1024_1; SiS_Pr->SiS_CRT2Part2_1024x768_2 = SiS300_CRT2Part2_1024x768_2; - SiS_Pr->SiS_CRT2Part2_1280x1024_2 = SiS300_CRT2Part2_1280x1024_2; SiS_Pr->SiS_CRT2Part2_1024x768_3 = SiS300_CRT2Part2_1024x768_3; - SiS_Pr->SiS_CRT2Part2_1280x1024_3 = SiS300_CRT2Part2_1280x1024_3; SiS_Pr->SiS_CHTVUPALData = SiS300_CHTVUPALData; SiS_Pr->SiS_CHTVOPALData = SiS300_CHTVOPALData; @@ -279,65 +240,17 @@ InitTo300Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_Pr->SiS_CHTVUPALNData = SiS300_CHTVUPALData; /* not supported on 300 series */ SiS_Pr->SiS_CHTVOPALNData = SiS300_CHTVOPALData; /* not supported on 300 series */ SiS_Pr->SiS_CHTVSOPALData = SiS300_CHTVSOPALData; - - SiS_Pr->SiS_PanelType00_1 = SiS300_PanelType00_1; - SiS_Pr->SiS_PanelType01_1 = SiS300_PanelType01_1; - SiS_Pr->SiS_PanelType02_1 = SiS300_PanelType02_1; - SiS_Pr->SiS_PanelType03_1 = SiS300_PanelType03_1; - SiS_Pr->SiS_PanelType04_1 = SiS300_PanelType04_1; - SiS_Pr->SiS_PanelType05_1 = SiS300_PanelType05_1; - SiS_Pr->SiS_PanelType06_1 = SiS300_PanelType06_1; - SiS_Pr->SiS_PanelType07_1 = SiS300_PanelType07_1; - SiS_Pr->SiS_PanelType08_1 = SiS300_PanelType08_1; - SiS_Pr->SiS_PanelType09_1 = SiS300_PanelType09_1; - SiS_Pr->SiS_PanelType0a_1 = SiS300_PanelType0a_1; - SiS_Pr->SiS_PanelType0b_1 = SiS300_PanelType0b_1; - SiS_Pr->SiS_PanelType0c_1 = SiS300_PanelType0c_1; - SiS_Pr->SiS_PanelType0d_1 = SiS300_PanelType0d_1; - SiS_Pr->SiS_PanelType0e_1 = SiS300_PanelType0e_1; - SiS_Pr->SiS_PanelType0f_1 = SiS300_PanelType0f_1; - SiS_Pr->SiS_PanelType00_2 = SiS300_PanelType00_2; - SiS_Pr->SiS_PanelType01_2 = SiS300_PanelType01_2; - SiS_Pr->SiS_PanelType02_2 = SiS300_PanelType02_2; - SiS_Pr->SiS_PanelType03_2 = SiS300_PanelType03_2; - SiS_Pr->SiS_PanelType04_2 = SiS300_PanelType04_2; - SiS_Pr->SiS_PanelType05_2 = SiS300_PanelType05_2; - SiS_Pr->SiS_PanelType06_2 = SiS300_PanelType06_2; - SiS_Pr->SiS_PanelType07_2 = SiS300_PanelType07_2; - SiS_Pr->SiS_PanelType08_2 = SiS300_PanelType08_2; - SiS_Pr->SiS_PanelType09_2 = SiS300_PanelType09_2; - SiS_Pr->SiS_PanelType0a_2 = SiS300_PanelType0a_2; - SiS_Pr->SiS_PanelType0b_2 = SiS300_PanelType0b_2; - SiS_Pr->SiS_PanelType0c_2 = SiS300_PanelType0c_2; - SiS_Pr->SiS_PanelType0d_2 = SiS300_PanelType0d_2; - SiS_Pr->SiS_PanelType0e_2 = SiS300_PanelType0e_2; - SiS_Pr->SiS_PanelType0f_2 = SiS300_PanelType0f_2; - SiS_Pr->SiS_PanelTypeNS_1 = SiS300_PanelTypeNS_1; - SiS_Pr->SiS_PanelTypeNS_2 = SiS300_PanelTypeNS_2; - - if(SiS_Pr->SiS_CustomT == CUT_BARCO1366) { - SiS_Pr->SiS_PanelType04_1 = SiS300_PanelType04_1a; - SiS_Pr->SiS_PanelType04_2 = SiS300_PanelType04_2a; - } - if(SiS_Pr->SiS_CustomT == CUT_BARCO1024) { - SiS_Pr->SiS_PanelType04_1 = SiS300_PanelType04_1b; - SiS_Pr->SiS_PanelType04_2 = SiS300_PanelType04_2b; - } - - SiS_Pr->SiS_LVDSCRT1800x600_1 = SiS300_LVDSCRT1800x600_1; - SiS_Pr->SiS_LVDSCRT1800x600_1_H = SiS300_LVDSCRT1800x600_1_H; - SiS_Pr->SiS_LVDSCRT1800x600_2 = SiS300_LVDSCRT1800x600_2; - SiS_Pr->SiS_LVDSCRT1800x600_2_H = SiS300_LVDSCRT1800x600_2_H; - SiS_Pr->SiS_LVDSCRT11024x768_1 = SiS300_LVDSCRT11024x768_1; - SiS_Pr->SiS_LVDSCRT11024x768_1_H = SiS300_LVDSCRT11024x768_1_H; - SiS_Pr->SiS_LVDSCRT11024x768_2 = SiS300_LVDSCRT11024x768_2; - SiS_Pr->SiS_LVDSCRT11024x768_2_H = SiS300_LVDSCRT11024x768_2_H; - SiS_Pr->SiS_LVDSCRT11280x1024_1 = SiS300_LVDSCRT11280x1024_1; - SiS_Pr->SiS_LVDSCRT11280x1024_1_H = SiS300_LVDSCRT11280x1024_1_H; - SiS_Pr->SiS_LVDSCRT11280x1024_2 = SiS300_LVDSCRT11280x1024_2; - SiS_Pr->SiS_LVDSCRT11280x1024_2_H = SiS300_LVDSCRT11280x1024_2_H; - SiS_Pr->SiS_LVDSCRT1XXXxXXX_1 = SiS300_LVDSCRT1XXXxXXX_1; - SiS_Pr->SiS_LVDSCRT1XXXxXXX_1_H = SiS300_LVDSCRT1XXXxXXX_1_H; + + SiS_Pr->SiS_LVDS848x480Data_1 = SiS300_LVDS848x480Data_1; + SiS_Pr->SiS_LVDS848x480Data_2 = SiS300_LVDS848x480Data_2; + SiS_Pr->SiS_LVDSBARCO1024Data_1 = SiS300_LVDSBARCO1024Data_1; + SiS_Pr->SiS_LVDSBARCO1366Data_1 = SiS300_LVDSBARCO1366Data_1; + SiS_Pr->SiS_LVDSBARCO1366Data_2 = SiS300_LVDSBARCO1366Data_2; + + SiS_Pr->SiS_PanelType04_1a = SiS300_PanelType04_1a; + SiS_Pr->SiS_PanelType04_2a = SiS300_PanelType04_2a; + SiS_Pr->SiS_PanelType04_1b = SiS300_PanelType04_1b; + SiS_Pr->SiS_PanelType04_2b = SiS300_PanelType04_2b; SiS_Pr->SiS_CHTVCRT1UNTSC = SiS300_CHTVCRT1UNTSC; SiS_Pr->SiS_CHTVCRT1ONTSC = SiS300_CHTVCRT1ONTSC; @@ -371,7 +284,6 @@ InitTo310Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { InitCommonPointer(SiS_Pr, HwInfo); - SiS_Pr->SiS_SModeIDTable = SiS310_SModeIDTable; SiS_Pr->SiS_EModeIDTable = SiS310_EModeIDTable; SiS_Pr->SiS_RefIndex = (SiS_Ext2Struct *)SiS310_RefIndex; SiS_Pr->SiS_CRT1Table = SiS310_CRT1Table; @@ -435,41 +347,6 @@ InitTo310Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_Pr->SiS_CRT2Part2_1024x768_1 = SiS310_CRT2Part2_1024x768_1; - SiS_Pr->SiS_PanelType00_1 = SiS310_PanelType00_1; - SiS_Pr->SiS_PanelType01_1 = SiS310_PanelType01_1; - SiS_Pr->SiS_PanelType02_1 = SiS310_PanelType02_1; - SiS_Pr->SiS_PanelType03_1 = SiS310_PanelType03_1; - SiS_Pr->SiS_PanelType04_1 = SiS310_PanelType04_1; - SiS_Pr->SiS_PanelType05_1 = SiS310_PanelType05_1; - SiS_Pr->SiS_PanelType06_1 = SiS310_PanelType06_1; - SiS_Pr->SiS_PanelType07_1 = SiS310_PanelType07_1; - SiS_Pr->SiS_PanelType08_1 = SiS310_PanelType08_1; - SiS_Pr->SiS_PanelType09_1 = SiS310_PanelType09_1; - SiS_Pr->SiS_PanelType0a_1 = SiS310_PanelType0a_1; - SiS_Pr->SiS_PanelType0b_1 = SiS310_PanelType0b_1; - SiS_Pr->SiS_PanelType0c_1 = SiS310_PanelType0c_1; - SiS_Pr->SiS_PanelType0d_1 = SiS310_PanelType0d_1; - SiS_Pr->SiS_PanelType0e_1 = SiS310_PanelType0e_1; - SiS_Pr->SiS_PanelType0f_1 = SiS310_PanelType0f_1; - SiS_Pr->SiS_PanelType00_2 = SiS310_PanelType00_2; - SiS_Pr->SiS_PanelType01_2 = SiS310_PanelType01_2; - SiS_Pr->SiS_PanelType02_2 = SiS310_PanelType02_2; - SiS_Pr->SiS_PanelType03_2 = SiS310_PanelType03_2; - SiS_Pr->SiS_PanelType04_2 = SiS310_PanelType04_2; - SiS_Pr->SiS_PanelType05_2 = SiS310_PanelType05_2; - SiS_Pr->SiS_PanelType06_2 = SiS310_PanelType06_2; - SiS_Pr->SiS_PanelType07_2 = SiS310_PanelType07_2; - SiS_Pr->SiS_PanelType08_2 = SiS310_PanelType08_2; - SiS_Pr->SiS_PanelType09_2 = SiS310_PanelType09_2; - SiS_Pr->SiS_PanelType0a_2 = SiS310_PanelType0a_2; - SiS_Pr->SiS_PanelType0b_2 = SiS310_PanelType0b_2; - SiS_Pr->SiS_PanelType0c_2 = SiS310_PanelType0c_2; - SiS_Pr->SiS_PanelType0d_2 = SiS310_PanelType0d_2; - SiS_Pr->SiS_PanelType0e_2 = SiS310_PanelType0e_2; - SiS_Pr->SiS_PanelType0f_2 = SiS310_PanelType0f_2; - SiS_Pr->SiS_PanelTypeNS_1 = SiS310_PanelTypeNS_1; - SiS_Pr->SiS_PanelTypeNS_2 = SiS310_PanelTypeNS_2; - SiS_Pr->SiS_CHTVUPALData = SiS310_CHTVUPALData; SiS_Pr->SiS_CHTVOPALData = SiS310_CHTVOPALData; SiS_Pr->SiS_CHTVUPALMData = SiS310_CHTVUPALMData; @@ -477,34 +354,12 @@ InitTo310Pointer(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) SiS_Pr->SiS_CHTVUPALNData = SiS310_CHTVUPALNData; SiS_Pr->SiS_CHTVOPALNData = SiS310_CHTVOPALNData; SiS_Pr->SiS_CHTVSOPALData = SiS310_CHTVSOPALData; - - SiS_Pr->SiS_LVDSCRT1800x600_1 = SiS310_LVDSCRT1800x600_1; - SiS_Pr->SiS_LVDSCRT11024x768_1 = SiS310_LVDSCRT11024x768_1; - SiS_Pr->SiS_LVDSCRT11280x1024_1 = SiS310_LVDSCRT11280x1024_1; - SiS_Pr->SiS_LVDSCRT11400x1050_1 = SiS310_LVDSCRT11400x1050_1; - SiS_Pr->SiS_LVDSCRT11600x1200_1 = SiS310_LVDSCRT11600x1200_1; - SiS_Pr->SiS_LVDSCRT1800x600_1_H = SiS310_LVDSCRT1800x600_1_H; - SiS_Pr->SiS_LVDSCRT11024x768_1_H = SiS310_LVDSCRT11024x768_1_H; - SiS_Pr->SiS_LVDSCRT11280x1024_1_H = SiS310_LVDSCRT11280x1024_1_H; - SiS_Pr->SiS_LVDSCRT11400x1050_1_H = SiS310_LVDSCRT11400x1050_1_H; - SiS_Pr->SiS_LVDSCRT11600x1200_1_H = SiS310_LVDSCRT11600x1200_1_H; - SiS_Pr->SiS_LVDSCRT1800x600_2 = SiS310_LVDSCRT1800x600_2; - SiS_Pr->SiS_LVDSCRT11024x768_2 = SiS310_LVDSCRT11024x768_2; - SiS_Pr->SiS_LVDSCRT11280x1024_2 = SiS310_LVDSCRT11280x1024_2; - SiS_Pr->SiS_LVDSCRT11400x1050_2 = SiS310_LVDSCRT11400x1050_2; - SiS_Pr->SiS_LVDSCRT11600x1200_2 = SiS310_LVDSCRT11600x1200_2; - SiS_Pr->SiS_LVDSCRT1800x600_2_H = SiS310_LVDSCRT1800x600_2_H; - SiS_Pr->SiS_LVDSCRT11024x768_2_H = SiS310_LVDSCRT11024x768_2_H; - SiS_Pr->SiS_LVDSCRT11280x1024_2_H = SiS310_LVDSCRT11280x1024_2_H; - SiS_Pr->SiS_LVDSCRT11400x1050_2_H = SiS310_LVDSCRT11400x1050_2_H; - SiS_Pr->SiS_LVDSCRT11600x1200_2_H = SiS310_LVDSCRT11600x1200_2_H; - SiS_Pr->SiS_LVDSCRT1XXXxXXX_1 = SiS310_LVDSCRT1XXXxXXX_1; - SiS_Pr->SiS_LVDSCRT1XXXxXXX_1_H = SiS310_LVDSCRT1XXXxXXX_1_H; - SiS_Pr->SiS_CHTVCRT1UNTSC = SiS310_CHTVCRT1UNTSC; - SiS_Pr->SiS_CHTVCRT1ONTSC = SiS310_CHTVCRT1ONTSC; - SiS_Pr->SiS_CHTVCRT1UPAL = SiS310_CHTVCRT1UPAL; - SiS_Pr->SiS_CHTVCRT1OPAL = SiS310_CHTVCRT1OPAL; - SiS_Pr->SiS_CHTVCRT1SOPAL = SiS310_CHTVCRT1OPAL; + + SiS_Pr->SiS_CHTVCRT1UNTSC = SiS310_CHTVCRT1UNTSC; + SiS_Pr->SiS_CHTVCRT1ONTSC = SiS310_CHTVCRT1ONTSC; + SiS_Pr->SiS_CHTVCRT1UPAL = SiS310_CHTVCRT1UPAL; + SiS_Pr->SiS_CHTVCRT1OPAL = SiS310_CHTVCRT1OPAL; + SiS_Pr->SiS_CHTVCRT1SOPAL = SiS310_CHTVCRT1OPAL; SiS_Pr->SiS_CHTVReg_UNTSC = SiS310_CHTVReg_UNTSC; SiS_Pr->SiS_CHTVReg_ONTSC = SiS310_CHTVReg_ONTSC; @@ -695,7 +550,7 @@ SiS_GetModeID(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, break; } - return(ModeIndex); + return ModeIndex; } #endif @@ -1297,11 +1152,13 @@ SiS_GetSysFlags(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) case 0x80: case 0x90: case 0xc0: - SiS_Pr->SiS_SysFlags |= SF_IsM650; break; + SiS_Pr->SiS_SysFlags |= SF_IsM650; + break; case 0xa0: case 0xb0: case 0xe0: - SiS_Pr->SiS_SysFlags |= SF_Is651; break; + SiS_Pr->SiS_SysFlags |= SF_Is651; + break; } } else { switch(cr5f) { @@ -1314,9 +1171,11 @@ SiS_GetSysFlags(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) } break; case 0xb0: - SiS_Pr->SiS_SysFlags |= SF_Is652; break; + SiS_Pr->SiS_SysFlags |= SF_Is652; + break; default: - SiS_Pr->SiS_SysFlags |= SF_IsM650; break; + SiS_Pr->SiS_SysFlags |= SF_IsM650; + break; } } } @@ -1702,10 +1561,8 @@ SiS_CheckMemorySize(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, } } - memorysize = modeflag & MemoryInfoFlag; - memorysize >>= MemorySizeShift; /* Get required memory size */ - memorysize++; - + memorysize = ((modeflag & MemoryInfoFlag) >> MemorySizeShift) + 1; + if(AdapterMemSize < memorysize) return FALSE; return TRUE; } @@ -1816,7 +1673,7 @@ SiS_SearchModeID(SiS_Private *SiS_Pr, USHORT *ModeNo, USHORT *ModeIdIndex) { UCHAR VGAINFO = SiS_Pr->SiS_VGAINFO; - if(*ModeNo <= 0x13) { + if((*ModeNo) <= 0x13) { if((*ModeNo) <= 0x05) (*ModeNo) |= 0x01; @@ -1875,7 +1732,7 @@ SiS_DoLowModeTest(SiS_Private *SiS_Pr, USHORT ModeNo, PSIS_HW_INFO HwInfo) USHORT temp,temp1,temp2; if((ModeNo != 0x03) && (ModeNo != 0x10) && (ModeNo != 0x12)) - return(TRUE); + return TRUE; temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x11); SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x11,0x80); temp1 = SiS_GetReg(SiS_Pr->SiS_P3d4,0x00); @@ -1885,13 +1742,13 @@ SiS_DoLowModeTest(SiS_Private *SiS_Pr, USHORT ModeNo, PSIS_HW_INFO HwInfo) SiS_SetReg(SiS_Pr->SiS_P3d4,0x11,temp); if((HwInfo->jChipType >= SIS_315H) || (HwInfo->jChipType == SIS_300)) { - if(temp2 == 0x55) return(FALSE); - else return(TRUE); + if(temp2 == 0x55) return FALSE; + else return TRUE; } else { - if(temp2 != 0x55) return(TRUE); + if(temp2 != 0x55) return TRUE; else { SiS_SetRegOR(SiS_Pr->SiS_P3d4,0x35,0x01); - return(FALSE); + return FALSE; } } } @@ -1965,7 +1822,7 @@ SiS_GetColorDepth(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex) index = (modeflag & ModeTypeMask) - ModeEGA; if(index < 0) index = 0; - return(ColorDepth[index]); + return ColorDepth[index]; } /*********************************************/ @@ -1996,7 +1853,7 @@ SiS_GetOffset(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, temp += colordepth; } - return(temp); + return temp; } /*********************************************/ @@ -2007,47 +1864,21 @@ static void SiS_SetSeqRegs(SiS_Private *SiS_Pr, USHORT StandTableIndex, PSIS_HW_INFO HwInfo) { UCHAR SRdata; - USHORT i; + int i; - SiS_SetReg(SiS_Pr->SiS_P3c4,0x00,0x03); /* Set SR0 */ + SiS_SetReg(SiS_Pr->SiS_P3c4,0x00,0x03); - SRdata = SiS_Pr->SiS_StandTable[StandTableIndex].SR[0]; + /* or "display off" */ + SRdata = SiS_Pr->SiS_StandTable[StandTableIndex].SR[0] | 0x20; - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) { - SRdata |= 0x01; - } - if(HwInfo->jChipType >= SIS_661) { - if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToTV)) { - if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { - SRdata |= 0x01; /* 8 dot clock */ - } - } - } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - if(SiS_Pr->SiS_VBType & VB_NoLCD) { - if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { - SRdata |= 0x01; /* 8 dot clock */ - } - } - } - } - - 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) { - SRdata |= 0x01; /* 8 dot clock */ - } - } - } - if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) { - SRdata |= 0x01; /* 8 dot clock */ - } - } - } - - SRdata |= 0x20; /* screen off */ + /* determine whether to force x8 dotclock */ + if((SiS_Pr->SiS_VBType & VB_SISVB) || (SiS_Pr->SiS_IF_DEF_LVDS)) { + + if(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToTV)) { + if(SiS_Pr->SiS_VBInfo & SetInSlaveMode) SRdata |= 0x01; + } else if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA) SRdata |= 0x01; + + } SiS_SetReg(SiS_Pr->SiS_P3c4,0x01,SRdata); @@ -2240,20 +2071,12 @@ SiS_ResetCRT1VCLK(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) return; } } - - if(HwInfo->jChipType >= SIS_315H) { - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x31,0xCF,0x20); - } else { - SiS_SetReg(SiS_Pr->SiS_P3c4,0x31,0x20); - } + + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x31,0xcf,0x20); SiS_SetReg(SiS_Pr->SiS_P3c4,0x2B,SiS_Pr->SiS_VCLKData[1].SR2B); SiS_SetReg(SiS_Pr->SiS_P3c4,0x2C,SiS_Pr->SiS_VCLKData[1].SR2C); SiS_SetReg(SiS_Pr->SiS_P3c4,0x2D,0x80); - if(HwInfo->jChipType >= SIS_315H) { - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x31,0xcf,0x10); - } else { - SiS_SetReg(SiS_Pr->SiS_P3c4,0x31,0x10); - } + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x31,0xcf,0x10); SiS_SetReg(SiS_Pr->SiS_P3c4,0x2B,SiS_Pr->SiS_VCLKData[0].SR2B); SiS_SetReg(SiS_Pr->SiS_P3c4,0x2C,SiS_Pr->SiS_VCLKData[0].SR2C); SiS_SetReg(SiS_Pr->SiS_P3c4,0x2D,0x80); @@ -2326,6 +2149,9 @@ SiS_SetCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } index = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT1CRTC; + + /* Alternate for 1600x1200 LCDA */ + if((index == 0x20) && (SiS_Pr->Alternate1600x1200)) index = 0x57; for(i=0,j=0;i<=7;i++,j++) { SiS_SetReg(SiS_Pr->SiS_P3d4,j,SiS_Pr->SiS_CRT1Table[index].CR[i]); @@ -2405,6 +2231,8 @@ SiS_SetCRT1VCLK(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } else { index = SiS_GetVCLK2Ptr(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, HwInfo); if((SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { + /* Alternate for 1600x1200 LCDA */ + if((index == 0x21) && (SiS_Pr->Alternate1600x1200)) index = 0x72; clka = SiS_Pr->SiS_VBVCLKData[index].Part4_A; clkb = SiS_Pr->SiS_VBVCLKData[index].Part4_B; } else { @@ -2412,12 +2240,8 @@ SiS_SetCRT1VCLK(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, clkb = SiS_Pr->SiS_VCLKData[index].SR2C; } } - - if(HwInfo->jChipType >= SIS_315H) { - SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x31,0xCF); - } else { - SiS_SetReg(SiS_Pr->SiS_P3c4,0x31,0x00); - } + + SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x31,0xCF); SiS_SetReg(SiS_Pr->SiS_P3c4,0x2B,clka); SiS_SetReg(SiS_Pr->SiS_P3c4,0x2C,clkb); @@ -2491,7 +2315,7 @@ SiS_CalcDelay(SiS_Private *SiS_Pr, USHORT VCLK, USHORT colordepth, USHORT MCLK) if(tempax < 4) tempax = 4; tempax -= 4; if(tempbx < tempax) tempbx = tempax; - return(tempbx); + return tempbx; } static void @@ -2605,7 +2429,7 @@ SiS_CalcDelay2(SiS_Private *SiS_Pr, UCHAR key, PSIS_HW_INFO HwInfo) if(data & 0x0080) index += 12; data = LatencyFactor[index]; } - return(data); + return data; } static void @@ -2956,9 +2780,17 @@ SiS_SetCRT1ModeRegs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, if(HwInfo->jChipType != SIS_300) { data = 0; if(infoflag & InterlaceMode) { - if(xres <= 800) data = 0x0020; - else if(xres <= 1024) data = 0x0035; - else data = 0x0048; + /* data = (Hsync / 8) - ((Htotal / 8) / 2) + 3 */ + USHORT hrs = (SiS_GetReg(SiS_Pr->SiS_P3d4,0x04) | + ((SiS_GetReg(SiS_Pr->SiS_P3c4,0x0b) & 0xc0) << 2)) - 3; + USHORT hto = (SiS_GetReg(SiS_Pr->SiS_P3d4,0x00) | + ((SiS_GetReg(SiS_Pr->SiS_P3c4,0x0b) & 0x03) << 8)) + 5; + data = hrs - (hto >> 1) + 3; +#if 0 + if(xres <= 800) data = 0x0020; /* guessed */ + else if(xres <= 1024) data = 0x0035; /* 1024x768 */ + else data = 0x0048; /* 1280x1024 */ +#endif } SiS_SetReg(SiS_Pr->SiS_P3d4,0x19,(data & 0xFF)); SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x1a,0xFC,(data >> 8)); @@ -2981,11 +2813,11 @@ SiS_SetCRT1ModeRegs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, } } - if(HwInfo->jChipType >= SIS_661) { +#ifdef SIS315H + if(HwInfo->jChipType >= SIS_315H) { SiS_SetRegAND(SiS_Pr->SiS_P3c4,0x31,0xfb); } -#ifdef SIS315H if(HwInfo->jChipType == SIS_315PRO) { data = SiS_Get310DRAMType(SiS_Pr, HwInfo); @@ -3377,7 +3209,7 @@ SiS_SetPitchCRT1(SiS_Private *SiS_Pr, ScrnInfoPtr pScrn) UShort HDisplay = pSiS->scrnPitch >> 3; SiS_SetReg(SiS_Pr->SiS_P3d4,0x13,(HDisplay & 0xFF)); - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0E,0xF0,(HDisplay>>8)); + SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0E,0xF0,(HDisplay >> 8)); } static void @@ -3509,8 +3341,9 @@ SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,USHORT ModeNo) #ifdef LINUX_KERNEL /* 3. Check memory size (Kernel framebuffer driver only) */ - temp = SiS_CheckMemorySize(SiS_Pr, HwInfo, ModeNo, ModeIdIndex); - if(!temp) return(0); + if(!SiS_CheckMemorySize(SiS_Pr, HwInfo, ModeNo, ModeIdIndex)) { + return FALSE; + } #endif if(HwInfo->jChipType >= SIS_315H) { @@ -4080,7 +3913,7 @@ SiS_GetPanelID(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) #define GETBITSTR(val,from,to) ((GETBITS(val,from)) << (0?to)) #endif -static void +void SiS_CalcCRRegisters(SiS_Private *SiS_Pr, int depth) { SiS_Pr->CCRT1CRTC[0] = ((SiS_Pr->CHTotal >> 3) - 5) & 0xff; /* CR0 */ @@ -4135,9 +3968,10 @@ SiS_CalcCRRegisters(SiS_Private *SiS_Pr, int depth) } void -SiS_CalcLCDACRT1Timing(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex) +SiS_CalcLCDACRT1Timing(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex,PSIS_HW_INFO HwInfo) { - USHORT modeflag, tempax, tempbx, VGAHDE = SiS_Pr->SiS_VGAHDE; + USHORT modeflag, tempax, tempbx, remaining = 0; + USHORT VGAHDE = SiS_Pr->SiS_VGAHDE; int i,j; /* 1:1 data: use data set by setcrt1crtc() */ @@ -4159,32 +3993,85 @@ SiS_CalcLCDACRT1Timing(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex) SiS_Pr->CVDisplay = SiS_Pr->SiS_VGAVDE; SiS_Pr->CVBlankStart = SiS_Pr->SiS_VGAVDE; - tempbx = SiS_Pr->PanelHT - SiS_Pr->PanelXRes; - tempax = SiS_Pr->SiS_VGAHDE; /* not /2 ! */ - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { - tempax = SiS_Pr->PanelXRes; - } - tempbx += tempax; - if(modeflag & HalfDCLK) tempbx -= VGAHDE; - SiS_Pr->CHTotal = SiS_Pr->CHBlankEnd = tempbx; - - tempax = VGAHDE; - tempbx = SiS_Pr->CHTotal; - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { - tempbx = SiS_Pr->PanelXRes; + if(HwInfo->jChipType < SIS_315H) { + tempbx = SiS_Pr->SiS_VGAHT; + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + tempbx = SiS_Pr->PanelHT; + } if(modeflag & HalfDCLK) tempbx >>= 1; - tempax += ((tempbx - tempax) >> 1); + remaining = tempbx % 8; + } else { + /* OK for LCDA, LVDS */ + tempbx = SiS_Pr->PanelHT - SiS_Pr->PanelXRes; + tempax = SiS_Pr->SiS_VGAHDE; /* not /2 ! */ + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + tempax = SiS_Pr->PanelXRes; + } + tempbx += tempax; + if(modeflag & HalfDCLK) tempbx -= VGAHDE; } - - tempax += SiS_Pr->PanelHRS; - SiS_Pr->CHSyncStart = tempax; - tempax += SiS_Pr->PanelHRE; - SiS_Pr->CHSyncEnd = tempax; - + SiS_Pr->CHTotal = SiS_Pr->CHBlankEnd = tempbx; + + if(HwInfo->jChipType < SIS_315H) { +#ifdef SIS300 + if(SiS_Pr->SiS_VGAHDE == SiS_Pr->PanelXRes) { + SiS_Pr->CHSyncStart = SiS_Pr->SiS_VGAHDE + ((SiS_Pr->PanelHRS + 1) & ~1); + SiS_Pr->CHSyncEnd = SiS_Pr->CHSyncStart + SiS_Pr->PanelHRE; + if(modeflag & HalfDCLK) { + SiS_Pr->CHSyncStart >>= 1; + SiS_Pr->CHSyncEnd >>= 1; + } + } else if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + tempax = (SiS_Pr->PanelXRes - SiS_Pr->SiS_VGAHDE) >> 1; + tempbx = (SiS_Pr->PanelHRS + 1) & ~1; + if(modeflag & HalfDCLK) { + tempax >>= 1; + tempbx >>= 1; + } + SiS_Pr->CHSyncStart = (VGAHDE + tempax + tempbx + 7) & ~7; + tempax = SiS_Pr->PanelHRE + 7; + if(modeflag & HalfDCLK) tempax >>= 1; + SiS_Pr->CHSyncEnd = (SiS_Pr->CHSyncStart + tempax) & ~7; + } else { + SiS_Pr->CHSyncStart = SiS_Pr->SiS_VGAHDE; + if(modeflag & HalfDCLK) { + SiS_Pr->CHSyncStart >>= 1; + tempax = ((SiS_Pr->CHTotal - SiS_Pr->CHSyncStart) / 3) << 1; + SiS_Pr->CHSyncEnd = SiS_Pr->CHSyncStart + tempax; + } else { + SiS_Pr->CHSyncEnd = (SiS_Pr->CHSyncStart + (SiS_Pr->CHTotal / 10) + 7) & ~7; + SiS_Pr->CHSyncStart += 8; + } + } +#endif + } else { +#ifdef SIS315H + tempax = VGAHDE; + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + tempbx = SiS_Pr->PanelXRes; + if(modeflag & HalfDCLK) tempbx >>= 1; + tempax += ((tempbx - tempax) >> 1); + } + tempax += SiS_Pr->PanelHRS; + SiS_Pr->CHSyncStart = tempax; + tempax += SiS_Pr->PanelHRE; + SiS_Pr->CHSyncEnd = tempax; +#endif + } + tempbx = SiS_Pr->PanelVT - SiS_Pr->PanelYRes; tempax = SiS_Pr->SiS_VGAVDE; if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { tempax = SiS_Pr->PanelYRes; + } else if(HwInfo->jChipType < SIS_315H) { + /* Stupid hack for 640x400/320x200 */ + if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { + if((tempax + tempbx) == 438) tempbx += 16; + } else if((SiS_Pr->SiS_LCDResInfo == Panel_800x600) || + (SiS_Pr->SiS_LCDResInfo == Panel_1024x600)) { + tempax = 0; + tempbx = SiS_Pr->SiS_VGAVT; + } } SiS_Pr->CVTotal = SiS_Pr->CVBlankEnd = tempbx + tempax; @@ -4196,8 +4083,14 @@ SiS_CalcLCDACRT1Timing(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex) SiS_Pr->CVSyncStart = tempax; tempax += SiS_Pr->PanelVRE; SiS_Pr->CVSyncEnd = tempax; + if(HwInfo->jChipType < SIS_315H) { + SiS_Pr->CVSyncStart--; + SiS_Pr->CVSyncEnd--; + } SiS_CalcCRRegisters(SiS_Pr, 8); + SiS_Pr->CCRT1CRTC[15] &= ~0xF8; + SiS_Pr->CCRT1CRTC[15] |= (remaining << 4); SiS_Pr->CCRT1CRTC[16] &= ~0xE0; SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); @@ -4288,7 +4181,7 @@ SiS_MakeClockRegs(ScrnInfoPtr pScrn, int clock, UCHAR *p2b, UCHAR *p2c) #endif -/* ================ XFREE86/X.ORG ================= */ +/* ================ XFree86/X.org ================= */ /* Helper functions */ @@ -5068,7 +4961,7 @@ sisfb_mode_rate_to_dclock(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, ClockIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRTVCLK; Clock = SiS_Pr->SiS_VCLKData[ClockIndex].CLOCK * 1000; - return(Clock); + return Clock; } BOOLEAN diff --git a/src/init.h b/src/init.h index 8d68913..829885f 100644 --- a/src/init.h +++ b/src/init.h @@ -3,7 +3,7 @@ /* * Data and prototypes for init.c * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * If distributed as part of the Linux kernel, the following license terms * apply: @@ -58,6 +58,12 @@ #ifdef LINUX_XF86 #include "sis.h" +#define SIS_NEED_inSISREG +#define SIS_NEED_inSISREGW +#define SIS_NEED_inSISREGL +#define SIS_NEED_outSISREG +#define SIS_NEED_outSISREGW +#define SIS_NEED_outSISREGL #include "sis_regs.h" #endif @@ -212,6 +218,30 @@ static const USHORT SiS_VGA_DAC[] = 0x0B,0x0C,0x0D,0x0F,0x10 }; +static const SiS_StStruct SiS_SModeIDTable[]= +{ + {0x01,0x9208,0x01,0x00,0x00,0x00,0x01,0x00,0x40}, + {0x01,0x1210,0x14,0x01,0x01,0x00,0x01,0x00,0x40}, + {0x01,0x1010,0x17,0x02,0x02,0x00,0x01,0x01,0x40}, + {0x03,0x8208,0x03,0x00,0x00,0x00,0x01,0x02,0x40}, + {0x03,0x0210,0x16,0x01,0x01,0x00,0x01,0x02,0x40}, + {0x03,0x0010,0x18,0x02,0x02,0x00,0x01,0x03,0x40}, + {0x05,0x9209,0x05,0x00,0x00,0x00,0x00,0x04,0x40}, + {0x06,0x8209,0x06,0x00,0x00,0x00,0x00,0x05,0x40}, + {0x07,0x0000,0x07,0x03,0x03,0x00,0x01,0x03,0x40}, + {0x07,0x0000,0x19,0x02,0x02,0x00,0x01,0x03,0x40}, + {0x0d,0x920a,0x0d,0x00,0x00,0x00,0x00,0x04,0x40}, + {0x0e,0x820a,0x0e,0x00,0x00,0x00,0x00,0x05,0x40}, + {0x0f,0x0202,0x11,0x01,0x01,0x00,0x00,0x05,0x40}, + {0x10,0x0212,0x12,0x01,0x01,0x00,0x00,0x05,0x40}, + {0x11,0x0212,0x1a,0x04,0x04,0x00,0x00,0x05,0x40}, + {0x12,0x0212,0x1b,0x04,0x04,0x00,0x00,0x05,0x40}, + {0x13,0x021b,0x1c,0x00,0x00,0x00,0x00,0x04,0x40}, + {0x12,0x0010,0x18,0x02,0x02,0x00,0x00,0x05,0x40}, + {0x12,0x0210,0x18,0x01,0x01,0x00,0x00,0x05,0x40}, + {0xff,0x0000,0x00,0x00,0x00,0x00,0x00,0x00,0x00} +}; + static const SiS_StResInfoStruct SiS_StResInfo[]= { { 640,400}, @@ -825,119 +855,119 @@ static const UCHAR SiS_SpecialPhaseJ[]= {0x25,0xd4,0xfd,0x5e}; static const SiS_TVDataStruct SiS_StPALData[] = { - { 1, 1, 864, 525,1270, 400, 100, 0, 760,0xf4,0xff,0x1c,0x22}, - { 1, 1, 864, 525,1270, 350, 100, 0, 760,0xf4,0xff,0x1c,0x22}, - { 1, 1, 864, 525,1270, 400, 0, 0, 720,0xf1,0x04,0x1f,0x18}, - { 1, 1, 864, 525,1270, 350, 0, 0, 720,0xf4,0x0b,0x1c,0x0a}, - { 1, 1, 864, 525,1270, 480, 50, 0, 760,0xf4,0xff,0x1c,0x22}, - { 1, 1, 864, 525,1270, 600, 50, 0, 0,0xf4,0xff,0x1c,0x22} + { 1, 1, 864, 525,1270, 400, 100, 0, 760, 0,0xf4,0xff,0x1c,0x22}, + { 1, 1, 864, 525,1270, 350, 100, 0, 760, 0,0xf4,0xff,0x1c,0x22}, + { 1, 1, 864, 525,1270, 400, 0, 0, 720, 0,0xf1,0x04,0x1f,0x18}, + { 1, 1, 864, 525,1270, 350, 0, 0, 720, 0,0xf4,0x0b,0x1c,0x0a}, + { 1, 1, 864, 525,1270, 480, 50, 0, 760, 0,0xf4,0xff,0x1c,0x22}, + { 1, 1, 864, 525,1270, 600, 50, 0, 0,0x300,0xf4,0xff,0x1c,0x22} }; static const SiS_TVDataStruct SiS_ExtPALData[] = { - { 27, 10, 848, 448,1270, 530, 50, 0, 50,0xf4,0xff,0x1c,0x22}, /* 640x400, 320x200 */ - { 108, 35, 848, 398,1270, 530, 50, 0, 50,0xf4,0xff,0x1c,0x22}, - { 12, 5, 954, 448,1270, 530, 50, 0, 50,0xf1,0x04,0x1f,0x18}, - { 9, 4, 960, 463,1644, 438, 50, 0, 50,0xf4,0x0b,0x1c,0x0a}, - { 9, 4, 848, 528,1270, 530, 0, 0, 50,0xf5,0xfb,0x1b,0x2a}, /* 640x480, 320x240 */ -/*{ 36, 25,1060, 648,1316, 530, 438, 0, 438,0xeb,0x05,0x25,0x16},*//* 800x600, 400x300 */ - { 36, 25,1060, 648,1270, 530, 438, 0, 438,0xeb,0x05,0x25,0x16}, /* 800x600, 400x300 - better */ - { 3, 2,1080, 619,1270, 540, 438, 0, 438,0xf3,0x00,0x1d,0x20}, /* 720x576 */ - { 1, 1,1170, 821,1270, 520, 686, 0, 686,0xF3,0x00,0x1D,0x20}, /* 1024x768 */ - { 1, 1,1170, 821,1270, 520, 686, 0, 686,0xF3,0x00,0x1D,0x20}, /* 1024x768 (for NTSC equ) */ - { 9, 4, 848, 528,1270, 530, 0, 0, 50,0xf5,0xfb,0x1b,0x2a} /* 720x480 test */ + { 27, 10, 848, 448,1270, 530, 50, 0, 50, 0,0xf4,0xff,0x1c,0x22}, /* 640x400, 320x200 */ + { 108, 35, 848, 398,1270, 530, 50, 0, 50, 0,0xf4,0xff,0x1c,0x22}, + { 12, 5, 954, 448,1270, 530, 50, 0, 50, 0,0xf1,0x04,0x1f,0x18}, + { 9, 4, 960, 463,1644, 438, 50, 0, 50, 0,0xf4,0x0b,0x1c,0x0a}, + { 9, 4, 848, 528,1270, 530, 0, 0, 50, 0,0xf5,0xfb,0x1b,0x2a}, /* 640x480, 320x240 */ +/*{ 36, 25,1060, 648,1316, 530, 438, 0, 438, 0,0xeb,0x05,0x25,0x16},*//* 800x600, 400x300 */ + { 36, 25,1060, 648,1270, 530, 438, 0, 438, 0,0xeb,0x05,0x25,0x16}, /* 800x600, 400x300 - better */ + { 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 */ }; static const SiS_TVDataStruct SiS_StNTSCData[] = { - { 1, 1, 858, 525,1270, 400, 50, 0, 760,0xf1,0x04,0x1f,0x18}, - { 1, 1, 858, 525,1270, 350, 50, 0, 640,0xf1,0x04,0x1f,0x18}, - { 1, 1, 858, 525,1270, 400, 0, 0, 720,0xf1,0x04,0x1f,0x18}, - { 1, 1, 858, 525,1270, 350, 0, 0, 720,0xf4,0x0b,0x1c,0x0a}, - { 1, 1, 858, 525,1270, 480, 0, 0, 760,0xf1,0x04,0x1f,0x18} + { 1, 1, 858, 525,1270, 400, 50, 0, 760, 0,0xf1,0x04,0x1f,0x18}, + { 1, 1, 858, 525,1270, 350, 50, 0, 640, 0,0xf1,0x04,0x1f,0x18}, + { 1, 1, 858, 525,1270, 400, 0, 0, 720, 0,0xf1,0x04,0x1f,0x18}, + { 1, 1, 858, 525,1270, 350, 0, 0, 720, 0,0xf4,0x0b,0x1c,0x0a}, + { 1, 1, 858, 525,1270, 480, 0, 0, 760, 0,0xf1,0x04,0x1f,0x18} }; static const SiS_TVDataStruct SiS_ExtNTSCData[] = { - { 143, 65, 858, 443,1270, 440, 171, 0, 171,0xf1,0x04,0x1f,0x18}, /* 640x400, 320x200 */ - { 88, 35, 858, 393,1270, 440, 171, 0, 171,0xf1,0x04,0x1f,0x18}, - { 143, 70, 924, 443,1270, 440, 92, 0, 92,0xf1,0x04,0x1f,0x18}, - { 143, 70, 924, 393,1270, 440, 92, 0, 92,0xf4,0x0b,0x1c,0x0a}, - { 143, 76, 836, 523,1270, 440, 224, 0, 0,0xf1,0x05,0x1f,0x16}, /* 640x480, 320x240 */ - { 143, 120,1056, 643,1270, 440, 0, 128, 0,0xf4,0x10,0x1c,0x00}, /* 800x600, 400x300 */ -/*{ 2, 1, 858, 503,1270, 480, 0, 128, 0,0xee,0x0c,0x22,0x08},*/ /* 720x480 (old, from 650) */ - { 143, 76, 836, 523,1270, 440, 0, 128, 0,0xee,0x0c,0x22,0x08}, /* 720x480 - BETTER (from 300 series) */ -/*{ 65, 64,1056, 791,1270, 480, 638, 0, 0,0xEE,0x0C,0x22,0x08} */ /* 1024x768 (525i) */ - { 1, 1,1100, 811,1412, 440, 0, 128, 0,0xee,0x0c,0x22,0x08}, /* 1024x768 (525i) CORRECTED */ - { 65, 64,1056, 791,1270, 480, 455, 0, 0,0x00,0x00,0x00,0x00} /* 1024x768 (525p) */ + { 143, 65, 858, 443,1270, 440, 171, 0, 171, 0,0xf1,0x04,0x1f,0x18}, /* 640x400, 320x200 */ + { 88, 35, 858, 393,1270, 440, 171, 0, 171, 0,0xf1,0x04,0x1f,0x18}, + { 143, 70, 924, 443,1270, 440, 92, 0, 92, 0,0xf1,0x04,0x1f,0x18}, + { 143, 70, 924, 393,1270, 440, 92, 0, 92, 0,0xf4,0x0b,0x1c,0x0a}, + { 143, 76, 836, 523,1270, 440, 224, 0, 0, 0,0xf1,0x05,0x1f,0x16}, /* 640x480, 320x240 */ + { 143, 120,1056, 643,1270, 440, 0, 1, 0, 0,0xf4,0x10,0x1c,0x00}, /* 800x600, 400x300 */ +/*{ 2, 1, 858, 503,1270, 480, 0, 1, 0, 0,0xee,0x0c,0x22,0x08},*/ /* 720x480 (old, from 650) */ + { 143, 76, 836, 523,1270, 440, 0, 1, 0, 0,0xee,0x0c,0x22,0x08}, /* 720x480 - BETTER (from 300 series) */ +/*{ 65, 64,1056, 791,1270, 480, 638, 0, 0, 0,0xEE,0x0C,0x22,0x08} */ /* 1024x768 (525i) */ + { 1, 1,1100, 811,1412, 440, 0, 1, 0, 0,0xee,0x0c,0x22,0x08}, /* 1024x768 (525i) CORRECTED */ + { 65, 64,1056, 791,1270, 480, 455, 0, 0, 0,0x00,0x00,0x00,0x00} /* 1024x768 (525p) */ }; static const SiS_TVDataStruct SiS_StHiTVData[] = /* Slave + TVSimu */ { - { 1, 1, 0x37c,0x233,0x2b2,0x320, 0, 0, 0, 0x00,0x00,0x00,0x00}, - { 1, 1, 0x37c,0x233,0x2b2,0x2bc, 0, 0, 0, 0x00,0x00,0x00,0x00}, - { 1, 1, 0x37c,0x233,0x2b2,0x320, 0, 0, 0, 0x00,0x00,0x00,0x00}, - { 1, 1, 0x37c,0x233,0x2b2,0x2bc, 0, 0, 0, 0x00,0x00,0x00,0x00}, - { 1, 1, 0x37c,0x233,0x2b2,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00}, - { 8, 5, 0x41a,0x2ab,0x670,0x3c0,0x150,128, 0, 0x00,0x00,0x00,0x00} + { 1, 1, 0x37c,0x233,0x2b2,0x320, 0, 0, 0, 0, 0, 0, 0, 0}, + { 1, 1, 0x37c,0x233,0x2b2,0x2bc, 0, 0, 0, 0, 0, 0, 0, 0}, + { 1, 1, 0x37c,0x233,0x2b2,0x320, 0, 0, 0, 0, 0, 0, 0, 0}, + { 1, 1, 0x37c,0x233,0x2b2,0x2bc, 0, 0, 0, 0, 0, 0, 0, 0}, + { 1, 1, 0x37c,0x233,0x2b2,0x3c0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 8, 5, 0x41a,0x2ab,0x670,0x3c0,0x150, 1, 0, 0, 0, 0, 0, 0} }; static const SiS_TVDataStruct SiS_St2HiTVData[] = /* Slave */ { - { 3, 1, 0x348,0x1e3,0x670,0x3c0,0x032, 0, 0, 0x00,0x00,0x00,0x00}, - { 1, 1, 0x37c,0x233,0x2b2,0x2bc, 0, 0, 0, 0x00,0x00,0x00,0x00}, - { 3, 1, 0x348,0x1e3,0x670,0x3c0,0x032, 0, 0, 0x00,0x00,0x00,0x00}, - { 1, 1, 0x37c,0x233,0x2b2,0x2bc, 0, 0, 0, 0x00,0x00,0x00,0x00}, - { 5, 2, 0x348,0x233,0x670,0x3c0,0x08d,128, 0, 0x00,0x00,0x00,0x00}, - { 8, 5, 0x41a,0x2ab,0x670,0x3c0,0x17c,128, 0, 0x00,0x00,0x00,0x00} + { 3, 1, 0x348,0x1e3,0x670,0x3c0,0x032, 0, 0, 0, 0, 0, 0, 0}, + { 1, 1, 0x37c,0x233,0x2b2,0x2bc, 0, 0, 0, 0, 0, 0, 0, 0}, + { 3, 1, 0x348,0x1e3,0x670,0x3c0,0x032, 0, 0, 0, 0, 0, 0, 0}, + { 1, 1, 0x37c,0x233,0x2b2,0x2bc, 0, 0, 0, 0, 0, 0, 0, 0}, + { 5, 2, 0x348,0x233,0x670,0x3c0,0x08d, 1, 0, 0, 0, 0, 0, 0}, + { 8, 5, 0x41a,0x2ab,0x670,0x3c0,0x17c, 1, 0, 0, 0, 0, 0, 0} }; static const SiS_TVDataStruct SiS_ExtHiTVData[] = { - { 6, 1, 0x348,0x233,0x660,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00}, - { 3, 1, 0x3c0,0x233,0x660,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00}, - { 6, 1, 0x348,0x233,0x660,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00}, - { 3, 1, 0x3c0,0x233,0x660,0x3c0, 0, 0, 0, 0x00,0x00,0x00,0x00}, - { 5, 1, 0x348,0x233,0x670,0x3c0,0x166,128, 0, 0x00,0x00,0x00,0x00}, /* 640x480 */ - { 16, 5, 0x41a,0x2ab,0x670,0x3c0,0x143,128, 0, 0x00,0x00,0x00,0x00}, /* 800x600 */ - { 25, 12, 0x4ec,0x353,0x670,0x3c0,0x032, 0, 0, 0x00,0x00,0x00,0x00}, /* 1024x768 */ - { 5, 4, 0x627,0x464,0x670,0x3c0,0x128, 0, 0, 0x00,0x00,0x00,0x00}, /* 1280x1024 */ - { 4, 1, 0x41a,0x233,0x60c,0x3c0,0x143,128, 0, 0x00,0x00,0x00,0x00}, /* 800x480 */ - { 5, 2, 0x578,0x293,0x670,0x3c0,0x032, 0, 0, 0x00,0x00,0x00,0x00}, /* 1024x576 */ - { 8, 5, 0x6d6,0x323,0x670,0x3c0,0x128, 0, 0, 0x00,0x00,0x00,0x00}, /* 1280x720 */ - { 137, 32, 0x3d4,0x233,0x663,0x3bf,0x143, 0, 0, 0x00,0x00,0x00,0x00} /* 960x600 */ + { 6, 1, 0x348,0x233,0x660,0x3c0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 3, 1, 0x3c0,0x233,0x660,0x3c0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 6, 1, 0x348,0x233,0x660,0x3c0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 3, 1, 0x3c0,0x233,0x660,0x3c0, 0, 0, 0, 0, 0, 0, 0, 0}, + { 5, 1, 0x348,0x233,0x670,0x3c0,0x166, 1, 0, 0, 0, 0, 0, 0}, /* 640x480 */ + { 16, 5, 0x41a,0x2ab,0x670,0x3c0,0x143, 1, 0, 0, 0, 0, 0, 0}, /* 800x600 */ + { 25, 12, 0x4ec,0x353,0x670,0x3c0,0x032, 0, 0, 0, 0, 0, 0, 0}, /* 1024x768 */ + { 5, 4, 0x627,0x464,0x670,0x3c0,0x128, 0, 0, 0, 0, 0, 0, 0}, /* 1280x1024 */ + { 4, 1, 0x41a,0x233,0x60c,0x3c0,0x143, 1, 0, 0, 0, 0, 0, 0}, /* 800x480 */ + { 5, 2, 0x578,0x293,0x670,0x3c0,0x032, 0, 0, 0, 0, 0, 0, 0}, /* 1024x576 */ + { 8, 5, 0x6d6,0x323,0x670,0x3c0,0x128, 0, 0, 0, 0, 0, 0, 0}, /* 1280x720 */ + { 137, 32, 0x3d4,0x233,0x663,0x3bf,0x143, 0, 0, 0, 0, 0, 0, 0} /* 960x600 */ }; static const SiS_TVDataStruct SiS_St525pData[] = { - { 1, 1, 0x6b4,0x20d,0x4f6,0x190, 50, 0, 0x2f8, 0x00,0x00,0x00,0x00}, - { 1, 1, 0x6b4,0x20d,0x4f6,0x15e, 50, 0, 0x280, 0x00,0x00,0x00,0x00}, - { 1, 1, 0x6b4,0x20d,0x4f6,0x190, 50, 0, 0x2f8, 0x00,0x00,0x00,0x00}, - { 1, 1, 0x6b4,0x20d,0x4f6,0x15e, 50, 0, 0x280, 0x00,0x00,0x00,0x00}, - { 1, 1, 0x6b4,0x20d,0x4f6,0x1e0, 0, 0, 0x2f8, 0x00,0x00,0x00,0x00} + { 1, 1, 0x6b4,0x20d,0x4f6,0x190, 50, 0, 0x2f8, 0, 0, 0, 0, 0}, + { 1, 1, 0x6b4,0x20d,0x4f6,0x15e, 50, 0, 0x280, 0, 0, 0, 0, 0}, + { 1, 1, 0x6b4,0x20d,0x4f6,0x190, 50, 0, 0x2f8, 0, 0, 0, 0, 0}, + { 1, 1, 0x6b4,0x20d,0x4f6,0x15e, 50, 0, 0x280, 0, 0, 0, 0, 0}, + { 1, 1, 0x6b4,0x20d,0x4f6,0x1e0, 0, 0, 0x2f8, 0, 0, 0, 0, 0} }; static const SiS_TVDataStruct SiS_St750pData[] = { - { 1, 1, 0x672,0x2ee,0x500,0x190, 50, 0, 0x2f8, 0x00,0x00,0x00,0x00}, - { 1, 1, 0x672,0x2ee,0x500,0x15e, 50, 0, 0x280, 0x00,0x00,0x00,0x00}, - { 1, 1, 0x672,0x2ee,0x500,0x190, 0, 0, 0x2d0, 0x00,0x00,0x00,0x00}, - { 1, 1, 0x672,0x2ee,0x500,0x15e, 0, 0, 0x2d0, 0x00,0x00,0x00,0x00}, - { 1, 1, 0x672,0x2ee,0x500,0x1e0, 0, 0, 0x2f8, 0x00,0x00,0x00,0x00} + { 1, 1, 0x672,0x2ee,0x500,0x190, 50, 0, 0x2f8, 0, 0, 0, 0, 0}, + { 1, 1, 0x672,0x2ee,0x500,0x15e, 50, 0, 0x280, 0, 0, 0, 0, 0}, + { 1, 1, 0x672,0x2ee,0x500,0x190, 0, 0, 0x2d0, 0, 0, 0, 0, 0}, + { 1, 1, 0x672,0x2ee,0x500,0x15e, 0, 0, 0x2d0, 0, 0, 0, 0, 0}, + { 1, 1, 0x672,0x2ee,0x500,0x1e0, 0, 0, 0x2f8, 0, 0, 0, 0, 0} }; static const SiS_TVDataStruct SiS_Ext750pData[] = { - { 143, 65, 0x35a,0x1bb,0x4f6,0x1b8,0x0ab, 0, 0x0ab, 0x00,0x00,0x00,0x00}, - { 88, 35, 0x35a,0x189,0x4f6,0x1b8,0x0ab, 0, 0x0ab, 0x00,0x00,0x00,0x00}, - { 18, 5, 0x339,0x1ae,0x500,0x2d0,0x05c, 0, 0x05c, 0x00,0x00,0x00,0x00}, - { 143, 70, 0x39c,0x189,0x4f6,0x1b8,0x05c, 0, 0x05c, 0x00,0x00,0x00,0x00}, - { 99, 32, 0x320,0x1fe,0x500,0x2d0, 50, 0, 0, 0x00,0x00,0x00,0x00}, /* 640x480 */ - { 5, 4, 0x5d8,0x29e,0x500,0x2a8, 50, 0, 0, 0x00,0x00,0x00,0x00}, /* 800x600 */ - { 99, 32, 0x320,0x1fe,0x500,0x2d0, 50, 0, 0, 0x00,0x00,0x00,0x00}, /* 720x480 test WORKS */ - { 68, 64, 0x55f,0x346,0x500,0x2a8,0x27e, 0, 0, 0x00,0x00,0x00,0x00}, /* 1024x768 */ - { 5, 2, 0x3a7,0x226,0x500,0x2a8, 0,128, 0, 0x00,0x00,0x00,0x00}, /* 720x576 */ - { 25, 24, 0x5d8,0x2f3,0x460,0x2a8, 50, 0, 0, 0x00,0x00,0x00,0x00} /* 1280x720 WORKS */ + { 143, 65, 0x35a,0x1bb,0x4f6,0x1b8,0x0ab, 0, 0x0ab, 0, 0, 0, 0, 0}, + { 88, 35, 0x35a,0x189,0x4f6,0x1b8,0x0ab, 0, 0x0ab, 0, 0, 0, 0, 0}, + { 18, 5, 0x339,0x1ae,0x500,0x2d0,0x05c, 0, 0x05c, 0, 0, 0, 0, 0}, + { 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 */ + { 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 */ }; static const SiS_LCDDataStruct SiS_LCD1280x720Data[] = /* 2.03.00 */ @@ -1039,6 +1069,23 @@ static const SiS_LCDDataStruct SiS_LCD1280x800_2Data[] = /* 2.03.00 (LVDS) */ { 97, 90, 1600, 730, 1552, 812 } /* 1280x720 */ }; +#if 0 +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 }, + { 8, 3, 880, 491, 1408, 816 }, /* 640x480 */ + { 11, 6, 1024, 612, 1408, 816 }, /* 800x600 */ + { 22, 21, 1400, 784, 1408, 816 }, /* 1024x768 */ + { 0, 0, 0, 0, 0, 0 }, /* 1280x1024 */ + { 1, 1, 1408, 816, 1408, 816 }, /* 1280x800 */ + { 0, 0, 0, 0, 0, 0 }, /* 1280x768 - patch index */ + { 0, 0, 0, 0, 0, 0 } /* 1280x720 */ +}; +#endif + static const SiS_LCDDataStruct SiS_LCD1280x960Data[] = { { 9, 2, 800, 500, 1800, 1000 }, @@ -1162,7 +1209,9 @@ static const SiS_LCDDataStruct SiS_NoScaleData[] = { 1, 1,1808, 808,1808, 808 }, /* 0x1b: 1360x768 */ { 1, 1,1104, 563,1104, 563 }, /* 0x1c: 960x540 */ { 1, 1,1120, 618,1120, 618 }, /* 0x1d: 960x600 */ - { 1, 1,1408, 816,1408, 816 } /* 0x1f: 1280x800 (TMDS special) */ + { 1, 1,1408, 816,1408, 816 }, /* 0x1f: 1280x800 (TMDS special) */ + { 1, 1,1760,1235,1760,1235 }, /* 0x20: 1600x1200 for LCDA */ + { 1, 1,2048,1320,2048,1320 } /* 0x21: 1600x1200 for non-SiS LVDS */ }; /**************************************************************/ @@ -1176,10 +1225,7 @@ static const SiS_LVDSDataStruct SiS_LVDS320x480Data_1[]= { 848, 433, 400, 525}, { 848, 389, 400, 525}, { 848, 518, 400, 525}, - {1056, 628, 400, 525}, - { 400, 525, 400, 525}, - { 800, 449,1000, 644}, - { 800, 525,1000, 635} + {1056, 628, 400, 525} }; static const SiS_LVDSDataStruct SiS_LVDS640x480Data_1[]= @@ -1188,9 +1234,7 @@ static const SiS_LVDSDataStruct SiS_LVDS640x480Data_1[]= { 800, 395, 800, 525}, { 800, 445, 800, 525}, { 800, 395, 800, 525}, - { 800, 525, 800, 525}, - { 800, 525, 800, 525}, /* pseudo */ - { 800, 525, 800, 525} /* pseudo */ + { 800, 525, 800, 525} }; /* FSTN 320x240 */ @@ -1200,9 +1244,7 @@ static const SiS_LVDSDataStruct SiS_LVDS640x480Data_2[]= { 800, 395, 800, 525}, { 800, 445, 800, 525}, { 800, 395, 800, 525}, - { 800, 525, 800, 525}, - { 800, 525, 800, 525}, /* pseudo */ - { 800, 525, 800, 525} /* pseudo */ + { 800, 525, 800, 525} }; static const SiS_LVDSDataStruct SiS_LVDS800x600Data_1[]= @@ -1212,121 +1254,9 @@ static const SiS_LVDSDataStruct SiS_LVDS800x600Data_1[]= { 848, 433,1060, 629}, { 848, 389,1060, 629}, { 848, 518,1060, 629}, - {1056, 628,1056, 628}, {1056, 628,1056, 628} }; -static const SiS_LVDSDataStruct SiS_LVDS800x600Data_2[]= -{ - {1056, 628,1056, 628} -}; - -static const SiS_LVDSDataStruct SiS_LVDS1024x768Data_1[]= -{ - { 840, 438,1344, 806}, - { 840, 409,1344, 806}, - { 840, 438,1344, 806}, - { 840, 409,1344, 806}, - { 840, 518,1344, 806}, /* 640x480 */ - {1050, 638,1344, 806}, /* 800x600 */ - {1344, 806,1344, 806}, /* 1024x768 */ -}; - -static const SiS_LVDSDataStruct SiS_LVDS1024x768Data_2[]= -{ - {1344, 806,1344, 806} -}; - -static const SiS_LVDSDataStruct SiS_LVDS1280x1024Data_1[]= -{ - {1048, 442,1688,1066}, - {1048, 392,1688,1066}, - {1048, 442,1688,1066}, - {1048, 392,1688,1066}, - {1048, 522,1688,1066}, - {1208, 642,1688,1066}, - {1432, 810,1688,1066}, - {1688,1066,1688,1066} -}; - -static const SiS_LVDSDataStruct SiS_LVDS1280x1024Data_2[]= -{ - {1688,1066,1688,1066} -}; - -static const SiS_LVDSDataStruct SiS_LVDS1400x1050Data_1[]= -{ - { 928, 416, 1688,1066}, - { 928, 366, 1688,1066}, - { 928, 416, 1688,1066}, - { 928, 366, 1688,1066}, - { 928, 496, 1688,1066}, - {1088, 616, 1688,1066}, - {1312, 784, 1688,1066}, - {1568,1040, 1688,1066}, - {1688,1066, 1688,1066} -}; - -static const SiS_LVDSDataStruct SiS_LVDS1400x1050Data_2[]= -{ - {1688,1066, 1688,1066} -}; - -static const SiS_LVDSDataStruct SiS_LVDS1600x1200Data_1[]= -{ - {1088, 520, 2048,1320}, - {1088, 470, 2048,1320}, - {1088, 520, 2048,1320}, - {1088, 470, 2048,1320}, - {1088, 600, 2048,1320}, - {1248, 720, 2048,1320}, - {1472, 888, 2048,1320}, - {1728,1144, 2048,1320}, - {1848,1170, 2048,1320}, - {2048,1320, 2048,1320} -}; - -static const SiS_LVDSDataStruct SiS_LVDS1600x1200Data_2[]= -{ - {2048,1320, 2048,1320} -}; - -static const SiS_LVDSDataStruct SiS_LVDS1280x960Data_1[]= -{ - { 840, 438,1344, 806}, - { 840, 409,1344, 806}, - { 840, 438,1344, 806}, - { 840, 409,1344, 806}, - { 840, 518,1344, 806}, - {1050, 638,1344, 806}, - {1344, 806,1344, 806}, - { 800, 449,1280, 801}, - { 800, 525,1280, 813} -}; - -static const SiS_LVDSDataStruct SiS_LVDS1280x960Data_2[]= -{ - {1344, 806,1344, 806} -}; - -static const SiS_LVDSDataStruct SiS_LVDS1280x768Data_1[]= -{ - { 768, 438, 1408, 806}, - { 768, 388, 1408, 806}, - { 768, 438, 1408, 806}, - { 768, 388, 1408, 806}, - { 768, 518, 1408, 806}, - { 928, 638, 1408, 806}, - {1152, 806, 1408, 806}, - {1408, 806, 1408, 806}, - {1408, 806, 1408, 806} -}; - -static const SiS_LVDSDataStruct SiS_LVDS1280x768Data_2[]= -{ - {1408, 806, 1408, 806} -}; - static const SiS_LVDSDataStruct SiS_LVDS1024x600Data_1[] = { { 840, 604,1344, 800}, @@ -1338,123 +1268,17 @@ static const SiS_LVDSDataStruct SiS_LVDS1024x600Data_1[] = {1344, 800,1344, 800} }; -static const SiS_LVDSDataStruct SiS_LVDS1024x600Data_2[] = -{ - {1344, 800,1344, 800} -}; - -static const SiS_LVDSDataStruct SiS_LVDS1152x768Data_1[] = +static const SiS_LVDSDataStruct SiS_LVDS1024x768Data_1[]= { { 840, 438,1344, 806}, { 840, 409,1344, 806}, { 840, 438,1344, 806}, { 840, 409,1344, 806}, - { 840, 518,1344, 806}, - {1050, 638,1344, 806}, - {1344, 806,1344, 806} -}; - -static const SiS_LVDSDataStruct SiS_LVDS1152x768Data_2[] = -{ - {1344, 806,1344, 806} -}; - -/* Pass 1:1 data */ -static const SiS_LVDSDataStruct SiS_LVDSXXXxXXXData_1[]= -{ - { 800, 449, 800, 449}, - { 800, 449, 800, 449}, - { 900, 449, 900, 449}, - { 900, 449, 900, 449}, - { 800, 525, 800, 525}, /* 640x480 */ - {1056, 628, 1056, 628}, /* 800x600 */ - {1344, 806, 1344, 806}, /* 1024x768 */ - {1688,1066, 1688,1066}, /* 1280x1024 */ /* INSERTED */ - {1688, 806, 1688, 806}, /* 1280x768 */ -}; - -/* Custom data for Barco iQ R series */ -static const SiS_LVDSDataStruct SiS_LVDSBARCO1366Data_1[]= -{ - { 832, 438,1331, 806}, - { 832, 388,1331, 806}, - { 832, 438,1331, 806}, - { 832, 388,1331, 806}, - { 832, 518,1331, 806}, - {1050, 638,1344, 806}, - {1344, 806,1344, 806}, - {1688,1066,1688,1066}, - {1688,1066,1688,1066} /* 1360x1024 */ -}; - -/* Custom data for Barco iQ R series */ -static const SiS_LVDSDataStruct SiS_LVDSBARCO1366Data_2[]= -{ - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1344, 806,1344, 806}, - {1688,1066,1688,1066}, - {1688,1066,1688,1066} /* 1360x1024 */ -}; - -/* Custom data for Barco iQ G series */ -static const SiS_LVDSDataStruct SiS_LVDSBARCO1024Data_1[]= -{ - { 832, 438,1331, 806}, - { 832, 409,1331, 806}, - { 832, 438,1331, 806}, - { 832, 409,1331, 806}, - { 832, 518,1331, 806}, /* 640x480 */ + { 840, 518,1344, 806}, /* 640x480 */ {1050, 638,1344, 806}, /* 800x600 */ {1344, 806,1344, 806}, /* 1024x768 */ }; -/* Custom data for Barco iQ G series */ -static const SiS_LVDSDataStruct SiS_LVDSBARCO1024Data_2[]= -{ - {1344, 806,1344, 806} -}; - -/* Custom data for 848x480 parallel panel */ -static const SiS_LVDSDataStruct SiS_LVDS848x480Data_1[]= -{ - { 0, 0, 0, 0}, - { 0, 0, 0, 0}, - { 0, 0, 0, 0}, - { 0, 0, 0, 0}, - {1088, 525,1088, 525}, /* 640x480 TODO */ - {1088, 525,1088, 525}, /* 800x600 TODO */ - {1088, 525,1088, 525}, /* 1024x768 TODO */ - { 0, 0, 0, 0}, - { 0, 0, 0, 0}, - { 0, 0, 0, 0}, - { 0, 0, 0, 0}, - {1088, 525,1088, 525}, /* 848x480 */ - {1088, 525,1088, 525} /* 1360x768 TODO */ -}; - -/* Custom data for 848x480 parallel panel */ -static const SiS_LVDSDataStruct SiS_LVDS848x480Data_2[]= -{ - { 0, 0, 0, 0}, - { 0, 0, 0, 0}, - { 0, 0, 0, 0}, - { 0, 0, 0, 0}, - {1088, 525,1088, 525}, /* 640x480 */ - {1088, 525,1088, 525}, /* 800x600 */ - {1088, 525,1088, 525}, /* 1024x768 */ - { 0, 0, 0, 0}, - { 0, 0, 0, 0}, - { 0, 0, 0, 0}, - { 0, 0, 0, 0}, - {1088, 525,1088, 525}, /* 848x480 */ - {1088, 525,1088, 525} /* 1360x768 TODO */ -}; - static const SiS_LVDSDataStruct SiS_CHTVUNTSCData[]= { { 840, 600, 840, 600}, @@ -1477,52 +1301,6 @@ static const SiS_LVDSDataStruct SiS_CHTVONTSCData[]= {1160, 840,1160, 840} }; -/* Chrontel TV Skew */ - -static const SiS_LVDSDesStruct SiS_CHTVUNTSCDesData[]= -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS_CHTVONTSCDesData[]= -{ - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS_CHTVUPALDesData[]= -{ - {256, 0}, - {256, 0}, - {256, 0}, - {256, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - -static const SiS_LVDSDesStruct SiS_CHTVOPALDesData[]= -{ - {256, 0}, - {256, 0}, - {256, 0}, - {256, 0}, - { 0, 0}, - { 0, 0}, - { 0, 0} -}; - /* CRT1 CRTC data for slave modes */ static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT1320x480_1[] = @@ -1691,6 +1469,7 @@ static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT1640x480_3_H[] = 0x00}} }; +#if 0 static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT11024x600_1[] = { {{0x64,0x4f,0x88,0x54,0x9f,0x5a,0x3e, @@ -1790,230 +1569,7 @@ static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT11024x600_2_H[] = 0x02,0x88,0xff,0x25,0x10,0x00,0x01, 0x01}} }; - -static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT11152x768_1[] = -{ - {{0x64,0x4f,0x88,0x54,0x9f,0xc4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, - 0x00}}, - {{0x64,0x4f,0x88,0x54,0x9f,0x97,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, - 0x00}}, - {{0x64,0x4f,0x88,0x54,0x9f,0xc4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x01, - 0x00}}, - {{0x64,0x4f,0x88,0x54,0x9f,0x97,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x01, - 0x00}}, - {{0x64,0x4f,0x88,0x54,0x9f,0x04,0x3e, - 0xe2,0x89,0xdf,0x05,0x00,0x00,0x01, - 0x00}}, - {{0x7e,0x63,0x82,0x68,0x15,0x7c,0xf0, - 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x26, - 0x01}}, - {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x02, - 0x01}} -}; - -static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT11152x768_1_H[] = -{ - {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, - 0x00}}, - {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, - 0x00}}, - {{0x2f,0x27,0x93,0x2b,0x90,0xc4,0x1f, - 0x92,0x89,0x8f,0xb5,0x30,0x00,0x44, - 0x00}}, - {{0x2f,0x27,0x93,0x2b,0x90,0x97,0x1f, - 0x60,0x87,0x5d,0x83,0x10,0x00,0x44, - 0x00}}, - {{0x2f,0x27,0x93,0x2b,0x90,0x04,0x3e, - 0xe2,0x89,0xdf,0x05,0x00,0x00,0x44, - 0x00}}, - {{0x3c,0x31,0x80,0x35,0x1c,0x7c,0xf0, - 0x5a,0x8f,0x57,0x7d,0x20,0x00,0x55, - 0x01}}, - {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x01, - 0x01}} -}; - -static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT11152x768_2[] = -{ - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x4f,0x87,0x6e,0x9f,0x24,0xbb, - 0x72,0x88,0xdf,0x25,0x30,0x00,0x06, - 0x00}}, - {{0xa3,0x63,0x87,0x78,0x89,0x24,0xf1, - 0xae,0x84,0x57,0x25,0x30,0x00,0x02, - 0x01}}, - {{0xa3,0x7f,0x87,0x86,0x97,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x02, - 0x01}} -}; - -static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT11152x768_2_H[] = -{ - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, - 0x00}}, - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, - 0x00}}, - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x4a,0x80,0x8f,0x25,0x30,0x00,0x01, - 0x00}}, - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x31,0x87,0x5d,0x25,0x30,0x00,0x01, - 0x00}}, - {{0x4f,0x27,0x93,0x39,0x01,0x24,0xbb, - 0x72,0x88,0xdf,0x25,0x30,0x00,0x01, - 0x00}}, - {{0x4f,0x31,0x93,0x3e,0x06,0x24,0xf1, - 0xae,0x84,0x57,0x25,0x30,0x00,0x01, - 0x01}}, - {{0x4f,0x3f,0x93,0x45,0x0d,0x24,0xf5, - 0x02,0x88,0xff,0x25,0x10,0x00,0x01, - 0x01}} -}; - -static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT11280x768_1[] = -{ - {{0x5b,0x4f,0x9f,0x55,0x19,0xb4,0x1f, - 0x9c,0x8e,0x8f,0xb5,0x10,0x00,0x01, - 0x00}}, - {{0x5b,0x4f,0x9f,0x55,0x19,0x82,0x1f, - 0x6a,0x8c,0x5d,0x83,0x30,0x00,0x01, - 0x00}}, - {{0x5b,0x4f,0x9f,0x55,0x19,0xb4,0x1f, - 0x9c,0x8e,0x8f,0xb5,0x10,0x00,0x01, - 0x00}}, - {{0x5b,0x4f,0x9f,0x55,0x19,0x82,0x1f, - 0x6a,0x8c,0x5d,0x83,0x30,0x00,0x01, - 0x00}}, - {{0x5b,0x4f,0x9f,0x55,0x19,0x04,0x3e, - 0xec,0x8e,0xdf,0x05,0x20,0x00,0x01, - 0x00}}, - {{0x6f,0x63,0x93,0x69,0x8d,0x7c,0xf0, - 0x64,0x86,0x57,0x7d,0x20,0x00,0x05, - 0x01}}, - {{0x8b,0x7f,0x8f,0x85,0x09,0x24,0xf5, - 0x0c,0x8e,0xff,0x25,0x30,0x00,0x02, - 0x01}}, - {{0xab,0x9f,0x8f,0xa5,0x89,0x24,0xf5, - 0x0c,0x8e,0xff,0x25,0x30,0x00,0x06, - 0x01}}, - {{0xab,0x9f,0x8f,0xa5,0x89,0x24,0xf5, - 0x0c,0x8e,0xff,0x25,0x30,0x00,0x06, - 0x01}} -}; - -static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT11280x768_1_H[] = -{ - {{0x47,0x27,0x8b,0x2c,0x1a,0x9e,0x1f, - 0x93,0x86,0x8f,0x9f,0x30,0x00,0x05, - 0x00}}, - {{0x47,0x27,0x8b,0x2c,0x1a,0x6c,0x1f, - 0x60,0x84,0x5d,0x6d,0x10,0x00,0x05, - 0x00}}, - {{0x47,0x27,0x8b,0x30,0x1e,0x9e,0x1f, - 0x92,0x86,0x8f,0x9f,0x30,0x00,0x05, - 0x00}}, - {{0x47,0x27,0x8b,0x2c,0x1a,0x6c,0x1f, - 0x60,0x84,0x5d,0x6d,0x10,0x00,0x05, - 0x00}}, - {{0x47,0x27,0x8b,0x2c,0x1a,0xee,0x1f, - 0xe2,0x86,0xdf,0xef,0x10,0x00,0x05, - 0x00}}, - {{0x51,0x31,0x95,0x36,0x04,0x66,0xf0, - 0x5a,0x8e,0x57,0x67,0x20,0x00,0x01, - 0x01}}, - {{0x5f,0x3f,0x83,0x44,0x92,0x0e,0xf5, - 0x02,0x86,0xff,0x0f,0x10,0x00,0x01, - 0x01}}, - {{0x6f,0x4f,0x93,0x54,0x82,0x0e,0x5a, - 0x02,0x86,0xff,0x0f,0x09,0x00,0x05, - 0x01}}, - {{0x6f,0x4f,0x93,0x54,0x82,0x0e,0x5a, - 0x02,0x86,0xff,0x0f,0x09,0x00,0x05, - 0x01}} -}; - -static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT11280x768_2[] = -{ - {{0xab,0x60,0x9f,0x80,0x04,0x24,0xbb, - 0x54,0x86,0xdb,0xda,0x00,0x00,0x02, - 0x00}}, - {{0xab,0x60,0x9f,0x80,0x04,0x24,0xbb, - 0x3b,0x8d,0xc2,0xc1,0x00,0x00,0x02, - 0x00}}, - {{0xab,0x60,0x9f,0x80,0x04,0x24,0xbb, - 0x54,0x86,0xdb,0xda,0x00,0x00,0x02, - 0x00}}, - {{0xab,0x60,0x9f,0x80,0x04,0x24,0xbb, - 0x3b,0x8d,0xc2,0xc1,0x00,0x00,0x02, - 0x00}}, - {{0xab,0x60,0x9f,0x80,0x04,0x24,0xb3, - 0x7c,0x8e,0x03,0x02,0x10,0x00,0x02, - 0x01}}, - {{0xab,0x63,0x8f,0x8a,0x8e,0x24,0xf1, - 0xb6,0x88,0x57,0x25,0x10,0x00,0x02, - 0x01}}, - {{0xab,0x7f,0x8f,0x98,0x9c,0x24,0xf5, - 0x0a,0x8c,0xff,0x25,0x30,0x00,0x02, - 0x01}}, - {{0xab,0x9f,0x8f,0xa8,0x8c,0x24,0xf5, - 0x0a,0x8c,0xff,0x25,0x30,0x00,0x06, - 0x01}}, - {{0xab,0x9f,0x8f,0xa8,0x8c,0x24,0xf5, - 0x0a,0x8c,0xff,0x25,0x30,0x00,0x06, - 0x01}} -}; - -static const SiS_LVDSCRT1DataStruct SiS_LVDSCRT11280x768_2_H[] = -{ - {{0x83,0x38,0x97,0x58,0x9c,0x24,0xbb, - 0x54,0x86,0xdb,0xda,0x00,0x00,0x01, - 0x00}}, - {{0x83,0x38,0x97,0x58,0x9c,0x24,0xbb, - 0x3b,0x8d,0xc2,0xc1,0x00,0x00,0x01, - 0x00}}, - {{0x83,0x38,0x97,0x58,0x9c,0x24,0xbb, - 0x54,0x86,0xdb,0xda,0x00,0x00,0x01, - 0x00}}, - {{0x83,0x38,0x97,0x58,0x9c,0x24,0xbb, - 0x3b,0x8d,0xc2,0xc1,0x00,0x00,0x01, - 0x00}}, - {{0x83,0x38,0x97,0x58,0x9c,0x24,0xb3, - 0x7c,0x8e,0x03,0x02,0x10,0x00,0x01, - 0x01}}, - {{0x79,0x31,0x9d,0x58,0x9c,0x24,0xf1, - 0xb6,0x88,0x57,0x25,0x10,0x00,0x01, - 0x01}}, - {{0x6b,0x3f,0x8f,0x58,0x9c,0x24,0xf5, - 0x0a,0x8c,0xff,0x25,0x30,0x00,0x01, - 0x01}}, - {{0xab,0x9f,0x8f,0xa8,0x8c,0x24,0xf5, - 0x0a,0x8c,0xff,0x25,0x30,0x00,0x06, - 0x01}}, - {{0xab,0x9f,0x8f,0xa8,0x8c,0x24,0xf5, - 0x0a,0x8c,0xff,0x25,0x30,0x00,0x06, - 0x01}} -}; +#endif /**************************************************************/ /* COMMON --------------------------------------------------- */ @@ -2405,7 +1961,8 @@ USHORT SiS_GetColorDepth(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex) USHORT SiS_GetOffset(SiS_Private *SiS_Pr,USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PSIS_HW_INFO HwInfo); void SiS_LoadDAC(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo, USHORT ModeIdIndex); -void SiS_CalcLCDACRT1Timing(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex); +void SiS_CalcLCDACRT1Timing(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,PSIS_HW_INFO HwInfo); +void SiS_CalcCRRegisters(SiS_Private *SiS_Pr, int depth); #ifdef LINUX_XF86 BOOLEAN SiSSetMode(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo,ScrnInfoPtr pScrn,USHORT ModeNo, BOOLEAN dosetpitch); diff --git a/src/init301.c b/src/init301.c index 5cfc7ba..fd10b83 100644 --- a/src/init301.c +++ b/src/init301.c @@ -6,7 +6,7 @@ * SiS 315/550/650/M650/651/661FX/M661xX/740/741(GX)/M741/330/660/M660/760/M760 * (Universal module for Linux kernel framebuffer and XFree86/X.org 4.x) * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * If distributed as part of the Linux kernel, the following license terms * apply: @@ -974,21 +974,10 @@ 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); -#if 0 - if(HwInfo->jChipType < SIS_661) { - /* NO - YPbPr not set yet ! */ - if(SiS_Pr->SiS_YPbPr & ) { - temp &= (SetCRT2ToHiVision | SwitchCRT2 | SetSimuScanMode); /* 0x83 */ - temp |= SetCRT2ToHiVision; /* 0x80 */ - } - if(SiS_Pr->SiS_YPbPr & ) { - temp &= (SetCRT2ToHiVision | SwitchCRT2 | SetSimuScanMode); /* 0x83 */ - temp |= SetCRT2ToSVIDEO; /* 0x08 */ - } - } -#endif tempbx |= temp; tempax = SiS_GetReg(SiS_Pr->SiS_P3d4,0x31) << 8; tempax &= (DriverMode | LoadDACFlag | SetNotSimuMode | SetPALTV); @@ -1020,24 +1009,14 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } } - if(SiS_Pr->SiS_VBType & (VB_SIS301LV|VB_SIS302LV|VB_SIS302ELV)) { - tempbx &= ~(SetCRT2ToRAMDAC); - } - - if(HwInfo->jChipType >= SIS_661) { + if(HwInfo->jChipType >= SIS_661) { /* New CR layout */ tempbx &= ~(SetCRT2ToYPbPr525750 | SetCRT2ToHiVision); - temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x38); - if(SiS_Pr->SiS_VBType & VB_SISYPBPR) { - if(temp & 0x04) { - temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35) & 0xe0; - if(temp == 0x60) tempbx |= SetCRT2ToHiVision; - else tempbx |= SetCRT2ToYPbPr525750; - } - } else if(SiS_Pr->SiS_VBType & VB_SISHIVISION) { - if(temp & 0x04) { - temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35) & 0xe0; - if(temp == 0x60) tempbx |= SetCRT2ToHiVision; - } + if(SiS_GetReg(SiS_Pr->SiS_P3d4,0x38) & 0x04) { + temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x35) & 0xe0; + if(temp == 0x60) tempbx |= SetCRT2ToHiVision; + else if(SiS_Pr->SiS_VBType & VB_SISYPBPR) { + tempbx |= SetCRT2ToYPbPr525750; + } } } @@ -1056,6 +1035,10 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, #endif /* SIS315H */ + if(SiS_Pr->SiS_VBType & (VB_SIS301LV|VB_SIS302LV|VB_SIS302ELV)) { + tempbx &= ~(SetCRT2ToRAMDAC); + } + if(SiS_Pr->SiS_VBType & VB_SISVB) { temp = SetCRT2ToSVIDEO | SetCRT2ToAVIDEO | @@ -1093,6 +1076,7 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } if(SiS_Pr->SiS_VBType & VB_SISVB) { + USHORT clearmask = ( DriverMode | DisableCRT2Display | LoadDACFlag | @@ -1101,13 +1085,16 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, SetPALTV | SwitchCRT2 | SetSimuScanMode ); + if(tempbx & SetCRT2ToLCDA) tempbx &= (clearmask | SetCRT2ToLCDA); if(tempbx & SetCRT2ToRAMDAC) tempbx &= (clearmask | SetCRT2ToRAMDAC); if(tempbx & SetCRT2ToLCD) tempbx &= (clearmask | SetCRT2ToLCD); if(tempbx & SetCRT2ToSCART) tempbx &= (clearmask | SetCRT2ToSCART); if(tempbx & SetCRT2ToHiVision) tempbx &= (clearmask | SetCRT2ToHiVision); if(tempbx & SetCRT2ToYPbPr525750) tempbx &= (clearmask | SetCRT2ToYPbPr525750); + } else { + if(HwInfo->jChipType >= SIS_315H) { if(tempbx & SetCRT2ToLCDA) { tempbx &= (0xFF00|SwitchCRT2|SetSimuScanMode); @@ -1126,6 +1113,7 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, tempbx |= SetCRT2ToLCD; } } + } if(tempax & DisableCRT2Display) { @@ -1147,14 +1135,9 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, if(!(tempbx & SetSimuScanMode)) { if(tempbx & SwitchCRT2) { if((!(modeflag & CRT2Mode)) && (checkcrt2mode)) { - if( (HwInfo->jChipType >= SIS_315H) && - (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) ) { - if(resinfo != SIS_RI_1600x1200) { - tempbx |= SetSimuScanMode; - } - } else { - tempbx |= SetSimuScanMode; - } + if(resinfo != SIS_RI_1600x1200) { + tempbx |= SetSimuScanMode; + } } } else { if(SiS_BridgeIsEnabled(SiS_Pr,HwInfo)) { @@ -1171,14 +1154,9 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, if(tempbx & DriverMode) { if(tempbx & SetSimuScanMode) { if((!(modeflag & CRT2Mode)) && (checkcrt2mode)) { - if( (HwInfo->jChipType >= SIS_315H) && - (SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) ) { - if(resinfo != SIS_RI_1600x1200) { - tempbx |= SetInSlaveMode; - } - } else { - tempbx |= SetInSlaveMode; - } + if(resinfo != SIS_RI_1600x1200) { + tempbx |= SetInSlaveMode; + } } } } else { @@ -1196,11 +1174,11 @@ SiS_GetVBInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, #ifdef TWDEBUG #ifdef LINUX_KERNEL - printk(KERN_DEBUG "sisfb: (VBInfo= 0x%04x, SetFlag=0x%04x)\n", + printk(KERN_DEBUG "sisfb: (init301: VBInfo= 0x%04x, SetFlag=0x%04x)\n", SiS_Pr->SiS_VBInfo, SiS_Pr->SiS_SetFlag); #endif #ifdef LINUX_XF86 - xf86DrvMsgVerb(0, X_PROBED, 3, "(init301: VBInfo=0x%04x, SetFlag=0x%04x)\n", + xf86DrvMsg(0, X_PROBED, "(init301: VBInfo=0x%04x, SetFlag=0x%04x)\n", SiS_Pr->SiS_VBInfo, SiS_Pr->SiS_SetFlag); #endif #endif @@ -1555,6 +1533,9 @@ 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; if(!(SiS_Pr->SiS_VBInfo & (SetCRT2ToLCD | SetCRT2ToLCDA))) return; @@ -1612,6 +1593,7 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, SiS_Pr->SiS_LCDResInfo = temp; +#ifdef SIS300 if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { if(SiS_Pr->SiS_CustomT == CUT_BARCO1366) { SiS_Pr->SiS_LCDResInfo = Panel_Barco1366; @@ -1619,6 +1601,7 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, SiS_Pr->SiS_LCDResInfo = Panel_848x480; } } +#endif if(SiS_Pr->SiS_VBType & VB_SISVB) { if(SiS_Pr->SiS_LCDResInfo < SiS_Pr->SiS_PanelMin301) @@ -1724,14 +1707,14 @@ 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->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; + 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; @@ -1747,7 +1730,7 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, break; case Panel_1152x768: SiS_Pr->PanelXRes = 1152; SiS_Pr->PanelYRes = 768; SiS_Pr->PanelHT = 1344; SiS_Pr->PanelVT = 806; - SiS_Pr->PanelHRS = 24; + SiS_Pr->PanelHRS = 24; SiS_Pr->PanelHRE = 136; SiS_Pr->PanelVRS = 3; SiS_Pr->PanelVRE = 6; if(HwInfo->jChipType < SIS_315H) { SiS_Pr->PanelHRS = 23; @@ -1819,7 +1802,7 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, break; case Panel_1400x1050: SiS_Pr->PanelXRes = 1400; SiS_Pr->PanelYRes = 1050; SiS_Pr->PanelHT = 1688; SiS_Pr->PanelVT = 1066; - SiS_Pr->PanelHRS = 48; SiS_Pr->PanelHRE = 112; /* HRE OK for LVDS, not for LCDA */ + SiS_Pr->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); @@ -1829,6 +1812,19 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, 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->PanelHRS = 48; SiS_Pr->PanelHRE = 32; + SiS_Pr->PanelVRS = 2; SiS_Pr->PanelVRE = 4; + SiS_Pr->PanelVCLKIdx315 = VCLK130_315; + SiS_Pr->Alternate1600x1200 = TRUE; + } + } else if(SiS_Pr->SiS_IF_DEF_LVDS) { + SiS_Pr->PanelHT = 2048; SiS_Pr->PanelVT = 1320; + SiS_Pr->PanelHRS = SiS_Pr->PanelHRE = 999; + SiS_Pr->PanelVRS = SiS_Pr->PanelVRE = 999; + } SiS_GetLCDInfoBIOS(SiS_Pr, HwInfo); break; case Panel_1680x1050: SiS_Pr->PanelXRes = 1680; SiS_Pr->PanelYRes = 1050; @@ -2043,13 +2039,13 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } } +#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) */ } } -#ifdef SIS300 if(HwInfo->jChipType < SIS_315H) { if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { if(SiS_Pr->SiS_UseROM) { @@ -2096,7 +2092,7 @@ SiS_GetLCDResInfo(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, break; } - if(SiS_Pr->UseCustomMode) { + if((SiS_Pr->UseCustomMode) || (SiS_Pr->SiS_CustomT == CUT_UNKNOWNLCD)) { SiS_Pr->SiS_LCDInfo |= (DontExpandLCD | LCDPass11); } @@ -2238,16 +2234,13 @@ SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, } 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) { - if(modeflag & Charx8Dot) VCLKIndex = HiTVSimuVCLK; - else VCLKIndex = HiTVTextVCLK; - } - } 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; + 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; if(HwInfo->jChipType < SIS_315H) VCLKIndex += TVCLKBASE_300; else VCLKIndex += TVCLKBASE_315; @@ -2326,6 +2319,7 @@ SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, VCLKIndex = SiS_Pr->PanelVCLKIdx315; } +#ifdef SIS300 /* Special Timing: Barco iQ Pro R series */ if(SiS_Pr->SiS_CustomT == CUT_BARCO1366) VCLKIndex = 0x44; @@ -2339,6 +2333,7 @@ SiS_GetVCLK2Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, /* if(resinfo == SIS_RI_1360x768) VCLKIndex = ?; */ } } +#endif } else { @@ -2853,92 +2848,6 @@ SiS_GetCRT2ResInfo(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, /* GET CRT2 TIMING DATA */ /*********************************************/ -static BOOLEAN -SiS_GetLVDSCRT1Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, USHORT *ResIndex, - USHORT *DisplayType) - { - USHORT modeflag=0; - - if(SiS_Pr->SiS_IF_DEF_LVDS == 1) { - if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { - if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) return FALSE; - } - } else if(SiS_Pr->SiS_VBType & VB_SISVB) { - if(!(SiS_Pr->SiS_VBInfo & SetInSlaveMode)) return FALSE; - } else - return FALSE; - - if(ModeNo <= 0x13) { - modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - (*ResIndex) = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; - } else { - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - (*ResIndex) = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; - } - - (*ResIndex) &= 0x3F; - - if((SiS_Pr->SiS_IF_DEF_CH70xx) && (SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) { - (*DisplayType) = 18; - if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) (*DisplayType)++; - if(SiS_Pr->SiS_TVMode & TVSetPAL) { - (*DisplayType) += 2; - if(SiS_Pr->SiS_ModeType > ModeVGA) { - if(SiS_Pr->SiS_CHSOverScan) (*DisplayType) = 99; - } - if(SiS_Pr->SiS_TVMode & TVSetPALM) { - (*DisplayType) = 18; /* PALM uses NTSC data */ - if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) (*DisplayType)++; - } else if(SiS_Pr->SiS_TVMode & TVSetPALN) { - (*DisplayType) = 20; /* PALN uses PAL data */ - if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) (*DisplayType)++; - } - } - } else { - switch(SiS_Pr->SiS_LCDResInfo) { - case Panel_640x480: (*DisplayType) = 50; break; - case Panel_640x480_2: (*DisplayType) = 52; break; - case Panel_640x480_3: (*DisplayType) = 54; break; - case Panel_800x600: (*DisplayType) = 0; break; - case Panel_1024x600: (*DisplayType) = 23; break; - case Panel_1024x768: (*DisplayType) = 4; break; - case Panel_1152x768: (*DisplayType) = 27; break; - case Panel_1280x768: (*DisplayType) = 40; break; - case Panel_1280x1024: (*DisplayType) = 8; break; - case Panel_1400x1050: (*DisplayType) = 14; break; - case Panel_1600x1200: (*DisplayType) = 36; break; - default: return FALSE; - } - - if(modeflag & HalfDCLK) (*DisplayType)++; - - switch(SiS_Pr->SiS_LCDResInfo) { - case Panel_640x480: - case Panel_640x480_2: - case Panel_640x480_3: - break; - default: - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) (*DisplayType) += 2; - } - - if(SiS_Pr->SiS_LCDInfo & LCDPass11) { - (*DisplayType) = 12; - if(modeflag & HalfDCLK) (*DisplayType)++; - } - } - -#if 0 - if(SiS_Pr->SiS_IF_DEF_FSTN) { - if(SiS_Pr->SiS_LCDResInfo == SiS_Pr->SiS_Panel320x480){ - (*DisplayType) = 22; - } - } -#endif - - return TRUE; -} - static void SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, USHORT RefreshRateTableIndex,USHORT *CRT2Index,USHORT *ResIndex, @@ -3047,37 +2956,36 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, tempbx = 0; if((SiS_Pr->SiS_IF_DEF_CH70xx) && (SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) { - tempbx = 10; - if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) tempbx += 1; + tempbx = 90; if(SiS_Pr->SiS_TVMode & TVSetPAL) { - tempbx += 2; + tempbx = 92; if(SiS_Pr->SiS_ModeType > ModeVGA) { if(SiS_Pr->SiS_CHSOverScan) tempbx = 99; } - if(SiS_Pr->SiS_TVMode & TVSetPALM) { - tempbx = 90; - if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) tempbx += 1; - } else if(SiS_Pr->SiS_TVMode & TVSetPALN) { - tempbx = 92; - if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) tempbx += 1; - } + if(SiS_Pr->SiS_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) { - case Panel_640x480: tempbx = 6; break; + case Panel_640x480: tempbx = 12; break; case Panel_640x480_2: - case Panel_640x480_3: tempbx = 30; break; - case Panel_800x600: tempbx = 0; break; - case Panel_1024x600: tempbx = 15; break; - case Panel_1024x768: tempbx = 2; break; - case Panel_1152x768: tempbx = 17; break; - case Panel_1280x768: tempbx = 18; break; - case Panel_1280x1024: tempbx = 4; break; - case Panel_1400x1050: tempbx = 8; break; - case Panel_1600x1200: tempbx = 21; break; + case Panel_640x480_3: tempbx = 14; break; + case Panel_800x600: tempbx = 16; break; + case Panel_1024x600: tempbx = 18; break; + case Panel_1152x768: + case Panel_1024x768: tempbx = 20; break; + case Panel_1280x768: tempbx = 22; break; + case Panel_1280x1024: tempbx = 24; break; + case Panel_1400x1050: tempbx = 26; break; + case Panel_1600x1200: tempbx = 28; break; +#ifdef SIS300 case Panel_Barco1366: tempbx = 80; break; +#endif } switch(SiS_Pr->SiS_LCDResInfo) { @@ -3089,8 +2997,9 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++; } - if(SiS_Pr->SiS_LCDInfo & LCDPass11) tempbx = 7; + if(SiS_Pr->SiS_LCDInfo & LCDPass11) tempbx = 30; +#ifdef SIS300 if(SiS_Pr->SiS_CustomT == CUT_BARCO1024) { tempbx = 82; if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++; @@ -3098,14 +3007,7 @@ SiS_GetCRT2Ptr(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, tempbx = 84; if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) tempbx++; } - - if((SiS_Pr->SiS_CustomT != CUT_BARCO1366) && - (SiS_Pr->SiS_CustomT != CUT_PANEL848)) { - if((SiS_Pr->SiS_LCDInfo & DontExpandLCD) && - (!(SiS_Pr->SiS_LCDInfo & LCDPass11))) { - tempal = 0; - } - } +#endif } @@ -3120,7 +3022,7 @@ SiS_GetRAMDAC2DATA(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, { USHORT tempax=0,tempbx=0; USHORT temp1=0,modeflag=0,tempcx=0; - USHORT index; + USHORT index,dotclock; SiS_Pr->SiS_RVBHCMAX = 1; SiS_Pr->SiS_RVBHCFACT = 1; @@ -3133,6 +3035,8 @@ 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 { @@ -3148,6 +3052,8 @@ SiS_GetRAMDAC2DATA(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, tempcx <<= 2; tempbx |= tempcx; temp1 = SiS_Pr->SiS_CRT1Table[index].CR[7]; + + dotclock = 8; } @@ -3155,16 +3061,8 @@ SiS_GetRAMDAC2DATA(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, if(temp1 & 0x20) tempbx |= 0x0200; tempax += 5; - - /* Charx8Dot is no more used (and assumed), so we set it */ - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { - modeflag |= Charx8Dot; - } - - if(modeflag & Charx8Dot) tempax *= 8; - else tempax *= 9; - - if(modeflag & HalfDCLK) tempax <<= 1; + tempax *= dotclock; + if(modeflag & HalfDCLK) tempax <<= 1; tempbx++; @@ -3172,11 +3070,54 @@ SiS_GetRAMDAC2DATA(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, SiS_Pr->SiS_VGAVT = SiS_Pr->SiS_VT = tempbx; } +static void +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) { + ResIndex = SiS_Pr->CHTotal; + if(SiS_Pr->CModeFlag & HalfDCLK) ResIndex <<= 1; + SiS_Pr->SiS_VGAHT = SiS_Pr->SiS_HT = ResIndex; + SiS_Pr->SiS_VGAVT = SiS_Pr->SiS_VT = SiS_Pr->CVTotal; + } else { + if(ModeNo < 0x13) { + ResIndex = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + } else { + ResIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC_NS; + } + if(ResIndex == 0x09) { + if(SiS_Pr->Alternate1600x1200) ResIndex = 0x20; /* 1600x1200 LCDA */ + else if(SiS_Pr->SiS_IF_DEF_LVDS == 1) ResIndex = 0x21; /* 1600x1200 LVDS */ + } + SiS_Pr->SiS_VGAHT = SiS_Pr->SiS_NoScaleData[ResIndex].VGAHT; + SiS_Pr->SiS_VGAVT = SiS_Pr->SiS_NoScaleData[ResIndex].VGAVT; + SiS_Pr->SiS_HT = SiS_Pr->SiS_NoScaleData[ResIndex].LCDHT; + SiS_Pr->SiS_VT = SiS_Pr->SiS_NoScaleData[ResIndex].LCDVT; + } + } else { + SiS_Pr->SiS_VGAHT = SiS_Pr->SiS_HT = SiS_Pr->PanelHT; + SiS_Pr->SiS_VGAVT = SiS_Pr->SiS_VT = SiS_Pr->PanelVT; + } + } else { + /* This handles custom modes and custom panels */ + SiS_Pr->SiS_HDE = SiS_Pr->PanelXRes; + SiS_Pr->SiS_VDE = SiS_Pr->PanelYRes; + SiS_Pr->SiS_HT = SiS_Pr->PanelHT; + SiS_Pr->SiS_VT = SiS_Pr->PanelVT; + SiS_Pr->SiS_VGAHT = SiS_Pr->PanelHT - (SiS_Pr->PanelXRes - SiS_Pr->SiS_VGAHDE); + SiS_Pr->SiS_VGAVT = SiS_Pr->PanelVT - (SiS_Pr->PanelYRes - SiS_Pr->SiS_VGAVDE); + } +} + static void SiS_GetCRT2DataLVDS(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PSIS_HW_INFO HwInfo) { - USHORT CRT2Index, ResIndex; + USHORT CRT2Index, ResIndex, backup; const SiS_LVDSDataStruct *LVDSData = NULL; SiS_GetCRT2ResInfo(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); @@ -3190,118 +3131,78 @@ SiS_GetCRT2DataLVDS(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, SiS_Pr->SiS_RY2COE = 0; SiS_Pr->SiS_RY3COE = 0; SiS_Pr->SiS_RY4COE = 0; + SiS_Pr->SiS_RVBHRS2 = 0; } if((SiS_Pr->SiS_VBType & VB_SISVB) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { #ifdef SIS315H - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { - if(SiS_Pr->SiS_LCDInfo & LCDPass11) { - if(SiS_Pr->UseCustomMode) { - ResIndex = SiS_Pr->CHTotal; - if(SiS_Pr->CModeFlag & HalfDCLK) ResIndex <<= 1; - SiS_Pr->SiS_VGAHT = SiS_Pr->SiS_HT = ResIndex; - SiS_Pr->SiS_VGAVT = SiS_Pr->SiS_VT = SiS_Pr->CVTotal; - } else { - if(ModeNo < 0x13) { - ResIndex = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; - } else { - ResIndex = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC_NS; - } - SiS_Pr->SiS_VGAHT = SiS_Pr->SiS_NoScaleData[ResIndex].VGAHT; - SiS_Pr->SiS_VGAVT = SiS_Pr->SiS_NoScaleData[ResIndex].VGAVT; - SiS_Pr->SiS_HT = SiS_Pr->SiS_NoScaleData[ResIndex].LCDHT; - SiS_Pr->SiS_VT = SiS_Pr->SiS_NoScaleData[ResIndex].LCDVT; - } - } else { - SiS_Pr->SiS_VGAHT = SiS_Pr->SiS_HT = SiS_Pr->PanelHT; - SiS_Pr->SiS_VGAVT = SiS_Pr->SiS_VT = SiS_Pr->PanelVT; - } - } else { - /* This handles custom modes and custom panels */ - SiS_Pr->SiS_HDE = SiS_Pr->PanelXRes; - SiS_Pr->SiS_VDE = SiS_Pr->PanelYRes; - SiS_Pr->SiS_HT = SiS_Pr->PanelHT; - SiS_Pr->SiS_VT = SiS_Pr->PanelVT; - SiS_Pr->SiS_VGAHT = SiS_Pr->PanelHT - (SiS_Pr->PanelXRes - SiS_Pr->SiS_VGAHDE); - SiS_Pr->SiS_VGAVT = SiS_Pr->PanelVT - (SiS_Pr->PanelYRes - SiS_Pr->SiS_VGAVDE); - } - - SiS_CalcLCDACRT1Timing(SiS_Pr,ModeNo,ModeIdIndex); - + SiS_CalcPanelLinkTiming(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex); + SiS_CalcLCDACRT1Timing(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); #endif } else { /* 301BDH needs LVDS Data */ + backup = SiS_Pr->SiS_IF_DEF_LVDS; if((SiS_Pr->SiS_VBType & VB_NoLCD) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) { SiS_Pr->SiS_IF_DEF_LVDS = 1; } SiS_GetCRT2Ptr(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, - &CRT2Index, &ResIndex, HwInfo); + &CRT2Index, &ResIndex, HwInfo); + + SiS_Pr->SiS_IF_DEF_LVDS = backup; - /* 301BDH needs LVDS Data */ - if((SiS_Pr->SiS_VBType & VB_NoLCD) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD)) { - SiS_Pr->SiS_IF_DEF_LVDS = 0; - } - - switch (CRT2Index) { - case 0: LVDSData = SiS_Pr->SiS_LVDS800x600Data_1; break; - case 1: LVDSData = SiS_Pr->SiS_LVDS800x600Data_2; break; - case 2: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_1; break; - case 3: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_2; break; - case 4: LVDSData = SiS_Pr->SiS_LVDS1280x1024Data_1; break; - case 5: LVDSData = SiS_Pr->SiS_LVDS1280x1024Data_2; break; - case 6: LVDSData = SiS_Pr->SiS_LVDS640x480Data_1; break; - case 7: LVDSData = SiS_Pr->SiS_LVDSXXXxXXXData_1; break; - case 8: LVDSData = SiS_Pr->SiS_LVDS1400x1050Data_1; break; - case 9: LVDSData = SiS_Pr->SiS_LVDS1400x1050Data_2; break; - case 10: LVDSData = SiS_Pr->SiS_CHTVUNTSCData; break; - case 11: LVDSData = SiS_Pr->SiS_CHTVONTSCData; break; - case 12: LVDSData = SiS_Pr->SiS_CHTVUPALData; break; - case 13: LVDSData = SiS_Pr->SiS_CHTVOPALData; break; - case 14: LVDSData = SiS_Pr->SiS_LVDS320x480Data_1; break; - case 15: LVDSData = SiS_Pr->SiS_LVDS1024x600Data_1; break; - case 16: LVDSData = SiS_Pr->SiS_LVDS1024x600Data_2; break; - case 17: LVDSData = SiS_Pr->SiS_LVDS1152x768Data_1; break; - case 18: LVDSData = SiS_Pr->SiS_LVDS1152x768Data_2; break; - case 19: LVDSData = SiS_Pr->SiS_LVDS1280x768Data_1; break; - case 20: LVDSData = SiS_Pr->SiS_LVDS1280x768Data_2; break; - case 21: LVDSData = SiS_Pr->SiS_LVDS1600x1200Data_1; break; - case 22: LVDSData = SiS_Pr->SiS_LVDS1600x1200Data_2; break; - case 30: LVDSData = SiS_Pr->SiS_LVDS640x480Data_2; break; - case 80: LVDSData = SiS_Pr->SiS_LVDSBARCO1366Data_1; break; + switch(CRT2Index) { + case 10: LVDSData = SiS_Pr->SiS_LVDS320x480Data_1; 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 81: LVDSData = SiS_Pr->SiS_LVDSBARCO1366Data_2; break; case 82: LVDSData = SiS_Pr->SiS_LVDSBARCO1024Data_1; break; - case 83: LVDSData = SiS_Pr->SiS_LVDSBARCO1024Data_2; break; case 84: LVDSData = SiS_Pr->SiS_LVDS848x480Data_1; break; case 85: LVDSData = SiS_Pr->SiS_LVDS848x480Data_2; break; - case 90: LVDSData = SiS_Pr->SiS_CHTVUPALMData; break; - case 91: LVDSData = SiS_Pr->SiS_CHTVOPALMData; break; - case 92: LVDSData = SiS_Pr->SiS_CHTVUPALNData; break; - case 93: LVDSData = SiS_Pr->SiS_CHTVOPALNData; break; - case 99: LVDSData = SiS_Pr->SiS_CHTVSOPALData; break; /* Super Overscan */ - default: LVDSData = SiS_Pr->SiS_LVDS1024x768Data_1; break; +#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 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 99: LVDSData = SiS_Pr->SiS_CHTVSOPALData; break; } - SiS_Pr->SiS_VGAHT = (LVDSData+ResIndex)->VGAHT; - SiS_Pr->SiS_VGAVT = (LVDSData+ResIndex)->VGAVT; - SiS_Pr->SiS_HT = (LVDSData+ResIndex)->LCDHT; - SiS_Pr->SiS_VT = (LVDSData+ResIndex)->LCDVT; + if(LVDSData) { + SiS_Pr->SiS_VGAHT = (LVDSData+ResIndex)->VGAHT; + SiS_Pr->SiS_VGAVT = (LVDSData+ResIndex)->VGAVT; + SiS_Pr->SiS_HT = (LVDSData+ResIndex)->LCDHT; + SiS_Pr->SiS_VT = (LVDSData+ResIndex)->LCDVT; + } else { + SiS_CalcPanelLinkTiming(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex); + } - if(!(SiS_Pr->SiS_VBType & VB_SISVB)) { - if((SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) && (!(SiS_Pr->SiS_LCDInfo & LCDPass11))) { - if((!(SiS_Pr->SiS_LCDInfo & DontExpandLCD)) || (SiS_Pr->SiS_SetFlag & SetDOSMode)) { - SiS_Pr->SiS_HDE = SiS_Pr->PanelXRes; - SiS_Pr->SiS_VDE = SiS_Pr->PanelYRes; - if(SiS_Pr->SiS_CustomT == CUT_BARCO1366) { - if(ResIndex < 0x08) { - SiS_Pr->SiS_HDE = 1280; - SiS_Pr->SiS_VDE = 1024; - } + if( (!(SiS_Pr->SiS_VBType & VB_SISVB)) && + (SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) && + (!(SiS_Pr->SiS_LCDInfo & LCDPass11)) ) { + 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 + if(SiS_Pr->SiS_CustomT == CUT_BARCO1366) { + if(ResIndex < 0x08) { + SiS_Pr->SiS_HDE = 1280; + SiS_Pr->SiS_VDE = 1024; } } +#endif } } } @@ -3352,6 +3253,7 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, SiS_Pr->SiS_RY2COE = 0; SiS_Pr->SiS_RY3COE = 0; SiS_Pr->SiS_RY4COE = 0; + SiS_Pr->SiS_RVBHRS2 = 0; SiS_GetCRT2ResInfo(SiS_Pr,ModeNo,ModeIdIndex,HwInfo); @@ -3403,11 +3305,20 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, SiS_Pr->SiS_VGAVT = (TVPtr+ResIndex)->VGAVT; SiS_Pr->SiS_HDE = (TVPtr+ResIndex)->TVHDE; SiS_Pr->SiS_VDE = (TVPtr+ResIndex)->TVVDE; - SiS_Pr->SiS_RVBHRS = (TVPtr+ResIndex)->RVBHRS; - SiS_Pr->SiS_NewFlickerMode = (TVPtr+ResIndex)->FlickerMode; + SiS_Pr->SiS_RVBHRS2 = (TVPtr+ResIndex)->RVBHRS2 & 0x0fff; if(modeflag & HalfDCLK) { 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; + if((TVPtr+ResIndex)->RVBHRS2 & 0x8000) SiS_Pr->SiS_RVBHRS2 -= tempax; + else SiS_Pr->SiS_RVBHRS2 += tempax; + } + } else { + SiS_Pr->SiS_RVBHRS = (TVPtr+ResIndex)->RVBHRS; } + SiS_Pr->SiS_NewFlickerMode = ((TVPtr+ResIndex)->FlickerMode) << 7; + if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) { @@ -3425,12 +3336,6 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) { SiS_Pr->SiS_HT = StHiTVHT; SiS_Pr->SiS_VT = StHiTVVT; -#if 0 - if(!(modeflag & Charx8Dot)) { - SiS_Pr->SiS_HT = StHiTextTVHT; - SiS_Pr->SiS_VT = StHiTextTVVT; - } -#endif } } @@ -3506,17 +3411,27 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, SiS_Pr->SiS_RVBHCMAX = ROMAddr[romptr]; SiS_Pr->SiS_RVBHCFACT = ROMAddr[romptr+1]; SiS_Pr->SiS_VGAHT = ROMAddr[romptr+2] | ((ROMAddr[romptr+3] & 0x0f) << 8); - SiS_Pr->SiS_VGAVT = ROMAddr[romptr+4] | ((ROMAddr[romptr+3] & 0xf0) << 4); + SiS_Pr->SiS_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] | ((ROMAddr[romptr+6] & 0xf0) << 4); + 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; + tempax = (ROMAddr[romptr+9] >> 4) & 0x07; + if(ROMAddr[romptr+9] & 0x80) SiS_Pr->SiS_RVBHRS2 -= tempax; + else SiS_Pr->SiS_RVBHRS2 += tempax; + } if(SiS_Pr->SiS_VGAHT) gotit = TRUE; else { SiS_Pr->SiS_LCDInfo |= DontExpandLCD; SiS_Pr->SiS_LCDInfo &= ~LCDPass11; + SiS_Pr->SiS_RVBHCMAX = 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_RVBHRS2 = 0; gotit = TRUE; } #endif @@ -3573,7 +3488,8 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, tempax = SiS_Pr->PanelXRes; tempbx = SiS_Pr->PanelYRes; - if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { + 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; @@ -3587,19 +3503,23 @@ SiS_GetCRT2Data301(SiS_Private *SiS_Pr,USHORT ModeNo,USHORT ModeIdIndex, else if(SiS_Pr->SiS_VGAVDE == 350) tempbx = 560; else if(SiS_Pr->SiS_VGAVDE == 400) tempbx = 640; } - } else if(SiS_Pr->SiS_LCDResInfo == Panel_1280x960) { + 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; - } else if(SiS_Pr->SiS_LCDResInfo == Panel_1280x1024) { + 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; - } else if(SiS_Pr->SiS_LCDResInfo == Panel_1600x1200) { + break; + 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; } + break; } if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { @@ -3642,67 +3562,41 @@ SiS_GetCRT2Data(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, /* GET LVDS DES (SKEW) DATA */ /*********************************************/ -static void -SiS_GetLVDSDesPtr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, - USHORT RefreshRateTableIndex, USHORT *PanelIndex, - USHORT *ResIndex, PSIS_HW_INFO HwInfo) +static const SiS_LVDSDesStruct * +SiS_GetLVDSDesPtr(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo) { - USHORT modeflag; - - if(ModeNo <= 0x13) { - modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - (*ResIndex) = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; - } else { - modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - (*ResIndex) = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; - } - - (*ResIndex) &= 0x1F; - (*PanelIndex) = 0; - - if(SiS_Pr->SiS_IF_DEF_CH70xx != 0) { - if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { - (*PanelIndex) = 50; - if((SiS_Pr->SiS_TVMode & TVSetPAL) && (!(SiS_Pr->SiS_TVMode & TVSetPALM))) (*PanelIndex) += 2; - if(SiS_Pr->SiS_TVMode & TVSetCHOverScan) (*PanelIndex) += 1; - /* Nothing special needed for SOverscan */ - /* PALM uses NTSC data, PALN uses PAL data */ - } - } + const SiS_LVDSDesStruct *PanelDesPtr = NULL; +#ifdef SIS300 if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - *PanelIndex = SiS_Pr->SiS_LCDTypeInfo; - if(HwInfo->jChipType >= SIS_661) { - /* As long as we don's use the BIOS tables, we - * need to convert the TypeInfo as for 315 series - */ - (*PanelIndex) = SiS_Pr->SiS_LCDResInfo - 1; - } - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { - (*PanelIndex) += 16; - if(SiS_Pr->SiS_LCDInfo & LCDPass11) { - (*PanelIndex) = 32; - if(modeflag & HalfDCLK) (*PanelIndex)++; + + if(HwInfo->jChipType < SIS_315H) { + + if(SiS_Pr->SiS_LCDTypeInfo == 4) { + if(SiS_Pr->SiS_CustomT == CUT_BARCO1366) { + PanelDesPtr = SiS_Pr->SiS_PanelType04_1a; + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + PanelDesPtr = SiS_Pr->SiS_PanelType04_2a; + } + } else if(SiS_Pr->SiS_CustomT == CUT_BARCO1024) { + PanelDesPtr = SiS_Pr->SiS_PanelType04_1b; + if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) { + PanelDesPtr = SiS_Pr->SiS_PanelType04_2b; + } + } } + } } - - if(SiS_Pr->SiS_SetFlag & SetDOSMode) { - if(SiS_Pr->SiS_LCDResInfo != Panel_640x480) { - (*ResIndex) = 7; - if(HwInfo->jChipType < SIS_315H) { - if(SiS_GetReg(SiS_Pr->SiS_P3c4,0x13) & 0x80) (*ResIndex)++; - } - } - } +#endif + return PanelDesPtr; } static void SiS_GetLVDSDesData(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PSIS_HW_INFO HwInfo) { - USHORT modeflag; - USHORT PanelIndex,ResIndex; + USHORT modeflag, ResIndex; const SiS_LVDSDesStruct *PanelDesPtr = NULL; SiS_Pr->SiS_LCDHDES = 0; @@ -3711,11 +3605,12 @@ SiS_GetLVDSDesData(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex, if( (SiS_Pr->UseCustomMode) || (SiS_Pr->SiS_LCDResInfo == Panel_Custom) || (SiS_Pr->SiS_CustomT == CUT_PANEL848) || - ((SiS_Pr->SiS_VBType & VB_SISVB) && - (SiS_Pr->SiS_LCDInfo & DontExpandLCD) && - (SiS_Pr->SiS_LCDInfo & LCDPass11)) ) { + (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; if((SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { @@ -3748,55 +3643,107 @@ SiS_GetLVDSDesData(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex, #endif } else { + + if((SiS_Pr->SiS_IF_DEF_CH70xx != 0) && (SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) { - SiS_GetLVDSDesPtr(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, - &PanelIndex, &ResIndex, HwInfo); - - switch(PanelIndex) { - case 0: PanelDesPtr = SiS_Pr->SiS_PanelType00_1; break; /* --- */ - case 1: PanelDesPtr = SiS_Pr->SiS_PanelType01_1; break; - case 2: PanelDesPtr = SiS_Pr->SiS_PanelType02_1; break; - case 3: PanelDesPtr = SiS_Pr->SiS_PanelType03_1; break; - case 4: PanelDesPtr = SiS_Pr->SiS_PanelType04_1; break; - case 5: PanelDesPtr = SiS_Pr->SiS_PanelType05_1; break; - case 6: PanelDesPtr = SiS_Pr->SiS_PanelType06_1; break; - case 7: PanelDesPtr = SiS_Pr->SiS_PanelType07_1; break; - case 8: PanelDesPtr = SiS_Pr->SiS_PanelType08_1; break; - case 9: PanelDesPtr = SiS_Pr->SiS_PanelType09_1; break; - case 10: PanelDesPtr = SiS_Pr->SiS_PanelType0a_1; break; - case 11: PanelDesPtr = SiS_Pr->SiS_PanelType0b_1; break; - case 12: PanelDesPtr = SiS_Pr->SiS_PanelType0c_1; break; - case 13: PanelDesPtr = SiS_Pr->SiS_PanelType0d_1; break; - case 14: PanelDesPtr = SiS_Pr->SiS_PanelType0e_1; break; - case 15: PanelDesPtr = SiS_Pr->SiS_PanelType0f_1; break; - case 16: PanelDesPtr = SiS_Pr->SiS_PanelType00_2; break; /* --- */ - case 17: PanelDesPtr = SiS_Pr->SiS_PanelType01_2; break; - case 18: PanelDesPtr = SiS_Pr->SiS_PanelType02_2; break; - case 19: PanelDesPtr = SiS_Pr->SiS_PanelType03_2; break; - case 20: PanelDesPtr = SiS_Pr->SiS_PanelType04_2; break; - case 21: PanelDesPtr = SiS_Pr->SiS_PanelType05_2; break; - case 22: PanelDesPtr = SiS_Pr->SiS_PanelType06_2; break; - case 23: PanelDesPtr = SiS_Pr->SiS_PanelType07_2; break; - case 24: PanelDesPtr = SiS_Pr->SiS_PanelType08_2; break; - case 25: PanelDesPtr = SiS_Pr->SiS_PanelType09_2; break; - case 26: PanelDesPtr = SiS_Pr->SiS_PanelType0a_2; break; - case 27: PanelDesPtr = SiS_Pr->SiS_PanelType0b_2; break; - case 28: PanelDesPtr = SiS_Pr->SiS_PanelType0c_2; break; - case 29: PanelDesPtr = SiS_Pr->SiS_PanelType0d_2; break; - case 30: PanelDesPtr = SiS_Pr->SiS_PanelType0e_2; break; - case 31: PanelDesPtr = SiS_Pr->SiS_PanelType0f_2; break; - case 32: PanelDesPtr = SiS_Pr->SiS_PanelTypeNS_1; break; /* pass 1:1 */ - case 33: PanelDesPtr = SiS_Pr->SiS_PanelTypeNS_2; break; - case 50: PanelDesPtr = SiS_Pr->SiS_CHTVUNTSCDesData; break; /* TV */ - case 51: PanelDesPtr = SiS_Pr->SiS_CHTVONTSCDesData; break; - case 52: PanelDesPtr = SiS_Pr->SiS_CHTVUPALDesData; break; - case 53: PanelDesPtr = SiS_Pr->SiS_CHTVOPALDesData; break; - default: return; + 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); + } + if(SiS_Pr->SiS_VGAVDE != SiS_Pr->PanelYRes) { + SiS_Pr->SiS_LCDVDES = SiS_Pr->SiS_VT - ((SiS_Pr->PanelYRes - SiS_Pr->SiS_VGAVDE) / 2); + } else { + if(HwInfo->jChipType < SIS_315H) { + SiS_Pr->SiS_LCDVDES = SiS_Pr->PanelVT - 1; + } else { + switch(SiS_Pr->SiS_LCDResInfo) { + case Panel_800x600: + case Panel_1024x768: + case Panel_1280x1024: + SiS_Pr->SiS_LCDVDES = SiS_Pr->PanelVT; + break; + case Panel_1400x1050: + SiS_Pr->SiS_LCDVDES = SiS_Pr->PanelVT - 1; + break; + } + } + } + + } else { + + if(HwInfo->jChipType < SIS_315H) { +#ifdef SIS300 + switch(SiS_Pr->SiS_LCDResInfo) { + case Panel_800x600: + if(SiS_Pr->SiS_VGAVDE == SiS_Pr->PanelYRes) { + SiS_Pr->SiS_LCDVDES = SiS_Pr->PanelVT - 1; + } else { + SiS_Pr->SiS_LCDHDES = SiS_Pr->PanelHT + 3; + SiS_Pr->SiS_LCDVDES = SiS_Pr->PanelVT; + if(SiS_Pr->SiS_VGAVDE == 400) SiS_Pr->SiS_LCDVDES -= 2; + else SiS_Pr->SiS_LCDVDES -= 4; + } + break; + case Panel_1024x768: + if(SiS_Pr->SiS_VGAVDE == SiS_Pr->PanelYRes) { + SiS_Pr->SiS_LCDVDES = SiS_Pr->PanelVT - 1; + } else { + SiS_Pr->SiS_LCDHDES = SiS_Pr->PanelHT - 1; + if(SiS_Pr->SiS_VGAVDE <= 400) SiS_Pr->SiS_LCDVDES = SiS_Pr->PanelVT - 8; + if(SiS_Pr->SiS_VGAVDE <= 350) SiS_Pr->SiS_LCDVDES = SiS_Pr->PanelVT - 12; + } + break; + case Panel_1024x600: + default: + 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; + break; + case 3: + SiS_Pr->SiS_LCDHDES = 8; + if (SiS_Pr->SiS_VGAVDE >= 480) SiS_Pr->SiS_LCDVDES = 512; + else if(SiS_Pr->SiS_VGAVDE >= 400) SiS_Pr->SiS_LCDVDES = 436; + else if(SiS_Pr->SiS_VGAVDE >= 350) SiS_Pr->SiS_LCDVDES = 440; + break; + } +#endif + } else { +#ifdef SIS315H + switch(SiS_Pr->SiS_LCDResInfo) { + 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: + SiS_Pr->SiS_LCDVDES = 524; + break; + } +#endif + } } - SiS_Pr->SiS_LCDHDES = (PanelDesPtr+ResIndex)->LCDHDES; - SiS_Pr->SiS_LCDVDES = (PanelDesPtr+ResIndex)->LCDVDES; - if((ModeNo <= 0x13) && (SiS_Pr->SiS_LCDInfo & DontExpandLCD)) { modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; if((SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) && (SiS_Pr->SiS_VBInfo & SetCRT2ToLCDA)) { @@ -3807,6 +3754,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 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; @@ -3815,6 +3763,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 } } } @@ -5309,321 +5258,144 @@ static void SiS_SetGroup1_301(SiS_Private *SiS_Pr, USHORT ModeNo,USHORT ModeIdIndex, PSIS_HW_INFO HwInfo,USHORT RefreshRateTableIndex) { - USHORT push1,push2; - USHORT tempax,tempbx,tempcx,temp; - USHORT resinfo,modeflag,xres=0; - unsigned char p1_7, p1_8; + 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, + /* CR8 CR9 SR0A SR0B SR0C SR0D SR0E CR0F */ + 0x00, 0x0b, 0x17, 0x18, 0x19, 0x00, 0x1a, 0x00, + /* CR10 CR11 CR12 CR13 CR14 CR15 CR16 CR17 */ + 0x0c, 0x0d, 0x0e, 0x00, 0x0f, 0x10, 0x11, 0x00 + }; if(ModeNo <= 0x13) { modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - resinfo = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ResInfo; } else if(SiS_Pr->UseCustomMode) { modeflag = SiS_Pr->CModeFlag; - resinfo = 0; xres = SiS_Pr->CHDisplay; } else { modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; - resinfo = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_RESINFO; xres = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].XRes; } /* The following is only done if bridge is in slave mode: */ - if((HwInfo->jChipType >= SIS_661) && (ModeNo > 0x13)) { - if(xres >= 1600) { + if(HwInfo->jChipType >= SIS_315H) { + if(xres >= 1600) { /* BIOS: == 1600 */ SiS_SetRegOR(SiS_Pr->SiS_P3c4,0x31,0x04); } } - - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x03,0xff); /* set MAX HT */ - - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) modeflag |= Charx8Dot; - - if(modeflag & Charx8Dot) tempcx = 0x08; - else tempcx = 0x09; - - tempax = SiS_Pr->SiS_VGAHDE; /* 0x04 Horizontal Display End */ - if(modeflag & HalfDCLK) tempax >>= 1; - tempax = ((tempax / tempcx) - 1) & 0xff; - tempbx = tempax; - - temp = tempax; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x04,temp); - + + SiS_Pr->CHTotal = 8224; /* Max HT, 0x2020, results in 0x3ff in registers */ + + 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) { - if(!(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV)) { - temp += 2; - } + SiS_Pr->CHBlankStart += 16; } - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) { - if(resinfo == SIS_RI_800x600) temp -= 2; - } - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x05,temp); /* 0x05 Horizontal Display Start */ - - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x06,0x03); /* 0x06 Horizontal Blank end */ - - tempax = 0xFFFF; - if(!(SiS_Pr->SiS_VBInfo & SetCRT2ToTV)) tempax = SiS_GetVGAHT2(SiS_Pr); - if(tempax >= SiS_Pr->SiS_VGAHT) tempax = SiS_Pr->SiS_VGAHT; - if(modeflag & HalfDCLK) tempax >>= 1; - tempax = (tempax / tempcx) - 5; - tempcx = tempax; - - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) { - temp = tempcx - 1; - if(!(modeflag & HalfDCLK)) { - temp -= 6; - if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) { - temp -= 2; - if(ModeNo > 0x13) temp -= 10; - } - } - } else { - tempcx = (tempcx + tempbx) >> 1; - temp = (tempcx & 0x00FF) + 2; - if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { - temp--; - if(!(modeflag & HalfDCLK)) { - if((modeflag & Charx8Dot)) { - temp += 4; - if(SiS_Pr->SiS_VGAHDE >= 800) temp -= 6; - if(HwInfo->jChipType >= SIS_315H) { - if(SiS_Pr->SiS_VGAHDE == 800) temp += 2; - } - } - } - } else { - if(!(modeflag & HalfDCLK)) { - temp -= 4; - if((SiS_Pr->SiS_LCDResInfo != Panel_1280x960) && - (SiS_Pr->SiS_LCDResInfo != Panel_1600x1200)) { - if(SiS_Pr->SiS_VGAHDE >= 800) { - temp -= 7; - if(HwInfo->jChipType < SIS_315H) { - if(SiS_Pr->SiS_ModeType == ModeEGA) { - if(SiS_Pr->SiS_VGAVDE == 1024) { - temp += 15; - if(SiS_Pr->SiS_LCDResInfo != Panel_1280x1024) - temp += 7; - } - } - } - if(SiS_Pr->SiS_LCDResInfo != Panel_1400x1050) { - if(SiS_Pr->SiS_VGAHDE >= 1280) { - if(SiS_Pr->SiS_LCDInfo & DontExpandLCD) temp += 28; - } - } - } - } - } - } - } - - p1_7 = temp; - p1_8 = 0x00; - - if(SiS_Pr->SiS_VBInfo & SetCRT2ToTV) { - if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) { - if(ModeNo <= 0x01) { - p1_7 = 0x2a; - if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) p1_8 = 0x61; - else p1_8 = 0x41; - } else if(SiS_Pr->SiS_ModeType == ModeText) { - if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) p1_7 = 0x54; - else p1_7 = 0x55; - p1_8 = 0x00; - } else if(ModeNo <= 0x13) { - if(modeflag & HalfDCLK) { - if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) { - p1_7 = 0x30; - p1_8 = 0x03; - } else { - p1_7 = 0x2f; - p1_8 = 0x02; - } - } else { - p1_7 = 0x5b; - p1_8 = 0x03; - } - } else if( ((HwInfo->jChipType >= SIS_315H) && - ((ModeNo == 0x50) || (ModeNo == 0x56) || (ModeNo == 0x53))) || - ((HwInfo->jChipType < SIS_315H) && - (resinfo == SIS_RI_320x200 || resinfo == SIS_RI_320x240)) ) { - if(!(SiS_Pr->SiS_TVMode & TVSetPAL)) { - p1_7 = 0x30, - p1_8 = 0x03; - } else { - p1_7 = 0x2f; - p1_8 = 0x03; - } - } - } - } - - if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) { - if(SiS_Pr->SiS_TVMode & (TVSetYPbPr525p|TVSetYPbPr750p)) { - p1_7 = 0x63; - if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) p1_7 = 0x55; - } - if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) { - if(!(modeflag & HalfDCLK)) { - p1_7 = 0xb2; - if(SiS_Pr->SiS_TVMode & TVSetYPbPr750p) { - p1_7 = 0xab; - } - } - } else { - if(SiS_Pr->SiS_TVMode & TVSetYPbPr525p) { - if(modeflag & HalfDCLK) p1_7 = 0x30; - } - } - } - - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x07,p1_7); /* 0x07 Horizontal Retrace Start */ - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x08,p1_8); /* 0x08 Horizontal Retrace End */ - - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x18,0x03); /* 0x18 SR08 (FIFO Threshold?) */ - - SiS_SetRegAND(SiS_Pr->SiS_Part1Port,0x19,0xF0); - - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x09,0xFF); /* 0x09 Set Max VT */ - - tempcx = 0x121; - tempbx = SiS_Pr->SiS_VGAVDE; /* 0x0E Vertical Display End */ - if (tempbx == 357) tempbx = 350; - else if(tempbx == 360) tempbx = 350; - else if(tempbx == 375) tempbx = 350; - else if(tempbx == 405) tempbx = 400; - else if(tempbx == 420) tempbx = 400; - else if(tempbx == 525) tempbx = 480; - push2 = tempbx; + + SiS_Pr->CHBlankEnd = 32; if(SiS_Pr->SiS_VBInfo & SetCRT2ToLCD) { - if(SiS_Pr->SiS_LCDResInfo == Panel_1024x768) { - if(!(SiS_Pr->SiS_SetFlag & LCDVESATiming)) { - if (tempbx == 350) tempbx += 5; - else if(tempbx == 480) tempbx += 5; - } - } + if(xres == 1600) SiS_Pr->CHBlankEnd += 80; } - tempbx -= 2; - temp = tempbx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x10,temp); /* 0x10 vertical Blank Start */ - - tempbx = push2; - tempbx--; - temp = tempbx & 0x00FF; -#if 0 - /* Missing code from 630/301B 2.04.5a and 650/302LV 1.10.6s (calles int 2f) */ - if(xxx()) { - if(temp == 0xdf) temp = 0xda; + + temp = SiS_Pr->SiS_VGAHT - 96; + if(!(modeflag & HalfDCLK)) temp -= 32; + if(SiS_Pr->SiS_LCDInfo & LCDPass11) { + temp = SiS_GetReg(SiS_Pr->SiS_P3d4,0x04); + temp |= ((SiS_GetReg(SiS_Pr->SiS_P3c4,0x0b) & 0xc0) << 2); + temp -= 3; + temp <<= 3; + } else { + if(SiS_Pr->SiS_RVBHRS2) temp = SiS_Pr->SiS_RVBHRS2; } -#endif - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0E,temp); + 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; + else if(VGAVDE == 375) VGAVDE = 350; + else if(VGAVDE == 405) VGAVDE = 400; + else if(VGAVDE == 420) VGAVDE = 400; + 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]); + } + for(i = 0x10, j = 8; i <= 0x12; i++, j++) { + SiS_SetReg(SiS_Pr->SiS_Part1Port,CRTranslation[i],SiS_Pr->CCRT1CRTC[j]); + } + for(i = 0x15, j = 11; i <= 0x16; i++, j++) { + SiS_SetReg(SiS_Pr->SiS_Part1Port,CRTranslation[i],SiS_Pr->CCRT1CRTC[j]); + } + 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 = 0; + temp = (SiS_Pr->CCRT1CRTC[16] & 0x01) << 5; if(modeflag & DoubleScanMode) temp |= 0x80; - if(HwInfo->jChipType >= SIS_661) { - if(tempbx & 0x0200) temp |= 0x20; - SiS_SetRegANDOR(SiS_Pr->SiS_Part1Port,0x0B,0x5F,temp); - if(tempbx & 0x0100) tempcx |= 0x000a; - if(tempbx & 0x0400) tempcx |= 0x1200; - } else { - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0B,temp); - if(tempbx & 0x0100) tempcx |= 0x0002; - if(tempbx & 0x0400) tempcx |= 0x0600; - } - - if(tempbx & 0x0200) tempcx |= 0x0040; - - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x11,0x00); /* 0x11 Vertical Blank End */ - - tempax = (SiS_Pr->SiS_VGAVT - tempbx) >> 2; - - if((ModeNo > 0x13) || (HwInfo->jChipType < SIS_315H)) { - if(resinfo != SIS_RI_1280x1024) { - tempbx += (tempax << 1); - } - } else if(HwInfo->jChipType >= SIS_315H) { - if(SiS_Pr->SiS_LCDResInfo != Panel_1400x1050) { - tempbx += (tempax << 1); - } - } - - if(SiS_Pr->SiS_VBInfo & SetCRT2ToHiVision) { - tempbx -= 10; - } else { - if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) { - if(SiS_Pr->SiS_TVMode & TVSetPAL) { - tempbx += 40; - if(HwInfo->jChipType >= SIS_315H) { - if(SiS_Pr->SiS_VGAHDE == 800) tempbx += 10; - } - } - } - } - tempax >>= 2; - tempax++; - tempax += tempbx; - push1 = tempax; - if(SiS_Pr->SiS_TVMode & TVSetPAL) { - if(tempbx <= 513) { - if(tempax >= 513) tempbx = 513; - } - } - temp = tempbx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0C,temp); /* 0x0C Vertical Retrace Start */ - - tempbx--; - temp = tempbx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x10,temp); - - if(tempbx & 0x0100) tempcx |= 0x0008; - - if(tempbx & 0x0200) { - SiS_SetRegOR(SiS_Pr->SiS_Part1Port,0x0B,0x20); - } - tempbx++; - - if(tempbx & 0x0100) tempcx |= 0x0004; - if(tempbx & 0x0200) tempcx |= 0x0080; - if(tempbx & 0x0400) { - if(HwInfo->jChipType >= SIS_661) tempcx |= 0x0800; - else if(SiS_Pr->SiS_VBType & VB_SIS301) tempcx |= 0x0800; - else tempcx |= 0x0C00; - } - - tempbx = push1; - temp = tempbx & 0x000F; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0D,temp); /* 0x0D vertical Retrace End */ - - if(tempbx & 0x0010) tempcx |= 0x2000; - - temp = tempcx & 0x00FF; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0A,temp); /* 0x0A CR07 */ - - temp = (tempcx & 0xFF00) >> 8; - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x17,temp); /* 0x17 SR0A */ - - tempax = modeflag; - temp = (tempax & 0xFF00) >> 8; - temp = (temp >> 1) & 0x09; - if(!(SiS_Pr->SiS_VBType & VB_SIS301)) temp |= 0x01; /* Always 8 dotclock */ - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x16,temp); /* 0x16 SR01 */ - - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x0F,0x00); /* 0x0F CR14 */ - - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x12,0x00); /* 0x12 CR17 */ - - temp = 0x00; + 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) { - if(SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00) & 0x01) { - temp = 0x80; - } + temp = (SiS_GetReg(SiS_Pr->SiS_Part1Port,0x00) & 0x01) << 7; } - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1A,temp); /* 0x1A SR0E */ + SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1A,temp); /* SR0E, dither[7] */ temp = SiS_GetRegByte((SiS_Pr->SiS_P3ca+0x02)); - SiS_SetReg(SiS_Pr->SiS_Part1Port,0x1b,temp); + 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->CVDisplay, SiS_Pr->CVSyncStart, SiS_Pr->CVSyncEnd, SiS_Pr->CVTotal, + SiS_Pr->CHBlankStart, SiS_Pr->CHBlankEnd, SiS_Pr->CVBlankStart, SiS_Pr->CVBlankEnd); + + xf86DrvMsg(0, X_INFO, " {{0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,\n", + SiS_Pr->CCRT1CRTC[0], SiS_Pr->CCRT1CRTC[1], + SiS_Pr->CCRT1CRTC[2], SiS_Pr->CCRT1CRTC[3], + SiS_Pr->CCRT1CRTC[4], SiS_Pr->CCRT1CRTC[5], + SiS_Pr->CCRT1CRTC[6], SiS_Pr->CCRT1CRTC[7]); + xf86DrvMsg(0, X_INFO, " 0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,\n", + SiS_Pr->CCRT1CRTC[8], SiS_Pr->CCRT1CRTC[9], + SiS_Pr->CCRT1CRTC[10], SiS_Pr->CCRT1CRTC[11], + SiS_Pr->CCRT1CRTC[12], SiS_Pr->CCRT1CRTC[13], + SiS_Pr->CCRT1CRTC[14], SiS_Pr->CCRT1CRTC[15]); + xf86DrvMsg(0, X_INFO, " 0x%02x}},\n", SiS_Pr->CCRT1CRTC[16]); +#endif } /* Setup panel link @@ -6752,13 +6524,13 @@ SiS_Set300Part2Regs(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x01,0x80,(CRT2Part2Ptr+resindex)->CR[0]); SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x02,0x80,(CRT2Part2Ptr+resindex)->CR[1]); for(i = 2, j = 0x04; j <= 0x06; i++, j++ ) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,j,(CRT2Part2Ptr+resindex)->CR[i]); + SiS_SetReg(SiS_Pr->SiS_Part2Port,j,(CRT2Part2Ptr+resindex)->CR[i]); } for(j = 0x1c; j <= 0x1d; i++, j++ ) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,j,(CRT2Part2Ptr+resindex)->CR[i]); + SiS_SetReg(SiS_Pr->SiS_Part2Port,j,(CRT2Part2Ptr+resindex)->CR[i]); } for(j = 0x1f; j <= 0x21; i++, j++ ) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,j,(CRT2Part2Ptr+resindex)->CR[i]); + SiS_SetReg(SiS_Pr->SiS_Part2Port,j,(CRT2Part2Ptr+resindex)->CR[i]); } SiS_SetReg(SiS_Pr->SiS_Part2Port,0x23,(CRT2Part2Ptr+resindex)->CR[10]); SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x25,0x0f,(CRT2Part2Ptr+resindex)->CR[11]); @@ -6912,9 +6684,6 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr TimingPoint = SiS_Pr->SiS_HiTVSt2Timing; if(SiS_Pr->SiS_TVMode & TVSetTVSimuMode) { TimingPoint = SiS_Pr->SiS_HiTVSt1Timing; -#if 0 - if(!(modeflag & Charx8Dot)) TimingPoint = SiS_Pr->SiS_HiTVTextTiming; -#endif } } @@ -7121,18 +6890,6 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr SiS_SetRegANDOR(SiS_Pr->SiS_Part4Port,0x10,0xdf,((tempbx & 0x0400) >> 5)); } -#if 0 - /* TEST qqqq */ - if(SiS_Pr->SiS_VBInfo & SetCRT2ToYPbPr525750) { - for(i=0x01, j=0; i<=0x2D; i++, j++) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,i,TimingPoint[j]); - } - for(i=0x39; i<=0x45; i++, j++) { - SiS_SetReg(SiS_Pr->SiS_Part2Port,i,TimingPoint[j]); - } - } -#endif - if(SiS_Pr->SiS_VBType & VB_SIS301BLV302BLV) { tempbx = SiS_Pr->SiS_VDE; if( (SiS_Pr->SiS_VBInfo & SetCRT2ToTV) && @@ -7250,10 +7007,8 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr if(SiS_Pr->SiS_ModeType == ModeEGA) { if(SiS_Pr->SiS_VGAHDE >= 1024) { temp = 0x02; - if(HwInfo->jChipType >= SIS_315H) { - if(SiS_Pr->SiS_SetFlag & LCDVESATiming) { - temp = 0x01; - } + if(SiS_Pr->SiS_SetFlag & LCDVESATiming) { + temp = 0x01; } } } @@ -7285,9 +7040,9 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr if(SiS_GetCRT2Part2Ptr(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, &CRT2Index, &resindex, HwInfo)) { switch(CRT2Index) { + case 206: CRT2Part2Ptr = SiS310_CRT2Part2_Asus1024x768_3; break; + default: case 200: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1024x768_1; break; - case 206: CRT2Part2Ptr = SiS310_CRT2Part2_Asus1024x768_3; break; - default: CRT2Part2Ptr = SiS_Pr->SiS_CRT2Part2_1024x768_3; break; } SiS_SetRegANDOR(SiS_Pr->SiS_Part2Port,0x01,0x80,(CRT2Part2Ptr+resindex)->CR[0]); @@ -7306,7 +7061,6 @@ SiS_SetGroup2(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex,USHORT Refr SiS_SetGroup2_Tail(SiS_Pr, ModeNo); - } else { #endif @@ -7935,116 +7689,153 @@ SiS_SetGroup5(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, /* MODIFY CRT1 GROUP FOR SLAVE MODE */ /*********************************************/ +static BOOLEAN +SiS_GetLVDSCRT1Ptr(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, + USHORT RefreshRateTableIndex, USHORT *ResIndex, + USHORT *DisplayType) + { + USHORT modeflag=0; + + /* Pass 1:1 not supported here */ + + if(ModeNo <= 0x13) { + modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; + (*ResIndex) = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_CRT2CRTC; + } else { + modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + (*ResIndex) = SiS_Pr->SiS_RefIndex[RefreshRateTableIndex].Ext_CRT2CRTC; + } + + (*ResIndex) &= 0x3F; + + 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; + if(SiS_Pr->SiS_ModeType > ModeVGA) { + if(SiS_Pr->SiS_CHSOverScan) (*DisplayType) = 84; + } + } + 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; + default: return TRUE; + } + + 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; +} + static void SiS_ModCRT1CRTC(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex, USHORT RefreshRateTableIndex, PSIS_HW_INFO HwInfo) { - USHORT tempah,i,modeflag,j; - USHORT ResIndex,DisplayType; + USHORT tempah,i,modeflag,j,ResIndex,DisplayType; const SiS_LVDSCRT1DataStruct *LVDSCRT1Ptr=NULL; - - if(ModeNo <= 0x13) modeflag = SiS_Pr->SiS_SModeIDTable[ModeIdIndex].St_ModeFlag; - else modeflag = SiS_Pr->SiS_EModeIDTable[ModeIdIndex].Ext_ModeFlag; + const USHORT CRIdx[] = { + 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, + 0x07, 0x10, 0x11, 0x15, 0x16 + }; if((SiS_Pr->SiS_CustomT == CUT_BARCO1366) || (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; + + if(SiS_Pr->SiS_LCDInfo & LCDPass11) return; + + if(HwInfo->jChipType < SIS_315H) { + if(SiS_Pr->SiS_SetFlag & SetDOSMode) return; + } if(!(SiS_GetLVDSCRT1Ptr(SiS_Pr, ModeNo, ModeIdIndex, RefreshRateTableIndex, &ResIndex, &DisplayType))) { return; } - if(HwInfo->jChipType < SIS_315H) { - if(SiS_Pr->SiS_SetFlag & SetDOSMode) return; - } - switch(DisplayType) { - case 0 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_1; break; - case 1 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_1_H; break; - case 2 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_2; break; - case 3 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1800x600_2_H; break; - case 4 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_1; break; - case 5 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_1_H; break; - case 6 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_2; break; - case 7 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_2_H; break; - case 8 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_1; break; - case 9 : LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_1_H; break; - case 10: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_2; break; - case 11: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x1024_2_H; break; - case 12: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1XXXxXXX_1; break; - case 13: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1XXXxXXX_1_H; break; - case 14: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11400x1050_1; break; - case 15: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11400x1050_1_H; break; - case 16: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11400x1050_2; break; - case 17: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11400x1050_2_H; break; - case 18: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1UNTSC; break; - case 19: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1ONTSC; break; - case 20: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1UPAL; break; - case 21: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1OPAL; break; - case 22: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1320x480_1; break; /* FSTN */ - case 23: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x600_1; break; - case 24: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x600_1_H; break; - case 25: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x600_2; break; - case 26: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x600_2_H; break; - case 27: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11152x768_1; break; - case 28: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11152x768_1_H; break; - case 29: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11152x768_2; break; - case 30: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11152x768_2_H; break; - case 36: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11600x1200_1; break; - case 37: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11600x1200_1_H; break; - case 38: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11600x1200_2; break; - case 39: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11600x1200_2_H; break; - case 40: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x768_1; break; - case 41: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x768_1_H; break; - case 42: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x768_2; break; - case 43: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11280x768_2_H; break; - case 50: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1640x480_1; break; - case 51: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1640x480_1_H; break; - case 52: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1640x480_2; break; - case 53: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1640x480_2_H; break; - case 54: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1640x480_3; break; - case 55: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT1640x480_3_H; break; - case 99: LVDSCRT1Ptr = SiS_Pr->SiS_CHTVCRT1SOPAL; break; - default: LVDSCRT1Ptr = SiS_Pr->SiS_LVDSCRT11024x768_1; break; + 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 */ + 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 */ + 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); + } - SiS_SetRegAND(SiS_Pr->SiS_P3d4,0x11,0x7f); + for(i = 0x0A, j = 11; i <= 0x0C; i++, j++) { + tempah = (LVDSCRT1Ptr + ResIndex)->CR[j]; + SiS_SetReg(SiS_Pr->SiS_P3c4,i,tempah); + } - tempah = (LVDSCRT1Ptr + ResIndex)->CR[0]; - SiS_SetReg(SiS_Pr->SiS_P3d4,0x00,tempah); + 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; - for(i=0x02,j=1;i<=0x05;i++,j++){ - tempah = (LVDSCRT1Ptr + ResIndex)->CR[j]; - SiS_SetReg(SiS_Pr->SiS_P3d4,i,tempah); + tempah = ((LVDSCRT1Ptr + ResIndex)->CR[14] & 0x01) << 5; + if(modeflag & DoubleScanMode) tempah |= 0x080; + SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,~0x020,tempah); + + } else { + + SiS_CalcLCDACRT1Timing(SiS_Pr, ModeNo, ModeIdIndex, HwInfo); + } - for(i=0x06,j=5;i<=0x07;i++,j++){ - tempah = (LVDSCRT1Ptr + ResIndex)->CR[j]; - SiS_SetReg(SiS_Pr->SiS_P3d4,i,tempah); - } - for(i=0x10,j=7;i<=0x11;i++,j++){ - tempah = (LVDSCRT1Ptr + ResIndex)->CR[j]; - SiS_SetReg(SiS_Pr->SiS_P3d4,i,tempah); - } - for(i=0x15,j=9;i<=0x16;i++,j++){ - tempah = (LVDSCRT1Ptr + ResIndex)->CR[j]; - SiS_SetReg(SiS_Pr->SiS_P3d4,i,tempah); - } - for(i=0x0A,j=11;i<=0x0C;i++,j++){ - tempah = (LVDSCRT1Ptr + ResIndex)->CR[j]; - SiS_SetReg(SiS_Pr->SiS_P3c4,i,tempah); - } - - tempah = (LVDSCRT1Ptr + ResIndex)->CR[14]; - tempah &= 0xE0; - SiS_SetRegANDOR(SiS_Pr->SiS_P3c4,0x0E,0x1f,tempah); - - tempah = (LVDSCRT1Ptr + ResIndex)->CR[14]; - tempah &= 0x01; - tempah <<= 5; - if(modeflag & DoubleScanMode) tempah |= 0x080; - SiS_SetRegANDOR(SiS_Pr->SiS_P3d4,0x09,~0x020,tempah); } /*********************************************/ @@ -8941,10 +8732,8 @@ SiS_SetCRT2Group(SiS_Private *SiS_Pr, PSIS_HW_INFO HwInfo, USHORT ModeNo) } else { SiS_SetCRT2Sync(SiS_Pr, ModeNo, RefreshRateTableIndex, HwInfo); - - if(!(SiS_Pr->SiS_LCDInfo & LCDPass11)) { - SiS_ModCRT1CRTC(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwInfo); - } + + SiS_ModCRT1CRTC(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwInfo); SiS_SetCRT2ECLK(SiS_Pr,ModeNo,ModeIdIndex,RefreshRateTableIndex,HwInfo); @@ -9687,7 +9476,7 @@ checkedid1(unsigned char *buffer) if((buffer[0x12] != 1) || (buffer[0x13] > 4)) return FALSE; /* Check week of manufacture for sanity */ - if(buffer[0x10] > 53) return FALSE; + if(buffer[0x10] > 54) return FALSE; /* Check year of manufacture for sanity */ if(buffer[0x11] > 40) return FALSE; @@ -9704,7 +9493,7 @@ checkedid2(unsigned char *buffer) if((buffer[0] & 0xf0) != 0x20) return FALSE; /* Check week of manufacture for sanity */ - if(buffer[5] > 53) return FALSE; + if(buffer[5] > 54) return FALSE; /* Check year of manufacture for sanity */ if((year != 0) && ((year < 1990) || (year > 2030))) return FALSE; @@ -9800,15 +9589,6 @@ SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS) buffer[0x14]); return 0; } - - if((buffer[0x18] & 0x18) != 0x08) { - xf86DrvMsg(pSiS->pScrn->scrnIndex, X_PROBED, - "LCD sense: Warning: Attached display is not of RGB but of %s type (0x%02x)\n", - ((buffer[0x18] & 0x18) == 0x00) ? "monochrome/greyscale" : - ( ((buffer[0x18] & 0x18) == 0x10) ? "non-RGB multicolor" : - "undefined"), - buffer[0x18]); - } /* Now analyze the first Detailed Timing Block and see * if the preferred timing mode is stored there. If so, @@ -9876,12 +9656,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; } } } @@ -10408,7 +10188,7 @@ SiS_SenseVGA2DDC(SiS_Private *SiS_Pr, SISPtr pSiS) "VGA2 sense: EDID corrupt\n"); return 0; } - if(buffer[0x14] & 0x80) { /* Display uses digital input */ + if(buffer[0x14] & 0x80) { /* Display uses digital input */ xf86DrvMsg(pSiS->pScrn->scrnIndex, X_ERROR, "VGA2 sense: Attached display expects digital input\n"); return 0; diff --git a/src/init301.h b/src/init301.h index 77e2b8b..85c0eea 100644 --- a/src/init301.h +++ b/src/init301.h @@ -3,7 +3,7 @@ /* * Data and prototypes for init301.c * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * If distributed as part of the Linux kernel, the following license terms * apply: @@ -400,7 +400,9 @@ extern USHORT SiS_GetOffset(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdI USHORT RefreshRateTableIndex, PSIS_HW_INFO HwInfo); extern void SiS_LoadDAC(SiS_Private *SiS_Pr, PSIS_HW_INFO, USHORT ModeNo, USHORT ModeIdIndex); -extern void SiS_CalcLCDACRT1Timing(SiS_Private *SiS_Pr, USHORT ModeNo, USHORT ModeIdIndex); +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); #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, diff --git a/src/initdef.h b/src/initdef.h index 9cf1df2..2cd70bd 100644 --- a/src/initdef.h +++ b/src/initdef.h @@ -3,7 +3,7 @@ /* * Global definitions for init.c and init301.c * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * If distributed as part of the Linux kernel, the following license terms * apply: @@ -91,6 +91,7 @@ #define VB_SISLCDA (VB_SIS302B|VB_SIS301C|VB_SIS301LV|VB_SIS302LV|VB_SIS302ELV) #define VB_SISYPBPR (VB_SIS301C|VB_SIS301LV|VB_SIS302LV|VB_SIS302ELV) #define VB_SISHIVISION (VB_SIS301|VB_SIS301B|VB_SIS302B) +#define VB_SISTMDSLCDA (VB_SIS301C) /* VBInfo */ #define SetSimuScanMode 0x0001 /* CR 30 */ @@ -483,16 +484,17 @@ #define VCLK34_300 0x3d /* Index in VCLKData table (300) */ #define VCLK_CUSTOM_300 0x47 -#define VCLK65_315 0x0b /* Index in (VB)VCLKData table (315) */ -#define VCLK108_2_315 0x19 /* Index in (VB)VCLKData table (315) */ -#define VCLK81_315 0x5b /* Index in (VB)VCLKData table (315) */ -#define VCLK162_315 0x5e /* Index in (VB)VCLKData table (315) */ -#define VCLK108_3_315 0x45 /* Index in VBVCLKData table (315) */ -#define VCLK100_315 0x46 /* Index in VBVCLKData table (315) */ +#define 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 VCLK34_315 0x55 #define VCLK68_315 0x0d -#define VCLK_1280x800_315_2 0x5c /* Index in VBVCLKData table (315) */ -#define VCLK121_315 0x5d /* Index in VBVCLKData table (315) */ +#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?) */ diff --git a/src/oem300.h b/src/oem300.h index b1358b7..c38fd68 100644 --- a/src/oem300.h +++ b/src/oem300.h @@ -3,7 +3,7 @@ /* * OEM Data for 300 series * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * If distributed as part of the Linux kernel, the following license terms * apply: diff --git a/src/oem310.h b/src/oem310.h index 7a5aed0..8efbd71 100644 --- a/src/oem310.h +++ b/src/oem310.h @@ -3,7 +3,7 @@ /* * OEM Data for 315/330 series * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * If distributed as part of the Linux kernel, the following license terms * apply: diff --git a/src/osdef.h b/src/osdef.h index 68f692d..b711af3 100644 --- a/src/osdef.h +++ b/src/osdef.h @@ -3,7 +3,7 @@ /* * OS depending defines * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * If distributed as part of the Linux kernel, the following license terms * apply: @@ -87,6 +87,7 @@ /**********************************************************************/ #ifdef LINUX_KERNEL + #include #ifdef CONFIG_FB_SIS_300 @@ -109,6 +110,7 @@ #define InPortWord(p) inw((IOADDRESS)(p)) #define InPortLong(p) inl((IOADDRESS)(p)) #define SiS_SetMemory(MemoryAddress,MemorySize,value) memset_io(MemoryAddress, value, MemorySize) + #endif /**********************************************************************/ @@ -116,6 +118,7 @@ /**********************************************************************/ #ifdef LINUX_XF86 + #define SIS300 #define SIS315H @@ -126,6 +129,7 @@ #define InPortWord(p) inSISREGW((IOADDRESS)(p)) #define InPortLong(p) inSISREGL((IOADDRESS)(p)) #define SiS_SetMemory(MemoryAddress,MemorySize,value) memset(MemoryAddress, value, MemorySize) -#endif + +#endif /* XF86 */ #endif /* _OSDEF_H_ */ diff --git a/src/sis.h b/src/sis.h index d7bfc1f..22b9d49 100644 --- a/src/sis.h +++ b/src/sis.h @@ -3,7 +3,7 @@ /* * Main global data and definitions * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -35,9 +35,9 @@ #ifndef _SIS_H #define _SIS_H_ -#define SISDRIVERVERSIONYEAR 4 -#define SISDRIVERVERSIONMONTH 12 -#define SISDRIVERVERSIONDAY 6 +#define SISDRIVERVERSIONYEAR 5 +#define SISDRIVERVERSIONMONTH 1 +#define SISDRIVERVERSIONDAY 19 #define SISDRIVERREVISION 1 #define SISDRIVERIVERSION ((SISDRIVERVERSIONYEAR << 16) | \ @@ -45,6 +45,17 @@ SISDRIVERVERSIONDAY | \ (SISDRIVERREVISION << 24)) +#undef SIS_LINUX /* Try to find out whether platform is Linux */ +#if defined(__GNUC__) && (__GNUC__ >= 4) +#ifdef __linux__ +#define SIS_LINUX +#endif +#else +#ifdef linux +#define SIS_LINUX +#endif +#endif + #define SIS_NAME "SIS" #define SIS_DRIVER_NAME "sis" #define SIS_MAJOR_VERSION 0 @@ -52,15 +63,14 @@ #define SIS_PATCHLEVEL 0 #define SIS_CURRENT_VERSION ((SIS_MAJOR_VERSION << 16) | \ (SIS_MINOR_VERSION << 8) | SIS_PATCHLEVEL ) - + #if 0 #define TWDEBUG /* for debugging */ #endif +#undef SIS_CP #if 0 #include "siscp.H" -#else -#undef SIS_CP #endif #include "xf86_ansic.h" @@ -94,7 +104,7 @@ #include "Xv.h" #endif -/* Platform/architecture related #defines: */ +/* Platform/architecture related definitions: */ /* SIS_PC_PLATFORM: Map VGA memory at a0000 and save/restore fonts? */ /* List of architectures likely to be incomplete */ @@ -111,7 +121,7 @@ /* SIS_NEED_MAP_IOP: Map i/o port area to virtual memory? */ /* List of architectures likely to be incomplete */ -/* BROKEN, see comment in sis_driver.c */ +/* This is BROKEN, see comment in sis_driver.c */ #undef SIS_NEED_MAP_IOP #if 0 #if defined(__arm32__) || defined(__mips__) @@ -120,10 +130,10 @@ #endif /* SISUSEDEVPORT: Used on architectures without direct inX/outX access. In this case, - * we use read()/write() to /dev/port. LINUX ONLY! + * we use read()/write() to /dev/port. LINUX ONLY! (How can this be done on *BSD?) */ #undef SISUSEDEVPORT -#if defined(linux) && (defined(__arm32__) || defined(__mips__)) +#if defined(SIS_LINUX) && (defined(__arm32__) || defined(__mips__)) #ifndef SIS_NEED_MAP_IOP #define SISUSEDEVPORT #endif @@ -153,7 +163,7 @@ #include "sis_dri.h" #endif /* XF86DRI */ -/* Configurable stuff: */ +/* Configurable stuff: ------------------------------------- */ #define SISDUALHEAD /* Include Dual Head code */ @@ -181,7 +191,7 @@ #define SISDEINT /* Include Xv deinterlacer code (not functional yet!) */ #endif -/* End of configurable stuff */ +/* End of configurable stuff --------------------------------- */ #define UNLOCK_ALWAYS /* Always unlock the registers (should be set!) */ @@ -356,6 +366,7 @@ #define VB_LCD_1280x800 0x00010000 #define VB_LCD_1680x1050 0x00020000 #define VB_LCD_1280x720 0x00040000 +#define VB_LCD_UNKNOWN 0x10000000 #define VB_LCD_BARCO1366 0x20000000 #define VB_LCD_CUSTOM 0x40000000 #define VB_LCD_EXPANDING 0x80000000 @@ -368,10 +379,11 @@ #define SIS_MODE_CRT2 2 /* pSiS->MiscFlags */ -#define MISC_CRT1OVERLAY 0x00000001 /* Current display mode supports overlay */ +#define MISC_CRT1OVERLAY 0x00000001 /* Current display mode supports overlay (CRT1) */ #define MISC_PANELLINKSCALER 0x00000002 /* Panel link is currently scaling */ #define MISC_CRT1OVERLAYGAMMA 0x00000004 /* Current display mode supports overlay gamma corr on CRT1 */ #define MISC_TVNTSC1024 0x00000008 /* Current display mode is TV NTSC/PALM/YPBPR525I 1024x768 */ +#define MISC_CRT2OVERLAY 0x00000010 /* Current display mode supports overlay (CRT2) */ /* pSiS->SiS6326Flags */ #define SIS6326_HASTV 0x00000001 @@ -445,6 +457,9 @@ typedef unsigned char UChar; #define SiSCF_IsM760 0x00000400 #define SiSCF_IsM661M 0x00000800 /* M661MX */ #define SiSCF_IsM66x (SiSCF_IsM661 | SiSCF_IsM741 | SiSCF_IsM760 | SiSCF_IsM661M) +#define SiSCF_Is315USB 0x00001000 /* USB2VGA dongle */ +#define SiSCF_Is315E 0x00002000 /* 315E (lower clocks) */ +/* ... */ #define SiSCF_315Core 0x00010000 /* 3D: Real 315 */ #define SiSCF_Real256ECore 0x00020000 /* 3D: Similar to 315 core, no T&L? (65x, 661, 740, 741) */ #define SiSCF_XabreCore 0x00040000 /* 3D: Real Xabre */ @@ -491,7 +506,22 @@ typedef unsigned char UChar; #define SiS_SD_SUPPORTSGRCRT2 0x40000000 /* Separate CRT2 gamma correction supported */ #define SiS_SD_CANSETGAMMA 0x80000000 /* Driver can set gamma ramp; otherwise: App needs to reset palette */ /* after disabling sep CRT2 gamma corr */ - + +#define SiS_SD2_LCDTMDS 0x00000001 /* SiS Bridge supports TMDS (DVI-D) */ +#define SiS_SD2_LCDLVDS 0x00000002 /* SiS Bridge supports LVDS */ +#define SiS_SD2_SUPPORTLCD 0x00000004 /* Bridge supports LCD (LVDS or TMDS, SiS+3rd party) */ +#define SiS_SD2_SUPPORTTVSIZE 0x00000008 /* TV resizing supported (SiS bridges) */ +#define SiS_SD2_SUPPORTTVTYPE 0x00000010 /* TV type selection supported (SiS bridges) */ +#define SiS_SD2_SUPPORTGAMMA2 0x00000020 /* Gamma corr for CRT2 supported (SiS bridges) */ +#define SiS_SD2_SISBRIDGE 0x00000040 /* SiS bridge */ +#define SiS_SD2_SUPPTVSAT 0x00000080 /* TV saturation supported */ +#define SiS_SD2_SUPPTVEDGE 0x00000100 /* TV edge enhancement supported */ +#define SiS_SD2_CHRONTEL 0x00000200 /* Chrontel TV encoder present */ +#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_DIRECTKEY 0x03145792 /* SiSCtrl: Check mode for CRT2 */ @@ -612,7 +642,7 @@ typedef struct { ULong agpVtxBufAddr; /* 315 series */ UChar *agpVtxBufBase; unsigned int agpVtxBufSize; - unsigned int agpVtxBufFree; + unsigned int agpVtxBufFree; #ifdef XF86DRI sisRegion agp; int drmSubFD; @@ -706,7 +736,7 @@ typedef struct { Bool XvUseMemcpy; Bool BenchMemCpy; Bool HaveFastVidCpy; - vidCopyFunc SiSFastVidCopy; + vidCopyFunc SiSFastVidCopy, SiSFastMemCopy; unsigned int CPUFlags; #ifdef SIS_NEED_MAP_IOP CARD32 IOPAddress; /* I/O port physical address */ @@ -894,9 +924,13 @@ typedef struct { Bool ShadowFB; UChar *ShadowPtr; int ShadowPitch; + +#ifdef SISUSEDEVPORT + Bool sisdevportopen; +#endif - Bool loadDRI; - + /* DRI */ + Bool loadDRI; #ifdef XF86DRI Bool directRenderingEnabled; DRIInfoPtr pDRIInfo; @@ -907,6 +941,7 @@ typedef struct { SISRegRec DRContextRegs; #endif + /* Xv */ XF86VideoAdaptorPtr adaptor; XF86VideoAdaptorPtr blitadaptor; void * blitPriv; @@ -915,6 +950,7 @@ typedef struct { void (*ResetXv)(ScrnInfoPtr); void (*ResetXvGamma)(ScrnInfoPtr); + /* misc */ OptionInfoPtr Options; UChar LCDon; #ifdef SISDUALHEAD @@ -994,6 +1030,7 @@ typedef struct { int sisfb_tvxpos, sisfb_tvypos; char sisfbdevname[16]; int EMI; + int PRGB; int NoYV12; /* Disable Xv YV12 support (old series) */ UChar postVBCR32; int newFastVram; /* Replaces FastVram */ @@ -1014,8 +1051,8 @@ typedef struct { Bool IsCustom; DisplayModePtr backupmodelist; int chtvtype; - Atom xvBrightness, xvContrast, xvColorKey, xvHue, xvSaturation; - Atom xvAutopaintColorKey, xvSetDefaults, xvSwitchCRT; + Atom xvBrightness, xvContrast, xvColorKey, xvHue, xvSaturation; + Atom xvAutopaintColorKey, xvSetDefaults, xvSwitchCRT; Atom xvDisableGfx, xvDisableGfxLR, xvTVXPosition, xvTVYPosition; Atom xvDisableColorkey, xvUseChromakey, xvChromaMin, xvChromaMax; Atom xvInsideChromakey, xvYUVChromakey, xvVSync; @@ -1028,7 +1065,7 @@ typedef struct { Atom xv_GDV, xv_GHI, xv_OVR, xv_GBI, xv_TXS, xv_TYS, xv_CFI, xv_COC, xv_COF; Atom xv_YFI, xv_GSS, xv_BRR, xv_BRG, xv_BRB, xv_PBR, xv_PBG, xv_PBB, xv_SHC; Atom xv_BRR2, xv_BRG2, xv_BRB2, xv_PBR2, xv_PBG2, xv_PBB2, xv_PMD, xv_RDT; - Atom xv_GARC2,xv_GAGC2,xv_GABC2; + Atom xv_GARC2,xv_GAGC2,xv_GABC2, xv_GSF2; Atom xv_BRRC2, xv_BRGC2, xv_BRBC2, xv_PBRC2, xv_PBGC2, xv_PBBC2; #ifdef TWDEBUG Atom xv_STR; @@ -1040,13 +1077,13 @@ typedef struct { SIS_CP_H #endif ULong ChipFlags; - ULong SiS_SD_Flags; + ULong SiS_SD_Flags, SiS_SD2_Flags; Bool UseHWARGBCursor; int OptUseColorCursor; int OptUseColorCursorBlend; CARD32 OptColorCursorBlendThreshold; UShort cursorBufferNum; - int vb; + int vb; Bool restorebyset; Bool nocrt2ddcdetection; Bool forcecrt2redetection; @@ -1073,10 +1110,10 @@ typedef struct { short Video_MaxWidth, Video_MaxHeight; int FSTN; Bool AddedPlasmaModes; - short scrnPitch2; + short scrnPitch2; CARD32 CurFGCol, CurBGCol; UChar * CurMonoSrc; - CARD32 * CurARGBDest; + CARD32 * CurARGBDest; int GammaBriR, GammaBriG, GammaBriB; int GammaPBriR, GammaPBriG, GammaPBriB; Bool HideHWCursor; /* Custom application */ @@ -1090,15 +1127,16 @@ typedef struct { ULong VBFlagsInit; DisplayModePtr currentModeLast; IOADDRESS MyPIOOffset; - Bool OverruleRanges; + Bool OverruleRanges; Bool BenchMemCpy; Bool NeedCopyFastVidCpy; Bool SiSFastVidCopyDone; - vidCopyFunc SiSFastVidCopy; + vidCopyFunc SiSFastVidCopy, SiSFastMemCopy; unsigned int CPUFlags; #ifndef SISCHECKOSSSE Bool XvSSEMemcpy; -#endif +#endif + char messagebuffer[64]; unsigned int VGAMapSize; /* SiSVGA stuff */ ULong VGAMapPhys; void *VGAMemBase; /* mapped */ @@ -1106,14 +1144,14 @@ typedef struct { Bool VGACMapSaved; Bool CRT2SepGamma; /* CRT2 separate gamma stuff */ int *crt2cindices; - LOCO *crt2gcolortable, *crt2colors; + LOCO *crt2gcolortable, *crt2colors; int CRT2ColNum; float GammaR2, GammaG2, GammaB2; int GammaR2i, GammaG2i, GammaB2i; int GammaBriR2, GammaBriG2, GammaBriB2; int GammaPBriR2, GammaPBriG2, GammaPBriB2; #ifdef SIS_NEED_MAP_IOP - CARD32 IOPAddress; /* I/O port physical address */ + CARD32 IOPAddress; /* I/O port physical address */ UChar *IOPBase; /* I/O port linear address */ #endif #ifdef SISMERGED @@ -1261,20 +1299,22 @@ extern void SiSOptions(ScrnInfoPtr pScrn); extern const OptionInfoRec * SISAvailableOptions(int chipid, int busid); extern void SiSSetup(ScrnInfoPtr pScrn); extern void SISVGAPreInit(ScrnInfoPtr pScrn); +extern Bool SiSHWCursorInit(ScreenPtr pScreen); extern Bool SiSAccelInit(ScreenPtr pScreen); extern Bool SiS300AccelInit(ScreenPtr pScreen); -extern Bool SiS315AccelInit(ScreenPtr pScreen); extern Bool SiS530AccelInit(ScreenPtr pScreen); -extern Bool SiSHWCursorInit(ScreenPtr pScreen); -extern Bool SISDGAInit(ScreenPtr pScreen); +extern Bool SiS315AccelInit(ScreenPtr pScreen); extern void SISInitVideo(ScreenPtr pScreen); extern void SIS6326InitVideo(ScreenPtr pScreen); +extern Bool SISDGAInit(ScreenPtr pScreen); /* For extended mempy() support */ extern unsigned int SiSGetCPUFlags(ScrnInfoPtr pScrn); -extern vidCopyFunc SiSVidCopyInit(ScreenPtr pScreen); +extern vidCopyFunc SiSVidCopyInit(ScreenPtr pScreen, vidCopyFunc *UMemCpy); extern vidCopyFunc SiSVidCopyGetDefault(void); +extern void SiSMemCopyToVideoRam(SISPtr pSiS, UChar *to, UChar *from, int size); + extern void SiS_SetCHTVlumabandwidthcvbs(ScrnInfoPtr pScrn, int val); extern void SiS_SetCHTVlumabandwidthsvideo(ScrnInfoPtr pScrn, int val); extern void SiS_SetCHTVlumaflickerfilter(ScrnInfoPtr pScrn, int val); diff --git a/src/sis300_accel.c b/src/sis300_accel.c index 60c1570..acc538a 100644 --- a/src/sis300_accel.c +++ b/src/sis300_accel.c @@ -3,7 +3,7 @@ /* * 2D Acceleration for SiS 530, 620, 300, 540, 630, 730. * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,9 +37,9 @@ #endif #include "sis.h" +#include "sis_regs.h" #include "xaarop.h" - #include "sis300_accel.h" #ifdef SISDUALHEAD @@ -139,7 +139,7 @@ extern UChar SiSGetPatternROP(int rop); static void SiSInitializeAccelerator(ScrnInfoPtr pScrn) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); pSiS->DoColorExpand = FALSE; } @@ -352,10 +352,9 @@ SiS300AccelInit(ScreenPtr pScreen) return TRUE; } else { return(XAAInit(pScreen, infoPtr)); - } + } } - static void SiSSync(ScrnInfoPtr pScrn) { @@ -1132,7 +1131,7 @@ SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, /* TW: Make sure that current CPU-driven BitBlt buffer stage is 0 * This is required!!! (Otherwise -> drawing errors) */ - while((MMIO_IN16(pSiS->IOBase, 0x8242) & 0x1F00) != 0) {} /* WDR: == 0x10 */ + while((SIS_MMIO_IN16(pSiS->IOBase, 0x8242) & 0x1F00) != 0) {} /* WDR: == 0x10 */ SiSSetupSRCXY(0,0); SiSSetupROP(SiSGetCopyROP(rop)); @@ -1181,8 +1180,8 @@ SiSSubsequentScanlineCPUToScreenColorExpandFill( * action, this bit never gets cleared again. So do * SiSIdle instead. */ - if((MMIO_IN16(pSiS->IOBase, 0x8242) & 0xe000) != 0xe000) { - /* while ((MMIO_IN16(pSiS->IOBase, 0x8242) & 0x0080) != 0) {} */ + if((SIS_MMIO_IN16(pSiS->IOBase, 0x8242) & 0xe000) != 0xe000) { + /* while ((SIS_MMIO_IN16(pSiS->IOBase, 0x8242) & 0x0080) != 0) {} */ SiSIdle } @@ -1230,8 +1229,8 @@ SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) * action, this bit never gets cleared again. So do * SiSIdle instead. */ - if((MMIO_IN16(pSiS->IOBase, 0x8242) & 0xe000) != 0xe000) { - /* while ((MMIO_IN16(pSiS->IOBase, 0x8242) & 0x0080) != 0) {} */ + if((SIS_MMIO_IN16(pSiS->IOBase, 0x8242) & 0xe000) != 0xe000) { + /* while ((SIS_MMIO_IN16(pSiS->IOBase, 0x8242) & 0x0080) != 0) {} */ SiSIdle } @@ -1244,9 +1243,7 @@ SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) pSiS->ycurrent++; if(pSiS->VGAEngine == SIS_530_VGA) { - while(MMIO_IN8(pSiS->IOBase, 0x8242) & 0x80) {} + while(SIS_MMIO_IN8(pSiS->IOBase, 0x8242) & 0x80) {} } } - - diff --git a/src/sis300_accel.h b/src/sis300_accel.h index f2b977c..a654bca 100644 --- a/src/sis300_accel.h +++ b/src/sis300_accel.h @@ -4,7 +4,7 @@ * 2D Acceleration for SiS 530, 620, 300, 540, 630, 730. * Definitions for the SIS engine communication * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -113,73 +113,73 @@ #define SiSIdle \ { \ - while( (MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \ - while( (MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \ - while( (MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \ - CmdQueLen = (MMIO_IN16(pSiS->IOBase, 0x8240) & pSiS->CmdQueLenMask) - pSiS->CmdQueLenFix; \ + while( (SIS_MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \ + while( (SIS_MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \ + while( (SIS_MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \ + CmdQueLen = (SIS_MMIO_IN16(pSiS->IOBase, 0x8240) & pSiS->CmdQueLenMask) - pSiS->CmdQueLenFix; \ } /* (do three times, because 2D engine seems quite unsure about whether or not it's idle) */ #define SiSSetupSRCBase(base) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, BR(0), base);\ + SIS_MMIO_OUT32(pSiS->IOBase, BR(0), base);\ CmdQueLen--; #define SiSSetupSRCPitch(pitch) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT16(pSiS->IOBase, BR(1), pitch);\ + SIS_MMIO_OUT16(pSiS->IOBase, BR(1), pitch);\ CmdQueLen--; #define SiSSetupSRCXY(x,y) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, BR(2), (x)<<16 | (y) );\ + SIS_MMIO_OUT32(pSiS->IOBase, BR(2), (x)<<16 | (y) );\ CmdQueLen--; #define SiSSetupDSTBase(base) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, BR(4), base);\ + SIS_MMIO_OUT32(pSiS->IOBase, BR(4), base);\ CmdQueLen--; #define SiSSetupDSTXY(x,y) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, BR(3), (x)<<16 | (y) );\ + SIS_MMIO_OUT32(pSiS->IOBase, BR(3), (x)<<16 | (y) );\ CmdQueLen--; #define SiSSetupDSTRect(x,y) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, BR(5), (y)<<16 | (x) );\ + SIS_MMIO_OUT32(pSiS->IOBase, BR(5), (y)<<16 | (x) );\ CmdQueLen--; #define SiSSetupDSTColorDepth(bpp) \ if(pSiS->VGAEngine != SIS_530_VGA) { \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT16(pSiS->IOBase, BR(1)+2, bpp);\ + SIS_MMIO_OUT16(pSiS->IOBase, BR(1)+2, bpp);\ CmdQueLen--; \ } #define SiSSetupRect(w,h) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, BR(6), (h)<<16 | (w) );\ + SIS_MMIO_OUT32(pSiS->IOBase, BR(6), (h)<<16 | (w) );\ CmdQueLen--; #define SiSSetupPATFG(color) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, BR(7), color);\ + SIS_MMIO_OUT32(pSiS->IOBase, BR(7), color);\ CmdQueLen--; #define SiSSetupPATBG(color) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, BR(8), color);\ + SIS_MMIO_OUT32(pSiS->IOBase, BR(8), color);\ CmdQueLen--; #define SiSSetupSRCFG(color) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, BR(9), color);\ + SIS_MMIO_OUT32(pSiS->IOBase, BR(9), color);\ CmdQueLen--; #define SiSSetupSRCBG(color) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, BR(10), color);\ + SIS_MMIO_OUT32(pSiS->IOBase, BR(10), color);\ CmdQueLen--; /* 0x8224 src colorkey high */ @@ -188,30 +188,30 @@ /* 0x8220 dest colorkey low */ #define SiSSetupSRCTrans(color) \ if (CmdQueLen <= 1) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, 0x8224, color);\ - MMIO_OUT32(pSiS->IOBase, 0x8228, color);\ + SIS_MMIO_OUT32(pSiS->IOBase, 0x8224, color);\ + SIS_MMIO_OUT32(pSiS->IOBase, 0x8228, color);\ CmdQueLen -= 2; #define SiSSetupDSTTrans(color) \ if (CmdQueLen <= 1) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, 0x821C, color); \ - MMIO_OUT32(pSiS->IOBase, 0x8220, color); \ + SIS_MMIO_OUT32(pSiS->IOBase, 0x821C, color); \ + SIS_MMIO_OUT32(pSiS->IOBase, 0x8220, color); \ CmdQueLen -= 2; #define SiSSetupMONOPAT(p0,p1) \ if (CmdQueLen <= 1) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, BR(11), p0);\ - MMIO_OUT32(pSiS->IOBase, BR(12), p1);\ + SIS_MMIO_OUT32(pSiS->IOBase, BR(11), p0);\ + SIS_MMIO_OUT32(pSiS->IOBase, BR(12), p1);\ CmdQueLen -= 2; #define SiSSetupClipLT(left,top) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, BR(13), ((left) & 0xFFFF) | (top)<<16 );\ + SIS_MMIO_OUT32(pSiS->IOBase, BR(13), ((left) & 0xFFFF) | (top)<<16 );\ CmdQueLen--; #define SiSSetupClipRB(right,bottom) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, BR(14), ((right) & 0xFFFF) | (bottom)<<16 );\ + SIS_MMIO_OUT32(pSiS->IOBase, BR(14), ((right) & 0xFFFF) | (bottom)<<16 );\ CmdQueLen--; /* General */ @@ -223,84 +223,84 @@ #define SiSDoCMD \ if (CmdQueLen <= 1) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, BR(15), pSiS->CommandReg); \ + SIS_MMIO_OUT32(pSiS->IOBase, BR(15), pSiS->CommandReg); \ CmdQueLen--; \ if(pSiS->VGAEngine != SIS_530_VGA) { \ - MMIO_OUT32(pSiS->IOBase, BR(16), 0);\ + SIS_MMIO_OUT32(pSiS->IOBase, BR(16), 0);\ CmdQueLen--; \ } else { \ unsigned long temp; \ - temp = MMIO_IN32(pSiS->IOBase, BR(16)); \ + temp = SIS_MMIO_IN32(pSiS->IOBase, BR(16)); \ (void) temp; \ } \ /* Line */ #define SiSSetupX0Y0(x,y) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, BR(2), (y)<<16 | (x) );\ + SIS_MMIO_OUT32(pSiS->IOBase, BR(2), (y)<<16 | (x) );\ CmdQueLen--; #define SiSSetupX1Y1(x,y) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, BR(3), (y)<<16 | (x) );\ + SIS_MMIO_OUT32(pSiS->IOBase, BR(3), (y)<<16 | (x) );\ CmdQueLen--; #define SiSSetupLineCount(c) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT16(pSiS->IOBase, BR(6), c);\ + SIS_MMIO_OUT16(pSiS->IOBase, BR(6), c);\ CmdQueLen--; #define SiSSetupStylePeriod(p) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT16(pSiS->IOBase, BR(6)+2, p);\ + SIS_MMIO_OUT16(pSiS->IOBase, BR(6)+2, p);\ CmdQueLen--; #define SiSSetupStyleLow(ls) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, BR(11), ls);\ + SIS_MMIO_OUT32(pSiS->IOBase, BR(11), ls);\ CmdQueLen--; #define SiSSetupStyleHigh(ls) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, BR(12), ls);\ + SIS_MMIO_OUT32(pSiS->IOBase, BR(12), ls);\ CmdQueLen--; /* Trapezoid */ #define SiSSetupYH(y,h) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, 0x8208, (y)<<16 | (h) );\ + SIS_MMIO_OUT32(pSiS->IOBase, 0x8208, (y)<<16 | (h) );\ CmdQueLen--; #define SiSSetupLR(left,right) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, 0x820C, (right)<<16 | (left) );\ + SIS_MMIO_OUT32(pSiS->IOBase, 0x820C, (right)<<16 | (left) );\ CmdQueLen--; #define SiSSetupdL(dxL,dyL) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, 0x8244, (dyL)<<16 | (dxL) );\ + SIS_MMIO_OUT32(pSiS->IOBase, 0x8244, (dyL)<<16 | (dxL) );\ CmdQueLen--; #define SiSSetupdR(dxR,dyR) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, 0x8248, (dyR)<<16 | (dxR) );\ + SIS_MMIO_OUT32(pSiS->IOBase, 0x8248, (dyR)<<16 | (dxR) );\ CmdQueLen--; #define SiSSetupEL(eL) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, 0x824C, eL);\ + SIS_MMIO_OUT32(pSiS->IOBase, 0x824C, eL);\ CmdQueLen--; #define SiSSetupER(eR) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, 0x8250, eR);\ + SIS_MMIO_OUT32(pSiS->IOBase, 0x8250, eR);\ CmdQueLen--; /* Set Pattern register */ #define SiSSetPattern(num, value) \ if (CmdQueLen <= 0) SiSIdle; \ - MMIO_OUT32(pSiS->IOBase, (PATTERN_REG + (num * 4)), value); \ + SIS_MMIO_OUT32(pSiS->IOBase, (PATTERN_REG + (num * 4)), value); \ CmdQueLen--; @@ -1179,7 +1179,7 @@ #define SiSWait3DCmdQueue(wLen)\ do{ \ while ( CmdQueLen < (int)(wLen)) { \ - CmdQueLen = (MMIO_IN16(pSiS->IOBase, 0x8240) & pSiS->CmdQueLenMask) - pSiS->CmdQueLenFix; \ + CmdQueLen = (SIS_MMIO_IN16(pSiS->IOBase, 0x8240) & pSiS->CmdQueLenMask) - pSiS->CmdQueLenFix; \ } \ CmdQueLen -= (int)(wLen); \ } while(0) diff --git a/src/sis310_accel.c b/src/sis310_accel.c index 0b98b00..1c27c3a 100644 --- a/src/sis310_accel.c +++ b/src/sis310_accel.c @@ -3,7 +3,7 @@ /* * 2D Acceleration for SiS 315 and 330 series * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -35,9 +35,10 @@ */ #include "sis.h" - +#define SIS_NEED_MYMMIO +#define SIS_NEED_ACCELBUF +#include "sis_regs.h" #include "xaarop.h" - #include "sis310_accel.h" #if 0 @@ -231,6 +232,10 @@ static CARD32 SiSDstTextureFormats32[3] = { PICT_x8r8g8b8, PICT_a8r8g8b8, 0 }; static void SiSRestoreAccelState(ScrnInfoPtr pScrn); #endif +#ifdef INCL_YUV_BLIT_ADAPTOR +void SISWriteBlitPacket(SISPtr pSiS, CARD32 *packet); +#endif + extern unsigned char SiSGetCopyROP(int rop); extern unsigned char SiSGetPatternROP(int rop); @@ -1452,7 +1457,7 @@ SiSSubsequentScanlineCPUToScreenColorExpandFill( #endif #ifndef SISVRAMQ - if((MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) { + if((SIS_MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) { SiSIdle; } #endif @@ -1493,7 +1498,7 @@ SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) #endif #ifndef SISVRAMQ - if((MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) { + if((SIS_MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) { SiSIdle; } #endif @@ -2053,3 +2058,19 @@ SiSSubsequentCPUToScreenTexture(ScrnInfoPtr pScrn, #endif #endif +/* Helper for xv video blitter */ +#ifdef INCL_YUV_BLIT_ADAPTOR +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]); + SiSWritePacketPart(packet[12], packet[13], packet[14], packet[15]); + SiSWritePacketPart(packet[16], packet[17], packet[18], packet[19]); + SiSSyncWP; + (void)dummybuf; /* Suppress compiler warning */ +} +#endif diff --git a/src/sis310_accel.h b/src/sis310_accel.h index 919f34a..a0d4b23 100644 --- a/src/sis310_accel.h +++ b/src/sis310_accel.h @@ -4,7 +4,7 @@ * 2D Acceleration for SiS 315 and Xabre series * Definitions for the SIS engine communication. * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -211,8 +211,8 @@ #define SiSQEmpty \ { \ - while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x0400) != 0x0400) {}; \ - while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x0400) != 0x0400) {}; \ + while( (SIS_MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x0400) != 0x0400) {}; \ + while( (SIS_MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x0400) != 0x0400) {}; \ } #define SiSResetCmd pSiS->CommandReg = 0; @@ -222,22 +222,22 @@ /* --- VRAM mode --- */ #define SiSGetSwWP() (CARD32)(*(pSiS->cmdQ_SharedWritePort)) -#define SiSGetHwRP() (CARD32)(MMIO_IN32(pSiS->IOBase, Q_READ_PTR)) +#define SiSGetHwRP() (CARD32)(SIS_MMIO_IN32(pSiS->IOBase, Q_READ_PTR)) #define SiSFlushCmdBuf \ if(pSiS->NeedFlush) { \ CARD32 ttt = ((SiSGetSwWP()) - 4) & pSiS->cmdQueueSizeMask; \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - dummybuf = ((volatile CARD32 *)(tt))[0]; \ + dummybuf = SIS_RQINDEX(0); \ } #define SiSSyncWP \ SiSFlushCmdBuf; \ - 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); \ - MMIO_OUT32(pSiS->IOBase, Q_WRITE_PTR, (p)); + SIS_MMIO_OUT32(pSiS->IOBase, Q_WRITE_PTR, (p)); #define SiSSetSwWP(p) *(pSiS->cmdQ_SharedWritePort) = (p); @@ -248,12 +248,12 @@ CARD32 mcurrent, i=0, ttt = SiSGetSwWP(); \ if((ttt + amount) >= pSiS->cmdQueueSize) { \ do { \ - mcurrent = MMIO_IN32(pSiS->IOBase, Q_READ_PTR); \ + mcurrent = SIS_MMIO_IN32(pSiS->IOBase, Q_READ_PTR); \ i++; \ } while((mcurrent > ttt) || (mcurrent < ((ttt + amount) & pSiS->cmdQueueSizeMask))); \ } else { \ do { \ - mcurrent = MMIO_IN32(pSiS->IOBase, Q_READ_PTR); \ + mcurrent = SIS_MMIO_IN32(pSiS->IOBase, Q_READ_PTR); \ i++; \ } while((mcurrent > ttt) && (mcurrent < (ttt + amount))); \ } \ @@ -261,28 +261,29 @@ #endif #define SiSUpdateQueue \ + SiSWriteQueue(tt); \ ttt += 16; \ ttt &= pSiS->cmdQueueSizeMask; \ if(!ttt) { \ - while(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; \ do { \ - temppp = MMIO_IN32(pSiS->IOBase, Q_READ_PTR); \ + temppp = SIS_MMIO_IN32(pSiS->IOBase, Q_READ_PTR); \ } while(temppp >= ttt && temppp <= pSiS->cmdQueueSize_div2); \ } else if(ttt == pSiS->cmdQueueSize_div2) { \ CARD32 temppp; \ do { \ - temppp = MMIO_IN32(pSiS->IOBase, Q_READ_PTR); \ + 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(MMIO_IN32(pSiS->IOBase, Q_READ_PTR) > ttt) {} \ + while(SIS_MMIO_IN32(pSiS->IOBase, Q_READ_PTR) > ttt) {} \ } /* Write-updates MUST be 128bit aligned. */ #define SiSNILandUpdateSWQueue \ - ((CARD32 *)(tt))[2] = (CARD32)(SIS_NIL_CMD); \ - ((CARD32 *)(tt))[3] = (CARD32)(SIS_NIL_CMD); \ + SIS_WQINDEX(2) = (CARD32)(SIS_NIL_CMD); \ + SIS_WQINDEX(3) = (CARD32)(SIS_NIL_CMD); \ SiSUpdateQueue; \ SiSSetSwWP(ttt); @@ -290,18 +291,18 @@ #define SiSIdle \ { \ - while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) {}; \ - while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) {}; \ + while( (SIS_MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) {}; \ + while( (SIS_MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) {}; \ } #define SiSSetupSRCDSTBase(srcbase,dstbase) \ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + SRC_ADDR); \ - ((CARD32 *)(tt))[1] = (CARD32)(srcbase); \ - ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + DST_ADDR); \ - ((CARD32 *)(tt))[3] = (CARD32)(dstbase); \ + 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 \ SiSSetSwWP(ttt); \ } @@ -310,10 +311,10 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + SRC_Y); \ - ((CARD32 *)(tt))[1] = (CARD32)(((sx)<<16) | (sy)); \ - ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + DST_Y); \ - ((CARD32 *)(tt))[3] = (CARD32)(((dx)<<16) | (dy)); \ + 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)); \ SiSUpdateQueue \ SiSSetSwWP(ttt); \ } @@ -322,10 +323,10 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + DST_Y); \ - ((CARD32 *)(tt))[1] = (CARD32)(((x)<<16) | (y)); \ - ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + RECT_WIDTH); \ - ((CARD32 *)(tt))[3] = (CARD32)(((h)<<16) | (w)); \ + 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 \ SiSSetSwWP(ttt); \ } @@ -334,10 +335,10 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + SRC_PITCH); \ - ((CARD32 *)(tt))[1] = (CARD32)(pitch); \ - ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + DST_PITCH); \ - ((CARD32 *)(tt))[3] = (CARD32)(((y)<<16) | (x)); \ + 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)); \ SiSUpdateQueue \ SiSSetSwWP(ttt); \ } @@ -346,8 +347,8 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + SRC_ADDR); \ - ((CARD32 *)(tt))[1] = (CARD32)(base); \ + SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + SRC_ADDR); \ + SIS_WQINDEX(1) = (CARD32)(base); \ SiSNILandUpdateSWQueue \ } @@ -355,8 +356,8 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + SRC_PITCH); \ - ((CARD32 *)(tt))[1] = (CARD32)(pitch); \ + SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + SRC_PITCH); \ + SIS_WQINDEX(1) = (CARD32)(pitch); \ SiSNILandUpdateSWQueue \ } @@ -364,8 +365,8 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + SRC_Y); \ - ((CARD32 *)(tt))[1] = (CARD32)(((x)<<16) | (y)); \ + SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + SRC_Y); \ + SIS_WQINDEX(1) = (CARD32)(((x)<<16) | (y)); \ SiSNILandUpdateSWQueue \ } @@ -373,8 +374,8 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + DST_ADDR); \ - ((CARD32 *)(tt))[1] = (CARD32)(base); \ + SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + DST_ADDR); \ + SIS_WQINDEX(1) = (CARD32)(base); \ SiSNILandUpdateSWQueue \ } @@ -382,8 +383,8 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + DST_Y); \ - ((CARD32 *)(tt))[1] = (CARD32)(((x)<<16) | (y)); \ + SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + DST_Y); \ + SIS_WQINDEX(1) = (CARD32)(((x)<<16) | (y)); \ SiSNILandUpdateSWQueue \ } @@ -391,8 +392,8 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + DST_PITCH); \ - ((CARD32 *)(tt))[1] = (CARD32)(((y)<<16) | (x)); \ + SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + DST_PITCH); \ + SIS_WQINDEX(1) = (CARD32)(((y)<<16) | (x)); \ SiSNILandUpdateSWQueue \ } @@ -400,10 +401,10 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + DST_PITCH); \ - ((CARD32 *)(tt))[1] = (CARD32)(((y)<<16) | (x)); \ - ((CARD32 *)(tt))[2] = (CARD32)(SIS_BURST_HEADER0 + reg); \ - ((CARD32 *)(tt))[3] = (CARD32)(SIS_BURST_HEADER1 + num); \ + SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + DST_PITCH); \ + SIS_WQINDEX(1) = (CARD32)(((y)<<16) | (x)); \ + SIS_WQINDEX(2) = (CARD32)(SIS_BURST_HEADER0 + reg); \ + SIS_WQINDEX(3) = (CARD32)(SIS_BURST_HEADER1 + num); \ SiSUpdateQueue \ SiSSetSwWP(ttt); \ } @@ -415,10 +416,10 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + PAT_FGCOLOR); \ - ((CARD32 *)(tt))[1] = (CARD32)(color); \ - ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + DST_PITCH); \ - ((CARD32 *)(tt))[3] = (CARD32)(((y)<<16) | (x)); \ + 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 \ SiSSetSwWP(ttt); \ } @@ -427,10 +428,10 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + SRC_FGCOLOR); \ - ((CARD32 *)(tt))[1] = (CARD32)(color); \ - ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + DST_PITCH); \ - ((CARD32 *)(tt))[3] = (CARD32)(((y)<<16) | (x)); \ + 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 \ SiSSetSwWP(ttt); \ } @@ -439,10 +440,10 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + RECT_WIDTH); \ - ((CARD32 *)(tt))[1] = (CARD32)(((h)<<16) | (w)); \ - ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + SRC_PITCH); \ - ((CARD32 *)(tt))[3] = (CARD32)(pitch); \ + 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 \ SiSSetSwWP(ttt); \ } @@ -451,8 +452,8 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + RECT_WIDTH); \ - ((CARD32 *)(tt))[1] = (CARD32)(((h)<<16) | (w)); \ + SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + RECT_WIDTH); \ + SIS_WQINDEX(1) = (CARD32)(((h)<<16) | (w)); \ SiSNILandUpdateSWQueue \ } @@ -460,8 +461,8 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + PAT_FGCOLOR); \ - ((CARD32 *)(tt))[1] = (CARD32)(color); \ + SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + PAT_FGCOLOR); \ + SIS_WQINDEX(1) = (CARD32)(color); \ SiSNILandUpdateSWQueue \ } @@ -469,8 +470,8 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + PAT_BGCOLOR); \ - ((CARD32 *)(tt))[1] = (CARD32)(color); \ + SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + PAT_BGCOLOR); \ + SIS_WQINDEX(1) = (CARD32)(color); \ SiSNILandUpdateSWQueue \ } @@ -478,8 +479,8 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + SRC_FGCOLOR); \ - ((CARD32 *)(tt))[1] = (CARD32)(color); \ + SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + SRC_FGCOLOR); \ + SIS_WQINDEX(1) = (CARD32)(color); \ SiSNILandUpdateSWQueue \ } @@ -487,8 +488,8 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + SRC_BGCOLOR); \ - ((CARD32 *)(tt))[1] = (CARD32)(color); \ + SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + SRC_BGCOLOR); \ + SIS_WQINDEX(1) = (CARD32)(color); \ SiSNILandUpdateSWQueue \ } @@ -496,10 +497,10 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + TRANS_SRC_KEY_HIGH); \ - ((CARD32 *)(tt))[1] = (CARD32)(color); \ - ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + TRANS_SRC_KEY_LOW); \ - ((CARD32 *)(tt))[3] = (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 \ SiSSetSwWP(ttt); \ } @@ -508,10 +509,10 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + TRANS_DST_KEY_HIGH); \ - ((CARD32 *)(tt))[1] = (CARD32)(color); \ - ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + TRANS_DST_KEY_LOW); \ - ((CARD32 *)(tt))[3] = (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 \ SiSSetSwWP(ttt); \ } @@ -520,10 +521,10 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + MONO_MASK); \ - ((CARD32 *)(tt))[1] = (CARD32)(p0); \ - ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + MONO_MASK + 4); \ - ((CARD32 *)(tt))[3] = (CARD32)(p1); \ + 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 \ SiSSetSwWP(ttt); \ } @@ -532,10 +533,10 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + LEFT_CLIP); \ - ((CARD32 *)(tt))[1] = (CARD32)(((left) & 0xFFFF) | ((top)<<16)); \ - ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + RIGHT_CLIP); \ - ((CARD32 *)(tt))[3] = (CARD32)(((right) & 0xFFFF)|((bottom)<<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 \ SiSSetSwWP(ttt); \ } @@ -544,11 +545,11 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + DST_ADDR); \ - ((CARD32 *)(tt))[1] = (CARD32)(base); \ - ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + COMMAND_READY); \ - ((CARD32 *)(tt))[3] = (CARD32)(pSiS->CommandReg); \ - if(pSiS->NeedFlush) dummybuf = ((volatile CARD32 *)(tt))[3]; \ + 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); \ + if(pSiS->NeedFlush) dummybuf = SIS_RQINDEX(3); \ SiSUpdateQueue \ SiSSetHwWP(ttt); \ } @@ -557,11 +558,11 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + RECT_WIDTH); \ - ((CARD32 *)(tt))[1] = (CARD32)(((h)<<16) | (w)); \ - ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + COMMAND_READY); \ - ((CARD32 *)(tt))[3] = (CARD32)(pSiS->CommandReg); \ - if(pSiS->NeedFlush) dummybuf = ((volatile CARD32 *)(tt))[3]; \ + 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); \ + if(pSiS->NeedFlush) dummybuf = SIS_RQINDEX(3); \ SiSUpdateQueue \ SiSSetHwWP(ttt); \ } @@ -573,11 +574,11 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + COMMAND_READY); \ - ((CARD32 *)(tt))[1] = (CARD32)(pSiS->CommandReg); \ - ((CARD32 *)(tt))[2] = (CARD32)(SIS_NIL_CMD); \ - ((CARD32 *)(tt))[3] = (CARD32)(SIS_NIL_CMD); \ - if(pSiS->NeedFlush) dummybuf = ((volatile CARD32 *)(tt))[3]; \ + 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); \ + if(pSiS->NeedFlush) dummybuf = SIS_RQINDEX(3); \ SiSUpdateQueue \ SiSSetHwWP(ttt); \ } @@ -588,10 +589,10 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + LINE_X0); \ - ((CARD32 *)(tt))[1] = (CARD32)(((y1)<<16) | (x1)); \ - ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + LINE_X1); \ - ((CARD32 *)(tt))[3] = (CARD32)(((y2)<<16) | (x2)); \ + 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 \ SiSSetSwWP(ttt); \ } @@ -600,8 +601,8 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + LINE_X0); \ - ((CARD32 *)(tt))[1] = (CARD32)(((y)<<16) | (x)); \ + SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + LINE_X0); \ + SIS_WQINDEX(1) = (CARD32)(((y)<<16) | (x)); \ SiSNILandUpdateSWQueue \ } @@ -609,8 +610,8 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + LINE_X1); \ - ((CARD32 *)(tt))[1] = (CARD32)(((y)<<16) | (x)); \ + SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + LINE_X1); \ + SIS_WQINDEX(1) = (CARD32)(((y)<<16) | (x)); \ SiSNILandUpdateSWQueue \ } @@ -618,8 +619,8 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + LINE_COUNT); \ - ((CARD32 *)(tt))[1] = (CARD32)(((p) << 16) | (c)); \ + SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + LINE_COUNT); \ + SIS_WQINDEX(1) = (CARD32)(((p) << 16) | (c)); \ SiSNILandUpdateSWQueue \ } @@ -627,10 +628,10 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + LINE_STYLE_0); \ - ((CARD32 *)(tt))[1] = (CARD32)(ls); \ - ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + LINE_STYLE_1); \ - ((CARD32 *)(tt))[3] = (CARD32)(hs); \ + 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 \ SiSSetSwWP(ttt); \ } @@ -641,10 +642,10 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + TRAP_YH); \ - ((CARD32 *)(tt))[1] = (CARD32)(((y)<<16) | (h)); \ - ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + TRAP_LR); \ - ((CARD32 *)(tt))[3] = (CARD32)(((right)<<16) | (left)); \ + 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 \ SiSSetSwWP(ttt); \ } @@ -654,10 +655,10 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + TRAP_DL); \ - ((CARD32 *)(tt))[1] = (CARD32)(((dyL)<<16) | (dxL)); \ - ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + TRAP_DR); \ - ((CARD32 *)(tt))[3] = (CARD32)(((dyR)<<16) | (dxR)); \ + 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 \ SiSSetSwWP(ttt); \ } @@ -666,10 +667,10 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + TRAP_EL); \ - ((CARD32 *)(tt))[1] = (CARD32)(eL); \ - ((CARD32 *)(tt))[2] = (CARD32)(SIS_SPKC_HEADER + TRAP_ER); \ - ((CARD32 *)(tt))[3] = (CARD32)(eR); \ + 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 \ SiSSetSwWP(ttt); \ } @@ -680,8 +681,8 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + ALPHA_ALPHA); \ - ((CARD32 *)(tt))[1] = (CARD32)(alpha); \ + SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + ALPHA_ALPHA); \ + SIS_WQINDEX(1) = (CARD32)(alpha); \ SiSNILandUpdateSWQueue \ } @@ -689,8 +690,8 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(SIS_SPKC_HEADER + (PATTERN_REG + (num * 4))); \ - ((CARD32 *)(tt))[1] = (CARD32)(value); \ + SIS_WQINDEX(0) = (CARD32)(SIS_SPKC_HEADER + (PATTERN_REG + (num * 4))); \ + SIS_WQINDEX(1) = (CARD32)(value); \ SiSNILandUpdateSWQueue \ } @@ -698,10 +699,10 @@ { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(pat1); \ - ((CARD32 *)(tt))[1] = (CARD32)(pat2); \ - ((CARD32 *)(tt))[2] = (CARD32)(pat3); \ - ((CARD32 *)(tt))[3] = (CARD32)(pat4); \ + SIS_WQINDEX(0) = (CARD32)(pat1); \ + SIS_WQINDEX(1) = (CARD32)(pat2); \ + SIS_WQINDEX(2) = (CARD32)(pat3); \ + SIS_WQINDEX(3) = (CARD32)(pat4); \ SiSUpdateQueue \ SiSSetSwWP(ttt); \ } @@ -741,10 +742,10 @@ typedef struct _SiS_Packet12_YUV { { \ CARD32 ttt = SiSGetSwWP(); \ pointer tt = (char *)pSiS->cmdQueueBase + ttt; \ - ((CARD32 *)(tt))[0] = (CARD32)(part1); \ - ((CARD32 *)(tt))[1] = (CARD32)(part2); \ - ((CARD32 *)(tt))[2] = (CARD32)(part3); \ - ((CARD32 *)(tt))[3] = (CARD32)(part4); \ + SIS_WQINDEX(0) = (CARD32)(part1); \ + SIS_WQINDEX(1) = (CARD32)(part2); \ + SIS_WQINDEX(2) = (CARD32)(part3); \ + SIS_WQINDEX(3) = (CARD32)(part4); \ SiSUpdateQueue \ SiSSetSwWP(ttt); \ } @@ -773,96 +774,96 @@ typedef struct _SiS_Packet12_YUV { } else { \ CmdQueLen = ((512 * 1024) / 4) - 64; \ } \ - while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) {}; \ - while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) {}; \ + while( (SIS_MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) {}; \ + while( (SIS_MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) {}; \ } #define SiSSetupSRCBase(base) \ if (CmdQueLen <= 0) SiSIdle; \ - MMIO_OUT32(pSiS->IOBase, SRC_ADDR, base); \ + SIS_MMIO_OUT32(pSiS->IOBase, SRC_ADDR, base); \ CmdQueLen--; #define SiSSetupSRCPitch(pitch) \ if (CmdQueLen <= 0) SiSIdle; \ - MMIO_OUT16(pSiS->IOBase, SRC_PITCH, pitch); \ + SIS_MMIO_OUT16(pSiS->IOBase, SRC_PITCH, pitch); \ CmdQueLen--; #define SiSSetupSRCXY(x,y) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, SRC_Y, (x)<<16 | (y) );\ + SIS_MMIO_OUT32(pSiS->IOBase, SRC_Y, (x)<<16 | (y) );\ CmdQueLen--; #define SiSSetupDSTBase(base) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, DST_ADDR, base);\ + SIS_MMIO_OUT32(pSiS->IOBase, DST_ADDR, base);\ CmdQueLen--; #define SiSSetupDSTXY(x,y) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, DST_Y, (x)<<16 | (y) );\ + SIS_MMIO_OUT32(pSiS->IOBase, DST_Y, (x)<<16 | (y) );\ CmdQueLen--; #define SiSSetupDSTRect(x,y) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, DST_PITCH, (y)<<16 | (x) );\ + SIS_MMIO_OUT32(pSiS->IOBase, DST_PITCH, (y)<<16 | (x) );\ CmdQueLen--; #define SiSSetupDSTColorDepth(bpp) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT16(pSiS->IOBase, AGP_BASE, bpp);\ + SIS_MMIO_OUT16(pSiS->IOBase, AGP_BASE, bpp);\ CmdQueLen--; #define SiSSetupRect(w,h) \ if(CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, RECT_WIDTH, (h)<<16 | (w) );\ + SIS_MMIO_OUT32(pSiS->IOBase, RECT_WIDTH, (h)<<16 | (w) );\ CmdQueLen--; #define SiSSetupPATFG(color) \ if(CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, PAT_FGCOLOR, color);\ + SIS_MMIO_OUT32(pSiS->IOBase, PAT_FGCOLOR, color);\ CmdQueLen--; #define SiSSetupPATBG(color) \ if(CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, PAT_BGCOLOR, color);\ + SIS_MMIO_OUT32(pSiS->IOBase, PAT_BGCOLOR, color);\ CmdQueLen--; #define SiSSetupSRCFG(color) \ if(CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, SRC_FGCOLOR, color);\ + SIS_MMIO_OUT32(pSiS->IOBase, SRC_FGCOLOR, color);\ CmdQueLen--; #define SiSSetupSRCBG(color) \ if(CmdQueLen <= 0) SiSIdle; \ - MMIO_OUT32(pSiS->IOBase, SRC_BGCOLOR, color); \ + SIS_MMIO_OUT32(pSiS->IOBase, SRC_BGCOLOR, color); \ CmdQueLen--; #define SiSSetupSRCTrans(color) \ if(CmdQueLen <= 1) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, TRANS_SRC_KEY_HIGH, color);\ - MMIO_OUT32(pSiS->IOBase, TRANS_SRC_KEY_LOW, color);\ + SIS_MMIO_OUT32(pSiS->IOBase, TRANS_SRC_KEY_HIGH, color);\ + SIS_MMIO_OUT32(pSiS->IOBase, TRANS_SRC_KEY_LOW, color);\ CmdQueLen -= 2; #define SiSSetupDSTTrans(color) \ if(CmdQueLen <= 1) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, TRANS_DST_KEY_HIGH, color); \ - MMIO_OUT32(pSiS->IOBase, TRANS_DST_KEY_LOW, color); \ + SIS_MMIO_OUT32(pSiS->IOBase, TRANS_DST_KEY_HIGH, color); \ + SIS_MMIO_OUT32(pSiS->IOBase, TRANS_DST_KEY_LOW, color); \ CmdQueLen -= 2; #define SiSSetupMONOPAT(p0,p1) \ if(CmdQueLen <= 1) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, MONO_MASK, p0);\ - MMIO_OUT32(pSiS->IOBase, MONO_MASK+4, p1);\ + SIS_MMIO_OUT32(pSiS->IOBase, MONO_MASK, p0);\ + SIS_MMIO_OUT32(pSiS->IOBase, MONO_MASK+4, p1);\ CmdQueLen=CmdQueLen-2; #define SiSSetupClipLT(left,top) \ if(CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, LEFT_CLIP, ((left) & 0xFFFF) | (top)<<16); \ + SIS_MMIO_OUT32(pSiS->IOBase, LEFT_CLIP, ((left) & 0xFFFF) | (top)<<16); \ CmdQueLen--; #define SiSSetupClipRB(right,bottom) \ if(CmdQueLen <= 0) SiSIdle; \ - MMIO_OUT32(pSiS->IOBase, RIGHT_CLIP, ((right) & 0xFFFF) | (bottom)<<16); \ + SIS_MMIO_OUT32(pSiS->IOBase, RIGHT_CLIP, ((right) & 0xFFFF) | (bottom)<<16); \ CmdQueLen--; #define SiSSetupROP(rop) \ @@ -870,86 +871,86 @@ typedef struct _SiS_Packet12_YUV { #define SiSDoCMD \ if (CmdQueLen <= 1) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, COMMAND_READY, pSiS->CommandReg); \ - MMIO_OUT32(pSiS->IOBase, FIRE_TRIGGER, 0); \ + SIS_MMIO_OUT32(pSiS->IOBase, COMMAND_READY, pSiS->CommandReg); \ + SIS_MMIO_OUT32(pSiS->IOBase, FIRE_TRIGGER, 0); \ CmdQueLen -= 2; /* Line */ #define SiSSetupX0Y0(x,y) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, LINE_X0, (y)<<16 | (x) );\ + SIS_MMIO_OUT32(pSiS->IOBase, LINE_X0, (y)<<16 | (x) );\ CmdQueLen--; #define SiSSetupX1Y1(x,y) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, LINE_X1, (y)<<16 | (x) );\ + SIS_MMIO_OUT32(pSiS->IOBase, LINE_X1, (y)<<16 | (x) );\ CmdQueLen--; #define SiSSetupLineCount(c) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT16(pSiS->IOBase, LINE_COUNT, c);\ + SIS_MMIO_OUT16(pSiS->IOBase, LINE_COUNT, c);\ CmdQueLen--; #define SiSSetupStylePeriod(p) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT16(pSiS->IOBase, LINE_STYLE_PERIOD, p);\ + SIS_MMIO_OUT16(pSiS->IOBase, LINE_STYLE_PERIOD, p);\ CmdQueLen--; #define SiSSetupStyleLow(ls) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, LINE_STYLE_0, ls);\ + SIS_MMIO_OUT32(pSiS->IOBase, LINE_STYLE_0, ls);\ CmdQueLen--; #define SiSSetupStyleHigh(ls) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, LINE_STYLE_1, ls);\ + SIS_MMIO_OUT32(pSiS->IOBase, LINE_STYLE_1, ls);\ CmdQueLen--; /* Trapezoid */ #define SiSSetupYH(y,h) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, TRAP_YH, (y)<<16 | (h) );\ + SIS_MMIO_OUT32(pSiS->IOBase, TRAP_YH, (y)<<16 | (h) );\ CmdQueLen--; #define SiSSetupLR(left,right) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, TRAP_LR, (right)<<16 | (left) );\ + SIS_MMIO_OUT32(pSiS->IOBase, TRAP_LR, (right)<<16 | (left) );\ CmdQueLen--; #define SiSSetupdL(dxL,dyL) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, TRAP_DL, (dyL)<<16 | (dxL) );\ + SIS_MMIO_OUT32(pSiS->IOBase, TRAP_DL, (dyL)<<16 | (dxL) );\ CmdQueLen--; #define SiSSetupdR(dxR,dyR) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, TRAP_DR, (dyR)<<16 | (dxR) );\ + SIS_MMIO_OUT32(pSiS->IOBase, TRAP_DR, (dyR)<<16 | (dxR) );\ CmdQueLen--; #define SiSSetupEL(eL) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, TRAP_EL, eL);\ + SIS_MMIO_OUT32(pSiS->IOBase, TRAP_EL, eL);\ CmdQueLen--; #define SiSSetupER(eR) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, TRAP_ER, eR);\ + SIS_MMIO_OUT32(pSiS->IOBase, TRAP_ER, eR);\ CmdQueLen--; /* (Constant) alpha blended BitBlt (alpha = 8 bit) */ #define SiSSetupAlpha(alpha) \ if (CmdQueLen <= 0) SiSIdle;\ - MMIO_OUT32(pSiS->IOBase, ALPHA_ALPHA, alpha);\ + SIS_MMIO_OUT32(pSiS->IOBase, ALPHA_ALPHA, alpha);\ CmdQueLen--; /* Set Pattern register */ #define SiSSetPattern(num, value) \ if (CmdQueLen <= 0) SiSIdle; \ - MMIO_OUT32(pSiS->IOBase, (PATTERN_REG + (num * 4)), value); \ + SIS_MMIO_OUT32(pSiS->IOBase, (PATTERN_REG + (num * 4)), value); \ CmdQueLen--; #endif /* MMIO mode */ diff --git a/src/sis6326_video.c b/src/sis6326_video.c index b440eda..e144c53 100644 --- a/src/sis6326_video.c +++ b/src/sis6326_video.c @@ -3,7 +3,7 @@ /* * Xv driver for SiS 5597/5598, 6236 and 530/620. * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria. + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,10 +37,13 @@ #include "xf86xv.h" #include "regionstr.h" #include "Xv.h" -#include "xaa.h" #include "dixstruct.h" #include "fourcc.h" +#define SIS_NEED_inSISREG +#define SIS_NEED_outSISREG +#define SIS_NEED_inSISIDXREG +#define SIS_NEED_outSISIDXREG #include "sis_regs.h" #define OFF_DELAY 200 /* milliseconds */ @@ -147,19 +150,15 @@ static CARD32 get_scanline_CRT1(SISPtr pSiS) void SIS6326InitVideo(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - SISPtr pSiS = SISPTR(pScrn); XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; XF86VideoAdaptorPtr newAdaptor = NULL; int num_adaptors; - - if(!pSiS->SiSFastVidCopy) { - pSiS->SiSFastVidCopy = SiSVidCopyInit(pScreen); - } newAdaptor = SIS6326SetupImageVideo(pScreen); - if(newAdaptor) + if(newAdaptor) { SIS6326InitOffscreenImages(pScreen); - + } + num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); if(newAdaptor) { @@ -1338,11 +1337,7 @@ SIS6326PutImage( /* copy data */ if((pSiS->XvUseMemcpy) || (totalSize < 16)) { - if((totalSize < 64) || (!pSiS->SiSFastVidCopy)) { - memcpy(pSiS->FbBase + pPriv->bufAddr[pPriv->currentBuf], buf, totalSize); - } else { - (*pSiS->SiSFastVidCopy)(pSiS->FbBase + pPriv->bufAddr[pPriv->currentBuf], buf, totalSize); - } + SiSMemCopyToVideoRam(pSiS, pSiS->FbBase + pPriv->bufAddr[pPriv->currentBuf], buf, totalSize); } else { dest = (CARD32 *)(pSiS->FbBase + pPriv->bufAddr[pPriv->currentBuf]); src = (CARD32 *)buf; @@ -1445,7 +1440,7 @@ SIS6326QueryImageAttributes( } static void -SIS6326VideoTimerCallback (ScrnInfoPtr pScrn, Time now) +SIS6326VideoTimerCallback(ScrnInfoPtr pScrn, Time now) { SISPtr pSiS = SISPTR(pScrn); SISPortPrivPtr pPriv = NULL; @@ -1678,3 +1673,5 @@ SIS6326InitOffscreenImages(ScreenPtr pScrn) } + + diff --git a/src/sis_accel.c b/src/sis_accel.c index ec36d77..5375e2e 100644 --- a/src/sis_accel.c +++ b/src/sis_accel.c @@ -4,7 +4,7 @@ * 2D acceleration for SiS5597/5598 and 6326 * * Copyright (C) 1998, 1999 by Alan Hourihane, Wigan, England. - * Parts Copyright (C) 2001-2004 Thomas Winischhofer, Vienna, Austria. + * Parts Copyright (C) 2001-2005 Thomas Winischhofer, Vienna, Austria. * * Licensed under the following terms: * @@ -34,14 +34,16 @@ * Thomas Winischhofer . */ +#include "sis.h" +#include "sis_regs.h" + +#include "xaarop.h" +#include "sis_accel.h" + #if 0 #define CTSCE /* Include enhanced color expansion code */ #endif /* This produces drawing errors sometimes */ -#include "sis.h" -#include "xaarop.h" -#include "sis_accel.h" - static void SiSSync(ScrnInfoPtr pScrn); static void SiSSetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask); @@ -234,7 +236,7 @@ SiSAccelInit(ScreenPtr pScreen) return TRUE; } else { return(XAAInit(pScreen, infoPtr)); - } + } } /* sync */ @@ -245,7 +247,8 @@ SiSSync(ScrnInfoPtr pScrn) { } /* Clipping */ -static void SiSSetClippingRectangle( ScrnInfoPtr pScrn, +static void +SiSSetClippingRectangle( ScrnInfoPtr pScrn, int left, int top, int right, int bottom) { SISPtr pSiS = SISPTR(pScrn); @@ -256,7 +259,8 @@ static void SiSSetClippingRectangle( ScrnInfoPtr pScrn, pSiS->ClipEnabled = TRUE; } -static void SiSDisableClipping(ScrnInfoPtr pScrn) +static void +SiSDisableClipping(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); pSiS->ClipEnabled = FALSE; @@ -431,7 +435,8 @@ SiSSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int patternx, } /* Line */ -static void SiSSetupForSolidLine(ScrnInfoPtr pScrn, +static void +SiSSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask) { SISPtr pSiS = SISPTR(pScrn); @@ -441,7 +446,8 @@ static void SiSSetupForSolidLine(ScrnInfoPtr pScrn, sisSETFGROPCOL(SiSGetCopyROP(rop), color); } -static void SiSSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, +static void +SiSSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int flags) { @@ -486,7 +492,8 @@ static void SiSSubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, sisSETCMD(op); } -static void SiSSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, +static void +SiSSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, int x, int y, int len, int dir) { SISPtr pSiS = SISPTR(pScrn); @@ -516,7 +523,7 @@ static void SiSSubsequentSolidHorVertLine(ScrnInfoPtr pScrn, } #ifdef CTSCE -/* TW: ----- CPU To Screen Color Expand (scanline-wise) ------ */ +/* ----- CPU To Screen Color Expand (scanline-wise) ------ */ static void SiSSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask) @@ -606,7 +613,7 @@ SiSSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) /* (needs to be done, otherwise the data in the buffer may * be overwritten while accessed by the hardware) */ - while((MMIO_IN32(pSiS->IOBase, 0x8284) & 0x80000000)) {} + while((SIS_MMIO_IN32(pSiS->IOBase, 0x8284) & 0x80000000)) {} sisBLTSync; } diff --git a/src/sis_accel.h b/src/sis_accel.h index 02638bd..1ec72be 100644 --- a/src/sis_accel.h +++ b/src/sis_accel.h @@ -5,7 +5,7 @@ * Definitions for the SIS engine communication * * Copyright (C) 1998, 1999 by Alan Hourihane, Wigan, England. - * Parts Copyright (C) 2001-2004 Thomas Winischhofer, Vienna, Austria. + * Parts Copyright (C) 2001-2005 Thomas Winischhofer, Vienna, Austria. * * Licensed under the following terms: * @@ -89,7 +89,7 @@ const int sisReg32MMIO[] = { /* Macros to do useful things with the SIS BitBLT engine */ #define sisBLTSync \ - while(MMIO_IN16(pSiS->IOBase, BR(10) + 2) & 0x4000) {} + while(SIS_MMIO_IN16(pSiS->IOBase, BR(10) + 2) & 0x4000) {} /* According to SiS 6326 2D programming guide, 16 bits position at */ /* 0x82A8 returns queue free. But this don't work, so don't wait */ @@ -102,7 +102,7 @@ const int sisReg32MMIO[] = { #define sisBLTWAIT \ if(!pSiS->TurboQueue) { \ - while(MMIO_IN16(pSiS->IOBase, BR(10) + 2) & 0x4000) {} \ + while(SIS_MMIO_IN16(pSiS->IOBase, BR(10) + 2) & 0x4000) {} \ } else { \ sisBLTSync \ } @@ -117,80 +117,80 @@ const int sisReg32MMIO[] = { #define sisSETCMD(op) \ { \ ULong temp; \ - MMIO_OUT16(pSiS->IOBase, BR(10) + 2, op); \ - temp = MMIO_IN32(pSiS->IOBase, BR(10)); \ + SIS_MMIO_OUT16(pSiS->IOBase, BR(10) + 2, op); \ + temp = SIS_MMIO_IN32(pSiS->IOBase, BR(10)); \ (void)temp; \ } /* set foreground color and fg ROP */ #define sisSETFGROPCOL(rop, color) \ - MMIO_OUT32(pSiS->IOBase, BR(4), ((rop << 24) | (color & 0xFFFFFF))); + SIS_MMIO_OUT32(pSiS->IOBase, BR(4), ((rop << 24) | (color & 0xFFFFFF))); /* set background color and bg ROP */ #define sisSETBGROPCOL(rop, color) \ - MMIO_OUT32(pSiS->IOBase, BR(5), ((rop << 24) | (color & 0xFFFFFF))); + SIS_MMIO_OUT32(pSiS->IOBase, BR(5), ((rop << 24) | (color & 0xFFFFFF))); /* background color */ #define sisSETBGCOLOR(bgColor) \ - MMIO_OUT32(pSiS->IOBase, BR(5), (bgColor)); + SIS_MMIO_OUT32(pSiS->IOBase, BR(5), (bgColor)); /* foreground color */ #define sisSETFGCOLOR(fgColor) \ - MMIO_OUT32(pSiS->IOBase, BR(4), (fgcolor)); + SIS_MMIO_OUT32(pSiS->IOBase, BR(4), (fgcolor)); /* ROP */ #define sisSETROPFG(op) \ - MMIO_OUT8(pSiS->IOBase, BR(4) + 3, op); + SIS_MMIO_OUT8(pSiS->IOBase, BR(4) + 3, op); #define sisSETROPBG(op) \ - MMIO_OUT8(pSiS->IOBase, BR(5) + 3, op); + SIS_MMIO_OUT8(pSiS->IOBase, BR(5) + 3, op); #define sisSETROP(op) \ sisSETROPFG(op); sisSETROPBG(op); /* source and dest address */ #define sisSETSRCADDR(srcAddr) \ - MMIO_OUT32(pSiS->IOBase, BR(0), (srcAddr & 0x3FFFFFL)); + SIS_MMIO_OUT32(pSiS->IOBase, BR(0), (srcAddr & 0x3FFFFFL)); #define sisSETDSTADDR(dstAddr) \ - MMIO_OUT32(pSiS->IOBase, BR(1), (dstAddr & 0x3FFFFFL)); + SIS_MMIO_OUT32(pSiS->IOBase, BR(1), (dstAddr & 0x3FFFFFL)); /* pitch */ #define sisSETPITCH(srcPitch,dstPitch) \ - MMIO_OUT32(pSiS->IOBase, BR(2), ((((dstPitch) & 0xFFFF) << 16) | ((srcPitch) & 0xFFFF))); + SIS_MMIO_OUT32(pSiS->IOBase, BR(2), ((((dstPitch) & 0xFFFF) << 16) | ((srcPitch) & 0xFFFF))); #define sisSETSRCPITCH(srcPitch) \ - MMIO_OUT16(pSiS->IOBase, BR(2), ((srcPitch) & 0xFFFF)); + SIS_MMIO_OUT16(pSiS->IOBase, BR(2), ((srcPitch) & 0xFFFF)); #define sisSETDSTPITCH(dstPitch) \ - MMIO_OUT16(pSiS->IOBase, BR(2) + 2, ((dstPitch) & 0xFFFF)); + SIS_MMIO_OUT16(pSiS->IOBase, BR(2) + 2, ((dstPitch) & 0xFFFF)); /* Height and width * According to SIS 2D Engine Programming Guide * height -1, width - 1 independant of Bpp */ #define sisSETHEIGHTWIDTH(Height, Width) \ - MMIO_OUT32(pSiS->IOBase, BR(3), ((((Height) & 0xFFFF) << 16) | ((Width) & 0xFFFF))); + SIS_MMIO_OUT32(pSiS->IOBase, BR(3), ((((Height) & 0xFFFF) << 16) | ((Width) & 0xFFFF))); /* Clipping */ #define sisSETCLIPTOP(x, y) \ - MMIO_OUT32(pSiS->IOBase, BR(8), ((((y) & 0xFFFF) << 16) | ((x) & 0xFFFF))); + SIS_MMIO_OUT32(pSiS->IOBase, BR(8), ((((y) & 0xFFFF) << 16) | ((x) & 0xFFFF))); #define sisSETCLIPBOTTOM(x, y) \ - MMIO_OUT32(pSiS->IOBase, BR(9), ((((y) & 0xFFFF) << 16) | ((x) & 0xFFFF))); + SIS_MMIO_OUT32(pSiS->IOBase, BR(9), ((((y) & 0xFFFF) << 16) | ((x) & 0xFFFF))); /* Line drawing */ #define sisSETXStart(XStart) \ - MMIO_OUT32(pSiS->IOBase, BR(0), ((XStart) & 0xFFFF)); + SIS_MMIO_OUT32(pSiS->IOBase, BR(0), ((XStart) & 0xFFFF)); #define sisSETYStart(YStart) \ - MMIO_OUT32(pSiS->IOBase, BR(1), ((YStart) & 0xFFFF)); + SIS_MMIO_OUT32(pSiS->IOBase, BR(1), ((YStart) & 0xFFFF)); #define sisSETLineMajorCount(MajorAxisCount) \ - MMIO_OUT32(pSiS->IOBase, BR(3), ((MajorAxisCount) & 0xFFFF)); + SIS_MMIO_OUT32(pSiS->IOBase, BR(3), ((MajorAxisCount) & 0xFFFF)); #define sisSETLineSteps(K1,K2) \ - MMIO_OUT32(pSiS->IOBase, BR(6), ((((K1) & 0xFFFF) << 16) | ((K2) & 0xFFFF))); + SIS_MMIO_OUT32(pSiS->IOBase, BR(6), ((((K1) & 0xFFFF) << 16) | ((K2) & 0xFFFF))); #define sisSETLineErrorTerm(ErrorTerm) \ - MMIO_OUT16(pSiS->IOBase, BR(7), (ErrorTerm)); + SIS_MMIO_OUT16(pSiS->IOBase, BR(7), (ErrorTerm)); diff --git a/src/sis_cursor.c b/src/sis_cursor.c index e4672bf..0308fe4 100644 --- a/src/sis_cursor.c +++ b/src/sis_cursor.c @@ -3,7 +3,7 @@ /* * SiS hardware cursor handling * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria. + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,15 +37,17 @@ #include "cursorstr.h" +#define SIS_NEED_inSISREG +#define SIS_NEED_outSISREG +#define SIS_NEED_inSISIDXREG +#define SIS_NEED_outSISIDXREG +#define SIS_NEED_orSISIDXREG +#define SIS_NEED_andSISIDXREG +#define SIS_NEED_MYMMIO +#define SIS_NEED_MYFBACCESS #include "sis_regs.h" #include "sis_cursor.h" -#if 0 -#define SIS300_USE_ARGB16 -#else -#undef SIS300_USE_ARGB16 -#endif - extern void SISWaitRetraceCRT1(ScrnInfoPtr pScrn); extern void SISWaitRetraceCRT2(ScrnInfoPtr pScrn); @@ -68,11 +70,12 @@ SiSXConvertMono2ARGB(SISPtr pSiS) for(i = 0; i < 64; i++) { for(j = 0; j < 8; j++) { - chunk = *(src + 8); mask = *src++; + chunk = sisfbreadb(src + 8); /* *(src + 8); */ + mask = sisfbreadbinc(src); /* *src++; */ for(k = 128; k != 0; k >>= 1) { - if(mask & k) *dest++ = 0x00000000; - else if(chunk & k) *dest++ = fg; - else *dest++ = bg; + if(mask & k) sisfbwritelinc(dest, 0x00000000); /* *dest++ = 0x00000000; */ + else if(chunk & k) sisfbwritelinc(dest, fg); /* *dest++ = fg; */ + else sisfbwritelinc(dest, bg); /* *dest++ = bg; */ } } src += 8; @@ -186,22 +189,14 @@ SiS300ShowCursor(ScrnInfoPtr pScrn) if(pSiS->SecondHead) { /* Head 2 is always CRT1 */ if(pSiS->UseHWARGBCursor) { -#ifdef SIS300_USE_ARGB16 - sis300EnableHWARGB16Cursor() -#else sis300EnableHWARGBCursor() -#endif } else { sis300EnableHWCursor() } } else { /* Head 1 is always CRT2 */ if(pSiS->UseHWARGBCursor) { -#ifdef SIS300_USE_ARGB16 - sis301EnableHWARGB16Cursor() -#else sis301EnableHWARGBCursor() -#endif } else { sis301EnableHWCursor() } @@ -209,17 +204,9 @@ SiS300ShowCursor(ScrnInfoPtr pScrn) } else { #endif if(pSiS->UseHWARGBCursor) { -#ifdef SIS300_USE_ARGB16 - sis300EnableHWARGB16Cursor() -#else sis300EnableHWARGBCursor() -#endif if(pSiS->VBFlags & CRT2_ENABLE) { -#ifdef SIS300_USE_ARGB16 - sis301EnableHWARGB16Cursor() -#else sis301EnableHWARGBCursor() -#endif } } else { sis300EnableHWCursor() @@ -510,7 +497,6 @@ SiS310SetCursorPosition(ScrnInfoPtr pScrn, int x, int y) #endif } - static void SiSSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg) { @@ -605,7 +591,7 @@ 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; @@ -638,15 +624,15 @@ SiSLoadCursorImage(ScrnInfoPtr pScrn, UChar *src) cursor_addr = pScrn->videoRam - 1; if(mode->Flags & V_DBLSCAN) { - int i; - for(i = 0; i < 32; i++) { - memcpy((UChar *)pSiS->FbBase + (cursor_addr * 1024) + (32 * i), - src + (16 * i), 16); - memcpy((UChar *)pSiS->FbBase + (cursor_addr * 1024) + (32 * i) + 16, - src + (16 * i), 16); - } + 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); + } } else { - memcpy((UChar *)pSiS->FbBase + (cursor_addr * 1024), src, 1024); + SiSMemCopyToVideoRam(pSiS, (UChar *)pSiS->FbBase + (cursor_addr * 1024), src, 1024); } /* copy bits [21:18] into the top bits of SR38 */ @@ -698,20 +684,20 @@ SiS300LoadCursorImage(ScrnInfoPtr pScrn, UChar *src) cursor_addr = pScrn->videoRam - pSiS->cursorOffset - (pSiS->CursorSize/1024); /* 1K boundary */ #ifdef SISDUALHEAD - /* TW: Use the global (real) FbBase in DHM */ + /* Use the global (real) FbBase in DHM */ if(pSiS->DualHeadMode) dest = pSiSEnt->FbBase; #endif if(sizedouble) { int i; for(i = 0; i < 32; i++) { - memcpy((UChar *)dest + (cursor_addr * 1024) + (32 * i), + SiSMemCopyToVideoRam(pSiS, (UChar *)dest + (cursor_addr * 1024) + (32 * i), src + (16 * i), 16); - memcpy((UChar *)dest + (cursor_addr * 1024) + (32 * i) + 16, + SiSMemCopyToVideoRam(pSiS, (UChar *)dest + (cursor_addr * 1024) + (32 * i) + 16, src + (16 * i), 16); } } else { - memcpy((UChar *)dest + (cursor_addr * 1024), src, 1024); + SiSMemCopyToVideoRam(pSiS, (UChar *)dest + (cursor_addr * 1024), src, 1024); } if(pSiS->UseHWARGBCursor) { @@ -795,19 +781,18 @@ SiS310LoadCursorImage(ScrnInfoPtr pScrn, UChar *src) if(sizedouble) { int i; for(i = 0; i < 32; i++) { - memcpy((UChar *)dest + (cursor_addr * 1024) + (32 * i), + SiSMemCopyToVideoRam(pSiS, (UChar *)dest + (cursor_addr * 1024) + (32 * i), src + (16 * i), 16); - memcpy((UChar *)dest + (cursor_addr * 1024) + (32 * i) + 16, + SiSMemCopyToVideoRam(pSiS, (UChar *)dest + (cursor_addr * 1024) + (32 * i) + 16, src + (16 * i), 16); } } else { - memcpy((UChar *)dest + (cursor_addr * 1024), src, 1024); + SiSMemCopyToVideoRam(pSiS, (UChar *)dest + (cursor_addr * 1024), src, 1024); } if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { /* Convert Mono image to color image */ - cursor_addr2 = pScrn->videoRam - pSiS->cursorOffset - ((pSiS->CursorSize/1024) * 2); pSiS->CurMonoSrc = (UChar *)dest + (cursor_addr * 1024); @@ -900,23 +885,24 @@ 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_DBLSCAN) && (pCurs->bits->height > 32)) - 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(mode2->Flags & V_INTERLACE) - return FALSE; - if((mode2->Flags & V_DBLSCAN) && (pCurs->bits->height > 32)) - return FALSE; - } + if(pSiS->MergedFB) { + if(mode2->Flags & V_INTERLACE) + return FALSE; + if((mode2->Flags & V_DBLSCAN) && (pCurs->bits->height > 32)) + return FALSE; + } #endif - break; + break; + case PCI_CHIP_SIS315: case PCI_CHIP_SIS315H: case PCI_CHIP_SIS315PRO: @@ -925,25 +911,26 @@ SiS300UseHWCursor(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_DBLSCAN) && (pCurs->bits->height > 32)) - 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(mode2->Flags & V_INTERLACE) - return FALSE; - if((mode2->Flags & V_DBLSCAN) && (pCurs->bits->height > 32)) - return FALSE; - } + if(pSiS->MergedFB) { + if(mode2->Flags & V_INTERLACE) + 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)) - return FALSE; - break; + if(mode->Flags & V_INTERLACE) + return FALSE; + if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32)) + return FALSE; + break; } return TRUE; } @@ -966,25 +953,26 @@ 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((pCurs->bits->height > 32) || (pCurs->bits->width > 32)) - return FALSE; - if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 16)) - 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(mode2->Flags & V_INTERLACE) - return FALSE; - if((mode2->Flags & V_DBLSCAN) && (pCurs->bits->height > 16)) - return FALSE; - } + if(pSiS->MergedFB) { + if(mode2->Flags & V_INTERLACE) + return FALSE; + if((mode2->Flags & V_DBLSCAN) && (pCurs->bits->height > 16)) + return FALSE; + } #endif - break; + break; + case PCI_CHIP_SIS550: case PCI_CHIP_SIS650: case PCI_CHIP_SIS315: @@ -993,42 +981,39 @@ 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((pCurs->bits->height > 64) || (pCurs->bits->width > 64)) - return FALSE; - if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32)) - return FALSE; - if((pSiS->CurrentLayout.bitsPerPixel == 8) && (pSiS->VBFlags & CRT2_ENABLE)) - return FALSE; + 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)) + return FALSE; + if((pSiS->CurrentLayout.bitsPerPixel == 8) && (pSiS->VBFlags & CRT2_ENABLE)) + return FALSE; #ifdef SISMERGED - if(pSiS->MergedFB) { - if(mode2->Flags & V_INTERLACE) - return FALSE; - if((mode->Flags & V_DBLSCAN) && (pCurs->bits->height > 32)) - return FALSE; - } + if(pSiS->MergedFB) { + if(mode2->Flags & V_INTERLACE) + 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 SiS300LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) +static void +SiS300LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) { SISPtr pSiS = SISPTR(pScrn); int cursor_addr, i, j, maxheight = 32; - CARD32 *src = pCurs->bits->argb, *p; -#ifdef SIS300_USE_ARGB16 - CARD16 *dest, *pb; - CARD16 temp1; -#define MYSISPTRTYPE CARD16 -#else + CARD32 *src = pCurs->bits->argb, *p; CARD32 *pb, *dest; #define MYSISPTRTYPE CARD32 -#endif int srcwidth = pCurs->bits->width; int srcheight = pCurs->bits->height; CARD32 temp, status1 = 0, status2 = 0; @@ -1066,44 +1051,12 @@ static void SiS300LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) maxheight = 16; } -#ifdef SIS300_USE_ARGB16 /* Use 16 Bit RGB pointer */ for(i = 0; i < srcheight; i++) { p = src; pb = dest; src += pCurs->bits->width; for(j = 0; j < srcwidth; j++) { temp = *p++; - if(temp & 0xffffff) { - temp1 = ((temp & 0xff) >> 3) | - ((((temp & 0xff00) >> (8 + 3)) << 5) & 0x03e0) | - ((((temp & 0xff0000) >> (16 + 3)) << 10) & 0x7c00); - } else temp1 = 0x8000; - *dest++ = temp1; - } - if(srcwidth < 32) { - for(; j < 32; j++) { - *dest++ = 0x8000; - } - } - } - if(srcheight < maxheight) { - for(; i < maxheight; i++) - for(j = 0; j < 32; j++) { - *dest++ = 0x8000; - } - if(sizedouble) { - for(j = 0; j < 32; j++) - *dest++ = 0x0000; - } - } -#else /* Use 32bit RGB pointer - preferred, saves us from the conversion */ - for(i = 0; i < srcheight; i++) { - p = src; - pb = dest; - src += pCurs->bits->width; - for(j = 0; j < srcwidth; j++) { - temp = *p++; -/* *dest1++ = ((temp ^ 0xff000000) << 4) | (((temp ^ 0xff000000) & 0xf0000000) >> 28); */ if(pSiS->OptUseColorCursorBlend) { if(temp & 0xffffff) { if((temp & 0xff000000) > pSiS->OptColorCursorBlendThreshold) { @@ -1116,16 +1069,16 @@ static void SiS300LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) if(temp & 0xffffff) temp &= 0x00ffffff; else temp = 0xff000000; } - *dest++ = temp; + sisfbwritelinc(dest, temp); /* *dest++ = temp; */ } if(srcwidth < 32) { for(; j < 32; j++) { - *dest++ = 0xff000000; + sisfbwritelinc(dest, 0xff000000); /* *dest++ = 0xff000000; */ } } if(sizedouble) { for(j = 0; j < 32; j++) { - *dest++ = *pb++; + sisfbwritelinc(dest, sisfbreadlinc(pb)); /* *dest++ = *pb++; */ } } @@ -1133,16 +1086,15 @@ static void SiS300LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) if(srcheight < maxheight) { for(; i < maxheight; i++) { for(j = 0; j < 32; j++) { - *dest++ = 0xff000000; + sisfbwritelinc(dest, 0xff000000); /* *dest++ = 0xff000000; */ } if(sizedouble) { for(j = 0; j < 32; j++) { - *dest++ = 0xff000000; + sisfbwritelinc(dest, 0xff000000); /* *dest++ = 0xff000000; */ } } } } -#endif if(!pSiS->UseHWARGBCursor) { if(pSiS->VBFlags & DISPTYPE_CRT1) { @@ -1223,7 +1175,7 @@ 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 */ @@ -1241,27 +1193,26 @@ static void SiS310LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) p = src; pb = dest; src += pCurs->bits->width; - for(j = 0; j < srcwidth; j++) *dest++ = *p++; + for(j = 0; j < srcwidth; j++) sisfbwritelpinc(dest, p); /* *dest++ = *p++; */ if(srcwidth < 64) { - for(; j < 64; j++) *dest++ = 0; + for(; j < 64; j++) sisfbwritelinc(dest, 0); /* *dest++ = 0; */ } if(sizedouble) { for(j = 0; j < 64; j++) { - *dest++ = *pb++; + sisfbwritelinc(dest, sisfbreadlinc(pb)); /* *dest++ = *pb++; */ } } } if(srcheight < maxheight) { for(; i < maxheight; i++) { - for(j = 0; j < 64; j++) *dest++ = 0; + for(j = 0; j < 64; j++) sisfbwritelinc(dest, 0); /* *dest++ = 0; */ if(sizedouble) { - for(j = 0; j < 64; j++) *dest++ = 0; + for(j = 0; j < 64; j++) sisfbwritelinc(dest, 0); /* *dest++ = 0; */ } } } - + if(pSiS->ChipFlags & SiSCF_CRT2HWCKaputt) { - if(!pSiS->UseHWARGBCursor) { if(pSiS->VBFlags & DISPTYPE_CRT1) { status1 = sis310GetCursorStatus; @@ -1270,7 +1221,6 @@ static void SiS310LoadCursorImageARGB(ScrnInfoPtr pScrn, CursorPtr pCurs) SISWaitRetraceCRT1(pScrn); sis310SwitchToRGBCursor(); } - } else { if(!pSiS->UseHWARGBCursor) { @@ -1328,8 +1278,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: diff --git a/src/sis_cursor.h b/src/sis_cursor.h index 6c087f2..1fee37e 100644 --- a/src/sis_cursor.h +++ b/src/sis_cursor.h @@ -4,7 +4,7 @@ * SiS hardware cursor handling * Definitions * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria. + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -45,84 +45,84 @@ */ #define sis300GetCursorStatus \ - MMIO_IN32(pSiS->IOBase, CS(0)) & 0x40000000; + SIS_MMIO_IN32(pSiS->IOBase, CS(0)) & 0x40000000; #define sis300SetCursorStatus(status) \ { \ ULong temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp = SIS_MMIO_IN32(pSiS->IOBase, CS(0)); \ temp &= 0xbfffffff; \ temp |= status; \ - MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ } #define sis300EnableHWCursor() \ { \ ULong temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp = SIS_MMIO_IN32(pSiS->IOBase, CS(0)); \ temp &= 0x0fffffff; \ temp |= 0x40000000; \ - MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ } #define sis300EnableHWARGBCursor() \ { \ ULong temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp = SIS_MMIO_IN32(pSiS->IOBase, CS(0)); \ temp |= 0xF0000000; \ - MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ } #define sis300EnableHWARGB16Cursor() \ { \ ULong temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp = SIS_MMIO_IN32(pSiS->IOBase, CS(0)); \ temp &= 0x0fffffff; \ temp |= 0xD0000000; \ - MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ } #define sis300SwitchToMONOCursor() \ { \ ULong temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp = SIS_MMIO_IN32(pSiS->IOBase, CS(0)); \ temp &= 0x4fffffff; \ - MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ } #define sis300SwitchToRGBCursor() \ { \ ULong temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp = SIS_MMIO_IN32(pSiS->IOBase, CS(0)); \ temp |= 0xB0000000; \ - MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ } #define sis300DisableHWCursor()\ { \ ULong temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp = SIS_MMIO_IN32(pSiS->IOBase, CS(0)); \ temp &= 0xbFFFFFFF; \ - MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(0), temp); \ } #define sis300SetCursorBGColor(color)\ - MMIO_OUT32(pSiS->IOBase, CS(1), (color)); + SIS_MMIO_OUT32(pSiS->IOBase, CS(1), (color)); #define sis300SetCursorFGColor(color)\ - MMIO_OUT32(pSiS->IOBase, CS(2), (color)); + SIS_MMIO_OUT32(pSiS->IOBase, CS(2), (color)); #define sis300SetCursorPositionX(x,preset)\ - MMIO_OUT32(pSiS->IOBase, CS(3), ((x) | ((preset) << 16))); + SIS_MMIO_OUT32(pSiS->IOBase, CS(3), ((x) | ((preset) << 16))); #define sis300SetCursorPositionY(y,preset)\ - MMIO_OUT32(pSiS->IOBase, CS(4), ((y) | ((preset) << 16))); + SIS_MMIO_OUT32(pSiS->IOBase, CS(4), ((y) | ((preset) << 16))); #define sis300SetCursorAddress(address)\ { \ ULong temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(0)); \ + temp = SIS_MMIO_IN32(pSiS->IOBase, CS(0)); \ temp &= 0xF0FF0000; \ temp |= address; \ - MMIO_OUT32(pSiS->IOBase,CS(0),temp); \ + SIS_MMIO_OUT32(pSiS->IOBase,CS(0),temp); \ } /* 300 series, CRT2 */ @@ -134,84 +134,84 @@ */ #define sis301GetCursorStatus \ - MMIO_IN32(pSiS->IOBase, CS(8)) & 0x40000000; + SIS_MMIO_IN32(pSiS->IOBase, CS(8)) & 0x40000000; #define sis301SetCursorStatus(status) \ { \ ULong temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp = SIS_MMIO_IN32(pSiS->IOBase, CS(8)); \ temp &= 0xbfffffff; \ temp |= status; \ - MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ } #define sis301EnableHWCursor()\ { \ ULong temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp = SIS_MMIO_IN32(pSiS->IOBase, CS(8)); \ temp &= 0x0fffffff; \ temp |= 0x40000000; \ - MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ } #define sis301EnableHWARGBCursor()\ { \ ULong temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp = SIS_MMIO_IN32(pSiS->IOBase, CS(8)); \ temp |= 0xF0000000; \ - MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ } #define sis301EnableHWARGB16Cursor()\ { \ ULong temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp = SIS_MMIO_IN32(pSiS->IOBase, CS(8)); \ temp &= 0x0FFFFFFF; \ temp |= 0xD0000000; \ - MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ } #define sis301SwitchToRGBCursor() \ { \ ULong temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp = SIS_MMIO_IN32(pSiS->IOBase, CS(8)); \ temp |= 0xB0000000; \ - MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ } #define sis301SwitchToMONOCursor() \ { \ ULong temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp = SIS_MMIO_IN32(pSiS->IOBase, CS(8)); \ temp &= 0x4fffffff; \ - MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ } #define sis301DisableHWCursor()\ { \ ULong temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp = SIS_MMIO_IN32(pSiS->IOBase, CS(8)); \ temp &= 0xbFFFFFFF; \ - MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(8), temp); \ } #define sis301SetCursorBGColor(color)\ - MMIO_OUT32(pSiS->IOBase, CS(9), (color)); + SIS_MMIO_OUT32(pSiS->IOBase, CS(9), (color)); #define sis301SetCursorFGColor(color)\ - MMIO_OUT32(pSiS->IOBase, CS(10), (color)); + SIS_MMIO_OUT32(pSiS->IOBase, CS(10), (color)); #define sis301SetCursorPositionX(x,preset)\ - MMIO_OUT32(pSiS->IOBase, CS(11), ((x) | ((preset) << 16))); + SIS_MMIO_OUT32(pSiS->IOBase, CS(11), ((x) | ((preset) << 16))); #define sis301SetCursorPositionY(y,preset)\ - MMIO_OUT32(pSiS->IOBase, CS(12), ((y) | ((preset) << 16))); + SIS_MMIO_OUT32(pSiS->IOBase, CS(12), ((y) | ((preset) << 16))); #define sis301SetCursorAddress(address)\ { \ ULong temp; \ - temp = MMIO_IN32(pSiS->IOBase, CS(8)); \ + temp = SIS_MMIO_IN32(pSiS->IOBase, CS(8)); \ temp &= 0xF0FF0000; \ temp |= address; \ - MMIO_OUT32(pSiS->IOBase,CS(8),temp); \ + SIS_MMIO_OUT32(pSiS->IOBase,CS(8),temp); \ } /* 315/330 series CRT1 */ @@ -223,72 +223,72 @@ */ #define sis310GetCursorStatus \ - MMIO_IN32(pSiS->IOBase, CS(0)) & 0x40000000; + SIS_MMIO_IN32(pSiS->IOBase, CS(0)) & 0x40000000; #define sis310SetCursorStatus(status) \ pSiS->HWCursorBackup[0] &= 0xbfffffff; \ pSiS->HWCursorBackup[0] |= status; \ - MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \ - MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \ - MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]); + SIS_MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]); #define sis310EnableHWCursor()\ pSiS->HWCursorBackup[0] &= 0x0fffffff; \ pSiS->HWCursorBackup[0] |= 0x40000000; \ - MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \ - MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \ - MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]); + SIS_MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]); #define sis310EnableHWARGBCursor()\ pSiS->HWCursorBackup[0] &= 0x0FFFFFFF; \ pSiS->HWCursorBackup[0] |= 0xE0000000; \ - MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \ - MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \ - MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]); + SIS_MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]); #define sis310SwitchToMONOCursor() \ pSiS->HWCursorBackup[0] &= 0x4fffffff; \ - MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \ - MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \ - MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]); + SIS_MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]); #define sis310SwitchToRGBCursor() \ pSiS->HWCursorBackup[0] &= 0xBFFFFFFF; \ pSiS->HWCursorBackup[0] |= 0xA0000000; \ - MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \ - MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \ - MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]); + SIS_MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]); #define sis310DisableHWCursor()\ pSiS->HWCursorBackup[0] &= 0xBFFFFFFF; \ - MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \ - MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \ - MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]); + SIS_MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]); #define sis310SetCursorBGColor(color) \ - MMIO_OUT32(pSiS->IOBase, CS(1), (color)); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(1), (color)); \ pSiS->HWCursorBackup[1] = color; #define sis310SetCursorFGColor(color)\ - MMIO_OUT32(pSiS->IOBase, CS(2), (color)); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(2), (color)); \ pSiS->HWCursorBackup[2] = color; #define sis310SetCursorPositionX(x,preset) \ pSiS->HWCursorBackup[3] = ((x) | ((preset) << 16)); \ - MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); + SIS_MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); #define sis310SetCursorPositionY(y,preset) \ pSiS->HWCursorBackup[4] = ((y) | ((preset) << 16)); \ - MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]); + SIS_MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]); #define sis310SetCursorAddress(address)\ pSiS->HWCursorBackup[0] &= 0xF0F00000; \ pSiS->HWCursorBackup[0] |= address; \ - MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \ - MMIO_OUT32(pSiS->IOBase, CS(1), pSiS->HWCursorBackup[1]); \ - MMIO_OUT32(pSiS->IOBase, CS(2), pSiS->HWCursorBackup[2]); \ - MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \ - MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]); + SIS_MMIO_OUT32(pSiS->IOBase, CS(0), pSiS->HWCursorBackup[0]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(1), pSiS->HWCursorBackup[1]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(2), pSiS->HWCursorBackup[2]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(3), pSiS->HWCursorBackup[3]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(4), pSiS->HWCursorBackup[4]); /* 315 series CRT2 */ @@ -299,63 +299,63 @@ */ #define sis301GetCursorStatus310 \ - MMIO_IN32(pSiS->IOBase, CS(8)) & 0x40000000; + SIS_MMIO_IN32(pSiS->IOBase, CS(8)) & 0x40000000; #define sis301SetCursorStatus310(status) \ pSiS->HWCursorBackup[8] &= 0xbfffffff; \ pSiS->HWCursorBackup[8] |= status; \ - MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \ - MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \ - MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); + SIS_MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); #define sis301EnableHWCursor310()\ pSiS->HWCursorBackup[8] &= 0x0fffffff; \ pSiS->HWCursorBackup[8] |= 0x40000000; \ - MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \ - MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \ - MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); + SIS_MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); #define sis301EnableHWARGBCursor310()\ pSiS->HWCursorBackup[8] &= 0x0FFFFFFF; \ pSiS->HWCursorBackup[8] |= 0xE0000000; \ - MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \ - MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \ - MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); + SIS_MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); #define sis301SwitchToRGBCursor310() \ pSiS->HWCursorBackup[8] &= 0xBFFFFFFF; \ pSiS->HWCursorBackup[8] |= 0xA0000000; \ - MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \ - MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \ - MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); + SIS_MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); #define sis301SwitchToMONOCursor310() \ pSiS->HWCursorBackup[8] &= 0x4fffffff; \ - MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \ - MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \ - MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); + SIS_MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); #define sis301DisableHWCursor310()\ pSiS->HWCursorBackup[8] &= 0xBFFFFFFF; \ - MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \ - MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \ - MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); + SIS_MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); #define sis301SetCursorBGColor310(color) \ - MMIO_OUT32(pSiS->IOBase, CS(9), (color)); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(9), (color)); \ pSiS->HWCursorBackup[9] = color; #define sis301SetCursorFGColor310(color) \ - MMIO_OUT32(pSiS->IOBase, CS(10), (color)); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(10), (color)); \ pSiS->HWCursorBackup[10] = color; #define sis301SetCursorPositionX310(x,preset) \ pSiS->HWCursorBackup[11] = ((x) | ((preset) << 16)); \ - MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); + SIS_MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); #define sis301SetCursorPositionY310(y,preset) \ pSiS->HWCursorBackup[12] = ((y) | ((preset) << 16)); \ - MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); + SIS_MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); #define sis301SetCursorAddress310(address) \ if(pSiS->sishw_ext.jChipType == SIS_315H) { \ @@ -368,11 +368,11 @@ } \ pSiS->HWCursorBackup[8] &= 0xF0F00000; \ pSiS->HWCursorBackup[8] |= address; \ - MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \ - MMIO_OUT32(pSiS->IOBase, CS(9), pSiS->HWCursorBackup[9]); \ - MMIO_OUT32(pSiS->IOBase, CS(10), pSiS->HWCursorBackup[10]); \ - MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \ - MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); + SIS_MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(9), pSiS->HWCursorBackup[9]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(10), pSiS->HWCursorBackup[10]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); /* 330 series CRT2 */ @@ -390,9 +390,9 @@ /* andSISIDXREG(SISCR,0x5b,~0x10); */ \ pSiS->HWCursorBackup[8] &= 0x0fffffff; \ pSiS->HWCursorBackup[8] |= 0xE0000000; \ - MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \ - MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \ - MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(8), pSiS->HWCursorBackup[8]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(11), pSiS->HWCursorBackup[11]); \ + SIS_MMIO_OUT32(pSiS->IOBase, CS(12), pSiS->HWCursorBackup[12]); \ /* orSISIDXREG(SISCR,0x5b,0x10); */ diff --git a/src/sis_dac.c b/src/sis_dac.c index 5322114..6795218 100644 --- a/src/sis_dac.c +++ b/src/sis_dac.c @@ -3,7 +3,7 @@ /* * DAC helper functions (Save/Restore, MemClk, etc) * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria. + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -64,19 +64,29 @@ */ #include "sis.h" +#define SIS_NEED_inSISREG +#define SIS_NEED_inSISREGW +#define SIS_NEED_inSISREGL +#define SIS_NEED_outSISREG +#define SIS_NEED_outSISREGW +#define SIS_NEED_outSISREGL +#define SIS_NEED_inSISIDXREG +#define SIS_NEED_outSISIDXREG +#define SIS_NEED_orSISIDXREG +#define SIS_NEED_andSISIDXREG +#define SIS_NEED_MYMMIO #include "sis_regs.h" #include "sis_dac.h" static void SiSSave(ScrnInfoPtr pScrn, SISRegPtr sisReg); static void SiSRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg); - static void SiS300Save(ScrnInfoPtr pScrn, SISRegPtr sisReg); +static void SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg); static void SiS315Save(ScrnInfoPtr pScrn, SISRegPtr sisReg); +static void SiS315Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg); static void SiS301Save(ScrnInfoPtr pScrn, SISRegPtr sisReg); static void SiS301BSave(ScrnInfoPtr pScrn, SISRegPtr sisReg); static void SiSLVDSChrontelSave(ScrnInfoPtr pScrn, SISRegPtr sisReg); -static void SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg); -static void SiS315Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg); static void SiS301Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg); static void SiS301BRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg); static void SiSLVDSChrontelRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg); @@ -203,7 +213,6 @@ int SiS_compute_vclk( return 1; } - void SiSCalcClock(ScrnInfoPtr pScrn, int clock, int max_VLD, unsigned int *vclk) { @@ -214,9 +223,6 @@ SiSCalcClock(ScrnInfoPtr pScrn, int clock, int max_VLD, unsigned int *vclk) double target; double Fvco, Fout; double error, aerror; -#ifdef DEBUG - double bestFout; -#endif /* * fd = fref*(Numerator/Denumerator)*(Divider/PostScaler) @@ -286,10 +292,7 @@ SiSCalcClock(ScrnInfoPtr pScrn, int clock, int max_VLD, unsigned int *vclk) bestN = N; bestP = P; bestPSN = PSN; - bestVLD = VLD; -#ifdef DEBUG - bestFout = Fout; -#endif + bestVLD = VLD; } } @@ -344,9 +347,6 @@ SiSCalcClock(ScrnInfoPtr pScrn, int clock, int max_VLD, unsigned int *vclk) bestP = P; bestPSN = PSN; bestVLD = VLD; -#ifdef DEBUG - bestFout = Fout; -#endif } #ifdef TWDEBUG xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO,3, @@ -367,18 +367,8 @@ SiSCalcClock(ScrnInfoPtr pScrn, int clock, int max_VLD, unsigned int *vclk) vclk[VLDidx] = bestVLD; vclk[Pidx] = bestP; vclk[PSNidx] = bestPSN; - - PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Freq. selected: %.2f MHz, M=%d, N=%d, VLD=%d, P=%d, PSN=%d\n", - (float)(clock / 1000.), vclk[Midx], vclk[Nidx], vclk[VLDidx], - vclk[Pidx], vclk[PSNidx])); - PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "Freq. set: %.2f MHz\n", bestFout / 1.0e6)); - PDEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, - "VCO Freq.: %.2f MHz\n", bestFout*bestP / 1.0e6)); } - static void SiSSave(ScrnInfoPtr pScrn, SISRegPtr sisReg) { @@ -603,9 +593,9 @@ SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg) /* Wait for accelerator to finish on-going drawing operations. */ inSISIDXREG(SISSR, 0x1E, temp); if(temp & (0x40|0x10|0x02)) { - while ( (MMIO_IN16(pSiS->IOBase, 0x8242) & 0xE000) != 0xE000){}; - while ( (MMIO_IN16(pSiS->IOBase, 0x8242) & 0xE000) != 0xE000){}; - while ( (MMIO_IN16(pSiS->IOBase, 0x8242) & 0xE000) != 0xE000){}; + while ( (SIS_MMIO_IN16(pSiS->IOBase, 0x8242) & 0xE000) != 0xE000){}; + while ( (SIS_MMIO_IN16(pSiS->IOBase, 0x8242) & 0xE000) != 0xE000){}; + while ( (SIS_MMIO_IN16(pSiS->IOBase, 0x8242) & 0xE000) != 0xE000){}; } if(!(pSiS->UseVESA)) { @@ -757,7 +747,7 @@ SiS315Save(ScrnInfoPtr pScrn, SISRegPtr sisReg) } /* Save command queue location */ - sisReg->sisMMIO85C0 = MMIO_IN32(pSiS->IOBase, 0x85C0); + sisReg->sisMMIO85C0 = SIS_MMIO_IN32(pSiS->IOBase, 0x85C0); /* Save CR registers */ for(i = 0x00; i <= 0x7c; i++) { @@ -788,7 +778,7 @@ SiS315Save(ScrnInfoPtr pScrn, SISRegPtr sisReg) /* Save Misc register */ sisReg->sisRegs3C2 = inSISREG(SISMISCR); - + /* Save panel link/video bridge registers */ #ifndef TWDEBUG if(!pSiS->UseVESA) { @@ -828,9 +818,9 @@ 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*/ - while ( (MMIO_IN32(pSiS->IOBase, 0x85CC) & 0x80000000) != 0x80000000){}; - while ( (MMIO_IN32(pSiS->IOBase, 0x85CC) & 0x80000000) != 0x80000000){}; - while ( (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){}; + while ( (SIS_MMIO_IN32(pSiS->IOBase, 0x85CC) & 0x80000000) != 0x80000000){}; } /* We reset the command queue before restoring. @@ -907,14 +897,14 @@ SiS315Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg) #ifndef SISVRAMQ /* Initialize read/write pointer for command queue */ - MMIO_OUT32(pSiS->IOBase, 0x85C4, MMIO_IN32(pSiS->IOBase, 0x85C8)); + SIS_MMIO_OUT32(pSiS->IOBase, 0x85C4, SIS_MMIO_IN32(pSiS->IOBase, 0x85C8)); #endif /* Restore queue location */ - MMIO_OUT32(pSiS->IOBase, 0x85C0, sisReg->sisMMIO85C0); + SIS_MMIO_OUT32(pSiS->IOBase, 0x85C0, sisReg->sisMMIO85C0); /* Restore Misc register */ outSISREG(SISMISCW, sisReg->sisRegs3C2); - + /* Restore panel link/video bridge registers */ if(!(pSiS->UseVESA)) { if(pSiS->VBFlags & (VB_LVDS|VB_CHRONTEL)) @@ -1300,7 +1290,7 @@ SiSRestoreBridge(ScrnInfoPtr pScrn, SISRegPtr sisReg) int SiSMclk(SISPtr pSiS) { - int mclk; + int mclk=0; UChar Num, Denum, Base; switch (pSiS->Chipset) { @@ -1316,6 +1306,7 @@ SiSMclk(SISPtr pSiS) case PCI_CHIP_SIS330: case PCI_CHIP_SIS660: case PCI_CHIP_SIS340: + /* Numerator */ inSISIDXREG(SISSR, 0x28, Num); mclk = 14318 * ((Num & 0x7f) + 1); @@ -1361,7 +1352,7 @@ SiSMclk(SISPtr pSiS) if ((Denum & 0x60) == 0x40) mclk /= 6; if ((Denum & 0x60) == 0x60) mclk /= 8; } - break; + break; } return(mclk); @@ -1443,13 +1434,15 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, Bool IsForCRT2) #ifdef SISDUALHEAD SISEntPtr pSiSEnt = pSiS->entityPrivate; #endif - int bus = pSiS->BusWidth; int mclk = pSiS->MemClock; - int bpp = pSiS->CurrentLayout.bitsPerPixel; + int bpp = pSiS->CurrentLayout.bitsPerPixel; + int max = 0; + float magic = 0.0, total; int bytesperpixel = (bpp + 7) / 8; - float magic=0.0, total, crt2used, maxcrt2; - int crt2clock, max=0; + float crt2used, maxcrt2; + int crt2clock; + Bool DHM, GetForCRT1; #ifdef __SUNPRO_C #define const #endif @@ -1458,10 +1451,9 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, Bool IsForCRT2) #ifdef __SUNPRO_C #undef const #endif - Bool DHM, GetForCRT1; switch(pSiS->Chipset) { - + case PCI_CHIP_SIS5597: total = ((mclk * (bus / 8)) * 0.7) / bytesperpixel; if(total > 135000) total = 135000; @@ -1543,7 +1535,7 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, Bool IsForCRT2) xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Memory bandwidth at %d bpp is %g MHz\n", bpp, total/1000); - + if((pSiS->VBFlags & CRT2_ENABLE) && (!pSiS->CRT1off)) { maxcrt2 = 135000; @@ -1662,6 +1654,7 @@ int SiSMemBandWidth(ScrnInfoPtr pScrn, Bool IsForCRT2) } } + total /= magic; if(total > (max / 2)) total = max / 2; return(int)(total); @@ -1740,11 +1733,11 @@ SISLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, index = indices[i]; if(index < 64) { /* Paranoia */ for(j=0; j<4; j++) { - MMIO_OUT32(pSiS->IOBase, 0x8570, - (colors[index].green << (myshift + 8)) | - (colors[index >> 1].blue << (myshift + 16)) | - (colors[index >> 1].red << myshift) | - (((index << 2) + j) << 24)); + SIS_MMIO_OUT32(pSiS->IOBase, 0x8570, + (colors[index].green << (myshift + 8)) | + (colors[index >> 1].blue << (myshift + 16)) | + (colors[index >> 1].red << myshift) | + (((index << 2) + j) << 24)); } } } @@ -1772,8 +1765,8 @@ SISLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, for(i=0; iIOBase, 0x8570, - (colors[index].blue << 16) | + SIS_MMIO_OUT32(pSiS->IOBase, 0x8570, + (colors[index].blue << 16) | (colors[index].green << 8) | (colors[index].red) | (index << 24)); @@ -1799,11 +1792,11 @@ SISLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, if(pSiS->ChipFlags & SiSCF_MMIOPalette) { for(i=0; iIOBase, 0x8570, - ((colors[index].blue) << 16) | - ((colors[index].green) << 8) | - (colors[index].red) | - (index << 24)); + SIS_MMIO_OUT32(pSiS->IOBase, 0x8570, + ((colors[index].blue) << 16) | + ((colors[index].green) << 8) | + (colors[index].red) | + (index << 24)); } } else { for(i=0; iDualHeadMode) || (!pSiS->SecondHead)) { #endif +#ifdef SISDUALHEAD + if((!pSiS->DualHeadMode) || (!pSiS->SecondHead)) { +#endif switch(pSiS->VGAEngine) { case SIS_300_VGA: case SIS_315_VGA: @@ -1845,7 +1839,6 @@ SISLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, } } } - #ifdef SISDUALHEAD } #endif @@ -1965,7 +1958,7 @@ SISDACPreInit(ScrnInfoPtr pScrn) case PCI_CHIP_SIS340: pSiS->SiSSave = SiS315Save; pSiS->SiSRestore = SiS315Restore; - break; + break; case PCI_CHIP_SIS300: case PCI_CHIP_SIS540: case PCI_CHIP_SIS630: diff --git a/src/sis_dac.h b/src/sis_dac.h index 4a7d596..d0d68e2 100644 --- a/src/sis_dac.h +++ b/src/sis_dac.h @@ -4,7 +4,7 @@ * DAC helper functions (Save/Restore, MemClk, etc) * Definitions and prototypes * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria. + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/src/sis_dga.c b/src/sis_dga.c index 9837bad..94b46d2 100644 --- a/src/sis_dga.c +++ b/src/sis_dga.c @@ -4,7 +4,7 @@ * SiS DGA handling * * Copyright (C) 2000 by Alan Hourihane, Sychdyn, North Wales, UK. - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * Portions from radeon_dga.c which is * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and @@ -35,14 +35,18 @@ */ #include "sis.h" - #include "xaa.h" #include "dgaproc.h" #include "sis_regs.h" +#ifndef NEW_DGAOPENFRAMEBUFFER static Bool SIS_OpenFramebuffer(ScrnInfoPtr, char **, UChar **, int *, int *, int *); +#else +static Bool SIS_OpenFramebuffer(ScrnInfoPtr, char **, unsigned int *, + unsigned int *, unsigned int *, unsigned int *); +#endif static Bool SIS_SetMode(ScrnInfoPtr, DGAModePtr); static void SIS_Sync(ScrnInfoPtr); static int SIS_GetViewport(ScrnInfoPtr); @@ -196,7 +200,6 @@ SECOND_PASS: return modes; } - Bool SISDGAInit(ScreenPtr pScreen) { @@ -261,10 +264,9 @@ SISDGAInit(ScreenPtr pScreen) return DGAInit(pScreen, &SISDGAFuncs3xx, modes, num); } else { return DGAInit(pScreen, &SISDGAFuncs, modes, num); - } + } } - static Bool SIS_SetMode( ScrnInfoPtr pScrn, @@ -406,18 +408,34 @@ static Bool SIS_OpenFramebuffer( ScrnInfoPtr pScrn, char **name, +#ifndef NEW_DGAOPENFRAMEBUFFER UChar **mem, int *size, int *offset, int *flags +#else + unsigned int *mem, + unsigned int *size, + unsigned int *offset, + unsigned int *flags +#endif ){ SISPtr pSiS = SISPTR(pScrn); *name = NULL; /* no special device */ +#ifndef NEW_DGAOPENFRAMEBUFFER *mem = (UChar *)pSiS->FbAddress; +#else + *mem = pSiS->FbAddress; +#endif *size = pSiS->maxxfbmem; *offset = 0; +#ifndef NEW_DGAOPENFRAMEBUFFER *flags = DGA_NEED_ROOT; +#else + *flags = 0; +#endif return TRUE; } + diff --git a/src/sis_dri.c b/src/sis_dri.c index 063fa02..f56dcf6 100644 --- a/src/sis_dri.c +++ b/src/sis_dri.c @@ -3,7 +3,7 @@ /* * DRI wrapper for 300 and 315 series * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * 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 @@ -37,12 +37,11 @@ */ #include "sis.h" +#include "sis_regs.h" #include "fb.h" - #include "GL/glxtokens.h" - #ifndef SISHAVEDRMWRITE # if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0) extern Bool drmSiSAgpInit(int driSubFD, int offset, int size); @@ -69,16 +68,16 @@ extern char *DRICreatePCIBusID(pciVideoPtr PciInfo); /* Idle function for 300 series */ #define BR(x) (0x8200 | (x) << 2) #define SiSIdle \ - while((MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \ - while((MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \ - MMIO_IN16(pSiS->IOBase, 0x8240); + while((SIS_MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \ + while((SIS_MMIO_IN16(pSiS->IOBase, BR(16)+2) & 0xE000) != 0xE000){}; \ + SIS_MMIO_IN16(pSiS->IOBase, 0x8240); /* Idle function for 315/330 series */ #define Q_STATUS 0x85CC #define SiS315Idle \ { \ - while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000){}; \ - while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000){}; \ + while( (SIS_MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000){}; \ + while( (SIS_MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000){}; \ } extern void GlxSetVisualConfigs( @@ -104,7 +103,7 @@ static void SISDRISwapContext(ScreenPtr pScreen, DRISyncType syncType, static void SISDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index); static void SISDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 index); - + static Bool SISInitVisualConfigs(ScreenPtr pScreen) { @@ -240,7 +239,8 @@ SISInitVisualConfigs(ScreenPtr pScreen) return TRUE; } -Bool SISDRIScreenInit(ScreenPtr pScreen) +Bool +SISDRIScreenInit(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SISPtr pSIS = SISPTR(pScrn); @@ -593,7 +593,7 @@ Bool SISDRIScreenInit(ScreenPtr pScreen) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] Visual configs initialized.\n" ); - return TRUE; + return TRUE; } void @@ -633,7 +633,7 @@ SISDRICloseScreen(ScreenPtr pScreen) 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 @@ -711,7 +711,7 @@ SISDRIFinishScreenInit(ScreenPtr pScreen) } } - return DRIFinishScreenInit(pScreen); + return DRIFinishScreenInit(pScreen); } static void @@ -790,3 +790,6 @@ void SISSwapContextPrivate(ScreenPtr pScreen) { } #endif + + + diff --git a/src/sis_dri.h b/src/sis_dri.h index ecb84f0..81d0b3d 100644 --- a/src/sis_dri.h +++ b/src/sis_dri.h @@ -3,7 +3,7 @@ /* * SiS DRI wrapper * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * Licensed under the following terms: * diff --git a/src/sis_driver.c b/src/sis_driver.c index 3c6bd0d..bd627b4 100644 --- a/src/sis_driver.c +++ b/src/sis_driver.c @@ -3,7 +3,7 @@ /* * SiS driver main code * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria. + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,7 +37,7 @@ * * Formerly based on code which was * Copyright (C) 1998, 1999 by Alan Hourihane, Wigan, England. - * Written by: + * Written by: * Alan Hourihane , * Mike Chapman , * Juanjo Santamarta , @@ -55,10 +55,19 @@ #include "mibank.h" #include "mipointer.h" #include "mibstore.h" - +#define _XF86MISC_SERVER_ +#include "xf86misc.h" + +#define SIS_NEED_inSISREG +#define SIS_NEED_inSISIDXREG +#define SIS_NEED_outSISIDXREG +#define SIS_NEED_orSISIDXREG +#define SIS_NEED_andSISIDXREG +#define SIS_NEED_setSISIDXREG +#define SIS_NEED_outSISREG +#define SIS_NEED_MYMMIO +#define SIS_NEED_sisclearvram #include "sis_regs.h" -#include "sis_shadow.h" -#include "sis_vb.h" #include "sis_dac.h" #include "sis_driver.h" @@ -137,7 +146,7 @@ static SymTabRec SISChipsets[] = { { PCI_CHIP_SIS540, "SIS540" }, { PCI_CHIP_SIS315, "SIS315" }, { PCI_CHIP_SIS315H, "SIS315H" }, - { PCI_CHIP_SIS315PRO, "SIS315PRO" }, + { PCI_CHIP_SIS315PRO, "SIS315PRO/E" }, { PCI_CHIP_SIS550, "SIS550" }, { PCI_CHIP_SIS650, "SIS650/M650/651/740" }, { PCI_CHIP_SIS330, "SIS330(Xabre)" }, @@ -303,8 +312,8 @@ sisSetup(pointer module, pointer opts, int *errmaj, int *errmin) setupDone = TRUE; xf86AddDriver(&SIS, module, 0); LoaderRefSymLists(fbSymbols, xaaSymbols, - shadowSymbols, ramdacSymbols, - vbeSymbols, int10Symbols, + shadowSymbols, ramdacSymbols, + vbeSymbols, int10Symbols, #ifdef XF86DRI drmSymbols, driSymbols, driRefSymbols, #endif @@ -318,6 +327,13 @@ sisSetup(pointer module, pointer opts, int *errmaj, int *errmin) #endif /* XFree86LOADER */ +/* Mandatory */ +static void +SISIdentify(int flags) +{ + xf86PrintChipsets(SIS_NAME, "driver for SiS chipsets", SISChipsets); +} + static Bool SISGetRec(ScrnInfoPtr pScrn) { @@ -434,6 +450,11 @@ SISFreeRec(ScrnInfoPtr pScrn) } if(pSiS->pVbe) vbeFree(pSiS->pVbe); pSiS->pVbe = NULL; + +#ifdef SISUSEDEVPORT + if(pSiS->sisdevportopen) close(sisdevport); +#endif + if(pScrn->driverPrivate == NULL) return; xfree(pScrn->driverPrivate); @@ -583,20 +604,20 @@ SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int fla switch(pSiS->VGAEngine) { case SIS_OLD_VGA: case SIS_530_VGA: - setSISIDXREG(SISSR, 0x01, ~0x20, sr1); /* Set/Clear "Display On" bit */ - inSISIDXREG(SISSR, 0x11, oldpmreg); - setSISIDXREG(SISCR, 0x17, 0x7f, cr17); + setSISIDXREG(SISSR, 0x01, ~0x20, sr1); /* Set/Clear "Display On" bit */ + inSISIDXREG(SISSR, 0x11, oldpmreg); + setSISIDXREG(SISCR, 0x17, 0x7f, cr17); setSISIDXREG(SISSR, 0x11, 0x3f, pmreg); break; case SIS_315_VGA: if((!pSiS->CRT1off) && ((!(pSiS->VBFlags & CRT1_LCDA)) || (pSiS->VBFlags & VB_SISTMDSLCDABRIDGE))) { - setSISIDXREG(SISCR, pSiS->myCR63, 0xbf, cr63); + setSISIDXREG(SISCR, pSiS->myCR63, 0xbf, cr63); setSISIDXREG(SISSR, 0x07, 0xef, sr7); } /* fall through */ default: - if(!SiSBridgeIsInSlaveMode(pScrn)) { - setSISIDXREG(SISSR, 0x01, ~0x20, sr1); /* Set/Clear "Display On" bit */ + 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); @@ -647,13 +668,6 @@ SISDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int fla } -/* Mandatory */ -static void -SISIdentify(int flags) -{ - xf86PrintChipsets(SIS_NAME, "driver for SiS chipsets", SISChipsets); -} - #ifdef SISGAMMARAMP static void SISCalculateGammaRamp(ScreenPtr pScreen, ScrnInfoPtr pScrn) @@ -858,7 +872,7 @@ SISProbe(DriverPtr drv, int flags) if(xf86GetPciVideoInfo() == NULL) { /* * We won't let anything in the config file override finding no - * PCI video cards at all. This seems reasonable now, but we'll see. + * PCI video cards at all. */ return FALSE; } @@ -872,8 +886,11 @@ SISProbe(DriverPtr drv, int flags) if(numUsed <= 0) return FALSE; if(flags & PROBE_DETECT) { + foundScreen = TRUE; + } else for(i = 0; i < numUsed; i++) { + ScrnInfoPtr pScrn; #ifdef SISDUALHEAD EntityInfoPtr pEnt; @@ -881,7 +898,7 @@ SISProbe(DriverPtr drv, int flags) /* Allocate a ScrnInfoRec and claim the slot */ pScrn = NULL; - + if((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i], SISPciChipsets, NULL, NULL, NULL, NULL, NULL))) { @@ -898,8 +915,14 @@ SISProbe(DriverPtr drv, int flags) pScrn->LeaveVT = SISLeaveVT; pScrn->FreeScreen = SISFreeScreen; pScrn->ValidMode = SISValidMode; +#ifdef X_XF86MiscPassMessage + if(xf86GetVersion() >= XF86_VERSION_NUMERIC(4,3,99,2,0)) { + pScrn->HandleMessage = SISHandleMessage; + } +#endif foundScreen = TRUE; } + #ifdef SISDUALHEAD pEnt = xf86GetEntityInfo(usedChips[i]); @@ -930,8 +953,10 @@ SISProbe(DriverPtr drv, int flags) xf86SetEntityInstanceForScreen(pScrn, pScrn->entityList[0], pSiSEnt->lastInstance); } -#endif +#endif /* DUALHEAD */ + } + xfree(usedChips); return foundScreen; } @@ -948,8 +973,9 @@ SiSSetSyncRangeFromEdid(ScrnInfoPtr pScrn, int flag) float myhhigh = 0.0, myhlow = 0.0, htest; int myvhigh = 0, myvlow = 0, vtest, i; UChar temp; - const myhddctiming myhtiming[11] = { + const myhddctiming myhtiming[12] = { { 1, 0x20, 31.6 }, /* rounded up by .1 */ + { 1, 0x80, 31.6 }, { 1, 0x02, 35.3 }, { 1, 0x04, 37.6 }, { 1, 0x08, 38.0 }, @@ -961,11 +987,12 @@ SiSSetSyncRangeFromEdid(ScrnInfoPtr pScrn, int flag) { 2, 0x02, 60.1 }, { 2, 0x01, 80.1 } }; - const myvddctiming myvtiming[10] = { + const myvddctiming myvtiming[11] = { { 1, 0x02, 56 }, { 1, 0x01, 60 }, { 2, 0x08, 60 }, { 2, 0x04, 70 }, + { 1, 0x80, 71 }, { 1, 0x08, 72 }, { 2, 0x80, 72 }, { 1, 0x04, 75 }, @@ -981,6 +1008,13 @@ SiSSetSyncRangeFromEdid(ScrnInfoPtr pScrn, int flag) 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->hsync[1].lo = 31.0; + mon->hsync[1].hi = 32.0; + } + } return; } } @@ -989,7 +1023,7 @@ SiSSetSyncRangeFromEdid(ScrnInfoPtr pScrn, int flag) * derive them from supported VESA modes. */ - for(i = 0; i < 11; i++) { + for(i = 0; i < 12; i++) { if(myhtiming[i].whichone == 1) temp = ddc->timings1.t1; else temp = ddc->timings1.t2; if(temp & myhtiming[i].mask) { @@ -1026,11 +1060,18 @@ SiSSetSyncRangeFromEdid(ScrnInfoPtr pScrn, int flag) 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->vrefresh[1].lo = 71; + mon->vrefresh[1].hi = 71; + } + } return; } } - for(i = 0; i < 10; i++) { + for(i = 0; i < 11; i++) { if(myvtiming[i].whichone == 1) temp = ddc->timings1.t1; else temp = ddc->timings1.t2; if(temp & myvtiming[i].mask) { @@ -1065,6 +1106,8 @@ SiSSetSyncRangeFromEdid(ScrnInfoPtr pScrn, int flag) static Bool SiSAllowSyncOverride(SISPtr pSiS, Bool fromDDC) { + if(!(pSiS->VBFlags & VB_VIDEOBRIDGE)) return FALSE; + #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { if(pSiS->SecondHead) { @@ -1092,6 +1135,111 @@ SiSAllowSyncOverride(SISPtr pSiS, Bool fromDDC) return FALSE; } +static Bool +SiSCheckForH(float hsync, MonPtr monitor) +{ + int i; + for(i = 0; i < monitor->nHsync; i++) { + if((hsync > monitor->hsync[i].lo * (1.0 - SYNC_TOLERANCE)) && + (hsync < monitor->hsync[i].hi * (1.0 + SYNC_TOLERANCE))) + break; + } + if(i == monitor->nHsync) return FALSE; + return TRUE; +} + +static Bool +SiSCheckForV(float vrefresh, MonPtr monitor) +{ + int i; + for(i = 0; i < monitor->nVrefresh; i++) { + if((vrefresh > monitor->vrefresh[i].lo * (1.0 - SYNC_TOLERANCE)) && + (vrefresh < monitor->vrefresh[i].hi * (1.0 + SYNC_TOLERANCE))) + break; + } + if(i == monitor->nVrefresh) return FALSE; + return TRUE; +} + +static Bool +CheckAndOverruleH(ScrnInfoPtr pScrn, MonPtr monitor) +{ + DisplayModePtr mode = monitor->Modes; + float mymin = 30.0, mymax = 80.0, hsync; + Bool doit = FALSE; + + for(hsync = mymin; hsync <= mymax; hsync += .5) { + if(!SiSCheckForH(hsync, monitor)) doit = TRUE; + } + + if(mode) { + do { + if(mode->type & M_T_BUILTIN) { + hsync = (float)mode->Clock / (float)mode->HTotal; + if(!SiSCheckForH(hsync, monitor)) { + doit = TRUE; + if(hsync < mymin) mymin = hsync; + if(hsync > mymax) mymax = hsync; + } + } + } while((mode = mode->next)); + } + + if(doit) { + monitor->nHsync = 1; + monitor->hsync[0].lo = mymin; + monitor->hsync[0].hi = mymax; + return TRUE; + } + + return FALSE; +} + +static Bool +CheckAndOverruleV(ScrnInfoPtr pScrn, MonPtr monitor) +{ + DisplayModePtr mode = monitor->Modes; + float mymin = 59.0, mymax = 61.0, vrefresh; + Bool doit = FALSE, ret = FALSE; + + for(vrefresh = mymin; vrefresh <= mymax; vrefresh += 1.0) { + if(!SiSCheckForV(vrefresh, monitor)) doit = TRUE; + } + + if(mode) { + do { + if(mode->type & M_T_BUILTIN) { + vrefresh = mode->Clock * 1000.0 / (mode->HTotal * mode->VTotal); + if(mode->Flags & V_INTERLACE) vrefresh *= 2.0; + if(mode->Flags & V_DBLSCAN) vrefresh /= 2.0; + if(!SiSCheckForH(vrefresh, monitor)) { + doit = TRUE; + if(vrefresh < mymin) mymin = vrefresh; + if(vrefresh > mymax) mymax = vrefresh; + } + } + } while((mode = mode->next)); + } + + if(doit) { + monitor->nVrefresh = 1; + monitor->vrefresh[0].lo = mymin; + monitor->vrefresh[0].hi = mymax; + ret = TRUE; + } + + /* special for 640x400/320x200/@70Hz (VGA/IBM 720x480) */ + if( (!SiSCheckForV(71, monitor)) && + (monitor->nVrefresh < MAX_VREFRESH) ) { + monitor->vrefresh[monitor->nVrefresh].lo = 71; + monitor->vrefresh[monitor->nVrefresh].hi = 71; + monitor->nVrefresh++; + ret = TRUE; + } + return ret; +} + + /* Some helper functions for MergedFB mode */ #ifdef SISMERGED @@ -1106,7 +1254,7 @@ SiSStrToRanges(range *r, char *s, int max) int rangenum = 0; Bool gotdash = FALSE; Bool nextdash = FALSE; - char* strnum = NULL; + char *strnum = NULL; do { switch(*s) { case '0': @@ -2350,8 +2498,19 @@ SiSMakeOwnModeList(ScrnInfoPtr pScrn, Bool acceptcustommodes, Bool includelcdmod delmode = delmode->next; } } - tempmode = pScrn->monitor->Modes; - if(tempmode) *havecustommodes = TRUE; + /* Link default modes AFTER user ones */ + if((tempmode = pScrn->monitor->Modes)) { + *havecustommodes = TRUE; + while(tempmode) { + if(!tempmode->next) break; + else tempmode = tempmode->next; + } + tempmode->next = mymodes; + mymodes->prev = tempmode; + } else { + pScrn->monitor->Modes = mymodes; + } +#if 0 pScrn->monitor->Modes = mymodes; while(mymodes) { if(!mymodes->next) break; @@ -2361,12 +2520,66 @@ SiSMakeOwnModeList(ScrnInfoPtr pScrn, Bool acceptcustommodes, Bool includelcdmod if(tempmode) { tempmode->prev = mymodes; } +#endif } return TRUE; } else return FALSE; } +static void +SiSPrintModes(ScrnInfoPtr pScrn) +{ + DisplayModePtr p; + float hsync, refresh = 0.0; + char *desc, *desc2, *prefix, *uprefix, *output; + + xf86DrvMsg(pScrn->scrnIndex, pScrn->virtualFrom, "Virtual size is %dx%d " + "(pitch %d)\n", pScrn->virtualX, pScrn->virtualY, + pScrn->displayWidth); + + if((p = pScrn->modes) == NULL) return; + + do { + desc = desc2 = ""; + uprefix = " "; + prefix = "Mode"; + output = "For CRT device: "; + if(p->HSync > 0.0) hsync = p->HSync; + else if (p->HTotal > 0) hsync = (float)p->Clock / (float)p->HTotal; + else hsync = 0.0; + refresh = 0.0; + if(p->VRefresh > 0.0) refresh = p->VRefresh; + else if (p->HTotal > 0 && p->VTotal > 0) { + refresh = p->Clock * 1000.0 / p->HTotal / p->VTotal; + if(p->Flags & V_INTERLACE) refresh *= 2.0; + if(p->Flags & V_DBLSCAN) refresh /= 2.0; + if(p->VScan > 1) refresh /= p->VScan; + } + if(p->Flags & V_INTERLACE) desc = " (I)"; + if(p->Flags & V_DBLSCAN) desc = " (D)"; + if(p->VScan > 1) desc2 = " (VScan)"; +#ifdef M_T_USERDEF + if(p->type & M_T_USERDEF) uprefix = "*"; +#endif + if(p->type & M_T_BUILTIN) { + prefix = "Built-in mode"; + output = ""; + } else if (p->type & M_T_DEFAULT) { + prefix = "Default mode"; + } else { + output = ""; + } + + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "%s%s \"%s\" (%dx%d) (%s%.1f MHz, %.1f kHz, %.1f Hz%s%s)\n", + uprefix, prefix, p->name, p->HDisplay, p->VDisplay, output, + p->Clock / 1000.0, hsync, refresh, desc, desc2); + + p = p->next; + } while (p != NULL && p != pScrn->modes); +} + void SISDetermineLCDACap(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); @@ -2465,18 +2678,17 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) SISEntPtr pSiSEnt = NULL; #endif MessageType from; - UChar usScratchCR17, CR5F; - UChar usScratchCR32, usScratchCR63; - UChar usScratchSR1F, tempreg; - UChar srlockReg, crlockReg; + UChar usScratchCR17, usScratchCR32, usScratchCR63; + UChar usScratchSR1F, srlockReg, crlockReg; unsigned int i; int pix24flags, temp; ClockRangePtr clockRanges; + xf86MonPtr pMonitor = NULL; + Bool didddc2, fromDDC, crt1freqoverruled = FALSE; + UChar CR5F, tempreg; #if defined(SISMERGED) || defined(SISDUALHEAD) DisplayModePtr first, p, n; #endif - xf86MonPtr pMonitor = NULL; - Bool didddc2, fromDDC, crt1freqoverruled = FALSE; #ifdef SISMERGED Bool crt2freqoverruled = FALSE; #endif @@ -2500,7 +2712,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) #endif if(flags & PROBE_DETECT) { - + vbeInfoPtr pVbe; if(xf86LoadSubModule(pScrn, "vbe")) { @@ -2556,7 +2768,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) #endif ); xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Copyright (C) 2001-2004 Thomas Winischhofer and others\n"); + "Copyright (C) 2001-2005 Thomas Winischhofer and others\n"); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "*** See http://www.winischhofer.net/linuxsisvga.shtml\n"); xf86DrvMsg(pScrn->scrnIndex, X_INFO, @@ -2616,7 +2828,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } } #endif - + /* Find the PCI info for this screen */ pSiS->PciInfo = xf86GetPciInfoForEntity(pSiS->pEnt->index); pSiS->PciTag = pSiS->sishw_ext.PciTag = pciTag(pSiS->PciInfo->bus, @@ -2662,14 +2874,14 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) #endif #ifdef SISUSEDEVPORT - sisdevport = open("/dev/port", O_RDWR, 0); - if(sisdevport == -1) { + if((sisdevport = open("/dev/port", O_RDWR, 0)) == -1) { SISErrorLog(pScrn, "Failed to open /dev/port for read/write\n"); SISFreeRec(pScrn); return FALSE; } + pSiS->sisdevportopen = TRUE; #endif - + #ifdef SIS_PC_PLATFORM /* Map 64k VGA window for saving/restoring CGA fonts */ SiS_MapVGAMem(pScrn); @@ -2728,6 +2940,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) * Set the Chipset and ChipRev, allowing config file entries to * override. DANGEROUS! */ + if(pSiS->pEnt->device->chipset && *pSiS->pEnt->device->chipset) { pScrn->chipset = pSiS->pEnt->device->chipset; pSiS->Chipset = xf86StringToToken(SISChipsets, pScrn->chipset); @@ -2742,7 +2955,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } else { from = X_PROBED; pSiS->Chipset = pSiS->PciInfo->chipType; - pScrn->chipset = (char *)xf86TokenToString(SISChipsets, pSiS->Chipset); + pScrn->chipset = (char *)xf86TokenToString(SISChipsets, pSiS->Chipset); } if(pSiS->pEnt->device->chipRev >= 0) { pSiS->ChipRev = pSiS->pEnt->device->chipRev; @@ -2752,7 +2965,6 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->ChipRev = pSiS->PciInfo->chipRev; } pSiS->sishw_ext.jChipRevision = pSiS->ChipRev; - pSiS->SiS6326Flags = 0; if(pSiS->Chipset == PCI_CHIP_SIS6326) { @@ -2779,7 +2991,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) /* * This shouldn't happen because such problems should be caught in - * SISProbe(), but check it just in case. + * SISProbe(), but check it just in case the user has overridden them. */ if(pScrn->chipset == NULL) { SISErrorLog(pScrn, "ChipID 0x%04X is not recognised\n", pSiS->Chipset); @@ -2801,7 +3013,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } /* Reset some entries */ - pSiS->SiSFastVidCopy = SiSVidCopyGetDefault(); + pSiS->SiSFastVidCopy = pSiS->SiSFastMemCopy = SiSVidCopyGetDefault(); pSiS->SiSFastVidCopyDone = FALSE; /* Always do a ValidMode() inside Switchmode() */ @@ -2809,7 +3021,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) /* Determine chipset and VGA engine type */ pSiS->ChipFlags = 0; - pSiS->SiS_SD_Flags = 0; + pSiS->SiS_SD_Flags = pSiS->SiS_SD2_Flags = 0; pSiS->HWCursorMBufNum = pSiS->HWCursorCBufNum = 0; pSiS->NeedFlush = FALSE; pSiS->NewCRLayout = FALSE; @@ -2998,19 +3210,19 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) Bool gotit = FALSE; - if(!ioctl(fd, SISFB_GET_INFO_SIZE, &sisfbinfosize)) { - if((mysisfbinfo = xalloc(sisfbinfosize))) { - if(!ioctl(fd, (SISFB_GET_INFO | (sisfbinfosize << 16)), mysisfbinfo)) { - gotit = TRUE; - } else { - xfree(mysisfbinfo); - mysisfbinfo = NULL; - } - } - } else { - if((mysisfbinfo = xalloc(sizeof(*mysisfbinfo)+16))) { - if(!ioctl(fd, SISFB_GET_INFO_OLD, mysisfbinfo)) { - gotit = TRUE; + if(!ioctl(fd, SISFB_GET_INFO_SIZE, &sisfbinfosize)) { + if((mysisfbinfo = xalloc(sisfbinfosize))) { + if(!ioctl(fd, (SISFB_GET_INFO | (sisfbinfosize << 16)), mysisfbinfo)) { + gotit = TRUE; + } else { + xfree(mysisfbinfo); + mysisfbinfo = NULL; + } + } + } else { + if((mysisfbinfo = xalloc(sizeof(*mysisfbinfo)+16))) { + if(!ioctl(fd, SISFB_GET_INFO_OLD, mysisfbinfo)) { + gotit = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Possibly old version of sisfb detected. Please update.\n"); } else { @@ -3041,7 +3253,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) if(pSiS->sisfbfound) { xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "%s: SiS kernel fb driver (sisfb) %d.%d.%d detected (PCI: %02d:%02d.%d)\n", + "%s: SiS kernel fb driver (sisfb) %d.%d.%d detected (PCI: %d:%d.%d)\n", &name[5], mysisfbinfo->sisfb_version, mysisfbinfo->sisfb_revision, @@ -3049,14 +3261,15 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->PciInfo->bus, pSiS->PciInfo->device, pSiS->PciInfo->func); + /* Added version/rev/pl in sisfb 1.4.0 */ if(mysisfbinfo->sisfb_version == 0) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Old version of sisfb found. Please update.\n"); } - pSiS->sisfbMem = mysisfbinfo->heapstart; /* Basically, we can't trust the pdc register if sisfb is loaded */ pSiS->donttrustpdc = TRUE; + pSiS->sisfbMem = mysisfbinfo->heapstart; xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "sisfb: memory heap starts at %dKB\n", (int)pSiS->sisfbMem); xf86DrvMsg(pScrn->scrnIndex, X_PROBED, @@ -3071,7 +3284,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) (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; @@ -3149,15 +3362,15 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) * Set SupportConvert... flags since we use the fb layer which * supports this conversion. (24to32 seems not implemented though) * Additionally, determine the size of the HWCursor memory area. - */ + */ switch(pSiS->VGAEngine) { case SIS_300_VGA: pSiS->CursorSize = 4096; pix24flags = Support32bppFb; break; - case SIS_315_VGA: + case SIS_315_VGA: pSiS->CursorSize = 16384; - pix24flags = Support32bppFb; + pix24flags = Support32bppFb; break; case SIS_530_VGA: pSiS->CursorSize = 2048; @@ -3194,7 +3407,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiSEnt->ROM661New = FALSE; pSiSEnt->SiS_Pr = NULL; pSiSEnt->RenderAccelArray = NULL; - pSiSEnt->SiSFastVidCopy = NULL; + pSiSEnt->SiSFastVidCopy = pSiSEnt->SiSFastMemCopy = NULL; } else { /* Second Head (always CRT1) */ pSiS->SecondHead = TRUE; @@ -3259,9 +3472,9 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) /* Get our relocated IO registers */ pSiS->RelIO = (SISIOADDRESS)(pSiS->PciInfo->ioBase[2] + pSiS->IODBase); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Relocated I/O registers at 0x%lX\n", + (ULong)pSiS->RelIO); pSiS->sishw_ext.ulIOAddress = (SISIOADDRESS)(pSiS->RelIO + 0x30); - xf86DrvMsg(pScrn->scrnIndex, from, "Relocated I/O registers at 0x%lX\n", - (ULong)pSiS->RelIO); /* Initialize SiS Port Reg definitions for externally used * init.c/init301.c functions. @@ -3273,7 +3486,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) * but I keep it here for future use. * 205, 215 and 225 are to be treated the same way, 201 and 202 * are different. - */ + */ if(pSiS->VGAEngine == SIS_OLD_VGA || pSiS->VGAEngine == SIS_530_VGA) { switch(pSiS->Chipset) { case PCI_CHIP_SG86C201: @@ -3463,7 +3676,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->BIOS = NULL; pSiS->sishw_ext.UseROM = FALSE; pSiS->ROM661New = FALSE; - + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { #ifdef SISDUALHEAD if(pSiSEnt) { @@ -3551,7 +3764,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } #endif - /* Probe CPU features */ + /* Probe CPU features */ #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { pSiS->CPUFlags = pSiSEnt->CPUFlags; @@ -3565,21 +3778,6 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) #endif } - /* Setup gamma (the cmap layer needs this to be initialised) */ - /* (Do this after evaluating options) */ - { - Gamma zeros = {0.0, 0.0, 0.0}; - if(!xf86SetGamma(pScrn, zeros)) { - SISErrorLog(pScrn, "xf86SetGamma() error\n"); -#ifdef SISDUALHEAD - if(pSiSEnt) pSiSEnt->ErrorAfterFirst = TRUE; -#endif - if(pSiS->pInt) xf86FreeInt10(pSiS->pInt); - SISFreeRec(pScrn); - return FALSE; - } - } - /* We use a programamble clock */ pScrn->progClock = TRUE; @@ -3727,7 +3925,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } #endif - /* Handle UseROMData, NoOEM and UsePanelScaler options */ + /* Handle UseROMData, NoOEM and UsePanelScaler options */ if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { from = X_PROBED; if(pSiS->OptROMUsage == 0) { @@ -3746,8 +3944,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) /* Do some HW configuration detection (memory amount & type, clock, etc) */ SiSSetup(pScrn); - - from = X_PROBED; + + /* Get framebuffer address */ if(pSiS->pEnt->device->MemBase != 0) { /* * XXX Should check that the config file value matches one of the @@ -3757,10 +3955,8 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) from = X_CONFIG; } else { pSiS->FbAddress = pSiS->PciInfo->memBase[0] & 0xFFFFFFF0; + from = X_PROBED; } - - pSiS->realFbAddress = pSiS->FbAddress; - #ifdef SISDUALHEAD if(pSiS->DualHeadMode) xf86DrvMsg(pScrn->scrnIndex, from, "Global linear framebuffer at 0x%lX\n", @@ -3769,8 +3965,10 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) #endif xf86DrvMsg(pScrn->scrnIndex, from, "Linear framebuffer at 0x%lX\n", (ULong)pSiS->FbAddress); + + pSiS->realFbAddress = pSiS->FbAddress; - from = X_PROBED; + /* Get MMIO address */ if(pSiS->pEnt->device->IOBase != 0) { /* * XXX Should check that the config file value matches one of the @@ -3780,13 +3978,14 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) from = X_CONFIG; } else { pSiS->IOAddress = pSiS->PciInfo->memBase[1] & 0xFFFFFFF0; + from = X_PROBED; } - xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX (size %ldK)\n", (ULong)pSiS->IOAddress, pSiS->mmioSize); + pSiS->sishw_ext.bIntegratedMMEnabled = TRUE; - - /* Register the PCI-assigned resources. */ + + /* Register the PCI-assigned resources */ if(xf86RegisterResources(pSiS->pEnt->index, NULL, ResExclusive)) { SISErrorLog(pScrn, "xf86RegisterResources() found resource conflicts\n"); #ifdef SISDUALHEAD @@ -3796,7 +3995,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) sisRestoreExtRegisterLock(pSiS,srlockReg,crlockReg); SISFreeRec(pScrn); return FALSE; - } + } from = X_PROBED; if(pSiS->pEnt->device->videoRam != 0) { @@ -3810,7 +4009,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } pSiS->RealVideoRam = pScrn->videoRam; - + if((pSiS->Chipset == PCI_CHIP_SIS6326) && (pScrn->videoRam > 4096) && (from != X_CONFIG)) { @@ -3846,7 +4045,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->CurFGCol = pSiS->CurBGCol = 0; switch(pSiS->VGAEngine) { - + case SIS_300_VGA: pSiS->TurboQueueLen = 512; if(pSiS->TurboQueue) { @@ -3883,16 +4082,17 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->cursorOffset = 512; } #endif - if(pSiS->HWCursor) { + if(pSiS->HWCursor) { pSiS->availMem -= (pSiS->CursorSize * 2); if(pSiS->OptUseColorCursor) pSiS->availMem -= (pSiS->CursorSize * 2); + } pSiS->cursorBufferNum = 0; #ifdef SISDUALHEAD if(pSiSEnt) pSiSEnt->cursorBufferNum = 0; #endif break; - + default: /* cursorOffset not used in cursor functions for 530 and * older chips, because the cursor is *above* the TQ. @@ -3942,9 +4142,10 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) /* This is to be subtracted from MMIO queue length register contents * for getting the real Queue length. */ - pSiS->CmdQueLenFix = (pSiS->TurboQueue) ? 32 : 0; + pSiS->CmdQueLenFix = (pSiS->TurboQueue) ? 32 : 0; } + #ifdef SISDUALHEAD /* In dual head mode, we share availMem equally - so align it * to 8KB; this way, the address of the FB of the second @@ -3986,21 +4187,21 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } else if(pSiS->sisfbMem) { pSiS->maxxfbmem = pSiS->sisfbMem * 1024; } - else pSiS->maxxfbmem = pSiS->availMem; + else pSiS->maxxfbmem = pSiS->availMem; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using %ldK of framebuffer memory\n", pSiS->maxxfbmem / 1024); /* Find out about sub-classes of some chipsets and check * if the chipset supports two video overlays - */ + */ if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA || pSiS->Chipset == PCI_CHIP_SIS530 || pSiS->Chipset == PCI_CHIP_SIS6326 || pSiS->Chipset == PCI_CHIP_SIS5597) { pSiS->hasTwoOverlays = FALSE; - switch(pSiS->Chipset) { + switch(pSiS->Chipset) { case PCI_CHIP_SIS300: case PCI_CHIP_SIS630: case PCI_CHIP_SIS550: @@ -4116,7 +4317,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } } break; - } + } } xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Hardware supports %s video overlay%s\n", @@ -4124,6 +4325,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->hasTwoOverlays ? "s" : ""); } + /* Backup VB connection and CRT1 on/off register */ if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { inSISIDXREG(SISSR, 0x1f, pSiS->oldSR1F); @@ -4226,7 +4428,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) /* Detect CRT1 (via DDC1 and DDC2, hence via VGA port; regardless of LCDA) */ SISCRT1PreInit(pScrn); - + /* Detect LCD (connected via CRT2, regardless of LCDA) and LCD resolution */ SISLCDPreInit(pScrn, FALSE); @@ -4247,10 +4449,42 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) /* Setup SD flags */ pSiS->SiS_SD_Flags |= SiS_SD_ADDLSUPFLAG; + + 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 ); + if(pSiS->VBFlags & VB_SISLVDSBRIDGE) { + pSiS->SiS_SD2_Flags |= ( SiS_SD2_LCDLVDS | + SiS_SD2_SUPPORTLCD ); + } else if(pSiS->VBFlags & VB_SISTMDSBRIDGE) { + if(!(pSiS->VBFlags & VB_30xBDH)) { + 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 ); + } + } + } else if(pSiS->VBFlags & VB_LVDS) { + pSiS->SiS_SD2_Flags |= ( SiS_SD2_THIRDPARTYLVDS | + SiS_SD2_SUPPORTLCD ); + } - if(pSiS->VBFlags & (VB_SISTVBRIDGE | VB_CHRONTEL)) { - pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTTV; - } + if(pSiS->VBFlags & (VB_SISTVBRIDGE | VB_CHRONTEL)) { + 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; + } else { + pSiS->SiS_SD2_Flags |= SiS_SD2_SUPPTVEDGE; + } + } + } + } #ifdef ENABLE_YPBPR if((pSiS->VGAEngine == SIS_315_VGA) && @@ -4319,16 +4553,26 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->SiS_SD_Flags |= (SiS_SD_SUPPORTSCART | SiS_SD_SUPPORTVGA2); } if(pSiS->VBFlags & VB_CHRONTEL) { - pSiS->SiS_SD_Flags |= SiS_SD_SUPPORTOVERSCAN; + 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; } } SISDetermineLCDACap(pScrn); - if((!(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTLCDA)) || - (!(pSiS->VBFlags & CRT2_LCD))) { - /* No LCDA if not supported or no LCD panel found */ + if(pSiS->SiS_SD_Flags & SiS_SD_SUPPORTLCDA) { + if(pSiS->ForceCRT1Type == CRT1_LCDA) { + if(pSiS->VBFlags & VB_SISTMDSLCDABRIDGE) { + if(!(pSiS->VBLCDFlags)) { + SiSSetupPseudoPanel(pScrn); + pSiS->detectedCRT2Devices |= CRT2_LCD; + } + } else if(!(pSiS->VBLCDFlags)) { + pSiS->ForceCRT1Type = CRT1_VGA; + } + } + } else { pSiS->ForceCRT1Type = CRT1_VGA; } @@ -4357,9 +4601,9 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) switch(pSiS->ForceCRT2Type) { case CRT2_TV: pSiS->VBFlags &= ~(CRT2_LCD | CRT2_VGA); - if(pSiS->VBFlags & (VB_SISTVBRIDGE | VB_CHRONTEL)) + if(pSiS->VBFlags & (VB_SISTVBRIDGE | VB_CHRONTEL)) { pSiS->VBFlags |= CRT2_TV; - else { + } else { pSiS->VBFlags &= ~(CRT2_TV); xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Hardware does not support TV output\n"); @@ -4367,9 +4611,12 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) break; case CRT2_LCD: pSiS->VBFlags &= ~(CRT2_TV | CRT2_VGA); - if((pSiS->VBFlags & VB_VIDEOBRIDGE) && (pSiS->VBLCDFlags)) + if((pSiS->VBFlags & VB_VIDEOBRIDGE) && (pSiS->VBLCDFlags)) { pSiS->VBFlags |= CRT2_LCD; - else { + } else if((pSiS->VBFlags & VB_SISTMDSBRIDGE) && (!(pSiS->VBFlags & VB_30xBDH))) { + SiSSetupPseudoPanel(pScrn); + pSiS->detectedCRT2Devices |= CRT2_LCD; + } else { pSiS->VBFlags &= ~(CRT2_LCD); xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Can't force CRT2 to LCD, no LCD detected\n"); @@ -4377,9 +4624,9 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) break; case CRT2_VGA: pSiS->VBFlags &= ~(CRT2_TV | CRT2_LCD); - if(pSiS->VBFlags & VB_SISVGA2BRIDGE) + if(pSiS->VBFlags & VB_SISVGA2BRIDGE) { pSiS->VBFlags |= CRT2_VGA; - else { + } else { pSiS->VBFlags &= ~(CRT2_VGA); xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Hardware does not support secondary VGA\n"); @@ -4388,6 +4635,13 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) default: pSiS->VBFlags &= ~(CRT2_TV | CRT2_LCD | CRT2_VGA); } + + /* Setup gamma (the cmap layer needs this to be initialised) */ + /* (Do this after evaluating options) */ + { + Gamma zeros = {0.0, 0.0, 0.0}; + xf86SetGamma(pScrn, zeros); + } #ifdef SISDUALHEAD if((!pSiS->DualHeadMode) || (pSiS->SecondHead)) { @@ -4418,7 +4672,9 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) #ifdef SISDUALHEAD if(pSiS->DualHeadMode) pSiS->CRT2SepGamma = FALSE; - +#endif + +#ifdef SISDUALHEAD if((!pSiS->DualHeadMode) || (!pSiS->SecondHead)) #endif { @@ -4444,7 +4700,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } } - /* Eventually overrule TV Type (SVIDEO, COMPOSITE, SCART, HIVISION, YPBPR) */ + /* Eventually overrule TV Type (SVIDEO, COMPOSITE, SCART, HIVISION, YPBPR) */ if(pSiS->VBFlags & VB_SISTVBRIDGE) { if(pSiS->ForceTVType != -1) { pSiS->VBFlags &= ~(TV_INTERFACE); @@ -4526,7 +4782,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->newCR32 = usScratchCR32; } - /* Check if CRT1 used (or needed; this eg. if no CRT2 detected) */ + /* Check if CRT1 used (or needed; this eg. if no CRT2 detected) */ if(pSiS->VBFlags & VB_VIDEOBRIDGE) { /* No CRT2 output? Then we NEED CRT1! @@ -4544,7 +4800,6 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } } else { /* no video bridge? */ - /* Then we NEED CRT1... */ pSiS->CRT1off = 0; /* ... and can't use CRT2 for Xv output */ @@ -4554,7 +4809,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) /* LCDA? Then we don't switch off CRT1 */ if(pSiS->VBFlags & CRT1_LCDA) pSiS->CRT1off = 0; - /* Handle TVStandard option */ + /* Handle TVStandard option */ if((pSiS->NonDefaultPAL != -1) || (pSiS->NonDefaultNTSC != -1)) { if( (!(pSiS->VBFlags & VB_SISTVBRIDGE)) && (!((pSiS->VBFlags & VB_CHRONTEL)) && (pSiS->ChrontelType == CHRONTEL_701x)) ) { @@ -4622,7 +4877,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } } - /* Do some checks */ + /* Do some checks */ if(pSiS->OptTVOver != -1) { if(pSiS->VBFlags & VB_CHRONTEL) { pSiS->UseCHOverScan = pSiS->OptTVOver; @@ -4757,7 +5012,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } } - /* Init Ptrs for Save/Restore functions and calc MaxClock */ + /* Init ptrs for Save/Restore functions and calc MaxClock */ SISDACPreInit(pScrn); /* ********** end of VBFlags setup ********** */ @@ -4979,12 +5234,13 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } #endif -#ifdef SISDUALHEAD + /* In dual head mode, both heads (currently) share the maxxfbmem equally. * 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. */ +#ifdef SISDUALHEAD pSiS->dhmOffset = 0; if(pSiS->DualHeadMode) { if(!pSiS->SecondHead) { @@ -5031,7 +5287,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) #if 0 /* For future use */ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No memory for DRI heap. Please set the option \"MaxXFBMem\" to\n" - "\tlimit the memory XFree should use and leave the rest to DRI\n"); + "\tlimit the memory X should use and leave the rest to DRI\n"); #endif pSiS->DRIheapstart = pSiS->DRIheapend = 0; } @@ -5162,147 +5418,18 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } } #endif - - /* If there is no HSync or VRefresh data for the monitor, - * derive it from DDC data. Essentially done by common layer - * since 4.3.99.14, but this is not usable since it is done - * too late (in ValidateModes()). - * Addendum: I overrule the ranges now in any case unless - * it would affect a CRT output device or DDC data is available. - * Hence, for LCD(A) and TV, we always get proper ranges. This - * is entirely harmless. However, option "NoOverruleRanges" will - * disable this behavior. - * This should "fix" the - by far - most common configuration - * mistakes. - */ - - crt1freqoverruled = FALSE; - - fromDDC = FALSE; - if((pScrn->monitor->nHsync <= 0) || (pSiS->OverruleRanges)) { - if((pScrn->monitor->nHsync <= 0) && (pScrn->monitor->DDC)) { - SiSSetSyncRangeFromEdid(pScrn, 1); - if(pScrn->monitor->nHsync > 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, subshstr, -#ifdef SISDUALHEAD - pSiS->DualHeadMode ? (pSiS->SecondHead ? 1 : 2) : -#endif - pSiS->CRT1off ? 2 : 1); - fromDDC = TRUE; - } - } - if((pScrn->monitor->nHsync <= 0) || (pSiS->OverruleRanges)) { - if(SiSAllowSyncOverride(pSiS, fromDDC)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, saneh, - (pScrn->monitor->nHsync <= 0) ? "missing" : "bogus", -#ifdef SISDUALHEAD - pSiS->DualHeadMode ? (pSiS->SecondHead ? 1 : 2) : -#endif - pSiS->CRT1off ? 2 : 1); - /* Set sane ranges for LCD and TV - * (our strict checking will filter out invalid ones anyway) - */ - pScrn->monitor->nHsync = 1; - pScrn->monitor->hsync[0].lo = 25; - pScrn->monitor->hsync[0].hi = 80; - crt1freqoverruled = TRUE; - } - } - } - - fromDDC = FALSE; - if((pScrn->monitor->nVrefresh <= 0) || (pSiS->OverruleRanges)) { - if((pScrn->monitor->nVrefresh <= 0) && (pScrn->monitor->DDC)) { - SiSSetSyncRangeFromEdid(pScrn, 0); - if(pScrn->monitor->nVrefresh > 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, subsvstr, -#ifdef SISDUALHEAD - pSiS->DualHeadMode ? (pSiS->SecondHead ? 1 : 2) : -#endif - pSiS->CRT1off ? 2 : 1); - fromDDC = TRUE; - } - } - if((pScrn->monitor->nVrefresh <= 0) || (pSiS->OverruleRanges)) { - if(SiSAllowSyncOverride(pSiS, fromDDC)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, sanev, - (pScrn->monitor->nVrefresh <= 0) ? "missing" : "bogus", -#ifdef SISDUALHEAD - pSiS->DualHeadMode ? (pSiS->SecondHead ? 1 : 2) : -#endif - pSiS->CRT1off ? 2 : 1); - /* Set sane ranges for LCD and TV */ - pScrn->monitor->nVrefresh = 1; - pScrn->monitor->vrefresh[0].lo = 50; /* 50 for 1280x720@50 */ - pScrn->monitor->vrefresh[0].hi = 62; - crt1freqoverruled = TRUE; - } - } - } - - -#ifdef SISMERGED - if(pSiS->MergedFB) { - - crt2freqoverruled = FALSE; - - fromDDC = FALSE; - if((pSiS->CRT2pScrn->monitor->nHsync <= 0) || (pSiS->OverruleRanges)) { - 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); - fromDDC = TRUE; - } - } - if((pSiS->CRT2pScrn->monitor->nHsync <= 0) || (pSiS->OverruleRanges)) { - if( (pSiS->VBFlags & CRT2_TV) || - ((pSiS->VBFlags & CRT2_LCD) && (!fromDDC)) ) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, saneh, - (pSiS->CRT2pScrn->monitor->nHsync <= 0) ? "missing" : "bogus", 2); - /* Set sane ranges for LCD and TV */ - pSiS->CRT2pScrn->monitor->nHsync = 1; - pSiS->CRT2pScrn->monitor->hsync[0].lo = 25; - pSiS->CRT2pScrn->monitor->hsync[0].hi = 80; - crt2freqoverruled = TRUE; - } - } - } - - 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) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, subsvstr, 2); - fromDDC = TRUE; - } - } - if((pSiS->CRT2pScrn->monitor->nVrefresh <= 0) || (pSiS->OverruleRanges)) { - if( (pSiS->VBFlags & CRT2_TV) || - ((pSiS->VBFlags & CRT2_LCD) && (!fromDDC)) ) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, sanev, - (pSiS->CRT2pScrn->monitor->nVrefresh <= 0) ? "missing" : "bogus", 2); - /* Set sane ranges for LCD and TV */ - pSiS->CRT2pScrn->monitor->nVrefresh = 1; - pSiS->CRT2pScrn->monitor->vrefresh[0].lo = 50; /* 50 for 1280x720@50 */ - pSiS->CRT2pScrn->monitor->vrefresh[0].hi = 62; - crt2freqoverruled = TRUE; - } - } - } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, crtsetupstr, 1); - } -#endif /* end of DDC */ /* From here, we mainly deal with clocks and modes */ + +#ifdef SISMERGED + if(pSiS->MergedFB) xf86DrvMsg(pScrn->scrnIndex, X_INFO, crtsetupstr, 1); +#endif /* Set the min pixel clock */ pSiS->MinClock = 5000; if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { - pSiS->MinClock = 9500; + pSiS->MinClock = 10000; } xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "Min pixel clock is %d MHz\n", pSiS->MinClock / 1000); @@ -5350,13 +5477,13 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) * -) vbtype is 301, 301B, 301C or 302B, and * -) crt2 device is not TV, and * -) crt1 is not LCDA, unless bridge is TMDS/LCDA capable (301C) - */ + */ if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { if(!(pSiS->noInternalModes)) { Bool acceptcustommodes = TRUE; /* Accept user modelines */ Bool includelcdmodes = TRUE; /* Include modes reported by DDC */ - Bool isfordvi = FALSE; /* Is for digital DVI output */ - Bool fakecrt2modes = FALSE; /* Fake some modes for CRT2 */ + Bool isfordvi = FALSE; /* Is for digital DVI output */ + Bool fakecrt2modes = FALSE; /* Fake some modes for CRT2 */ if(pSiS->UseVESA) { acceptcustommodes = FALSE; includelcdmodes = FALSE; @@ -5458,7 +5585,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->HaveCustomModes = FALSE; if(SiSMakeOwnModeList(pScrn, acceptcustommodes, includelcdmodes, - isfordvi, &pSiS->HaveCustomModes, fakecrt2modes)) { + isfordvi, &pSiS->HaveCustomModes, FALSE /*fakecrt2modes*/ )) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Replaced %s mode list with built-in modes\n", pSiS->HaveCustomModes ? "default" : "entire"); @@ -5508,6 +5635,81 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } } } + + /* If there is no HSync or VRefresh data for the monitor, + * derive it from DDC data. Essentially done by common layer + * since 4.3.99.14, but this is not usable since it is done + * too late (in ValidateModes()). + * Addendum: I overrule the ranges now in any case unless + * it would affect a CRT output device or DDC data is available. + * Hence, for LCD(A) and TV, we always get proper ranges. This + * is entirely harmless. However, option "NoOverruleRanges" will + * disable this behavior. + * This should "fix" the - by far - most common configuration + * mistakes. + */ + + crt1freqoverruled = FALSE; + + fromDDC = FALSE; + if((pScrn->monitor->nHsync <= 0) || (pSiS->OverruleRanges)) { + if((pScrn->monitor->nHsync <= 0) && (pScrn->monitor->DDC)) { + SiSSetSyncRangeFromEdid(pScrn, 1); + if(pScrn->monitor->nHsync > 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, subshstr, +#ifdef SISDUALHEAD + pSiS->DualHeadMode ? (pSiS->SecondHead ? 1 : 2) : +#endif + pSiS->CRT1off ? 2 : 1); + fromDDC = TRUE; + } + } + if((pScrn->monitor->nHsync <= 0) || (pSiS->OverruleRanges)) { + 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", +#ifdef SISDUALHEAD + pSiS->DualHeadMode ? (pSiS->SecondHead ? 1 : 2) : +#endif + pSiS->CRT1off ? 2 : 1); + } + } + } + } + + fromDDC = FALSE; + if((pScrn->monitor->nVrefresh <= 0) || (pSiS->OverruleRanges)) { + if((pScrn->monitor->nVrefresh <= 0) && (pScrn->monitor->DDC)) { + SiSSetSyncRangeFromEdid(pScrn, 0); + if(pScrn->monitor->nVrefresh > 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, subsvstr, +#ifdef SISDUALHEAD + pSiS->DualHeadMode ? (pSiS->SecondHead ? 1 : 2) : +#endif + pSiS->CRT1off ? 2 : 1); + fromDDC = TRUE; + } + } + if((pScrn->monitor->nVrefresh <= 0) || (pSiS->OverruleRanges)) { + 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", +#ifdef SISDUALHEAD + pSiS->DualHeadMode ? (pSiS->SecondHead ? 1 : 2) : +#endif + pSiS->CRT1off ? 2 : 1); + } + } + } + } if(pSiS->VGAEngine == SIS_300_VGA || pSiS->VGAEngine == SIS_315_VGA) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, @@ -5606,43 +5808,43 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) * -) Find the highest used pixelclock on the master head. */ #ifdef SISDUALHEAD - if(pSiS->DualHeadMode) { + if((pSiS->DualHeadMode) && (!pSiS->SecondHead)) { + + pSiSEnt->maxUsedClock = 0; + + if((p = first = pScrn->modes)) { + + do { + + n = p->next; - if(!pSiS->SecondHead) { + /* Modes that require the bridge to operate in SlaveMode + * 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; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, notsuitablestr, p->name, "dual head"); + } - pSiSEnt->maxUsedClock = 0; + /* Search for the highest clock on first head in order to calculate + * max clock for second head (CRT1) + */ + if((p->status == MODE_OK) && (p->Clock > pSiSEnt->maxUsedClock)) { + pSiSEnt->maxUsedClock = p->Clock; + } - if((p = first = pScrn->modes)) { - do { - n = p->next; + p = n; - /* Modes that require the bridge to operate in SlaveMode - * 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; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, notsuitablestr, p->name, "dual head"); - } - - /* Search for the highest clock on first head in order to calculate - * max clock for second head (CRT1) - */ - if((p->status == MODE_OK) && (p->Clock > pSiSEnt->maxUsedClock)) { - pSiSEnt->maxUsedClock = p->Clock; - } - - p = n; - - } while (p != NULL && p != first); - } + } while (p != NULL && p != first); + } } -#endif +#endif /* Prune the modes marked as invalid */ xf86PruneDriverModes(pScrn); @@ -5675,8 +5877,36 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) #endif /* Print the list of modes being used */ - xf86PrintModes(pScrn); - + { + Bool usemyprint = FALSE; + +#ifdef SISDUALHEAD + if(pSiS->DualHeadMode) { + if(pSiS->SecondHead) { + if(pSiS->VBFlags & CRT1_LCDA) usemyprint = TRUE; + } else { + if(pSiS->VBFlags & (CRT2_LCD | CRT2_TV)) usemyprint = TRUE; + } + } else +#endif +#ifdef SISMERGED + if(pSiS->MergedFB) { + if(pSiS->VBFlags & CRT1_LCDA) usemyprint = TRUE; + } else +#endif + { + if( (pSiS->VBFlags & (CRT2_LCD | CRT2_TV)) && + (!(pSiS->VBFlags & DISPTYPE_DISP1)) ) + usemyprint = TRUE; + } + + if(usemyprint) { + SiSPrintModes(pScrn); + } else { + xf86PrintModes(pScrn); + } + } + #ifdef SISMERGED if(pSiS->MergedFB) { Bool acceptcustommodes = TRUE; @@ -5723,7 +5953,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) pSiS->HaveCustomModes2 = FALSE; if(!SiSMakeOwnModeList(pSiS->CRT2pScrn, acceptcustommodes, includelcdmodes, - isfordvi, &pSiS->HaveCustomModes2, fakecrt2modes)) { + isfordvi, &pSiS->HaveCustomModes2, FALSE /* fakecrt2modes */ )) { SISErrorLog(pScrn, "Building list of built-in modes for CRT2 failed, %s\n", mergeddisstr); @@ -5737,10 +5967,58 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } } - + if(pSiS->MergedFB) { - pointer backupddc = pSiS->CRT2pScrn->monitor->DDC; + pointer backupddc; + + crt2freqoverruled = FALSE; + + fromDDC = FALSE; + if((pSiS->CRT2pScrn->monitor->nHsync <= 0) || (pSiS->OverruleRanges)) { + 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); + fromDDC = TRUE; + } + } + 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); + /* Set sane ranges for LCD and TV */ + if((crt2freqoverruled = CheckAndOverruleH(pScrn, pSiS->CRT2pScrn->monitor))) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, saneh, + HaveNoRanges ? "missing" : "bogus", 2); + } + } + } + } + + 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) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, subsvstr, 2); + fromDDC = TRUE; + } + } + 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); + /* Set sane ranges for LCD and TV */ + if((crt2freqoverruled = CheckAndOverruleV(pScrn, pSiS->CRT2pScrn->monitor))) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, sanev, + HaveNoRanges ? "missing" : "bogus", 2); + } + } + } + } + + backupddc = pSiS->CRT2pScrn->monitor->DDC; /* Suppress bogus DDC warning */ if(crt2freqoverruled) pSiS->CRT2pScrn->monitor->DDC = NULL; @@ -5768,7 +6046,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) } if(pSiS->MergedFB) { - + if((p = first = pSiS->CRT2pScrn->modes)) { do { n = p->next; @@ -5780,7 +6058,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) (strcmp(p->name, "640x400") == 0) ) ) { p->status = MODE_BAD; xf86DrvMsg(pScrn->scrnIndex, X_INFO, notsuitablestr, p->name, "MergedFB"); - } + } p = n; } while (p != NULL && p != first); } @@ -5801,7 +6079,11 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, X_INFO, modesforstr, 2); - xf86PrintModes(pSiS->CRT2pScrn); + if(pSiS->VBFlags & (CRT2_LCD | CRT2_TV)) { + SiSPrintModes(pSiS->CRT2pScrn); + } else { + xf86PrintModes(pSiS->CRT2pScrn); + } pSiS->CRT1Modes = pScrn->modes; pSiS->CRT1CurrentMode = pScrn->currentMode; @@ -5932,7 +6214,7 @@ SISPreInit(ScrnInfoPtr pScrn, int flags) #endif /* Now load and initialize VBE module for VESA mode switching */ - pSiS->UseVESA = 0; + pSiS->UseVESA = 0; if(pSiS->VESA == 1) { SiS_LoadInitVBE(pScrn); if(pSiS->pVbe) { @@ -6071,28 +6353,19 @@ SISUnmapIOPMem(ScrnInfoPtr pScrn) static Bool SISMapMem(ScrnInfoPtr pScrn) { - SISPtr pSiS; - int mmioFlags; + SISPtr pSiS = SISPTR(pScrn); + int mmioFlags = VIDMEM_MMIO; #ifdef SISDUALHEAD - SISEntPtr pSiSEnt = NULL; -#endif - pSiS = SISPTR(pScrn); - -#ifdef SISDUALHEAD - pSiSEnt = pSiS->entityPrivate; + SISEntPtr pSiSEnt = pSiS->entityPrivate; #endif /* * Map IO registers to virtual address space + * (For Alpha, we need to map SPARSE memory, since we need + * byte/short access.) */ -#if !defined(__alpha__) - mmioFlags = VIDMEM_MMIO; -#else - /* - * For Alpha, we need to map SPARSE memory, since we need - * byte/short access. - */ - mmioFlags = VIDMEM_MMIO | VIDMEM_SPARSE; +#if defined(__alpha__) + mmioFlags |= VIDMEM_SPARSE; #endif #ifdef SISDUALHEAD @@ -6137,7 +6410,6 @@ SISMapMem(ScrnInfoPtr pScrn) SISErrorLog(pScrn, "Could not map MMIO dense area\n"); return FALSE; } - #endif /* __alpha__ */ #ifdef SISDUALHEAD @@ -6177,15 +6449,9 @@ SISMapMem(ScrnInfoPtr pScrn) static Bool SISUnmapMem(ScrnInfoPtr pScrn) { - SISPtr pSiS; + SISPtr pSiS = SISPTR(pScrn); #ifdef SISDUALHEAD - SISEntPtr pSiSEnt = NULL; -#endif - - pSiS = SISPTR(pScrn); - -#ifdef SISDUALHEAD - pSiSEnt = pSiS->entityPrivate; + SISEntPtr pSiSEnt = pSiS->entityPrivate; #endif /* In dual head mode, we must not unmap if the other head still @@ -6283,7 +6549,7 @@ SISSave(ScrnInfoPtr pScrn) sisSaveUnlockExtRegisterLock(pSiS,&sisReg->sisRegs3C4[0x05],&sisReg->sisRegs3D4[0x80]); (*pSiS->SiSSave)(pScrn, sisReg); - + if(pSiS->UseVESA) SISVESASaveRestore(pScrn, MODE_SAVE); /* "Save" these again as they may have been changed prior to SISSave() call */ @@ -6352,13 +6618,13 @@ SISVESASaveRestore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function) * Initialise a new mode. This is currently done using the * "initialise struct, restore/write struct to HW" model for * the old chipsets (5597/530/6326). For newer chipsets, - * we use our own mode switching code (or VESA). + * we use our own mode switching code. */ static Bool SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); SISRegPtr sisReg; #ifdef SISDUALHEAD SISEntPtr pSiSEnt = NULL; @@ -6373,7 +6639,7 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) } if(pSiS->UseVESA) { /* With VESA: */ - + #ifdef SISDUALHEAD /* No dual head mode when using VESA */ if(pSiS->SecondHead) return TRUE; @@ -6413,7 +6679,7 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) SiSVGAProtect(pScrn, TRUE); (*pSiS->SiSRestore)(pScrn, &pSiS->ModeReg); - SiSVGAProtect(pScrn, FALSE); + SiSVGAProtect(pScrn, FALSE); } else { /* Without VESA: */ @@ -6570,7 +6836,9 @@ SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) #endif SiSVGAProtect(pScrn, FALSE); + } + #ifdef SISDUALHEAD } #endif @@ -6806,7 +7074,7 @@ SISRestore(ScrnInfoPtr pScrn) xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "Restoring by setting old mode 0x%02x\n", pSiS->OldMode); - + if(((pSiS->OldMode <= 0x13) || (!pSiS->sisfbfound)) && (pSiS->pVbe)) { int vmode = SiSTranslateToVESA(pScrn, pSiS->OldMode); if(vmode > 0) { @@ -6887,17 +7155,7 @@ SISRestore(ScrnInfoPtr pScrn) #ifdef SISVRAMQ /* Restore queue mode registers on 315/330/340 series */ /* (This became necessary due to the switch to VRAM queue) */ - if(pSiS->VGAEngine == SIS_315_VGA) { - UChar tempCR55=0; - inSISIDXREG(SISCR,0x55,tempCR55); - andSISIDXREG(SISCR,0x55,0x33); - outSISIDXREG(SISSR,0x26,0x01); - MMIO_OUT32(pSiS->IOBase, 0x85c4, 0); - outSISIDXREG(SISSR,0x27,sisReg->sisRegs3C4[0x27]); - outSISIDXREG(SISSR,0x26,sisReg->sisRegs3C4[0x26]); - MMIO_OUT32(pSiS->IOBase, 0x85C0, sisReg->sisMMIO85C0); - outSISIDXREG(SISCR,0x55,tempCR55); - } + SiSRestoreQueueMode(pSiS, sisReg); #endif } else { @@ -6970,7 +7228,7 @@ SISRestore(ScrnInfoPtr pScrn) sisRestoreExtRegisterLock(pSiS,sisReg->sisRegs3C4[0x05],sisReg->sisRegs3D4[0x80]); } else { /* All other chipsets */ - + SiSVGAProtect(pScrn, TRUE); #ifdef UNLOCK_ALWAYS @@ -7017,7 +7275,7 @@ SISRestore(ScrnInfoPtr pScrn) sisRestoreExtRegisterLock(pSiS,sisReg->sisRegs3C4[5],sisReg->sisRegs3D4[0x80]); - SiSVGAProtect(pScrn, FALSE); + SiSVGAProtect(pScrn, FALSE); } } @@ -7025,24 +7283,16 @@ static void SISVESARestore(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); +#ifdef SISVRAMQ + SISRegPtr sisReg = &pSiS->SavedReg; +#endif if(pSiS->UseVESA) { SISVESASaveRestore(pScrn, MODE_RESTORE); #ifdef SISVRAMQ /* Restore queue mode registers on 315/330/340 series */ /* (This became necessary due to the switch to VRAM queue) */ - if(pSiS->VGAEngine == SIS_315_VGA) { - SISRegPtr sisReg = &pSiS->SavedReg; - UChar tempCR55=0; - inSISIDXREG(SISCR,0x55,tempCR55); - andSISIDXREG(SISCR,0x55,0x33); - outSISIDXREG(SISSR,0x26,0x01); - MMIO_OUT32(pSiS->IOBase, 0x85c4, 0); - outSISIDXREG(SISSR,0x27,sisReg->sisRegs3C4[0x27]); - outSISIDXREG(SISSR,0x26,sisReg->sisRegs3C4[0x26]); - MMIO_OUT32(pSiS->IOBase, 0x85C0, sisReg->sisMMIO85C0); - outSISIDXREG(SISCR,0x55,tempCR55); - } + SiSRestoreQueueMode(pSiS, sisReg); #endif } } @@ -7081,6 +7331,7 @@ SISBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask) if(pSiSEnt->HaveFastVidCpy) { pSiS->NeedCopyFastVidCpy = FALSE; pSiS->SiSFastVidCopy = pSiSEnt->SiSFastVidCopy; + pSiS->SiSFastMemCopy = pSiSEnt->SiSFastMemCopy; } } #endif @@ -7094,6 +7345,61 @@ SISBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask) } } +/* Our MessageHandler */ +#ifdef X_XF86MiscPassMessage +static int +SISHandleMessage(int scrnIndex, const char *msgtype, const char *msgval, char **retmsg) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SISPtr pSiS = SISPTR(pScrn); + int result = 0; + + strcpy(pSiS->messagebuffer, "NIL"); + + if(strcmp(msgtype, "SiSCtrl")) return BadMatch; + + if(!strncmp(msgval, "SD_NUMCOMMANDS", 14)) { + + sprintf(pSiS->messagebuffer, "OK %d", 3); + + } else if(!strncmp(msgval, "SD_CHECKMODEINDEXFORCRT2", 24)) { + + 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); + } else { + strcpy(pSiS->messagebuffer, "ERROR"); + } + + } else if(!strncmp(msgval, "SD_CHECKMODETIMINGFORCRT2", 25)) { + + 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", + &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; + + sprintf(pSiS->messagebuffer, "OK %lx", result); + } else { + strcpy(pSiS->messagebuffer, "ERROR"); + } + + } else + return BadMatch; + + *retmsg = pSiS->messagebuffer; + return 0; +} +#endif + /* Mandatory * This gets called at the start of each server generation * @@ -7159,7 +7465,7 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) #endif SiSEnableTurboQueue(pScrn); } - + /* Save the current state */ SISSave(pScrn); @@ -7243,9 +7549,7 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* Set the viewport */ SISAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); - /* - * Reset visual list. - */ + /* Reset visual list. */ miClearVisualTypes(); /* Setup the visuals we support. */ @@ -7302,7 +7606,7 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pSiS->cmdQueueLenPtr = &(pSiS->cmdQueueLen); pSiS->cmdQueueLen = 0; /* Force an EngineIdle() at start */ - + #ifdef XF86DRI if(pSiS->loadDRI) { #ifdef SISDUALHEAD @@ -7370,13 +7674,13 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* Initialize RENDER ext; must be after RGB ordering fixed */ fbPictureInit(pScreen, 0, 0); - /* hardware cursor needs to wrap this layer */ + /* hardware cursor needs to wrap this layer */ if(!pSiS->ShadowFB) SISDGAInit(pScreen); xf86SetBlackWhitePixels(pScreen); /* Initialize the accelerators */ - switch(pSiS->VGAEngine) { + switch(pSiS->VGAEngine) { case SIS_530_VGA: case SIS_300_VGA: SiS300AccelInit(pScreen); @@ -7399,20 +7703,21 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { if(pSiS->SecondHead) { - pSiSEnt->SiSFastVidCopy = SiSVidCopyInit(pScreen); + pSiSEnt->SiSFastVidCopy = SiSVidCopyInit(pScreen, &pSiSEnt->SiSFastMemCopy); pSiSEnt->HaveFastVidCpy = TRUE; } else { pSiS->NeedCopyFastVidCpy = TRUE; } pSiS->SiSFastVidCopy = pSiSEnt->SiSFastVidCopy; + pSiS->SiSFastMemCopy = pSiSEnt->SiSFastMemCopy; } else { #endif - pSiS->SiSFastVidCopy = SiSVidCopyInit(pScreen); + pSiS->SiSFastVidCopy = SiSVidCopyInit(pScreen, &pSiS->SiSFastMemCopy); #ifdef SISDUALHEAD } #endif } - pSiS->SiSFastVidCopyDone = TRUE; + pSiS->SiSFastVidCopyDone = TRUE; miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); @@ -7424,7 +7729,7 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if(pSiS->HWCursor) { SiSHWCursorInit(pScreen); } - + #ifdef SISDUALHEAD if(!pSiS->DualHeadMode) { #endif @@ -7484,10 +7789,8 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) RefreshAreaFuncPtr refreshArea = SISRefreshArea; if(pSiS->Rotate) { - if((!pSiS->PointerMoved) && (pSiS->RotateMouse)) { - pSiS->PointerMoved = pScrn->PointerMoved; - pScrn->PointerMoved = SISPointerMoved; - } + if(!pSiS->PointerMoved) pSiS->PointerMoved = pScrn->PointerMoved; + if(pSiS->RotateMouse) pScrn->PointerMoved = SISPointerMoved; switch(pScrn->bitsPerPixel) { case 8: refreshArea = SISRefreshArea8; break; @@ -7552,7 +7855,7 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } else if( pSiS->Chipset == PCI_CHIP_SIS6326 || pSiS->Chipset == PCI_CHIP_SIS530 || pSiS->Chipset == PCI_CHIP_SIS5597 ) { - + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using SiS5597/5598/6326/530/620 HW Xv\n" ); SIS6326InitVideo(pScreen); @@ -7650,8 +7953,8 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { if(pSiS->SecondHead) { - bzero(pSiS->FbBase, OnScreenSize); - bzero(pSiSEnt->FbBase1, pSiSEnt->OnScreenSize1); + sisclearvram(pSiS->FbBase, OnScreenSize); + sisclearvram(pSiSEnt->FbBase1, pSiSEnt->OnScreenSize1); SISSaveScreen(pScreen, SCREEN_SAVER_OFF); } else { pSiSEnt->FbBase1 = pSiS->FbBase; @@ -7660,7 +7963,7 @@ SISScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } else { #endif SISSaveScreen(pScreen, SCREEN_SAVER_OFF); - bzero(pSiS->FbBase, OnScreenSize); + sisclearvram(pSiS->FbBase, OnScreenSize); #ifdef SISDUALHEAD } #endif @@ -7841,26 +8144,13 @@ SISSwitchCRT2Type(ScrnInfoPtr pScrn, ULong newvbflags) } pSiS->skipswitchcheck = FALSE; SISAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); - return TRUE; + return TRUE; } -int -SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, UShort cond, UShort index, Bool quiet) +static ULong SiSCondToVBFlags(UShort cond, ULong GivenVBFlags) { - SISPtr pSiS = SISPTR(pScrn); - Bool hcm = pSiS->HaveCustomModes; - DisplayModePtr mode = pScrn->modes, mastermode; - int i, result = 0; - ULong vbflags = pSiS->VBFlags; - - /* Not only CRT2, but also LCDA */ - - /* returns 0 if mode ok, - * 0x01 if mode not ok for CRT2 device, - * 0x02 if mode too large for current root window - * or combinations thereof - */ - + ULong vbflags = GivenVBFlags; + /* No special treatment for NTSC-J here; conditions equal NTSC */ if(cond) { vbflags &= ~(CRT2_ENABLE | CRT1_LCDA | TV_STANDARD | TV_INTERFACE); @@ -7890,15 +8180,17 @@ SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, UShort cond, UShort index, Bool vbflags |= CRT1_LCDA; } } + return(vbflags); +} - /* Find mode of given index */ - if(index) { - for(i = 0; i < index; i++) { - if(!mode) return 0x03; - mode = mode->next; - } - } - +static int +SISCheckModeForCRT2Type(ScrnInfoPtr pScrn, DisplayModePtr mode, ULong vbflags, UShort cond, Bool quiet) +{ + SISPtr pSiS = SISPTR(pScrn); + DisplayModePtr mastermode; + Bool hcm = pSiS->HaveCustomModes; + int result = 0; + mastermode = mode; #ifdef SISDUALHEAD @@ -7984,6 +8276,80 @@ SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, UShort cond, UShort index, Bool return result; } +int +SISCheckModeIndexForCRT2Type(ScrnInfoPtr pScrn, UShort cond, UShort index, Bool quiet) +{ + SISPtr pSiS = SISPTR(pScrn); + DisplayModePtr mode = pScrn->modes; + ULong vbflags; + int i; + + /* Not only CRT2, but also LCDA */ + + /* returns 0 if mode ok, + * 0x01 if mode not ok for CRT2 device, + * 0x02 if mode too large for current root window + * or combinations thereof + */ + + vbflags = SiSCondToVBFlags(cond, pSiS->VBFlags); + + /* Find mode of given index */ + if(index) { + for(i = 0; i < index; i++) { + if(!mode) return 0x03; + mode = mode->next; + } + } + + return(SISCheckModeForCRT2Type(pScrn, mode, vbflags, cond, quiet)); +} + +#ifdef X_XF86MiscPassMessage +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) +{ + SISPtr pSiS = SISPTR(pScrn); + DisplayModePtr mode = pScrn->modes, pmode = pScrn->modes; + ULong vbflags; + Bool found = FALSE; + + /* Not only CRT2, but also LCDA */ + + /* returns 0 if mode ok, + * 0x01 if mode not ok for CRT2 device, + * 0x02 if mode too large for current root window + * or combinations thereof + */ + + vbflags = SiSCondToVBFlags(cond, pSiS->VBFlags); + + /* Find mode with given timing */ + do { + if( (mode->HDisplay == hdisplay) && + (mode->VDisplay == vdisplay) && + (mode->HTotal == htotal) && + (mode->VTotal == vtotal) && + (mode->HSyncStart == hsyncstart) && + (mode->VSyncStart == vsyncstart) && + (mode->HSyncEnd == hsyncend) && + (mode->VSyncEnd == vsyncend) && + (mode->Clock == clock) ) { + found = TRUE; + break; + } + mode = mode->next; + } while((mode) && (mode != pmode)); + + if(!found) return 0x03; + + return(SISCheckModeForCRT2Type(pScrn, mode, vbflags, cond, quiet)); +} +#endif + Bool SISRedetectCRT2Devices(ScrnInfoPtr pScrn) { @@ -8019,8 +8385,7 @@ SISRedetectCRT2Devices(ScrnInfoPtr pScrn) } pSiS->skipswitchcheck = FALSE; SISAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); - } - + } return TRUE; } @@ -8129,7 +8494,7 @@ SISSwitchCRT1Status(ScrnInfoPtr pScrn, int onoff) } pSiS->skipswitchcheck = FALSE; SISAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); - return TRUE; + return TRUE; } static void @@ -8159,7 +8524,7 @@ SISSetStartAddressCRT2(SISPtr pSiS, ULong base) if(pSiS->VGAEngine == SIS_315_VGA) { setSISIDXREG(SISPART1, 0x02, 0x7F, ((base >> 24) & 0x01) << 7); } - SiS_LockCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext); + SiS_LockCRT2(pSiS->SiS_Pr, &pSiS->sishw_ext); } #ifdef SISMERGED @@ -8572,7 +8937,9 @@ SISAdjustFrame(int scrnIndex, int x, int y, int flags) case SIS_315_VGA: SISSetStartAddressCRT1(pSiS, base); if(pSiS->VBFlags & CRT2_ENABLE) { - SISSetStartAddressCRT2(pSiS, base); + if(!SiSBridgeIsInSlaveMode(pScrn)) { + SISSetStartAddressCRT2(pSiS, base); + } } break; default: @@ -8604,7 +8971,7 @@ SISEnterVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; SISPtr pSiS = SISPTR(pScrn); - + SiS_SiSFB_Lock(pScrn, TRUE); sisSaveUnlockExtRegisterLock(pSiS, NULL, NULL); @@ -8621,7 +8988,7 @@ SISEnterVT(int scrnIndex, int flags) } SISAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); - + #ifdef XF86DRI if(pSiS->directRenderingEnabled) { DRIUnlock(screenInfo.screens[scrnIndex]); @@ -8634,7 +9001,7 @@ SISEnterVT(int scrnIndex, int flags) if(pSiS->ResetXv) { (pSiS->ResetXv)(pScrn); } - + return TRUE; } @@ -8691,7 +9058,7 @@ SISLeaveVT(int scrnIndex, int flags) if((pSiS->VBFlags & VB_VIDEOBRIDGE) && (!(pSiS->VBFlags & DISPTYPE_DISP2))) VBESetVBEMode(pSiS->pVbe, (pSiS->SISVESAModeList->n) | 0xc000, NULL); - SISVESARestore(pScrn); + SISVESARestore(pScrn); } else { @@ -8819,7 +9186,7 @@ SISCloseScreen(int scrnIndex, ScreenPtr pScreen) xf86DestroyCursorInfoRec(pSiS->CursorInfoPtr); pSiS->CursorInfoPtr = NULL; } - + if(pSiS->ShadowPtr) { xfree(pSiS->ShadowPtr); pSiS->ShadowPtr = NULL; @@ -9024,11 +9391,15 @@ SISSaveScreen(ScreenPtr pScreen, int mode) } - } + } } - - return SiSVGASaveScreen(pScreen, mode); + + if(!SiSBridgeIsInSlaveMode(pScrn)) { + return SiSVGASaveScreen(pScreen, mode); + } + + return TRUE; } #ifdef SISDUALHEAD @@ -9164,7 +9535,7 @@ SISModifyModeInfo(DisplayModePtr mode) } /* Enable the Turboqueue/Commandqueue (For 300 and 315/330/340 series only) */ -void +static void SiSEnableTurboQueue(ScrnInfoPtr pScrn) { SISPtr pSiS = SISPTR(pScrn); @@ -9226,7 +9597,7 @@ SiSEnableTurboQueue(ScrnInfoPtr pScrn) andSISIDXREG(SISCR, 0x55, 0x33) ; /* Syncronous reset for Command Queue */ outSISIDXREG(SISSR, 0x26, 0x01); - MMIO_OUT32(pSiS->IOBase, 0x85c4, 0); + SIS_MMIO_OUT32(pSiS->IOBase, 0x85c4, 0); /* Enable VRAM Command Queue mode */ switch(pSiS->cmdQueueSize) { case 1*1024*1024: SR26 = (0x40 | 0x04 | 0x01); break; @@ -9239,10 +9610,10 @@ SiSEnableTurboQueue(ScrnInfoPtr pScrn) outSISIDXREG(SISSR, 0x26, SR26); SR26 &= 0xfe; outSISIDXREG(SISSR, 0x26, SR26); - pSiS->cmdQ_SharedWritePort_2D = (ULong)(MMIO_IN32(pSiS->IOBase, 0x85c8)); + pSiS->cmdQ_SharedWritePort_2D = (ULong)(SIS_MMIO_IN32(pSiS->IOBase, 0x85c8)); *(pSiS->cmdQ_SharedWritePort) = pSiS->cmdQ_SharedWritePort_2D; - MMIO_OUT32(pSiS->IOBase, 0x85c4, pSiS->cmdQ_SharedWritePort_2D); - MMIO_OUT32(pSiS->IOBase, 0x85C0, pSiS->cmdQueueOffset); + SIS_MMIO_OUT32(pSiS->IOBase, 0x85c4, pSiS->cmdQ_SharedWritePort_2D); + SIS_MMIO_OUT32(pSiS->IOBase, 0x85C0, pSiS->cmdQueueOffset); temp = (ULong)pSiS->FbBase; #ifdef SISDUALHEAD if(pSiS->DualHeadMode) { @@ -9260,8 +9631,8 @@ SiSEnableTurboQueue(ScrnInfoPtr pScrn) /* Syncronous reset for Command Queue */ outSISIDXREG(SISSR, 0x26, 0x01); /* Do some magic (cp readport to writeport) */ - temp = MMIO_IN32(pSiS->IOBase, 0x85C8); - MMIO_OUT32(pSiS->IOBase, 0x85C4, temp); + temp = SIS_MMIO_IN32(pSiS->IOBase, 0x85C8); + SIS_MMIO_OUT32(pSiS->IOBase, 0x85C4, temp); /* Enable MMIO Command Queue mode (0x20), * Enable_command_queue_auto_correction (0x02) * (no idea, but sounds good, so use it) @@ -9270,7 +9641,7 @@ SiSEnableTurboQueue(ScrnInfoPtr pScrn) /* Calc Command Queue position (Q is always 512k)*/ temp = (pScrn->videoRam - 512) * 1024; /* Set Q position */ - MMIO_OUT32(pSiS->IOBase, 0x85C0, temp); + SIS_MMIO_OUT32(pSiS->IOBase, 0x85C0, temp); #endif } break; @@ -9279,6 +9650,25 @@ SiSEnableTurboQueue(ScrnInfoPtr pScrn) } } +#ifdef SISVRAMQ +static void +SiSRestoreQueueMode(SISPtr pSiS, SISRegPtr sisReg) +{ + UChar tempCR55=0; + + if(pSiS->VGAEngine == SIS_315_VGA) { + inSISIDXREG(SISCR,0x55,tempCR55); + andSISIDXREG(SISCR,0x55,0x33); + outSISIDXREG(SISSR,0x26,0x01); + SIS_MMIO_OUT32(pSiS->IOBase, 0x85c4, 0); + outSISIDXREG(SISSR,0x27,sisReg->sisRegs3C4[0x27]); + outSISIDXREG(SISSR,0x26,sisReg->sisRegs3C4[0x26]); + SIS_MMIO_OUT32(pSiS->IOBase, 0x85C0, sisReg->sisMMIO85C0); + outSISIDXREG(SISCR,0x55,tempCR55); + } +} +#endif + /* Things to do before a ModeSwitch. We set up the * video bridge configuration and the TurboQueue. */ @@ -9672,7 +10062,7 @@ void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode) * The values will be in pSiSEnt anyway, and read from there * if we're running dual head. */ - + void SiS_SetCHTVlumabandwidthcvbs(ScrnInfoPtr pScrn, int val) { SISPtr pSiS = SISPTR(pScrn); @@ -11335,6 +11725,23 @@ int SiS_GetTVyscale(ScrnInfoPtr pScrn) return (int)pSiS->tvyscale; } +/* Calc dotclock from registers */ +static int +SiSGetClockFromRegs(UChar sr2b, UChar sr2c) +{ + float num, denum, postscalar, divider; + int myclock; + + divider = (sr2b & 0x80) ? 2.0 : 1.0; + postscalar = (sr2c & 0x80) ? + ( (((sr2c >> 5) & 0x03) == 0x02) ? 6.0 : 8.0 ) : + ( ((sr2c >> 5) & 0x03) + 1.0 ); + num = (sr2b & 0x7f) + 1.0; + denum = (sr2c & 0x1f) + 1.0; + myclock = (int)((14318 * (divider / postscalar) * (num / denum)) / 1000); + return myclock; +} + /* PostSetMode: * -) Disable CRT1 for saving bandwidth. This doesn't work with VESA; * VESA uses the bridge in SlaveMode and switching CRT1 off while @@ -11351,13 +11758,12 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg) #ifdef SISDUALHEAD SISEntPtr pSiSEnt = pSiS->entityPrivate; #endif - UChar usScratchCR17; + UChar usScratchCR17, sr2b, sr2c, tmpreg; + int myclock1, myclock2, temp; Bool flag = FALSE; Bool doit = TRUE; - int myclock, temp; - UChar sr2b, sr2c, tmpreg; - float num, denum, postscalar, divider; - + Bool IsInSlaveMode; + #ifdef TWDEBUG xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CRT1off is %d\n", pSiS->CRT1off); @@ -11369,6 +11775,8 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg) #endif SiSFixupSR11(pScrn); + + IsInSlaveMode = SiSBridgeIsInSlaveMode(pScrn); if((!pSiS->UseVESA) && (pSiS->VBFlags & CRT2_ENABLE)) { @@ -11385,7 +11793,7 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg) #ifdef SISDUALHEAD if(!pSiS->DualHeadMode) { #endif - if(SiSBridgeIsInSlaveMode(pScrn)) { + if(IsInSlaveMode) { doit = FALSE; temp = pSiS->VBFlags; pSiS->VBFlags &= (~VB_DISPMODE_SINGLE); @@ -11440,60 +11848,71 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg) /* Determine if the video overlay can be used */ if(!pSiS->NoXvideo) { + int clklimit1=0, clklimit2=0, clklimitg=0; inSISIDXREG(SISSR,0x2b,sr2b); inSISIDXREG(SISSR,0x2c,sr2c); - divider = (sr2b & 0x80) ? 2.0 : 1.0; - postscalar = (sr2c & 0x80) ? - ( (((sr2c >> 5) & 0x03) == 0x02) ? 6.0 : 8.0 ) : - ( ((sr2c >> 5) & 0x03) + 1.0 ); - num = (sr2b & 0x7f) + 1.0; - denum = (sr2c & 0x1f) + 1.0; - myclock = (int)((14318 * (divider / postscalar) * (num / denum)) / 1000); + myclock1 = myclock2 = SiSGetClockFromRegs(sr2b, sr2c); + if((!IsInSlaveMode) && (pSiS->VBFlags & CRT2_ENABLE)) { + if(pSiS->VBFlags & VB_SISBRIDGE) { + inSISIDXREG(SISPART4,0x0a,sr2b); + inSISIDXREG(SISPART4,0x0b,sr2c); + } else { + inSISIDXREG(SISSR,0x2e,sr2b); + inSISIDXREG(SISSR,0x2f,sr2c); + } + myclock2 = SiSGetClockFromRegs(sr2b, sr2c); + } - pSiS->MiscFlags &= ~(MISC_CRT1OVERLAY | MISC_CRT1OVERLAYGAMMA); + pSiS->MiscFlags &= ~(MISC_CRT1OVERLAY | MISC_CRT2OVERLAY | MISC_CRT1OVERLAYGAMMA); switch(pSiS->sishw_ext.jChipType) { case SIS_300: case SIS_540: case SIS_630: case SIS_730: - if(myclock < 150) { - pSiS->MiscFlags |= MISC_CRT1OVERLAY; - } + clklimit1 = clklimit2 = clklimitg = 150; break; case SIS_550: case SIS_650: case SIS_740: - if(myclock < 175) { - pSiS->MiscFlags |= MISC_CRT1OVERLAY; - if(myclock < 166) { - pSiS->MiscFlags |= MISC_CRT1OVERLAYGAMMA; - } - } + case SIS_661: + case SIS_741: + clklimit1 = clklimit2 = 175; /* verified for 6xx */ + clklimitg = 166; /* ? */ break; + case SIS_660: + case SIS_760: + case SIS_761: + clklimit1 = clklimit2 = 175; /* ? */ + if(!(pSiS->ChipFlags & SiSCF_760UMA)) clklimit1 = clklimit2 = 180; + clklimitg = 166; /* ? */ + break; case SIS_315H: case SIS_315: case SIS_315PRO: case SIS_330: - case SIS_661: - case SIS_741: - case SIS_660: - case SIS_760: - case SIS_340: - if(myclock < 180) { - pSiS->MiscFlags |= MISC_CRT1OVERLAY; - if(myclock < 166) { - pSiS->MiscFlags |= MISC_CRT1OVERLAYGAMMA; - } - } + case SIS_340: /* ? */ + clklimit1 = clklimit2 = 180; /* ? */ + clklimitg = 166; /* ? */ 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)) { #ifdef SISDUALHEAD if((!pSiS->DualHeadMode) || (pSiS->SecondHead)) #endif xf86DrvMsgVerb(pScrn->scrnIndex, X_WARNING, 3, "Current dotclock (%dMhz) too high for video overlay on CRT1\n", - myclock); + 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); } } @@ -11528,27 +11947,28 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg) } } -#ifdef SISVRAMQ + if(pSiS->VGAEngine == SIS_315_VGA) { int i; +#ifdef SISVRAMQ /* Re-Enable command queue */ SiSEnableTurboQueue(pScrn); +#endif /* Get HWCursor register contents for backup */ for(i = 0; i < 16; i++) { - pSiS->HWCursorBackup[i] = MMIO_IN32(pSiS->IOBase, 0x8500 + (i << 2)); + pSiS->HWCursorBackup[i] = SIS_MMIO_IN32(pSiS->IOBase, 0x8500 + (i << 2)); } if(pSiS->sishw_ext.jChipType >= SIS_330) { /* Enable HWCursor protection (Y pos as trigger) */ andSISIDXREG(SISCR, 0x5b, ~0x30); } } -#endif /* Reset XV gamma correction */ if(pSiS->ResetXvGamma) { (pSiS->ResetXvGamma)(pScrn); - } - + } + /* Apply TV settings given by options Do this even in DualHeadMode: - if this is called by SetModeCRT1, CRT2 mode has been reset by SetModeCRT1 @@ -11775,7 +12195,7 @@ SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg) SiS_SetTVyscale(pScrn, val); } } - } + } } @@ -12025,6 +12445,13 @@ SiS_CheckModeCRT1(ScrnInfoPtr pScrn, DisplayModePtr mode, ULong VBFlags, Bool ha } else if(VBFlags & VB_SISTMDSLCDABRIDGE) { + if(pSiS->sishw_ext.jChipType < SIS_661) { /* < 661 only? */ + if(!(mode->type & M_T_DEFAULT)) { + if(mode->HTotal > 2055) return 0; + /* (Default mode will be caught in mode switching code) */ + } + } + if(pSiS->SiS_Pr->CP_HaveCustomData) { for(j=0; j<7; j++) { if((pSiS->SiS_Pr->CP_DataValid[j]) && @@ -12370,6 +12797,13 @@ SiS_GetSetBIOSScratch(ScrnInfoPtr pScrn, UShort offset, UChar value) return ret; } +void +SiSMemCopyToVideoRam(SISPtr pSiS, UChar *to, UChar *from, int size) +{ + if((ULong)to & 15) (*pSiS->SiSFastMemCopy)(to, from, size); + else (*pSiS->SiSFastVidCopy)(to, from, size); +} + void sisSaveUnlockExtRegisterLock(SISPtr pSiS, UChar *reg1, UChar *reg2) { @@ -12411,7 +12845,7 @@ sisSaveUnlockExtRegisterLock(SISPtr pSiS, UChar *reg1, UChar *reg2) outSISIDXREG(SISSR, 0x05, 0x86); } } - } + } if((pSiS->VGAEngine == SIS_OLD_VGA) || (pSiS->VGAEngine == SIS_530_VGA)) { inSISIDXREG(SISCR, 0x80, val); if(val != 0xa1) { diff --git a/src/sis_driver.h b/src/sis_driver.h index 232a1e6..bd151a3 100644 --- a/src/sis_driver.h +++ b/src/sis_driver.h @@ -3,7 +3,7 @@ /* * Global data and definitions * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -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, @@ -656,7 +656,7 @@ static DisplayModeRec SiS6326SIS1600x1200_60Mode = { }; /* TV filters for SiS video bridges - */ + */ static const struct _SiSTVFilter301 { UChar filter[7][4]; } SiSTVFilter301[] = { @@ -780,7 +780,7 @@ static const struct _SiSTVFilter301B { }; /* TV scaling data for SiS video bridges - */ + */ typedef struct _SiSTVVScale { UShort ScaleVDE; int sindex; @@ -1266,7 +1266,6 @@ static const UChar SiS301CScaling[] = { 0x7D,0x0C,0x16,0x01,0x7D,0x0A,0x17,0x02,0x7D,0x09,0x17,0x03,0x7D,0x07,0x17,0x05 }; - /* Mandatory functions */ static void SISIdentify(int flags); static Bool SISProbe(DriverPtr drv, int flags); @@ -1281,6 +1280,14 @@ static void SISAdjustFrame(int scrnIndex, int x, int y, int flags); #ifdef SISDUALHEAD static Bool SISSaveScreenDH(ScreenPtr pScreen, int mode); #endif +#ifdef X_XF86MiscPassMessage +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, + UShort hsyncstart, UShort hsyncend, UShort vsyncstart, + UShort vsyncend, int clock, Bool quiet); +#endif /* Optional functions */ static void SISFreeScreen(int scrnIndex, int flags); @@ -1296,18 +1303,19 @@ static Bool SISUnmapIOPMem(ScrnInfoPtr pScrn); #endif static void SISSave(ScrnInfoPtr pScrn); static void SISRestore(ScrnInfoPtr pScrn); -static void SISVESARestore(ScrnInfoPtr pScrn); static Bool SISModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); static void SISModifyModeInfo(DisplayModePtr mode); static void SiSPreSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode, int viewmode); static void SiSPostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg); static void SiS6326PostSetMode(ScrnInfoPtr pScrn, SISRegPtr sisReg); static Bool SiSSetVESAMode(ScrnInfoPtr pScrn, DisplayModePtr pMode); +static void SISVESARestore(ScrnInfoPtr pScrn); static void SiSBuildVesaModeList(ScrnInfoPtr pScrn, vbeInfoPtr pVbe, VbeInfoBlock *vbe); static UShort SiSCalcVESAModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode); static void SISVESASaveRestore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function); static void SISBridgeRestore(ScrnInfoPtr pScrn); static void SiSEnableTurboQueue(ScrnInfoPtr pScrn); +static void SiSRestoreQueueMode(SISPtr pSiS, SISRegPtr sisReg); UChar SISSearchCRT1Rate(ScrnInfoPtr pScrn, DisplayModePtr mode); static void SISWaitVBRetrace(ScrnInfoPtr pScrn); void SISWaitRetraceCRT1(ScrnInfoPtr pScrn); @@ -1315,7 +1323,8 @@ void SISWaitRetraceCRT2(ScrnInfoPtr pScrn); static UShort SiS_CheckModeCRT1(ScrnInfoPtr pScrn, DisplayModePtr mode, ULong VBFlags, Bool hcm); static UShort SiS_CheckModeCRT2(ScrnInfoPtr pScrn, DisplayModePtr mode, - ULong VBFlags, Bool hcm); + ULong VBFlags, Bool hcm); + #ifdef SISMERGED static Bool InRegion(int x, int y, region r); static void SISMergePointerMoved(int scrnIndex, int x, int y); @@ -1341,6 +1350,24 @@ extern Bool SiSVGAMapMem(ScrnInfoPtr pScrn); extern void SiSVGAUnmapMem(ScrnInfoPtr pScrn); extern Bool SiSVGASaveScreen(ScreenPtr pScreen, int mode); +/* shadow */ +extern void SISPointerMoved(int index, int x, int y); +extern void SISRefreshArea(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); +extern void SISRefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox); + +/* vb */ +extern void SISCRT1PreInit(ScrnInfoPtr pScrn); +extern void SISLCDPreInit(ScrnInfoPtr pScrn, Bool quiet); +extern void SISTVPreInit(ScrnInfoPtr pScrn, Bool quiet); +extern void SISCRT2PreInit(ScrnInfoPtr pScrn, Bool quiet); +extern void SISSense30x(ScrnInfoPtr pScrn, Bool quiet); +extern void SISSenseChrontel(ScrnInfoPtr pScrn, Bool quiet); +extern Bool SISRedetectCRT2Type(ScrnInfoPtr pScrn); +extern void SiSSetupPseudoPanel(ScrnInfoPtr pScrn); + /* init.c, init301.c ----- (use their data types!) */ extern USHORT SiS_GetModeID(int VGAEngine, ULONG VBFlags, int HDisplay, int VDisplay, int Depth, BOOLEAN FSTN, int LCDwith, int LCDheight); diff --git a/src/sis_memcpy.c b/src/sis_memcpy.c index 8a1cbed..9417ae3 100644 --- a/src/sis_memcpy.c +++ b/src/sis_memcpy.c @@ -1,9 +1,9 @@ /* * SiS memcpy() routines (assembly) * - * Copyright (C) 2004 Thomas Winischhofer + * Copyright (C) 2004-2005 Thomas Winischhofer * - * Based on via_memcpy.c which is + * Idea and some code bits from via_memcpy.c which is * Copyright (C) 2004 Thomas Hellstrom, All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -164,8 +164,8 @@ extern FBLinearPtr SISAllocateOverlayMemory(ScrnInfoPtr pScrn, FBLinearPtr linea " jne 1b\n" \ : "=&D"(to), "=&S"(from), "=&r"(dummy) \ : "0" (to), "1" (from), "2" (lcnt) \ - : "memory", "cc"); - + : "memory", "cc"); + #define SSE_CPY(prefetch,from,to,dummy,lcnt) \ if((ULong) from & 15) { \ __asm__ __volatile__ ( \ @@ -207,7 +207,7 @@ extern FBLinearPtr SISAllocateOverlayMemory(ScrnInfoPtr pScrn, FBLinearPtr linea : "=&D"(to), "=&S"(from), "=&r"(dummy) \ : "0" (to), "1" (from), "2" (lcnt) \ : "memory", "cc"); \ - } + } #define MMXEXT_CPY(prefetch,from,to,dummy,lcnt) \ __asm__ __volatile__ ( \ @@ -292,10 +292,11 @@ extern FBLinearPtr SISAllocateOverlayMemory(ScrnInfoPtr pScrn, FBLinearPtr linea /* Type for table for benchmark list */ typedef struct { - vidCopyFunc mFunc; - char *mName; + vidCopyFunc mFunc; + char *mName; unsigned int mycpuflag; - int grade; + int grade; + Bool reqAlignment; } SISMCFuncData; /************************************************************************/ @@ -339,7 +340,7 @@ vidCopyFunc SiSVidCopyInit(ScreenPtr pScreen) #define SiS_checkosforsse /* Does this cpu support sse and do we need to check os? */ #define SiS_canBenchmark /* Can we perform a benchmark? */ -#ifdef linux +#ifdef SIS_LINUX #define SiS_haveProc /* Do we have /proc/cpuinfo or similar? */ #endif #define SiS_haveBuiltInMC /* Is there a built-in memcpy for this arch? */ @@ -433,7 +434,7 @@ static unsigned int taketime(void) /* get current time (for benchmarking) */ #define SiS_checkosforsse /* Does this cpu support sse and do we need to check os? */ #define SiS_canBenchmark /* Can we perform a benchmark? */ -#ifdef linux +#ifdef SIS_LINUX #define SiS_haveProc /* Do we have /proc/cpuinfo or similar? */ #endif #define SiS_haveBuiltInMC /* Is there a built-in memcpy for this arch? */ @@ -606,14 +607,16 @@ static FBLinearPtr SiS_AllocBuffers(ScrnInfoPtr pScrn, UChar **buf1, /* Perform Benchmark */ static int SiS_BenchmarkMemcpy(ScrnInfoPtr pScrn, SISMCFuncData *MCFunctions, - unsigned int myCPUflags, - UChar *buf1, UChar *buf2, - UChar *buf3, char *frqBuf, double cpuFreq) + unsigned int myCPUflags, UChar *buf1, UChar *buf2, + UChar *buf3, char *frqBuf, double cpuFreq, + vidCopyFunc *UMemCpy, int *best2) { SISMCFuncData *curData; int j = 0, bestSoFar = 0; - unsigned int tmp1, tmp2, best = 0xFFFFFFFFU; + unsigned int tmp1, tmp2, best = 0xFFFFFFFFU, sbest = 0xFFFFFFFFU; + (*best2) = 0; + /* Make probable buf1 and buf2 are not paged out by referencing them */ SiS_libc_memcpy(buf1, buf2, BUFSIZ); @@ -659,6 +662,13 @@ static int SiS_BenchmarkMemcpy(ScrnInfoPtr pScrn, SISMCFuncData *MCFunctions, best = tmp1; bestSoFar = j; } + + if(!curData->reqAlignment) { + if(tmp1 < sbest) { + sbest = tmp1; + (*best2) = j; + } + } } @@ -669,9 +679,11 @@ static int SiS_BenchmarkMemcpy(ScrnInfoPtr pScrn, SISMCFuncData *MCFunctions, } static vidCopyFunc SiS_GetBestByGrade(ScrnInfoPtr pScrn, SISMCFuncData *MCFunctions, - unsigned int myCPUflags) + unsigned int myCPUflags, vidCopyFunc *UMemCpy) { - int j = 0, best = -1, bestSoFar = 10; + int j = 0, best = -1, secondbest = -1, bestSoFar = 10, best2SoFar = 10; + + *UMemCpy = SiS_libc_memcpy; while(MCFunctions[j].mFunc) { if(myCPUflags & MCFunctions[j].mycpuflag) { @@ -679,13 +691,25 @@ static vidCopyFunc SiS_GetBestByGrade(ScrnInfoPtr pScrn, SISMCFuncData *MCFuncti best = j; bestSoFar = MCFunctions[j].grade; } + if(MCFunctions[j].grade < best2SoFar) { + if(!MCFunctions[j].reqAlignment) { + secondbest = j; + best2SoFar = MCFunctions[j].grade; + } + } } j++; } if(best >= 0) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Chose %s method for video data transfers by grade\n", + "Chose %s method for aligned video data transfers\n", MCFunctions[best].mName); + if(secondbest >= 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Chose %s method for unaligned video data transfers\n", + MCFunctions[secondbest].mName); + *UMemCpy = MCFunctions[secondbest].mFunc; + } return MCFunctions[best].mFunc; } @@ -821,14 +845,14 @@ PREFETCH_FUNC(SiS_now,MMX,NOW,FEMMS,FEMMS,small_memcpy_i386) NOPREFETCH_FUNC(SiS_mmx,MMX,EMMS,EMMS,small_memcpy_i386) static SISMCFuncData MCFunctions_i386[] = { - {SiS_libc_memcpy, "libc", SIS_CPUFL_LIBC, 3}, - {SiS_builtin_memcpy,"built-in-1",SIS_CPUFL_BI, 4}, - {SiS_builtin_memcp2,"built-in-2",SIS_CPUFL_BI2, 5}, - {SiS_mmx_memcpy, "MMX", SIS_CPUFL_MMX, 2}, - {SiS_sse_memcpy, "SSE", SIS_CPUFL_SSE, 0}, - {SiS_now_memcpy, "3DNow!", SIS_CPUFL_3DNOW, 1}, - {SiS_mmxext_memcpy, "MMX2", SIS_CPUFL_MMX2, 0}, - {NULL, "", 0, 10} + {SiS_libc_memcpy, "libc", SIS_CPUFL_LIBC, 3, FALSE}, + {SiS_builtin_memcpy,"built-in-1",SIS_CPUFL_BI, 4, FALSE}, + {SiS_builtin_memcp2,"built-in-2",SIS_CPUFL_BI2, 5, FALSE}, + {SiS_mmx_memcpy, "MMX", SIS_CPUFL_MMX, 2, FALSE}, + {SiS_sse_memcpy, "SSE", SIS_CPUFL_SSE, 0, TRUE}, + {SiS_now_memcpy, "3DNow!", SIS_CPUFL_3DNOW, 1, FALSE}, + {SiS_mmxext_memcpy, "MMX2", SIS_CPUFL_MMX2, 0, FALSE}, + {NULL, "", 0, 10, FALSE} }; #define Def_FL (SIS_CPUFL_LIBC | SIS_CPUFL_BI | SIS_CPUFL_BI2) /* Default methods */ @@ -923,11 +947,11 @@ static unsigned int SiS_GetCpuFeatures(ScrnInfoPtr pScrn) PREFETCH_FUNC(SiS_sse,SSE,SSE,,FENCE,small_memcpy_amd64) static SISMCFuncData MCFunctions_AMD64[] = { - {SiS_libc_memcpy, "libc", SIS_CPUFL_LIBC, 2}, - {SiS_builtin_memcpy,"built-in-1",SIS_CPUFL_BI, 1}, - {SiS_builtin_memcp2,"built-in-2",SIS_CPUFL_BI2, 3}, - {SiS_sse_memcpy, "SSE", SIS_CPUFL_SSE, 0}, - {NULL, "", 0, 10} + {SiS_libc_memcpy, "libc", SIS_CPUFL_LIBC, 2, FALSE}, + {SiS_builtin_memcpy,"built-in-1",SIS_CPUFL_BI, 1, FALSE}, + {SiS_builtin_memcp2,"built-in-2",SIS_CPUFL_BI2, 3, FALSE}, + {SiS_sse_memcpy, "SSE", SIS_CPUFL_SSE, 0, TRUE}, + {NULL, "", 0, 10, FALSE} }; #define Def_FL (SIS_CPUFL_LIBC | SIS_CPUFL_BI | SIS_CPUFL_BI2) @@ -955,7 +979,7 @@ static unsigned int SiS_GetCpuFeatures(ScrnInfoPtr pScrn) /**********************************************************************/ #ifdef SiS_canBenchmark -static vidCopyFunc SiSVidCopyInitGen(ScreenPtr pScreen, SISMCFuncData *MCFunctions) +static vidCopyFunc SiSVidCopyInitGen(ScreenPtr pScreen, SISMCFuncData *MCFunctions, vidCopyFunc *UMemCpy) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; SISPtr pSiS = SISPTR(pScrn); @@ -964,11 +988,13 @@ static vidCopyFunc SiSVidCopyInitGen(ScreenPtr pScreen, SISMCFuncData *MCFunctio UChar *buf1, *buf2, *buf3; double cpuFreq = 0.0; unsigned int myCPUflags = pSiS->CPUFlags | Def_FL; - int best; + int best, secondbest; #ifdef SiS_haveProc char buf[CPUBUFSIZE]; #endif + *UMemCpy = SiS_libc_memcpy; + /* Bail out if user disabled benchmarking */ if(!pSiS->BenchMemCpy) { return SiS_libc_memcpy; @@ -988,12 +1014,12 @@ static vidCopyFunc SiSVidCopyInitGen(ScreenPtr pScreen, SISMCFuncData *MCFunctio if(!(tmpFbBuffer = SiS_AllocBuffers(pScrn, &buf1, &buf2, &buf3))) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to allocate video RAM for video data transfer benchmark\n"); - return SiS_GetBestByGrade(pScrn, MCFunctions, myCPUflags); + return SiS_GetBestByGrade(pScrn, MCFunctions, myCPUflags, UMemCpy); } /* Perform Benchmark */ - best = SiS_BenchmarkMemcpy(pScrn, MCFunctions, myCPUflags, - buf1, buf2, buf3, frqBuf, cpuFreq); + best = SiS_BenchmarkMemcpy(pScrn, MCFunctions, myCPUflags, buf1, buf2, buf3, + frqBuf, cpuFreq, UMemCpy, &secondbest); /* Free buffers */ xf86FreeOffscreenLinear(tmpFbBuffer); @@ -1001,7 +1027,10 @@ static vidCopyFunc SiSVidCopyInitGen(ScreenPtr pScreen, SISMCFuncData *MCFunctio xfree(buf3); xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Using %s method for video data transfers\n", MCFunctions[best].mName); + "Using %s method for aligned video data transfers\n", MCFunctions[best].mName); + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Using %s method for unaligned video data transfers\n", MCFunctions[secondbest].mName); return MCFunctions[best].mFunc; } @@ -1036,13 +1065,14 @@ unsigned int SiSGetCPUFlags(ScrnInfoPtr pScrn) /* (SiSGetCPUFlags must be called before this one) */ /**********************************************************************/ -vidCopyFunc SiSVidCopyInit(ScreenPtr pScreen) +vidCopyFunc SiSVidCopyInit(ScreenPtr pScreen, vidCopyFunc *UMemCpy) { #if defined(__i386__) && defined(SiS_canBenchmark) - return(SiSVidCopyInitGen(pScreen, MCFunctions_i386)); + return(SiSVidCopyInitGen(pScreen, MCFunctions_i386, UMemCpy)); #elif defined(__AMD64__) && defined(SiS_canBenchmark) - return(SiSVidCopyInitGen(pScreen, MCFunctions_AMD64)); -#else /* Other cases: Use libc memcpy() */ + return(SiSVidCopyInitGen(pScreen, MCFunctions_AMD64, UMemCpy)); +#else /* Other cases: Use libc memcpy() */ + *UMemCpy = SiS_libc_memcpy; return SiS_libc_memcpy; #endif } @@ -1054,3 +1084,4 @@ vidCopyFunc SiSVidCopyGetDefault(void) #endif /* GNU C */ + diff --git a/src/sis_opt.c b/src/sis_opt.c index 5a9c780..679dc4a 100644 --- a/src/sis_opt.c +++ b/src/sis_opt.c @@ -3,7 +3,7 @@ /* * SiS driver option evaluation * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -126,6 +126,7 @@ typedef enum { OPTION_CENTERLCD, OPTION_SPECIALTIMING, OPTION_LVDSHL, + OPTION_PRGB, OPTION_ENABLEHOTKEY, OPTION_MERGEDFB, OPTION_MERGEDFBAUTO, @@ -148,26 +149,31 @@ typedef enum { OPTION_PSEUDO } SISOpts; -static const OptionInfoRec SISOptions[] = { - { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, +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_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_VESA, "Vesa", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_MAXXFBMEM, "MaxXFBMem", OPTV_INTEGER, {0}, FALSE }, - { OPTION_FORCECRT1, "ForceCRT1", 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 }, @@ -175,10 +181,10 @@ static const OptionInfoRec SISOptions[] = { { 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_NOINTERNALMODES, "NoInternalModes", 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 }, @@ -208,11 +214,9 @@ static const OptionInfoRec SISOptions[] = { { 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_USERGBCURSOR, "UseColorHWCursor", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_YPBPRAR, "YPbPrAspectRatio", OPTV_STRING, {0}, FALSE }, { OPTION_USERGBCURSORBLEND, "ColorHWCursorBlending", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_USERGBCURSORBLENDTH, "ColorHWCursorBlendThreshold", OPTV_INTEGER,{0},FALSE}, - { OPTION_RESTOREBYSET, "RestoreBySetMode", 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 }, @@ -236,7 +240,7 @@ static const OptionInfoRec SISOptions[] = { { 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_XVDISABLECOLORKEY, "XvDisableColorKey", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_XVMEMCPY, "XvUseMemcpy", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_XVBENCHCPY, "BenchmarkMemcpy", OPTV_BOOLEAN, {0}, FALSE }, #ifndef SISCHECKOSSSE @@ -246,8 +250,6 @@ static const OptionInfoRec SISOptions[] = { { OPTION_SCALELCD, "ScaleLCD", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_CENTERLCD, "CenterLCD", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_ENABLEHOTKEY, "EnableHotkey", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_ENABLESISCTRL, "EnableSiSCtrl", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_OVERRULERANGES, "OverruleFrequencyRanges",OPTV_BOOLEAN, {0}, FALSE }, #ifdef SISMERGED { OPTION_MERGEDFB, "MergedFB", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_MERGEDFB, "TwinView", OPTV_BOOLEAN, {0}, FALSE }, /* alias */ @@ -375,14 +377,15 @@ SiSOptions(ScrnInfoPtr pScrn) SISPtr pSiS = SISPTR(pScrn); MessageType from; char *strptr; + int ival; static const char *baddhm = "Option \"%s\" ignored in Dual Head mode\n"; static const char *validparm = "Valid parameters are"; static const char *disabledstr= "disabled"; static const char *enabledstr = "enabled"; static const char *gammaopt = "%s expects either a boolean, or 1 or 3 real numbers (0.1 - 10.0)\n"; static const char *briopt = "%s expects 1 or 3 real numbers (0.1 - 10.0)\n"; - Bool val, IsDHM = FALSE, IsSecondHead = FALSE; - int ival; + Bool val, IsDHM = FALSE; + Bool IsSecondHead = FALSE; /* Collect all of the relevant option flags (fill in pScrn->options) */ xf86CollectOptions(pScrn, NULL); @@ -408,6 +411,7 @@ SiSOptions(ScrnInfoPtr pScrn) pSiS->HWCursor = TRUE; pSiS->Rotate = 0; pSiS->RotateMouse = FALSE; + pSiS->NoAccel = FALSE; pSiS->ShadowFB = FALSE; pSiS->loadDRI = FALSE; pSiS->agpWantedPages = AGP_PAGES; @@ -422,6 +426,7 @@ SiSOptions(ScrnInfoPtr pScrn) pSiS->PDC = -1; pSiS->PDCA = -1; pSiS->EMI = -1; + pSiS->PRGB = -1; pSiS->OptTVStand = -1; pSiS->OptROMUsage = -1; pSiS->noInternalModes = FALSE; @@ -580,7 +585,7 @@ SiSOptions(ScrnInfoPtr pScrn) } /* NoHostBus (5597/5598 only) - */ + */ if(pSiS->Chipset == PCI_CHIP_SIS5597) { from = X_DEFAULT; if(xf86GetOptValBool(pSiS->Options, OPTION_NOHOSTBUS, &pSiS->NoHostBus)) { @@ -598,7 +603,7 @@ SiSOptions(ScrnInfoPtr pScrn) * between 8 and 16MB are available, otherwise at 4MB. So, if the amount * of memory X uses, a clash between the framebuffer's memory heap * 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", @@ -608,7 +613,7 @@ SiSOptions(ScrnInfoPtr pScrn) /* NoAccel * Turns off 2D acceleration - */ + */ if(xf86ReturnOptValBool(pSiS->Options, OPTION_NOACCEL, FALSE)) { pSiS->NoAccel = TRUE; #if XF86_VERSION_CURRENT < XF86_VERSION_NUMERIC(4,2,99,0,0) @@ -621,7 +626,7 @@ SiSOptions(ScrnInfoPtr pScrn) /* RenderAcceleration * En/Disables RENDER acceleration (315/330 series only) - */ + */ if((pSiS->VGAEngine == SIS_315_VGA) && (!pSiS->NoAccel)) { if(xf86GetOptValBool(pSiS->Options, OPTION_RENDER, &pSiS->doRender)) { if(!pSiS->doRender) { @@ -666,7 +671,7 @@ SiSOptions(ScrnInfoPtr pScrn) } xf86DrvMsg(pScrn->scrnIndex, from, "Color HW cursor is %s\n", pSiS->OptUseColorCursor ? enabledstr : disabledstr); - + if(pSiS->VGAEngine == SIS_300_VGA) { from = X_DEFAULT; if(xf86GetOptValBool(pSiS->Options, OPTION_USERGBCURSORBLEND, &pSiS->OptUseColorCursorBlend)) { @@ -695,7 +700,7 @@ SiSOptions(ScrnInfoPtr pScrn) "HW cursor color blending emulation threshold is %d\n", ival); } } - } + } } #endif #endif @@ -914,7 +919,6 @@ SiSOptions(ScrnInfoPtr pScrn) } else { /* TurboQueue */ - from = X_DEFAULT; if(xf86GetOptValBool(pSiS->Options, OPTION_TURBOQUEUE, &pSiS->TurboQueue)) { from = X_CONFIG; @@ -944,7 +948,7 @@ SiSOptions(ScrnInfoPtr pScrn) * However, although the driver disables the hotkey as * BIOS developers intented to do that, some buggy BIOSes * still cause the machine to freeze. Hence the warning. - */ + */ ival = 0; from = X_DEFAULT; #ifdef SISDUALHEAD @@ -974,7 +978,7 @@ SiSOptions(ScrnInfoPtr pScrn) * 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, @@ -988,7 +992,7 @@ SiSOptions(ScrnInfoPtr pScrn) * 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, @@ -1002,7 +1006,7 @@ SiSOptions(ScrnInfoPtr pScrn) * 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; } @@ -1015,7 +1019,7 @@ SiSOptions(ScrnInfoPtr pScrn) * 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; @@ -1029,31 +1033,32 @@ SiSOptions(ScrnInfoPtr pScrn) * time, because this condition will be detected as YPbPr (since * the TV output pins are shared). "False" will not sense for * YPbPr and detect SVideo or CVBS only. - */ + */ if(xf86GetOptValBool(pSiS->Options, OPTION_SENSEYPBPR, &val)) { if(val) pSiS->SenseYPbPr = TRUE; else pSiS->SenseYPbPr = FALSE; } - /* ForceCRT1Type (315/330 series only) * Used for forcing the driver to initialize CRT1 as * VGA (analog) or LCDA (for simultanious LCD and TV * display) - on M650/651 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")) { + if((!xf86NameCmp(strptr,"VGA")) || (!xf86NameCmp(strptr,"CRT"))) { pSiS->ForceCRT1Type = CRT1_VGA; } else if( (!xf86NameCmp(strptr,"LCD")) || (!xf86NameCmp(strptr,"LCDA")) || (!xf86NameCmp(strptr,"DVI-D")) || + (!xf86NameCmp(strptr,"DVID")) || + (!xf86NameCmp(strptr,"DVI")) || (!xf86NameCmp(strptr,"LCD-A")) ) { pSiS->ForceCRT1Type = CRT1_LCDA; } else { SiS_PrintBadOpt(pScrn, strptr, OPTION_FORCE_CRT1TYPE); xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "%s \"VGA\" or \"LCD\" (alias \"DVI-D\")\n", validparm); + "%s \"VGA\" (alias \"CRT\") or \"LCD\" (alias \"DVI-D\")\n", validparm); } } } @@ -1063,7 +1068,7 @@ SiSOptions(ScrnInfoPtr pScrn) * 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, @@ -1076,7 +1081,7 @@ SiSOptions(ScrnInfoPtr pScrn) * 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")) @@ -1106,7 +1111,9 @@ SiSOptions(ScrnInfoPtr pScrn) 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; } else { @@ -1168,7 +1175,7 @@ SiSOptions(ScrnInfoPtr pScrn) 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) { @@ -1239,7 +1246,7 @@ SiSOptions(ScrnInfoPtr pScrn) * 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,7 +1261,7 @@ SiSOptions(ScrnInfoPtr pScrn) * 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", @@ -1273,7 +1280,7 @@ SiSOptions(ScrnInfoPtr pScrn) * 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); if(ival != -1) { @@ -1292,7 +1299,7 @@ SiSOptions(ScrnInfoPtr pScrn) /* PanelDelayCompensation1 (315 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); @@ -1312,7 +1319,7 @@ SiSOptions(ScrnInfoPtr pScrn) /* 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)) { if((pSiS->SiS_Pr->LVDSHL < 0) || (pSiS->SiS_Pr->LVDSHL > 3)) { SiS_PrintIlRange(pScrn, OPTION_LVDSHL, 0, 3, 0); @@ -1333,7 +1340,7 @@ SiSOptions(ScrnInfoPtr pScrn) * 1400x1050, or some Inventec(Compaq) machines with a * 1280x1024 panel. * The parameter is an integer from 0 to 0x60ffffff. - */ + */ if(xf86GetOptValInteger(pSiS->Options, OPTION_EMI, &pSiS->EMI)) { if((pSiS->EMI < 0) || (pSiS->EMI > 0x60ffffff)) { SiS_PrintIlRange(pScrn, OPTION_LVDSHL, 0, 0x60ffffff, 1); @@ -1345,13 +1352,30 @@ SiSOptions(ScrnInfoPtr pScrn) } } + /* ForcePanelRGB (300/315/330 series only) + * Can be used to force the bridge/panel link to assume a + * specified LCD color capability of 18 or 24 bit in cases + * where the BIOS carries incorrect information (such as in + * the case of the MSI m250). + */ + if(xf86GetOptValInteger(pSiS->Options, OPTION_EMI, &pSiS->PRGB)) { + if((pSiS->PRGB != 18 && pSiS->PRGB != 24)) { + pSiS->PRGB = -1; + SiS_PrintBadOpt(pScrn, strptr, OPTION_PRGB); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "LCD panel color depth is %d\n", + pSiS->PRGB); + } + } + } /* 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))) { @@ -1400,7 +1424,7 @@ SiSOptions(ScrnInfoPtr pScrn) /* 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) { @@ -1427,7 +1451,7 @@ SiSOptions(ScrnInfoPtr pScrn) * 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; @@ -1627,20 +1651,20 @@ 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 "); - } + } 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", val ? "" : "not "); - } - + } + #ifndef SISCHECKOSSSE if(xf86GetOptValBool(pSiS->Options, OPTION_XVSSECOPY, &val)) { pSiS->XvSSEMemcpy = val ? TRUE : FALSE; @@ -1650,7 +1674,6 @@ SiSOptions(ScrnInfoPtr pScrn) } #endif - #ifdef SIS_CP SIS_CP_OPT_DOOPT #endif @@ -1667,7 +1690,7 @@ SiSOptions(ScrnInfoPtr pScrn) /* 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, @@ -1684,7 +1707,6 @@ SiSOptions(ScrnInfoPtr pScrn) } 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 @@ -1701,7 +1723,7 @@ SiSOptions(ScrnInfoPtr pScrn) } - /* ShadowFB */ + /* ShadowFB */ from = X_DEFAULT; if(xf86GetOptValBool(pSiS->Options, OPTION_SHADOW_FB, &pSiS->ShadowFB)) { #ifdef SISMERGED @@ -1795,7 +1817,7 @@ SiSOptions(ScrnInfoPtr pScrn) } if(!pSiS->NoXvideo) { - + if((pSiS->VGAEngine == SIS_300_VGA) || (pSiS->VGAEngine == SIS_315_VGA)) { /* XvOnCRT2 * On chipsets with only one overlay (315, 650, 740, 330), the user can @@ -1931,7 +1953,7 @@ SiSOptions(ScrnInfoPtr pScrn) 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(SiS_EvalOneOrThreeFloats(pScrn, OPTION_STOREDBRI2, briopt, strptr, diff --git a/src/sis_regs.h b/src/sis_regs.h index 0ec07e5..f4ce227 100644 --- a/src/sis_regs.h +++ b/src/sis_regs.h @@ -3,7 +3,7 @@ /* * Register access macros and register definitions * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,7 +31,56 @@ #ifndef _SIS_REGS_H_ #define _SIS_REGS_H_ + +/* +#define SIS_NEED_inSISREG +#define SIS_NEED_inSISREGW +#define SIS_NEED_inSISREGL +#define SIS_NEED_outSISREG +#define SIS_NEED_outSISREGW +#define SIS_NEED_outSISREGL +#define SIS_NEED_orSISREG +#define SIS_NEED_andSISREG +#define SIS_NEED_inSISIDXREG +#define SIS_NEED_outSISIDXREG +#define SIS_NEED_orSISIDXREG +#define SIS_NEED_andSISIDXREG +#define SIS_NEED_setSISIDXREG +#define SIS_NEED_setSISIDXREGmask +*/ +/* Video RAM access macros */ + +/* (Currently, these are use on all platforms; USB2VGA is handled + * entirely different in a dedicated driver) + */ + +/* dest is video RAM, src is system RAM */ +#define sisfbwritel(dest, data) *(dest) = (data) +#define sisfbwritelinc(dest, data) *((dest)++) = (data) +#define sisfbwritelp(dest, dataptr) *(dest) = *(dataptr) +#define sisfbwritelpinc(dest, dataptr) *((dest)++) = *((dataptr)++) + +#define sisfbwritew(dest, data) *(dest) = (data) +#define sisfbwritewinc(dest, data) *((dest)++) = (data) +#define sisfbwritewp(dest, dataptr) *(dest) = *(dataptr) +#define sisfbwritewpinc(dest, dataptr) *((dest)++) = *((dataptr)++) + +#define sisfbwriteb(dest, data) *(dest) = (data) +#define sisfbwritebinc(dest, data) *((dest)++) = (data) +#define sisfbwritebp(dest, dataptr) *(dest) = *(dataptr) +#define sisfbwritebpinc(dest, dataptr) *((dest)++) = *((dataptr)++) + +/* Source is video RAM */ +#define sisfbreadl(src) *(src) +#define sisfbreadlinc(src) *((src)++) + +#define sisfbreadw(src) *(src) +#define sisfbreadwinc(src) *((src)++) + +#define sisfbreadb(src) *(src) +#define sisfbreadbinc(src) *((src)++) + /* Register access macros --------------- */ #ifndef SISUSEDEVPORT @@ -101,12 +150,13 @@ outSISREG((base)+1, __Temp); \ } while(0) -#else +#else /* USEDEVPORT */ extern int sisdevport; /* Note to self: SEEK_SET is faster than SEEK_CUR */ +#ifdef SIS_NEED_inSISREG static UChar inSISREG(ULong base) { UChar tmp; @@ -114,7 +164,9 @@ static UChar inSISREG(ULong base) read(sisdevport, &tmp, 1); return tmp; } +#endif +#ifdef SIS_NEED_inSISREGW static __inline UShort inSISREGW(ULong base) { UShort tmp; @@ -122,7 +174,9 @@ static __inline UShort inSISREGW(ULong base) read(sisdevport, &tmp, 2); return tmp; } +#endif +#ifdef SIS_NEED_inSISREGL static __inline unsigned int inSISREGL(ULong base) { ULong tmp; @@ -130,35 +184,45 @@ static __inline unsigned int inSISREGL(ULong base) read(sisdevport, &tmp, 4); return tmp; } +#endif +#ifdef SIS_NEED_outSISREG static void outSISREG(ULong base, UChar val) { lseek(sisdevport, base, SEEK_SET); write(sisdevport, &val, 1); } +#endif +#ifdef SIS_NEED_outSISREGW static __inline void outSISREGW(ULong base, UShort val) { lseek(sisdevport, base, SEEK_SET); write(sisdevport, &val, 2); } +#endif +#ifdef SIS_NEED_outSISREGL static __inline void outSISREGL(ULong base, unsigned int val) { lseek(sisdevport, base, SEEK_SET); write(sisdevport, &val, 4); } +#endif +#ifdef SIS_NEED_orSISREG static void orSISREG(ULong base, UChar val) { UChar tmp; lseek(sisdevport, base, SEEK_SET); read(sisdevport, &tmp, 1); tmp |= val; - lseek(sisdevport, -1, SEEK_CUR); + lseek(sisdevport, base, SEEK_SET); write(sisdevport, &tmp, 1); } +#endif +#ifdef SIS_NEED_andSISREG static void andSISREG(ULong base, UChar val) { UChar tmp; @@ -168,16 +232,20 @@ static void andSISREG(ULong base, UChar val) lseek(sisdevport, base, SEEK_SET); write(sisdevport, &tmp, 1); } +#endif +#ifdef SIS_NEED_outSISIDXREG static void outSISIDXREG(ULong base, UChar idx, UChar val) { UChar value[2]; - value[0] = idx; + value[0] = idx; /* sic! reads/writes bytewise! */ value[1] = val; lseek(sisdevport, base, SEEK_SET); write(sisdevport, &value[0], 2); } +#endif +#ifdef SIS_NEED_inSISIDXREG static UChar __inSISIDXREG(ULong base, UChar idx) { UChar tmp; @@ -186,9 +254,10 @@ static UChar __inSISIDXREG(ULong base, UChar idx) read(sisdevport, &tmp, 1); return tmp; } - #define inSISIDXREG(base,idx,var) var = __inSISIDXREG(base, idx); +#endif +#ifdef SIS_NEED_orSISIDXREG static void orSISIDXREG(ULong base, UChar idx, UChar val) { UChar tmp; @@ -199,7 +268,9 @@ static void orSISIDXREG(ULong base, UChar idx, UChar val) lseek(sisdevport, base + 1, SEEK_SET); write(sisdevport, &tmp, 1); } +#endif +#ifdef SIS_NEED_andSISIDXREG static void andSISIDXREG(ULong base, UChar idx, UChar val) { UChar tmp; @@ -210,7 +281,9 @@ static void andSISIDXREG(ULong base, UChar idx, UChar val) lseek(sisdevport, base + 1, SEEK_SET); write(sisdevport, &tmp, 1); } +#endif +#ifdef SIS_NEED_setSISIDXREG static void setSISIDXREG(ULong base, UChar idx, UChar myand, UChar myor) { @@ -223,7 +296,9 @@ static void setSISIDXREG(ULong base, UChar idx, lseek(sisdevport, base + 1, SEEK_SET); write(sisdevport, &tmp, 1); } +#endif +#ifdef SIS_NEED_setSISIDXREGmask static void setSISIDXREGmask(ULong base, UChar idx, UChar data, UChar mask) { @@ -236,9 +311,31 @@ static void setSISIDXREGmask(ULong base, UChar idx, lseek(sisdevport, base + 1, SEEK_SET); write(sisdevport, &tmp, 1); } +#endif #endif /* SISUSEDEVPORT */ +/* Video RAM and MMIO access macros ----- */ + +#define sisclearvram(where, howmuch) bzero(where, howmuch) + +/* MMIO */ +#define SIS_MMIO_OUT8 MMIO_OUT8 +#define SIS_MMIO_OUT16 MMIO_OUT16 +#define SIS_MMIO_OUT32 MMIO_OUT32 + +#define SIS_MMIO_IN8 MMIO_IN8 +#define SIS_MMIO_IN16 MMIO_IN16 +#define SIS_MMIO_IN32 MMIO_IN32 + +/* VRAM queue acceleration */ + +#define SiSWriteQueue(tt) + +#define SIS_WQINDEX(i) ((CARD32 *)(tt))[(i)] + +#define SIS_RQINDEX(i) ((volatile CARD32 *)(tt))[(i)] + /* Port offsets --------------- */ #define AROFFSET 0x40 @@ -607,7 +704,7 @@ static void setSISIDXREGmask(ULong base, UChar idx, #define VI6326_Misc4_CPUVideoFormatYUV422 0x01 #define VI6326_Misc4_CPUVideoFormatRGB565 0x02 #define VI6326_Misc4_EnableYUV420 0x04 /* 1 = enable, 0 = disable */ -/** #define WHATISTHIS 0x40 */ +/* #define WHATISTHIS 0x40 */ /* Bits for Index_VI6326_Control_Misc5 (all 530/620 only) */ #define VI6326_Misc5_LineBufferMerge 0x10 /* 0 = disable, 1=enable */ diff --git a/src/sis_setup.c b/src/sis_setup.c index 39cef71..08564f7 100644 --- a/src/sis_setup.c +++ b/src/sis_setup.c @@ -3,7 +3,7 @@ /* * Basic hardware and memory detection * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria. + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,6 +34,12 @@ */ #include "sis.h" +#define SIS_NEED_inSISREGW +#define SIS_NEED_inSISREGL +#define SIS_NEED_outSISREGW +#define SIS_NEED_outSISREGL +#define SIS_NEED_inSISIDXREG +#define SIS_NEED_outSISIDXREG #include "sis_regs.h" extern int SiSMclk(SISPtr pSiS); @@ -51,7 +57,7 @@ static const char *dramTypeStr[] = { "VCM", /* for 630 */ "DDR2 SDRAM", "" }; - + /* MCLK tables for SiS6326 */ static const int SiS6326MCLKIndex[4][8] = { { 10, 12, 14, 16, 17, 18, 19, 7 }, /* SGRAM */ @@ -332,7 +338,7 @@ sis300Setup(ScrnInfoPtr pScrn) pSiS->BusWidth); } -/* For 315, 315H, 315PRO, 330, 340 */ +/* For 315, 315H, 315PRO/E, 330, 340 */ static void sis315Setup(ScrnInfoPtr pScrn) { @@ -340,7 +346,7 @@ sis315Setup(ScrnInfoPtr pScrn) int busSDR[4] = {64, 64, 128, 128}; int busDDR[4] = {32, 32, 64, 64}; int busDDRA[4] = {64+32, 64+32 , (64+32)*2, (64+32)*2}; - unsigned int config, config1, config2, sr3a; + unsigned int config, config1, config2, sr3a, cr5f; char *dramTypeStr315[] = { "Single channel 1 rank SDR SDRAM", "Single channel 1 rank SDR SGRAM", @@ -395,10 +401,13 @@ sis315Setup(ScrnInfoPtr pScrn) inSISIDXREG(SISSR, 0x14, config); config1 = (config & 0x0C) >> 2; - inSISIDXREG(SISSR, 0x3A, sr3a); + + inSISIDXREG(SISSR, 0x3a, sr3a); config2 = sr3a & 0x03; + + inSISIDXREG(SISCR,0x5f,cr5f); - pScrn->videoRam = (1 << ((config & 0xF0) >> 4)) * 1024; + pScrn->videoRam = (1 << ((config & 0xf0) >> 4)) * 1024; if(pSiS->Chipset == PCI_CHIP_SIS340) { @@ -426,9 +435,11 @@ sis315Setup(ScrnInfoPtr pScrn) xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "DRAM type: %s\n", dramTypeStr330[(config1 * 4) + (config2 & 0x02)]); - } else { + } else { /* 315, USB 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)) { @@ -484,7 +495,7 @@ sis315Setup(ScrnInfoPtr pScrn) } } - } else { + } else { /* 315 */ if(config2 & 0x02) pSiS->MemClock *= 2; if(config1 == 0x02) @@ -493,6 +504,11 @@ sis315Setup(ScrnInfoPtr pScrn) pSiS->BusWidth = busDDR[(config & 0x03)]; else pSiS->BusWidth = busSDR[(config & 0x03)]; + + if(pSiS->ChipFlags & SiSCF_Is315E) { + inSISIDXREG(SISSR,0x15,config); + if(config & 0x10) pSiS->BusWidth = 32; + } } @@ -715,7 +731,7 @@ SiSSetup(ScrnInfoPtr pScrn) pSiS->Flags = 0; pSiS->VBFlags = 0; - switch (SISPTR(pScrn)->Chipset) { + switch (SISPTR(pScrn)->Chipset) { case PCI_CHIP_SIS300: case PCI_CHIP_SIS630: /* +730 */ case PCI_CHIP_SIS540: diff --git a/src/sis_shadow.c b/src/sis_shadow.c index cbac74e..223d131 100644 --- a/src/sis_shadow.c +++ b/src/sis_shadow.c @@ -30,7 +30,13 @@ #include "sis.h" #include "servermd.h" -#include "sis_shadow.h" + +void SISPointerMoved(int index, int x, int y); +void SISRefreshArea(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); +void SISRefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox); void SISPointerMoved(int index, int x, int y) @@ -54,15 +60,16 @@ SISRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) Bpp = pScrn->bitsPerPixel >> 3; FBPitch = BitmapBytePad(pScrn->displayWidth * pScrn->bitsPerPixel); - + while(num--) { + width = (pbox->x2 - pbox->x1) * Bpp; height = pbox->y2 - pbox->y1; src = pSiS->ShadowPtr + (pbox->y1 * pSiS->ShadowPitch) + (pbox->x1 * Bpp); dst = pSiS->FbBase + (pbox->y1 * FBPitch) + (pbox->x1 * Bpp); while(height--) { - (*pSiS->SiSFastVidCopy)(dst, src, width); + SiSMemCopyToVideoRam(pSiS, dst, src, width); dst += FBPitch; src += pSiS->ShadowPitch; } diff --git a/src/sis_vb.c b/src/sis_vb.c index 3473afe..87f26e0 100644 --- a/src/sis_vb.c +++ b/src/sis_vb.c @@ -3,7 +3,7 @@ /* * Video bridge detection and configuration for 300, 315 and 330 series * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,10 +32,24 @@ */ #include "sis.h" +#define SIS_NEED_inSISREG +#define SIS_NEED_inSISIDXREG +#define SIS_NEED_outSISIDXREG +#define SIS_NEED_orSISIDXREG +#define SIS_NEED_andSISIDXREG +#define SIS_NEED_setSISIDXREG #include "sis_regs.h" -#include "sis_vb.h" #include "sis_dac.h" +void SISCRT1PreInit(ScrnInfoPtr pScrn); +void SISLCDPreInit(ScrnInfoPtr pScrn, Bool quiet); +void SISTVPreInit(ScrnInfoPtr pScrn, Bool quiet); +void SISCRT2PreInit(ScrnInfoPtr pScrn, Bool quiet); +Bool SISRedetectCRT2Type(ScrnInfoPtr pScrn); +void SISSense30x(ScrnInfoPtr pScrn, Bool quiet); +void SISSenseChrontel(ScrnInfoPtr pScrn, Bool quiet); +void SiSSetupPseudoPanel(ScrnInfoPtr pScrn); + extern void SISDetermineLCDACap(ScrnInfoPtr pScrn); extern void SISSaveDetectedDevices(ScrnInfoPtr pScrn); extern void SISWaitRetraceCRT1(ScrnInfoPtr pScrn); @@ -46,6 +60,12 @@ extern BOOLEAN SiS_GetPanelID(SiS_Private *SiS_Pr, PSIS_HW_INFO HwDeviceExtensio extern USHORT SiS_SenseLCDDDC(SiS_Private *SiS_Pr, SISPtr pSiS); extern USHORT SiS_SenseVGA2DDC(SiS_Private *SiS_Pr, SISPtr pSiS); +typedef struct _SiS_LCD_StStruct +{ + ULong VBLCD_lcdflag; + UShort LCDwidth; + UShort LCDheight; +} SiS_LCD_StStruct; static const SiS_LCD_StStruct SiS300_LCD_Type[]= { @@ -292,12 +312,16 @@ 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. + * Therefore, we disregard an eventually detected secondary + * VGA if the user forced CRT2 type to LCD. * * By default, CRT2 redetection is forced since 12/09/2003, as * I encountered numerous panels which deliver more or less * bogus DDC data confusing the BIOS. Since our DDC detection * is waaaay better, we prefer it instead of the primitive * and buggy BIOS method. + * */ #ifdef SISDUALHEAD if((!pSiS->DualHeadMode) || (!pSiS->SecondHead)) { @@ -313,12 +337,14 @@ void SISLCDPreInit(ScrnInfoPtr pScrn, Bool quiet) } if(!(pSiS->nocrt2ddcdetection)) { - if((!(pSiS->VBFlags & CRT2_LCD)) && (!(CR32 & 0x10))) { + 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", pSiS->forcecrt2redetection ? - "Forced re-detection of" : "BIOS detected no"); + "(Re)-detecting" : "BIOS detected no"); } if(SiS_SenseLCDDDC(pSiS->SiS_Pr, pSiS)) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, @@ -348,6 +374,17 @@ void SISLCDPreInit(ScrnInfoPtr pScrn, Bool quiet) if((CR36 & 0x0f) < 0x0f) CR36 &= 0xf7; } } + if(pSiS->PRGB != -1) { + tmp = 0x37; + if((pSiS->VGAEngine == SIS_315_VGA) && + (pSiS->sishw_ext.jChipType < SIS_661) && + (pSiS->ROM661New) && + (!(pSiS->SiS_Pr->PanelSelfDetected))) { + tmp = 0x35; + } + if(pSiS->PRGB == 18) orSISIDXREG(SISCR, tmp, 0x01); + else if(pSiS->PRGB == 24) andSISIDXREG(SISCR, tmp, 0xfe); + } inSISIDXREG(SISCR, 0x37, CR37); if(pSiS->sishw_ext.jChipType < SIS_661) { inSISIDXREG(SISCR, 0x3C, CR7D); @@ -444,7 +481,31 @@ void SISLCDPreInit(ScrnInfoPtr pScrn, Bool quiet) } } } +} +void SiSSetupPseudoPanel(ScrnInfoPtr 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; + pSiS->SiS_Pr->CP_PreferredIndex = -1; + pSiS->VBLCDFlags |= (VB_LCD_UNKNOWN | VB_LCD_EXPANDING); + pSiS->LCDwidth = pSiS->SiS_Pr->CP_MaxX = 2048; + pSiS->LCDheight = pSiS->SiS_Pr->CP_MaxY = 2048; + for(i=0; i<7; i++) pSiS->SiS_Pr->CP_DataValid[i] = FALSE; + pSiS->SiS_Pr->CP_HaveCustomData = FALSE; + pSiS->SiS_Pr->PanelSelfDetected = TRUE; + outSISIDXREG(SISCR,0x36,0x0f); + setSISIDXREG(SISCR,0x37,0x0e,0x10); + orSISIDXREG(SISCR,0x32,0x08); } /* Detect CRT2-TV connector type and PAL/NTSC flag */ @@ -606,7 +667,7 @@ 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 */ @@ -1084,7 +1145,8 @@ Bool SISRedetectCRT2Type(ScrnInfoPtr pScrn) if((pSiS->VGAEngine == SIS_315_VGA) && (pSiS->VBFlags & VB_SISTMDSBRIDGE) && (!(pSiS->VBFlags & VB_30xBDH)) && - (pSiS->VESA != 1)) { + (pSiS->VESA != 1) && + (pSiS->SiS_Pr->SiS_CustomT != CUT_UNKNOWNLCD)) { SISLCDPreInit(pScrn, TRUE); } else { pSiS->VBFlags |= (pSiS->detectedCRT2Devices & CRT2_LCD); @@ -1125,7 +1187,7 @@ Bool SISRedetectCRT2Type(ScrnInfoPtr pScrn) 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 b786be2..ff8a865 100644 --- a/src/sis_vga.c +++ b/src/sis_vga.c @@ -3,7 +3,7 @@ /* * Mode setup and basic video bridge detection * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria. + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria. * * The SISInit() function for old series (except TV and FIFO calculation) * was previously based on code which was Copyright (C) 1998,1999 by Alan @@ -37,6 +37,12 @@ */ #include "sis.h" +#define SIS_NEED_inSISREG +#define SIS_NEED_outSISREG +#define SIS_NEED_inSISIDXREG +#define SIS_NEED_outSISIDXREG +#define SIS_NEED_orSISIDXREG +#define SIS_NEED_andSISIDXREG #include "sis_regs.h" #include "sis_dac.h" @@ -45,7 +51,6 @@ static Bool SIS300Init(ScrnInfoPtr pScrn, DisplayModePtr mode); static int SIS6326DoSense(ScrnInfoPtr pScrn, int tempbh, int tempbl, int tempch, int tempcl); static void SISSense6326(ScrnInfoPtr pScrn); static void SiS6326TVDelay(ScrnInfoPtr pScrn, int delay); - extern void SISSense30x(ScrnInfoPtr pScrn, Bool quiet); extern void SISSenseChrontel(ScrnInfoPtr pScrn, Bool quiet); @@ -57,8 +62,10 @@ void SiSVGARestoreFonts(ScrnInfoPtr pScrn); void SISVGALock(SISPtr pSiS); void SiSVGAUnlock(SISPtr pSiS); void SiSVGAProtect(ScrnInfoPtr pScrn, Bool on); +#ifdef SIS_PC_PLATFORM Bool SiSVGAMapMem(ScrnInfoPtr pScrn); void SiSVGAUnmapMem(ScrnInfoPtr pScrn); +#endif Bool SiSVGASaveScreen(ScreenPtr pScreen, int mode); static Bool SiSVGAInit(ScrnInfoPtr pScrn, DisplayModePtr mode, int fixsync); @@ -1002,12 +1009,11 @@ SISIsUMC(SISPtr pSiS) /* Detect video bridge and set VBFlags accordingly */ void SISVGAPreInit(ScrnInfoPtr pScrn) { - SISPtr pSiS = SISPTR(pScrn); + SISPtr pSiS = SISPTR(pScrn); int temp,temp1,temp2,sistypeidx; int upperlimitlvds, lowerlimitlvds; int upperlimitch, lowerlimitch; int chronteltype, chrontelidreg, upperlimitvb; - static const char *detectvb = "Detected SiS%s video bridge (%s, ID %d; Rev 0x%x)\n"; #if 0 UChar sr17=0; @@ -1051,7 +1057,7 @@ void SISVGAPreInit(ScrnInfoPtr pScrn) default: pSiS->ModeInit = SISInit; } - + if((pSiS->Chipset == PCI_CHIP_SIS6326) && (pSiS->SiS6326Flags & SIS6326_HASTV)) { UChar sr0d; inSISIDXREG(SISSR, 0x0d, sr0d); @@ -1064,7 +1070,7 @@ void SISVGAPreInit(ScrnInfoPtr pScrn) pSiS->VBFlags = pSiS->VBFlags2 = 0; /* reset VBFlags */ pSiS->SiS_Pr->SiS_UseLCDA = FALSE; pSiS->SiS_Pr->Backup = FALSE; - + /* Videobridges only available for 300/315/330/340 series */ if((pSiS->VGAEngine != SIS_300_VGA) && (pSiS->VGAEngine != SIS_315_VGA)) return; @@ -1348,7 +1354,7 @@ void SISVGAPreInit(ScrnInfoPtr pScrn) } } } - } + } } static void @@ -1503,7 +1509,7 @@ SiSVGASaveColormap(ScrnInfoPtr pScrn, SISRegPtr save) int i; if(pSiS->VGACMapSaved) return; - + outSISREG(SISPEL, 0xff); outSISREG(SISCOLIDXR, 0x00); @@ -1709,7 +1715,6 @@ SiSVGAMapMem(ScrnInfoPtr pScrn) return(pSiS->VGAMemBase != NULL); } - void SiSVGAUnmapMem(ScrnInfoPtr pScrn) { diff --git a/src/sis_video.c b/src/sis_video.c index bf23d81..80b7ae3 100644 --- a/src/sis_video.c +++ b/src/sis_video.c @@ -3,7 +3,7 @@ /* * Xv driver for SiS 300, 315 and 330 series. * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria. + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -102,6 +102,12 @@ #include "dixstruct.h" #include "fourcc.h" +#define SIS_NEED_inSISREG +#define SIS_NEED_outSISREG +#define SIS_NEED_inSISIDXREG +#define SIS_NEED_outSISIDXREG +#define SIS_NEED_setSISIDXREGmask +#define SIS_NEED_MYMMIO #include "sis_regs.h" #ifdef INCL_YUV_BLIT_ADAPTOR @@ -136,7 +142,8 @@ static int SISPutImageBlit( ScrnInfoPtr, short, short, short, short, short, short, short, short, int, UChar *, short, short, Bool, RegionPtr, ULong); static int SISQueryImageAttributesBlit(ScrnInfoPtr, - int, UShort *, UShort *, int *, int *); + int, UShort *, UShort *, int *, int *); +extern void SISWriteBlitPacket(SISPtr pSiS, CARD32 *packet); #endif #define OFF_DELAY 200 /* milliseconds */ @@ -225,6 +232,7 @@ static char sisxvsdgethardwareinfo[] = "XV_SD_GETHARDWAREINFO"; static char sisxvsdgetbusid[] = "XV_SD_GETBUSID"; static char sisxvsdqueryvbflagsversion[] = "XV_SD_QUERYVBFLAGSVERSION"; static char sisxvsdgetsdflags[] = "XV_SD_GETSDFLAGS"; +static char sisxvsdgetsdflags2[] = "XV_SD_GETSDFLAGS2"; static char sisxvsdunlocksisdirect[] = "XV_SD_UNLOCKSISDIRECT"; static char sisxvsdsetvbflags[] = "XV_SD_SETVBFLAGS"; static char sisxvsdquerydetecteddevices[] = "XV_SD_QUERYDETECTEDDEVICES"; @@ -297,19 +305,19 @@ static XF86VideoEncodingRec DummyEncoding = #ifndef SIS_CP #ifdef SISDEINT +#define NUM_ATTRIBUTES_300 69 +#ifdef TWDEBUG +#define NUM_ATTRIBUTES_315 76 +#else +#define NUM_ATTRIBUTES_315 75 +#endif +#else #define NUM_ATTRIBUTES_300 68 #ifdef TWDEBUG #define NUM_ATTRIBUTES_315 75 #else #define NUM_ATTRIBUTES_315 74 #endif -#else -#define NUM_ATTRIBUTES_300 67 -#ifdef TWDEBUG -#define NUM_ATTRIBUTES_315 74 -#else -#define NUM_ATTRIBUTES_315 73 -#endif #endif #endif @@ -339,6 +347,7 @@ static XF86AttributeRec SISAttributes_300[NUM_ATTRIBUTES_300] = { XvGettable, 0, -1, sisxvsdgetbusid}, { XvGettable, 0, -1, sisxvsdqueryvbflagsversion}, { XvGettable, 0, -1, sisxvsdgetsdflags}, + { XvGettable, 0, -1, sisxvsdgetsdflags2}, {XvSettable | XvGettable, 0, -1, sisxvsdunlocksisdirect}, {XvSettable , 0, -1, sisxvsdsetvbflags}, { XvGettable, 0, -1, sisxvsdquerydetecteddevices}, @@ -420,6 +429,7 @@ static XF86AttributeRec SISAttributes_315[NUM_ATTRIBUTES_315] = { XvGettable, 0, -1, sisxvsdgetbusid}, { XvGettable, 0, -1, sisxvsdqueryvbflagsversion}, { XvGettable, 0, -1, sisxvsdgetsdflags}, + { XvGettable, 0, -1, sisxvsdgetsdflags2}, {XvSettable | XvGettable, 0, -1, sisxvsdunlocksisdirect}, {XvSettable , 0, -1, sisxvsdsetvbflags}, { XvGettable, 0, -1, sisxvsdquerydetecteddevices}, @@ -953,7 +963,7 @@ SiSSetXvGamma(SISPtr pSiS) UChar backup = getsrreg(pSiS, 0x1f); setsrregmask(pSiS, 0x1f, 0x08, 0x18); for(i = 0; i <= 255; i++) { - MMIO_OUT32(pSiS->IOBase, 0x8570, + SIS_MMIO_OUT32(pSiS->IOBase, 0x8570, (i << 24) | (pSiS->XvGammaRampBlue[i] << 16) | (pSiS->XvGammaRampGreen[i] << 8) | @@ -1580,6 +1590,7 @@ SISSetupImageVideo(ScreenPtr pScreen) pSiS->xv_GBI = MAKE_ATOM(sisxvsdgetbusid); pSiS->xv_QVV = MAKE_ATOM(sisxvsdqueryvbflagsversion); pSiS->xv_GSF = MAKE_ATOM(sisxvsdgetsdflags); + pSiS->xv_GSF2 = MAKE_ATOM(sisxvsdgetsdflags2); pSiS->xv_USD = MAKE_ATOM(sisxvsdunlocksisdirect); pSiS->xv_SVF = MAKE_ATOM(sisxvsdsetvbflags); pSiS->xv_QDD = MAKE_ATOM(sisxvsdquerydetecteddevices); @@ -1748,7 +1759,7 @@ RegionsEqual(RegionPtr A, RegionPtr B) static int SISSetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 value, pointer data) -{ +{ SISPortPrivPtr pPriv = (SISPortPrivPtr)data; SISPtr pSiS = SISPTR(pScrn); #ifdef SISDUALHEAD @@ -2225,7 +2236,7 @@ SISSetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, pSiS->XvGammaBlue = value; SiSUpdateXvGamma(pSiS, pPriv); } else return BadMatch; - } else return BadMatch; + } else return BadMatch; return Success; } @@ -2235,7 +2246,7 @@ SISGetPortAttribute( Atom attribute, INT32 *value, pointer data -){ +){ SISPortPrivPtr pPriv = (SISPortPrivPtr)data; SISPtr pSiS = SISPTR(pScrn); #ifdef SISDUALHEAD @@ -2290,6 +2301,8 @@ SISGetPortAttribute( *value = pSiS->CRT1isoff ? 0 : 1; } else if(attribute == pSiS->xv_GSF) { *value = pSiS->SiS_SD_Flags; + } else if(attribute == pSiS->xv_GSF2) { + *value = pSiS->SiS_SD2_Flags; } else if(attribute == pSiS->xv_USD) { *value = pSiS->xv_sisdirectunlocked; } else if(attribute == pSiS->xv_TAF) { @@ -2337,8 +2350,8 @@ SISGetPortAttribute( if(pSiS->CRT2SepGamma) *value |= 0x08; #ifdef SISDUALHEAD } +#endif if(pSiS->XvGamma) *value |= 0x04; -#endif } else if(attribute == pSiS->xv_TXS) { *value = SiS_GetTVxscale(pScrn); } else if(attribute == pSiS->xv_TYS) { @@ -2449,7 +2462,7 @@ SISGetPortAttribute( } else if(attribute == pSiS->xvGammaBlue) { *value = pSiS->XvGammaBlue; } else return BadMatch; - } else return BadMatch; + } else return BadMatch; return Success; } @@ -3482,14 +3495,17 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv) #ifdef SISMERGED if(!pSiS->MergedFB) { #endif - if(pPriv->displayMode & (DISPMODE_SINGLE1 | DISPMODE_MIRROR)) { - if(!(pSiS->MiscFlags & MISC_CRT1OVERLAY)) { - if(pPriv->overlayStatus) { - close_overlay(pSiS, pPriv); - } - pPriv->NoOverlay = TRUE; - return; - } + if( ((pPriv->displayMode & DISPMODE_MIRROR) && + ((pSiS->MiscFlags & (MISC_CRT1OVERLAY|MISC_CRT2OVERLAY)) != (MISC_CRT1OVERLAY|MISC_CRT2OVERLAY))) || + ((pPriv->displayMode & DISPMODE_SINGLE1) && + (!(pSiS->MiscFlags & MISC_CRT1OVERLAY))) || + ((pPriv->displayMode & DISPMODE_SINGLE2) && + (!(pSiS->MiscFlags & MISC_CRT2OVERLAY))) ) { + if(pPriv->overlayStatus) { + close_overlay(pSiS, pPriv); + } + pPriv->NoOverlay = TRUE; + return; } #ifdef SISMERGED } @@ -3642,6 +3658,13 @@ SISDisplayVideo(ScrnInfoPtr pScrn, SISPortPrivPtr pPriv) (overlay.dstBox2.x1 >= screen2width - 2) || (overlay.dstBox2.y1 >= overlay.dstBox2.y2)) overlay.DoSecond = FALSE; + + /* Check if dotclock is within limits for CRT1 */ + if(pPriv->displayMode & (DISPMODE_SINGLE2 | DISPMODE_MIRROR)) { + if(!(pSiS->MiscFlags & MISC_CRT2OVERLAY)) { + overlay.DoSecond = FALSE; + } + } /* If neither overlay is to be displayed, disable them if they are currently enabled */ if((!overlay.DoFirst) && (!overlay.DoSecond)) { @@ -4238,6 +4261,11 @@ SISPutImage( Bool deintfm = (pPriv->deinterlacemethod > 1) ? TRUE : FALSE; #endif +#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); +#endif + #if 0 if(id == SDC_ID) { return(SiSHandleSiSDirectCommand(pScrn, pPriv, (sisdirectcommand *)buf)); @@ -4331,7 +4359,7 @@ SISPutImage( CARD8 *dest = (CARD8 *)(pSiS->FbBase + pPriv->bufAddr[pPriv->currentBuf]); int i = height; while(i--) { - (*pSiS->SiSFastVidCopy)(dest, src, pPriv->srcPitch); + SiSMemCopyToVideoRam(pSiS, dest, src, pPriv->srcPitch); src += pPriv->srcPitch; dest += (pPriv->srcPitch << 1); } @@ -4343,7 +4371,7 @@ SISPutImage( /* copy data */ if((pSiS->XvUseMemcpy) || (totalSize < 16)) { - (*pSiS->SiSFastVidCopy)(pSiS->FbBase + pPriv->bufAddr[pPriv->currentBuf], buf, totalSize); + SiSMemCopyToVideoRam(pSiS, pSiS->FbBase + pPriv->bufAddr[pPriv->currentBuf], buf, totalSize); } else { ULong i; CARD32 *src = (CARD32 *)buf; @@ -4731,7 +4759,7 @@ SISInitOffscreenImages(ScreenPtr pScreen) if(pSiS->VGAEngine == SIS_300_VGA) num = NUMOFFSCRIMAGES_300; else num = NUMOFFSCRIMAGES_315; - for(i = 0; i <= num; i++) { + for(i = 0; i < num; i++) { SISOffscreenImages[i].max_width = DummyEncoding.width; SISOffscreenImages[i].max_height = DummyEncoding.height; if(pSiS->VGAEngine == SIS_300_VGA) { @@ -4739,9 +4767,9 @@ SISInitOffscreenImages(ScreenPtr pScreen) SISOffscreenImages[i].attributes = &SISAttributes_300[0]; } else { if(pPriv->hasTwoOverlays) { - SISOffscreenImages[i].num_attributes = NUM_ATTRIBUTES_315; - } else { SISOffscreenImages[i].num_attributes = NUM_ATTRIBUTES_315 - 1; + } else { + SISOffscreenImages[i].num_attributes = NUM_ATTRIBUTES_315; } SISOffscreenImages[i].attributes = &SISAttributes_315[0]; } @@ -4908,19 +4936,7 @@ SISStopVideoBlit(ScrnInfoPtr pScrn, ULong index, Bool shutdown) } } -static 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]); - SiSWritePacketPart(packet[12], packet[13], packet[14], packet[15]); - SiSWritePacketPart(packet[16], packet[17], packet[18], packet[19]); - SiSSyncWP; - (void)dummybuf; /* Suppress compiler warning */ -} + static int SISPutImageBlit( @@ -5053,7 +5069,7 @@ SISPutImageBlit( case PIXEL_FMT_I420: MyPacket.P12_Command = YUV_FORMAT_NV12; /* Copy y plane */ - (*pSiS->SiSFastVidCopy)(ybased, ybases, bytesize); + SiSMemCopyToVideoRam(pSiS, ybased, ybases, bytesize); /* Copy u/v planes */ wb = srcPitch >> 1; h = height >> 1; @@ -5078,7 +5094,7 @@ SISPutImageBlit( } break; default: - (*pSiS->SiSFastVidCopy)(ybased, ybases, totalSize); + SiSMemCopyToVideoRam(pSiS, ybased, ybases, totalSize); } #ifdef SISDUALHEAD @@ -5227,8 +5243,8 @@ mycont: #if 0 { int debug = 0; - while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) { debug++; }; - while( (MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) { debug++; }; + while( (SIS_MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) { debug++; }; + while( (SIS_MMIO_IN16(pSiS->IOBase, Q_STATUS+2) & 0x8000) != 0x8000) { debug++; }; xf86DrvMsg(0, X_INFO, "vsync %d, debug %d\n", pPriv->vsync, debug); } #endif diff --git a/src/vgatypes.h b/src/vgatypes.h index 865471c..b87de9e 100644 --- a/src/vgatypes.h +++ b/src/vgatypes.h @@ -3,7 +3,7 @@ /* * General type definitions for universal mode switching modules * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * If distributed as part of the Linux kernel, the following license terms * apply: @@ -191,6 +191,11 @@ struct _SIS_HW_INFO /* lock sisfb from register access */ #define SISFB_SET_LOCK 0x4004f306 +/* Magic value for USB device */ +#ifndef SISFB_USB_MAGIC +#define SISFB_USB_MAGIC 0x55aa2011 +#endif + /* Structure argument for SISFB_GET_INFO ioctl */ typedef struct _SISFB_INFO sisfb_info, *psisfb_info; @@ -212,9 +217,9 @@ struct _SISFB_INFO { CARD32 sisfb_tqlen; /* turbo queue length (in KB) */ - CARD32 sisfb_pcibus; /* The card's PCI ID */ - CARD32 sisfb_pcislot; - CARD32 sisfb_pcifunc; + CARD32 sisfb_pcibus; /* The card's PCI bus ID. For USB, bus = SISFB_USB_MAGIC */ + CARD32 sisfb_pcislot; /* alias usbbus */ + CARD32 sisfb_pcifunc; /* alias usbdev */ CARD8 sisfb_lcdpdc; @@ -236,7 +241,8 @@ struct _SISFB_INFO { CARD8 reserved[208]; /* for future use */ }; -#endif + +#endif /* LINUX_XF86 */ #endif diff --git a/src/vstruct.h b/src/vstruct.h index a3174a3..11693ab 100644 --- a/src/vstruct.h +++ b/src/vstruct.h @@ -3,7 +3,7 @@ /* * General structure definitions for universal mode switching modules * - * Copyright (C) 2001-2004 by Thomas Winischhofer, Vienna, Austria + * Copyright (C) 2001-2005 by Thomas Winischhofer, Vienna, Austria * * If distributed as part of the Linux kernel, the following license terms * apply: @@ -79,6 +79,7 @@ typedef struct _SiS_TVDataStruct USHORT RVBHRS; UCHAR FlickerMode; USHORT HALFRVBHRS; + USHORT RVBHRS2; UCHAR RY1COE; UCHAR RY2COE; UCHAR RY3COE; @@ -104,11 +105,6 @@ typedef struct _SiS_LVDSCRT1DataStruct UCHAR CR[15]; } SiS_LVDSCRT1DataStruct; -typedef struct _SiS_LCDACRT1DataStruct -{ - UCHAR CR[17]; -} SiS_LCDACRT1DataStruct; - typedef struct _SiS_CHTVRegDataStruct { UCHAR Reg[16]; @@ -223,8 +219,6 @@ typedef struct _SiS_ModeResInfoStruct UCHAR YChar; } SiS_ModeResInfoStruct; - - typedef UCHAR DRAM4Type[4]; /* Defines for SiS_CustomT */ @@ -248,6 +242,7 @@ typedef UCHAR DRAM4Type[4]; #define CUT_COMPAL1400_2 16 #define CUT_ASUSA2H_1 17 #define CUT_ASUSA2H_2 18 +#define CUT_UNKNOWNLCD 19 typedef struct _SiS_Private { @@ -323,6 +318,7 @@ typedef struct _SiS_Private USHORT SiS_RVBHCFACT; USHORT SiS_RVBHCMAX; USHORT SiS_RVBHRS; + USHORT SiS_RVBHRS2; USHORT SiS_VGAVT; USHORT SiS_VGAHT; USHORT SiS_VT; @@ -454,40 +450,20 @@ typedef struct _SiS_Private #endif const SiS_Part2PortTblStruct *SiS_CRT2Part2_1024x768_1; - const SiS_Part2PortTblStruct *SiS_CRT2Part2_1280x1024_1; const SiS_Part2PortTblStruct *SiS_CRT2Part2_1024x768_2; - const SiS_Part2PortTblStruct *SiS_CRT2Part2_1280x1024_2; const SiS_Part2PortTblStruct *SiS_CRT2Part2_1024x768_3; - const SiS_Part2PortTblStruct *SiS_CRT2Part2_1280x1024_3; /* LVDS, Chrontel */ - const SiS_LVDSDataStruct *SiS_LVDS800x600Data_1; - const SiS_LVDSDataStruct *SiS_LVDS800x600Data_2; - const SiS_LVDSDataStruct *SiS_LVDS1024x768Data_1; - const SiS_LVDSDataStruct *SiS_LVDS1024x768Data_2; - const SiS_LVDSDataStruct *SiS_LVDS1280x1024Data_1; - const SiS_LVDSDataStruct *SiS_LVDS1280x1024Data_2; - const SiS_LVDSDataStruct *SiS_LVDS1280x960Data_1; - const SiS_LVDSDataStruct *SiS_LVDS1280x960Data_2; - const SiS_LVDSDataStruct *SiS_LVDS1400x1050Data_1; - const SiS_LVDSDataStruct *SiS_LVDS1400x1050Data_2; - const SiS_LVDSDataStruct *SiS_LVDS1600x1200Data_1; - const SiS_LVDSDataStruct *SiS_LVDS1600x1200Data_2; - const SiS_LVDSDataStruct *SiS_LVDS1280x768Data_1; - const SiS_LVDSDataStruct *SiS_LVDS1280x768Data_2; - const SiS_LVDSDataStruct *SiS_LVDS1024x600Data_1; - const SiS_LVDSDataStruct *SiS_LVDS1024x600Data_2; - const SiS_LVDSDataStruct *SiS_LVDS1152x768Data_1; - const SiS_LVDSDataStruct *SiS_LVDS1152x768Data_2; + const SiS_LVDSDataStruct *SiS_LVDS320x480Data_1; const SiS_LVDSDataStruct *SiS_LVDS640x480Data_1; const SiS_LVDSDataStruct *SiS_LVDS640x480Data_2; - const SiS_LVDSDataStruct *SiS_LVDS320x480Data_1; - const SiS_LVDSDataStruct *SiS_LVDSXXXxXXXData_1; + const SiS_LVDSDataStruct *SiS_LVDS800x600Data_1; + const SiS_LVDSDataStruct *SiS_LVDS1024x600Data_1; + const SiS_LVDSDataStruct *SiS_LVDS1024x768Data_1; const SiS_LVDSDataStruct *SiS_LVDSBARCO1366Data_1; const SiS_LVDSDataStruct *SiS_LVDSBARCO1366Data_2; const SiS_LVDSDataStruct *SiS_LVDSBARCO1024Data_1; - const SiS_LVDSDataStruct *SiS_LVDSBARCO1024Data_2; const SiS_LVDSDataStruct *SiS_LVDS848x480Data_1; const SiS_LVDSDataStruct *SiS_LVDS848x480Data_2; const SiS_LVDSDataStruct *SiS_CHTVUNTSCData; @@ -499,87 +475,25 @@ typedef struct _SiS_Private const SiS_LVDSDataStruct *SiS_CHTVUPALNData; const SiS_LVDSDataStruct *SiS_CHTVOPALNData; const SiS_LVDSDataStruct *SiS_CHTVSOPALData; - - const SiS_LVDSDesStruct *SiS_PanelType00_1; - const SiS_LVDSDesStruct *SiS_PanelType01_1; - const SiS_LVDSDesStruct *SiS_PanelType02_1; - const SiS_LVDSDesStruct *SiS_PanelType03_1; - const SiS_LVDSDesStruct *SiS_PanelType04_1; - const SiS_LVDSDesStruct *SiS_PanelType05_1; - const SiS_LVDSDesStruct *SiS_PanelType06_1; - const SiS_LVDSDesStruct *SiS_PanelType07_1; - const SiS_LVDSDesStruct *SiS_PanelType08_1; - const SiS_LVDSDesStruct *SiS_PanelType09_1; - const SiS_LVDSDesStruct *SiS_PanelType0a_1; - const SiS_LVDSDesStruct *SiS_PanelType0b_1; - const SiS_LVDSDesStruct *SiS_PanelType0c_1; - const SiS_LVDSDesStruct *SiS_PanelType0d_1; - const SiS_LVDSDesStruct *SiS_PanelType0e_1; - const SiS_LVDSDesStruct *SiS_PanelType0f_1; - const SiS_LVDSDesStruct *SiS_PanelTypeNS_1; - const SiS_LVDSDesStruct *SiS_PanelType00_2; - const SiS_LVDSDesStruct *SiS_PanelType01_2; - const SiS_LVDSDesStruct *SiS_PanelType02_2; - const SiS_LVDSDesStruct *SiS_PanelType03_2; - const SiS_LVDSDesStruct *SiS_PanelType04_2; - const SiS_LVDSDesStruct *SiS_PanelType05_2; - const SiS_LVDSDesStruct *SiS_PanelType06_2; - const SiS_LVDSDesStruct *SiS_PanelType07_2; - const SiS_LVDSDesStruct *SiS_PanelType08_2; - const SiS_LVDSDesStruct *SiS_PanelType09_2; - const SiS_LVDSDesStruct *SiS_PanelType0a_2; - const SiS_LVDSDesStruct *SiS_PanelType0b_2; - const SiS_LVDSDesStruct *SiS_PanelType0c_2; - const SiS_LVDSDesStruct *SiS_PanelType0d_2; - const SiS_LVDSDesStruct *SiS_PanelType0e_2; - const SiS_LVDSDesStruct *SiS_PanelType0f_2; - const SiS_LVDSDesStruct *SiS_PanelTypeNS_2; - const SiS_LVDSDesStruct *SiS_CHTVUNTSCDesData; - const SiS_LVDSDesStruct *SiS_CHTVONTSCDesData; - const SiS_LVDSDesStruct *SiS_CHTVUPALDesData; - const SiS_LVDSDesStruct *SiS_CHTVOPALDesData; - - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1800x600_1; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x768_1; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x1024_1; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11400x1050_1; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x768_1; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x600_1; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11152x768_1; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11600x1200_1; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1800x600_1_H; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x768_1_H; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x1024_1_H; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11400x1050_1_H; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x768_1_H; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x600_1_H; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11152x768_1_H; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11600x1200_1_H; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1800x600_2; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x768_2; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x1024_2; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11400x1050_2; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x768_2; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x600_2; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11152x768_2; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11600x1200_2; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1800x600_2_H; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x768_2_H; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x1024_2_H; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11400x1050_2_H; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11280x768_2_H; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11024x600_2_H; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11152x768_2_H; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT11600x1200_2_H; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1XXXxXXX_1; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1XXXxXXX_1_H; + + 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_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; - const SiS_LVDSCRT1DataStruct *SiS_LVDSCRT1320x480_1; +#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 const SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1UNTSC; const SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1ONTSC; const SiS_LVDSCRT1DataStruct *SiS_CHTVCRT1UPAL; @@ -612,6 +526,7 @@ typedef struct _SiS_Private USHORT PanelVRS, PanelVRE; USHORT PanelVCLKIdx300; USHORT PanelVCLKIdx315; + BOOLEAN Alternate1600x1200; BOOLEAN UseCustomMode; BOOLEAN CRT1UsesCustomMode;