libdrm_meson: add disable plane function [1/1]

PD#SWPL-120498

Problem:
no disable plane function

Solution:
add disable plane function

Verify:
S4

Change-Id: I12cae5dc87a10a176af731d120743f94fb90bd92
Signed-off-by: wenlong.zhang <wenlong.zhang@amlogic.com>
diff --git a/meson/meson_drm_kms.c b/meson/meson_drm_kms.c
index 67ed569..4c54cef 100644
--- a/meson/meson_drm_kms.c
+++ b/meson/meson_drm_kms.c
@@ -291,6 +291,7 @@
     buf->height = info->height;
     buf->flags = info->flags;
     buf->fence_fd = -1;
+    buf->disable_plane = 0;
     buf->disp = drm_disp;
 
     ret = alloc_bos(drm_disp, buf, bo_handles);
@@ -330,6 +331,7 @@
         buf->height = info->height;
         buf->flags = info->flags;
         buf->fence_fd = -1;
+        buf->disable_plane = 0;
         buf->disp = drm_disp;
 
         if (!info->fourcc)
@@ -381,6 +383,7 @@
     buf->height = info->height;
     buf->flags = info->flags;
     buf->fence_fd = -1;
+    buf->disable_plane = 0;
     buf->disp = disp;
 
     if (!info->fourcc)
@@ -449,50 +452,63 @@
 
     request = drmModeAtomicAlloc();
 
-#if 0
-    if (!disp->mode_set) {
-        flags |= DRM_MODE_ATOMIC_ALLOW_MODESET;
-        drmModeAtomicAddProperty(request, conn_state->id, conn_state->crtc_id.id, crtc_state->id);
+    if (buf->disable_plane) {
+        drmModeAtomicAddProperty(request, plane_state->id, plane_state->crtc_x.id, 0);
+        drmModeAtomicAddProperty(request, plane_state->id, plane_state->crtc_y.id, 0);
+        drmModeAtomicAddProperty(request, plane_state->id, plane_state->crtc_w.id, 0);
+        drmModeAtomicAddProperty(request, plane_state->id, plane_state->crtc_h.id, 0);
+        drmModeAtomicAddProperty(request, plane_state->id, plane_state->src_x.id, 0);
+        drmModeAtomicAddProperty(request, plane_state->id, plane_state->src_y.id, 0);
+        drmModeAtomicAddProperty(request, plane_state->id, plane_state->src_w.id, 0);
+        drmModeAtomicAddProperty(request, plane_state->id, plane_state->src_h.id, 0);
+        drmModeAtomicAddProperty(request, plane_state->id, plane_state->fb_id.id, 0);
+        drmModeAtomicAddProperty(request, plane_state->id, plane_state->crtc_id.id, 0);
+    } else {
+    #if 0
+        if (!disp->mode_set) {
+            flags |= DRM_MODE_ATOMIC_ALLOW_MODESET;
+            drmModeAtomicAddProperty(request, conn_state->id, conn_state->crtc_id.id, crtc_state->id);
 
-        if (drmModeCreatePropertyBlob(drm_disp->drm_fd, &disp->conn_states[0]->mode,
-                                sizeof(drmModeModeInfo), &blob_id) != 0 ) {
-            return -1;
+            if (drmModeCreatePropertyBlob(drm_disp->drm_fd, &disp->conn_states[0]->mode,
+                                    sizeof(drmModeModeInfo), &blob_id) != 0 ) {
+                return -1;
+            }
+            drmModeAtomicAddProperty(request, crtc_state->id, crtc_state->mode_id.id, blob_id);
+            drmModeAtomicAddProperty(request, crtc_state->id, crtc_state->active.id, 1);
+
+            disp->mode_set = 1;
         }
-        drmModeAtomicAddProperty(request, crtc_state->id, crtc_state->mode_id.id, blob_id);
-        drmModeAtomicAddProperty(request, crtc_state->id, crtc_state->active.id, 1);
+    #else
+        /*No modeset needed in post buf, modeset will control by systemservice.*/
+    #endif
 
-        disp->mode_set = 1;
+        drmModeAtomicAddProperty(request, plane_state->id, plane_state->crtc_x.id, buf->crtc_x);
+        drmModeAtomicAddProperty(request, plane_state->id, plane_state->crtc_y.id, buf->crtc_y);
+        if (buf->crtc_w == 0) {
+            drmModeAtomicAddProperty(request, plane_state->id, plane_state->crtc_w.id, conn_state->mode.hdisplay);
+        } else {
+            drmModeAtomicAddProperty(request, plane_state->id, plane_state->crtc_w.id, buf->crtc_w);
+        }
+
+        if (buf->crtc_h == 0) {
+            drmModeAtomicAddProperty(request, plane_state->id, plane_state->crtc_h.id, conn_state->mode.vdisplay);
+        } else {
+            drmModeAtomicAddProperty(request, plane_state->id, plane_state->crtc_h.id, buf->crtc_h);
+        }
+
+        drmModeAtomicAddProperty(request, plane_state->id, plane_state->src_x.id, buf->src_x << 16);
+        drmModeAtomicAddProperty(request, plane_state->id, plane_state->src_y.id, buf->src_y << 16);
+        drmModeAtomicAddProperty(request, plane_state->id, plane_state->src_w.id, buf->src_w << 16);
+        drmModeAtomicAddProperty(request, plane_state->id, plane_state->src_h.id, buf->src_h << 16);
+        drmModeAtomicAddProperty(request, plane_state->id, plane_state->fb_id.id, buf->fb_id);
+        drmModeAtomicAddProperty(request, plane_state->id, plane_state->crtc_id.id, crtc_state->id);
+    #if 0
+        if (buf->flags | (MESON_USE_VD2 | MESON_USE_VD1))
+            drmModeAtomicAddProperty(request, crtc_state->id, crtc_state->video_out_fence.id, VOID2U64(&buf->fence_fd));
+        else
+            drmModeAtomicAddProperty(request, crtc_state->id, crtc_state->out_fence.id, VOID2U64(&buf->fence_fd));
+    #endif
     }
-#else
-    /*No modeset needed in post buf, modeset will control by systemservice.*/
-#endif
-
-    drmModeAtomicAddProperty(request, plane_state->id, plane_state->crtc_x.id, buf->crtc_x);
-    drmModeAtomicAddProperty(request, plane_state->id, plane_state->crtc_y.id, buf->crtc_y);
-    if (buf->crtc_w == 0) {
-        drmModeAtomicAddProperty(request, plane_state->id, plane_state->crtc_w.id, conn_state->mode.hdisplay);
-    } else {
-        drmModeAtomicAddProperty(request, plane_state->id, plane_state->crtc_w.id, buf->crtc_w);
-    }
-
-    if (buf->crtc_h == 0) {
-        drmModeAtomicAddProperty(request, plane_state->id, plane_state->crtc_h.id, conn_state->mode.vdisplay);
-    } else {
-        drmModeAtomicAddProperty(request, plane_state->id, plane_state->crtc_h.id, buf->crtc_h);
-    }
-
-    drmModeAtomicAddProperty(request, plane_state->id, plane_state->src_x.id, buf->src_x << 16);
-    drmModeAtomicAddProperty(request, plane_state->id, plane_state->src_y.id, buf->src_y << 16);
-    drmModeAtomicAddProperty(request, plane_state->id, plane_state->src_w.id, buf->src_w << 16);
-    drmModeAtomicAddProperty(request, plane_state->id, plane_state->src_h.id, buf->src_h << 16);
-    drmModeAtomicAddProperty(request, plane_state->id, plane_state->fb_id.id, buf->fb_id);
-    drmModeAtomicAddProperty(request, plane_state->id, plane_state->crtc_id.id, crtc_state->id);
-#if 0
-    if (buf->flags | (MESON_USE_VD2 | MESON_USE_VD1))
-        drmModeAtomicAddProperty(request, crtc_state->id, crtc_state->video_out_fence.id, VOID2U64(&buf->fence_fd));
-    else
-        drmModeAtomicAddProperty(request, crtc_state->id, crtc_state->out_fence.id, VOID2U64(&buf->fence_fd));
-#endif
 
     ret = drmModeAsyncAtomicCommit(drm_disp->drm_fd, request, flags, NULL);
     if (ret < 0) {
diff --git a/meson/meson_drm_util.h b/meson/meson_drm_util.h
index 758fca7..d06a224 100644
--- a/meson/meson_drm_util.h
+++ b/meson/meson_drm_util.h
@@ -42,6 +42,7 @@
 
     struct drm_display *disp;
     int commit_to_video;
+    int disable_plane;
 };
 
 struct drm_buf_metadata {