Bug 12814 (cx88-alsa) - Live TV with MythTV frontend produces garbled audio
Summary: Live TV with MythTV frontend produces garbled audio
Status: CLOSED OBSOLETE
Alias: cx88-alsa
Product: v4l-dvb
Classification: Unclassified
Component: cx88 (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: v4l-dvb_cx88
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-03 10:35 UTC by Mario DiNicola
Modified: 2012-05-30 14:30 UTC (History)
3 users (show)

See Also:
Kernel Version: 2.6.27.11.14 - i686 GNU/Linux
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Mario DiNicola 2009-03-03 10:35:53 UTC
Latest working kernel version: 
2.6.27.11.14

Earliest failing kernel version: 
2.6.22.16.23

Distribution: 
Ubuntu (Mythbuntu) 7.10 thru 8.10

Hardware Environment:

Tuner Card= Dvico Fusion HDTV5 Gold Plus. Only the analog input on the Fusion card is affected.

lspci

00:00.0 Host bridge: VIA Technologies, Inc. K8T800Pro Host Bridge
00:00.1 Host bridge: VIA Technologies, Inc. K8T800Pro Host Bridge
00:00.2 Host bridge: VIA Technologies, Inc. K8T800Pro Host Bridge
00:00.3 Host bridge: VIA Technologies, Inc. K8T800Pro Host Bridge
00:00.4 Host bridge: VIA Technologies, Inc. K8T800Pro Host Bridge
00:00.7 Host bridge: VIA Technologies, Inc. K8T800Pro Host Bridge
00:01.0 PCI bridge: VIA Technologies, Inc. VT8237 PCI bridge [K8T800/K8T890 South]
00:0a.0 Ethernet controller: Atheros Communications Inc. AR2413 802.11bg NIC (rev 01)
00:0b.0 Multimedia video controller: Conexant Systems, Inc. CX23880/1/2/3 PCI Video and Audio Decoder (rev 05)
00:0b.1 Multimedia controller: Conexant Systems, Inc. CX23880/1/2/3 PCI Video and Audio Decoder [Audio Port] (rev 05)
00:0b.2 Multimedia controller: Conexant Systems, Inc. CX23880/1/2/3 PCI Video and Audio Decoder [MPEG Port] (rev 05)
00:0c.0 Multimedia video controller: Conexant Systems, Inc. CX23880/1/2/3 PCI Video and Audio Decoder (rev 05)
00:0c.1 Multimedia controller: Conexant Systems, Inc. CX23880/1/2/3 PCI Video and Audio Decoder [Audio Port] (rev 05)
00:0c.2 Multimedia controller: Conexant Systems, Inc. CX23880/1/2/3 PCI Video and Audio Decoder [MPEG Port] (rev 05)
00:0f.0 IDE interface: VIA Technologies, Inc. VIA VT6420 SATA RAID Controller (rev 80)
00:0f.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06)
00:10.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)
00:10.1 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)
00:10.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)
00:10.3 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)
00:10.4 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 86)
00:11.0 ISA bridge: VIA Technologies, Inc. VT8237 ISA bridge [KT600/K8T800/K8T890 South]
00:11.5 Multimedia audio controller: VIA Technologies, Inc. VT8233/A/8235/8237 AC97 Audio Controller (rev 60)
00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration
00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map
00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller
00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control
01:00.0 VGA compatible controller: nVidia Corporation NV43 [GeForce 6200] (rev a2)

Software Environment: 
Mythbuntu 8.10 distro w/MythTV frontend/backend on same machine.

Problem Description:
When entering live tv with analog input a race condition occurs which distorts the audio. In an attempt to sync the audio MythTV drops video frames resulting in starting and stopping the video in rapid succession.

Steps to reproduce:
Attempt to watch live tv, error occurs giving the following dmesg output:

[ 2173.549236] cx88[1]: irq aud [0x1001] dn_risci1* dn_sync*
[ 2173.549242] cx88[1]: irq aud [0x1001] dn_risci1* dn_sync*
[ 2173.549245] cx88[1]/1: IRQ loop detected, disabling interrupts
[ 2173.553616] cx88[1]: irq aud [0x1001] dn_risci1* dn_sync*
[ 2173.588416] cx88[1]: irq aud [0x1101] dn_risci1* dnf_of dn_sync*

This pattern repeats indefinitely until I exit live tv, then try again which usually solves the problem. Error messages are from module cx88-alsa.

Additional information:
This particular bug is the same that occurred with a pcHDTV 5500 card and is discussed in this thread with some workaround patches:

http://www.pchdtv.com/forum/viewtopic.php?t=1466&start=15-

I've been available to fix the problem using a modified version of the irq patch listed in the thread with the current Mercurial sources:

--- old/cx88-alsa.c     2009-03-03 10:29:01.000000000 -0600
+++ new/cx88-alsa.c     2009-03-03 10:28:43.000000000 -0600
@@ -538,6 +538,7 @@ static int snd_cx88_card_trigger(struct
 static snd_pcm_uframes_t snd_cx88_pointer(struct snd_pcm_substream *substream)
 {
        snd_cx88_card_t *chip = snd_pcm_substream_chip(substream);
+       struct cx88_core *core=chip->core;
        struct snd_pcm_runtime *runtime = substream->runtime;
        u16 count;

@@ -549,6 +550,7 @@ static snd_pcm_uframes_t snd_cx88_pointe
 //     dprintk(2, "%s - count %d (+%u), period %d, frame %lu\n", __func__,
 //             count, new, count & (runtime->periods-1),
 //             runtime->period_size * (count & (runtime->periods-1)));
+       cx_set(MO_PCI_INTMSK, 0x02);
        return runtime->period_size * (count & (runtime->periods-1));
 }

This condition is reproducible with or without tainted modules, such as nvidia and fglrx, and has been occurring in ubuntu 7.10, 8.04, and 8.10. 

The bug also existed on my previous machine, which was a Intel Pentium 4 using a MSI TV@nywhere Master tuner card. Both the Dvico and MSI card uses the cx88 modules, which is the constant.

Since I'm not a developer I've been waiting for a fix to filter back from others since this bug seems to be well known. Please advise on next step you would like me to take.
Comment 1 Chase Douglas 2009-06-03 16:20:22 UTC
I would like to add a few of my own observations to this bug.

OS: Ubuntu Jaunty 9.04
Tuner card: pcHDTV 5500

I do not use the analog tuner on this card, only the digital tuner. However, this irq bug was killing my system performance. For example, when I would try to watch a recording from my hard drive using mplayer or mythtv it would sometimes begin to stutter, and this would sometimes worsen until the video ground to a halt. I noticed the irq messages in my dmesg and I found this patch through google. After applying it, the irq messages have gone away and my machine has restabilized.

To give an example of the performance drop, one time I had tried to watch a recording but my whole system seemed to hang. I was able to switch to a virtual terminal and run hdparm -t -T and I could not attain even 1 MB/s from my hard drive cached or buffered reads. Usually I get > 8000 MB/s cached and > 60 MB/s buffered reads.

I believe my performance hit was due to the fact that ahci shares an irq with cx88[1], the pcHDTV 5500 tuner, on my system. The following is the relevant irq line from /proc/interrupts:

 17:          0          0          0          0    3782002          0          0          0   IO-APIC-fasteoi   ahci, cx88[1], cx88[1], cx88[1]

Unfortunately, I don't have any extra PCI slots to swap cards around, and my motherboard does not support changing the default irq assignments.

I believe this patch should be evaluated for immediate inclusion into the kernel sources due to the potential performance impacts when the irq is shared with another system resource.

Note You need to log in before you can comment on or make changes to this bug.