egl: simplify the Android logger

Drop the unsupported pre-JellyBean macros and use a simple egl2android
mapping. With this we loose the explicit abort() provided by LOG_FATAL,
although Mesa already already calls exit(1) in case of a fatal errors.

Suggested-by: Rob Herring <robh@kernel.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Rob Herring <robh@kernel.org>
This commit is contained in:
Emil Velikov 2017-05-08 15:38:11 +01:00 committed by Emil Velikov
parent bec1c13be2
commit 1ce58536ec

View file

@ -49,17 +49,6 @@
#define LOG_TAG "EGL-MAIN" #define LOG_TAG "EGL-MAIN"
#include <cutils/log.h> #include <cutils/log.h>
/* support versions < JellyBean */
#ifndef ALOGW
#define ALOGW LOGW
#endif
#ifndef ALOGD
#define ALOGD LOGD
#endif
#ifndef ALOGI
#define ALOGI LOGI
#endif
#endif /* HAVE_ANDROID_PLATFORM */ #endif /* HAVE_ANDROID_PLATFORM */
#define MAXSTRING 1000 #define MAXSTRING 1000
@ -92,22 +81,13 @@ static void
_eglDefaultLogger(EGLint level, const char *msg) _eglDefaultLogger(EGLint level, const char *msg)
{ {
#ifdef HAVE_ANDROID_PLATFORM #ifdef HAVE_ANDROID_PLATFORM
switch (level) { static const int egl2alog[] = {
case _EGL_DEBUG: [_EGL_FATAL] = LOG_ERROR,
ALOGD("%s", msg); [_EGL_WARNING] = LOG_WARN,
break; [_EGL_INFO] = LOG_INFO,
case _EGL_INFO: [_EGL_DEBUG] = LOG_DEBUG,
ALOGI("%s", msg); };
break; ALOG(egl2alog[level], LOG_TAG, "%s", msg);
case _EGL_WARNING:
ALOGW("%s", msg);
break;
case _EGL_FATAL:
LOG_FATAL("%s", msg);
break;
default:
break;
}
#else #else
fprintf(stderr, "libEGL %s: %s\n", level_strings[level], msg); fprintf(stderr, "libEGL %s: %s\n", level_strings[level], msg);
#endif /* HAVE_ANDROID_PLATFORM */ #endif /* HAVE_ANDROID_PLATFORM */