weston: Weston Log Mechanism Development [1/1]

PD#SWPL-198933

Problem:
Weston Log Mechanism Development.

Solution:
Weston Log Mechanism Development.

Verify:
s7d

Change-Id: I1c7e83ed981a1b1077947b9c9a83635f8255920b
Signed-off-by: limin.tian <limin.tian@amlogic.com>
diff --git a/libweston/compositor.c b/libweston/compositor.c
index f011f55..2c87f2d 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -631,6 +631,7 @@
 	surface->protection_mode = WESTON_SURFACE_PROTECTION_MODE_RELAXED;
 
 	weston_init_video_surface_info(surface);
+	WESTON_LOGI(COMMON_LOG, "%p \n", surface);
 
 	return surface;
 }
@@ -2361,7 +2362,7 @@
 	weston_set_appstate_by_appname(surface->compositor, surface->name, 0);
 	weston_clear_video_surface_info(surface);
 	weston_surface_destroy_info_for_surface(surface);
-	weston_log("\n weston_surface_destroy :%p output:%p name :%s \n", surface, surface->output, surface->name);
+	weston_log("weston_surface_destroy :%p output:%p name :%s \n", surface, surface->output, surface->name);
 
 	free(surface);
 }
@@ -2395,7 +2396,7 @@
 	struct weston_buffer *buffer =
 		container_of(listener, struct weston_buffer, destroy_listener);
 
-	weston_log("\n weston_buffer_destroy_handler buffer:%p\n",buffer);
+	weston_log("weston_buffer_destroy_handler buffer:%p\n",buffer);
 	weston_signal_emit_mutable(&buffer->destroy_signal, buffer);
 	free(buffer);
 }
@@ -2985,12 +2986,7 @@
 	weston_compositor_repick(ec);
 
 	frame_time_msec = timespec_to_msec(&output->frame_time);
-	if (ec->enable_video_debug) {
-		struct timespec time;
-
-		weston_compositor_get_time(&time);
-		weston_log("%llu repaint send done\n", timespec_to_usec(&time));
-	}
+	WESTON_LOGD(COMMON_LOG, "send callback\n");
 	wl_resource_for_each_safe(cb, cnext, &frame_callback_list) {
 		wl_callback_send_done(cb, frame_time_msec);
 		wl_resource_destroy(cb);
@@ -3028,8 +3024,7 @@
 
 	msec_to_repaint = timespec_sub_to_msec(&output->next_repaint, now);
 	if (msec_to_repaint > 1) {
-		if (compositor->enable_video_debug)
-			weston_log("\n %s %d return ret:%d\n", __FUNCTION__,__LINE__,ret);
+		WESTON_LOGD(COMMON_LOG, "msec_to_repaint > 1\n");
 		return ret;
 	}
 
@@ -3037,15 +3032,13 @@
 	 * explicitly repaint all outputs when we come back. */
 	if (compositor->state == WESTON_COMPOSITOR_SLEEPING ||
 		compositor->state == WESTON_COMPOSITOR_OFFSCREEN) {
-		if (compositor->enable_video_debug)
-			weston_log("\n %s %d return ret:%d\n", __FUNCTION__,__LINE__,ret);
+		WESTON_LOGD(COMMON_LOG, "state:%d\n", compositor->state);
 		goto err;
 		}
 	/* We don't actually need to repaint this output; drop it from
 	 * repaint until something causes damage. */
 	if (!output->repaint_needed) {
-		if (compositor->enable_video_debug)
-			weston_log("\n %s %d return ret:%d\n", __FUNCTION__,__LINE__,ret);
+		WESTON_LOGD(COMMON_LOG, "repaint not needed\n");
 		goto err;
 	}
 
@@ -3057,8 +3050,7 @@
 	ret = weston_output_repaint(output, repaint_data);
 	weston_compositor_read_presentation_clock(compositor, now);
 	if (ret != 0) {
-		if (compositor->enable_video_debug)
-			weston_log("\n %s %d return ret:%d\n", __FUNCTION__,__LINE__,ret);
+		WESTON_LOGD(COMMON_LOG, "fail\n");
 		goto err;
 	}
 	output->repainted = true;
@@ -4066,7 +4058,7 @@
 
 	surface->pending.buffer_viewport.buffer.transform = transform;
 	surface->pending.buffer_viewport.changed = 1;
-	weston_log("\n %s %d transform:%d\n", __FUNCTION__,__LINE__,transform);
+	weston_log("%s %d transform:%d\n", __FUNCTION__,__LINE__,transform);
 	surface->video_transform = transform;
 }
 
@@ -4654,7 +4646,7 @@
 
 	if (!sub)
 		return;
-
+	WESTON_LOGI(VIDEO_LOG, "x:%d, y:%d\n", x,y);
 	sub->position.x = x;
 	sub->position.y = y;
 	sub->position.set = 1;
@@ -7333,7 +7325,7 @@
 			"wl_surface for this viewport no longer exists");
 		return;
 	}
-
+	WESTON_LOGI(COMMON_LOG, "w:%d h:%d\n", dst_width, dst_height);
 	assert(surface->viewport_resource == resource);
 
 	if (dst_width == -1 && dst_height == -1) {