diff options
author | Andrew F. Davis | 2019-06-11 16:12:09 -0500 |
---|---|---|
committer | Andrew F. Davis | 2019-06-28 10:32:54 -0500 |
commit | 595c7819bb42e1ddda7362a98000dfbe61b627e8 (patch) | |
tree | e926282e778f377b37ffed0a66257e5f9182266c | |
parent | 007419d9788ab730971e804e0040ef3710dd21a3 (diff) | |
download | hardware-ti-am65x-595c7819bb42e1ddda7362a98000dfbe61b627e8.tar.gz hardware-ti-am65x-595c7819bb42e1ddda7362a98000dfbe61b627e8.tar.xz hardware-ti-am65x-595c7819bb42e1ddda7362a98000dfbe61b627e8.zip |
libhwcomposer: Fix possible lock condition in adding external display
If the external display is unplugged before the EDID information is
read out then we may get locked waiting for the information to become
available. Check for a connection inside this loop to break out if
the display we are waiting for is no longer attached.
Signed-off-by: Andrew F. Davis <afd@ti.com>
-rw-r--r-- | libhwcomposer/hwc.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp index d0d5d0d..d4bdbb8 100644 --- a/libhwcomposer/hwc.cpp +++ b/libhwcomposer/hwc.cpp | |||
@@ -232,9 +232,14 @@ static int add_external_hdmi_display(omap_hwc_device_t* hwc_dev) | |||
232 | } | 232 | } |
233 | 233 | ||
234 | /* wait until EDID read finishes */ | 234 | /* wait until EDID read finishes */ |
235 | do { | 235 | while (connector->get_modes().size() == 0) { |
236 | connector->refresh(); | 236 | connector->refresh(); |
237 | } while (connector->get_modes().size() == 0); | 237 | // Check for disconnect while waiting for EDID read |
238 | if (connector->connected() != DRM_MODE_CONNECTED) { | ||
239 | ALOGE("External display disconnected"); | ||
240 | return -1; | ||
241 | } | ||
242 | } | ||
238 | 243 | ||
239 | HWCDisplay* display = new HWCDisplay(DISP_ROLE_SECONDARY); | 244 | HWCDisplay* display = new HWCDisplay(DISP_ROLE_SECONDARY); |
240 | hwc_dev->displays[HWC_DISPLAY_EXTERNAL] = display; | 245 | hwc_dev->displays[HWC_DISPLAY_EXTERNAL] = display; |