summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2016-08-05 18:17:32 +0200
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2016-09-07 16:18:48 +0200
commitc117165f7baf7f5c684414c9a378b1690b7a896d (patch)
tree174791e602540bf339a458b7ccc66de25c55282a /sys
parent533ee7be95aedb93bff1f08f62288b13bf1d844b (diff)
downloadgstreamer-plugins-bad-c117165f7baf7f5c684414c9a378b1690b7a896d.tar.gz
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
Diffstat (limited to 'sys')
-rw-r--r--sys/kms/gstkmsallocator.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/kms/gstkmsallocator.c b/sys/kms/gstkmsallocator.c
index 7df1aa325..e031848d0 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]);