comparison vidix/sis_vid.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 598ef7d90b78
children
comparison
equal deleted inserted replaced
37106:1b9907dfe2f4 37107:3c5c93a30fb7
34 #include "vidix.h" 34 #include "vidix.h"
35 #include "fourcc.h" 35 #include "fourcc.h"
36 #include "dha.h" 36 #include "dha.h"
37 #include "pci_ids.h" 37 #include "pci_ids.h"
38 #include "pci_names.h" 38 #include "pci_names.h"
39 #include "mp_msg.h"
39 40
40 #include "sis_bridge.h" 41 #include "sis_bridge.h"
41 #include "sis_regs.h" 42 #include "sis_regs.h"
42 #include "sis_defs.h" 43 #include "sis_defs.h"
43 44
249 250
250 sis_verbose = verbose; 251 sis_verbose = verbose;
251 force = force; 252 force = force;
252 err = pci_scan(lst, &num_pci); 253 err = pci_scan(lst, &num_pci);
253 if (err) { 254 if (err) {
254 printf("[SiS] Error occurred during pci scan: %s\n", strerror(err)); 255 mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] Error occurred during pci scan: %s\n", strerror(err));
255 return err; 256 return err;
256 } else { 257 } else {
257 err = ENXIO; 258 err = ENXIO;
258 for (i = 0; i < num_pci; i++) { 259 for (i = 0; i < num_pci; i++) {
259 if (lst[i].vendor == VENDOR_SIS) { 260 if (lst[i].vendor == VENDOR_SIS) {
263 if (idx == -1) 264 if (idx == -1)
264 continue; 265 continue;
265 dname = pci_device_name(VENDOR_SIS, lst[i].device); 266 dname = pci_device_name(VENDOR_SIS, lst[i].device);
266 dname = dname ? dname : "Unknown chip"; 267 dname = dname ? dname : "Unknown chip";
267 if (sis_verbose > 0) 268 if (sis_verbose > 0)
268 printf("[SiS] Found chip: %s (0x%X)\n", 269 mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] Found chip: %s (0x%X)\n",
269 dname, lst[i].device); 270 dname, lst[i].device);
270 sis_device_id = sis_cap.device_id = lst[i].device; 271 sis_device_id = sis_cap.device_id = lst[i].device;
271 err = 0; 272 err = 0;
272 memcpy(&pci_info, &lst[i], sizeof(pciinfo_t)); 273 memcpy(&pci_info, &lst[i], sizeof(pciinfo_t));
273 274
310 } else { 311 } else {
311 sis_has_two_overlays = 1; /* ? */ 312 sis_has_two_overlays = 1; /* ? */
312 } 313 }
313 if (sis_has_two_overlays) { 314 if (sis_has_two_overlays) {
314 if (sis_verbose > 0) 315 if (sis_verbose > 0)
315 printf 316 mp_msg(MSGT_VO, MSGL_STATUS,
316 ("[SiS] detected M650/651 with 2 overlays\n"); 317 "[SiS] detected M650/651 with 2 overlays\n");
317 } 318 }
318 disable_app_io(); 319 disable_app_io();
319 } 320 }
320 sis_vga_engine = SIS_315_VGA; 321 sis_vga_engine = SIS_315_VGA;
321 break; 322 break;
326 } 327 }
327 } 328 }
328 } 329 }
329 } 330 }
330 if (err && sis_verbose) { 331 if (err && sis_verbose) {
331 printf("[SiS] Can't find chip\n"); 332 mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] Can't find chip\n");
332 } else { 333 } else {
333 sis_probed = 1; 334 sis_probed = 1;
334 } 335 }
335 336
336 return err; 337 return err;
340 { 341 {
341 uint8_t sr_data, cr_data, cr_data2; 342 uint8_t sr_data, cr_data, cr_data2;
342 char *env_overlay_crt; 343 char *env_overlay_crt;
343 344
344 if (!sis_probed) { 345 if (!sis_probed) {
345 printf("[SiS] driver was not probed but is being initialized\n"); 346 mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] driver was not probed but is being initialized\n");
346 return EINTR; 347 return EINTR;
347 } 348 }
348 349
349 if (enable_app_io() != 0) 350 if (enable_app_io() != 0)
350 { 351 {
351 printf("[SiS] can't enable register I/O\n"); 352 mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] can't enable register I/O\n");
352 return EINTR; 353 return EINTR;
353 } 354 }
354 355
355 /* JCP: this is WRONG. Need to coordinate w/ sisfb to use correct mem */ 356 /* JCP: this is WRONG. Need to coordinate w/ sisfb to use correct mem */
356 /* map 16MB scary hack for now. */ 357 /* map 16MB scary hack for now. */
385 if (env_overlay_crt) { 386 if (env_overlay_crt) {
386 int crt = atoi(env_overlay_crt); 387 int crt = atoi(env_overlay_crt);
387 if (crt == 1 || crt == 2) { 388 if (crt == 1 || crt == 2) {
388 sis_overlay_on_crt1 = (crt == 1); 389 sis_overlay_on_crt1 = (crt == 1);
389 if (sis_verbose > 0) { 390 if (sis_verbose > 0) {
390 printf 391 mp_msg(MSGT_VO, MSGL_STATUS,
391 ("[SiS] override: using overlay on CRT%d from VIDIX_CRT\n", 392 "[SiS] override: using overlay on CRT%d from VIDIX_CRT\n",
392 crt); 393 crt);
393 } 394 }
394 } 395 }
395 } 396 }
396 397
483 static void set_disptype_regs(void) 484 static void set_disptype_regs(void)
484 { 485 {
485 switch (sis_displaymode) { 486 switch (sis_displaymode) {
486 case DISPMODE_SINGLE1: /* TW: CRT1 only */ 487 case DISPMODE_SINGLE1: /* TW: CRT1 only */
487 if (sis_verbose > 2) { 488 if (sis_verbose > 2) {
488 printf("[SiS] Setting up overlay on CRT1\n"); 489 mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] Setting up overlay on CRT1\n");
489 } 490 }
490 if (sis_has_two_overlays) { 491 if (sis_has_two_overlays) {
491 setsrregmask(0x06, 0x00, 0xc0); 492 setsrregmask(0x06, 0x00, 0xc0);
492 setsrregmask(0x32, 0x00, 0xc0); 493 setsrregmask(0x32, 0x00, 0xc0);
493 } else { 494 } else {
495 setsrregmask(0x32, 0x00, 0xc0); 496 setsrregmask(0x32, 0x00, 0xc0);
496 } 497 }
497 break; 498 break;
498 case DISPMODE_SINGLE2: /* TW: CRT2 only */ 499 case DISPMODE_SINGLE2: /* TW: CRT2 only */
499 if (sis_verbose > 2) { 500 if (sis_verbose > 2) {
500 printf("[SiS] Setting up overlay on CRT2\n"); 501 mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] Setting up overlay on CRT2\n");
501 } 502 }
502 if (sis_has_two_overlays) { 503 if (sis_has_two_overlays) {
503 setsrregmask(0x06, 0x80, 0xc0); 504 setsrregmask(0x06, 0x80, 0xc0);
504 setsrregmask(0x32, 0x80, 0xc0); 505 setsrregmask(0x32, 0x80, 0xc0);
505 } else { 506 } else {
508 } 509 }
509 break; 510 break;
510 case DISPMODE_MIRROR: /* TW: CRT1 + CRT2 */ 511 case DISPMODE_MIRROR: /* TW: CRT1 + CRT2 */
511 default: 512 default:
512 if (sis_verbose > 2) { 513 if (sis_verbose > 2) {
513 printf("[SiS] Setting up overlay on CRT1 AND CRT2!\n"); 514 mp_msg(MSGT_VO, MSGL_STATUS, "[SiS] Setting up overlay on CRT1 AND CRT2!\n");
514 } 515 }
515 setsrregmask(0x06, 0x80, 0xc0); 516 setsrregmask(0x06, 0x80, 0xc0);
516 setsrregmask(0x32, 0x80, 0xc0); 517 setsrregmask(0x32, 0x80, 0xc0);
517 break; 518 break;
518 } 519 }
1026 watchdog = WATCHDOG_DELAY; 1027 watchdog = WATCHDOG_DELAY;
1027 while (pOverlay->VBlankActiveFunc() && --watchdog); 1028 while (pOverlay->VBlankActiveFunc() && --watchdog);
1028 watchdog = WATCHDOG_DELAY; 1029 watchdog = WATCHDOG_DELAY;
1029 while ((!pOverlay->VBlankActiveFunc()) && --watchdog); 1030 while ((!pOverlay->VBlankActiveFunc()) && --watchdog);
1030 if (!watchdog && sis_verbose > 0) { 1031 if (!watchdog && sis_verbose > 0) {
1031 printf("[SiS]: timed out waiting for vertical retrace\n"); 1032 mp_msg(MSGT_VO, MSGL_STATUS, "[SiS]: timed out waiting for vertical retrace\n");
1032 } 1033 }
1033 } 1034 }
1034 1035
1035 /* Unlock address registers */ 1036 /* Unlock address registers */
1036 data = getvideoreg(Index_VI_Control_Misc1); 1037 data = getvideoreg(Index_VI_Control_Misc1);