Browse Source

gstreamer kmssink: assign the first drm framebuffer to black, support RGB, YUV420 format

Signed-off-by: sw.multimedia <sw.multimedia@starfivetech.com>
Signed-off-by: andy.hu <andy.hu@starfivetech.com>
andy.hu 2 years ago
parent
commit
dad896710f

+ 22 - 0
package/gstreamer1/gst1-plugins-bad/0002-set-init-buffer-to-black.patch

@@ -0,0 +1,22 @@
+--- a/sys/kms/gstkmssink.c	2020-10-26 19:14:46.656235000 +0800
++++ b/sys/kms/gstkmssink.c	2021-12-16 15:35:15.590755066 +0800
+@@ -450,6 +450,19 @@
+     goto bo_failed;
+   fb_id = kmsmem->fb_id;
+
++  GST_INFO_OBJECT (self, "size = %d, width = %d, height = %d.", vinfo->size, vinfo->width, vinfo->height);
++  if (vinfo->size == vinfo->width * vinfo->height * 3 / 2) {
++    GstMapInfo mapInfo;
++    if (gst_memory_map((GstMemory *)kmsmem, &mapInfo, GST_MAP_WRITE)) {
++      guint8 *start = mapInfo.data + vinfo->width * vinfo->height;
++      guint32 size = vinfo->width * vinfo->height / 2;
++      GST_INFO_OBJECT (self, "Set buffer to blank.");
++      memset(start, 128, size);
++      gst_memory_unmap((GstMemory *)kmsmem, &mapInfo);
++    }
++  }
++
++
+   conn = drmModeGetConnector (self->fd, self->conn_id);
+   if (!conn)
+     goto connector_failed;