summaryrefslogtreecommitdiff
path: root/src/video_core/query_cache.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/query_cache.h')
-rw-r--r--src/video_core/query_cache.h29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/video_core/query_cache.h b/src/video_core/query_cache.h
index a64404ce4..b01d843e4 100644
--- a/src/video_core/query_cache.h
+++ b/src/video_core/query_cache.h
@@ -21,6 +21,7 @@
21#include "core/memory.h" 21#include "core/memory.h"
22#include "video_core/control/channel_state_cache.h" 22#include "video_core/control/channel_state_cache.h"
23#include "video_core/engines/maxwell_3d.h" 23#include "video_core/engines/maxwell_3d.h"
24#include "video_core/host1x/gpu_device_memory_manager.h"
24#include "video_core/memory_manager.h" 25#include "video_core/memory_manager.h"
25#include "video_core/rasterizer_interface.h" 26#include "video_core/rasterizer_interface.h"
26#include "video_core/texture_cache/slot_vector.h" 27#include "video_core/texture_cache/slot_vector.h"
@@ -102,18 +103,19 @@ template <class QueryCache, class CachedQuery, class CounterStream, class HostCo
102class QueryCacheLegacy : public VideoCommon::ChannelSetupCaches<VideoCommon::ChannelInfo> { 103class QueryCacheLegacy : public VideoCommon::ChannelSetupCaches<VideoCommon::ChannelInfo> {
103public: 104public:
104 explicit QueryCacheLegacy(VideoCore::RasterizerInterface& rasterizer_, 105 explicit QueryCacheLegacy(VideoCore::RasterizerInterface& rasterizer_,
105 Core::Memory::Memory& cpu_memory_) 106 Tegra::MaxwellDeviceMemoryManager& device_memory_)
106 : rasterizer{rasterizer_}, 107 : rasterizer{rasterizer_},
107 // Use reinterpret_cast instead of static_cast as workaround for 108 // Use reinterpret_cast instead of static_cast as workaround for
108 // UBSan bug (https://github.com/llvm/llvm-project/issues/59060) 109 // UBSan bug (https://github.com/llvm/llvm-project/issues/59060)
109 cpu_memory{cpu_memory_}, streams{{ 110 device_memory{device_memory_},
110 {CounterStream{reinterpret_cast<QueryCache&>(*this), 111 streams{{
111 VideoCore::QueryType::SamplesPassed}}, 112 {CounterStream{reinterpret_cast<QueryCache&>(*this),
112 {CounterStream{reinterpret_cast<QueryCache&>(*this), 113 VideoCore::QueryType::SamplesPassed}},
113 VideoCore::QueryType::PrimitivesGenerated}}, 114 {CounterStream{reinterpret_cast<QueryCache&>(*this),
114 {CounterStream{reinterpret_cast<QueryCache&>(*this), 115 VideoCore::QueryType::PrimitivesGenerated}},
115 VideoCore::QueryType::TfbPrimitivesWritten}}, 116 {CounterStream{reinterpret_cast<QueryCache&>(*this),
116 }} { 117 VideoCore::QueryType::TfbPrimitivesWritten}},
118 }} {
117 (void)slot_async_jobs.insert(); // Null value 119 (void)slot_async_jobs.insert(); // Null value
118 } 120 }
119 121
@@ -322,13 +324,14 @@ private:
322 local_lock.unlock(); 324 local_lock.unlock();
323 if (timestamp) { 325 if (timestamp) {
324 u64 timestamp_value = *timestamp; 326 u64 timestamp_value = *timestamp;
325 cpu_memory.WriteBlockUnsafe(address + sizeof(u64), &timestamp_value, sizeof(u64)); 327 device_memory.WriteBlockUnsafe(address + sizeof(u64), &timestamp_value,
326 cpu_memory.WriteBlockUnsafe(address, &value, sizeof(u64)); 328 sizeof(u64));
329 device_memory.WriteBlockUnsafe(address, &value, sizeof(u64));
327 rasterizer.InvalidateRegion(address, sizeof(u64) * 2, 330 rasterizer.InvalidateRegion(address, sizeof(u64) * 2,
328 VideoCommon::CacheType::NoQueryCache); 331 VideoCommon::CacheType::NoQueryCache);
329 } else { 332 } else {
330 u32 small_value = static_cast<u32>(value); 333 u32 small_value = static_cast<u32>(value);
331 cpu_memory.WriteBlockUnsafe(address, &small_value, sizeof(u32)); 334 device_memory.WriteBlockUnsafe(address, &small_value, sizeof(u32));
332 rasterizer.InvalidateRegion(address, sizeof(u32), 335 rasterizer.InvalidateRegion(address, sizeof(u32),
333 VideoCommon::CacheType::NoQueryCache); 336 VideoCommon::CacheType::NoQueryCache);
334 } 337 }
@@ -342,7 +345,7 @@ private:
342 SlotVector<AsyncJob> slot_async_jobs; 345 SlotVector<AsyncJob> slot_async_jobs;
343 346
344 VideoCore::RasterizerInterface& rasterizer; 347 VideoCore::RasterizerInterface& rasterizer;
345 Core::Memory::Memory& cpu_memory; 348 Tegra::MaxwellDeviceMemoryManager& device_memory;
346 349
347 mutable std::recursive_mutex mutex; 350 mutable std::recursive_mutex mutex;
348 351