diff options
author | Liam <byteslice@airmail.cc> | 2024-02-15 05:44:05 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2024-02-18 00:08:38 +0100 |
commit | 812f23d05c77fb10407546c3e7a95447fcbea395 (patch) | |
tree | bbfb035c35ccffb6dbe0995002c2937bd94edc2d /src/core/hle/service/vi/shared_buffer_manager.h | |
parent | vi: move shared buffer management from nvnflinger (diff) | |
download | yuzu-812f23d05c77fb10407546c3e7a95447fcbea395.tar yuzu-812f23d05c77fb10407546c3e7a95447fcbea395.tar.gz yuzu-812f23d05c77fb10407546c3e7a95447fcbea395.tar.bz2 yuzu-812f23d05c77fb10407546c3e7a95447fcbea395.tar.lz yuzu-812f23d05c77fb10407546c3e7a95447fcbea395.tar.xz yuzu-812f23d05c77fb10407546c3e7a95447fcbea395.tar.zst yuzu-812f23d05c77fb10407546c3e7a95447fcbea395.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/vi/shared_buffer_manager.h (renamed from src/core/hle/service/vi/fbshare_buffer_manager.h) | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/src/core/hle/service/vi/fbshare_buffer_manager.h b/src/core/hle/service/vi/shared_buffer_manager.h index b9e99e61f..7c9bb7199 100644 --- a/src/core/hle/service/vi/fbshare_buffer_manager.h +++ b/src/core/hle/service/vi/shared_buffer_manager.h @@ -8,16 +8,28 @@ #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" namespace Kernel { class KPageGroup; +class KReadableEvent; +} // namespace Kernel + +namespace Service::android { +class BufferQueueProducer; +} + +namespace Service::Nvidia { +class Module; } +union Result; + namespace Service::VI { +class Container; + struct SharedMemorySlot { u64 buffer_offset; u64 size; @@ -32,18 +44,17 @@ struct SharedMemoryPoolLayout { }; static_assert(sizeof(SharedMemoryPoolLayout) == 0x188, "SharedMemoryPoolLayout has wrong size"); -struct FbshareSession; +struct SharedBufferSession; -class FbshareBufferManager final { +class SharedBufferManager final { public: - explicit FbshareBufferManager(Core::System& system, - std::shared_ptr<Nvnflinger::Nvnflinger> surface_flinger, - std::shared_ptr<Nvidia::Module> nvdrv); - ~FbshareBufferManager(); + explicit SharedBufferManager(Core::System& system, Container& container, + std::shared_ptr<Nvidia::Module> nvdrv); + ~SharedBufferManager(); - Result Initialize(Kernel::KProcess* owner_process, u64* out_buffer_id, u64* out_layer_handle, - u64 display_id, Nvnflinger::LayerBlending blending); - void Finalize(Kernel::KProcess* owner_process); + Result CreateSession(Kernel::KProcess* owner_process, u64* out_buffer_id, u64* out_layer_handle, + u64 display_id, bool enable_blending); + void DestroySession(Kernel::KProcess* owner_process); Result GetSharedBufferMemoryHandleId(u64* out_buffer_size, s32* out_nvmap_handle, SharedMemoryPoolLayout* out_pool_layout, u64 buffer_id, @@ -52,28 +63,26 @@ public: s64* out_target_slot, u64 layer_id); Result PresentSharedFrameBuffer(android::Fence fence, Common::Rectangle<s32> crop_region, u32 transform, s32 swap_interval, u64 layer_id, s64 slot); + Result CancelSharedFrameBuffer(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); - -private: u64 m_next_buffer_id = 1; u64 m_display_id = 0; u64 m_buffer_id = 0; SharedMemoryPoolLayout m_pool_layout = {}; - std::map<u64, FbshareSession> m_sessions; + std::map<u64, SharedBufferSession> m_sessions; std::unique_ptr<Kernel::KPageGroup> m_buffer_page_group; std::mutex m_guard; Core::System& m_system; - const std::shared_ptr<Nvnflinger::Nvnflinger> m_surface_flinger; + Container& m_container; const std::shared_ptr<Nvidia::Module> m_nvdrv; }; -struct FbshareSession { +struct SharedBufferSession { Nvidia::DeviceFD nvmap_fd = {}; Nvidia::NvCore::SessionId session_id = {}; u64 layer_id = {}; |