Imagination PowerVR SDK Blog

PVRHub install failed on rooted Android device.

pvrtune
pvrtrace
pvrhub

#1

Hi, Guys, I’ve tried very hard on installing the PVRHub tools on my Xiaomi HM1w, which has been rooted. By saying rooted, I mean that I can using “adb root” to access any file on the phone.



But PVRHub keep telling me that it is unable to get root access!



And I tried to run PVRHubDaemon before runing PVRHub, it doesn’t change anything.



Any suggestion?


#2

Hi,



For PVRHub to work on a rooted device, the PVRHub application must be able to obtain root permissions. This usually requires the presence of an application like SuperSU.



If you can’t install SuperSU on your device, you can manually run the PVRHubDaemon from the command-line. The daemon must be left running in the background while PVRHub has focus:



# /data/data/com.powervr.PVRHub/bin/PVRHubDaemon &



To simplify this, you can script the process (here’s a Windows batch script I use)


@echo off<br />
echo Executing PVRHubDaemon in the background...<br />
start /b cmd /c "adb shell su -c '/data/data/com.powervr.PVRHub/bin/PVRHubDaemon'&"<br />
<br />
set PACKAGE_NAME="com.powervr.PVRHub"<br />
set ACTIVITY_NAME=".MainActivity"<br />
echo Restarting PVRHub...<br />
adb shell am force-stop %PACKAGE_NAME%<br />
adb shell am start -n %PACKAGE_NAME%/%ACTIVITY_NAME%
```<br />
<br />
Hope this helps :)<br />
<br />
Joe

#3

Hi, Joe, thanks for your reply.



I do have a superuser.apk installed in my phone. The problem is that no window shows up asking for root access when I open the PVRHub application.



I tried your script. It still does not work, only shows a dialog saying “Unable to get root access! Is Superuser.apk installed? See logcat for details. PVRHub out.”



#4

Hi,



PVRHubDaemon has a feature to generate system report to help us debug situations like this. Here’s a snippet from the PVRHub User Manual (Appendix A) that explains how this feature works;


System report generator: every time the PVRHubDaemon runs, it writes a report in ‘/data/local/tmp/PVRHubDaemon_report.txt’ which contains all the relevant information of the Android system. By executing the daemon with ‘(-g)’ it will generate a report and terminate (i.e., ‘/data/data/com.powervr/PVRHub/bin/PVRHubDaemon –g’)


If you send us the log generated by your device, we can try to isolate the cause. You can confidentially share the system report with us by attaching it to a support ticket: https://pvrsupport.imgtec.com/new-ticket

Thanks,
Joe

#5

Hi, Joe, thanks again



Here is the report:

E: The system does not appear to be correct.



ANDROID API VERSION
I: Android SDK API version = 17


BUILD PROPERTIES
ro.build.version.sdk=17
ro.product.brand=XIAOMI
ro.product.cpu.abi=armeabi-v7a
ro.product.cpu.abi2=armeabi
ro.product.manufacturer=XIAOMI
ro.opengles.version=131072
ro.product.model=2013023
ro.product.name=2013023
ro.product.board=2013023
ro.product.device=2013023


POWERVR DRIVERS
I: PowerVR DDK suffix =
E: PVRHubDaemon could not find the driver.
I: The DDK Version is:
Version SGX_DDK_Android sgxddk 19 1.9@2564405 (release) mt6589
System Version String: SGX revision = 1.1.5



EGL CFG
I: /system/lib/egl/egl.cfg found
I: The contents are:
0 0 android
0 1 mtk


PVRTRACE RECORDING LIBRARIES
I: libPVRTrace appears to be installed in /system/vendor/lib/
I: The permissions are: 666
E: The permissions should be 0644

#6

Ah - I think I see what’s going wrong. PVRTrace expects the graphics driver suffix to be “POWERVR”, as is the case on most devices with PowerVR GPUs. According to your ‘egl.cfg’, the graphics driver suffix is “mtk” (it seems MediaTek have renamed the driver).



The version of PVRHub in our upcoming 3.4 SDK removes the “POWERVR” suffix restriction. In the meantime, you can use the 3.3 SDK PVRHub’s suffix override feature to workaround the issue. Appendix A of the PVRHub User Manual discusses this:

Driver name override: by default, PVRHubDaemon will only look for driver binaries with ‘_POWERVR’ in their file name. The optional file ‘/data/local/tmp/ddk_suffix.txt’ allows users to override the identifier PVRHubDaemon will use to select a graphics driver. This feature is designed for developers targeting development platforms, where there may be a number of graphics driver builds on the target with different names.


If you hit any issues, let us know. We may be able to provide you with an early access build of our 3.4 tools.

Thanks,
Joe

#7

Hi, Joe,

I can not figure out what exactly should I put in the configure file ‘/data/local/tmp/ddk_suffix.txt’, as it seems that PVRHubDaemon didn’t generate this file on my phone.



Can you give me a example?



Many thanks.


#8

Hi,



I don’t have a MediaTek platform to test. I believe you just need to write the replacement suffix to your ddk_suffix.txt. In your case, this would be “mtk”. If this doesn’t work, you could try “_mtk”. I’ll confirm the correct suffix string with the PVRTrace lead engineer tomorrow.



If you create the TXT file on your development machine, you can adb push it to /data/local/tmp/ (all users have permission to write to this directory).



Thanks,

Joe


#9

Hi, Joe,



I tried both to put “mtk” and “_mtk” in ddk_suffix.txt, but none of them worked.



And I also tried to rename my egl related libararies from “libEGL_mtk.so”, “libGLESv1_CM_mtk.so” and "libGLESv2_mtk.so"

to “libEGL_POWERVR.so”, “libGLESv1_POWERVR.so” and “libGLESv2_POWERVR.so”,

and modify the egl.cfg to



0 0 android

0 1 POWERVR





The later change doesn’t help either.





Thanks


#10

Hi,



Sorry about this. We’ve checked the code. It looks like the feature was documented but never implemented…



I’ve uploaded 3.4 SDK beta PVRHub and PVRTraceGUI packages to our support portal. You will need to use the new version of PVRTraceGUI to inspect any files recorded with the new PVRHub. The new version of PVRHub removes the suffix restriction, so it should work on your target.



Here are links to the betas (you’ll need to login/register for the support portal to access them):



Thanks,
Joe

#11

Is the beta working on your MediaTek device? We haven’t had a chance to test it on a MediaTek platform yet, so would appreciate any feedback you can give :slight_smile:



Joe


#12

Hi, Jeo, thanks again



The 3.4 beta version works on my phone. Although PVRHub still cannot gain root access, I installed the trace libs successfully after start PVRHubDaemon.



But there are still some little problems.

One problem is that closing the PVRHub when it is tracing a application will leave my /system folder unwritable and the file ‘/system/lib/egl/egl.cfg’ uncompleted. So I had to remount /system part and recover egl.cfg by hand.



Another problem is that when I open the generated .pvrt file using PVRTraceGUI, it complains that “Unable to playback file, binary objects detected. Files that contain binary objects(e.g. shader or program binaries) can only be played back on the platforms on which they were recorded.” While I can see visual images of the frame buffer after every drawcall in the 3.3 version of PVRTraceGUI (with the .pvrt file generated by 3.3 version of PVRTrace).


#13
One problem is that closing the PVRHub when it is tracing a application will leave my /system folder unwritable and the file '/system/lib/egl/egl.cfg' uncompleted. So I had to remount /system part and recover egl.cfg by hand.

Was PVRHubDaemon still running when you closed PVRHub? Can you share the logcat output with us?PVRHubDaemon is responsible for all system operations that require root permissions, such as remounting /system. If PVRHubDaemon isn't running, PVRHub will not be able to perform these operations.

Another problem is that when I open the generated .pvrt file using PVRTraceGUI, it complains that "Unable to playback file, binary objects detected. Files that contain binary objects(e.g. shader or program binaries) can only be played back on the platforms on which they were recorded."

This warning is given when the PVRT recording contains binary shaders. As PVRTrace's Image Analysis (a.k.a. playback) requires all shaders to be given as GLSL ES source, it has to be disabled when shader binaries are detected. If you haven't submitted shader binaries to OpenGL ES yourself, the binaries may have come from Android's OpenGL ES shim shader binary cache. I believe you can clear your application's shader binary cache using the "Clear cache" option in your application's settings page.

Hope this helps,
Joe

#14

Hi, Joe, Thanks for your detailed replies.

I have yet another problem associated with the 3.4 beta version of PVRHub.

I cannot start my GLES application after click the ‘Start PVRTune Profile’ button. And I found that PVRHub changed the file ‘/system/lib/egl/egl.cfg’ to something containing only the following line.

0 0 PVRTRACE


#15

OK. I have successfully run another little program while PVRPerfServer is running, though the application I aimed to profile cannot run.

The problem is that I’m unable to connect to the PVRPerfServer from PVRTuneGUI. I have a wireless network adapter installed on my windows PC, and the PC is connected to the same subnet as the mobile phone.


#16

Thanks to Paul Sobek.



I finally get the PVRPerfServer and PVRTuneGUI worked. Just to save the time for somebody like me.

In my case, I just cannot run the PVRPerfServer from the GUI (on the phone). Instead, I had to run the server from the command line.



After a successful installation you can find the PVRPerfServer in the folder /data/data/com.powervr.PVRHub/bin/,

so you can start the server by this line bellow:



adb shell /data/data/com.powervr.PVRHub/bin/PVRPerfServer &





After that, something like this appears:

PVRPerfServerDeveloper v14.89 - Build 3.4@3145943

Copyright © Imagination Technologies Ltd. All rights reserved.

  • Support: DevTech@imgtec.com
  • OS: Linux version 3.4.5 (builder@wcc-miui-ota-bd15) (gcc versi

    on 4.6.x-google 20120106 (prerelease) (GCC) ) #1 SMP PREEMPT Wed Mar 5 22:15:14

    CST 2014
  • Time (local): Fri Sep 26 20:42:55 2014 (20:42:55)
  • Time (UTC): Fri Sep 26 12:42:55 2014 (12:42:55)
  • DRIVER BUILD: 1.9.256.4405
  • Device Variant: PowerVR SGX544
  • Device Series: PowerVR Series5XT

    This server is localhost:6521 (lo:127.0.0.1,wlan0:10.66.202.175)…
  • Processor count: 4

    This server is localhost:6520 (lo:127.0.0.1,wlan0:10.66.202.175)…

    Waiting for connection (press q to quit)…



    In this case, the server is listening at two ports 6520 and 6521. Just forward these to the PC:

    adb forward tcp:6520 tcp:6520

    adb forward tcp:6521 tcp:6521




    Then just connect to ‘localhost’ from your PVRTuneGUI. That is it! Enjoy your new toy.



    Thanks to Paul Sobek of Imagination again.



#17

hello, everyone



I encounter the same problem as Yiifever, and I am sure I use 3.4 sdk.

The pvrhub does not ask for root permission, and PVRHubDaemon -g says "PVRHubDaemon could not find the driver."



What should I do now?

I have tried ten phones or so, and of course they both are not powervr gpu.



And another question, can I use pvrhub on android emulator?


#18

Hello Lazytiger,



The latest version of PVRHub does support the Android Emulator.



Apart from the emulator we only officially support PowerVR based Android devices.



Thanks,

Paul


#19

Hi, Pauls



I can not run it on android 4.3, and I got error as follows



E: The system does not appear to be correct.



ANDROID API VERSION
I: Android SDK API version = 18


BUILD PROPERTIES
ro.build.version.sdk=18
ro.product.model=sdk
ro.product.brand=generic
ro.product.name=sdk
ro.product.device=generic
ro.product.board=
ro.product.cpu.abi=armeabi-v7a
ro.product.cpu.abi2=armeabi
ro.product.manufacturer=unknown


POWERVR DRIVERS
I: PowerVR DDK suffix =
E: PVRHubDaemon could not find the driver.


EGL CFG
I: /system/lib/egl/egl.cfg found
I: The contents are:
0 0 emulation



PVRTRACE RECORDING LIBRARIES
I: libPVRTrace is not installed

I will try if 4.2 will be ok

#20

I have tried android 4.2, it’s not ok either. BTW, my os is mac, do I need a PC?