Segfault on XvMC + SMP (if two or more cores are enabled)

Bug #249203 reported by Vanessa Dannenberg
2
Affects Status Importance Assigned to Milestone
mythtv (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Background:

I just recently switched from Gentoo to Ubuntu Hardy, and have run into a few problems here and there. Most of them I have already solved, but at least one has me stumped: mythtv. I am currently using mythtv 0.21 as supplied by the Ubuntu repositories. My capture card, a Kworld ATSC-120, requires drivers from the linuxtv.org v4l-dvb repository. Thus, I picked up the latest kernel (2.6.25.2), and built it using the config file I was using in Gentoo. As I expected, the kernel works fine (including SMP support, as usual), and I can access my capture card through the DVB interface thanks to that v4l-dvb driver.

With that "custom" kernel being in place, I fetched the latest nVidia driver (173.14.09) from nvidia.com and installed it, figuring that the one in the Ubuntu repository would insist on building against an Ubuntu kernel rather than my "custom" one. As expected, the nVidia driver seems to work as it always has. OpenGL apps like Google Earth behave normally, 2D accel seems to work, and video-playing apps seem to work fine (as far as I can tell anyway).... Except mythtv.

My machine is based around an AMD 64x2 3800+ CPU with 1GB of RAM, a reasonably fast SATA hard disk (actual speeds of close to 50 MB/sec on writes, and upwards of 60 MB/sec reads), and an nVidia GeForce 6800 video card.

As per information I've read elsewhere, I have already edited /etc/X11/XvMCConfig so that it contains only this one line:

libXvMCNVIDIA_dynamic.so.1

If I do not change this from the default, I see an error about a missing symbol (probably generated by ld rather than mythfrontend), but as that has already been covered elsewhere, it need not be further addressed here.

On this setup, every type of standard-definition-sized video that I've tried seems to work fine in xine and mplayer, using about 20% of one core even at full screen. Ditto for my husband's box, which is identical but with a slower video card (an nVidia MX4000).

In order to play high definition video (i.e. from the ATSC side of my capture card), with mythtv, I need to use the "Standard XvMC" decoders, with the "xvmc-blit" video renderer, "ia44blend" for the OSD renderer (since nVidia dropped support for chromakeys), and bob deinterlacing. If I allow MythTV to use only one core for the decoder, the video stutters badly, the audio is choppy, and the actual video content is mildly corrupted near the bottom... a sort of "stretching" effect that looks like it only affects one of the two fields, similar to what you get if you play a VHS video tape with the tracking slightly off. The console output from the program in this instance looks like this:

==========
vanessa@rainbird:~$ mythfrontend
2008-07-16 15:11:54.932 Using runtime prefix = /usr, libdir = /usr/lib
2008-07-16 15:11:56.356 XScreenSaver support enabled
2008-07-16 15:11:56.356 DPMS is disabled.
2008-07-16 15:11:56.357 Empty LocalHostName.
2008-07-16 15:11:56.357 Using localhost value of rainbird
2008-07-16 15:11:56.377 New DB connection, total: 1
2008-07-16 15:11:56.385 Connected to database 'mythconverg' at host: localhost
2008-07-16 15:11:56.387 Closing DB connection named 'DBManager0'
2008-07-16 15:11:56.389 Total desktop dim: 2560x1024, over 2 screen[s].
2008-07-16 15:11:56.390 Screen 0 dim: 1280x1024.
2008-07-16 15:11:56.390 Screen 1 dim: 1280x1024.
2008-07-16 15:11:56.390 Primary screen 0.
2008-07-16 15:11:56.390 Connected to database 'mythconverg' at host: localhost
2008-07-16 15:11:56.394 Running in a window
2008-07-16 15:11:56.394 Using screen 1, 1280x1024 at 1280,0
2008-07-16 15:11:56.411 New DB connection, total: 2
2008-07-16 15:11:56.412 Connected to database 'mythconverg' at host: localhost
2008-07-16 15:11:56.419 mythfrontend version: 0.21.20080304-1 www.mythtv.org
2008-07-16 15:11:56.420 Enabled verbose msgs: important general
2008-07-16 15:11:56.553 Unable to parse themeinfo.xml for glass-wide
2008-07-16 15:11:56.554 The theme (glass-wide) is missing a themeinfo.xml file
2008-07-16 15:11:56.840 Unable to parse themeinfo.xml for glass-wide
2008-07-16 15:11:56.841 The theme (glass-wide) is missing a themeinfo.xml file
2008-07-16 15:11:57.323 Total desktop dim: 2560x1024, over 2 screen[s].
2008-07-16 15:11:57.323 Screen 0 dim: 1280x1024.
2008-07-16 15:11:57.323 Screen 1 dim: 1280x1024.
2008-07-16 15:11:57.323 Primary screen 0.
2008-07-16 15:11:57.324 Running in a window
2008-07-16 15:11:57.324 Using screen 1, 1280x1024 at 1280,0
2008-07-16 15:11:57.329 Switching to square mode (MythCenter)
2008-07-16 15:11:57.373 Using the OpenGL painter
2008-07-16 15:11:57.374 JoystickMenuClient Error: Joystick disabled - Failed to read /home/vanessa/.mythtv/joystickmenurc
mythtv: could not connect to socket
mythtv: No such file or directory
2008-07-16 15:11:57.374 lirc_init failed for mythtv, see preceding messages
2008-07-16 15:11:59.528 Loading from: /usr/share/mythtv/themes/MythCenter/base.xml
2008-07-16 15:11:59.612 Loading from: /usr/share/mythtv/themes/default/base.xml
2008-07-16 15:11:59.694 Registering Internal as a media playback plugin.
2008-07-16 15:12:00.440 Using NV NPOT texture extension
2008-07-16 15:12:03.384 Connecting to backend server: 127.0.0.1:6543 (try 1 of 5)
2008-07-16 15:12:03.386 Using protocol version 40
2008-07-16 15:12:03.396 TV: Attempting to change from None to WatchingLiveTV
2008-07-16 15:12:03.397 Using protocol version 40
2008-07-16 15:12:04.560 New DB connection, total: 3
2008-07-16 15:12:04.561 Connected to database 'mythconverg' at host: localhost
2008-07-16 15:12:04.604 NVP: Disabling Audio, params(-1,2,44100)
2008-07-16 15:12:04.648 VideoOutputXv: Desired video renderer 'xvmc-blit' not available.
                        codec 'None' makes 'xv-blit,xshm,opengl,xlib,' available, using 'xv-blit' instead.
2008-07-16 15:12:04.652 VideoOutputXv: XVideo Adaptor Name: 'NV17 Video Texture'
2008-07-16 15:12:04.727 OSD Theme Dimensions W: 640 H: 480
2008-07-16 15:12:05.247 TV: Changing from None to WatchingLiveTV
2008-07-16 15:12:05.255 Realtime priority would require SUID as root.
2008-07-16 15:12:05.354 OpenGLVideoSync()
2008-07-16 15:12:05.657 Video timing method: SGI OpenGL
2008-07-16 15:12:07.548 VideoOutputXv: XvMC Adaptor Name: 'NV17 Video Texture'
2008-07-16 15:12:07.927 VideoOutputXv: ProcessFrameXvMC: Tried to reuse frame but failed
2008-07-16 15:12:07.928 VideoOutputXv: ProcessFrameXvMC: Called without frame
2008-07-16 15:12:07.928 AFD: Opened codec 0x9a371e0, id(MPEG2VIDEO_XVMC) type(Video)
2008-07-16 15:12:07.928 AFD: codec AC3 has 6 channels
2008-07-16 15:12:07.930 AFD: Opened codec 0x9a37550, id(AC3) type(Audio)
2008-07-16 15:12:08.021 Opening audio device 'default'. ch 2(2) sr 48000
2008-07-16 15:12:08.021 Opening ALSA audio device 'default'.
2008-07-16 15:12:08.057 NVP: Enabling Audio
2008-07-16 15:12:08.086 XvMC: picture structure FRAME
2008-07-16 15:12:08.289 NVP: prebuffering pause
2008-07-16 15:12:08.371 NVP: prebuffering pause
2008-07-16 15:12:08.446 WriteAudio: buffer underrun
2008-07-16 15:12:08.454 NVP: prebuffering pause

[deleted a bunch of exact repeats]

2008-07-16 15:12:10.520 NVP: prebuffering pause
2008-07-16 15:12:10.547 WriteAudio: buffer underrun
2008-07-16 15:12:11.412 TV: Attempting to change from WatchingLiveTV to None
2008-07-16 15:12:11.421 ~OpenGLVideoSync() -- begin
2008-07-16 15:12:11.422 ~OpenGLVideoSync() -- middle
2008-07-16 15:12:11.423 ~OpenGLVideoSync() -- end
2008-07-16 15:12:11.854 TV: Changing from WatchingLiveTV to None
2008-07-16 15:13:06.381 Deleting UPnP client...
==========

However, if I allow two cores, with no other changes whatsoever, and then "Watch TV" again, it goes to the video display, displays the OSD, waits a moment while it acquires a channel lock, blacks the window again, and then segfaults, without ever displaying even one frame from the video stream. Here is the output from the controlling terminal in this case:

==========
vanessa@rainbird:~$ mythfrontend
2008-07-16 14:41:35.352 Using runtime prefix = /usr, libdir = /usr/lib
2008-07-16 14:41:36.776 XScreenSaver support enabled
2008-07-16 14:41:36.777 DPMS is active.
2008-07-16 14:41:36.777 Empty LocalHostName.
2008-07-16 14:41:36.778 Using localhost value of rainbird
2008-07-16 14:41:36.796 New DB connection, total: 1
2008-07-16 14:41:36.803 Connected to database 'mythconverg' at host: localhost
2008-07-16 14:41:36.806 Closing DB connection named 'DBManager0'
2008-07-16 14:41:36.808 Total desktop dim: 2560x1024, over 2 screen[s].
2008-07-16 14:41:36.808 Screen 0 dim: 1280x1024.
2008-07-16 14:41:36.809 Screen 1 dim: 1280x1024.
2008-07-16 14:41:36.809 Primary screen 0.
2008-07-16 14:41:36.809 Connected to database 'mythconverg' at host: localhost
2008-07-16 14:41:36.813 Running in a window
2008-07-16 14:41:36.813 Using screen 1, 1280x1024 at 1280,0
2008-07-16 14:41:36.834 New DB connection, total: 2
2008-07-16 14:41:36.836 Connected to database 'mythconverg' at host: localhost
2008-07-16 14:41:36.840 mythfrontend version: 0.21.20080304-1 www.mythtv.org
2008-07-16 14:41:36.840 Enabled verbose msgs: important general
2008-07-16 14:41:36.971 Unable to parse themeinfo.xml for glass-wide
2008-07-16 14:41:36.971 The theme (glass-wide) is missing a themeinfo.xml file
2008-07-16 14:41:37.262 Unable to parse themeinfo.xml for glass-wide
2008-07-16 14:41:37.262 The theme (glass-wide) is missing a themeinfo.xml file
2008-07-16 14:41:37.746 Total desktop dim: 2560x1024, over 2 screen[s].
2008-07-16 14:41:37.747 Screen 0 dim: 1280x1024.
2008-07-16 14:41:37.747 Screen 1 dim: 1280x1024.
2008-07-16 14:41:37.747 Primary screen 0.
2008-07-16 14:41:37.748 Running in a window
2008-07-16 14:41:37.748 Using screen 1, 1280x1024 at 1280,0
2008-07-16 14:41:37.753 Switching to square mode (MythCenter)
2008-07-16 14:41:37.797 Using the OpenGL painter
2008-07-16 14:41:37.798 JoystickMenuClient Error: Joystick disabled - Failed to read /home/vanessa/.mythtv/joystickmenurc
mythtv: could not connect to socket
mythtv: No such file or directory
2008-07-16 14:41:37.798 lirc_init failed for mythtv, see preceding messages
2008-07-16 14:41:39.979 Loading from: /usr/share/mythtv/themes/MythCenter/base.xml
2008-07-16 14:41:40.071 Loading from: /usr/share/mythtv/themes/default/base.xml
2008-07-16 14:41:40.147 Registering Internal as a media playback plugin.
2008-07-16 14:41:40.884 Using NV NPOT texture extension
2008-07-16 14:41:42.272 Connecting to backend server: 127.0.0.1:6543 (try 1 of 5)
2008-07-16 14:41:42.273 Using protocol version 40
2008-07-16 14:41:42.288 TV: Attempting to change from None to WatchingLiveTV
2008-07-16 14:41:42.290 Using protocol version 40
2008-07-16 14:41:43.642 DPMS Deactivated
2008-07-16 14:41:43.644 New DB connection, total: 3
2008-07-16 14:41:43.645 Connected to database 'mythconverg' at host: localhost
2008-07-16 14:41:43.678 NVP: Disabling Audio, params(-1,2,44100)
2008-07-16 14:41:43.719 VideoOutputXv: Desired video renderer 'xvmc-blit' not available.
                        codec 'None' makes 'xv-blit,xshm,opengl,xlib,' available, using 'xv-blit' instead.
2008-07-16 14:41:43.723 VideoOutputXv: XVideo Adaptor Name: 'NV17 Video Texture'
2008-07-16 14:41:43.787 OSD Theme Dimensions W: 640 H: 480
2008-07-16 14:41:44.482 TV: Changing from None to WatchingLiveTV
2008-07-16 14:41:44.490 Realtime priority would require SUID as root.
2008-07-16 14:41:44.590 OpenGLVideoSync()
2008-07-16 14:41:44.894 Video timing method: SGI OpenGL
2008-07-16 14:41:47.522 VideoOutputXv: XvMC Adaptor Name: 'NV17 Video Texture'
2008-07-16 14:41:48.176 VideoOutputXv: ProcessFrameXvMC: Tried to reuse frame but failed
2008-07-16 14:41:48.176 VideoOutputXv: ProcessFrameXvMC: Called without frame
2008-07-16 14:41:48.213 AFD Error: Could not open codec 0x93edca0, id(MPEG2VIDEO_XVMC) type(Video) aborting. reason -1
Segmentation fault
==========

This all used to work fine within Gentoo, using about 65-70% of total CPU (across both cores) to watch a full 1920x1080i stream with no crashes.

I can freely switch between one or two cores and repeat these two different error conditions with 100% reliability.

What should happen:

The video stream should play normally and mythfrontend shouldn't segfault :-)

Revision history for this message
Mario Limonciello (superm1) wrote : Re: [Bug 249203] [NEW] Segfault on XvMC + SMP (if two or more cores are enabled)
Download full text (13.2 KiB)

Do you by chance still have that gentoo install around somewhere to try to
further fine tune the comparison between the configs? There is a handful of
options in the mythtv database, nvidia settings rc, versions, compile flags,
tons of stuff that can boil down to be the root cause here.

If not, would you have a second hard drive that you could drop gentoo back
on to try to help isolate the exact issue?

On Wed, Jul 16, 2008 at 15:30, Vanessa Ezekowitz <email address hidden>
wrote:

> Public bug reported:
>
> Background:
>
> I just recently switched from Gentoo to Ubuntu Hardy, and have run into
> a few problems here and there. Most of them I have already solved, but
> at least one has me stumped: mythtv. I am currently using mythtv 0.21
> as supplied by the Ubuntu repositories. My capture card, a Kworld
> ATSC-120, requires drivers from the linuxtv.org v4l-dvb repository.
> Thus, I picked up the latest kernel (2.6.25.2), and built it using the
> config file I was using in Gentoo. As I expected, the kernel works fine
> (including SMP support, as usual), and I can access my capture card
> through the DVB interface thanks to that v4l-dvb driver.
>
> With that "custom" kernel being in place, I fetched the latest nVidia
> driver (173.14.09) from nvidia.com and installed it, figuring that the
> one in the Ubuntu repository would insist on building against an Ubuntu
> kernel rather than my "custom" one. As expected, the nVidia driver
> seems to work as it always has. OpenGL apps like Google Earth behave
> normally, 2D accel seems to work, and video-playing apps seem to work
> fine (as far as I can tell anyway).... Except mythtv.
>
> My machine is based around an AMD 64x2 3800+ CPU with 1GB of RAM, a
> reasonably fast SATA hard disk (actual speeds of close to 50 MB/sec on
> writes, and upwards of 60 MB/sec reads), and an nVidia GeForce 6800
> video card.
>
> As per information I've read elsewhere, I have already edited
> /etc/X11/XvMCConfig so that it contains only this one line:
>
> libXvMCNVIDIA_dynamic.so.1
>
> If I do not change this from the default, I see an error about a missing
> symbol (probably generated by ld rather than mythfrontend), but as that
> has already been covered elsewhere, it need not be further addressed
> here.
>
> On this setup, every type of standard-definition-sized video that I've
> tried seems to work fine in xine and mplayer, using about 20% of one
> core even at full screen. Ditto for my husband's box, which is
> identical but with a slower video card (an nVidia MX4000).
>
> In order to play high definition video (i.e. from the ATSC side of my
> capture card), with mythtv, I need to use the "Standard XvMC" decoders,
> with the "xvmc-blit" video renderer, "ia44blend" for the OSD renderer
> (since nVidia dropped support for chromakeys), and bob deinterlacing.
> If I allow MythTV to use only one core for the decoder, the video
> stutters badly, the audio is choppy, and the actual video content is
> mildly corrupted near the bottom... a sort of "stretching" effect that
> looks like it only affects one of the two fields, similar to what you
> get if you play a VHS video tape with the tracking slightly off. ...

Revision history for this message
laga (laga) wrote :

Mario Limonciello schrieb:
> Do you by chance still have that gentoo install around somewhere to try to
> further fine tune the comparison between the configs? There is a handful of
> options in the mythtv database, nvidia settings rc, versions, compile flags,
> tons of stuff that can boil down to be the root cause here.
>
> If not, would you have a second hard drive that you could drop gentoo back
> on to try to help isolate the exact issue?
>

Maybe try getting a backtrace first?

I think that multithreaded decoding is not supported with XvMC...

Revision history for this message
Vanessa Dannenberg (vanessadannenberg) wrote :

Well after much finagling I was able to get a fresh Gentoo 2008.0 install onto my disk alongside Ubuntu. Using the nVidia driver supplied by the repository (same version as in Ubuntu), along with my custom kernel and the v4l-dvb repository.

I was able to get around the audio write errors above by explicitly setting my audio device in Mythtv to /dev/dsp and making sure KDE/aRTS was set to release the sound card after a few seconds. Same setting on both distros.

However, the stream of "prebuffering pause" messages still persists only under Ubuntu - the Gentoo side seemed more or less devoid of these messages and the video was as smooth as I normally expected it to be. Any amount of activity (such as a window gaining or losing focus) here on the Ubuntu side will set off a stream of those messages, the video and audio still get a little choppy, and if it gets too severe, mythfrontend segfaults. I might be able to avoid this by enabling realtime priority, but the last time I did that, it caused a hard lock.

It seems that the XvMC multi-core crash exists on Gentoo as well (odd, I could have sworn I used it before). I guess that technically makes this bug report invalid.

Revision history for this message
Vanessa Dannenberg (vanessadannenberg) wrote :

Oh, and you can ignore the "stretching at the bottom like VHS tracking" effect... Turns out that is something one particular channel is transmitting, and not an error in mythtv or ubuntu. Someone needs to fire that station's engineer. :-)

Revision history for this message
Mario Limonciello (superm1) wrote :

Well so after reading this, the initial big report is indeed invalid.
I would still like to narrow down why ubuntu is more suceptible to
these types of prebuffering issues in the first place. Could you post
you compilation flags? That's as good a place as any to start. Also, I
am assuming same window manager and all right?

On 07/18/2008, Vanessa Ezekowitz <email address hidden> wrote:
> Well after much finagling I was able to get a fresh Gentoo 2008.0
> install onto my disk alongside Ubuntu. Using the nVidia driver supplied
> by the repository (same version as in Ubuntu), along with my custom
> kernel and the v4l-dvb repository.
>
> I was able to get around the audio write errors above by explicitly
> setting my audio device in Mythtv to /dev/dsp and making sure KDE/aRTS
> was set to release the sound card after a few seconds. Same setting on
> both distros.
>
> However, the stream of "prebuffering pause" messages still persists only
> under Ubuntu - the Gentoo side seemed more or less devoid of these
> messages and the video was as smooth as I normally expected it to be.
> Any amount of activity (such as a window gaining or losing focus) here
> on the Ubuntu side will set off a stream of those messages, the video
> and audio still get a little choppy, and if it gets too severe,
> mythfrontend segfaults. I might be able to avoid this by enabling
> realtime priority, but the last time I did that, it caused a hard lock.
>
> It seems that the XvMC multi-core crash exists on Gentoo as well (odd, I
> could have sworn I used it before). I guess that technically makes this
> bug report invalid.
>
> --
> Segfault on XvMC + SMP (if two or more cores are enabled)
> https://bugs.launchpad.net/bugs/249203
> You received this bug notification because you are a member of MythTV
> Ubuntu Maintainers, which is subscribed to mythtv in ubuntu.
>

--
Sent from Gmail for mobile | mobile.google.com

Mario Limonciello
<email address hidden>

Revision history for this message
Vanessa Dannenberg (vanessadannenberg) wrote :

Both systems are using KDE 3.5.9 and generally everything is as close to the same as I could manage. I guess by "compilation flags" you mean my /etc/make.conf and the output of emerge --info? Attached.

Revision history for this message
Vanessa Dannenberg (vanessadannenberg) wrote :
Revision history for this message
Vanessa Dannenberg (vanessadannenberg) wrote :

An update to this: it seems that it would be just my luck that as soon as I say it works in Gentoo, it turns out that it's just as bad there as under Ubuntu. Something must have changed in Gentoo without me noticing it, so whatever is wrong is clearly a Mythtv bug upstream, or possibly a bug in my video card driver (gee, there's a surprise!). Suggest closing this bug as invalid.

Revision history for this message
laga (laga) wrote :

Rejecting as invalid as suggested by the OP.

Besides, there is no backtrace which makes me a sad panda.

Changed in mythtv:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.