#jogamp @ irc.freenode.net - 20140607 05:05:23 (UTC)


20140607 05:05:23 -jogamp- Previous @ http://jogamp.org/log/irc/jogamp_20140605162523.html
20140607 05:05:23 -jogamp- This channel is logged @ http://jogamp.org/log/irc/jogamp_20140607050523.html
20140607 05:59:11 * [Mike] (~Mike]@anon) Quit ()
20140607 06:33:16 * [Mike] (~Mike]@anon) has joined #jogamp
20140607 07:21:57 * guardianp (~gp@anon) has joined #jogamp
20140607 07:55:52 * monsieur_max (~maxime@anon) has joined #jogamp
20140607 08:36:44 * monsieur_max (~maxime@anon) has left #jogamp
20140607 08:58:40 * jk4 (~jk4@anon) Quit (*.net *.split)
20140607 08:58:41 * bbbruce (~bx@anon) Quit (*.net *.split)
20140607 08:58:55 * bbbruce (~bx@anon) has joined #jogamp
20140607 08:58:55 * jk4 (~jk4@anon) has joined #jogamp
20140607 09:02:01 * bbbruce (~bx@anon) Quit (*.net *.split)
20140607 09:04:26 * jk4 (~jk4@anon) Quit (*.net *.split)
20140607 09:04:34 * bbbruce (~bx@anon) has joined #jogamp
20140607 09:09:50 * jk4 (~jk4@anon) has joined #jogamp
20140607 09:51:11 * guardianp (~gp@anon) has left #jogamp
20140607 10:47:25 <sgothel> http://ppaalanen.blogspot.de/2014/06/from-pre-history-to-beyond-global.html <- OSS display driver evolution .. [mode setting + page flipping / vsync]
20140607 10:53:35 <sgothel> http://www.vesa.org/news/vesa-adds-adaptive-sync-to-popular-displayport-video-standard/ <- ... using that for adaptive pageflip .. maybe soon :)
20140607 11:05:54 * zzuegg (~zzuegg@anon) has joined #jogamp
20140607 11:06:38 * monsieur_max (~maxime@anon) has joined #jogamp
20140607 12:43:31 <rmk0> 'lo.
20140607 12:43:43 <rmk0> sgothel: wondering if you have any opinion on how i should try to handle this apitrace thing
20140607 12:43:52 <rmk0> generally, it's run from the command line, like:
20140607 12:43:58 <rmk0> $ apitrace trace java -jar ...
20140607 12:44:06 <rmk0> but it's also possible to load it as a library with LD_PRELOAD
20140607 12:44:37 <rmk0> i'd kind of like to be able to load the apitrace.so at runtime in a way that would work with jogl
20140607 12:44:59 <rmk0> as in... not using LD_PRELOAD for the vm, but selectively loading the .so
20140607 12:45:10 <rmk0> they claim it's actually completely interchangeable with the normal libGL.so
20140607 12:45:37 <rmk0> wondering what would be the recommended way to do it...
20140607 13:43:19 * zzuegg (~zzuegg@anon) Quit ()
20140607 14:17:08 * monsieur_max (~maxime@anon) has left #jogamp
20140607 15:01:38 <sgothel> hmm
20140607 15:02:16 <sgothel> we do load 'a' 'libGL' via dlopen .. so the so _name_ matters here
20140607 15:02:46 <sgothel> GLDynamicLibraryBundleInfo <- see ..
20140607 15:03:14 <sgothel> X11GLXDynamicLibraryBundleInfo: search names in order libGL.so.1, libGL.so, GL
20140607 15:03:29 <sgothel> shallLinkGlobal() { return true; }
20140607 15:03:42 <sgothel> but! lookup is local .. hmm
20140607 15:04:04 <sgothel> so in case your wrapping apitrace libGL is the one to be found .. and is found .. it should just work
20140607 15:04:16 <sgothel> i.e. via LD_LIBRARY_PATH
20140607 15:04:39 <sgothel> same for EGLES2DynamicLibraryBundleInfo so names ..
20140607 15:05:30 <sgothel> if it works .. maybe you can add a wiki entry .. 'analyzing/debugging JOGL w/ external tools - chapter-1 apitrace' :)
20140607 15:06:20 <sgothel> I may like to add a chapter for the dynamic memory analyzer .. forgot name ? hmm .. bad :)
20140607 15:07:58 <sgothel> *valgrind* .. it is .. yup
20140607 15:09:17 <sgothel> we talked about adding a custom lib-name for the GL lookup (properties ..) .. could do for apps not running in a sandbox
20140607 15:13:55 <sgothel> @Mark: ok ?
20140607 15:14:21 <rmk0> lo...
20140607 15:14:23 * rmk0 reads
20140607 15:14:45 <rmk0> hm
20140607 15:14:53 <rmk0> let me clarify, actually
20140607 15:15:13 <rmk0> the way it works with opengl programs written in C is either:
20140607 15:15:24 <rmk0> 1. user runs their program with apitrace: $ apitrace trace ./myprogram
20140607 15:15:50 <rmk0> 2. user forces apitrace.so to override the symbols in libGL.so: LD_PRELOAD=/opt/apitrace/lib... ./myprogram
20140607 15:16:04 <rmk0> in java, we're obviously loading everything at runtime
20140607 15:16:16 <rmk0> i'd like to be able to, from my program, load apitrace, and then load JOGL
20140607 15:16:37 <sgothel> understood
20140607 15:16:39 <rmk0> like... actually allow the person running the program to determine whether or not they want tracing before we open an opengl context
20140607 15:17:11 <sgothel> this works usually if symbol lookup is global (pre-existing ?)
20140607 15:17:32 <sgothel> and apitrace.so must have a build-in name like libGL.so.1 ?
20140607 15:17:45 <rmk0> i've only tested running java programs from apitrace, like $ apitrace trace java -jar ..., which does work correctly
20140607 15:17:57 <rmk0> i've not played around with LD_PRELOAD and so on, or with renaming .so files
20140607 15:18:28 <sgothel> how does it work w/o forcing to use the apitrace.so ?
20140607 15:18:41 <rmk0> i... don't know /o\
20140607 15:18:47 <sgothel> b/c apitrace's libGL.so.1 is in LD_LIBRARY_PATH ?
20140607 15:18:56 <sgothel> IMHO the only way ..
20140607 15:19:03 <rmk0> hang on, will need to check the apitrace source to find out
20140607 15:19:07 <sgothel> LD_LIBRARY_PATH or ldconfig ..
20140607 15:19:14 <rmk0> they most likely do play around with the environment, yes
20140607 15:19:25 <sgothel> thats how I load diff. mesa impl.
20140607 15:19:29 <sgothel> so - great
20140607 15:20:05 <sgothel> then, we load the favored apitrace libGL.so* via LD_LIBRARY_PATH or ldconfig, which itself loads the downstream native libGL
20140607 15:22:06 <rmk0> aha, running apitrace sets LD_PRELOAD:
20140607 15:22:18 <rmk0> $ env -i /opt/apitrace/bin/apitrace trace env
20140607 15:22:22 <rmk0> LD_PRELOAD=/opt/apitrace/bin/../$LIB/apitrace/wrappers/glxtrace.so
20140607 15:22:58 <rmk0> so they load a glxtrace.so which presumably defines all of the usual libGL.so gl* symbols
20140607 15:23:36 <sgothel> wonder why this works w/ JOGL, since we do a local dlsym lookup on the libGL.so .. hmm
20140607 15:23:42 <rmk0> http://waste.io7m.com/2014/06/07/nm.txt
20140607 15:23:49 <sgothel> jaja
20140607 15:23:50 <rmk0> ^^ 'nm' on glxtrace.so
20140607 15:24:08 <rmk0> is a bit of a mystery to me why it works too...
20140607 15:26:22 <sgothel> DynamicLibraryBundle#327:addr = lib.dynamicLookupFunction(funcName);
20140607 15:26:28 <sgothel> NativeLibrary lib ..
20140607 15:27:02 <sgothel> -> dlsym(libraryHandle, symbolName);
20140607 15:27:42 <sgothel> so LD_PRELOAD must override this 'local' concept, for each symbol-name of all libraries ? .. wow
20140607 15:27:57 <rmk0> interesting...
20140607 15:28:24 <sgothel> or .. apitrace is also using LD_LIBRARY_PATH or ldconfig
20140607 15:28:55 <sgothel> but then .. we do use GLX lookup-function .. hmm
20140607 15:29:20 <rmk0> it seems it only uses LD_PRELOAD
20140607 15:29:25 <sgothel> glXGetProcAddress*
20140607 15:29:43 <sgothel> GLX.glXGetProcAddress(toolGetProcAddressHandle, funcName);
20140607 15:30:11 <rmk0> what is glXGetProcAddress used for in JOGL?
20140607 15:30:57 <sgothel> to get the symbol names alternative to dlsym
20140607 15:31:21 <rmk0> suppose what i mean is, why glXGetProcAddress over dlsym?
20140607 15:31:24 <sgothel> and we do favor this path: DesktopGLDynamicLibraryBundleInfo.useToolGetProcAdressFirst(..) { return true; }
20140607 15:31:50 <rmk0> apitrace obviously hijacks glXGetProcAddress
20140607 15:31:51 <sgothel> b/c client libGL does not need to expose the symbol names statically
20140607 15:32:07 <rmk0> ah, right
20140607 15:32:09 <sgothel> but per context TYPE libGL can swizzle entries!
20140607 15:32:33 <rmk0> so they use may use some internal mangled name for the actual GL functions, and glXGetProcAddress returns pointers to those?
20140607 15:32:38 <rmk0> without them having to expose the real symbol names?
20140607 15:32:43 <sgothel> yes
20140607 15:32:45 <rmk0> makes sense
20140607 15:33:20 <sgothel> hence we cache the ProcAddressTable per context type (GL3, GL4, ES2, ..)
20140607 15:34:00 <sgothel> .. and GLX connection.. etc
20140607 15:34:42 * guardianp (~gp@anon) has joined #jogamp
20140607 15:40:08 <rmk0> hrm, seems like they do something different on each platform
20140607 15:40:14 <rmk0> LD_PRELOAD on linux, obviously
20140607 15:40:20 <rmk0> think their command line tool abstracts over the differences
20140607 15:42:00 <rmk0> i would guess that it probably works in our case because JOGL calls glXGetProcAddress
20140607 15:42:24 <rmk0> can't see any other way
20140607 15:42:45 <sgothel> yup
20140607 15:43:06 <sgothel> glXGetProcAddress -> how do we get that one ? :)
20140607 15:43:33 <rmk0> they use LD_PRELOAD on linux, DYLD_FRAMEWORK_PATH on OS X, and some sort of DLL injection trick on windows
20140607 15:44:44 <sgothel> dynamicLookupFunctionOnLibs <- same way, i.e. local on loaded libGL.so.1
20140607 15:44:51 <sgothel> hmm
20140607 15:45:00 <sgothel> strace would probably tell ..
20140607 15:45:06 <rmk0> hehe, was just about to say that
20140607 15:45:13 <rmk0> am going to do some poking with strace shortly
20140607 15:45:21 <rmk0> will get to the bottom of this...
20140607 15:48:38 <sgothel> https://github.com/tobbez/ld-preload-reverse/ <- looking at this simple example .. it must override per symbol in a global scope
20140607 15:48:46 <sgothel> problem solved .. hmm
20140607 15:56:47 * guardianp (~gp@anon) Quit (Ping timeout: 265 seconds)
20140607 17:38:01 * kermyt (~kermyt@anon) Quit (Ping timeout: 252 seconds)
20140607 17:41:33 * kermyt (~kermyt@anon) has joined #jogamp
20140607 20:01:11 * void256 (~void@anon) has joined #jogamp
20140607 21:26:29 * void256_ (~void@anon) has joined #jogamp
20140607 21:28:24 * void256 (~void@anon) Quit (Ping timeout: 260 seconds)
20140607 21:28:38 * void256_ is now known as void256
20140608 00:55:13 * void256 (~void@anon) Quit (Quit: ChatZilla 0.9.90.1 [Firefox 29.0.1/20140506152807])
20140608 01:45:54 * guardianp (~gp@anon) has joined #jogamp
20140608 01:46:00 * guardianp (~gp@anon) has left #jogamp
20140608 05:05:24 -jogamp- Continue @ http://jogamp.org/log/irc/jogamp_20140608050524.html