Commit graph

18 commits

Author SHA1 Message Date
Seungha Yang
09a8d2db05 kmssink: Add support for P010 and P016 formats
Support high bit-depth YUV formats

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1188>
2020-04-22 22:39:04 +00:00
Nicolas Dufresne
112baf404e kmssink: Fixup all errno tracing
All DRM ioctl uses errno to report the error and simply returns -1
when some error occured. This patch fixes all usage of the return
value instead of errno to trace the error type and moves to g_strerror
instead of string.h strerror in order to be consistent with the rest
of GStreamer.
2019-05-26 12:17:29 +02:00
U. Artie Eoff
ddba9e40f2 kms: Fix compilation error when libdrm < 2.4.68
DRM_RDWR was not defined until libdrm 2.4.68.  However,
in configure.ac we only require libdrm >= 2.4.55.

Seems silly to to bump minimum libdrm version for a simple
define.  Thus, define DRM_RDWR if it's not defined.

This fixes compilation error introduced in:

commit 922031b0f9
Author: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Date:   Tue Sep 12 12:07:13 2017 -0400

    kms: Export DMABuf from Dumb buffer when possible

    https://bugzilla.gnome.org/show_bug.cgi?id=787593

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2017-10-05 20:50:37 -04:00
Nicolas Dufresne
2057a36d04 kmsallocator: Update GstVideoInfo.size when extrapolating
When we guess the strides, we need to also update the GstVideoInfo.size
otherwise the memory size will be set to something smaller then needed.
This was causing crash with the DMABuf exportation, since we would not
mmap() a large enough buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=787593
2017-10-05 16:19:15 -04:00
Nicolas Dufresne
922031b0f9 kms: Export DMABuf from Dumb buffer when possible
https://bugzilla.gnome.org/show_bug.cgi?id=787593
2017-10-05 16:16:16 -04:00
Nicolas Dufresne
9d5a524547 kmssink: Move the mem cache into the allocator
No functional change, the cache will be later reused by the buffer
pool to keep track of the kmssink memory when exporting dmabuf.

https://bugzilla.gnome.org/show_bug.cgi?id=787593
2017-10-05 16:16:16 -04:00
Guillaume Desmottes
2d67189073 kmsallocator: add driver pitch support for planar formats
We used to to handle the driver pitch only for single plan video format.
Add support for multi planes format by re-using the extrapolate function
from the v4l2 element.
Also use this pitch to calculate the proper offsets.

Prevent DRM drivers to pick a slow path if the pitches/offsets don't
match the ones it reported.

https://bugzilla.gnome.org/show_bug.cgi?id=785029
2017-07-25 09:21:16 -04:00
Guillaume Desmottes
f9379b51b6 kmsallocator: inline gst_kms_allocator_alloc_empty()
No semantic change, just renamed the 'tmp' variable to a more meaningful
name and to use the same structure as in gst_kms_allocator_bo_alloc().

Needed as I'm going to move the gst_memory_init() call after the
allocation of the DUMB buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=785029
2017-07-25 09:21:16 -04:00
Nicolas Dufresne
cfadd5a936 kmssink: Don't leak GEM primed from DMABuf
This otherwise breaks DMABuf reclaiming. This is not visible from
userspace, but inside the kernel, the DRM driver will hold a ref to the
DMABuf object. With a V4L2 driver allocating those DMABuf, it then
prevent changing the resolution and re-allocation new buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=782774
2017-07-07 14:36:38 -04:00
Sebastian Dröge
634cd87c76 gst: Clear floating flag in constructor of all GstObject subclasses that are not owned by any parent
https://bugzilla.gnome.org/show_bug.cgi?id=743062
2017-05-17 10:40:23 +03:00
Víctor Manuel Jáquez Leal
88dbae3ab9 kmssink: include drm.h after stdlib.h
As drm.h is internal to libdrm, it expects to have already included
stdlib.h.
2016-11-23 20:13:59 +01:00
Víctor Manuel Jáquez Leal
79cd4bb44b kms: include stdlib.h
drm.h does not include all what it needs to compile, in particular
stdlib.h which defines size_t
2016-11-23 19:44:49 +01:00
Michael Tretter
12e82aac28 kmssink: remove dependency on libkms
libkms should not be used, because it imposes limitations on the DRM
API, especially regarding bpp and stride. Instead the DRM IOCTL should
be used directly.

Switch from libkms to the IOCTL interface. Set bpp and height for
framebuffer allocation to properly handle planar video formats.

https://bugzilla.gnome.org/show_bug.cgi?id=773473

Signed-off-by: Víctor Jáquez <vjaquez@igalia.com>
2016-11-23 16:43:28 +01:00
Philipp Zabel
4f19d5d20a kmssink: do not get kms bo pitch for planar formats
The API is ill defined for planar formats in case of dumb BOs,
do not use the reported stride in those cases.

https://bugzilla.gnome.org/show_bug.cgi?id=773473
2016-11-10 15:57:24 +01:00
Víctor Manuel Jáquez Leal
c117165f7b 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
2016-09-07 16:18:48 +02:00
Nicolas Dufresne
f03fc663ef kmssink: Fix offsets handling
The calculation of the offset table was done base on a plane size
estimation. This does not always work. Instead, use memory offset the
same we as it's implement in GstVideoMeta map functions.
2016-07-11 12:07:04 -04:00
Víctor Manuel Jáquez Leal
c419d17dbf kmssink: add dmabuf support
This patch will enable the import of dmabufs into a KMS buffer using
the PRIME kernel interface.

If the driver does not support prime import, the method is skipped.

It has been tested with a Freescale I.MX6 board.

https://bugzilla.gnome.org/show_bug.cgi?id=761059
2016-04-11 19:57:48 +02:00
Víctor Manuel Jáquez Leal
620e1d2fcd kmssink: add plugin and sink element
This is simple video sink that use libdrm/libkms API to render frames.

The element uses planes to render through drmModeSetPlane().

It has been tested in an Exynos4412 board and in a Freescale I.MX6 board.

https://bugzilla.gnome.org/show_bug.cgi?id=761059
2016-04-11 19:57:48 +02:00