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
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
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
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
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
Seungha Yang
a88d90b777
d3d11: Log device removed reason
...
... and live objects. It could be useful hint for GPU debugging
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4170 >
2023-06-14 06:23:12 +00:00
Seungha Yang
15735a4ef3
d3d11converter: Add support for premultiplied alpha
...
Adding "src-alpha-mode" and "dest-alpha-mode" properties
and performs premultiplied alpha conversion if needed
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4825 >
2023-06-10 18:12:58 +00:00
Seungha Yang
1e5343f0c6
d3d11memory: Add support for resource sharing via NT handle
...
Adding gst_d3d11_memory_get_nt_handle() method so that GstD3D11Memory
can hold shareable NT handle and for easy reuse of it
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4774 >
2023-06-06 17:54:44 +00:00
Seungha Yang
7b6f7e6e36
d3d11memory: Don't clear wrapped texture memory
...
The external texture may hold already rendered scene and therefore
it should not be cleared in alloc method
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4554 >
2023-05-05 13:18:06 +00:00
Thibault Saunier
b14e675a27
gir: Checkout all .gir files and check that they are updated on the CI
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3010 >
2023-04-22 09:32:32 -04:00
Seungha Yang
c7c380abb1
d3d11memory: Remove redundant bind flag validation
...
It has been validated outside of each function already
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4455 >
2023-04-20 18:05:27 +00:00
Seungha Yang
af6dccd6e6
d3d11bufferpool: Fix invalid access in debug print loop
...
Add missing condition check in for loop
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4255 >
2023-03-23 18:15:03 +00:00
Aleksandr Slobodeniuk
1f834eaacb
d3d11convert: add "method" property
...
It allows to select the sampling method, same
as "method" property of videoconvert.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4205 >
2023-03-21 12:08:54 +00:00
Seungha Yang
e1a73a723f
d3d11converter: Fix conversion backend selection
...
Intended behavior was selecting video processor only if pixel shader
is disabled, since we prefer shader over video processor
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4179 >
2023-03-16 01:17:27 +00:00
Seungha Yang
76d1257cd3
d3d11memory: Remove GstPoll from GstD3D11PoolAllocator
...
GstBufferPool implementation was referenced for this GstD3D11PoolAllocator,
for example GstAtomicQueue, various atomic operations, and GstPoll ones.
However, such combination seems to be almost pointless
since gst_poll_{read,write}_control() takes mutex and also
GstPoll uses Win32 event handle internally.
Use simple SRWLOCK and CONDITION_VARIABLE instead, and don't make things
complicated/inefficient.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2887 >
2023-03-05 22:51:24 +09:00
Seungha Yang
69b2e1565c
d3d11memory: Add support for keyed mutex
...
Non-zero mutex key held by application is not considered for now.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4081 >
2023-03-01 14:13:14 +00:00
Seungha Yang
ff3120a38c
cudamemory, d3d11memory: Add memory_{get,set}_token_data() methods
...
Similar to GstMiniObject qdata but new methods will use int64
token value and per object lock, instead of GQuark with global
mutex in qdata
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3884 >
2023-02-16 17:49:54 +00:00
Seungha Yang
2e574a80d9
d3d11: Don't use g_alloca()
...
_alloca CRT function is deprecated. Moreover, stack allocation
for string is not a good idea. We can use _malloca inline
function instead, but all use of _alloca in d3d11 library/plugin
are not performance critical path at all.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3652 >
2023-01-24 20:27:43 +00:00
Seungha Yang
434337c3e1
d3d11memory: Fix potential crash in GstD3D11PoolAllocator
...
Allocator object can be the final refcount holder, when a GstD3D11Memory
is being released. Do unref allocator once there's no more
remaining operation.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3715 >
2023-01-12 19:26:41 +00:00
Seungha Yang
fdc3ee97ae
d3d11memory: Remove GstD3D11PoolAllocator::dispose
...
Clear GstD3D11Device object in finalize method as well
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3715 >
2023-01-12 19:26:41 +00:00
Seungha Yang
af3311c1d6
d3d11memory: Fix typo in vfunc name
...
s/set_actvie/set_active/g
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3627 >
2022-12-23 01:03:41 +09:00
Seungha Yang
837881ad29
d3d11converter: Fix YUY2 conversion error
...
Always configure shader conversion path, then fallback to the
shader path if processor is not available
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3392 >
2022-11-14 20:14:27 +00:00
Seungha Yang
d0572622fa
d3d11: Add support for planar RGB formats
...
Adding RGBP, BGRP, GBR, GBR_10LE, GBR_12LE, GBRA, GBRA_10LE, and
GBRA_12LE format support
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3392 >
2022-11-14 20:14:27 +00:00
Seungha Yang
3f94df9487
d3d11: Add support for YUY2 format
...
YUY2 is a primary YUV 4:2:2 format for DXVA.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3316 >
2022-11-03 06:40:09 +09:00
Seungha Yang
e68645c2d2
d3d11: Move format defines to private header
...
Those defines will be likely changed/deleted in the future, and we
don't need to expose them to public at the moment
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3265 >
2022-10-26 02:55:34 +09:00
Sebastian Dröge
b57c07d5a7
d3d11: Add/fix various annotations
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3194 >
2022-10-18 13:51:17 +03:00
Nirbheek Chauhan
a5ef7cb041
d3d11: Fix debug build on UWP
...
GstDXGIGetDebugInterface() is unused when targeting UWP. We directly
call DXGIGetDebugInterface1() in that case.
Fixes build failure:
../gst-libs/gst/d3d11/gstd3d11device.cpp(271): error C2440: '=': cannot convert from 'HRESULT (__cdecl *)(UINT,const IID &,void **)' to 'DXGIGetDebugInterface_t'
../gst-libs/gst/d3d11/gstd3d11device.cpp(271): note: This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3118 >
2022-10-05 18:29:01 +00:00
Thibault Saunier
bc9c1e3956
meson: Namespace the plugins_doc_dep/libraries variables
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2970 >
2022-09-01 21:17:35 +00:00
Seungha Yang
8b988605a8
d3d11memory: Fix GstAllocator::mem_copy() implementation
...
We were checking possible bind flags for the DXGI format
of the source texture but that's never applied to
the destination texture desc.
Just use the already configured bind (and misc) flags of source texture
for the destination texture allocation without additional check.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2950 >
2022-08-30 19:58:29 +00:00
Seungha Yang
c3cf9521a5
d3d11: Update library doc
...
* Private header name is changed to gstd3d11-private.h to follow
naming convention
* Add Since mark everywhere
* Update member variable names to be consistent with the other
object implementations in this library
* Correct outdated documentation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2945 >
2022-08-27 22:40:34 +09:00
Seungha Yang
eedaf10359
meson: d3d11: Fix missing header install
...
Install gstd3d11compile.h header file
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2896 >
2022-08-16 16:55:45 +00:00
Seungha Yang
7c842d9247
meson: d3d11: Fix build with GIR enabled
...
... and remove unused list
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2870 >
2022-08-12 18:03:00 +00:00
Seungha Yang
05dae94352
d3d11: Use WIN32 API directly for locking with RAII pattern
...
Such abstraction is unnecessary for this library/plugin.
Use WIN32 API directly instead of GLib wrappers.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2848 >
2022-08-08 20:13:51 +00:00
Seungha Yang
a75e88fdd2
d3d11memory: Remove unnecessary locking
...
* memory map/unmap is already protected by d3d11 device lock.
Don't need to take another memory lock.
* Use WIN32 critical section and slim reader/writer lock APIs
directly instead of GLib wrappers.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2848 >
2022-08-08 20:13:51 +00:00
Seungha Yang
21e5c33797
d3d11memory: Allow null GstD3D11Allocator to alloc methods
...
Similar to gst_allocator_alloc(), use default GstD3D11Allocator
when caller passes null allocator object
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2843 >
2022-08-06 23:54:56 +09:00
Seungha Yang
74f56632c3
d3d11: Use std::call_once()
...
g_once_init_enter() always takes global mutex for non-GCC build.
Use C++ once call implementation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2843 >
2022-08-06 23:27:23 +09:00
Seungha Yang
cf64c9f588
d3d11device: Use WIN32 critical section API directly
...
GLib's GRecMutex will allocate another heap memory for CRITICAL_SECTION
struct and g_rec_mutex_lock/g_rec_mutex_unlock use WIN32 APIs actually.
We don't need such intermediate function calls and redundant heap allocation.
Just call WIN32 APIs directly.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2845 >
2022-08-06 05:12:41 +09:00
Seungha Yang
72ee96af42
d3d11converter: Add options for gamma and primaries conversion
...
Gamma remap and/or primaries conversion requires additional
processing which might be something user want to avoid, performance
reason for example
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2831 >
2022-08-04 02:48:57 +09:00