wayland-egl-tizen: changed to use dlog to print logs. 12/243112/1
authorJoonbum Ko <joonbum.ko@samsung.com>
Thu, 3 Sep 2020 06:33:36 +0000 (15:33 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Thu, 3 Sep 2020 06:33:36 +0000 (15:33 +0900)
Change-Id: Ia248ca9b2ca3c6877a5e0844efa357be7f39ecba
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
configure.ac
packaging/libtpl-egl.spec
src/wayland-egl-tizen/wayland-egl-tizen.c

index 71e4070..e59d587 100644 (file)
@@ -102,7 +102,9 @@ AS_IF([test "${enable_dlog}" = "yes" || test "${enable_dlog}" = "1"],
          [PKG_CHECK_MODULES([DLOG], [dlog])
           TPL_CFLAGS+="$DLOG_CFLAGS"
           TPL_CFLAGS+=" -DDLOG_DEFAULT_ENABLE "
-          TPL_LIBS+="$DLOG_LIBS"],
+          TPL_LIBS+="$DLOG_LIBS"
+          WL_EGL_TIZEN_CFLAGS+="$DLOG_CFLAGS"
+          WL_EGL_TIZEN_LIBS+="$DLOG_LIBS"],
          [])
 
 AM_CONDITIONAL([ENABLE_DLOG], [test "${enable_dlog}" = "yes" || test "${enable_dlog}" = "1"])
index 16495d3..f360f7d 100644 (file)
@@ -112,6 +112,7 @@ the GPU Vendor DDK's EGL.
 Version:       %{WL_EGL_TIZEN_VERSION}
 Release:       0
 Summary:    Wayland EGL TIZEN backend
+BuildRequires: pkgconfig(dlog)
 
 %description -n libwayland-egl-tizen
 This package provides tizen specific extension of wayland-egl.
index b4e679c..2fb876c 100644 (file)
@@ -3,9 +3,6 @@
 #include "wayland-egl-tizen.h"
 #include "wayland-egl-tizen-priv.h"
 
-#define WL_EGL_DEBUG 1
-#if WL_EGL_DEBUG
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <sys/types.h>
 #include <signal.h>
 
-unsigned int wl_egl_log_level;
-
-/* WL-EGL Log Level - 0:unintialized, 1:initialized(no logging), 2:min log, 3:more log */
-#define WL_EGL_LOG(lvl, f, x...) {                                                             \
-               if (wl_egl_log_level == 1) {                                                    \
-               }                                                                                                               \
-               else if (wl_egl_log_level > 1) {                                                \
-                       if (wl_egl_log_level <= lvl)                                            \
-                               WL_EGL_LOG_PRINT(f, ##x)                                                \
-               }                                                                                                               \
-               else {                                                                                                  \
-                       char *env = getenv("WL_EGL_LOG_LEVEL");                         \
-                       if (env == NULL)                                                                        \
-                               wl_egl_log_level = 1;                                                   \
-                       else                                                                                            \
-                               wl_egl_log_level = atoi(env);                                   \
-                                                                                                                               \
-                       if (wl_egl_log_level > 1 && wl_egl_log_level <= lvl)\
-                               WL_EGL_LOG_PRINT(f, ##x)                                                \
-               }                                                                                                               \
-       }
+#define LOG_TAG "WL_EGL"
+#include <dlog.h>
 
-#define WL_EGL_LOG_PRINT(fmt, args...) {                                                                               \
-               printf("[\x1b[32mWL-EGL\x1b[0m %d:%d|\x1b[32m%s\x1b[0m|%d] " fmt "\n",  \
-                       getpid(), (int)syscall(SYS_gettid), __func__, __LINE__, ##args);        \
-       }
-
-#define WL_EGL_ERR(f, x...)    {                                                                                                       \
-               printf("[\x1b[31mWL-EGL_ERR\x1b[0m %d:%d|\x1b[31m%s\x1b[0m|%d] " f "\n",\
-                       getpid(), (int)syscall(SYS_gettid), __func__, __LINE__, ##x);           \
-       }
+#define FONT_DEFAULT   "\033[0m"       /* for reset to default color */
+#define FONT_RED               "\033[31m"      /* for error logs */
+#define FONT_YELLOW            "\033[33m"      /* for warning logs */
 
-#else
-#define WL_EGL_LOG(lvl, f, x...)
-#endif
+#define WL_EGL_LOG(f, x...)            LOGI(f, ##x)
+#define WL_EGL_ERR(f, x...)            LOGE(FONT_RED f FONT_DEFAULT, ##x)
+#define WL_EGL_WARN(f, x...)   LOGW(FONT_YELLOW f FONT_DEFAULT, ##x)
 
 void
 wl_egl_window_tizen_set_rotation(struct wl_egl_window *egl_window,
@@ -72,8 +44,8 @@ wl_egl_window_tizen_set_rotation(struct wl_egl_window *egl_window,
        }
 
        if (private->rotation == rotation) {
-               WL_EGL_LOG(2, "rotation(%d) egl_window->rotation(%d) already rotated",
-                                  rotation, private->rotation);
+               WL_EGL_WARN("wl_egl_window(%p) rotation(%d) already rotated",
+                                       egl_window, rotation);
                return;
        }
 
@@ -137,9 +109,8 @@ wl_egl_window_tizen_set_buffer_transform(struct wl_egl_window *egl_window,
        }
 
        if (private->transform == wl_output_transform) {
-               WL_EGL_LOG(2,
-                                  "wl_output_transform(%d) private->transform(%d) already rotated",
-                                  wl_output_transform, private->transform);
+               WL_EGL_WARN("wl_egl_window(%p) wl_output_transform(%d) already rotated",
+                                       egl_window, wl_output_transform);
                return;
        }
 
@@ -198,9 +169,8 @@ wl_egl_window_tizen_set_window_transform(struct wl_egl_window *egl_window,
        }
 
        if (private->window_transform == window_transform) {
-               WL_EGL_LOG(2,
-                                  "window_transform(%d)  already rotated",
-                                  window_transform);
+               WL_EGL_WARN("wl_egl_window(%p) window_transform(%d) already rotated",
+                                       egl_window, window_transform);
                return;
        }