summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2016-10-26 16:19:01 +0900
committerMichel Dänzer <michel@daenzer.net>2016-10-27 11:02:34 +0900
commit3c1f4386ba7d0b6c16bdd2b2178f978f2f154ba8 (patch)
treeb17f3e424f9860a19a6ab1decea861ba3cb78945
parentc87dff3257e797cfd80d208c9a612b21978ff4eb (diff)
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 many events as we can, we reduce the number of output re-evalutions. It depends on the timing how many events can be consumed at once. (Inspired by xserver commit 363f4273dd4aec3e26cc57ecb6c20f27e6c813d8) (Ported from radeon commit 22b5ce9548393ba2ff73ee234ecd82eeaf0ef6c4) Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--src/drmmode_display.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 9dfef40..b03a8a7 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2479,12 +2479,15 @@ static void drmmode_handle_uevents(int fd, void *closure)
drmmode_ptr drmmode = closure;
ScrnInfoPtr scrn = drmmode->scrn;
struct udev_device *dev;
- dev = udev_monitor_receive_device(drmmode->uevent_monitor);
- if (!dev)
- return;
+ Bool received = FALSE;
+
+ while ((dev = udev_monitor_receive_device(drmmode->uevent_monitor))) {
+ udev_device_unref(dev);
+ received = TRUE;
+ }
- amdgpu_mode_hotplug(scrn, drmmode);
- udev_device_unref(dev);
+ if (received)
+ amdgpu_mode_hotplug(scrn, drmmode);
}
#endif