summaryrefslogtreecommitdiff
path: root/src/video_core/query_cache
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2024-01-07 05:33:43 +0100
committerGravatar Liam2024-01-18 21:12:30 -0500
commit23430e67724d803184b6a861e4bcb3cac0e38cb0 (patch)
tree5d0b3dfc7175434f66d0dfb32f1d0bfa597013c4 /src/video_core/query_cache
parentSMMU: Fix Right Shift UB. (diff)
downloadyuzu-23430e67724d803184b6a861e4bcb3cac0e38cb0.tar.gz
yuzu-23430e67724d803184b6a861e4bcb3cac0e38cb0.tar.xz
yuzu-23430e67724d803184b6a861e4bcb3cac0e38cb0.zip
Core: Eliminate core/memory dependancies.
Diffstat (limited to 'src/video_core/query_cache')
-rw-r--r--src/video_core/query_cache/query_cache.h15
-rw-r--r--src/video_core/query_cache/query_cache_base.h7
2 files changed, 10 insertions, 12 deletions
diff --git a/src/video_core/query_cache/query_cache.h b/src/video_core/query_cache/query_cache.h
index b5e90cf8c..08b779055 100644
--- a/src/video_core/query_cache/query_cache.h
+++ b/src/video_core/query_cache/query_cache.h
@@ -15,7 +15,6 @@
15#include "common/logging/log.h" 15#include "common/logging/log.h"
16#include "common/scope_exit.h" 16#include "common/scope_exit.h"
17#include "common/settings.h" 17#include "common/settings.h"
18#include "core/memory.h"
19#include "video_core/engines/maxwell_3d.h" 18#include "video_core/engines/maxwell_3d.h"
20#include "video_core/gpu.h" 19#include "video_core/gpu.h"
21#include "video_core/host1x/gpu_device_memory_manager.h" 20#include "video_core/host1x/gpu_device_memory_manager.h"
@@ -253,8 +252,8 @@ void QueryCacheBase<Traits>::CounterReport(GPUVAddr addr, QueryType counter_type
253 query_location.stream_id.Assign(static_cast<u32>(streamer_id)); 252 query_location.stream_id.Assign(static_cast<u32>(streamer_id));
254 query_location.query_id.Assign(static_cast<u32>(new_query_id)); 253 query_location.query_id.Assign(static_cast<u32>(new_query_id));
255 const auto gen_caching_indexing = [](VAddr cur_addr) { 254 const auto gen_caching_indexing = [](VAddr cur_addr) {
256 return std::make_pair<u64, u32>(cur_addr >> Core::Memory::YUZU_PAGEBITS, 255 return std::make_pair<u64, u32>(cur_addr >> Core::DEVICE_PAGEBITS,
257 static_cast<u32>(cur_addr & Core::Memory::YUZU_PAGEMASK)); 256 static_cast<u32>(cur_addr & Core::DEVICE_PAGEMASK));
258 }; 257 };
259 u8* pointer = impl->device_memory.template GetPointer<u8>(cpu_addr); 258 u8* pointer = impl->device_memory.template GetPointer<u8>(cpu_addr);
260 u8* pointer_timestamp = impl->device_memory.template GetPointer<u8>(cpu_addr + 8); 259 u8* pointer_timestamp = impl->device_memory.template GetPointer<u8>(cpu_addr + 8);
@@ -325,8 +324,8 @@ void QueryCacheBase<Traits>::CounterReport(GPUVAddr addr, QueryType counter_type
325template <typename Traits> 324template <typename Traits>
326void QueryCacheBase<Traits>::UnregisterPending() { 325void QueryCacheBase<Traits>::UnregisterPending() {
327 const auto gen_caching_indexing = [](VAddr cur_addr) { 326 const auto gen_caching_indexing = [](VAddr cur_addr) {
328 return std::make_pair<u64, u32>(cur_addr >> Core::Memory::YUZU_PAGEBITS, 327 return std::make_pair<u64, u32>(cur_addr >> Core::DEVICE_PAGEBITS,
329 static_cast<u32>(cur_addr & Core::Memory::YUZU_PAGEMASK)); 328 static_cast<u32>(cur_addr & Core::DEVICE_PAGEMASK));
330 }; 329 };
331 std::scoped_lock lock(cache_mutex); 330 std::scoped_lock lock(cache_mutex);
332 for (QueryLocation loc : impl->pending_unregister) { 331 for (QueryLocation loc : impl->pending_unregister) {
@@ -390,7 +389,7 @@ bool QueryCacheBase<Traits>::AccelerateHostConditionalRendering() {
390 } 389 }
391 VAddr cpu_addr = *cpu_addr_opt; 390 VAddr cpu_addr = *cpu_addr_opt;
392 std::scoped_lock lock(cache_mutex); 391 std::scoped_lock lock(cache_mutex);
393 auto it1 = cached_queries.find(cpu_addr >> Core::Memory::YUZU_PAGEBITS); 392 auto it1 = cached_queries.find(cpu_addr >> Core::DEVICE_PAGEBITS);
394 if (it1 == cached_queries.end()) { 393 if (it1 == cached_queries.end()) {
395 return VideoCommon::LookupData{ 394 return VideoCommon::LookupData{
396 .address = cpu_addr, 395 .address = cpu_addr,
@@ -398,10 +397,10 @@ bool QueryCacheBase<Traits>::AccelerateHostConditionalRendering() {
398 }; 397 };
399 } 398 }
400 auto& sub_container = it1->second; 399 auto& sub_container = it1->second;
401 auto it_current = sub_container.find(cpu_addr & Core::Memory::YUZU_PAGEMASK); 400 auto it_current = sub_container.find(cpu_addr & Core::DEVICE_PAGEMASK);
402 401
403 if (it_current == sub_container.end()) { 402 if (it_current == sub_container.end()) {
404 auto it_current_2 = sub_container.find((cpu_addr & Core::Memory::YUZU_PAGEMASK) + 4); 403 auto it_current_2 = sub_container.find((cpu_addr & Core::DEVICE_PAGEMASK) + 4);
405 if (it_current_2 == sub_container.end()) { 404 if (it_current_2 == sub_container.end()) {
406 return VideoCommon::LookupData{ 405 return VideoCommon::LookupData{
407 .address = cpu_addr, 406 .address = cpu_addr,
diff --git a/src/video_core/query_cache/query_cache_base.h b/src/video_core/query_cache/query_cache_base.h
index 3c820b5f2..c12fb75ef 100644
--- a/src/video_core/query_cache/query_cache_base.h
+++ b/src/video_core/query_cache/query_cache_base.h
@@ -13,7 +13,6 @@
13#include "common/assert.h" 13#include "common/assert.h"
14#include "common/bit_field.h" 14#include "common/bit_field.h"
15#include "common/common_types.h" 15#include "common/common_types.h"
16#include "core/memory.h"
17#include "video_core/control/channel_state_cache.h" 16#include "video_core/control/channel_state_cache.h"
18#include "video_core/host1x/gpu_device_memory_manager.h" 17#include "video_core/host1x/gpu_device_memory_manager.h"
19#include "video_core/query_cache/query_base.h" 18#include "video_core/query_cache/query_base.h"
@@ -123,10 +122,10 @@ protected:
123 const u64 addr_begin = addr; 122 const u64 addr_begin = addr;
124 const u64 addr_end = addr_begin + size; 123 const u64 addr_end = addr_begin + size;
125 124
126 const u64 page_end = addr_end >> Core::Memory::YUZU_PAGEBITS; 125 const u64 page_end = addr_end >> Core::DEVICE_PAGEBITS;
127 std::scoped_lock lock(cache_mutex); 126 std::scoped_lock lock(cache_mutex);
128 for (u64 page = addr_begin >> Core::Memory::YUZU_PAGEBITS; page <= page_end; ++page) { 127 for (u64 page = addr_begin >> Core::DEVICE_PAGEBITS; page <= page_end; ++page) {
129 const u64 page_start = page << Core::Memory::YUZU_PAGEBITS; 128 const u64 page_start = page << Core::DEVICE_PAGEBITS;
130 const auto in_range = [page_start, addr_begin, addr_end](const u32 query_location) { 129 const auto in_range = [page_start, addr_begin, addr_end](const u32 query_location) {
131 const u64 cache_begin = page_start + query_location; 130 const u64 cache_begin = page_start + query_location;
132 const u64 cache_end = cache_begin + sizeof(u32); 131 const u64 cache_end = cache_begin + sizeof(u32);