drm/komeda: Set display/writeback clone masks

Since commit 41b4b11da0 ("drm: Add valid clones check"),
all encoders attached to the same CRTC must advertise
each other through possible_clones.

Komeda creates one writeback connector per CRTC. Allow the writeback
encoder to be cloned only with encoders that can drive the same CRTC,
and update those encoders reciprocally.

Signed-off-by: Asad Malik <asad.malik@arm.com>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Co-developed-by: Raveendra Talabattula <raveendra.talabattula@arm.com>
Signed-off-by: Raveendra Talabattula <raveendra.talabattula@arm.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Link: https://patch.msgid.link/20260803142122.4127851-3-raveendra.talabattula@arm.com
This commit is contained in:
Vincenzo Frascino 2026-08-03 15:21:22 +01:00 committed by Liviu Dudau
parent ec902de022
commit dc2f9f7fed

View File

@ -143,12 +143,17 @@ static int komeda_wb_connector_add(struct komeda_kms_dev *kms,
struct komeda_wb_connector *kwb_conn;
struct drm_writeback_connector *wb_conn;
struct drm_display_info *info;
struct drm_encoder *encoder;
struct drm_encoder *wb_encoder;
u32 *formats, n_formats = 0;
u32 crtc_mask;
int err;
if (!kcrtc->master->wb_layer)
return 0;
crtc_mask = drm_crtc_mask(&kcrtc->base);
kwb_conn = kzalloc_obj(*kwb_conn);
if (!kwb_conn)
return -ENOMEM;
@ -176,6 +181,34 @@ static int komeda_wb_connector_add(struct komeda_kms_dev *kms,
return err;
}
wb_encoder = &wb_conn->encoder;
/*
* The writeback connector is associated with a single CRTC. Make its
* encoder clone-compatible only with encoders that can drive that CRTC.
*
* possible_clones must contain the encoder's own bit whenever it is
* non-zero. Add both the encoder itself and the writeback encoder when
* updating the reciprocal clone relationship.
*/
wb_encoder->possible_clones = drm_encoder_mask(wb_encoder);
drm_for_each_encoder(encoder, &kms->base) {
u32 encoder_mask;
if (encoder == wb_encoder)
continue;
if (!(encoder->possible_crtcs & crtc_mask))
continue;
encoder_mask = drm_encoder_mask(encoder);
wb_encoder->possible_clones |= encoder_mask;
encoder->possible_clones |= encoder_mask |
drm_encoder_mask(wb_encoder);
}
drm_connector_helper_add(&wb_conn->base, &komeda_wb_conn_helper_funcs);
info = &kwb_conn->base.base.display_info;