Seungha Yang
8c3d516a14
d3d12: Additional fixes for MinGW build
...
Various fixes for GCC build, including actual bug fixes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7722 >
2024-10-24 06:54:30 +09:00
Seungha Yang
7c06001705
d3d12: Shorten various names
...
Update names of various objects and method to be shorter, for instance
GstD3D12CommandAllocator is changed to GstD3D12CmdAlloc.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7642 >
2024-10-10 10:35:36 -04:00
Sebastian Dröge
b7b24573ce
common: Use more efficient versions of GstCapsFeatures API where possible
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7432 >
2024-09-26 19:26:18 +03:00
Seungha Yang
2d91521dfc
d3d12: Fix resource allocation on old Windows version
...
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED flag was introduced as of
Windows 10 May 2020 Update, and older versions don't understand
the heap flag. Checks the feature support and enables the
D3D12_HEAP_FLAG_CREATE_NOT_ZEROED only if it's supported by OS
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7573 >
2024-09-26 12:48:55 +00:00
Seungha Yang
800961cf28
d3d12decoder: Add support for d3d11 output again
...
Although d3d12download supports d3d12 to d3d11 texture copy,
this feature might be useful if an application is not ready to d3d12
support and it expects output type of decodebin(3) is d3d11.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7208 >
2024-07-22 23:17:25 +09:00
Seungha Yang
72895ed0fa
d3d12: Always allocate output texture using shared heap
...
... if downstream preference is unknown (e.g., no proposed
buffer pool by downstream), so that produced textures can be
shareable with other APIs such as d3d11 or vulkan, or other processes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7193 >
2024-07-18 14:17:43 +00:00
Seungha Yang
b37bfc02f5
d3d12: Remove unnecessary event handles
...
null event NT handle to ID3D12Fence::SetEventOnCompletion()
will block the calling CPU thread already, thus it has no point that
creating an event NT handle in order to immediate wait for fence at CPU-side.
Note that passing a valid event NT handle to the fence API might be useful
when we need to wait for the fence value later (or timeout is required),
or want to wait for multiple fences at once via WaitForMultipleObjects().
But it's not a considered use case for now.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7176 >
2024-07-16 19:17:15 +00:00
Seungha Yang
c013e88295
d3d12decoder: Use sub-allocated bitstream buffer
...
Since a buffer resource will occupy at least 64KB,
allocating upload resource per decoding command might not be
an optimal approach. Instead, use sub-region of a upload resource
for multiple decoding command if sub-regions are not overlapped
each other.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7108 >
2024-06-29 20:47:39 +09:00
Seungha Yang
2ec7d82bd7
d3d12: Move fence setter helper method to gst-libs
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7057 >
2024-06-19 13:19:48 +00:00
Seungha Yang
f6eb3a01c0
d3d12memory: Hide fence value from header
...
Instead of exposing fence value to wait in header, user setter/getter
methods.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7057 >
2024-06-19 13:19:47 +00:00
Seungha Yang
289bc1d440
d3d12: Remove notify_com and notify_mini_object helper methods
...
Use private macros instead of exposing multiple APIs for the same thing
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7057 >
2024-06-19 13:19:47 +00:00
Seungha Yang
6942868bda
d3d12commandqueue: Update API name and arguments
...
Accepts multiple fences since single command list may have
multiple dependent resources which are associated with
different GPU engines
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7057 >
2024-06-19 13:19:47 +00:00
Seungha Yang
a2df44da7d
d3d12: Workaround for Intel iGPU decoder crash
...
Observed Intel GPU driver crash when multiple decoders are
configured in a process. It might be because of frequent
command queue alloc/free or too many in-flight decoding commands.
In order to make command queue persistent and limit the number of
in-flight command lists, holds global decoding command queue.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7019 >
2024-06-17 15:15:07 +00:00
Seungha Yang
9d23c26027
d3d12decoder: Fix SDK debug layer warning
...
Address below message reported by SDK debug layer.
ID3D12Device::CheckFeatureSupport: Unsupported Decode Profile Specified.
Use ID3D12VideoDevice::CheckFeatureSupport with D3D12_FEATURE_VIDEO_DECODE_PROFILES
to retrieve a list of supported profiles
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6839 >
2024-05-13 19:42:52 +00:00
Sebastian Dröge
0ef396359c
gst: Move GstQueueArray as GstVecDeque to core
...
And change lengths and indices from guint to gsize for a more correct type.
Also deprecate GstQueueArray and implement it in terms of GstVecDeque.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6779 >
2024-05-06 18:25:42 +00:00
Seungha Yang
cb20a371c2
d3d12decoder: Fix d3d12 resource copy
...
It was copying to self resource
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6753 >
2024-04-28 15:31:19 +00:00
Seungha Yang
b7844ef307
d3d12decoder: Remove CPU-side waiting
...
Sets decoder command queue's fence to memory instead of waiting
from decoder's output thread. CPU-side waiting will happen
only if download is required.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6749 >
2024-04-28 12:49:07 +00:00
Seungha Yang
478e49dd73
d3d12: Update copy_texture_region() method
...
Pass external fence value if any and allow passing fence
data so that dependent resources can be released
once copy is done
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6749 >
2024-04-28 12:49:07 +00:00
Seungha Yang
cecb0f2148
d3d12decoder: Lock DPB while building command
...
Since DPB resource can be modified in output thread, protect
it when building command list.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6709 >
2024-04-23 10:08:19 +00:00
Seungha Yang
27c02a0b80
d3d12decoder: Hold reference pictures in fence data
...
Keep reference pictures alive during executing decoding commands
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6709 >
2024-04-23 10:08:19 +00:00
Seungha Yang
0f5f170a40
d3d12vp9dec: Disallow resolution change to larger size on non-keyframe
...
Intel GPU seems to be crashing if the case happens.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6709 >
2024-04-23 10:08:18 +00:00
Seungha Yang
700c00eda3
d3d12decoder: Fix potential use after free
...
A DPB buffer held by codec picture object may not be writable
at the moment, then gst_buffer_make_writable() will unref passed buffer.
Specifically, the use after free or double free can happen if:
* Crop meta of buffer copy is required because of non-zero
top-left crop position
* zero-copy is possible with crop meta
* A picture was duplicated, interlaced h264 stream for example
Interlaced h264 stream with non-zero top-left crop position
is not very common but it's possible configuration in theory.
Thus gst_buffer_make_writable() should be called with
GstVideoCodecFrame.output_buffer directly.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6706 >
2024-04-22 13:28:06 +00:00
Seungha Yang
ad6670ba81
d3d12decoder: Always output sharable texture
...
Because shared heap's additional costs is not significant,
use D3D12_HEAP_FLAG_SHARED for resource can be shared over process
boundary. And enables render target for d3d11 interop in the process.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6513 >
2024-04-03 02:05:25 +00:00
Seungha Yang
7d0e90b7bc
d3d12: Move core part to gst-libs
...
Move buffer pool, converter, and device abstraction layer to
public library
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6494 >
2024-04-01 10:37:50 +00:00
Seungha Yang
abeccdd6bc
d3d12: Make resource getter methods consistent
...
Returns COM pointer directly everywhere
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6494 >
2024-04-01 10:37:49 +00:00
Seungha Yang
0527f27204
d3d12: Add a helper method for device equality check
...
GstD3D12Device object itself is not singltons anymore but
underlying private struct is singltons.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6494 >
2024-04-01 10:37:49 +00:00
Seungha Yang
bbdfa00b7b
d3d12: Add support for cross-compile
...
... and fix bunch of GCC reported warnings
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6435 >
2024-03-25 11:41:25 +00:00
Seungha Yang
18091f0115
d3d12memory: Update for API interop
...
Add support for destroy notify in case of wrapped memory, and
allow setting external fence for interop
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6428 >
2024-03-22 20:01:16 +09:00
Seungha Yang
0d559bead9
d3d12: Make primary fence sharable
...
Create primary fence with D3D12_FENCE_FLAG_SHARED flag so that
the fence can be shared with other APIs or processes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6428 >
2024-03-22 18:57:26 +09:00
Seungha Yang
393fb4733c
d3d12: Use native device handle if possible
...
Various abstraction objects such as command queue/list/allocator
can be constructed without GstD3D12Device
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6395 >
2024-03-19 12:03:55 +00:00
Seungha Yang
36c4ef361b
d3d12: Add VP8 decoder
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6088 >
2024-02-10 21:23:51 +09:00
Seungha Yang
e2eff3e4a3
d3d12decoder: Fix bitstream buffer usage
...
Resource state of a buffer in upload heap should stay in
generic-read although it's effectively in common state. Some drivers
complains about the wrong state.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6088 >
2024-02-10 21:23:28 +09: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
Seungha Yang
077470913d
d3d12decoder: Use D3D12_HEAP_FLAG_CREATE_NOT_ZEROED flag
...
Since the first access to a texture is always write, zero initialization
is unnecessary
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5919 >
2024-01-14 13:10:56 +00:00
Seungha Yang
a242b93f33
d3d12decoder: Release decoder and heap on stop
...
Sometimes driver crash happens if ID3D12VideoDevice got closed first,
and then ID3D12VideoDecoderHeap/ID3D12VideoDecoder are released.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5895 >
2024-01-09 13:52:44 +00:00
Seungha Yang
e1ecd1de2f
d3d12: Simplify fence data setup
...
Adding COM and GstMiniObject specific methods to skip passing
free function pointer
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5895 >
2024-01-09 13:52:44 +00:00
Seungha Yang
0077c4beb0
d3d12decoder: Set buffer flag on output buffer
...
... and remove unnecessary condition check
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5891 >
2024-01-07 13:38:44 +00:00
Seungha Yang
1b86c9d370
d3d12decoder: Try zero-copy in case of reverse playback too
...
In case of tier 1 decoder, always use reference-only picture to avoid
fixed-size pool limitation and output decoded picture without
copy even for negative rate. Also do not use copy queue for GPU to GPU
copy. Copy queue is specialized for upload/download and may occupy
PCIE bandwidth. Use direct queue as recommended by vendors.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5877 >
2024-01-03 02:08:53 +09:00
Seungha Yang
1fb44b8160
d3d12decoder: Fix crash on flush
...
On flush event, baseclass will discard all pictures from DPB
but there can be still in-flight commands not finished yet.
Use our command queue, allocator and fence data helper objects
to keep resource available during command execution.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5877 >
2024-01-03 01:36:42 +09:00
Seungha Yang
9d5277e70e
d3d12decoder: Fix barrier usage
...
Common state promotion and decay does not seem to be applied to
decoder commands. Use barriers explicitly
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5877 >
2024-01-03 01:17:32 +09:00
Seungha Yang
0ce6e752e4
d3d12: Use CREATE_NOT_ZEROED heap flag if possible
...
Zero initialization would have overhead and it's not required
most cases except for textures. Use CREATE_NOT_ZEROED flag
in case of buffer resource or if a texture will be rendered without any
prior read operation.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5875 >
2024-01-02 13:02:47 +00:00
Seungha Yang
48cfca413d
d3d12: Add header containing core features
...
... and include the single header instead of listing many ones
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5870 >
2023-12-29 14:39:00 +00:00
Seungha Yang
1c5bba4b6b
d3d12decoder: Remove ID3D12Device4 interface requirement
...
Old OS may not support the interface. And allow 11_0 feature level
hardware.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5870 >
2023-12-29 14:38:59 +00:00
Seungha Yang
4e5d4a45a3
d3d12decoder: Reduce the number of resource barriers
...
Single barrier per texture is sufficient in case of array-of-textures.
Avoid unnecessary decay barriers
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5870 >
2023-12-29 14:38:59 +00:00
Seungha Yang
e6bdb0458c
d3d12decoder: Use flexible task queue
...
Instead of using fixed size command allocator array, make it
resizable.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5870 >
2023-12-29 14:38:59 +00:00
Seungha Yang
efc023e76e
d3d12: Rework command scheduling
...
* Use single fence object per queue and remove GstD3D12Fence
implementation
* Add a helper method for texture copy
* Run background thread and release unused resource from the thread
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5870 >
2023-12-29 14:38:59 +00:00
Seungha Yang
2578f234dd
d3d12: Remove d3d11 dependency
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5870 >
2023-12-29 14:38:59 +00:00
Seungha Yang
800a83b435
d3d12decoder: Implement threaded decoding
...
To achieve maximum throughput, waiting on command commit thread
is not ideal. And render-delay will introduce unwanted latency.
Best is to split thread and wait finished decoding job in a dedicated
output thread
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5812 >
2023-12-15 22:56:33 +09:00
Seungha Yang
818c95e8c3
d3d12: Update allocation params signalling
...
Sync up with d3d11 implementation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5812 >
2023-12-15 19:48:36 +09:00
Seungha Yang
fab1c5f953
d3d12: Use d3dx12.h helper library
...
... and remove manually implemented helper methods
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5807 >
2023-12-14 18:08:00 +09:00