vaapi plugin crash during initialisation
While running gst-inspect-1.0 to check whether the gst-vaapi plugins were compiled and available, I saw gst-inspect-1.0 crash and ask me to remove the plugin or debug it, so I did the latter.
On a GNOME Wayland session, Fedora 35, using an Intel GPU, with commit 31b5243e as the compiled version of gstreamer.
$ gdb --args gst-inspect-1.0 --gst-disable-segtrap --gst-disable-registry-fork
Program received signal SIGSEGV, Segmentation fault.
gst_vaapi_video_format_from_drm_format (drm_format=drm_format@entry=875713089) at ../../../../Projects/jhbuild/gstreamer/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/video-format.c:678
678 for (i = 0; i < map->len; i++) {
(gdb) p map
$1 = (const GArray *) 0x0
(gdb) bt
#0 gst_vaapi_video_format_from_drm_format (drm_format=drm_format@entry=875713089) at ../../../../Projects/jhbuild/gstreamer/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/video-format.c:678
#1 0x00007fffdd4b402a in dmabuf_modifier (data=0xdc44b0, zwp_linux_dmabuf=<optimized out>, format=875713089, modifier_hi=<optimized out>, modifier_lo=<optimized out>) at ../../../../Projects/jhbuild/gstreamer/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidisplay_wayland.c:124
#2 0x00007ffff78a7c04 in ffi_call_unix64 () at /lib64/libffi.so.6
#3 0x00007ffff78a7108 in ffi_call () at /lib64/libffi.so.6
#4 0x00007fffddc15d10 in wl_closure_invoke.constprop () at /lib64/libwayland-client.so.0
#5 0x00007fffddc1641b in dispatch_event.isra () at /lib64/libwayland-client.so.0
#6 0x00007fffddc1660c in wl_display_dispatch_queue_pending () at /lib64/libwayland-client.so.0
#7 0x00007fffddc18aef in wl_display_roundtrip_queue () at /lib64/libwayland-client.so.0
#8 0x00007fffdd4b41a9 in gst_vaapi_display_wayland_setup (display=<optimized out>) at ../../../../Projects/jhbuild/gstreamer/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidisplay_wayland.c:193
#9 0x00007fffdd474e3c in gst_vaapi_display_create (data=0x0, init_type=GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, display=0xdc45b0) at ../../../../Projects/jhbuild/gstreamer/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidisplay.c:958
#10 gst_vaapi_display_config (display=0xdc45b0, init_type=GST_VAAPI_DISPLAY_INIT_FROM_DISPLAY_NAME, init_value=0x0) at ../../../../Projects/jhbuild/gstreamer/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidisplay.c:1265
#11 0x00007fffdd43d984 in gst_vaapi_create_test_display () at ../../../../Projects/jhbuild/gstreamer/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapipluginutil.c:932
#12 0x00007fffdd434892 in plugin_init (plugin=0xdbe840) at ../../../../Projects/jhbuild/gstreamer/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapi.c:191
#13 0x00007ffff7f142d5 in gst_plugin_register_func (plugin=plugin@entry=0xdbe840, desc=0x7fffdd4ee6c0 <gst_plugin_desc>, user_data=user_data@entry=0x0) at ../../../../Projects/jhbuild/gstreamer/subprojects/gstreamer/gst/gstplugin.c:529
#14 0x00007ffff7f1649d in _priv_gst_plugin_load_file_for_registry (filename=filename@entry=0xcc0ee0 "/home/hadess/Projects/gnome-install/lib/gstreamer-1.0/libgstvaapi.so", registry=0x45b3d0, error=error@entry=0x0) at ../../../../Projects/jhbuild/gstreamer/subprojects/gstreamer/gst/gstplugin.c:968
#15 0x00007ffff7f240fe in gst_registry_scan_plugin_file (context=context@entry=0x7fffffffcb50, filename=filename@entry=0xcc0ee0 "/home/hadess/Projects/gnome-install/lib/gstreamer-1.0/libgstvaapi.so", file_size=4487536, file_mtime=1643397437) at ../../../../Projects/jhbuild/gstreamer/subprojects/gstreamer/gst/gstregistry.c:1191
#16 0x00007ffff7f251f6 in gst_registry_scan_path_level (context=context@entry=0x7fffffffcb50, path=path@entry=0x468c10 "/home/hadess/Projects/gnome-install/lib/gstreamer-1.0", level=level@entry=10) at ../../../../Projects/jhbuild/gstreamer/subprojects/gstreamer/gst/gstregistry.c:1362
#17 0x00007ffff7f25390 in gst_registry_scan_path_internal (context=context@entry=0x7fffffffcb50, path=0x468c10 "/home/hadess/Projects/gnome-install/lib/gstreamer-1.0") at ../../../../Projects/jhbuild/gstreamer/subprojects/gstreamer/gst/gstregistry.c:1381
#18 0x00007ffff7f26974 in scan_and_update_registry (write_changes=1, error=0x7fffffffcb48, registry_file=0x451dd0 "/home/hadess/Projects/gnome-install/_jhbuild/gstreamer-1.0.registry", default_registry=0x45b3d0) at ../../../../Projects/jhbuild/gstreamer/subprojects/gstreamer/gst/gstregistry.c:1643
#19 ensure_current_registry (error=0x7fffffffcb48) at ../../../../Projects/jhbuild/gstreamer/subprojects/gstreamer/gst/gstregistry.c:1784
#20 gst_update_registry () at ../../../../Projects/jhbuild/gstreamer/subprojects/gstreamer/gst/gstregistry.c:1861
#21 0x00007ffff7eb65ae in init_post (error=<optimized out>, data=<optimized out>, group=<optimized out>, context=<optimized out>) at ../../../../Projects/jhbuild/gstreamer/subprojects/gstreamer/gst/gst.c:828
#22 0x00007ffff7d81588 in g_option_context_parse () at /lib64/libglib-2.0.so.0
#23 0x0000000000404e7e in main (argc=<optimized out>, argv=<optimized out>) at ../../../../Projects/jhbuild/gstreamer/subprojects/gstreamer/tools/gst-inspect.c:2103
(gdb) list
673 #if USE_DRM
674 const GArray *map = gst_vaapi_video_formats_map;
675 const GstVideoFormatMap *m;
676 guint i;
677
678 for (i = 0; i < map->len; i++) {
679 m = &g_array_index (map, GstVideoFormatMap, i);
680 if (m->drm_format == drm_format)
681 return m->format;
682 }