summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>2017-11-29 14:33:33 +0200
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2018-05-02 12:08:34 +0300
commit7f853799e2ec2c43c6d45e399ae575b86ef97e8a (patch)
tree8fe30429f7c179ad525ada968a22681a7ac24385
parentdb4c7d7237ac297cfdd22b9a1d856d9999399ff2 (diff)
downloadweston-7f853799e2ec2c43c6d45e399ae575b86ef97e8a.tar.gz
weston-7f853799e2ec2c43c6d45e399ae575b86ef97e8a.tar.bz2
weston-7f853799e2ec2c43c6d45e399ae575b86ef97e8a.zip
compositor-drm: head detach requires a modeset
When a head is detached from an enabled output, that output needs to go through a modeset (drmModeSetCrtc() / ATOMIC_ALLOW_MODESET) so that the connector is actually removed from the CRTC. This has not yet been a problem, because an output could only have one head at a time, and would be automatically disabled on detach. It would be a problem with clone mode. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Acked-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
-rw-r--r--libweston/compositor-drm.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 851446be..9e88962c 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -4394,6 +4394,23 @@ drm_output_attach_head(struct weston_output *output_base,
return 0;
}
+static void
+drm_output_detach_head(struct weston_output *output_base,
+ struct weston_head *head_base)
+{
+ struct drm_backend *b = to_drm_backend(output_base->compositor);
+
+ if (!output_base->enabled)
+ return;
+
+ /* Need to go through modeset to drop connectors that should no longer
+ * be driven. */
+ /* XXX: Ideally we'd do this per-output, not globally. */
+ b->state_invalid = true;
+
+ weston_output_schedule_repaint(output_base);
+}
+
static int
parse_gbm_format(const char *s, uint32_t default_value, uint32_t *gbm_format)
{
@@ -5407,6 +5424,7 @@ drm_output_create(struct weston_compositor *compositor, const char *name)
output->base.destroy = drm_output_destroy;
output->base.disable = drm_output_disable;
output->base.attach_head = drm_output_attach_head;
+ output->base.detach_head = drm_output_detach_head;
output->destroy_pending = 0;
output->disable_pending = 0;