diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2023-12-25 07:32:16 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2024-01-19 03:12:30 +0100 |
commit | 0a2536a0df1f4aea406f2132d3edda0430acc9d1 (patch) | |
tree | c0ad53890581c9c7e180c5ccb3b66e3c63e3ba64 /src/video_core/query_cache | |
parent | SMMU: Implement backing CPU page protect/unprotect (diff) | |
download | yuzu-0a2536a0df1f4aea406f2132d3edda0430acc9d1.tar yuzu-0a2536a0df1f4aea406f2132d3edda0430acc9d1.tar.gz yuzu-0a2536a0df1f4aea406f2132d3edda0430acc9d1.tar.bz2 yuzu-0a2536a0df1f4aea406f2132d3edda0430acc9d1.tar.lz yuzu-0a2536a0df1f4aea406f2132d3edda0430acc9d1.tar.xz yuzu-0a2536a0df1f4aea406f2132d3edda0430acc9d1.tar.zst yuzu-0a2536a0df1f4aea406f2132d3edda0430acc9d1.zip |
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) class QueryBase { public: - VAddr guest_address{}; + DAddr guest_address{}; QueryFlagBits flags{}; u64 value{}; @@ -32,7 +32,7 @@ protected: QueryBase() = default; // Parameterized constructor - QueryBase(VAddr address, QueryFlagBits flags_, u64 value_) + QueryBase(DAddr address, QueryFlagBits flags_, u64 value_) : guest_address(address), flags(flags_), value{value_} {} }; 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 @@ #include "core/memory.h" #include "video_core/engines/maxwell_3d.h" #include "video_core/gpu.h" +#include "video_core/host1x/gpu_device_memory_manager.h" #include "video_core/memory_manager.h" #include "video_core/query_cache/bank_base.h" #include "video_core/query_cache/query_base.h" @@ -113,9 +114,10 @@ struct QueryCacheBase<Traits>::QueryCacheBaseImpl { using RuntimeType = typename Traits::RuntimeType; QueryCacheBaseImpl(QueryCacheBase<Traits>* owner_, VideoCore::RasterizerInterface& rasterizer_, - Core::Memory::Memory& cpu_memory_, RuntimeType& runtime_, Tegra::GPU& gpu_) + Tegra::MaxwellDeviceMemoryManager& device_memory_, RuntimeType& runtime_, + Tegra::GPU& gpu_) : owner{owner_}, rasterizer{rasterizer_}, - cpu_memory{cpu_memory_}, runtime{runtime_}, gpu{gpu_} { + device_memory{device_memory_}, runtime{runtime_}, gpu{gpu_} { streamer_mask = 0; for (size_t i = 0; i < static_cast<size_t>(QueryType::MaxQueryTypes); i++) { streamers[i] = runtime.GetStreamerInterface(static_cast<QueryType>(i)); @@ -158,7 +160,7 @@ struct QueryCacheBase<Traits>::QueryCacheBaseImpl { QueryCacheBase<Traits>* owner; VideoCore::RasterizerInterface& rasterizer; - Core::Memory::Memory& cpu_memory; + Tegra::MaxwellDeviceMemoryManager& device_memory; RuntimeType& runtime; Tegra::GPU& gpu; std::array<StreamerInterface*, static_cast<size_t>(QueryType::MaxQueryTypes)> streamers; @@ -171,10 +173,11 @@ struct QueryCacheBase<Traits>::QueryCacheBaseImpl { template <typename Traits> QueryCacheBase<Traits>::QueryCacheBase(Tegra::GPU& gpu_, VideoCore::RasterizerInterface& rasterizer_, - Core::Memory::Memory& cpu_memory_, RuntimeType& runtime_) + Tegra::MaxwellDeviceMemoryManager& device_memory_, + RuntimeType& runtime_) : cached_queries{} { impl = std::make_unique<QueryCacheBase<Traits>::QueryCacheBaseImpl>( - this, rasterizer_, cpu_memory_, runtime_, gpu_); + this, rasterizer_, device_memory_, runtime_, gpu_); } template <typename Traits> @@ -240,7 +243,7 @@ void QueryCacheBase<Traits>::CounterReport(GPUVAddr addr, QueryType counter_type if (!cpu_addr_opt) [[unlikely]] { return; } - VAddr cpu_addr = *cpu_addr_opt; + DAddr cpu_addr = *cpu_addr_opt; const size_t new_query_id = streamer->WriteCounter(cpu_addr, has_timestamp, payload, subreport); auto* query = streamer->GetQuery(new_query_id); if (is_fence) { @@ -253,10 +256,9 @@ void QueryCacheBase<Traits>::CounterReport(GPUVAddr addr, QueryType counter_type return std::make_pair<u64, u32>(cur_addr >> Core::Memory::YUZU_PAGEBITS, static_cast<u32>(cur_addr & Core::Memory::YUZU_PAGEMASK)); }; - u8* pointer = impl->cpu_memory.GetPointer(cpu_addr); - u8* pointer_timestamp = impl->cpu_memory.GetPointer(cpu_addr + 8); + u8* pointer = impl->device_memory.GetPointer<u8>(cpu_addr); + u8* pointer_timestamp = impl->device_memory.GetPointer<u8>(cpu_addr + 8); bool is_synced = !Settings::IsGPULevelHigh() && is_fence; - std::function<void()> operation([this, is_synced, streamer, query_base = query, query_location, pointer, pointer_timestamp] { if (True(query_base->flags & QueryFlagBits::IsInvalidated)) { @@ -559,7 +561,7 @@ bool QueryCacheBase<Traits>::SemiFlushQueryDirty(QueryCacheBase<Traits>::QueryLo } if (True(query_base->flags & QueryFlagBits::IsFinalValueSynced) && False(query_base->flags & QueryFlagBits::IsGuestSynced)) { - auto* ptr = impl->cpu_memory.GetPointer(query_base->guest_address); + auto* ptr = impl->device_memory.GetPointer<u8>(query_base->guest_address); if (True(query_base->flags & QueryFlagBits::HasTimestamp)) { std::memcpy(ptr, &query_base->value, sizeof(query_base->value)); 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 @@ #include "video_core/control/channel_state_cache.h" #include "video_core/query_cache/query_base.h" #include "video_core/query_cache/types.h" - -namespace Core::Memory { -class Memory; -} +#include "video_core/host1x/gpu_device_memory_manager.h" namespace VideoCore { class RasterizerInterface; @@ -53,7 +50,7 @@ public: }; explicit QueryCacheBase(Tegra::GPU& gpu, VideoCore::RasterizerInterface& rasterizer_, - Core::Memory::Memory& cpu_memory_, RuntimeType& runtime_); + Tegra::MaxwellDeviceMemoryManager& device_memory_, RuntimeType& runtime_); ~QueryCacheBase(); |