Mercurial > mplayer.hg
comparison vidix/mach64_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 | 945eab072c9d |
children |
comparison
equal
deleted
inserted
replaced
37106:1b9907dfe2f4 | 37107:3c5c93a30fb7 |
---|---|
36 #include "vidix.h" | 36 #include "vidix.h" |
37 #include "fourcc.h" | 37 #include "fourcc.h" |
38 #include "dha.h" | 38 #include "dha.h" |
39 #include "pci_ids.h" | 39 #include "pci_ids.h" |
40 #include "pci_names.h" | 40 #include "pci_names.h" |
41 #include "mp_msg.h" | |
41 | 42 |
42 #include "mach64.h" | 43 #include "mach64.h" |
43 | 44 |
44 #define UNUSED(x) ((void)(x)) /**< Removes warning about unused arguments */ | 45 #define UNUSED(x) ((void)(x)) /**< Removes warning about unused arguments */ |
45 | 46 |
289 int ext_vert_stretch; | 290 int ext_vert_stretch; |
290 int ret; | 291 int ret; |
291 int yres= mach64_get_yres(); | 292 int yres= mach64_get_yres(); |
292 | 293 |
293 if(!supports_lcd_v_stretch){ | 294 if(!supports_lcd_v_stretch){ |
294 if(verbosity > 0) printf("[mach64] vertical stretching not supported\n"); | 295 if(verbosity > 0) mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] vertical stretching not supported\n"); |
295 return 1<<16; | 296 return 1<<16; |
296 } | 297 } |
297 | 298 |
298 lcd_index= INREG(LCD_INDEX); | 299 lcd_index= INREG(LCD_INDEX); |
299 | 300 |
312 | 313 |
313 // lcd_gen_ctrl = ATIGetMach64LCDReg(LCD_GEN_CNTL); | 314 // lcd_gen_ctrl = ATIGetMach64LCDReg(LCD_GEN_CNTL); |
314 | 315 |
315 OUTREG(LCD_INDEX, lcd_index); | 316 OUTREG(LCD_INDEX, lcd_index); |
316 | 317 |
317 if(verbosity > 0) printf("[mach64] vertical stretching factor= %d\n", ret); | 318 if(verbosity > 0) mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] vertical stretching factor= %d\n", ret); |
318 | 319 |
319 return ret; | 320 return ret; |
320 } | 321 } |
321 | 322 |
322 static void mach64_vid_make_default(void) | 323 static void mach64_vid_make_default(void) |
335 } | 336 } |
336 | 337 |
337 static void mach64_vid_dump_regs( void ) | 338 static void mach64_vid_dump_regs( void ) |
338 { | 339 { |
339 size_t i; | 340 size_t i; |
340 printf("[mach64] *** Begin of DRIVER variables dump ***\n"); | 341 mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] *** Begin of DRIVER variables dump ***\n"); |
341 printf("[mach64] mach64_mmio_base=%p\n",mach64_mmio_base); | 342 mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] mach64_mmio_base=%p\n",mach64_mmio_base); |
342 printf("[mach64] mach64_mem_base=%p\n",mach64_mem_base); | 343 mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] mach64_mem_base=%p\n",mach64_mem_base); |
343 printf("[mach64] mach64_overlay_off=%08X\n",mach64_overlay_offset); | 344 mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] mach64_overlay_off=%08X\n",mach64_overlay_offset); |
344 printf("[mach64] mach64_ram_size=%08X\n",mach64_ram_size); | 345 mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] mach64_ram_size=%08X\n",mach64_ram_size); |
345 printf("[mach64] video mode: %ux%u@%u\n",mach64_get_xres(),mach64_get_yres(),mach64_vid_get_dbpp()); | 346 mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] video mode: %ux%u@%u\n",mach64_get_xres(),mach64_get_yres(),mach64_vid_get_dbpp()); |
346 printf("[mach64] *** Begin of OV0 registers dump ***\n"); | 347 mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] *** Begin of OV0 registers dump ***\n"); |
347 for(i=0;i<sizeof(vregs)/sizeof(video_registers_t);i++) | 348 for(i=0;i<sizeof(vregs)/sizeof(video_registers_t);i++) |
348 { | 349 { |
349 mach64_wait_for_idle(); | 350 mach64_wait_for_idle(); |
350 printf("[mach64] %s = %08X\n",vregs[i].sname,INREG(vregs[i].name)); | 351 mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] %s = %08X\n",vregs[i].sname,INREG(vregs[i].name)); |
351 } | 352 } |
352 printf("[mach64] *** End of OV0 registers dump ***\n"); | 353 mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] *** End of OV0 registers dump ***\n"); |
353 } | 354 } |
354 | 355 |
355 | 356 |
356 static unsigned short ati_card_ids[] = | 357 static unsigned short ati_card_ids[] = |
357 { | 358 { |
412 int err; | 413 int err; |
413 verbosity = verbose; | 414 verbosity = verbose; |
414 err = pci_scan(lst,&num_pci); | 415 err = pci_scan(lst,&num_pci); |
415 if(err) | 416 if(err) |
416 { | 417 { |
417 printf("[mach64] Error occurred during pci scan: %s\n",strerror(err)); | 418 mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] Error occurred during pci scan: %s\n",strerror(err)); |
418 return err; | 419 return err; |
419 } | 420 } |
420 else | 421 else |
421 { | 422 { |
422 err = ENXIO; | 423 err = ENXIO; |
428 const char *dname; | 429 const char *dname; |
429 idx = find_chip(lst[i].device); | 430 idx = find_chip(lst[i].device); |
430 if(idx == -1 && force == PROBE_NORMAL) continue; | 431 if(idx == -1 && force == PROBE_NORMAL) continue; |
431 dname = pci_device_name(VENDOR_ATI,lst[i].device); | 432 dname = pci_device_name(VENDOR_ATI,lst[i].device); |
432 dname = dname ? dname : "Unknown chip"; | 433 dname = dname ? dname : "Unknown chip"; |
433 printf("[mach64] Found chip: %s\n",dname); | 434 mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] Found chip: %s\n",dname); |
434 #if 0 | 435 #if 0 |
435 if ((lst[i].command & PCI_COMMAND_IO) == 0) | 436 if ((lst[i].command & PCI_COMMAND_IO) == 0) |
436 { | 437 { |
437 printf("[mach64] Device is disabled, ignoring\n"); | 438 mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] Device is disabled, ignoring\n"); |
438 continue; | 439 continue; |
439 } | 440 } |
440 #endif | 441 #endif |
441 if(force > PROBE_NORMAL) | 442 if(force > PROBE_NORMAL) |
442 { | 443 { |
443 printf("[mach64] Driver was forced. Was found %sknown chip\n",idx == -1 ? "un" : ""); | 444 mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] Driver was forced. Was found %sknown chip\n",idx == -1 ? "un" : ""); |
444 if(idx == -1) | 445 if(idx == -1) |
445 printf("[mach64] Assuming it as Mach64\n"); | 446 mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] Assuming it as Mach64\n"); |
446 } | 447 } |
447 mach64_cap.device_id = lst[i].device; | 448 mach64_cap.device_id = lst[i].device; |
448 err = 0; | 449 err = 0; |
449 memcpy(&pci_info,&lst[i],sizeof(pciinfo_t)); | 450 memcpy(&pci_info,&lst[i],sizeof(pciinfo_t)); |
450 probed=1; | 451 probed=1; |
451 break; | 452 break; |
452 } | 453 } |
453 } | 454 } |
454 } | 455 } |
455 if(err && verbose) printf("[mach64] Can't find chip\n"); | 456 if(err && verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] Can't find chip\n"); |
456 return err; | 457 return err; |
457 } | 458 } |
458 | 459 |
459 static void reset_regs( void ) | 460 static void reset_regs( void ) |
460 { | 461 { |
470 static int mach64_init(void) | 471 static int mach64_init(void) |
471 { | 472 { |
472 int err; | 473 int err; |
473 if(!probed) | 474 if(!probed) |
474 { | 475 { |
475 printf("[mach64] Driver was not probed but is being initializing\n"); | 476 mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] Driver was not probed but is being initializing\n"); |
476 return EINTR; | 477 return EINTR; |
477 } | 478 } |
478 | 479 |
479 if((mach64_mmio_base = map_phys_mem(pci_info.base2,0x1000))==(void *)-1) return ENOMEM; | 480 if((mach64_mmio_base = map_phys_mem(pci_info.base2,0x1000))==(void *)-1) return ENOMEM; |
480 mach64_wait_for_idle(); | 481 mach64_wait_for_idle(); |
483 else if (mach64_ram_size < 12) mach64_ram_size = (mach64_ram_size - 3) * 1024; | 484 else if (mach64_ram_size < 12) mach64_ram_size = (mach64_ram_size - 3) * 1024; |
484 else mach64_ram_size = (mach64_ram_size - 7) * 2048; | 485 else mach64_ram_size = (mach64_ram_size - 7) * 2048; |
485 mach64_ram_size *= 0x400; /* KB -> bytes */ | 486 mach64_ram_size *= 0x400; /* KB -> bytes */ |
486 if((mach64_mem_base = map_phys_mem(pci_info.base0,mach64_ram_size))==(void *)-1) return ENOMEM; | 487 if((mach64_mem_base = map_phys_mem(pci_info.base0,mach64_ram_size))==(void *)-1) return ENOMEM; |
487 memset(&besr,0,sizeof(bes_registers_t)); | 488 memset(&besr,0,sizeof(bes_registers_t)); |
488 printf("[mach64] Video memory = %uMb\n",mach64_ram_size/0x100000); | 489 mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] Video memory = %uMb\n",mach64_ram_size/0x100000); |
489 err = mtrr_set_type(pci_info.base0,mach64_ram_size,MTRR_TYPE_WRCOMB); | 490 err = mtrr_set_type(pci_info.base0,mach64_ram_size,MTRR_TYPE_WRCOMB); |
490 if(!err) printf("[mach64] Set write-combining type of video memory\n"); | 491 if(!err) mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] Set write-combining type of video memory\n"); |
491 | 492 |
492 /* save this */ | 493 /* save this */ |
493 mach64_wait_for_idle(); | 494 mach64_wait_for_idle(); |
494 SAVED_OVERLAY_GRAPHICS_KEY_CLR = INREG(OVERLAY_GRAPHICS_KEY_CLR); | 495 SAVED_OVERLAY_GRAPHICS_KEY_CLR = INREG(OVERLAY_GRAPHICS_KEY_CLR); |
495 | 496 |
506 mach64_wait_for_idle(); | 507 mach64_wait_for_idle(); |
507 mach64_fifo_wait(2); | 508 mach64_fifo_wait(2); |
508 | 509 |
509 if(INREG(SCALER_BUF0_OFFSET_U)) supports_planar=1; | 510 if(INREG(SCALER_BUF0_OFFSET_U)) supports_planar=1; |
510 } | 511 } |
511 if(supports_planar) printf("[mach64] Planar YUV formats are supported :)\n"); | 512 if(supports_planar) mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] Planar YUV formats are supported :)\n"); |
512 else printf("[mach64] Planar YUV formats are not supported :(\n"); | 513 else mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] Planar YUV formats are not supported :(\n"); |
513 | 514 |
514 if( mach64_cap.device_id==DEVICE_ATI_RAGE_MOBILITY_P_M | 515 if( mach64_cap.device_id==DEVICE_ATI_RAGE_MOBILITY_P_M |
515 || mach64_cap.device_id==DEVICE_ATI_RAGE_MOBILITY_P_M2 | 516 || mach64_cap.device_id==DEVICE_ATI_RAGE_MOBILITY_P_M2 |
516 || mach64_cap.device_id==DEVICE_ATI_RAGE_MOBILITY_L | 517 || mach64_cap.device_id==DEVICE_ATI_RAGE_MOBILITY_L |
517 || mach64_cap.device_id==DEVICE_ATI_RAGE_MOBILITY_L2) | 518 || mach64_cap.device_id==DEVICE_ATI_RAGE_MOBILITY_L2) |
766 dest_w = config->dest.w; | 767 dest_w = config->dest.w; |
767 dest_h = config->dest.h; | 768 dest_h = config->dest.h; |
768 besr.fourcc = config->fourcc; | 769 besr.fourcc = config->fourcc; |
769 ecp = (INPLL(PLL_VCLK_CNTL) & PLL_ECP_DIV) >> 4; | 770 ecp = (INPLL(PLL_VCLK_CNTL) & PLL_ECP_DIV) >> 4; |
770 | 771 |
771 if(verbosity > 0) printf("[mach64] ecp: %d\n", ecp); | 772 if(verbosity > 0) mp_msg(MSGT_VO, MSGL_STATUS, "[mach64] ecp: %d\n", ecp); |
772 v_inc = src_h * mach64_get_vert_stretch(); | 773 v_inc = src_h * mach64_get_vert_stretch(); |
773 | 774 |
774 if(mach64_is_interlace()) v_inc<<=1; | 775 if(mach64_is_interlace()) v_inc<<=1; |
775 if(mach64_is_dbl_scan() ) v_inc>>=1; | 776 if(mach64_is_dbl_scan() ) v_inc>>=1; |
776 v_inc>>=4; // convert 16.16 -> 20.12 | 777 v_inc>>=4; // convert 16.16 -> 20.12 |
919 static int mach64_frame_sel(unsigned int frame) | 920 static int mach64_frame_sel(unsigned int frame) |
920 { | 921 { |
921 uint32_t off[6]; | 922 uint32_t off[6]; |
922 int i; | 923 int i; |
923 int last_frame= (frame-1+num_mach64_buffers) % num_mach64_buffers; | 924 int last_frame= (frame-1+num_mach64_buffers) % num_mach64_buffers; |
924 //printf("Selecting frame %d\n", frame); | 925 //mp_msg(MSGT_VO, MSGL_STATUS, "Selecting frame %d\n", frame); |
925 /* | 926 /* |
926 buf3-5 always should point onto second buffer for better | 927 buf3-5 always should point onto second buffer for better |
927 deinterlacing and TV-in | 928 deinterlacing and TV-in |
928 */ | 929 */ |
929 if(num_mach64_buffers==1) return 0; | 930 if(num_mach64_buffers==1) return 0; |