Commit 2523dcf9 authored by Steve Lhomme's avatar Steve Lhomme

update patchset

Merge xbox/winstore fixes until they are backported to 3.0
parent 9e189cad
From 5c8f022fdb52488ff6d3789d2bc5bb32e2de7914 Mon Sep 17 00:00:00 2001
From 58193c36a5321ba98ebf3b41e32f9f8527d6c075 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
Date: Tue, 10 Feb 2015 11:58:54 +0100
Subject: [PATCH 01/14] wasapi: Don't fail if the client is already initialized
Subject: [PATCH 01/20] wasapi: Don't fail if the client is already initialized
make the extra test only for Winstore builds
---
......
From 60b9380480d1dad3370ca8ba3b6dbffa0e993247 Mon Sep 17 00:00:00 2001
From bd4f57b6f453f51c5a4b8b57181b48d790696ab1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
Date: Wed, 11 May 2016 17:37:47 +0200
Subject: [PATCH 02/14] gnutls: Set cannot_unload_broken_library for winrt
Subject: [PATCH 02/20] gnutls: Set cannot_unload_broken_library for winrt
---
modules/misc/gnutls.c | 3 +++
......
From 51e171b34a038bca878d39291f42844c0406adde Mon Sep 17 00:00:00 2001
From 9f78a0ad5e97ff7b7b04623bf76f745a2e7b99ae Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Kempf <jb@videolan.org>
Date: Wed, 16 Apr 2014 16:09:53 +0200
Subject: [PATCH 03/14] Cheat for Windows Store subtitles
Subject: [PATCH 03/20] Cheat for Windows Store subtitles
---
lib/video.c | 5 +++++
......
From 9da77ace7208186b969d4dc731c81d14ffffc9c8 Mon Sep 17 00:00:00 2001
From db20dbac83849cc17a9c055b2a74d10a3260bc4a Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Kempf <jb@videolan.org>
Date: Wed, 12 Mar 2014 00:11:26 +0100
Subject: [PATCH 04/14] Accept the weird WinRT pathes
Subject: [PATCH 04/20] Accept the weird WinRT pathes
---
src/text/url.c | 5 +++++
......
From 4fbf88d2555a4a140335afb7568310cffaccea99 Mon Sep 17 00:00:00 2001
From 3a743ae12f1595229c4a42ef1fa2950fdfb01872 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
Date: Tue, 2 Aug 2016 18:54:28 +0200
Subject: [PATCH 05/14] config: cmdline: Use msg_* instead of fprintf
Subject: [PATCH 05/20] config: cmdline: Use msg_* instead of fprintf
---
src/config/cmdline.c | 14 +++++++-------
......
From f6f9cd5f912092e0baaa691d666e90e5199db08c Mon Sep 17 00:00:00 2001
From 5c846a8f324a017f18a4fd9910475853b58b728f Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@videolabs.io>
Date: Fri, 30 Sep 2016 09:49:19 +0200
Subject: [PATCH 06/14] plugin cache: Windows doesn't like relative pathes in
Subject: [PATCH 06/20] plugin cache: Windows doesn't like relative pathes in
LoadLibraryEx()
Fixes "vlc-cache-gen ../modules" on Windows and general VLC_PLUGIN_PATH usage.
......
From 07d8c5ebb98e9baf339853184d54210fd60fb4b9 Mon Sep 17 00:00:00 2001
From 0cc1aaa214b24789104371f3ad4c31fc63ef6a50 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <slhomme@matroska.org>
Date: Fri, 2 Dec 2016 11:14:40 +0100
Subject: [PATCH 07/14] TEMPORARY: disable cuda/nvenc when building for
Subject: [PATCH 07/20] TEMPORARY: disable cuda/nvenc when building for
Winstore
---
......
From fac19c78da1011d004ad4c33f26fc2f9acfd4940 Mon Sep 17 00:00:00 2001
From 8bd8e5d30a0cba88c7964fc80f2ea97a84dbcf40 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@videolabs.io>
Date: Mon, 30 Jan 2017 09:57:41 +0100
Subject: [PATCH 08/14] directxva: allow decoding FF_PROFILE_H264_BASELINE
Subject: [PATCH 08/20] directxva: allow decoding FF_PROFILE_H264_BASELINE
without constraint
It works
......
From efcbccf2776e8ad4099a7993fc5a1b9e1241ae10 Mon Sep 17 00:00:00 2001
From e3e8f141cb1b3b3de43a7de6ece8f5542345b41f Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@videolabs.io>
Date: Wed, 25 Jan 2017 10:49:37 +0100
Subject: [PATCH 09/14] core: avcodec requires 32-bytes memory alignment in
Subject: [PATCH 09/20] core: avcodec requires 32-bytes memory alignment in
many cases
For example a IA0L texture on Windows is not 32 bytes aligned and avcodec
......
From 4b8b56131c781ee64ccc0e86ef1ec4a30ca9f2ea Mon Sep 17 00:00:00 2001
From 5563b7fad2d6960833f588fae4427d8d2dc9f7e6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
Date: Wed, 22 Nov 2017 14:13:15 +0100
Subject: [PATCH 10/14] contrib: ffmpeg: Fix winstore build
Subject: [PATCH 10/20] contrib: ffmpeg: Fix winstore build
---
contrib/src/ffmpeg/disable-wincrypt.patch | 10 ++++++++++
......
From b722d8e61f44a3974708e6c457b5e5cf7c9e2210 Mon Sep 17 00:00:00 2001
From ecd8afb48216599c2ec92bab7e99fde28c88a4e5 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@videolabs.io>
Date: Tue, 19 Dec 2017 12:39:06 +0100
Subject: [PATCH 11/14] contrib:avcodec: use a more recent FFmpeg version
Subject: [PATCH 11/20] contrib:avcodec: use a more recent FFmpeg version
So that it doesn't use bogus atomics based code
---
......
From f0b8ed47319c890072c59eaa34cb05839393d383 Mon Sep 17 00:00:00 2001
From c7f2bd58a902c298a42da4fbf05928feaa14f094 Mon Sep 17 00:00:00 2001
From: Martin Finkel <martin@videolabs.io>
Date: Tue, 16 Jan 2018 11:35:03 +0100
Subject: [PATCH 12/14] Revert "contrib: gnutls: update to current stable
Subject: [PATCH 12/20] Revert "contrib: gnutls: update to current stable
3.5.16 (fixes #19350)"
This reverts commit 496d5f426d7fde1bb60c90a0009d222a52fd582d.
......
From 7a4e50ee418eed84581eb9da839befd7512469d8 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Thu, 14 Sep 2017 12:35:43 +0200
Subject: [PATCH 13/20] video_output: adapt the late threshold to the frame
rate if there's one
---
src/video_output/video_output.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 640d999..dfe2a3b 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -862,9 +862,14 @@ static int ThreadDisplayPreparePicture(vout_thread_t *vout, bool reuse, bool fra
decoded = picture_fifo_Pop(vout->p->decoder_fifo);
if (decoded) {
if (is_late_dropped && !decoded->b_force) {
+ mtime_t late_threshold;
+ if (decoded->format.i_frame_rate && decoded->format.i_frame_rate_base)
+ late_threshold = ((CLOCK_FREQ/2) * decoded->format.i_frame_rate_base) / decoded->format.i_frame_rate;
+ else
+ late_threshold = VOUT_DISPLAY_LATE_THRESHOLD;
const mtime_t predicted = mdate() + 0; /* TODO improve */
const mtime_t late = predicted - decoded->date;
- if (late > VOUT_DISPLAY_LATE_THRESHOLD) {
+ if (late > late_threshold) {
msg_Warn(vout, "picture is too late to be displayed (missing %"PRId64" ms)", late/1000);
picture_Release(decoded);
vout_statistic_AddLost(&vout->p->statistic, 1);
--
2.10.1.windows.1
From b70db3006308f9b319881203d6d4165d26861656 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Mon, 19 Feb 2018 17:30:50 +0100
Subject: [PATCH 14/20] d3d11va: fix leak on error
---
modules/codec/avcodec/d3d11va.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index ac6d6bc..0ffb06a 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -420,6 +420,8 @@ static int D3dCreateDevice(vlc_va_t *va)
hr = ID3D11DeviceContext_QueryInterface(sys->d3d_dev.d3dcontext, &IID_ID3D11VideoContext, &d3dvidctx);
if (FAILED(hr)) {
msg_Err(va, "Could not Query ID3D11VideoContext Interface. (hr=0x%lX)", hr);
+ ID3D11DeviceContext_Release(sys->d3d_dev.d3dcontext);
+ ID3D11Device_Release(sys->d3d_dev.d3ddevice);
return VLC_EGENERIC;
}
sys->d3dvidctx = d3dvidctx;
--
2.10.1.windows.1
From cf91ff601df2d68ffd75dc9951023946d8232951 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Mon, 19 Feb 2018 15:24:41 +0100
Subject: [PATCH 15/20] d3d11va: try to decode to P010 with 10 bits decoders
---
modules/codec/avcodec/d3d11va.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 0ffb06a..bf6dcf5 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -530,6 +530,7 @@ static int DxGetInputList(vlc_va_t *va, input_list_t *p_list)
}
extern const GUID DXVA_ModeHEVC_VLD_Main10;
+extern const GUID DXVA_ModeVP9_VLD_10bit_Profile2;
static bool CanUseIntelHEVC(vlc_va_t *va)
{
vlc_va_sys_t *sys = va->sys;
@@ -569,6 +570,8 @@ static int DxSetupOutput(vlc_va_t *va, const GUID *input, const video_format_t *
int idx = 0;
if ( sys->render != DXGI_FORMAT_UNKNOWN )
processorInput[idx++] = sys->render;
+ if (IsEqualGUID(input, &DXVA_ModeHEVC_VLD_Main10) || IsEqualGUID(input, &DXVA_ModeVP9_VLD_10bit_Profile2))
+ processorInput[idx++] = DXGI_FORMAT_P010;
processorInput[idx++] = DXGI_FORMAT_NV12;
processorInput[idx++] = DXGI_FORMAT_420_OPAQUE;
processorInput[idx++] = DXGI_FORMAT_UNKNOWN;
--
2.10.1.windows.1
From 81113b0341fc775613b3db60a45b179156bc27e0 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Mon, 19 Feb 2018 12:37:04 +0100
Subject: [PATCH 16/20] direct3d11: only lock the picture if it's plane based
---
modules/video_output/win32/direct3d11.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index ab2a31e..3d13959 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -661,7 +661,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
.picture = pictures,
.picture_count = pool_size,
};
- if (vd->info.is_slow) {
+ if (vd->info.is_slow && !is_d3d11_opaque(surface_fmt.i_chroma)) {
pool_cfg.lock = Direct3D11MapPoolTexture;
//pool_cfg.unlock = Direct3D11UnmapPoolTexture;
}
--
2.10.1.windows.1
From 25c418eee1c7e6285a0417082606521400379cec Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Mon, 19 Feb 2018 17:31:33 +0100
Subject: [PATCH 17/20] d3d11va: reuse the global UWP context if possible
---
modules/codec/avcodec/d3d11va.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index bf6dcf5..4a83ab1 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -409,12 +409,26 @@ static int D3dCreateDevice(vlc_va_t *va)
return VLC_SUCCESS;
}
- /* */
- hr = D3D11_CreateDevice(va, &sys->hd3d, true, &sys->d3d_dev);
- if (FAILED(hr)) {
- msg_Err(va, "D3D11CreateDevice failed. (hr=0x%lX)", hr);
- return VLC_EGENERIC;
+#if VLC_WINSTORE_APP
+ sys->d3d_dev.d3dcontext = var_InheritInteger(va, "winrt-d3dcontext");
+ if (likely(sys->d3d_dev.d3dcontext))
+ {
+ ID3D11Device* d3ddevice = NULL;
+ ID3D11DeviceContext_GetDevice(sys->d3d_dev.d3dcontext, &sys->d3d_dev.d3ddevice);
+ ID3D11DeviceContext_AddRef(sys->d3d_dev.d3dcontext);
+ ID3D11Device_Release(sys->d3d_dev.d3ddevice);
}
+#endif
+
+ /* */
+ if (!sys->d3d_dev.d3ddevice)
+ {
+ hr = D3D11_CreateDevice(va, &sys->hd3d, true, &sys->d3d_dev);
+ if (FAILED(hr)) {
+ msg_Err(va, "D3D11CreateDevice failed. (hr=0x%lX)", hr);
+ return VLC_EGENERIC;
+ }
+ }
void *d3dvidctx = NULL;
hr = ID3D11DeviceContext_QueryInterface(sys->d3d_dev.d3dcontext, &IID_ID3D11VideoContext, &d3dvidctx);
--
2.10.1.windows.1
From 518bbcce8b2ea3fbffe1ec22559a66f6824c2bd8 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Mon, 19 Feb 2018 12:39:10 +0100
Subject: [PATCH 18/20] directx_va: adjust the Xbox constraints
It can't handle 4K aligned to 128 but is fine when aligned to 16.
---
modules/codec/avcodec/d3d11va.c | 2 +-
modules/codec/avcodec/directx_va.c | 8 ++++++--
modules/codec/avcodec/directx_va.h | 2 +-
modules/codec/avcodec/dxva2.c | 2 +-
4 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
index 4a83ab1..de4ebea 100644
--- a/modules/codec/avcodec/d3d11va.c
+++ b/modules/codec/avcodec/d3d11va.c
@@ -378,7 +378,7 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
if (err!=VLC_SUCCESS)
goto error;
- err = directx_va_Setup(va, &sys->dx_sys, ctx, fmt);
+ err = directx_va_Setup(va, &sys->dx_sys, ctx, fmt, isXboxHardware(sys->d3d_dev.d3ddevice));
if (err != VLC_SUCCESS)
goto error;
diff --git a/modules/codec/avcodec/directx_va.c b/modules/codec/avcodec/directx_va.c
index a2bb530..75a56f9 100644
--- a/modules/codec/avcodec/directx_va.c
+++ b/modules/codec/avcodec/directx_va.c
@@ -284,7 +284,7 @@ char *directx_va_GetDecoderName(const GUID *guid)
/* */
int directx_va_Setup(vlc_va_t *va, directx_sys_t *dx_sys, const AVCodecContext *avctx,
- const es_format_t *fmt)
+ const es_format_t *fmt, int flag_xbox)
{
/* */
if (FindVideoServiceConversion(va, dx_sys, fmt, avctx)) {
@@ -307,7 +307,11 @@ int directx_va_Setup(vlc_va_t *va, directx_sys_t *dx_sys, const AVCodecContext *
case AV_CODEC_ID_HEVC:
/* the HEVC DXVA2 spec asks for 128 pixel aligned surfaces to ensure
all coding features have enough room to work with */
- surface_alignment = 128;
+ /* On the Xbox 1/S, the decoder cannot do 4K aligned to 128 but is OK with 64 */
+ if (flag_xbox)
+ surface_alignment = 16;
+ else
+ surface_alignment = 128;
surface_count += 16;
break;
case AV_CODEC_ID_H264:
diff --git a/modules/codec/avcodec/directx_va.h b/modules/codec/avcodec/directx_va.h
index 7dbef97..b8e62aa 100644
--- a/modules/codec/avcodec/directx_va.h
+++ b/modules/codec/avcodec/directx_va.h
@@ -80,7 +80,7 @@ typedef struct
int directx_va_Open(vlc_va_t *, directx_sys_t *);
void directx_va_Close(vlc_va_t *, directx_sys_t *);
-int directx_va_Setup(vlc_va_t *, directx_sys_t *, const AVCodecContext *avctx, const es_format_t *);
+int directx_va_Setup(vlc_va_t *, directx_sys_t *, const AVCodecContext *avctx, const es_format_t *, int flag_xbox);
char *directx_va_GetDecoderName(const GUID *guid);
#endif /* AVCODEC_DIRECTX_VA_H */
diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index 25de31d..42f5172 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -315,7 +315,7 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat pix_fmt,
if (err!=VLC_SUCCESS)
goto error;
- err = directx_va_Setup(va, &sys->dx_sys, ctx, fmt);
+ err = directx_va_Setup(va, &sys->dx_sys, ctx, fmt, 0);
if (err != VLC_SUCCESS)
goto error;
--
2.10.1.windows.1
From c5b8856cf468de16db1a95de8e709405ca8bab93 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Mon, 19 Feb 2018 14:47:48 +0100
Subject: [PATCH 19/20] avcodec: limit the amount of threads to 6 for UWP apps
This will also limit the amount of memory used
---
modules/codec/avcodec/video.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index abb6bdd..9df2c41 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -542,7 +542,11 @@ int InitVideoDec( vlc_object_t *obj )
i_thread_count++;
//FIXME: take in count the decoding time
+#if VLC_WINSTORE_APP
+ i_thread_count = __MIN( i_thread_count, 6 );
+#else
i_thread_count = __MIN( i_thread_count, p_codec->id == AV_CODEC_ID_HEVC ? 10 : 6 );
+#endif
}
i_thread_count = __MIN( i_thread_count, p_codec->id == AV_CODEC_ID_HEVC ? 32 : 16 );
msg_Dbg( p_dec, "allowing %d thread(s) for decoding", i_thread_count );
--
2.10.1.windows.1
From 1cb366c0dcbcf0234386c03d2f2a50de511e2293 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Mon, 19 Feb 2018 14:50:10 +0100
Subject: [PATCH 20/20] direct3d11: limit the amount of pool slices on Winstore
apps
They're limited in memory and don't like too many slices. In most cases
the d3d11va pool will be used instead.
---
modules/video_output/win32/direct3d11.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 3d13959..46630ca 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -587,6 +587,13 @@ 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))
+ pool_size = __MIN(pool_size, 6);
+#endif
+
if (SetupQuad( vd, &surface_fmt, &sys->picQuad, &sys->sys.rect_src_clipped,
sys->picQuadConfig, sys->picQuadPixelShader,
surface_fmt.projection_mode, vd->fmt.orientation ) != VLC_SUCCESS) {
--
2.10.1.windows.1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment