aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-06-03 08:18:56 +0200
committerMattias Andrée <maandree@operamail.com>2014-06-03 08:18:56 +0200
commitc382e9317d7052eddb3960f61886651096c35b50 (patch)
tree345c7084c3ab96fae1f8cec6ad792fc09de8d7c6 /src/lib
parenttypo (diff)
downloadlibgamma-c382e9317d7052eddb3960f61886651096c35b50.tar.gz
libgamma-c382e9317d7052eddb3960f61886651096c35b50.tar.bz2
libgamma-c382e9317d7052eddb3960f61886651096c35b50.tar.xz
gamma-linux-drm: do not attempt to get the encoder for disabled connectors
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/lib/gamma-linux-drm.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/lib/gamma-linux-drm.c b/src/lib/gamma-linux-drm.c
index 5f66cdf..f192310 100644
--- a/src/lib/gamma-linux-drm.c
+++ b/src/lib/gamma-linux-drm.c
@@ -451,15 +451,19 @@ static drmModeConnector* find_connector(libgamma_crtc_state_t* restrict this, in
if ((card->encoders = calloc(n, sizeof(drmModeEncoder*))) == NULL) goto fail;
/* Fill connector and encoder arrays. */
for (i = 0; i < n; i++)
- if (((card->connectors[i] = drmModeGetConnector(card->fd, card->res->connectors[i])) == NULL) ||
- ((card->encoders[i] = drmModeGetEncoder(card->fd, card->connectors[i]->encoder_id)) == NULL))
- goto fail;
+ {
+ if ((card->connectors[i] = drmModeGetConnector(card->fd, card->res->connectors[i])) == NULL)
+ goto fail;
+ if ((card->connectors[i]->encoder_id != 0) &&
+ ((card->encoders[i] = drmModeGetEncoder(card->fd, card->connectors[i]->encoder_id)) == NULL))
+ goto fail;
+ }
}
/* No error has occurred yet. */
*error = 0;
/* Find connector. */
for (i = 0; i < n; i++)
- if (card->encoders[i]->crtc_id == crtc_id)
+ if ((card->encoders[i] != NULL) && (card->encoders[i]->crtc_id == crtc_id))
return card->connectors[i];
/* We did not find the connector. */
*error = LIBGAMMA_CONNECTOR_UNKNOWN;
@@ -749,6 +753,8 @@ int libgamma_linux_drm_get_crtc_information(libgamma_crtc_information_t* restric
/* Find connector. */
if ((connector = find_connector(crtc, &error)) == NULL)
{
+ perror("connector not found");
+ abort();
/* Store reported error in affected fields. */
e |= this->width_mm_error = this->height_mm_error
= this->connector_type = this->subpixel_order_error