diff options
| author | 2024-01-22 10:55:39 -0500 | |
|---|---|---|
| committer | 2024-01-22 10:55:39 -0500 | |
| commit | 8bd10473d60503c7acddc399604a51b9c9947541 (patch) | |
| tree | f713f84942681321fca27ba028e31d6c74a09013 /src/video_core/query_cache.h | |
| parent | Merge pull request #12747 from t895/homescreen-widget (diff) | |
| parent | device_memory_manager: use unique_lock for update (diff) | |
| download | yuzu-8bd10473d60503c7acddc399604a51b9c9947541.tar.gz yuzu-8bd10473d60503c7acddc399604a51b9c9947541.tar.xz yuzu-8bd10473d60503c7acddc399604a51b9c9947541.zip | |
Merge pull request #12579 from FernandoS27/smmu
Core: Implement Device Mapping & GPU SMMU
Diffstat (limited to 'src/video_core/query_cache.h')
| -rw-r--r-- | src/video_core/query_cache.h | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/video_core/query_cache.h b/src/video_core/query_cache.h index a64404ce4..4861b123a 100644 --- a/src/video_core/query_cache.h +++ b/src/video_core/query_cache.h | |||
| @@ -18,9 +18,9 @@ | |||
| 18 | 18 | ||
| 19 | #include "common/assert.h" | 19 | #include "common/assert.h" |
| 20 | #include "common/settings.h" | 20 | #include "common/settings.h" |
| 21 | #include "core/memory.h" | ||
| 22 | #include "video_core/control/channel_state_cache.h" | 21 | #include "video_core/control/channel_state_cache.h" |
| 23 | #include "video_core/engines/maxwell_3d.h" | 22 | #include "video_core/engines/maxwell_3d.h" |
| 23 | #include "video_core/host1x/gpu_device_memory_manager.h" | ||
| 24 | #include "video_core/memory_manager.h" | 24 | #include "video_core/memory_manager.h" |
| 25 | #include "video_core/rasterizer_interface.h" | 25 | #include "video_core/rasterizer_interface.h" |
| 26 | #include "video_core/texture_cache/slot_vector.h" | 26 | #include "video_core/texture_cache/slot_vector.h" |
| @@ -102,18 +102,19 @@ template <class QueryCache, class CachedQuery, class CounterStream, class HostCo | |||
| 102 | class QueryCacheLegacy : public VideoCommon::ChannelSetupCaches<VideoCommon::ChannelInfo> { | 102 | class QueryCacheLegacy : public VideoCommon::ChannelSetupCaches<VideoCommon::ChannelInfo> { |
| 103 | public: | 103 | public: |
| 104 | explicit QueryCacheLegacy(VideoCore::RasterizerInterface& rasterizer_, | 104 | explicit QueryCacheLegacy(VideoCore::RasterizerInterface& rasterizer_, |
| 105 | Core::Memory::Memory& cpu_memory_) | 105 | Tegra::MaxwellDeviceMemoryManager& device_memory_) |
| 106 | : rasterizer{rasterizer_}, | 106 | : rasterizer{rasterizer_}, |
| 107 | // Use reinterpret_cast instead of static_cast as workaround for | 107 | // Use reinterpret_cast instead of static_cast as workaround for |
| 108 | // UBSan bug (https://github.com/llvm/llvm-project/issues/59060) | 108 | // UBSan bug (https://github.com/llvm/llvm-project/issues/59060) |
| 109 | cpu_memory{cpu_memory_}, streams{{ | 109 | device_memory{device_memory_}, |
| 110 | {CounterStream{reinterpret_cast<QueryCache&>(*this), | 110 | streams{{ |
| 111 | VideoCore::QueryType::SamplesPassed}}, | 111 | {CounterStream{reinterpret_cast<QueryCache&>(*this), |
| 112 | {CounterStream{reinterpret_cast<QueryCache&>(*this), | 112 | VideoCore::QueryType::SamplesPassed}}, |
| 113 | VideoCore::QueryType::PrimitivesGenerated}}, | 113 | {CounterStream{reinterpret_cast<QueryCache&>(*this), |
| 114 | {CounterStream{reinterpret_cast<QueryCache&>(*this), | 114 | VideoCore::QueryType::PrimitivesGenerated}}, |
| 115 | VideoCore::QueryType::TfbPrimitivesWritten}}, | 115 | {CounterStream{reinterpret_cast<QueryCache&>(*this), |
| 116 | }} { | 116 | VideoCore::QueryType::TfbPrimitivesWritten}}, |
| 117 | }} { | ||
| 117 | (void)slot_async_jobs.insert(); // Null value | 118 | (void)slot_async_jobs.insert(); // Null value |
| 118 | } | 119 | } |
| 119 | 120 | ||
| @@ -322,13 +323,14 @@ private: | |||
| 322 | local_lock.unlock(); | 323 | local_lock.unlock(); |
| 323 | if (timestamp) { | 324 | if (timestamp) { |
| 324 | u64 timestamp_value = *timestamp; | 325 | u64 timestamp_value = *timestamp; |
| 325 | cpu_memory.WriteBlockUnsafe(address + sizeof(u64), ×tamp_value, sizeof(u64)); | 326 | device_memory.WriteBlockUnsafe(address + sizeof(u64), ×tamp_value, |
| 326 | cpu_memory.WriteBlockUnsafe(address, &value, sizeof(u64)); | 327 | sizeof(u64)); |
| 328 | device_memory.WriteBlockUnsafe(address, &value, sizeof(u64)); | ||
| 327 | rasterizer.InvalidateRegion(address, sizeof(u64) * 2, | 329 | rasterizer.InvalidateRegion(address, sizeof(u64) * 2, |
| 328 | VideoCommon::CacheType::NoQueryCache); | 330 | VideoCommon::CacheType::NoQueryCache); |
| 329 | } else { | 331 | } else { |
| 330 | u32 small_value = static_cast<u32>(value); | 332 | u32 small_value = static_cast<u32>(value); |
| 331 | cpu_memory.WriteBlockUnsafe(address, &small_value, sizeof(u32)); | 333 | device_memory.WriteBlockUnsafe(address, &small_value, sizeof(u32)); |
| 332 | rasterizer.InvalidateRegion(address, sizeof(u32), | 334 | rasterizer.InvalidateRegion(address, sizeof(u32), |
| 333 | VideoCommon::CacheType::NoQueryCache); | 335 | VideoCommon::CacheType::NoQueryCache); |
| 334 | } | 336 | } |
| @@ -342,7 +344,7 @@ private: | |||
| 342 | SlotVector<AsyncJob> slot_async_jobs; | 344 | SlotVector<AsyncJob> slot_async_jobs; |
| 343 | 345 | ||
| 344 | VideoCore::RasterizerInterface& rasterizer; | 346 | VideoCore::RasterizerInterface& rasterizer; |
| 345 | Core::Memory::Memory& cpu_memory; | 347 | Tegra::MaxwellDeviceMemoryManager& device_memory; |
| 346 | 348 | ||
| 347 | mutable std::recursive_mutex mutex; | 349 | mutable std::recursive_mutex mutex; |
| 348 | 350 | ||