diff options
| author | 2021-12-12 17:43:10 -0700 | |
|---|---|---|
| committer | 2021-12-13 22:29:19 -0700 | |
| commit | a2d73eaa107bb5e3cd570e522fc69311468c2c89 (patch) | |
| tree | 62305d776efe84061d94003f4e51557e161c092f | |
| parent | CI: fix MinGW installation step (diff) | |
| download | yuzu-a2d73eaa107bb5e3cd570e522fc69311468c2c89.tar.gz yuzu-a2d73eaa107bb5e3cd570e522fc69311468c2c89.tar.xz yuzu-a2d73eaa107bb5e3cd570e522fc69311468c2c89.zip | |
video_core/codecs: skip decoders that use hw frames ...
... this would resolve some edge-cases where multiple devices are
present and ffmpeg is unable to auto-supply the hw surfaces
| -rw-r--r-- | src/video_core/command_classes/codecs/codec.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/video_core/command_classes/codecs/codec.cpp b/src/video_core/command_classes/codecs/codec.cpp index 2a532b883..439c47209 100644 --- a/src/video_core/command_classes/codecs/codec.cpp +++ b/src/video_core/command_classes/codecs/codec.cpp | |||
| @@ -130,6 +130,12 @@ bool Codec::CreateGpuAvDevice() { | |||
| 130 | } | 130 | } |
| 131 | if (config->methods & HW_CONFIG_METHOD && config->device_type == type) { | 131 | if (config->methods & HW_CONFIG_METHOD && config->device_type == type) { |
| 132 | av_codec_ctx->pix_fmt = config->pix_fmt; | 132 | av_codec_ctx->pix_fmt = config->pix_fmt; |
| 133 | if (config->methods & AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX) { | ||
| 134 | // skip zero-copy decoders, we don't currently support them | ||
| 135 | LOG_DEBUG(Service_NVDRV, "Skipping decoder {} with unsupported capability {}.", | ||
| 136 | av_hwdevice_get_type_name(type), config->methods); | ||
| 137 | continue; | ||
| 138 | } | ||
| 133 | LOG_INFO(Service_NVDRV, "Using {} GPU decoder", av_hwdevice_get_type_name(type)); | 139 | LOG_INFO(Service_NVDRV, "Using {} GPU decoder", av_hwdevice_get_type_name(type)); |
| 134 | return true; | 140 | return true; |
| 135 | } | 141 | } |
| @@ -251,6 +257,9 @@ void Codec::Decode() { | |||
| 251 | final_frame->format = PREFERRED_GPU_FMT; | 257 | final_frame->format = PREFERRED_GPU_FMT; |
| 252 | const int ret = av_hwframe_transfer_data(final_frame.get(), initial_frame.get(), 0); | 258 | const int ret = av_hwframe_transfer_data(final_frame.get(), initial_frame.get(), 0); |
| 253 | ASSERT_MSG(!ret, "av_hwframe_transfer_data error {}", ret); | 259 | ASSERT_MSG(!ret, "av_hwframe_transfer_data error {}", ret); |
| 260 | // null the hw frame context to prevent the buffer from being deleted | ||
| 261 | // and leaving a dangling reference in the av_codec_ctx | ||
| 262 | initial_frame->hw_frames_ctx = nullptr; | ||
| 254 | } else { | 263 | } else { |
| 255 | final_frame = std::move(initial_frame); | 264 | final_frame = std::move(initial_frame); |
| 256 | } | 265 | } |