Commit graph

515 commits

Author SHA1 Message Date
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