diff options
Diffstat (limited to 'src')
30 files changed, 167 insertions, 165 deletions
diff --git a/src/common/multi_level_page_table.h b/src/common/multi_level_page_table.h index 08092c89a..31f6676a0 100644 --- a/src/common/multi_level_page_table.h +++ b/src/common/multi_level_page_table.h | |||
| @@ -46,19 +46,19 @@ public: | |||
| 46 | 46 | ||
| 47 | void ReserveRange(u64 start, std::size_t size); | 47 | void ReserveRange(u64 start, std::size_t size); |
| 48 | 48 | ||
| 49 | [[nodiscard]] constexpr const BaseAddr& operator[](std::size_t index) const { | 49 | [[nodiscard]] const BaseAddr& operator[](std::size_t index) const { |
| 50 | return base_ptr[index]; | 50 | return base_ptr[index]; |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | [[nodiscard]] constexpr BaseAddr& operator[](std::size_t index) { | 53 | [[nodiscard]] BaseAddr& operator[](std::size_t index) { |
| 54 | return base_ptr[index]; | 54 | return base_ptr[index]; |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | [[nodiscard]] constexpr BaseAddr* data() { | 57 | [[nodiscard]] BaseAddr* data() { |
| 58 | return base_ptr; | 58 | return base_ptr; |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | [[nodiscard]] constexpr const BaseAddr* data() const { | 61 | [[nodiscard]] const BaseAddr* data() const { |
| 62 | return base_ptr; | 62 | return base_ptr; |
| 63 | } | 63 | } |
| 64 | 64 | ||
diff --git a/src/core/hle/service/nvdrv/core/container.cpp b/src/core/hle/service/nvdrv/core/container.cpp index d2a632646..37ca24f5d 100644 --- a/src/core/hle/service/nvdrv/core/container.cpp +++ b/src/core/hle/service/nvdrv/core/container.cpp | |||
| @@ -10,9 +10,11 @@ | |||
| 10 | namespace Service::Nvidia::NvCore { | 10 | namespace Service::Nvidia::NvCore { |
| 11 | 11 | ||
| 12 | struct ContainerImpl { | 12 | struct ContainerImpl { |
| 13 | ContainerImpl(Tegra::Host1x::Host1x& host1x_) : file{host1x_}, manager{host1x_} {} | 13 | explicit ContainerImpl(Tegra::Host1x::Host1x& host1x_) |
| 14 | : file{host1x_}, manager{host1x_}, device_file_data{} {} | ||
| 14 | NvMap file; | 15 | NvMap file; |
| 15 | SyncpointManager manager; | 16 | SyncpointManager manager; |
| 17 | Container::Host1xDeviceFileData device_file_data; | ||
| 16 | }; | 18 | }; |
| 17 | 19 | ||
| 18 | Container::Container(Tegra::Host1x::Host1x& host1x_) { | 20 | Container::Container(Tegra::Host1x::Host1x& host1x_) { |
| @@ -29,6 +31,14 @@ const NvMap& Container::GetNvMapFile() const { | |||
| 29 | return impl->file; | 31 | return impl->file; |
| 30 | } | 32 | } |
| 31 | 33 | ||
| 34 | Container::Host1xDeviceFileData& Container::Host1xDeviceFile() { | ||
| 35 | return impl->device_file_data; | ||
| 36 | } | ||
| 37 | |||
| 38 | const Container::Host1xDeviceFileData& Container::Host1xDeviceFile() const { | ||
| 39 | return impl->device_file_data; | ||
| 40 | } | ||
| 41 | |||
| 32 | SyncpointManager& Container::GetSyncpointManager() { | 42 | SyncpointManager& Container::GetSyncpointManager() { |
| 33 | return impl->manager; | 43 | return impl->manager; |
| 34 | } | 44 | } |
diff --git a/src/core/hle/service/nvdrv/core/container.h b/src/core/hle/service/nvdrv/core/container.h index 5c8b95803..b4b63ac90 100644 --- a/src/core/hle/service/nvdrv/core/container.h +++ b/src/core/hle/service/nvdrv/core/container.h | |||
| @@ -4,15 +4,15 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <deque> | ||
| 7 | #include <memory> | 8 | #include <memory> |
| 9 | #include <unordered_map> | ||
| 8 | 10 | ||
| 9 | namespace Tegra { | 11 | #include "core/hle/service/nvdrv/nvdata.h" |
| 10 | 12 | ||
| 11 | namespace Host1x { | 13 | namespace Tegra::Host1x { |
| 12 | class Host1x; | 14 | class Host1x; |
| 13 | } // namespace Host1x | 15 | } // namespace Tegra::Host1x |
| 14 | |||
| 15 | } // namespace Tegra | ||
| 16 | 16 | ||
| 17 | namespace Service::Nvidia::NvCore { | 17 | namespace Service::Nvidia::NvCore { |
| 18 | 18 | ||
| @@ -23,7 +23,7 @@ struct ContainerImpl; | |||
| 23 | 23 | ||
| 24 | class Container { | 24 | class Container { |
| 25 | public: | 25 | public: |
| 26 | Container(Tegra::Host1x::Host1x& host1x); | 26 | explicit Container(Tegra::Host1x::Host1x& host1x); |
| 27 | ~Container(); | 27 | ~Container(); |
| 28 | 28 | ||
| 29 | NvMap& GetNvMapFile(); | 29 | NvMap& GetNvMapFile(); |
| @@ -34,6 +34,17 @@ public: | |||
| 34 | 34 | ||
| 35 | const SyncpointManager& GetSyncpointManager() const; | 35 | const SyncpointManager& GetSyncpointManager() const; |
| 36 | 36 | ||
| 37 | struct Host1xDeviceFileData { | ||
| 38 | std::unordered_map<DeviceFD, u32> fd_to_id{}; | ||
| 39 | std::deque<u32> syncpts_accumulated{}; | ||
| 40 | u32 nvdec_next_id{}; | ||
| 41 | u32 vic_next_id{}; | ||
| 42 | }; | ||
| 43 | |||
| 44 | Host1xDeviceFileData& Host1xDeviceFile(); | ||
| 45 | |||
| 46 | const Host1xDeviceFileData& Host1xDeviceFile() const; | ||
| 47 | |||
| 37 | private: | 48 | private: |
| 38 | std::unique_ptr<ContainerImpl> impl; | 49 | std::unique_ptr<ContainerImpl> impl; |
| 39 | }; | 50 | }; |
diff --git a/src/core/hle/service/nvdrv/core/nvmap.cpp b/src/core/hle/service/nvdrv/core/nvmap.cpp index e63ec7717..fbd8a74a5 100644 --- a/src/core/hle/service/nvdrv/core/nvmap.cpp +++ b/src/core/hle/service/nvdrv/core/nvmap.cpp | |||
| @@ -119,7 +119,7 @@ std::shared_ptr<NvMap::Handle> NvMap::GetHandle(Handle::Id handle) { | |||
| 119 | std::scoped_lock lock(handles_lock); | 119 | std::scoped_lock lock(handles_lock); |
| 120 | try { | 120 | try { |
| 121 | return handles.at(handle); | 121 | return handles.at(handle); |
| 122 | } catch ([[maybe_unused]] std::out_of_range& e) { | 122 | } catch (std::out_of_range&) { |
| 123 | return nullptr; | 123 | return nullptr; |
| 124 | } | 124 | } |
| 125 | } | 125 | } |
| @@ -128,7 +128,7 @@ VAddr NvMap::GetHandleAddress(Handle::Id handle) { | |||
| 128 | std::scoped_lock lock(handles_lock); | 128 | std::scoped_lock lock(handles_lock); |
| 129 | try { | 129 | try { |
| 130 | return handles.at(handle)->address; | 130 | return handles.at(handle)->address; |
| 131 | } catch ([[maybe_unused]] std::out_of_range& e) { | 131 | } catch (std::out_of_range&) { |
| 132 | return 0; | 132 | return 0; |
| 133 | } | 133 | } |
| 134 | } | 134 | } |
diff --git a/src/core/hle/service/nvdrv/core/nvmap.h b/src/core/hle/service/nvdrv/core/nvmap.h index 6d6dac023..b9dd3801f 100644 --- a/src/core/hle/service/nvdrv/core/nvmap.h +++ b/src/core/hle/service/nvdrv/core/nvmap.h | |||
| @@ -98,35 +98,6 @@ public: | |||
| 98 | } | 98 | } |
| 99 | }; | 99 | }; |
| 100 | 100 | ||
| 101 | private: | ||
| 102 | std::list<std::shared_ptr<Handle>> unmap_queue{}; | ||
| 103 | std::mutex unmap_queue_lock{}; //!< Protects access to `unmap_queue` | ||
| 104 | |||
| 105 | std::unordered_map<Handle::Id, std::shared_ptr<Handle>> | ||
| 106 | handles{}; //!< Main owning map of handles | ||
| 107 | std::mutex handles_lock; //!< Protects access to `handles` | ||
| 108 | |||
| 109 | static constexpr u32 HandleIdIncrement{ | ||
| 110 | 4}; //!< Each new handle ID is an increment of 4 from the previous | ||
| 111 | std::atomic<u32> next_handle_id{HandleIdIncrement}; | ||
| 112 | Tegra::Host1x::Host1x& host1x; | ||
| 113 | |||
| 114 | void AddHandle(std::shared_ptr<Handle> handle); | ||
| 115 | |||
| 116 | /** | ||
| 117 | * @brief Unmaps and frees the SMMU memory region a handle is mapped to | ||
| 118 | * @note Both `unmap_queue_lock` and `handle_description.mutex` MUST be locked when calling this | ||
| 119 | */ | ||
| 120 | void UnmapHandle(Handle& handle_description); | ||
| 121 | |||
| 122 | /** | ||
| 123 | * @brief Removes a handle from the map taking its dupes into account | ||
| 124 | * @note handle_description.mutex MUST be locked when calling this | ||
| 125 | * @return If the handle was removed from the map | ||
| 126 | */ | ||
| 127 | bool TryRemoveHandle(const Handle& handle_description); | ||
| 128 | |||
| 129 | public: | ||
| 130 | /** | 101 | /** |
| 131 | * @brief Encapsulates the result of a FreeHandle operation | 102 | * @brief Encapsulates the result of a FreeHandle operation |
| 132 | */ | 103 | */ |
| @@ -136,7 +107,7 @@ public: | |||
| 136 | bool was_uncached; //!< If the handle was allocated as uncached | 107 | bool was_uncached; //!< If the handle was allocated as uncached |
| 137 | }; | 108 | }; |
| 138 | 109 | ||
| 139 | NvMap(Tegra::Host1x::Host1x& host1x); | 110 | explicit NvMap(Tegra::Host1x::Host1x& host1x); |
| 140 | 111 | ||
| 141 | /** | 112 | /** |
| 142 | * @brief Creates an unallocated handle of the given size | 113 | * @brief Creates an unallocated handle of the given size |
| @@ -172,5 +143,33 @@ public: | |||
| 172 | * describing the prior state of the handle | 143 | * describing the prior state of the handle |
| 173 | */ | 144 | */ |
| 174 | std::optional<FreeInfo> FreeHandle(Handle::Id handle, bool internal_session); | 145 | std::optional<FreeInfo> FreeHandle(Handle::Id handle, bool internal_session); |
| 146 | |||
| 147 | private: | ||
| 148 | std::list<std::shared_ptr<Handle>> unmap_queue{}; | ||
| 149 | std::mutex unmap_queue_lock{}; //!< Protects access to `unmap_queue` | ||
| 150 | |||
| 151 | std::unordered_map<Handle::Id, std::shared_ptr<Handle>> | ||
| 152 | handles{}; //!< Main owning map of handles | ||
| 153 | std::mutex handles_lock; //!< Protects access to `handles` | ||
| 154 | |||
| 155 | static constexpr u32 HandleIdIncrement{ | ||
| 156 | 4}; //!< Each new handle ID is an increment of 4 from the previous | ||
| 157 | std::atomic<u32> next_handle_id{HandleIdIncrement}; | ||
| 158 | Tegra::Host1x::Host1x& host1x; | ||
| 159 | |||
| 160 | void AddHandle(std::shared_ptr<Handle> handle); | ||
| 161 | |||
| 162 | /** | ||
| 163 | * @brief Unmaps and frees the SMMU memory region a handle is mapped to | ||
| 164 | * @note Both `unmap_queue_lock` and `handle_description.mutex` MUST be locked when calling this | ||
| 165 | */ | ||
| 166 | void UnmapHandle(Handle& handle_description); | ||
| 167 | |||
| 168 | /** | ||
| 169 | * @brief Removes a handle from the map taking its dupes into account | ||
| 170 | * @note handle_description.mutex MUST be locked when calling this | ||
| 171 | * @return If the handle was removed from the map | ||
| 172 | */ | ||
| 173 | bool TryRemoveHandle(const Handle& handle_description); | ||
| 175 | }; | 174 | }; |
| 176 | } // namespace Service::Nvidia::NvCore | 175 | } // namespace Service::Nvidia::NvCore |
diff --git a/src/core/hle/service/nvdrv/core/syncpoint_manager.cpp b/src/core/hle/service/nvdrv/core/syncpoint_manager.cpp index 072b3a22f..eda2041a0 100644 --- a/src/core/hle/service/nvdrv/core/syncpoint_manager.cpp +++ b/src/core/hle/service/nvdrv/core/syncpoint_manager.cpp | |||
| @@ -18,23 +18,23 @@ SyncpointManager::SyncpointManager(Tegra::Host1x::Host1x& host1x_) : host1x{host | |||
| 18 | ReserveSyncpoint(VBlank0SyncpointId, true); | 18 | ReserveSyncpoint(VBlank0SyncpointId, true); |
| 19 | ReserveSyncpoint(VBlank1SyncpointId, true); | 19 | ReserveSyncpoint(VBlank1SyncpointId, true); |
| 20 | 20 | ||
| 21 | for (u32 syncpointId : channel_syncpoints) { | 21 | for (u32 syncpoint_id : channel_syncpoints) { |
| 22 | if (syncpointId) { | 22 | if (syncpoint_id) { |
| 23 | ReserveSyncpoint(syncpointId, false); | 23 | ReserveSyncpoint(syncpoint_id, false); |
| 24 | } | 24 | } |
| 25 | } | 25 | } |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | SyncpointManager::~SyncpointManager() = default; | 28 | SyncpointManager::~SyncpointManager() = default; |
| 29 | 29 | ||
| 30 | u32 SyncpointManager::ReserveSyncpoint(u32 id, bool clientManaged) { | 30 | u32 SyncpointManager::ReserveSyncpoint(u32 id, bool client_managed) { |
| 31 | if (syncpoints.at(id).reserved) { | 31 | if (syncpoints.at(id).reserved) { |
| 32 | ASSERT_MSG(false, "Requested syncpoint is in use"); | 32 | ASSERT_MSG(false, "Requested syncpoint is in use"); |
| 33 | return 0; | 33 | return 0; |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | syncpoints.at(id).reserved = true; | 36 | syncpoints.at(id).reserved = true; |
| 37 | syncpoints.at(id).interfaceManaged = clientManaged; | 37 | syncpoints.at(id).interface_managed = client_managed; |
| 38 | 38 | ||
| 39 | return id; | 39 | return id; |
| 40 | } | 40 | } |
| @@ -49,9 +49,9 @@ u32 SyncpointManager::FindFreeSyncpoint() { | |||
| 49 | return 0; | 49 | return 0; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | u32 SyncpointManager::AllocateSyncpoint(bool clientManaged) { | 52 | u32 SyncpointManager::AllocateSyncpoint(bool client_managed) { |
| 53 | std::lock_guard lock(reservation_lock); | 53 | std::lock_guard lock(reservation_lock); |
| 54 | return ReserveSyncpoint(FindFreeSyncpoint(), clientManaged); | 54 | return ReserveSyncpoint(FindFreeSyncpoint(), client_managed); |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | void SyncpointManager::FreeSyncpoint(u32 id) { | 57 | void SyncpointManager::FreeSyncpoint(u32 id) { |
| @@ -64,7 +64,7 @@ bool SyncpointManager::IsSyncpointAllocated(u32 id) { | |||
| 64 | return (id <= SyncpointCount) && syncpoints[id].reserved; | 64 | return (id <= SyncpointCount) && syncpoints[id].reserved; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | bool SyncpointManager::HasSyncpointExpired(u32 id, u32 threshold) { | 67 | bool SyncpointManager::HasSyncpointExpired(u32 id, u32 threshold) const { |
| 68 | const SyncpointInfo& syncpoint{syncpoints.at(id)}; | 68 | const SyncpointInfo& syncpoint{syncpoints.at(id)}; |
| 69 | 69 | ||
| 70 | if (!syncpoint.reserved) { | 70 | if (!syncpoint.reserved) { |
| @@ -74,10 +74,10 @@ bool SyncpointManager::HasSyncpointExpired(u32 id, u32 threshold) { | |||
| 74 | 74 | ||
| 75 | // If the interface manages counters then we don't keep track of the maximum value as it handles | 75 | // If the interface manages counters then we don't keep track of the maximum value as it handles |
| 76 | // sanity checking the values then | 76 | // sanity checking the values then |
| 77 | if (syncpoint.interfaceManaged) { | 77 | if (syncpoint.interface_managed) { |
| 78 | return static_cast<s32>(syncpoint.counterMin - threshold) >= 0; | 78 | return static_cast<s32>(syncpoint.counter_min - threshold) >= 0; |
| 79 | } else { | 79 | } else { |
| 80 | return (syncpoint.counterMax - threshold) >= (syncpoint.counterMin - threshold); | 80 | return (syncpoint.counter_max - threshold) >= (syncpoint.counter_min - threshold); |
| 81 | } | 81 | } |
| 82 | } | 82 | } |
| 83 | 83 | ||
| @@ -87,7 +87,7 @@ u32 SyncpointManager::IncrementSyncpointMaxExt(u32 id, u32 amount) { | |||
| 87 | return 0; | 87 | return 0; |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | return syncpoints.at(id).counterMax += amount; | 90 | return syncpoints.at(id).counter_max += amount; |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | u32 SyncpointManager::ReadSyncpointMinValue(u32 id) { | 93 | u32 SyncpointManager::ReadSyncpointMinValue(u32 id) { |
| @@ -96,7 +96,7 @@ u32 SyncpointManager::ReadSyncpointMinValue(u32 id) { | |||
| 96 | return 0; | 96 | return 0; |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | return syncpoints.at(id).counterMin; | 99 | return syncpoints.at(id).counter_min; |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | u32 SyncpointManager::UpdateMin(u32 id) { | 102 | u32 SyncpointManager::UpdateMin(u32 id) { |
| @@ -105,8 +105,8 @@ u32 SyncpointManager::UpdateMin(u32 id) { | |||
| 105 | return 0; | 105 | return 0; |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | syncpoints.at(id).counterMin = host1x.GetSyncpointManager().GetHostSyncpointValue(id); | 108 | syncpoints.at(id).counter_min = host1x.GetSyncpointManager().GetHostSyncpointValue(id); |
| 109 | return syncpoints.at(id).counterMin; | 109 | return syncpoints.at(id).counter_min; |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | NvFence SyncpointManager::GetSyncpointFence(u32 id) { | 112 | NvFence SyncpointManager::GetSyncpointFence(u32 id) { |
| @@ -115,7 +115,7 @@ NvFence SyncpointManager::GetSyncpointFence(u32 id) { | |||
| 115 | return NvFence{}; | 115 | return NvFence{}; |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | return {.id = static_cast<s32>(id), .value = syncpoints.at(id).counterMax}; | 118 | return {.id = static_cast<s32>(id), .value = syncpoints.at(id).counter_max}; |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | } // namespace Service::Nvidia::NvCore | 121 | } // namespace Service::Nvidia::NvCore |
diff --git a/src/core/hle/service/nvdrv/core/syncpoint_manager.h b/src/core/hle/service/nvdrv/core/syncpoint_manager.h index 6b71cd33d..b76ef9032 100644 --- a/src/core/hle/service/nvdrv/core/syncpoint_manager.h +++ b/src/core/hle/service/nvdrv/core/syncpoint_manager.h | |||
| @@ -11,13 +11,9 @@ | |||
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | #include "core/hle/service/nvdrv/nvdata.h" | 12 | #include "core/hle/service/nvdrv/nvdata.h" |
| 13 | 13 | ||
| 14 | namespace Tegra { | 14 | namespace Tegra::Host1x { |
| 15 | |||
| 16 | namespace Host1x { | ||
| 17 | class Host1x; | 15 | class Host1x; |
| 18 | } // namespace Host1x | 16 | } // namespace Tegra::Host1x |
| 19 | |||
| 20 | } // namespace Tegra | ||
| 21 | 17 | ||
| 22 | namespace Service::Nvidia::NvCore { | 18 | namespace Service::Nvidia::NvCore { |
| 23 | 19 | ||
| @@ -54,15 +50,15 @@ public: | |||
| 54 | * @brief Finds a free syncpoint and reserves it | 50 | * @brief Finds a free syncpoint and reserves it |
| 55 | * @return The ID of the reserved syncpoint | 51 | * @return The ID of the reserved syncpoint |
| 56 | */ | 52 | */ |
| 57 | u32 AllocateSyncpoint(bool clientManaged); | 53 | u32 AllocateSyncpoint(bool client_managed); |
| 58 | 54 | ||
| 59 | /** | 55 | /** |
| 60 | * @url | 56 | * @url |
| 61 | * https://github.com/Jetson-TX1-AndroidTV/android_kernel_jetson_tx1_hdmi_primary/blob/8f74a72394efb871cb3f886a3de2998cd7ff2990/drivers/gpu/host1x/syncpt.c#L259 | 57 | * https://github.com/Jetson-TX1-AndroidTV/android_kernel_jetson_tx1_hdmi_primary/blob/8f74a72394efb871cb3f886a3de2998cd7ff2990/drivers/gpu/host1x/syncpt.c#L259 |
| 62 | */ | 58 | */ |
| 63 | bool HasSyncpointExpired(u32 id, u32 threshold); | 59 | bool HasSyncpointExpired(u32 id, u32 threshold) const; |
| 64 | 60 | ||
| 65 | bool IsFenceSignalled(NvFence fence) { | 61 | bool IsFenceSignalled(NvFence fence) const { |
| 66 | return HasSyncpointExpired(fence.id, fence.value); | 62 | return HasSyncpointExpired(fence.id, fence.value); |
| 67 | } | 63 | } |
| 68 | 64 | ||
| @@ -107,7 +103,7 @@ private: | |||
| 107 | /** | 103 | /** |
| 108 | * @note reservation_lock should be locked when calling this | 104 | * @note reservation_lock should be locked when calling this |
| 109 | */ | 105 | */ |
| 110 | u32 ReserveSyncpoint(u32 id, bool clientManaged); | 106 | u32 ReserveSyncpoint(u32 id, bool client_managed); |
| 111 | 107 | ||
| 112 | /** | 108 | /** |
| 113 | * @return The ID of the first free syncpoint | 109 | * @return The ID of the first free syncpoint |
| @@ -115,15 +111,15 @@ private: | |||
| 115 | u32 FindFreeSyncpoint(); | 111 | u32 FindFreeSyncpoint(); |
| 116 | 112 | ||
| 117 | struct SyncpointInfo { | 113 | struct SyncpointInfo { |
| 118 | std::atomic<u32> counterMin; //!< The least value the syncpoint can be (The value it was | 114 | std::atomic<u32> counter_min; //!< The least value the syncpoint can be (The value it was |
| 119 | //!< when it was last synchronized with host1x) | 115 | //!< when it was last synchronized with host1x) |
| 120 | std::atomic<u32> counterMax; //!< The maximum value the syncpoint can reach according to the | 116 | std::atomic<u32> counter_max; //!< The maximum value the syncpoint can reach according to |
| 121 | //!< current usage | 117 | //!< the current usage |
| 122 | bool interfaceManaged; //!< If the syncpoint is managed by a host1x client interface, a | 118 | bool interface_managed; //!< If the syncpoint is managed by a host1x client interface, a |
| 123 | //!< client interface is a HW block that can handle host1x | 119 | //!< client interface is a HW block that can handle host1x |
| 124 | //!< transactions on behalf of a host1x client (Which would otherwise | 120 | //!< transactions on behalf of a host1x client (Which would |
| 125 | //!< need to be manually synced using PIO which is synchronous and | 121 | //!< otherwise need to be manually synced using PIO which is |
| 126 | //!< requires direct cooperation of the CPU) | 122 | //!< synchronous and requires direct cooperation of the CPU) |
| 127 | bool reserved; //!< If the syncpoint is reserved or not, not to be confused with a reserved | 123 | bool reserved; //!< If the syncpoint is reserved or not, not to be confused with a reserved |
| 128 | //!< value | 124 | //!< value |
| 129 | }; | 125 | }; |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp index 192503ffc..6411dbf43 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_as_gpu.cpp | |||
| @@ -106,7 +106,7 @@ NvResult nvhost_as_gpu::AllocAsEx(const std::vector<u8>& input, std::vector<u8>& | |||
| 106 | return NvResult::BadValue; | 106 | return NvResult::BadValue; |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | if (!(params.big_page_size & VM::SUPPORTED_BIG_PAGE_SIZES)) { | 109 | if ((params.big_page_size & VM::SUPPORTED_BIG_PAGE_SIZES) == 0) { |
| 110 | LOG_ERROR(Service_NVDRV, "Unsupported big page size: 0x{:X}!", params.big_page_size); | 110 | LOG_ERROR(Service_NVDRV, "Unsupported big page size: 0x{:X}!", params.big_page_size); |
| 111 | return NvResult::BadValue; | 111 | return NvResult::BadValue; |
| 112 | } | 112 | } |
| @@ -124,12 +124,13 @@ NvResult nvhost_as_gpu::AllocAsEx(const std::vector<u8>& input, std::vector<u8>& | |||
| 124 | vm.va_range_end = params.va_range_end; | 124 | vm.va_range_end = params.va_range_end; |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | const u64 start_pages{vm.va_range_start >> VM::PAGE_SIZE_BITS}; | 127 | const auto start_pages{static_cast<u32>(vm.va_range_start >> VM::PAGE_SIZE_BITS)}; |
| 128 | const u64 end_pages{vm.va_range_split >> VM::PAGE_SIZE_BITS}; | 128 | const auto end_pages{static_cast<u32>(vm.va_range_split >> VM::PAGE_SIZE_BITS)}; |
| 129 | vm.small_page_allocator = std::make_shared<VM::Allocator>(start_pages, end_pages); | 129 | vm.small_page_allocator = std::make_shared<VM::Allocator>(start_pages, end_pages); |
| 130 | 130 | ||
| 131 | const u64 start_big_pages{vm.va_range_split >> vm.big_page_size_bits}; | 131 | const auto start_big_pages{static_cast<u32>(vm.va_range_split >> vm.big_page_size_bits)}; |
| 132 | const u64 end_big_pages{(vm.va_range_end - vm.va_range_split) >> vm.big_page_size_bits}; | 132 | const auto end_big_pages{ |
| 133 | static_cast<u32>((vm.va_range_end - vm.va_range_split) >> vm.big_page_size_bits)}; | ||
| 133 | vm.big_page_allocator = std::make_unique<VM::Allocator>(start_big_pages, end_big_pages); | 134 | vm.big_page_allocator = std::make_unique<VM::Allocator>(start_big_pages, end_big_pages); |
| 134 | 135 | ||
| 135 | gmmu = std::make_shared<Tegra::MemoryManager>(system, 40, vm.big_page_size_bits, | 136 | gmmu = std::make_shared<Tegra::MemoryManager>(system, 40, vm.big_page_size_bits, |
| @@ -210,10 +211,11 @@ void nvhost_as_gpu::FreeMappingLocked(u64 offset) { | |||
| 210 | 211 | ||
| 211 | // Sparse mappings shouldn't be fully unmapped, just returned to their sparse state | 212 | // Sparse mappings shouldn't be fully unmapped, just returned to their sparse state |
| 212 | // Only FreeSpace can unmap them fully | 213 | // Only FreeSpace can unmap them fully |
| 213 | if (mapping->sparse_alloc) | 214 | if (mapping->sparse_alloc) { |
| 214 | gmmu->MapSparse(offset, mapping->size, mapping->big_page); | 215 | gmmu->MapSparse(offset, mapping->size, mapping->big_page); |
| 215 | else | 216 | } else { |
| 216 | gmmu->Unmap(offset, mapping->size); | 217 | gmmu->Unmap(offset, mapping->size); |
| 218 | } | ||
| 217 | 219 | ||
| 218 | mapping_map.erase(offset); | 220 | mapping_map.erase(offset); |
| 219 | } | 221 | } |
| @@ -256,7 +258,7 @@ NvResult nvhost_as_gpu::FreeSpace(const std::vector<u8>& input, std::vector<u8>& | |||
| 256 | allocator.Free(static_cast<u32>(params.offset >> page_size_bits), | 258 | allocator.Free(static_cast<u32>(params.offset >> page_size_bits), |
| 257 | static_cast<u32>(allocation.size >> page_size_bits)); | 259 | static_cast<u32>(allocation.size >> page_size_bits)); |
| 258 | allocation_map.erase(params.offset); | 260 | allocation_map.erase(params.offset); |
| 259 | } catch ([[maybe_unused]] const std::out_of_range& e) { | 261 | } catch (const std::out_of_range&) { |
| 260 | return NvResult::BadValue; | 262 | return NvResult::BadValue; |
| 261 | } | 263 | } |
| 262 | 264 | ||
| @@ -351,7 +353,7 @@ NvResult nvhost_as_gpu::MapBufferEx(const std::vector<u8>& input, std::vector<u8 | |||
| 351 | gmmu->Map(gpu_address, cpu_address, params.mapping_size, mapping->big_page); | 353 | gmmu->Map(gpu_address, cpu_address, params.mapping_size, mapping->big_page); |
| 352 | 354 | ||
| 353 | return NvResult::Success; | 355 | return NvResult::Success; |
| 354 | } catch ([[maybe_unused]] const std::out_of_range& e) { | 356 | } catch (const std::out_of_range&) { |
| 355 | LOG_WARNING(Service_NVDRV, "Cannot remap an unmapped GPU address space region: 0x{:X}", | 357 | LOG_WARNING(Service_NVDRV, "Cannot remap an unmapped GPU address space region: 0x{:X}", |
| 356 | params.offset); | 358 | params.offset); |
| 357 | return NvResult::BadValue; | 359 | return NvResult::BadValue; |
| @@ -367,11 +369,11 @@ NvResult nvhost_as_gpu::MapBufferEx(const std::vector<u8>& input, std::vector<u8 | |||
| 367 | u64 size{params.mapping_size ? params.mapping_size : handle->orig_size}; | 369 | u64 size{params.mapping_size ? params.mapping_size : handle->orig_size}; |
| 368 | 370 | ||
| 369 | bool big_page{[&]() { | 371 | bool big_page{[&]() { |
| 370 | if (Common::IsAligned(handle->align, vm.big_page_size)) | 372 | if (Common::IsAligned(handle->align, vm.big_page_size)) { |
| 371 | return true; | 373 | return true; |
| 372 | else if (Common::IsAligned(handle->align, VM::YUZU_PAGESIZE)) | 374 | } else if (Common::IsAligned(handle->align, VM::YUZU_PAGESIZE)) { |
| 373 | return false; | 375 | return false; |
| 374 | else { | 376 | } else { |
| 375 | ASSERT(false); | 377 | ASSERT(false); |
| 376 | return false; | 378 | return false; |
| 377 | } | 379 | } |
| @@ -450,7 +452,7 @@ NvResult nvhost_as_gpu::UnmapBuffer(const std::vector<u8>& input, std::vector<u8 | |||
| 450 | } | 452 | } |
| 451 | 453 | ||
| 452 | mapping_map.erase(params.offset); | 454 | mapping_map.erase(params.offset); |
| 453 | } catch ([[maybe_unused]] const std::out_of_range& e) { | 455 | } catch (const std::out_of_range&) { |
| 454 | LOG_WARNING(Service_NVDRV, "Couldn't find region to unmap at 0x{:X}", params.offset); | 456 | LOG_WARNING(Service_NVDRV, "Couldn't find region to unmap at 0x{:X}", params.offset); |
| 455 | } | 457 | } |
| 456 | 458 | ||
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h index 4aa738b41..0b56d7070 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.h | |||
| @@ -79,7 +79,7 @@ private: | |||
| 79 | // Used for waiting on a syncpoint & canceling it. | 79 | // Used for waiting on a syncpoint & canceling it. |
| 80 | Tegra::Host1x::SyncpointManager::ActionHandle wait_handle{}; | 80 | Tegra::Host1x::SyncpointManager::ActionHandle wait_handle{}; |
| 81 | 81 | ||
| 82 | bool IsBeingUsed() { | 82 | bool IsBeingUsed() const { |
| 83 | const auto current_status = status.load(std::memory_order_acquire); | 83 | const auto current_status = status.load(std::memory_order_acquire); |
| 84 | return current_status == EventState::Waiting || | 84 | return current_status == EventState::Waiting || |
| 85 | current_status == EventState::Cancelling || | 85 | current_status == EventState::Cancelling || |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp index 32e45540d..45a759fa8 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_gpu.cpp | |||
| @@ -184,7 +184,7 @@ NvResult nvhost_gpu::AllocGPFIFOEx2(const std::vector<u8>& input, std::vector<u8 | |||
| 184 | params.num_entries, params.flags, params.unk0, params.unk1, params.unk2, | 184 | params.num_entries, params.flags, params.unk0, params.unk1, params.unk2, |
| 185 | params.unk3); | 185 | params.unk3); |
| 186 | 186 | ||
| 187 | if (channel_state->initiated) { | 187 | if (channel_state->initialized) { |
| 188 | LOG_CRITICAL(Service_NVDRV, "Already allocated!"); | 188 | LOG_CRITICAL(Service_NVDRV, "Already allocated!"); |
| 189 | return NvResult::AlreadyAllocated; | 189 | return NvResult::AlreadyAllocated; |
| 190 | } | 190 | } |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp index fed537039..1703f9cc3 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.cpp | |||
| @@ -5,13 +5,12 @@ | |||
| 5 | #include "common/assert.h" | 5 | #include "common/assert.h" |
| 6 | #include "common/logging/log.h" | 6 | #include "common/logging/log.h" |
| 7 | #include "core/core.h" | 7 | #include "core/core.h" |
| 8 | #include "core/hle/service/nvdrv/core/container.h" | ||
| 8 | #include "core/hle/service/nvdrv/devices/nvhost_nvdec.h" | 9 | #include "core/hle/service/nvdrv/devices/nvhost_nvdec.h" |
| 9 | #include "video_core/renderer_base.h" | 10 | #include "video_core/renderer_base.h" |
| 10 | 11 | ||
| 11 | namespace Service::Nvidia::Devices { | 12 | namespace Service::Nvidia::Devices { |
| 12 | 13 | ||
| 13 | u32 nvhost_nvdec::next_id{}; | ||
| 14 | |||
| 15 | nvhost_nvdec::nvhost_nvdec(Core::System& system_, NvCore::Container& core_) | 14 | nvhost_nvdec::nvhost_nvdec(Core::System& system_, NvCore::Container& core_) |
| 16 | : nvhost_nvdec_common{system_, core_, NvCore::ChannelType::NvDec} {} | 15 | : nvhost_nvdec_common{system_, core_, NvCore::ChannelType::NvDec} {} |
| 17 | nvhost_nvdec::~nvhost_nvdec() = default; | 16 | nvhost_nvdec::~nvhost_nvdec() = default; |
| @@ -22,8 +21,9 @@ NvResult nvhost_nvdec::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& | |||
| 22 | case 0x0: | 21 | case 0x0: |
| 23 | switch (command.cmd) { | 22 | switch (command.cmd) { |
| 24 | case 0x1: { | 23 | case 0x1: { |
| 25 | if (!fd_to_id.contains(fd)) { | 24 | auto& host1x_file = core.Host1xDeviceFile(); |
| 26 | fd_to_id[fd] = next_id++; | 25 | if (!host1x_file.fd_to_id.contains(fd)) { |
| 26 | host1x_file.fd_to_id[fd] = host1x_file.nvdec_next_id++; | ||
| 27 | } | 27 | } |
| 28 | return Submit(fd, input, output); | 28 | return Submit(fd, input, output); |
| 29 | } | 29 | } |
| @@ -74,8 +74,9 @@ void nvhost_nvdec::OnOpen(DeviceFD fd) { | |||
| 74 | 74 | ||
| 75 | void nvhost_nvdec::OnClose(DeviceFD fd) { | 75 | void nvhost_nvdec::OnClose(DeviceFD fd) { |
| 76 | LOG_INFO(Service_NVDRV, "NVDEC video stream ended"); | 76 | LOG_INFO(Service_NVDRV, "NVDEC video stream ended"); |
| 77 | const auto iter = fd_to_id.find(fd); | 77 | auto& host1x_file = core.Host1xDeviceFile(); |
| 78 | if (iter != fd_to_id.end()) { | 78 | const auto iter = host1x_file.fd_to_id.find(fd); |
| 79 | if (iter != host1x_file.fd_to_id.end()) { | ||
| 79 | system.GPU().ClearCdmaInstance(iter->second); | 80 | system.GPU().ClearCdmaInstance(iter->second); |
| 80 | } | 81 | } |
| 81 | system.AudioCore().SetNVDECActive(false); | 82 | system.AudioCore().SetNVDECActive(false); |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h index 3261ce1d4..c1b4e53e8 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec.h | |||
| @@ -22,9 +22,6 @@ public: | |||
| 22 | 22 | ||
| 23 | void OnOpen(DeviceFD fd) override; | 23 | void OnOpen(DeviceFD fd) override; |
| 24 | void OnClose(DeviceFD fd) override; | 24 | void OnClose(DeviceFD fd) override; |
| 25 | |||
| 26 | private: | ||
| 27 | static u32 next_id; | ||
| 28 | }; | 25 | }; |
| 29 | 26 | ||
| 30 | } // namespace Service::Nvidia::Devices | 27 | } // namespace Service::Nvidia::Devices |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp index 2ec1ad3e9..99eede702 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp | |||
| @@ -46,13 +46,11 @@ std::size_t WriteVectors(std::vector<u8>& dst, const std::vector<T>& src, std::s | |||
| 46 | } | 46 | } |
| 47 | } // Anonymous namespace | 47 | } // Anonymous namespace |
| 48 | 48 | ||
| 49 | std::unordered_map<DeviceFD, u32> nvhost_nvdec_common::fd_to_id{}; | ||
| 50 | std::deque<u32> nvhost_nvdec_common::syncpts_accumulated{}; | ||
| 51 | |||
| 52 | nvhost_nvdec_common::nvhost_nvdec_common(Core::System& system_, NvCore::Container& core_, | 49 | nvhost_nvdec_common::nvhost_nvdec_common(Core::System& system_, NvCore::Container& core_, |
| 53 | NvCore::ChannelType channel_type_) | 50 | NvCore::ChannelType channel_type_) |
| 54 | : nvdevice{system_}, core{core_}, syncpoint_manager{core.GetSyncpointManager()}, | 51 | : nvdevice{system_}, core{core_}, syncpoint_manager{core.GetSyncpointManager()}, |
| 55 | nvmap{core.GetNvMapFile()}, channel_type{channel_type_} { | 52 | nvmap{core.GetNvMapFile()}, channel_type{channel_type_} { |
| 53 | auto& syncpts_accumulated = core.Host1xDeviceFile().syncpts_accumulated; | ||
| 56 | if (syncpts_accumulated.empty()) { | 54 | if (syncpts_accumulated.empty()) { |
| 57 | channel_syncpoint = syncpoint_manager.AllocateSyncpoint(false); | 55 | channel_syncpoint = syncpoint_manager.AllocateSyncpoint(false); |
| 58 | } else { | 56 | } else { |
| @@ -60,8 +58,9 @@ nvhost_nvdec_common::nvhost_nvdec_common(Core::System& system_, NvCore::Containe | |||
| 60 | syncpts_accumulated.pop_front(); | 58 | syncpts_accumulated.pop_front(); |
| 61 | } | 59 | } |
| 62 | } | 60 | } |
| 61 | |||
| 63 | nvhost_nvdec_common::~nvhost_nvdec_common() { | 62 | nvhost_nvdec_common::~nvhost_nvdec_common() { |
| 64 | syncpts_accumulated.push_back(channel_syncpoint); | 63 | core.Host1xDeviceFile().syncpts_accumulated.push_back(channel_syncpoint); |
| 65 | } | 64 | } |
| 66 | 65 | ||
| 67 | NvResult nvhost_nvdec_common::SetNVMAPfd(const std::vector<u8>& input) { | 66 | NvResult nvhost_nvdec_common::SetNVMAPfd(const std::vector<u8>& input) { |
| @@ -108,7 +107,7 @@ NvResult nvhost_nvdec_common::Submit(DeviceFD fd, const std::vector<u8>& input, | |||
| 108 | Tegra::ChCommandHeaderList cmdlist(cmd_buffer.word_count); | 107 | Tegra::ChCommandHeaderList cmdlist(cmd_buffer.word_count); |
| 109 | system.Memory().ReadBlock(object->address + cmd_buffer.offset, cmdlist.data(), | 108 | system.Memory().ReadBlock(object->address + cmd_buffer.offset, cmdlist.data(), |
| 110 | cmdlist.size() * sizeof(u32)); | 109 | cmdlist.size() * sizeof(u32)); |
| 111 | gpu.PushCommandBuffer(fd_to_id[fd], cmdlist); | 110 | gpu.PushCommandBuffer(core.Host1xDeviceFile().fd_to_id[fd], cmdlist); |
| 112 | } | 111 | } |
| 113 | std::memcpy(output.data(), ¶ms, sizeof(IoctlSubmit)); | 112 | std::memcpy(output.data(), ¶ms, sizeof(IoctlSubmit)); |
| 114 | // Some games expect command_buffers to be written back | 113 | // Some games expect command_buffers to be written back |
| @@ -186,8 +185,4 @@ Kernel::KEvent* nvhost_nvdec_common::QueryEvent(u32 event_id) { | |||
| 186 | return nullptr; | 185 | return nullptr; |
| 187 | } | 186 | } |
| 188 | 187 | ||
| 189 | void nvhost_nvdec_common::Reset() { | ||
| 190 | fd_to_id.clear(); | ||
| 191 | } | ||
| 192 | |||
| 193 | } // namespace Service::Nvidia::Devices | 188 | } // namespace Service::Nvidia::Devices |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h index 93990bb9b..fe76100c8 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h | |||
| @@ -25,8 +25,6 @@ public: | |||
| 25 | NvCore::ChannelType channel_type); | 25 | NvCore::ChannelType channel_type); |
| 26 | ~nvhost_nvdec_common() override; | 26 | ~nvhost_nvdec_common() override; |
| 27 | 27 | ||
| 28 | static void Reset(); | ||
| 29 | |||
| 30 | protected: | 28 | protected: |
| 31 | struct IoctlSetNvmapFD { | 29 | struct IoctlSetNvmapFD { |
| 32 | s32_le nvmap_fd{}; | 30 | s32_le nvmap_fd{}; |
| @@ -119,7 +117,6 @@ protected: | |||
| 119 | 117 | ||
| 120 | Kernel::KEvent* QueryEvent(u32 event_id) override; | 118 | Kernel::KEvent* QueryEvent(u32 event_id) override; |
| 121 | 119 | ||
| 122 | static std::unordered_map<DeviceFD, u32> fd_to_id; | ||
| 123 | u32 channel_syncpoint; | 120 | u32 channel_syncpoint; |
| 124 | s32_le nvmap_fd{}; | 121 | s32_le nvmap_fd{}; |
| 125 | u32_le submit_timeout{}; | 122 | u32_le submit_timeout{}; |
| @@ -128,8 +125,6 @@ protected: | |||
| 128 | NvCore::NvMap& nvmap; | 125 | NvCore::NvMap& nvmap; |
| 129 | NvCore::ChannelType channel_type; | 126 | NvCore::ChannelType channel_type; |
| 130 | std::array<u32, MaxSyncPoints> device_syncpoints{}; | 127 | std::array<u32, MaxSyncPoints> device_syncpoints{}; |
| 131 | |||
| 132 | static std::deque<u32> syncpts_accumulated; | ||
| 133 | }; | 128 | }; |
| 134 | }; // namespace Devices | 129 | }; // namespace Devices |
| 135 | } // namespace Service::Nvidia | 130 | } // namespace Service::Nvidia |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp index 2e4ff988c..73f97136e 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp | |||
| @@ -4,13 +4,12 @@ | |||
| 4 | #include "common/assert.h" | 4 | #include "common/assert.h" |
| 5 | #include "common/logging/log.h" | 5 | #include "common/logging/log.h" |
| 6 | #include "core/core.h" | 6 | #include "core/core.h" |
| 7 | #include "core/hle/service/nvdrv/core/container.h" | ||
| 7 | #include "core/hle/service/nvdrv/devices/nvhost_vic.h" | 8 | #include "core/hle/service/nvdrv/devices/nvhost_vic.h" |
| 8 | #include "video_core/renderer_base.h" | 9 | #include "video_core/renderer_base.h" |
| 9 | 10 | ||
| 10 | namespace Service::Nvidia::Devices { | 11 | namespace Service::Nvidia::Devices { |
| 11 | 12 | ||
| 12 | u32 nvhost_vic::next_id{}; | ||
| 13 | |||
| 14 | nvhost_vic::nvhost_vic(Core::System& system_, NvCore::Container& core_) | 13 | nvhost_vic::nvhost_vic(Core::System& system_, NvCore::Container& core_) |
| 15 | : nvhost_nvdec_common{system_, core_, NvCore::ChannelType::VIC} {} | 14 | : nvhost_nvdec_common{system_, core_, NvCore::ChannelType::VIC} {} |
| 16 | 15 | ||
| @@ -21,11 +20,13 @@ NvResult nvhost_vic::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& i | |||
| 21 | switch (command.group) { | 20 | switch (command.group) { |
| 22 | case 0x0: | 21 | case 0x0: |
| 23 | switch (command.cmd) { | 22 | switch (command.cmd) { |
| 24 | case 0x1: | 23 | case 0x1: { |
| 25 | if (!fd_to_id.contains(fd)) { | 24 | auto& host1x_file = core.Host1xDeviceFile(); |
| 26 | fd_to_id[fd] = next_id++; | 25 | if (!host1x_file.fd_to_id.contains(fd)) { |
| 26 | host1x_file.fd_to_id[fd] = host1x_file.vic_next_id++; | ||
| 27 | } | 27 | } |
| 28 | return Submit(fd, input, output); | 28 | return Submit(fd, input, output); |
| 29 | } | ||
| 29 | case 0x2: | 30 | case 0x2: |
| 30 | return GetSyncpoint(input, output); | 31 | return GetSyncpoint(input, output); |
| 31 | case 0x3: | 32 | case 0x3: |
| @@ -69,8 +70,9 @@ NvResult nvhost_vic::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& i | |||
| 69 | void nvhost_vic::OnOpen(DeviceFD fd) {} | 70 | void nvhost_vic::OnOpen(DeviceFD fd) {} |
| 70 | 71 | ||
| 71 | void nvhost_vic::OnClose(DeviceFD fd) { | 72 | void nvhost_vic::OnClose(DeviceFD fd) { |
| 72 | const auto iter = fd_to_id.find(fd); | 73 | auto& host1x_file = core.Host1xDeviceFile(); |
| 73 | if (iter != fd_to_id.end()) { | 74 | const auto iter = host1x_file.fd_to_id.find(fd); |
| 75 | if (iter != host1x_file.fd_to_id.end()) { | ||
| 74 | system.GPU().ClearCdmaInstance(iter->second); | 76 | system.GPU().ClearCdmaInstance(iter->second); |
| 75 | } | 77 | } |
| 76 | } | 78 | } |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.h b/src/core/hle/service/nvdrv/devices/nvhost_vic.h index 59e23b41e..f164caafb 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_vic.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.h | |||
| @@ -21,8 +21,5 @@ public: | |||
| 21 | 21 | ||
| 22 | void OnOpen(DeviceFD fd) override; | 22 | void OnOpen(DeviceFD fd) override; |
| 23 | void OnClose(DeviceFD fd) override; | 23 | void OnClose(DeviceFD fd) override; |
| 24 | |||
| 25 | private: | ||
| 26 | static u32 next_id; | ||
| 27 | }; | 24 | }; |
| 28 | } // namespace Service::Nvidia::Devices | 25 | } // namespace Service::Nvidia::Devices |
diff --git a/src/core/hle/service/nvdrv/devices/nvmap.h b/src/core/hle/service/nvdrv/devices/nvmap.h index 52e1d7cff..e9bfd0358 100644 --- a/src/core/hle/service/nvdrv/devices/nvmap.h +++ b/src/core/hle/service/nvdrv/devices/nvmap.h | |||
| @@ -23,8 +23,8 @@ public: | |||
| 23 | explicit nvmap(Core::System& system_, NvCore::Container& container); | 23 | explicit nvmap(Core::System& system_, NvCore::Container& container); |
| 24 | ~nvmap() override; | 24 | ~nvmap() override; |
| 25 | 25 | ||
| 26 | nvmap(nvmap const&) = delete; | 26 | nvmap(const nvmap&) = delete; |
| 27 | nvmap& operator=(nvmap const&) = delete; | 27 | nvmap& operator=(const nvmap&) = delete; |
| 28 | 28 | ||
| 29 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, | 29 | NvResult Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, |
| 30 | std::vector<u8>& output) override; | 30 | std::vector<u8>& output) override; |
diff --git a/src/core/hle/service/nvdrv/nvdrv.cpp b/src/core/hle/service/nvdrv/nvdrv.cpp index 7929443d2..5e7b7468f 100644 --- a/src/core/hle/service/nvdrv/nvdrv.cpp +++ b/src/core/hle/service/nvdrv/nvdrv.cpp | |||
| @@ -101,9 +101,7 @@ Module::Module(Core::System& system) | |||
| 101 | }; | 101 | }; |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | Module::~Module() { | 104 | Module::~Module() {} |
| 105 | Devices::nvhost_nvdec_common::Reset(); | ||
| 106 | } | ||
| 107 | 105 | ||
| 108 | NvResult Module::VerifyFD(DeviceFD fd) const { | 106 | NvResult Module::VerifyFD(DeviceFD fd) const { |
| 109 | if (fd < 0) { | 107 | if (fd < 0) { |
diff --git a/src/core/hle/service/nvdrv/nvdrv.h b/src/core/hle/service/nvdrv/nvdrv.h index a2aeb80b4..146d046a9 100644 --- a/src/core/hle/service/nvdrv/nvdrv.h +++ b/src/core/hle/service/nvdrv/nvdrv.h | |||
| @@ -46,7 +46,7 @@ class Module; | |||
| 46 | 46 | ||
| 47 | class EventInterface { | 47 | class EventInterface { |
| 48 | public: | 48 | public: |
| 49 | EventInterface(Module& module_); | 49 | explicit EventInterface(Module& module_); |
| 50 | ~EventInterface(); | 50 | ~EventInterface(); |
| 51 | 51 | ||
| 52 | Kernel::KEvent* CreateEvent(std::string name); | 52 | Kernel::KEvent* CreateEvent(std::string name); |
diff --git a/src/video_core/control/channel_state.cpp b/src/video_core/control/channel_state.cpp index b04922ac0..cdecc3a91 100644 --- a/src/video_core/control/channel_state.cpp +++ b/src/video_core/control/channel_state.cpp | |||
| @@ -14,10 +14,7 @@ | |||
| 14 | 14 | ||
| 15 | namespace Tegra::Control { | 15 | namespace Tegra::Control { |
| 16 | 16 | ||
| 17 | ChannelState::ChannelState(s32 bind_id_) { | 17 | ChannelState::ChannelState(s32 bind_id_) : bind_id{bind_id_}, initialized{} {} |
| 18 | bind_id = bind_id_; | ||
| 19 | initiated = false; | ||
| 20 | } | ||
| 21 | 18 | ||
| 22 | void ChannelState::Init(Core::System& system, GPU& gpu) { | 19 | void ChannelState::Init(Core::System& system, GPU& gpu) { |
| 23 | ASSERT(memory_manager); | 20 | ASSERT(memory_manager); |
| @@ -27,7 +24,7 @@ void ChannelState::Init(Core::System& system, GPU& gpu) { | |||
| 27 | kepler_compute = std::make_unique<Engines::KeplerCompute>(system, *memory_manager); | 24 | kepler_compute = std::make_unique<Engines::KeplerCompute>(system, *memory_manager); |
| 28 | maxwell_dma = std::make_unique<Engines::MaxwellDMA>(system, *memory_manager); | 25 | maxwell_dma = std::make_unique<Engines::MaxwellDMA>(system, *memory_manager); |
| 29 | kepler_memory = std::make_unique<Engines::KeplerMemory>(system, *memory_manager); | 26 | kepler_memory = std::make_unique<Engines::KeplerMemory>(system, *memory_manager); |
| 30 | initiated = true; | 27 | initialized = true; |
| 31 | } | 28 | } |
| 32 | 29 | ||
| 33 | void ChannelState::BindRasterizer(VideoCore::RasterizerInterface* rasterizer) { | 30 | void ChannelState::BindRasterizer(VideoCore::RasterizerInterface* rasterizer) { |
diff --git a/src/video_core/control/channel_state.h b/src/video_core/control/channel_state.h index 305b21cba..3a7b9872c 100644 --- a/src/video_core/control/channel_state.h +++ b/src/video_core/control/channel_state.h | |||
| @@ -34,7 +34,7 @@ class DmaPusher; | |||
| 34 | namespace Control { | 34 | namespace Control { |
| 35 | 35 | ||
| 36 | struct ChannelState { | 36 | struct ChannelState { |
| 37 | ChannelState(s32 bind_id); | 37 | explicit ChannelState(s32 bind_id); |
| 38 | ChannelState(const ChannelState& state) = delete; | 38 | ChannelState(const ChannelState& state) = delete; |
| 39 | ChannelState& operator=(const ChannelState&) = delete; | 39 | ChannelState& operator=(const ChannelState&) = delete; |
| 40 | ChannelState(ChannelState&& other) noexcept = default; | 40 | ChannelState(ChannelState&& other) noexcept = default; |
| @@ -60,7 +60,7 @@ struct ChannelState { | |||
| 60 | 60 | ||
| 61 | std::unique_ptr<DmaPusher> dma_pusher; | 61 | std::unique_ptr<DmaPusher> dma_pusher; |
| 62 | 62 | ||
| 63 | bool initiated{}; | 63 | bool initialized{}; |
| 64 | }; | 64 | }; |
| 65 | 65 | ||
| 66 | } // namespace Control | 66 | } // namespace Control |
diff --git a/src/video_core/control/channel_state_cache.h b/src/video_core/control/channel_state_cache.h index 5246192a8..584a0c26c 100644 --- a/src/video_core/control/channel_state_cache.h +++ b/src/video_core/control/channel_state_cache.h | |||
| @@ -32,7 +32,7 @@ namespace VideoCommon { | |||
| 32 | class ChannelInfo { | 32 | class ChannelInfo { |
| 33 | public: | 33 | public: |
| 34 | ChannelInfo() = delete; | 34 | ChannelInfo() = delete; |
| 35 | ChannelInfo(Tegra::Control::ChannelState& state); | 35 | explicit ChannelInfo(Tegra::Control::ChannelState& state); |
| 36 | ChannelInfo(const ChannelInfo& state) = delete; | 36 | ChannelInfo(const ChannelInfo& state) = delete; |
| 37 | ChannelInfo& operator=(const ChannelInfo&) = delete; | 37 | ChannelInfo& operator=(const ChannelInfo&) = delete; |
| 38 | ChannelInfo(ChannelInfo&& other) = default; | 38 | ChannelInfo(ChannelInfo&& other) = default; |
diff --git a/src/video_core/control/scheduler.cpp b/src/video_core/control/scheduler.cpp index 733042690..f7cbe204e 100644 --- a/src/video_core/control/scheduler.cpp +++ b/src/video_core/control/scheduler.cpp | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <memory> | 4 | #include <memory> |
| 5 | 5 | ||
| 6 | #include "common/assert.h" | ||
| 6 | #include "video_core/control/channel_state.h" | 7 | #include "video_core/control/channel_state.h" |
| 7 | #include "video_core/control/scheduler.h" | 8 | #include "video_core/control/scheduler.h" |
| 8 | #include "video_core/gpu.h" | 9 | #include "video_core/gpu.h" |
| @@ -13,8 +14,9 @@ Scheduler::Scheduler(GPU& gpu_) : gpu{gpu_} {} | |||
| 13 | Scheduler::~Scheduler() = default; | 14 | Scheduler::~Scheduler() = default; |
| 14 | 15 | ||
| 15 | void Scheduler::Push(s32 channel, CommandList&& entries) { | 16 | void Scheduler::Push(s32 channel, CommandList&& entries) { |
| 16 | std::unique_lock<std::mutex> lk(scheduling_guard); | 17 | std::unique_lock lk(scheduling_guard); |
| 17 | auto it = channels.find(channel); | 18 | auto it = channels.find(channel); |
| 19 | ASSERT(it != channels.end()); | ||
| 18 | auto channel_state = it->second; | 20 | auto channel_state = it->second; |
| 19 | gpu.BindChannel(channel_state->bind_id); | 21 | gpu.BindChannel(channel_state->bind_id); |
| 20 | channel_state->dma_pusher->Push(std::move(entries)); | 22 | channel_state->dma_pusher->Push(std::move(entries)); |
| @@ -23,7 +25,7 @@ void Scheduler::Push(s32 channel, CommandList&& entries) { | |||
| 23 | 25 | ||
| 24 | void Scheduler::DeclareChannel(std::shared_ptr<ChannelState> new_channel) { | 26 | void Scheduler::DeclareChannel(std::shared_ptr<ChannelState> new_channel) { |
| 25 | s32 channel = new_channel->bind_id; | 27 | s32 channel = new_channel->bind_id; |
| 26 | std::unique_lock<std::mutex> lk(scheduling_guard); | 28 | std::unique_lock lk(scheduling_guard); |
| 27 | channels.emplace(channel, new_channel); | 29 | channels.emplace(channel, new_channel); |
| 28 | } | 30 | } |
| 29 | 31 | ||
diff --git a/src/video_core/control/scheduler.h b/src/video_core/control/scheduler.h index 305a01e0a..44addf61c 100644 --- a/src/video_core/control/scheduler.h +++ b/src/video_core/control/scheduler.h | |||
| @@ -19,7 +19,7 @@ struct ChannelState; | |||
| 19 | 19 | ||
| 20 | class Scheduler { | 20 | class Scheduler { |
| 21 | public: | 21 | public: |
| 22 | Scheduler(GPU& gpu_); | 22 | explicit Scheduler(GPU& gpu_); |
| 23 | ~Scheduler(); | 23 | ~Scheduler(); |
| 24 | 24 | ||
| 25 | void Push(s32 channel, CommandList&& entries); | 25 | void Push(s32 channel, CommandList&& entries); |
diff --git a/src/video_core/engines/maxwell_dma.h b/src/video_core/engines/maxwell_dma.h index 9c5d567a6..bc48320ce 100644 --- a/src/video_core/engines/maxwell_dma.h +++ b/src/video_core/engines/maxwell_dma.h | |||
| @@ -195,7 +195,7 @@ public: | |||
| 195 | BitField<24, 2, u32> num_dst_components_minus_one; | 195 | BitField<24, 2, u32> num_dst_components_minus_one; |
| 196 | }; | 196 | }; |
| 197 | 197 | ||
| 198 | Swizzle GetComponent(size_t i) { | 198 | Swizzle GetComponent(size_t i) const { |
| 199 | const u32 raw = dst_components_raw; | 199 | const u32 raw = dst_components_raw; |
| 200 | return static_cast<Swizzle>((raw >> (i * 3)) & 0x7); | 200 | return static_cast<Swizzle>((raw >> (i * 3)) & 0x7); |
| 201 | } | 201 | } |
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index d7a3dd96b..28b38273e 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -355,7 +355,7 @@ struct GPU::Impl { | |||
| 355 | 355 | ||
| 356 | std::condition_variable sync_cv; | 356 | std::condition_variable sync_cv; |
| 357 | 357 | ||
| 358 | std::list<std::function<void(void)>> sync_requests; | 358 | std::list<std::function<void()>> sync_requests; |
| 359 | std::atomic<u64> current_sync_fence{}; | 359 | std::atomic<u64> current_sync_fence{}; |
| 360 | u64 last_sync_fence{}; | 360 | u64 last_sync_fence{}; |
| 361 | std::mutex sync_request_mutex; | 361 | std::mutex sync_request_mutex; |
diff --git a/src/video_core/host1x/host1x.h b/src/video_core/host1x/host1x.h index 7ecf853d9..57082ae54 100644 --- a/src/video_core/host1x/host1x.h +++ b/src/video_core/host1x/host1x.h | |||
| @@ -19,7 +19,7 @@ namespace Host1x { | |||
| 19 | 19 | ||
| 20 | class Host1x { | 20 | class Host1x { |
| 21 | public: | 21 | public: |
| 22 | Host1x(Core::System& system); | 22 | explicit Host1x(Core::System& system); |
| 23 | 23 | ||
| 24 | SyncpointManager& GetSyncpointManager() { | 24 | SyncpointManager& GetSyncpointManager() { |
| 25 | return syncpoint_manager; | 25 | return syncpoint_manager; |
diff --git a/src/video_core/host1x/syncpoint_manager.cpp b/src/video_core/host1x/syncpoint_manager.cpp index 4471bacae..326e8355a 100644 --- a/src/video_core/host1x/syncpoint_manager.cpp +++ b/src/video_core/host1x/syncpoint_manager.cpp | |||
| @@ -12,13 +12,13 @@ MICROPROFILE_DEFINE(GPU_wait, "GPU", "Wait for the GPU", MP_RGB(128, 128, 192)); | |||
| 12 | 12 | ||
| 13 | SyncpointManager::ActionHandle SyncpointManager::RegisterAction( | 13 | SyncpointManager::ActionHandle SyncpointManager::RegisterAction( |
| 14 | std::atomic<u32>& syncpoint, std::list<RegisteredAction>& action_storage, u32 expected_value, | 14 | std::atomic<u32>& syncpoint, std::list<RegisteredAction>& action_storage, u32 expected_value, |
| 15 | std::function<void(void)>& action) { | 15 | std::function<void()>&& action) { |
| 16 | if (syncpoint.load(std::memory_order_acquire) >= expected_value) { | 16 | if (syncpoint.load(std::memory_order_acquire) >= expected_value) { |
| 17 | action(); | 17 | action(); |
| 18 | return {}; | 18 | return {}; |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | std::unique_lock<std::mutex> lk(guard); | 21 | std::unique_lock lk(guard); |
| 22 | if (syncpoint.load(std::memory_order_relaxed) >= expected_value) { | 22 | if (syncpoint.load(std::memory_order_relaxed) >= expected_value) { |
| 23 | action(); | 23 | action(); |
| 24 | return {}; | 24 | return {}; |
| @@ -30,12 +30,12 @@ SyncpointManager::ActionHandle SyncpointManager::RegisterAction( | |||
| 30 | } | 30 | } |
| 31 | ++it; | 31 | ++it; |
| 32 | } | 32 | } |
| 33 | return action_storage.emplace(it, expected_value, action); | 33 | return action_storage.emplace(it, expected_value, std::move(action)); |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | void SyncpointManager::DeregisterAction(std::list<RegisteredAction>& action_storage, | 36 | void SyncpointManager::DeregisterAction(std::list<RegisteredAction>& action_storage, |
| 37 | ActionHandle& handle) { | 37 | ActionHandle& handle) { |
| 38 | std::unique_lock<std::mutex> lk(guard); | 38 | std::unique_lock lk(guard); |
| 39 | action_storage.erase(handle); | 39 | action_storage.erase(handle); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| @@ -68,7 +68,7 @@ void SyncpointManager::Increment(std::atomic<u32>& syncpoint, std::condition_var | |||
| 68 | std::list<RegisteredAction>& action_storage) { | 68 | std::list<RegisteredAction>& action_storage) { |
| 69 | auto new_value{syncpoint.fetch_add(1, std::memory_order_acq_rel) + 1}; | 69 | auto new_value{syncpoint.fetch_add(1, std::memory_order_acq_rel) + 1}; |
| 70 | 70 | ||
| 71 | std::unique_lock<std::mutex> lk(guard); | 71 | std::unique_lock lk(guard); |
| 72 | auto it = action_storage.begin(); | 72 | auto it = action_storage.begin(); |
| 73 | while (it != action_storage.end()) { | 73 | while (it != action_storage.end()) { |
| 74 | if (it->expected_value > new_value) { | 74 | if (it->expected_value > new_value) { |
| @@ -87,7 +87,7 @@ void SyncpointManager::Wait(std::atomic<u32>& syncpoint, std::condition_variable | |||
| 87 | return; | 87 | return; |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | std::unique_lock<std::mutex> lk(guard); | 90 | std::unique_lock lk(guard); |
| 91 | wait_cv.wait(lk, pred); | 91 | wait_cv.wait(lk, pred); |
| 92 | } | 92 | } |
| 93 | 93 | ||
diff --git a/src/video_core/host1x/syncpoint_manager.h b/src/video_core/host1x/syncpoint_manager.h index 72220a09a..50a264e23 100644 --- a/src/video_core/host1x/syncpoint_manager.h +++ b/src/video_core/host1x/syncpoint_manager.h | |||
| @@ -18,34 +18,34 @@ namespace Host1x { | |||
| 18 | 18 | ||
| 19 | class SyncpointManager { | 19 | class SyncpointManager { |
| 20 | public: | 20 | public: |
| 21 | u32 GetGuestSyncpointValue(u32 id) { | 21 | u32 GetGuestSyncpointValue(u32 id) const { |
| 22 | return syncpoints_guest[id].load(std::memory_order_acquire); | 22 | return syncpoints_guest[id].load(std::memory_order_acquire); |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | u32 GetHostSyncpointValue(u32 id) { | 25 | u32 GetHostSyncpointValue(u32 id) const { |
| 26 | return syncpoints_host[id].load(std::memory_order_acquire); | 26 | return syncpoints_host[id].load(std::memory_order_acquire); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | struct RegisteredAction { | 29 | struct RegisteredAction { |
| 30 | RegisteredAction(u32 expected_value_, std::function<void(void)>& action_) | 30 | explicit RegisteredAction(u32 expected_value_, std::function<void()>&& action_) |
| 31 | : expected_value{expected_value_}, action{action_} {} | 31 | : expected_value{expected_value_}, action{std::move(action_)} {} |
| 32 | u32 expected_value; | 32 | u32 expected_value; |
| 33 | std::function<void(void)> action; | 33 | std::function<void()> action; |
| 34 | }; | 34 | }; |
| 35 | using ActionHandle = std::list<RegisteredAction>::iterator; | 35 | using ActionHandle = std::list<RegisteredAction>::iterator; |
| 36 | 36 | ||
| 37 | template <typename Func> | 37 | template <typename Func> |
| 38 | ActionHandle RegisterGuestAction(u32 syncpoint_id, u32 expected_value, Func&& action) { | 38 | ActionHandle RegisterGuestAction(u32 syncpoint_id, u32 expected_value, Func&& action) { |
| 39 | std::function<void(void)> func(action); | 39 | std::function<void()> func(action); |
| 40 | return RegisterAction(syncpoints_guest[syncpoint_id], guest_action_storage[syncpoint_id], | 40 | return RegisterAction(syncpoints_guest[syncpoint_id], guest_action_storage[syncpoint_id], |
| 41 | expected_value, func); | 41 | expected_value, std::move(func)); |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | template <typename Func> | 44 | template <typename Func> |
| 45 | ActionHandle RegisterHostAction(u32 syncpoint_id, u32 expected_value, Func&& action) { | 45 | ActionHandle RegisterHostAction(u32 syncpoint_id, u32 expected_value, Func&& action) { |
| 46 | std::function<void(void)> func(action); | 46 | std::function<void()> func(action); |
| 47 | return RegisterAction(syncpoints_host[syncpoint_id], host_action_storage[syncpoint_id], | 47 | return RegisterAction(syncpoints_host[syncpoint_id], host_action_storage[syncpoint_id], |
| 48 | expected_value, func); | 48 | expected_value, std::move(func)); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | void DeregisterGuestAction(u32 syncpoint_id, ActionHandle& handle); | 51 | void DeregisterGuestAction(u32 syncpoint_id, ActionHandle& handle); |
| @@ -60,11 +60,11 @@ public: | |||
| 60 | 60 | ||
| 61 | void WaitHost(u32 syncpoint_id, u32 expected_value); | 61 | void WaitHost(u32 syncpoint_id, u32 expected_value); |
| 62 | 62 | ||
| 63 | bool IsReadyGuest(u32 syncpoint_id, u32 expected_value) { | 63 | bool IsReadyGuest(u32 syncpoint_id, u32 expected_value) const { |
| 64 | return syncpoints_guest[syncpoint_id].load(std::memory_order_acquire) >= expected_value; | 64 | return syncpoints_guest[syncpoint_id].load(std::memory_order_acquire) >= expected_value; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | bool IsReadyHost(u32 syncpoint_id, u32 expected_value) { | 67 | bool IsReadyHost(u32 syncpoint_id, u32 expected_value) const { |
| 68 | return syncpoints_host[syncpoint_id].load(std::memory_order_acquire) >= expected_value; | 68 | return syncpoints_host[syncpoint_id].load(std::memory_order_acquire) >= expected_value; |
| 69 | } | 69 | } |
| 70 | 70 | ||
| @@ -74,7 +74,7 @@ private: | |||
| 74 | 74 | ||
| 75 | ActionHandle RegisterAction(std::atomic<u32>& syncpoint, | 75 | ActionHandle RegisterAction(std::atomic<u32>& syncpoint, |
| 76 | std::list<RegisteredAction>& action_storage, u32 expected_value, | 76 | std::list<RegisteredAction>& action_storage, u32 expected_value, |
| 77 | std::function<void(void)>& action); | 77 | std::function<void()>&& action); |
| 78 | 78 | ||
| 79 | void DeregisterAction(std::list<RegisteredAction>& action_storage, ActionHandle& handle); | 79 | void DeregisterAction(std::list<RegisteredAction>& action_storage, ActionHandle& handle); |
| 80 | 80 | ||
diff --git a/src/video_core/memory_manager.h b/src/video_core/memory_manager.h index ae4fd98df..f992e29f3 100644 --- a/src/video_core/memory_manager.h +++ b/src/video_core/memory_manager.h | |||
| @@ -126,7 +126,7 @@ private: | |||
| 126 | void WriteBlockImpl(GPUVAddr gpu_dest_addr, const void* src_buffer, std::size_t size); | 126 | void WriteBlockImpl(GPUVAddr gpu_dest_addr, const void* src_buffer, std::size_t size); |
| 127 | 127 | ||
| 128 | template <bool is_big_page> | 128 | template <bool is_big_page> |
| 129 | [[nodiscard]] inline std::size_t PageEntryIndex(GPUVAddr gpu_addr) const { | 129 | [[nodiscard]] std::size_t PageEntryIndex(GPUVAddr gpu_addr) const { |
| 130 | if constexpr (is_big_page) { | 130 | if constexpr (is_big_page) { |
| 131 | return (gpu_addr >> big_page_bits) & big_page_table_mask; | 131 | return (gpu_addr >> big_page_bits) & big_page_table_mask; |
| 132 | } else { | 132 | } else { |