weston-10: weston supports the 180° rotation command [1/1]

PD#SWPL-186564

Problem:
weston supports the 180° rotation command

Solution:
weston supports the 180° rotation command

Verify:
AH212.

Change-Id: Ide3179393713bf8f4ee081fd6dae2d2ea8c5e464
Signed-off-by: chen.wang1 <chen.wang1@amlogic.com>
diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h
index 098b4d0..d22089d 100644
--- a/libweston/backend-drm/drm-internal.h
+++ b/libweston/backend-drm/drm-internal.h
@@ -166,6 +166,7 @@
 	WDRM_PLANE_IN_FENCE_FD,
 	WDRM_PLANE_FB_DAMAGE_CLIPS,
 	WDRM_PLANE_ZPOS,
+	WDRM_PLANE_VIDEO_ROTATION,
 	WDRM_PLANE__COUNT
 };
 
@@ -456,6 +457,7 @@
 	uint32_t damage_blob_id; /* damage to kernel */
 
 	struct wl_list link; /* drm_output_state::plane_list */
+	uint32_t video_transform;
 };
 
 /**
@@ -669,6 +671,10 @@
 	 * buffer and view transformations match the output transform.
 	 * Fixing this requires a full analysis of the transformation
 	 * chain. */
+	if (ev->surface->is_video_surface) {
+		weston_log("\n %s %d video surface return true\n", __FUNCTION__,__LINE__);
+		return true;
+	}
 	if (ev->transform.enabled &&
 	    ev->transform.matrix.type >= WESTON_MATRIX_TRANSFORM_ROTATE)
 		return false;
diff --git a/libweston/backend-drm/kms.c b/libweston/backend-drm/kms.c
index 511634c..86e9d1e 100644
--- a/libweston/backend-drm/kms.c
+++ b/libweston/backend-drm/kms.c
@@ -77,6 +77,7 @@
 	[WDRM_PLANE_IN_FENCE_FD] = { .name = "IN_FENCE_FD" },
 	[WDRM_PLANE_FB_DAMAGE_CLIPS] = { .name = "FB_DAMAGE_CLIPS" },
 	[WDRM_PLANE_ZPOS] = { .name = "zpos" },
+	[WDRM_PLANE_VIDEO_ROTATION] = { .name = "rotation" },
 };
 
 struct drm_property_enum_info dpms_state_enums[] = {
@@ -1019,6 +1020,15 @@
 			ret |= plane_add_prop(req, plane, WDRM_PLANE_FB_DAMAGE_CLIPS,
 					      plane_state->damage_blob_id);
 
+		if (plane->is_video_plane ) {
+			drm_debug(plane->backend, "\t\t\t[PLANE:%lu] video plane, video_transform:%d\n",
+				(unsigned long) plane->plane_id,
+					plane_state->video_transform);
+
+			ret |= plane_add_prop(req, plane, WDRM_PLANE_VIDEO_ROTATION,
+					  1 << plane_state->video_transform);
+		}
+
 		if (plane_state->fb && plane_state->fb->format)
 			pinfo = plane_state->fb->format;
 
diff --git a/libweston/backend-drm/state-propose.c b/libweston/backend-drm/state-propose.c
index 1919886..0f1a440 100644
--- a/libweston/backend-drm/state-propose.c
+++ b/libweston/backend-drm/state-propose.c
@@ -181,6 +181,11 @@
 
 	state->in_fence_fd = ev->surface->acquire_fence_fd;
 
+	if (ev->surface->is_video_surface) {
+		state->video_transform = ev->surface->video_transform;
+		drm_debug(b, "\t\t\t\t[overlay] ev:%p video_transform:%d ", ev, state->video_transform);
+	}
+
 	/* In planes-only mode, we don't have an incremental state to
 	 * test against, so we just hope it'll work. */
 	if (mode == DRM_OUTPUT_PROPOSE_STATE_PLANES_ONLY) {
diff --git a/libweston/compositor.c b/libweston/compositor.c
index 8dd78c1..9bab03e 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -4066,6 +4066,8 @@
 
 	surface->pending.buffer_viewport.buffer.transform = transform;
 	surface->pending.buffer_viewport.changed = 1;
+	weston_log("\n %s %d transform:%d\n", __FUNCTION__,__LINE__,transform);
+	surface->video_transform = transform;
 }
 
 static void