Commit graph

4454 commits

Author SHA1 Message Date
He Junyan
64b596103a va: Do not use a common parent_class in vabasedec.
We have only one copy of gst_va_base_dec_parent_class inside the
vabasedec, so it can not handle the case when there are multi va
decoders inside one pipeline. The pipeline:

  gst-launch-1.0 filesrc location=xxx.h264 ! h264parse \
      ! vah264dec ! msdkh265enc ! vah265dec ! fakesink

generates a assertion of

"invalid cast from 'GstVaH264Dec' to 'GstH265Decoder"

and gets a crash.

We should keep the parent_class for each decoder type.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2231>
2021-05-10 22:47:11 +08:00
Víctor Manuel Jáquez Leal
bd2bbadeb0 va: av1dec: Avoid structure overwrite.
VADecPictureParameterBufferAV1.mode_control_fields.bits were filled
twice, overwriting to zeros the first assignation. This patch unifies
both assignations.

Also it makes explicit an enum casting between libva and gstreamer; it
removes the assignation to zero a deprecated parameter; and use an
appropriate assertion.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2223>
2021-05-07 11:22:33 +02:00
Seungha Yang
90edef103c wasapi2: Propagate HRESULT error code everywhere
... instead of boolean value which cannot notify the reason
of the operation failure.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2219>
2021-05-06 08:40:37 +00:00
Seungha Yang
81ac09cfda decklinkvideosrc: Fix crash when mode is not specified
In that case, we will get "VideoInputFrameArrived" callback
without "VideoInputFormatChanged"

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2218>
2021-05-06 01:37:33 +09:00
François Laignel
ad3d7d34cc Use gst_element_request_pad_simple...
Instead of the deprecated gst_element_get_request_pad.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2180>
2021-05-05 06:17:14 +00:00
Seungha Yang
1039d70d18 d3d11desktopdup: Don't ignore error DXGI_ERROR_UNSUPPORTED
Although Microsoft's DXGIDesktopDuplication example is considering
the DXGI_ERROR_UNSUPPORTED as an expected error
(See https://github.com/microsoft/Windows-classic-samples/tree/master/Samples/DXGIDesktopDuplication)
it might not be recoverable error if application is
run against a discrete GPU
(See https://docs.microsoft.com/en-US/troubleshoot/windows-client/shell-experience/error-when-dda-capable-app-is-against-gpu)

Do early error out if the error happens while opening device,
instead of retrying it forever.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2208>
2021-04-30 05:44:39 +00:00
Jakub Adam
fb8ed9e5d2 d3d11desktopdup: Support desktop switches
Before creating output duplication interface, call SetThreadDesktop()
with HDESK of the current input desktop in case a desktop switch has
occurred.

This allows d3d11desktopdupsrc to capture Windows User Account Control
(UAC) prompts, which appear on a separate secure desktop. Otherwise
IDXGIOutput1::DuplicateOutput() will return E_ACCESSDENIED and the
element won't produce any frames as long as the UAC screen is active.

Note that in order to access secure desktop the application still has to
run at LOCAL_SYSTEM privileges. For GStreamer applications running with
regular user privileges this change has no effect.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2209>
2021-04-30 04:47:36 +00:00
Jakub Adam
aac012ce72 dxgicapture: reinitialize duplication interface on ERROR_ACCESS_LOST
IDXGIOutputDuplication can become invalid for example when there's
desktop switch, resolution change or Windows User Account Control prompt
appears on screen.

When that happens, try to re-create the duplication interface for the
changed output. Note that in the case of UAC prompt this operation will
fail if the GStreamer process doesn't run at LOCAL_SYSTEM privileges. In
such situation the source element won't create any frames as long as the
output is occupied by UAC screen.

In order to enable UAC access to sufficiently privileged GStreamer
processes, call SetThreadDesktop() with the desktop handle that
currently receives user input before creating our output duplication.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2204>
2021-04-30 04:06:42 +00:00
Haihao Xiang
6750123d5c msdk: set correct parameters for BGRx frame
Otherwise when mapping BGRx frame onto CPU's memory, CPU will get wrong
data for B, G, R components

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2205>
2021-04-30 02:12:46 +00:00
Víctor Manuel Jáquez Leal
166082f3c3 va: allocator: Disable derived for Gallium if RGB and reading.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2127>
2021-04-28 12:08:58 +02:00
Víctor Manuel Jáquez Leal
ced093c738 va: allocator: Disable derived for i965 if YUV and writing.
The problem is for uploading YUV frames using derived images, is that
derived images imply tiling, so frames are wrongly uploaded.

Though derived for reading might work we cannot know the Intel graphics
generation to validate the caching. Overall, it's safer to disable derived
images for i965.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2127>
2021-04-28 12:06:17 +02:00
Víctor Manuel Jáquez Leal
2b0fa73c10 va: display: Fix typo.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2127>
2021-04-28 11:39:24 +02:00
Víctor Manuel Jáquez Leal
e2ff55b40d va: allocator: Hack for i965 to get linear RGB DMABufs.
i965 driver has a hack to provide linear dmabufs, which is required for RGB
formats, since they are directly uploaded by glupload, ignoring tiled modifiers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2127>
2021-04-28 11:39:24 +02:00
Víctor Manuel Jáquez Leal
672c977927 va: postproc: Remove unused parameter.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2127>
2021-04-28 11:39:24 +02:00
Víctor Manuel Jáquez Leal
9365073d50 va: postproc: Set usage hint generic if DMABuf.
iHD driver sets a tiled DRM modifier if surface's usage hint is set to
VPP_WRITE. This result in a garbled rendering when using glimagesink.

This patch changes the usage hint to generic if the caps feature is
DMABuf. Either way only iHD driver, so far, uses the usage hint flag.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2127>
2021-04-28 11:39:24 +02:00
Víctor Manuel Jáquez Leal
b4535093f6 va: postproc: Get info from caps in decide_allocation()
decide_allocation() occurs before set_caps(), where out_info is set,
thus setting srcpad_info with zeros or old values. Instead of it, the
caps, from the allocation query, are converted and used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2127>
2021-04-28 11:39:24 +02:00
Haihao Xiang
449f0ee52a msdkh265dec: Add support for error report too
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/909>
2021-04-28 08:30:38 +00:00
Haihao Xiang
5d891eb40c msdkh264dec: report error to user
Sometimes user want to know what the error is when decoding a stream,
This commit adds a property of report-error to msdkh264dec. When
report-error is TRUE, msdkh264dec may catch bitstream error and frame
corruption, then report the error to application by using GST_ELEMENT_ERROR

Refer to the code in
https://github.com/Intel-Media-SDK/MediaSDK/tree/master/samples

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/909>
2021-04-28 08:30:38 +00:00
Haihao Xiang
b6eca79557 msdkdec: allow sub class to add extra parameters for additional configuration
MSDK allows user add extended buffers to a bitstream for additional
configuration. This commit is to support this feature in this plugin

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/909>
2021-04-28 08:30:38 +00:00
Seungha Yang
957034d71a d3d11: Handle device change
If incoming buffer holds other d3d11 device, and user wants any device
(i.e., adapter index wasn't specified explicitly) update our device
with that of buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2191>
2021-04-28 16:26:58 +09:00
Seungha Yang
227aaed8d4 d3d11videosink: Delay window setup as much as possible
... so that videosink can handle device update with
d3d11 device of the first buffer

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2191>
2021-04-28 16:26:53 +09:00
Seungha Yang
70c96cf0dd d3d11: Don't accept buffer pool which holds different device
At the moment, d3d11 plugin doesn't support texture sharing between
different device

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2191>
2021-04-28 00:25:57 +09:00
Seungha Yang
41218dacec d3d11decoder: Run gst-indent
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2191>
2021-04-28 00:25:56 +09:00
Sebastian Dröge
f1ec6ddd5e decklinkvideosrc: Fix AFD/Bar VANC size check
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2193>
2021-04-26 15:03:34 +00:00
Sebastian Dröge
56af02f9c8 decklinkvideosrc: Automatically detect widescreen vs. normal NTSC/PAL
Based on the AFD aspect ratio flag the source can detect (in mode=auto)
whether this NTSC/PAL mode is actually a normal or a widescreen one and
select the caps according to that.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2193>
2021-04-26 15:03:34 +00:00
Seungha Yang
00e1561bf2 d3d11decoder: Set flushing to internal pool on flush event
d3d11 decoders use internal pool for DPB texture and
Gst*Decoder::new_picture() will be blocked if internal pool is full.
We should be able to unblock in on flush-start event as expected.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2192>
2021-04-24 01:37:01 +09:00
Seungha Yang
e4fe65a03e d3d11: Fix wrong GstD3D11BufferPool type check
Fix typos

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2190>
2021-04-23 16:54:15 +09:00
Seungha Yang
08b792d24c mfvideoenc: Fix UWP build
Add missing GST_MF_HAVE_D3D11 define guard

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2185>
2021-04-22 15:50:15 +09:00
Seungha Yang
2616fcfbac wasapi2: Fix UWP build
KSAUDIO_SPEAKER_* defines are WINAPI_PARTITION_DESKTOP only

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2185>
2021-04-22 15:42:23 +09:00
Seungha Yang
33078bf54a wasapi2: Implement default audio channel mask
Some capture devices might not provide channel mask value which will
result in capturing failure because of unknown channel mask in case
that device generates more than 2 channels. Although it might not
be correct, we can assume channel mask with the given number of channels.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2177>
2021-04-21 05:18:49 +00:00
Seungha Yang
f0ac468fb4 wasapi2clinet: Simplify set caps
Don't need to iterate all structure to set identical values

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2177>
2021-04-21 05:18:49 +00:00
Seungha Yang
6b7e08df90 wasapi2client: Run gst-indent
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2177>
2021-04-21 05:18:49 +00:00
Seungha Yang
094bfbedfc d3d11: Remove d3d11videosink wrapper bin
Drop d3d11videosink wrapper bin and handle texture upload
in d3d11videosink.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2169>
2021-04-20 02:01:30 +09:00
Seungha Yang
41879b20c2 d3d11: pluginutils: Fix wrong gst_memory_unmap() on _map() failure
It was obvious typo

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2164>
2021-04-15 00:05:03 +09:00
He Junyan
9bcb18ebce va: allocator: Fix an unmap typo in _va_copy.
No need to unmap the the src memory when failing to allocate the
dst mem. It has not been mapped yet.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2156>
2021-04-13 15:46:17 +08:00
Haihao Xiang
39538adfd6 msdk: don't fall back to the default device
Ohterwise when user set a wrong device, the warning message doesn't get
printed if user doesn't set a right debug level in the environment, this
behavior might mislead user that the wrong device is being used.

This fixed https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1567

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2138>
2021-04-13 01:23:43 +00:00
Stéphane Cerveau
da9e012e8a plugins-sys: allow per feature registration
Split plugin into features including
dynamic types which can be indiviually
registered during a static build.

More details here:

https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/199
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2116>
2021-04-09 19:23:40 +00:00
Nicolas Dufresne
f992c521c3 v4l2codecs: allocator: Keep dmabuf mapped
DMABuf allocator already implements DMABuf Sync, meaning that doing
mmap/munmap (unless the mode have changed) is not required. In fact, on
systems with IOMMU it makes the kernel redo the mmu table which is visible
in the CPU usage.

This change reduces CPU usage when decoding
bbb_sunflower_2160p_60fps_normal.mp4 on RK3399 SoC from over 30% to
around 15%.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2152>
2021-04-08 15:22:49 -04:00
Víctor Manuel Jáquez Leal
07a0b63472 va: allocator: Implement mem_copy for VA memory.
Implementation of mem_copy() virtual method for GstVaAllocator.

It's a deep copy where a new VA memory is popped out from the pool or,
if pool is empty, a new memory is allocated. The original memory is
mapped to read, and if its VAImage is not derived and size to copy is
the whole surface, the mapped VAImage of the original memory is put in
the new memory. Otherwise a slow memcpy is done between both memories.

Fixes: #1568
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2136>
2021-04-08 16:34:06 +00:00
Seungha Yang
6eb9856f59 codecs: vp9decoder: Pass GstVideoCodecFrame to duplicate_picture()
... and fix picture duplication logic for vavp9dec

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2112>
2021-04-07 19:32:29 +00:00
Seungha Yang
1f769839c0 codecs: vp9decoder: Port to GstVp9StatefulParser
Use newly implemented VP9 parser. Since new GstVp9FrameHeader
struct holds all the information of the stream, baseclass will not
pass parser object to new_sequence() method anymore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2112>
2021-04-07 19:32:29 +00:00
Nicolas Dufresne
24eda30bd7 v4l2codecs: Fix holding of reference picture buffer
The picture buffer (V4L2 CAPTURE buffer) was being released immediatly
when the request was done. This was problematic since even after the
request is done, the picture buffer might still be used as a reference
and should not be reused for further decoding yet.

This change effectively bind the picture buffer lifetime to the request.
So that if the picture is never showned (decode only frame) or the request
queue is full before the buffer is displayed, the picture buffer will
remain alive.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2142>
2021-04-07 19:00:21 +00:00
Víctor Manuel Jáquez Leal
7395057af3 va: filter: remove unsupported formats because driver's bugs
Add a way to filter out video formats from caps because of unresolved
bugs in drivers. In this case for media-driver (iHD) where some RGB32
formats are not handled correctly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2129>
2021-04-07 11:06:59 +00:00
Víctor Manuel Jáquez Leal
60db766a0d va: videoformats: Map more color formats.
Added Y212_LE, Y412_LE, P012_LE, Y444, RGB16, RGB and BGR10A2_LE in
the static map betwen VA and GStreamer color formats. This synchronize
the map used in gstremaer-vaapi and this plugin.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2129>
2021-04-07 11:06:59 +00:00
Víctor Manuel Jáquez Leal
d932dcf6be va: videoformats: Fix RGB32 mapping between VA and GStreamer.
Different VA drives might have different definitions for RGB32 color
formats because different bit interpretation. Sadly the specification
doesn't clarify these interpretations. So VA users have to figure out
what's the correct mapping with it's rendering color format
definition.

This patch aims to fix the static map structure after the
VAImageFormats are queried. There is another static map with the
different interpretations of the RGB32 formats, and compare them with
the given VAImageFormat, then with the GStreamer color format, update
the mapping table.

Finally, some RGB32 color formats were added.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2129>
2021-04-07 11:06:59 +00:00
Daniel Almeida
4373535bb5 v4l2codecs: gstv4l2decoder.c: Add missing include
Add missing include for sys/ioctl.h so that these warnings dissapear
when compiling:
../subprojects/gst-plugins-bad/sys/v4l2codecs/gstv4l2decoder.c:179:9:
warning: implicit declaration of function ‘ioctl’
[-Wimplicit-function-declaration]

Signed-off-by: Daniel Almeida <daniel.almeida@collabora.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2140>
2021-04-06 17:34:18 +00:00
Yinhang Liu
531ccf0594 msdkh265enc: add support for RGB 10bit format
The SDK can support A2RGB10 format [1], A2RGB10 format corresponds
to BGR10A2_LE format in gstreamer. A2RGB10 format only supports
low-power mode.

Example:
gst-launch-1.0 videotestsrc ! video/x-raw,format=BGR10A2_LE \
! msdkh265enc low-power=1 ! fakesink

[1] https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#mfxframedata

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2126>
2021-04-06 14:29:42 +00:00
Wim Taymans
cefdd0d0f1 vulkan: provide a custom VK_DEFINE_NON_DISPATCHABLE_HANDLE
If the application did not define one yet, define our own
VK_DEFINE_NON_DISPATCHABLE_HANDLE that is independent of the
architecture.

Vulkan, by default, provides a define that depends on the architecture,
which causes the symbol type to be different. This causes an
architecture dependent .gir file, which then causes multilib
installation problems because the .gir files can't be shared.

Make it possible to override the format specifier and provide
a default one that is compatible with the default non dispatchable
handle.

Return VK_NULL_HANDLE from functions that return a non-dispatchable
handle.

Fixes #1566

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2130>
2021-04-06 12:32:57 +02:00
Víctor Manuel Jáquez Leal
2ba5854c6b va: postproc, filter: add disable-passthrough property
vapostproc tries to be in passthrough mode as much as possible. But
they might be situations where the user might force to process the
frames. For example, when upstream sets the crop meta and the user
wants VA do that cropping, rather than downstream.

For those situations this property will disable the passthrough mode,
if it's enabled.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2058>
2021-04-03 15:47:18 +02:00
Víctor Manuel Jáquez Leal
f4862f8298 va: postproc: enable cropping by crop meta
If incoming buffers have crop meta it's done by vapostproc, iif
vapostproc is not in passthrough mode and downstream doesn't handle
it.

This patch announces the crop meta API in proposed bufferpool, while
it stops filtering meta APIs, since it was only filter crop api.

Also if downstream supports crop and video metas, vapostporoc
announces both meta APIs in upstream bufferpool.

Finally, the meta is removed from the buffer if the crop is enabled.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2058>
2021-04-03 15:47:18 +02:00