// SPDX-FileCopyrightText: 2022 yuzu Emulator Project // SPDX-FileCopyrightText: 2022 Skyline Team and Contributors // SPDX-License-Identifier: GPL-3.0-or-later #pragma once #include #include #include #include "core/hle/service/nvdrv/nvdata.h" namespace Kernel { class KProcess; } namespace Tegra::Host1x { class Host1x; } // namespace Tegra::Host1x namespace Service::Nvidia::NvCore { class HeapMapper; class NvMap; class SyncpointManager; struct ContainerImpl; struct Session { Session(size_t id_, Kernel::KProcess* process_, size_t smmu_id_); ~Session(); Session(const Session&) = delete; Session& operator=(const Session&) = delete; Session(Session&&) = default; Session& operator=(Session&&) = default; size_t id; Kernel::KProcess* process; size_t smmu_id; bool has_preallocated_area{}; std::unique_ptr mapper{}; bool is_active{}; }; class Container { public: explicit Container(Tegra::Host1x::Host1x& host1x); ~Container(); size_t OpenSession(Kernel::KProcess* process); void CloseSession(size_t id); Session* GetSession(size_t id); NvMap& GetNvMapFile(); const NvMap& GetNvMapFile() const; SyncpointManager& GetSyncpointManager(); const SyncpointManager& GetSyncpointManager() const; struct Host1xDeviceFileData { std::unordered_map fd_to_id{}; std::deque syncpts_accumulated{}; u32 nvdec_next_id{}; u32 vic_next_id{}; }; Host1xDeviceFileData& Host1xDeviceFile(); const Host1xDeviceFileData& Host1xDeviceFile() const; private: std::unique_ptr impl; }; } // namespace Service::Nvidia::NvCore