Beginnings of multiple monitor

Marty Jack martyj19 at
Wed Feb 9 16:01:42 PST 2011

I have a little patch that allocates the CRTCs to avoid the multiple monitor black screen.  If you don't want it right now that's fine too.

I don't know what Kristian's ultimate vision of this is.  Do we allow windows to move like they do now on a virtual desktop where you can slide one to a RightOf monitor by dragging it and it appears part on one and part on the other?

A lot of the data structure and processing change for multiple monitors would depend on whether it is possible to have one pair of big FBs added to both CRTCs at the same time, with different (x,y,w,h) if it is tiled and the same (x,y) if it is cloned or how he would want to handle this case [moving the rbo, fb_id, image up to drm_compositor].  With some philosophical guidance I could get the underpinnings in place.

diff --git a/compositor/compositor-drm.c b/compositor/compositor-drm.c
index 6df6b34..d8827b7 100644
--- a/compositor/compositor-drm.c
+++ b/compositor/compositor-drm.c
@@ -37,6 +37,7 @@ struct drm_compositor {
        struct udev *udev;
        struct wl_event_source *drm_source;
+       uint32_t crtc_allocator;
        struct tty *tty;
@@ -198,7 +199,7 @@ create_output_for_connector(struct drm_compositor *ec,
        for (i = 0; i < resources->count_crtcs; i++) {
-               if (encoder->possible_crtcs & (1 << i))
+               if ((encoder->possible_crtcs & (1 << i)) && ( ! (ec->crtc_allocator & (1 << i))))
        if (i == resources->count_crtcs) {
@@ -210,6 +211,7 @@ create_output_for_connector(struct drm_compositor *ec,
        wlsc_output_init(&output->base, &ec->base, 0, 0,
                         mode->hdisplay, mode->vdisplay);
+       ec->crtc_allocator |= (1 << i);
        output->crtc_id = resources->crtcs[i];
        output->connector_id = connector->connector_id;
        output->mode = *mode;

More information about the wayland-devel mailing list