backend-drm: Explicitly set an invalid state

A infinitesimal short-flip in HDMI HDP in-out (hot-plug event) would
cause a discrepancy between kernel's connector's state and Weston
connector state resulting in kernel and Weston disagreeing on the final
connector state.

This has the undesired effect where the output would never turn on when
this short burst of HDP events come through.

To avoid that, just set the device invalid_state as true to go through a
modeset.  Also, schedule a repaint when that happens to go through a
repaint.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This commit is contained in:
Marius Vlad 2025-06-23 07:57:34 +00:00 committed by Daniel Stone
parent 794c1eb490
commit fdb43447a2

View file

@ -3632,6 +3632,25 @@ drm_backend_update_connector(struct drm_device *device,
if (head->base.device_changed) {
drm_head_log_info(head, "updated");
}
/* a no change in weston_head::device_changed but with
* connected status still on, means we got here through a udev
* HOTPLUG event and we further got interrupted by another
* HOTPLUG event.
*
* When this happens mark the state as invalid to allow to
* connector/output to be enabled on a next flip; otherwise we
* reach a point where the kernel had the connector disabled
* but we Weston has it enabled, finishing finally with Weston
* not doing anything to re-enable the output */
if (!head->base.device_changed && head->base.connected) {
struct weston_output *output = head->base.output;
drm_debug(b, "\t[CONN:%d] Invalid state detected.\n",
connector_id);
device->state_invalid = true;
weston_output_schedule_repaint(output);
}
} else if (writeback) {
ret = drm_writeback_update_info(writeback, conn);
} else {