- While debugging a bug last week, I wrote a thing I'm calling LayerScope. It does real-time dumping of data from a layer manager. I did the initial implementation in the OGL layer manager, dumping relevant texture data from the various layers in the b2g compositor process. Hasn't been tested anywhere else, but should also work fine for Android. The same approach can be expanded out to other layers backends.
Enabling Layer Scope
go to about:config set gfx.layerscope.enabled to true. set layers.offmainthreadcomposition.enabled to true. set layers.acceleration.force-enabled to true.
- Mac/ Windows
go to about:config set gfx.layerscope.enabled to true.
- Go to the Developer in Settings and click "Dump layerscope" to enable Layerscope
- If your working branch doesn't have this item to enable it, please go with the following step
run ./edit-prefs.sh add user_pref("gfx.layerscope.enabled", true); add user_pref("network.gonk.manage-offline-status", false);
Save and exit.
Enabling Display List Dump
After bug 1061393 and bug 1193834 landed, layerscope is able to present display list information on the viewer. To enable this feature, you have to enable "layout.display-list.dump" preference manually.
There are two ways on B2G to enable display list dump.
./edit-prefs.sh user_pref("layout.display-list.dump", true);
Or, in Settings app, check "dump display list" Developer->Dump Display List
- All the others
go to about:config set layout.display-list.dump as true.
- LayerScope Viewer
- LayerScope Viewer (Depreciated)
Connecting to Layer Scope
NOTE: from changeset  we removed dependency of websockify.
Note: If you use Layerscope Addon, just clink the addon button, select the device, and press connect. It's much easier.
For the implementation, it creates a websocket where it sends some simple framed data to. Just using the viewer tool to view the data.
- Desktop Example:
To connect to local layerscope, just press connect to ws://localhost:23456.
Note: If you want to change gfx.layerscope.port on your nightly browser, please revise the connection address, for example, set the port to 23457, and then use the address ws://localhost:23457 on the layerscope tool page.
- B2G Example:
Just use adb forward to forward your host port to a target port. (The default value is 23456.)
adb forward tcp:23456 tcp:23456
The first argument is the host port and the second one is the target port. And then press connect to ws://localhost:23456.