[PATCH xf86-video-ati 4/4] Consume all available udev events at once

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Michel Dänzer <michel.daenzer@xxxxxxx>

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)

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/drmmode_display.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index a5a34fd..9cf4846 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2656,12 +2656,15 @@ 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;
+	}
 
-	radeon_mode_hotplug(scrn, drmmode);
-	udev_device_unref(dev);
+	if (received)
+		radeon_mode_hotplug(scrn, drmmode);
 }
 #endif
 
-- 
2.10.1



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux