Commit graph

177 commits

Author SHA1 Message Date
Seungha Yang
495ed45d05 d3d11decoder: Disable zero-copy for Qualcomm devices
Qualcomm driver looks buggy in zero-copy scenario. Even if we disable
zero-copy, device-to-device memory copy will be used with d3d11videosink
which should be fast enough.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1432>
2020-07-12 01:40:45 +09:00
Seungha Yang
ad8529caf7 d3d11: Disable D3D11Debug and DXGIDebug layer for UWP build
WACK (Windows App Certification Kit) doesn't seem to be happy with
the DXGIGetDebugInterface1 symbol.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1421>
2020-07-08 21:11:31 +00:00
Mathieu Duponchelle
b33f10e7e2 docs: remove gst prefix from plugin titles 2020-07-02 18:10:21 +02:00
Seungha Yang
8d0dc4fdd2 plugins: Update for documentation of Windows plugins
* Add Since marks
* Make use of GST_PARAM_CONDITIONALLY_AVAILABLE flag
2020-07-02 17:21:29 +02:00
Seungha Yang
117f593cff d3d11h265dec: Fix possible invalid memory access
The number of element to copy should be num_tile_columns_minus1
and num_tile_rows_minus1.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1374>
2020-06-25 13:58:57 +00:00
Seungha Yang
82189d6859 d3d11videosink: Disable d3d11videosink depending on supported feature level
Current shader code is not compatible with HLSL profile "ps_4_0_level_9_3"
or lower. So d3dcompiler cannot compile our shader code in that case.
Note that VirtualBox is one known driver which doesn't support currently
implemented shader code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1343>
2020-06-25 07:55:47 +00:00
Seungha Yang
863c663b1d d3d11window_win32: Chain up mouse event to parent window
Unlike key event, mouse event will not be chained up to parent window
by DefWindowProc

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1361>
2020-06-22 15:09:22 +00:00
Seungha Yang
3dd2b6f20b d3d11device: Print supported DXGI format for debugging
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1355>
2020-06-22 14:36:16 +00:00
Seungha Yang
8fe1aae96c d3d11: Load HLSL compiler library using g_module_open
Depending on OS version, available d3dcompiler library name is different.
But for UWP, we can still use the current way

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1355>
2020-06-22 14:36:16 +00:00
Seungha Yang
9b8eec39b6 d3d11shader: Add missing config.h include
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1355>
2020-06-22 14:36:16 +00:00
Seungha Yang
f899728dd4 d3d11: Don't assume response of context query has valid d3d11 device context
Peer elements should return FALSE if d3d11 device context is unavailable
but it might happen for some reason (e.g., wrong implementation or so)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1347>
2020-06-16 11:23:34 +00:00
Seungha Yang
bc99ea1e30 d3d11decoder: Disable zero-copy for blacklisted device
Should enable it for verified devices. For now, Xbox is blacklisted

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1339>
2020-06-16 10:49:02 +00:00
Seungha Yang
1144cdc63a d3d11decoder: Adjust alignment constraint for Xbox device
XBox doesn't seem to support 128 bytes alignment for 4K HEVC

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1339>
2020-06-16 10:49:02 +00:00
Seungha Yang
fe361ecc25 d3d11window: Do not configure video processor for Xbox device
Disable video processor for Xbox until it's verified

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1339>
2020-06-16 10:49:02 +00:00
Seungha Yang
d12c0c4c7b d3d11utils: Add a helper method for checking Xbox device
Required for some cases to work around device specific issue

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1339>
2020-06-16 10:49:02 +00:00
Seungha Yang
b5c8889d4f d3d11videosink: Use GPU memory copy if possible
Even if fallback buffer is required (e.g., shader resource view is unavailable),
use direct GPU memory copy if possible. It must be much faster than
system memory copy approach.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1339>
2020-06-16 10:49:02 +00:00
Seungha Yang
73b39407a6 d3d11videosink: Ensure shader resource view of fallback buffer
SRV must be configured for color conversion

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1339>
2020-06-16 10:49:02 +00:00
Seungha Yang
4471788e4a d3d11window: Fix typo "configureed"
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1339>
2020-06-16 10:49:02 +00:00
Seungha Yang
a38ac7a865 d3d11overlaycompositor: Fix wrong Y position calculation
The Y coordinate of vertex and screen/image are opposite

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1319>
2020-06-05 13:47:49 +00:00
Seungha Yang
116d7453cb d3d11videosink: Assign primary rank
d3d11videosink has an advantage over d3dvideosink, such as
* Zero-copy playback with d3d11 decoders
* HDR rendering with 10-bit format/swapchain support
* UWP support
* Any system memory alignment/padding can be supported
* User can select target GPU device
And old d3dvideosink's functionality (e.g., navigation event, overlaycomposition)
can be covered by d3d11videosink

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1311>
2020-06-03 17:57:41 +09:00
Seungha Yang
bd8a415747 d3d11window_win32: Create internal window on parent window's thread
If parent and child windows are running on different thread,
there is always a chance to cause deadlock as DefWindowProc() call
from child window thread might be blocked until the message
is handled by parent's window procedure.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1299>
2020-05-27 05:08:48 +09:00
Seungha Yang
afe941249e d3d11window: Add unprepare method to clear internal resource
GObject::dispose method can be called multiple times. As win32 d3d11window
has an internal thread and because GObject::dispose method could be called from the
thread, it might cause problems such as trying to join self-thread

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1299>
2020-05-27 04:59:50 +09:00
Seungha Yang
24f30b2e6e d3d11convert: Fix fallback texture setup when resolution is not even number
When texture format is semi-planar, resolution should be even number,
and add missing P016 format handling

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1275>
2020-05-19 17:25:05 +00:00
Seungha Yang
a966cc20bc d3d11convert: Fix fallback texture copy
Fix texture copy when input texture has non-zero subresource index

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1275>
2020-05-19 17:25:05 +00:00
Seungha Yang
a24d4e654d d3d11: Add support for video rescale and rename element to d3d11convert
GstD3D11ColorConverter implementation is able to rescale video as well.
By doing colorspace conversion and rescale at once, we can save
one cycle of shader pipeline which will can save GPU resource.

Since this element can support color space conversion and rescale,
it's renamed as d3d11convert

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1275>
2020-05-19 17:25:05 +00:00
Seungha Yang
0e842c74b6 d3d11: Move scoring util method for colorspace conversion to colorconvert element
It's used only by colorconvert element.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1275>
2020-05-19 17:25:05 +00:00
Víctor Manuel Jáquez Leal
d2aae6bb96 codecs: h264decoder: ref pic lists as decode_slice parameters
Pass reference picture lists to decode_slice() vmethods

Change gstv4l2codech264dec and gstnvh264dec accordingly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1238>
2020-05-19 16:57:09 +00:00
Seungha Yang
d9c552802e d3d11vp8dec: Remove useless assign operation
It's already been done in the line just above.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1246>
2020-05-05 16:37:14 +00:00
Seungha Yang
a4fbb49ef3 d3d11window: Fix processor output view resource leak
Because this object holds reference to native d3d11 device handle internally,
related native d3d11 objects would be leaked as well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1243>
2020-05-05 20:49:32 +09:00
Seungha Yang
ed147a3b48 d3d11h264dec: Rearrange the order of supported profiles in caps
constrained-baseline profile is much preferred than baseline.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1229>
2020-04-29 18:13:42 +00:00
Seungha Yang
7db29fc382 d3d11h264dec: Add constrained-baseline and baseline profile
Both profiles are expected to be supported profile by DXVA hardware

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1212>
2020-04-29 14:24:02 +00:00
Seungha Yang
3804dfb28d d3d11device: Add fallback for device creation
D3D11_CREATE_DEVICE_DEBUG flag will be used while creating d3d11 device
to activate debug layer. However, if system doesn't support the
debug layer for some reason, we should try to create d3d11 device
without the flag. Debug layer should be optional for device creation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1217>
2020-04-28 17:33:56 +00:00
Nicolas Dufresne
ed6236f551 d3d11vp8dec: Remove unused parameters
Minor cleanup removing unused picture parameters in two internal functions.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1221>
2020-04-28 06:21:53 +00:00
Seungha Yang
2fe473fa50 d3d11decoder: Fix wrong return type from output_picture vfunc
Return type should be GstFlowReturn, not gboolean

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1213>
2020-04-23 22:06:24 +00:00
Seungha Yang
15365aba70 d3d11decoder: Add VP8 decoder element
New d3d11 VP8 decoder implementation

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1079>
2020-04-22 23:20:44 +00:00
Seungha Yang
5965b6ef85 d3d11decoder: Add helper methods for negotiation and decide_allocation
The implementation for all codecs is almost the same.
No need to duplicate code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1079>
2020-04-22 23:20:44 +00:00
Seungha Yang
c5abdf8a63 d3d11window: Fix videoprocessor leak
Clear all objects in dispose function
2020-04-21 15:32:30 +09:00
Seungha Yang
64a015d51f d3d11device: Drop floating reference count
... and use gst_object_unref instead of g_object_unref for tracer
to be happy.
2020-04-21 15:32:26 +09:00
Nirbheek Chauhan
387b6df948 meson: Don't use get_option('buildtype')
We should directly check the values of the `debug` and `optimization`
options instead.

`get_option('buildtype')` will return `'custom'` for most combinations
of `-Doptimization` and `-Ddebug`, but those two will always be set
correctly if only `-Dbuildtype` is set. So we should look at those
options directly.

For the two-way mapping between `buildtype` and `optimization`
+ `debug`, see this table:
https://mesonbuild.com/Builtin-options.html#build-type-options
2020-04-03 17:07:47 +05:30
Seungha Yang
fc9f7a6ade d3d11: Update for video-hdr struct change
See the change of -base https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/594
2020-04-01 05:18:11 +00:00
Seungha Yang
429de2c6d8 d3d11decoder: Add support for array of texture DPB
DXVA supports two kinds of texture structure for DPB, one is
"1) texture array" and the other is "2) array of texture".
1) is a type of texture which is single ID3D11Texture2D object having
ArraySize greater than one. So the ID3D11Texture2D itself is a set of texture.
Each sub texture of this type mush have identical resolution, format and so on,
and the number of sub texture in a texture array is fixed.

2) is an array of usual ID3D11Texture2D object. That means each
ID3D11Texture2D is independent each other and might have different resolution as well.
Moreover, we can modify the number of frames of the array dynamically.
This type is more flexible than "1) texture array" in terms of dynamic
behavior and also this type of texture can be used for shader resource view
but "1) texture array" couldn't be.

If "2) array of texture" is supported by driver, DXVA spec is saying that
it's preferred format over "1) texture array" in terms of performance.
2020-03-30 03:40:16 +00:00
Seungha Yang
3208e3d371 Revert "d3d11decoder: Check decoder status report"
This reverts commit 418e6991c1.

Not all drivers seem to be friendly to this API.
Revert to avoid incomprehensible crash with Nvidia.
2020-03-28 12:12:03 +00:00
Seungha Yang
b2a650cf28 d3d11window: Always reuse swapchain
DXGI format can be updated via ResizeBuffers()
2020-03-28 11:45:48 +00:00
Seungha Yang
f9f6916aa1 d3d11window: Reorganize display colorspace selection
The set of supported color space by DXGI is not full combination of
our colorimetry. That means we should convert color space to one
of supported color space by DXGI. This commit modifies the color space
selection step so that d3d11window can find the best matching DXGI color space
first and then the selected input/output color space will be referenced
by shader and/or d3d11videoprocessor.
2020-03-28 11:45:48 +00:00
Seungha Yang
58a4c33a0e d3d11vp9dec: Add support for internal frame resizing
VP9 codec allows resizing reference frame by spec. Handling this case
is a bit tricky especially when the resizing happens on non-keyframe,
because pre-allocated decoder textures (i.e., dpb) have negotiated
resolution and to change resolution meanwhile decoding on non-keyframe,
each texture might need to be re-created, copied to new dpb somehow,
and re-negotiated with downstream.

Due to the complicated requirement of negotiation driven
resizing handling, this commit adds shader into d3d11decoder object
to resize only corresponding frames. Note that if the resolution change
is detected on keyframe, decoder will re-negotiate with downstream.
2020-03-09 23:44:12 +09:00
Seungha Yang
c10b5f06a5 d3d11decoder: Set GstVideoAlignment to downstream d3d11 buffer pool
To copy decoder output texture to another d3d11 texture, the downstream
texture needs to be aligned too.
2020-03-09 23:44:12 +09:00
Seungha Yang
5c51601cdf d3d11decoder: Use aligned resolution for staging texture
Not only any textures for decoder output view, any destination texture
which would be copied from decoder output texture need to be aligned too.
Otherwise driver sometimes crashed/hung (not sure why).
2020-03-09 23:44:12 +09:00
Seungha Yang
5074cecc82 d3d11colorconverter: Add support cropping
Vertex buffer will be updated if input texture resolution is different
from GstVideoInfo or when an user requests specific crop area.
2020-03-09 23:44:06 +09:00
Seungha Yang
c6c83ca493 d3d11bufferpool: Add padding space for semi-planar YUV formats
Resolution of NV12, P010, and P016 formats must be multiple of two.
Otherwise texture cannot be created. Instead of doing this alignment
per API consumer side, do this in buffer pool for simplicity.
2020-03-09 10:14:53 +09:00
Seungha Yang
5609d8751c h265decoder: Pass max_dpb_size to new_sequence vfunc
same as we are doing in h264decoder
2020-03-08 16:11:35 +09:00