Hardware Accelerated JPEG encode/decode on Jetson Xavier JP 5.1.3

Hi,
It looks like you don’t use default rootfs with Ubuntu 20.04 desktop. Please share your full steps so that we can set up developer kit try. And it would be great you can try all-default Jetpack 5.1.3.

The rootfs was installed by flashing via the SDK Manager. No custom rootfs was used. What is the reason for the Could not get EGL display connection messages during testing on our side?

It appears the encode does not work correctly based on the image you provided in your testing. What is wrong with the provided sample application code that causing the resulting JPEG to be distorted?

Hi,
We would need to replicate Could not get EGL display connection message and check further. It is uncertain why you hit it on developer kit and we do not. Please share the full steps so that we can replicate it in developer kit.

After flashing these steps are taken to prepare the system:

# install cmake
sudo apt update && sudo apt install -y cmake

# dependencies update
sudo apt install -y cuda-toolkit-11-4
sudo apt install -y -f ./cuda-repo-l4t-11-4-local_11.4.19-1_arm64.deb
sudo apt-get remove --auto-remove libgstreamer-opencv1.0-0 libopencv-*
sudo apt install -y -f ./libalpropencvgpu4_4.5.5-200420240324133246_arm64.deb
sudo apt install -y -f ./libalpropencvgpu-dev_4.5.5-200420240324133246_arm64.deb
sudo apt install -y -f ./nvidia-l4t-jetson-multimedia-api_35.5.0-20240219203809_arm64.deb
sudo apt install -y -f ./deepstream-6.3_6.3.0-1_arm64.deb

# libnvjpeg patch
wget -O r35_5_TEST_libnvjpeg_1.zip https://forums.developer.nvidia.com/uploads/short-url/nz3uWYNzgYxH82gXw2b2IQM4K5d.zip
unzip r35_5_TEST_libnvjpeg_1.zip
sudo mv libnvjpeg.so /usr/lib/aarch64-linux-gnu/tegra/

After unzipping the sample application:

mkdir build && cd build
cmake …
make

After successfully building, the test is run:

./test_jpeg </path/to/input.jpg> </path/to/output.jpg>

We get these results on both developer kit boards and production boards:

nvbufsurface: Could not get EGL display connection
nvbufsurface: Can't get EGL display
NvBufSurfaceMapEglImage() FAILED, ret: -1
Test encode FAILED

You indicated that you were not getting this error but that you were getting a corrupt output image:
b

Hi,
Please do clean re-flash and run the commands to set up:

$ sudo apt update
$ sudo apt install cmake
$ sudo apt install nvidia-jetpack
$ sudo apt install ./deepstream-6.3_6.3.0-1_arm64.deb
$ sudo apt -y purge *libopencv*
$ sudo apt install ./libalpropencvgpu4_4.5.5-200420240324133246_arm64.deb
$ sudo apt install ./libalpropencvgpu-dev_4.5.5-200420240324133246_arm64.deb

And see if no issue in executing NvBufSurfaceMapEglImage()

After following your instructions, the same error occurs:

nvbufsurftransform: Could not get EGL display connection
NvMMLiteOpen : Block : BlockType = 277
NvMMLiteBlockCreate : Block : BlockType = 277
Decoded input jpeg file: /test/nvidia/image_00000.jpg, size: 368640
nvbufsurface: Could not get EGL display connection
nvbufsurface: Can't get EGL display
NvBufSurfaceMapEglImage() FAILED, ret: -1
Test encode FAILED

Hi,
Which setup is your developer kit:

1. Xavier NX module with SD slot(SD card size >= 32GB)
2. Xavier NX module with eMMC and rootfs in NVMe SSD card

We are using an Orin AGX 32gb version developer kit board flashed to the EMMC

Hi,
The topic is moved to AGX Orin category. It was in Xavier NX category, so we thought you use Xavier NX.

We don’t observe the failure on both Jetpack 5.1.3/Xavier NX and AGX Orin developer kit. And for Orin series, the latest release is Jetpack 6.0GA. Not sure if you can try this version.

We are using a Jetson device in production. We are only testing the hwaccel JPEG encoding/decoding on the Orin Developer Kit Board because the same code failed on our Orin devices and we only had access to the Orin Developer Kit Board.

Hi,
Please share full steps you execute to download the Jetpack release, extract the BSP and rootfs, and flash AGX Orin developer kit. Probably there is deviation in the steps of flashing system image, triggering the issue.