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 22.214.171.124d92cba7
android-non-root\arm\armeabi-v7a\libMGD.so dated 05/08/2015 18:38
Are messages getting lost somewhere?
Thanks in advance,
I'm facing the same issue, but I don't use Unity for VR.
All the sympthoms, however, are exactly the same:
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.
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?
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 JdkBin="C:\Program Files\Java\jdk1.8.0_66\bin"
javac -bootclasspath %AndroidJar% -cp %UnityJar% -source 1.6 -target 1.6 %TargetJava%
jar cvf %TargetJar% -C %TargetJavaDir% "com/CodingJar/MaliDebugActivity.class"
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.
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.
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.
View all questions in Graphics and Gaming forum