c2c11cc9037d5ddd55282c6dab82db542b398d9e |
|
19-Jul-2013 |
Stephen Hines <srhines@google.com> |
Fix Script instancing issue for support library. Our support library relies on opening shared library versions of Scripts on older devices. This has the unfortunate side effect of sharing global variables across Script instances. In traditional RenderScript, the actual Scripts are always instanced, and thus have distinct storage/values for every global (and static global). This change fixes the instancing issue by keeping track of loaded libraries (via a global set, since dlopen is tracked/shared per-process). If we detect a collision, we create a new randomly named symlink of the library to actually load from. The dlopen() function only looks at the library name passed to it, so this allows us to cheaply create a duplicate instance. Once the symlinked library is actually loaded, we destroy it. A new unit test has also been added to RSTest_CompatLib to verify instance behavior. This is a modified version of the same test we have present in CTS for traditional RenderScript instance verification. Change-Id: I6a0bca2b65d125b54793d98f0f73ae92e0280af7
/frameworks/rs/java/tests/RSTest_CompatLib/src/com/android/rs/test/UT_instance.java
|