Skip to content

Instantly share code, notes, and snippets.

@ChristophHaag
Created September 6, 2016 21:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChristophHaag/a6b69563109a559b1e07d03a02e2ec9a to your computer and use it in GitHub Desktop.
Save ChristophHaag/a6b69563109a559b1e07d03a02e2ec9a to your computer and use it in GitHub Desktop.
avconv vaSyncSurface removed
LIBVA_DRIVER_NAME=radeonsi gdb --args avconv -v debug -vaapi_device /dev/dri/renderD128 -i big_buck_bunny_720p_1mb.mp4 -vf 'format=nv12,hwupload' -c:v h264_vaapi output.mkv
GNU gdb (GDB) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from avconv...(no debugging symbols found)...done.
(gdb) r
Starting program: /usr/bin/avconv -v debug -vaapi_device /dev/dri/renderD128 -i big_buck_bunny_720p_1mb.mp4 -vf format=nv12,hwupload -c:v h264_vaapi output.mkv
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
avconv version v12_dev0-3170-g0e5dde7, Copyright (c) 2000-2016 the Libav developers
built on Sep 6 2016 23:57:13 with gcc 6.2.1 (GCC) 20160830
configuration: --prefix=/usr --enable-openssl --enable-nonfree --enable-vaapi --enable-omx --enable-libopus --enable-libpulse --enable-libx264 --enable-gpl
libavutil 55. 21. 0 / 55. 21. 0
libavcodec 57. 26. 0 / 57. 26. 0
libavformat 57. 7. 1 / 57. 7. 1
libavdevice 56. 1. 0 / 56. 1. 0
libavfilter 6. 7. 0 / 6. 7. 0
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 0. 0 / 4. 0. 0
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set libav* logging level) with argument 'debug'.
Reading option '-vaapi_device' ... matched as option 'vaapi_device' (set VAAPI hardware device (DRM path or X11 display name)) with argument '/dev/dri/renderD128'.
Reading option '-i' ... matched as input file with argument 'big_buck_bunny_720p_1mb.mp4'.
Reading option '-vf' ... matched as option 'vf' (video filters) with argument 'format=nv12,hwupload'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'h264_vaapi'.
Reading option 'output.mkv' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set libav* logging level) with argument debug.
Applying option vaapi_device (set VAAPI hardware device (DRM path or X11 display name)) with argument /dev/dri/renderD128.
[AVHWDeviceContext @ 0x55555684e7e0] Opened VA display via DRM device /dev/dri/renderD128.
libva info: VA-API version 0.39.2
libva info: va_getDriverName() returns -1
libva info: User requested driver 'radeonsi'
libva info: Trying to open /usr/lib/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_0_39
[New Thread 0x7fffec51b700 (LWP 30639)]
[New Thread 0x7fffebb15700 (LWP 30640)]
[New Thread 0x7fffeb314700 (LWP 30641)]
[New Thread 0x7fffeab13700 (LWP 30642)]
[New Thread 0x7fffea312700 (LWP 30643)]
libva info: va_openDriver() returns 0
[AVHWDeviceContext @ 0x55555684e7e0] Initialised VAAPI connection: version 0.39
[AVHWDeviceContext @ 0x55555684e7e0] Format 0x3231564e -> nv12.
[AVHWDeviceContext @ 0x55555684e7e0] Format 0x32315659 -> yuv420p.
[AVHWDeviceContext @ 0x55555684e7e0] Format 0x56595559 -> unknown.
[AVHWDeviceContext @ 0x55555684e7e0] Format 0x59565955 -> uyvy422.
[AVHWDeviceContext @ 0x55555684e7e0] Format 0x41524742 -> bgra.
[AVHWDeviceContext @ 0x55555684e7e0] Format 0x41424752 -> rgba.
[AVHWDeviceContext @ 0x55555684e7e0] Format 0x58524742 -> unknown.
[AVHWDeviceContext @ 0x55555684e7e0] Format 0x58424752 -> unknown.
[AVHWDeviceContext @ 0x55555684e7e0] Unknown driver "mesa gallium vaapi", assuming standard behaviour.
Successfully parsed a group of options.
Parsing a group of options: input file big_buck_bunny_720p_1mb.mp4.
Successfully parsed a group of options.
Opening an input file: big_buck_bunny_720p_1mb.mp4.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55555690ea20] Probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55555690ea20] ISO: File Type Major Brand: isom
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55555690ea20] Unknown dref type 0x08206c7275 size 12
Last message repeated 1 times
[h264 @ 0x555556878280] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x555556878280] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x555556878280] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x555556878280] Reinit context to 1280x720, pix_fmt: 0
[h264 @ 0x555556878280] nal_unit_type: 1, nal_ref_idc: 2
Last message repeated 4 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55555690ea20] All info found
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'big_buck_bunny_720p_1mb.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.24.2
Duration: 00:00:05.31, start: 0.000000, bitrate: 1589 kb/s
Stream #0:0(und), 20, 1/12800: Video: h264 (Main) [avc1 / 0x31637661]
yuv420p, left, 1280x720 (0x0) [PAR 1:1 DAR 16:9], 0/1, 1205 kb/s
25 fps, 12800 tbn (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
Stream #0:1(und), 37, 1/48000: Audio: aac (LC) [mp4a / 0x6134706D]
48000 Hz, 5.1, fltp, 384 kb/s (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : SoundHandler
Successfully opened the file.
Parsing a group of options: output file output.mkv.
Applying option vf (video filters) with argument format=nv12,hwupload.
Applying option c:v (codec name) with argument h264_vaapi.
Successfully parsed a group of options.
Opening an output file: output.mkv.
File 'output.mkv' already exists. Overwrite ? [y/N] y
Successfully opened the file.
[h264 @ 0x555556911b80] detected 4 logical cores
[h264 @ 0x555556915c00] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x555556915c00] nal_unit_type: 8, nal_ref_idc: 3
[New Thread 0x7fffe9b11700 (LWP 30644)]
[New Thread 0x7fffe9310700 (LWP 30645)]
[New Thread 0x7fffe8b0f700 (LWP 30646)]
[New Thread 0x7fffdbfff700 (LWP 30647)]
[New Thread 0x7fffdb7fe700 (LWP 30648)]
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_vaapi))
Stream #0:1 -> #0:1 (aac (native) -> ac3 (native))
Press ctrl-c to stop encoding
Detected 4 logical cores.
[New Thread 0x7fffdaffd700 (LWP 30649)]
[New Thread 0x7fffda7fc700 (LWP 30650)]
[New Thread 0x7fffd9ffb700 (LWP 30651)]
[New Thread 0x7fffd97fa700 (LWP 30652)]
[New Thread 0x7fffd8ff9700 (LWP 30653)]
[abuffer @ 0x55555695da20] tb:1/48000 samplefmt:(null) samplerate: 48000 ch layout:(null)
[abuffersink @ 0x55555684e3a0] auto-inserting filter 'auto-inserted fifo 0' between the filter 'audio format for output stream 0:1' and the filter 'output stream 0:1'
[h264 @ 0x555556915c00] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x555556915c00] Reinit context to 1280x720, pix_fmt: 0
[h264 @ 0x555556bf3fc0] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 0x555556bb6720] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 0x555556acef20] nal_unit_type: 1, nal_ref_idc: 2
[h264 @ 0x555556a94080] nal_unit_type: 1, nal_ref_idc: 2
Detected 4 logical cores.
[New Thread 0x7fffbffff700 (LWP 30654)]
[New Thread 0x7fffbf7fe700 (LWP 30655)]
[New Thread 0x7fffbeffd700 (LWP 30656)]
[New Thread 0x7fffbe7fc700 (LWP 30657)]
[New Thread 0x7fffbdffb700 (LWP 30658)]
[buffer @ 0x555556bf5c40] w:1280 h:720 pixfmt:yuv420p tb:1/12800 sar:1/1
[buffersink @ 0x555556bf67e0] auto-inserting filter 'auto-inserted fifo 0' between the filter 'format' and the filter 'output stream 0:0'
[format @ 0x555556a61a00] auto-inserting filter 'auto-inserted scaler 0' between the filter 'graph 0 input from stream 0:0' and the filter 'Parsed filter 0 format'
[scale @ 0x555556d65880] w:1280 h:720 fmt:yuv420p -> w:1280 h:720 fmt:nv12 flags:0x4
[hwupload @ 0x555556bf6080] Surface format is nv12.
[AVHWFramesContext @ 0x555556ad0da0] Created surface 0x1.
[AVHWFramesContext @ 0x555556ad0da0] Direct mapping disabled: deriving image does not work: 22 (invalid VAImageFormat).
[h264_vaapi @ 0x5555569698a0] Using fixed QP = 20 / 20 / 24 for IDR- / P- / B-frames.
[h264_vaapi @ 0x5555569698a0] Using nv12 as format of reconstructed frames.
[AVHWFramesContext @ 0x555556d6ea80] Created surface 0x3.
[AVHWFramesContext @ 0x555556d6ea80] Direct mapping disabled: deriving image does not work: 22 (invalid VAImageFormat).
[AVHWFramesContext @ 0x555556d6ea80] Created surface 0x4.
[AVHWFramesContext @ 0x555556d6ea80] Created surface 0x5.
[AVHWFramesContext @ 0x555556d6ea80] Created surface 0x6.
[AVHWFramesContext @ 0x555556d6ea80] Created surface 0x7.
[AVHWFramesContext @ 0x555556d6ea80] Created surface 0x8.
[AVHWFramesContext @ 0x555556d6ea80] Created surface 0x9.
[AVHWFramesContext @ 0x555556d6ea80] Created surface 0xa.
[AVHWFramesContext @ 0x555556d6ea80] Created surface 0xb.
[AVHWFramesContext @ 0x555556d6ea80] Created surface 0xc.
[AVHWFramesContext @ 0x555556d6ea80] Created surface 0xd.
[AVHWFramesContext @ 0x555556d6ea80] Created surface 0xe.
[AVHWFramesContext @ 0x555556d6ea80] Created surface 0xf.
[AVHWFramesContext @ 0x555556d6ea80] Created surface 0x10.
[AVHWFramesContext @ 0x555556d6ea80] Created surface 0x11.
[AVHWFramesContext @ 0x555556d6ea80] Created surface 0x12.
[AVHWFramesContext @ 0x555556d6ea80] Created surface 0x13.
[AVHWFramesContext @ 0x555556d6ea80] Created surface 0x14.
[AVHWFramesContext @ 0x555556d6ea80] Created surface 0x15.
[AVHWFramesContext @ 0x555556d6ea80] Created surface 0x16.
Output #0, matroska, to 'output.mkv':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf57.7.1
Stream #0:0(und), 0, 1/1000: Video: h264 (High) [H264 / 0x34363248]
vaapi_vld, left, 1280x720 (0x0) [PAR 1:1 DAR 16:9], 0/1, q=2-31, PAR 1:1 DAR 16:9
1k tbn (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
encoder : Lavc57.26.0 h264_vaapi
Stream #0:1(und), 0, 1/1000: Audio: ac3 [[0] [0][0] / 0x2000]
48000 Hz, 5.1, fltp, 448 kb/s (default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : SoundHandler
encoder : Lavc57.26.0 ac3
[AVHWFramesContext @ 0x555556ad0da0] Map surface 0x1.
[AVHWFramesContext @ 0x555556ad0da0] Unmap surface 0x1.
[h264_vaapi @ 0x5555569698a0] Encode frame: 1280x720 (0).
[h264_vaapi @ 0x5555569698a0] Issuing encode for pic 0/0 as type IDR.
[h264_vaapi @ 0x5555569698a0] No reference pictures.
[h264_vaapi @ 0x5555569698a0] Input surface is 0x1.
[h264_vaapi @ 0x5555569698a0] Recon surface is 0x16.
[h264_vaapi @ 0x5555569698a0] Allocated output buffer 0x18
[h264_vaapi @ 0x5555569698a0] Output buffer is 0x18.
[h264_vaapi @ 0x5555569698a0] Param buffer (22) is 0x19.
[h264_vaapi @ 0x5555569698a0] Param buffer (23) is 0x1a.
[h264_vaapi @ 0x5555569698a0] Packed header buffer (1) is 0x1b/0x1c (280 bits).
[h264_vaapi @ 0x5555569698a0] Packed header buffer (3) is 0x1d/0x1e (61 bits).
[h264_vaapi @ 0x5555569698a0] Param buffer (24) is 0x1f.
[h264 @ 0x555556915c00] nal_unit_type: 1, nal_ref_idc: 2
[AVHWFramesContext @ 0x555556ad0da0] Created surface 0x20.
[AVHWFramesContext @ 0x555556ad0da0] Map surface 0x20.
[AVHWFramesContext @ 0x555556ad0da0] Unmap surface 0x20.
[h264_vaapi @ 0x5555569698a0] Encode frame: 1280x720 (512).
[h264_vaapi @ 0x5555569698a0] Pictures: IDR (0/0) B (1/2) B (2/3) P (3/1)
[h264 @ 0x555556bf3fc0] nal_unit_type: 1, nal_ref_idc: 2
[AVHWFramesContext @ 0x555556ad0da0] Created surface 0x21.
[AVHWFramesContext @ 0x555556ad0da0] Map surface 0x21.
[AVHWFramesContext @ 0x555556ad0da0] Unmap surface 0x21.
[h264_vaapi @ 0x5555569698a0] Encode frame: 1280x720 (1024).
[h264_vaapi @ 0x5555569698a0] Sync to pic 0/0 (recon surface 0x16).
[h264_vaapi @ 0x5555569698a0] Output buffer: 0 bytes (status 00000000).
[h264_vaapi @ 0x5555569698a0] Output read for pic 0/0.
[matroska @ 0x55555695e0e0] Writing block at offset 1064, size 0, pts 40, dts 0, duration 0, flags 128
[h264 @ 0x555556bb6720] nal_unit_type: 1, nal_ref_idc: 2
[AVHWFramesContext @ 0x555556ad0da0] Map surface 0x1.
[AVHWFramesContext @ 0x555556ad0da0] Unmap surface 0x1.
Thread 1 "avconv" received signal SIGSEGV, Segmentation fault.
0x00007ffff4e6a7cf in __memmove_avx_unaligned_erms () from /usr/lib/libc.so.6
(gdb) bt
#0 0x00007ffff4e6a7cf in __memmove_avx_unaligned_erms () from /usr/lib/libc.so.6
#1 0x00007ffff11bbbe8 in ?? () from /usr/lib/dri/radeonsi_drv_video.so
#2 0x00007ffff11bfd31 in ?? () from /usr/lib/dri/radeonsi_drv_video.so
#3 0x00007ffff1127f62 in ?? () from /usr/lib/dri/radeonsi_drv_video.so
#4 0x0000555555cddf2f in ?? ()
#5 0x0000555555cd5c8f in ?? ()
#6 0x0000555555cdb6bc in ?? ()
#7 0x0000555555cdb7ac in ?? ()
#8 0x0000555555cddddd in ?? ()
#9 0x0000555555cdd357 in ?? ()
#10 0x0000555555632055 in ?? ()
#11 0x0000555555624ff2 in ?? ()
#12 0x0000555555624ff2 in ?? ()
#13 0x0000555555635439 in ?? ()
#14 0x0000555555624ff2 in ?? ()
#15 0x0000555555626d8a in ?? ()
#16 0x00005555556276cc in ?? ()
#17 0x00005555556268c8 in ?? ()
#18 0x000055555561cf2f in ?? ()
#19 0x000055555561d7f5 in ?? ()
#20 0x0000555555609cf2 in main ()
diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index cdda485..fc6ef67 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -112,13 +112,6 @@ static int vaapi_encode_wait(AVCodecContext *avctx,
"(recon surface %#x).\n", pic->display_order,
pic->encode_order, pic->recon_surface);
- vas = vaSyncSurface(ctx->hwctx->display, pic->recon_surface);
- if (vas != VA_STATUS_SUCCESS) {
- av_log(avctx, AV_LOG_ERROR, "Failed to sync to picture completion: "
- "%d (%s).\n", vas, vaErrorStr(vas));
- return AVERROR(EIO);
- }
-
// Input is definitely finished with now.
av_frame_free(&pic->input_image);
diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
index bba0c4d..71ec7f2 100644
--- a/libavutil/hwcontext_vaapi.c
+++ b/libavutil/hwcontext_vaapi.c
@@ -703,14 +703,6 @@ static int vaapi_map_frame(AVHWFramesContext *hwfc,
map->flags = flags;
map->image.image_id = VA_INVALID_ID;
- vas = vaSyncSurface(hwctx->display, surface_id);
- if (vas != VA_STATUS_SUCCESS) {
- av_log(hwfc, AV_LOG_ERROR, "Failed to sync surface "
- "%#x: %d (%s).\n", surface_id, vas, vaErrorStr(vas));
- err = AVERROR(EIO);
- goto fail;
- }
-
// The memory which we map using derive need not be connected to the CPU
// in a way conducive to fast access. On Gen7-Gen9 Intel graphics, the
// memory is mappable but not cached, so normal memcpy()-like access is
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment