Commit graph

74 commits

Author SHA1 Message Date
Nicolas Dufresne
9387a936b5 kmssink: Add Amlogic upstreamer DRM driver support
Amlogic Upstream driver is named meson, not to be confuse with the build
system.
2018-03-18 09:50:51 -04:00
Nicolas Dufresne
a7c207630c kmssink: Make render rectangle property controllable
https://bugzilla.gnome.org/show_bug.cgi?id=792798
2018-01-30 10:02:14 +00:00
Nicolas Dufresne
44dabe21d9 kmssink: Fix CropMeta support
We copy the meta's from the original buffer to the wrapper or copied
buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=790473
2017-12-06 13:34:19 -05:00
Nicolas Dufresne
d33aff0fa0 kmssink: Enforce pixel aspect ratio when we cannot scale
When we cannot scale, we need to enforce the pixel aspect ratio.
This was partly implemented in the previous patch. Doing this
simplify some of the code.

https://bugzilla.gnome.org/show_bug.cgi?id=784599
2017-12-06 13:34:19 -05:00
Nicolas Dufresne
737067e793 kmssink: Add display-width/height properties
This is to be used with gst_video_overlay_set_render_rectangle()
so the application can calculate a rectangle that fits inside
the display. The property changes are notify in a way that you
can watch either notify::display-width or notify::display-height
and both will be up-to-data when this is called back. Before the
element is started, the size will be 0x0.

https://bugzilla.gnome.org/show_bug.cgi?id=784599
2017-12-01 12:01:59 -05:00
Haihua Hu
b24bb73101 kmssink: support videooverlay interface
Implement videooverlay interface in kmssink, divided into two cases:
when driver supports scale, then we do refresh in show_frame(); if
not, send a reconfigure event to upstream and re-negotiate, using the
new size.

https://bugzilla.gnome.org/show_bug.cgi?id=784599
2017-12-01 09:44:47 -05:00
Haihua Hu
ff9a4390cb kmssink: add can-scale property
https://bugzilla.gnome.org/show_bug.cgi?id=784599
2017-12-01 09:44:47 -05:00
Nicolas Dufresne
72eebe7f53 kmssink: Add Raspberry Pi (vc4) support 2017-11-21 12:04:58 -05:00
Nicolas Dufresne
f272ddf9c7 kmssink: Fix crash on NULL dmabuf allocator pointer
Now that we are doing lazy allocation, we may endup calling _stop()
before the allocator was created. As a side effect, we need to nul-check
the pointer before calling it's method (_clear_cache()).

https://bugzilla.gnome.org/show_bug.cgi?id=787593
2017-10-06 15:10:26 -04: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
Nicolas Dufresne
119294f3fc kmsbufferpool: Don't check allocator pointer twice
https://bugzilla.gnome.org/show_bug.cgi?id=787593
2017-10-05 16:16:16 -04:00
Nicolas Dufresne
0a25ca893d kmsbufferpool: Removed unused member fd
https://bugzilla.gnome.org/show_bug.cgi?id=787593
2017-10-05 16:16:16 -04:00
Nicolas Dufresne
045a91922c kmssink: Check if we can prime export
This will be used later to decide if a DMABuf allocator should be
exposed.

https://bugzilla.gnome.org/show_bug.cgi?id=787593
2017-10-05 16:16:16 -04:00
Nicolas Dufresne
ee021c0418 kmssink: Don't leak the dumb buffer on drain 2017-09-08 10:16:12 -04:00
Nicolas Dufresne
22ce257f1c kmssink: Don't assume buffer pool won't touch buf pointer
Just for extra safety, let's not assume that gst_buffer_pool_acquire()
won't ever touch the buf pointer.
2017-09-08 09:28:19 -04:00
Guillaume Desmottes
7e38fb5422 kms: fix crash if bo allocation failed when copying to dumb buffer
If bo allocation failed we destroy the buffer and return GST_FLOW_ERROR,
but the @buffer pointer was still pointing to the address of the
destroyed buffer. gst_kms_sink_copy_to_dumb_buffer() was then trying to
unref it when bailing out causing a crash.

Leave @buffer untouched if allocation failed to fix the crash.
Also remove the check on *buffer being not NULL as gst_buffer_new()
will abort if it failed.

https://bugzilla.gnome.org/show_bug.cgi?id=787442
2017-09-08 09:26:21 -04:00
Nicolas Dufresne
9b2e28d91d Request minimum buffer even if need_pool is FALSE
When tee is used, it will not request a pool, but still it wants to
know how many buffers are required.

https://bugzilla.gnome.org/show_bug.cgi?id=730758
2017-09-06 14:19:37 -04:00
Nicolas Dufresne
a5229c3098 kmssink: Add bus-id property
https://bugzilla.gnome.org/show_bug.cgi?id=786112
2017-08-11 09:32:08 -04:00
Nicolas Dufresne
b7b7948e5f kmssink: Free devname before setting it
This avoids leaking the devname if the property is set twice.
2017-08-09 15:00:17 -04:00
Nicolas Dufresne
1ec081f96d Revert "kmssink: support videooverlay interface"
This is causing hard failure for non-squared pixel. The fix isn't
trivial so taking offline by reverting.

This reverts commit db07f4507d.
2017-08-07 16:00:59 -04:00
Haihua Hu
db07f4507d kmssink: support videooverlay interface
Implement videooverlay interface in kmssink, divided into two cases:
when driver supports scale, then we do refresh in show_frame(); if
not, send a reconfigure event to upstream and re-negotiate, using the
new size.

https://bugzilla.gnome.org/show_bug.cgi?id=784599
2017-07-31 20:04:15 +02: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
Víctor Manuel Jáquez Leal
c538942b0d kmssink: initialize variable
Otherwise clang complains:

gstkmssink.c:1192:7: warning: variable 'buf' is used uninitialized
whenever 'if' condition is true [-Wsometimes-uninitialized]
2017-07-10 13:32:49 +02:00
Nicolas Dufresne
0a0bc8ab94 kmssink: Track cached kmsmem and clear them on drain
In this patch we keep track of the cached kmsmem in a way
that we can clear the cache during the drain process. This
release the framebuffer before waiting for the next vblank,
hence add support for DRM driver (like Intel one) that release
the associated DMABuf reference asynchronously.

https://bugzilla.gnome.org/show_bug.cgi?id=782774
2017-07-07 14:36:38 -04:00
Nicolas Dufresne
98b91d09c2 kmssink: Move kmsmem cache code higher
This will be needed as this API will be used elsewhere to clear
the cache.

https://bugzilla.gnome.org/show_bug.cgi?id=782774
2017-07-07 14:36:38 -04:00
Nicolas Dufresne
b8c5a4c9ed kmssink: drop last rendered buffer on ALLOCATION and DRAIN queries
kmssink keeps a reference on the last rendered buffer. If this buffer
refers to an upstream buffer, it should be should be released on DRAIN
and ALLOCATION queries so all upstream buffers can be returned to the
pool if needed. As the buffer may be used for scanout, we copy this
buffer into a dumb buffer prior to let it go.

Based on patch from Guillaume Desmottes <guillaume.desmottes@collabora.com>

https://bugzilla.gnome.org/show_bug.cgi?id=782774
2017-07-07 14:36:38 -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
Nicolas Dufresne
6e3fe4eaab kmssink: Factor out copying to dump buffer
This will be used to copy any upstream memory in order to return it on
resolution change, allocation query or drain query.

https://bugzilla.gnome.org/show_bug.cgi?id=782774
2017-07-07 14:36:38 -04:00
Guillaume Desmottes
d373c4478b kmssink: Add xilinx_drm to the list of drivers
This prevent having to set the driver-name explicitly when running on
Zynq UltraScale+ boards.

https://bugzilla.gnome.org/show_bug.cgi?id=783188
2017-06-05 12:56:03 +02: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
Nicolas Dufresne
4261692187 Remove plugin specific static build option
Static and dynamic plugins now have the same interface. The standard
--enable-static/--enable-shared toggle are sufficient.
2017-05-16 14:05:52 -04:00
Nicolas Dufresne
99755badbe kmssink: Add msm to the list of drivers
This prevent having to set the driver-name explicitly when running on
Qualcomm/MSM boards.
2017-04-21 21:30:10 -04:00
Philipp Zabel
9ed9c14eb5 kmssink: if the plane can not scale, retry without scaling and remember
Retry the drmModeSetPlane call without scaling if the first try fails,
and remember not to scale anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=781188
2017-04-12 19:31:47 +02:00
Thibault Saunier
78022a6e0c docs: Port all docstring to gtk-doc markdown 2017-04-12 12:57:57 -03:00
Sebastian Dröge
40a2deef80 kmssink: Fix compiler warning with gcc 7
gstkmssink.c: In function ‘gst_kms_sink_get_input_buffer’:
gstkmssink.c:1102:29: error: ‘mems[0]’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   kmsmem = (GstKMSMemory *) get_cached_kmsmem (mems[0]);
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
2017-03-22 17:38:37 +02:00
George Kiagiadakis
4757ec8860 kmssink: adjust memory offset calculation for dmabuf buffers
The data in the dmabuf fd may not start from byte 0, therefore
we need to inform DRM about this additional offset.

https://bugzilla.gnome.org/show_bug.cgi?id=779790
2017-03-14 17:07:41 +02:00
Nicolas Dufresne
eb2dae8fd6 Rename plugin filesnames to match plugin names
- libgstgtksink.so -> libgstgtk.so
- libgstteletextdec.so -> libgstteletex.so
- libgstcamerabin2.so -> libgstcamerabin.so
- libgstonvif.so -> libgstrtponvif.so (meson only)
- sdp -> sdpelem (avoid clash with libgstsdp)
- gstsiren -> siren
- libgstkmssink.so -> libgstkms.so

https://bugzilla.gnome.org/show_bug.cgi?id=779344
2017-03-08 20:04:23 -05:00
Víctor Manuel Jáquez Leal
4b3baab40a kmssink: post error message if start() fails
It is expected to post an error message in the bus if the device cannot
be started.
2016-11-30 20:13:55 +01:00
Michael Tretter
649364b923 kmssink: configure display mode during set_caps
Configure the display mode when setting the negotiated caps instead of
during showing the first frame.

A framebuffer is required to set the mode. Allocate a buffer object
according to the negotiated caps and use it to set the mode. This buffer
object cannot be freed until another page flip happened on the crtc
(i.e., until the first frame is rendered).

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

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
2016-11-30 20:13:55 +01:00
Michael Tretter
dff77fd15f kmssink: add parameter force-modesetting
The force-modesetting parameter forces the kmssink to ignore already
configured display modes, to configure the display mode itself and use
the base plane for output.

https://bugzilla.gnome.org/show_bug.cgi?id=773473
2016-11-30 20:13:55 +01:00
Michael Tretter
3d0c5dd58e kmssink: allow only supported resolutions
If the input buffers have a different size than the display, the frames
would have to be scaled or positioned on the display. The kmssink cannot
decide which behaviour would be appropriate for which use case.

In order to avoid scaling or positioning of the input stream, allow only
the supported connector resolutions in the sink caps.

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

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
2016-11-30 20:13:55 +01:00
Michael Tretter
ca96cc6083 kmssink: set mode based on framebuffer configuration
Displays usually support multiple modes. Therefore, the kmssink should
not only support the preferred mode, but any mode that is supported by
the display.

https://bugzilla.gnome.org/show_bug.cgi?id=773473
2016-11-30 20:13:55 +01:00
Michael Tretter
f52baadd1e kmssink: add mode setting and base plane rendering
The kmssink assumed that the mode was already set by another application
and used an overlay plane for displaying the frames.

Use the preferred mode of the monitor and render to the base plane if
the crtc does not have a valid mode.

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

Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
2016-11-30 20:13:55 +01: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