Commit graph

34 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
32eeadb4a5 d3d11: Define enum and flags types manually
gnome.mkenums_simple() doesn't work well for GstD3D11, seems to
be confused by numeric representation of D3D11, must be a bug
in GLib or so. Just don't rely on the incomplete automagic.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2767>
2022-07-22 00:07:52 +09:00
Seungha Yang
b09ca8635f d3d11: Use scoped device lock
Make code simpler and more deadlock-free

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2728>
2022-07-09 03:36:17 +09:00
Seungha Yang
347ad181be d3d11memory: Update alloc_wrapped() API to avoid staging texture alloc
Add size parameter and use it for CPU accessible memory size
instead of allocating staging texture per API call.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2713>
2022-07-04 18:46:51 +00:00
Seungha Yang
46a3394581 d3d11memory: Add private method for texture wrapped memory allocation
Unlike public method gst_d3d11_allocator_alloc_wrapped(), newly
added method by this commit will not calculate CPU accessible memory
size, since staging texture must be allocated to calculate the size.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2697>
2022-07-02 05:37:55 +09:00
Seungha Yang
06b7b240af d3d11memory: Add support for wrapping application texture
Add gst_d3d11_allocator_alloc_wrapped() method to support wrapping
application texture using GstD3D11Memory without copy.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2646>
2022-06-27 19:33:57 +00:00
Seungha Yang
fce7431381 d3d11: Install library headers
Our Direct3D11 abstraction layer has been improved and
it gained good shape from API point of view.
Also, On Windows, GstD3D11 has various advantages over GstGL
in terms of compatibility/stability/feature/performance.
Note that WGL implementation is known to be buggy for some
drivers/vendors/scenario (that's a reason why Google implemented ANGLE).
Moreover, GstGL is not fully optimized for Windows unfortunately.

It's the time to open this interface to application developers
for various optimized processing using our Direct3D11
infrastructure.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2646>
2022-06-27 19:33:57 +00:00
Seungha Yang
aca71fd692 d3d11: Update gst_d3d11_allocation_params_new() interface
Define GST_D3D11_ALLOCATION_FLAG_DEFAULT (0) value instead of
casting enum type everywhere. And pass D3D11_RESOURCE_MISC_FLAG value

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2646>
2022-06-27 19:33:57 +00:00
Seungha Yang
fe64295841 d3d11decoder: Work around Intel DXVA driver crash
Intel DXVA driver crashes sometimes (from GPU thread) if
ID3D11VideoDecoder is released while there are outstanding view objects.
To make sure the object life cycle, holds an ID3D11VideoDecoder refcount
in GstD3D11Memory object.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2504>
2022-05-27 15:13:15 +00:00
Seungha Yang
0deb73d9ba d3d11memory: Clear YUV texture with black color
We prefer black color as an initial texture color and
Direct3D11 runtime will initialize texture with zeros (except for alpha)
which is fine for RGB formats. But UV components of YUV texture
requires manual clear for black color.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2502>
2022-05-27 14:03:49 +00:00
Seungha Yang
47ff41bcd2 d3d11memory: Protect against concurrent access from GPU and CPU to staging texture
Staging texture does not allow GPU access while it's CPU mapped.
But because we cannot block concurrent READ access by GstMemory design,
additional staging texture is still required.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1182
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2375>
2022-05-05 18:59:05 +00:00
Sebastian Dröge
8ab1c5791b d3d11: Remove non-existing gst_d3d11_memory_get_type() API from header
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1764>
2022-02-21 21:26:43 +00:00
Seungha Yang
cb7e454b53 d3d11: Reorganize format mapping table
... and handle GST <-> D3D11 format mapping in a single place to
make adding format easier

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1699>
2022-02-16 18:41:05 +00:00
Seungha Yang
dd906f9610 d3d11: Store device format in struct
Holding pointer to struct was unsafe approach because
the pointer to d3d11 format will be invalidated once d3d11 device
object is released

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1699>
2022-02-16 18:41:05 +00:00
Seungha Yang
af9b9be76d d3d11memory: Inform subresource index via GstMapInfo::user_data
By using this way, caller does not need to call another method
gst_d3d11_memory_get_subresource_index()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1408>
2022-02-08 10:05:35 +00:00
Seungha Yang
a37da515f4 d3d11memory: Add support for ID3D11Buffer
Allow wrap ID3D11Buffer via GstD3D11Memory object
At the moment, only staging ID3D11Buffer is supported.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1408>
2022-02-08 10:05:35 +00:00
Thibault Saunier
019971a3c7 Move files from gst-plugins-bad into the "subprojects/gst-plugins-bad/" subdir 2021-09-24 16:14:36 -03:00
Renamed from gst-libs/gst/d3d11/gstd3d11memory.cpp (Browse further)