ecore-drm: Only try to set the crtc mode if an output is connected
authorChris Michael <cp.michael@samsung.com>
Mon, 18 May 2015 14:15:09 +0000 (10:15 -0400)
committerChris Michael <cp.michael@samsung.com>
Mon, 18 May 2015 14:15:09 +0000 (10:15 -0400)
Summary: If an output is disconnected, then we should not be trying to
set the mode of it's CRTC as that is going to fail anyway.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/lib/ecore_drm/ecore_drm_output.c

index e1b0b15..c66a9da 100644 (file)
@@ -498,14 +498,17 @@ _ecore_drm_output_create(Ecore_Drm_Device *dev, drmModeRes *res, drmModeConnecto
 
    output->current_mode->flags |= DRM_MODE_TYPE_DEFAULT;
 
-   if (drmModeSetCrtc(output->dev->drm.fd, output->crtc_id,
-                      output->crtc->buffer_id, 0, 0,
-                      &output->conn_id, 1, &output->current_mode->info) < 0)
+   if (output->connected)
      {
-        ERR("Failed to set Mode %dx%d for Output %s: %m",
-            output->current_mode->width, output->current_mode->height,
-            output->name);
-        goto err;
+        if (drmModeSetCrtc(output->dev->drm.fd, output->crtc_id,
+                           output->crtc->buffer_id, 0, 0,
+                           &output->conn_id, 1, &output->current_mode->info) < 0)
+          {
+             ERR("Failed to set Mode %dx%d for Output %s: %m",
+                 output->current_mode->width, output->current_mode->height,
+                 output->name);
+             goto err;
+          }
      }
 
    /* try to init backlight */