diff options
Diffstat (limited to 'src')
40 files changed, 152 insertions, 106 deletions
diff --git a/src/audio_core/device/device_session.cpp b/src/audio_core/device/device_session.cpp index d9fc8c3e0..2a1ae1bb3 100644 --- a/src/audio_core/device/device_session.cpp +++ b/src/audio_core/device/device_session.cpp | |||
| @@ -8,8 +8,8 @@ | |||
| 8 | #include "audio_core/sink/sink_stream.h" | 8 | #include "audio_core/sink/sink_stream.h" |
| 9 | #include "core/core.h" | 9 | #include "core/core.h" |
| 10 | #include "core/core_timing.h" | 10 | #include "core/core_timing.h" |
| 11 | #include "core/memory.h" | ||
| 12 | #include "core/guest_memory.h" | 11 | #include "core/guest_memory.h" |
| 12 | #include "core/memory.h" | ||
| 13 | 13 | ||
| 14 | #include "core/hle/kernel/k_process.h" | 14 | #include "core/hle/kernel/k_process.h" |
| 15 | 15 | ||
diff --git a/src/audio_core/renderer/command/data_source/decode.cpp b/src/audio_core/renderer/command/data_source/decode.cpp index 77a33a87a..905613a5a 100644 --- a/src/audio_core/renderer/command/data_source/decode.cpp +++ b/src/audio_core/renderer/command/data_source/decode.cpp | |||
| @@ -9,8 +9,8 @@ | |||
| 9 | #include "common/fixed_point.h" | 9 | #include "common/fixed_point.h" |
| 10 | #include "common/logging/log.h" | 10 | #include "common/logging/log.h" |
| 11 | #include "common/scratch_buffer.h" | 11 | #include "common/scratch_buffer.h" |
| 12 | #include "core/memory.h" | ||
| 13 | #include "core/guest_memory.h" | 12 | #include "core/guest_memory.h" |
| 13 | #include "core/memory.h" | ||
| 14 | 14 | ||
| 15 | namespace AudioCore::Renderer { | 15 | namespace AudioCore::Renderer { |
| 16 | 16 | ||
diff --git a/src/core/device_memory_manager.h b/src/core/device_memory_manager.h index 0f6599cfe..f9cb13a7a 100644 --- a/src/core/device_memory_manager.h +++ b/src/core/device_memory_manager.h | |||
| @@ -27,13 +27,13 @@ struct DeviceMemoryManagerAllocator; | |||
| 27 | template <typename Traits> | 27 | template <typename Traits> |
| 28 | class DeviceMemoryManager { | 28 | class DeviceMemoryManager { |
| 29 | using DeviceInterface = typename Traits::DeviceInterface; | 29 | using DeviceInterface = typename Traits::DeviceInterface; |
| 30 | using DeviceMethods = Traits::DeviceMethods; | 30 | using DeviceMethods = typename Traits::DeviceMethods; |
| 31 | 31 | ||
| 32 | public: | 32 | public: |
| 33 | DeviceMemoryManager(const DeviceMemory& device_memory); | 33 | DeviceMemoryManager(const DeviceMemory& device_memory); |
| 34 | ~DeviceMemoryManager(); | 34 | ~DeviceMemoryManager(); |
| 35 | 35 | ||
| 36 | void BindInterface(DeviceInterface* interface); | 36 | void BindInterface(DeviceInterface* device_inter); |
| 37 | 37 | ||
| 38 | DAddr Allocate(size_t size); | 38 | DAddr Allocate(size_t size); |
| 39 | void AllocateFixed(DAddr start, size_t size); | 39 | void AllocateFixed(DAddr start, size_t size); |
| @@ -111,6 +111,7 @@ public: | |||
| 111 | private: | 111 | private: |
| 112 | static constexpr size_t device_virtual_bits = Traits::device_virtual_bits; | 112 | static constexpr size_t device_virtual_bits = Traits::device_virtual_bits; |
| 113 | static constexpr size_t device_as_size = 1ULL << device_virtual_bits; | 113 | static constexpr size_t device_as_size = 1ULL << device_virtual_bits; |
| 114 | static constexpr size_t physical_min_bits = 32; | ||
| 114 | static constexpr size_t physical_max_bits = 33; | 115 | static constexpr size_t physical_max_bits = 33; |
| 115 | static constexpr size_t page_bits = 12; | 116 | static constexpr size_t page_bits = 12; |
| 116 | static constexpr size_t page_size = 1ULL << page_bits; | 117 | static constexpr size_t page_size = 1ULL << page_bits; |
| @@ -143,7 +144,7 @@ private: | |||
| 143 | std::unique_ptr<DeviceMemoryManagerAllocator<Traits>> impl; | 144 | std::unique_ptr<DeviceMemoryManagerAllocator<Traits>> impl; |
| 144 | 145 | ||
| 145 | const uintptr_t physical_base; | 146 | const uintptr_t physical_base; |
| 146 | DeviceInterface* interface; | 147 | DeviceInterface* device_inter; |
| 147 | Common::VirtualBuffer<u32> compressed_physical_ptr; | 148 | Common::VirtualBuffer<u32> compressed_physical_ptr; |
| 148 | Common::VirtualBuffer<u32> compressed_device_addr; | 149 | Common::VirtualBuffer<u32> compressed_device_addr; |
| 149 | Common::VirtualBuffer<u32> continuity_tracker; | 150 | Common::VirtualBuffer<u32> continuity_tracker; |
diff --git a/src/core/device_memory_manager.inc b/src/core/device_memory_manager.inc index 175f0cd5f..a0eb4214e 100644 --- a/src/core/device_memory_manager.inc +++ b/src/core/device_memory_manager.inc | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include "common/assert.h" | 12 | #include "common/assert.h" |
| 13 | #include "common/div_ceil.h" | 13 | #include "common/div_ceil.h" |
| 14 | #include "common/scope_exit.h" | 14 | #include "common/scope_exit.h" |
| 15 | #include "common/settings.h" | ||
| 15 | #include "core/device_memory.h" | 16 | #include "core/device_memory.h" |
| 16 | #include "core/device_memory_manager.h" | 17 | #include "core/device_memory_manager.h" |
| 17 | #include "core/memory.h" | 18 | #include "core/memory.h" |
| @@ -162,20 +163,39 @@ struct DeviceMemoryManagerAllocator { | |||
| 162 | template <typename Traits> | 163 | template <typename Traits> |
| 163 | DeviceMemoryManager<Traits>::DeviceMemoryManager(const DeviceMemory& device_memory_) | 164 | DeviceMemoryManager<Traits>::DeviceMemoryManager(const DeviceMemory& device_memory_) |
| 164 | : physical_base{reinterpret_cast<const uintptr_t>(device_memory_.buffer.BackingBasePointer())}, | 165 | : physical_base{reinterpret_cast<const uintptr_t>(device_memory_.buffer.BackingBasePointer())}, |
| 165 | interface{nullptr}, compressed_physical_ptr(device_as_size >> Memory::YUZU_PAGEBITS), | 166 | device_inter{nullptr}, compressed_physical_ptr(device_as_size >> Memory::YUZU_PAGEBITS), |
| 166 | compressed_device_addr(1ULL << (physical_max_bits - Memory::YUZU_PAGEBITS)), | 167 | compressed_device_addr(1ULL << ((Settings::values.memory_layout_mode.GetValue() == |
| 168 | Settings::MemoryLayout::Memory_4Gb | ||
| 169 | ? physical_min_bits | ||
| 170 | : physical_max_bits) - | ||
| 171 | Memory::YUZU_PAGEBITS)), | ||
| 167 | continuity_tracker(device_as_size >> Memory::YUZU_PAGEBITS), | 172 | continuity_tracker(device_as_size >> Memory::YUZU_PAGEBITS), |
| 168 | cpu_backing_address(device_as_size >> Memory::YUZU_PAGEBITS) { | 173 | cpu_backing_address(device_as_size >> Memory::YUZU_PAGEBITS) { |
| 169 | impl = std::make_unique<DeviceMemoryManagerAllocator<Traits>>(); | 174 | impl = std::make_unique<DeviceMemoryManagerAllocator<Traits>>(); |
| 170 | cached_pages = std::make_unique<CachedPages>(); | 175 | cached_pages = std::make_unique<CachedPages>(); |
| 176 | |||
| 177 | const size_t total_virtual = device_as_size >> Memory::YUZU_PAGEBITS; | ||
| 178 | for (size_t i = 0; i < total_virtual; i++) { | ||
| 179 | compressed_physical_ptr[i] = 0; | ||
| 180 | continuity_tracker[i] = 1; | ||
| 181 | cpu_backing_address[i] = 0; | ||
| 182 | } | ||
| 183 | const size_t total_phys = 1ULL << ((Settings::values.memory_layout_mode.GetValue() == | ||
| 184 | Settings::MemoryLayout::Memory_4Gb | ||
| 185 | ? physical_min_bits | ||
| 186 | : physical_max_bits) - | ||
| 187 | Memory::YUZU_PAGEBITS); | ||
| 188 | for (size_t i = 0; i < total_phys; i++) { | ||
| 189 | compressed_device_addr[i] = 0; | ||
| 190 | } | ||
| 171 | } | 191 | } |
| 172 | 192 | ||
| 173 | template <typename Traits> | 193 | template <typename Traits> |
| 174 | DeviceMemoryManager<Traits>::~DeviceMemoryManager() = default; | 194 | DeviceMemoryManager<Traits>::~DeviceMemoryManager() = default; |
| 175 | 195 | ||
| 176 | template <typename Traits> | 196 | template <typename Traits> |
| 177 | void DeviceMemoryManager<Traits>::BindInterface(DeviceInterface* interface_) { | 197 | void DeviceMemoryManager<Traits>::BindInterface(DeviceInterface* device_inter_) { |
| 178 | interface = interface_; | 198 | device_inter = device_inter_; |
| 179 | } | 199 | } |
| 180 | 200 | ||
| 181 | template <typename Traits> | 201 | template <typename Traits> |
| @@ -232,7 +252,7 @@ template <typename Traits> | |||
| 232 | void DeviceMemoryManager<Traits>::Unmap(DAddr address, size_t size) { | 252 | void DeviceMemoryManager<Traits>::Unmap(DAddr address, size_t size) { |
| 233 | size_t start_page_d = address >> Memory::YUZU_PAGEBITS; | 253 | size_t start_page_d = address >> Memory::YUZU_PAGEBITS; |
| 234 | size_t num_pages = Common::AlignUp(size, Memory::YUZU_PAGESIZE) >> Memory::YUZU_PAGEBITS; | 254 | size_t num_pages = Common::AlignUp(size, Memory::YUZU_PAGESIZE) >> Memory::YUZU_PAGEBITS; |
| 235 | interface->InvalidateRegion(address, size); | 255 | device_inter->InvalidateRegion(address, size); |
| 236 | std::scoped_lock lk(mapping_guard); | 256 | std::scoped_lock lk(mapping_guard); |
| 237 | for (size_t i = 0; i < num_pages; i++) { | 257 | for (size_t i = 0; i < num_pages; i++) { |
| 238 | auto phys_addr = compressed_physical_ptr[start_page_d + i]; | 258 | auto phys_addr = compressed_physical_ptr[start_page_d + i]; |
| @@ -392,7 +412,7 @@ void DeviceMemoryManager<Traits>::WalkBlock(DAddr addr, std::size_t size, auto o | |||
| 392 | 412 | ||
| 393 | template <typename Traits> | 413 | template <typename Traits> |
| 394 | void DeviceMemoryManager<Traits>::ReadBlock(DAddr address, void* dest_pointer, size_t size) { | 414 | void DeviceMemoryManager<Traits>::ReadBlock(DAddr address, void* dest_pointer, size_t size) { |
| 395 | interface->FlushRegion(address, size); | 415 | device_inter->FlushRegion(address, size); |
| 396 | WalkBlock( | 416 | WalkBlock( |
| 397 | address, size, | 417 | address, size, |
| 398 | [&](size_t copy_amount, DAddr current_vaddr) { | 418 | [&](size_t copy_amount, DAddr current_vaddr) { |
| @@ -426,7 +446,7 @@ void DeviceMemoryManager<Traits>::WriteBlock(DAddr address, const void* src_poin | |||
| 426 | [&](const std::size_t copy_amount) { | 446 | [&](const std::size_t copy_amount) { |
| 427 | src_pointer = static_cast<const u8*>(src_pointer) + copy_amount; | 447 | src_pointer = static_cast<const u8*>(src_pointer) + copy_amount; |
| 428 | }); | 448 | }); |
| 429 | interface->InvalidateRegion(address, size); | 449 | device_inter->InvalidateRegion(address, size); |
| 430 | } | 450 | } |
| 431 | 451 | ||
| 432 | template <typename Traits> | 452 | template <typename Traits> |
| @@ -468,14 +488,14 @@ void DeviceMemoryManager<Traits>::WriteBlockUnsafe(DAddr address, const void* sr | |||
| 468 | } | 488 | } |
| 469 | 489 | ||
| 470 | template <typename Traits> | 490 | template <typename Traits> |
| 471 | size_t DeviceMemoryManager<Traits>::RegisterProcess(Memory::Memory* memory_interface) { | 491 | size_t DeviceMemoryManager<Traits>::RegisterProcess(Memory::Memory* memory_device_inter) { |
| 472 | size_t new_id; | 492 | size_t new_id; |
| 473 | if (!id_pool.empty()) { | 493 | if (!id_pool.empty()) { |
| 474 | new_id = id_pool.front(); | 494 | new_id = id_pool.front(); |
| 475 | id_pool.pop_front(); | 495 | id_pool.pop_front(); |
| 476 | registered_processes[new_id] = memory_interface; | 496 | registered_processes[new_id] = memory_device_inter; |
| 477 | } else { | 497 | } else { |
| 478 | registered_processes.emplace_back(memory_interface); | 498 | registered_processes.emplace_back(memory_device_inter); |
| 479 | new_id = registered_processes.size() - 1U; | 499 | new_id = registered_processes.size() - 1U; |
| 480 | } | 500 | } |
| 481 | return new_id; | 501 | return new_id; |
| @@ -512,7 +532,7 @@ void DeviceMemoryManager<Traits>::UpdatePagesCachedCount(DAddr addr, size_t size | |||
| 512 | size_t page = addr >> Memory::YUZU_PAGEBITS; | 532 | size_t page = addr >> Memory::YUZU_PAGEBITS; |
| 513 | auto [process_id, base_vaddress] = ExtractCPUBacking(page); | 533 | auto [process_id, base_vaddress] = ExtractCPUBacking(page); |
| 514 | size_t vpage = base_vaddress >> Memory::YUZU_PAGEBITS; | 534 | size_t vpage = base_vaddress >> Memory::YUZU_PAGEBITS; |
| 515 | auto* memory_interface = registered_processes[process_id]; | 535 | auto* memory_device_inter = registered_processes[process_id]; |
| 516 | for (; page != page_end; ++page) { | 536 | for (; page != page_end; ++page) { |
| 517 | std::atomic_uint8_t& count = cached_pages->at(page >> 3).Count(page); | 537 | std::atomic_uint8_t& count = cached_pages->at(page >> 3).Count(page); |
| 518 | 538 | ||
| @@ -536,7 +556,7 @@ void DeviceMemoryManager<Traits>::UpdatePagesCachedCount(DAddr addr, size_t size | |||
| 536 | uncache_bytes += Memory::YUZU_PAGESIZE; | 556 | uncache_bytes += Memory::YUZU_PAGESIZE; |
| 537 | } else if (uncache_bytes > 0) { | 557 | } else if (uncache_bytes > 0) { |
| 538 | lock(); | 558 | lock(); |
| 539 | MarkRegionCaching(memory_interface, uncache_begin << Memory::YUZU_PAGEBITS, | 559 | MarkRegionCaching(memory_device_inter, uncache_begin << Memory::YUZU_PAGEBITS, |
| 540 | uncache_bytes, false); | 560 | uncache_bytes, false); |
| 541 | uncache_bytes = 0; | 561 | uncache_bytes = 0; |
| 542 | } | 562 | } |
| @@ -547,7 +567,7 @@ void DeviceMemoryManager<Traits>::UpdatePagesCachedCount(DAddr addr, size_t size | |||
| 547 | cache_bytes += Memory::YUZU_PAGESIZE; | 567 | cache_bytes += Memory::YUZU_PAGESIZE; |
| 548 | } else if (cache_bytes > 0) { | 568 | } else if (cache_bytes > 0) { |
| 549 | lock(); | 569 | lock(); |
| 550 | MarkRegionCaching(memory_interface, cache_begin << Memory::YUZU_PAGEBITS, cache_bytes, | 570 | MarkRegionCaching(memory_device_inter, cache_begin << Memory::YUZU_PAGEBITS, cache_bytes, |
| 551 | true); | 571 | true); |
| 552 | cache_bytes = 0; | 572 | cache_bytes = 0; |
| 553 | } | 573 | } |
| @@ -555,12 +575,12 @@ void DeviceMemoryManager<Traits>::UpdatePagesCachedCount(DAddr addr, size_t size | |||
| 555 | } | 575 | } |
| 556 | if (uncache_bytes > 0) { | 576 | if (uncache_bytes > 0) { |
| 557 | lock(); | 577 | lock(); |
| 558 | MarkRegionCaching(memory_interface, uncache_begin << Memory::YUZU_PAGEBITS, uncache_bytes, | 578 | MarkRegionCaching(memory_device_inter, uncache_begin << Memory::YUZU_PAGEBITS, uncache_bytes, |
| 559 | false); | 579 | false); |
| 560 | } | 580 | } |
| 561 | if (cache_bytes > 0) { | 581 | if (cache_bytes > 0) { |
| 562 | lock(); | 582 | lock(); |
| 563 | MarkRegionCaching(memory_interface, cache_begin << Memory::YUZU_PAGEBITS, cache_bytes, | 583 | MarkRegionCaching(memory_device_inter, cache_begin << Memory::YUZU_PAGEBITS, cache_bytes, |
| 564 | true); | 584 | true); |
| 565 | } | 585 | } |
| 566 | } | 586 | } |
diff --git a/src/core/guest_memory.h b/src/core/guest_memory.h index 0b349cc17..8030df73a 100644 --- a/src/core/guest_memory.h +++ b/src/core/guest_memory.h | |||
| @@ -202,7 +202,8 @@ public: | |||
| 202 | } else { | 202 | } else { |
| 203 | this->m_memory.WriteBlockUnsafe(this->m_addr, this->data(), this->size_bytes()); | 203 | this->m_memory.WriteBlockUnsafe(this->m_addr, this->data(), this->size_bytes()); |
| 204 | } | 204 | } |
| 205 | } else if constexpr ((FLAGS & GuestMemoryFlags::Safe) || (FLAGS & GuestMemoryFlags::Cached)) { | 205 | } else if constexpr ((FLAGS & GuestMemoryFlags::Safe) || |
| 206 | (FLAGS & GuestMemoryFlags::Cached)) { | ||
| 206 | this->m_memory.InvalidateRegion(this->m_addr, this->size_bytes()); | 207 | this->m_memory.InvalidateRegion(this->m_addr, this->size_bytes()); |
| 207 | } | 208 | } |
| 208 | } | 209 | } |
| @@ -215,4 +216,4 @@ using CpuGuestMemory = GuestMemory<Core::Memory::Memory, T, FLAGS>; | |||
| 215 | template <typename T, GuestMemoryFlags FLAGS> | 216 | template <typename T, GuestMemoryFlags FLAGS> |
| 216 | using CpuGuestMemoryScoped = GuestMemoryScoped<Core::Memory::Memory, T, FLAGS>; | 217 | using CpuGuestMemoryScoped = GuestMemoryScoped<Core::Memory::Memory, T, FLAGS>; |
| 217 | 218 | ||
| 218 | } // namespace Tegra::Memory | 219 | } // namespace Core::Memory |
diff --git a/src/core/hle/service/hle_ipc.cpp b/src/core/hle/service/hle_ipc.cpp index 9f6274c7d..e491dd260 100644 --- a/src/core/hle/service/hle_ipc.cpp +++ b/src/core/hle/service/hle_ipc.cpp | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 13 | #include "common/logging/log.h" | 13 | #include "common/logging/log.h" |
| 14 | #include "common/scratch_buffer.h" | 14 | #include "common/scratch_buffer.h" |
| 15 | #include "core/guest_memory.h" | ||
| 15 | #include "core/hle/kernel/k_auto_object.h" | 16 | #include "core/hle/kernel/k_auto_object.h" |
| 16 | #include "core/hle/kernel/k_handle_table.h" | 17 | #include "core/hle/kernel/k_handle_table.h" |
| 17 | #include "core/hle/kernel/k_process.h" | 18 | #include "core/hle/kernel/k_process.h" |
| @@ -22,7 +23,6 @@ | |||
| 22 | #include "core/hle/service/hle_ipc.h" | 23 | #include "core/hle/service/hle_ipc.h" |
| 23 | #include "core/hle/service/ipc_helpers.h" | 24 | #include "core/hle/service/ipc_helpers.h" |
| 24 | #include "core/memory.h" | 25 | #include "core/memory.h" |
| 25 | #include "core/guest_memory.h" | ||
| 26 | 26 | ||
| 27 | namespace Service { | 27 | namespace Service { |
| 28 | 28 | ||
diff --git a/src/core/hle/service/nvdrv/core/container.cpp b/src/core/hle/service/nvdrv/core/container.cpp index 4d3a9d696..d04b7f5ff 100644 --- a/src/core/hle/service/nvdrv/core/container.cpp +++ b/src/core/hle/service/nvdrv/core/container.cpp | |||
| @@ -16,6 +16,12 @@ | |||
| 16 | 16 | ||
| 17 | namespace Service::Nvidia::NvCore { | 17 | namespace Service::Nvidia::NvCore { |
| 18 | 18 | ||
| 19 | Session::Session(size_t id_, Kernel::KProcess* process_, size_t smmu_id_) | ||
| 20 | : id{id_}, process{process_}, smmu_id{smmu_id_}, | ||
| 21 | has_preallocated_area{}, mapper{}, is_active{} {} | ||
| 22 | |||
| 23 | Session::~Session() = default; | ||
| 24 | |||
| 19 | struct ContainerImpl { | 25 | struct ContainerImpl { |
| 20 | explicit ContainerImpl(Container& core, Tegra::Host1x::Host1x& host1x_) | 26 | explicit ContainerImpl(Container& core, Tegra::Host1x::Host1x& host1x_) |
| 21 | : host1x{host1x_}, file{core, host1x_}, manager{host1x_}, device_file_data{} {} | 27 | : host1x{host1x_}, file{core, host1x_}, manager{host1x_}, device_file_data{} {} |
| @@ -54,8 +60,8 @@ size_t Container::OpenSession(Kernel::KProcess* process) { | |||
| 54 | impl->id_pool.pop_front(); | 60 | impl->id_pool.pop_front(); |
| 55 | impl->sessions[new_id] = Session{new_id, process, smmu_id}; | 61 | impl->sessions[new_id] = Session{new_id, process, smmu_id}; |
| 56 | } else { | 62 | } else { |
| 57 | impl->sessions.emplace_back(new_id, process, smmu_id); | ||
| 58 | new_id = impl->new_ids++; | 63 | new_id = impl->new_ids++; |
| 64 | impl->sessions.emplace_back(new_id, process, smmu_id); | ||
| 59 | } | 65 | } |
| 60 | auto& session = impl->sessions[new_id]; | 66 | auto& session = impl->sessions[new_id]; |
| 61 | session.is_active = true; | 67 | session.is_active = true; |
diff --git a/src/core/hle/service/nvdrv/core/container.h b/src/core/hle/service/nvdrv/core/container.h index 86705cbc8..4b8452844 100644 --- a/src/core/hle/service/nvdrv/core/container.h +++ b/src/core/hle/service/nvdrv/core/container.h | |||
| @@ -27,6 +27,14 @@ class SyncpointManager; | |||
| 27 | struct ContainerImpl; | 27 | struct ContainerImpl; |
| 28 | 28 | ||
| 29 | struct Session { | 29 | struct Session { |
| 30 | Session(size_t id_, Kernel::KProcess* process_, size_t smmu_id_); | ||
| 31 | ~Session(); | ||
| 32 | |||
| 33 | Session(const Session&) = delete; | ||
| 34 | Session& operator=(const Session&) = delete; | ||
| 35 | Session(Session&&) = default; | ||
| 36 | Session& operator=(Session&&) = default; | ||
| 37 | |||
| 30 | size_t id; | 38 | size_t id; |
| 31 | Kernel::KProcess* process; | 39 | Kernel::KProcess* process; |
| 32 | size_t smmu_id; | 40 | size_t smmu_id; |
diff --git a/src/core/hle/service/nvdrv/core/heap_mapper.cpp b/src/core/hle/service/nvdrv/core/heap_mapper.cpp index 59d993bc6..c29191b92 100644 --- a/src/core/hle/service/nvdrv/core/heap_mapper.cpp +++ b/src/core/hle/service/nvdrv/core/heap_mapper.cpp | |||
| @@ -124,10 +124,11 @@ DAddr HeapMapper::Map(VAddr start, size_t size) { | |||
| 124 | m_internal->base_set.clear(); | 124 | m_internal->base_set.clear(); |
| 125 | const IntervalType interval{start, start + size}; | 125 | const IntervalType interval{start, start + size}; |
| 126 | m_internal->base_set.insert(interval); | 126 | m_internal->base_set.insert(interval); |
| 127 | m_internal->ForEachInOverlapCounter(m_internal->mapping_overlaps, start, size, [this](VAddr start_addr, VAddr end_addr, int){ | 127 | m_internal->ForEachInOverlapCounter(m_internal->mapping_overlaps, start, size, |
| 128 | const IntervalType other{start_addr, end_addr}; | 128 | [this](VAddr start_addr, VAddr end_addr, int) { |
| 129 | m_internal->base_set.subtract(other); | 129 | const IntervalType other{start_addr, end_addr}; |
| 130 | }); | 130 | m_internal->base_set.subtract(other); |
| 131 | }); | ||
| 131 | if (!m_internal->base_set.empty()) { | 132 | if (!m_internal->base_set.empty()) { |
| 132 | auto it = m_internal->base_set.begin(); | 133 | auto it = m_internal->base_set.begin(); |
| 133 | auto end_it = m_internal->base_set.end(); | 134 | auto end_it = m_internal->base_set.end(); |
| @@ -136,7 +137,8 @@ DAddr HeapMapper::Map(VAddr start, size_t size) { | |||
| 136 | const VAddr inter_addr = it->lower(); | 137 | const VAddr inter_addr = it->lower(); |
| 137 | const size_t offset = inter_addr - m_vaddress; | 138 | const size_t offset = inter_addr - m_vaddress; |
| 138 | const size_t sub_size = inter_addr_end - inter_addr; | 139 | const size_t sub_size = inter_addr_end - inter_addr; |
| 139 | m_internal->device_memory.Map(m_daddress + offset, m_vaddress + offset, sub_size, m_smmu_id); | 140 | m_internal->device_memory.Map(m_daddress + offset, m_vaddress + offset, sub_size, |
| 141 | m_smmu_id); | ||
| 140 | } | 142 | } |
| 141 | } | 143 | } |
| 142 | m_internal->mapping_overlaps += std::make_pair(interval, 1); | 144 | m_internal->mapping_overlaps += std::make_pair(interval, 1); |
| @@ -147,12 +149,13 @@ DAddr HeapMapper::Map(VAddr start, size_t size) { | |||
| 147 | void HeapMapper::Unmap(VAddr start, size_t size) { | 149 | void HeapMapper::Unmap(VAddr start, size_t size) { |
| 148 | std::scoped_lock lk(m_internal->guard); | 150 | std::scoped_lock lk(m_internal->guard); |
| 149 | m_internal->base_set.clear(); | 151 | m_internal->base_set.clear(); |
| 150 | m_internal->ForEachInOverlapCounter(m_internal->mapping_overlaps, start, size, [this](VAddr start_addr, VAddr end_addr, int value) { | 152 | m_internal->ForEachInOverlapCounter(m_internal->mapping_overlaps, start, size, |
| 151 | if (value <= 1) { | 153 | [this](VAddr start_addr, VAddr end_addr, int value) { |
| 152 | const IntervalType other{start_addr, end_addr}; | 154 | if (value <= 1) { |
| 153 | m_internal->base_set.insert(other); | 155 | const IntervalType other{start_addr, end_addr}; |
| 154 | } | 156 | m_internal->base_set.insert(other); |
| 155 | }); | 157 | } |
| 158 | }); | ||
| 156 | if (!m_internal->base_set.empty()) { | 159 | if (!m_internal->base_set.empty()) { |
| 157 | auto it = m_internal->base_set.begin(); | 160 | auto it = m_internal->base_set.begin(); |
| 158 | auto end_it = m_internal->base_set.end(); | 161 | auto end_it = m_internal->base_set.end(); |
diff --git a/src/core/hle/service/nvdrv/core/nvmap.cpp b/src/core/hle/service/nvdrv/core/nvmap.cpp index 296b4d8d2..6e59d4fe1 100644 --- a/src/core/hle/service/nvdrv/core/nvmap.cpp +++ b/src/core/hle/service/nvdrv/core/nvmap.cpp | |||
| @@ -13,8 +13,8 @@ | |||
| 13 | #include "core/memory.h" | 13 | #include "core/memory.h" |
| 14 | #include "video_core/host1x/host1x.h" | 14 | #include "video_core/host1x/host1x.h" |
| 15 | 15 | ||
| 16 | |||
| 17 | using Core::Memory::YUZU_PAGESIZE; | 16 | using Core::Memory::YUZU_PAGESIZE; |
| 17 | constexpr size_t BIG_PAGE_SIZE = YUZU_PAGESIZE * 16; | ||
| 18 | 18 | ||
| 19 | namespace Service::Nvidia::NvCore { | 19 | namespace Service::Nvidia::NvCore { |
| 20 | NvMap::Handle::Handle(u64 size_, Id id_) | 20 | NvMap::Handle::Handle(u64 size_, Id id_) |
| @@ -96,8 +96,9 @@ void NvMap::UnmapHandle(Handle& handle_description) { | |||
| 96 | const size_t map_size = handle_description.aligned_size; | 96 | const size_t map_size = handle_description.aligned_size; |
| 97 | if (!handle_description.in_heap) { | 97 | if (!handle_description.in_heap) { |
| 98 | auto& smmu = host1x.MemoryManager(); | 98 | auto& smmu = host1x.MemoryManager(); |
| 99 | size_t aligned_up = Common::AlignUp(map_size, BIG_PAGE_SIZE); | ||
| 99 | smmu.Unmap(handle_description.d_address, map_size); | 100 | smmu.Unmap(handle_description.d_address, map_size); |
| 100 | smmu.Free(handle_description.d_address, static_cast<size_t>(map_size)); | 101 | smmu.Free(handle_description.d_address, static_cast<size_t>(aligned_up)); |
| 101 | handle_description.d_address = 0; | 102 | handle_description.d_address = 0; |
| 102 | return; | 103 | return; |
| 103 | } | 104 | } |
| @@ -206,7 +207,8 @@ DAddr NvMap::PinHandle(NvMap::Handle::Id handle, bool low_area_pin) { | |||
| 206 | handle_description->d_address = session->mapper->Map(vaddress, map_size); | 207 | handle_description->d_address = session->mapper->Map(vaddress, map_size); |
| 207 | handle_description->in_heap = true; | 208 | handle_description->in_heap = true; |
| 208 | } else { | 209 | } else { |
| 209 | while ((address = smmu.Allocate(map_size)) == 0) { | 210 | size_t aligned_up = Common::AlignUp(map_size, BIG_PAGE_SIZE); |
| 211 | while ((address = smmu.Allocate(aligned_up)) == 0) { | ||
| 210 | // Free handles until the allocation succeeds | 212 | // Free handles until the allocation succeeds |
| 211 | std::scoped_lock queueLock(unmap_queue_lock); | 213 | std::scoped_lock queueLock(unmap_queue_lock); |
| 212 | if (auto freeHandleDesc{unmap_queue.front()}) { | 214 | if (auto freeHandleDesc{unmap_queue.front()}) { |
diff --git a/src/core/hle/service/nvdrv/core/nvmap.h b/src/core/hle/service/nvdrv/core/nvmap.h index 119efc38d..aa5cd21ec 100644 --- a/src/core/hle/service/nvdrv/core/nvmap.h +++ b/src/core/hle/service/nvdrv/core/nvmap.h | |||
| @@ -63,8 +63,8 @@ public: | |||
| 63 | } flags{}; | 63 | } flags{}; |
| 64 | static_assert(sizeof(Flags) == sizeof(u32)); | 64 | static_assert(sizeof(Flags) == sizeof(u32)); |
| 65 | 65 | ||
| 66 | VAddr address{}; //!< The memory location in the guest's AS that this handle corresponds to, | 66 | VAddr address{}; //!< The memory location in the guest's AS that this handle corresponds to, |
| 67 | //!< this can also be in the nvdrv tmem | 67 | //!< this can also be in the nvdrv tmem |
| 68 | bool is_shared_mem_mapped{}; //!< If this nvmap has been mapped with the MapSharedMem IPC | 68 | bool is_shared_mem_mapped{}; //!< If this nvmap has been mapped with the MapSharedMem IPC |
| 69 | //!< call | 69 | //!< call |
| 70 | 70 | ||
| @@ -73,8 +73,8 @@ public: | |||
| 73 | bool in_heap{}; | 73 | bool in_heap{}; |
| 74 | size_t session_id{}; | 74 | size_t session_id{}; |
| 75 | 75 | ||
| 76 | DAddr d_address{}; //!< The memory location in the device's AS that this handle corresponds to, | 76 | DAddr d_address{}; //!< The memory location in the device's AS that this handle corresponds |
| 77 | //!< this can also be in the nvdrv tmem | 77 | //!< to, this can also be in the nvdrv tmem |
| 78 | 78 | ||
| 79 | Handle(u64 size, Id id); | 79 | Handle(u64 size, Id id); |
| 80 | 80 | ||
| @@ -82,7 +82,8 @@ public: | |||
| 82 | * @brief Sets up the handle with the given memory config, can allocate memory from the tmem | 82 | * @brief Sets up the handle with the given memory config, can allocate memory from the tmem |
| 83 | * if a 0 address is passed | 83 | * if a 0 address is passed |
| 84 | */ | 84 | */ |
| 85 | [[nodiscard]] NvResult Alloc(Flags pFlags, u32 pAlign, u8 pKind, u64 pAddress, size_t pSessionId); | 85 | [[nodiscard]] NvResult Alloc(Flags pFlags, u32 pAlign, u8 pKind, u64 pAddress, |
| 86 | size_t pSessionId); | ||
| 86 | 87 | ||
| 87 | /** | 88 | /** |
| 88 | * @brief Increases the dupe counter of the handle for the given session | 89 | * @brief Increases the dupe counter of the handle for the given session |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h index b44b17a82..718e0fecd 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.h | |||
| @@ -4,8 +4,8 @@ | |||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <deque> | 6 | #include <deque> |
| 7 | #include <vector> | ||
| 8 | #include <unordered_map> | 7 | #include <unordered_map> |
| 8 | #include <vector> | ||
| 9 | 9 | ||
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | #include "common/swap.h" | 11 | #include "common/swap.h" |
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp index d4c93ea5d..a27bed29b 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_vic.cpp | |||
| @@ -69,7 +69,7 @@ NvResult nvhost_vic::Ioctl3(DeviceFD fd, Ioctl command, std::span<const u8> inpu | |||
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | void nvhost_vic::OnOpen(size_t session_id, DeviceFD fd) { | 71 | void nvhost_vic::OnOpen(size_t session_id, DeviceFD fd) { |
| 72 | sessions[fd] = session_id; | 72 | sessions[fd] = session_id; |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | void nvhost_vic::OnClose(DeviceFD fd) { | 75 | void nvhost_vic::OnClose(DeviceFD fd) { |
diff --git a/src/core/hle/service/nvdrv/devices/nvmap.cpp b/src/core/hle/service/nvdrv/devices/nvmap.cpp index 24f49ddcd..08ee8ec24 100644 --- a/src/core/hle/service/nvdrv/devices/nvmap.cpp +++ b/src/core/hle/service/nvdrv/devices/nvmap.cpp | |||
| @@ -123,8 +123,8 @@ NvResult nvmap::IocAlloc(IocAllocParams& params, DeviceFD fd) { | |||
| 123 | return NvResult::InsufficientMemory; | 123 | return NvResult::InsufficientMemory; |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | const auto result = | 126 | const auto result = handle_description->Alloc(params.flags, params.align, params.kind, |
| 127 | handle_description->Alloc(params.flags, params.align, params.kind, params.address, sessions[fd]); | 127 | params.address, sessions[fd]); |
| 128 | if (result != NvResult::Success) { | 128 | if (result != NvResult::Success) { |
| 129 | LOG_CRITICAL(Service_NVDRV, "Object failed to allocate, handle={:08X}", params.handle); | 129 | LOG_CRITICAL(Service_NVDRV, "Object failed to allocate, handle={:08X}", params.handle); |
| 130 | return result; | 130 | return result; |
diff --git a/src/core/hle/service/nvnflinger/fb_share_buffer_manager.cpp b/src/core/hle/service/nvnflinger/fb_share_buffer_manager.cpp index d36eff4ec..86e272b41 100644 --- a/src/core/hle/service/nvnflinger/fb_share_buffer_manager.cpp +++ b/src/core/hle/service/nvnflinger/fb_share_buffer_manager.cpp | |||
| @@ -92,7 +92,8 @@ Result FreeNvMapHandle(Nvidia::Devices::nvmap& nvmap, u32 handle, Nvidia::Device | |||
| 92 | Nvidia::Devices::nvmap::IocFreeParams free_params{ | 92 | Nvidia::Devices::nvmap::IocFreeParams free_params{ |
| 93 | .handle = handle, | 93 | .handle = handle, |
| 94 | }; | 94 | }; |
| 95 | R_UNLESS(nvmap.IocFree(free_params, nvmap_fd) == Nvidia::NvResult::Success, VI::ResultOperationFailed); | 95 | R_UNLESS(nvmap.IocFree(free_params, nvmap_fd) == Nvidia::NvResult::Success, |
| 96 | VI::ResultOperationFailed); | ||
| 96 | 97 | ||
| 97 | // We succeeded. | 98 | // We succeeded. |
| 98 | R_SUCCEED(); | 99 | R_SUCCEED(); |
| @@ -109,7 +110,8 @@ Result AllocNvMapHandle(Nvidia::Devices::nvmap& nvmap, u32 handle, Common::Proce | |||
| 109 | .kind = 0, | 110 | .kind = 0, |
| 110 | .address = GetInteger(buffer), | 111 | .address = GetInteger(buffer), |
| 111 | }; | 112 | }; |
| 112 | R_UNLESS(nvmap.IocAlloc(alloc_params, nvmap_fd) == Nvidia::NvResult::Success, VI::ResultOperationFailed); | 113 | R_UNLESS(nvmap.IocAlloc(alloc_params, nvmap_fd) == Nvidia::NvResult::Success, |
| 114 | VI::ResultOperationFailed); | ||
| 113 | 115 | ||
| 114 | // We succeeded. | 116 | // We succeeded. |
| 115 | R_SUCCEED(); | 117 | R_SUCCEED(); |
| @@ -201,8 +203,8 @@ Result FbShareBufferManager::Initialize(u64* out_buffer_id, u64* out_layer_id, u | |||
| 201 | m_nvmap_fd = m_nvdrv->Open("/dev/nvmap", m_session_id); | 203 | m_nvmap_fd = m_nvdrv->Open("/dev/nvmap", m_session_id); |
| 202 | 204 | ||
| 203 | // Create an nvmap handle for the buffer and assign the memory to it. | 205 | // Create an nvmap handle for the buffer and assign the memory to it. |
| 204 | R_TRY(AllocateHandleForBuffer(std::addressof(m_buffer_nvmap_handle), *m_nvdrv, m_nvmap_fd, map_address, | 206 | R_TRY(AllocateHandleForBuffer(std::addressof(m_buffer_nvmap_handle), *m_nvdrv, m_nvmap_fd, |
| 205 | SharedBufferSize)); | 207 | map_address, SharedBufferSize)); |
| 206 | 208 | ||
| 207 | // Record the display id. | 209 | // Record the display id. |
| 208 | m_display_id = display_id; | 210 | m_display_id = display_id; |
diff --git a/src/core/hle/service/nvnflinger/fb_share_buffer_manager.h b/src/core/hle/service/nvnflinger/fb_share_buffer_manager.h index 4b1a3d430..d2ec7a9b9 100644 --- a/src/core/hle/service/nvnflinger/fb_share_buffer_manager.h +++ b/src/core/hle/service/nvnflinger/fb_share_buffer_manager.h | |||
| @@ -4,9 +4,9 @@ | |||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include "common/math_util.h" | 6 | #include "common/math_util.h" |
| 7 | #include "core/hle/service/nvdrv/nvdata.h" | ||
| 7 | #include "core/hle/service/nvnflinger/nvnflinger.h" | 8 | #include "core/hle/service/nvnflinger/nvnflinger.h" |
| 8 | #include "core/hle/service/nvnflinger/ui/fence.h" | 9 | #include "core/hle/service/nvnflinger/ui/fence.h" |
| 9 | #include "core/hle/service/nvdrv/nvdata.h" | ||
| 10 | 10 | ||
| 11 | namespace Kernel { | 11 | namespace Kernel { |
| 12 | class KPageGroup; | 12 | class KPageGroup; |
| @@ -62,7 +62,6 @@ private: | |||
| 62 | Core::System& m_system; | 62 | Core::System& m_system; |
| 63 | Nvnflinger& m_flinger; | 63 | Nvnflinger& m_flinger; |
| 64 | std::shared_ptr<Nvidia::Module> m_nvdrv; | 64 | std::shared_ptr<Nvidia::Module> m_nvdrv; |
| 65 | |||
| 66 | }; | 65 | }; |
| 67 | 66 | ||
| 68 | } // namespace Service::Nvnflinger | 67 | } // namespace Service::Nvnflinger |
diff --git a/src/core/memory.h b/src/core/memory.h index 9d29cfd3f..552fd585f 100644 --- a/src/core/memory.h +++ b/src/core/memory.h | |||
| @@ -488,7 +488,7 @@ public: | |||
| 488 | void SetGPUDirtyManagers(std::span<Core::GPUDirtyMemoryManager> managers); | 488 | void SetGPUDirtyManagers(std::span<Core::GPUDirtyMemoryManager> managers); |
| 489 | 489 | ||
| 490 | bool InvalidateNCE(Common::ProcessAddress vaddr, size_t size); | 490 | bool InvalidateNCE(Common::ProcessAddress vaddr, size_t size); |
| 491 | 491 | ||
| 492 | bool InvalidateSeparateHeap(void* fault_address); | 492 | bool InvalidateSeparateHeap(void* fault_address); |
| 493 | 493 | ||
| 494 | private: | 494 | private: |
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index 6fe2e8b93..5325a715a 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h | |||
| @@ -240,8 +240,8 @@ bool BufferCache<P>::DMACopy(GPUVAddr src_address, GPUVAddr dest_address, u64 am | |||
| 240 | memory_tracker.MarkRegionAsGpuModified(*cpu_dest_address, amount); | 240 | memory_tracker.MarkRegionAsGpuModified(*cpu_dest_address, amount); |
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | Tegra::Memory::DeviceGuestMemoryScoped<u8, Tegra::Memory::GuestMemoryFlags::UnsafeReadWrite> tmp( | 243 | Tegra::Memory::DeviceGuestMemoryScoped<u8, Tegra::Memory::GuestMemoryFlags::UnsafeReadWrite> |
| 244 | device_memory, *cpu_src_address, amount, &tmp_buffer); | 244 | tmp(device_memory, *cpu_src_address, amount, &tmp_buffer); |
| 245 | tmp.SetAddressAndSize(*cpu_dest_address, amount); | 245 | tmp.SetAddressAndSize(*cpu_dest_address, amount); |
| 246 | return true; | 246 | return true; |
| 247 | } | 247 | } |
| @@ -1355,7 +1355,7 @@ typename BufferCache<P>::OverlapResult BufferCache<P>::ResolveOverlaps(DAddr dev | |||
| 1355 | bool has_stream_leap = false; | 1355 | bool has_stream_leap = false; |
| 1356 | auto expand_begin = [&](DAddr add_value) { | 1356 | auto expand_begin = [&](DAddr add_value) { |
| 1357 | static constexpr DAddr min_page = CACHING_PAGESIZE + Core::Memory::YUZU_PAGESIZE; | 1357 | static constexpr DAddr min_page = CACHING_PAGESIZE + Core::Memory::YUZU_PAGESIZE; |
| 1358 | if (add_value > begin - min_page ) { | 1358 | if (add_value > begin - min_page) { |
| 1359 | begin = min_page; | 1359 | begin = min_page; |
| 1360 | device_addr = Core::Memory::YUZU_PAGESIZE; | 1360 | device_addr = Core::Memory::YUZU_PAGESIZE; |
| 1361 | return; | 1361 | return; |
| @@ -1365,7 +1365,7 @@ typename BufferCache<P>::OverlapResult BufferCache<P>::ResolveOverlaps(DAddr dev | |||
| 1365 | }; | 1365 | }; |
| 1366 | auto expand_end = [&](DAddr add_value) { | 1366 | auto expand_end = [&](DAddr add_value) { |
| 1367 | static constexpr DAddr max_page = 1ULL << Tegra::MaxwellDeviceMemoryManager::AS_BITS; | 1367 | static constexpr DAddr max_page = 1ULL << Tegra::MaxwellDeviceMemoryManager::AS_BITS; |
| 1368 | if (add_value > max_page - end ) { | 1368 | if (add_value > max_page - end) { |
| 1369 | end = max_page; | 1369 | end = max_page; |
| 1370 | return; | 1370 | return; |
| 1371 | } | 1371 | } |
diff --git a/src/video_core/buffer_cache/word_manager.h b/src/video_core/buffer_cache/word_manager.h index 56ab4f5f1..1ca333b32 100644 --- a/src/video_core/buffer_cache/word_manager.h +++ b/src/video_core/buffer_cache/word_manager.h | |||
| @@ -472,8 +472,8 @@ private: | |||
| 472 | u64 changed_bits = (add_to_tracker ? current_bits : ~current_bits) & new_bits; | 472 | u64 changed_bits = (add_to_tracker ? current_bits : ~current_bits) & new_bits; |
| 473 | VAddr addr = cpu_addr + word_index * BYTES_PER_WORD; | 473 | VAddr addr = cpu_addr + word_index * BYTES_PER_WORD; |
| 474 | IteratePages(changed_bits, [&](size_t offset, size_t size) { | 474 | IteratePages(changed_bits, [&](size_t offset, size_t size) { |
| 475 | tracker->UpdatePagesCachedCount(addr + offset * BYTES_PER_PAGE, | 475 | tracker->UpdatePagesCachedCount(addr + offset * BYTES_PER_PAGE, size * BYTES_PER_PAGE, |
| 476 | size * BYTES_PER_PAGE, add_to_tracker ? 1 : -1); | 476 | add_to_tracker ? 1 : -1); |
| 477 | }); | 477 | }); |
| 478 | } | 478 | } |
| 479 | 479 | ||
diff --git a/src/video_core/dma_pusher.cpp b/src/video_core/dma_pusher.cpp index d461c5be8..fb2060ca4 100644 --- a/src/video_core/dma_pusher.cpp +++ b/src/video_core/dma_pusher.cpp | |||
| @@ -86,14 +86,14 @@ bool DmaPusher::Step() { | |||
| 86 | } | 86 | } |
| 87 | const auto safe_process = [&] { | 87 | const auto safe_process = [&] { |
| 88 | Tegra::Memory::GpuGuestMemory<Tegra::CommandHeader, | 88 | Tegra::Memory::GpuGuestMemory<Tegra::CommandHeader, |
| 89 | Tegra::Memory::GuestMemoryFlags::SafeRead> | 89 | Tegra::Memory::GuestMemoryFlags::SafeRead> |
| 90 | headers(memory_manager, dma_state.dma_get, command_list_header.size, | 90 | headers(memory_manager, dma_state.dma_get, command_list_header.size, |
| 91 | &command_headers); | 91 | &command_headers); |
| 92 | ProcessCommands(headers); | 92 | ProcessCommands(headers); |
| 93 | }; | 93 | }; |
| 94 | const auto unsafe_process = [&] { | 94 | const auto unsafe_process = [&] { |
| 95 | Tegra::Memory::GpuGuestMemory<Tegra::CommandHeader, | 95 | Tegra::Memory::GpuGuestMemory<Tegra::CommandHeader, |
| 96 | Tegra::Memory::GuestMemoryFlags::UnsafeRead> | 96 | Tegra::Memory::GuestMemoryFlags::UnsafeRead> |
| 97 | headers(memory_manager, dma_state.dma_get, command_list_header.size, | 97 | headers(memory_manager, dma_state.dma_get, command_list_header.size, |
| 98 | &command_headers); | 98 | &command_headers); |
| 99 | ProcessCommands(headers); | 99 | ProcessCommands(headers); |
diff --git a/src/video_core/engines/sw_blitter/blitter.cpp b/src/video_core/engines/sw_blitter/blitter.cpp index b67589daf..4bc079024 100644 --- a/src/video_core/engines/sw_blitter/blitter.cpp +++ b/src/video_core/engines/sw_blitter/blitter.cpp | |||
| @@ -8,10 +8,10 @@ | |||
| 8 | #include "common/scratch_buffer.h" | 8 | #include "common/scratch_buffer.h" |
| 9 | #include "video_core/engines/sw_blitter/blitter.h" | 9 | #include "video_core/engines/sw_blitter/blitter.h" |
| 10 | #include "video_core/engines/sw_blitter/converter.h" | 10 | #include "video_core/engines/sw_blitter/converter.h" |
| 11 | #include "video_core/guest_memory.h" | ||
| 11 | #include "video_core/memory_manager.h" | 12 | #include "video_core/memory_manager.h" |
| 12 | #include "video_core/surface.h" | 13 | #include "video_core/surface.h" |
| 13 | #include "video_core/textures/decoders.h" | 14 | #include "video_core/textures/decoders.h" |
| 14 | #include "video_core/guest_memory.h" | ||
| 15 | 15 | ||
| 16 | namespace Tegra { | 16 | namespace Tegra { |
| 17 | class MemoryManager; | 17 | class MemoryManager; |
diff --git a/src/video_core/guest_memory.h b/src/video_core/guest_memory.h index a2132f7ea..8b6213172 100644 --- a/src/video_core/guest_memory.h +++ b/src/video_core/guest_memory.h | |||
| @@ -20,7 +20,8 @@ using GuestMemoryFlags = Core::Memory::GuestMemoryFlags; | |||
| 20 | template <typename T, GuestMemoryFlags FLAGS> | 20 | template <typename T, GuestMemoryFlags FLAGS> |
| 21 | using DeviceGuestMemory = Core::Memory::GuestMemory<Tegra::MaxwellDeviceMemoryManager, T, FLAGS>; | 21 | using DeviceGuestMemory = Core::Memory::GuestMemory<Tegra::MaxwellDeviceMemoryManager, T, FLAGS>; |
| 22 | template <typename T, GuestMemoryFlags FLAGS> | 22 | template <typename T, GuestMemoryFlags FLAGS> |
| 23 | using DeviceGuestMemoryScoped = Core::Memory::GuestMemoryScoped<Tegra::MaxwellDeviceMemoryManager, T, FLAGS>; | 23 | using DeviceGuestMemoryScoped = |
| 24 | Core::Memory::GuestMemoryScoped<Tegra::MaxwellDeviceMemoryManager, T, FLAGS>; | ||
| 24 | template <typename T, GuestMemoryFlags FLAGS> | 25 | template <typename T, GuestMemoryFlags FLAGS> |
| 25 | using GpuGuestMemory = Core::Memory::GuestMemory<Tegra::MemoryManager, T, FLAGS>; | 26 | using GpuGuestMemory = Core::Memory::GuestMemory<Tegra::MemoryManager, T, FLAGS>; |
| 26 | template <typename T, GuestMemoryFlags FLAGS> | 27 | template <typename T, GuestMemoryFlags FLAGS> |
diff --git a/src/video_core/host1x/codecs/vp9.cpp b/src/video_core/host1x/codecs/vp9.cpp index e2ae1f76d..65d6fb2d5 100644 --- a/src/video_core/host1x/codecs/vp9.cpp +++ b/src/video_core/host1x/codecs/vp9.cpp | |||
| @@ -383,9 +383,8 @@ Vp9FrameContainer VP9::GetCurrentFrame(const Host1x::NvdecCommon::NvdecRegisters | |||
| 383 | // gpu.SyncGuestHost(); epic, why? | 383 | // gpu.SyncGuestHost(); epic, why? |
| 384 | current_frame.info = GetVp9PictureInfo(state); | 384 | current_frame.info = GetVp9PictureInfo(state); |
| 385 | current_frame.bit_stream.resize(current_frame.info.bitstream_size); | 385 | current_frame.bit_stream.resize(current_frame.info.bitstream_size); |
| 386 | host1x.GMMU().ReadBlock(state.frame_bitstream_offset, | 386 | host1x.GMMU().ReadBlock(state.frame_bitstream_offset, current_frame.bit_stream.data(), |
| 387 | current_frame.bit_stream.data(), | 387 | current_frame.info.bitstream_size); |
| 388 | current_frame.info.bitstream_size); | ||
| 389 | } | 388 | } |
| 390 | if (!next_frame.bit_stream.empty()) { | 389 | if (!next_frame.bit_stream.empty()) { |
| 391 | Vp9FrameContainer temp{ | 390 | Vp9FrameContainer temp{ |
diff --git a/src/video_core/host1x/vic.cpp b/src/video_core/host1x/vic.cpp index 1826211a1..d154746af 100644 --- a/src/video_core/host1x/vic.cpp +++ b/src/video_core/host1x/vic.cpp | |||
| @@ -167,7 +167,7 @@ void Vic::WriteRGBFrame(std::unique_ptr<FFmpeg::Frame> frame, const VicConfig& c | |||
| 167 | // send pitch linear frame | 167 | // send pitch linear frame |
| 168 | const size_t linear_size = width * height * 4; | 168 | const size_t linear_size = width * height * 4; |
| 169 | host1x.GMMU().WriteBlock(output_surface_luma_address, converted_frame_buf_addr, | 169 | host1x.GMMU().WriteBlock(output_surface_luma_address, converted_frame_buf_addr, |
| 170 | linear_size); | 170 | linear_size); |
| 171 | } | 171 | } |
| 172 | } | 172 | } |
| 173 | 173 | ||
| @@ -193,8 +193,7 @@ void Vic::WriteYUVFrame(std::unique_ptr<FFmpeg::Frame> frame, const VicConfig& c | |||
| 193 | const std::size_t dst = y * aligned_width; | 193 | const std::size_t dst = y * aligned_width; |
| 194 | std::memcpy(luma_buffer.data() + dst, luma_src + src, frame_width); | 194 | std::memcpy(luma_buffer.data() + dst, luma_src + src, frame_width); |
| 195 | } | 195 | } |
| 196 | host1x.GMMU().WriteBlock(output_surface_luma_address, luma_buffer.data(), | 196 | host1x.GMMU().WriteBlock(output_surface_luma_address, luma_buffer.data(), luma_buffer.size()); |
| 197 | luma_buffer.size()); | ||
| 198 | 197 | ||
| 199 | // Chroma | 198 | // Chroma |
| 200 | const std::size_t half_height = frame_height / 2; | 199 | const std::size_t half_height = frame_height / 2; |
| @@ -234,7 +233,7 @@ void Vic::WriteYUVFrame(std::unique_ptr<FFmpeg::Frame> frame, const VicConfig& c | |||
| 234 | break; | 233 | break; |
| 235 | } | 234 | } |
| 236 | host1x.GMMU().WriteBlock(output_surface_chroma_address, chroma_buffer.data(), | 235 | host1x.GMMU().WriteBlock(output_surface_chroma_address, chroma_buffer.data(), |
| 237 | chroma_buffer.size()); | 236 | chroma_buffer.size()); |
| 238 | } | 237 | } |
| 239 | 238 | ||
| 240 | } // namespace Host1x | 239 | } // namespace Host1x |
diff --git a/src/video_core/memory_manager.h b/src/video_core/memory_manager.h index 00d64dcce..eb00918fc 100644 --- a/src/video_core/memory_manager.h +++ b/src/video_core/memory_manager.h | |||
| @@ -38,8 +38,9 @@ class MemoryManager final { | |||
| 38 | public: | 38 | public: |
| 39 | explicit MemoryManager(Core::System& system_, u64 address_space_bits_ = 40, | 39 | explicit MemoryManager(Core::System& system_, u64 address_space_bits_ = 40, |
| 40 | u64 big_page_bits_ = 16, u64 page_bits_ = 12); | 40 | u64 big_page_bits_ = 16, u64 page_bits_ = 12); |
| 41 | explicit MemoryManager(Core::System& system_, MaxwellDeviceMemoryManager& memory_, u64 address_space_bits_ = 40, | 41 | explicit MemoryManager(Core::System& system_, MaxwellDeviceMemoryManager& memory_, |
| 42 | u64 big_page_bits_ = 16, u64 page_bits_ = 12); | 42 | u64 address_space_bits_ = 40, u64 big_page_bits_ = 16, |
| 43 | u64 page_bits_ = 12); | ||
| 43 | ~MemoryManager(); | 44 | ~MemoryManager(); |
| 44 | 45 | ||
| 45 | size_t GetID() const { | 46 | size_t GetID() const { |
diff --git a/src/video_core/query_cache/query_cache_base.h b/src/video_core/query_cache/query_cache_base.h index 7720456ff..3c820b5f2 100644 --- a/src/video_core/query_cache/query_cache_base.h +++ b/src/video_core/query_cache/query_cache_base.h | |||
| @@ -15,9 +15,9 @@ | |||
| 15 | #include "common/common_types.h" | 15 | #include "common/common_types.h" |
| 16 | #include "core/memory.h" | 16 | #include "core/memory.h" |
| 17 | #include "video_core/control/channel_state_cache.h" | 17 | #include "video_core/control/channel_state_cache.h" |
| 18 | #include "video_core/host1x/gpu_device_memory_manager.h" | ||
| 18 | #include "video_core/query_cache/query_base.h" | 19 | #include "video_core/query_cache/query_base.h" |
| 19 | #include "video_core/query_cache/types.h" | 20 | #include "video_core/query_cache/types.h" |
| 20 | #include "video_core/host1x/gpu_device_memory_manager.h" | ||
| 21 | 21 | ||
| 22 | namespace VideoCore { | 22 | namespace VideoCore { |
| 23 | class RasterizerInterface; | 23 | class RasterizerInterface; |
| @@ -50,7 +50,8 @@ public: | |||
| 50 | }; | 50 | }; |
| 51 | 51 | ||
| 52 | explicit QueryCacheBase(Tegra::GPU& gpu, VideoCore::RasterizerInterface& rasterizer_, | 52 | explicit QueryCacheBase(Tegra::GPU& gpu, VideoCore::RasterizerInterface& rasterizer_, |
| 53 | Tegra::MaxwellDeviceMemoryManager& device_memory_, RuntimeType& runtime_); | 53 | Tegra::MaxwellDeviceMemoryManager& device_memory_, |
| 54 | RuntimeType& runtime_); | ||
| 54 | 55 | ||
| 55 | ~QueryCacheBase(); | 56 | ~QueryCacheBase(); |
| 56 | 57 | ||
diff --git a/src/video_core/renderer_opengl/gl_buffer_cache.h b/src/video_core/renderer_opengl/gl_buffer_cache.h index e6ad030cb..af34c272b 100644 --- a/src/video_core/renderer_opengl/gl_buffer_cache.h +++ b/src/video_core/renderer_opengl/gl_buffer_cache.h | |||
| @@ -20,8 +20,7 @@ class BufferCacheRuntime; | |||
| 20 | 20 | ||
| 21 | class Buffer : public VideoCommon::BufferBase { | 21 | class Buffer : public VideoCommon::BufferBase { |
| 22 | public: | 22 | public: |
| 23 | explicit Buffer(BufferCacheRuntime&, DAddr cpu_addr, | 23 | explicit Buffer(BufferCacheRuntime&, DAddr cpu_addr, u64 size_bytes); |
| 24 | u64 size_bytes); | ||
| 25 | explicit Buffer(BufferCacheRuntime&, VideoCommon::NullBufferParams); | 24 | explicit Buffer(BufferCacheRuntime&, VideoCommon::NullBufferParams); |
| 26 | 25 | ||
| 27 | void ImmediateUpload(size_t offset, std::span<const u8> data) noexcept; | 26 | void ImmediateUpload(size_t offset, std::span<const u8> data) noexcept; |
diff --git a/src/video_core/renderer_opengl/gl_query_cache.cpp b/src/video_core/renderer_opengl/gl_query_cache.cpp index 567292e1c..2147d587f 100644 --- a/src/video_core/renderer_opengl/gl_query_cache.cpp +++ b/src/video_core/renderer_opengl/gl_query_cache.cpp | |||
| @@ -35,7 +35,8 @@ constexpr GLenum GetTarget(VideoCore::QueryType type) { | |||
| 35 | 35 | ||
| 36 | } // Anonymous namespace | 36 | } // Anonymous namespace |
| 37 | 37 | ||
| 38 | QueryCache::QueryCache(RasterizerOpenGL& rasterizer_, Tegra::MaxwellDeviceMemoryManager& device_memory_) | 38 | QueryCache::QueryCache(RasterizerOpenGL& rasterizer_, |
| 39 | Tegra::MaxwellDeviceMemoryManager& device_memory_) | ||
| 39 | : QueryCacheLegacy(rasterizer_, device_memory_), gl_rasterizer{rasterizer_} { | 40 | : QueryCacheLegacy(rasterizer_, device_memory_), gl_rasterizer{rasterizer_} { |
| 40 | EnableCounters(); | 41 | EnableCounters(); |
| 41 | } | 42 | } |
diff --git a/src/video_core/renderer_opengl/gl_query_cache.h b/src/video_core/renderer_opengl/gl_query_cache.h index 04a1b39c9..38118f355 100644 --- a/src/video_core/renderer_opengl/gl_query_cache.h +++ b/src/video_core/renderer_opengl/gl_query_cache.h | |||
| @@ -8,10 +8,10 @@ | |||
| 8 | #include <vector> | 8 | #include <vector> |
| 9 | 9 | ||
| 10 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | #include "video_core/host1x/gpu_device_memory_manager.h" | ||
| 11 | #include "video_core/query_cache.h" | 12 | #include "video_core/query_cache.h" |
| 12 | #include "video_core/rasterizer_interface.h" | 13 | #include "video_core/rasterizer_interface.h" |
| 13 | #include "video_core/renderer_opengl/gl_resource_manager.h" | 14 | #include "video_core/renderer_opengl/gl_resource_manager.h" |
| 14 | #include "video_core/host1x/gpu_device_memory_manager.h" | ||
| 15 | 15 | ||
| 16 | namespace Core { | 16 | namespace Core { |
| 17 | class System; | 17 | class System; |
| @@ -29,7 +29,8 @@ using CounterStream = VideoCommon::CounterStreamBase<QueryCache, HostCounter>; | |||
| 29 | class QueryCache final | 29 | class QueryCache final |
| 30 | : public VideoCommon::QueryCacheLegacy<QueryCache, CachedQuery, CounterStream, HostCounter> { | 30 | : public VideoCommon::QueryCacheLegacy<QueryCache, CachedQuery, CounterStream, HostCounter> { |
| 31 | public: | 31 | public: |
| 32 | explicit QueryCache(RasterizerOpenGL& rasterizer_, Tegra::MaxwellDeviceMemoryManager& device_memory_); | 32 | explicit QueryCache(RasterizerOpenGL& rasterizer_, |
| 33 | Tegra::MaxwellDeviceMemoryManager& device_memory_); | ||
| 33 | ~QueryCache(); | 34 | ~QueryCache(); |
| 34 | 35 | ||
| 35 | OGLQuery AllocateQuery(VideoCore::QueryType type); | 36 | OGLQuery AllocateQuery(VideoCore::QueryType type); |
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index f197774ed..34aa73526 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h | |||
| @@ -75,9 +75,9 @@ class RasterizerOpenGL : public VideoCore::RasterizerInterface, | |||
| 75 | protected VideoCommon::ChannelSetupCaches<VideoCommon::ChannelInfo> { | 75 | protected VideoCommon::ChannelSetupCaches<VideoCommon::ChannelInfo> { |
| 76 | public: | 76 | public: |
| 77 | explicit RasterizerOpenGL(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_, | 77 | explicit RasterizerOpenGL(Core::Frontend::EmuWindow& emu_window_, Tegra::GPU& gpu_, |
| 78 | Tegra::MaxwellDeviceMemoryManager& device_memory_, const Device& device_, | 78 | Tegra::MaxwellDeviceMemoryManager& device_memory_, |
| 79 | ScreenInfo& screen_info_, ProgramManager& program_manager_, | 79 | const Device& device_, ScreenInfo& screen_info_, |
| 80 | StateTracker& state_tracker_); | 80 | ProgramManager& program_manager_, StateTracker& state_tracker_); |
| 81 | ~RasterizerOpenGL() override; | 81 | ~RasterizerOpenGL() override; |
| 82 | 82 | ||
| 83 | void Draw(bool is_indexed, u32 instance_count) override; | 83 | void Draw(bool is_indexed, u32 instance_count) override; |
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp index 0e1815076..1631276c6 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp +++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp | |||
| @@ -97,8 +97,8 @@ RendererVulkan::RendererVulkan(Core::TelemetrySession& telemetry_session_, | |||
| 97 | render_window.GetFramebufferLayout().height), | 97 | render_window.GetFramebufferLayout().height), |
| 98 | present_manager(instance, render_window, device, memory_allocator, scheduler, swapchain, | 98 | present_manager(instance, render_window, device, memory_allocator, scheduler, swapchain, |
| 99 | surface), | 99 | surface), |
| 100 | blit_screen(device_memory, render_window, device, memory_allocator, swapchain, present_manager, | 100 | blit_screen(device_memory, render_window, device, memory_allocator, swapchain, |
| 101 | scheduler, screen_info), | 101 | present_manager, scheduler, screen_info), |
| 102 | rasterizer(render_window, gpu, device_memory, screen_info, device, memory_allocator, | 102 | rasterizer(render_window, gpu, device_memory, screen_info, device, memory_allocator, |
| 103 | state_tracker, scheduler) { | 103 | state_tracker, scheduler) { |
| 104 | if (Settings::values.renderer_force_max_clock.GetValue() && device.ShouldBoostClocks()) { | 104 | if (Settings::values.renderer_force_max_clock.GetValue() && device.ShouldBoostClocks()) { |
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.h b/src/video_core/renderer_vulkan/renderer_vulkan.h index e5ce4692d..11c52287a 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.h +++ b/src/video_core/renderer_vulkan/renderer_vulkan.h | |||
| @@ -7,12 +7,12 @@ | |||
| 7 | #include <string> | 7 | #include <string> |
| 8 | #include <variant> | 8 | #include <variant> |
| 9 | 9 | ||
| 10 | #include "video_core/renderer_vulkan/vk_rasterizer.h" | ||
| 11 | |||
| 12 | #include "common/dynamic_library.h" | 10 | #include "common/dynamic_library.h" |
| 11 | #include "video_core/host1x/gpu_device_memory_manager.h" | ||
| 13 | #include "video_core/renderer_base.h" | 12 | #include "video_core/renderer_base.h" |
| 14 | #include "video_core/renderer_vulkan/vk_blit_screen.h" | 13 | #include "video_core/renderer_vulkan/vk_blit_screen.h" |
| 15 | #include "video_core/renderer_vulkan/vk_present_manager.h" | 14 | #include "video_core/renderer_vulkan/vk_present_manager.h" |
| 15 | #include "video_core/renderer_vulkan/vk_rasterizer.h" | ||
| 16 | #include "video_core/renderer_vulkan/vk_scheduler.h" | 16 | #include "video_core/renderer_vulkan/vk_scheduler.h" |
| 17 | #include "video_core/renderer_vulkan/vk_state_tracker.h" | 17 | #include "video_core/renderer_vulkan/vk_state_tracker.h" |
| 18 | #include "video_core/renderer_vulkan/vk_swapchain.h" | 18 | #include "video_core/renderer_vulkan/vk_swapchain.h" |
| @@ -20,7 +20,6 @@ | |||
| 20 | #include "video_core/vulkan_common/vulkan_device.h" | 20 | #include "video_core/vulkan_common/vulkan_device.h" |
| 21 | #include "video_core/vulkan_common/vulkan_memory_allocator.h" | 21 | #include "video_core/vulkan_common/vulkan_memory_allocator.h" |
| 22 | #include "video_core/vulkan_common/vulkan_wrapper.h" | 22 | #include "video_core/vulkan_common/vulkan_wrapper.h" |
| 23 | #include "video_core/host1x/gpu_device_memory_manager.h" | ||
| 24 | 23 | ||
| 25 | namespace Core { | 24 | namespace Core { |
| 26 | class TelemetrySession; | 25 | class TelemetrySession; |
diff --git a/src/video_core/renderer_vulkan/vk_blit_screen.h b/src/video_core/renderer_vulkan/vk_blit_screen.h index cb941a956..3eff76009 100644 --- a/src/video_core/renderer_vulkan/vk_blit_screen.h +++ b/src/video_core/renderer_vulkan/vk_blit_screen.h | |||
| @@ -6,9 +6,9 @@ | |||
| 6 | #include <memory> | 6 | #include <memory> |
| 7 | 7 | ||
| 8 | #include "core/frontend/framebuffer_layout.h" | 8 | #include "core/frontend/framebuffer_layout.h" |
| 9 | #include "video_core/host1x/gpu_device_memory_manager.h" | ||
| 9 | #include "video_core/vulkan_common/vulkan_memory_allocator.h" | 10 | #include "video_core/vulkan_common/vulkan_memory_allocator.h" |
| 10 | #include "video_core/vulkan_common/vulkan_wrapper.h" | 11 | #include "video_core/vulkan_common/vulkan_wrapper.h" |
| 11 | #include "video_core/host1x/gpu_device_memory_manager.h" | ||
| 12 | 12 | ||
| 13 | namespace Core { | 13 | namespace Core { |
| 14 | class System; | 14 | class System; |
| @@ -53,8 +53,9 @@ struct ScreenInfo { | |||
| 53 | 53 | ||
| 54 | class BlitScreen { | 54 | class BlitScreen { |
| 55 | public: | 55 | public: |
| 56 | explicit BlitScreen(Tegra::MaxwellDeviceMemoryManager& device_memory, Core::Frontend::EmuWindow& render_window, | 56 | explicit BlitScreen(Tegra::MaxwellDeviceMemoryManager& device_memory, |
| 57 | const Device& device, MemoryAllocator& memory_manager, Swapchain& swapchain, | 57 | Core::Frontend::EmuWindow& render_window, const Device& device, |
| 58 | MemoryAllocator& memory_manager, Swapchain& swapchain, | ||
| 58 | PresentManager& present_manager, Scheduler& scheduler, | 59 | PresentManager& present_manager, Scheduler& scheduler, |
| 59 | const ScreenInfo& screen_info); | 60 | const ScreenInfo& screen_info); |
| 60 | ~BlitScreen(); | 61 | ~BlitScreen(); |
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp index bec20c21a..1e1821b10 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp | |||
| @@ -298,8 +298,9 @@ bool GraphicsPipelineCacheKey::operator==(const GraphicsPipelineCacheKey& rhs) c | |||
| 298 | return std::memcmp(&rhs, this, Size()) == 0; | 298 | return std::memcmp(&rhs, this, Size()) == 0; |
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | PipelineCache::PipelineCache(Tegra::MaxwellDeviceMemoryManager& device_memory_, const Device& device_, | 301 | PipelineCache::PipelineCache(Tegra::MaxwellDeviceMemoryManager& device_memory_, |
| 302 | Scheduler& scheduler_, DescriptorPool& descriptor_pool_, | 302 | const Device& device_, Scheduler& scheduler_, |
| 303 | DescriptorPool& descriptor_pool_, | ||
| 303 | GuestDescriptorQueue& guest_descriptor_queue_, | 304 | GuestDescriptorQueue& guest_descriptor_queue_, |
| 304 | RenderPassCache& render_pass_cache_, BufferCache& buffer_cache_, | 305 | RenderPassCache& render_pass_cache_, BufferCache& buffer_cache_, |
| 305 | TextureCache& texture_cache_, VideoCore::ShaderNotify& shader_notify_) | 306 | TextureCache& texture_cache_, VideoCore::ShaderNotify& shader_notify_) |
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.h b/src/video_core/renderer_vulkan/vk_pipeline_cache.h index 354fdc8ed..797700128 100644 --- a/src/video_core/renderer_vulkan/vk_pipeline_cache.h +++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.h | |||
| @@ -20,13 +20,13 @@ | |||
| 20 | #include "shader_recompiler/object_pool.h" | 20 | #include "shader_recompiler/object_pool.h" |
| 21 | #include "shader_recompiler/profile.h" | 21 | #include "shader_recompiler/profile.h" |
| 22 | #include "video_core/engines/maxwell_3d.h" | 22 | #include "video_core/engines/maxwell_3d.h" |
| 23 | #include "video_core/host1x/gpu_device_memory_manager.h" | ||
| 23 | #include "video_core/renderer_vulkan/fixed_pipeline_state.h" | 24 | #include "video_core/renderer_vulkan/fixed_pipeline_state.h" |
| 24 | #include "video_core/renderer_vulkan/vk_buffer_cache.h" | 25 | #include "video_core/renderer_vulkan/vk_buffer_cache.h" |
| 25 | #include "video_core/renderer_vulkan/vk_compute_pipeline.h" | 26 | #include "video_core/renderer_vulkan/vk_compute_pipeline.h" |
| 26 | #include "video_core/renderer_vulkan/vk_graphics_pipeline.h" | 27 | #include "video_core/renderer_vulkan/vk_graphics_pipeline.h" |
| 27 | #include "video_core/renderer_vulkan/vk_texture_cache.h" | 28 | #include "video_core/renderer_vulkan/vk_texture_cache.h" |
| 28 | #include "video_core/shader_cache.h" | 29 | #include "video_core/shader_cache.h" |
| 29 | #include "video_core/host1x/gpu_device_memory_manager.h" | ||
| 30 | 30 | ||
| 31 | namespace Core { | 31 | namespace Core { |
| 32 | class System; | 32 | class System; |
| @@ -99,8 +99,8 @@ struct ShaderPools { | |||
| 99 | 99 | ||
| 100 | class PipelineCache : public VideoCommon::ShaderCache { | 100 | class PipelineCache : public VideoCommon::ShaderCache { |
| 101 | public: | 101 | public: |
| 102 | explicit PipelineCache(Tegra::MaxwellDeviceMemoryManager& device_memory_, const Device& device, Scheduler& scheduler, | 102 | explicit PipelineCache(Tegra::MaxwellDeviceMemoryManager& device_memory_, const Device& device, |
| 103 | DescriptorPool& descriptor_pool, | 103 | Scheduler& scheduler, DescriptorPool& descriptor_pool, |
| 104 | GuestDescriptorQueue& guest_descriptor_queue, | 104 | GuestDescriptorQueue& guest_descriptor_queue, |
| 105 | RenderPassCache& render_pass_cache, BufferCache& buffer_cache, | 105 | RenderPassCache& render_pass_cache, BufferCache& buffer_cache, |
| 106 | TextureCache& texture_cache, VideoCore::ShaderNotify& shader_notify_); | 106 | TextureCache& texture_cache, VideoCore::ShaderNotify& shader_notify_); |
diff --git a/src/video_core/renderer_vulkan/vk_query_cache.cpp b/src/video_core/renderer_vulkan/vk_query_cache.cpp index d59fe698c..522f92dae 100644 --- a/src/video_core/renderer_vulkan/vk_query_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_query_cache.cpp | |||
| @@ -14,10 +14,10 @@ | |||
| 14 | #include "common/bit_util.h" | 14 | #include "common/bit_util.h" |
| 15 | #include "common/common_types.h" | 15 | #include "common/common_types.h" |
| 16 | #include "core/memory.h" | 16 | #include "core/memory.h" |
| 17 | #include "video_core/rasterizer_interface.h" | ||
| 18 | #include "video_core/engines/draw_manager.h" | 17 | #include "video_core/engines/draw_manager.h" |
| 19 | #include "video_core/host1x/gpu_device_memory_manager.h" | 18 | #include "video_core/host1x/gpu_device_memory_manager.h" |
| 20 | #include "video_core/query_cache/query_cache.h" | 19 | #include "video_core/query_cache/query_cache.h" |
| 20 | #include "video_core/rasterizer_interface.h" | ||
| 21 | #include "video_core/renderer_vulkan/vk_buffer_cache.h" | 21 | #include "video_core/renderer_vulkan/vk_buffer_cache.h" |
| 22 | #include "video_core/renderer_vulkan/vk_compute_pass.h" | 22 | #include "video_core/renderer_vulkan/vk_compute_pass.h" |
| 23 | #include "video_core/renderer_vulkan/vk_query_cache.h" | 23 | #include "video_core/renderer_vulkan/vk_query_cache.h" |
| @@ -1156,9 +1156,10 @@ private: | |||
| 1156 | 1156 | ||
| 1157 | struct QueryCacheRuntimeImpl { | 1157 | struct QueryCacheRuntimeImpl { |
| 1158 | QueryCacheRuntimeImpl(QueryCacheRuntime& runtime, VideoCore::RasterizerInterface* rasterizer_, | 1158 | QueryCacheRuntimeImpl(QueryCacheRuntime& runtime, VideoCore::RasterizerInterface* rasterizer_, |
| 1159 | Tegra::MaxwellDeviceMemoryManager& device_memory_, Vulkan::BufferCache& buffer_cache_, | 1159 | Tegra::MaxwellDeviceMemoryManager& device_memory_, |
| 1160 | const Device& device_, const MemoryAllocator& memory_allocator_, | 1160 | Vulkan::BufferCache& buffer_cache_, const Device& device_, |
| 1161 | Scheduler& scheduler_, StagingBufferPool& staging_pool_, | 1161 | const MemoryAllocator& memory_allocator_, Scheduler& scheduler_, |
| 1162 | StagingBufferPool& staging_pool_, | ||
| 1162 | ComputePassDescriptorQueue& compute_pass_descriptor_queue, | 1163 | ComputePassDescriptorQueue& compute_pass_descriptor_queue, |
| 1163 | DescriptorPool& descriptor_pool) | 1164 | DescriptorPool& descriptor_pool) |
| 1164 | : rasterizer{rasterizer_}, device_memory{device_memory_}, | 1165 | : rasterizer{rasterizer_}, device_memory{device_memory_}, |
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 7db131985..874927311 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp | |||
| @@ -38,7 +38,6 @@ | |||
| 38 | #include "video_core/vulkan_common/vulkan_device.h" | 38 | #include "video_core/vulkan_common/vulkan_device.h" |
| 39 | #include "video_core/vulkan_common/vulkan_wrapper.h" | 39 | #include "video_core/vulkan_common/vulkan_wrapper.h" |
| 40 | 40 | ||
| 41 | |||
| 42 | namespace Vulkan { | 41 | namespace Vulkan { |
| 43 | 42 | ||
| 44 | using Maxwell = Tegra::Engines::Maxwell3D::Regs; | 43 | using Maxwell = Tegra::Engines::Maxwell3D::Regs; |
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.h b/src/video_core/renderer_vulkan/vk_rasterizer.h index d593f35df..881ee0993 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.h +++ b/src/video_core/renderer_vulkan/vk_rasterizer.h | |||
| @@ -7,13 +7,13 @@ | |||
| 7 | 7 | ||
| 8 | #include <boost/container/static_vector.hpp> | 8 | #include <boost/container/static_vector.hpp> |
| 9 | 9 | ||
| 10 | #include "video_core/renderer_vulkan/vk_buffer_cache.h" | ||
| 11 | |||
| 12 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 13 | #include "video_core/control/channel_state_cache.h" | 11 | #include "video_core/control/channel_state_cache.h" |
| 14 | #include "video_core/engines/maxwell_dma.h" | 12 | #include "video_core/engines/maxwell_dma.h" |
| 13 | #include "video_core/host1x/gpu_device_memory_manager.h" | ||
| 15 | #include "video_core/rasterizer_interface.h" | 14 | #include "video_core/rasterizer_interface.h" |
| 16 | #include "video_core/renderer_vulkan/blit_image.h" | 15 | #include "video_core/renderer_vulkan/blit_image.h" |
| 16 | #include "video_core/renderer_vulkan/vk_buffer_cache.h" | ||
| 17 | #include "video_core/renderer_vulkan/vk_descriptor_pool.h" | 17 | #include "video_core/renderer_vulkan/vk_descriptor_pool.h" |
| 18 | #include "video_core/renderer_vulkan/vk_fence_manager.h" | 18 | #include "video_core/renderer_vulkan/vk_fence_manager.h" |
| 19 | #include "video_core/renderer_vulkan/vk_pipeline_cache.h" | 19 | #include "video_core/renderer_vulkan/vk_pipeline_cache.h" |
| @@ -24,7 +24,6 @@ | |||
| 24 | #include "video_core/renderer_vulkan/vk_update_descriptor.h" | 24 | #include "video_core/renderer_vulkan/vk_update_descriptor.h" |
| 25 | #include "video_core/vulkan_common/vulkan_memory_allocator.h" | 25 | #include "video_core/vulkan_common/vulkan_memory_allocator.h" |
| 26 | #include "video_core/vulkan_common/vulkan_wrapper.h" | 26 | #include "video_core/vulkan_common/vulkan_wrapper.h" |
| 27 | #include "video_core/host1x/gpu_device_memory_manager.h" | ||
| 28 | 27 | ||
| 29 | namespace Core { | 28 | namespace Core { |
| 30 | class System; | 29 | class System; |
diff --git a/src/video_core/shader_cache.cpp b/src/video_core/shader_cache.cpp index 86fd62428..2af32c8f2 100644 --- a/src/video_core/shader_cache.cpp +++ b/src/video_core/shader_cache.cpp | |||
| @@ -35,7 +35,8 @@ void ShaderCache::SyncGuestHost() { | |||
| 35 | RemovePendingShaders(); | 35 | RemovePendingShaders(); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | ShaderCache::ShaderCache(Tegra::MaxwellDeviceMemoryManager& device_memory_) : device_memory{device_memory_} {} | 38 | ShaderCache::ShaderCache(Tegra::MaxwellDeviceMemoryManager& device_memory_) |
| 39 | : device_memory{device_memory_} {} | ||
| 39 | 40 | ||
| 40 | bool ShaderCache::RefreshStages(std::array<u64, 6>& unique_hashes) { | 41 | bool ShaderCache::RefreshStages(std::array<u64, 6>& unique_hashes) { |
| 41 | auto& dirty{maxwell3d->dirty.flags}; | 42 | auto& dirty{maxwell3d->dirty.flags}; |
diff --git a/src/video_core/shader_cache.h b/src/video_core/shader_cache.h index 02ef39483..fd9bf2562 100644 --- a/src/video_core/shader_cache.h +++ b/src/video_core/shader_cache.h | |||
| @@ -14,9 +14,9 @@ | |||
| 14 | #include "common/common_types.h" | 14 | #include "common/common_types.h" |
| 15 | #include "common/polyfill_ranges.h" | 15 | #include "common/polyfill_ranges.h" |
| 16 | #include "video_core/control/channel_state_cache.h" | 16 | #include "video_core/control/channel_state_cache.h" |
| 17 | #include "video_core/host1x/gpu_device_memory_manager.h" | ||
| 17 | #include "video_core/rasterizer_interface.h" | 18 | #include "video_core/rasterizer_interface.h" |
| 18 | #include "video_core/shader_environment.h" | 19 | #include "video_core/shader_environment.h" |
| 19 | #include "video_core/host1x/gpu_device_memory_manager.h" | ||
| 20 | 20 | ||
| 21 | namespace Tegra { | 21 | namespace Tegra { |
| 22 | class MemoryManager; | 22 | class MemoryManager; |