Camera 8M and HDMI output on Debian 11 b6 (Zero 3W)

It is known that Debian b6 does not contain GPU drivers for the desktop
Does anyone have a step-by-step instruction where the image from the 8M camera can be output to HDMI without delays (with hardware acceleration)?
I tried Armbian, but it has its own problems, including with the drivers for CSI.

You can use gstreamer kmssink to render it with hw acceleration without delay.

For this you need:

  • stop desktop, drop to CLI
  • have gstreamer up to date for rockchip (kms fix)

Assuming you have all this in place, your first test is like this:

gst-launch-1.0 videotestsrc ! kmssink
Setting pipeline to PAUSED ...
ERROR: from element /GstPipeline:pipeline0/GstKMSSink:kmssink0: Could not find a plane for crtc
Additional debug info:
../sys/kms/gstkmssink.c(1172): gst_kms_sink_start (): /GstPipeline:pipeline0/GstKMSSink:kmssink0
ERROR: pipeline doesn't want to preroll.
ERROR: from element /GstPipeline:pipeline0/GstKMSSink:kmssink0: GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failure.
Additional debug info:
../libs/gst/base/gstbasesink.c(5878): gst_base_sink_change_state (): /GstPipeline:pipeline0/GstKMSSink:kmssink0:
Failed to start
ERROR: pipeline doesn't want to preroll.
Failed to set pipeline to PAUSED.
Setting pipeline to NULL ...
Freeing pipeline ...

That means you need to pass a plane-id to kmssink for it to work properly.

Find a plane id is something like this:

sudo cat /sys/kernel/debug/dri/0/state | grep "plane\["
[sudo] password for rock: 
plane[57]: Cluster0-win0
plane[71]: Esmart0-win0
plane[93]: Cluster1-win0
plane[107]: Esmart1-win0
plane[129]: Cluster2-win0
plane[143]: Esmart2-win0
plane[165]: Cluster3-win0
plane[179]: Esmart3-win0

I chose plane-id 71, so fire gstreamer like this:

gst-launch-1.0 v4l2src device=/dev/video0 io-mode=dmabuf ! 'video/x-raw,format=NV12,width=1920,height=1080' ! fpsdisplaysink video-sink="kmssink plane-id=71" text-overlay=true sync=false

Another alternative is to build the latest nyamisaka’s ffmpeg / ffplay and use a command like this:
ffplay -fflags nobuffer -f v4l2 -pixel_format nv12 -framerate 30 -video_size 1920x1080 -i /dev/video0

But i think you need sdl2 with kms/drm enabled, or if you fave already ffplay working on the desktop, just pass -fflags nobuffer for no delay.

This is a solution, but for beginners more information is needed
At the moment I have gstreamer FPS for FULL HD or HD 19-20 resolution, but the load on the processor is low. Although the camera should give out 30 FPS for FULL HD, 60 (Camera 8M) for HD
ffplay has not yet been launched in the console, I would like to try it too.
My current steps: (professionals, help with the correct command parameters)
Debian11 b6 OS is installed with the desktop.
Pre-compiled rkmpp and rkrga according to the instructions


Then compiled and installed ffmpeg-rockchip according to the instructions
https://docs.radxa.com/en/zero/zero3/app-development/rtsp?target=ffmpeg
with activated ffplay.

Now the interesting part begins, figure out how to compile and install sdl2 with kms/drm enabled

I took the instructions https://mydedibox.fr/rpi4-sdl2-kms-drm-compilation-no-x/ as a basis
And I only added
–disable-video-opengl
Everything else is unchanged.

Exit to console ctrl+alt +F1
then turn off the desktop: sudo service lightdm stop

Launch gstreamer (I didn’t compile it separately, maybe I installed it through the standard repositories)
gst-launch-1.0 v4l2src device=/dev/video-camera0 ! ‘video/x-raw,format=NV12,width=1280,height=720,framerate=60/1’ ! fpsdisplaysink video-sink=“kmssink” text-overlay=true sync=false

I launch analogy for 1920*1080 30 fps
The image is displayed, but as I understand the frame rate is for some reason 19-20 and by feel if you wave your hand.
The test starts and works
gst-launch-1.0 videotestsrc ! kmssink

Maybe some additional launch parameters or a specially compiled gstreamer are needed here

Next ffplay.

ffplay -fflags nobuffer -f v4l2 -pixel_format nv12 -framerate 30 -video_size 1920x1080 -i /dev/video-camera0

Doesn’t start, an error occurs

arm_release_ver of this libmali is ‘g2p0-01eac0’, rk_so_ver is ‘4’.
Segmentation fault
Add the -nodisp parameter

ffplay -fflags nobuffer -f v4l2 -pixel_format yuv420p -framerate 30 -video_size 1920x1080 -i /dev/video-camera0 -autoexit -nodisp

We get the error
Failed to open file ‘/dev/video-camera0’ or configure filtergraph

Well, if you play with the frame rate, you will still get an error of a similar type

I found the problem of low FPS:
by default it outputs in the native camera resolution 3280x2464 with low FPS
in this topic there was a similar problem

But the solution needs to be modified for our board
I kill the process
sudo pkill rkaiq_3A_server
then I displayed the topology
media-ctl -d /dev/media0 -p -v
camera at the end (if I understood correctly):

  • entity 70: m00_b_imx219 2-0010 (1 pad, 1 link)
    type V4L2 subdev subtype Sensor flags 0
    device node name /dev/v4l-subdev3
    pad0: Source
    [fmt:SRGGB10_1X10/3280x2464@10000/210000 field:none]
    -> “rockchip-csi2-dphy0”:0 [ENABLED]

Then I try to adjust the resolution
sudo media-ctl -d /dev/media0 --set-v4l2 ‘“m00_b_imx219 2-0010”:0[fmt:SRGGB10_1X10/1920x1080@10000/300000]’

and I get the error Unable to setup formats: Inappropriate ioctl for device (25)

Has anyone solved the problem with setting real FPS?

sudo media-ctl -d /dev/media0 --set-v4l2 ‘“m00_b_imx219 2-0010”:0[fmt:SRGGB10_1X10/1920x1080]’

The setting was applied, but when launching
gst-launch-1.0 v4l2src device=/dev/video0 io-mode=dmabuf ! ‘video/x-raw,format=NV12,width=1920,height=1080’ ! fpsdisplaysink video-sink=“kmssink plane-id=76” text-overlay=true sync=false

An error occurs on the screen:

And instead of an image, lines are displayed

Which kernel version?

uname -ra

radxa-zero3 5.10.160-38-rk356x

I think the kernel version is right. Check the system log for possible clues. My guess is you don’t have a 1920x1080 scene.