Commit graph

1362 commits

Author SHA1 Message Date
Marek Vasut
50fb6f8c02 av1decoder: Fix multiplication wraparound
The GstAV1Picture system_frame_number is guint32, constant 1000 is guint32,
GstV4l2CodecAV1Dec v4l2_av1_frame.*_frame_ts multiplication result is u64 .

```
u64 result = (u32)((u32)system_frame_number * (u32)1000);
```
behaves the same as
```
u64 result = (u32)(((u32)system_frame_number * (u32)1000) & 0xffffffff);
```

so in case `system_frame_number > 4294967295 / 1000`, the `result` will
wrap around. Since the `result` is really used as a cookie used to look
up V4L2 buffers related to the currently decoded frame, this wraparound
leads to visible corruption during AV1 decoding. At 30 FPS this occurs
after cca. 40 hours of playback .

Fix this by changing the 1000 from u32 to u64, i.e.:
```
u64 result = (u64)((u32)system_frame_number * (u64)1000ULL);
```
this way, the wraparound is prevented and the correct cookie is used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5791>
2023-12-20 18:47:39 +00:00
Marek Vasut
6f74818a07 vp9decoder: Fix multiplication wraparound
The GstVp9Picture system_frame_number is guint32, constant 1000 is guint32,
GstV4l2CodecVp9Dec v4l2_vp9_frame.*_frame_ts multiplication result is u64 .

```
u64 result = (u32)((u32)system_frame_number * (u32)1000);
```
behaves the same as
```
u64 result = (u32)(((u32)system_frame_number * (u32)1000) & 0xffffffff);
```

so in case `system_frame_number > 4294967295 / 1000`, the `result` will
wrap around. Since the `result` is really used as a cookie used to look
up V4L2 buffers related to the currently decoded frame, this wraparound
leads to visible corruption during VP9 decoding. At 30 FPS this occurs
after cca. 40 hours of playback .

Fix this by changing the 1000 from u32 to u64, i.e.:
```
u64 result = (u64)((u32)system_frame_number * (u64)1000ULL);
```
this way, the wraparound is prevented and the correct cookie is used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5791>
2023-12-20 18:47:39 +00:00
Marek Vasut
15c9a6caa9 vp8decoder: Fix multiplication wraparound
The GstVp8Picture system_frame_number is guint32, constant 1000 is guint32,
GstV4l2CodecVp8Dec v4l2_vp8_frame.*_frame_ts multiplication result is u64 .

```
u64 result = (u32)((u32)system_frame_number * (u32)1000);
```
behaves the same as
```
u64 result = (u32)(((u32)system_frame_number * (u32)1000) & 0xffffffff);
```

so in case `system_frame_number > 4294967295 / 1000`, the `result` will
wrap around. Since the `result` is really used as a cookie used to look
up V4L2 buffers related to the currently decoded frame, this wraparound
leads to visible corruption during VP8 decoding. At 30 FPS this occurs
after cca. 40 hours of playback .

Fix this by changing the 1000 from u32 to u64, i.e.:
```
u64 result = (u64)((u32)system_frame_number * (u64)1000ULL);
```
this way, the wraparound is prevented and the correct cookie is used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5791>
2023-12-20 18:47:39 +00:00
He Junyan
35390de50d vacompositor: consider the DMA kind input for sink pad
Co-authored-by: Víctor Jáquez <vjaquez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5160>
2023-12-16 10:56:09 +00:00
He Junyan
0bbaa00c3f vacompositor: Override the update_caps() of video aggregator class
The input of the vacompositor may be DMA buffers. And in this case, the input
caps has the format=DMA_DRM, which can not be recognized by base video
aggregator class' find_best_format() function. So we need to override the
update_caps() virtual function.

Also we consider the DMA kind caps in negotiated_src_caps() for output.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5160>
2023-12-16 10:56:09 +00:00
He Junyan
e68724c8e0 vacompositor: add helper function to get formats from caps
Co-authored-by: Víctor Jáquez <vjaquez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5160>
2023-12-16 10:56:09 +00:00
He Junyan
c76999fe7b vacompositor: add helper function to choose format
The function is based on the most supported formats by Intel/Mesa VA drivers.

Co-authored-by: Víctor Jáquez <vjaquez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5160>
2023-12-16 10:56:09 +00:00
He Junyan
eb4d2dd204 vacompositor: record the input caps for each input pad
The caps of each input sink pad wil decide the final output format and
caps of the src pad.

Co-authored-by: Víctor Jáquez <vjaquez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5160>
2023-12-16 10:56:09 +00:00
Seungha Yang
800a83b435 d3d12decoder: Implement threaded decoding
To achieve maximum throughput, waiting on command commit thread
is not ideal. And render-delay will introduce unwanted latency.
Best is to split thread and wait finished decoding job in a dedicated
output thread

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5812>
2023-12-15 22:56:33 +09:00
Seungha Yang
7471db9a30 d3d12decoder: Disable d3d11 interop
It does not seem to work with some AMD iGPU

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5812>
2023-12-15 20:40:21 +09:00
Seungha Yang
7afa914054 d3d12fence: Reset fence after waiting done
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5812>
2023-12-15 19:48:40 +09:00
Seungha Yang
a24a155279 d3d12: Enable debug layer
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5812>
2023-12-15 19:48:40 +09:00
Seungha Yang
7443cc00b5 d3d12: Requires ID3D12Device4 interface
ID3D12Device4::CreateCommandList1() method is required

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5812>
2023-12-15 19:48:39 +09:00
Seungha Yang
818c95e8c3 d3d12: Update allocation params signalling
Sync up with d3d11 implementation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5812>
2023-12-15 19:48:36 +09:00
Víctor Manuel Jáquez Leal
8210784dab vabasedec: clean up decide_allocation() vmethod
When creating a new VA pool set config size to zero because it's not used.

Also, given the potential different sizes from software buffer pools and VA
buffer pools, this patch handle that potential different values.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5805>
2023-12-14 12:50:32 +00:00
Víctor Manuel Jáquez Leal
4fab6bb45a vabasetransform: clean up decide_allocation() vmethod
When creating a new VA pool set config size to zero because it's not used.

Also, given the potential different sizes from software buffer pools and VA
buffer pools, this patch handle that potential different values.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5805>
2023-12-14 12:50:32 +00:00
Víctor Manuel Jáquez Leal
33e49023ff vacompositor: clean up decide_allocation() vmethod
When creating a new VA pool set config size to zero because it's not used.

Also, given the potential different sizes from software buffer pools and VA
buffer pools, this patch handle that potential different values.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5805>
2023-12-14 12:50:32 +00:00
Víctor Manuel Jáquez Leal
1c7ce208bd vapluginsutils: add helper gst_va_create_other_pool()
This helper function creates a software-based buffer pool, where if size is
zero, its value is retrieved from the canonical size.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5805>
2023-12-14 12:50:32 +00:00
Víctor Manuel Jáquez Leal
4a22cc8fb3 va: no need to provide a buffer size for VA pool
VA drivers allocate surfaces given their properties, so there's no need to
provide a buffer size to the VA pool.

Though, the buffer size is provided by the driver, or the canonical size
is used for single planed surfaces.

This patch removes the need to provide a size for the function
gst_va_pool_new_with_config() and adds a helper method to retrieve the surface
size, gst_va_pool_get_buffer_size(). Also change the callers accordingly.

Changes for custom VA pool creation will be addressed in the following commits.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5805>
2023-12-14 12:50:32 +00:00
Seungha Yang
fab1c5f953 d3d12: Use d3dx12.h helper library
... and remove manually implemented helper methods

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5807>
2023-12-14 18:08:00 +09:00
Seungha Yang
38c04a5f34 d3d12: Use DirectX-Headers and drop MinGW build support
There are some conflicts between MinGW toolchan and DirectX-Headers.
And due to ABI differences, more fixes are required.
We will support only MSVC build for now

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5807>
2023-12-14 18:08:00 +09:00
Mengkejiergeli Ba
41f13f4373 msdk: Remove dead code
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5796>
2023-12-14 00:47:28 +00:00
He Junyan
5ae7bbf5fb va: h265dec: Add support for more -still and -intra profiles
They are actually compitable with the main and main-10 profiles.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5797>
2023-12-12 21:30:16 +08:00
He Junyan
5345652896 va: Add decoder compatible caps string field into profiles' map
Some profiles such as main or main-10 in HEVC can support more
compatible profiles such as main-still-picture or main-10-intra.
We should add them into decoder's sink caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5797>
2023-12-12 21:30:08 +08:00
He Junyan
354aceb9cd va: Add the entrypoint parameter to gst_va_profile_caps()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5797>
2023-12-12 20:41:54 +08:00
Mengkejiergeli Ba
484a636841 msdkvpp: Add fix_format for src caps
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5208>
2023-12-12 14:56:12 +08:00
Mengkejiergeli Ba
5536f742e9 msdk: Add a help func to fix the map
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5208>
2023-12-12 14:56:12 +08:00
Mengkejiergeli Ba
8081a665f8 msdk: Remove func to export dmabuf to va surface
Since we use va allocator and va dma allocator to create surface, the
surface is already exported in the case of dma allocator. So remove
redundant export function in msdk allocator.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5208>
2023-12-12 14:56:12 +08:00
Yinhang Liu
61282ebd34 msdkenc: Add modifier support
Co-authored-by: Mengkejiergeli Ba <mengkejiergeli.ba@intel.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5208>
2023-12-12 14:56:12 +08:00
Yinhang Liu
9ccdfae545 msdkvpp: Add modifier support
Co-authored-by: Mengkejiergeli Ba <mengkejiergeli.ba@intel.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5208>
2023-12-12 14:56:12 +08:00
Yinhang Liu
63c0fdd29a msdkdec: Add modifier support
Co-authored-by: Mengkejiergeli Ba <mengkejiergeli.ba@intel.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5208>
2023-12-12 14:56:12 +08:00
Mengkejiergeli Ba
e65e954e2b msdk: Config pool with max/min number of buffers
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5208>
2023-12-12 14:56:12 +08:00
Yinhang Liu
e668cf9305 msdk: Add help functions to handle drm caps
Co-authored-by: Mengkejiergeli Ba <mengkejiergeli.ba@intel.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5208>
2023-12-12 14:56:03 +08:00
Yinhang Liu
bf4703e9a0 msdk: Add modifier when creating dynamic caps
Add modifier in gst-inspect for dma features.

Co-authored-by: Mengkejiergeli Ba <mengkejiergeli.ba@intel.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5208>
2023-12-12 11:30:07 +08:00
Yinhang Liu
8100b04ea0 msdk: Add a helper function to get supported modifiers
The modifiers will be used when creating caps for dma feature.

co-authored-by: Mengkejiergeli Ba <mengkejiergeli.ba@intel.com>

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5208>
2023-12-12 10:22:11 +08:00
Alexander Slobodeniuk
651dcb4912 d3d11: fix building with address sanitizer
When building with address sanitizer it gives next error:
"gstd3d11window_corewindow.cpp : fatal error C1128: number of sections
exceeded object file format limit: compile with /bigobj"

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5779>
2023-12-07 21:36:20 +00:00
Mengkejiergeli Ba
be7e502769 msdk: Let deviceID config the mfx implementation
In multi-card scenario, user can set GST_MSDK_DRM_DEVICE env variable to
choose the device. This patch can align vpl's queried results with the
users' choice by passing deviceID when creating mfx implementation.

Co-authored-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5697>
2023-12-07 11:17:20 +08:00
Seungha Yang
012222bcb3 cudaipcsink: Fix deadlock on stop
Manually close connection if client does not hold any shared memory
on stop.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5747>
2023-12-06 16:09:27 +00:00
Seungha Yang
ed5987efd4 d3d11ipcsink: Fix deadlock on stop
Manually close connection if client does not hold any shared memory
on stop.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5747>
2023-12-06 16:09:27 +00:00
Seungha Yang
b168647073 nvdec: Fix division by zero when calculating buffer duration
Don't try to calculate buffer duration from variable framerate

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5764>
2023-12-06 13:38:09 +00:00
renjun wang
4ff2f07e51 v4l2codecs: av1: Fix typo in debug log message
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5722>
2023-12-06 10:25:24 +00:00
Seungha Yang
adfa4d459e qsv: Update plugin doc cache
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5706>
2023-11-30 21:55:24 +09:00
Seungha Yang
865d7a1351 qsvh265dec: Add support for GBR decoding
Use GBR equivalent output formats if RGB colorspace is detected

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5706>
2023-11-30 21:50:26 +09:00
Seungha Yang
e4729e5784 qsvh265dec: Add support for HEVC RExt profiles
Adding 4:2:0 high bitdepth and 4:2:2/4:4:4 decoding support

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5706>
2023-11-30 21:38:04 +09:00
Seungha Yang
0178cc188b qsv: Add util methods for video format mapping
Remove duplicated format mapping code

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5706>
2023-11-30 21:38:04 +09:00
Seungha Yang
c432a73e80 msdk: Fix build error after d3d11 API change
Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3158
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5723>
2023-11-28 19:17:20 +09:00
Seungha Yang
461c4bc32c d3d11: Add support for more packed formats using compute shader
Adding below listed formats support, and reorders supported format
list based on preference

<YUV 4:2:2>
UYVY, VYUY, YVYU, v210, v216

<YUV 4:4:4>
v308, IYU2

<RGB 16bits per pixel>
RGB16, RGB15, BGR16, BGR15

<RGB 8bits per channel>
ARGB, xRGB, ABGR, xBGR, RGB, BGR

<RGB 10bits per channel>
r210, BGR10A2

<RGB 16bits per channel>
BGRA64

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5717>
2023-11-27 15:14:09 +00:00
Seungha Yang
f23d4475b3 d3d11convert: Allow MSAA only for native DXGI formats
Enable MSAA only if converter can render directly on texture
without post-processing

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5717>
2023-11-27 15:14:09 +00:00
Seungha Yang
845f5d4856 d3d11: Rework memory allocation params signalling
Hide GstD3D11AllocationParams detail from public header and
set setter methods.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5717>
2023-11-27 15:14:09 +00:00
Seungha Yang
721533d042 d3d11: Use shader model 4
Since shader model 4 is sufficient for the current pixel shader
implementations, prebuild HLSL with shader model 4 as well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5709>
2023-11-25 20:27:43 +09:00
Seungha Yang
3ab8d520fb d3d11: Drop legacy device support
Direct3D feature level 10 supported GPUs were released
more than 15 years ago, around the time when Windows
Vista / 7 were released. Also our d3d11 plugin/library
does not support feature level 9.x very well already.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5709>
2023-11-25 20:27:43 +09:00
Link Mauve
4cd9dd3940 v4l2codecs: Query the right buffer before expbuf
We were previously always querying index 0, and while the number of planes per
buffer will never change, it seems more proper to query the right buffer rather
than always the first one.

This was found while reading strace logs, and wondering why the
V4L2_BUF_FLAG_MAPPED flag was present on all ¬0 indices even though that
happened before VIDIOC_EXPBUF.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5647>
2023-11-22 15:50:08 +00:00
Seungha Yang
0004a52866 qsvdecoder: Fix stream format detection
Fixing typo

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5700>
2023-11-21 21:22:47 +09:00
Seungha Yang
0ad1c07b20 d3d11testsrc: Bind UAV if needed
YUV packed formats require UAV

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5691>
2023-11-20 20:29:13 +09:00
Seungha Yang
ca14eeeeaa d3d11convert: Add support for YUY2 and Y410 output
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5691>
2023-11-20 20:29:13 +09:00
Seungha Yang
0afeacce92 d3d11screencapturesrc: Fix wrong color with HDR enabled
Even if IDXGIOutput6 says current display colorspace is HDR,
captured texture via IDXGIOutputDuplication::AcquireNextFrame()
is converted frame by OS unless we use IDXGIOutput5::DuplicateOutput1()
with DXGI_FORMAT_R16G16B16A16_FLOAT format, in order for captured
frame to be scRGB color space. Then application should perform
tonemap operation based on reported display white level, color primaries, etc.

Since we don't have any tonemapping implementation, ignores colorimetry
reported by IDXGIOutput6.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3128
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5671>
2023-11-16 19:00:24 +09:00
Seungha Yang
cb3c1390f2 d3d11: Avoid ID3D11DeviceContext::Map if possible
Allocate resource with initial date instead of calling Map/Unmap
after allocation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5660>
2023-11-15 23:38:59 +09:00
Seungha Yang
ac11ccd4ff dwrite: Protect entire draw operation with D3D11 lock
d2d runtime seems to execute pending GPU command list
when DXGI ID2D1RenderTarget is being released, and it will invoke
d3d11 immediate context APIs. Should protect all rendering operations
and DXGI resources with lock.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5659>
2023-11-15 19:25:46 +09:00
Mengkejiergeli Ba
cef1f179c6 msdk: Add device env in plugin dependencies
Add env vars GST_MSDK_DRM_DEVICE in plugin_add_dependencies to register
msdk plugins according to user's choice in a multi-gpu platform.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5615>
2023-11-15 02:34:27 +00:00
Víctor Manuel Jáquez Leal
9f5b2c4e25 va: use GstVideoInfoDmaDrm when importing buffers
In the case of encoders and filters when importing a DMABuf, use
GstVideoInfoDmaDrm to get the drm fourcc and modifier.

In both cases, instead of keeping the original GstVideoInfoDmaDrm from caps, the
GstVideoInfo part of the structure is converted as canonical one, given the
format from the fourcc. It's kept in the way to handle V4L2 linear DMABufs and
to avoid too many changes in the current code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5264>
2023-11-09 17:36:06 +00:00
Víctor Manuel Jáquez Leal
7c0227145c vaallocator: use GstVideoInfoDmaDrm for dmabuf setup
Instead of guessing the DRM format and modifier, pass a DRM video info to
gst_va_dmabuf_memories_setup().

Still, it checks for the DRM parameters in DRM info, if they are not available,
as in the case of V4L2 buffers, the part of the video info is used.

This is an API breakage, but since the plugin is still in stage, it's still
allowed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5264>
2023-11-09 17:36:06 +00:00
Víctor Manuel Jáquez Leal
76115528ac vallocator: remove n_planes argument in dmabuf_memories_setup()
Instead of passing the number of planes to process, take that number from the
passed GstVideoInfo.

This is an API breakage, but since the plugin is still in stage, it's still
allowed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5264>
2023-11-09 17:36:06 +00:00
Tobias Rapp
cd98d12f2e decklink: Fix typo in element documentation
DechLink -> DeckLink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5625>
2023-11-09 07:53:12 +00:00
Tobias Rapp
7ec3a97a70 decklink: Increase section level of video sink/source element documentation
Should fix auto-generated follow-up sections like "Hierarchy" or
"Factory details" to be listed under the element name in the
table-of-contents of the document, instead of a stand-alone
"Duplex-Mode" section.

Also cleanup some spurious colon suffix after section names.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5625>
2023-11-09 07:53:12 +00:00
Víctor Manuel Jáquez Leal
d7b5b54eda vadisplay: only register elements of allowed drivers
Now that nvidia-vaapi-driver appeared and isn't yet supported by GstVA, we've to
add an allowed list of supported drivers.

This patch implements it adding a environment variable to disable this driver
check: GST_VA_ALL_DRIVERS

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5616>
2023-11-08 13:53:26 +00:00
Seungha Yang
02bf1dbf1f d3d11window: Fix scale factor setting
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5602>
2023-11-07 11:19:31 +00:00
Seungha Yang
0bcddfc894 d3d11: Enable DirectXMath SIMD
* Enable SIMD except for x86 target
* Use aligned matrix struct
* Remove unnecessary matrix copy operations

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5602>
2023-11-07 11:19:31 +00:00
Seungha Yang
b12d43bd89 wasapi2device: Ignore activation failed device
Enumerates all devices even if activation error is detected

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3090
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5599>
2023-11-06 12:28:50 +00:00
Marek Vasut
5d2d602e4a v4l2codecs: Avoid QBUF/DQBUF struct timeval .tv_usec wrap-around at frame 1000000
When decoding stream using hardware V4L2 decoder element, in any of the
currently supported formats, the decoding will fail once frame number
1000000 is reached. The reported error clearly indicates a wrap-around
occured, instead of receiving decoded frame 1000000, frame 0 is received
from the hardware V4L2 decoder driver.

The problem is actually not in the driver itself, but rather in gstreamer,
which uses `struct v4l2_buffer` member `.timestamp` in a special way. The
timestamp of buffers with encoded data added to the SINK (input) queue of
the driver is copied by the driver into matching buffers with decoded data
added to the SOURCE (output) queue of the driver. In fact, the timestamp
is not a timestamp at all, but rather in this special case, only part of
it is used as an incrementing frame counter.

The `.timestamp` is of type `struct timeval`, which is defined in
`sys/time.h` [1]. Only the `tv_usec` member of this structure is used
for the incrementing frame counter. However, suseconds_t tv_usec [2]
may be limited to range [-1, 1000000]:
"
[XSI] The type suseconds_t shall be a signed integer type capable of
      storing values at least in the range [-1, 1000000].
"
Therefore, once frame 1000000 is reached, a rollover occurs and decoding
fails.

Fix this by using both `struct timeval` members, `.tv_sec` and `.tv_usec`
with matching modular arithmetic, this way the failure would occur again
just short of 2^84 frames, which should be plenty.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_time.h.html
[2] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html

A test case using stateless hardware h264 decoder, the WARN/ERROR output
in gstreamer log indicates a failure occurred. With this change, that
error no longer occurs and the WARN/ERROR are not present:
```
pc$ gst-launch-1.0 videotestsrc num-buffers=1001001 pattern=6 ! \
                   video/x-raw,width=16,height=16,format=I420 ! \
                   x264enc ! filesink location=/tmp/test.h264

dut$ GST_DEBUG="*:3" gst-launch-1.0 filesrc location=/tmp/test.h264 ! \
                                    h264parse ! v4l2slh264dec ! fakesink
...
0:03:51.393677606 12111     0x370df400 WARN      \
  v4l2codecs-decoder gstv4l2decoder.c:1157:gst_v4l2_request_set_done:<v4l2decoder2> \
  Requested frame 1000000, but driver returned frame 0.
0:03:51.394140597 12111     0x370df400 WARN      \
  v4l2codecs-decoder gstv4l2decoder.c:1157:gst_v4l2_request_set_done:<v4l2decoder2> \
  Requested frame 1000001, but driver returned frame 1.
0:03:51.394425216 12111     0x370df400 WARN      \
  v4l2codecs-decoder gstv4l2decoder.c:1157:gst_v4l2_request_set_done:<v4l2decoder2> \
  Requested frame 1000002, but driver returned frame 2.
0:03:51.394665211 12111     0x370df400 WARN      \
  v4l2codecs-decoder gstv4l2decoder.c:1157:gst_v4l2_request_set_done:<v4l2decoder2> \
  Requested frame 1000003, but driver returned frame 3.
0:03:51.394785833 12111     0x370df400 WARN      \
  v4l2codecs-h264dec gstv4l2codech264dec.c:1059:gst_v4l2_codec_h264_dec_output_picture:<v4l2slh264dec0> \
  error: Failed to decode frame 1000000
ERROR: from element /GstPipeline:pipeline0/v4l2slh264dec:v4l2slh264dec0: Failed to decode frame 1000000
```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5598>
2023-11-04 15:51:45 +01:00
Seungha Yang
34d221dad5 wasapi2: Fix build with GST_DISABLE_GST_DEBUG
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5585>
2023-11-03 13:31:03 +00:00
Seungha Yang
8009f5275a mediafoundation: Fix build with GST_DISABLE_GST_DEBUG
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5585>
2023-11-03 13:31:03 +00:00
Seungha Yang
c3cef6e923 d3d12: Fix build with GST_DISABLE_GST_DEBUG
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5585>
2023-11-03 13:31:03 +00:00
Seungha Yang
033f98ad86 d3d11: Set MaxAnisotropy value for the best quality
... and use anisotropic filter without comparison, which is actually
intended one.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5580>
2023-11-01 15:41:08 +00:00
Seungha Yang
ac265bc4f9 d3d11overlaycompositor: Avoid heap allocation per upload
Don't allocate list per upload

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5580>
2023-11-01 15:41:08 +00:00
Seungha Yang
107edc0c07 d3d11videosink: Add redraw-on-update property
If users update geometry related properties very frequently
for a stream to be animated, redrawing on every update
can make rendering choppy or can be a performance bottleneck.
To address the issue, adding a property to control the behavior
of redrawing scene when geometry related properties are updated.

Also, do not resize swapchain on such property update, since
re-allocating backbuffer and multi-sampled render target is
unnecessary in that case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5575>
2023-10-30 11:15:35 +00:00
Seungha Yang
795e1bac34 d3d11videosink: Fix window switching in case of fullscreen mode
Other Windows applications allow window switching even when
an application window is in fullscreen mode. Also fixing
regression introduced in 15248d8b84
which makes restored window is always located at topmost
since we do not call SetWindowPos() anymore when restoring

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5574>
2023-10-29 22:45:17 +09:00
Seungha Yang
e7069984df d3d11videosink: Add sampling-method property
Identical to "method" property in d3d11convert element

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5572>
2023-10-28 23:12:30 +09:00
Seungha Yang
b16665dc75 d3d11convert: Add support for sampling with anisotropic filter
Anisotropic filtering might produce better quality than linear filtering

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5572>
2023-10-28 22:56:28 +09:00
Seungha Yang
af31b46992 d3d11convert: Add support for transform
Adding 3D rotation and scale transform support to d3d11convert element

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5572>
2023-10-28 22:12:17 +09:00
Seungha Yang
1813b4e3d9 d3d11: Move transform matrix related method to utils
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5572>
2023-10-28 22:12:17 +09:00
Seungha Yang
3a2a31d18b d3d11overlaycompositor: Set rasterizer state
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5572>
2023-10-28 22:12:17 +09:00
Seungha Yang
4dfdb6ec68 d3d11screencapturesrc: Set rasterizer state
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5572>
2023-10-28 22:12:17 +09:00
Seungha Yang
5389cc2cc3 d3d11compositor: Set rasterizer state
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5572>
2023-10-28 22:12:17 +09:00
Seungha Yang
1a82c9b9ab d3d11testsrc: Set rasterizer state
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5572>
2023-10-28 22:12:17 +09:00
Seungha Yang
e13612162b d3d11screencapturesrc: Use DirectXMath struct and C++ mutex
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5572>
2023-10-28 22:11:53 +09:00
Seungha Yang
63bb0b8de7 d3d11videosink: Add support for transform and MSAA
Adding properties for 3D rotation with arbitrary angle
and scaling. And adding Multi Sampling Anti-Aliasing rendering
support to smooth borders if arbitrary angle is applied

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5532>
2023-10-28 09:58:16 +00:00
Seungha Yang
0b45548f18 d3d11videosink: Fix typo
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5532>
2023-10-28 09:58:16 +00:00
Seungha Yang
745a73eece wasapi2: Don't use global volume control object
ISimpleAudioVolume controls volume of corresponding audio session
and there would be only single input/output audio session
in case of share-mode, which means that it controls audio volume of the
process. Instead, use IAudioStreamVolume interface which controls
volume of the stream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5549>
2023-10-27 18:11:51 +00:00
Seungha Yang
bdc0f177f0 d3d11screencapturesrc: Fix mouse cursor blending
Ignore alpha component of source (mouse cursor texture)
when blending alpha channel, otherwise the background area of source
(which has zeros) will be written to render target. Then it will result
in black rectangle if output texture is converted to premultiplied alpha
texture

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5566>
2023-10-27 16:33:04 +00:00
Sebastian Dröge
e6ff644bac aja: Move clang-format configuration from the top-level to the plugin subdirectory
This shouldn't have been left at the top-level but was forgotten to be
moved when merging the repository histories.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5558>
2023-10-27 11:44:36 +00:00
Sebastian Dröge
1b117e666b aja: Add basic documentation
Also remove the `gst-inspect-1.0` output from the README.md. This is
listed in the actual documentation and more up to date there.
2023-10-26 09:36:10 +03:00
Sebastian Dröge
59f4146bdc aja: Integrate AJA plugin into the build system
Co-Authored-By: Nirbheek Chauhan <nirbheek@centricular.com>
2023-10-26 09:36:09 +03:00
Sebastian Dröge
d2d947380e Merge AJA audio/video source/sink plugin
Original location is https://github.com/centricular/gst-aja
2023-10-26 09:35:52 +03:00
Sebastian Dröge
f1a1dadbf3 Prepare for merging into GStreamer 2023-10-26 09:27:46 +03:00
Seungha Yang
2aa841e74b mfvideoencoder: Fix typo in template caps
Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3058
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5554>
2023-10-25 23:19:51 +09:00
Adrien De Coninck
65365caa21 d3d11videosink: post "have-window-handle" element message on the bus
* when window_id is not user-provided and window_type==GST_D3D11_WINDOW_NATIVE_TYPE_HWND
* allows user to retrieve internally created window handle
  * for custom positionning
  * for custom icons
  * ...

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5544>
2023-10-24 16:32:36 +02:00
David Rosca
8aac08506a va: Use vaMapBuffer2
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5467>
2023-10-23 19:40:16 +00:00
Piotr Brzeziński
e79b308f82 vtdec: Fix deadlock when attempting to negotiate
This was wrongly calling the base class method, which unnecessairly took the stream lock, already taken by
handle_frame(). The drain() call in negotiate() would then wait for the output loop to pause, while that loop
is stuck waiting to take the stream lock, thus causing a deadlock.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5521>
2023-10-20 13:50:16 +02:00
Nicolas Dufresne
41f478e97d v4l2codecs: h265: Fix entry_point_offsets array leak
This array was being leaked.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5499>
2023-10-17 15:06:26 -04:00
Seungha Yang
e2790d635c d3d11screencapturesrc: Fix HWND capture mode
Use per-monitor-aware context to cover different DPI settings per
monitor

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2425
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5485>
2023-10-16 01:02:36 +09:00
Seungha Yang
c5d60cee01 d3d12decoder: Hide non-default device from docs
... and add since marker

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5481>
2023-10-14 12:32:46 +00:00
Seungha Yang
8a35c8a2a5 d3d11compositor: Fix typo in property description
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5481>
2023-10-14 12:32:46 +00:00
Seungha Yang
0a05ba3f62 nvencoder: Add support for new preset/tune/multi-pass options
Adding new P1 ~ P7 presets and deprecate old preset values.
Also adding tune and multi-pass properties.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5428>
2023-10-14 11:03:40 +00:00
Rahul T R
6fbe4d55c4 kmssink: Add TIDSS auto-detection
Add Texas Instruments TIDSS display controller into list of
auto-detected modules.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5469>
2023-10-12 18:25:50 +00:00
Seungha Yang
ed29c23e86 d3d12, dwrite, va: Fix various msys2 build error/warning
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5454>
2023-10-12 10:53:58 +00:00
Mengkejiergeli Ba
c14f4cda0c msdkvpp: Use filter flag to handle passthrough for tone mapping
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5449>
2023-10-12 05:02:37 +00:00
Seungha Yang
c2ed8759c8 d3d11videosink: Don't use DXGI_ALPHA_MODE_PREMULTIPLIED for HWND swapchain
It's allowed only for a swapchain type which does composition

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5464>
2023-10-11 22:22:56 +00:00
Seungha Yang
7b564619cf d3d11videosink: Fix rendering with initial fullscreen state
Change fullscreen mode once the swapchain is fully configured

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5462>
2023-10-11 21:39:11 +00:00
Seungha Yang
15248d8b84 d3d11videosink: Fix toggling between fullscreen and maximized
Use GetWindowPlacement() and SetWindowPlacement() APIs
to remember and restore window status, such as maximized, position,
restore position, etc.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3016
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5462>
2023-10-11 21:39:11 +00:00
Seungha Yang
f52ecb9607 d3d11converter: Add support for HLSL precompile and bytecode caching
Precompile pixel shaders for simple conversion path
(without gamma/primaries conversion) in case of MSVC build.
Even if runtime compile is required (cross-compiled or complex conversion
path), do it only once and reuse the compiled bytecode.

This precompile/caching can save about 95% of time taken by
gst_d3d11_converter_new() call.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3004
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5457>
2023-10-11 18:40:46 +00:00
Seungha Yang
83a576e854 d3d11: Reuse sampler object
The linear sampler object can be reused

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5457>
2023-10-11 18:40:46 +00:00
Seungha Yang
92cc5722c8 d3d11: Pass HLSL source size to compile function
The string size is known at build time

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5457>
2023-10-11 18:40:46 +00:00
Seungha Yang
bfdea297d2 d3d11converter: Set alpha-mode using config
... and disallow runtime alpha-mode update for now

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5457>
2023-10-11 18:40:46 +00:00
Seungha Yang
8fe26c8a10 d3d11: Simplify HLSL build
Unify source/header/entrypoint names

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5457>
2023-10-11 18:40:46 +00:00
Nicolas Dufresne
88fd9908fe v4l2codecs: Fix tiled formats stride conversion
While adding arbitrary tile support, a round up operation was badly
converter. This caused the Y component of the stride to be 0. This
eventually lead to a crash in glupoad preceded by the following
assertion.

  gst_gl_buffer_allocation_params_new: assertion 'alloc_size > 0' failed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5458>
2023-10-11 14:13:53 +00:00
Seungha Yang
3536b7f3a6 decklink: Fix broken COM string conversion
WideCharToMultiByte return is the string length without null terminate
character if passed "cchWideChar" does not include the null terminate
character size. Instead of passing the exact string length, pass -1 so that
the API can understand the input string is null terminated already and
returned value from the API includes the character.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3023
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5444>
2023-10-09 20:10:25 +09:00
Michael Tretter
c020dab393 uvcsink: use the pad's current caps to update caps_changed
The caps that were sent by the caps event can be retrieved from the sinkpad
using gst_pad_get_current_caps(). This is more reliable than using cur_caps as
we know exactly which caps upstream selected when the UVC host didn't select a
format, yet.

This further allows to simplify the check, if the uvcsink has to wait for the
caps event before switching to the internal v4l2sink.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Tretter
733b4d9597 uvcsink: use event function instead of probe
The probe passes all events except the EVENT_CAPS. Installing and removing the
probe doesn't provide any additional value.

Install an event function and always handle EVENT_CAPS. Use the caps_changed
field, to decide, if the element has to do anything special on a EVENT_CAPS.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Tretter
1732f8c728 uvcsink: refactor gst_uvc_sink_update_streaming
Move the sanity checks to the beginning of the function. Make the actual effect
of the function more obvious and reset the flags in the end.

This should make it easier to understand what this function is doing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Tretter
6637343980 uvcsink: extract helper function for updating the stream state
The uvcsink may switch to the v4l2sink after a STREAMON either on a caps event
or on a caps query.

Extract the code that handles the STREAMON into a helper function, as this is
the same code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Tretter
24daf9ea3d uvcsink: extract common code to reset caps_changed
The caps_changed flag must be reset for streamon and streamoff. Extract it to a
common path.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Tretter
a9eef25717 uvcsink: remove separate function for buffer probe installation
The probe that installs the buffer probe is already on the correct pad. There is
no need for a separate function to install the probe.

While at it, change the signature of the probe functions to GstPadProbeCallback
to avoid the cast when installing the probes.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Tretter
eac9f60608 uvcsink: extract common code in idle_probe
The RECONFIGURE event has to be sent in streamon and streamoff. Extract the
common code to a separate branch to make it easier to understand.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Tretter
69c5529011 uvcsink: return caps when reading the host configured caps
The uvcsink calculates the caps for the format that the UVC host selected. The
gst_uvc_sink_parse_cur_caps() sets these caps as cur_caps as a side effect. This
behavior is surprising as cur_caps is later updated to reflect the actually used
caps.

Just return the configured caps to avoid side effects. This makes the function
easier to understand. Update the function name to reflect the new behavior.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Grzeschik
17797d1d28 uvcsink: fix event peer probe
The only job of the event peer probe is to catch the upcoming caps event
and be able to react with the sink change. All other events that are
passing the pad shall be passed and ignored.

Since the probe is a blocking probe, there is no use in returning
with GST_PAD_PROBE_OK on other events. Otherwise the event would just
be blocked.

Since we are handling the probe removal of the probe already in the
event switch, we can remove the second explicit probe removal.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:23 +00:00
Michael Grzeschik
e3a121950b uvcsink: drop useless debug messages in peer event probe
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4994>
2023-10-06 15:55:22 +00:00
James Oliver
aeef97d81b nvh265encoder: fix bounds for auto-select GPU enumeration
Fixes the bounds-check for encoder auto-select GPU enumeration to be
between 0-7 instead of 0-6. This should allow 8-GPU machines to work
with nvautogpuh265enc for the last enumerated GPU.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5438>
2023-10-05 13:37:36 +08:00
James Oliver
54074af8ec nvh264encoder: fix bounds for auto-select GPU enumeration
Fixes the bounds-check for encoder auto-select GPU enumeration to be
between 0-7 instead of 0-6. This should allow 8-GPU machines to work
with nvautogpuh264enc for the last enumerated GPU.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5438>
2023-10-05 13:37:32 +08:00
Seungha Yang
cf1286b0e9 d3d11: Add support for HLSL precompile and shader caching
Compile HLSL at build time in case of MSVC, and use it if device
supports shader model 5. Also cache/reuse pixel shader and vertex
shader objects.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5426>
2023-10-03 09:42:03 +00:00
Seungha Yang
6fdcd07e59 d3d11testsrc: Use const buffer in shader
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5426>
2023-10-03 09:42:03 +00:00
Seungha Yang
2cd81eb1ac nvdecoder: Handle output surface alignment in decoder helper object
Output resolution might not be an even number. Set output resolution
without round up but consider the alignment inside of decoder

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5409>
2023-09-29 12:36:01 +00:00
Seungha Yang
42560c24df nvdecoder: Add support for D3D11 output
Since DXVA does not support some profiles such as HEVC RExt,
vendor specific decoding API is still required.
When decoder is negotiated with d3d11 caps, decoder will convert
semi-planar frame to planar since semi-planar format (e.g.,
DXGI_FORMAT_NV12) is not supported by CUDA/D3D11 interop.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5409>
2023-09-29 12:36:01 +00:00
Seungha Yang
57e0a0bd61 nvdecoder: Handle GstContext in helper object
... and move common code to helper object

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5409>
2023-09-29 12:36:01 +00:00
Seungha Yang
c818906236 cuda: Add support for I420_12LE format
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5409>
2023-09-29 12:36:01 +00:00
Piotr Brzeziński
85adc2daee vtdec: Handle output in separate thread
Moves outputting frames to a task on the source pad, bringing vtdec in line with vtenc.
This brings possible performance improvements thanks to decoupling queueing new frames from outputting processed ones.
The queue length is limited to `2*DBP` to prevent decoding too far ahead compared to what we're pushing downstream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5163>
2023-09-27 13:01:33 +00:00
Seungha Yang
a7353d8859 d3d11decoder: Fix crash on negotiate() when decoder is not configured
The negotiate() can be called by GstVideoDecoder baseclass on GAP event,
and decoder helper object might not be configured at the time
when negotiate() is called.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5394>
2023-09-27 01:15:26 +09:00
Seungha Yang
c5bd0faee3 nvdecoder: Add support for HEVC GBR output
... and use P012 format for 12bits instead of P016

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2991
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5375>
2023-09-23 13:12:56 +00:00
Seungha Yang
907c507680 nvh265encoder: Add support for RGB encoding
Adding GBR format support to nv{autogpu,cuda,d3d11}h265enc.
Note that the only difference between GBR and Y444 encoding
is matrix_coeffs value written in VUI.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5375>
2023-09-23 13:12:56 +00:00
Seungha Yang
a80f542f66 cuda: Add support for P012_LE and Y444/GBR high bitdepth formats
Adding P012, Y444_10, Y444_12, GBR_10, GBR_12 and GBR_16 formats support

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5375>
2023-09-23 13:12:55 +00:00
Tong Wu
57bfbf51b2 msdkvpp: fix an issue which causes dangling pointer
Put all the external buffer structures into thiz to avoid being freed
early.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5377>
2023-09-22 10:04:30 +08:00
Piotr Brzeziński
9cbe9a52fe vtenc: Fix deadlock after GST_FLOW_ERROR is received on frame push
This was easy to trigger when testing with e.g. vtenc ! vtdec ! glimagesink and closing the sink via window button,
causing GST_FLOW_ERROR to be received by the output loop, stopping it with the queue still full. This made the
enqueue_buffer() callback to lock waiting for space in our queue, while handle_frame() was waiting for the internal
VideoToolbox queue to free up, so that VTCompressionSessionEncodeFrame could finish. As the output loop was not
running, both functions waited forever.

Fixed by 1) immediately emptying our queue when GST_FLOW_ERROR is received (like we already did with _FLUSHING)
and 2) unconditionally setting the flushing flag in finish_encoding() when it sees the output loop stopped because
of GST_FLOW_ERROR, so that enqueue_buffer() will immediately discard any new frames coming out of VideoToolbox.
Both of those make sure we never run into the both-queues-full scenario.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5303>
2023-09-20 13:10:02 +00:00
Seungha Yang
d9a89cce06 d3d12decoder: Add support for D3D11 interop
As a short-term solution before full d3d12 rendering feature,
copy decoded d3d12 texture to shared d3d11 texture in order to use
existing various d3d11 implementations such as conversion, resizing,
and videosink.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5356>
2023-09-20 10:34:54 +00:00
Seungha Yang
bb040ce571 d3d12decoder: Move common part to helper object
Store device at helper object

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5356>
2023-09-20 10:34:54 +00:00
Seungha Yang
44b02e58fc d3d12fence: Check completed value before waiting
If currently completed fence value is larger than target value,
skip waiting.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5356>
2023-09-20 10:34:54 +00:00
Seungha Yang
39aca8a096 d3d11vp9dec: Fix critical warning
Don't query GPU vendor using null device.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5353>
2023-09-19 13:09:57 +00:00
Seungha Yang
e769ae3dbe d3d12decoder: Add support for d3d12 output
... and enable zero-copy decoding if downstream supports d3d12 memory

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5345>
2023-09-19 08:52:04 +00:00
Seungha Yang
ff7bde06f2 d3d12decoder: Use GstD3D12BufferPool
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5345>
2023-09-19 08:52:04 +00:00
Seungha Yang
884f4122b5 d3d12decoder: Use global copy queue and fence value
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5345>
2023-09-19 08:52:04 +00:00
Seungha Yang
1a7390c85c d3d12: Remove unused debug category
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5345>
2023-09-19 08:52:04 +00:00
Seungha Yang
6c9d023861 d3d12: Add d3d12download element
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5345>
2023-09-19 08:52:04 +00:00