From 08b0efd69bb5b9b7d3c4bf7a69bceac116baf835 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 10 Aug 2015 22:24:08 +0200 Subject: add support for graphics cards that report crtc:s without connectors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/drmgamma.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/drmgamma.c b/src/drmgamma.c index d738dd4..8f3dd97 100644 --- a/src/drmgamma.c +++ b/src/drmgamma.c @@ -166,6 +166,8 @@ int drm_crtc_open(size_t index, drm_card_t* restrict card, drm_crtc_t* restrict crtc->id = card->res->crtcs[index]; crtc->card = card; + crtc->connector = NULL; + crtc->encoder = NULL; for (i = 0; i < card->connector_count; i++) if (card->encoders[i] != NULL) if (card->encoders[i]->crtc_id == crtc->id) @@ -174,7 +176,7 @@ int drm_crtc_open(size_t index, drm_card_t* restrict card, drm_crtc_t* restrict crtc->encoder = card->encoders[i]; } - crtc->connected = crtc->connector->connection == DRM_MODE_CONNECTED; + crtc->connected = (crtc->connector != NULL) && (crtc->connector->connection == DRM_MODE_CONNECTED); info = drmModeGetCrtc(card->fd, crtc->id); if (info == NULL) @@ -189,6 +191,8 @@ int drm_crtc_open(size_t index, drm_card_t* restrict card, drm_crtc_t* restrict crtc->green = crtc->red + crtc->gamma_stops; crtc->blue = crtc->green + crtc->gamma_stops; + if (crtc->connector == NULL) + return 0; for (i = 0; i < (size_t)(crtc->connector->count_props); i++) { size_t j; -- cgit v1.2.3-70-g09d2