From cc0694559fd7084221540d595edb228f8267a96c Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Thu, 13 Feb 2020 14:28:22 -0300 Subject: query_cache: Add a recursive mutex for concurrent usage --- src/video_core/query_cache.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/video_core') 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 @@ #include #include #include +#include #include #include #include @@ -98,10 +99,12 @@ public: VideoCore::QueryType::SamplesPassed}}} {} void InvalidateRegion(CacheAddr addr, std::size_t size) { + std::unique_lock lock{mutex}; FlushAndRemoveRegion(addr, size); } void FlushRegion(CacheAddr addr, std::size_t size) { + std::unique_lock lock{mutex}; FlushAndRemoveRegion(addr, size); } @@ -112,6 +115,7 @@ public: * @param timestamp Timestamp, when empty the flushed query is assumed to be short. */ void Query(GPUVAddr gpu_addr, VideoCore::QueryType type, std::optional timestamp) { + std::unique_lock lock{mutex}; auto& memory_manager = system.GPU().MemoryManager(); const auto host_ptr = memory_manager.GetPointer(gpu_addr); @@ -219,6 +223,8 @@ private: Core::System& system; VideoCore::RasterizerInterface& rasterizer; + std::recursive_mutex mutex; + std::unordered_map> cached_queries; std::array streams; -- cgit v1.2.3