Skip to content

drm: select a CRTC from possible_crtcs when none is bound yet - #792

Open
alchark wants to merge 1 commit into
Igalia:masterfrom
flipperdevices:possible-crtcs
Open

alchark wants to merge 1 commit into
Igalia:masterfrom
flipperdevices:possible-crtcs

Conversation

@alchark

@alchark alchark commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

init_drm() located the CRTC for the chosen connector by looking for an encoder whose crtc_id already pointed at a CRTC, i.e. it required that a modeset had already been performed by some other DRM client or fbdev. On a freshly booted device where nothing has driven the pipeline yet, every encoder reports crtc_id == 0, so the search failed with

no crtc for encoder found!

and cog aborted ("Failed to initialize DRM"). cog could only start once an unrelated client (e.g. a display manager) had performed the first modeset and populated encoder->crtc_id.

Prefer the CRTC bound to the connector's currently active encoder, when there is one (avoids re-routing a CRTC another client drives). Otherwise pick the first CRTC allowed by the possible_crtcs bitmask of any of the connector's encoders (which should work even before the first modeset).

While at that, iterate the connector's own encoder list instead of every encoder in the device.

init_drm() located the CRTC for the chosen connector by looking for an
encoder whose crtc_id already pointed at a CRTC, i.e. it required that a
modeset had already been performed by some other DRM client or fbdev. On a
freshly booted device where nothing has driven the pipeline yet, every
encoder reports crtc_id == 0, so the search failed with

    no crtc for encoder found!

and cog aborted ("Failed to initialize DRM"). cog could only start once
an unrelated client (e.g. a display manager) had performed the first
modeset and populated encoder->crtc_id.

Prefer the CRTC bound to the connector's currently active encoder, when
there is one (avoids re-routing a CRTC another client drives). Otherwise
pick the first CRTC allowed by the possible_crtcs bitmask of any of the
connector's encoders (which should work even before the first modeset).

While at that, iterate the connector's own encoder list instead of every
encoder in the device.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant