diff options
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-yuv.c | 138 |
1 files changed, 72 insertions, 66 deletions
diff --git a/drivers/media/video/ivtv/ivtv-yuv.c b/drivers/media/video/ivtv/ivtv-yuv.c index 13c358242bbc..9091c4837bbc 100644 --- a/drivers/media/video/ivtv/ivtv-yuv.c +++ b/drivers/media/video/ivtv/ivtv-yuv.c | |||
@@ -857,95 +857,101 @@ void ivtv_yuv_work_handler (struct ivtv *itv) | |||
857 | 857 | ||
858 | static void ivtv_yuv_init (struct ivtv *itv) | 858 | static void ivtv_yuv_init (struct ivtv *itv) |
859 | { | 859 | { |
860 | struct yuv_playback_info *yi = &itv->yuv_info; | ||
861 | |||
860 | IVTV_DEBUG_YUV("ivtv_yuv_init\n"); | 862 | IVTV_DEBUG_YUV("ivtv_yuv_init\n"); |
861 | 863 | ||
862 | /* Take a snapshot of the current register settings */ | 864 | /* Take a snapshot of the current register settings */ |
863 | itv->yuv_info.reg_2834 = read_reg(0x02834); | 865 | yi->reg_2834 = read_reg(0x02834); |
864 | itv->yuv_info.reg_2838 = read_reg(0x02838); | 866 | yi->reg_2838 = read_reg(0x02838); |
865 | itv->yuv_info.reg_283c = read_reg(0x0283c); | 867 | yi->reg_283c = read_reg(0x0283c); |
866 | itv->yuv_info.reg_2840 = read_reg(0x02840); | 868 | yi->reg_2840 = read_reg(0x02840); |
867 | itv->yuv_info.reg_2844 = read_reg(0x02844); | 869 | yi->reg_2844 = read_reg(0x02844); |
868 | itv->yuv_info.reg_2848 = read_reg(0x02848); | 870 | yi->reg_2848 = read_reg(0x02848); |
869 | itv->yuv_info.reg_2854 = read_reg(0x02854); | 871 | yi->reg_2854 = read_reg(0x02854); |
870 | itv->yuv_info.reg_285c = read_reg(0x0285c); | 872 | yi->reg_285c = read_reg(0x0285c); |
871 | itv->yuv_info.reg_2864 = read_reg(0x02864); | 873 | yi->reg_2864 = read_reg(0x02864); |
872 | itv->yuv_info.reg_2870 = read_reg(0x02870); | 874 | yi->reg_2870 = read_reg(0x02870); |
873 | itv->yuv_info.reg_2874 = read_reg(0x02874); | 875 | yi->reg_2874 = read_reg(0x02874); |
874 | itv->yuv_info.reg_2898 = read_reg(0x02898); | 876 | yi->reg_2898 = read_reg(0x02898); |
875 | itv->yuv_info.reg_2890 = read_reg(0x02890); | 877 | yi->reg_2890 = read_reg(0x02890); |
876 | 878 | ||
877 | itv->yuv_info.reg_289c = read_reg(0x0289c); | 879 | yi->reg_289c = read_reg(0x0289c); |
878 | itv->yuv_info.reg_2918 = read_reg(0x02918); | 880 | yi->reg_2918 = read_reg(0x02918); |
879 | itv->yuv_info.reg_291c = read_reg(0x0291c); | 881 | yi->reg_291c = read_reg(0x0291c); |
880 | itv->yuv_info.reg_2920 = read_reg(0x02920); | 882 | yi->reg_2920 = read_reg(0x02920); |
881 | itv->yuv_info.reg_2924 = read_reg(0x02924); | 883 | yi->reg_2924 = read_reg(0x02924); |
882 | itv->yuv_info.reg_2928 = read_reg(0x02928); | 884 | yi->reg_2928 = read_reg(0x02928); |
883 | itv->yuv_info.reg_292c = read_reg(0x0292c); | 885 | yi->reg_292c = read_reg(0x0292c); |
884 | itv->yuv_info.reg_2930 = read_reg(0x02930); | 886 | yi->reg_2930 = read_reg(0x02930); |
885 | itv->yuv_info.reg_2934 = read_reg(0x02934); | 887 | yi->reg_2934 = read_reg(0x02934); |
886 | itv->yuv_info.reg_2938 = read_reg(0x02938); | 888 | yi->reg_2938 = read_reg(0x02938); |
887 | itv->yuv_info.reg_293c = read_reg(0x0293c); | 889 | yi->reg_293c = read_reg(0x0293c); |
888 | itv->yuv_info.reg_2940 = read_reg(0x02940); | 890 | yi->reg_2940 = read_reg(0x02940); |
889 | itv->yuv_info.reg_2944 = read_reg(0x02944); | 891 | yi->reg_2944 = read_reg(0x02944); |
890 | itv->yuv_info.reg_2948 = read_reg(0x02948); | 892 | yi->reg_2948 = read_reg(0x02948); |
891 | itv->yuv_info.reg_294c = read_reg(0x0294c); | 893 | yi->reg_294c = read_reg(0x0294c); |
892 | itv->yuv_info.reg_2950 = read_reg(0x02950); | 894 | yi->reg_2950 = read_reg(0x02950); |
893 | itv->yuv_info.reg_2954 = read_reg(0x02954); | 895 | yi->reg_2954 = read_reg(0x02954); |
894 | itv->yuv_info.reg_2958 = read_reg(0x02958); | 896 | yi->reg_2958 = read_reg(0x02958); |
895 | itv->yuv_info.reg_295c = read_reg(0x0295c); | 897 | yi->reg_295c = read_reg(0x0295c); |
896 | itv->yuv_info.reg_2960 = read_reg(0x02960); | 898 | yi->reg_2960 = read_reg(0x02960); |
897 | itv->yuv_info.reg_2964 = read_reg(0x02964); | 899 | yi->reg_2964 = read_reg(0x02964); |
898 | itv->yuv_info.reg_2968 = read_reg(0x02968); | 900 | yi->reg_2968 = read_reg(0x02968); |
899 | itv->yuv_info.reg_296c = read_reg(0x0296c); | 901 | yi->reg_296c = read_reg(0x0296c); |
900 | itv->yuv_info.reg_2970 = read_reg(0x02970); | 902 | yi->reg_2970 = read_reg(0x02970); |
901 | 903 | ||
902 | itv->yuv_info.v_filter_1 = -1; | 904 | yi->v_filter_1 = -1; |
903 | itv->yuv_info.v_filter_2 = -1; | 905 | yi->v_filter_2 = -1; |
904 | itv->yuv_info.h_filter = -1; | 906 | yi->h_filter = -1; |
905 | 907 | ||
906 | /* Set some valid size info */ | 908 | /* Set some valid size info */ |
907 | itv->yuv_info.osd_x_offset = read_reg(0x02a04) & 0x00000FFF; | 909 | yi->osd_x_offset = read_reg(0x02a04) & 0x00000FFF; |
908 | itv->yuv_info.osd_y_offset = (read_reg(0x02a04) >> 16) & 0x00000FFF; | 910 | yi->osd_y_offset = (read_reg(0x02a04) >> 16) & 0x00000FFF; |
909 | 911 | ||
910 | /* Bit 2 of reg 2878 indicates current decoder output format | 912 | /* Bit 2 of reg 2878 indicates current decoder output format |
911 | 0 : NTSC 1 : PAL */ | 913 | 0 : NTSC 1 : PAL */ |
912 | if (read_reg(0x2878) & 4) | 914 | if (read_reg(0x2878) & 4) |
913 | itv->yuv_info.decode_height = 576; | 915 | yi->decode_height = 576; |
914 | else | 916 | else |
915 | itv->yuv_info.decode_height = 480; | 917 | yi->decode_height = 480; |
916 | |||
917 | /* If no visible size set, assume full size */ | ||
918 | if (!itv->yuv_info.osd_vis_w) | ||
919 | itv->yuv_info.osd_vis_w = 720 - itv->yuv_info.osd_x_offset; | ||
920 | 918 | ||
921 | if (!itv->yuv_info.osd_vis_h) { | 919 | if (!itv->osd_info) { |
922 | itv->yuv_info.osd_vis_h = itv->yuv_info.decode_height - itv->yuv_info.osd_y_offset; | 920 | yi->osd_vis_w = 720 - yi->osd_x_offset; |
921 | yi->osd_vis_h = yi->decode_height - yi->osd_y_offset; | ||
923 | } else { | 922 | } else { |
924 | /* If output video standard has changed, requested height may | 923 | /* If no visible size set, assume full size */ |
925 | not be legal */ | 924 | if (!yi->osd_vis_w) |
926 | if (itv->yuv_info.osd_vis_h + itv->yuv_info.osd_y_offset > itv->yuv_info.decode_height) { | 925 | yi->osd_vis_w = 720 - yi->osd_x_offset; |
927 | IVTV_DEBUG_WARN("Clipping yuv output - fb size (%d) exceeds video standard limit (%d)\n", | 926 | |
928 | itv->yuv_info.osd_vis_h + itv->yuv_info.osd_y_offset, | 927 | if (!yi->osd_vis_h) |
929 | itv->yuv_info.decode_height); | 928 | yi->osd_vis_h = yi->decode_height - yi->osd_y_offset; |
930 | itv->yuv_info.osd_vis_h = itv->yuv_info.decode_height - itv->yuv_info.osd_y_offset; | 929 | else { |
930 | /* If output video standard has changed, requested height may | ||
931 | not be legal */ | ||
932 | if (yi->osd_vis_h + yi->osd_y_offset > yi->decode_height) { | ||
933 | IVTV_DEBUG_WARN("Clipping yuv output - fb size (%d) exceeds video standard limit (%d)\n", | ||
934 | yi->osd_vis_h + yi->osd_y_offset, | ||
935 | yi->decode_height); | ||
936 | yi->osd_vis_h = yi->decode_height - yi->osd_y_offset; | ||
937 | } | ||
931 | } | 938 | } |
932 | } | 939 | } |
933 | 940 | ||
934 | /* We need a buffer for blanking when Y plane is offset - non-fatal if we can't get one */ | 941 | /* We need a buffer for blanking when Y plane is offset - non-fatal if we can't get one */ |
935 | itv->yuv_info.blanking_ptr = kzalloc(720*16,GFP_KERNEL); | 942 | yi->blanking_ptr = kzalloc(720*16, GFP_KERNEL); |
936 | if (itv->yuv_info.blanking_ptr) { | 943 | if (yi->blanking_ptr) |
937 | itv->yuv_info.blanking_dmaptr = pci_map_single(itv->dev, itv->yuv_info.blanking_ptr, 720*16, PCI_DMA_TODEVICE); | 944 | yi->blanking_dmaptr = pci_map_single(itv->dev, yi->blanking_ptr, 720*16, PCI_DMA_TODEVICE); |
938 | } | ||
939 | else { | 945 | else { |
940 | itv->yuv_info.blanking_dmaptr = 0; | 946 | yi->blanking_dmaptr = 0; |
941 | IVTV_DEBUG_WARN ("Failed to allocate yuv blanking buffer\n"); | 947 | IVTV_DEBUG_WARN("Failed to allocate yuv blanking buffer\n"); |
942 | } | 948 | } |
943 | 949 | ||
944 | /* Enable YUV decoder output */ | 950 | /* Enable YUV decoder output */ |
945 | write_reg_sync(0x01, IVTV_REG_VDM); | 951 | write_reg_sync(0x01, IVTV_REG_VDM); |
946 | 952 | ||
947 | set_bit(IVTV_F_I_DECODING_YUV, &itv->i_flags); | 953 | set_bit(IVTV_F_I_DECODING_YUV, &itv->i_flags); |
948 | atomic_set(&itv->yuv_info.next_dma_frame,0); | 954 | atomic_set(&yi->next_dma_frame, 0); |
949 | } | 955 | } |
950 | 956 | ||
951 | int ivtv_yuv_prep_frame(struct ivtv *itv, struct ivtv_dma_frame *args) | 957 | int ivtv_yuv_prep_frame(struct ivtv *itv, struct ivtv_dma_frame *args) |