SFML: Cannot create DRM context without X server running.

Prerequisite Checklist

Describe your issue here

When I attempt to run any of the example programs I get the message:

DRM device used: 0
DRM device used: 1
DRM using the current mode
DRM Mode used: 3840x2160@60
Failed to set mode: Invalid argument

I’ve tried with different modes using SFML_DRM_MODE and selecting different devices with SFML_DRM_DEVICE but the outcome is the same no matter the combination.

If I start the same program with startx then it doesn’t give an error but there is no output on the display.

I’ve confirmed the GPU can output the selected mode with glmark2 and with a vanilla build of SFML. It’s only the DRM build that won’t start.

Your Environment

  • OS / distro / window manager: Linux 6.1.25 Debian Bookworm
  • SFML version: 2.6.1
  • Compiler / toolchain: GCC version 12.2.0 - aarch64-linux-gnu
  • Special compiler / CMake flags: SFML_USE_DRM SFML_BUILD_EXAMPLES

Steps to reproduce

  1. Download SFML 2.6.1 source
  2. Build with CMAKE flag SFML_USE_DRM and SFML_BUILD_EXAMPLES
  3. Run ./examples/opengl/opengl without an X server running

Expected behavior

Connected display should show a spinning cube on a jungle background

Actual behavior

Program wont start with the error message “Failed to set mode: Invalid argument”

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 25 (11 by maintainers)

Most upvoted comments

I just tested this on a cm4 board running raspbian 64 bit and works perfect.

Compile the 2.6.x branch with SFML_USE_DRM flag

The DRM implementation was written/ported by @mickelson, @oomek and @substring. Maybe they can look into this.