summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/video_core/query_cache.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/video_core/query_cache.h b/src/video_core/query_cache.h
index 069032121..86f5aade1 100644
--- a/src/video_core/query_cache.h
+++ b/src/video_core/query_cache.h
@@ -9,6 +9,7 @@
9#include <cstring> 9#include <cstring>
10#include <iterator> 10#include <iterator>
11#include <memory> 11#include <memory>
12#include <mutex>
12#include <optional> 13#include <optional>
13#include <unordered_map> 14#include <unordered_map>
14#include <vector> 15#include <vector>
@@ -98,10 +99,12 @@ public:
98 VideoCore::QueryType::SamplesPassed}}} {} 99 VideoCore::QueryType::SamplesPassed}}} {}
99 100
100 void InvalidateRegion(CacheAddr addr, std::size_t size) { 101 void InvalidateRegion(CacheAddr addr, std::size_t size) {
102 std::unique_lock lock{mutex};
101 FlushAndRemoveRegion(addr, size); 103 FlushAndRemoveRegion(addr, size);
102 } 104 }
103 105
104 void FlushRegion(CacheAddr addr, std::size_t size) { 106 void FlushRegion(CacheAddr addr, std::size_t size) {
107 std::unique_lock lock{mutex};
105 FlushAndRemoveRegion(addr, size); 108 FlushAndRemoveRegion(addr, size);
106 } 109 }
107 110
@@ -112,6 +115,7 @@ public:
112 * @param timestamp Timestamp, when empty the flushed query is assumed to be short. 115 * @param timestamp Timestamp, when empty the flushed query is assumed to be short.
113 */ 116 */
114 void Query(GPUVAddr gpu_addr, VideoCore::QueryType type, std::optional<u64> timestamp) { 117 void Query(GPUVAddr gpu_addr, VideoCore::QueryType type, std::optional<u64> timestamp) {
118 std::unique_lock lock{mutex};
115 auto& memory_manager = system.GPU().MemoryManager(); 119 auto& memory_manager = system.GPU().MemoryManager();
116 const auto host_ptr = memory_manager.GetPointer(gpu_addr); 120 const auto host_ptr = memory_manager.GetPointer(gpu_addr);
117 121
@@ -219,6 +223,8 @@ private:
219 Core::System& system; 223 Core::System& system;
220 VideoCore::RasterizerInterface& rasterizer; 224 VideoCore::RasterizerInterface& rasterizer;
221 225
226 std::recursive_mutex mutex;
227
222 std::unordered_map<u64, std::vector<CachedQuery>> cached_queries; 228 std::unordered_map<u64, std::vector<CachedQuery>> cached_queries;
223 229
224 std::array<CounterStream, VideoCore::NumQueryTypes> streams; 230 std::array<CounterStream, VideoCore::NumQueryTypes> streams;