Commit graph

761 commits

Author SHA1 Message Date
Víctor Manuel Jáquez Leal 74c75b1e8b vah265dec: Fix end_picture() vmethod.
Since commit 88437a9c the signature of h265decoder's end_picture()
changed to return GstFlowReturn, but vah265dec was not updated.

This commit fixes this regression.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1248>
2021-10-25 17:01:26 +02:00
Mengkejiergeli Ba 164244a2eb va: allocator: Fix possible memory leaks
At gst_va_dmabuf_allocator_setup_buffer_full, static code analysis tool
does not know number of objects in descriptor is always larger than 0 if
export_surface_to_dmabuf succeeds. Thus, the tool will assume buf is
allocated with mem but not released when desc.num_objects equals to 0
and raise a mem leak issue.

For gst_va_dambuf_memories_setup, we should also inform the tool that
n_planes will be larger than 0 by checking the value at very beginning.
Then, the defect similar to above will not be raised during static analysis.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1241>
2021-10-25 15:03:30 +08:00
Mathieu Duponchelle 2f8030d98b nvh264enc: add constrained-baseline to the caps profiles
In practice, when baseline is requested from the encoder it
produces constrained baseline, and it is already reflected
in the profile-iop flags.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1213>
2021-10-21 09:06:08 +00:00
Seungha Yang 8b6c3e030b mediafoundation: Fix for UWP build
We don't support D3D11 interop for UWP because some APIs
(specifically MFTEnum2) are desktop application only.
However, the code for symbol loading is commonly used by both UWP and WIN32.
Just link GModule unconditionally which is UWP compatible, and simply don't
try to load any library/symbol dynamically when D3D11 interop is unavailable.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1216>
2021-10-21 05:11:40 +00:00
Tim-Philipp Müller e0f336c1b4 meson: va, msdk: simplify dep.get_variable() use
With recent Meson versions we can just write dep.get_variable('foo')
instead of dep.get_variable(pkgconfig: 'driverdir', internal: 'driverdir').

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1183>
2021-10-20 11:20:44 +00:00
Tim-Philipp Müller f1bb2c76c6 meson: update for dep.get_pkgconfig_variable() deprecation
... in favour of dep.get_variable('foo', ..) which in some
cases allows for further cleanups in future since we can
extract variables from pkg-config dependencies as well as
internal dependencies using this mechanism.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1183>
2021-10-20 11:20:44 +00:00
Víctor Manuel Jáquez Leal 5c6b641ae3 vadeinterlace: Accept ANY feature.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1024>
2021-10-18 19:14:15 +00:00
Víctor Manuel Jáquez Leal bf1b03e5cb vadeinterlace: Fixate interlace-mode and framerate accordingly.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1024>
2021-10-18 19:14:15 +00:00
Víctor Manuel Jáquez Leal 10e5db047a vapostproc: Accept ANY feature.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1024>
2021-10-18 19:14:15 +00:00
Víctor Manuel Jáquez Leal 7e53161ea5 vapostproc: Traverse caps features in gst_va_vpp_caps_remove_fields()
The previous code had a potential failure for multiple caps features. Now
each caps feature in each structure is reviewed, and if it has a supported
feature, the structure is processed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1024>
2021-10-18 19:14:15 +00:00
Víctor Manuel Jáquez Leal c00ad9e70c vapostproc: Refactor gst_va_vpp_complete_caps_features()
gst_va_vpp_complete_caps_features() now receives the @feature_name to
add and return if @caps doesn't provide it.

So, instead of two nested loops, now the function is a single loop,
traversing @caps to find if each structure already contains the requested
@features_name.

It's important to add missing caps features with @caps, in order to
not lost information.

The function caller does the external loop by calling per each
available caps feature.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1024>
2021-10-18 19:14:15 +00:00
Víctor Manuel Jáquez Leal d12991c979 vapostproc: Split caps transform in two phases.
In order to make more readable the caps transformation, the operation
was split in two phases:

1. Rangify the supported caps structures.
2. Add the missing (and supported) caps features.

Step 1 modified its logic, by copying any unrecognized structure.
It's a previous step required for allowing ANY caps feature as
passthrough.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1024>
2021-10-18 19:14:15 +00:00
Seungha Yang be9cf6c9cd d3d11: d3d11{convert,scale}: Add add-borders property
Functionally identical to that of videoscale element.

When disabled, d3d11convert or d3d11scale element will scale
image without adding borders, meaning that display aspect ratio
will not be preserved.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1170>
2021-10-17 12:36:28 +00:00
Víctor Manuel Jáquez Leal ff0fae50af vapostproc: Add add-borders property to keep dar
Just as videoscale, it enables add-borders property (FALSE by default)
in vapostproc to add border, if necessary, to keep the display aspect
ratio from the original image.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1169>
2021-10-17 11:24:26 +00:00
Víctor Manuel Jáquez Leal 52c09778b7 vapostproc: Fix early fixation.
First copy missing fields and then fixate all remaining fields.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1169>
2021-10-17 11:24:26 +00:00
Seungha Yang 47a53f5063 meson: wasapi2,mediafoundation: Work around Windows SDK header issue
Some SDK headers are not standard compliant, so MSVC will
complain when such headers are in use with "/permissive-" compile
option. Use "/Zc:twoPhase-" to work around the issue as documented in
https://docs.microsoft.com/en-us/cpp/build/reference/permissive-standards-conformance?view=msvc-160#windows-header-issues

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1174>
2021-10-17 08:01:47 +00:00
Seungha Yang d0c86365d2 mediafoundation: Use GetProcAddress() for OS version dependent symbols
We are using some symbols which are not available on Windows 7,
specifically D3D11 interop related ones

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1167>
2021-10-16 18:07:06 +09:00
Víctor Manuel Jáquez Leal ee7af02c3e vapostproc: Transfer colorimetry at fixate if possible.
Taken from videoconvert element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1110>
2021-10-16 05:17:19 +00:00
Seungha Yang ba79339d56 mediafoundation: Fix various string constness handling
... with fixing typo (g_strup -> g_strdup)

Constness needs to be explicit in C++ world otherwise compiler
would complain about that.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1164>
2021-10-15 23:38:48 +09:00
Mengkejiergeli Ba 4a6cc431d2 va: Fix null ptr dereference for vadeocder
Making a null check in gst_va_decode_picture_free () indicates pic->buffers or pic->slices
can be null, then in _destroy_buffers () the pointers are dereferenced, which is detected
as dereference after null check by Coverity. Thus, modify the code to do null check in
_detroy_buffers ().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1143>
2021-10-15 00:45:44 +00:00
Seungha Yang b3710aa68d d3d11: Rename screen capture element
Old name "desktopdup" may confuse users. Now it's renamed to
"screencapture"

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1136>
2021-10-14 15:15:56 +00:00
Mengkejiergeli Ba 5e7aa06257 va: Fix error handling for decoder
Need to check if va decoder is closed successfully.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1131>
2021-10-14 11:12:41 +00:00
Mengkejiergeli Ba 2eaba0cefa va: Fix error handling for base transform
Need to check the returned value of gst_buffer_pool_set_active() when
setting the active status of buffer pool.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1131>
2021-10-14 11:12:41 +00:00
Víctor Manuel Jáquez Leal a2aa2cda42 vapostproc: Negotiate interlaced.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1109>
2021-10-13 14:59:09 +00:00
Víctor Manuel Jáquez Leal 60be3dbd2a vapostproc: Copy missing fields at fixate.
When caps negotiation implies a caps feature change, some fields might
get lost. This patch brings them back from input caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1109>
2021-10-13 14:59:09 +00:00
Víctor Manuel Jáquez Leal 5ae1072c2f vapostproc: Simplify size fixate.
gst_va_vpp_fixate_size() returned the fixated caps, but that is not
needed since `othercaps` are modified inline.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1109>
2021-10-13 14:59:09 +00:00
Víctor Manuel Jáquez Leal b53446ddc9 vapostproc: Simplify fixate.
The first approach to fixate was simply a copy&paste of both
videoconvert and videoscale, trying to keep their logic as isolated
as possible. But that brought duplicated and sparse logic.

This patch merge both approaches simplifying the fixate operation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1109>
2021-10-13 14:59:09 +00:00
Víctor Manuel Jáquez Leal 1642c3fc96 va: filter, deinterlace, vpp: Add gst_va_buffer_get_surface_flags().
Add a helper function to get, from GstVideoInfo and GstBuffers flags,
the VA interlace surface flags. This is used currently by vainterlace
element, but it will be used in vapostproc too if it can process
interlaced frames.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1109>
2021-10-13 14:59:09 +00:00
Mengkejiergeli Ba 40d559adcf msdkenc: fix vp9enc initialization fail
MediaSDK does not support to handle extbuff with id
MFX_EXTBUFF_VIDEO_SIGNAL_INFO for mjpegenc and vp9enc. Hence, need to
exclude mjpeg and vp9 when passing color properties to MediaSDK during
msdkenc initialization.

Fix issue: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/764

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1101>
2021-10-12 03:45:41 +00:00
Seungha Yang 4b85704b88 d3d11: Add device provider for d3d11desktopdupsrc
... and add support for multi-GPU/multi-monitor

By using newly added "monitor-handle" property, user can specify a
monitor to be captured via HMONITOR handle.

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1673
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1103>
2021-10-11 15:21:26 +00:00
Víctor Manuel Jáquez Leal 35575e7b11 va: allocator: dmabuf: Use GstVaSurfaceCopy, if possible.
If dmabuf-based buffer to copy contains only one memory, and there are
memories available in the allocator's pool, it's possible a fast
memory copy using GstVaSurfaceCopy, regardless the drm modifier.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1023>
2021-10-10 17:03:29 +00:00
Víctor Manuel Jáquez Leal cf751d54a9 va: allocator: Use GstVaSurfaceCopy.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1023>
2021-10-10 17:03:29 +00:00
Víctor Manuel Jáquez Leal ffa2522fc0 va: Add GstVaSurfaceCopy class.
This new class is a helper for fast/tricky copy of surfaces. First it
tries to copy using the function vaCopy in libva 1.12. If it fails, or
it's not available, a GstVaFilter is tried to be instantiated with the
allocator's parameters, and if succeed, it's used for copying the
source surface.

This is required for dmabuf surfaces with drm modifier.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1023>
2021-10-10 17:03:29 +00:00
Víctor Manuel Jáquez Leal f1e2eb4f1e va: filter: Enable to pass VASurfaceID in GstVaSample.
Initially GstVaSample processed its GstBuffer member to get the
VASurfaceID. But it might cases where we already have the VASurfaceID
to process by the filter.

This patch enables the possibility to pass the surfaces rather than
the buffers. In order to validate the surfaces a function to check
surfaces were added.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1023>
2021-10-10 17:03:29 +00:00
Víctor Manuel Jáquez Leal 14156f8270 va: Split VA memory handling in different files.
Take out the VA memory wrappers from gstvallocator.c to an external
file exposing the functions.

This is going to be needed for the copy helper object.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1023>
2021-10-10 17:03:29 +00:00
Víctor Manuel Jáquez Leal 1be43e76cc va: allocator: Add missing header file.
Added stdint.h because uintptr_t is used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1023>
2021-10-10 17:03:29 +00:00
Víctor Manuel Jáquez Leal 2947bd6ef1 va: display: Add gst_va_display_has_vpp()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1023>
2021-10-10 17:03:29 +00:00
Benjamin Gaignard 7e9e17ebbe v4l2codecs: Align v4l2-controls header with kernel 5.15-rc3
Update v4l2-controls to be aligned with kernel 5.15-rc3.
Fix VP8 decoder to use the correct field name.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1081>
2021-10-10 15:50:57 +00:00
Seungha Yang 0d96e43c91 mediafoundation: mfvideoenc: Use DXGI adapter LUID
Make use of new DXGI adapter LUID based device context sharing.
Note that we were using DXGI adapter LUID to open MFT already.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1098>
2021-10-10 03:23:58 +09:00
Seungha Yang 5707e487cf d3d11: d3d11decoder: Use DXGI adapter LUID
... instead of index of DXGI adapter.

The order of IDXGIAdapter1 enumerated via IDXGIFactory1::EnumAdapters1
can be varying even there's no rebooting in case that GPU preference order
is updated by user (for example, it can be done by using NVIDIA Control Panel
in case of multi-GPU laptop system) and eGPU is another possible case.

So, for an element which requires fixed target GPU requirement,
index based device enumeration is unreliable.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1098>
2021-10-10 03:23:58 +09:00
Seungha Yang d8eff2623d d3d11: d3d11device: Remove "allow-tearing" property
Plugin can query DXGI_FEATURE_PRESENT_ALLOW_TEARING without d3d11device
help

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1098>
2021-10-10 01:01:44 +09:00
Seungha Yang 7286c8e302 d3d11: d3d11desktopdupsrc: Add support for non-D3D11 downstream element
By this commit, application doesn't need to configure d3d11download
element for software pipeline which will make things simpler

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1082>
2021-10-08 16:13:46 +09:00
Víctor Manuel Jáquez Leal 01cfc1ee7e va: Use macro rather than VAMemory feature string.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1061>
2021-10-06 07:19:50 +00:00
Seungha Yang 7c557c2d65 codecs: mpeg2decoder: Use GstFlowReturn everywhere
boolean return value is not sufficient for representing the reason
of error in most cases. For instance, any errors around new_sequence()
would mean negotiation error, not just *ERROR*.
And some subclasses will allocate buffer/memory/surface on new_picture()
but it could be failed because of expected error, likely flushing

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1019>
2021-10-04 20:56:46 +00:00
Seungha Yang e322745763 codecs: h264decoder: Use GstFlowReturn everywhere
boolean return value is not sufficient for representing the reason
of error in most cases. For instance, any errors around new_sequence()
would mean negotiation error, not just *ERROR*.
And some subclasses will allocate buffer/memory/surface on new_picture()
but it could be failed because of expected error, likely flushing

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1019>
2021-10-04 20:56:46 +00:00
Seungha Yang 5b405d1585 codecs: h265decoder: Use GstFlowReturn everywhere
boolean return value is not sufficient for representing the reason
of error in most cases. For instance, any errors around new_sequence()
would mean negotiation error, not just *ERROR*.
And some subclasses will allocate buffer/memory/surface on new_picture()
but it could be failed because of expected error, likely flushing

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1019>
2021-10-04 20:56:46 +00:00
Víctor Manuel Jáquez Leal 2e6cd5c2e4 va: Make libgudev dependency optional.
libgudev is a problematic dependency, particularly in sandboxed
environments, such as flatpak.

This patch implements a way to get the available VA devices using
brute-forced traverse of /dev/drm/renderD* directory. Thus usable in
those sandboxed environments.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1027>
2021-10-04 10:19:36 +00:00
Víctor Manuel Jáquez Leal e699aaeb16 va: meson: Move back libgudev dependency to plugin.
When move the libgstva, libgudev dependency was moved as part of the
library, though it's not use by the library but the plugin. This patch
moves back libgudev dependency to the plugin.

Also HAVE_LIBDRM is move to the library which is the one who use it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1027>
2021-10-04 10:19:36 +00:00
Seungha Yang da7f4e0a69 nvcodec: nvh264sldec: Add support for interlaced stream
Implement missing interlaced stream support

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1026>
2021-10-04 08:04:00 +00:00
Seungha Yang ce8965b75b nvcodec: nvh264sldec: Consider additional render delay DPB pictures
At least additional 4 pictures are required

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1026>
2021-10-04 08:04:00 +00:00
Seungha Yang 613d380b97 nvcodec: nvvp9sldec: Fix for VP9 profile2 decoding
Fix for output video format to be selected correctly

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1026>
2021-10-04 08:04:00 +00:00
Seungha Yang baf252b48b msdk: meson: Fix build on Windows
subprojects\gst-plugins-bad\sys\msdk\meson.build:160:2: ERROR: Unknown variable "libva_dep".

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1022>
2021-10-04 07:14:33 +00:00
Seungha Yang 6a756b9f46 d3d11: d3d11vp9dec: Fix use_prev_in_find_mv_refs value setting
"last_show_frame" should be updated based on
GstVp9FrameHeader::show_frame, not show_existing_frame

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1021>
2021-10-03 02:25:50 +09:00
Seungha Yang 834d6f4031 nvcodec: nv{vp8,vp9}sldec: Implement get_preferred_output_delay()
Equivalent to that of nvh264sldec. Use render delay in case of non-live
pipeline for the better throughput performance.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/987>
2021-10-02 12:11:48 +00:00
Víctor Manuel Jáquez Leal 5e08ede8f6 va: meson: Update and enhance meson syntax usage.
This patch contains two updates:

1. Instead of checking for dependency already checked just to verify a
   version, we use the dependency version API.
2. Update the deprecated function get_pkgconfig_variable.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/997>
2021-10-02 00:54:56 +00:00
Víctor Manuel Jáquez Leal a769e3308d msdk: meson: Don't get dependency variable before it's valid.
It's possible to have installed MediaSDK environment
package (libmfx-dev in Debian) without libva environment package. This
setup will lead to a breakage of meson configuration.

The fix is to get the libva's driver directory variable after the
dependency is validated as found.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/998>
2021-10-01 23:43:41 +00:00
Seungha Yang feb5a5aae6 mfdeviceprovider: Add support for device update
Similar to the wasapi2 plugin, GstWinRT library will be used for UWP,
and adding new GstWin32DeviceWatcher object implementation for
Win32 desktop application.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/947>
2021-09-30 06:13:07 +00:00
Seungha Yang 2f791ff027 wasapi2deviceprovider: Add support for device update
... by using newly implemented GstWinRT library

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/947>
2021-09-30 06:13:07 +00:00
Seungha Yang 052983014e d3d11videosink: Add support for crop meta
... when upstream element is d3d11.

Note that, if upstream element is not d3d11, crop meta is almost
pointless since d3d11videosink will upload video frame to GPU memory
in any case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/933>
2021-09-27 16:29:09 +00:00
Seungha Yang 0fa5a06ed9 d3d11videosink: Perform propose_allocation() even when we have no configured window
In order to support d3d11 device update, d3d11videosink will configure
window on the first buffer. So, there might not be configured
window when propose_allocation() is required.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/933>
2021-09-27 16:29:09 +00:00
Thibault Saunier 019971a3c7 Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00