[PATCH 1/1] evdev: Fix a high CPU utilization bug

Singh, Satyeshwar satyeshwar.singh at intel.com
Thu Jun 6 10:17:37 PDT 2013


The problem was that if we ever switched to another tty while running
Weston, then we would essentially not handle any remaining events and Weston
would enter an infinite loop where it's trying to process an event but it
can't because the processing function evdev_device_data exits before it can
read anything from the queue. With this fix, we read whatever is in the
queue, but not process it any further. 

---
 src/evdev.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index 9289b1c..70d3c52 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -372,8 +372,6 @@ evdev_device_data(int fd, uint32_t mask, void *data)
      int len;
 
      ec = device->seat->compositor;
-     if (!ec->focus)
-           return 1;
 
      /* If the compositor is repainting, this function is called only once
       * per frame and we have to process all the events available on the
@@ -391,7 +389,8 @@ evdev_device_data(int fd, uint32_t mask, void *data)
                  return 1;
            }
 
-           evdev_process_events(device, ev, len / sizeof ev[0]);
+           if (ec->focus)
+                 evdev_process_events(device, ev, len / sizeof ev[0]);
 
      } while (len > 0);
 
-- 
1.7.11.4

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20130606/62479d27/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 8662 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20130606/62479d27/attachment-0001.bin>


More information about the wayland-devel mailing list