2017-05-12 14:15 GMT+08:00 Tapani Pälli <tapani.pa...@intel.com>:
>
>
> On 05/12/2017 09:13 AM, Chih-Wei Huang wrote:
>>
>> 2017-05-12 13:37 GMT+08:00 Tapani Pälli <tapani.pa...@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.pa...@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".

Correction: this has already included (from cutils/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/)
>
>
> problem is that ALOG stringifies (is that a word?) the first argument and
> concats that with 'ANDROID_', so currently you get 'ANDROID_egl2alog[level]'
> which does not exist. With ANDROID applied, you would get 'ANDROID_ANDROID
> ..'

Ah, I see. Then change ALOG to LOG_PRI
(or android_printLog).

>
>
>>> -   };
>>> -   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
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to