Skip to content

libplatsch: handle possible clones#9

Open
bith3ad wants to merge 1 commit intopengutronix:mainfrom
bith3ad:mfe/hardware-connector-clone
Open

libplatsch: handle possible clones#9
bith3ad wants to merge 1 commit intopengutronix:mainfrom
bith3ad:mfe/hardware-connector-clone

Conversation

@bith3ad
Copy link
Copy Markdown
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 <m.felsch@pengutronix.de>
Comment thread libplatsch.c
Comment on lines +176 to +179
for (i = 0; i < dev->max_conn_num; i++) {
if (dev->conn_id[i] == 0)
break;
}
Copy link
Copy Markdown
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 thread libplatsch.c
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
Copy Markdown
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.

Comment thread libplatsch.c

/*
* Get the global encoder idx first to be able to check for
* possible clonse later.
Copy link
Copy Markdown
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