Top-most windows

Soeren Sandmann sandmann at redhat.com
Mon Jan 9 12:02:02 PST 2006


Deron Johnson wrote:

>Keith Packard wrote On 01/06/06 17:58,:
>  
>
>>On Fri, 2006-01-06 at 17:26 -0800, Deron Johnson wrote:
>>
>>
>>    
>>
>>>Avoiding server grabs is not just nicer looking, it's critical for good
>>>performance. Especially when the scene is drawn at 60 frames per second!
>>>      
>>>
>>I guess I'm wondering how this would have an effect; the scene is drawn
>>by the client which is holding the grab...
>>    
>>
>
>My understanding is that he was suggesting that the compositing manager
>raise its output window every time it goes to render anything. This is
>out of the question--grabbing the server everytime a 60 fps animator
>renders anything is prohibitively expensive. But perhaps I misunderstood
>what he was proposing.
>  
>
No, that is what I was proposing. I don't see any reason grabbing the server
should be an expensive operation.

I worte a quick test that shows that my system can grab and ungrab the 
server
around one million times per second, which doesn't seem prohibitive to 
me. But
perhaps I am misunderstanding you.

Soren


great-sage-equal-to-heaven:~% ./a.out
time: 0.100932 (990766.060318 per second)
great-sage-equal-to-heaven:~% ./a.out
time: 0.100657 (993472.883158 per second)


#include <glib.h>
#include <X11/Xlib.h>

#define N_GRABS 100000

int
main ()
{
    Display *dpy;
    GTimer *timer;
    int i;
    double elapsed;

    dpy = XOpenDisplay (NULL);

    if (!dpy)
    {
        g_print ("could not open display\n");
        return 0;
    }

    timer = g_timer_new ();

    for (i = 0; i < N_GRABS; ++i)
    {
        XGrabServer (dpy);
        XUngrabServer (dpy);
    }

    XSync (dpy, False);

    elapsed = g_timer_elapsed (timer, NULL);
    g_print ("time: %f (%f per second)\n", elapsed, N_GRABS / elapsed);

    return 0;
}



More information about the xorg-arch mailing list