vo_corevideo: Make the Quit menu entry work
[mplayer/glamo.git] / vidix / sis_bridge.c
blob265bce5fd37b3a6cccb0ce1689cb33a09e3b36d1
1 /*
2 * VIDIX driver for SiS chipsets.
3 * Video bridge detection for SiS 300 and 310/325 series.
5 * Copyright (C) 2003 Jake Page, Sugar Media
6 * Based on SiS Xv driver
7 * Copyright 2002-2003 by Thomas Winischhofer, Vienna, Austria
9 * This file is part of MPlayer.
11 * MPlayer is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * MPlayer is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <unistd.h>
30 #include "dha.h"
31 #include "sis_bridge.h"
32 #include "sis_regs.h"
33 #include "sis_defs.h"
36 static void sis_ddc2_delay(unsigned short delaytime)
38 unsigned short i;
39 int temp;
41 for (i = 0; i < delaytime; i++) {
42 inSISIDXREG(SISSR, 0x05, temp);
47 static int sis_do_sense(int tempbl, int tempbh, int tempcl, int tempch)
49 int temp;
51 outSISIDXREG(SISPART4, 0x11, tempbl);
52 temp = tempbh | tempcl;
53 setSISIDXREG(SISPART4, 0x10, 0xe0, temp);
54 //usleep(200000);
55 sis_ddc2_delay(0x1000);
56 tempch &= 0x7f;
57 inSISIDXREG(SISPART4, 0x03, temp);
58 temp ^= 0x0e;
59 temp &= tempch;
60 return temp == tempch;
64 /* sense connected devices on 30x bridge */
65 static void sis_sense_30x(void)
67 unsigned char backupP4_0d, backupP2_00, biosflag;
68 unsigned char testsvhs_tempbl, testsvhs_tempbh;
69 unsigned char testsvhs_tempcl, testsvhs_tempch;
70 unsigned char testcvbs_tempbl, testcvbs_tempbh;
71 unsigned char testcvbs_tempcl, testcvbs_tempch;
72 unsigned char testvga2_tempbl, testvga2_tempbh;
73 unsigned char testvga2_tempcl, testvga2_tempch;
74 int myflag, result = 0, i, j, haveresult;
76 inSISIDXREG(SISPART4, 0x0d, backupP4_0d);
77 outSISIDXREG(SISPART4, 0x0d, (backupP4_0d | 0x04));
79 inSISIDXREG(SISPART2, 0x00, backupP2_00);
80 outSISIDXREG(SISPART2, 0x00, (backupP2_00 | 0x1c));
82 sis_do_sense(0, 0, 0, 0);
84 if (sis_vga_engine == SIS_300_VGA) {
85 testvga2_tempbh = 0x00;
86 testvga2_tempbl = 0xd1;
87 testsvhs_tempbh = 0x00;
88 testsvhs_tempbl = 0xb9;
89 testcvbs_tempbh = 0x00;
90 testcvbs_tempbl = 0xb3;
91 biosflag = 0;
93 if (sis_vbflags & (VB_301B | VB_302B | VB_301LV | VB_302LV)) {
94 testvga2_tempbh = 0x01;
95 testvga2_tempbl = 0x90;
96 testsvhs_tempbh = 0x01;
97 testsvhs_tempbl = 0x6b;
98 testcvbs_tempbh = 0x01;
99 testcvbs_tempbl = 0x74;
101 inSISIDXREG(SISPART4, 0x01, myflag);
102 if (myflag & 0x04) {
103 testvga2_tempbh = 0x00;
104 testvga2_tempbl = 0xfd;
105 testsvhs_tempbh = 0x00;
106 testsvhs_tempbl = 0xdd;
107 testcvbs_tempbh = 0x00;
108 testcvbs_tempbl = 0xee;
110 testvga2_tempch = 0x0e;
111 testvga2_tempcl = 0x08;
112 testsvhs_tempch = 0x06;
113 testsvhs_tempcl = 0x04;
114 testcvbs_tempch = 0x08;
115 testcvbs_tempcl = 0x04;
117 if (sis_device_id == DEVICE_SIS_300) {
118 inSISIDXREG(SISSR, 0x3b, myflag);
119 if (!(myflag & 0x01)) {
120 testvga2_tempbh = 0x00;
121 testvga2_tempbl = 0x00;
122 testvga2_tempch = 0x00;
123 testvga2_tempcl = 0x00;
126 } else {
127 testvga2_tempbh = 0x00;
128 testvga2_tempbl = 0xd1;
129 testsvhs_tempbh = 0x00;
130 testsvhs_tempbl = 0xb9;
131 testcvbs_tempbh = 0x00;
132 testcvbs_tempbl = 0xb3;
133 biosflag = 0;
135 if (sis_vbflags & (VB_301B | VB_302B | VB_301LV | VB_302LV)) {
136 if (sis_vbflags & (VB_301B | VB_302B)) {
137 testvga2_tempbh = 0x01;
138 testvga2_tempbl = 0x90;
139 testsvhs_tempbh = 0x01;
140 testsvhs_tempbl = 0x6b;
141 testcvbs_tempbh = 0x01;
142 testcvbs_tempbl = 0x74;
143 } else {
144 testvga2_tempbh = 0x00;
145 testvga2_tempbl = 0x00;
146 testsvhs_tempbh = 0x02;
147 testsvhs_tempbl = 0x00;
148 testcvbs_tempbh = 0x01;
149 testcvbs_tempbl = 0x00;
152 if (sis_vbflags & (VB_301 | VB_301B | VB_302B)) {
153 inSISIDXREG(SISPART4, 0x01, myflag);
154 if (myflag & 0x04) {
155 testvga2_tempbh = 0x00;
156 testvga2_tempbl = 0xfd;
157 testsvhs_tempbh = 0x00;
158 testsvhs_tempbl = 0xdd;
159 testcvbs_tempbh = 0x00;
160 testcvbs_tempbl = 0xee;
163 if (sis_vbflags & (VB_301LV | VB_302LV)) {
164 /* TW: No VGA2 or SCART on LV bridges */
165 testvga2_tempbh = 0x00;
166 testvga2_tempbl = 0x00;
167 testvga2_tempch = 0x00;
168 testvga2_tempcl = 0x00;
169 testsvhs_tempch = 0x04;
170 testsvhs_tempcl = 0x08;
171 testcvbs_tempch = 0x08;
172 testcvbs_tempcl = 0x08;
173 } else {
174 testvga2_tempch = 0x0e;
175 testvga2_tempcl = 0x08;
176 testsvhs_tempch = 0x06;
177 testsvhs_tempcl = 0x04;
178 testcvbs_tempch = 0x08;
179 testcvbs_tempcl = 0x04;
183 /* XXX: ?? andSISIDXREG(SISCR, 0x32, ~0x14); */
184 /* pSiS->postVBCR32 &= ~0x14; */
186 /* scan for VGA2/SCART */
187 if (testvga2_tempch || testvga2_tempcl ||
188 testvga2_tempbh || testvga2_tempbl) {
190 haveresult = 0;
191 for (j = 0; j < 10; j++) {
192 result = 0;
193 for (i = 0; i < 3; i++) {
194 if (sis_do_sense(testvga2_tempbl, testvga2_tempbh,
195 testvga2_tempcl, testvga2_tempch))
196 result++;
198 if ((result == 0) || (result >= 2))
199 break;
201 if (result) {
202 if (biosflag & 0x01) {
203 if (sis_verbose > 1) {
204 printf
205 ("[SiS] SiS30x: Detected TV connected to SCART output\n");
207 sis_vbflags |= TV_SCART;
208 orSISIDXREG(SISCR, 0x32, 0x04);
209 /*pSiS->postVBCR32 |= 0x04; */
210 } else {
211 if (sis_verbose > 1) {
212 printf
213 ("[SiS] SiS30x: Detected secondary VGA connection\n");
215 sis_vbflags |= VGA2_CONNECTED;
216 orSISIDXREG(SISCR, 0x32, 0x10);
217 /*pSiS->postVBCR32 |= 0x10; */
222 /* scanning for TV */
224 /* XXX: ?? andSISIDXREG(SISCR, 0x32, ~0x03); */
225 /* pSiS->postVBCR32 &= ~0x03; */
227 result = sis_do_sense(testsvhs_tempbl, testsvhs_tempbh,
228 testsvhs_tempcl, testsvhs_tempch);
231 haveresult = 0;
232 for (j = 0; j < 10; j++) {
233 result = 0;
234 for (i = 0; i < 3; i++) {
235 if (sis_do_sense(testsvhs_tempbl, testsvhs_tempbh,
236 testsvhs_tempcl, testsvhs_tempch))
237 result++;
239 if ((result == 0) || (result >= 2))
240 break;
242 if (result) {
243 if (sis_verbose > 1) {
244 printf
245 ("[SiS] SiS30x: Detected TV connected to SVIDEO output\n");
247 /* TW: So we can be sure that there IS a SVIDEO output */
248 sis_vbflags |= TV_SVIDEO;
249 orSISIDXREG(SISCR, 0x32, 0x02);
250 //pSiS->postVBCR32 |= 0x02;
253 if ((biosflag & 0x02) || (!(result))) {
254 haveresult = 0;
255 for (j = 0; j < 10; j++) {
256 result = 0;
257 for (i = 0; i < 3; i++) {
258 if (sis_do_sense(testcvbs_tempbl, testcvbs_tempbh,
259 testcvbs_tempcl, testcvbs_tempch))
260 result++;
262 if ((result == 0) || (result >= 2))
263 break;
265 if (result) {
266 if (sis_verbose > 1) {
267 printf
268 ("[SiS] SiS30x: Detected TV connected to COMPOSITE output\n");
270 sis_vbflags |= TV_AVIDEO;
271 orSISIDXREG(SISCR, 0x32, 0x01);
272 //pSiS->postVBCR32 |= 0x01;
276 sis_do_sense(0, 0, 0, 0);
278 outSISIDXREG(SISPART2, 0x00, backupP2_00);
279 outSISIDXREG(SISPART4, 0x0d, backupP4_0d);
283 static void sis_detect_crt1(void)
285 unsigned char CR32;
286 unsigned char CRT1Detected = 0;
287 unsigned char OtherDevices = 0;
289 if (!(sis_vbflags & VB_VIDEOBRIDGE)) {
290 sis_crt1_off = 0;
291 return;
294 inSISIDXREG(SISCR, 0x32, CR32);
296 if (CR32 & 0x20)
297 CRT1Detected = 1;
298 if (CR32 & 0x5F)
299 OtherDevices = 1;
301 if (sis_crt1_off == -1) {
302 if (!CRT1Detected) {
303 /* BIOS detected no CRT1. */
304 /* If other devices exist, switch it off */
305 if (OtherDevices)
306 sis_crt1_off = 1;
307 else
308 sis_crt1_off = 0;
309 } else {
310 /* BIOS detected CRT1, leave/switch it on */
311 sis_crt1_off = 0;
314 if (sis_verbose > 0) {
315 printf("[SiS] %sCRT1 connection detected\n",
316 sis_crt1_off ? "No " : "");
320 static void sis_detect_tv(void)
322 unsigned char SR16, SR38, CR32, CR38 = 0, CR79;
323 int temp = 0;
325 if (!(sis_vbflags & VB_VIDEOBRIDGE))
326 return;
328 inSISIDXREG(SISCR, 0x32, CR32);
329 inSISIDXREG(SISSR, 0x16, SR16);
330 inSISIDXREG(SISSR, 0x38, SR38);
331 switch (sis_vga_engine) {
332 case SIS_300_VGA:
333 if (sis_device_id == DEVICE_SIS_630_VGA)
334 temp = 0x35;
335 break;
336 case SIS_315_VGA:
337 temp = 0x38;
338 break;
340 if (temp) {
341 inSISIDXREG(SISCR, temp, CR38);
344 if (CR32 & 0x47)
345 sis_vbflags |= CRT2_TV;
347 if (CR32 & 0x04)
348 sis_vbflags |= TV_SCART;
349 else if (CR32 & 0x02)
350 sis_vbflags |= TV_SVIDEO;
351 else if (CR32 & 0x01)
352 sis_vbflags |= TV_AVIDEO;
353 else if (CR32 & 0x40)
354 sis_vbflags |= (TV_SVIDEO | TV_HIVISION);
355 else if ((CR38 & 0x04) && (sis_vbflags & (VB_301LV | VB_302LV)))
356 sis_vbflags |= TV_HIVISION_LV;
357 else if ((CR38 & 0x04) && (sis_vbflags & VB_CHRONTEL))
358 sis_vbflags |= (TV_CHSCART | TV_PAL);
359 else if ((CR38 & 0x08) && (sis_vbflags & VB_CHRONTEL))
360 sis_vbflags |= (TV_CHHDTV | TV_NTSC);
362 if (sis_vbflags & (TV_SCART | TV_SVIDEO | TV_AVIDEO | TV_HIVISION)) {
363 if (sis_vga_engine == SIS_300_VGA) {
364 /* TW: Should be SR38 here as well, but this
365 * does not work. Looks like a BIOS bug (2.04.5c).
367 if (SR16 & 0x20)
368 sis_vbflags |= TV_PAL;
369 else
370 sis_vbflags |= TV_NTSC;
371 } else if ((sis_device_id == DEVICE_SIS_550_VGA)) {
372 inSISIDXREG(SISCR, 0x79, CR79);
373 if (CR79 & 0x08) {
374 inSISIDXREG(SISCR, 0x79, CR79);
375 CR79 >>= 5;
377 if (CR79 & 0x01) {
378 sis_vbflags |= TV_PAL;
379 if (CR38 & 0x40)
380 sis_vbflags |= TV_PALM;
381 else if (CR38 & 0x80)
382 sis_vbflags |= TV_PALN;
383 } else
384 sis_vbflags |= TV_NTSC;
385 } else if ((sis_device_id == DEVICE_SIS_650_VGA)) {
386 inSISIDXREG(SISCR, 0x79, CR79);
387 if (CR79 & 0x20) {
388 sis_vbflags |= TV_PAL;
389 if (CR38 & 0x40)
390 sis_vbflags |= TV_PALM;
391 else if (CR38 & 0x80)
392 sis_vbflags |= TV_PALN;
393 } else
394 sis_vbflags |= TV_NTSC;
395 } else { /* 315, 330 */
396 if (SR38 & 0x01) {
397 sis_vbflags |= TV_PAL;
398 if (CR38 & 0x40)
399 sis_vbflags |= TV_PALM;
400 else if (CR38 & 0x80)
401 sis_vbflags |= TV_PALN;
402 } else
403 sis_vbflags |= TV_NTSC;
407 if (sis_vbflags &
408 (TV_SCART | TV_SVIDEO | TV_AVIDEO | TV_HIVISION | TV_CHSCART |
409 TV_CHHDTV)) {
410 if (sis_verbose > 0) {
411 printf("[SiS] %sTV standard %s\n",
412 (sis_vbflags & (TV_CHSCART | TV_CHHDTV)) ? "Using " :
413 "Detected default ",
414 (sis_vbflags & TV_NTSC) ? ((sis_vbflags & TV_CHHDTV) ?
415 "480i HDTV" : "NTSC")
416 : ((sis_vbflags & TV_PALM) ? "PALM"
417 : ((sis_vbflags & TV_PALN) ? "PALN" : "PAL")));
424 static void sis_detect_crt2(void)
426 unsigned char CR32;
428 if (!(sis_vbflags & VB_VIDEOBRIDGE))
429 return;
431 /* CRT2-VGA not supported on LVDS and 30xLV */
432 if (sis_vbflags & (VB_LVDS | VB_301LV | VB_302LV))
433 return;
435 inSISIDXREG(SISCR, 0x32, CR32);
437 if (CR32 & 0x10)
438 sis_vbflags |= CRT2_VGA;
442 /* Preinit: detect video bridge and sense connected devs */
443 static void sis_detect_video_bridge(void)
445 int temp, temp1, temp2;
448 sis_vbflags = 0;
450 if (sis_vga_engine != SIS_300_VGA && sis_vga_engine != SIS_315_VGA)
451 return;
453 inSISIDXREG(SISPART4, 0x00, temp);
454 temp &= 0x0F;
455 if (temp == 1) {
456 inSISIDXREG(SISPART4, 0x01, temp1);
457 temp1 &= 0xff;
458 if (temp1 >= 0xE0) {
459 sis_vbflags |= VB_302LV;
460 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_302LV;
461 if (sis_verbose > 1) {
462 printf
463 ("[SiS] Detected SiS302LV video bridge (ID 1; Revision 0x%x)\n",
464 temp1);
467 } else if (temp1 >= 0xD0) {
468 sis_vbflags |= VB_301LV;
469 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301LV;
470 if (sis_verbose > 1) {
471 printf
472 ("[SiS] Detected SiS301LV video bridge (ID 1; Revision 0x%x)\n",
473 temp1);
475 } else if (temp1 >= 0xB0) {
476 sis_vbflags |= VB_301B;
477 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301B;
478 inSISIDXREG(SISPART4, 0x23, temp2);
479 if (!(temp2 & 0x02))
480 sis_vbflags |= VB_30xBDH;
481 if (sis_verbose > 1) {
482 printf
483 ("[SiS] Detected SiS301B%s video bridge (Revision 0x%x)\n",
484 (temp2 & 0x02) ? "" : " (DH)", temp1);
486 } else {
487 sis_vbflags |= VB_301;
488 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301;
489 if (sis_verbose > 1) {
490 printf
491 ("[SiS] Detected SiS301 video bridge (Revision 0x%x)\n",
492 temp1);
496 sis_sense_30x();
498 } else if (temp == 2) {
500 inSISIDXREG(SISPART4, 0x01, temp1);
501 temp1 &= 0xff;
502 if (temp1 >= 0xE0) {
503 sis_vbflags |= VB_302LV;
504 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_302LV;
505 if (sis_verbose > 1) {
506 printf
507 ("[SiS] Detected SiS302LV video bridge (ID 2; Revision 0x%x)\n",
508 temp1);
510 } else if (temp1 >= 0xD0) {
511 sis_vbflags |= VB_301LV;
512 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301LV;
513 if (sis_verbose > 1) {
514 printf
515 ("[SiS] Detected SiS301LV video bridge (ID 2; Revision 0x%x)\n",
516 temp1);
518 } else {
519 sis_vbflags |= VB_302B;
520 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_302B;
521 inSISIDXREG(SISPART4, 0x23, temp2);
522 if (!(temp & 0x02))
523 sis_vbflags |= VB_30xBDH;
524 if (sis_verbose > 1) {
525 printf
526 ("[SiS] Detected SiS302B%s video bridge (Revision 0x%x)\n",
527 (temp2 & 0x02) ? "" : " (DH)", temp1);
531 sis_sense_30x();
533 } else if (temp == 3) {
534 if (sis_verbose > 1) {
535 printf("[SiS] Detected SiS303 video bridge - not supported\n");
537 } else {
538 /* big scary mess of code to handle unknown or Chrontel LVDS */
539 /* skipping it for now */
540 if (sis_verbose > 1) {
541 printf
542 ("[SiS] Detected Chrontel video bridge - not supported\n");
546 /* this is probably not relevant to video overlay driver... */
547 /* detects if brdige uses LCDA for low res text modes */
548 if (sis_vga_engine == SIS_315_VGA) {
549 if (sis_vbflags & (VB_302B | VB_301LV | VB_302LV)) {
550 inSISIDXREG(SISCR, 0x34, temp);
551 if (temp <= 0x13) {
552 inSISIDXREG(SISCR, 0x38, temp);
553 if ((temp & 0x03) == 0x03) {
554 //pSiS->SiS_Pr->SiS_UseLCDA = TRUE;
555 sis_vbflags |= VB_USELCDA;
556 } else {
557 inSISIDXREG(SISCR, 0x30, temp);
558 if (temp & 0x20) {
559 inSISIDXREG(SISPART1, 0x13, temp);
560 if (temp & 0x40) {
561 //pSiS->SiS_Pr->SiS_UseLCDA = TRUE;
562 sis_vbflags |= VB_USELCDA;
567 if (sis_vbflags & VB_USELCDA) {
568 /* printf("Bridge uses LCDA for low resolution and text modes\n"); */
577 /* detect video bridge type and sense connected devices */
578 void sis_init_video_bridge(void)
581 sis_detect_video_bridge();
583 sis_detect_crt1();
584 //sis_detect_lcd();
585 sis_detect_tv();
586 sis_detect_crt2();
588 sis_detected_crt2_devices =
589 sis_vbflags & (CRT2_LCD | CRT2_TV | CRT2_VGA);
591 // force crt2 type
592 if (sis_force_crt2_type == CRT2_DEFAULT) {
593 if (sis_vbflags & CRT2_VGA)
594 sis_force_crt2_type = CRT2_VGA;
595 else if (sis_vbflags & CRT2_LCD)
596 sis_force_crt2_type = CRT2_LCD;
597 else if (sis_vbflags & CRT2_TV)
598 sis_force_crt2_type = CRT2_TV;
601 switch (sis_force_crt2_type) {
602 case CRT2_TV:
603 sis_vbflags = sis_vbflags & ~(CRT2_LCD | CRT2_VGA);
604 if (sis_vbflags & VB_VIDEOBRIDGE)
605 sis_vbflags = sis_vbflags | CRT2_TV;
606 else
607 sis_vbflags = sis_vbflags & ~(CRT2_TV);
608 break;
609 case CRT2_LCD:
610 sis_vbflags = sis_vbflags & ~(CRT2_TV | CRT2_VGA);
611 if ((sis_vbflags & VB_VIDEOBRIDGE) /* XXX: && (pSiS->VBLCDFlags) */
613 sis_vbflags = sis_vbflags | CRT2_LCD;
614 else {
615 sis_vbflags = sis_vbflags & ~(CRT2_LCD);
616 if (sis_verbose > 0) {
617 printf
618 ("[SiS] Can't force CRT2 to LCD, no panel detected\n");
621 break;
622 case CRT2_VGA:
623 if (sis_vbflags & VB_LVDS) {
624 if (sis_verbose > 0) {
625 printf("[SiS] LVDS does not support secondary VGA\n");
627 break;
629 if (sis_vbflags & (VB_301LV | VB_302LV)) {
630 if (sis_verbose > 0) {
631 printf
632 ("[SiS] SiS30xLV bridge does not support secondary VGA\n");
634 break;
636 sis_vbflags = sis_vbflags & ~(CRT2_TV | CRT2_LCD);
637 if (sis_vbflags & VB_VIDEOBRIDGE)
638 sis_vbflags = sis_vbflags | CRT2_VGA;
639 else
640 sis_vbflags = sis_vbflags & ~(CRT2_VGA);
641 break;
642 default:
643 sis_vbflags &= ~(CRT2_TV | CRT2_LCD | CRT2_VGA);
646 /* CRT2 gamma correction?? */
648 /* other force modes: */
649 /* have a 'force tv type' (svideo, composite, scart) option? */
650 /* have a 'force crt1 type' (to turn it off, etc??) */
652 /* TW: Check if CRT1 used (or needed; this eg. if no CRT2 detected) */
653 if (sis_vbflags & VB_VIDEOBRIDGE) {
655 /* TW: No CRT2 output? Then we NEED CRT1!
656 * We also need CRT1 if depth = 8 and bridge=LVDS|630+301B
658 if ((!(sis_vbflags & (CRT2_VGA | CRT2_LCD | CRT2_TV))) || ( /*(pScrn->bitsPerPixel == 8) && */
659 ((sis_vbflags & (VB_LVDS | VB_CHRONTEL)) || ((sis_vga_engine == SIS_300_VGA) && (sis_vbflags & VB_301B))))) {
660 sis_crt1_off = 0;
662 /* TW: No CRT2 output? Then we can't use hw overlay on CRT2 */
663 if (!(sis_vbflags & (CRT2_VGA | CRT2_LCD | CRT2_TV)))
664 sis_overlay_on_crt1 = 1;
666 } else { /* TW: no video bridge? */
668 /* Then we NEED CRT1... */
669 sis_crt1_off = 0;
670 /* ... and can't use CRT2 for overlay output */
671 sis_overlay_on_crt1 = 1;
674 /* tvstandard options ? */
676 // determine using CRT1 or CRT2?
677 /* -> NO dualhead right now... */
678 if (sis_vbflags & DISPTYPE_DISP2) {
679 if (sis_crt1_off) {
680 sis_vbflags |= VB_DISPMODE_SINGLE;
681 /* TW: No CRT1? Then we use the video overlay on CRT2 */
682 sis_overlay_on_crt1 = 0;
683 } else /* TW: CRT1 and CRT2 - mirror or dual head ----- */
684 sis_vbflags |= (VB_DISPMODE_MIRROR | DISPTYPE_CRT1);
685 } else { /* TW: CRT1 only ------------------------------- */
686 sis_vbflags |= (VB_DISPMODE_SINGLE | DISPTYPE_CRT1);
689 if (sis_verbose > 0) {
690 printf("[SiS] Using hardware overlay on CRT%d\n",
691 sis_overlay_on_crt1 ? 1 : 2);