diff options
| author | 2023-12-25 07:32:16 +0100 | |
|---|---|---|
| committer | 2024-01-18 21:12:30 -0500 | |
| commit | 0a2536a0df1f4aea406f2132d3edda0430acc9d1 (patch) | |
| tree | c0ad53890581c9c7e180c5ccb3b66e3c63e3ba64 /src/video_core/query_cache | |
| parent | SMMU: Implement backing CPU page protect/unprotect (diff) | |
| download | yuzu-0a2536a0df1f4aea406f2132d3edda0430acc9d1.tar.gz yuzu-0a2536a0df1f4aea406f2132d3edda0430acc9d1.tar.xz yuzu-0a2536a0df1f4aea406f2132d3edda0430acc9d1.zip | |
SMMU: Initial adaptation to video_core.
Diffstat (limited to 'src/video_core/query_cache')
| -rw-r--r-- | src/video_core/query_cache/query_base.h | 4 | ||||
| -rw-r--r-- | src/video_core/query_cache/query_cache.h | 22 | ||||
| -rw-r--r-- | src/video_core/query_cache/query_cache_base.h | 7 |
3 files changed, 16 insertions, 17 deletions
diff --git a/src/video_core/query_cache/query_base.h b/src/video_core/query_cache/query_base.h index 1d786b3a7..aca6a6447 100644 --- a/src/video_core/query_cache/query_base.h +++ b/src/video_core/query_cache/query_base.h | |||
| @@ -23,7 +23,7 @@ DECLARE_ENUM_FLAG_OPERATORS(QueryFlagBits) | |||
| 23 | 23 | ||
| 24 | class QueryBase { | 24 | class QueryBase { |
| 25 | public: | 25 | public: |
| 26 | VAddr guest_address{}; | 26 | DAddr guest_address{}; |
| 27 | QueryFlagBits flags{}; | 27 | QueryFlagBits flags{}; |
| 28 | u64 value{}; | 28 | u64 value{}; |
| 29 | 29 | ||
| @@ -32,7 +32,7 @@ protected: | |||
| 32 | QueryBase() = default; | 32 | QueryBase() = default; |
| 33 | 33 | ||
| 34 | // Parameterized constructor | 34 | // Parameterized constructor |
| 35 | QueryBase(VAddr address, QueryFlagBits flags_, u64 value_) | 35 | QueryBase(DAddr address, QueryFlagBits flags_, u64 value_) |
| 36 | : guest_address(address), flags(flags_), value{value_} {} | 36 | : guest_address(address), flags(flags_), value{value_} {} |
| 37 | }; | 37 | }; |
| 38 | 38 | ||
diff --git a/src/video_core/query_cache/query_cache.h b/src/video_core/query_cache/query_cache.h index 94f0c4466..508afb10a 100644 --- a/src/video_core/query_cache/query_cache.h +++ b/src/video_core/query_cache/query_cache.h | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include "core/memory.h" | 18 | #include "core/memory.h" |
| 19 | #include "video_core/engines/maxwell_3d.h" | 19 | #include "video_core/engines/maxwell_3d.h" |
| 20 | #include "video_core/gpu.h" | 20 | #include "video_core/gpu.h" |
| 21 | #include "video_core/host1x/gpu_device_memory_manager.h" | ||
| 21 | #include "video_core/memory_manager.h" | 22 | #include "video_core/memory_manager.h" |
| 22 | #include "video_core/query_cache/bank_base.h" | 23 | #include "video_core/query_cache/bank_base.h" |
| 23 | #include "video_core/query_cache/query_base.h" | 24 | #include "video_core/query_cache/query_base.h" |
| @@ -113,9 +114,10 @@ struct QueryCacheBase<Traits>::QueryCacheBaseImpl { | |||
| 113 | using RuntimeType = typename Traits::RuntimeType; | 114 | using RuntimeType = typename Traits::RuntimeType; |
| 114 | 115 | ||
| 115 | QueryCacheBaseImpl(QueryCacheBase<Traits>* owner_, VideoCore::RasterizerInterface& rasterizer_, | 116 | QueryCacheBaseImpl(QueryCacheBase<Traits>* owner_, VideoCore::RasterizerInterface& rasterizer_, |
| 116 | Core::Memory::Memory& cpu_memory_, RuntimeType& runtime_, Tegra::GPU& gpu_) | 117 | Tegra::MaxwellDeviceMemoryManager& device_memory_, RuntimeType& runtime_, |
| 118 | Tegra::GPU& gpu_) | ||
| 117 | : owner{owner_}, rasterizer{rasterizer_}, | 119 | : owner{owner_}, rasterizer{rasterizer_}, |
| 118 | cpu_memory{cpu_memory_}, runtime{runtime_}, gpu{gpu_} { | 120 | device_memory{device_memory_}, runtime{runtime_}, gpu{gpu_} { |
| 119 | streamer_mask = 0; | 121 | streamer_mask = 0; |
| 120 | for (size_t i = 0; i < static_cast<size_t>(QueryType::MaxQueryTypes); i++) { | 122 | for (size_t i = 0; i < static_cast<size_t>(QueryType::MaxQueryTypes); i++) { |
| 121 | streamers[i] = runtime.GetStreamerInterface(static_cast<QueryType>(i)); | 123 | streamers[i] = runtime.GetStreamerInterface(static_cast<QueryType>(i)); |
| @@ -158,7 +160,7 @@ struct QueryCacheBase<Traits>::QueryCacheBaseImpl { | |||
| 158 | 160 | ||
| 159 | QueryCacheBase<Traits>* owner; | 161 | QueryCacheBase<Traits>* owner; |
| 160 | VideoCore::RasterizerInterface& rasterizer; | 162 | VideoCore::RasterizerInterface& rasterizer; |
| 161 | Core::Memory::Memory& cpu_memory; | 163 | Tegra::MaxwellDeviceMemoryManager& device_memory; |
| 162 | RuntimeType& runtime; | 164 | RuntimeType& runtime; |
| 163 | Tegra::GPU& gpu; | 165 | Tegra::GPU& gpu; |
| 164 | std::array<StreamerInterface*, static_cast<size_t>(QueryType::MaxQueryTypes)> streamers; | 166 | std::array<StreamerInterface*, static_cast<size_t>(QueryType::MaxQueryTypes)> streamers; |
| @@ -171,10 +173,11 @@ struct QueryCacheBase<Traits>::QueryCacheBaseImpl { | |||
| 171 | template <typename Traits> | 173 | template <typename Traits> |
| 172 | QueryCacheBase<Traits>::QueryCacheBase(Tegra::GPU& gpu_, | 174 | QueryCacheBase<Traits>::QueryCacheBase(Tegra::GPU& gpu_, |
| 173 | VideoCore::RasterizerInterface& rasterizer_, | 175 | VideoCore::RasterizerInterface& rasterizer_, |
| 174 | Core::Memory::Memory& cpu_memory_, RuntimeType& runtime_) | 176 | Tegra::MaxwellDeviceMemoryManager& device_memory_, |
| 177 | RuntimeType& runtime_) | ||
| 175 | : cached_queries{} { | 178 | : cached_queries{} { |
| 176 | impl = std::make_unique<QueryCacheBase<Traits>::QueryCacheBaseImpl>( | 179 | impl = std::make_unique<QueryCacheBase<Traits>::QueryCacheBaseImpl>( |
| 177 | this, rasterizer_, cpu_memory_, runtime_, gpu_); | 180 | this, rasterizer_, device_memory_, runtime_, gpu_); |
| 178 | } | 181 | } |
| 179 | 182 | ||
| 180 | template <typename Traits> | 183 | template <typename Traits> |
| @@ -240,7 +243,7 @@ void QueryCacheBase<Traits>::CounterReport(GPUVAddr addr, QueryType counter_type | |||
| 240 | if (!cpu_addr_opt) [[unlikely]] { | 243 | if (!cpu_addr_opt) [[unlikely]] { |
| 241 | return; | 244 | return; |
| 242 | } | 245 | } |
| 243 | VAddr cpu_addr = *cpu_addr_opt; | 246 | DAddr cpu_addr = *cpu_addr_opt; |
| 244 | const size_t new_query_id = streamer->WriteCounter(cpu_addr, has_timestamp, payload, subreport); | 247 | const size_t new_query_id = streamer->WriteCounter(cpu_addr, has_timestamp, payload, subreport); |
| 245 | auto* query = streamer->GetQuery(new_query_id); | 248 | auto* query = streamer->GetQuery(new_query_id); |
| 246 | if (is_fence) { | 249 | if (is_fence) { |
| @@ -253,10 +256,9 @@ void QueryCacheBase<Traits>::CounterReport(GPUVAddr addr, QueryType counter_type | |||
| 253 | return std::make_pair<u64, u32>(cur_addr >> Core::Memory::YUZU_PAGEBITS, | 256 | return std::make_pair<u64, u32>(cur_addr >> Core::Memory::YUZU_PAGEBITS, |
| 254 | static_cast<u32>(cur_addr & Core::Memory::YUZU_PAGEMASK)); | 257 | static_cast<u32>(cur_addr & Core::Memory::YUZU_PAGEMASK)); |
| 255 | }; | 258 | }; |
| 256 | u8* pointer = impl->cpu_memory.GetPointer(cpu_addr); | 259 | u8* pointer = impl->device_memory.GetPointer<u8>(cpu_addr); |
| 257 | u8* pointer_timestamp = impl->cpu_memory.GetPointer(cpu_addr + 8); | 260 | u8* pointer_timestamp = impl->device_memory.GetPointer<u8>(cpu_addr + 8); |
| 258 | bool is_synced = !Settings::IsGPULevelHigh() && is_fence; | 261 | bool is_synced = !Settings::IsGPULevelHigh() && is_fence; |
| 259 | |||
| 260 | std::function<void()> operation([this, is_synced, streamer, query_base = query, query_location, | 262 | std::function<void()> operation([this, is_synced, streamer, query_base = query, query_location, |
| 261 | pointer, pointer_timestamp] { | 263 | pointer, pointer_timestamp] { |
| 262 | if (True(query_base->flags & QueryFlagBits::IsInvalidated)) { | 264 | if (True(query_base->flags & QueryFlagBits::IsInvalidated)) { |
| @@ -559,7 +561,7 @@ bool QueryCacheBase<Traits>::SemiFlushQueryDirty(QueryCacheBase<Traits>::QueryLo | |||
| 559 | } | 561 | } |
| 560 | if (True(query_base->flags & QueryFlagBits::IsFinalValueSynced) && | 562 | if (True(query_base->flags & QueryFlagBits::IsFinalValueSynced) && |
| 561 | False(query_base->flags & QueryFlagBits::IsGuestSynced)) { | 563 | False(query_base->flags & QueryFlagBits::IsGuestSynced)) { |
| 562 | auto* ptr = impl->cpu_memory.GetPointer(query_base->guest_address); | 564 | auto* ptr = impl->device_memory.GetPointer<u8>(query_base->guest_address); |
| 563 | if (True(query_base->flags & QueryFlagBits::HasTimestamp)) { | 565 | if (True(query_base->flags & QueryFlagBits::HasTimestamp)) { |
| 564 | std::memcpy(ptr, &query_base->value, sizeof(query_base->value)); | 566 | std::memcpy(ptr, &query_base->value, sizeof(query_base->value)); |
| 565 | return false; | 567 | return false; |
diff --git a/src/video_core/query_cache/query_cache_base.h b/src/video_core/query_cache/query_cache_base.h index 07be421c6..7720456ff 100644 --- a/src/video_core/query_cache/query_cache_base.h +++ b/src/video_core/query_cache/query_cache_base.h | |||
| @@ -17,10 +17,7 @@ | |||
| 17 | #include "video_core/control/channel_state_cache.h" | 17 | #include "video_core/control/channel_state_cache.h" |
| 18 | #include "video_core/query_cache/query_base.h" | 18 | #include "video_core/query_cache/query_base.h" |
| 19 | #include "video_core/query_cache/types.h" | 19 | #include "video_core/query_cache/types.h" |
| 20 | 20 | #include "video_core/host1x/gpu_device_memory_manager.h" | |
| 21 | namespace Core::Memory { | ||
| 22 | class Memory; | ||
| 23 | } | ||
| 24 | 21 | ||
| 25 | namespace VideoCore { | 22 | namespace VideoCore { |
| 26 | class RasterizerInterface; | 23 | class RasterizerInterface; |
| @@ -53,7 +50,7 @@ public: | |||
| 53 | }; | 50 | }; |
| 54 | 51 | ||
| 55 | explicit QueryCacheBase(Tegra::GPU& gpu, VideoCore::RasterizerInterface& rasterizer_, | 52 | explicit QueryCacheBase(Tegra::GPU& gpu, VideoCore::RasterizerInterface& rasterizer_, |
| 56 | Core::Memory::Memory& cpu_memory_, RuntimeType& runtime_); | 53 | Tegra::MaxwellDeviceMemoryManager& device_memory_, RuntimeType& runtime_); |
| 57 | 54 | ||
| 58 | ~QueryCacheBase(); | 55 | ~QueryCacheBase(); |
| 59 | 56 | ||