comparison vidix/sis_bridge.c @ 37107:3c5c93a30fb7

vidix: Replace printf with mp_msg - Make MPlayer more quiet when requested (e.g. when using -really-quiet) - Additionally change some minor capitalization and "bla:" to "[bla]" Patch-by: Arne Bochem >arneb.mp ccan de< Patch-also-OKed-by: Reimar
author al
date Sat, 17 May 2014 01:38:00 +0000
parents 36818ea5ce95
children
comparison
equal deleted inserted replaced
37106:1b9907dfe2f4 37107:3c5c93a30fb7
29 29
30 #include "dha.h" 30 #include "dha.h"
31 #include "sis_bridge.h" 31 #include "sis_bridge.h"
32 #include "sis_regs.h" 32 #include "sis_regs.h"
33 #include "sis_defs.h" 33 #include "sis_defs.h"
34 #include "mp_msg.h"
34 35
35 36
36 static void sis_ddc2_delay(unsigned short delaytime) 37 static void sis_ddc2_delay(unsigned short delaytime)
37 { 38 {
38 unsigned short i; 39 unsigned short i;
199 break; 200 break;
200 } 201 }
201 if (result) { 202 if (result) {
202 if (biosflag & 0x01) { 203 if (biosflag & 0x01) {
203 if (sis_verbose > 1) { 204 if (sis_verbose > 1) {
204 printf 205 mp_msg(MSGT_VO, MSGL_STATUS,
205 ("[SiS] SiS30x: Detected TV connected to SCART output\n"); 206 "[SiS] SiS30x: Detected TV connected to SCART output\n");
206 } 207 }
207 sis_vbflags |= TV_SCART; 208 sis_vbflags |= TV_SCART;
208 orSISIDXREG(SISCR, 0x32, 0x04); 209 orSISIDXREG(SISCR, 0x32, 0x04);
209 /*pSiS->postVBCR32 |= 0x04; */ 210 /*pSiS->postVBCR32 |= 0x04; */
210 } else { 211 } else {
211 if (sis_verbose > 1) { 212 if (sis_verbose > 1) {
212 printf 213 mp_msg(MSGT_VO, MSGL_STATUS,
213 ("[SiS] SiS30x: Detected secondary VGA connection\n"); 214 "[SiS] SiS30x: Detected secondary VGA connection\n");
214 } 215 }
215 sis_vbflags |= VGA2_CONNECTED; 216 sis_vbflags |= VGA2_CONNECTED;
216 orSISIDXREG(SISCR, 0x32, 0x10); 217 orSISIDXREG(SISCR, 0x32, 0x10);
217 /*pSiS->postVBCR32 |= 0x10; */ 218 /*pSiS->postVBCR32 |= 0x10; */
218 } 219 }
239 if ((result == 0) || (result >= 2)) 240 if ((result == 0) || (result >= 2))
240 break; 241 break;
241 } 242 }
242 if (result) { 243 if (result) {
243 if (sis_verbose > 1) { 244 if (sis_verbose > 1) {
244 printf 245 mp_msg(MSGT_VO, MSGL_STATUS,
245 ("[SiS] SiS30x: Detected TV connected to SVIDEO output\n"); 246 "[SiS] SiS30x: Detected TV connected to SVIDEO output\n");
246 } 247 }
247 /* TW: So we can be sure that there IS a SVIDEO output */ 248 /* TW: So we can be sure that there IS a SVIDEO output */
248 sis_vbflags |= TV_SVIDEO; 249 sis_vbflags |= TV_SVIDEO;
249 orSISIDXREG(SISCR, 0x32, 0x02); 250 orSISIDXREG(SISCR, 0x32, 0x02);
250 //pSiS->postVBCR32 |= 0x02; 251 //pSiS->postVBCR32 |= 0x02;
262 if ((result == 0) || (result >= 2)) 263 if ((result == 0) || (result >= 2))
263 break; 264 break;
264 } 265 }
265 if (result) { 266 if (result) {
266 if (sis_verbose > 1) { 267 if (sis_verbose > 1) {
267 printf 268 mp_msg(MSGT_VO, MSGL_STATUS,
268 ("[SiS] SiS30x: Detected TV connected to COMPOSITE output\n"); 269 "[SiS] SiS30x: Detected TV connected to COMPOSITE output\n");
269 } 270 }
270 sis_vbflags |= TV_AVIDEO; 271 sis_vbflags |= TV_AVIDEO;
271 orSISIDXREG(SISCR, 0x32, 0x01); 272 orSISIDXREG(SISCR, 0x32, 0x01);
272 //pSiS->postVBCR32 |= 0x01; 273 //pSiS->postVBCR32 |= 0x01;
273 } 274 }
310 /* BIOS detected CRT1, leave/switch it on */ 311 /* BIOS detected CRT1, leave/switch it on */
311 sis_crt1_off = 0; 312 sis_crt1_off = 0;
312 } 313 }
313 } 314 }
314 if (sis_verbose > 0) { 315 if (sis_verbose > 0) {
315 printf("[SiS] %sCRT1 connection detected\n", 316 mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] %sCRT1 connection detected\n",
316 sis_crt1_off ? "No " : ""); 317 sis_crt1_off ? "No " : "");
317 } 318 }
318 } 319 }
319 320
320 static void sis_detect_tv(void) 321 static void sis_detect_tv(void)
406 407
407 if (sis_vbflags & 408 if (sis_vbflags &
408 (TV_SCART | TV_SVIDEO | TV_AVIDEO | TV_HIVISION | TV_CHSCART | 409 (TV_SCART | TV_SVIDEO | TV_AVIDEO | TV_HIVISION | TV_CHSCART |
409 TV_CHHDTV)) { 410 TV_CHHDTV)) {
410 if (sis_verbose > 0) { 411 if (sis_verbose > 0) {
411 printf("[SiS] %sTV standard %s\n", 412 mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] %sTV standard %s\n",
412 (sis_vbflags & (TV_CHSCART | TV_CHHDTV)) ? "Using " : 413 (sis_vbflags & (TV_CHSCART | TV_CHHDTV)) ? "Using " :
413 "Detected default ", 414 "Detected default ",
414 (sis_vbflags & TV_NTSC) ? ((sis_vbflags & TV_CHHDTV) ? 415 (sis_vbflags & TV_NTSC) ? ((sis_vbflags & TV_CHHDTV) ?
415 "480i HDTV" : "NTSC") 416 "480i HDTV" : "NTSC")
416 : ((sis_vbflags & TV_PALM) ? "PALM" 417 : ((sis_vbflags & TV_PALM) ? "PALM"
457 temp1 &= 0xff; 458 temp1 &= 0xff;
458 if (temp1 >= 0xE0) { 459 if (temp1 >= 0xE0) {
459 sis_vbflags |= VB_302LV; 460 sis_vbflags |= VB_302LV;
460 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_302LV; 461 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_302LV;
461 if (sis_verbose > 1) { 462 if (sis_verbose > 1) {
462 printf 463 mp_msg(MSGT_VO, MSGL_STATUS,
463 ("[SiS] Detected SiS302LV video bridge (ID 1; Revision 0x%x)\n", 464 "[SiS] Detected SiS302LV video bridge (ID 1; Revision 0x%x)\n",
464 temp1); 465 temp1);
465 } 466 }
466 467
467 } else if (temp1 >= 0xD0) { 468 } else if (temp1 >= 0xD0) {
468 sis_vbflags |= VB_301LV; 469 sis_vbflags |= VB_301LV;
469 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301LV; 470 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301LV;
470 if (sis_verbose > 1) { 471 if (sis_verbose > 1) {
471 printf 472 mp_msg(MSGT_VO, MSGL_STATUS,
472 ("[SiS] Detected SiS301LV video bridge (ID 1; Revision 0x%x)\n", 473 "[SiS] Detected SiS301LV video bridge (ID 1; Revision 0x%x)\n",
473 temp1); 474 temp1);
474 } 475 }
475 } else if (temp1 >= 0xB0) { 476 } else if (temp1 >= 0xB0) {
476 sis_vbflags |= VB_301B; 477 sis_vbflags |= VB_301B;
477 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301B; 478 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301B;
478 inSISIDXREG(SISPART4, 0x23, temp2); 479 inSISIDXREG(SISPART4, 0x23, temp2);
479 if (!(temp2 & 0x02)) 480 if (!(temp2 & 0x02))
480 sis_vbflags |= VB_30xBDH; 481 sis_vbflags |= VB_30xBDH;
481 if (sis_verbose > 1) { 482 if (sis_verbose > 1) {
482 printf 483 mp_msg(MSGT_VO, MSGL_STATUS,
483 ("[SiS] Detected SiS301B%s video bridge (Revision 0x%x)\n", 484 "[SiS] Detected SiS301B%s video bridge (Revision 0x%x)\n",
484 (temp2 & 0x02) ? "" : " (DH)", temp1); 485 (temp2 & 0x02) ? "" : " (DH)", temp1);
485 } 486 }
486 } else { 487 } else {
487 sis_vbflags |= VB_301; 488 sis_vbflags |= VB_301;
488 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301; 489 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301;
489 if (sis_verbose > 1) { 490 if (sis_verbose > 1) {
490 printf 491 mp_msg(MSGT_VO, MSGL_STATUS,
491 ("[SiS] Detected SiS301 video bridge (Revision 0x%x)\n", 492 "[SiS] Detected SiS301 video bridge (Revision 0x%x)\n",
492 temp1); 493 temp1);
493 } 494 }
494 } 495 }
495 496
496 sis_sense_30x(); 497 sis_sense_30x();
501 temp1 &= 0xff; 502 temp1 &= 0xff;
502 if (temp1 >= 0xE0) { 503 if (temp1 >= 0xE0) {
503 sis_vbflags |= VB_302LV; 504 sis_vbflags |= VB_302LV;
504 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_302LV; 505 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_302LV;
505 if (sis_verbose > 1) { 506 if (sis_verbose > 1) {
506 printf 507 mp_msg(MSGT_VO, MSGL_STATUS,
507 ("[SiS] Detected SiS302LV video bridge (ID 2; Revision 0x%x)\n", 508 "[SiS] Detected SiS302LV video bridge (ID 2; Revision 0x%x)\n",
508 temp1); 509 temp1);
509 } 510 }
510 } else if (temp1 >= 0xD0) { 511 } else if (temp1 >= 0xD0) {
511 sis_vbflags |= VB_301LV; 512 sis_vbflags |= VB_301LV;
512 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301LV; 513 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_301LV;
513 if (sis_verbose > 1) { 514 if (sis_verbose > 1) {
514 printf 515 mp_msg(MSGT_VO, MSGL_STATUS,
515 ("[SiS] Detected SiS301LV video bridge (ID 2; Revision 0x%x)\n", 516 "[SiS] Detected SiS301LV video bridge (ID 2; Revision 0x%x)\n",
516 temp1); 517 temp1);
517 } 518 }
518 } else { 519 } else {
519 sis_vbflags |= VB_302B; 520 sis_vbflags |= VB_302B;
520 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_302B; 521 //pSiS->sishw_ext.ujVBChipID = VB_CHIP_302B;
521 inSISIDXREG(SISPART4, 0x23, temp2); 522 inSISIDXREG(SISPART4, 0x23, temp2);
522 if (!(temp & 0x02)) 523 if (!(temp & 0x02))
523 sis_vbflags |= VB_30xBDH; 524 sis_vbflags |= VB_30xBDH;
524 if (sis_verbose > 1) { 525 if (sis_verbose > 1) {
525 printf 526 mp_msg(MSGT_VO, MSGL_STATUS,
526 ("[SiS] Detected SiS302B%s video bridge (Revision 0x%x)\n", 527 "[SiS] Detected SiS302B%s video bridge (Revision 0x%x)\n",
527 (temp2 & 0x02) ? "" : " (DH)", temp1); 528 (temp2 & 0x02) ? "" : " (DH)", temp1);
528 } 529 }
529 } 530 }
530 531
531 sis_sense_30x(); 532 sis_sense_30x();
532 533
533 } else if (temp == 3) { 534 } else if (temp == 3) {
534 if (sis_verbose > 1) { 535 if (sis_verbose > 1) {
535 printf("[SiS] Detected SiS303 video bridge - not supported\n"); 536 mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] Detected SiS303 video bridge - not supported\n");
536 } 537 }
537 } else { 538 } else {
538 /* big scary mess of code to handle unknown or Chrontel LVDS */ 539 /* big scary mess of code to handle unknown or Chrontel LVDS */
539 /* skipping it for now */ 540 /* skipping it for now */
540 if (sis_verbose > 1) { 541 if (sis_verbose > 1) {
541 printf 542 mp_msg(MSGT_VO, MSGL_STATUS,
542 ("[SiS] Detected Chrontel video bridge - not supported\n"); 543 "[SiS] Detected Chrontel video bridge - not supported\n");
543 } 544 }
544 } 545 }
545 546
546 /* this is probably not relevant to video overlay driver... */ 547 /* this is probably not relevant to video overlay driver... */
547 /* detects if brdige uses LCDA for low res text modes */ 548 /* detects if brdige uses LCDA for low res text modes */
563 } 564 }
564 } 565 }
565 } 566 }
566 } 567 }
567 if (sis_vbflags & VB_USELCDA) { 568 if (sis_vbflags & VB_USELCDA) {
568 /* printf("Bridge uses LCDA for low resolution and text modes\n"); */ 569 /* mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] Bridge uses LCDA for low resolution and text modes\n"); */
569 } 570 }
570 } 571 }
571 } 572 }
572 573
573 574
612 ) 613 )
613 sis_vbflags = sis_vbflags | CRT2_LCD; 614 sis_vbflags = sis_vbflags | CRT2_LCD;
614 else { 615 else {
615 sis_vbflags = sis_vbflags & ~(CRT2_LCD); 616 sis_vbflags = sis_vbflags & ~(CRT2_LCD);
616 if (sis_verbose > 0) { 617 if (sis_verbose > 0) {
617 printf 618 mp_msg(MSGT_VO, MSGL_STATUS,
618 ("[SiS] Can't force CRT2 to LCD, no panel detected\n"); 619 "[SiS] Can't force CRT2 to LCD, no panel detected\n");
619 } 620 }
620 } 621 }
621 break; 622 break;
622 case CRT2_VGA: 623 case CRT2_VGA:
623 if (sis_vbflags & VB_LVDS) { 624 if (sis_vbflags & VB_LVDS) {
624 if (sis_verbose > 0) { 625 if (sis_verbose > 0) {
625 printf("[SiS] LVDS does not support secondary VGA\n"); 626 mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] LVDS does not support secondary VGA\n");
626 } 627 }
627 break; 628 break;
628 } 629 }
629 if (sis_vbflags & (VB_301LV | VB_302LV)) { 630 if (sis_vbflags & (VB_301LV | VB_302LV)) {
630 if (sis_verbose > 0) { 631 if (sis_verbose > 0) {
631 printf 632 mp_msg(MSGT_VO, MSGL_STATUS,
632 ("[SiS] SiS30xLV bridge does not support secondary VGA\n"); 633 "[SiS] SiS30xLV bridge does not support secondary VGA\n");
633 } 634 }
634 break; 635 break;
635 } 636 }
636 sis_vbflags = sis_vbflags & ~(CRT2_TV | CRT2_LCD); 637 sis_vbflags = sis_vbflags & ~(CRT2_TV | CRT2_LCD);
637 if (sis_vbflags & VB_VIDEOBRIDGE) 638 if (sis_vbflags & VB_VIDEOBRIDGE)
685 } else { /* TW: CRT1 only ------------------------------- */ 686 } else { /* TW: CRT1 only ------------------------------- */
686 sis_vbflags |= (VB_DISPMODE_SINGLE | DISPTYPE_CRT1); 687 sis_vbflags |= (VB_DISPMODE_SINGLE | DISPTYPE_CRT1);
687 } 688 }
688 689
689 if (sis_verbose > 0) { 690 if (sis_verbose > 0) {
690 printf("[SiS] Using hardware overlay on CRT%d\n", 691 mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] Using hardware overlay on CRT%d\n",
691 sis_overlay_on_crt1 ? 1 : 2); 692 sis_overlay_on_crt1 ? 1 : 2);
692 } 693 }
693 694
694 } 695 }