After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 771524 - GPU reset and pipeline hangs randomly when using low-power tune
GPU reset and pipeline hangs randomly when using low-power tune
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer-vaapi
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-09-16 10:08 UTC by Florent Thiéry
Modified: 2018-02-27 17:50 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Florent Thiéry 2016-09-16 10:08:14 UTC
OS: Arch
Kernel: 4.7.3-2-ARCH
libdrm 2.4.70
libva: 1.7.1
libva-intel-driver: 1.7.1
GPU: Intel Iris Pro 580 (Skull Canyon NUC)
Running headless (no xorg)
gstreamer-vaapi commit: 9afa0ce47169cc91aa212dcf7db375a64244c0ba

Running the following pipeline twice in a row (quickly) will result in the pipeline hanging randomly:

gst-launch-1.0 videotestsrc num-buffers=100 ! video/x-raw\,\ format\=\(string\)I420\,\ width\=\(int\)1920\,\ height\=\(int\)1080\,\ framerate\=\(fraction\)30/1 ! vaapih264enc tune=low-power ! fakesink silent=false -v

When this happens, the following gstreamer error is displayed: 

vaapiencode gstvaapiencode.c:210:gst_vaapiencode_default_alloc_buffer: invalid GstVaapiCodedBuffer size (0 bytes)

And in the kernel logs:
[ 6130.436724] [drm] stuck on bsd2 ring
[ 6130.437427] [drm] GPU HANG: ecode 9:3:0xcb79ffc4, in encoder:src [912], reason: Engine(s) hung, action: reset
[ 6130.437431] [drm] GPU hangs can indicate a bug anywhere in the entire gfx stack, including userspace.
[ 6130.437433] [drm] Please file a _new_ bug report on bugs.freedesktop.org against DRI -> DRM/Intel
[ 6130.437436] [drm] drm/i915 developers can then reassign to the right component if it's not a kernel issue.
[ 6130.437438] [drm] The gpu crash dump is required to analyze gpu hangs, so please always attach it.
[ 6130.437440] [drm] GPU crash dump saved to /sys/class/drm/card0/error
[ 6130.438994] drm/i915: Resetting chip after gpu hang
[ 6132.423434] [drm] RC6 on

[fthiery@skull gstreamer-benchmarks]$ gst-launch-1.0 videotestsrc num-buffers=100 ! video/x-raw\,\ format\=\(string\)I420\,\ width\=\(int\)1920\,\ height\=\(int\)1080\,\ framerate\=\(fraction\)30/1 ! vaapih264enc tune=low-power ! fakesink silent=false -v
libva info: VA-API version 0.39.2
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
libva info: VA-API version 0.39.2
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
Setting pipeline to PAUSED ...
libva info: VA-API version 0.39.2
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
Pipeline is PREROLLING ...
Got context from element 'vaapiencodeh264-0': gst.vaapi.Display=context, gst.vaapi.Display=(GstVaapiDisplay)NULL;
/GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1
/GstPipeline:pipeline0/GstVaapiEncodeH264:vaapiencodeh264-0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1
/GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = event   ******* (fakesink0:sink) E (type: stream-start (10254), GstEventStreamStart, stream-id=(string)f19a7558e50ff7c63fc4b3831013cb76, flags=(GstStreamFlags)GST_STREAM_FLAG_NONE, group-id=(uint)0;) 0xda30f0
/GstPipeline:pipeline0/GstVaapiEncodeH264:vaapiencodeh264-0.GstPad:src: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = event   ******* (fakesink0:sink) E (type: caps (12814), GstEventCaps, caps=(GstCaps)"video/x-h264\,\ stream-format\=\(string\)byte-stream\,\ alignment\=\(string\)au\,\ width\=\(int\)1920\,\ height\=\(int\)1080\,\ pixel-aspect-ratio\=\(fraction\)1/1\,\ framerate\=\(fraction\)30/1";) 0x7f3de8002830
/GstPipeline:pipeline0/GstFakeSink:fakesink0.GstPad:sink: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1
/GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = event   ******* (fakesink0:sink) E (type: segment (17934), GstEventSegment, segment=(GstSegment)"GstSegment, flags=(GstSegmentFlags)GST_SEGMENT_FLAG_NONE, rate=(double)1, applied-rate=(double)1, format=(GstFormat)GST_FORMAT_TIME, base=(guint64)0, offset=(guint64)0, start=(guint64)0, stop=(guint64)18446744073709551615, time=(guint64)0, position=(guint64)0, duration=(guint64)18446744073709551615;";) 0x7f3de80028a0
/GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = preroll   ******* 
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = chain   ******* (fakesink0:sink) (77009 bytes, dts: 0:00:00.000000000, pts: none, duration: 0:00:00.033333333, offset: -1, offset_end: -1, flags: 00000040 discont ) 0x7f3df00236d0
...
/GstPipeline:pipeline0/GstFakeSink:fakesink0: last-message = chain   ******* (fakesink0:sink) (77091 bytes, dts: 0:00:01.500000000, pts: 0:00:01.499999999, duration: 0:00:00.033333333, offset: -1, offset_end: -1, flags: 00002000 delta-unit ) 0x7f3df002a240
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:00.832002271
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
[fthiery@skull gstreamer-benchmarks]$ gst-launch-1.0 videotestsrc num-buffers=100 ! video/x-raw\,\ format\=\(string\)I420\,\ width\=\(int\)1920\,\ height\=\(int\)1080\,\ framerate\=\(fraction\)30/1 ! vaapih264enc tune=low-power ! fakesink silent=false -v
libva info: VA-API version 0.39.2
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
Setting pipeline to PAUSED ...
libva info: VA-API version 0.39.2
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
Pipeline is PREROLLING ...
Got context from element 'vaapiencodeh264-0': gst.vaapi.Display=context, gst.vaapi.Display=(GstVaapiDisplay)NULL;
/GstPipeline:pipeline0/GstVideoTestSrc:videotestsrc0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw, format=(string)I420, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1
/GstPipeline:pipeline0/GstVaapiEncodeH264:vaapiencodeh264-0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw, format=(string)I420, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, interlace-mode=(string)progressive, pixel-aspect-ratio=(fraction)1/1
^Chandling interrupt.
Interrupt: Stopping pipeline ...
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Comment 1 Florent Thiéry 2016-09-16 10:16:35 UTC
Full GPU info is: GPU: Intel Corporation Iris Pro Graphics 580 (rev 09) CPU: Intel(R) Core(TM) i7-6770HQ CPU @ 2.60GHz Intel(R) Skylake
Comment 2 sreerenj 2016-09-16 11:55:06 UTC
I can't reproduce it in my Skylake, HD graphcis 520..
Anyone else able to reproduce it?
Comment 3 Florent Thiéry 2016-09-16 14:35:10 UTC
Also reproduced on Iris Graphics 540

@sreerenj: did you try headless (as i'm using it) ? Like, run it from the console without xorg running
Comment 4 sreerenj 2016-09-16 15:19:55 UTC
(In reply to Florent Thiéry from comment #3)
> Also reproduced on Iris Graphics 540
> 
> @sreerenj: did you try headless (as i'm using it) ? Like, run it from the
> console without xorg running

Yes, tried with drm mode,,
VA-API version: 0.39 (libva 1.7.3.pre1)
Driver version: Intel i965 driver for Intel(R) Skylake - 1.7.2.pre1 (1.7.0-69-
g5a30370)
Kenel:4.7.0-rc5-4.4.7-rc5-drm-intel-nightly+ (git://anongit.freedesktop.org/drm-intel), not latest though..
libdrm: 2.4.67
Comment 5 Florent Thiéry 2016-09-16 15:24:08 UTC
My libva is older (1.7.1), should i try to upgrade ?
Comment 6 sreerenj 2016-09-16 15:30:59 UTC
(In reply to Florent Thiéry from comment #5)
> My libva is older (1.7.1), should i try to upgrade ?

I dont think it is related, but good to have the latest one...
Comment 7 Florent Thiéry 2016-09-16 15:53:32 UTC
Funny, same environment, does not happen with NUC6i3SYK (HD Graphics 520 (rev 07)
i3-6100U CPU @ 2.30GHz Intel(R) Skylake).

So it looks like it's only appearing on his big brothers
Comment 8 Florent Thiéry 2016-09-20 13:13:51 UTC
For what it's worth, it also happens under xorg.

Filed a bug on DRM/INTEL bugtracker: https://bugs.freedesktop.org/show_bug.cgi?id=97872
Comment 9 Florent Thiéry 2016-10-25 11:01:04 UTC
At first sight, the patch provided on the upstream libva bug fixes the issue.
Comment 10 sreerenj 2016-10-25 11:03:40 UTC
(In reply to Florent Thiéry from comment #9)
> At first sight, the patch provided on the upstream libva bug fixes the issue.

good, so waiting for your benchmarking ;)
Comment 11 Florent Thiéry 2016-10-25 12:49:43 UTC
Well, it's a bit confusing: even though it works, GT3e performance is 10% below GT2 (i measure only 132 fps 1080p for the i5 vs 146 fps for the i3 in low power mode).

Note that it's worse on the PG mode (non-low power mode), i get 20% less performance out of GT3e vs GT2 -- which should not be the cases since GT3 and GT4 are supposed to have more hardware capability (http://www.anandtech.com/show/9562/intels-skylake-gpu-analyzing-the-media-capabilities).

But overall, on GT3, FF mode is 50% faster than PG mode.

Should i file a separate bug for the fact that GT3e/GT4e is slower than GT2 ?
Comment 12 Florent Thiéry 2018-02-27 17:50:05 UTC
This did not happen to me anymore, i guess we can close this. In any case, this would be an external bug (libva/drm/kernel).