summaryrefslogtreecommitdiff
path: root/hw/kdrive
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2016-06-14 13:45:27 -0700
committerKeith Packard <keithp@keithp.com>2016-06-20 11:55:21 -0700
commit828887b6f4a997b6468da565a88b6fe9afcda191 (patch)
tree98c13e69f4b2ea5bd3ffb9df67bf113b23b499bb /hw/kdrive
parentc17a41794507d6d04c850e9e1bc04fc60c31de18 (diff)
ephyr: Process only the last expose or configure available from the server
Delay expose or configure processing until the event queue is empty so that we don't end up processing a long series of events one at a time. Expose events already have a check waiting for the last in a series, this further improves that by discarding multiple series of events. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Adam Jackson <ajax@redhat.com>
Diffstat (limited to 'hw/kdrive')
-rw-r--r--hw/kdrive/ephyr/ephyr.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index 015aef53d..d7948e8de 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -1141,6 +1141,7 @@ static void
ephyrXcbProcessEvents(Bool queued_only)
{
xcb_connection_t *conn = hostx_get_xcbconn();
+ xcb_generic_event_t *expose = NULL, *configure = NULL;
while (TRUE) {
xcb_generic_event_t *xev = hostx_get_event(queued_only);
@@ -1164,7 +1165,9 @@ ephyrXcbProcessEvents(Bool queued_only)
break;
case XCB_EXPOSE:
- ephyrProcessExpose(xev);
+ free(expose);
+ expose = xev;
+ xev = NULL;
break;
case XCB_MOTION_NOTIFY:
@@ -1188,14 +1191,28 @@ ephyrXcbProcessEvents(Bool queued_only)
break;
case XCB_CONFIGURE_NOTIFY:
- ephyrProcessConfigureNotify(xev);
+ free(configure);
+ configure = xev;
+ xev = NULL;
break;
}
- if (ephyr_glamor)
- ephyr_glamor_process_event(xev);
+ if (xev) {
+ if (ephyr_glamor)
+ ephyr_glamor_process_event(xev);
+
+ free(xev);
+ }
+ }
+
+ if (configure) {
+ ephyrProcessConfigureNotify(configure);
+ free(configure);
+ }
- free(xev);
+ if (expose) {
+ ephyrProcessExpose(expose);
+ free(expose);
}
}