compositor-drm: head attach requires a modeset
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>
Fri, 8 Dec 2017 12:45:00 +0000 (14:45 +0200)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Wed, 2 May 2018 09:08:34 +0000 (12:08 +0300)
For the attach on an enabled output to have an effect, we need to go
through drmModeSetCrtc or ATOMIC_ALLOW_MODESET.

v9:
- Add another XXX comment.

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>
libweston/compositor-drm.c

index 9e88962c0182fd0e57fec3704e5e1a5adc1f0910..592ee76aa0ee7128b5d9ef7d2082c8e350fdf89c 100644 (file)
@@ -4388,9 +4388,27 @@ static int
 drm_output_attach_head(struct weston_output *output_base,
                       struct weston_head *head_base)
 {
+       struct drm_backend *b = to_drm_backend(output_base->compositor);
+
        if (wl_list_length(&output_base->head_list) >= MAX_CLONED_CONNECTORS)
                return -1;
 
+       if (!output_base->enabled)
+               return 0;
+
+       /* XXX: ensure the configuration will work.
+        * This is actually impossible without major infrastructure
+        * work. */
+
+       /* Need to go through modeset to add connectors. */
+       /* XXX: Ideally we'd do this per-output, not globally. */
+       /* XXX: Doing it globally, what guarantees another output's update
+        * will not clear the flag before this output is updated?
+        */
+       b->state_invalid = true;
+
+       weston_output_schedule_repaint(output_base);
+
        return 0;
 }