diff options
author | Jøger Hansegård <joger.hansegard@qt.io> | 2024-04-29 22:47:36 +0200 |
---|---|---|
committer | Jøger Hansegård <joger.hansegard@qt.io> | 2024-05-03 18:02:45 +0200 |
commit | 68d3b6606864226fb73ecba07f6ff215ec533b60 (patch) | |
tree | 248527d5e404610e66d1682c5005dfa0d08ef056 | |
parent | ceafdc0436e5ab3fccf64f0eb688bd0e0656fa7f (diff) |
Reduce startup time on Windows with FFmpeg 7.0
FFmpeg 7.0 introduces a new AV_HWDEVICE_TYPE_D3D12VA device type. Since
Direct3D 12 exists on all Windows versions supported by Qt, we can skip
checking if the D3D12VA HW context can be created, and instead rely on a
precheck that verifies presence of d3d12.dll. This saves time during
startup on all Windows versions.
Task-number: QTBUG-124482
Pick-to: 6.7 6.5
Change-Id: I9aff8640c28fab3a710d5f939b37301cc873f416
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Reviewed-by: Tim Blechmann <tim@klingt.org>
-rw-r--r-- | src/plugins/multimedia/ffmpeg/qffmpegdefs_p.h | 2 | ||||
-rw-r--r-- | src/plugins/multimedia/ffmpeg/qffmpeghwaccel.cpp | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/plugins/multimedia/ffmpeg/qffmpegdefs_p.h b/src/plugins/multimedia/ffmpeg/qffmpegdefs_p.h index f3860377e..239d8ff0c 100644 --- a/src/plugins/multimedia/ffmpeg/qffmpegdefs_p.h +++ b/src/plugins/multimedia/ffmpeg/qffmpegdefs_p.h @@ -32,6 +32,8 @@ extern "C" { (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(60, 3, 100)) // since ffmpeg n6.0 #define QT_FFMPEG_STREAM_SIDE_DATA_DEPRECATED \ (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(60, 15, 100)) // since ffmpeg n6.1 +#define QT_FFMPEG_HAS_D3D12VA \ + (LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(59, 8, 100)) // since ffmpeg n7.0 #define QT_FFMPEG_SWR_CONST_CH_LAYOUT (LIBSWRESAMPLE_VERSION_INT >= AV_VERSION_INT(4, 9, 100)) #define QT_FFMPEG_AVIO_WRITE_CONST \ (LIBAVFORMAT_VERSION_MAJOR >= 61) diff --git a/src/plugins/multimedia/ffmpeg/qffmpeghwaccel.cpp b/src/plugins/multimedia/ffmpeg/qffmpeghwaccel.cpp index 78e265b4b..06bd4f4d3 100644 --- a/src/plugins/multimedia/ffmpeg/qffmpeghwaccel.cpp +++ b/src/plugins/multimedia/ffmpeg/qffmpeghwaccel.cpp @@ -93,6 +93,11 @@ static bool precheckDriver(AVHWDeviceType type) if (type == AV_HWDEVICE_TYPE_D3D11VA) return QSystemLibrary(QLatin1String("d3d11.dll")).load(); +#if QT_FFMPEG_HAS_D3D12VA + if (type == AV_HWDEVICE_TYPE_D3D12VA) + return QSystemLibrary(QLatin1String("d3d12.dll")).load(); +#endif + if (type == AV_HWDEVICE_TYPE_DXVA2) return QSystemLibrary(QLatin1String("d3d9.dll")).load(); @@ -122,6 +127,9 @@ static bool checkHwType(AVHWDeviceType type) if (type == AV_HWDEVICE_TYPE_MEDIACODEC || type == AV_HWDEVICE_TYPE_VIDEOTOOLBOX || type == AV_HWDEVICE_TYPE_D3D11VA || +#if QT_FFMPEG_HAS_D3D12VA + type == AV_HWDEVICE_TYPE_D3D12VA || +#endif type == AV_HWDEVICE_TYPE_DXVA2) return true; // Don't waste time; it's expected to work fine of the precheck is OK |