Skip to content

[core] Issues running in native mode with PLATFORM_DRM in Bullseye in RPI Zero W #2439

@raysan5

Description

@raysan5

I'm trying to run raylib in native mode in RPI Zero W with latest RPI OS Bullseye and KMS driver. After installing required libraries (libgles2-dev, libgbm-dev, libdrm-dev), compilation works ok but program crashes on run:

pi@raspberrypi:~/raylib/examples $ ./core/core_basic_window
INFO: Initializing raylib 4.1-dev
INFO: Supported raylib modules:
INFO:     > rcore:..... loaded (mandatory)
INFO:     > rlgl:...... loaded (mandatory)
INFO:     > rshapes:... loaded (optional)
INFO:     > rtextures:. loaded (optional)
INFO:     > rtext:..... loaded (optional)
INFO:     > rmodels:... loaded (optional)
INFO:     > raudio:.... loaded (optional)
INFO: DISPLAY: No graphic card set, trying platform-gpu-card
INFO: DISPLAY: Failed to open platform-gpu-card, trying card1
INFO: DISPLAY: Failed to open graphic card1, trying card0
INFO: DISPLAY: Selected DRM connector mode 1280x720 (1280x720p@60)
INFO: DISPLAY: Device initialized successfully
INFO:     > Display size: 1280 x 720
INFO:     > Screen size:  1280 x 720
INFO:     > Render size:  1280 x 720
INFO:     > Viewport offsets: 0, 0
INFO: GL: Supported extensions count: 52
INFO: GL: OpenGL device information:
INFO:     > Vendor:   Broadcom
INFO:     > Renderer: VC4 V3D 2.1
INFO:     > Version:  OpenGL ES 2.0 Mesa 20.3.5
INFO:     > GLSL:     OpenGL ES GLSL ES 1.0.16
INFO: GL: VAO extension detected, VAO functions loaded successfully
INFO: GL: NPOT textures extension detected, full NPOT textures supported
INFO: GL: ETC1 compressed textures supported
INFO: TEXTURE: [ID 1] Texture loaded successfully (1x1 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 1] Default texture loaded successfully
INFO: SHADER: [ID 1] Vertex shader compiled successfully
INFO: SHADER: [ID 2] Fragment shader compiled successfully
INFO: SHADER: [ID 3] Program shader loaded successfully
INFO: SHADER: [ID 3] Default shader loaded successfully
INFO: RLGL: Render batch vertex buffers loaded successfully in RAM (CPU)
INFO: RLGL: Render batch vertex buffers loaded successfully in VRAM (GPU)
INFO: RLGL: Default OpenGL state initialized successfully
INFO: TEXTURE: [ID 2] Texture loaded successfully (128x128 | GRAY_ALPHA | 1 mipmaps)
INFO: FONT: Default font loaded successfully (224 glyphs)
INFO: RPI: Opening input device: /dev/input/event1 (mouse )
INFO: RPI: Opening keyboard device: /dev/input/event0
WARNING: RPI: Failed to open Gamepad device, no gamepad available
INFO: TIMER: Target time per frame: 16.667 milliseconds
ERROR: DISPLAY: Failed GBM to lock front buffer
Segmentation fault
pi@raspberrypi:~/raylib/examples $

The system is properly configured to run on native mode with Full KMS acceleration enabled:

sudo raspi-config > Advance Options > A2 GL Driver > G2 GL (Full KMS) OpenGL desktop driver with full KMS

Driver is properly enabled in /boot/config.txt

# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d
max_framebuffers = 2
gpu_mem = 256

In case it is relevant, user permissions have been reviewed:

sudo usermod -a -G render pi

The output is the HDMI, it should be the default output and it seems to be detected correctly:

INFO: DISPLAY: No graphic card set, trying platform-gpu-card
INFO: DISPLAY: Failed to open platform-gpu-card, trying card1
INFO: DISPLAY: Failed to open graphic card1, trying card0
INFO: DISPLAY: Selected DRM connector mode 1280x720 (1280x720p@60)
INFO: DISPLAY: Device initialized successfully

The error is related to function gbm_surface_lock_front_buffer() -> ERROR: DISPLAY: Failed GBM to lock front buffer.

Any idea?

EDIT: useful info: https://symbolibre.org/graphics-acceleration-on-the-raspberry-pi-zero.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions