From d618bba8a6a748654559fd9edac09a775aa6f0fa Mon Sep 17 00:00:00 2001 From: ameerj <52414509+ameerj@users.noreply.github.com> Date: Thu, 17 Mar 2022 22:09:01 -0400 Subject: [PATCH] general: Reduce core.h includes --- src/core/CMakeLists.txt | 1 + src/core/hle/kernel/k_page_buffer.cpp | 19 +++++++++++++++++++ src/core/hle/kernel/k_page_buffer.h | 9 ++------- src/core/hle/kernel/k_thread_local_page.cpp | 1 + src/video_core/fence_manager.h | 2 -- src/video_core/query_cache.h | 1 - .../renderer_opengl/gl_state_tracker.h | 1 - .../renderer_vulkan/vk_state_tracker.h | 1 - 8 files changed, 23 insertions(+), 12 deletions(-) create mode 100644 src/core/hle/kernel/k_page_buffer.cpp diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 1f234c822..1d4e92edb 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -209,6 +209,7 @@ add_library(core STATIC hle/kernel/k_memory_region.h hle/kernel/k_memory_region_type.h hle/kernel/k_page_bitmap.h + hle/kernel/k_page_buffer.cpp hle/kernel/k_page_buffer.h hle/kernel/k_page_heap.cpp hle/kernel/k_page_heap.h diff --git a/src/core/hle/kernel/k_page_buffer.cpp b/src/core/hle/kernel/k_page_buffer.cpp new file mode 100644 index 000000000..f7df4a9a8 --- /dev/null +++ b/src/core/hle/kernel/k_page_buffer.cpp @@ -0,0 +1,19 @@ +// Copyright 2022 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "common/alignment.h" +#include "common/assert.h" +#include "core/core.h" +#include "core/device_memory.h" +#include "core/hle/kernel/k_page_buffer.h" +#include "core/hle/kernel/memory_types.h" + +namespace Kernel { + +KPageBuffer* KPageBuffer::FromPhysicalAddress(Core::System& system, PAddr phys_addr) { + ASSERT(Common::IsAligned(phys_addr, PageSize)); + return reinterpret_cast(system.DeviceMemory().GetPointer(phys_addr)); +} + +} // namespace Kernel diff --git a/src/core/hle/kernel/k_page_buffer.h b/src/core/hle/kernel/k_page_buffer.h index 0a9451228..6ff3c1568 100644 --- a/src/core/hle/kernel/k_page_buffer.h +++ b/src/core/hle/kernel/k_page_buffer.h @@ -6,12 +6,10 @@ #include -#include "common/alignment.h" -#include "common/assert.h" #include "common/common_types.h" -#include "core/core.h" #include "core/device_memory.h" #include "core/hle/kernel/memory_types.h" +#include "core/hle/kernel/slab_helpers.h" namespace Kernel { @@ -19,10 +17,7 @@ class KPageBuffer final : public KSlabAllocated { public: KPageBuffer() = default; - static KPageBuffer* FromPhysicalAddress(Core::System& system, PAddr phys_addr) { - ASSERT(Common::IsAligned(phys_addr, PageSize)); - return reinterpret_cast(system.DeviceMemory().GetPointer(phys_addr)); - } + static KPageBuffer* FromPhysicalAddress(Core::System& system, PAddr phys_addr); private: [[maybe_unused]] alignas(PageSize) std::array m_buffer{}; diff --git a/src/core/hle/kernel/k_thread_local_page.cpp b/src/core/hle/kernel/k_thread_local_page.cpp index 4653c29f6..17b233fca 100644 --- a/src/core/hle/kernel/k_thread_local_page.cpp +++ b/src/core/hle/kernel/k_thread_local_page.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include "common/scope_exit.h" +#include "core/core.h" #include "core/hle/kernel/k_memory_block.h" #include "core/hle/kernel/k_page_table.h" #include "core/hle/kernel/k_process.h" diff --git a/src/video_core/fence_manager.h b/src/video_core/fence_manager.h index 34dc6c596..f80d62c80 100644 --- a/src/video_core/fence_manager.h +++ b/src/video_core/fence_manager.h @@ -8,8 +8,6 @@ #include #include "common/common_types.h" -#include "common/settings.h" -#include "core/core.h" #include "video_core/delayed_destruction_ring.h" #include "video_core/gpu.h" #include "video_core/memory_manager.h" diff --git a/src/video_core/query_cache.h b/src/video_core/query_cache.h index 392f82eb7..0173b54d8 100644 --- a/src/video_core/query_cache.h +++ b/src/video_core/query_cache.h @@ -18,7 +18,6 @@ #include "common/assert.h" #include "common/settings.h" -#include "core/core.h" #include "video_core/engines/maxwell_3d.h" #include "video_core/gpu.h" #include "video_core/memory_manager.h" diff --git a/src/video_core/renderer_opengl/gl_state_tracker.h b/src/video_core/renderer_opengl/gl_state_tracker.h index 5864c7c07..550ed6d36 100644 --- a/src/video_core/renderer_opengl/gl_state_tracker.h +++ b/src/video_core/renderer_opengl/gl_state_tracker.h @@ -9,7 +9,6 @@ #include #include "common/common_types.h" -#include "core/core.h" #include "video_core/dirty_flags.h" #include "video_core/engines/maxwell_3d.h" diff --git a/src/video_core/renderer_vulkan/vk_state_tracker.h b/src/video_core/renderer_vulkan/vk_state_tracker.h index 40a149832..8240c83e1 100644 --- a/src/video_core/renderer_vulkan/vk_state_tracker.h +++ b/src/video_core/renderer_vulkan/vk_state_tracker.h @@ -8,7 +8,6 @@ #include #include "common/common_types.h" -#include "core/core.h" #include "video_core/dirty_flags.h" #include "video_core/engines/maxwell_3d.h"