Seungha Yang
a5295509af
d3d11: Enable dxgi debug layer and always try to pop d3d11/dxgi debug message if possible
...
Note that dxgi and d3d11 sdk debug will be enabled on debug build
2019-12-24 19:00:40 +09:00
Seungha Yang
0e013fe539
d3d11videosink: Use dynamic texture for fallback buffer
...
Upload CPU memory to texture directly by using dynamic usage texture.
This will reduce at least one step of staging copy per frame.
2019-12-20 19:21:02 +09:00
Seungha Yang
65cace22e2
d3d11colorconvert: Set TRANSFER_NEED_DOWNLOAD flag to output memory for later cpu access
...
Otherwise CPU cannot access texture via gst_memory_map()
2019-12-20 19:21:02 +09:00
Seungha Yang
18e13404a2
d3d11colorconvert: Use shader resource and render target bind flags together
...
The output of d3d11colorconvert would be used for rendering (i.e., shader resource)
2019-12-20 19:21:02 +09:00
Seungha Yang
62c8d19e01
d3d11window: Change aspect-ratio mode from window thread
...
Call DXGI API from window thread as much as possible
2019-12-20 19:21:02 +09:00
Seungha Yang
1b687d556a
d3d11videosink: Add support for full screen mode
...
borderless top-most style full screen mode support.
Basically fullscreen toggle mode is disabled by default. To enable it
use "fullscreen-toggle-mode" property to allow fullscreen mode change
by user input and/or property.
2019-12-20 19:21:02 +09:00
Seungha Yang
0788492461
d3d11: Use GRecMutex to protect immediate context and dxgi API call
...
In some cases, rendering and dxgi (e.g., swapchain) APIs should be
called from window message pump thread, but current design (dedicated d3d11 thread)
make it impossible. To solve it, change concurrency model to locking based one
from single-thread model.
2019-12-20 19:21:03 +09:00
Seungha Yang
a0a85cd80c
d3d11window: Prefer to use flip-sequential over discard
...
flip-sequential is more efficient than discard
2019-12-20 11:15:12 +09:00
Seungha Yang
1424de0a4a
d3d11window: Don't hold backbuffer interface
...
We don't need to hold it
2019-12-20 11:15:12 +09:00
Seungha Yang
32d618c677
d3d11window: Use CreateSwapChainForHwnd if available
...
That's recommended way from MS and CreateSwapChainForHwnd supports
more options than CreateSwapChain
2019-12-20 11:15:12 +09:00
Seungha Yang
9fd0b62f2d
d3d11: Use configuration file for dxgi header version check
2019-12-20 11:15:12 +09:00
Seungha Yang
23b47a7ec1
d3d11window: Use allow-tearing mode if device supports it
...
As the recommendation from MS.
2019-12-20 11:15:12 +09:00
Seungha Yang
72b6b3557d
d3d11window: Disable fullscreen mode change by alt + enter
...
Disable full screen mode change until proper handling is implemented
2019-12-20 11:15:12 +09:00
Seungha Yang
9dada90108
d3d11videosink: Remove resizing window hack and unify resizing flow
...
In earlier implementation of d3d11videosink where no shader was implemented,
the aspect ratio and render size were adjusted by manipulating the backbuffer size
with unintuitive formula. Since now we do color conversion and resize using
shader, we can remove the hack.
2019-12-20 11:15:12 +09:00
Seungha Yang
61cb6b2bbe
d3d11: Pass GstD3D11Memory object to ensure_{shader_resource,render_target}_view methods
...
The method name indicates it should be d3d11memory, so passing
GstD3D11Memory seems to make more sense than GstMemory.
2019-12-20 11:15:12 +09:00
Seungha Yang
7c041f1934
d3d11videosink: Don't specify crop meta to allocation query
...
d3d11videosink could not handle it for now
2019-12-20 11:15:12 +09:00
Seungha Yang
64eb1d46b5
d3d11window: Always draw to internal window
...
... and use SetParent() WIN32 API when external window is used.
Depending on DXGI swap effect, the external window might not be
reusable by another backend. To preserve the external window's property
and setting, drawing to internal window seems to be safer way.
2019-12-16 22:24:29 +09:00
Seungha Yang
638c6d6931
d3d11window: Always set error reason to GError object
2019-12-16 18:21:02 +09:00
Seungha Yang
a400126889
d3d11window: Initialize surface rect with given external window handle
...
Unlike internal window, resize event might not happen with external window.
2019-12-11 23:04:55 +09:00
Seungha Yang
a8ec409b84
d3d11device: Report alive d3d11 objects at the end
...
It would be useful for debugging d3d11 object leak.
2019-12-11 23:04:49 +09:00
Seungha Yang
59295b4271
d3d11: Fix ID3D11SamplerState leak
2019-12-11 12:57:46 +00:00
Seungha Yang
d963d442c5
d3d11videosink: Fix broken fallback rendering
...
Make fallback rendering work
2019-12-10 04:06:28 +00:00
Seungha Yang
abc1443cf0
d3d11videosink: Add debug message for fallback reason
2019-12-10 04:06:28 +00:00
Seungha Yang
9835289239
d3d11window: Do not check shader resource view if not doing conversion
...
If d3d11window does not convert format internally, shader resource view
is not required. Note that shader resource view is used for
color conversion using shader but when conversion is not required,
we just copy input input texture to backbuffer.
2019-12-10 04:06:28 +00:00
Seungha Yang
8154b22a88
d3d11window: Clear old swapchain per prepare
...
_prepare() might be called multiple times for given window, so clear
old swapchain if any.
Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1138
2019-12-10 10:58:28 +09:00
Seungha Yang
5bf10d8781
d3d11window: Always set dxgi colorspace if possible
...
Not only for the 10 bits RGB case with HDR metadata, set proper color space
to swapchain in order to make color representaion correct
2019-12-09 12:22:15 +00:00
Aaron Boxer
e9891dfe14
d3d11: translate windows error codes to human readable strings
...
This will help with debugging.
2019-12-07 16:09:03 -06:00
Seungha Yang
199caccc41
d3d11: Initialize debug categories of non-GstElement implementation in plugin init
...
That's the way to expose debug category to --gst-debug-help
2019-12-05 02:29:18 +00:00
Seungha Yang
71befc477f
d3d11window: Invoke resize task with high priority
...
On resize event, swapchain should be configured with higher priority
than the other tasks since it's directly related to visual artifacts.
2019-12-05 02:29:18 +00:00
Seungha Yang
d2b85683de
d3d11device: Add gst_d3d11_device_thread_add_full method
...
I would be used to invoke GPU task with specified priority.
2019-12-05 02:29:18 +00:00
Seungha Yang
7cab47ddda
d3d11videosinkbin: Drop d3d11 color convert element
...
d3d11videosink can convert color space now, so the conversion element
seems to be redundant.
2019-12-05 02:29:18 +00:00
Seungha Yang
ca3ddf7848
d3d11videosink: Add color conversion support
...
Draw to back buffer texture directly. It would reduce the number of
copy at least once when color conversion is required.
2019-12-05 02:29:18 +00:00
Seungha Yang
622733ed0d
d3d11converter: Skip setup converter if input and output formats are equal
2019-12-05 02:29:18 +00:00
Seungha Yang
c9cb08fcd4
d3d11colorconvert: Split color space converter to reuse code
2019-12-05 02:29:18 +00:00
Seungha Yang
42ca123f0f
d3d11: Split shader to reuse code
2019-12-05 02:29:18 +00:00
Seungha Yang
59d9589722
d3d11videosink: Draw window with cached texture on resize
...
This would render nicer than presenting scene with broken aspect ratio,
especially in case of low framerate.
2019-12-05 02:29:18 +00:00
Seungha Yang
ddd13fc7c0
d3d11: Add support for D3D11_USAGE_DYNAMIC
...
D3D11 dynamic texture is a special memory type, which is mainly used for
frequent CPU write access to the texture. For now, this texture type
does not support gst_memory_{map,unmap}
2019-12-05 02:29:18 +00:00
Seungha Yang
5ce4748cc0
d3d11device: Add debug message for CreateTexture2D failure
2019-12-05 02:29:18 +00:00
Seungha Yang
914d2df79e
d3d11device: Fix misreading debug message
2019-12-05 02:29:18 +00:00
Seungha Yang
71ae632b25
d3d11colorconvert: Disable color conversion with software rasterizer
...
It's much slower than our CPU based color-converter in most case.
2019-12-05 02:29:18 +00:00
Seungha Yang
79e88b76da
d3d11videosink: Handle context query
...
Propagate d3d11device via context query.
2019-12-05 02:29:18 +00:00
Seungha Yang
5edf64d655
d3d11colorconvert: Avoid copy in/out texture if possible
...
When input and/or output d3d11memory has its own view, use them for
rendering to avoid texture copy
2019-12-05 02:29:18 +00:00
Seungha Yang
da3545e8c8
d3d11memory: Allocate texture with required views
...
Store required resource views with d3d11 texture when it requested.
2019-12-05 02:29:18 +00:00
Seungha Yang
4e4fb8a577
d3d11: Add d3d11videosinkbin element
...
New wrapper element to support d3d11 memory upload, color conversion, and
rendering at once.
2019-12-05 02:29:18 +00:00
Seungha Yang
79ac41ec5b
d3d11: Add color space conversion element using shader
...
Add d3d11colorconvert element for color space conversion.
Currently {RGB, YUV} to RGB conversion is supported.
2019-12-05 02:29:18 +00:00
Seungha Yang
01903c47f7
d3d11memory: Register mininal compare function for GstD3D11AllocationParams
...
The d3d11 allocation param is stored in GstStructure so it should
provide compare function for later use such as gst_structure_is_equal()
2019-12-05 02:29:18 +00:00
Seungha Yang
0778fa8043
d3d11window: Set render target whenever drawing
...
Device context's render target might be updated for offscreen rendering
2019-12-05 02:29:18 +00:00
Seungha Yang
a687f06b59
d3d11videosink: Specify d3d11 memory caps feature on sinkpad template
2019-12-05 02:29:18 +00:00
Seungha Yang
c17c1346ee
d3d11: Introduce d3d11 upload/download element
...
That's equivalent to glupload and gldownload elements but for d3d11
2019-12-05 02:29:18 +00:00
Seungha Yang
6c3311a39e
d3d11: Refactor d3d11 memory and dxgi format usage
...
* Create staging texture only when the CPU access is requested.
Note that we should avoid the CPU access to d3d11 memory as mush as possible.
Incoming d3d11upload and d3d11download will take this GPU memory upload/download.
* Upload/Download texture memory from/to staging only if it needed, similar to
GstGL PBO implementation.
* Define more dxgi formats for future usage (e.g., color conversion, dxva2 decoder).
Because I420_* formats are not supported formats by dxgi, each plane should
be handled likewise GstGL separately, but NV12/P10 formats might be supported ones.
So we decide the number of d3d11memory per GstBuffer for video memory depending on
OS version and dxgi format. For instance, if NV12 is supported by OS,
only one d3d11memory with DXGI_FORMAT_NV12 texture can be allocated by this commit.
One use case of such texture is DXVA. In case DXVA decoder, it might need to produce decoded data
to one DXGI_FORMAT_NV12 instead of seperate Y and UV planes.
Such behavior will be controlled via configuration of GstD3D11BufferPool and
default configuration is separate resources per plane.
2019-12-05 02:29:18 +00:00