Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Mali Graphics Debugger and Unity

Discussion in 'General Graphics' started by Lex-DRL, Jan 13, 2016.

  1. Lex-DRL

    Lex-DRL

    Joined:
    Oct 10, 2011
    Posts:
    139
    I'm trying to make this debug tool work with Unity game on a non-rooted Android device.

    Could anyone give a hint on how do I do that?

    I followed all the steps from MGD's user guide with no success.
    There are several things that I need to do with a source Android files (like adding some lines to an "Android.mk" file and manually load a .so file). And these steps need to be done slightly different way in case of Unity's app.

    So, I placed libMGD.so to the "Assets/Plugins/Android/libs/armeabi-v7a" folder in Unity project, installed the provided MGDDaemon.apk and enabled it on the device.
    But in the MGD tool itself I don't get any trace data. I'm facing exactly the same issue as discussed here, but unlike that guy, I'm not building a VR app. In fact, VR is even disabled in player settings.

    So if anyone was able to debug Unity's build with the Mali Graphics Debugger on an unrooted device, I'd really appreciate some help.

    As far as I can see, some people was able to make MGD work. So could you tell the secret, how you did that, please?
     
  2. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    547
    Hi Lex,

    I've done the rooted alternative, which is pretty straighforward apart from rooting the device.

    I'm curious about this. I'll try the non-rooted solution when I get some time later this week and let you know about my progress.

    Btw, current MGD version already supports VR.

    Phil,
     
    Lex-DRL likes this.
  3. Jodon

    Jodon

    Joined:
    Sep 12, 2010
    Posts:
    433
    Lex-DRL likes this.
  4. Phil Lira

    Phil Lira

    Joined:
    Jan 19, 2016
    Posts:
    2
    Argh. I just had time to work on it today and just got it working. It kinda feels frustating that someone already posted the solution before me.

    To add my two cents.

    1) In build settings you can select "Google Android Project" and Export. This will create an android project for you in which you can load in Eclipse or Android Studio.

    2) Derive your class from UnityNativePlayerActivity instead.

    3) On Eclipse select File > Export -> Java -> Jar

    4) Place libMGD.so from non-root/armeabi-v7a into Plugins/Android/libs/armeabi-v7a

    5) manifest and jar files into Plugins/Android
     
    Lex-DRL likes this.
  5. Lex-DRL

    Lex-DRL

    Joined:
    Oct 10, 2011
    Posts:
    139
    Thanks guys!. You both really helped a lot.
     
  6. mbowen89

    mbowen89

    Joined:
    Jan 21, 2013
    Posts:
    639
    Call me stupid, but I guess I need an even more detailed step by step process to get this working on a non-rooted device. @Jodon or @Phil Lira any help would be much appreciated.
     
  7. Jodon

    Jodon

    Joined:
    Sep 12, 2010
    Posts:
    433
    Unzip the attach .zip file into your Assets/Plugins/Android folder. Rename the AndroidManifest.MaliDebug.xml to simply AndroidManifest.xml. Then make sure you're running the MGDaemon on your device. Launch via the MGDaemon while your Mali Debugging app (running on your PC) is connected. I should warn you, the info I got from MGD was pretty much nothing. The built-in Unity tools are much better.

    Cheers.
     

    Attached Files:

  8. mbowen89

    mbowen89

    Joined:
    Jan 21, 2013
    Posts:
    639
    Thanks I will try it out.

    Why was it not helpful? It should show you a complete breakdown of shaders and draw calls and actual performance on device.
     
  9. Jodon

    Jodon

    Joined:
    Sep 12, 2010
    Posts:
    433
    That's what I thought too. I'm on mobile, but here's the relevant thread where I discuss the issues I have. In short, you're better off using their other tools to figure it out plus the Unity Frame Debugger and profiling tools. If you need shader times, their shader compiler is what you need.

    https://community.arm.com/message/34065#34065
     
    Last edited: Mar 21, 2016
  10. mihailogazda

    mihailogazda

    Joined:
    Aug 11, 2015
    Posts:
    1
  11. Jodon

    Jodon

    Joined:
    Sep 12, 2010
    Posts:
    433
    That was my first implementation. Unfortunately it disn't work for me when testing with the Gear VR. Those libraries grab function pointers on startup and if Mali isn't active by then it won't function.
     
  12. AlexHell

    AlexHell

    Joined:
    Oct 2, 2014
    Posts:
    164
unityunity