Mercurial > mplayer.hg
comparison vidix/sis_vid.c @ 22857:77def5093daf
switch to new internal vidix API, no more dlopen/dlsym, libvidix is now a fully static library with all drivers built-in
author | ben |
---|---|
date | Sun, 01 Apr 2007 11:06:06 +0000 |
parents | 9a1e26fef45b |
children | 6c57087c5a2d |
comparison
equal
deleted
inserted
replaced
22856:27db9ffe00a5 | 22857:77def5093daf |
---|---|
29 #include <string.h> | 29 #include <string.h> |
30 #include <inttypes.h> | 30 #include <inttypes.h> |
31 #include <unistd.h> | 31 #include <unistd.h> |
32 | 32 |
33 #include "vidix.h" | 33 #include "vidix.h" |
34 #include "vidixlib.h" | |
34 #include "fourcc.h" | 35 #include "fourcc.h" |
35 #include "../libdha/libdha.h" | 36 #include "../libdha/libdha.h" |
36 #include "../libdha/pci_ids.h" | 37 #include "../libdha/pci_ids.h" |
37 #include "../libdha/pci_names.h" | 38 #include "../libdha/pci_names.h" |
38 #include "../config.h" | 39 #include "../config.h" |
146 VENDOR_SIS, | 147 VENDOR_SIS, |
147 -1, | 148 -1, |
148 {0, 0, 0, 0} | 149 {0, 0, 0, 0} |
149 }; | 150 }; |
150 | 151 |
151 vidix_video_eq_t sis_equal = { | 152 static vidix_video_eq_t sis_equal = { |
152 VEQ_CAP_BRIGHTNESS | VEQ_CAP_CONTRAST, | 153 VEQ_CAP_BRIGHTNESS | VEQ_CAP_CONTRAST, |
153 200, 0, 0, 0, 0, 0, 0, 0 | 154 200, 0, 0, 0, 0, 0, 0, 0 |
154 }; | 155 }; |
155 | 156 |
156 static unsigned short sis_card_ids[] = { | 157 static unsigned short sis_card_ids[] = { |
235 } | 236 } |
236 return ((ret & 0x02) ^ 0x02); | 237 return ((ret & 0x02) ^ 0x02); |
237 } | 238 } |
238 | 239 |
239 | 240 |
240 unsigned int vixGetVersion(void) | 241 static unsigned int sis_get_version(void) |
241 { | 242 { |
242 return (VIDIX_VERSION); | 243 return (VIDIX_VERSION); |
243 } | 244 } |
244 | 245 |
245 static int find_chip(unsigned chip_id) | 246 static int find_chip(unsigned chip_id) |
250 return i; | 251 return i; |
251 } | 252 } |
252 return -1; | 253 return -1; |
253 } | 254 } |
254 | 255 |
255 int vixProbe(int verbose, int force) | 256 static int sis_probe(int verbose, int force) |
256 { | 257 { |
257 pciinfo_t lst[MAX_PCI_DEVICES]; | 258 pciinfo_t lst[MAX_PCI_DEVICES]; |
258 unsigned i, num_pci; | 259 unsigned i, num_pci; |
259 int err; | 260 int err; |
260 | 261 |
341 } | 342 } |
342 | 343 |
343 return err; | 344 return err; |
344 } | 345 } |
345 | 346 |
346 int vixInit(void) | 347 static int sis_init(void) |
347 { | 348 { |
348 uint8_t sr_data, cr_data, cr_data2; | 349 uint8_t sr_data, cr_data, cr_data2; |
349 char *env_overlay_crt; | 350 char *env_overlay_crt; |
350 | 351 |
351 if (!sis_probed) { | 352 if (!sis_probed) { |
404 } | 405 } |
405 | 406 |
406 return 0; | 407 return 0; |
407 } | 408 } |
408 | 409 |
409 void vixDestroy(void) | 410 static void sis_destroy(void) |
410 { | 411 { |
411 /* unmap_phys_mem(sis_reg_base, 0x20000); */ | 412 /* unmap_phys_mem(sis_reg_base, 0x20000); */ |
412 /* JCP: see above, hence also a hack. */ | 413 /* JCP: see above, hence also a hack. */ |
413 unmap_phys_mem(sis_mem_base, 0x1000000); | 414 unmap_phys_mem(sis_mem_base, 0x1000000); |
414 } | 415 } |
415 | 416 |
416 int vixGetCapability(vidix_capability_t * to) | 417 static int sis_get_caps(vidix_capability_t * to) |
417 { | 418 { |
418 memcpy(to, &sis_cap, sizeof(vidix_capability_t)); | 419 memcpy(to, &sis_cap, sizeof(vidix_capability_t)); |
419 return 0; | 420 return 0; |
420 } | 421 } |
421 | 422 |
432 default: | 433 default: |
433 return 0; | 434 return 0; |
434 } | 435 } |
435 } | 436 } |
436 | 437 |
437 int vixQueryFourcc(vidix_fourcc_t * to) | 438 static int sis_query_fourcc(vidix_fourcc_t * to) |
438 { | 439 { |
439 if (is_supported_fourcc(to->fourcc)) { | 440 if (is_supported_fourcc(to->fourcc)) { |
440 to->depth = VID_DEPTH_8BPP | VID_DEPTH_16BPP | VID_DEPTH_32BPP; | 441 to->depth = VID_DEPTH_8BPP | VID_DEPTH_16BPP | VID_DEPTH_32BPP; |
441 to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK | VID_CAP_COLORKEY; | 442 to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK | VID_CAP_COLORKEY; |
442 return 0; | 443 return 0; |
593 setvideoreg(Index_VI_Saturation, 0x00); | 594 setvideoreg(Index_VI_Saturation, 0x00); |
594 } | 595 } |
595 } | 596 } |
596 } | 597 } |
597 | 598 |
598 int vixConfigPlayback(vidix_playback_t * info) | 599 static int sis_set_eq(const vidix_video_eq_t * eq); |
600 | |
601 static int sis_config_playback(vidix_playback_t * info) | |
599 { | 602 { |
600 SISOverlayRec overlay; | 603 SISOverlayRec overlay; |
601 int srcOffsetX = 0, srcOffsetY = 0; | 604 int srcOffsetX = 0, srcOffsetY = 0; |
602 int sx, sy; | 605 int sx, sy; |
603 int index = 0, iscrt2 = 0; | 606 int index = 0, iscrt2 = 0; |
820 | 823 |
821 set_format(&overlay); | 824 set_format(&overlay); |
822 | 825 |
823 set_colorkey(); | 826 set_colorkey(); |
824 | 827 |
825 vixPlaybackSetEq(&sis_equal); | 828 sis_set_eq(&sis_equal); |
826 | 829 |
827 /* set up video overlay registers */ | 830 /* set up video overlay registers */ |
828 set_overlay(&overlay, index); | 831 set_overlay(&overlay, index); |
829 | 832 |
830 /* prevent badness if bits are not at default setting */ | 833 /* prevent badness if bits are not at default setting */ |
835 setup mirror CRT2 */ | 838 setup mirror CRT2 */ |
836 | 839 |
837 return 0; | 840 return 0; |
838 } | 841 } |
839 | 842 |
840 int vixPlaybackOn(void) | 843 static int sis_playback_on(void) |
841 { | 844 { |
842 setvideoregmask(Index_VI_Control_Misc0, 0x02, 0x02); | 845 setvideoregmask(Index_VI_Control_Misc0, 0x02, 0x02); |
843 return 0; | 846 return 0; |
844 } | 847 } |
845 | 848 |
846 int vixPlaybackOff(void) | 849 static int sis_playback_off(void) |
847 { | 850 { |
848 unsigned char sridx, cridx; | 851 unsigned char sridx, cridx; |
849 sridx = inSISREG(SISSR); | 852 sridx = inSISREG(SISSR); |
850 cridx = inSISREG(SISCR); | 853 cridx = inSISREG(SISCR); |
851 close_overlay(); | 854 close_overlay(); |
853 outSISREG(SISCR, cridx); | 856 outSISREG(SISCR, cridx); |
854 | 857 |
855 return 0; | 858 return 0; |
856 } | 859 } |
857 | 860 |
858 int vixPlaybackFrameSelect(unsigned int frame) | 861 static int sis_frame_select(unsigned int frame) |
859 { | 862 { |
860 uint8_t data; | 863 uint8_t data; |
861 int index = 0; | 864 int index = 0; |
862 uint32_t PSY; | 865 uint32_t PSY; |
863 | 866 |
923 setvideoregmask(Index_VI_Control_Misc1, 0x00, 0x20); | 926 setvideoregmask(Index_VI_Control_Misc1, 0x00, 0x20); |
924 | 927 |
925 return 0; | 928 return 0; |
926 } | 929 } |
927 | 930 |
928 int vixGetGrKeys(vidix_grkey_t * grkey) | 931 static int sis_get_gkeys(vidix_grkey_t * grkey) |
929 { | 932 { |
930 memcpy(grkey, &sis_grkey, sizeof(vidix_grkey_t)); | 933 memcpy(grkey, &sis_grkey, sizeof(vidix_grkey_t)); |
931 return 0; | 934 return 0; |
932 } | 935 } |
933 | 936 |
934 int vixSetGrKeys(const vidix_grkey_t * grkey) | 937 static int sis_set_gkeys(const vidix_grkey_t * grkey) |
935 { | 938 { |
936 memcpy(&sis_grkey, grkey, sizeof(vidix_grkey_t)); | 939 memcpy(&sis_grkey, grkey, sizeof(vidix_grkey_t)); |
937 set_colorkey(); | 940 set_colorkey(); |
938 return 0; | 941 return 0; |
939 } | 942 } |
940 | 943 |
941 int vixPlaybackGetEq(vidix_video_eq_t * eq) | 944 static int sis_get_eq(vidix_video_eq_t * eq) |
942 { | 945 { |
943 memcpy(eq, &sis_equal, sizeof(vidix_video_eq_t)); | 946 memcpy(eq, &sis_equal, sizeof(vidix_video_eq_t)); |
944 return 0; | 947 return 0; |
945 } | 948 } |
946 | 949 |
947 int vixPlaybackSetEq(const vidix_video_eq_t * eq) | 950 static int sis_set_eq(const vidix_video_eq_t * eq) |
948 { | 951 { |
949 int br, sat, cr, hue; | 952 int br, sat, cr, hue; |
950 if (eq->cap & VEQ_CAP_BRIGHTNESS) | 953 if (eq->cap & VEQ_CAP_BRIGHTNESS) |
951 sis_equal.brightness = eq->brightness; | 954 sis_equal.brightness = eq->brightness; |
952 if (eq->cap & VEQ_CAP_CONTRAST) | 955 if (eq->cap & VEQ_CAP_CONTRAST) |
1556 data = getvideoreg(Index_VI_Key_Overlay_OP); | 1559 data = getvideoreg(Index_VI_Key_Overlay_OP); |
1557 data &= 0x0F; | 1560 data &= 0x0F; |
1558 setvideoreg(Index_VI_Key_Overlay_OP, data | (alpha << 4)); | 1561 setvideoreg(Index_VI_Key_Overlay_OP, data | (alpha << 4)); |
1559 } | 1562 } |
1560 #endif | 1563 #endif |
1564 | |
1565 VDXDriver sis_drv = { | |
1566 "sis", | |
1567 NULL, | |
1568 | |
1569 .probe = sis_probe, | |
1570 .get_version = sis_get_version, | |
1571 .get_caps = sis_get_caps, | |
1572 .query_fourcc = sis_query_fourcc, | |
1573 .init = sis_init, | |
1574 .destroy = sis_destroy, | |
1575 .config_playback = sis_config_playback, | |
1576 .playback_on = sis_playback_on, | |
1577 .playback_off = sis_playback_off, | |
1578 .frame_sel = sis_frame_select, | |
1579 .get_eq = sis_get_eq, | |
1580 .set_eq = sis_set_eq, | |
1581 .get_gkey = sis_get_gkeys, | |
1582 .set_gkey = sis_set_gkeys, | |
1583 }; |