[Mesa-dev] [PATCH] egl: fix android logger compilation
Chih-Wei Huang
cwhuang at android-x86.org
Fri May 12 06:13:26 UTC 2017
2017-05-12 13:37 GMT+08:00 Tapani Pälli <tapani.palli at intel.com>:
> this patch is a partial revert of 1ce5853 that break compilation
> since LOG_ERROR etc are not defined and also macro expansion won't
> work as planned (expands to 'ANDROID_egl2alog[level]')
>
> Fixes: 1ce5853 ("egl: simplify the Android logger")
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> ---
> src/egl/main/egllog.c | 21 ++++++++++++++-------
> 1 file changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c
> index 6de2a50..51ab76f 100644
> --- a/src/egl/main/egllog.c
> +++ b/src/egl/main/egllog.c
> @@ -81,13 +81,20 @@ static void
> _eglDefaultLogger(EGLint level, const char *msg)
> {
> #ifdef HAVE_ANDROID_PLATFORM
> - static const int egl2alog[] = {
> - [_EGL_FATAL] = LOG_ERROR,
> - [_EGL_WARNING] = LOG_WARN,
> - [_EGL_INFO] = LOG_INFO,
> - [_EGL_DEBUG] = LOG_DEBUG,
How about just change LOG_* to ANDROID_LOG_* ?
You also need to include "android/log.h".
LOG_* are not real macros defined in Android headers.
They are concatenated to ANDROID_LOG_*
defined in android/log.h. (in system/core/include/)
> - };
> - ALOG(egl2alog[level], LOG_TAG, "%s", msg);
> + switch (level) {
> + case _EGL_FATAL:
> + ALOGE("%s", msg);
> + break;
> + case _EGL_WARNING:
> + ALOGW("%s", msg);
> + break;
> + case _EGL_INFO:
> + ALOGI("%s", msg);
> + break;
> + case _EGL_DEBUG:
> + ALOGD("%s", msg);
> + break;
> + }
> #else
> fprintf(stderr, "libEGL %s: %s\n", level_strings[level], msg);
> #endif /* HAVE_ANDROID_PLATFORM */
> --
--
Chih-Wei
Android-x86 project
http://www.android-x86.org
More information about the mesa-dev
mailing list