Core: Eliminate core/memory dependancies.

This commit is contained in:
Fernando Sahmkow
2024-01-07 05:33:43 +01:00
committed by Liam
parent 0672847330
commit 23430e6772
21 changed files with 46 additions and 54 deletions

View File

@ -15,7 +15,6 @@
#include "common/logging/log.h"
#include "common/scope_exit.h"
#include "common/settings.h"
#include "core/memory.h"
#include "video_core/engines/maxwell_3d.h"
#include "video_core/gpu.h"
#include "video_core/host1x/gpu_device_memory_manager.h"
@ -253,8 +252,8 @@ void QueryCacheBase<Traits>::CounterReport(GPUVAddr addr, QueryType counter_type
query_location.stream_id.Assign(static_cast<u32>(streamer_id));
query_location.query_id.Assign(static_cast<u32>(new_query_id));
const auto gen_caching_indexing = [](VAddr cur_addr) {
return std::make_pair<u64, u32>(cur_addr >> Core::Memory::YUZU_PAGEBITS,
static_cast<u32>(cur_addr & Core::Memory::YUZU_PAGEMASK));
return std::make_pair<u64, u32>(cur_addr >> Core::DEVICE_PAGEBITS,
static_cast<u32>(cur_addr & Core::DEVICE_PAGEMASK));
};
u8* pointer = impl->device_memory.template GetPointer<u8>(cpu_addr);
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
template <typename Traits>
void QueryCacheBase<Traits>::UnregisterPending() {
const auto gen_caching_indexing = [](VAddr cur_addr) {
return std::make_pair<u64, u32>(cur_addr >> Core::Memory::YUZU_PAGEBITS,
static_cast<u32>(cur_addr & Core::Memory::YUZU_PAGEMASK));
return std::make_pair<u64, u32>(cur_addr >> Core::DEVICE_PAGEBITS,
static_cast<u32>(cur_addr & Core::DEVICE_PAGEMASK));
};
std::scoped_lock lock(cache_mutex);
for (QueryLocation loc : impl->pending_unregister) {
@ -390,7 +389,7 @@ bool QueryCacheBase<Traits>::AccelerateHostConditionalRendering() {
}
VAddr cpu_addr = *cpu_addr_opt;
std::scoped_lock lock(cache_mutex);
auto it1 = cached_queries.find(cpu_addr >> Core::Memory::YUZU_PAGEBITS);
auto it1 = cached_queries.find(cpu_addr >> Core::DEVICE_PAGEBITS);
if (it1 == cached_queries.end()) {
return VideoCommon::LookupData{
.address = cpu_addr,
@ -398,10 +397,10 @@ bool QueryCacheBase<Traits>::AccelerateHostConditionalRendering() {
};
}
auto& sub_container = it1->second;
auto it_current = sub_container.find(cpu_addr & Core::Memory::YUZU_PAGEMASK);
auto it_current = sub_container.find(cpu_addr & Core::DEVICE_PAGEMASK);
if (it_current == sub_container.end()) {
auto it_current_2 = sub_container.find((cpu_addr & Core::Memory::YUZU_PAGEMASK) + 4);
auto it_current_2 = sub_container.find((cpu_addr & Core::DEVICE_PAGEMASK) + 4);
if (it_current_2 == sub_container.end()) {
return VideoCommon::LookupData{
.address = cpu_addr,

View File

@ -13,7 +13,6 @@
#include "common/assert.h"
#include "common/bit_field.h"
#include "common/common_types.h"
#include "core/memory.h"
#include "video_core/control/channel_state_cache.h"
#include "video_core/host1x/gpu_device_memory_manager.h"
#include "video_core/query_cache/query_base.h"
@ -123,10 +122,10 @@ protected:
const u64 addr_begin = addr;
const u64 addr_end = addr_begin + size;
const u64 page_end = addr_end >> Core::Memory::YUZU_PAGEBITS;
const u64 page_end = addr_end >> Core::DEVICE_PAGEBITS;
std::scoped_lock lock(cache_mutex);
for (u64 page = addr_begin >> Core::Memory::YUZU_PAGEBITS; page <= page_end; ++page) {
const u64 page_start = page << Core::Memory::YUZU_PAGEBITS;
for (u64 page = addr_begin >> Core::DEVICE_PAGEBITS; page <= page_end; ++page) {
const u64 page_start = page << Core::DEVICE_PAGEBITS;
const auto in_range = [page_start, addr_begin, addr_end](const u32 query_location) {
const u64 cache_begin = page_start + query_location;
const u64 cache_end = cache_begin + sizeof(u32);