get windowposition using drawable and display

dragoran dragoran at feuerpokemon.de
Mon Aug 7 06:38:03 PDT 2006


Carsten Haitzler (The Rasterman) wrote:
> On Mon, 07 Aug 2006 14:49:22 +0200 dragoran <dragoran at feuerpokemon.de> babbled:
>
>   
>> Carsten Haitzler (The Rasterman) wrote:
>>     
>>> On Sun, 06 Aug 2006 18:02:26 +0200 dragoran <dragoran at feuerpokemon.de>
>>> babbled: so summary: use events - keep an updated x,y co-ord pair and use
>>> those when you need it. don't do query calls to x if you can avoid it.
>>>
>>>   
>>>       
>> ok thx now I have this:
>>
>> void* window_thread(void* arg) {
>> XEvent event;
>> XSelectInput(data.dpy, data.drawable,StructureNotifyMask);
>> while(data.status) {
>> XNextEvent(data.dpy, &event);
>> switch(event.type) {
>> case ConfigureNotify:
>> xosd_set_vertical_offset(data.dsp,event.xconfigure.y);
>> xosd_set_horizontal_offset(data.dsp,event.xconfigure.x);
>> break;
>> default:
>> break;
>> }
>>
>> }
>> }
>>
>> void glXSwapBuffers(Display* dpy, GLXDrawable drawable) {
>> #ifdef DEBUG
>> //fprintf(stderr,"about to draw hud ;)\n");
>> #endif
>> if(th==1) {
>> pthread_t *hthread;
>> pthread_t *dthread;
>> pthread_t *wthread;
>> gettimeofday(&starttime,NULL);
>> data.status=1;
>> data.frames=0;
>> data.dpy=dpy;
>> data.drawable=drawable;
>> pthread_create(hthread,NULL,hud_thread,NULL);
>> pthread_create(dthread,NULL,dbus_thread,NULL);
>> pthread_create(dthread,NULL,window_thread,NULL);
>> th=0;
>>
>> }
>> //increment frame counter
>> data.frames++;
>> pglXSwapBuffers(dpy, drawable);
>> }
>>
>> it works fine but when I move the window the framerate (in glxgears)
>> goes down from ~11000 to 6000fps even when I keep the window and stop
>> moving it...
>> the hud_thread only counts the frames and prints them via xosd and the
>> dbus one does change some vars which it gets from dbus so that the hud
>> thread can display them.
>>     
>
> when you are moving a window you will have lock contention on the gfx card -
> not surprising your framerate goes down as glx with dri won't be pipelined like
> standard x protocol and thus will sit and wait on a lock until x gives up the
> gpu (of course this may vary from driver to driver... but i'm not an expert in
> these details).
>
>
>   
but shouldn't the framerate goes up again after the window has stopped
moving?



More information about the xorg mailing list