Skip to content

Conversation

bith3ad
Copy link
Contributor

@bith3ad bith3ad commented Jun 30, 2025

At the moment we miss the support to drive multiple connectors which are connected to the same CRTC, also called a hardware clone mode.

libplatsch is not using the DRM atomic API due to it limited scope therefore using properties values isn't sufficient. Instead all possible connector ids need to be passed during the drmModeSetCrtc().

To find all connectors which belong to the same CRTC, the encoder behind each connector must be validated by making use of the encoders '.possible_clones' array.

If a connector shall be added which belongs to an already used CRTC, a check is performed to see if this connector can be driven by the CRTC. In that case the connector id is added to the 'struct modeset_dev::conn_id' array and -EEXIST is returned.

Because of this error, no new 'struct modeset_dev' is added and certain error() messages aren't printed because this can be a valid use-case.

At the moment we miss the support to drive multiple connectors which are
connected to the same CRTC, also called a hardware clone mode.

libplatsch is not using the DRM atomic API due to it limited scope
therefore using properties values isn't sufficient. Instead all possible
connector ids need to be passed during the drmModeSetCrtc().

To find all connectors which belong to the same CRTC, the encoder behind
each connector must be validated by making use of the encoders
'.possible_clones' array.

If a connector shall be added which belongs to an already used CRTC, a check
is performed to see if this connector can be driven by the CRTC. In that
case the connector id is added to the 'struct modeset_dev::conn_id'
array and -EEXIST is returned.

Because of this error, no new 'struct modeset_dev' is added and certain
error() messages aren't printed because this can be a valid use-case.

Signed-off-by: Marco Felsch <[email protected]>
Comment on lines +176 to +179
for (i = 0; i < dev->max_conn_num; i++) {
if (dev->conn_id[i] == 0)
break;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this iteration needed? AFAICS you already know the last used array entry by looking at dev->conn_num.

Comment on lines +181 to +184
if (i == dev->max_conn_num) {
error("Failed to add connector-id: %u\n", connector_id);
return;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would this happen? The array is sized to hold all connectors of the device, so this should not ever happen. Seems a bit over-defensive.


/*
* Get the global encoder idx first to be able to check for
* possible clonse later.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type in clones.

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.

2 participants