]> git.cworth.org Git - fips/log
fips
10 years agoAdd support for OpenGL ES by conditionally compiling wrapper for eglSwapBuffers
Carl Worth [Mon, 6 May 2013 18:30:06 +0000 (11:30 -0700)]
Add support for OpenGL ES by conditionally compiling wrapper for eglSwapBuffers

The configure script now looks for EGL/egl.h, (via pkg-config or directly),
and if present, will compile a wrapper for eglSwapBuffers.

This allows fips to report metrics for OpenGL ES programs.

10 years agoMove metrics-tracking code from glwrap.c to new metrics.c
Carl Worth [Mon, 6 May 2013 18:18:33 +0000 (11:18 -0700)]
Move metrics-tracking code from glwrap.c to new metrics.c

We're moving toward having separate *wrap.c files for each flavor of GL,
(glwrap.c, glxwrap.c, and eglwrap.c). But this metrics-tracking code is
generic to all of those so belongs in a separate module.

10 years agoReduce code duplication with with new 'glwrap_lookup' function.
Carl Worth [Thu, 2 May 2013 21:33:12 +0000 (14:33 -0700)]
Reduce code duplication with with new 'glwrap_lookup' function.

We already had two copies of 'lookup', (and were anticipating additional
modules which needed it as well). The DEFER macro is now also exported
as GLWRAP_DEFER for use in additional modules.

11 years agoconfigure: Add checks for GL/gl.h
Carl Worth [Mon, 29 Apr 2013 21:54:52 +0000 (14:54 -0700)]
configure: Add checks for GL/gl.h

Previously, the compile would just forge ahead assuming GL/gl.h was present.

Now, at configure time, actually look for gl.h, (first, by looking for
a pkg-config "gl" package, otherwise, trying to just test-compile
something with a #include <GL/gl.h>).

If things aren't found at configure time, tell the user which packages
to install.

11 years agoFix glwrap.c to workaround 'const' changes in OpenGL headers.
Carl Worth [Mon, 29 Apr 2013 20:23:58 +0000 (13:23 -0700)]
Fix glwrap.c to workaround 'const' changes in OpenGL headers.

Not all OpenGL headers are created equal. Some include more "const"
keywords than others, and we don't know wheter the headers we are
compiling against include the extra "const". We force all to be equal
by using the preprocessor to remove all "const" keywords altogether.

11 years agoWrap all OpenGL drawing calls, measure GPU time of each, and account to shader.
Carl Worth [Thu, 25 Apr 2013 05:57:50 +0000 (22:57 -0700)]
Wrap all OpenGL drawing calls, measure GPU time of each, and account to shader.

Thanks to José Fonseca, there's a nice list of OpenGL functions identified
as "drawing operations" in the apitrace source. (It's mostly glDraw* but
there are a few oddball as well.) With that list we implement a wrapper
for each draw call.

And in each wrapper we fire of a glBeginQuery/glEndQuery measurement around
the call to measure how much GPU time is consumed by the call. At the end
of each frame, we capture all available query results and accumulate those
into per-shader-program counters based on the currently active program,
(which we track by wrapping glUseProgram and glUseProgramObjectARB).

Finally, every 60 frames, we print out a simple report showing the
accumulated time for each shader program.

The report could very easily become more sophisticated. Here are some
obvious ideas:

  1. Sort the report so that the most active shaders are reported first

  2. Come up with some real units for the report values rather than mega-ticks

  3. Report relative execution time as percentages

  4. Clear the screen for each report, (with ncurses)

  5. Dump the source for the shaders themselves to a file for easy inspection

Without any of the above, things are fairly raw for now, but are
perhaps still useful.

11 years agoGeneralize glXGetProcAddressARB wrapper to work for all wrapper functions
Carl Worth [Thu, 25 Apr 2013 05:55:01 +0000 (22:55 -0700)]
Generalize glXGetProcAddressARB wrapper to work for all wrapper functions

The originally implementation here had a whitelist of function names for
which we would return a wrapped symbol, (a very short whitelist consisting
only of "glXSwapBuffers"). A hard-coded list here would be a maintenance
nightmare.

Instead, we now simply perform a dlsym lookup on the wrapper library itself
and if there's a function that exists in the library matching the name
being requested, we return that.

This way we can add functions to our wrapper library without needing to
change the implementation of glXGetProcAddressARB at all.

11 years agoFix 3 separate off-by-one error in as many lines of code.
Carl Worth [Thu, 25 Apr 2013 05:52:50 +0000 (22:52 -0700)]
Fix 3 separate off-by-one error in as many lines of code.

This one is quite embarrassing, and is evidence that I should have
gone to bead earlier last night.

11 years agoMove include of dlfcn.h to dlwrap.h
Carl Worth [Wed, 24 Apr 2013 22:36:23 +0000 (15:36 -0700)]
Move include of dlfcn.h to dlwrap.h

It only makes sense to make this header file pull in the underlying
dlfcn.h.

While in the area, also drop an unneeded include of GL/glext.h, (which
gets pulled in by GL/gl.h).

11 years agoAdd a simple fips.h file.
Carl Worth [Wed, 24 Apr 2013 22:28:43 +0000 (15:28 -0700)]
Add a simple fips.h file.

This pulls in a few widely-used header files, (config.h, stdio.h,
stdlib.h, and string.h), and also gives us a place to define common
macros such as unused and STRNCMP_LITERAL.

11 years agoAppend to, rather than replace, the LD_PRELOAD value.
Carl Worth [Wed, 24 Apr 2013 08:08:54 +0000 (01:08 -0700)]
Append to, rather than replace, the LD_PRELOAD value.

This is more polite for running things such as Steam games where there
is already an LD_PRELOAD value in place. This way, both the Steam overlay
and fips can get along happily.

11 years agofixup __dlsym
Carl Worth [Wed, 24 Apr 2013 22:26:35 +0000 (15:26 -0700)]
fixup __dlsym

11 years agoAdd wrappers for dlopen, dlsym, and glXGetProcAddressARB
Carl Worth [Wed, 24 Apr 2013 07:58:26 +0000 (00:58 -0700)]
Add wrappers for dlopen, dlsym, and glXGetProcAddressARB

This allows for many applications to start working with fips that would not
work before. Specifically, applications that dlopen libGL.so.1 instead of
directly linking with it would previously bypass fips' attempts to wrap
GL calls.

With these new wrappers carefully in place, many applications now work.

I've verified the following applications at least:

apitrace replay
NightSkyHD, a Humble Bundle game, both 32 and 64-bit versions
World of Goo, via Steam

I was also happy to notice that the Steam overlay does not cause fips
any difficulties.

11 years agoFix fips to work without requiring an absolute path for program to run.
Carl Worth [Wed, 24 Apr 2013 00:47:20 +0000 (17:47 -0700)]
Fix fips to work without requiring an absolute path for program to run.

With the latest commit that examines the ELF header of the program to
run fips was suddenly requiring that the absolute path of the program
be provided. This was obvisouly not desired.

It's simple enough to search through the PATH environment variable to
find the absolute path of the program to be run and examine that.

11 years agoCompile both 32-bit and 64-bit versions of the wrapper library.
Carl Worth [Wed, 24 Apr 2013 00:25:13 +0000 (17:25 -0700)]
Compile both 32-bit and 64-bit versions of the wrapper library.

This is intended to make it transparent to run fips with either a
32-bit or a 64-bit program. And it does do that once you successfully
build both versions of the library.

Actually being able to build both versions of the library is a little
tricky though. Here are some of the tricks:

1. You will need to have installed both a 32-bit and a 64-bit .so file
   for each dependent library, (currently libelf and libtalloc).

   The current configure script doesn't check for both versions, so
   you don't get a lot of guidance here. And that's because...

2. On Debian, at least, one cannot currently install both
   libtalloc-dev:amd64 and libtalloc-dev:i386 at the same time.

   Contrast with libelf-dev:i386 and libelf-dev:amd64 which work just
   fine when installed simultaneously.

One can work around this by just install libtalloc-dev:amd64 and then
manually creating the link you need for the i386 package. Namely:

sudo ln -s libelf.so.1 /usr/lib/i386-linux-gnu/libelf.so

11 years agoStart wrapping OpenGL, and print periodic FPS value to stdout.
Carl Worth [Tue, 23 Apr 2013 21:17:33 +0000 (14:17 -0700)]
Start wrapping OpenGL, and print periodic FPS value to stdout.

In addition to the fips binary, we now also compile a libfips.so library
and LD_PRELOAD that before executing the program specified on the command-
line.

The libfips.so library wraps OpenGL calls of interest for purpose of
instrumentation. So far, the only call wrapped is glXSwapBuffers and
the only instrumentation is to compute and print out a frames-per-second
value every 60 frames.

11 years agoAdd the ability to execute a program.
Carl Worth [Mon, 22 Apr 2013 23:03:07 +0000 (16:03 -0700)]
Add the ability to execute a program.

Simply fork and exec the command-line arguments given.

(Nothing is actually changed yet about the environment in which the
program is executed.)

11 years agoMove dist, release, etc. targets to new Makefile.release
Carl Worth [Tue, 23 Apr 2013 17:22:29 +0000 (10:22 -0700)]
Move dist, release, etc. targets to new Makefile.release

The Makefile.local was getting far too cluttered with all of this
stuff mixed in.

11 years agoInitial commit of fips repository
Carl Worth [Mon, 22 Apr 2013 21:24:30 +0000 (14:24 -0700)]
Initial commit of fips repository

Just a build system and a stub of a main program for now, (which
doesn't do anything yet).