xf86-video-intel: src/sna/sna_display.c
Chris Wilson
ickle at kemper.freedesktop.org
Mon Jun 9 05:15:30 PDT 2014
src/sna/sna_display.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
New commits:
commit af3130cbba8375b9060a3a8cef5b03189d01c419
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Mon Jun 9 13:13:25 2014 +0100
sna: Do not rely on udev_monitor_receive_device() being non-blocking
The libudev documentation says that is it non-blocking by default, but
experience shows otherwise.
Reported-by: Sedat Dilek <sedat.dilek at gmail.com>
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 231fc68..5187515 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -189,14 +189,19 @@ static inline struct sna_crtc *to_sna_crtc(xf86CrtcPtr crtc)
return crtc->driver_private;
}
-static bool sna_mode_has_pending_events(struct sna *sna)
+static inline bool event_pending(int fd)
{
struct pollfd pfd;
- pfd.fd = sna->kgem.fd;
+ pfd.fd = fd;
pfd.events = POLLIN;
return poll(&pfd, 1, 0) == 1;
}
+static bool sna_mode_has_pending_events(struct sna *sna)
+{
+ return event_pending(sna->kgem.fd);
+}
+
static bool sna_mode_wait_for_event(struct sna *sna)
{
struct pollfd pfd;
@@ -411,17 +416,19 @@ sna_backlight_uevent(int fd, void *closure)
DBG(("%s()\n", __FUNCTION__));
/* Drain the event queue */
- do {
+ while (event_pending(fd)) {
struct udev_device *dev;
+ DBG(("%s: waiting for uevent\n", __FUNCTION__));
dev = udev_monitor_receive_device(sna->mode.backlight_monitor);
if (dev == NULL)
break;
udev_device_unref(dev);
- } while (1);
+ }
/* Query all backlights for any changes */
+ DBG(("%s: probing backlights for changes\n", __FUNCTION__));
for (i = 0; i < sna->mode.num_real_output; i++) {
xf86OutputPtr output = config->output[i];
struct sna_output *sna_output = to_sna_output(output);
More information about the xorg-commit
mailing list