comparison vidix/mga_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
56 #include "vidix.h" 56 #include "vidix.h"
57 #include "fourcc.h" 57 #include "fourcc.h"
58 #include "dha.h" 58 #include "dha.h"
59 #include "pci_ids.h" 59 #include "pci_ids.h"
60 #include "pci_names.h" 60 #include "pci_names.h"
61 #include "mp_msg.h"
61 62
62 #ifdef __MINGW32__ 63 #ifdef __MINGW32__
63 #define ENOTSUP 134 64 #define ENOTSUP 134
64 #endif 65 #endif
65 66
342 #endif 343 #endif
343 344
344 static int mga_frame_select(unsigned int frame) 345 static int mga_frame_select(unsigned int frame)
345 { 346 {
346 mga_next_frame = frame; 347 mga_next_frame = frame;
347 if (mga_verbose>1) printf("[mga] frameselect: %d\n", mga_next_frame); 348 if (mga_verbose>1) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] frameselect: %d\n", mga_next_frame);
348 #if MGA_ALLOW_IRQ 349 #if MGA_ALLOW_IRQ
349 if (mga_irq == -1) 350 if (mga_irq == -1)
350 #endif 351 #endif
351 { 352 {
352 //we don't need the vcount protection as we're only hitting 353 //we don't need the vcount protection as we're only hitting
537 writel( regs.besglobctl + ((readl(mga_mmio_base + VCOUNT)+2)<<16), 538 writel( regs.besglobctl + ((readl(mga_mmio_base + VCOUNT)+2)<<16),
538 mga_mmio_base + BESGLOBCTL); 539 mga_mmio_base + BESGLOBCTL);
539 540
540 if (mga_verbose > 1) 541 if (mga_verbose > 1)
541 { 542 {
542 printf("[mga] wrote BES registers\n"); 543 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] wrote BES registers\n");
543 printf("[mga] BESCTL = 0x%08x\n", 544 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] BESCTL = 0x%08x\n",
544 readl(mga_mmio_base + BESCTL)); 545 readl(mga_mmio_base + BESCTL));
545 printf("[mga] BESGLOBCTL = 0x%08x\n", 546 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] BESGLOBCTL = 0x%08x\n",
546 readl(mga_mmio_base + BESGLOBCTL)); 547 readl(mga_mmio_base + BESGLOBCTL));
547 printf("[mga] BESSTATUS= 0x%08x\n", 548 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] BESSTATUS= 0x%08x\n",
548 readl(mga_mmio_base + BESSTATUS)); 549 readl(mga_mmio_base + BESSTATUS));
549 } 550 }
550 #ifdef CRTC2 551 #ifdef CRTC2
551 writel(((readl(mga_mmio_base + C2CTL) & ~0x03e00000) + (cregs.c2ctl & 0x03e00000)), mga_mmio_base + C2CTL); 552 writel(((readl(mga_mmio_base + C2CTL) & ~0x03e00000) + (cregs.c2ctl & 0x03e00000)), mga_mmio_base + C2CTL);
552 writel(((readl(mga_mmio_base + C2DATACTL) & ~0x000000ff) + (cregs.c2datactl & 0x000000ff)), mga_mmio_base + C2DATACTL); 553 writel(((readl(mga_mmio_base + C2DATACTL) & ~0x000000ff) + (cregs.c2datactl & 0x000000ff)), mga_mmio_base + C2DATACTL);
553 // ctrc2 554 // ctrc2
554 // disable CRTC2 acording to specs 555 // disable CRTC2 acording to specs
555 writel(cregs.c2misc, mga_mmio_base + C2MISC); 556 writel(cregs.c2misc, mga_mmio_base + C2MISC);
556 557
557 if (mga_verbose > 1) printf("[mga] c2offset = %d\n",cregs.c2offset); 558 if (mga_verbose > 1) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] c2offset = %d\n",cregs.c2offset);
558 559
559 writel(cregs.c2offset, mga_mmio_base + C2OFFSET); 560 writel(cregs.c2offset, mga_mmio_base + C2OFFSET);
560 writel(cregs.c2startadd0, mga_mmio_base + C2STARTADD0); 561 writel(cregs.c2startadd0, mga_mmio_base + C2STARTADD0);
561 writel(cregs.c2pl2startadd0, mga_mmio_base + C2PL2STARTADD0); 562 writel(cregs.c2pl2startadd0, mga_mmio_base + C2PL2STARTADD0);
562 writel(cregs.c2pl3startadd0, mga_mmio_base + C2PL3STARTADD0); 563 writel(cregs.c2pl3startadd0, mga_mmio_base + C2PL3STARTADD0);
641 unsigned int vtotal = vsyncend + upper_margin; 642 unsigned int vtotal = vsyncend + upper_margin;
642 #endif 643 #endif
643 644
644 if ((config->num_frames < 1) || (config->num_frames > 4)) 645 if ((config->num_frames < 1) || (config->num_frames > 4))
645 { 646 {
646 printf("[mga] illegal num_frames: %d, setting to %d\n", 647 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] illegal num_frames: %d, setting to %d\n",
647 config->num_frames, MGA_DEFAULT_FRAMES); 648 config->num_frames, MGA_DEFAULT_FRAMES);
648 config->num_frames = MGA_DEFAULT_FRAMES; 649 config->num_frames = MGA_DEFAULT_FRAMES;
649 } 650 }
650 651
651 x = config->dest.x; 652 x = config->dest.x;
656 dh = config->dest.h; 657 dh = config->dest.h;
657 658
658 config->dest.pitch.y=32; 659 config->dest.pitch.y=32;
659 config->dest.pitch.u=config->dest.pitch.v=32; 660 config->dest.pitch.u=config->dest.pitch.v=32;
660 661
661 if (mga_verbose) printf("[mga] Setting up a %dx%d-%dx%d video window (src %dx%d) format %X\n", 662 if (mga_verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Setting up a %dx%d-%dx%d video window (src %dx%d) format %X\n",
662 dw, dh, x, y, sw, sh, config->fourcc); 663 dw, dh, x, y, sw, sh, config->fourcc);
663 664
664 if ((sw < 4) || (sh < 4) || (dw < 4) || (dh < 4)) 665 if ((sw < 4) || (sh < 4) || (dw < 4) || (dh < 4))
665 { 666 {
666 printf("[mga] Invalid src/dest dimensions\n"); 667 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Invalid src/dest dimensions\n");
667 return EINVAL; 668 return EINVAL;
668 } 669 }
669 670
670 //FIXME check that window is valid and inside desktop 671 //FIXME check that window is valid and inside desktop
671 672
681 case IMGFMT_YUY2: 682 case IMGFMT_YUY2:
682 case IMGFMT_UYVY: 683 case IMGFMT_UYVY:
683 config->frame_size = ((sw + 31) & ~31) * sh * 2; 684 config->frame_size = ((sw + 31) & ~31) * sh * 2;
684 break; 685 break;
685 default: 686 default:
686 printf("[mga] Unsupported pixel format: %x\n", config->fourcc); 687 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Unsupported pixel format: %x\n", config->fourcc);
687 return ENOTSUP; 688 return ENOTSUP;
688 } 689 }
689 690
690 config->offsets[0] = 0; 691 config->offsets[0] = 0;
691 for (i = 1; i < config->num_frames+1; i++) 692 for (i = 1; i < config->num_frames+1; i++)
703 } 704 }
704 705
705 mga_src_base = (mga_ram_size*0x100000-config->num_frames*config->frame_size); 706 mga_src_base = (mga_ram_size*0x100000-config->num_frames*config->frame_size);
706 if (mga_src_base < 0) 707 if (mga_src_base < 0)
707 { 708 {
708 printf("[mga] not enough memory for frames!\n"); 709 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] not enough memory for frames!\n");
709 return EFAULT; 710 return EFAULT;
710 } 711 }
711 mga_src_base &= (~0xFFFF); /* 64k boundary */ 712 mga_src_base &= (~0xFFFF); /* 64k boundary */
712 if (mga_verbose > 1) printf("[mga] YUV buffer base: %#x\n", mga_src_base); 713 if (mga_verbose > 1) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] YUV buffer base: %#x\n", mga_src_base);
713 714
714 config->dga_addr = mga_mem_base + mga_src_base; 715 config->dga_addr = mga_mem_base + mga_src_base;
715 716
716 /* for G200 set Interleaved UV planes */ 717 /* for G200 set Interleaved UV planes */
717 if (!is_g400) 718 if (!is_g400)
1045 return 0; 1046 return 0;
1046 } 1047 }
1047 1048
1048 static int mga_playback_on(void) 1049 static int mga_playback_on(void)
1049 { 1050 {
1050 if (mga_verbose) printf("[mga] playback on\n"); 1051 if (mga_verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] playback on\n");
1051 1052
1052 vid_src_ready = 1; 1053 vid_src_ready = 1;
1053 if(vid_overlay_on) 1054 if(vid_overlay_on)
1054 { 1055 {
1055 regs.besctl |= 1; 1056 regs.besctl |= 1;
1064 return 0; 1065 return 0;
1065 } 1066 }
1066 1067
1067 static int mga_playback_off(void) 1068 static int mga_playback_off(void)
1068 { 1069 {
1069 if (mga_verbose) printf("[mga] playback off\n"); 1070 if (mga_verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] playback off\n");
1070 1071
1071 vid_src_ready = 0; 1072 vid_src_ready = 0;
1072 #if MGA_ALLOW_IRQ 1073 #if MGA_ALLOW_IRQ
1073 if (mga_irq != -1) 1074 if (mga_irq != -1)
1074 disable_irq(); 1075 disable_irq();
1084 { 1085 {
1085 pciinfo_t lst[MAX_PCI_DEVICES]; 1086 pciinfo_t lst[MAX_PCI_DEVICES];
1086 unsigned int i, num_pci; 1087 unsigned int i, num_pci;
1087 int err; 1088 int err;
1088 1089
1089 if (verbose) printf("[mga] probe\n"); 1090 if (verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] probe\n");
1090 1091
1091 mga_verbose = verbose; 1092 mga_verbose = verbose;
1092 1093
1093 is_g400 = -1; 1094 is_g400 = -1;
1094 1095
1095 err = pci_scan(lst, &num_pci); 1096 err = pci_scan(lst, &num_pci);
1096 if (err) 1097 if (err)
1097 { 1098 {
1098 printf("[mga] Error occurred during pci scan: %s\n", strerror(err)); 1099 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Error occurred during pci scan: %s\n", strerror(err));
1099 return err; 1100 return err;
1100 } 1101 }
1101 1102
1102 if (mga_verbose) 1103 if (mga_verbose)
1103 printf("[mga] found %d pci devices\n", num_pci); 1104 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] found %d pci devices\n", num_pci);
1104 1105
1105 for (i = 0; i < num_pci; i++) 1106 for (i = 0; i < num_pci; i++)
1106 { 1107 {
1107 if (mga_verbose > 1) 1108 if (mga_verbose > 1)
1108 printf("[mga] pci[%d] vendor: %d device: %d\n", 1109 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] pci[%d] vendor: %d device: %d\n",
1109 i, lst[i].vendor, lst[i].device); 1110 i, lst[i].vendor, lst[i].device);
1110 if (lst[i].vendor == VENDOR_MATROX) 1111 if (lst[i].vendor == VENDOR_MATROX)
1111 { 1112 {
1112 #if 0 1113 #if 0
1113 if ((lst[i].command & PCI_COMMAND_IO) == 0) 1114 if ((lst[i].command & PCI_COMMAND_IO) == 0)
1114 { 1115 {
1115 printf("[mga] Device is disabled, ignoring\n"); 1116 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Device is disabled, ignoring\n");
1116 continue; 1117 continue;
1117 } 1118 }
1118 #endif 1119 #endif
1119 switch(lst[i].device) 1120 switch(lst[i].device)
1120 { 1121 {
1121 case DEVICE_MATROX_MGA_G550_AGP: 1122 case DEVICE_MATROX_MGA_G550_AGP:
1122 printf("[mga] Found MGA G550\n"); 1123 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Found MGA G550\n");
1123 is_g400 = 1; 1124 is_g400 = 1;
1124 goto card_found; 1125 goto card_found;
1125 case DEVICE_MATROX_MGA_G400_G450: 1126 case DEVICE_MATROX_MGA_G400_G450:
1126 printf("[mga] Found MGA G400/G450\n"); 1127 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Found MGA G400/G450\n");
1127 is_g400 = 1; 1128 is_g400 = 1;
1128 goto card_found; 1129 goto card_found;
1129 case DEVICE_MATROX_MGA_G200_AGP: 1130 case DEVICE_MATROX_MGA_G200_AGP:
1130 printf("[mga] Found MGA G200 AGP\n"); 1131 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Found MGA G200 AGP\n");
1131 is_g400 = 0; 1132 is_g400 = 0;
1132 goto card_found; 1133 goto card_found;
1133 case DEVICE_MATROX_MGA_G200: 1134 case DEVICE_MATROX_MGA_G200:
1134 printf("[mga] Found MGA G200 PCI\n"); 1135 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Found MGA G200 PCI\n");
1135 is_g400 = 0; 1136 is_g400 = 0;
1136 goto card_found; 1137 goto card_found;
1137 } 1138 }
1138 } 1139 }
1139 } 1140 }
1140 1141
1141 if (is_g400 == -1) 1142 if (is_g400 == -1)
1142 { 1143 {
1143 if (verbose) printf("[mga] Can't find chip\n"); 1144 if (verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Can't find chip\n");
1144 return ENXIO; 1145 return ENXIO;
1145 } 1146 }
1146 1147
1147 card_found: 1148 card_found:
1148 probed = 1; 1149 probed = 1;
1156 static int mga_init(void) 1157 static int mga_init(void)
1157 { 1158 {
1158 unsigned int card_option = 0; 1159 unsigned int card_option = 0;
1159 int err; 1160 int err;
1160 1161
1161 if (mga_verbose) printf("[mga] init\n"); 1162 if (mga_verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] init\n");
1162 1163
1163 mga_vid_in_use = 0; 1164 mga_vid_in_use = 0;
1164 1165
1165 printf("Matrox MGA G200/G400/G450 YUV Video interface v2.01 (c) Aaron Holtzman & A'rpi\n"); 1166 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Matrox MGA G200/G400/G450 YUV Video interface v2.01 (c) Aaron Holtzman & A'rpi\n");
1166 #ifdef CRTC2 1167 #ifdef CRTC2
1167 printf("Driver compiled with TV-out (second-head) support\n"); 1168 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Driver compiled with TV-out (second-head) support\n");
1168 #endif 1169 #endif
1169 1170
1170 if (!probed) 1171 if (!probed)
1171 { 1172 {
1172 printf("[mga] driver was not probed but is being initializing\n"); 1173 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] driver was not probed but is being initializing\n");
1173 return EINTR; 1174 return EINTR;
1174 } 1175 }
1175 1176
1176 #ifdef MGA_PCICONFIG_MEMDETECT 1177 #ifdef MGA_PCICONFIG_MEMDETECT
1177 pci_config_read(pci_info.bus, pci_info.card, pci_info.func, 1178 pci_config_read(pci_info.bus, pci_info.card, pci_info.func,
1178 0x40, 4, &card_option); 1179 0x40, 4, &card_option);
1179 if (mga_verbose > 1) printf("[mga] OPTION word: 0x%08X mem: 0x%02X %s\n", card_option, 1180 if (mga_verbose > 1) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] OPTION word: 0x%08X mem: 0x%02X %s\n", card_option,
1180 (card_option>>10)&0x17, ((card_option>>14)&1)?"SGRAM":"SDRAM"); 1181 (card_option>>10)&0x17, ((card_option>>14)&1)?"SGRAM":"SDRAM");
1181 #endif 1182 #endif
1182 1183
1183 if (mga_ram_size) 1184 if (mga_ram_size)
1184 { 1185 {
1185 printf("[mga] RAMSIZE forced to %d MB\n", mga_ram_size); 1186 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] RAMSIZE forced to %d MB\n", mga_ram_size);
1186 } 1187 }
1187 else 1188 else
1188 { 1189 {
1189 #ifdef MGA_MEMORY_SIZE 1190 #ifdef MGA_MEMORY_SIZE
1190 mga_ram_size = MGA_MEMORY_SIZE; 1191 mga_ram_size = MGA_MEMORY_SIZE;
1191 printf("[mga] hard-coded RAMSIZE is %d MB\n", (unsigned int) mga_ram_size); 1192 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] hard-coded RAMSIZE is %d MB\n", (unsigned int) mga_ram_size);
1192 #else 1193 #else
1193 if (is_g400) 1194 if (is_g400)
1194 { 1195 {
1195 switch((card_option>>10)&0x17) 1196 switch((card_option>>10)&0x17)
1196 { 1197 {
1203 case 0x14: mga_ram_size = 32; break; 1204 case 0x14: mga_ram_size = 32; break;
1204 case 0x11: 1205 case 0x11:
1205 case 0x12: mga_ram_size = 16; break; 1206 case 0x12: mga_ram_size = 16; break;
1206 default: 1207 default:
1207 mga_ram_size = 16; 1208 mga_ram_size = 16;
1208 printf("[mga] Couldn't detect RAMSIZE, assuming 16MB!\n"); 1209 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Couldn't detect RAMSIZE, assuming 16MB!\n");
1209 } 1210 }
1210 } 1211 }
1211 else 1212 else
1212 { 1213 {
1213 switch((card_option>>10)&0x17) 1214 switch((card_option>>10)&0x17)
1214 { 1215 {
1215 default: mga_ram_size = 8; 1216 default: mga_ram_size = 8;
1216 } 1217 }
1217 } 1218 }
1218 1219
1219 printf("[mga] detected RAMSIZE is %d MB\n", (unsigned int) mga_ram_size); 1220 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] detected RAMSIZE is %d MB\n", (unsigned int) mga_ram_size);
1220 #endif 1221 #endif
1221 } 1222 }
1222 1223
1223 if (mga_ram_size) 1224 if (mga_ram_size)
1224 { 1225 {
1225 if ((mga_ram_size < 4) || (mga_ram_size > 64)) 1226 if ((mga_ram_size < 4) || (mga_ram_size > 64))
1226 { 1227 {
1227 printf("[mga] invalid RAMSIZE: %d MB\n", mga_ram_size); 1228 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] invalid RAMSIZE: %d MB\n", mga_ram_size);
1228 return EINVAL; 1229 return EINVAL;
1229 } 1230 }
1230 } 1231 }
1231 1232
1232 if (mga_verbose > 1) printf("[mga] hardware addresses: mmio: %#x, framebuffer: %#x\n", 1233 if (mga_verbose > 1) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] hardware addresses: mmio: %#x, framebuffer: %#x\n",
1233 pci_info.base1, pci_info.base0); 1234 pci_info.base1, pci_info.base0);
1234 1235
1235 mga_mmio_base = map_phys_mem(pci_info.base1,0x4000); 1236 mga_mmio_base = map_phys_mem(pci_info.base1,0x4000);
1236 mga_mem_base = map_phys_mem(pci_info.base0,mga_ram_size*1024*1024); 1237 mga_mem_base = map_phys_mem(pci_info.base0,mga_ram_size*1024*1024);
1237 1238
1238 if (mga_verbose > 1) printf("[mga] MMIO at %p, IRQ: %d, framebuffer: %p\n", 1239 if (mga_verbose > 1) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] MMIO at %p, IRQ: %d, framebuffer: %p\n",
1239 mga_mmio_base, mga_irq, mga_mem_base); 1240 mga_mmio_base, mga_irq, mga_mem_base);
1240 err = mtrr_set_type(pci_info.base0,mga_ram_size*1024*1024,MTRR_TYPE_WRCOMB); 1241 err = mtrr_set_type(pci_info.base0,mga_ram_size*1024*1024,MTRR_TYPE_WRCOMB);
1241 if(!err) printf("[mga] Set write-combining type of video memory\n"); 1242 if(!err) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] Set write-combining type of video memory\n");
1242 #if MGA_ALLOW_IRQ 1243 #if MGA_ALLOW_IRQ
1243 if (mga_irq != -1) 1244 if (mga_irq != -1)
1244 { 1245 {
1245 int tmp = request_irq(mga_irq, mga_handle_irq, SA_INTERRUPT | SA_SHIRQ, "Syncfb Time Base", &mga_irq); 1246 int tmp = request_irq(mga_irq, mga_handle_irq, SA_INTERRUPT | SA_SHIRQ, "Syncfb Time Base", &mga_irq);
1246 if (tmp) 1247 if (tmp)
1247 { 1248 {
1248 printf("syncfb (mga): cannot register irq %d (Err: %d)\n", mga_irq, tmp); 1249 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] syncfb (mga): cannot register irq %d (Err: %d)\n", mga_irq, tmp);
1249 mga_irq=-1; 1250 mga_irq=-1;
1250 } 1251 }
1251 else 1252 else
1252 { 1253 {
1253 printf("syncfb (mga): registered irq %d\n", mga_irq); 1254 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] syncfb (mga): registered irq %d\n", mga_irq);
1254 } 1255 }
1255 } 1256 }
1256 else 1257 else
1257 { 1258 {
1258 printf("syncfb (mga): No valid irq was found\n"); 1259 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] syncfb (mga): No valid irq was found\n");
1259 mga_irq=-1; 1260 mga_irq=-1;
1260 } 1261 }
1261 #else 1262 #else
1262 printf("syncfb (mga): IRQ disabled in mga_vid.c\n"); 1263 mp_msg(MSGT_VO, MSGL_STATUS, "[mga] syncfb (mga): IRQ disabled in mga_vid.c\n");
1263 mga_irq=-1; 1264 mga_irq=-1;
1264 #endif 1265 #endif
1265 1266
1266 return 0; 1267 return 0;
1267 } 1268 }
1268 1269
1269 static void mga_destroy(void) 1270 static void mga_destroy(void)
1270 { 1271 {
1271 if (mga_verbose) printf("[mga] destroy\n"); 1272 if (mga_verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] destroy\n");
1272 1273
1273 /* FIXME turn off BES */ 1274 /* FIXME turn off BES */
1274 vid_src_ready = 0; 1275 vid_src_ready = 0;
1275 regs.besctl &= ~1; 1276 regs.besctl &= ~1;
1276 regs.besglobctl &= ~(1<<6); // UYVY format selected 1277 regs.besglobctl &= ~(1<<6); // UYVY format selected
1289 return; 1290 return;
1290 } 1291 }
1291 1292
1292 static int mga_query_fourcc(vidix_fourcc_t *to) 1293 static int mga_query_fourcc(vidix_fourcc_t *to)
1293 { 1294 {
1294 if (mga_verbose) printf("[mga] query fourcc (%x)\n", to->fourcc); 1295 if (mga_verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] query fourcc (%x)\n", to->fourcc);
1295 1296
1296 switch(to->fourcc) 1297 switch(to->fourcc)
1297 { 1298 {
1298 case IMGFMT_YV12: 1299 case IMGFMT_YV12:
1299 case IMGFMT_IYUV: 1300 case IMGFMT_IYUV:
1334 static int mga_set_eq( const vidix_video_eq_t * eq) 1335 static int mga_set_eq( const vidix_video_eq_t * eq)
1335 { 1336 {
1336 /* contrast and brightness control isn't supported on G200 - alex */ 1337 /* contrast and brightness control isn't supported on G200 - alex */
1337 if (!is_g400) 1338 if (!is_g400)
1338 { 1339 {
1339 if (mga_verbose) printf("[mga] equalizer isn't supported with G200\n"); 1340 if (mga_verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] equalizer isn't supported with G200\n");
1340 return ENOTSUP; 1341 return ENOTSUP;
1341 } 1342 }
1342 1343
1343 // only brightness&contrast are supported: 1344 // only brightness&contrast are supported:
1344 if(!(eq->cap & (VEQ_CAP_BRIGHTNESS|VEQ_CAP_CONTRAST))) 1345 if(!(eq->cap & (VEQ_CAP_BRIGHTNESS|VEQ_CAP_CONTRAST)))
1361 static int mga_get_eq( vidix_video_eq_t * eq) 1362 static int mga_get_eq( vidix_video_eq_t * eq)
1362 { 1363 {
1363 /* contrast and brightness control isn't supported on G200 - alex */ 1364 /* contrast and brightness control isn't supported on G200 - alex */
1364 if (!is_g400) 1365 if (!is_g400)
1365 { 1366 {
1366 if (mga_verbose) printf("[mga] equalizer isn't supported with G200\n"); 1367 if (mga_verbose) mp_msg(MSGT_VO, MSGL_STATUS, "[mga] equalizer isn't supported with G200\n");
1367 return ENOTSUP; 1368 return ENOTSUP;
1368 } 1369 }
1369 1370
1370 eq->brightness = (signed short int)(regs.beslumactl >> 16) * 1000 / 128; 1371 eq->brightness = (signed short int)(regs.beslumactl >> 16) * 1000 / 128;
1371 eq->contrast = (signed short int)(regs.beslumactl & 0xFFFF) * 1000 / 128 - 1000; 1372 eq->contrast = (signed short int)(regs.beslumactl & 0xFFFF) * 1000 / 128 - 1000;
1372 eq->cap = VEQ_CAP_BRIGHTNESS | VEQ_CAP_CONTRAST; 1373 eq->cap = VEQ_CAP_BRIGHTNESS | VEQ_CAP_CONTRAST;
1373 1374
1374 printf("MGA GET_EQ: br=%d c=%d \n",eq->brightness,eq->contrast); 1375 mp_msg(MSGT_VO, MSGL_STATUS, "MGA GET_EQ: br=%d c=%d \n",eq->brightness,eq->contrast);
1375 1376
1376 return 0; 1377 return 0;
1377 } 1378 }
1378 1379
1379 #ifndef CRTC2 1380 #ifndef CRTC2