Top-most windows

Deron Johnson Deron.Johnson at Sun.COM
Mon Jan 9 13:00:46 PST 2006


The whole notion of grabbing the server, raising the composite output
window, and then ungrabbing the server seems like a kludge to me.
I just want a window I can draw to without interference from any
other clients. Why should a direct rendering library need to send
3 X requests per frame? And, in addition, grabbing the server will
interfere with the rendering of other clients. For example, if there
is an X11 program trying to animate at 30 fps it needs to to render
one frame every 33 ms. But if the composite manager is running
at 30 fps, and let say it takes 1/2 a frame to do its rendering,
then the server is grabbed for 16.5 ms. This means that the
animating X11 program will only get a 16.5 ms window in which to
draw--so the maximum frame rate it can achieve is 15 fps.

The question is not how fast can I grab and ungrab the server
and do no work in between. The question is how to minimize the
total amount of time the server is grabbed. Grabbing the server is
evil because it stops everything. It should be avoided at all cost.

The grab/raise/ungrab paradigm seems like a bad long term strategy to
me. Just give me a window to which the composite manager can draw
without interfering with other X11 clients, who are drawing to
off-screen memory anyway.

Soeren Sandmann wrote On 01/09/06 12:02,:
> 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;
> }
> 
> _______________________________________________
> xorg-arch mailing list
> xorg-arch at lists.x.org
> http://lists.x.org/mailman/listinfo/xorg-arch



More information about the xorg-arch mailing list