aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/host1x/ffmpeg/ffmpeg.cpp
diff options
context:
space:
mode:
authorJPikachu <jpikachu.eden@gmail.com>2025-06-29 17:14:23 +0000
committerJPikachu <jpikachu@noreply.localhost>2025-06-29 17:14:23 +0000
commit91a662431cfe419bd46b6ca4ed298a4ba70d7820 (patch)
tree686cf38ab4c6d697e336be4684626707284afca2 /src/video_core/host1x/ffmpeg/ffmpeg.cpp
parentb5b1d20e1e0756066abf0457bd66695dde40bab7 (diff)
[Texture_cache] Better memory handling for devices with lower memory allocations (#233)
Means games like Minecraft Dungeons, Sea of Stars, Luigi Mansion 2, Astroneer, Alan Wake, etc are now playable. It also cleans up the recent abi.cpp and bindless texture commits a bit. Everything is in #ifdef ANDROID - The biggest change is CACHING_PAGEBITS = 12. Without that the way the buffercache grows and joins buffers can cause Android to run out of memory (as you end up with just one big buffer that needs to be copied every time it grows) Also patches up ffmpeg issues. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/233 Co-authored-by: JPikachu <jpikachu.eden@gmail.com> Co-committed-by: JPikachu <jpikachu.eden@gmail.com>
Diffstat (limited to 'src/video_core/host1x/ffmpeg/ffmpeg.cpp')
-rw-r--r--src/video_core/host1x/ffmpeg/ffmpeg.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/video_core/host1x/ffmpeg/ffmpeg.cpp b/src/video_core/host1x/ffmpeg/ffmpeg.cpp
index ffde231aee..4bca9ab7b1 100644
--- a/src/video_core/host1x/ffmpeg/ffmpeg.cpp
+++ b/src/video_core/host1x/ffmpeg/ffmpeg.cpp
@@ -237,16 +237,23 @@ std::shared_ptr<Frame> DecoderContext::ReceiveFrame() {
if (m_codec_context->hw_device_ctx) {
// If we have a hardware context, make a separate frame here to receive the
// hardware result before sending it to the output.
- Frame intermediate_frame;
+ std::shared_ptr<Frame> intermediate_frame = std::make_shared<Frame>();
- if (!receive(intermediate_frame.GetFrame())) {
+ if (!receive(intermediate_frame->GetFrame())) {
return {};
}
- m_temp_frame->SetFormat(PreferredGpuFormat);
- if (int ret = av_hwframe_transfer_data(m_temp_frame->GetFrame(), intermediate_frame.GetFrame(), 0); ret < 0) {
- LOG_ERROR(HW_GPU, "av_hwframe_transfer_data error: {}", AVError(ret));
- return {};
+ const auto fmt = intermediate_frame->GetPixelFormat();
+ const auto desc = av_pix_fmt_desc_get(fmt);
+ if (desc && (desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
+ m_temp_frame->SetFormat(PreferredGpuFormat);
+ if (int ret = av_hwframe_transfer_data(m_temp_frame->GetFrame(), intermediate_frame->GetFrame(), 0); ret < 0) {
+ LOG_ERROR(HW_GPU, "av_hwframe_transfer_data error: {}", AVError(ret));
+ return {};
+ }
+ }
+ else {
+ m_temp_frame = std::move(intermediate_frame);
}
} else {
// Otherwise, decode the frame as normal.