Beginnings of multiple monitor
authorMarty Jack <martyj19@comcast.net>
Thu, 10 Feb 2011 00:01:42 +0000 (19:01 -0500)
committerKristian Høgsberg <krh@bitplanet.net>
Sun, 13 Mar 2011 19:02:01 +0000 (15:02 -0400)
Allocate the CRTCs from a bit mask to avoid the multiple monitor black
screen problem.

compositor/compositor-drm.c

index e55c5f2..135e1cb 100644 (file)
@@ -43,6 +43,7 @@ struct drm_compositor {
        struct {
                int fd;
        } drm;
+       uint32_t crtc_allocator;
        struct tty *tty;
 };
 
@@ -204,7 +205,8 @@ 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)))
                        break;
        }
        if (i == resources->count_crtcs) {
@@ -216,6 +218,7 @@ create_output_for_connector(struct drm_compositor *ec,
        wlsc_output_init(&output->base, &ec->base, 0, 0,
                         mode->hdisplay, mode->vdisplay, 0);
 
+       ec->crtc_allocator |= (1 << i);
        output->crtc_id = resources->crtcs[i];
        output->connector_id = connector->connector_id;
        output->mode = *mode;