Optimize CUDA support to avoid roundtrip to CPU memory

This commit is contained in:
Cameron Gutman
2021-12-06 18:22:39 -06:00
parent f0c292f508
commit 3e9aea1f7a
5 changed files with 141 additions and 8 deletions
+7 -4
View File
@@ -6,7 +6,6 @@
#include <h264_stream.h>
#include "ffmpeg-renderers/sdlvid.h"
#include "ffmpeg-renderers/cuda.h"
#ifdef Q_OS_WIN32
#include "ffmpeg-renderers/dxva2.h"
@@ -36,6 +35,10 @@
#include "ffmpeg-renderers/eglvid.h"
#endif
#ifdef HAVE_CUDA
#include "ffmpeg-renderers/cuda.h"
#endif
// This is gross but it allows us to use sizeof()
#include "ffmpeg_videosamples.cpp"
@@ -567,11 +570,11 @@ IFFmpegRenderer* FFmpegVideoDecoder::createHwAccelRenderer(const AVCodecHWConfig
// Second pass for our second-tier hwaccel implementations
else if (pass == 1) {
switch (hwDecodeCfg->device_type) {
#ifdef HAVE_CUDA
case AV_HWDEVICE_TYPE_CUDA:
// CUDA should only be used if all other options fail, since it requires
// read-back of frames. This should only be used for the NVIDIA+Wayland case
// with VDPAU covering the NVIDIA+X11 scenario.
// CUDA should only be used to cover the NVIDIA+Wayland case
return new CUDARenderer();
#endif
default:
return nullptr;
}