Mobile/SkiaGLDebugging: Difference between revisions

(Created page with "= Debugging SkiaGL = == Debugging the GLES2 Skia backend on desktop == SkiaGL has an object, GrGLInterface, that contains all the function pointers to glFoo functions for it...")
 
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
= Debugging SkiaGL =
= Debugging SkiaGL =
== Prefs necessary for enabling SkiaGL ==
  gfx.canvas.azure.accelerated = true
  gfx.canvas.azure.backends = skia
For Linux:
  layers.acceleration.force-enabled = true


== Debugging the GLES2 Skia backend on desktop ==
== Debugging the GLES2 Skia backend on desktop ==
Line 16: Line 25:


To ensure that we use the GLES2 Skia codepath in desktop Linux.
To ensure that we use the GLES2 Skia codepath in desktop Linux.
== Apitrace ==
We can use Apitrace to intercept all GL commands run by Skia and Gecko on a device, and replay/analyse them on desktop. There's already a lot of documentation on Apitrace at https://wiki.mozilla.org/B2G/Debugging_OpenGL and http://www.hackermusings.com/2012/03/debugging-opengl-on-android-without-losing-your-sanity/
== DMD ==
DMD is useful to trace memory leaks. It's documented [[Performance/MemShrink/DMD|there]].

Latest revision as of 21:02, 16 May 2013

Debugging SkiaGL

Prefs necessary for enabling SkiaGL

 gfx.canvas.azure.accelerated = true
 gfx.canvas.azure.backends = skia

For Linux:

 layers.acceleration.force-enabled = true

Debugging the GLES2 Skia backend on desktop

SkiaGL has an object, GrGLInterface, that contains all the function pointers to glFoo functions for it to use. We have our own special GrGLInterface, "GLContextSkia", that forwards these glFoo calls to GLContext->fFoo. It is in gfx/gl/GLContextSkia.cpp

SkiaGL supports two different OpenGL APIs through its GrGLInterface; either desktop GL (we expose Desktop OpenGL 2.0 with a few extensions) or GLES2. On device, we (obviously) use GLES2 bindings, and on desktop we will generally use desktop GL.

In order to debug the GLES2 codepath without the overhead of having to test on an ARM device, it's generally easier to find a desktop Linux box with the "GL_ARB_ES2_compatibility" extension available (you can check if it's supported by running "glxinfo"). If you have it, change all instances of:

 if (sGLContext->IsGLES2())

to

 if (sGLContext->IsGLES2() || true)

To ensure that we use the GLES2 Skia codepath in desktop Linux.

Apitrace

We can use Apitrace to intercept all GL commands run by Skia and Gecko on a device, and replay/analyse them on desktop. There's already a lot of documentation on Apitrace at https://wiki.mozilla.org/B2G/Debugging_OpenGL and http://www.hackermusings.com/2012/03/debugging-opengl-on-android-without-losing-your-sanity/

DMD

DMD is useful to trace memory leaks. It's documented there.