Stack Exchange Network
Stack Exchange network consists of 183 Q&A communities including
Stack Overflow
, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this community
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I am trying to build an application that can measure the latency/processing time of graphics frameworks on Linux.
My idea is to implement simple programs that react to an input event (e.g. mouse click) by changing the screen's color (e.g. from black to white) with different graphics and UI frameworks (e.g. SDL, OpenGL, Qt, ...).
To measure each program's latency, I want to implement a separate program that measures the time from an input event arriving at the machine (I'm using evdev for this) to a pixel being updated in some kind of framebuffer (as close to the application as possible). The second program should also be independent of vblank events, as I'm interested in the time the rendering is done, not the time users might be able to see something.
My problem is getting the framebuffer content with the second program. I already managed to get framebuffer content with fbdev or libdrm (based on
this tutorial
), but both require the programs to be run in a terminal without an active XServer (which I would prefer due to external validity).
I have also already tried to use
MIT-XShm
to retrieve the X framebuffer's content, but it seems too slow for my problem, even when reading only one pixel (around 4 milliseconds with harsh outliers).
This is how I currently use XShm, in case it might help.
// get one pixel at coordinates x/y with XShm
XShmGetImage(display, rootWindow, image, x, y, 0x00ffffff);
// store red value into variable
unsigned int color = image->data[2];
if(color != lastcolor)
log(time_micros(), color);
Is there a quick and reliable way to retrieve framebuffer content (either from X or from DRM) with an XServer running? Or is XShm the best we can do at the moment?
–
–
–