use hdmi connector to main output if there is no connected connector 83/163883/3
authorJunkyeong Kim <jk0430.kim@samsung.com>
Thu, 14 Dec 2017 01:32:44 +0000 (10:32 +0900)
committerJunkyeong Kim <jk0430.kim@samsung.com>
Mon, 18 Dec 2017 07:24:23 +0000 (16:24 +0900)
Change-Id: I87ab515be8e908f024402d1a7da2f400fdaadb72
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
src/tdm_nexell_display.c

index 8acc4a8a60c01d96bc3f137b212a948f276f7f60..0f17866bea423a7c388829a04d72d33fdefdeed6 100644 (file)
@@ -781,6 +781,7 @@ tdm_nexell_display_create_output_list(tdm_nexell_data *nexell_data)
        drmModeConnectorPtr connector;
        drmModeEncoderPtr encoder;
        int conn_idx = -1;
+       int hdmia_idx = -1, hdmib_idx = -1;
        int crtc_id = 0, c, j;
 
        RETURN_VAL_IF_FAIL(LIST_IS_EMPTY(&nexell_data->output_list),
@@ -805,12 +806,25 @@ tdm_nexell_display_create_output_list(tdm_nexell_data *nexell_data)
                        drmModeFreeConnector(connector);
                        break;
                }
+
+               if (connector->connector_type == DRM_MODE_CONNECTOR_HDMIA)
+                       hdmia_idx = i;
+               if (connector->connector_type == DRM_MODE_CONNECTOR_HDMIB)
+                       hdmib_idx = i;
+
                drmModeFreeConnector(connector);
        }
 
-       /* use the first connecoct_id if there is not connector which is connected */
-       if (conn_idx == -1)
-               conn_idx = 0;
+       /* use the hdmi connector if there is no connected connector. */
+       /* if there is no hdmi connector, use first connector. */
+       if (conn_idx == -1) {
+               if (hdmia_idx != -1)
+                       conn_idx = hdmia_idx;
+               else if (hdmib_idx != -1)
+                       conn_idx = hdmib_idx;
+               else
+                       conn_idx = 0;
+       }
 
        /* The TDM drm backend considers only 1 connector because it is the TDM
         * reference backend and can't take care of all hardware devices.