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
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.
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.
Thanks for the steps! We get a lot of people asking about MGD + Unity, so I'll raise this with the team and see if we can add some Unity specific steps to our documentation.
As for the VR support, I believe the team are aware of the problem, and we plan to support it.
Thanks,
Chris
Hi,
MGD v3.4.1 has been released Mali Graphics Debugger - Mali Developer Center and supports VR with frame detection. Let us know if you have any issues.
Cheers,
Jacek