[mythtv-users] [RFC] HD PVR kernel driver and mythtv patches
Alan Young
ayoung at teleport.com
Mon Jul 26 00:45:41 UTC 2010
I've been working with the HD PVR driver and mythtv for a couple of
months now to try to figure out why it does not work well. I've built a
set of patches for the hdpvr kernel driver and mythtv that seem to
address the many of the issues I've seen. I will say up front that
these changes make mythtv work much better for me. I'm sending these
changes out for comments (and if you are brave for your testing). :-)
The changes are not a cure all. And I know the mythtv patch needs
better than what I've done to it. I still have a couple of other issues
that need to be worked out (documented below).
The kernel patches:
01_hdpvr-control.patch - This patch removes a msleep in the
hdpvr_config_call function and adds some debugging to set option
functions. The debugging was added to see if the sets, particularly
set_audio, was or was not being called during recordings. The msleep
was removed as it made no sense as to why it is there.
02_hdpvr-core.patch - This patch changes the hard coded buffer sizes
and number of buffers to be module parameters. If not specified, the
parameters default to what was hard coded.
With this patch, I'm using a buffer size of 20480 and 15 buffers. The
20480 comes from some USB traces on Windows where the Hauppauge driver
is submitting buffers of 24064 bytes. When I tried that size on linux,
I saw in the host controller's /sys/kernel/debug/usb/ehci/<device>/async
display that they were being split into two URBs of 20480 and 3584 bytes
each. So I use 20480 as a larger size without the extra overhead of
splitting and reassembling. YMMV.
03_hdpvr-core.patch - This adds a display to show the firmware date
along with the firmware version. Hauppauge released several different
versions of firmware all with 0x12 as the version number. The date is
different in each, so displaying that may help ID issues.
04_hdpvr-core.patch - This checks the device bus speed at init time to
verify the device is in 2.0 high speed or better mode. If not it
displays a message. This should help warn if it has been plugged into a
1.x host or if other problems have dropped the device to low or full speed.
05_hdpvr-core.patch - This forces the audio defaults to SPDIF and AC3.
I'm not sure why this is needed, but it keeps sound from disappearing.
06_hdpvr-video.patch - This patch changes the bulk URB timeout that is
used to drain the buffers a stop from 1.25 seconds to .09 seconds. This
change was made based on USB traces of the Windows driver.
07_hdpvr-video.patch - This patch adds some error checking and displays
to the URB callback routine. It also sets the buffer to ready if the HD
PVR is streaming. Otherwise it sets it to available.
The checks are in the USB skeleton driver and other drivers. They were
added here to check for USB problems.
The status change was added to see if data was still being pulled in
when streaming is stopped. I'm not sure if this change helps or not at
this point.
08_hdpvr-video.patch - This patch adds some error checking to the start
streaming commands. It also adds a video info buffer leak fix from v4l2
tree.
09_hdpvr-video.patch - This patch and 02, 05 and 06 are what I think are
the core fixes. This patch changes the stop streaming function in a
couple of ways. The changes are to display the return code of the stop
streaming config call, the removal of a 5 ms sleep in the drain buffer
loop and the addition of call to stop the encoder after the buffers are
drained.
The mythtv patches - these are against .23 fixes svn 24486. Yeah, I
know its old but I needed to have things stable while figuring it all out.
10_libmythtv-analogsignalmonitor.patch - This (I admit) is a hack. It
bypasses a large chunk of the AnalogSignalMonitor::UpdateValues function.
11_libmythtv-devicereadbuffer_report.patch - This turns on the ring
buffer status reporting and increases the report frequency to 2 seconds.
12_libmythtv-mpegrecorder.patch - This adds some additional log messages
for tracing, a change to the polling time in ::WaitFor_HDPVR and another
hack to bypass a large chunk of ::WaitFor_HDPVR.
What's left...
- Clean up the myth patches to make better sense of what needs to be done
- Channel changing still is not perfect. I'll get some blue screen
flashes and sometimes garbage as the screen changes. I'm not sure why
this happens as the device is stopped and then restarted. I'm not sure
if still data in the device, or the driver's buffers or in the mythtv
ring buffer. It could also be that VDPAU (I use that for playback) has
some issues with packets that may not be complete during the change.
- Sometimes stuttering occurs when the channel is changed. I think
mythtv might be delaying to accumulate data in the ring buffer, but I'm
not sure.
- Sometimes after a channel change the audio is out of sync. It fixes
it self within a minute or so.
- Need to check to make sure the audio is really being setup right and
the forced default to SPDIF is not needed.
- I'm not sure the bulk receive process is the right way to go to stop
the HD PVR. I don't see this happening in the USB traces on the other
OS. It seems like that driver leaves the URBs active to clean up.
There might be a way to do that in the linux driver, but it needs some
careful work with the io->mutex lock.
- Still need to look at the 6611 and 6719 patches to see if they address
any of the above.
Alan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 01_hdpvr-control.patch
Type: text/x-patch
Size: 2675 bytes
Desc: not available
URL: <http://mythtv.org/pipermail/mythtv-users/attachments/20100725/5eff02f5/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 02_hdpvr-core.patch
Type: text/x-patch
Size: 2665 bytes
Desc: not available
URL: <http://mythtv.org/pipermail/mythtv-users/attachments/20100725/5eff02f5/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 03_hdpvr-core.patch
Type: text/x-patch
Size: 555 bytes
Desc: not available
URL: <http://mythtv.org/pipermail/mythtv-users/attachments/20100725/5eff02f5/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 04_hdpvr-core.patch
Type: text/x-patch
Size: 856 bytes
Desc: not available
URL: <http://mythtv.org/pipermail/mythtv-users/attachments/20100725/5eff02f5/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 05_hdpvr-core.patch
Type: text/x-patch
Size: 813 bytes
Desc: not available
URL: <http://mythtv.org/pipermail/mythtv-users/attachments/20100725/5eff02f5/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 06_hdpvr-video.patch
Type: text/x-patch
Size: 597 bytes
Desc: not available
URL: <http://mythtv.org/pipermail/mythtv-users/attachments/20100725/5eff02f5/attachment-0005.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 07_hdpvr-video.patch
Type: text/x-patch
Size: 2011 bytes
Desc: not available
URL: <http://mythtv.org/pipermail/mythtv-users/attachments/20100725/5eff02f5/attachment-0006.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 08_hdpvr-video.patch
Type: text/x-patch
Size: 1015 bytes
Desc: not available
URL: <http://mythtv.org/pipermail/mythtv-users/attachments/20100725/5eff02f5/attachment-0007.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 09_hdpvr-video.patch
Type: text/x-patch
Size: 1682 bytes
Desc: not available
URL: <http://mythtv.org/pipermail/mythtv-users/attachments/20100725/5eff02f5/attachment-0008.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 10_libmythtv-analogsignalmonitor.patch
Type: text/x-patch
Size: 705 bytes
Desc: not available
URL: <http://mythtv.org/pipermail/mythtv-users/attachments/20100725/5eff02f5/attachment-0009.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 11_libmythtv-devicereadbuffer_report.patch
Type: text/x-patch
Size: 961 bytes
Desc: not available
URL: <http://mythtv.org/pipermail/mythtv-users/attachments/20100725/5eff02f5/attachment-0010.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 12_libmythtv_mpegrecorder.patch
Type: text/x-patch
Size: 2591 bytes
Desc: not available
URL: <http://mythtv.org/pipermail/mythtv-users/attachments/20100725/5eff02f5/attachment-0011.bin>
More information about the mythtv-users
mailing list