Low performance of XRRGetScreenInfo

Peter Harris pharris at opentext.com
Thu Apr 2 10:05:26 PDT 2009


Ren, Zhaohan wrote:
> 
> Hi All
> I wrote some code using libXrandr to check the current screen rotation state
>  
> /int CheckRotationState(Display * x11_dpy) {/
> /    Rotation current_rotation;/
> /    XRRScreenConfiguration *scrn_cfg;/
> /    scrn_cfg = XRRGetScreenInfo(x11_dpy, DefaultRootWindow(x11_dpy));/
> /    XRRConfigCurrentConfiguration (scrn_cfg, &current_rotation);/
> /    XRRFreeScreenConfigInfo(scrn_cfg);/
> /    return current_rotation;/
> /}/
>  
> /CheckRotationState /is put ahead of /XvPutImage/,  that is to say every
> time I want to display an image, I will firstly check the screen
> rotation state. If the return value of /CheckRotationState /is
> /RR_Rotate_0(There isn't any rotation)/, I will use hardware overlay to
> display video, or I will use textured blit way. But I found the
> performance degraded a lot after add /CheckRotationState/. Seems that
> /XRRGetScreenInfo /consumes much time. I tried another interface
> /XRRRotations/, but can only get the cached information, not the current
> rotation state.
> Does anyone have some good idea about how to get the screen rotation
> state from the Server efficiently?

Instead of polling the rotation state every frame, you should call
XRRSelectInput() once. The server will send you an event whenever the
rotation state changes.

Peter Harris
-- 
               Open Text Connectivity Solutions Group
Peter Harris                    http://www.opentext.com/connectivity
Research and Development        Phone: +1 905 762 6001
pharris at opentext.com            Toll Free: 1 877 359 4866


More information about the xorg-devel mailing list