Should weston call power off when a hotplug connector being unplugged ?
Dear Weston experts,
Recently we met a problem on our device with DP port running weston. The problem is that after DP connector unplugged and then re-plugged, weston desktop could not be shown. We found that the problem might be due to weston did not call power off when unplugged.
Referring to Android, when unplugged HWC would call an AtomicCommit to disable CRTC, https://cs.android.com/android/platform/superproject/+/master:external/drm_hwcomposer/hwc2_device/HwcDisplay.cpp;l=712?q=HwcDisplay::
The DP port on our device needs re-power-on and re-training when re-plugged. Our DP driver takes AtomicCommit to power off DP. If DP is not powered off when unplugged, the driver would not re-power-on and re-training DP when re-plugged.
We have a work around on weston for this problem. We try to send an AtomicCommit when a connector head is NOT connected.
sample code below
drm_backend_update_connectors(...) {
...
if (head) {
ret = drm_head_update_info(head, conn);
if (!head->base.connected) {
struct weston_head *w_head = &head->base;
struct drm_output *output = to_drm_output(w_head->output);
if (output && !atomic_clear_mode(output))
weston_log("atomic_clear_mode ok\n");
}
}
...
}
We would like to ask for your opinion, should weston call power off when unplugged, like Android HWC does, or the display driver should detect unplug event and power off by itself ?
Please help give us some advices, thanks in advance.