summaryrefslogtreecommitdiff
path: root/src/sna
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2018-11-30 14:11:04 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2019-01-10 10:01:58 +0000
commitc37c7ee0748ba828ec5d2c7304cd2a17af2c8109 (patch)
treecb3909b7c1bc9194dc4239969acc961403d72231 /src/sna
parent985553dff9d9de255edb6acb0ae85117ceb3e76c (diff)
sna: Switch off old outputs on topology changes
The kernel may keep the old connector id around so that userspace can gracefully switch it off, which means that on detecting a topology change (a new id for an old connector path), we must do a SetCRTC to release the old resources. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106250 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna')
-rw-r--r--src/sna/sna_display.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index f6a6d99b..fe67f85b 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -5254,6 +5254,20 @@ sna_output_add(struct sna *sna, unsigned id, unsigned serial)
if (strcmp(output->name, name) == 0) {
assert(output->scrn == scrn);
assert(output->funcs == &sna_output_funcs);
+
+ /*
+ * If the old output is still in use, tell
+ * the kernel to switch it off so we can
+ * move its resources over to the new id.
+ */
+ if (output->crtc) {
+ struct drm_mode_crtc arg = {
+ .crtc_id = __sna_crtc_id(to_sna_crtc(output->crtc)),
+ };
+ drmIoctl(sna->kgem.fd, DRM_IOCTL_MODE_SETCRTC, &arg);
+ output->crtc = NULL;
+ }
+
sna_output_destroy(output);
goto reset;
}