modesetting: Consume all available udev events at once
We get multiple udev events for actions like docking a laptop into its station or plugging a monitor to the station. By consuming as much events as we can, we reduce the number of output re-evalutions. I.e. having a Lenovo X250 in a ThinkPad Ultra Dock and plugging a monitor to the station generates 5 udev events. Or having 2 monitors attached to the station and docking the laptop generates 7 events. It depends on the timing how many events can consumed at once. Signed-off-by: Daniel Martin <consume.noise@gmail.com> [hdegoede@redhat.com: Keep goto out so that we always call RRGetInfo()] Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
ea91db4b83
commit
363f4273dd
|
@ -2269,11 +2269,14 @@ drmmode_handle_uevents(int fd, void *closure)
|
||||||
drmModeResPtr mode_res;
|
drmModeResPtr mode_res;
|
||||||
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
|
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
|
||||||
int i, j;
|
int i, j;
|
||||||
Bool found;
|
Bool found = FALSE;
|
||||||
Bool changed = FALSE;
|
Bool changed = FALSE;
|
||||||
|
|
||||||
dev = udev_monitor_receive_device(drmmode->uevent_monitor);
|
while ((dev = udev_monitor_receive_device(drmmode->uevent_monitor))) {
|
||||||
if (!dev)
|
udev_device_unref(dev);
|
||||||
|
found = TRUE;
|
||||||
|
}
|
||||||
|
if (!found)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mode_res = drmModeGetResources(drmmode->fd);
|
mode_res = drmModeGetResources(drmmode->fd);
|
||||||
|
@ -2339,7 +2342,6 @@ out_free_res:
|
||||||
drmModeFreeResources(mode_res);
|
drmModeFreeResources(mode_res);
|
||||||
out:
|
out:
|
||||||
RRGetInfo(xf86ScrnToScreen(scrn), TRUE);
|
RRGetInfo(xf86ScrnToScreen(scrn), TRUE);
|
||||||
udev_device_unref(dev);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue