Using apitrace with Xvfb
Nick McVeity
nmcveity at gmail.com
Fri May 15 00:03:22 PDT 2015
Hello.
I wanted to record and replay a trace on a headless server for regression
testing purposes. The headless server does not have an X session so the
plan was to create one with Xvfb.
Something like:
% Xvfb :99 -screen 0 640x480x24 &
% DISPLAY=:99 apitrace trace -o trace /path/to/executable
% DISPLAY=:99 apitrace replay trace
While replaying the trace I'd capture the frame checksums and check against
the golden copy and that'd confirm the tests.
When I try this with apitrace the third step (replay) fails with the error
message:
error: failed to create OpenGL 3.3 core context.
My test program is attached. It is a very simple program that uses freeglut
to initialise a window and then prints the GL_RENDERER, GL_VENDOR, ...
strings.
It is compiled with:
g++ -o example example.cpp -lGL -lglut
If I run the program when an X session is active:
% ./example
OpenGL initialized:
Version: 3.3 (Core Profile) Mesa 10.6.0-devel
Vendor: Intel Open Source Technology Center
Renderer: Mesa DRI Intel(R) HD Graphics 5500 (Broadwell GT2)
GLSL: 3.30
(Note: running on a broadwell laptop, so this output is entirely expected).
Running it in the Xvfb session:
% DISPLAY=:99 ./example
OpenGL initialized:
Version: 3.3 (Core Profile) Mesa 10.6.0-devel
Vendor: VMware, Inc.
Renderer: Gallium 0.4 on llvmpipe (LLVM 3.6, 256 bits)
GLSL: 3.30
Running the trace I get:
% DISPLAY=:99 apitrace trace -o trace example
apitrace: loaded into /usr/local/bin/apitrace
apitrace: loaded into /home/nick/example
apitrace: tracing to trace
apitrace: redirecting dlopen("libGL.so.1", 0x102)
OpenGL initialized:
apitrace: attempting to read configuration file:
/home/nick/.config/apitrace/gltrace.conf
Version: 3.3 (Core Profile) Mesa 10.6.0-devel
Vendor: VMware, Inc.
Renderer: Gallium 0.4 on llvmpipe (LLVM 3.6, 256 bits)
GLSL: 3.30
If I use apitrace to dump the trace:
% DISPLAY=:99 apitrace dump trace
1 glXChooseFBConfig(dpy = 0xa444f0, screen = 0, attribList =
{GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, GLX_DOUBLEBUFFER,
True, GLX_DEPTH_SIZE, 1, 0}, nitems = &64) = {0xa7e020, 0xa7e200, 0xa83480,
0xa83660, 0xa7d4e0, 0xa7d6c0, 0xa82940, 0xa82b20, 0xa7da80, 0xa7dc60,
0xa82ee0, 0xa830c0, 0xa7ce10, 0xa7d120, 0xa823a0, 0xa82580, 0xa7c2d0,
0xa7c4b0, 0xa81860, 0xa81a40, 0xa7b790, 0xa7b970, 0xa80d20, 0xa80f00,
0xa7bd30, 0xa7bf10, 0xa812c0, 0xa814a0, 0xa7b1f0, 0xa7b3d0, 0xa80780,
0xa80960, 0xa7e110, 0xa7e2f0, 0xa83570, 0xa83750, 0xa7d5d0, 0xa7d7b0,
0xa82a30, 0xa82c10, 0xa7db70, 0xa7dd50, 0xa82fd0, 0xa831b0, 0xa7cf00,
0xa7d210, 0xa82490, 0xa82670, 0xa7c3c0, 0xa7c5a0, 0xa81950, 0xa81b30,
0xa7b880, 0xa7ba60, 0xa80e10, 0xa80ff0, 0xa7be20, 0xa7c000, 0xa813b0,
0xa81590, 0xa7b2e0, 0xa7b4c0, 0xa80870, 0xa80a50}
2 glXGetVisualFromFBConfig(dpy = 0xa444f0, config = 0xa7e020) =
&{visual = 0xa4f630, visualid = 297, screen = 0, depth = 24, c_class = 4,
red_mask = 16711680, green_mask = 65280, blue_mask = 255, colormap_size =
256, bits_per_rgb = 8}
4 glXCreateContextAttribsARB(dpy = 0xa444f0, config = 0xa7e020,
share_context = NULL, direct = True, attrib_list =
{GLX_CONTEXT_MAJOR_VERSION_ARB, 3, GLX_CONTEXT_MINOR_VERSION_ARB, 3,
GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB |
GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, 0}) = 0xa55da0
6 glXMakeContextCurrent(dpy = 0xa444f0, draw = 2097154, read = 2097154,
ctx = 0xa55da0) = True
7 glViewport(x = 0, y = 0, width = 400, height = 400)
8 glScissor(x = 0, y = 0, width = 400, height = 400)
9 glXMakeContextCurrent(dpy = 0xa444f0, draw = 2097154, read = 2097154,
ctx = 0xa55da0) = True
14 glXMakeContextCurrent(dpy = 0xa444f0, draw = 2097154, read =
2097154, ctx = 0xa55da0) = True
15 glXDestroyContext(dpy = 0xa444f0, ctx = 0xa55da0)
If I try to replay:
%DISPLAY=:99 apitrace replay -vvv trace
0 @0 glXQueryExtension(dpy = 0xa444f0, errorb = NULL, event = NULL) =
True
1 @0 glXChooseFBConfig(dpy = 0xa444f0, screen = 0, attribList =
{GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, GLX_DOUBLEBUFFER,
True, GLX_DEPTH_SIZE, 1, 0}, nitems = &64) = {0xa7e020, 0xa7e200, 0xa83480,
0xa83660, 0xa7d4e0, 0xa7d6c0, 0xa82940, 0xa82b20, 0xa7da80, 0xa7dc60,
0xa82ee0, 0xa830c0, 0xa7ce10, 0xa7d120, 0xa823a0, 0xa82580, 0xa7c2d0,
0xa7c4b0, 0xa81860, 0xa81a40, 0xa7b790, 0xa7b970, 0xa80d20, 0xa80f00,
0xa7bd30, 0xa7bf10, 0xa812c0, 0xa814a0, 0xa7b1f0, 0xa7b3d0, 0xa80780,
0xa80960, 0xa7e110, 0xa7e2f0, 0xa83570, 0xa83750, 0xa7d5d0, 0xa7d7b0,
0xa82a30, 0xa82c10, 0xa7db70, 0xa7dd50, 0xa82fd0, 0xa831b0, 0xa7cf00,
0xa7d210, 0xa82490, 0xa82670, 0xa7c3c0, 0xa7c5a0, 0xa81950, 0xa81b30,
0xa7b880, 0xa7ba60, 0xa80e10, 0xa80ff0, 0xa7be20, 0xa7c000, 0xa813b0,
0xa81590, 0xa7b2e0, 0xa7b4c0, 0xa80870, 0xa80a50}
2 @0 glXGetVisualFromFBConfig(dpy = 0xa444f0, config = 0xa7e020) =
&{visual = 0xa4f630, visualid = 297, screen = 0, depth = 24, c_class = 4,
red_mask = 16711680, green_mask = 65280, blue_mask = 255, colormap_size =
256, bits_per_rgb = 8}
3 @0 glXGetProcAddressARB(procName = "glXCreateContextAttribsARB") =
0x7f49a8ac15f2
4 @0 glXCreateContextAttribsARB(dpy = 0xa444f0, config = 0xa7e020,
share_context = NULL, direct = True, attrib_list =
{GLX_CONTEXT_MAJOR_VERSION_ARB, 3, GLX_CONTEXT_MINOR_VERSION_ARB, 3,
GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB |
GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, 0}) = 0xa55da0
*error: failed to create OpenGL 3.3 core context.*
Initially I suspected that the DISPLAY variable was not propagating to the
glretrace child of "apitrace replay" but I have
1) straced to verify that the environment variable DISPLAY=:99 is making
it through to the glretrace child process spawned by apitrace, and
2) confirmed that the code uses XOpenDisplay(NULL), which should open the
X display in the environment variable DISPLAY
Anyone have any ideas or experience running apitrace on headless servers?
Thanks,
-- Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/apitrace/attachments/20150515/49ca1505/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example.cpp
Type: text/x-c++src
Size: 731 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/apitrace/attachments/20150515/49ca1505/attachment.cpp>
More information about the apitrace
mailing list