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 <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2015-09-09 11:18:15 +01:00
parent e179e7d3a4
commit f5aabb7bdd
1 changed files with 23 additions and 2 deletions

View File

@ -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;
}