]> git.cworth.org Git - fips/log
fips
10 years agotest: Add test using GLX with dlopen and dlsym to find symbols
Carl Worth [Thu, 27 Jun 2013 21:08:39 +0000 (14:08 -0700)]
test: Add test using GLX with dlopen and dlsym to find symbols

Gradually building out the test suite to something useful here.

10 years agofips: Add the beginning of a test suite
Carl Worth [Thu, 27 Jun 2013 20:26:59 +0000 (13:26 -0700)]
fips: Add the beginning of a test suite

So far, there's just one test program. It links against libGL.so and
uses GLX to render a few solid frames. The test suite ensures that it
can be run and that "fips --verbose" actually prints a message.

10 years agofips: Add a -v/--verbose flag.
Carl Worth [Thu, 27 Jun 2013 20:23:55 +0000 (13:23 -0700)]
fips: Add a -v/--verbose flag.

The only real purpose imagined for this for now is to be able to
verify that fips is actually doing something, (for example, if a
program renders less than 60 frames and exits then previous fips would
exit silently).

The --verbose flag will be useful with the upcoming test suite and its
short-lived programs.

10 years agoconfigure: Add pkg-config-based check for libX11
Carl Worth [Thu, 27 Jun 2013 20:22:54 +0000 (13:22 -0700)]
configure: Add pkg-config-based check for libX11

Nothing in fips itself needs to link against libX11, but we'll soon be
adding a test-suite program that needs to be able to.

10 years agoconfigure: Set GL_LDFLAGS and EGL_LDFLAGS in configure script
Carl Worth [Thu, 27 Jun 2013 03:46:40 +0000 (20:46 -0700)]
configure: Set GL_LDFLAGS and EGL_LDFLAGS in configure script

The libfips library doesn't link directly to libGL nor libEGL so
didn't need these flags. But we're adding test programs that do link
to these, so the test's Makefile needs access to these flags.

10 years agoPush final collection of CFLAGS/LDFLAGS from Makefile.config to Makefile.local
Carl Worth [Thu, 27 Jun 2013 01:18:52 +0000 (18:18 -0700)]
Push final collection of CFLAGS/LDFLAGS from Makefile.config to Makefile.local

This makes the final decision more explicit closer to where the flags
are actually being used. This will be helpful as we add other
programs, which can now easily mimic the style of flags collection as
is done for fips.

This also eliminates any potential confusion of FIPS_FLAGS
vs. FINAL_FIPS_FLAGS, etc. The use of "FINAL_" has now been entirely
eliminated.

10 years agoStop processing command-line options at first non-option argument
Carl Worth [Tue, 25 Jun 2013 23:48:13 +0000 (16:48 -0700)]
Stop processing command-line options at first non-option argument

This makes it much easier to pass options to the program being
executed by fips. The options can be passed directly, such as:

fips glxgears -fullscreen

Previous, to this commit, one would have to use a syntax such as:

fips -- glxgears -fullscreen

to prevent fips from trying to interpret the "-fullscreen" argument as
options to fips itself.

10 years agoeglwrap: Add comment describing why we don't lookup into libGLESv2.so
Carl Worth [Mon, 24 Jun 2013 22:49:44 +0000 (15:49 -0700)]
eglwrap: Add comment describing why we don't lookup into libGLESv2.so

A user recently asked me why we didn't perform lookups in
libGLESv2.so, (instead of just libEGL.so). I actually made the mistake
of writing code to do that before I realized the answer.

Adding the answer in a comment here should help me avoid making that
mistake again.

10 years agoEGL: Add wrapper for eglGetProcAddress
Carl Worth [Mon, 24 Jun 2013 22:44:47 +0000 (15:44 -0700)]
EGL: Add wrapper for eglGetProcAddress

If an EGL-using program uses eglGetProcAddress to locate functions, we
want to intercept that to return our own versions of the functions,
(to add out metrics timings, etc.).

If the requested function is not implemented in our library, just
defer to the real, underlying eglGetProcAddress function to find the
symbol.

10 years agoconfigure: Fix configure check to look for egl.h in the correct directory
Carl Worth [Mon, 24 Jun 2013 22:27:50 +0000 (15:27 -0700)]
configure: Fix configure check to look for egl.h in the correct directory

This configure check was broken by looking for GL/egl.h instead of
EGL/egl.h as it should. This failure was masked on any system with an
EGL implementation providing a pkg-config file (egl.pc).

10 years agoPush glBeginQuery/glEndQuery down into metrics.c
Carl Worth [Mon, 24 Jun 2013 22:24:20 +0000 (22:24 +0000)]
Push glBeginQuery/glEndQuery down into metrics.c

The code in metrics.c was already using dynamic dispatch for OpenGL functions.

But the code in glwrap is now, (and cannot since it relies on "real" OpenGL
header files to ensure the wrapped functions have the correct prototypes).

This resulted in link failures since these functions were not called via
dynamic dispatch.

Gix by adding new metrics_counter_start and metrics_counter_stop functions which
call the glBeginQuery/glEndQuery functions via dynamic dispatch.

10 years agofips-dispatch: Completely separate fips-dispatch GL prototypes from GL/gl.h
Carl Worth [Mon, 24 Jun 2013 20:22:59 +0000 (13:22 -0700)]
fips-dispatch: Completely separate fips-dispatch GL prototypes from GL/gl.h

Move the OpenGL prototypes previously in fips-dispatch.h to a new
fips-dispatch-gl.h. The idea here is that any given file should
include only one of GL/gl.h or fips-dispatch-gl.h.

Files that implement libfips wrappers for OpenGL functions include
GL/gl.h to ensure that they implement functions with the correct
prototypes.

Meanwhile, files that call into OpenGL functions at run-time, (such as
metrics.c which calls the various OpenGL query-related functions),
instead include fips-dispatch-gl.h and do not include GL/gl.h. With
this approach, any new calls to OpenGL functions will cause
compilation warnings if the stubs are not also added to
fips-dispatch-gl.h.

10 years agoAdd dynamic dispatch for any calls to OpenGL functions.
Carl Worth [Sat, 22 Jun 2013 00:10:03 +0000 (17:10 -0700)]
Add dynamic dispatch for any calls to OpenGL functions.

Previously, fips code was making direct calls to OpenGL functions,
(such as glGenQueries, glBeinQuery, etc. within metrics.c). Some
OpenGL implementations do not export these symbols directly,
(expecting the application to instead look the symbols up via a call
to glXGetProcAddressARB or eglGetProcAddress).

The new fips-dispatch code added here does precisely that, (and adds
wrapper for both glXMakeCurrent and eglMakeCurrent in order to know
which GetProcAddress function should be called).

The dispatch code follows the model of piglit-dispatch, (available
under the same license as fips). Thanks to Eric Anholt for suggesting
following the same approach as piglit.

10 years agoconfigure: Fix to have compiler warnings enabled while building libfips
Carl Worth [Mon, 24 Jun 2013 20:19:41 +0000 (13:19 -0700)]
configure: Fix to have compiler warnings enabled while building libfips

In commit e42d9f224a4ef2784f8fd43f9f4f5c593a7ddd57 , when the flags
were split between fips and libfips, the warnings flags were
mistakenly applied to both CFLAGS and LDFLAGS of fips. (What was
actually intended was to have the warnings applied to the CFLAGS of
both fips and libfips).

10 years agoTODO: Add some additional items suggested by Eero.
Carl Worth [Fri, 14 Jun 2013 18:29:33 +0000 (11:29 -0700)]
TODO: Add some additional items suggested by Eero.

Again, simply trying to ensure that good ideas that come in via email
don't get dropped on the floor.

 Report shader compilation time.

+Report elapsed time per frame.
+
+Add options to control which metrics should be collected.
+
 Add Eric's tiny hash table for collecting per-shader statistics

  people.freedesktop.org:~anholt/hash_table
@@ -45,6 +49,9 @@ Infrastructure (larger-scale things, more future-looking items)

 Use ncurses for a better top-like display.

+Report timestamps and CPU time durations for operations causing
+CPU/GPU syncs.
+
 Emit per-frame data in a format for external timeline viewer.

 Allow enabling/disabling of tracing at run-time
@@ -61,10 +68,16 @@ should automatically collect:

 Audit exisiting visualization tools before writing one from scratch

- Eero suggested that pytimechart might be well-suited:
+ Eero suggested two possibilities:

+ pytimechart
+ -----------
  http://pythonhosted.org/pytimechart/index.html

+ e-graph
+ -------
+ https://gitorious.org/e-graph
+
  Others?

 Explore using perf/LTTng probing instead of LD_PRELOAD wrapper

10 years agoTODO: Remove bug causing libfips-32.so to not build.
Carl Worth [Fri, 14 Jun 2013 18:11:42 +0000 (11:11 -0700)]
TODO: Remove bug causing libfips-32.so to not build.

The configure script now checks for this problem and won't attempt to
build a non-native-arch libfips if the toolchain pieces, (such as the
gcc-multilib package), are not in place.

10 years agoconfigure: Fully separate CFLAGS/LDFLAGS between fips and libfips
Carl Worth [Fri, 14 Jun 2013 06:29:07 +0000 (23:29 -0700)]
configure: Fully separate CFLAGS/LDFLAGS between fips and libfips

The top-level program and the underlying library have fundamentally
different requirements. For example, the top-level program needs to
link against libtalloc and libelf but the library does not.

Previously, the necessary flags for both were mixed together in
CONFIGURE_CFLAGS and CONFIGURE_LDFLAGS. This caused the library to
unnecessarily link against libtalloc and libelf, (which in turn caused
problems since the library is compiled as both 32-bit and 64-bit but
the system may not provide both 32- and 64-bit versions of these
libraries).

By splitting things up into separate FIPS_LDFLAGS vs. LIBFIPS_LDFLAGS,
etc. we can keep the dependencies down to what is really required and
eliminate several sprious failure cases.

10 years agoAdd more detailed warning if libfips binary could not be found.
Carl Worth [Fri, 14 Jun 2013 05:02:45 +0000 (22:02 -0700)]
Add more detailed warning if libfips binary could not be found.

Since we now may not compile a non-native bit-size libfips, (such as
not compiling libfips-32.so on a native 64-bit install), then fips can
fail when trying to wrap a 32-bit application.

So be kind and suggest that the user install gcc-multilib and
re-compile fips as one potential solution for this problem.

10 years agoconfigure: Test whether compiler can create both 32 and 64-bit binaries
Carl Worth [Fri, 14 Jun 2013 04:57:38 +0000 (21:57 -0700)]
configure: Test whether compiler can create both 32 and 64-bit binaries

If not, tell the user and recommend installing gcc-multilib. Then simply
don't attempt to compile the unspoorted library.

10 years agoconfigure: Move the code which detects compiler warning options
Carl Worth [Thu, 13 Jun 2013 22:39:30 +0000 (15:39 -0700)]
configure: Move the code which detects compiler warning options

For no good reason, this code was previously stuck right in the middle
of code reporting the final results of previous checks, (after the
case reporting that errors were found and before the case reporting
that no errors were found).

It's more clean to have the warning-option detection happen before any
of that reporting.

10 years agoconfigure: Switch from 4 spaces to tabs for some messages
Carl Worth [Thu, 13 Jun 2013 22:33:26 +0000 (15:33 -0700)]
configure: Switch from 4 spaces to tabs for some messages

Another cosmetic improvement to simply align the output more cleanly.

10 years agoconfigure: Add an early check for a functional C compiler
Carl Worth [Thu, 13 Jun 2013 22:00:49 +0000 (15:00 -0700)]
configure: Add an early check for a functional C compiler

Without this, later compiler-based checks for header files, etc. would
falsely claim that libraries were not installed, (when in fact, the
libraries were installed but the compiler-based checks were failing
because no compiler is available).

10 years agoconfigure: Tighten up the text on a couple of messages
Carl Worth [Thu, 13 Jun 2013 21:32:32 +0000 (14:32 -0700)]
configure: Tighten up the text on a couple of messages

Just a cosmetic thing to make the column of Yes/No messages align more
closely.

10 years agoconfigure: Move the error message for pkg-config earlier
Carl Worth [Thu, 13 Jun 2013 21:26:08 +0000 (14:26 -0700)]
configure: Move the error message for pkg-config earlier

Once pkg-config cannot be found, there's no point in running the rest
of the configure script since it will just spew a bunch of errors due
to missing pkg-config.

So, stop early and let the user know that pkg-config needs to be
installed.

10 years agoAdd a TODO file
Carl Worth [Thu, 13 Jun 2013 17:37:36 +0000 (10:37 -0700)]
Add a TODO file

This captures known bugs, planned (near-term) features, planned
(longer-term) infrastructure changes, and some ideas for other things
to investigate.

Many thanks to Eero Tamminen whose recent discussions and ideas
prompted the creation of this file, (and much of the content).

10 years agoeglwrap: Add EGLWRAP_DEFER and EGLWRAP_DEFER_WITH_RETURN macros
Carl Worth [Wed, 12 Jun 2013 23:35:59 +0000 (16:35 -0700)]
eglwrap: Add EGLWRAP_DEFER and EGLWRAP_DEFER_WITH_RETURN macros

There are parallel to GLWRAP_DEFER and GLWRAP_DEFER_WITH_RETURN, (differing
only in calling eglwrap_lookup rathern than glwrap_lookup).

Having these macros around will avoid some code duplication as we start
adding more functions to the eglwrap.c file.

10 years agoFix to actually load the real libGL.so when the application asks for it.
Carl Worth [Wed, 12 Jun 2013 23:22:06 +0000 (16:22 -0700)]
Fix to actually load the real libGL.so when the application asks for it.

Our wrapper library intercepts calls to dlopen "libGL.so" and returns
a handle to itself. That's correct, and as intended.

Before doing this, however, it's essential to actual dlopen "libGL.so"
for real even though we won't be returning a handle to it. This
ensures that any side effects from that dlopen are taken care of.

This fixes a bug where "fips apitrace replay foo.trace" would cause
Mesa to fail to load its driver as follows (with LIBGL_DEBUG=verbose):

libGL: OpenDriver: trying .../lib/dri/i965_dri.so
libGL error: dlopen .../lib/dri/i965_dri.so failed (.../lib/libdricore9.2.0.so.1: undefined symbol: _glapi_tls_Context)

10 years agodlwrap: Don't resolve libfips_handle on every call to dlopen.
Carl Worth [Wed, 12 Jun 2013 23:16:51 +0000 (16:16 -0700)]
dlwrap: Don't resolve libfips_handle on every call to dlopen.

Instead, call dladdr and the real dlopen on the first call to dlopen
then save the libfips_handle result for all future calls.

10 years agoSwitch from glGetQueryObjectiv to glGetQueryObjectuiv
Carl Worth [Wed, 12 Jun 2013 00:18:12 +0000 (17:18 -0700)]
Switch from glGetQueryObjectiv to glGetQueryObjectuiv

The latter is available in OpenGL ES 3 while the former is not.

We don't really care about the signedness either way, (we're fetching
a Boolean), so sticking consistently to the unsigned version provides
better portability with no downside.

10 years agoAdd a new GLWRAP_DEFER_WITH_RETURN macro.
Carl Worth [Mon, 10 Jun 2013 21:40:43 +0000 (14:40 -0700)]
Add a new GLWRAP_DEFER_WITH_RETURN macro.

This allows for the elimination of some code duplication from our
implementation of glXGetPrcAddressARB. The previous implementation
duplicated code from glwrap_lookup simply because the GLWRAP_DEFER
macro did not provide access to the return value of the wrapped
function.

With the new macro, (very much like GLWRAP_DEFER but accepting a
parameter for a variable to accept the return value), we can eliminate
this code duplication.

Of course, our symbol-extraction script is now a bit more complicated
since it has to find occurrences of DEFER_WITH_RETURN in addition to
occurrences of DEFER, and pull out the function name as the second
argument rather than the first.

10 years agoRemove typedef for fips_glXGetProcAddressARB_t
Carl Worth [Mon, 10 Jun 2013 21:34:26 +0000 (14:34 -0700)]
Remove typedef for fips_glXGetProcAddressARB_t

There were two problems with this typedef. First, we don't actually
need it, (we define it here and then use it exactly once on the next
line---it's simpler to have the direct syntax for a function returning
a pointer to a function accepting void and returning void.

More importantly, the typedef was relying on the type __GLXextFuncPtr
being defined. This happens to work with Mesa on my system but is
inherently fragile. So the code is more robust not relying on this.

10 years agoMakefile: Automatically generate libfips.sym symbol map
Carl Worth [Thu, 30 May 2013 22:10:15 +0000 (15:10 -0700)]
Makefile: Automatically generate libfips.sym symbol map

Previously, we had to manually maintain this table of symbols, (hence
it was too easy for the list to be stale). Instead, we now generate
the list automatically by examining the source code for symbols that
are wrapped.

10 years agolibfips.sym: Sort list in symbol map alphabetically.
Carl Worth [Thu, 30 May 2013 21:49:18 +0000 (14:49 -0700)]
libfips.sym: Sort list in symbol map alphabetically.

Where sort order is determined by "sort" utility.

This is to prepare for eventually generating this list automatically
from the source.

10 years agoAdd some *wrap_ prefixes to real_foo symbols.
Carl Worth [Thu, 30 May 2013 21:32:52 +0000 (14:32 -0700)]
Add some *wrap_ prefixes to real_foo symbols.

The intent here is to allow automated extraction of wrapper names by
grepping for symbols matching *wrap_real_<wrapper>.

10 years agoAdd two missing GL draw wrappers
Carl Worth [Thu, 30 May 2013 21:22:24 +0000 (14:22 -0700)]
Add two missing GL draw wrappers

The following two functions are now added:

glMultiDrawArraysIndirect
glMultiDrawElementsIndirect

These were previously commented out with a "FIXME" comment. I don't
recall now what original problem I ran into when trying to add these,
but they seem to work fine now.

10 years agometrics: Collect new timer-query results before report
Carl Worth [Thu, 30 May 2013 21:05:08 +0000 (14:05 -0700)]
metrics: Collect new timer-query results before report

The timers from the most-recently-completed frame may not yet be
complete, but still, for the most accurate reports, we now collect all
available timer values before printing the report.

10 years agodlwrap: Fix dlwrap_real_dlopen to only perform dlsym-lookup once
Carl Worth [Thu, 30 May 2013 19:55:26 +0000 (12:55 -0700)]
dlwrap: Fix dlwrap_real_dlopen to only perform dlsym-lookup once

Making the real_dlopen variable static means that we perform the dlysm
lookup only once and then re-use the result for later calls. This is
what was always intended for this code.

10 years agoAvoid inserting timer queries while constructing a display list
Carl Worth [Fri, 24 May 2013 18:11:15 +0000 (11:11 -0700)]
Avoid inserting timer queries while constructing a display list

We only want to time actual drawing operations. When between glNewList
and glEndList, calls that look like drawing operations are not really,
instead these are just calls that are being recorded to be later
executed with glCallList. (And it won't work to put our timer queries
inside the display list.)

So, track when we are within glNewList/glEndList and don't add timer
queries.  Instead, we will time these operations as a whole with a
timer query around the glCallList call itself.

10 years agoAvoid trying to start a timer query within glBegin/glEnd
Carl Worth [Fri, 24 May 2013 18:10:12 +0000 (11:10 -0700)]
Avoid trying to start a timer query within glBegin/glEnd

Instead, treat the entire sequence from glBegin..glEnd as a single drawing
operation and execute the timer query around the whole thing.

10 years agoAdd several missing symbols to the libfips symbol map.
Carl Worth [Thu, 23 May 2013 21:22:42 +0000 (14:22 -0700)]
Add several missing symbols to the libfips symbol map.

I'm not sure why these weren't added before, but without these in the
map, these calls were not being successfully wrapped, so these calls
were not being timed as they should have been.

In the future we should automatically generate the symbol list to
avoid any similar problems.

10 years agoRemove useless fork before executing wrapped program.
Carl Worth [Mon, 6 May 2013 18:57:24 +0000 (11:57 -0700)]
Remove useless fork before executing wrapped program.

The fork did nothing for us since the parent simply waited on the child
and then exited. It's simpler to simply exec the wrapped program, (which
simplifies running fips within a debugger, etc.).

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).