RGA crashes on Zero 3E, not with Zero 3W

I have a serious problem with the latest RGA rockchip library (version 1.10.0).
The application uses the RGA RK_FORMAT_BGR_888 to RK_FORMAT_YCbCr_420_SP (NV12) conversion.
It all works well on the Radxa Zero 3W. No problem.
It crashes on the Radxa Zero 3E. It actually freezes the OS!
Same software, same libraries, same OS, everything is identical.
Has someone any suggestions?
BTW, I have tried several different OS.
Ubuntu 24 (Joshua Riek), latest rockchip KDE, Armbian.
All have the same behavior.

Be more specific I use Jellyfin transcoding under Armbian Noble …no problems

Thanks for thinking this through with me.

The issue arises when calling the RGA function from within a C++ program. Below is a snippet of code (which, by the way, comes from the Rockchip documentation):

rga_buffer_t src = wrapbuffer_virtualaddr((void *)bgr_image.data, width, height, RK_FORMAT_BGR_888);
rga_buffer_t dst = wrapbuffer_virtualaddr(yuv_ptr, hor_stride, ver_stride, RK_FORMAT_YCbCr_420_SP);

int ret = imcvtcolor(src, dst, RK_FORMAT_BGR_888, RK_FORMAT_YCbCr_420_SP);
if (ret != IM_STATUS_SUCCESS) return -1;

The program crashes without returning from the imcvtcolor() call. The PC counter starts fetching at 0x000000, etc.

I believe you’re referring to this Jellyfin documentation. That code works fine—I use it as well. However, it specifically applies to FFmpeg with MPP and RGA acceleration.

In my case, I need to convert a single JPEG image. Using FFmpeg (or GStreamer, for that matter) introduces far too much overhead.

You can use ffmpeg to process images as explained here
https://superuser.com/questions/606800/converting-image-format-to-jpeg-using-ffmpeg

However the filters you will use will be Rockchip’s to reduce overhead. There are a total of x3 filters, for images I believe scale_rkrga will be used

Dear ioncube,

Could you be so kind to run the next command on your Radxa Zero 3E?

gst-launch-1.0 filesrc location=input.mp4 ! qtdemux ! h264parse ! queue max-size-buffers=1 ! mppvideodec fast-mode=true format=BGR ! queue ! autosinkvideo

It crashes on my machine, as it uses RGA.

As can be seen below, ffmpeg doesn’t use the RGA library, hence we get no errors.

GStreamer uses the RGA. Below a screen dump of the Radxa Zero 3W, the board without any problems.

You can tell ffmpeg-rockchip to use rga. For example

# PNG (RGB24) -> RAW YUV (NV12) -> File
./ffmpeg -init_hw_device rkmpp=hw -filter_hw_device hw -i INPUT.png \
-vf hwupload,scale_rkrga=format=nv12,hwmap,format=nv12 -f rawvideo OUTPUT.yuv

# Video (NV12) -> RAW YUV (NV12) -> Discard/Null
./ffmpeg -hwaccel rkmpp -hwaccel_output_format drm_prime -i INPUT.mp4 \
-vf scale_rkrga=format=nv12,hwmap,format=nv12 -f null -

Glad to see you, @nyanmisaka!
Enabling the RGA doesn’t seem to be the issue.
On my Zero 3E, the underlying RGA library crashes when calling RGA, almost as if there’s a hardware address conflict. However, the same code, command, and software run flawlessly on the Zero 3W.
I find it hard to believe that this is just a case of a faulty SoC.

Below a screendump of ffmpeg with RGA enabled.

BTW, did you see the perfomance tool with your wonderful VPU utilization code?

That is a rare error code reported from the RGA. It should be an issue caused by device tree/kernel/hardware, because Zero 3W and 3E seem to only have differences in wireless/ethernet. There may be a conflict defined somewhere.

BTW, did you see the perfomance tool with your wonderful VPU utilization code?

The addition of VPU utilization looks great!

BTW, the same issue occurs with the Radxa’s official Debian OS.

“Input/output error” != “Invalid argument”

I was afraid it might be related to the device tree.
When the SD card from the Zero 3E is used in the Zero 3W, everything works fine—the only difference is that the Ethernet driver is disabled.

Now, I have very few options to resolve this:
The internal Ethernet memory conflicts with the RGA.
The Ethernet’s addresses or interrupts are conflicting with something else.

In practice, I encounter various errors, such as Input/output error or Invalid argument.

The most frustrating part is that when an error occurs, there’s a 95% chance the entire OS freezes, requiring a power cycle to recover.

I forwarded this to someone at radxa, hopefully they can take a look at it. If they can’t reproduce it, I’m afraid you’ll need an RMA.

Hi @Rients_Politiek ,
Everything works fine for me at zero3e with the command gst-launch-1.0 filesrc location=1080P_60FPS.mp4 ! qtdemux ! h264parse ! queue max-size-buffers=1 ! mppvideodec fast-mode=true format=NV16 ! queue ! fakesink -v , but it really doesn’t support the RGB-like format, probably due to the old user-level and kernel code.

Can you get ffmpeg from here and try the commands I mentioned above on your Zero 3E? It has been tested on numerous boards and will not cause RGA failures. Both MPP and RGA it built with are updated to date.

https://github.com/jellyfin/jellyfin-ffmpeg/releases/download/v7.0.2-9/jellyfin-ffmpeg_7.0.2-9_portable_linuxarm64-gpl.tar.xz

# Video (NV12) -> RAW YUV (NV12) -> Discard/Null
./ffmpeg -hwaccel rkmpp -hwaccel_output_format drm_prime -i INPUT.mp4 \
-vf scale_rkrga=format=nv12,hwmap,format=nv12 -f null -

It remains strange.
@ChenJaly, It fails on my Zero 3E.



@nyanmisaka, Jellyfin succeeded!

What to do?
Despite the success with the Jellyfin, I begin to suspect the hardware. If ChenJaly has no error while my board crashes, there is not much room for other interpretations.
I will order a new Radxa Zero 3E board and come back to you with the results.

I like to thank you all for the prompt support.

I have no problem with jellyfin, try updating the system with rsetup and sudo apt-get update && sudo apt-get install librga*=2.2.0-1.

I notice you have kernel version 26, which is a longer version

I’m using this Bullseye version radxa-zero3_debian_bullseye_xfce_b6.img.xz
image
However, with sudo apt-get update I get messages about missing public keys.
rsetup fails also to upgrading the system due to “Unable to update package list”