Ticket #6366: mythtv-ivtv-dma.patch
File mythtv-ivtv-dma.patch, 3.9 KB (added by , 15 years ago) |
---|
-
mythtv/libs/libmythtv/videoout_ivtv.h
91 91 unsigned int driver_version; 92 92 bool has_v4l2_api; 93 93 bool has_pause_bug; 94 bool has_dma_write; 94 95 95 96 QMutex lock; 96 97 -
mythtv/libs/libmythtv/videoout_ivtv.cpp
120 120 fps(30000.0f/1001.0f), videoDevice("/dev/video16"), 121 121 driver_version(0), 122 122 has_v4l2_api(false), has_pause_bug(false), 123 has_dma_write(false), 123 124 124 125 mapped_offset(0), mapped_memlen(0), 125 126 mapped_mem(NULL), pixels(NULL), … … 171 172 172 173 VERBOSE(VB_PLAYBACK, LOC + "ClearOSD"); 173 174 175 int frame_size = osdbufsize; 176 177 if (!old_fb_ioctl) 178 { 179 ioctl(fbfd, FBIOPAN_DISPLAY, &priv->ivtvfb_var); 180 frame_size = priv->ivtvfb_var.xres_virtual * 181 priv->ivtvfb_var.yres * (priv->ivtvfb_var.bits_per_pixel / 8); 182 } 183 184 bzero(osdbuf_aligned, frame_size); 185 186 if (has_dma_write) 187 { 188 lseek(fbfd, 0, SEEK_SET); 189 if (write(fbfd, osdbuf_aligned, frame_size) < 0) 190 VERBOSE(VB_IMPORTANT, LOC_ERR + "Failed to write() osd" + ENO); 191 return; 192 } 193 174 194 struct ivtvfb_ioctl_dma_host_to_ivtv_args prep; 175 195 bzero(&prep, sizeof(prep)); 176 177 bzero(osdbuf_aligned, osdbufsize);178 196 prep.source = osdbuf_aligned; 179 197 prep.dest_offset = 0; 180 198 … … 193 211 } 194 212 else 195 213 { 196 prep.count = priv->ivtvfb_var.xres_virtual * 197 priv->ivtvfb_var.yres * (priv->ivtvfb_var.bits_per_pixel / 8); 214 prep.count = frame_size; 198 215 } 199 216 200 if (!old_fb_ioctl)201 ioctl(fbfd, FBIOPAN_DISPLAY, &priv->ivtvfb_var);202 203 217 int ret = ioctl(fbfd, fb_dma_ioctl, &prep); 204 218 if (ret < 0) 205 219 { … … 667 681 decoder_flush = false; 668 682 has_v4l2_api = (driver_version >= 0x010000); 669 683 has_pause_bug = (driver_version == 0x010000); 684 has_dma_write = (driver_version >= 0x010400); 670 685 671 686 VERBOSE(VB_GENERAL, LOC + QString("ivtv version %1.%2.%3") 672 687 .arg(driver_version >> 16) … … 895 910 return; 896 911 897 912 // The OSD surface needs to be updated... 898 struct ivtvfb_ioctl_dma_host_to_ivtv_args prep; 899 bzero(&prep, sizeof(prep)); 900 prep.source = osdbuf_aligned; 901 prep.count = video_dim.height() * stride; 913 int frame_size = video_dim.height() * stride; 902 914 903 915 // This shouldn't be here. OSD should be rendered correctly to start with 904 916 #ifdef WORDS_BIGENDIAN … … 906 918 unsigned int *osd_int = (unsigned int*) osdbuf_aligned; 907 919 if (!lastcleared) 908 920 { 909 for (b_index = 0, i_index = 0; b_index < prep.count;921 for (b_index = 0, i_index = 0; b_index < frame_size; 910 922 b_index += 4, i_index ++) 911 923 { 912 924 if (osd_int[i_index]) … … 924 936 if (!old_fb_ioctl) 925 937 ioctl(fbfd, FBIOPAN_DISPLAY, &priv->ivtvfb_var); 926 938 927 if (ioctl(fbfd, fb_dma_ioctl, &prep) < 0) 928 VERBOSE(VB_IMPORTANT, LOC_ERR + "Failed to process frame" + ENO); 939 if (has_dma_write) 940 { 941 lseek(fbfd, 0, SEEK_SET); 942 if (write(fbfd, osdbuf_aligned, frame_size) < 0) 943 VERBOSE(VB_IMPORTANT, LOC_ERR + "Failed to process frame" + ENO); 944 } 945 else 946 { 947 struct ivtvfb_ioctl_dma_host_to_ivtv_args prep; 948 bzero(&prep, sizeof(prep)); 949 prep.source = osdbuf_aligned; 950 prep.count = frame_size; 929 951 952 if (ioctl(fbfd, fb_dma_ioctl, &prep) < 0) 953 VERBOSE(VB_IMPORTANT, LOC_ERR + "Failed to process frame" + ENO); 954 } 930 955 if (!lastcleared) 931 956 SetAlpha(kAlpha_Local); 932 957 }