From 871a9cff032e8802684a66eaa8a7b7bcc50f6947 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Tue, 2 Aug 2016 13:24:40 -0500 Subject: [PATCH] ecore_drm2: Fix a condition where no outputs are enabled If the first output we test is disconnected but has the crtc of the primary display assigned then we'll fail to assign the crtc to the connector it's really connected to later. This is a quick hack as trying to sort this out properly may be too invasive for the upcoming 1.18 and isn't really important until 1.19 supports multihead anyway. --- src/lib/ecore_drm2/ecore_drm2_outputs.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib/ecore_drm2/ecore_drm2_outputs.c b/src/lib/ecore_drm2/ecore_drm2_outputs.c index 6fe2180b68..a48170ca97 100644 --- a/src/lib/ecore_drm2/ecore_drm2_outputs.c +++ b/src/lib/ecore_drm2/ecore_drm2_outputs.c @@ -234,6 +234,15 @@ _output_crtc_find(const drmModeRes *res, const drmModeConnector *conn, Ecore_Drm uint32_t crtc; int i = 0, j = 0; + /* Skip all disconnected connectors... + * + * When a connector is disconnected it still has an encoder id + * which messes up our output selection code later. When we support + * multi-head properly and hotplug becomes a real thing we'll + * need to revisit this hack (and the crtc assignment code as well) + */ + if (conn->connection != DRM_MODE_CONNECTED) return -1; + for (j = 0; j < conn->count_encoders; j++) { enc = drmModeGetEncoder(dev->fd, conn->encoders[j]);