Skip to content

[rcore] No suitable DRM connector found on Raspberry Pi with composite output #4293

@emdzej

Description

@emdzej

Issue description

When using composite output only on Raspberry Pi Zero W, when trying to initialise raylib the output is as follows:

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
TRACE: DISPLAY: Connectors found: 1
TRACE: DISPLAY: Connector index 0
TRACE: DISPLAY: Connector modes detected: 4
TRACE: DISPLAY: DRM mode NOT connected (deleting)
WARNING: DISPLAY: No suitable DRM connector found
WARNING: TEXTURE: Failed to load texture
WARNING: TEXTURE: Failed to load default texture

Environment

Raylib 5.0 compiled from source on Raspberry Pi Zero w Linux 6.6.31+rpt-rpi-v6 #1 Raspbian 1:6.6.31-1+rpt1 (2024-05-29) armv6l GNU/Linux

Code Example

Used core_basic_window.c from examples.

Investigation

The issue seems to be related to the code in rcore_drm.c

if ((con->connection == DRM_MODE_CONNECTED) && (con->encoder_id))
        {
            TRACELOG(LOG_TRACE, "DISPLAY: DRM mode connected");
            platform.connector = con;
            break;
        }
        else
        {
            TRACELOG(LOG_TRACE, "DISPLAY: DRM mode NOT connected (deleting)");
            drmModeFreeConnector(con);
        }

because in my case the connector status is unknown as can bee seen on modetest -c output:

trying to open device 'vc4'...done
Connectors:
id	encoder	status		name		size (mm)	modes	encoders
45	44	unknown	Composite-1    	0x0		4	44
  modes:
	index name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot
  #0 720x480i 29.97 720 736 800 858 480 486 492 525 13500 flags: nhsync, nvsync, interlace; type: preferred, driver
  #1 720x576i 25.00 720 732 796 864 576 581 587 625 13500 flags: nhsync, nvsync, interlace; type: driver
  #2 720x288 50.08 720 740 804 864 288 290 293 312 13500 flags: ; type: driver
  #3 720x240 60.05 720 734 798 858 240 243 246 262 13500 flags: ; type: driver
  props:

Dirty solution

While this seems like the OS / hardware? issue which reports unknown status of the connector (or maybe it's not supported at all in certain hardware configurations), I was wondering if this could be a valid case to inlcude as an option in the library, to overcome this limitation.

Doing a cheap and dirty fix like this

        if (
            ((con->connection == DRM_MODE_CONNECTED) || (con->connection == DRM_MODE_UNKNOWNCONNECTION))
            && (con->encoder_id)
           )
        {
            TRACELOG(LOG_TRACE, "DISPLAY: DRM mode connected");
            platform.connector = con;
            break;
        }
        else
        {
            TRACELOG(LOG_TRACE, "DISPLAY: DRM mode NOT connected (deleting)");
            drmModeFreeConnector(con);
        }

solves the problem. Not sure what would be other implications of such a change, but anyway reporting it for anyone interested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions