[vlc-commits] d3d11: make the code to decide whether to use the external pool more generic
Steve Lhomme
git at videolan.org
Tue Feb 20 10:03:32 CET 2018
vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Feb 20 08:47:35 2018 +0100| [31562c8b2c3eefc97cdd5b5716a23928a1032be1] | committer: Hugo Beauzée-Luyssen
d3d11: make the code to decide whether to use the external pool more generic
This code will go away once we use the push model.
(cherry picked from commit 571ea8ffbb7ac26747519811a593efe36addd673)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=31562c8b2c3eefc97cdd5b5716a23928a1032be1
---
modules/codec/avcodec/d3d11va.c | 4 +---
modules/video_chroma/d3d11_fmt.c | 13 +++++++++++++
modules/video_chroma/d3d11_fmt.h | 1 +
modules/video_output/win32/direct3d11.c | 7 ++-----
4 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index de4ebea8ca..bcac511956 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -648,9 +648,7 @@ static int DxSetupOutput(vlc_va_t *va, const GUID *input, const video_format_t *
msg_Dbg(va, "Using output format %s for decoder %s", DxgiFormatToStr(processorInput[idx]), psz_decoder_name);
if ( sys->render == processorInput[idx] )
{
- /* NVIDIA cards crash when calling CreateVideoDecoderOutputView
- * on more than 30 slices */
- if (sys->totalTextureSlices <= 30 || !isNvidiaHardware(sys->d3d_dev.d3ddevice))
+ if (CanUseVoutPool(&sys->d3d_dev, sys->totalTextureSlices))
dx_sys->can_extern_pool = true;
else
msg_Warn( va, "NVIDIA GPU with too many slices (%d) detected, use internal pool",
diff --git a/modules/video_chroma/d3d11_fmt.c b/modules/video_chroma/d3d11_fmt.c
index 96835fccca..ef4b7b9bf3 100644
--- a/modules/video_chroma/d3d11_fmt.c
+++ b/modules/video_chroma/d3d11_fmt.c
@@ -349,6 +349,19 @@ bool isNvidiaHardware(ID3D11Device *d3ddev)
return result;
}
+bool CanUseVoutPool(d3d11_device_t *d3d_dev, UINT slices)
+{
+#if VLC_WINSTORE_APP
+ /* Phones and the Xbox are memory constrained, rely on the d3d11va pool
+ * which is always smaller, we still get direct rendering from the decoder */
+ return false;
+#else
+ /* NVIDIA cards crash when calling CreateVideoDecoderOutputView
+ * on more than 30 slices */
+ return slices <= 30 || !isNvidiaHardware(d3d_dev->d3ddevice);
+#endif
+}
+
int D3D11CheckDriverVersion(d3d11_device_t *d3d_dev, UINT vendorId, const struct wddm_version *min_ver)
{
IDXGIAdapter *pAdapter = D3D11DeviceAdapter(d3d_dev->d3ddevice);
diff --git a/modules/video_chroma/d3d11_fmt.h b/modules/video_chroma/d3d11_fmt.h
index e5dfaefe37..4e1a848352 100644
--- a/modules/video_chroma/d3d11_fmt.h
+++ b/modules/video_chroma/d3d11_fmt.h
@@ -108,6 +108,7 @@ void D3D11_Destroy(d3d11_handle_t *);
bool isXboxHardware(ID3D11Device *d3ddev);
bool isNvidiaHardware(ID3D11Device *d3ddev);
+bool CanUseVoutPool(d3d11_device_t *, UINT slices);
IDXGIAdapter *D3D11DeviceAdapter(ID3D11Device *d3ddev);
int D3D11CheckDriverVersion(d3d11_device_t *, UINT vendorId,
const struct wddm_version *min_ver);
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 0c6a4ab2c0..6cfe80e571 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -587,12 +587,9 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
surface_fmt.i_width = sys->picQuad.i_width;
surface_fmt.i_height = sys->picQuad.i_height;
-#if VLC_WINSTORE_APP
- /* Phones and the Xbox are memory constrained, rely on the d3d11va pool
- * which is always smaller, we still get direct rendering from the decoder */
- if (is_d3d11_opaque(surface_fmt.i_chroma))
+ if (is_d3d11_opaque(surface_fmt.i_chroma) && !CanUseVoutPool(&sys->d3d_dev, pool_size))
+ /* only provide enough for the filters, we can still do direct rendering */
pool_size = __MIN(pool_size, 6);
-#endif
if (SetupQuad( vd, &surface_fmt, &sys->picQuad, &sys->sys.rect_src_clipped,
sys->picQuadConfig, sys->picQuadPixelShader,
More information about the vlc-commits
mailing list