summaryrefslogtreecommitdiff
path: root/gst-libs/gst/d3d11
Commit message (Collapse)AuthorAgeFilesLines
* d3d11bufferpool: Hide buffer_size field from headerSeungha Yang2021-08-222-6/+1
| | | | | | | | | | | | | | User can get the required buffer size by using buffer pool config. Since d3d11 implementation is a candidate for public library in the future, we need to hide everything from header as much as possible. Note that the total size of allocated d3d11 texture memory by GPU is not controllable factor. It depends on hardware specific alignment/padding requirement. So, GstD3D11 implementation updates actual buffer size by allocating D3D11 texture, since there's no way to get CPU accessible memory size without allocating real D3D11 texture. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2482>
* d3d11: Disable packed and subsampled YUV formatsSeungha Yang2021-07-292-2/+17
| | | | | | | | Direct3D11 sampler doesn't support them very well, and conversion outputs usually result in poor visual quality with our shader code. Should disable support for such formats for now Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2344>
* d3d11: Add support for GRAY and more YUV formatsSeungha Yang2021-06-232-2/+79
| | | | | | | | | | | | | | | | | | | | By this commit, following formats will be newly supported by d3d11 elements * Y444_{8, 12, 16}LE formats: Similar to other planar formats. Such Y444 variants are not supported by Direct3D11 natively, but we can simply map each plane by using R8 and/or R16 texture. * P012_LE: It is not different from P016_LE, but defining P012 and P016 separately for more explicit signalling. Note that DXVA uses P016 texture for 12bits encoded bitstreams. * GRAY: This format is required for some codecs (e.g., AV1) if monochrome is supported * 4:2:0 planar 12bits (I420_12LE) and 4:2:2 planar 8, 10, 12bits formats (Y42B, I422_10LE, and I422_12LE) Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2346>
* libs: d3d11: Port to C++Seungha Yang2021-06-207-236/+211
| | | | | | | | In general, C++ COM APIs are slightly less verbose and more readable than C APIs. And C++ supports some helper methods (smart pointer and C++ only macros for example) which are not allowed for C. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2343>
* d3d11memory: Implement GstAllocator::mem_copy methodSeungha Yang2021-06-103-2/+104
| | | | | | | | | | | There are a few places which require deep copy (basesink on drain for example). Also this implementation can be useful for future use case. One probable future use case is that copying DPB texture to another texture for in-place transform since our DPB texture is never writable, and therefore copying is unavoidable. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2308>
* d3d11: Add support for YV12 and NV21 formatsSeungha Yang2021-06-032-3/+17
| | | | | | Handle UV swapped 4:2:0 8bits formats Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2290>
* d3d11: Suppress some warning logsSeungha Yang2021-05-291-5/+6
| | | | | | | | We uses gst_d3d11_device_new() for enumerating device which can fail for some reason. Don't print warning log for the case. And decoding capability check is the same case as well. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2286>
* d3d11memory: Protect map and unmap with device lockSeungha Yang2021-05-201-26/+31
| | | | | | | | | | | | We should lock memory object with gst_d3d11_device_lock() first then GST_D3D11_MEMORY_LOCK() need to be used. One observed deadlock case is that: - Thread A takes d3d11 device lock - At the same time, Thread B tries CPU map to d3d11memory which requires d3d11 device lock as well, but it's already taken by Thread A. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2267>
* d3d11memory: Add trace log for debugging locking threadSeungha Yang2021-05-201-2/+10
| | | | Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2267>
* d3d11: Add support for BGRx and RGBx formatsSeungha Yang2021-04-212-2/+14
| | | | | | | For such formats, we can re-use existing BGRA/RGBA implementations but ignoring alpha channel Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2174>
* Add @ prefix to enum-variant references in documentationMarijn Suijten2021-03-281-4/+4
| | | | | | | | | | | Found while working on GStreamer-rs documentation, some enums had this bit of text pasted verbatim in the enum documentation rather than attached to the enum-variant. Fortunately it seems these in WebRTC and D3D11 are the only ones matching the non-@-prefixed pattern: ^ \* GST_\w+:\s*\w+ Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2118>
* d3d11decoder: Resurrect zero-copy for fixed-size DPB poolSeungha Yang2021-03-242-0/+40
| | | | | | | | | Enable zero-copy if downstream proposed pool and therefore decoder can know the amount of buffer required by downstream. Otherwise decoder will copy when our DPB pool has no sufficient buffers for later decoding operation. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2097>
* d3d11: Implement memory poolSeungha Yang2021-03-246-978/+1368
| | | | | | | | | | | | | | | | | Major changes: * GstD3D11Allocator: This allocator is now device-independent object which can allocate GstD3D11Memory object for any GstD3D11Device. User can get this object via gst_allocator_find(GST_D3D11_MEMORY_NAME) * GstD3D11PoolAllocator: A new allocator implementation for texture pool. From now on GstD3D11BufferPool will make use of this memory pool allocator to avoid frequent texture reallocation. That usually happens because of buffer copy (gst_buffer_make_writable for example) In addition to that, GstD3D11BufferPool will provide GstBuffer with GstVideoMeta, because CPU access to a GstD3D11Memory without GstVideoMeta is almost impossible since GPU drivers needs padding for stride alignment. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2097>
* d3d11decoder: Temporarily remove zero-copy related codeSeungha Yang2021-03-242-44/+0
| | | | | | We will re-implement it based on memory pool Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2097>
* gst: don't use volatile to mean atomicMatthew Waters2021-03-222-3/+3
| | | | | | | | | | | | volatile is not sufficient to provide atomic guarantees and real atomics should be used instead. GCC 11 has started warning about using volatile with atomic operations. https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719 Discovered in https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/868 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2098>
* Revert "d3d11: Enable native multi-thread protection layer and make use of it"Seungha Yang2021-03-203-24/+17
| | | | | | | | | This reverts commit 872b7f503c49442e559f6a381416c6a84b76a3c6. Native multi-thread protection layer seems to be consuming more CPU resource than application side protection approach in some cases Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2095>
* d3d11: Enable native multi-thread protection layer and make use of itSeungha Yang2021-03-183-17/+24
| | | | | | | | | ... instead of our own GRecMutex locking. In this way, any other Direct3D11 client (MediaFoundation for example) can safely call any Direct3D11 API even when we are sharing our Direct3D11 device with others. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2092>
* d3d11device: Hold ID3D11VideoDevice and ID3D11VideoContext objectSeungha Yang2021-03-142-0/+88
| | | | | | | | | ... instead of QueryInterface-ing per elements. Note that ID3D11VideoDevice and ID3D11VideoContext objects might not be available if device doesn't support video interface. So GstD3D11Device object will create those objects only when requested. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2079>
* d3d11device: Fix wrong printf formattingSeungha Yang2021-03-111-2/+3
| | | | | | Add missing '%' there Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2069>
* d3d11memory: Fix for wrong texture_array_size returnsSeungha Yang2021-03-021-3/+3
| | | | | | Fix mismatched return values Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2051>
* d3d11: Fix wrong preprocessing blocksSeungha Yang2021-03-021-5/+5
| | | | | | Missed in https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/464 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2051>
* d3d11: Add a method for conversion from DXGI format to GstVideoFormatSeungha Yang2021-02-172-0/+44
| | | | Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2016>
* d3d11memory: Add a method for querying texture array sizeSeungha Yang2021-02-032-0/+53
| | | | | | | | | | ... and the number of textures in use. Direct3D11 texture array is usually used for decoder DPB pool, and d3d11 decoder elements might want to know whether there's available texture resource or not. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2003>
* d3d11: Suppress some warning debug messagesSeungha Yang2021-01-271-6/+13
| | | | | | | | | | | | | | | * Don't warn for live object, since ID3D11Debug itself seems to be holding refcount of ID3D11Device at the moment we called ID3D11Debug::ReportLiveDeviceObjects(). It would report live object always * Device might not be able to support some formats (e.g., P010) especially in case of WARP device. We don't need to warn about that. * gst_d3d11_device_new() can be used for device enumeration. Don't warn even if we cannot create D3D11 device with given adapter index therefore. * Don't warn for HLSL compiler warning. It's just noise and should not be critical thing at all Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1986>
* d3d11: Allow building UWP features with Desktop features if possibleSeungha Yang2021-01-192-6/+11
| | | | | | | | WINAPI_PARTITION_DESKTOP and WINAPI_PARTITION_APP can coexist. Although UWP only binaries should be used for production stage, this change will be useful for development stage Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1962>
* d3d11: Move core methods to gst-libsSeungha Yang2021-01-1316-0/+4766
Move d3d11 device, memory, buffer pool and minimal method to gst-libs so that other plugins can access d3d11 resource. Since Direct3D is primary graphics API on Windows, we need this infrastructure for various plugins can share GPU resource without downloading GPU memory. Note that this implementation is public only for -bad scope for now. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/464>