Bug 68792

Summary: Problems during playback of h264 files using UVD and VLC on AMD E-350 CPU
Product: Mesa Reporter: Richard Van Den Boom <rvdb>
Component: Drivers/Gallium/r600Assignee: Default DRI bug account <dri-devel>
Status: RESOLVED MOVED QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: vlc -vvv output log
Proposed fix for #1
Proposed fix for #2
VLC-menue-Video image
VLC-menu-Input-Codecs image
New VLC log
dmesg DPM debug output

Description Richard Van Den Boom 2013-08-31 13:32:36 UTC
Created attachment 84971 [details]
vlc -vvv output log

I have a small system with a E350 CPU in it and try to use a recent git pull of VLC, mesa and xfree86-video-ati, on a 3.11rc6 kernel, to run with VDPAU and the UVD chip on the CPU.
VLC indeed manages to play H264 files in DVD resolution but :

1/ It seems to fail on color space matrix :

[0x7ffa0f00c288] vdpau_chroma filter debug: using video mixer sharpness feature
[0x7ffa0f00c288] vdpau_chroma filter error: video color space matrix failure: An invalid pointer was provided. Typically, this means that a NULL pointer was provided for an 'output' parameter.
[0x7ffa0f00c288] vdpau_chroma filter debug: using video mixer 7


2/ it regularly spits "vo messages like this :

[0x7ffa14001248] vdpau_display vout display debug: surface status: 2


3/ regularly, it spits "warning: picture is too late to be displayed (missing 113 ms)" messages

4/ regularly stalls with messages like this :

[CODE][0x7f08e0c1f3f8] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (pts_delay increased to 1000 ms
[0x7f08e0c1f3f8] main input error: ES_OUT_RESET_PCR called
[0x7f08a0001248] vdpau_display vout display debug: surface status: 2
[0x7f08d91e7188] main decoder warning: early picture skipped[/CODE]


On the same system, mplayer from 2013/08/19 plays the same file, using VDPAU and UVD (checked watching the CPU usage) fine.

I opened a bug on the VLC bug tracker (https://trac.videolan.org/vlc/ticket/9281) but according to them, the problem seems to come from the Galllium VDPAU state tracker as they should not get "surface status : 2" at this stage of their code (they obviously tested their VDPAU implementation using Nvidia binary driver, which does not use the VDPAU Gallium state tracker).
Mplayer doesn't seem to have problem here as it seems to not even try to support 
CSC matrix generation or decoder capabilities.

I'm sorry if this bug report is a bit of a mess. There may be several issues involved here, and some may be more VLC-related that mesa, but I don't know at all how to sort them out. 
The VLC devs at least seem to consider that the "surface status : 2" and CSC matrix generation problem are Gallium-related and need to be fixed before they can look into the problem if it's still there.
Comment 1 Grigori Goronzy 2013-10-06 12:19:00 UTC
Created attachment 87182 [details]
Proposed fix for #1

This patch should fix issue #1.
Comment 2 Grigori Goronzy 2013-10-08 17:20:36 UTC
Created attachment 87295 [details]
Proposed fix for #2

This patch should fix issue #2 and probably fixes the stalling, too. I can play the "killa sample" without lag with CPU clock fixed to 800 MHz now.
Comment 3 Christian König 2013-10-08 18:40:02 UTC
The patches look good to me. Have you already submitted them to the list?

If not please do so.

Christian.
Comment 4 Dieter Nützel 2013-10-09 14:50:44 UTC
With this landed, I get this with vlc on my RV730 AGP:

vlc /data/Filme/Serenity\ -\ HD\ DVD\ Trailer.mp4
VLC media player 2.1.0 Rincewind (revision 2.1.0-0-gedd8835)
[0x9a2ee58] main interface error: no suitable interface module
[0x99393f8] main libvlc error: interface "globalhotkeys,none" initialization failed
[0x99393f8] main libvlc: VLC wird mit dem Standard-Interface ausgeführt. Benutzen Sie 'cvlc', um VLC ohne Interface zu verwenden.
[0xb4930640] avcodec decoder: Using G3DVL VDPAU Driver Shared Library version 1.0 for hardware decoding.
[0xb4930640] avcodec decoder: Using G3DVL VDPAU Driver Shared Library version 1.0 for hardware decoding.
[0xb49402c0] main vout display error: Failed to resize display
[0x9c6b780] vdpau generic error: surface copy failure: No backend implementation could be loaded.
[0x9c6b780] vdpau generic error: surface copy failure: No backend implementation could be loaded.
[0x9c6b780] vdpau generic error: surface copy failure: No backend implementation could be loaded.
[-]

mplayer can...;-)

/opt/mesa> mplayer -vo vdpau /data/Filme/Serenity\ -\ HD\ DVD\ Trailer.mp4 
MPlayer dev-SVN-r35127-4.7-openSUSE Linux 12.3 (i586)-Packman (C) 2000-2012 MPlayer Team
Can't open joystick device /dev/input/js0: No such file or directory
Can't init input joystick
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Loading extension-related profile 'vo.vdpau'

Playing /data/Filme/Serenity - HD DVD Trailer.mp4.
libavformat version 54.25.104 (internal)
libavformat file format detected.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x8abc120]max_analyze_duration 5000000 reached at 5005000
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang und
[lavf] stream 2: video (mjpeg), -vid 1
VIDEO:  [H264]  1280x720  24bpp  23.976 fps  4674.1 kbps (570.6 kbyte/s)
Clip info:
 major_brand: isom
 minor_version: 1
 compatible_brands: isomavc1
 creation_time: 1937-04-23 22:52:15
 genre: Trailer
 artist: Universal Pictures
 title: Serenity - HD DVD Trailer
 date: 2005
Load subtitles in /data/Filme/
==========================================================================
Forced video codec: ffmpeg12vdpau
Forced video codec: ffwmv3vdpau
Forced video codec: ffvc1vdpau
Forced video codec: ffh264vdpau
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 54.54.100 (internal)
Selected video codec: [ffh264vdpau] vfm: ffmpeg (FFmpeg H.264 (VDPAU))
==========================================================================
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, s16le, 127.5 kbit/8.30% (ratio: 15942->192000)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
AO: [pulse] 48000Hz 2ch s16le (2 bytes per sample)
Starting playback...
[VD_FFMPEG] Trying pixfmt=0.
Movie-Aspect is undefined - no prescaling applied.
VO: [vdpau] 1280x720 => 1280x720 H.264 VDPAU acceleration 
[VD_FFMPEG] XVMC-accelerated MPEG-2.
A:   1.0 V:   1.0 A-V:  0.004 ct:  0.007   0/  0 465% 17%  0.6% 3 0 

Exiting... (Quit)
Inconsistency detected by ld.so: dl-close.c: 765: _dl_close: Assertion `map->l_init_called' failed!

But much better support, now.

Thank you!

-Dieter
Comment 5 Grigori Goronzy 2013-10-09 16:27:40 UTC
You have to enable VDPAU output as well. If you don't do that, in case the readback method is used, it won't work because the necessary format conversions have not been implemented yet (I'm working on it).
Comment 6 Dieter Nützel 2013-10-10 01:27:02 UTC
(In reply to comment #5)
> You have to enable VDPAU output as well.

Sorry, but where and how?
In VLC?
*.conf file?

> If you don't do that, in case the
> readback method is used,

I read something about it.
Can I disable 'readback method' as interrims solution?

> it won't work because the necessary format
> conversions have not been implemented yet (I'm working on it).

Go ahead ;-)
Comment 7 Grigori Goronzy 2013-10-10 11:22:36 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > You have to enable VDPAU output as well.
> 
> Sorry, but where and how?
> In VLC?
> *.conf file?
>

In preferences go to the "Video" tab and select VDPAU from the list of outputs.

> > If you don't do that, in case the
> > readback method is used,
> 
> I read something about it.
> Can I disable 'readback method' as interrims solution?
>

No, you can't disable it, it is required for non-VDPAU outputs.

> > it won't work because the necessary format
> > conversions have not been implemented yet (I'm working on it).
> 
> Go ahead ;-)

It's already finished, try this patch series:
http://lists.freedesktop.org/archives/mesa-dev/2013-October/046014.html

With that, readback works flawlessly.
Comment 8 Dieter Nützel 2013-10-11 02:33:42 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > (In reply to comment #5)
> > > You have to enable VDPAU output as well.
> > 
> > Sorry, but where and how?
> > In VLC?
> > *.conf file?
> >
> 
> In preferences go to the "Video" tab and select VDPAU from the list of
> outputs.

I didn't have VDPAU, there.
That's why I'm asking.
Have a look at my attachments.
VDPAU is only enable under "Input/Codecs".
Is my VLC version missing something?

> > > If you don't do that, in case the
> > > readback method is used,
> > 
> > I read something about it.
> > Can I disable 'readback method' as interrims solution?
> >
> 
> No, you can't disable it, it is required for non-VDPAU outputs.
> 
> > > it won't work because the necessary format
> > > conversions have not been implemented yet (I'm working on it).
> > 
> > Go ahead ;-)
> 
> It's already finished, try this patch series:
> http://lists.freedesktop.org/archives/mesa-dev/2013-October/046014.html
> 
> With that, readback works flawlessly.

With that I get only every several seconds one frame but good audio.

lib/gallium> vlc /data/Filme/Serenity\ -\ HD\ DVD\ Trailer.mp4
VLC media player 2.1.0 Rincewind (revision 2.1.0-0-gedd8835)
[0x8a94290] main interface error: no suitable interface module
[0x89973f8] main libvlc error: interface "globalhotkeys,none" initialization failed
[0x89973f8] main libvlc: VLC wird mit dem Standard-Interface ausgeführt. Benutzen Sie 'cvlc', um VLC ohne Interface zu verwenden.
[0xb4a306c0] avcodec decoder: Using G3DVL VDPAU Driver Shared Library version 1.0 for hardware decoding.
[0xb4a306c0] avcodec decoder: Using G3DVL VDPAU Driver Shared Library version 1.0 for hardware decoding.
[0xb4a402f0] main vout display error: Failed to resize display
[0xb4a306c0] avcodec decoder error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
[0xb4a306c0] avcodec decoder error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
[0xb4a306c0] avcodec decoder error: more than 5 seconds of late video -> dropping frame (computer too slow ?)
Comment 9 Dieter Nützel 2013-10-11 02:37:44 UTC
Created attachment 87417 [details]
VLC-menue-Video image
Comment 10 Dieter Nützel 2013-10-11 02:38:51 UTC
Created attachment 87418 [details]
VLC-menu-Input-Codecs image
Comment 11 Grigori Goronzy 2013-10-14 08:49:02 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > (In reply to comment #6)
> > > (In reply to comment #5)
> > > > You have to enable VDPAU output as well.
> > > 
> > > Sorry, but where and how?
> > > In VLC?
> > > *.conf file?
> > >
> > 
> > In preferences go to the "Video" tab and select VDPAU from the list of
> > outputs.
> 
> I didn't have VDPAU, there.
> That's why I'm asking.
> Have a look at my attachments.
> VDPAU is only enable under "Input/Codecs".
> Is my VLC version missing something?
>

Yes, you do not have VDPAU video output support enabled in your VLC build. You may need a newer version (>= 0.6) of libvdpau and recent VLC master.

> 
> With that I get only every several seconds one frame but good audio.
> 
> lib/gallium> vlc /data/Filme/Serenity\ -\ HD\ DVD\ Trailer.mp4
> VLC media player 2.1.0 Rincewind (revision 2.1.0-0-gedd8835)
> [0x8a94290] main interface error: no suitable interface module
> [0x89973f8] main libvlc error: interface "globalhotkeys,none" initialization
> failed
> [0x89973f8] main libvlc: VLC wird mit dem Standard-Interface ausgeführt.
> Benutzen Sie 'cvlc', um VLC ohne Interface zu verwenden.
> [0xb4a306c0] avcodec decoder: Using G3DVL VDPAU Driver Shared Library
> version 1.0 for hardware decoding.
> [0xb4a306c0] avcodec decoder: Using G3DVL VDPAU Driver Shared Library
> version 1.0 for hardware decoding.
> [0xb4a402f0] main vout display error: Failed to resize display
> [0xb4a306c0] avcodec decoder error: more than 5 seconds of late video ->
> dropping frame (computer too slow ?)
> [0xb4a306c0] avcodec decoder error: more than 5 seconds of late video ->
> dropping frame (computer too slow ?)
> [0xb4a306c0] avcodec decoder error: more than 5 seconds of late video ->
> dropping frame (computer too slow ?)

Please try again with latest Mesa, updated patches have been committed. I can play high-bitrate 1080p files without any framedrops and reasonable CPU load (~40-50%) on an E-450 now, even without VDPAU video output, which means that the inefficient readback path is used. With VDPAU video output enabled on VLC master, CPU usage is much lower.
Comment 12 Richard Van Den Boom 2013-11-19 06:38:29 UTC
Sorry for the delay.
I tried git pulls of libdrm, mesa, xf86-video-ati and vlc on the 10th of november, but still experiences hangs.
The film plays well for about 5 minutes and then hangs, no sound, then resume. It occurs at different moments with several plays, so it's not related to the film itself.
I've attached new logs from vlc, as well as the radeon kernel DPM debug output but I don't find them very helpful myself.
Please let me know what I can do to help debug this.
Comment 13 Richard Van Den Boom 2013-11-19 06:39:04 UTC
Created attachment 89448 [details]
New VLC log
Comment 14 Richard Van Den Boom 2013-11-19 06:39:36 UTC
Created attachment 89449 [details]
dmesg DPM debug output
Comment 15 russianneuromancer 2015-04-13 03:00:56 UTC
Can you please try to reproduce this with latest kernel, driver and VLC 2.2?
Comment 16 GitLab Migration User 2019-09-18 19:05:30 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/460.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.