diff options
| author | 2024-01-26 16:10:21 -0500 | |
|---|---|---|
| committer | 2024-02-09 09:20:53 -0500 | |
| commit | 0cb413c3d31b93ce347e997b9674c304094dab09 (patch) | |
| tree | 959ef73963ea1e7975690d31eaf4ddc2f2ad6e19 /src/core | |
| parent | nvnflinger/gpu: implement blending (diff) | |
| download | yuzu-0cb413c3d31b93ce347e997b9674c304094dab09.tar.gz yuzu-0cb413c3d31b93ce347e997b9674c304094dab09.tar.xz yuzu-0cb413c3d31b93ce347e997b9674c304094dab09.zip | |
nvnflinger/gpu: implement applet capture
Diffstat (limited to 'src/core')
| -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) { | |||
| 68 | 68 | ||
| 69 | Result SystemBufferManager::WriteAppletCaptureBuffer(bool* out_was_written, | 69 | Result SystemBufferManager::WriteAppletCaptureBuffer(bool* out_was_written, |
| 70 | s32* out_fbshare_layer_index) { | 70 | s32* out_fbshare_layer_index) { |
| 71 | // TODO | 71 | if (!m_buffer_sharing_enabled) { |
| 72 | R_SUCCEED(); | 72 | return VI::ResultPermissionDenied; |
| 73 | } | ||
| 74 | |||
| 75 | return m_nvnflinger->GetSystemBufferManager().WriteAppletCaptureBuffer(out_was_written, | ||
| 76 | out_fbshare_layer_index); | ||
| 73 | } | 77 | } |
| 74 | 78 | ||
| 75 | } // namespace Service::AM | 79 | } // 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 @@ | |||
| 15 | #include "core/hle/service/vi/layer/vi_layer.h" | 15 | #include "core/hle/service/vi/layer/vi_layer.h" |
| 16 | #include "core/hle/service/vi/vi_results.h" | 16 | #include "core/hle/service/vi/vi_results.h" |
| 17 | #include "video_core/gpu.h" | 17 | #include "video_core/gpu.h" |
| 18 | #include "video_core/host1x/host1x.h" | ||
| 18 | 19 | ||
| 19 | namespace Service::Nvnflinger { | 20 | namespace Service::Nvnflinger { |
| 20 | 21 | ||
| @@ -414,9 +415,30 @@ Result FbShareBufferManager::GetSharedFrameBufferAcquirableEvent(Kernel::KReadab | |||
| 414 | R_SUCCEED(); | 415 | R_SUCCEED(); |
| 415 | } | 416 | } |
| 416 | 417 | ||
| 417 | Result FbShareBufferManager::WriteAppletCaptureBuffer(bool* out_was_written, | 418 | Result FbShareBufferManager::WriteAppletCaptureBuffer(bool* out_was_written, s32* out_layer_index) { |
| 418 | s32* out_layer_index) { | 419 | std::vector<u8> capture_buffer(m_system.GPU().GetAppletCaptureBuffer()); |
| 419 | // TODO | 420 | Common::ScratchBuffer<u32> scratch; |
| 421 | |||
| 422 | // TODO: this could be optimized | ||
| 423 | s64 e = -1280 * 768 * 4; | ||
| 424 | for (auto& block : *m_buffer_page_group) { | ||
| 425 | u8* start = m_system.DeviceMemory().GetPointer<u8>(block.GetAddress()); | ||
| 426 | u8* end = m_system.DeviceMemory().GetPointer<u8>(block.GetAddress() + block.GetSize()); | ||
| 427 | |||
| 428 | for (; start < end; start++) { | ||
| 429 | *start = 0; | ||
| 430 | |||
| 431 | if (e >= 0 && e < static_cast<s64>(capture_buffer.size())) { | ||
| 432 | *start = capture_buffer[e]; | ||
| 433 | } | ||
| 434 | e++; | ||
| 435 | } | ||
| 436 | |||
| 437 | m_system.GPU().Host1x().MemoryManager().ApplyOpOnPointer(start, scratch, [&](DAddr addr) { | ||
| 438 | m_system.GPU().InvalidateRegion(addr, end - start); | ||
| 439 | }); | ||
| 440 | } | ||
| 441 | |||
| 420 | *out_was_written = true; | 442 | *out_was_written = true; |
| 421 | *out_layer_index = 1; | 443 | *out_layer_index = 1; |
| 422 | R_SUCCEED(); | 444 | R_SUCCEED(); |