summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2020-08-15 23:20:53 -0400
committerIlia Mirkin <imirkin@alum.mit.edu>2020-08-15 23:21:53 -0400
commit5031100549fb053527a1f11d771e930dec065ced (patch)
tree447d436ca7f33f7b184b2556f386c5a72083ef14
parentf833cd0827a73b716cc3af5905015fcb2c7d958d (diff)
drmmode: make event handler leave a note that there are stuck events
We don't really expect to have too many events in the queue. If there are, then the algorithm we use isn't appropriate. Add a warning when the queue gets very long, as it's an indication of something having gone wrong. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
-rw-r--r--src/drmmode_display.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 2d3229c..45292c4 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -159,6 +159,8 @@ drmmode_events = {
.prev = &drmmode_events,
};
+static bool warned = false;
+
static void
drmmode_event_handler(int fd, unsigned int frame, unsigned int tv_sec,
unsigned int tv_usec, void *event_data)
@@ -166,7 +168,10 @@ drmmode_event_handler(int fd, unsigned int frame, unsigned int tv_sec,
const uint64_t ust = (uint64_t)tv_sec * 1000000 + tv_usec;
struct drmmode_event *e = event_data;
+ int counter = 0;
+
xorg_list_for_each_entry(e, &drmmode_events, head) {
+ counter++;
if (e == event_data) {
xorg_list_del(&e->head);
e->func((void *)(e + 1), e->name, ust, frame);
@@ -174,6 +179,12 @@ drmmode_event_handler(int fd, unsigned int frame, unsigned int tv_sec,
break;
}
}
+
+ if (counter > 100 && !warned) {
+ xf86DrvMsg(0, X_WARNING,
+ "Event handler iterated %d times\n", counter);
+ warned = true;
+ }
}
void