annotate vidix/sis_bridge.c @ 28771:bd24ac0d9fd8

Make sure vo_x11_create_vo_window sets vo_dwidth and vo_dheight right when we were in fullscreen mode and stay there.
author reimar
date Wed, 04 Mar 2009 08:37:54 +0000
parents 2391228b7ff0
children 36818ea5ce95
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23046
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
1 /*
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
2 * VIDIX driver for SiS chipsets.
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
3 * Video bridge detection for SiS 300 and 310/325 series.
26718
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 23048
diff changeset
4 *
28307
2391228b7ff0 cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents: 26753
diff changeset
5 * Copyright (C) 2003 Jake Page, Sugar Media
26718
051b2632f121 consistency cosmetics: Move some parts of file headers around; typo fixes.
diego
parents: 23048
diff changeset
6 * Based on SiS Xv driver
28307
2391228b7ff0 cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents: 26753
diff changeset
7 * Copyright 2002-2003 by Thomas Winischhofer, Vienna, Austria
23046
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
8 *
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
9 * This file is part of MPlayer.
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
10 *
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
11 * MPlayer is free software; you can redistribute it and/or modify
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
12 * it under the terms of the GNU General Public License as published by
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
14 * (at your option) any later version.
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
15 *
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
16 * MPlayer is distributed in the hope that it will be useful,
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
19 * GNU General Public License for more details.
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
20 *
26719
3abd1629658b Use standard license headers.
diego
parents: 26718
diff changeset
21 * You should have received a copy of the GNU General Public License along
3abd1629658b Use standard license headers.
diego
parents: 26718
diff changeset
22 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
3abd1629658b Use standard license headers.
diego
parents: 26718
diff changeset
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23046
82216ef041e0 updated vidix files headers whenever it's possible to have a clear GPL statement
ben
parents: 22901
diff changeset
24 */
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
25
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
26 #include <stdio.h>
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
27 #include <stdlib.h>
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
28 #include <unistd.h>
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
29
22901
a7605669b114 renamed libdha.[hc] to dha.[hc]
ben
parents: 22900
diff changeset
30 #include "dha.h"
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
31 #include "sis_regs.h"
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
32 #include "sis_defs.h"
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
33
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
34
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
35 static void sis_ddc2_delay(unsigned short delaytime)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
36 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
37 unsigned short i;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
38 int temp;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
39
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
40 for (i = 0; i < delaytime; i++) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
41 inSISIDXREG(SISSR, 0x05, temp);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
42 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
43 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
44
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
45
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
46 static int sis_do_sense(int tempbl, int tempbh, int tempcl, int tempch)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
47 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
48 int temp;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
49
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
50 outSISIDXREG(SISPART4, 0x11, tempbl);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
51 temp = tempbh | tempcl;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
52 setSISIDXREG(SISPART4, 0x10, 0xe0, temp);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
53 //usleep(200000);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
54 sis_ddc2_delay(0x1000);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
55 tempch &= 0x7f;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
56 inSISIDXREG(SISPART4, 0x03, temp);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
57 temp ^= 0x0e;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
58 temp &= tempch;
26753
502f04b67653 cosmetics: Remove useless parentheses from return statements.
diego
parents: 26719
diff changeset
59 return temp == tempch;
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
60 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
61
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
62
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
63 /* sense connected devices on 30x bridge */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
64 static void sis_sense_30x(void)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
65 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
66 unsigned char backupP4_0d, backupP2_00, biosflag;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
67 unsigned char testsvhs_tempbl, testsvhs_tempbh;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
68 unsigned char testsvhs_tempcl, testsvhs_tempch;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
69 unsigned char testcvbs_tempbl, testcvbs_tempbh;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
70 unsigned char testcvbs_tempcl, testcvbs_tempch;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
71 unsigned char testvga2_tempbl, testvga2_tempbh;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
72 unsigned char testvga2_tempcl, testvga2_tempch;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
73 int myflag, result = 0, i, j, haveresult;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
74
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
75 inSISIDXREG(SISPART4, 0x0d, backupP4_0d);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
76 outSISIDXREG(SISPART4, 0x0d, (backupP4_0d | 0x04));
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
77
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
78 inSISIDXREG(SISPART2, 0x00, backupP2_00);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
79 outSISIDXREG(SISPART2, 0x00, (backupP2_00 | 0x1c));
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
80
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
81 sis_do_sense(0, 0, 0, 0);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
82
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
83 if (sis_vga_engine == SIS_300_VGA) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
84 testvga2_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
85 testvga2_tempbl = 0xd1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
86 testsvhs_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
87 testsvhs_tempbl = 0xb9;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
88 testcvbs_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
89 testcvbs_tempbl = 0xb3;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
90 biosflag = 0;
23048
7973a6935234 removed useless code from vidix drivers
ben
parents: 23046
diff changeset
91
22850
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
92 if (sis_vbflags & (VB_301B | VB_302B | VB_301LV | VB_302LV)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
93 testvga2_tempbh = 0x01;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
94 testvga2_tempbl = 0x90;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
95 testsvhs_tempbh = 0x01;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
96 testsvhs_tempbl = 0x6b;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
97 testcvbs_tempbh = 0x01;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
98 testcvbs_tempbl = 0x74;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
99 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
100 inSISIDXREG(SISPART4, 0x01, myflag);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
101 if (myflag & 0x04) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
102 testvga2_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
103 testvga2_tempbl = 0xfd;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
104 testsvhs_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
105 testsvhs_tempbl = 0xdd;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
106 testcvbs_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
107 testcvbs_tempbl = 0xee;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
108 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
109 testvga2_tempch = 0x0e;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
110 testvga2_tempcl = 0x08;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
111 testsvhs_tempch = 0x06;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
112 testsvhs_tempcl = 0x04;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
113 testcvbs_tempch = 0x08;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
114 testcvbs_tempcl = 0x04;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
115
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
116 if (sis_device_id == DEVICE_SIS_300) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
117 inSISIDXREG(SISSR, 0x3b, myflag);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
118 if (!(myflag & 0x01)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
119 testvga2_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
120 testvga2_tempbl = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
121 testvga2_tempch = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
122 testvga2_tempcl = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
123 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
124 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
125 } else {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
126 testvga2_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
127 testvga2_tempbl = 0xd1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
128 testsvhs_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
129 testsvhs_tempbl = 0xb9;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
130 testcvbs_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
131 testcvbs_tempbl = 0xb3;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
132 biosflag = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
133
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
134 if (sis_vbflags & (VB_301B | VB_302B | VB_301LV | VB_302LV)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
135 if (sis_vbflags & (VB_301B | VB_302B)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
136 testvga2_tempbh = 0x01;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
137 testvga2_tempbl = 0x90;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
138 testsvhs_tempbh = 0x01;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
139 testsvhs_tempbl = 0x6b;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
140 testcvbs_tempbh = 0x01;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
141 testcvbs_tempbl = 0x74;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
142 } else {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
143 testvga2_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
144 testvga2_tempbl = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
145 testsvhs_tempbh = 0x02;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
146 testsvhs_tempbl = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
147 testcvbs_tempbh = 0x01;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
148 testcvbs_tempbl = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
149 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
150 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
151 if (sis_vbflags & (VB_301 | VB_301B | VB_302B)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
152 inSISIDXREG(SISPART4, 0x01, myflag);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
153 if (myflag & 0x04) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
154 testvga2_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
155 testvga2_tempbl = 0xfd;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
156 testsvhs_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
157 testsvhs_tempbl = 0xdd;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
158 testcvbs_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
159 testcvbs_tempbl = 0xee;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
160 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
161 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
162 if (sis_vbflags & (VB_301LV | VB_302LV)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
163 /* TW: No VGA2 or SCART on LV bridges */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
164 testvga2_tempbh = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
165 testvga2_tempbl = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
166 testvga2_tempch = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
167 testvga2_tempcl = 0x00;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
168 testsvhs_tempch = 0x04;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
169 testsvhs_tempcl = 0x08;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
170 testcvbs_tempch = 0x08;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
171 testcvbs_tempcl = 0x08;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
172 } else {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
173 testvga2_tempch = 0x0e;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
174 testvga2_tempcl = 0x08;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
175 testsvhs_tempch = 0x06;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
176 testsvhs_tempcl = 0x04;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
177 testcvbs_tempch = 0x08;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
178 testcvbs_tempcl = 0x04;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
179 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
180 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
181
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
182 /* XXX: ?? andSISIDXREG(SISCR, 0x32, ~0x14); */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
183 /* pSiS->postVBCR32 &= ~0x14; */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
184
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
185 /* scan for VGA2/SCART */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
186 if (testvga2_tempch || testvga2_tempcl ||
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
187 testvga2_tempbh || testvga2_tempbl) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
188
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
189 haveresult = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
190 for (j = 0; j < 10; j++) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
191 result = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
192 for (i = 0; i < 3; i++) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
193 if (sis_do_sense(testvga2_tempbl, testvga2_tempbh,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
194 testvga2_tempcl, testvga2_tempch))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
195 result++;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
196 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
197 if ((result == 0) || (result >= 2))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
198 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
199 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
200 if (result) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
201 if (biosflag & 0x01) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
202 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
203 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
204 ("[SiS] SiS30x: Detected TV connected to SCART output\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
205 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
206 sis_vbflags |= TV_SCART;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
207 orSISIDXREG(SISCR, 0x32, 0x04);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
208 /*pSiS->postVBCR32 |= 0x04; */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
209 } else {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
210 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
211 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
212 ("[SiS] SiS30x: Detected secondary VGA connection\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
213 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
214 sis_vbflags |= VGA2_CONNECTED;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
215 orSISIDXREG(SISCR, 0x32, 0x10);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
216 /*pSiS->postVBCR32 |= 0x10; */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
217 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
218 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
219 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
220
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
221 /* scanning for TV */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
222
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
223 /* XXX: ?? andSISIDXREG(SISCR, 0x32, ~0x03); */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
224 /* pSiS->postVBCR32 &= ~0x03; */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
225
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
226 result = sis_do_sense(testsvhs_tempbl, testsvhs_tempbh,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
227 testsvhs_tempcl, testsvhs_tempch);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
228
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
229
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
230 haveresult = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
231 for (j = 0; j < 10; j++) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
232 result = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
233 for (i = 0; i < 3; i++) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
234 if (sis_do_sense(testsvhs_tempbl, testsvhs_tempbh,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
235 testsvhs_tempcl, testsvhs_tempch))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
236 result++;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
237 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
238 if ((result == 0) || (result >= 2))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
239 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
240 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
241 if (result) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
242 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
243 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
244 ("[SiS] SiS30x: Detected TV connected to SVIDEO output\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
245 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
246 /* TW: So we can be sure that there IS a SVIDEO output */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
247 sis_vbflags |= TV_SVIDEO;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
248 orSISIDXREG(SISCR, 0x32, 0x02);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
249 //pSiS->postVBCR32 |= 0x02;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
250 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
251
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
252 if ((biosflag & 0x02) || (!(result))) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
253 haveresult = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
254 for (j = 0; j < 10; j++) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
255 result = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
256 for (i = 0; i < 3; i++) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
257 if (sis_do_sense(testcvbs_tempbl, testcvbs_tempbh,
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
258 testcvbs_tempcl, testcvbs_tempch))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
259 result++;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
260 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
261 if ((result == 0) || (result >= 2))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
262 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
263 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
264 if (result) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
265 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
266 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
267 ("[SiS] SiS30x: Detected TV connected to COMPOSITE output\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
268 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
269 sis_vbflags |= TV_AVIDEO;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
270 orSISIDXREG(SISCR, 0x32, 0x01);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
271 //pSiS->postVBCR32 |= 0x01;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
272 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
273 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
274
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
275 sis_do_sense(0, 0, 0, 0);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
276
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
277 outSISIDXREG(SISPART2, 0x00, backupP2_00);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
278 outSISIDXREG(SISPART4, 0x0d, backupP4_0d);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
279 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
280
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
281
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
282 static void sis_detect_crt1(void)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
283 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
284 unsigned char CR32;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
285 unsigned char CRT1Detected = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
286 unsigned char OtherDevices = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
287
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
288 if (!(sis_vbflags & VB_VIDEOBRIDGE)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
289 sis_crt1_off = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
290 return;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
291 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
292
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
293 inSISIDXREG(SISCR, 0x32, CR32);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
294
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
295 if (CR32 & 0x20)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
296 CRT1Detected = 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
297 if (CR32 & 0x5F)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
298 OtherDevices = 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
299
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
300 if (sis_crt1_off == -1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
301 if (!CRT1Detected) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
302 /* BIOS detected no CRT1. */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
303 /* If other devices exist, switch it off */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
304 if (OtherDevices)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
305 sis_crt1_off = 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
306 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
307 sis_crt1_off = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
308 } else {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
309 /* BIOS detected CRT1, leave/switch it on */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
310 sis_crt1_off = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
311 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
312 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
313 if (sis_verbose > 0) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
314 printf("[SiS] %sCRT1 connection detected\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
315 sis_crt1_off ? "No " : "");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
316 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
317 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
318
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
319 static void sis_detect_tv(void)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
320 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
321 unsigned char SR16, SR38, CR32, CR38 = 0, CR79;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
322 int temp = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
323
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
324 if (!(sis_vbflags & VB_VIDEOBRIDGE))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
325 return;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
326
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
327 inSISIDXREG(SISCR, 0x32, CR32);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
328 inSISIDXREG(SISSR, 0x16, SR16);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
329 inSISIDXREG(SISSR, 0x38, SR38);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
330 switch (sis_vga_engine) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
331 case SIS_300_VGA:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
332 if (sis_device_id == DEVICE_SIS_630_VGA)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
333 temp = 0x35;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
334 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
335 case SIS_315_VGA:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
336 temp = 0x38;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
337 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
338 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
339 if (temp) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
340 inSISIDXREG(SISCR, temp, CR38);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
341 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
342
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
343 if (CR32 & 0x47)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
344 sis_vbflags |= CRT2_TV;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
345
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
346 if (CR32 & 0x04)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
347 sis_vbflags |= TV_SCART;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
348 else if (CR32 & 0x02)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
349 sis_vbflags |= TV_SVIDEO;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
350 else if (CR32 & 0x01)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
351 sis_vbflags |= TV_AVIDEO;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
352 else if (CR32 & 0x40)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
353 sis_vbflags |= (TV_SVIDEO | TV_HIVISION);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
354 else if ((CR38 & 0x04) && (sis_vbflags & (VB_301LV | VB_302LV)))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
355 sis_vbflags |= TV_HIVISION_LV;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
356 else if ((CR38 & 0x04) && (sis_vbflags & VB_CHRONTEL))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
357 sis_vbflags |= (TV_CHSCART | TV_PAL);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
358 else if ((CR38 & 0x08) && (sis_vbflags & VB_CHRONTEL))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
359 sis_vbflags |= (TV_CHHDTV | TV_NTSC);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
360
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
361 if (sis_vbflags & (TV_SCART | TV_SVIDEO | TV_AVIDEO | TV_HIVISION)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
362 if (sis_vga_engine == SIS_300_VGA) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
363 /* TW: Should be SR38 here as well, but this
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
364 * does not work. Looks like a BIOS bug (2.04.5c).
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
365 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
366 if (SR16 & 0x20)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
367 sis_vbflags |= TV_PAL;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
368 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
369 sis_vbflags |= TV_NTSC;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
370 } else if ((sis_device_id == DEVICE_SIS_550_VGA)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
371 inSISIDXREG(SISCR, 0x79, CR79);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
372 if (CR79 & 0x08) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
373 inSISIDXREG(SISCR, 0x79, CR79);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
374 CR79 >>= 5;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
375 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
376 if (CR79 & 0x01) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
377 sis_vbflags |= TV_PAL;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
378 if (CR38 & 0x40)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
379 sis_vbflags |= TV_PALM;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
380 else if (CR38 & 0x80)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
381 sis_vbflags |= TV_PALN;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
382 } else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
383 sis_vbflags |= TV_NTSC;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
384 } else if ((sis_device_id == DEVICE_SIS_650_VGA)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
385 inSISIDXREG(SISCR, 0x79, CR79);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
386 if (CR79 & 0x20) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
387 sis_vbflags |= TV_PAL;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
388 if (CR38 & 0x40)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
389 sis_vbflags |= TV_PALM;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
390 else if (CR38 & 0x80)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
391 sis_vbflags |= TV_PALN;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
392 } else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
393 sis_vbflags |= TV_NTSC;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
394 } else { /* 315, 330 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
395 if (SR38 & 0x01) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
396 sis_vbflags |= TV_PAL;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
397 if (CR38 & 0x40)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
398 sis_vbflags |= TV_PALM;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
399 else if (CR38 & 0x80)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
400 sis_vbflags |= TV_PALN;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
401 } else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
402 sis_vbflags |= TV_NTSC;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
403 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
404 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
405
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
406 if (sis_vbflags &
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
407 (TV_SCART | TV_SVIDEO | TV_AVIDEO | TV_HIVISION | TV_CHSCART |
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
408 TV_CHHDTV)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
409 if (sis_verbose > 0) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
410 printf("[SiS] %sTV standard %s\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
411 (sis_vbflags & (TV_CHSCART | TV_CHHDTV)) ? "Using " :
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
412 "Detected default ",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
413 (sis_vbflags & TV_NTSC) ? ((sis_vbflags & TV_CHHDTV) ?
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
414 "480i HDTV" : "NTSC")
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
415 : ((sis_vbflags & TV_PALM) ? "PALM"
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
416 : ((sis_vbflags & TV_PALN) ? "PALN" : "PAL")));
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
417 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
418 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
419
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
420 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
421
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
422
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
423 static void sis_detect_crt2(void)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
424 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
425 unsigned char CR32;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
426
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
427 if (!(sis_vbflags & VB_VIDEOBRIDGE))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
428 return;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
429
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
430 /* CRT2-VGA not supported on LVDS and 30xLV */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
431 if (sis_vbflags & (VB_LVDS | VB_301LV | VB_302LV))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
432 return;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
433
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
434 inSISIDXREG(SISCR, 0x32, CR32);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
435
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
436 if (CR32 & 0x10)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
437 sis_vbflags |= CRT2_VGA;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
438 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
439
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
440
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
441 /* Preinit: detect video bridge and sense connected devs */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
442 static void sis_detect_video_bridge(void)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
443 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
444 int temp, temp1, temp2;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
445
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
446
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
447 sis_vbflags = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
448
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
449 if (sis_vga_engine != SIS_300_VGA && sis_vga_engine != SIS_315_VGA)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
450 return;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
451
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
452 inSISIDXREG(SISPART4, 0x00, temp);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
453 temp &= 0x0F;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
454 if (temp == 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
455 inSISIDXREG(SISPART4, 0x01, temp1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
456 temp1 &= 0xff;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
457 if (temp1 >= 0xE0) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
458 sis_vbflags |= VB_302LV;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
459 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_302LV;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
460 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
461 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
462 ("[SiS] Detected SiS302LV video bridge (ID 1; Revision 0x%x)\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
463 temp1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
464 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
465
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
466 } else if (temp1 >= 0xD0) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
467 sis_vbflags |= VB_301LV;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
468 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301LV;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
469 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
470 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
471 ("[SiS] Detected SiS301LV video bridge (ID 1; Revision 0x%x)\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
472 temp1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
473 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
474 } else if (temp1 >= 0xB0) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
475 sis_vbflags |= VB_301B;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
476 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301B;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
477 inSISIDXREG(SISPART4, 0x23, temp2);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
478 if (!(temp2 & 0x02))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
479 sis_vbflags |= VB_30xBDH;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
480 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
481 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
482 ("[SiS] Detected SiS301B%s video bridge (Revision 0x%x)\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
483 (temp2 & 0x02) ? "" : " (DH)", temp1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
484 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
485 } else {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
486 sis_vbflags |= VB_301;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
487 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
488 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
489 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
490 ("[SiS] Detected SiS301 video bridge (Revision 0x%x)\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
491 temp1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
492 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
493 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
494
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
495 sis_sense_30x();
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
496
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
497 } else if (temp == 2) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
498
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
499 inSISIDXREG(SISPART4, 0x01, temp1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
500 temp1 &= 0xff;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
501 if (temp1 >= 0xE0) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
502 sis_vbflags |= VB_302LV;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
503 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_302LV;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
504 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
505 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
506 ("[SiS] Detected SiS302LV video bridge (ID 2; Revision 0x%x)\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
507 temp1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
508 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
509 } else if (temp1 >= 0xD0) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
510 sis_vbflags |= VB_301LV;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
511 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301LV;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
512 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
513 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
514 ("[SiS] Detected SiS301LV video bridge (ID 2; Revision 0x%x)\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
515 temp1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
516 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
517 } else {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
518 sis_vbflags |= VB_302B;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
519 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_302B;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
520 inSISIDXREG(SISPART4, 0x23, temp2);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
521 if (!(temp & 0x02))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
522 sis_vbflags |= VB_30xBDH;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
523 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
524 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
525 ("[SiS] Detected SiS302B%s video bridge (Revision 0x%x)\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
526 (temp2 & 0x02) ? "" : " (DH)", temp1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
527 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
528 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
529
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
530 sis_sense_30x();
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
531
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
532 } else if (temp == 3) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
533 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
534 printf("[SiS] Detected SiS303 video bridge - not supported\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
535 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
536 } else {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
537 /* big scary mess of code to handle unknown or Chrontel LVDS */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
538 /* skipping it for now */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
539 if (sis_verbose > 1) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
540 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
541 ("[SiS] Detected Chrontel video bridge - not supported\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
542 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
543 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
544
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
545 /* this is probably not relevant to video overlay driver... */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
546 /* detects if brdige uses LCDA for low res text modes */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
547 if (sis_vga_engine == SIS_315_VGA) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
548 if (sis_vbflags & (VB_302B | VB_301LV | VB_302LV)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
549 inSISIDXREG(SISCR, 0x34, temp);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
550 if (temp <= 0x13) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
551 inSISIDXREG(SISCR, 0x38, temp);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
552 if ((temp & 0x03) == 0x03) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
553 //pSiS->SiS_Pr->SiS_UseLCDA = TRUE;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
554 sis_vbflags |= VB_USELCDA;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
555 } else {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
556 inSISIDXREG(SISCR, 0x30, temp);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
557 if (temp & 0x20) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
558 inSISIDXREG(SISPART1, 0x13, temp);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
559 if (temp & 0x40) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
560 //pSiS->SiS_Pr->SiS_UseLCDA = TRUE;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
561 sis_vbflags |= VB_USELCDA;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
562 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
563 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
564 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
565 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
566 if (sis_vbflags & VB_USELCDA) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
567 /* printf("Bridge uses LCDA for low resolution and text modes\n"); */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
568 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
569 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
570 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
571
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
572
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
573 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
574
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
575
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
576 /* detect video bridge type and sense connected devices */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
577 void sis_init_video_bridge(void)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
578 {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
579
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
580 sis_detect_video_bridge();
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
581
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
582 sis_detect_crt1();
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
583 //sis_detect_lcd();
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
584 sis_detect_tv();
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
585 sis_detect_crt2();
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
586
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
587 sis_detected_crt2_devices =
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
588 sis_vbflags & (CRT2_LCD | CRT2_TV | CRT2_VGA);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
589
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
590 // force crt2 type
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
591 if (sis_force_crt2_type == CRT2_DEFAULT) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
592 if (sis_vbflags & CRT2_VGA)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
593 sis_force_crt2_type = CRT2_VGA;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
594 else if (sis_vbflags & CRT2_LCD)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
595 sis_force_crt2_type = CRT2_LCD;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
596 else if (sis_vbflags & CRT2_TV)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
597 sis_force_crt2_type = CRT2_TV;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
598 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
599
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
600 switch (sis_force_crt2_type) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
601 case CRT2_TV:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
602 sis_vbflags = sis_vbflags & ~(CRT2_LCD | CRT2_VGA);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
603 if (sis_vbflags & VB_VIDEOBRIDGE)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
604 sis_vbflags = sis_vbflags | CRT2_TV;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
605 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
606 sis_vbflags = sis_vbflags & ~(CRT2_TV);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
607 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
608 case CRT2_LCD:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
609 sis_vbflags = sis_vbflags & ~(CRT2_TV | CRT2_VGA);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
610 if ((sis_vbflags & VB_VIDEOBRIDGE) /* XXX: && (pSiS->VBLCDFlags) */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
611 )
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
612 sis_vbflags = sis_vbflags | CRT2_LCD;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
613 else {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
614 sis_vbflags = sis_vbflags & ~(CRT2_LCD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
615 if (sis_verbose > 0) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
616 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
617 ("[SiS] Can't force CRT2 to LCD, no panel detected\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
618 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
619 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
620 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
621 case CRT2_VGA:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
622 if (sis_vbflags & VB_LVDS) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
623 if (sis_verbose > 0) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
624 printf("[SiS] LVDS does not support secondary VGA\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
625 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
626 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
627 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
628 if (sis_vbflags & (VB_301LV | VB_302LV)) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
629 if (sis_verbose > 0) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
630 printf
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
631 ("[SiS] SiS30xLV bridge does not support secondary VGA\n");
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
632 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
633 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
634 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
635 sis_vbflags = sis_vbflags & ~(CRT2_TV | CRT2_LCD);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
636 if (sis_vbflags & VB_VIDEOBRIDGE)
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
637 sis_vbflags = sis_vbflags | CRT2_VGA;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
638 else
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
639 sis_vbflags = sis_vbflags & ~(CRT2_VGA);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
640 break;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
641 default:
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
642 sis_vbflags &= ~(CRT2_TV | CRT2_LCD | CRT2_VGA);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
643 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
644
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
645 /* CRT2 gamma correction?? */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
646
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
647 /* other force modes: */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
648 /* have a 'force tv type' (svideo, composite, scart) option? */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
649 /* have a 'force crt1 type' (to turn it off, etc??) */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
650
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
651 /* TW: Check if CRT1 used (or needed; this eg. if no CRT2 detected) */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
652 if (sis_vbflags & VB_VIDEOBRIDGE) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
653
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
654 /* TW: No CRT2 output? Then we NEED CRT1!
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
655 * We also need CRT1 if depth = 8 and bridge=LVDS|630+301B
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
656 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
657 if ((!(sis_vbflags & (CRT2_VGA | CRT2_LCD | CRT2_TV))) || ( /*(pScrn->bitsPerPixel == 8) && */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
658 ((sis_vbflags & (VB_LVDS | VB_CHRONTEL)) || ((sis_vga_engine == SIS_300_VGA) && (sis_vbflags & VB_301B))))) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
659 sis_crt1_off = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
660 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
661 /* TW: No CRT2 output? Then we can't use hw overlay on CRT2 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
662 if (!(sis_vbflags & (CRT2_VGA | CRT2_LCD | CRT2_TV)))
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
663 sis_overlay_on_crt1 = 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
664
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
665 } else { /* TW: no video bridge? */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
666
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
667 /* Then we NEED CRT1... */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
668 sis_crt1_off = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
669 /* ... and can't use CRT2 for overlay output */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
670 sis_overlay_on_crt1 = 1;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
671 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
672
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
673 /* tvstandard options ? */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
674
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
675 // determine using CRT1 or CRT2?
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
676 /* -> NO dualhead right now... */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
677 if (sis_vbflags & DISPTYPE_DISP2) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
678 if (sis_crt1_off) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
679 sis_vbflags |= VB_DISPMODE_SINGLE;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
680 /* TW: No CRT1? Then we use the video overlay on CRT2 */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
681 sis_overlay_on_crt1 = 0;
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
682 } else /* TW: CRT1 and CRT2 - mirror or dual head ----- */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
683 sis_vbflags |= (VB_DISPMODE_MIRROR | DISPTYPE_CRT1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
684 } else { /* TW: CRT1 only ------------------------------- */
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
685 sis_vbflags |= (VB_DISPMODE_SINGLE | DISPTYPE_CRT1);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
686 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
687
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
688 if (sis_verbose > 0) {
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
689 printf("[SiS] Using hardware overlay on CRT%d\n",
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
690 sis_overlay_on_crt1 ? 1 : 2);
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
691 }
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
692
9a1e26fef45b Move driver files directly into the vidix directory.
diego
parents:
diff changeset
693 }