print the error log. 36/195936/1
authorSooChan Lim <sc1.lim@samsung.com>
Wed, 19 Dec 2018 23:53:25 +0000 (08:53 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Wed, 19 Dec 2018 23:53:25 +0000 (08:53 +0900)
use the dlog LOGE at error case

Change-Id: I368e5ea9abbc048532680a6e0814f598bf256f9b

src/wayland-tbm-client.c
src/wayland-tbm-int.h
src/wayland-tbm-server.c

index a6a9159..1229e4b 100644 (file)
@@ -269,6 +269,7 @@ void _waylend_tbm_monitor_client_print_show_to_file(char* show_str)
 
        snprintf(tmp_file, sizeof(tmp_file), "/tmp/tbm_debug_show_%d%d", getpid(), c++);
        if ((f = fopen(tmp_file, "a+")) != NULL) {
+               WL_TBM_LOG_E("fail to open tmp_file.");
                fprintf(f, "%s", show_str);
                fclose(f);
        }
@@ -458,7 +459,7 @@ _wayland_tbm_client_registry_handle_global(void *data,
                if (!tbm_client->bufmgr) {
                        tbm_client->bufmgr = tbm_bufmgr_init(-1);
                        if (!tbm_client->bufmgr) {
-                               WL_TBM_LOG("failed to get auth_info");
+                               WL_TBM_LOG_E("failed to get auth_info");
                                wl_tbm_destroy(tbm_client->wl_tbm);
                                tbm_client->wl_tbm = NULL;
                                return;
@@ -520,14 +521,14 @@ wayland_tbm_client_init(struct wl_display *display)
 
        display_wrapper = wl_proxy_create_wrapper(display);
        if (!display_wrapper) {
-               WL_TBM_LOG("Failed to create display_wrapper.");
+               WL_TBM_LOG_E("Failed to create display_wrapper.");
                free(tbm_client);
                return NULL;
        }
 
        wl_queue = wl_display_create_queue(display);
        if (!wl_queue) {
-               WL_TBM_LOG("Failed to create queue.");
+               WL_TBM_LOG_E("Failed to create queue.");
                wl_proxy_wrapper_destroy(display_wrapper);
                free(tbm_client);
                return NULL;
@@ -538,7 +539,7 @@ wayland_tbm_client_init(struct wl_display *display)
        wl_registry = wl_display_get_registry(display_wrapper);
        wl_proxy_wrapper_destroy(display_wrapper);
        if (!wl_registry) {
-               WL_TBM_LOG("Failed to get registry");
+               WL_TBM_LOG_E("Failed to get registry");
 
                wl_event_queue_destroy(wl_queue);
                free(tbm_client);
@@ -547,7 +548,7 @@ wayland_tbm_client_init(struct wl_display *display)
 
        wl_registry_add_listener(wl_registry, &registry_listener, tbm_client);
        if (wl_display_roundtrip_queue(display, wl_queue) < 0) {
-               WL_TBM_LOG("Failed to wl_display_roundtrip_queue");
+               WL_TBM_LOG_E("Failed to wl_display_roundtrip_queue");
 
                wl_registry_destroy(wl_registry);
                wl_event_queue_destroy(wl_queue);
@@ -560,7 +561,7 @@ wayland_tbm_client_init(struct wl_display *display)
 
        /* check wl_tbm */
        if (!tbm_client->wl_tbm) {
-               WL_TBM_LOG("failed to create wl_tbm");
+               WL_TBM_LOG_E("failed to create wl_tbm");
                wayland_tbm_client_deinit(tbm_client);
                return NULL;
        }
@@ -677,25 +678,25 @@ wayland_tbm_client_create_buffer(struct wayland_tbm_client *tbm_client,
                return buffer->wl_buffer;
 
        if (tbm_surface_get_info(surface, &info) != TBM_SURFACE_ERROR_NONE) {
-               WL_TBM_LOG("Failed to create buffer from surface");
+               WL_TBM_LOG_E("Failed to create buffer from surface");
                return NULL;
        }
 
        if (info.num_planes > 3) {
-               WL_TBM_LOG("invalid num_planes(%d)", info.num_planes);
+               WL_TBM_LOG_E("invalid num_planes(%d)", info.num_planes);
                return NULL;
        }
 
        num_buf = tbm_surface_internal_get_num_bos(surface);
        if (num_buf == 0) {
-               WL_TBM_LOG("surface doesn't have any bo.");
+               WL_TBM_LOG_E("surface doesn't have any bo.");
                return NULL;
        }
 
        for (i = 0; i < num_buf; i++) {
                tbm_bo bo = tbm_surface_internal_get_bo(surface, i);
                if (bo == NULL) {
-                       WL_TBM_LOG("Failed to get bo from surface");
+                       WL_TBM_LOG_E("Failed to get bo from surface");
                        goto err;
                }
 
@@ -716,7 +717,7 @@ wayland_tbm_client_create_buffer(struct wayland_tbm_client *tbm_client,
                if (is_fd == -1 ||
                    (is_fd == 1 && bufs[i] < 0) ||
                    (is_fd == 0 && bufs[i] <= 0)) {
-                       WL_TBM_LOG("Failed to export(is_fd:%d, bufs:%d)", is_fd, bufs[i]);
+                       WL_TBM_LOG_E("Failed to export(is_fd:%d, bufs:%d)", is_fd, bufs[i]);
                        goto err;
                }
        }
@@ -757,7 +758,7 @@ wayland_tbm_client_create_buffer(struct wayland_tbm_client *tbm_client,
        wl_array_release(&plane_size);
 
        if (!wl_buffer) {
-               WL_TBM_LOG("Failed to create wl_buffer");
+               WL_TBM_LOG_E("Failed to create wl_buffer");
                goto err;
        }
 
@@ -1165,7 +1166,7 @@ handle_tbm_queue_active(void *data,
        pthread_mutex_lock(&queue_info->lock);
 
        if (queue_info->is_active) {
-               WL_TBM_C_LOG("warning: queue_info is already activated");
+               WL_TBM_LOG_E("warning: queue_info is already activated");
                pthread_mutex_unlock(&queue_info->lock);
                return;
        }
@@ -1212,7 +1213,7 @@ handle_tbm_queue_deactive(void *data,
        pthread_mutex_lock(&queue_info->lock);
 
        if (!queue_info->is_active) {
-               WL_TBM_C_LOG("warning: queue_info is already deactivated");
+               WL_TBM_LOG_E("warning: queue_info is already deactivated");
                pthread_mutex_unlock(&queue_info->lock);
                return;
        }
@@ -1270,7 +1271,7 @@ handle_tbm_queue_flush(void *data,
        pthread_mutex_lock(&queue_info->lock);
 
        if (queue_info->is_active && queue_info->active_flush) {
-               WL_TBM_C_LOG("warning: Cannot flush the tbm_surface_queueu. The queue is activate.");
+               WL_TBM_LOG_E("warning: Cannot flush the tbm_surface_queueu. The queue is activate.");
                pthread_mutex_unlock(&queue_info->lock);
                return;
        }
index ac10f54..57c4185 100644 (file)
@@ -97,19 +97,19 @@ extern int bTrace;
 /* check condition */
 #define WL_TBM_RETURN_IF_FAIL(cond) {\
        if (!(cond)) {\
-               WL_TBM_LOG("'%s' failed.", #cond);\
+               WL_TBM_LOG_E("'%s' failed.", #cond);\
                return;\
        } \
 }
 #define WL_TBM_RETURN_VAL_IF_FAIL(cond, val) {\
        if (!(cond)) {\
-               WL_TBM_LOG("'%s' failed.", #cond);\
+               WL_TBM_LOG_E("'%s' failed.", #cond);\
                return val;\
        } \
 }
 #define WL_TBM_GOTO_IF_FAIL(cond, dst) {\
        if (!(cond)) {\
-               WL_TBM_LOG("'%s' failed.", #cond);\
+               WL_TBM_LOG_E("'%s' failed.", #cond);\
                goto dst;\
        } \
 }
index 3d7569b..0affd19 100644 (file)
@@ -226,7 +226,7 @@ _wayland_tbm_server_tbm_buffer_create(struct wl_resource *wl_tbm,
 
        tbm_buffer = calloc(1, sizeof(*tbm_buffer));
        if (tbm_buffer == NULL) {
-               WL_TBM_S_LOG("Error. fail to allocate a tbm_buffer.");
+               WL_TBM_LOG_E("Error. fail to allocate a tbm_buffer.");
                return NULL;
        }
        wl_list_init(&tbm_buffer->link_ref);
@@ -236,7 +236,7 @@ _wayland_tbm_server_tbm_buffer_create(struct wl_resource *wl_tbm,
        /* create a wl_buffer resource */
        tbm_buffer->wl_buffer = wl_resource_create(wl_client, &wl_buffer_interface, 1, id);
        if (!tbm_buffer->wl_buffer) {
-               WL_TBM_S_LOG("Error. fail to create wl_buffer resource.");
+               WL_TBM_LOG_E("Error. fail to create wl_buffer resource.");
                free(tbm_buffer);
                return NULL;
        }
@@ -282,6 +282,7 @@ _wayland_tbm_server_impl_create_buffer(struct wl_client *client,
 
        numPlane = tbm_surface_internal_get_num_planes(format);
        if (numPlane != num_plane) {
+               WL_TBM_LOG_E("invalid numPlane.");
                wl_resource_post_error(wl_tbm, WL_TBM_ERROR_INVALID_FORMAT,
                                       "invalid format");
                return;
@@ -311,6 +312,7 @@ _wayland_tbm_server_impl_create_buffer(struct wl_client *client,
 
        surface = tbm_surface_internal_create_with_bos(&info, bos, num_buf);
        if (surface == NULL) {
+               WL_TBM_LOG_E("fail to create the tbm_surface.");
                wl_resource_post_no_memory(wl_tbm);
                return;
        }
@@ -320,6 +322,7 @@ _wayland_tbm_server_impl_create_buffer(struct wl_client *client,
 
        tbm_buffer = _wayland_tbm_server_tbm_buffer_create(wl_tbm, client, surface, id, flags);
        if (tbm_buffer == NULL) {
+               WL_TBM_LOG_E("fail to create the tbm_buffer.");
                wl_resource_post_no_memory(wl_tbm);
                tbm_surface_destroy(surface);
                return;
@@ -358,6 +361,7 @@ _wayland_tbm_server_impl_create_buffer_with_fd(struct wl_client *client,
 
        numPlane = tbm_surface_internal_get_num_planes(format);
        if (numPlane != num_plane) {
+               WL_TBM_LOG_E("invalid numPlane.");
                wl_resource_post_error(wl_tbm, WL_TBM_ERROR_INVALID_FORMAT,
                                       "invalid format");
                goto done;
@@ -386,6 +390,7 @@ _wayland_tbm_server_impl_create_buffer_with_fd(struct wl_client *client,
 
        surface = tbm_surface_internal_create_with_bos(&info, bos, num_buf);
        if (surface == NULL) {
+               WL_TBM_LOG_E("fail to create the tbm_surface.");
                wl_resource_post_no_memory(wl_tbm);
                goto done;
        }
@@ -395,6 +400,7 @@ _wayland_tbm_server_impl_create_buffer_with_fd(struct wl_client *client,
 
        tbm_buffer = _wayland_tbm_server_tbm_buffer_create(wl_tbm, client, surface, id, flags);
        if (tbm_buffer == NULL) {
+               WL_TBM_LOG_E("fail to create the tbm_buffer.");
                wl_resource_post_no_memory(wl_tbm);
                tbm_surface_destroy(surface);
                goto done;
@@ -515,6 +521,7 @@ _wayland_tbm_server_impl_create_surface_queue(struct wl_client *client,
 
        cqueue = calloc(1, sizeof(struct wayland_tbm_client_queue));
        if (!cqueue) {
+               WL_TBM_LOG_E("fail to allocate the cqueue.");
                wl_resource_post_no_memory(wl_tbm);
                return;
        }
@@ -525,6 +532,7 @@ _wayland_tbm_server_impl_create_surface_queue(struct wl_client *client,
                                                        &wl_tbm_queue_interface,
                                                        1, surface_queue);
        if (!cqueue->wl_tbm_queue) {
+               WL_TBM_LOG_E("fail to create the wl_tbm_queue.");
                wl_resource_post_no_memory(wl_tbm);
                free(cqueue);
                return;
@@ -793,18 +801,18 @@ _wayland_tbm_server_export_surface(struct wl_resource *wl_tbm,
        int *p;
 
        if (tbm_surface_get_info(surface, &info) != TBM_SURFACE_ERROR_NONE) {
-               WL_TBM_S_LOG("Failed to create buffer from surface");
+               WL_TBM_LOG_E("Failed to create buffer from surface");
                return 0;
        }
 
        if (info.num_planes > 3) {
-               WL_TBM_S_LOG("invalid num_planes(%d)", info.num_planes);
+               WL_TBM_LOG_E("invalid num_planes(%d)", info.num_planes);
                return 0;
        }
 
        num_buf = tbm_surface_internal_get_num_bos(surface);
        if (num_buf == 0) {
-               WL_TBM_S_LOG("surface doesn't have any bo.");
+               WL_TBM_LOG_E("surface doesn't have any bo.");
                return 0;
        }
 
@@ -812,8 +820,10 @@ _wayland_tbm_server_export_surface(struct wl_resource *wl_tbm,
 
        for (i = 0; i < num_buf; i++) {
                tbm_bo bo = tbm_surface_internal_get_bo(surface, i);
-               if (bo == NULL)
+               if (bo == NULL) {
+                       WL_TBM_LOG_E("fail to get the bo.");
                        goto err;
+               }
 
                /* try to get fd first */
                if (is_fd == -1 || is_fd == 1) {
@@ -832,7 +842,7 @@ _wayland_tbm_server_export_surface(struct wl_resource *wl_tbm,
                if (is_fd == -1 ||
                    (is_fd == 1 && bufs[i] < 0) ||
                    (is_fd == 0 && bufs[i] <= 0)) {
-                       WL_TBM_S_LOG("Failed to export(is_fd:%d, bufs:%d)", is_fd, bufs[i]);
+                       WL_TBM_LOG_E("Failed to export(is_fd:%d, bufs:%d)", is_fd, bufs[i]);
                        goto err;
                }
        }
@@ -906,6 +916,7 @@ wayland_tbm_server_export_buffer(struct wayland_tbm_server *tbm_srv,
        tbm_buffer = _wayland_tbm_server_tbm_buffer_create(wl_tbm, 0, surface,
                                                                0, 0);
        if (tbm_buffer == NULL) {
+               WL_TBM_LOG_E("fail to create the tbm_buffer.");
                tbm_surface_internal_unref(surface);
                return NULL;
        }
@@ -913,7 +924,7 @@ wayland_tbm_server_export_buffer(struct wayland_tbm_server *tbm_srv,
        if (!_wayland_tbm_server_export_surface(wl_tbm,
                                                tbm_buffer->wl_buffer,
                                                surface)) {
-               WL_TBM_S_LOG("Failed to send the surface to the wl_tbm_queue");
+               WL_TBM_LOG_E("Failed to send the surface to the wl_tbm_queue");
                wl_resource_destroy(tbm_buffer->wl_buffer);
                tbm_surface_internal_unref(surface);
                return NULL;
@@ -1057,6 +1068,7 @@ wayland_tbm_server_client_queue_export_buffer2(
        tbm_buffer = _wayland_tbm_server_tbm_buffer_create(wl_tbm, 0, surface,
                                                                0, 0);
        if (tbm_buffer == NULL) {
+               WL_TBM_LOG_E("fail to create the tbm_buffer.");
                tbm_surface_internal_unref(surface);
                return NULL;
        }
@@ -1069,7 +1081,7 @@ wayland_tbm_server_client_queue_export_buffer2(
        if (!_wayland_tbm_server_export_surface(cqueue->wl_tbm,
                                                tbm_buffer->wl_buffer,
                                                surface)) {
-               WL_TBM_S_LOG("Failed to send the surface to the wl_tbm_queue");
+               WL_TBM_LOG_E("Failed to send the surface to the wl_tbm_queue");
                wl_resource_destroy(tbm_buffer->wl_buffer);
                tbm_surface_internal_unref(surface);
                return NULL;