SMMU: Initial adaptation to video_core.
This commit is contained in:
		| @@ -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_} {} | ||||
| }; | ||||
|  | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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(); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Fernando Sahmkow
					Fernando Sahmkow