Merge branch 'CR_1982_fix_show_previous_last_frame_Windsome.Zeng' into 'jh7110-mm-devel'

[GST] [DRM] Reset DRM to initial state on each playing, using atomic API.

See merge request sdk/buildroot!65
This commit is contained in:
andy.hu
2022-09-07 03:22:09 +00:00
committed by Andy Hu
3 changed files with 1027 additions and 38 deletions
File diff suppressed because it is too large Load Diff
@@ -1,21 +0,0 @@
--- 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,18 @@
goto bo_failed;
fb_id = kmsmem->fb_id;
+ GST_INFO_OBJECT (self, "size = %lu, 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;
@@ -1,17 +0,0 @@
Clear all framebuffer content when mapping.
Signed-off-by: Windsome Zeng <windsome.zeng@starfivetech.com>
diff -purN a/sys/kms/gstkmsallocator.c b/sys/kms/gstkmsallocator.c
--- a/sys/kms/gstkmsallocator.c 2022-08-31 10:57:31.759791991 +0800
+++ b/sys/kms/gstkmsallocator.c 2022-08-31 09:25:30.132182006 +0800
@@ -384,6 +384,9 @@ gst_kms_memory_map (GstMemory * mem, gsi
}
kmsmem->bo->ptr = out;
+ /* clear the framebuffer to 0 */
+ memset(out, 0, kmsmem->bo->size);
+
out:
g_atomic_int_inc (&kmsmem->bo->refs);
return kmsmem->bo->ptr;