mirror of
https://github.com/mpv-player/mpv
synced 2025-03-25 04:38:01 +00:00
d3d: make DXVA2 support optional
This partially reverts the change from a longer time ago to always build DXVA2 and D3D11VA together. To make it simpler, we change the following: - building with ANGLE headers is now required to build D3D hwaccels - if DXVA2 is enabled, D3D11VA is still forcibly built - the CLI vo_opengl ANGLE backend is now under --egl-angle-win32 This is done to reduce the dependency mess slightly.
This commit is contained in:
parent
c61520b6bd
commit
dd408e68ed
@ -699,7 +699,7 @@ const m_option_t mp_opts[] = {
|
||||
OPT_SUBSTRUCT("", gl_video_opts, gl_video_conf, 0),
|
||||
#endif
|
||||
|
||||
#if HAVE_EGL_ANGLE
|
||||
#if HAVE_EGL_ANGLE_WIN32
|
||||
OPT_SUBSTRUCT("", angle_opts, angle_conf, 0),
|
||||
#endif
|
||||
|
||||
|
@ -377,9 +377,12 @@ AVBufferRef *d3d9_wrap_device_ref(struct IDirect3DDevice9 *device) { return NULL
|
||||
#else /* !HAVE_D3D_HWACCEL_NEW */
|
||||
|
||||
#include <libavutil/hwcontext.h>
|
||||
#include <libavutil/hwcontext_dxva2.h>
|
||||
#include <libavutil/hwcontext_d3d11va.h>
|
||||
|
||||
#if HAVE_D3D9_HWACCEL
|
||||
#include <libavutil/hwcontext_dxva2.h>
|
||||
#endif
|
||||
|
||||
void d3d_hwframes_refine(struct lavc_ctx *ctx, AVBufferRef *hw_frames_ctx)
|
||||
{
|
||||
AVHWFramesContext *fctx = (void *)hw_frames_ctx->data;
|
||||
@ -400,11 +403,13 @@ void d3d_hwframes_refine(struct lavc_ctx *ctx, AVBufferRef *hw_frames_ctx)
|
||||
fctx->width = FFALIGN(fctx->width, alignment);
|
||||
fctx->height = FFALIGN(fctx->height, alignment);
|
||||
|
||||
#if HAVE_D3D9_HWACCEL
|
||||
if (fctx->format == AV_PIX_FMT_DXVA2_VLD) {
|
||||
AVDXVA2FramesContext *hwctx = fctx->hwctx;
|
||||
|
||||
hwctx->surface_type = DXVA2_VideoDecoderRenderTarget;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (fctx->format == AV_PIX_FMT_D3D11) {
|
||||
AVD3D11VAFramesContext *hwctx = fctx->hwctx;
|
||||
|
@ -265,8 +265,11 @@ static const struct vd_lavc_hwdec *const hwdec_list[] = {
|
||||
#endif
|
||||
#if HAVE_D3D_HWACCEL
|
||||
&mp_vd_lavc_d3d11va,
|
||||
|
||||
#if HAVE_D3D9_HWACCEL
|
||||
&mp_vd_lavc_dxva2,
|
||||
&mp_vd_lavc_dxva2_copy,
|
||||
#endif
|
||||
&mp_vd_lavc_d3d11va_copy,
|
||||
#endif
|
||||
#if HAVE_ANDROID
|
||||
|
@ -56,7 +56,7 @@ static const struct mpgl_driver *const backends[] = {
|
||||
#if HAVE_GL_COCOA
|
||||
&mpgl_driver_cocoa,
|
||||
#endif
|
||||
#if HAVE_EGL_ANGLE
|
||||
#if HAVE_EGL_ANGLE_WIN32
|
||||
&mpgl_driver_angle,
|
||||
#endif
|
||||
#if HAVE_GL_WIN32
|
||||
|
@ -51,15 +51,15 @@ static const struct gl_hwdec_driver *const mpgl_hwdec_drivers[] = {
|
||||
&gl_hwdec_videotoolbox,
|
||||
#endif
|
||||
#if HAVE_D3D_HWACCEL
|
||||
#if HAVE_EGL_ANGLE
|
||||
&gl_hwdec_d3d11egl,
|
||||
&gl_hwdec_d3d11eglrgb,
|
||||
#if HAVE_D3D9_HWACCEL
|
||||
&gl_hwdec_dxva2egl,
|
||||
#endif
|
||||
#endif
|
||||
#if HAVE_GL_DXINTEROP
|
||||
#if HAVE_GL_DXINTEROP_D3D9
|
||||
&gl_hwdec_dxva2gldx,
|
||||
#endif
|
||||
#endif
|
||||
#if HAVE_CUDA_HWACCEL
|
||||
&gl_hwdec_cuda,
|
||||
#endif
|
||||
|
28
wscript
28
wscript
@ -619,7 +619,7 @@ video_output_features = [
|
||||
check_statement('d3d9.h', 'IDirect3D9Ex *d'))
|
||||
} , {
|
||||
'name': '--egl-angle',
|
||||
'desc': 'OpenGL Win32 ANGLE Backend',
|
||||
'desc': 'OpenGL ANGLE headers',
|
||||
'deps_any': [ 'os-win32', 'os-cygwin' ],
|
||||
'groups': [ 'gl' ],
|
||||
'func': check_statement(['EGL/egl.h', 'EGL/eglext.h'],
|
||||
@ -635,6 +635,12 @@ video_output_features = [
|
||||
'-DANGLE_NO_ALIASES', '-DANGLE_EXPORT='],
|
||||
lib=['EGL', 'GLESv2', 'dxguid', 'd3d9',
|
||||
'gdi32', 'stdc++'])
|
||||
}, {
|
||||
'name': '--egl-angle-win32',
|
||||
'desc': 'OpenGL Win32 ANGLE Backend',
|
||||
'deps': [ 'egl-angle', 'win32-desktop' ],
|
||||
'groups': [ 'gl' ],
|
||||
'func': check_true,
|
||||
} , {
|
||||
'name': '--vdpau',
|
||||
'desc': 'VDPAU acceleration',
|
||||
@ -736,7 +742,7 @@ video_output_features = [
|
||||
'name': 'egl-helpers',
|
||||
'desc': 'EGL helper functions',
|
||||
'deps_any': [ 'egl-x11', 'mali-fbdev', 'rpi', 'gl-wayland', 'egl-drm',
|
||||
'egl-angle' ],
|
||||
'egl-angle-win32' ],
|
||||
'func': check_true
|
||||
}
|
||||
]
|
||||
@ -794,13 +800,14 @@ hwaccel_features = [
|
||||
' ? 1 : -1]',
|
||||
use='libav'),
|
||||
}, {
|
||||
# (conflated with ANGLE for easier deps)
|
||||
'name': '--d3d-hwaccel',
|
||||
'desc': 'DXVA2 and D3D11VA hwaccel',
|
||||
'deps': [ 'win32-desktop' ],
|
||||
'desc': 'D3D11VA hwaccel (plus ANGLE)',
|
||||
'deps': [ 'os-win32', 'egl-angle' ],
|
||||
'func': check_true,
|
||||
}, {
|
||||
'name': '--d3d-hwaccel-new',
|
||||
'desc': 'DXVA2 and D3D11VA hwaccel (new API)',
|
||||
'desc': 'D3D11VA hwaccel (new API)',
|
||||
'func': check_statement('libavcodec/version.h',
|
||||
'int x[(LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(58, 4, 0) && '
|
||||
' LIBAVCODEC_VERSION_MICRO < 100) ||'
|
||||
@ -809,6 +816,17 @@ hwaccel_features = [
|
||||
' ? 1 : -1]',
|
||||
use='libav'),
|
||||
'deps': [ 'd3d-hwaccel' ],
|
||||
}, {
|
||||
'name': '--d3d9-hwaccel',
|
||||
'desc': 'DXVA2 hwaccel (plus ANGLE)',
|
||||
'deps': [ 'd3d-hwaccel', 'egl-angle-win32' ],
|
||||
'func': check_true,
|
||||
}, {
|
||||
'name': '--gl-dxinterop-d3d9',
|
||||
'desc': 'OpenGL/DirectX Interop Backend DXVA2 interop',
|
||||
'deps': [ 'gl-dxinterop', 'd3d9-hwaccel' ],
|
||||
'groups': [ 'gl' ],
|
||||
'func': check_true,
|
||||
}, {
|
||||
'name': '--cuda-hwaccel',
|
||||
'desc': 'CUDA hwaccel',
|
||||
|
@ -325,10 +325,10 @@ def build(ctx):
|
||||
( "video/vdpau.c", "vdpau" ),
|
||||
( "video/vdpau_mixer.c", "vdpau" ),
|
||||
( "video/vt.c", "videotoolbox-hwaccel" ),
|
||||
( "video/decode/d3d.c", "win32-desktop" ),
|
||||
( "video/decode/d3d.c", "d3d-hwaccel" ),
|
||||
( "video/decode/dec_video.c"),
|
||||
( "video/decode/hw_cuda.c", "cuda-hwaccel" ),
|
||||
( "video/decode/hw_dxva2.c", "d3d-hwaccel" ),
|
||||
( "video/decode/hw_dxva2.c", "d3d9-hwaccel" ),
|
||||
( "video/decode/hw_d3d11va.c", "d3d-hwaccel" ),
|
||||
( "video/decode/hw_videotoolbox.c", "videotoolbox-hwaccel" ),
|
||||
( "video/decode/vd_lavc.c" ),
|
||||
@ -366,7 +366,7 @@ def build(ctx):
|
||||
( "video/out/opengl/angle_dynamic.c", "egl-angle" ),
|
||||
( "video/out/opengl/common.c", "gl" ),
|
||||
( "video/out/opengl/context.c", "gl" ),
|
||||
( "video/out/opengl/context_angle.c", "egl-angle" ),
|
||||
( "video/out/opengl/context_angle.c", "egl-angle-win32" ),
|
||||
( "video/out/opengl/context_cocoa.c", "gl-cocoa" ),
|
||||
( "video/out/opengl/context_drm_egl.c", "egl-drm" ),
|
||||
( "video/out/opengl/context_dxinterop.c","gl-dxinterop" ),
|
||||
@ -382,10 +382,10 @@ def build(ctx):
|
||||
( "video/out/opengl/formats.c", "gl" ),
|
||||
( "video/out/opengl/hwdec.c", "gl" ),
|
||||
( "video/out/opengl/hwdec_cuda.c", "cuda-hwaccel" ),
|
||||
( "video/out/opengl/hwdec_d3d11egl.c", "egl-angle" ),
|
||||
( "video/out/opengl/hwdec_d3d11eglrgb.c","egl-angle" ),
|
||||
( "video/out/opengl/hwdec_dxva2gldx.c", "gl-dxinterop" ),
|
||||
( "video/out/opengl/hwdec_dxva2egl.c", "egl-angle" ),
|
||||
( "video/out/opengl/hwdec_d3d11egl.c", "d3d-hwaccel" ),
|
||||
( "video/out/opengl/hwdec_d3d11eglrgb.c","d3d-hwaccel" ),
|
||||
( "video/out/opengl/hwdec_dxva2gldx.c", "gl-dxinterop-d3d9" ),
|
||||
( "video/out/opengl/hwdec_dxva2egl.c", "d3d9-hwaccel" ),
|
||||
( "video/out/opengl/hwdec_osx.c", "videotoolbox-gl" ),
|
||||
( "video/out/opengl/hwdec_ios.m", "ios-gl" ),
|
||||
( "video/out/opengl/hwdec_rpi.c", "rpi" ),
|
||||
|
Loading…
Reference in New Issue
Block a user