Commit graph

575 commits

Author SHA1 Message Date
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 d1210d6dc0 vaallocator: use VADRMPRIMESurfaceDescriptor to create surfaces
To import DMAbufs we used VASurfaceAttribExternalBuffers which works, but it's
not specific for DRM PRIME 2, since it lacks of many metadata. This patch
replaces VASurfaceAttribExternalBuffers with VADRMPRIMESurfaceDescriptor in
va_create_surfaces().

Still, this patch assumes linear modifier only.

The hack for RGB surfaces in I965 driver was pushed down into
va_create_surfaces() to avoid handling both structures.

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
Víctor Manuel Jáquez Leal 2d358cb22a vaallocator: fix assumption object size equal fd size
Remove the comment and warning message that object size should be equal to the
file descriptor size.

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 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
Slava Andrejev 93b4272e6c meson: change Wayland scanner command from "code" to "private-code"
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5593>
2023-11-07 18:40:35 +00:00
Slava Andrejev cad42b0511 meson: add processing of "staging" Wayland protocols
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5593>
2023-11-07 18:40:35 +00:00
Slava Andrejev c48e96fd76 meson: prevent sandbox violation if GStreamer and wayland-protocols are subprojects
Suppose you have a project where GStreamer and wayland-protocols are
pulled in as dependencies via .wrap files. In that case, Meson's setup
step will fail for gst-plugins-bad with the message "Sandbox violation:
Tried to grab file viewporter.xml outside current (sub)project." To
avoid this exception, one should use Meson's `files` and `join_paths`
functions. The suggested solution is identical to how GTK 4 processes
Wayland files.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5593>
2023-11-07 18:40:35 +00:00
Balló György 6f8b9574f2 gstwayland: Don't depend on wayland-protocols
wayland-protocols are needed to build gstwayland, but not for dependent projects.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4724>
2023-11-07 17:52: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
Xavier Claessens 7df22b338b GstShmAllocator: New shared memory allocator
This makes Wayland's allocator public. It is generally useful to have a
shared memory allocator that can create memfd on Linux.

Sponsored-by: Netflix Inc.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5328>
2023-11-03 18:22:00 +00:00
Seungha Yang bf05cfea45 d3d11: 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 0e9fdabb1b d3d11converter: Simplify private struct ctor
Initialize transform matrix using memcpy

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5580>
2023-11-01 15:41:08 +00:00
Seungha Yang e134cd8e09 d3d11device: Store device formats in hash map
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5580>
2023-11-01 15:41:08 +00:00
Seungha Yang 443f205c38 d3d11converter: Don't update vertex buffer on transform matrix change
Transform matrix change requires only constant buffer update

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5575>
2023-10-30 11:15:35 +00:00
Seungha Yang f32bb06e32 d3d11converter: Fallback to linear sampler if filter is not supported
Use linear sampler if requested filter is not supported

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5572>
2023-10-29 01:07:45 +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 5f44390b3e d3d11converter: Reuse rasterizer state object
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5572>
2023-10-28 22:12:17 +09:00
Seungha Yang b7c49f8e9f d3d11converter: Add support for MSAA render target
Create multi-sample render target view if sample count > 1
and MSAA enabled rasterizer for multi-sample render target

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5532>
2023-10-28 09:58:16 +00:00
Seungha Yang eac65d248a d3d11converter: Add support for custom transform matrix
Adding gst_d3d11_converter_set_transform_matrix() method so that
user specified transform matrix can be applied when "video-direction=custom"

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5532>
2023-10-28 09:58:16 +00:00
Seungha Yang 769c6a62a4 d3d11converter: Use transform matrix for rotation/flip
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5532>
2023-10-28 09:58:16 +00:00
Matthew Waters d20d94cc48 vkformat: also use the correct srgb vs unorm when using older
gst_video_info_from_video_info()

Fixes sRGB colorspace chosen by GstVulkanSwapper and therefore used for
display.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5316>
2023-10-27 09:13:18 +00:00
Víctor Manuel Jáquez Leal ce91004c3b build: opencv: disable opencv deps if it's not installed
When hotdoc documentation is enabled and opencv plugin is set as
auto-detected, but the library isn't installed, meson configuration fails
with this message:

  ../subprojects/gst-plugins-bad/docs/meson.build:139:21: ERROR: Unknown variable "gstopencv_dep".

This patch fixes this case defined gstopencv_dep as disabler() when
dependencies aren't found.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5560>
2023-10-26 20:43:14 +00:00
Mengkejiergeli Ba 38e8896887 vaallocator: Do not try derive image for d3d backend
Current codes try derive image in _update_image_info first, if
derive returns no error, the va_allocator->info is the one from derived
image, but in va_map_unlocked, we disable derive manner for d3d backend
because it doesn't seem to work, this will cause issue for d3d path,
i.e. possibly using derived info in va_get_image to do mapping...
This patch disables derive image for d3d backend in _update_image_info,
to ensure we only use info from va_create_image for d3d path.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5495>
2023-10-26 16:08:10 +00:00
Víctor Manuel Jáquez Leal a2f875251f vkimagebufferpool: use GstVulkanOperation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5079>
2023-10-26 07:26:23 +00:00
Víctor Manuel Jáquez Leal 265f1274dc vkoperation: synchronization helper object
An operation is an arbitrary amount of work to be executed on the host, a
device, or an external entity such as a presentation engine.

The purpose of this object is to help on the operation's synchronization
through declaring explicit execution dependencies, and memory dependencies
between two sets of operations defined by the command’s two synchronization
scopes.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5079>
2023-10-26 07:26:22 +00:00
Víctor Manuel Jáquez Leal c83c508c5e vulkan: add a timeline semaphore per image
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5079>
2023-10-26 07:26:22 +00:00
Víctor Manuel Jáquez Leal 964aec54b4 vkbarrier: Use guint64 for VkFlags and VkFlags2
While VkPipelineStageFlags is an enum (arguably backed as uint32 in 32bit
platforms), VkPipelineStageFlags2 is a redefinition of guint64; likewise for
VkAccessFlags and VkAccessFlags2.

This patch types both members in GstVulkanBarrierMemoryInfo as guint64 for
compatibility, so it could be used with or without synchronization2 vulkan
extension.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5079>
2023-10-26 07:26:22 +00:00
Víctor Manuel Jáquez Leal 8809ce5648 vkmemory: unref queue in barriers
Queue might be assigned for queue transfers, so we need to unref it if the
memory has been assigned to a specific queue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5079>
2023-10-26 07:26:22 +00:00
Víctor Manuel Jáquez Leal 5acd6c23b8 vkdevice: use macro VK_KHR_synchronization2 as guard
Instead of (defined(VK_VERSION_1_3) || (defined(VK_VERSION_1_2) && VK_HEADER_VERSION >= 170))

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5079>
2023-10-26 07:26:22 +00:00
Jordan Petridis 67475fa684 opencv: move the dependency check to a single place
Previously we were checking for opencv dep in 2 different places,
and the checks would vary in terms of how complex and exhaustive
they were.

Move the check into the libs module and reuse the result later on.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3016>
2023-10-26 00:01:23 +00:00
Matthew Waters 48ab457d79 vulkan/physical-device: don't assume that queue_family_ops is filled
On old enough vulkan (< 1.2), we will never retrieve the family operations and
will perform a NULL pointer dereference when dumping the queue family op
properties.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5547>
2023-10-25 16:38:06 +11: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
Jordan Petridis 9f3b8c9366 vkwindow_xcb: Make the visible private field a guint
This field is used to store gbooleans (which are ints) but if it's
a :1 bit depth assigning ints to it changes it's value as the only
valid values are -1 and 0.

Make it a guint instead so the cast would be correct.

```
../subprojects/gst-plugins-bad/gst-libs/gst/vulkan/xcb/gstvkwindow_xcb.c:151:25: error:
implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1
[-Werror,-Wsingle-bit-bitfield-constant-conversion]
    window_xcb->visible = TRUE;
```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5432>
2023-10-23 10:43:52 +05:30
Detlev Casanova 5f9b24e3ba codecs: h265: Do not free slice header before using it
The v4l2codecs H.265 decoder uses the
GstH265SliceHdr::entry_point_offset_minus1 array so make sure that it is not
freed before decoding the frame.

Before this patch, some H.265 input would segfault in
gst_v4l2_codec_h265_dec_fill_slice_params() when executing the line:

guint32 entry_point_offset = slice_hdr->entry_point_offset_minus1[i] + 1;

Make sure that the array is not freed before using it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5499>
2023-10-17 15:06:10 -04:00
Seungha Yang 269ab85881 d3d11converter: Fix deadlock on taking property mutex
SRWLOCK should be zero initialized, but since we changed the private
struct to C++, use C++ mutex instead.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5498>
2023-10-17 12:50:55 +00:00
Seungha Yang 65aa1b8faa d3d11converter: Create ID3D11Buffer with initial data
... and remove unnecessary device lock

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5492>
2023-10-17 10:48:49 +00:00
Seungha Yang 4e3d87edf5 d3d11converter: Don't set unnecessary constant buffer
Skip PSSetConstantBuffers() if it's not used by pixel shader

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5492>
2023-10-17 10:48:49 +00:00
Seungha Yang 66bb9ee866 d3d11converter: Update shader code to make 4_0_level_9_1 compatible
4_0_level_9_1 target requires float4 SV_TARGET

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5483>
2023-10-15 19:02:24 +09:00
Seungha Yang a35c4fd5c5 d3d11converter: Fix 10/12bits planar output
Simple division can result in 10/12bits overflow.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5483>
2023-10-15 01:47:29 +09:00
Seungha Yang 5ea1f8a548 d3d11converter: Print calculated matrix for debugging
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5483>
2023-10-15 00:27:27 +09:00
Seungha Yang ba02e94dde d3d11converter: Calculate gamma LUT only once
Reuse calculated gamma lookup table and use immutable 1D texture

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5482>
2023-10-14 13:37:08 +00:00
Seungha Yang 6f8c474293 d3d11converter: Remove unused variable
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5482>
2023-10-14 13:37:08 +00:00
Seungha Yang 347dd37225 dxva: Build gir and remove SDK header dependency
Build gir for documentation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5481>
2023-10-14 12:32:46 +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
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