[PATCH] Android: Port eglretracer for Android
Chad Versace
chad.versace at linux.intel.com
Wed Jul 24 15:18:00 PDT 2013
On 07/23/2013 12:22 AM, Juha-Pekka Heikkila wrote:
> Port eglretracer for Android using Waffle library. To build for
> Android the Android source tree is needed for Waffle. Waffle
> need to be build first, Waffle can be obtained from:
> http://cgit.freedesktop.org/~chadversary/waffle/
>
> If Android source tree is not available/only NDK is present
> egltrace.so and related will only be build, eglretracer will
> be skipped.
>
> Known issues:
> eglretracer seem to launch multiple windows with some traces from
> Android. These multiple windows sometimes segfault on Android,
> need to look into this yet. I remember SurfaceFlinger wasn't
> maybe too happy with such behaviour.
>
> Signed-off-by: Juha-Pekka Heikkila <juha-pekka.heikkila at linux.intel.com>
> ---
> dispatch/glproc_egl.cpp | 9 ++
> retrace/CMakeLists.txt | 74 ++++++++++---
> retrace/glws_waffle.cpp | 274 ++++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 344 insertions(+), 13 deletions(-)
> create mode 100644 retrace/glws_waffle.cpp
[snip]
> diff --git a/retrace/glws_waffle.cpp b/retrace/glws_waffle.cpp
> new file mode 100644
> index 0000000..f0c44ab
> --- /dev/null
> +++ b/retrace/glws_waffle.cpp
> +class WaffleVisual : public Visual
> +{
> + static WaffleVisual* createWaffleVisual(bool doubleBuffer, Profile profile)
> + {
> + switch (profile) {
> + case PROFILE_COMPAT:
> + if(!waffle_display_supports_context_api(dpy, WAFFLE_DL_OPENGL))
> + {
> + os::log("%s: !waffle_display_supports_context_api\n",
> + __FILE__);
> +
> + delete visual;
> + assert(0);
> + return NULL;
> + }
> +
> + waffle_gl_api = config_attrib_list[i++] = WAFFLE_DL_OPENGL;
> + break;
> + case PROFILE_CORE:
> + os::log("%s: PROFILE_CORE no support\n", __FILE__);
> + delete visual;
> + assert(0);
> + return NULL;
Waffle does support core profiles. In the waffle_config manpage [1], search for
WAFFLE_CONTEXT_PROFILE. Also, see the example code in "Example 2".
[1] http://people.freedesktop.org/~chadversary/waffle/man/waffle_config.3.html
On the other hand, according to the init() in this patch, glws_waffle supports only Android.
And I know no Android device that supports non-ES OpenGL. Until glws_waffle acquires
support for other operating systems, I prefer that code that is known to fail not be
present in this file.
> + case PROFILE_ES1:
> + if(!waffle_display_supports_context_api(dpy,
> + WAFFLE_CONTEXT_OPENGL_ES1))
> + {
> + os::log("%s: !waffle_display_supports_context_api\n",
> + __FILE__);
> +
> + delete visual;
> + assert(0);
> + return NULL;
> + }
> +
> + config_attrib_list[i++] = WAFFLE_CONTEXT_OPENGL_ES1;
> + waffle_gl_api = WAFFLE_DL_OPENGL_ES1;
> + break;
> + case PROFILE_ES2:
> + if(!waffle_display_supports_context_api(dpy,
> + WAFFLE_CONTEXT_OPENGL_ES2))
> + {
> + os::log("%s: !waffle_display_supports_context_api\n",
> + __FILE__);
> +
> + delete visual;
> + assert(0);
> + return NULL;
> + }
> +
> + config_attrib_list[i++] = WAFFLE_CONTEXT_OPENGL_ES2;
> + waffle_gl_api = WAFFLE_DL_OPENGL_ES2;
> + break;
[snip]
> +
> + ~WaffleVisual() {
> + if (this->config != NULL)
> + {
> + waffle_config_destroy(this->config);
> + this->config = NULL;
> + }
Oh... you're right. waffle_config_destroy() emits an error if given
a null pointer. I intended for waffle_*_destroy() to behave as free()
and delete(), which silently ignore null pointers. I need to fix that
in the next Waffle release. But, until then, `this->config != NULL` is
indeed needed.
[snip]
> +void
> +init(void) {
> + int i;
> + int waffle_init_attrib_list[3];
> +
> + i = 0;
> + waffle_init_attrib_list[i++] = WAFFLE_PLATFORM;
> + waffle_init_attrib_list[i++] = WAFFLE_PLATFORM_ANDROID;
> + waffle_init_attrib_list[i++] = WAFFLE_NONE;
> +
> + waffle_init(waffle_init_attrib_list);
> +
> + dpy = waffle_display_connect(NULL);
> + if (!dpy)
> + {
> + os::log("No display!!\n");
> + assert(0);
> + }
> +}
[snip]
More information about the apitrace
mailing list