diff options
author | Daniel Martin <consume.noise@gmail.com> | 2015-12-11 12:05:22 +0100 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2016-09-28 14:53:39 -0400 |
commit | 363f4273dd4aec3e26cc57ecb6c20f27e6c813d8 (patch) | |
tree | 1bb8cd866385992566ba16efa02062436323de7b | |
parent | ea91db4b83312e791dcae935b8720f49a3861d72 (diff) |
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>
-rw-r--r-- | hw/xfree86/drivers/modesetting/drmmode_display.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c index 6b933e49b..b895d628a 100644 --- a/hw/xfree86/drivers/modesetting/drmmode_display.c +++ b/hw/xfree86/drivers/modesetting/drmmode_display.c @@ -2269,11 +2269,14 @@ drmmode_handle_uevents(int fd, void *closure) drmModeResPtr mode_res; xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); int i, j; - Bool found; + Bool found = FALSE; Bool changed = FALSE; - dev = udev_monitor_receive_device(drmmode->uevent_monitor); - if (!dev) + while ((dev = udev_monitor_receive_device(drmmode->uevent_monitor))) { + udev_device_unref(dev); + found = TRUE; + } + if (!found) return; mode_res = drmModeGetResources(drmmode->fd); @@ -2339,7 +2342,6 @@ out_free_res: drmModeFreeResources(mode_res); out: RRGetInfo(xf86ScrnToScreen(scrn), TRUE); - udev_device_unref(dev); } #endif |