I am trying to trace the GPU activity on an unrooted Samsung S6 using Unity. I have added the libMGD.so to my application and it does appear in my .apk package. I have installed the MGDDaemon and this can see my application.
I start the MGDDaemon and the Mali Graphics Debugger application (Windows8).
Debug | "Connect to target" appears to work and launches a window titled "Capturing Target@/127.0.0.1:5002".
There is no message on the console and no other output appears.
From the MGDDaemon app on device, I select my application which launches.
There are still no traces appearing within the Windows MGD app.
MGD v 3.0.0.6d92cba7
android-non-root\arm\armeabi-v7a\libMGD.so dated 05/08/2015 18:38
Are messages getting lost somewhere?
Thanks in advance,
Ed
Hi edwebb,
Sorry to hear that you are experiencing problems with tracing your application.
Does your application work when you are trying to trace it?
Is there any interesting output in the logcat (run adb logcat and search for one of the following strings: libMGD, mgd_daemon, mgd_interceptor)?
Cheers,
Jacek
The application works correctly and is launched through the MGD Daemon.
None of the strings that you mention are present in the logcat output, though there are references to mgd. I have uploaded the logfile as logcat_gearvr_mgd1.txt.
PIDs 2628 and 3689 seem to have relevant information. Does this help?
Hi Ed,
Any chance you can upload the file again as I don't seem to be able to access it?
The log file is here http://community.arm.com/docs/DOC-10731
Do I need to do anything to make it public?
I've downloaded the file, thanks!
We are currently working on a similar issue that we have found internally, I'll keep you informed.
I am getting exactly the same symptoms with my setup too. Is there any progress? Anything additional information I can provide?
I have a Samsung S6 (non-rooted) with the MGDaemon installed. The daemon is enabled and successfully identifies my Unity app and can launch it. I can run the debugger and successfully connect to the phone but I get no trace at all.
My app is a Gear VR app.
Thanks
Jules
Hi Jules,
Unfortunately Mali Graphics Debugger doesn't support VR mode at the moment, see MGD - Galaxy S6 - No end of frame detected - Unity
Based on the attached file name and the file content I guess you are using Gear VR
Unfortunately it is not supported at the moment, see MGD - Galaxy S6 - No end of frame detected - Unity
Regards,
This thread does seem related, though I note that I am not getting any output whereas Chris Varnsverry appears to be getting data but no end of frame.
Any update on plans to fix this? Or work with Unity or Oculus to work around it?
Would it be likely to work for a Cardboard version of the App?
I'm facing the same issue, but I don't use Unity for VR.
All the sympthoms, however, are exactly the same:
MGD 3.3.0.1ed1bae6
Samsung Galaxy Tab S 8.4
On the Unity side, there's no way to do that "add to the Android.mk and Activity class" stuff.
So I just put the libMGD.so file from target\android-non-root\arm\armeabi-v7a\ to the project's Assets\Plugins\Android\libs\armeabi-v7a\ folder.
P.S.: the lack of pre-built example app really complicates the process of setting MGR up. It would be much better if there was pre-built APK for the same app as the one profiled in the "samples" folder.
Hi drl,
Unfortunately without the "Activity class stuff", your application is not going to load the MGD interceptor.
Your APK may have libMGD.so inside of it, but its not going to be used unless you explicitly load it.
We're going to have a look and see if there's a way for Unity applications to load libraries.
Thanks,
Jon.
The ability to have the application load the mgd interceptor directly is designed for people who are in a position to make their application do that. If you're not in a position to make your application do that, then I'd recommend the root method as that "just works" without any involvement from the application. Is there something precluding you from using the root method?
Hth,
Chris
Thanks for the replies.
Is there something precluding you from using the root method?
Yes. The warranty void.
Also, I'm working in a small game studio and we're testing our game on the personal devices each of our team has. There's only one "studio device", we don't have a big budget to buy a wide range of devices just for testing.
And none of my co-workers would agree to root their devise for debugging purposes. They're ok to let me use their phones to build the app and check how fast it runs (and/or profile the app with Unity's built-in profiler, which doesn't require rooting). But the're not ok with such a risky thing as rooting the device.
So, yes, non-rooted method for Unity app would be highly, extremely desireable.
Anyway, thanks for making it clear. Today I've rooted our "primary testing device" and with the rooted approach MGD successfully reads data from Unity app.
Unity uses C# for scripting, but as I see the library you provided is written in c++.
In c#, there's a method to load a dll, which was previously compiled by C#, too (and therefore it can be built to any supported platform later).
Or you can call a specific function from the pre-compiled library using [DllImport()]. But I don't know which functions are in this .so file, which of them I need to call and when.
I spent hours trying to get MGD working without voiding my warranty by rooting my device. I finally managed to get it going. Here's what you have to do on the UNITY side (you also have to follow the manual about getting MGDDeamon on your device):
Copy libMGD.so into your Unity Project's Assets/Plugins/Android folder.
Create your own Activity that derives from UnityPlayerActivity and throw the hook in there. Then compile that .java into a .class, then put that .class into a .jar. Finally, place a modified AndroidManifest.xml in your Assets/Plugins/Android folder which will launch your modified activity as the main activity.
Here is the code for the Activity: [Java] Mali Debugger Unity Activity - Pastebin.com
Here's how I compile the .java and .jar it up:
set CurrentDir=%~dp0%
set JdkBin="C:\Program Files\Java\jdk1.8.0_66\bin"
set AndroidJar="B:\Junctions\Android\sdk\platforms\android-23\android.jar"
set UnityJar="B:\Junctions\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Variations\mono\Development\Classes\classes.jar"
set TargetJavaDir=%CurrentDir%
set TargetJava="SOME_SOURCE\com\CodingJar\MaliDebugActivity.java"
set TargetJar="SOME_SOURCE\Assets\Plugins\Android\CodingJar-Development.jar"
pushd %JdkBin%
javac -bootclasspath %AndroidJar% -cp %UnityJar% -source 1.6 -target 1.6 %TargetJava%
jar cvf %TargetJar% -C %TargetJavaDir% "com/CodingJar/MaliDebugActivity.class"
popd
The AndroidManifest.xml which you can base yours off of is found in Unity\Editor\Data\PlaybackEngines\AndroidPlayer\Apk
I have only tested this with Google Cardboard and it appears to work. If any Mali engineers are watching, PLEASE supply us with a custom function we can call in your libMGD.so so that it can mark the end of a frame. This way we can use it for VR rendering as well without waiting for you to figure out what to hook instead of eglSwapBuffers.
Cheers.