Commit graph

900 commits

Author SHA1 Message Date
Olivier Crête
7a14b48dad analytics: Add missing documentation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6253>
2024-03-04 17:33:00 +00:00
Olivier Crête
0aecef9b63 analytics: Fix various typos in the documentation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6253>
2024-03-04 09:59:12 -05:00
Seungha Yang
d0713e029c d3d11memory, d3d12memory: Fix outstanding memory count tracing
Gets being released memory back to queue even if allocator is flushing
in order to count the number of outstanding memory objects.
Also, clear queue if there's no outstanding memory object and
allocator is flushing

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6240>
2024-02-29 11:57:50 +00:00
Seungha Yang
f77f3e83ed cudamemory: Fix outstanding memory count tracing
Gets being released memory back to queue even if allocator is flushing
in order to count the number of outstanding memory objects.
And fixing double count increment

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6240>
2024-02-29 11:57:50 +00:00
Damian Hobson-Garcia
dd8ef3ec1b waylandsink: Move buffer commits to the display thread
Syncrhonizing buffer commits to the streaming thread can lead to
dropped frames when frame callbacks are not processed before the
next frame is ready for rendering.  Depending on the drift between
the wayland compositor and buffer source timings, this can lead to
periods of significant frame drop, especially when the media frame
rate is close to the display frame rate.

Cache buffers in the streaming thread and peform commits on the
display thread to eliminate the buffer commit racing.

The implementation is the same for both waylandsink and gtkwaylandsink,
so move it to the common wayland library under gst-lib.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6133>
2024-02-27 17:20:42 +00:00
Damian Hobson-Garcia
612ee3b591 wayland: Add API to ref/unref current GstBuffer inside a GstWlBuffer
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6133>
2024-02-27 17:20:42 +00:00
Damian Hobson-Garcia
1b3bb334eb wayland: Add synchronized requests to WlDisplay
Add synchonized versions of wl_display_sync() and wl_callback_destroy()
that will ensure that to callbacks can be managed in a thread safe way
on the display queue even when they are dispatched from a separate
thread.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6133>
2024-02-27 17:20:42 +00:00
naglis
476a34cfdb gstplay: Fix typos in documentation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6177>
2024-02-23 00:35:58 +00:00
ekwange
0cbb396ab9 mse: Add logging init for mediasource sample map
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6033>
2024-02-21 18:11:25 +00:00
Edward Hervey
62b9049d20 mpegst: Fix ownership of return value
This inherits from the same rule as gst_buffer_add_meta

```
gst-mpegtspesmetadatameta.h:98: Warning: GstMpegts:
gst_buffer_add_mpegts_pes_metadata_meta: return value: Invalid non-constant
return of bare structure or union; register as boxed type or (skip)
```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6146>
2024-02-20 11:33:33 +02:00
Edward Hervey
d26194db0e libgstplay: Use playbin3 by default
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6120>
2024-02-15 09:00:45 +01:00
Seungha Yang
d98c922995 h265decoder: Fix DPB size calculation
MaxDpbSize specified in A.4.2 tells upper bound of decoded picture
buffer size but does not tell actual required size.
Use max_dec_pic_buffering value as a dpb size. Some backends
such as DXVA and NVDEC might require pre-allocated DPB buffer
and unnecessary large DPB size will result in waste of GPU memory.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6101>
2024-02-14 15:05:59 +00:00
Víctor Manuel Jáquez Leal
2011dec249 vulkan/decoder: fix documentation generation
GstVulkanDecoderParameters is an union, not a struct, and that isn't handled by
hotdoc.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6089>
2024-02-10 17:17:23 +00:00
Víctor Manuel Jáquez Leal
f0c5a853a6 vulkan/decoder: don't initialize function table once
Since it has to be associated with the device and it gets destroyed when the
decoder is freed.

Now it's created when the decoder starts and it's flagged.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6089>
2024-02-10 17:17:23 +00:00
Seungha Yang
b3a29b61c5 dxvavp8decoder: Fix reference frame setting
Fixing typo

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6088>
2024-02-10 21:18:44 +09:00
Sebastian Dröge
77a09c1781 analytics: Allow getting a related meta with ANY type
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6068>
2024-02-07 14:07:52 +00:00
Tim-Philipp Müller
f1940077a2 codecparsers: av1bitwriter: fix Since marker
... and add them to the symbol index to make hotdoc happy
2024-02-06 16:37:13 +00:00
Tim-Philipp Müller
6651bb3ed8 codecparsers: document new GstH265Level and GstH264Level enums
... and add them to the symbol index to make hotdoc happy.
2024-02-06 16:37:13 +00:00
Tim-Philipp Müller
b9b249be48 va: fix g-i annotation
This parameter annotation is unknown :[allow-null-none] None
2024-02-06 16:37:12 +00:00
sergey radionov
ebc51e3253 nice: resolve result should go to nice helper thread
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5921>
2024-02-06 09:12:13 +00:00
Olivier Crête
351f823704 analytics: Always return a string from mtd_type_get_name()
It makes it easier to use in printf() style strings without worrying
about getting a NULL.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6035>
2024-02-02 15:49:56 +00:00
Daniel Morin
8122f623f6 analytics: Change indexes type from i32 -> gsize
- gst_analytics_cls_mtd_get_length() return a gsize, this type dicated index
  type for gst_analytics_cls_mtd_get_quark() and
  gst_analytics_cls_mtd_get_level().
- Minor cleanup/improvement on index validation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6018>
2024-01-31 15:22:43 +00:00
Daniel Morin
42227d7de3 analytics: add api on OD to retrieve bbox confidence
- Add a specific api to retrieve bbox confidence level without having to
  retrieve it's location.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6017>
2024-01-31 14:40:56 +00:00
Seungha Yang
51162acc31 cuda: Report device open error
Call gst_cuda_result() with CUDA_ERROR_NO_DEVICE error code if
we could not open device, so that application can catch the error

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6006>
2024-01-30 14:30:41 +00:00
Seungha Yang
cd6d62ddf0 cuda: Use cuStreamDestroy_v2 API
Sync up with CUDA 11.x/12.0 header

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6006>
2024-01-30 14:30:41 +00:00
Víctor Manuel Jáquez Leal
c760c72f7a vkformat: fetch correctly feature flags2
Feature flags2 are fetch through VkFormatProperties3KHR and needs more guards
checking.

Moved out all the feature flags fetching to another function for clarity.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6014>
2024-01-30 12:57:41 +00:00
Víctor Manuel Jáquez Leal
c24b47ecee vkformat: use VK_KHR_get_physical_device_properties2 to guard
and VK_KHR_format_feature_flags2 rather than a meaningless version handling.

Also the patch brings back the usage of features2 for video extensions, use KHR
version to support the guarded symbols.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6014>
2024-01-30 12:57:41 +00:00
Víctor Manuel Jáquez Leal
394aaa6a59 vulkan: early return if gst_buffer_pool_set_config() fails
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6013>
2024-01-30 11:58:04 +00:00
He Junyan
040042113e codecparsers: Implement the AV1 bit code writer
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3015>
2024-01-30 08:24:25 +00:00
He Junyan
e1d96d0669 codecparsers: av1: add ref_global_motion_params in frame header
In order to ease the AV1 bit writer to write the global_motion_params
when primary_ref_frame is enabled, we need to add this field to set
the global_motion_params of the reference frame.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3015>
2024-01-30 08:24:25 +00:00
He Junyan
14a5d936f8 codecparsers: av1: add expected_frame_id in frame header
We need it to ease the bit code writing of AV1 frame header.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3015>
2024-01-30 08:24:25 +00:00
Robert Mader
9ee58825cc vaallocator: Allow non-linear modifiers for dummy mem_maps
A client may map dmabufs without the intention to either read or write
to the memory. One example is clients wanting to use the
`gst_video_frame_map()` helper function.

Thus, in order to make buffers from `GstVaDmabufAllocator` conveniently
usable, ignore the modifier check if the client specified neither
`GST_MAP_READ` nor `GST_MAP_WRITE`.

Also skip the `va_sync_surface()` call in that case, as it's likely only
needed for CPU reads/writes.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5965>
2024-01-29 17:10:50 +00:00
Nicolas Dufresne
0b38cb2320 vulkan: Fix clang compiler warning
clang does not like the array index assignment without the `=` sign in
it. This is a gnu extension I believe, and adding the sign is proper.
This fixes the following two warnings:

```
../subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkvideo-private.c:32:40:
warning: use of GNU 'missing =' extension in designator [-Wgnu-designator]
  [GST_VK_VIDEO_EXTENSION_DECODE_H264] {
                                       ^
                                       =
../subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkvideo-private.c:36:40:
warning: use of GNU 'missing =' extension in designator [-Wgnu-designator]
  [GST_VK_VIDEO_EXTENSION_DECODE_H265] {
                                       ^
                                       =
```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5996>
2024-01-26 16:42:30 +00:00
Seungha Yang
3855646f1d d3d12: Add MPEG-2 decoder
Most of code additions are just gluing already implemented
GstDxva and GstD3D12Decoder interfaces

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5979>
2024-01-25 11:45:23 +00:00
Stéphane Cerveau
dd6fca1d02 vulkan video: add GST_VK_VIDEO_EXTENSIONS enum
To avoid using mysterious value, use an enum to
show the valid value in _vk_codec_extensions

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5922>
2024-01-24 17:00:47 +00:00
Matthew Waters
f50b43c83b vulkan/format: also get features in the fallback case
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5576>
2024-01-24 13:54:41 +00:00
Matthew Waters
634fc913a6 vulkan/format: don't assign an uneeded boolean
We don't actually need the basics_primary/secondary boolean.  The
returned format is decided by the requested usage with fallbacks as
necessary.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5576>
2024-01-24 13:54:41 +00:00
Matthew Waters
420548a6c6 vulkan/format: there is no current need to use the 64-bit feature flags
All of our feature flags are currently covered by the first
VkFormatFeatureFlag enum so far.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5576>
2024-01-24 13:54:41 +00:00
Matthew Waters
080b25cbfe vulkan/format: correct fallback features in from_video_info_2
The features were not actually used and were written into a boolean
value.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5576>
2024-01-24 13:54:41 +00:00
Seungha Yang
f368d63ecd av1parser: Fix potential stack overflow during tile list parsing
The tile_count_minus_1 must be less than or equal to 511 as specified
in spec "6.11.1 General tile list OBU semantics"

Fixes #3214 / CVE-2024-0444 / ZDI-CAN-22873

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5970>
2024-01-24 12:29:12 +00:00
Daniel Stone
da9d4225b1 wayland: Actually use wayland-protocols version dep
Closes: #3242
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5962>
2024-01-23 13:11:23 +00:00
Daniel Stone
3a37778f69 gstwayland: Support wp_single_pixel_buffer_v1
This protocol does what it says on the box, avoiding the need for a 1x1
wl_shm buffer.

A wayland-projects wrap has been added for users who do not have v1.26
available.

This commit was partly authored by Robert Mader.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2662>
2024-01-22 16:51:36 -05:00
Seungha Yang
e353fe8fcc h264decoder: Handle malformed avc/avc3 packets
Packetized stream format should not contain start-code prefix
in bitstream and each [nal-length-byte, nal-byte] unit should consist of
single nal unit. But there are malformed streams in the world.
Use newly added gst_h264_parser_identify_and_split_nalu_avc()
method to identify each nal unit.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3219
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5772>
2024-01-17 14:57:57 +00:00
Seungha Yang
c737799900 h264parser: Add gst_h264_parser_identify_and_split_nalu_avc() method
Equivalent to _split_nalu_hevc() method in h265parser. This method
will scan start-code prefix and split into individual NAL units
if start-code prefix is detected

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5772>
2024-01-17 14:57:57 +00:00
Chris Spencer
2388932767 vkmemory: don't map memory more than once
vkMapMemory may not be called on a memory object that is already
host-mapped. If the gstreamer memory object is mapped more than once then
reuse the existing Vulkan mapping.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5917>
2024-01-16 17:44:48 +01:00
Chris Spencer
865227b750 vkimagebufferpool: allow specifying initial image layout
The pool currently defaults to performing a layout transition to
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, with some special exceptions for
video usages. This may not be a legal transition depending on the usage.
Provide an API to explicitly control the initial image layout.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5881>
2024-01-13 05:54:00 +00:00
Scott Moreau
f0d15f335d gst-launch: accept option to set program name
The option --prog-name="PROGRAM-NAME" can be passed to set the program name.
The program name is used by gtk and gstreamer to set the class or app-id.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5263>
2024-01-12 17:11:11 +00:00
Stéphane Cerveau
f337d37d6d codecparsers: add slice type name for h265
Add a method to convert the slice type to a descriptive
name.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5908>
2024-01-11 13:17:43 +01:00
Stéphane Cerveau
9c250179c6 codecparsers: add helper methods for h264
Add two helper methods to convert profile
and slice types

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5908>
2024-01-11 13:17:43 +01:00
Olivier Crête
745197d386 analytics: Implement scale meta transform for Object detection meta
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5863>
2024-01-10 18:35:17 -05:00
Olivier Crête
5d3035553c analytics: Replace type quark with opaque struct pointer
This way, we can add function pointers in there for things like
transformations.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5863>
2024-01-10 18:34:53 -05:00
Olivier Crête
91815710dd analyticsmeta: Make the GstAnalyticsRelatableMtdData struct private
Only ask the subclass about how much space they need, this way we can keep
the allocation details more private.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5863>
2024-01-10 18:19:38 -05:00
Stéphane Cerveau
476c7efcb7 vulkan: decoder: create union for profile usage
As a profile can include a VkVideoDecodeUsageInfoKHR
or VkVideoEncodeUsageInfoKHR, use union to separate the both.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5701>
2024-01-10 17:15:12 +00:00
Stéphane Cerveau
97ebaa0bc1 gstutils: add gst_util_ceil_log2
Move ceil_log2 from nalutils.* to gstutils.*

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5888>
2024-01-09 15:34:10 +00:00
Seungha Yang
abe1f5044d cuda: Prefer CUBIN over PTX
System installed NVRTC library might be newer version than
driver, then generate PTX can be incompatible with the driver.
Instead of the intermediate code PTX, use actual assembly code
directly.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3108
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5639>
2024-01-02 10:10:09 +00:00
Olivier Crête
f5d5f2cf1a meta: Add API to register metas in two steps
And also remove the specific registration APIs for
serializable meta.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5830>
2023-12-19 22:41:31 +00:00
Olivier Crête
2a9c4e3270 meta: Move the clear operation to its own vfunc
Some transforms always assumed that the transformation was some kind
of copy. So adding a "clear" operation didn't work out in practice.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5830>
2023-12-19 22:41:31 +00:00
Philippe Normand
61d3f5c8e0 play: Include pipeline dump in error details structure
This can be useful for debugging purposes. It can't be done on application side
because the on_error callback tears down the pipeline.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5828>
2023-12-18 20:13:38 +00:00
Philippe Normand
c6c567e3e4 play: Fix error details parsing
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5828>
2023-12-18 20:13:38 +00:00
Seungha Yang
890d59e97e av1parser: Fix array sizes in scalability structure
Since the AV1 specification is not explicitly mentioning about
the array size bounds, array sizes in scalability structure
should be defined as possible maximum sizes that can have.

Also, this commit removes GST_AV1_MAX_SPATIAL_LAYERS define from
public header which is API break but the define is misleading
and this patch is introducing ABI break already

ZDI-CAN-22300

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5823>
2023-12-18 10:58:24 +00:00
Daniel Morin
49f200cb54 h264parse: Improved AU boundary detection
- AU boundary detection reviewed to follow more closely H.264 spec. and more
  specifically clauses 7.4.1.2.3 and 7.4.1.2.4.
- The gist of the changes is a look-a-head in then next AU required identify the
  last vcl-nal of current AU and firt vcl-nal of next AU (according to
  7.4.1.2.4) followed by the identification of the first nal of next AU
  (according to 7.4.1.2.3).
- A backlog of all nals of current AU and next AU up to the point where current
  AU can identified completed is kept.
- In NAL alignement mode vcl-nal are sent immediatly but the history is kept to
  allow AU boundary detection. Non-vcl-nal can be delayed up to the reception of
  the next vcl-nal to allow a correct AUD insertion.
- Based on this improved AU boudary detection we can avoid erronous AUD
  insertion, like the one highlighted by test
  test_parse_sliced_with_prefix_and_sei_nal_au.
- Add support for MVC AU boundary detection. (H.7.4.1.2.4)
- Explicitly report SVC not supported. We don't have the SVC NAL parsing
  required to identify boundary. (missing dependency_id and quality_id fields
  from SVC, see G.7.4.1.2.4)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5741>
2023-12-17 21:42:47 +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
Víctor Manuel Jáquez Leal
f413714b37 vaallocator: use gst_va_display_check_version()
Instead of the local method to parse the vendor string.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5800>
2023-12-13 09:12:28 +00:00
Víctor Manuel Jáquez Leal
8574bb8914 vadisplay: add gst_va_display_check_version()
This function compares the driver version with the user provided one to check if
driver's is equal or bigger.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5800>
2023-12-13 09:12:28 +00:00
Víctor Manuel Jáquez Leal
94e6a6e3de vaallocator: clean up use derived feature
Remove allocator member variable for use derived feature which doesn't need to be kept,
it's just for configuration purposes.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5799>
2023-12-12 18:39:49 +01:00
He Junyan
fac9fb2174 codecs: correct the print log for h265 picture getting by poc
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5789>
2023-12-11 10:24:34 +00:00
Jordan Petridis
30c968f0ee build/mse: Add the enum sources to the test gstmse_private_test_dep
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5763>
2023-12-11 06:39:29 +00:00
Víctor Manuel Jáquez Leal
7332eb6427 vaallocator: force non-derived for old mesa drivers
Mesa <23.3 can't map derived images for P010 format. This patch forces
non-derived if this is the case.

See: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24381
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5760>
2023-12-07 10:42:50 +00:00
Víctor Manuel Jáquez Leal
ddf6fd9c61 va: check surface status before get derive image
According with documentation the surface has to be in ready state before getting
it derived image. This patch adds that check.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5760>
2023-12-07 10:42:50 +00:00
Víctor Manuel Jáquez Leal
6b1fba14bf vaallocator: remove runtime mapping selection
The original idea was to select the type of mapping (either using derive images
or downloading the image) in runtime, under the assumption that both methods
shared the same memory layout (offsets and strides), because a single
GstVideoMeta is assigned by the buffer pool at allocation time. Nonetheless, in
recent hardware this assumption is invalid, raising memory access errors.

This patch removes completely the mapping type selection at runtime, using the
method selected when the allocator is configured, synced with the bufferpool
allocation.

This problem was fixed originally for iHD driver only. But now it makes sense to
remove all of it.

Original-patch-by: Mengkejiergeli Ba <mengkejiergeli.ba@intel.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5760>
2023-12-07 10:42:50 +00:00
Víctor Manuel Jáquez Leal
90af9b7704 vaallocator: don't fail if drm fourcc are different
When exporting a DMABuf from a VASurface the user might tell that the surface
was allocated with certain fourcc, but the returned VADRMPRIMESurfaceDescriptor
migth tell a different fourcc, as in the case or radeonsi driver, for duplicated
fourcc, such as YUY2 and YUYV.

Originally it was supposed to be a failed exportation. This patch relax this
validation by allowing different fourcc.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5760>
2023-12-07 10:42:50 +00:00
Daniel Morin
4425562661 analytics: fix analytics-meta re-use
- Fix alignment error when source and destination analytics-meta have the same
  relation order.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5767>
2023-12-06 18:25:16 +00:00
Daniel Morin
aaee569087 analytics: replace id type from gint to guint
- Replace all id type from gint to guint
- Fix annotation for GstAnalyticsODMtdData

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5758>
2023-12-04 10:14:59 -05:00
Seungha Yang
801492b334 d3d11: Add RBGA format support
Allocates DXGI_FORMAT_AYUV texture for RBGA so that it can be used
by video decoders.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5703>
2023-11-29 16:54:16 +00:00
Benjamin Gaignard
cd14b0892e codecparsers: av1: Clip max tile rows and cols values
Clip tile rows and cols to 64 as describe in AV1 specification
to avoid writing outside array range but preserve sb_cols
and sb_rows value which are used to futher computation.

Fixes ZDI-CAN-22226 / CVE-2023-44429

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5702>
2023-11-29 15:48:50 +00:00
Benjamin Gaignard
f525de6d00 Revert "codecparsers: av1: Clip max tile rows and cols values"
This reverts commit b76a801f57.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5702>
2023-11-29 15:48:50 +00:00
Seungha Yang
ccf6ac2b4c h264decoder: Fix GstVideoCodecFrame leak
If current buffer has no slice data, frame should be released.
Otherwise frames will stay in decoder baseclass forever.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5693>
2023-11-29 10:52:58 +00:00
Seungha Yang
6992e14eee d3d11: Fix string version shader code
RGBA to BGRA conversion code should have written in compute
shader.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5723>
2023-11-28 21:02:44 +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
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
df0e6c4140 d3d11converter: Do not use R32_UINT UAV
It does not work well with YUY2 texture on some GPUs. Always use
the same DXGI formats for each SRV and UAV

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5709>
2023-11-25 20:27:43 +09:00
Seungha Yang
030800905b d3d11device: Remove outdated comment
We do support 4:2:2 YUV formats using compute shader now

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
Stéphane Cerveau
15b719d7f6 vkbufferpool: add support for video encoded buffers
Add support for non video raw  buffers to allocate memory
such as in encoded content scenario.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5645>
2023-11-21 19:16:37 +00:00
Stéphane Cerveau
c6a5437e0d vkbufferpool: allow to set allocation params
Add the possibility to change the vulkan usage and mem properties from
external source.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5645>
2023-11-21 19:16:37 +00:00
Daniel Morin
d23a90cb16 analytics: base class for analytics meta
- GstAnalyticRelationMeta is a base class for analytics
  meta. It's able to store analytics results (GstAnalyticRelatableMtd)
  and describe the relation between each analysis results.
- GstAnalysisRelationMeta also contain an algorithm able to explore
  analysis results relation using a bfs.
- Relation(edge) between analysis results (vertice) are stored in an adjacency-matrix
  that allow to quickly identify if two analysis results are related and by
  which relation they related. It also work for indirect relation
  and can provide the path of analysis results by which two
  analysis results are related.
- One allocation per buffer to store analysis results. Here we rely on
  the application to guess how much space will be required to store all
  analysis results. This is something that could be improved
  significantly but it's a starting point.
- Define common analysis results, classification, object-detection,
  tracking that are subclass of GstAnalyticRelatableMtd. The also
  provide exemple of how to extend GstAnalyticRelatableMtd to have them
  benefit for the mechanim to express relation with other analysis
  results.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4962>
2023-11-21 18:04:53 +00:00
Stéphane Cerveau
159f24c07f vulkan: use gst_vulkan_device_select_queue
Use gst_vulkan_device_select_queue api to retrieve a valid queue
in vkupload, vkdownload, vkimagebufferpool, and vkvideofilter

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5656>
2023-11-21 13:51:21 +00:00
Stéphane Cerveau
74c6298eb7 vkdevice: select queue with expected flags
Allow to select a queue with the given flags
such as compute bit etc from a given device.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5656>
2023-11-21 13:51:21 +00:00
Nirbheek Chauhan
ec3962f9c7 directxmath.wrap: Fix cpuid mismatch on MinGW
This fixes a build failure with meson 1.3.0, which was caused by
a bugfix in Meson that made the cc.compile() check succeed on MSYS2
MinGW and enable DirectXMath SIMD, which in turn triggered the broken
`__cpuid()` issue mentioned in the meson.build file.

Upstream fix: https://github.com/microsoft/DirectXMath/pull/172

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5690>
2023-11-20 20:08:57 +00:00
Nirbheek Chauhan
f65d074354 meson: Rework d3d11 checks, add new d3d11-math option
This allows us to ensure that directxmath SIMD is enabled.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5690>
2023-11-20 18:49:13 +00:00
Seungha Yang
b42b45af46 d3d11: Add Y412 format support
It's mapped to DXGI_FORMAT_Y416 and major format for 12bits 4:4:4
video decoding. Since DXGI_FORMAT_Y416 format cannot be a render target,
adding corresponding compute shader code too.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5692>
2023-11-21 02:40:10 +09:00
Víctor Manuel Jáquez Leal
5bece78ca2 vkqueue: add decoder factory
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:20 +00:00
Víctor Manuel Jáquez Leal
4f475732bd vkdecoder: add gstvkdecoder helper object
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:20 +00:00
Víctor Manuel Jáquez Leal
8ee3ec105c vkvideo-private: video structures and session handle
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:20 +00:00
Stéphane Cerveau
96daac8ac7 vkvideoutils: add GstVulkanVideoOperation enum
To differentiate a video/x-h264 caps use with a decoder or an encoder
and get the correct video profile, the API expects an enum
GstVulkanVideoOperation to handle this difference.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:20 +00:00
Víctor Manuel Jáquez Leal
8ee0f04d8d vkvideoutils: add dec postfix to profiles
So it the future don't collide with encoding profiles.

Original-patch-by: Stéphane Cerveau <scerveau@igalia.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:20 +00:00
Víctor Manuel Jáquez Leal
bf7a01f3fd vkvideoutils: add video capabilities structure
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:19 +00:00
Víctor Manuel Jáquez Leal
8023e3c19a vkvideoutils: add gst_vulkan_video_profile_is_equal()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:19 +00:00
Víctor Manuel Jáquez Leal
13d78652b7 vkvideoutils: add gst_vulkan_video_profile_is_valid()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:19 +00:00
Víctor Manuel Jáquez Leal
f896e2a347 vkvideoutils: add VkVideoDecodeUsageInfoKHR in profile
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:19 +00:00
Víctor Manuel Jáquez Leal
fd1b1332b7 vkvideoutils: if unknown codec nullify pNext
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:19 +00:00
Víctor Manuel Jáquez Leal
d5036e4429 vkvideoutils: mark as private members of profile structure
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:19 +00:00
Víctor Manuel Jáquez Leal
e3054056ff vkimagebufferpool: set image's number of layers
Handle the image's number of layers as configuration so it can be set by the
user, still isn't exposed as function since it's very niche.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:19 +00:00
Stéphane Cerveau
d52d50570e vkmemory: avoid the property flag check
During the video session memory allocation, the property flags can
be different from the expected ones, so do not expect all the
property flags and test it with G_MAXUINT32

It's failing with driver 525.47.26 and NVidia HW NVIDIA GeForce
RTX 3050 and 2060

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4850>
2023-11-20 13:32:19 +00:00
Seungha Yang
522d883fc3 d3d11: Add support for Y210 and Y212 formats
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
2afa0fe7d0 d3d11converter: Port to converter helper
... add support 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
c57fe82a93 d3d11: Implement helper object for converter
This object will upload system memory to GPU and preprocess
texture using compute shader or software converter if needed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5691>
2023-11-20 20:29:13 +09:00
Jordan Yelloz
66f51f642f bad: Added W3C Media Source Extensions library
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2992>
2023-11-19 13:48:43 +00:00
Alexander Slobodeniuk
2922c6182d insertbin/doc: add "Since" markers to pass CI
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5514>
2023-11-17 01:09:49 +01:00
Alexander Slobodeniuk
709913b1d2 insertbin: make it available in the registry
so it could also be used from the gst-parse-launch

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5514>
2023-11-16 21:36:32 +01:00
Sebastian Dröge
6b22f53fa9 player: Without dispatcher emit signals directly instead of via the default main context
This is how it was documented and how it worked before the port to GstPlay.

Without this, applications expecting signals to be emitted directly
without anything running the main context will simply not receive any
signals.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5672>
2023-11-15 17:16:36 +00: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
Michael Grzeschik
23a4b72631 codecparsers: h264bitwriter: Fix trace typo
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5661>
2023-11-14 14:41:37 -05:00
Stéphane Cerveau
fdc3db68cd codecparsers: introduce h265 level enum
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5644>
2023-11-13 16:37:46 +00:00
Philippe Normand
99fa06e73f play: Improve documentation header
If the application relies on GstPlaySignalAdapter, no special clean-up is
required.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5643>
2023-11-12 11:07:37 +00:00
HuQian
050e7f4831 waylandsink: fix incorrect RGB and BGR mapping about GST DRM and WL_SHM
This commit corrects the mapping relationship between RGB and BGR in GST and DRM.
The previous mapping was incorrect, causing potential color mismatches in the output.

The changes are as follows:

  {WL_SHM_FORMAT_RGB888, DRM_FORMAT_RGB888, GST_VIDEO_FORMAT_BGR},
  {WL_SHM_FORMAT_BGR888, DRM_FORMAT_BGR888, GST_VIDEO_FORMAT_RGB},

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5620>
2023-11-11 14:41:18 +00:00
Sebastian Dröge
a238caebbb play: Automatically flush the bus when disposing the signal adapter
See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3107

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5642>
2023-11-11 14:11:30 +02:00
Philippe Normand
66373721d5 gstplay: Add a minimal documentation header
Also mentioning the need to set the bus to flushing state before disposing the
player in order to avoid reference cycles.

Fixes #3107

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5631>
2023-11-11 10:48:27 +00:00
Víctor Manuel Jáquez Leal
43ce583460 vulkan/operation: wait for pending objects at reset
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5591>
2023-11-10 16:36:44 +01:00
Víctor Manuel Jáquez Leal
0296c8a53a vulkan/operation: get query only if a operation is submitted
To avoid a validation error if get query is performed before.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5591>
2023-11-10 16:36:44 +01:00
Víctor Manuel Jáquez Leal
3464710bf0 vulkan/operation: remove stored fences at the end
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5591>
2023-11-10 16:36:44 +01:00
Víctor Manuel Jáquez Leal
405ae91ed7 vulkan/operation: don't fail if extension isn't available
gst_vulkan_operation_add_dependency_frame() is a noop if the required extensions
aren't available.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5591>
2023-11-10 16:36:44 +01:00
Benjamin Gaignard
1db83d3f74 codecparsers: av1: Clip max tile rows and cols values
Clip tile rows and cols to 64 as describe in AV1 specification.

Fixes ZDI-CAN-22226 / CVE-2023-44429

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3015

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5634>
2023-11-10 13:45:43 +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
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
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
Sebastian Dröge
510f71fbe4 video-format: Fix up video formats ordering by quality
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5412>
2023-10-02 09:39:21 +03:00
Seungha Yang
91e0c3aafa cuda: Use d3d11 token data for interop data
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
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
Seungha Yang
d731a7c2fc d3d11: Add support for GBR_16LE format
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5375>
2023-09-23 13:12:55 +00:00
Seungha Yang
2b7dc0de1b h265decoder: Set discont state after new_picture()
Subclass might negotiate with downstream inside of the new_picture().
Set discont state after the new_picture() call

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5368>
2023-09-20 18:44:42 +00:00
Nicolas Dufresne
ff91a3d8d6 h265parser: Fix possible overflow using max_sub_layers_minus1
This fixes a possible overflow that can be triggered by an invalid value of
max_sub_layers_minus1 being set in the bitstream. The bitstream uses 3 bits,
but the allowed range is 0 to 6 only.

Fixes ZDI-CAN-21768, CVE-2023-40476

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2895

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5364>
2023-09-20 14:11:55 +00:00
Seungha Yang
2aa88033b2 d3d11memory: Allow CreateSharedHandle() without keyed mutex
For d3d11 resource to be shared with d3d12, keyed mutex shouldn't
be enabled since d3d12 resource does not expose the keyed mutex
interface

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5356>
2023-09-20 10:34:54 +00:00
Hugues Fruchet
42c65cc765 waylandsink: Fix cropping for video with non-square aspect ratio
Padding of unaligned content is still visible at right with some aspect-ratio.
Fix this by giving the original content resolution to wp_viewport_set_source()
instead of pixel aspect ratio scaled one.

Fixes !5259

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5346>
2023-09-19 22:56:31 +00:00
Víctor Manuel Jáquez Leal
4c5e17308e vaallocator: don't update size in info for single plane images
Don't update info's size with the VA image reported data size for single plane
images, since drivers might allocate bigger space than the strictly required to
store the image, but when we dump the buffer as is (using filesink, for example)
the produced stream is corrupted. For multi-plane images video meta is required
to read/write them.

We updated info's size because gstreamer-vaapi did it too, but the reason to
update it there was for uploading and rendering surfaces (commit c698a015).

Furthermore, this patch adds an error message if the allocated data size for the
image by the driver is lesser than the expected because it would be a buggy
driver.

Fixes: #2959
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5308>
2023-09-18 14:55:10 +00:00
Seungha Yang
729c11cb0c dxva: Add DXVA decoder baseclass implementation
Extract Direct3D version independent common DXVA logic from d3d11
decoder so that it can be used by the other APIs (D3D9 and D3D12)
as well

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4161>
2023-09-17 18:30:03 +09:00
Seungha Yang
48a0c01570 h264decoder: Update latency dynamically
The actual number of reorder frames is unknown
unless frame reordering is disabled
(e.g., POC type 2 or constrained-* profiles).
Also derived maximum DPB size or max_num_reorder_frames in VUI
is not the upper bound of output delay.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2702
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5326>
2023-09-17 01:43:29 +09:00
Seungha Yang
6785c7d378 av1parser: Fix segmentation params update
Even if the segmentation feature value is not updated,
the parsed "segmentation_update_map" and "segmentation_temporal_update"
values should not be cleared as it's referenced during lower
level bitstream parsing. Also, don't use assert() in parser
unless it's clearly impossible condition.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5334>
2023-09-16 07:50:41 +09:00
Seungha Yang
3ac2690807 h265decoder: Fix DPB overflow
If DPB is full already, GstH265Decoder::new_picture() might fail if
subclass uses fixed size picture pool and its size is equal to the DPB
size. Call the new_picture() after DPB is cleared in gst_h265_decoder_dpb_init()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5333>
2023-09-15 18:26:31 +00:00
Nicolas Dufresne
16ae1286d1 wayland: Use generated formats list
Update the order according to what the generator produces.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5304>
2023-09-10 19:06:07 -04:00
Víctor Manuel Jáquez Leal
b7ded81f7b vkbufferimagepool: short circuit usage for decoding
NVIDIA & RADV drivers don't report decoding features for color format. Setting
requested usage to zero to short circuit validation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5288>
2023-09-08 18:11:55 +02:00
Matthew Waters
9d79852890 vkformat: assume that unknown rgb transfer is sRGB
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5288>
2023-09-08 16:09:33 +00:00
Matthew Waters
b82a402bf1 vkformat: also check configured usage flags
This does also mean that if the primary format fails this check, we need
to try the secondary format before returning an error

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2957
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5288>
2023-09-08 16:09:33 +00:00
Matthew Waters
4d3b03e8e8 vkformat: invert srgb and multiplane && planes > 1 checks
The primary format for RGB includes sRGB transfer but was not actually
being used.

The !(no_multiplane && planes > 1) check for YUV resulted in those
formats never being used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5288>
2023-09-08 16:09:33 +00:00
Matthew Waters
8a9d630e3b vkformat: FORMAT_FEATURE_COLOR_ATTACHMENT also includes INPUT_ATTACHMENT
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5288>
2023-09-08 16:09:33 +00:00
Matthew Waters
6c534655d4 vkformat: reorder RGBA formats before RGBx formats
Fixes gst_vulkan_format_to_video_format to use the RGBA formats instead
of RGBx formats.

Fixes vulkansink exposing a RGBx/BGRx format instead of the more
relevant RGBA/BGRA formats

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5288>
2023-09-08 16:09:33 +00:00
Aleksandr Slobodeniuk
a98330636a h264/h265parser: clarify some gtk-doc annotations
Needed for the documentation since the transfer
is not obvious.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5287>
2023-09-08 13:41:01 +00:00
Seungha Yang
97fc02cfe3 av1decoder: Port to GstCodecPicture struct
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5285>
2023-09-08 11:51:23 +00:00
Seungha Yang
a73c6d7fb6 vp9decoder: Port to GstCodecPicture struct
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5285>
2023-09-08 11:51:23 +00:00
Seungha Yang
4571fac946 vp8decoder: Port to GstCodecPicture struct
... and remove unused "pts" variable from GstVp8Picture struct

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5285>
2023-09-08 11:51:23 +00:00
Seungha Yang
a5ddf7af3b mpeg2decoder: Port to GstCodecPicture struct
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5285>
2023-09-08 11:51:23 +00:00
Seungha Yang
6e7cab43be h265decoder: Port to GstCodecPicture struct
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5285>
2023-09-08 11:51:23 +00:00
Seungha Yang
ea3dfadbed h264decoder: Port to GstCodecPicture struct
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5285>
2023-09-08 11:51:23 +00:00
Seungha Yang
d69bacb954 codecs: Define common codec picture struct
Adding parent class of codec picture struct

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5285>
2023-09-08 11:51:23 +00:00
Robert Mader
649eeeaa27 wlvideoformat: Add P010
It is similar to NV12 but has 10bits per channel instead of 8.
As it is supported by many modern GPUs, VA-API and an increasing
number of Wayland compositors, let's support it as well.

Also bump the required libdrm version accordingly and add a temporary
define for the WL_SHM format.

Tested with Weston, Mutter and Sway.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5275>
2023-09-07 13:50:48 +00:00
Robert Mader
fd82342bbd waylandsink: Move format caps list to shared library
So it can be shared and more easily updated. While on it, order the
formats according to the documentation for GstVideo.VIDEO_FORMATS_ALL.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5275>
2023-09-07 13:50:48 +00:00
Akihiro Sagawa
3c7ba382db codecparsers: Fix MPEG-1 aspect ratio table
The values defined in ISO/IEC 11172-2 are different from those used so far.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5272>
2023-09-06 12:24:37 +00:00
He Junyan
732a32a243 va: Add modifier paramters check for va_create_surfaces()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5267>
2023-09-01 17:26:51 +08:00
Víctor Manuel Jáquez Leal
22c8d1890e va: retry if surface creation fails
Old versions of mesa doesn't support VASurfaceAttribDRMFormatModifiers. To
solve it, by just ignoring the modifiers assuming that linear is accepted and
produced, the creation of frames will be tried again without that attribute.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5256>
2023-08-31 20:18:26 +00:00
Nicolas Dufresne
0b648f9a2d waylandsink: Crop surfaces to their display width height
Setting the surface source rectangle has been omitted so far. As a side effect
surface created with padded width/height are being scaled down. Fix this using
the viewporter source rectangle configuration. This can later be enhanced
to support crop meta.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5259>
2023-08-30 18:58:45 +00:00
He Junyan
0e500ee084 va: Add helper function va_get_surface_usage_hint()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5210>
2023-08-24 11:03:59 +00:00
Seungha Yang
d84c13ab0d h265parser: Allow partially broken hvcC data
Ignores parsing error on the last nalu of the array if the nalu type
is not VPS/SPS/PPS

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2905
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5188>
2023-08-23 10:43:18 +00:00
Johan Sternerup
5b64cfaca3 webrtcice: Add webrtc ALPN header for HTTP proxy
Section 3.4 in RFC8835 states that if a WebRTC endpoint uses an HTTP
proxy to access the Internet it MUST include the "ALPN" header. This
commit adds this header.

By default the ALPN used when connecting to the TURN/TCP server via a
proxy is set to "webrtc". It can be changed by adding an alpn url
option for the http-proxy. For example:

http://user:pass@my.http.proxy.com:8080?alpn=c-webrtc

This will add the header "ALPN: c-webrtc" to the HTTP proxy CONNECT
request.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4212>
2023-08-17 00:45:05 +00:00
Seungha Yang
dc2fd997a2 cuda: Add workaround for gir build
ERROR:../girepository/girparser.c:343:state_switch:
  assertion failed: (ctx->state != newstate)
Bail out! ERROR:../girepository/girparser.c:343:state_switch:
  assertion failed: (ctx->state != newstate)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4510>
2023-08-14 13:41:01 +00:00
Seungha Yang
7b1e4d6051 cudabufferpool: Add support for virtual memory
Configure malloc or mmap allocator depending on config option

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4510>
2023-08-14 13:41:01 +00:00
Seungha Yang
547b13c68f cudacontext: Add memory allocation related properties
Adding "virtual-memory" and "os-handle" properties. New properties
will be used to query device's capability

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4510>
2023-08-14 13:41:01 +00:00
Seungha Yang
2f506e8ddc cudamemory: Add support for virtual memory in pool allocator
Adding new memory pool allocator for virtual memory

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4510>
2023-08-14 13:41:01 +00:00
Seungha Yang
194fd8bb82 cudamemory: Add support for virtual memory management
Adding new CUDA memory allocation methods

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4510>
2023-08-14 13:41:01 +00:00
Seungha Yang
a712a768a4 cuda: Load virtual memory management and IPC API symbols
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4510>
2023-08-14 13:41:01 +00:00
Fabian Orccon
d07ffae343 h264parser: Write Unregistered User Data
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5071>
2023-08-08 02:47:41 +00:00
He Junyan
919d398bff va: update the gst_va_dma_drm_info_to_video_info() to use DMA_DRM format
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4044>
2023-08-07 22:49:26 +00:00
He Junyan
93d763b85c va: Use new dma drm caps in va pool when we setup DMA pools
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4044>
2023-08-07 22:49:26 +00:00
He Junyan
d7d25de892 va: Use GstVideoInfoDmaDrm in DMA allocator's get/set_format() API
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4044>
2023-08-07 22:49:26 +00:00
He Junyan
ab9d11bc17 va: Include drm fourcc header file in gstvavideoformat.h
And add some definition to pass the Windows compiling.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4044>
2023-08-07 22:49:26 +00:00
Nicolas Dufresne
0149d77eff waylandsink: Improve DMA DRM integration
Pass GstVideoInfoDmaDrm or GstVideoInfo whenever possible, avoiding passing
strange combination of GstVieoFormat + modifier. Even though we don't have any
at the moment, this also allow supporting GstVideoFormat that are not supported
in our DRM integration.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5120>
2023-08-01 14:55:23 -04:00
Cheah, Vincent Beng Keat
6e22846301 waylandsink: Add DRM modifiers support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5103>
2023-07-27 17:08:26 +00:00
Mengkejiergeli Ba
809a984b91 va:allocator: Rework the func va_map_unlocked
Rework the va_map_unlocked() after we keep mapping behavior (whether to
use derive) consistent with allocator_try stage. Also remove the flag
for iHD case because pitch/stride difference between vaCreateImage and
vaDeriveImage only possibly happen on iHD by now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5046>
2023-07-27 15:04:01 +00:00
Mengkejiergeli Ba
b997f541b2 va:allocator: Let pool alloc_info be consitent with the test order in gst_va_allocator_try
In gst_va_allocator_try, the first try is to use derive_image, if it
succeeds, we should use info from derived image to create bufferpool.
If derive fails, then try create_image and give created image info
to the pool.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5046>
2023-07-27 15:04:01 +00:00
He Junyan
5aa2239c4b codecs: AV1: Ensure current picture and frame to NULL before return
The current code fails to clear the current picture and frame pointer if
some flow error such as EOS happens. This causes the double free issue in
gst_av1_decoder_reset().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5104>
2023-07-26 16:27:43 +08:00
Fabian Orccon
216f9d66a0 h265parser: Write Unregistered User Data
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5070>
2023-07-25 18:28:26 +00:00
Fabian Orccon
dd47fa53d8 h265parse: Parse SEI unregistered user data
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5070>
2023-07-25 18:28:26 +00:00
Seungha Yang
9a902afce4 codecs: Use release_frame() instead of drop_frame()
drop_frame() will post QoS message which is not intended here

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5024>
2023-07-13 13:48:46 +00:00
Seungha Yang
45766f2448 codecs: Propagate downstream flow ERROR
Don't translate downstream flow ERROR to OK

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5024>
2023-07-13 13:48:46 +00:00
Seungha Yang
b18bd5ec2b d3d11bufferpool: Fix heavy CPU usage in case of fixed-size pool
There's no reason to release GstMemory manually at all.
If we do release GstMemory, corresponding GstBuffer will be
discarded by GstBufferPool baseclass because the size is changed
to zero.

Actual cause of heavy CPU usage in case of fixed-size pool
(i.e., decoder output buffer pool) and if we remove GstMemory from
GstBuffer is that GstBufferPool baseclass is doing busy wait in acquire_buffer()
for some reason. That needs to be investigated though, discarding
and re-alloc every GstBuffer is not ideal already.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4935>
2023-06-27 23:25:09 +00:00
Seungha Yang
9aa1d683a2 d3d11poolallocator: Initialize flush flag with TRUE
If it's not active state, it should return flushing from acquire
method

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4935>
2023-06-27 23:25:09 +00:00
He Junyan
6accb7a1f5 va: Only change video format in gst_va_video_info_from_dma_info()
The current way of using gst_video_info_set_format() will change all
fields of the GstVideoInfo. We only need to change its format, stride
and offset fields.

In order to keep the consistency with th common drm API, we rename the
gst_va_video_info_from_dma_info() into gst_va_dma_drm_info_to_video_info().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4883>
2023-06-26 16:18:23 +00:00
Stéphane Cerveau
2974c18a5c codecparsers: keep naming consistency in GST_H264_LEVEL
GST_H264_LEVEL_2 should be used instead of GST_H264_LEVEL_2_0

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4737>
2023-06-26 10:47:36 +00:00
Stéphane Cerveau
c98f5c2bf4 vkvideoutils: fix memory leak in structure's string
Retrieve a const char* from structure for "chromat-format" and
avoid extra mem copy.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4904>
2023-06-22 04:42:58 +00:00
Stéphane Cerveau
fc0ee45fb5 vkdevice: fix beta extensions symbol
Missing 's' to VK_ENABLE_BETA_EXTENSIONS

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4904>
2023-06-22 04:42:58 +00:00
Stéphane Cerveau
c1149d60c1 vkphysicaldevice: fix leak with queue_family_query_props
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4904>
2023-06-22 04:42:58 +00:00
Stéphane Cerveau
6920166af4 vulkan: fix C2099 error with VS2019
As VK_FORMAT_FEATURE_2_xxx are defined as static const variable, the
vscoce C compiler prevents the initialization of the  vk_usage_map
structure with error "C2099: initializer is not a constant".

Init the structure separately.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4904>
2023-06-22 04:42:58 +00:00
Seungha Yang
de749fa356 cuda: Introduce GST_CUDA_CRITICAL_ERRORS env to abort on critical error
Adding GST_CUDA_CRITICAL_ERRORS env variable so that program can be
terminated on unrecoverable error.

Example)
GST_CUDA_CRITICAL_ERRORS=2,700 gst-launch-1.0 ...

In this example, CUDA_ERROR_OUT_OF_MEMORY(2) and
CUDA_ERROR_ILLEGAL_ADDRESS(700) are registered as critical error
and program will be aborted on those errors

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4729>
2023-06-18 16:44:43 +00:00
Seungha Yang
58b166453d cuda: Move cuda debug helper function to .cpp
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4729>
2023-06-18 16:44:43 +00:00
Benjamin Gaignard
465d146864 codecparser: AV1: fix reference frame ordering
In AV1 specifications earliest_order_hint is initialized at
beginning of the process and not before each frame ordering.

FFMPEG parser does the same.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1011>
2023-06-16 01:30:40 +00:00
Seungha Yang
5b6ecf359e va: Fix Windows build
DRM_FORMAT_MOD_LINEAR and DRM_FORMAT_MOD_INVALID are not defined
on Windows

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4864>
2023-06-15 21:14:29 +00:00
Seungha Yang
842805d7c6 av1decoder: Fix DPB size signalling
Take current frame into account for the DPB size signalling

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4845>
2023-06-14 15:16:04 +00:00
Seungha Yang
77b9e1351a mpeg2decoder: Fix DPB size signalling
Take current frame into account for the DPB size signalling

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4845>
2023-06-14 15:16:04 +00:00
Seungha Yang
965e566156 vp9decoder: Fix DPB size signalling
Take current frame into account for the DPB size signalling

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4845>
2023-06-14 15:16:04 +00:00
Seungha Yang
7d2beab9b1 vp8decoder: Fix DPB size signalling
Take current frame into account for the DPB size signalling

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4845>
2023-06-14 15:16:04 +00:00