To select an encoder, CRTC, and connector
- Open a DRM device file using
drmOpen. - Obtain DRM-KMS resources using
drmModeGetResources. - (Optional) Get plane info using
drmModeGetPlaneanddrmModeGetPlaneResources. - Query the desired connector using
drmModeGetConnector.All valid modes for a connector can be retrieved with a call to
drmModeGetConnector. Select the mode to be used and save it. The first mode in the list is the default mode with the highest resolution possible and often a suitable choice - If there is already an encoder attached to the connector, choose it using
drmModeGetEncoder.If the attached encoder is incompatible with CRTC/plane find another one by iterating over all available encoders.
- Select a suitable CRTC.
- For each connector, find a CRTC to drive this connector. To find a suitable CRTC, iterate over the list of encoders that are available for each connector. Each encoder contains a list of CRTCs that it can work with and select one of these CRTCs.
- Query info for CRTC,
drmModeGetCrtc.
- If necessary, set the mode using
drmModeSetCrtc. Obtain the layer for the plane/CRTC.Use CRTC to drive the selected connector with a call to
drmModeSetCrtc. - If a plane must be used, set it using
drmModeSetPlane.