From f5aabb7bddc6fc5dc910a983d1291c9864f65f06 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 9 Sep 2015 11:18:15 +0100 Subject: [PATCH] sna: On hotplug events, update the output->status During the hotplug event, we query the current connector status and use that to trigger an output changed event to the clients. However, since we know the new status, we can set that on the RROutput immediately. Note the modelist is left unchanged, and will only be queried when the user requests it (though we may want to provide that in the hotplug notify as well). References: https://bugs.freedesktop.org/show_bug.cgi?id=91929#c2 Signed-off-by: Chris Wilson --- src/sna/sna_display.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 34d19bb6..d13d2833 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -4848,8 +4848,29 @@ void sna_mode_discover(struct sna *sna) sna_output->last_detect = 0; if (sna_output->serial == serial) { - if (sna_output_detect(output) != output->status) - RROutputChanged(output->randr_output, TRUE); + xf86OutputStatus status = sna_output_detect(output); + if (status != output->status) { + RROutputPtr rr = output->randr_output; + unsigned value; + + DBG(("%s: output %s (id=%d), changed status %d -> %d\n", + __FUNCTION__, output->name, sna_output->id, output->status, status)); + + output->status = status; + switch (status) { + case XF86OutputStatusConnected: + value = RR_Connected; + break; + case XF86OutputStatusDisconnected: + value = RR_Disconnected; + break; + default: + case XF86OutputStatusUnknown: + value = RR_UnknownConnection; + break; + } + RROutputSetConnection(rr, value); + } continue; }