B2G/Debugging OpenGL: Difference between revisions

bug 849276, reflect the fact tha apitrace was integrated in the build system
(PRELOAD mozglue to make sure we get the right allocator)
(bug 849276, reflect the fact tha apitrace was integrated in the build system)
 
Line 4: Line 4:


===Get a copy of apitrace===
===Get a copy of apitrace===
You'll need to follow this step if you want to build the '''qapitrace''' graphical tool for analyzing traces. If your distribution already provides such tool or if you're content with the command-line based '''apitrace''' tool you can skip the steps needed for building the host version.


The first thing to do is to grab a copy of apitrace.
The first thing to do is to grab a copy of apitrace.
Line 9: Line 11:
git clone https://github.com/apitrace/apitrace.git
git clone https://github.com/apitrace/apitrace.git
</pre>
</pre>
 
The INSTALL.markdown file contains instructions for building. I'll summarize what I did (I was running Linux Mint 13 at the time).  
The INSTALL.markdown file contains instructions for building. I'll summarize what I did (I was running Linux Mint 13 at the time).
 
===Install the Android NDK===
<pre>
cd /home/work
wget http://dl.google.com/android/ndk/android-ndk-r8-linux-x86.tar.bz2
tar xf android-ndk-r8-linux-x86.tar.bz2
</pre>


===Install cmake and needed Qt packages===
===Install cmake and needed Qt packages===
You will need cmake to build apitrace, additional packages may be required to inspect the traces later. This example should work on most Debian-based distributions
<pre>
<pre>
sudo apt-get install cmake libqjson-dev libqtwebkit-dev
sudo apt-get install cmake libqjson-dev libqtwebkit-dev
Line 30: Line 25:
</pre>
</pre>


===Build for the phone===
===Rebuild B2G===
<pre>
apitrace is now integrated in the B2G build-system so the only thing you need to do is to re-build your B2G checkout after having installed cmake and then push everything to the phone
export ANDROID_NDK=/home/work/android-ndk-r8
cmake -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain/android.toolchain.cmake -DANDROID_API_LEVEL=9 -H. -Bbuild-b2g
make -C build-b2g
</pre>
 
The egltrace.so for the ARM will be found in <tt>libs/armeabi-v7a/egltrace.so</tt>
 
===Install egltrace.so onto the phone===
<pre>
<pre>
adb push build-b2g/wrappers/egltrace.so /data
cd /where/you/keep/B2G
./build.sh
./flash.sh
</pre>
</pre>


Line 53: Line 42:


ADB=adb
ADB=adb
B2G_DIR=/system/b2g
B2G_BIN=/system/b2g/b2g
B2G_BIN=/system/b2g/b2g


B2G_PID=`$ADB shell toolbox ps |
B2G_PID=`$ADB shell toolbox ps b2g |
         grep "b2g" | awk '{ print \$2; }'`
         grep "b2g" | awk '{ print \$2; }'`


$ADB shell kill $B2G_PID
$ADB shell kill $B2G_PID
$ADB shell stop b2g
$ADB shell stop b2g
$ADB shell TRACE_FILE=/data/egl.trace LD_PRELOAD=\"/system/b2g/libmozglue.so /data/egltrace.so\" LD_LIBRARY_PATH=/system/b2g ${B2G_BIN}
$ADB shell TRACE_FILE=/data/egl.trace \
          GRE_HOME=\"${B2G_DIR}\" \
          LD_PRELOAD=\"/system/b2g/libmozglue.so /system/lib/apitrace/wrappers/egltrace.so\" \
          LD_LIBRARY_PATH=\"/vendor/lib:/system/lib:${B2G_DIR}\" \
          ${B2G_BIN}
</pre>
</pre>


Confirmed users
417

edits