diff options
author | Liam <byteslice@airmail.cc> | 2024-01-26 22:10:21 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2024-02-09 15:20:53 +0100 |
commit | 0cb413c3d31b93ce347e997b9674c304094dab09 (patch) | |
tree | 959ef73963ea1e7975690d31eaf4ddc2f2ad6e19 /src/core/hle/service | |
parent | nvnflinger/gpu: implement blending (diff) | |
download | yuzu-0cb413c3d31b93ce347e997b9674c304094dab09.tar yuzu-0cb413c3d31b93ce347e997b9674c304094dab09.tar.gz yuzu-0cb413c3d31b93ce347e997b9674c304094dab09.tar.bz2 yuzu-0cb413c3d31b93ce347e997b9674c304094dab09.tar.lz yuzu-0cb413c3d31b93ce347e997b9674c304094dab09.tar.xz yuzu-0cb413c3d31b93ce347e997b9674c304094dab09.tar.zst yuzu-0cb413c3d31b93ce347e997b9674c304094dab09.zip |
Diffstat (limited to 'src/core/hle/service')
-rw-r--r-- | src/core/hle/service/am/system_buffer_manager.cpp | 8 | ||||
-rw-r--r-- | src/core/hle/service/nvnflinger/fb_share_buffer_manager.cpp | 28 |
2 files changed, 31 insertions, 5 deletions
diff --git a/src/core/hle/service/am/system_buffer_manager.cpp b/src/core/hle/service/am/system_buffer_manager.cpp index 3cccc5388..7fb9e3a75 100644 --- a/src/core/hle/service/am/system_buffer_manager.cpp +++ b/src/core/hle/service/am/system_buffer_manager.cpp @@ -68,8 +68,12 @@ void SystemBufferManager::SetWindowVisibility(bool visible) { Result SystemBufferManager::WriteAppletCaptureBuffer(bool* out_was_written, s32* out_fbshare_layer_index) { - // TODO - R_SUCCEED(); + if (!m_buffer_sharing_enabled) { + return VI::ResultPermissionDenied; + } + + return m_nvnflinger->GetSystemBufferManager().WriteAppletCaptureBuffer(out_was_written, + out_fbshare_layer_index); } } // namespace Service::AM diff --git a/src/core/hle/service/nvnflinger/fb_share_buffer_manager.cpp b/src/core/hle/service/nvnflinger/fb_share_buffer_manager.cpp index 6a7da0cae..90f7248a0 100644 --- a/src/core/hle/service/nvnflinger/fb_share_buffer_manager.cpp +++ b/src/core/hle/service/nvnflinger/fb_share_buffer_manager.cpp @@ -15,6 +15,7 @@ #include "core/hle/service/vi/layer/vi_layer.h" #include "core/hle/service/vi/vi_results.h" #include "video_core/gpu.h" +#include "video_core/host1x/host1x.h" namespace Service::Nvnflinger { @@ -414,9 +415,30 @@ Result FbShareBufferManager::GetSharedFrameBufferAcquirableEvent(Kernel::KReadab R_SUCCEED(); } -Result FbShareBufferManager::WriteAppletCaptureBuffer(bool* out_was_written, - s32* out_layer_index) { - // TODO +Result FbShareBufferManager::WriteAppletCaptureBuffer(bool* out_was_written, s32* out_layer_index) { + std::vector<u8> capture_buffer(m_system.GPU().GetAppletCaptureBuffer()); + Common::ScratchBuffer<u32> scratch; + + // TODO: this could be optimized + s64 e = -1280 * 768 * 4; + for (auto& block : *m_buffer_page_group) { + u8* start = m_system.DeviceMemory().GetPointer<u8>(block.GetAddress()); + u8* end = m_system.DeviceMemory().GetPointer<u8>(block.GetAddress() + block.GetSize()); + + for (; start < end; start++) { + *start = 0; + + if (e >= 0 && e < static_cast<s64>(capture_buffer.size())) { + *start = capture_buffer[e]; + } + e++; + } + + m_system.GPU().Host1x().MemoryManager().ApplyOpOnPointer(start, scratch, [&](DAddr addr) { + m_system.GPU().InvalidateRegion(addr, end - start); + }); + } + *out_was_written = true; *out_layer_index = 1; R_SUCCEED(); |