diff options
author | Narr the Reg <juangerman-13@hotmail.com> | 2024-02-12 03:58:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-12 03:58:28 +0100 |
commit | 2ff45cd0da941dce2564f5c18c580d0283da27bf (patch) | |
tree | 81fea8c23f9afa39c167288e03ff57eb25413ee4 /src/core/hle/service/nvnflinger/fb_share_buffer_manager.h | |
parent | Merge pull request #12991 from german77/news2 (diff) | |
parent | am: use applet program loading for tested versions (diff) | |
download | yuzu-2ff45cd0da941dce2564f5c18c580d0283da27bf.tar yuzu-2ff45cd0da941dce2564f5c18c580d0283da27bf.tar.gz yuzu-2ff45cd0da941dce2564f5c18c580d0283da27bf.tar.bz2 yuzu-2ff45cd0da941dce2564f5c18c580d0283da27bf.tar.lz yuzu-2ff45cd0da941dce2564f5c18c580d0283da27bf.tar.xz yuzu-2ff45cd0da941dce2564f5c18c580d0283da27bf.tar.zst yuzu-2ff45cd0da941dce2564f5c18c580d0283da27bf.zip |
Diffstat (limited to 'src/core/hle/service/nvnflinger/fb_share_buffer_manager.h')
-rw-r--r-- | src/core/hle/service/nvnflinger/fb_share_buffer_manager.h | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/core/hle/service/nvnflinger/fb_share_buffer_manager.h b/src/core/hle/service/nvnflinger/fb_share_buffer_manager.h index 033bf4bbe..b79a7d23a 100644 --- a/src/core/hle/service/nvnflinger/fb_share_buffer_manager.h +++ b/src/core/hle/service/nvnflinger/fb_share_buffer_manager.h @@ -3,9 +3,12 @@ #pragma once +#include <map> + #include "common/math_util.h" #include "core/hle/service/nvdrv/core/container.h" #include "core/hle/service/nvdrv/nvdata.h" +#include "core/hle/service/nvnflinger/hwc_layer.h" #include "core/hle/service/nvnflinger/nvnflinger.h" #include "core/hle/service/nvnflinger/ui/fence.h" @@ -29,13 +32,18 @@ struct SharedMemoryPoolLayout { }; static_assert(sizeof(SharedMemoryPoolLayout) == 0x188, "SharedMemoryPoolLayout has wrong size"); +struct FbShareSession; + class FbShareBufferManager final { public: explicit FbShareBufferManager(Core::System& system, Nvnflinger& flinger, std::shared_ptr<Nvidia::Module> nvdrv); ~FbShareBufferManager(); - Result Initialize(u64* out_buffer_id, u64* out_layer_handle, u64 display_id); + Result Initialize(Kernel::KProcess* owner_process, u64* out_buffer_id, u64* out_layer_handle, + u64 display_id, LayerBlending blending); + void Finalize(Kernel::KProcess* owner_process); + Result GetSharedBufferMemoryHandleId(u64* out_buffer_size, s32* out_nvmap_handle, SharedMemoryPoolLayout* out_pool_layout, u64 buffer_id, u64 applet_resource_user_id); @@ -45,6 +53,8 @@ public: u32 transform, s32 swap_interval, u64 layer_id, s64 slot); Result GetSharedFrameBufferAcquirableEvent(Kernel::KReadableEvent** out_event, u64 layer_id); + Result WriteAppletCaptureBuffer(bool* out_was_written, s32* out_layer_index); + private: Result GetLayerFromId(VI::Layer** out_layer, u64 layer_id); @@ -52,11 +62,8 @@ private: u64 m_next_buffer_id = 1; u64 m_display_id = 0; u64 m_buffer_id = 0; - u64 m_layer_id = 0; - u32 m_buffer_nvmap_handle = 0; SharedMemoryPoolLayout m_pool_layout = {}; - Nvidia::DeviceFD m_nvmap_fd = {}; - Nvidia::NvCore::SessionId m_session_id = {}; + std::map<u64, FbShareSession> m_sessions; std::unique_ptr<Kernel::KPageGroup> m_buffer_page_group; std::mutex m_guard; @@ -65,4 +72,11 @@ private: std::shared_ptr<Nvidia::Module> m_nvdrv; }; +struct FbShareSession { + Nvidia::DeviceFD nvmap_fd = {}; + Nvidia::NvCore::SessionId session_id = {}; + u64 layer_id = {}; + u32 buffer_nvmap_handle = 0; +}; + } // namespace Service::Nvnflinger |