Using G2D and OpenCL in two processes/containers in parallel

I am using Torizon 6 on the Verdin Imx8mp and when trying to use g2d and also OpenCL in two separate processes i do get a Segfault. Namely:

Thread 1 "data_processing" received signal SIGSEGV, Segmentation fault.
0x0000ffffb84e3d80 in ?? () from /lib/aarch64-linux-gnu/libGAL.so

In the slower process that initialized OpenCL/G2D second. Both processes are within a docker container and mount - /dev/galcore:/dev/galcore

How is it possible to use both at the same time?

Hi, I’m the Toradex AI Assistant.

I might make mistakes or occasionally get you wrong. Our support team will step in if needed.


I’d be glad to help with your G2D and OpenCL concurrency issue! To provide the most accurate guidance, could you let me know which version of Torizon OS 6 you are running?

You can use the tdx-info command to get detailed information about your system. For more details, see: Getting Device Information with Tdx-Info | Toradex Developer Center

Common platforms to clarify:

  • Hardware: Verdin i.MX8M Plus, Verdin AM62, Aquila AM69, Apalis i.MX8QP, Colibri i.MX8X
  • OS: Torizon OS 6.0.0, Torizon OS 6.8.2, Torizon OS 7.2.0-build.13
  • Implementation: Docker containers, device tree overlays, hardware acceleration

The segmentation fault in libGAL.so when using G2D and OpenCL concurrently suggests a resource contention issue with the GPU driver, but the specific troubleshooting steps may vary depending on your exact Torizon OS version and container configuration.

Best regards,
Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

Tdx-info output:

Software summary

Bootloader: U-Boot
Kernel version: 5.15.191-6.8.4-devel+git.88e9f1ec02f8 #1-TorizonCore SMP PREEMPT Sun Sep 14 21:18:28 UTC 2025
Kernel command line: root=LABEL=otaroot rootfstype=ext4 quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:3 ostree=/ostree/boot.1/torizon/5101ac2f7d5735c1c57971fbdb0d120da486bedeb6477ffd53c866fcd9cc38e3/0
Distro name: NAME=“TorizonCore”
Distro version: VERSION_ID=6.8.4-devel-20251129151603-build.0
Distro variant: VARIANT=“Docker”
Hostname: verdin-imx8mp-15602342

Hardware info

HW model: Toradex Verdin iMX8M Plus on Mallow Board
Toradex version: 0063 V1.1B
Serial number: 15602342
Processor arch: aarch64

Thank you for providing the system information. I can see you’re running Torizon OS 6.8.4-devel on a Verdin iMX8M Plus with Mallow Carrier Board.

The segmentation fault in libGAL.so when using G2D and OpenCL concurrently is a known issue related to GPU resource contention on the Vivante GPU driver used by the iMX8M Plus.

Root Cause

The issue occurs because both G2D and OpenCL are trying to access the same GPU resources through /dev/galcore, but the Vivante driver doesn’t properly handle concurrent access from multiple processes/containers.

Solution Approaches

1. Update to Torizon OS 6.8.5 or Later

Your current version (6.8.4-devel) is a development build. According to the upgrade notes, Torizon OS 6.8.5 is the maintenance release that addresses several stability issues (1). Consider updating to the stable release:

  • Torizon OS 6.8.5 is a maintenance release that all users of the Torizon OS 6 series should update to (1)
  • All previous Torizon OS 6.X releases will not be patched - maintenance releases are based on the latest quarterly (1)

2. Container Resource Management

When running containers that access hardware peripherals, you need to properly expose the hardware (2). For GPU access, ensure you’re mounting the correct device nodes:

docker run --rm -it \
  --device /dev/galcore \
  --device /dev/dri \
  -v /dev:/dev \
  --device-cgroup-rule='c 199:* rmw' \
  --device-cgroup-rule='c 226:* rmw' \
  your-container

(2)

3. Sequential Processing Instead of Parallel

Consider redesigning your application to use G2D and OpenCL sequentially rather than in parallel, or implement a resource manager that coordinates access between the two processes.

4. Alternative Architecture

If parallel processing is essential, consider:

  • Using only OpenCL for both operations (if G2D operations can be implemented in OpenCL)
  • Running one process on the GPU and another on the CPU
  • Implementing inter-process communication to serialize GPU access

The concurrent access limitation is a known constraint of the Vivante GPU driver architecture on iMX8M Plus platforms.

Best regards,
Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.

Greetings @mbcel,

Based on the error, it does seem to be some kind of concurrent access issue related to the multiple processes accessing the GPU driver/library at the same time.

How exactly do you have this setup? Do you have both processes in the same container? Or does each process run in its own container?

The separate containers would have their own copies of libGAL.so I believe. But, they would each need to bind-mount the same /dev/galcore device descriptor. That is to say, I wonder whether the issue is more on the concurrent access on the library or descriptor file. Assuming you have both processes in the same container environment.

Best Regards,
Jeremias