Freescale / libimxvpuapi

i.MX VPU API Library
GNU Lesser General Public License v2.1
88 stars 54 forks source link

imxvpuapi2_imx8m_hantro_decoder.c:1196:imx_vpu_api_dec_open: initializing DWL instance failed #54

Closed NIKovachev closed 1 year ago

NIKovachev commented 1 year ago

Hello, I'm trying to decode mjpeg on coral-dev but I'm running into the error below. Any suggestions or advices are appreciated.

I'm running customer image build with yocto:

root@coral-dev:~# uname -a
Linux coral-dev 5.15.52-5.15.52-2.1.0+g36363d8623ba #1 SMP PREEMPT Tue Sep 6 09:50:50 UTC 2022 aarch64 GNU/Linux
root@coral-dev:~# gst-launch-1.0 --version
gst-launch-1.0 version 1.20.4
GStreamer 1.20.4
Unknown package origin
root@coral-dev:~# 

Error:

root@coral-dev:~# gst-launch-1.0 --gst-debug=2 v4l2src device=/dev/video0 ! image/jpeg, width=800,height=600, framerate=5/1 ! imxvpudec_jpeg ! fakesink
Setting pipeline to PAUSED ...[ 1421.110014] usb 1-1.4: Failed to query (GET_DEF) UVC control 12 on unit 1: -32 (exp. 3).

Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
0:00:00.329565253   397 0xaaaaf03aa580 ERROR              imxvpuapi imxvpuapi2_imx8m_hantro_decoder.c:1196:imx_vpu_api_dec_open: initializing DWL instance failed
0:00:00.329694973   397 0xaaaaf03aa580 ERROR              imxvpudec gstimxvpudec.c:488:gst_imx_vpu_dec_set_format:<imxvpudecjpeg0> could not open decoder: error
0:00:00.329738173   397 0xaaaaf03aa580 WARN            videodecoder gstvideodecoder.c:928:gst_video_decoder_setcaps:<imxvpudecjpeg0> Subclass refused caps
0:00:00.329970733   397 0xaaaaf03aa580 ERROR              imxvpuapi imxvpuapi2_imx8m_hantro_decoder.c:1196:imx_vpu_api_dec_open: initializing DWL instance failed
0:00:00.330010933   397 0xaaaaf03aa580 ERROR              imxvpudec gstimxvpudec.c:488:gst_imx_vpu_dec_set_format:<imxvpudecjpeg0> could not open decoder: error
0:00:00.330043333   397 0xaaaaf03aa580 WARN            videodecoder gstvideodecoder.c:928:gst_video_decoder_setcaps:<imxvpudecjpeg0> Subclass refused caps
0:00:00.330077293   397 0xaaaaf03aa580 WARN                GST_PADS gstpad.c:4351:gst_pad_peer_query:<capsfilter0:src> could not send sticky events
0:00:00.394068376   397 0xaaaaf03aa580 WARN          v4l2bufferpool gstv4l2bufferpool.c:855:gst_v4l2_buffer_pool_start:<v4l2src0:pool0:src> Uncertain or not enough buffers, enabling copy threshold
0:00:01.145123686   397 0xaaaaf03aa580 ERROR              imxvpuapi imxvpuapi2_imx8m_hantro_decoder.c:1196:imx_vpu_api_dec_open: initializing DWL instance failed
0:00:01.145210326   397 0xaaaaf03aa580 ERROR              imxvpudec gstimxvpudec.c:488:gst_imx_vpu_dec_set_format:<imxvpudecjpeg0> could not open decoder: error
0:00:01.145244166   397 0xaaaaf03aa580 WARN            videodecoder gstvideodecoder.c:928:gst_video_decoder_setcaps:<imxvpudecjpeg0> Subclass refused caps
0:00:01.145473606   397 0xaaaaf03aa580 ERROR              imxvpuapi imxvpuapi2_imx8m_hantro_decoder.c:1196:imx_vpu_api_dec_open: initializing DWL instance failed
0:00:01.145513326   397 0xaaaaf03aa580 ERROR              imxvpudec gstimxvpudec.c:488:gst_imx_vpu_dec_set_format:<imxvpudecjpeg0> could not open decoder: error
0:00:01.145545606   397 0xaaaaf03aa580 WARN            videodecoder gstvideodecoder.c:928:gst_video_decoder_setcaps:<imxvpudecjpeg0> Subclass refused caps
0:00:01.145638006   397 0xaaaaf03aa580 WARN                 basesrc gstbasesrc.c:3127:gst_base_src_loop:<v4l2src0> error: Internal data stream error.
0:00:01.145674126   397 0xaaaaf03aa580 WARN                 basesrc gstbasesrc.c:3127:gst_base_src_loop:<v4l2src0> error: streaming stopped, reason not-negotiated (-4)
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
../gstreamer-1.20.4/libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Execution ended after 0:00:00.848592994
Setting pipeline to NULL ...
0:00:01.146180526   397 0xaaaaf03aa580 ERROR              imxvpuapi imxvpuapi2_imx8m_hantro_decoder.c:1196:imx_vpu_api_dec_open: initializing DWL instance failed
0:00:01.146221206   397 0xaaaaf03aa580 ERROR              imxvpudec gstimxvpudec.c:488:gst_imx_vpu_dec_set_format:<imxvpudecjpeg0> could not open decoder: error
0:00:01.146254086   397 0xaaaaf03aa580 WARN            videodecoder gstvideodecoder.c:928:gst_video_decoder_setcaps:<imxvpudecjpeg0> Subclass refused caps
Freeing pipeline ...
root@coral-dev:~# 

Regards, Nikolay Kovachev

dv1 commented 1 year ago

I'm not familiar with Coral, but these DWL errors can happen because of problems with dma-heap. Use strace -f -e trace=openat gst-launch-1.0 --gst-debug=2 v4l2src device=/dev/video0 ! image/jpeg, width=800,height=600, framerate=5/1 ! imxvpudec_jpeg ! fakesink to check for attempts to open a device node like /dev/dma_heap/linux,cma or /dev/dma_heap/linux,cma-uncached . If these nodes are not present, DWLInit() fails.

NIKovachev commented 1 year ago

Hi, looking at the strace:

[pid   404] openat(AT_FDCWD, "/dev/mxc_hantro", O_RDWR) = -1 ENOENT (No such file or directory)
[pid   404] openat(AT_FDCWD, "/dev/mxc_hantro", O_RDWR) = -1 ENOENT (No such file or directory)

That looks similar to issue #46. I have the hantro_vpu and hantrodec modules loaded but /dev/mxc_hantro it's not present. Do I need to load some additional module?

root@coral-dev:~# lsmod
Module                  Size  Used by
hantrodec              36864  0
hantro_vpu            110592  0
v4l2_h264              16384  1 hantro_vpu
fsl_jr_uio             20480  0
caam_jr               180224  0
caamkeyblob_desc       16384  1 caam_jr
caamhash_desc          16384  1 caam_jr
caamalg_desc           40960  1 caam_jr
snd_usb_audio         290816  0
crypto_engine          20480  1 caam_jr
rng_core               24576  1 caam_jr
imx8mq_interconnect    16384  0
authenc                16384  1 caam_jr
imx_interconnect       16384  1 imx8mq_interconnect
libdes                 24576  1 caam_jr
uvcvideo              106496  0
snd_hwdep              20480  1 snd_usb_audio
snd_usbmidi_lib        36864  1 snd_usb_audio
caam                   28672  1 caam_jr
secvio                 20480  0
governor_userspace     16384  0
error                  24576  7 caamalg_desc,secvio,caamkeyblob_desc,caamhash_desc,caam,caam_jr,fsl_jr_uio
imx8m_ddrc             20480  0
imx_bus                16384  0
crct10dif_ce           20480  1
fuse                  131072  1
root@coral-dev:~#
NIKovachev commented 1 year ago

more details from the strace:

root@coral-dev:~# strace -f gst-launch-1.0 --gst-debug=2 v4l2src device=/dev/video0 ! image/jpeg, width=800,height=600, framerate=5/1 ! imxvpudec_jpeg ! fakesink &> gst.out
root@coral-dev:~# grep "= -1" gst.out
faccessat(AT_FDCWD, "/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/bin/../gst/tls/aarch64/libgstreamer-1.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/bin/../gst/tls/aarch64", 0xffffe126f8b0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/bin/../gst/tls/libgstreamer-1.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/bin/../gst/tls", 0xffffe126f8b0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/bin/../gst/aarch64/libgstreamer-1.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/bin/../gst/aarch64", 0xffffe126f8b0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/bin/../gst/libgstreamer-1.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/bin/../gst", 0xffffe126f8b0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/../glib/tls/aarch64/libffi.so.8", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib/../glib/tls/aarch64", 0xffffe126f7b0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/../glib/tls/libffi.so.8", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib/../glib/tls", 0xffffe126f7b0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/../glib/aarch64/libffi.so.8", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib/../glib/aarch64", 0xffffe126f7b0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/../glib/libffi.so.8", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib/../glib", 0xffffe126f7b0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/charset.alias", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/gconv/gconv-modules.cache", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/root/.local/share/gstreamer-1.0/plugins", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/root/.frei0r-1/lib", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/frei0r-1", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/local/lib/frei0r-1", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib32/frei0r-1", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/local/lib32/frei0r-1", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib64/frei0r-1", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/local/lib64/frei0r-1", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/share/gvfs/mounts", 0xffffe126fff8, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/dev/v4l2", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
faccessat(AT_FDCWD, "/sys/subsystem", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/gstreamer-1.0/../../gst-libs/gst/imx/common/tls/aarch64/libgstimxcommon.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib/gstreamer-1.0/../../gst-libs/gst/imx/common/tls/aarch64", 0xffffe126d6d0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/gstreamer-1.0/../../gst-libs/gst/imx/common/tls/libgstimxcommon.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib/gstreamer-1.0/../../gst-libs/gst/imx/common/tls", 0xffffe126d6d0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/gstreamer-1.0/../../gst-libs/gst/imx/common/aarch64/libgstimxcommon.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib/gstreamer-1.0/../../gst-libs/gst/imx/common/aarch64", 0xffffe126d6d0, 0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/gstreamer-1.0/../../gst-libs/gst/imx/common/libgstimxcommon.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
newfstatat(AT_FDCWD, "/usr/lib/gstreamer-1.0/../../gst-libs/gst/imx/common", 0xffffe126d6d0, 0) = -1 ENOENT (No such file or directory)
ioctl(6, VIDIOC_ENUMINPUT, {index=1})   = -1 EINVAL (Invalid argument)
ioctl(6, VIDIOC_ENUMSTD, {index=0})     = -1 ENOTTY (Inappropriate ioctl for device)
ioctl(6, VIDIOC_QUERYCTRL, {id=V4L2_CTRL_FLAG_NEXT_CTRL|V4L2_CID_ZOOM_ABSOLUTE}) = -1 EIO (Input/output error)
ioctl(6, VIDIOC_G_STD, 0xffffe126ffe0)  = -1 ENOTTY (Inappropriate ioctl for device)
faccessat(AT_FDCWD, "/tmp/gst-launch/NULL_READY", F_OK) = -1 ENOENT (No such file or directory)
[pid   383] <... faccessat resumed>)    = -1 ENOENT (No such file or directory)
[pid   385] <... ioctl resumed>})       = -1 EINVAL (Invalid argument)
[pid   383] <... ioctl resumed>, 0xffffe12703b8) = -1 ENOTTY (Inappropriate ioctl for device)
[pid   385] <... ioctl resumed>})       = -1 EINVAL (Invalid argument)
[pid   385] <... ioctl resumed>})       = -1 EINVAL (Invalid argument)
[pid   385] <... ioctl resumed>})       = -1 EINVAL (Invalid argument)
[pid   385] <... ioctl resumed>})       = -1 EINVAL (Invalid argument)
[pid   385] <... ioctl resumed>})       = -1 EINVAL (Invalid argument)
[pid   385] <... ioctl resumed>})       = -1 EINVAL (Invalid argument)
[pid   385] <... ioctl resumed>})       = -1 EINVAL (Invalid argument)
[pid   385] <... ioctl resumed>})       = -1 EINVAL (Invalid argument)
[pid   385] <... ioctl resumed>})       = -1 EINVAL (Invalid argument)
[pid   385] <... ioctl resumed>})       = -1 EINVAL (Invalid argument)
[pid   385] <... ioctl resumed>})       = -1 EINVAL (Invalid argument)
[pid   385] <... ioctl resumed>})       = -1 EINVAL (Invalid argument)
[pid   385] <... ioctl resumed>})       = -1 EINVAL (Invalid argument)
[pid   385] <... ioctl resumed>})       = -1 EINVAL (Invalid argument)
[pid   385] <... ioctl resumed>})       = -1 EINVAL (Invalid argument)
[pid   385] <... ioctl resumed>})       = -1 EINVAL (Invalid argument)
[pid   385] <... ioctl resumed>})       = -1 EINVAL (Invalid argument)
[pid   385] <... ioctl resumed>})       = -1 EINVAL (Invalid argument)
[pid   385] ioctl(6, VIDIOC_ENUM_FRAMEINTERVALS, {index=6, pixel_format=v4l2_fourcc('M', 'J', 'P', 'G') /* V4L2_PIX_FMT_MJPEG */, width=1024, height=576}) = -1 EINVAL (Invalid argument)
[pid   385] ioctl(6, VIDIOC_ENUM_FRAMEINTERVALS, {index=6, pixel_format=v4l2_fourcc('M', 'J', 'P', 'G') /* V4L2_PIX_FMT_MJPEG */, width=800, height=600}) = -1 EINVAL (Invalid argument)
[pid   385] ioctl(6, VIDIOC_ENUM_FRAMEINTERVALS, {index=6, pixel_format=v4l2_fourcc('M', 'J', 'P', 'G') /* V4L2_PIX_FMT_MJPEG */, width=800, height=480}) = -1 EINVAL (Invalid argument)
[pid   385] ioctl(6, VIDIOC_ENUM_FRAMEINTERVALS, {index=6, pixel_format=v4l2_fourcc('M', 'J', 'P', 'G') /* V4L2_PIX_FMT_MJPEG */, width=640, height=360}) = -1 EINVAL (Invalid argument)
[pid   385] ioctl(6, VIDIOC_ENUM_FRAMEINTERVALS, {index=6, pixel_format=v4l2_fourcc('M', 'J', 'P', 'G') /* V4L2_PIX_FMT_MJPEG */, width=424, height=240}) = -1 EINVAL (Invalid argument)
[pid   385] ioctl(6, VIDIOC_ENUM_FRAMEINTERVALS, {index=6, pixel_format=v4l2_fourcc('M', 'J', 'P', 'G') /* V4L2_PIX_FMT_MJPEG */, width=352, height=288}) = -1 EINVAL (Invalid argument)
[pid   385] ioctl(6, VIDIOC_ENUM_FRAMEINTERVALS, {index=6, pixel_format=v4l2_fourcc('M', 'J', 'P', 'G') /* V4L2_PIX_FMT_MJPEG */, width=3840, height=2160}) = -1 EINVAL (Invalid argument)
[pid   385] ioctl(6, VIDIOC_ENUM_FRAMESIZES, {index=12, pixel_format=v4l2_fourcc('M', 'J', 'P', 'G') /* V4L2_PIX_FMT_MJPEG */}) = -1 EINVAL (Invalid argument)
[pid   385] openat(AT_FDCWD, "/dev/mxc_hantro", O_RDWR) = -1 ENOENT (No such file or directory)
[pid   385] openat(AT_FDCWD, "/dev/mxc_hantro", O_RDWR) = -1 ENOENT (No such file or directory)
[pid   385] ioctl(6, VIDIOC_EXPBUF, 0xffff9ab4e118) = -1 EINVAL (Invalid argument)
[pid   385] ioctl(6, VIDIOC_G_CTRL, {id=V4L2_CID_MIN_BUFFERS_FOR_CAPTURE}) = -1 EINVAL (Invalid argument)
[pid   385] ioctl(6, VIDIOC_SUBSCRIBE_EVENT, 0xffff9ab4e4b8) = -1 EINVAL (Invalid argument)
[pid   385] ioctl(6, VIDIOC_G_CTRL, {id=V4L2_CID_MIN_BUFFERS_FOR_CAPTURE}) = -1 EINVAL (Invalid argument)
[pid   385] openat(AT_FDCWD, "/dev/mxc_hantro", O_RDWR) = -1 ENOENT (No such file or directory)
[pid   385] openat(AT_FDCWD, "/dev/mxc_hantro", O_RDWR) = -1 ENOENT (No such file or directory)
[pid   385] <... openat resumed>)       = -1 ENOENT (No such file or directory)
[pid   385] openat(AT_FDCWD, "/dev/mxc_hantro", O_RDWR) = -1 ENOENT (No such file or directory)
[pid   385] openat(AT_FDCWD, "/dev/mxc_hantro", O_RDWR) = -1 ENOENT (No such file or directory)
[pid   383] faccessat(AT_FDCWD, "/tmp/gst-launch/PAUSED_READY", F_OK) = -1 ENOENT (No such file or directory)
[pid   383] <... futex resumed>)        = -1 EAGAIN (Resource temporarily unavailable)
root@coral-dev:~# 
dv1 commented 1 year ago

Check your kernel config for CONFIG_MXC_HANTRO. This controls the compilation of the mxc hantro driver.

NIKovachev commented 1 year ago

Hi, yes I have them as a module. I don't get what's wrong with with hantrodec and why it doesn't create mxc_hantro dev.

root@coral-dev:~# ls /dev/*mxc*
/dev/ttymxc0
root@coral-dev:~# lsmod
Module                  Size  Used by
hantro_vpu            110592  0
v4l2_h264              16384  1 hantro_vpu
hantrodec              36864  0
fsl_jr_uio             20480  0
uvcvideo              102400  0
caam_jr               180224  0
caamkeyblob_desc       16384  1 caam_jr
snd_usb_audio         294912  0
caamhash_desc          16384  1 caam_jr
caamalg_desc           40960  1 caam_jr
crypto_engine          20480  1 caam_jr
authenc                16384  1 caam_jr
snd_hwdep              20480  1 snd_usb_audio
snd_usbmidi_lib        36864  1 snd_usb_audio
libdes                 24576  1 caam_jr
caam                   28672  1 caam_jr
secvio                 20480  0
error                  24576  7 caamalg_desc,secvio,caamkeyblob_desc,caamhash_desc,caam,caam_jr,fsl_jr_uio
crct10dif_ce           20480  1
fuse                  131072  1
root@coral-dev:~# 

#####################Kernel config
coral@9746a802cf5e:/home/coral/yocto/coral/build$ grep -i hantro /home/coral/yocto/coral/sources/meta-freescale/recipes-kernel/linux/linux-imx/coral-dev/defconfig
CONFIG_VIDEO_HANTRO=m
CONFIG_VIDEO_HANTRO_IMX8M=m
# MXC HANTRO(Video Processing Unit) support
CONFIG_MXC_HANTRO=m
# end of MXC HANTRO(Video Processing Unit) support
# MXC HANTRO(Video Processing Unit) 845 support
CONFIG_MXC_HANTRO_845=m
# end of MXC HANTRO(Video Processing Unit) 845 support
# MXC HANTRO(Video Processing Unit) encoder support
CONFIG_MXC_HANTRO_845_H1=m
# end of MXC HANTRO(Video Processing Unit) encoder support
# MXC HANTRO(Video Processing Unit) VC8000E encoder support
CONFIG_MXC_HANTRO_VC8000E=m
# end of MXC HANTRO(Video Processing Unit) VC8000E encoder support
# MXC HANTRO(Video Processing Unit) V4L2 support
CONFIG_MXC_HANTRO_V4L2=m
# end of MXC HANTRO(Video Processing Unit) V4L2 support
coral@9746a802cf5e:/home/coral/yocto/coral/build$ 
NIKovachev commented 1 year ago

I did a step back and recompiled everything with default config. Indeed now /dev/dma_heap/linux,cma-uncached is missing. In the same time I have the DMABUF configured (check the kernel modules). I assume imxdmabuffer need to create /dev/dma_heap/linux,cma-uncached if the FD is missing but for some reason it doesn't ? Under /dev/dma_heap/ I have only the following files:

root@coral-dev:~# ls -la /dev/dma_heap/
drwxr-xr-x    2 root     root           100 Jan  1  1970 .
drwxr-xr-x   17 root     root          4060 Apr 28 17:42 ..
crw-------    1 root     root      252,   1 Apr 28 17:42 reserved
crw-------    1 root     root      252,   2 Apr 28 17:42 reserved-uncached
crw-------    1 root     root      252,   0 Apr 28 17:42 system
root@coral-dev:~# 

strace:

root@coral-dev:~# strace -f -e trace=openat gst-launch-1.0 --gst-debug=2 v4l2src device=/dev/video0 ! image/jpeg, width=800,height=600, framerate=5/1 ! imxvpudec_jpeg ! fa
kesink &> gst.out
root@coral-dev:~# grep "= -1" gst.out 
openat(AT_FDCWD, "/usr/bin/../gst/tls/aarch64/libgstreamer-1.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/bin/../gst/tls/libgstreamer-1.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/bin/../gst/aarch64/libgstreamer-1.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/bin/../gst/libgstreamer-1.0.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/../glib/tls/aarch64/libffi.so.8", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/../glib/tls/libffi.so.8", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/../glib/aarch64/libffi.so.8", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/../glib/libffi.so.8", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/charset.alias", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/gconv/gconv-modules.cache", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/root/.local/share/gstreamer-1.0/plugins", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/dev/v4l2", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/root/.frei0r-1/lib", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/frei0r-1", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/local/lib/frei0r-1", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib32/frei0r-1", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/local/lib32/frei0r-1", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib64/frei0r-1", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/local/lib64/frei0r-1", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/gstreamer-1.0/../../gst-libs/gst/imx/common/tls/aarch64/libgstimxcommon.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/gstreamer-1.0/../../gst-libs/gst/imx/common/tls/libgstimxcommon.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/gstreamer-1.0/../../gst-libs/gst/imx/common/aarch64/libgstimxcommon.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/gstreamer-1.0/../../gst-libs/gst/imx/common/libgstimxcommon.so.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/dev/dma_heap/linux,cma-uncached", O_RDWR) = -1 ENOENT (No such file or directory)
root@coral-dev:~# 

Kernel modules

coral@9746a802cf5e:/home/coral/yocto/coral/build$ egrep -e 'DMAB|_ION|HANTRO' /home/coral/yocto/coral/sources/meta-freescale/recipes-kernel/linux/linux-imx/coral-dev/defconfig
# CONFIG_IONIC is not set
# DMABUF options
# CONFIG_UDMABUF is not set
# CONFIG_DMABUF_MOVE_NOTIFY is not set
# CONFIG_DMABUF_DEBUG is not set
# CONFIG_DMABUF_SELFTESTS is not set
CONFIG_DMABUF_HEAPS=y
# CONFIG_DMABUF_SYSFS_STATS is not set
CONFIG_DMABUF_HEAPS_SYSTEM=y
CONFIG_DMABUF_HEAPS_CMA=y
CONFIG_DMABUF_HEAPS_DSP=y
# end of DMABUF options
CONFIG_VIDEO_HANTRO=m
CONFIG_VIDEO_HANTRO_IMX8M=m
# MXC HANTRO(Video Processing Unit) support
CONFIG_MXC_HANTRO=m
# end of MXC HANTRO(Video Processing Unit) support
# MXC HANTRO(Video Processing Unit) 845 support
CONFIG_MXC_HANTRO_845=m
# end of MXC HANTRO(Video Processing Unit) 845 support
# MXC HANTRO(Video Processing Unit) encoder support
CONFIG_MXC_HANTRO_845_H1=m
# end of MXC HANTRO(Video Processing Unit) encoder support
# MXC HANTRO(Video Processing Unit) VC8000E encoder support
CONFIG_MXC_HANTRO_VC8000E=m
# end of MXC HANTRO(Video Processing Unit) VC8000E encoder support
# MXC HANTRO(Video Processing Unit) V4L2 support
CONFIG_MXC_HANTRO_V4L2=m
# end of MXC HANTRO(Video Processing Unit) V4L2 support
CONFIG_ION=y
CONFIG_ION_CMA_HEAP=y
coral@9746a802cf5e:/home/coral/yocto/coral/build$ 
NIKovachev commented 1 year ago

Hello, I linked /dev/dma_heap/reserved-uncached to /dev/dma_heap/linux,cma-uncached and now again missing /dev/mxc-hantro. Can someone confirm please that this is working on kernel 5.15.52? I see it was working on 4.14? but that kernel is quite old now.

NIKovachev commented 1 year ago

The hanto vpu was disabled in the device tree. convert the dtb to dts, set vpu@38300000 status="okay" and it works fine.