Freescale / gstreamer-imx

GStreamer 1.0 plugins for i.MX platforms
Other
182 stars 127 forks source link

imxg2dvideosink crashes on IMX8MM after "framebuffer physical address is not available" #320

Open Talkless opened 11 months ago

Talkless commented 11 months ago

I've reported bug against GStreamer about VSYNC tearing on IMX8MM (https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/1006) and wanted to try out sink from gstreamer-imx as an alternative, but this simple pipeline just crashes:

# env GST_DEBUG="imx*:5" ./gst-launch-1.0 -v videotestsrc pattern=blink ! video/x-raw,width=1280,height=720 ! imxg2dvideosink
Setting pipeline to PAUSED ...
0:00:00.063517204 25228 0xaaaaf9cbd8f0 DEBUG    imxdmaheapallocator gstimxdmaheapallocator.c:286:gst_imx_dma_heap_allocator_new:<imxdmaheapallocator0> created new dma-heap i.MX DMA allocator imxdmaheapallocator0
0:00:00.063685448 25228 0xaaaaf9cbd8f0 DEBUG     imxdmabufferupload gstimxdmabufferuploader.c:348:gst_imx_dma_buffer_uploader_new:<imxdmabufferuploader0> created new GstImxDmaBufferUploader instance <imxdmabufferuploader0>, using ImxDmaBuffer allocator <imxdmaheapallocator0>
0:00:00.063738446 25228 0xaaaaf9cbd8f0 DEBUG         imxvideoupload gstimxvideouploader.c:117:gst_imx_video_uploader_new:<imxvideouploader0> created new video uploader with internal DMA buffer uploader <imxdmabufferuploader0> allocator <imxdmaheapallocator0> stride alignment 16 plane alignment 8
0:00:00.063809443 25228 0xaaaaf9cbd8f0 DEBUG                  imx2d g2d_blitter.c:693:imx_2d_backend_g2d_blitter_create: created new internal i.MX DMA buffer allocator 0xaaaaf9c932c0
0:00:00.065218392 25228 0xaaaaf9cbd8f0 DEBUG                  imx2d g2d_blitter.c:701:imx_2d_backend_g2d_blitter_create: created new G2D fill surface DMA buffer 0xaaaaf9d17520; buffer size: 16 byte(s)
0:00:00.065297890 25228 0xaaaaf9cbd8f0 DEBUG         imx2dvideosink gstimx2dvideosink.c:1102:gst_imx_2d_video_sink_create_blitter:<imxg2dvideosink0> created new blitter 0xaaaaf9d29a80
0:00:00.065378512 25228 0xaaaaf9cbd8f0 DEBUG                  imx2d linux_framebuffer.c:104:imx_2d_linux_framebuffer_get_format_from_fb: framebuffer uses 32 bpp (sizes: r 8 g 8 b 8 a 0  offsets: r 16 g 8 b 0 a 0) => format BGRX 8:8:8:8
0:00:00.065400511 25228 0xaaaaf9cbd8f0 INFO                   imx2d linux_framebuffer.c:206:imx_2d_linux_framebuffer_create: page flipping enabled: 0
0:00:00.065423260 25228 0xaaaaf9cbd8f0 ERROR                  imx2d linux_framebuffer.c:249:imx_2d_linux_framebuffer_create: framebuffer physical address is not available
0:00:00.065445759 25228 0xaaaaf9cbd8f0 DEBUG                  imx2d linux_framebuffer.c:137:imx_2d_linux_framebuffer_restore_original_fb_height: resetting framebuffer display Y offset to 0 and physical address for writing back to basic physical address
Caught SIGSEGV
#0  0x0000ffff8dae6530 in wait4 () from /lib/libc.so.6
#1  0x0000ffff8d743c7c in g_on_error_stack_trace () from ./lib/libglib-2.0.so.0
#2  0x0000aaaac4c55074 in fault_handler_sighandler ()
#3  <signal handler called>
#4  0x0000ffff8d0eb890 in imx_2d_linux_framebuffer_set_display_fb_page ()
#5  0x0000ffff8d0eb9a4 in imx_2d_linux_framebuffer_restore_original_fb_height.isra () from ./lib/gstreamer-1.0/libgstimx2d.so
#6  0x0000ffff8d0ebd68 in imx_2d_linux_framebuffer_create ()
#7  0x0000ffff8d0e945c in gst_imx_2d_video_sink_change_state ()
#8  0x0000ffff8d94118c in gst_element_change_state ()
#9  0x0000ffff8d941934 in gst_element_set_state_func ()
#10 0x0000ffff8d91962c in gst_bin_change_state_func ()
#11 0x0000ffff8d971b60 in gst_pipeline_change_state ()
#12 0x0000ffff8d94118c in gst_element_change_state ()
#13 0x0000ffff8d941934 in gst_element_set_state_func ()
#14 0x0000aaaac4c54b68 in real_main ()
#15 0x0000ffff8da66994 in __libc_start_main () from /lib/libc.so.6
#16 0x0000aaaac4c53938 in _start () at ../sysdeps/aarch64/start.S:91
Spinning.  Please run 'gdb gst-launch-1.0 25228' to continue debugging, Ctrl-C to quit, or Ctrl-\ to dump core.

Also, I don't see imxipuvideosink mentioned here and there available for me, maybe some build configuration is inadequate?

Message: Setting up build configuration for gstreamer-imx version 2.1.0
Library dl found: YES
Library m found: YES
Found pkg-config: /home/vincas/.conan/data/pkgconf/1.9.3/_/_/package/24647d9fe8ec489125dfbae4b3ebefaf7581674c/bin/pkgconf (1.9.3)
Run-time dependency libimxdmabuffer found: YES 1.1.2
Checking if "dma-heap allocator support" with dependency libimxdmabuffer compiles: YES (cached)
Message: libimxdmabuffer supports dma-heap allocation - enabling dma-heap GstAllocator
Checking if "ION allocator support" with dependency libimxdmabuffer compiles: YES (cached)
Message: libimxdmabuffer supports ION allocation - enabling ION GstAllocator
Run-time dependency gstreamer-1.0 found: YES 1.22.5
Run-time dependency gstreamer-base-1.0 found: YES 1.22.5
Run-time dependency gstreamer-allocators-1.0 found: YES 1.22.5
Run-time dependency gstreamer-audio-1.0 found: YES 1.22.5
Run-time dependency gstreamer-video-1.0 found: YES 1.22.5
Message: found gstaudio library - building audio plugins
Message: found gstvideo library - building video plugins
Message: Using sysroot from meson external properties: ""
Has header "g2d.h" : YES (cached)
Library g2d found: YES
Message: G2D implementation is not based on the i.MX8qm / i.MX8qxp DPU
Message: imx2d G2D backend enabled
Check usable header "linux/ipu.h" : NO (cached)
Check usable header "imx/linux/ipu.h" : NO (cached)
Message: imx2d IPU backend disabled due to missing IPU dependency
Check usable header "linux/pxp_device.h" : NO (cached)
Check usable header "imx/linux/pxp_device.h" : NO (cached)
Message: imx2d PxP backend disabled due to missing PxP dependency
Run-time dependency libimxvpuapi2 found: YES 2.2.2
Message: Found installed imxvpuapi library - VPU elements will be built
Dependency libfslaudiocodec skipped: feature uniaudiodec disabled
Message: Installed fslaudiocodec library not found, or user disabled uniaudiodec element compilation - uniaudio decoder will not be built
Library _mp3_enc_arm12_elinux skipped: feature mp3encoder disabled
Message: Installed _mp3_enc_arm12_elinux library not found, or user disabled mp3encoder element compilation - mp3 encoder will not be built
Message: imx2d compositor elements enabled
Message: imx2d videosink elements enabled
Message: mxc_v4l2 Video4Linux2 source and sink elements enabled
Configuring config.h using configuration
Build targets in project: 8
dv1 commented 11 months ago

The crash is a bug. It should exit cleanly with an error message.

But, look at the README:

NOTE: 2D blitter video sink elements do not work on i.MX8 machines, since these no longer use the older MXC framebuffer driver (which these video sink elements rely on).

Use kmssink, waylandsink, or glimagesink instead. If tearing happens with glimagesink, try it inside Weston, or try waylandsink.