From dd0f89acaa9f41689ef7324858f3dfe2db64e1f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Fri, 5 Aug 2016 18:17:32 +0200 Subject: [PATCH 4/9] kmssink: override stride if defined in driver Some kms drivers demands specific pitches over the ones calculated by GstVideoInfo. For example, intel driver demands strides round up 64. This patch queries the driver for the prefered pitch and overwrites it in the pool's GstVideoInfo structure. https://bugzilla.gnome.org/show_bug.cgi?id=768446 Upstream Status: Backport --- sys/kms/gstkmsallocator.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/kms/gstkmsallocator.c b/sys/kms/gstkmsallocator.c index 7df1aa3..e031848 100644 --- a/sys/kms/gstkmsallocator.c +++ b/sys/kms/gstkmsallocator.c @@ -303,7 +303,7 @@ gst_kms_allocator_add_fb (GstKMSAllocator * alloc, GstKMSMemory * kmsmem, { int i, ret; gint num_planes = GST_VIDEO_INFO_N_PLANES (vinfo); - guint32 w, h, fmt, bo_handles[4] = { 0, }; + guint32 w, h, fmt, pitch = 0, bo_handles[4] = { 0, }; guint32 offsets[4] = { 0, }; guint32 pitches[4] = { 0, }; @@ -318,6 +318,10 @@ gst_kms_allocator_add_fb (GstKMSAllocator * alloc, GstKMSMemory * kmsmem, kms_bo_get_prop (kmsmem->bo, KMS_HANDLE, &bo_handles[0]); for (i = 1; i < num_planes; i++) bo_handles[i] = bo_handles[0]; + + /* Get the bo pitch calculated by the kms driver. + * If it's defined, it will overwrite the video info's stride */ + kms_bo_get_prop (kmsmem->bo, KMS_PITCH, &pitch); } else { for (i = 0; i < num_planes; i++) bo_handles[i] = kmsmem->gem_handle[i]; @@ -328,6 +332,8 @@ gst_kms_allocator_add_fb (GstKMSAllocator * alloc, GstKMSMemory * kmsmem, for (i = 0; i < num_planes; i++) { offsets[i] = mem_offsets[i]; + if (pitch) + GST_VIDEO_INFO_PLANE_STRIDE (vinfo, i) = pitch; pitches[i] = GST_VIDEO_INFO_PLANE_STRIDE (vinfo, i); GST_DEBUG_OBJECT (alloc, "Create FB plane %i with stride %u and offset %u", i, pitches[i], offsets[i]); -- 2.7.4