On 18.07.25 12:23, Louis Chauvet wrote:
Le 03/07/2025 à 11:03, Robert Mader a écrit :
Since commit 41b4b11da0215 ("drm: Add valid clones check") setting
the `possible_clones` values is a hard requirement for cloning.
`vkms` supports cloning for writeback connectors in order to capture
CRTC content, however that broke with said commit.
Writeback connectors are created on a per-CRTC basis, thus mark
every non-writeback connector that is compatible with a given CRTC
as possible clone - and vice-versa.
Using a default configuration, the corresponding `drm_info` output
changes from:
├───Encoders
│ ├───Encoder 0
│ │ ├───Object ID: 40
│ │ ├───Type: virtual
│ │ ├───CRTCS: {0}
│ │ └───Clones: {0}
│ └───Encoder 1
│ ├───Object ID: 41
│ ├───Type: virtual
│ ├───CRTCS: {0}
│ └───Clones: {1}
to:
├───Encoders
│ ├───Encoder 0
│ │ ├───Object ID: 44
│ │ ├───Type: virtual
│ │ ├───CRTCS: {0}
│ │ └───Clones: {0, 1}
│ └───Encoder 1
│ ├───Object ID: 50
│ ├───Type: virtual
│ ├───CRTCS: {0}
│ └───Clones: {0, 1}
Signed-off-by: Robert Mader <robert.ma...@collabora.com>
Hi,
About the Fixes tag, I think you can add it anyway, if the patch is
not applicable on previous kernel version, this is not an issue, it
will just be ignored.
Alright, added
Fixes: dbd9d80c1b2e (drm/vkms: Add support for writeback)
in v2.
---
drivers/gpu/drm/vkms/vkms_output.c | 12 ++++++++++++
drivers/gpu/drm/vkms/vkms_writeback.c | 2 ++
2 files changed, 14 insertions(+)
diff --git a/drivers/gpu/drm/vkms/vkms_output.c
b/drivers/gpu/drm/vkms/vkms_output.c
index 8d7ca0cdd79f..21935eb88198 100644
--- a/drivers/gpu/drm/vkms/vkms_output.c
+++ b/drivers/gpu/drm/vkms/vkms_output.c
@@ -77,9 +77,21 @@ int vkms_output_init(struct vkms_device *vkmsdev)
return ret;
}
+ encoder_cfg->encoder->possible_clones |=
BIT(drm_encoder_index(encoder_cfg->encoder));
+
vkms_config_encoder_for_each_possible_crtc(encoder_cfg, idx,
possible_crtc) {
encoder_cfg->encoder->possible_crtcs |=
drm_crtc_mask(&possible_crtc->crtc->crtc);
+
+ if (vkms_config_crtc_get_writeback(possible_crtc)) {
+ struct drm_encoder *wb_encoder =
+ &possible_crtc->crtc->wb_encoder;
+
+ encoder_cfg->encoder->possible_clones |=
+ BIT(drm_encoder_index(wb_encoder));
+ wb_encoder->possible_clones |=
+ BIT(drm_encoder_index(encoder_cfg->encoder));
Can you use drm_encoder_mask directly?
Much better, done for all places in v2.
Thanks a lot for this patch,
Louis Chauvet
Thanks for the feedback!
+ }
}
}
diff --git a/drivers/gpu/drm/vkms/vkms_writeback.c
b/drivers/gpu/drm/vkms/vkms_writeback.c
index fe163271d5b5..12b60fb97c68 100644
--- a/drivers/gpu/drm/vkms/vkms_writeback.c
+++ b/drivers/gpu/drm/vkms/vkms_writeback.c
@@ -174,6 +174,8 @@ int vkms_enable_writeback_connector(struct
vkms_device *vkmsdev,
if (ret)
return ret;
vkms_output->wb_encoder.possible_crtcs |=
drm_crtc_mask(&vkms_output->crtc);
+ vkms_output->wb_encoder.possible_clones |=
+ BIT(drm_encoder_index(&vkms_output->wb_encoder));
drm_connector_helper_add(&wb->base, &vkms_wb_conn_helper_funcs);
--
Robert Mader
Consultant Software Developer
Collabora Ltd.
Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK
Registered in England & Wales, no. 5513718