Bug 10644 - XIfEvent() uses CPU too much
Summary: XIfEvent() uses CPU too much
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Lib/Xlib (show other bugs)
Version: 7.2 (2007.02)
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
: 10173 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-04-13 22:39 UTC by Yuuki Harano
Modified: 2007-12-29 20:29 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Yuuki Harano 2007-04-13 22:39:48 UTC
This code uses CPU too much until I click the window.

#include <X11/Xlib.h>

static Bool check(Display *dpy, XEvent *ev, XPointer arg)
{
    return ev->type == ButtonPress;
}

int main(void)
{
    Display *dpy = XOpenDisplay(NULL);
    
    Window win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, 100, 100, 0, 0, 0);
    
    XSelectInput(dpy, win, ExposureMask | ButtonPressMask);
    
    XMapWindow(dpy, win);
    
    XEvent ev;
    XIfEvent(dpy, &ev, check, NULL);
    
    return 0;
}

X11R7.2
slackware 11.0
linux kernel 2.6.20.6
glibc 2.5
gcc 4.1.2
ThinkPad X40
Comment 1 Jamey Sharp 2007-06-02 18:39:05 UTC
You're right: Xlib/XCB had a performance bug that code like yours (and metacity) triggered. Josh and I believe it is now fixed in libX11 git, and we'll release a new version after some more testing.
Comment 2 Jamey Sharp 2007-06-02 18:54:47 UTC
*** Bug 10173 has been marked as a duplicate of this bug. ***
Comment 3 Daniel Hahler 2007-12-29 18:15:58 UTC
JFI: this appears to be this commit:
http://gitweb.freedesktop.org/?p=xcb/libxcb.git;a=commitdiff;h=e20a31d72b8838cdf31b568431b5ad78492c1481
Comment 4 Daniel Hahler 2007-12-29 20:29:23 UTC
Hmm.. probably not, but rather one from http://gitweb.freedesktop.org/?p=xorg/lib/libX11.git;a=log

Would be nice to post a commit link for reference, if a bug gets closed.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.