diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/nvdrv/core/nvmap.cpp | 38 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp | 1 | ||||
| -rw-r--r-- | src/video_core/gpu.cpp | 1 | ||||
| -rw-r--r-- | src/video_core/host1x/codecs/h264.cpp | 9 | ||||
| -rw-r--r-- | src/video_core/host1x/codecs/vp8.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/host1x/codecs/vp9.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/host1x/gpu_device_memory_manager.h | 2 | ||||
| -rw-r--r-- | src/video_core/host1x/host1x.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/host1x/host1x.h | 20 | ||||
| -rw-r--r-- | src/video_core/host1x/vic.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/memory_manager.cpp | 18 | ||||
| -rw-r--r-- | src/video_core/memory_manager.h | 2 |
12 files changed, 86 insertions, 29 deletions
diff --git a/src/core/hle/service/nvdrv/core/nvmap.cpp b/src/core/hle/service/nvdrv/core/nvmap.cpp index e4168a37c..0b2ddd980 100644 --- a/src/core/hle/service/nvdrv/core/nvmap.cpp +++ b/src/core/hle/service/nvdrv/core/nvmap.cpp | |||
| @@ -80,6 +80,15 @@ void NvMap::UnmapHandle(Handle& handle_description) { | |||
| 80 | handle_description.unmap_queue_entry.reset(); | 80 | handle_description.unmap_queue_entry.reset(); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | // Free and unmap the handle from Host1x GMMU | ||
| 84 | if (handle_description.pin_virt_address) { | ||
| 85 | host1x.GMMU().Unmap(static_cast<GPUVAddr>(handle_description.pin_virt_address), | ||
| 86 | handle_description.aligned_size); | ||
| 87 | host1x.Allocator().Free(handle_description.pin_virt_address, | ||
| 88 | static_cast<u32>(handle_description.aligned_size)); | ||
| 89 | handle_description.pin_virt_address = 0; | ||
| 90 | } | ||
| 91 | |||
| 83 | // Free and unmap the handle from the SMMU | 92 | // Free and unmap the handle from the SMMU |
| 84 | auto& smmu = host1x.MemoryManager(); | 93 | auto& smmu = host1x.MemoryManager(); |
| 85 | smmu.Unmap(handle_description.d_address, handle_description.aligned_size); | 94 | smmu.Unmap(handle_description.d_address, handle_description.aligned_size); |
| @@ -141,6 +150,17 @@ DAddr NvMap::PinHandle(NvMap::Handle::Id handle, size_t session_id, bool low_are | |||
| 141 | } | 150 | } |
| 142 | 151 | ||
| 143 | std::scoped_lock lock(handle_description->mutex); | 152 | std::scoped_lock lock(handle_description->mutex); |
| 153 | const auto map_low_area = [&] { | ||
| 154 | if (handle_description->pin_virt_address == 0) { | ||
| 155 | auto& gmmu_allocator = host1x.Allocator(); | ||
| 156 | auto& gmmu = host1x.GMMU(); | ||
| 157 | u32 address = | ||
| 158 | gmmu_allocator.Allocate(static_cast<u32>(handle_description->aligned_size)); | ||
| 159 | gmmu.Map(static_cast<GPUVAddr>(address), handle_description->d_address, | ||
| 160 | handle_description->aligned_size); | ||
| 161 | handle_description->pin_virt_address = address; | ||
| 162 | } | ||
| 163 | }; | ||
| 144 | if (!handle_description->pins) { | 164 | if (!handle_description->pins) { |
| 145 | // If we're in the unmap queue we can just remove ourselves and return since we're already | 165 | // If we're in the unmap queue we can just remove ourselves and return since we're already |
| 146 | // mapped | 166 | // mapped |
| @@ -152,6 +172,12 @@ DAddr NvMap::PinHandle(NvMap::Handle::Id handle, size_t session_id, bool low_are | |||
| 152 | unmap_queue.erase(*handle_description->unmap_queue_entry); | 172 | unmap_queue.erase(*handle_description->unmap_queue_entry); |
| 153 | handle_description->unmap_queue_entry.reset(); | 173 | handle_description->unmap_queue_entry.reset(); |
| 154 | 174 | ||
| 175 | if (low_area_pin) { | ||
| 176 | map_low_area(); | ||
| 177 | handle_description->pins++; | ||
| 178 | return static_cast<DAddr>(handle_description->pin_virt_address); | ||
| 179 | } | ||
| 180 | |||
| 155 | handle_description->pins++; | 181 | handle_description->pins++; |
| 156 | return handle_description->d_address; | 182 | return handle_description->d_address; |
| 157 | } | 183 | } |
| @@ -162,10 +188,7 @@ DAddr NvMap::PinHandle(NvMap::Handle::Id handle, size_t session_id, bool low_are | |||
| 162 | DAddr address{}; | 188 | DAddr address{}; |
| 163 | auto& smmu = host1x.MemoryManager(); | 189 | auto& smmu = host1x.MemoryManager(); |
| 164 | auto* session = core.GetSession(session_id); | 190 | auto* session = core.GetSession(session_id); |
| 165 | 191 | while ((address = smmu.Allocate(handle_description->aligned_size)) == 0) { | |
| 166 | auto allocate = std::bind(&Tegra::MaxwellDeviceMemoryManager::Allocate, &smmu, _1); | ||
| 167 | //: std::bind(&Tegra::MaxwellDeviceMemoryManager::Allocate, &smmu, _1); | ||
| 168 | while ((address = allocate(static_cast<size_t>(handle_description->aligned_size))) == 0) { | ||
| 169 | // Free handles until the allocation succeeds | 192 | // Free handles until the allocation succeeds |
| 170 | std::scoped_lock queueLock(unmap_queue_lock); | 193 | std::scoped_lock queueLock(unmap_queue_lock); |
| 171 | if (auto freeHandleDesc{unmap_queue.front()}) { | 194 | if (auto freeHandleDesc{unmap_queue.front()}) { |
| @@ -185,7 +208,14 @@ DAddr NvMap::PinHandle(NvMap::Handle::Id handle, size_t session_id, bool low_are | |||
| 185 | session->smmu_id); | 208 | session->smmu_id); |
| 186 | } | 209 | } |
| 187 | 210 | ||
| 211 | if (low_area_pin) { | ||
| 212 | map_low_area(); | ||
| 213 | } | ||
| 214 | |||
| 188 | handle_description->pins++; | 215 | handle_description->pins++; |
| 216 | if (low_area_pin) { | ||
| 217 | return static_cast<DAddr>(handle_description->pin_virt_address); | ||
| 218 | } | ||
| 189 | return handle_description->d_address; | 219 | return handle_description->d_address; |
| 190 | } | 220 | } |
| 191 | 221 | ||
diff --git a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp index 78bc5f3c4..0b6aa9993 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_nvdec_common.cpp | |||
| @@ -95,7 +95,6 @@ NvResult nvhost_nvdec_common::Submit(IoctlSubmit& params, std::span<u8> data, De | |||
| 95 | offset += SliceVectors(data, fence_thresholds, params.fence_count, offset); | 95 | offset += SliceVectors(data, fence_thresholds, params.fence_count, offset); |
| 96 | 96 | ||
| 97 | auto& gpu = system.GPU(); | 97 | auto& gpu = system.GPU(); |
| 98 | //auto& device_memory = system.Host1x().MemoryManager(); | ||
| 99 | auto* session = core.GetSession(sessions[fd]); | 98 | auto* session = core.GetSession(sessions[fd]); |
| 100 | 99 | ||
| 101 | if (gpu.UseNvdec()) { | 100 | if (gpu.UseNvdec()) { |
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 5f780507b..6ad3b94f8 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp | |||
| @@ -88,6 +88,7 @@ struct GPU::Impl { | |||
| 88 | renderer = std::move(renderer_); | 88 | renderer = std::move(renderer_); |
| 89 | rasterizer = renderer->ReadRasterizer(); | 89 | rasterizer = renderer->ReadRasterizer(); |
| 90 | host1x.MemoryManager().BindInterface(rasterizer); | 90 | host1x.MemoryManager().BindInterface(rasterizer); |
| 91 | host1x.GMMU().BindRasterizer(rasterizer); | ||
| 91 | } | 92 | } |
| 92 | 93 | ||
| 93 | /// Flush all current written commands into the host GPU for execution. | 94 | /// Flush all current written commands into the host GPU for execution. |
diff --git a/src/video_core/host1x/codecs/h264.cpp b/src/video_core/host1x/codecs/h264.cpp index 309a7f1d5..994591c8d 100644 --- a/src/video_core/host1x/codecs/h264.cpp +++ b/src/video_core/host1x/codecs/h264.cpp | |||
| @@ -32,13 +32,12 @@ H264::~H264() = default; | |||
| 32 | std::span<const u8> H264::ComposeFrame(const Host1x::NvdecCommon::NvdecRegisters& state, | 32 | std::span<const u8> H264::ComposeFrame(const Host1x::NvdecCommon::NvdecRegisters& state, |
| 33 | size_t* out_configuration_size, bool is_first_frame) { | 33 | size_t* out_configuration_size, bool is_first_frame) { |
| 34 | H264DecoderContext context; | 34 | H264DecoderContext context; |
| 35 | host1x.MemoryManager().ReadBlock(state.picture_info_offset, &context, | 35 | host1x.GMMU().ReadBlock(state.picture_info_offset, &context, sizeof(H264DecoderContext)); |
| 36 | sizeof(H264DecoderContext)); | ||
| 37 | 36 | ||
| 38 | const s64 frame_number = context.h264_parameter_set.frame_number.Value(); | 37 | const s64 frame_number = context.h264_parameter_set.frame_number.Value(); |
| 39 | if (!is_first_frame && frame_number != 0) { | 38 | if (!is_first_frame && frame_number != 0) { |
| 40 | frame.resize_destructive(context.stream_len); | 39 | frame.resize_destructive(context.stream_len); |
| 41 | host1x.MemoryManager().ReadBlock(state.frame_bitstream_offset, frame.data(), frame.size()); | 40 | host1x.GMMU().ReadBlock(state.frame_bitstream_offset, frame.data(), frame.size()); |
| 42 | *out_configuration_size = 0; | 41 | *out_configuration_size = 0; |
| 43 | return frame; | 42 | return frame; |
| 44 | } | 43 | } |
| @@ -159,8 +158,8 @@ std::span<const u8> H264::ComposeFrame(const Host1x::NvdecCommon::NvdecRegisters | |||
| 159 | std::memcpy(frame.data(), encoded_header.data(), encoded_header.size()); | 158 | std::memcpy(frame.data(), encoded_header.data(), encoded_header.size()); |
| 160 | 159 | ||
| 161 | *out_configuration_size = encoded_header.size(); | 160 | *out_configuration_size = encoded_header.size(); |
| 162 | host1x.MemoryManager().ReadBlock(state.frame_bitstream_offset, | 161 | host1x.GMMU().ReadBlock(state.frame_bitstream_offset, frame.data() + encoded_header.size(), |
| 163 | frame.data() + encoded_header.size(), context.stream_len); | 162 | context.stream_len); |
| 164 | 163 | ||
| 165 | return frame; | 164 | return frame; |
| 166 | } | 165 | } |
diff --git a/src/video_core/host1x/codecs/vp8.cpp b/src/video_core/host1x/codecs/vp8.cpp index ee6392ff9..be97e3b00 100644 --- a/src/video_core/host1x/codecs/vp8.cpp +++ b/src/video_core/host1x/codecs/vp8.cpp | |||
| @@ -14,7 +14,7 @@ VP8::~VP8() = default; | |||
| 14 | 14 | ||
| 15 | std::span<const u8> VP8::ComposeFrame(const Host1x::NvdecCommon::NvdecRegisters& state) { | 15 | std::span<const u8> VP8::ComposeFrame(const Host1x::NvdecCommon::NvdecRegisters& state) { |
| 16 | VP8PictureInfo info; | 16 | VP8PictureInfo info; |
| 17 | host1x.MemoryManager().ReadBlock(state.picture_info_offset, &info, sizeof(VP8PictureInfo)); | 17 | host1x.GMMU().ReadBlock(state.picture_info_offset, &info, sizeof(VP8PictureInfo)); |
| 18 | 18 | ||
| 19 | const bool is_key_frame = info.key_frame == 1u; | 19 | const bool is_key_frame = info.key_frame == 1u; |
| 20 | const auto bitstream_size = static_cast<size_t>(info.vld_buffer_size); | 20 | const auto bitstream_size = static_cast<size_t>(info.vld_buffer_size); |
| @@ -45,7 +45,7 @@ std::span<const u8> VP8::ComposeFrame(const Host1x::NvdecCommon::NvdecRegisters& | |||
| 45 | frame[9] = static_cast<u8>(((info.frame_height >> 8) & 0x3f)); | 45 | frame[9] = static_cast<u8>(((info.frame_height >> 8) & 0x3f)); |
| 46 | } | 46 | } |
| 47 | const u64 bitstream_offset = state.frame_bitstream_offset; | 47 | const u64 bitstream_offset = state.frame_bitstream_offset; |
| 48 | host1x.MemoryManager().ReadBlock(bitstream_offset, frame.data() + header_size, bitstream_size); | 48 | host1x.GMMU().ReadBlock(bitstream_offset, frame.data() + header_size, bitstream_size); |
| 49 | 49 | ||
| 50 | return frame; | 50 | return frame; |
| 51 | } | 51 | } |
diff --git a/src/video_core/host1x/codecs/vp9.cpp b/src/video_core/host1x/codecs/vp9.cpp index 306c3d0e8..e2ae1f76d 100644 --- a/src/video_core/host1x/codecs/vp9.cpp +++ b/src/video_core/host1x/codecs/vp9.cpp | |||
| @@ -358,7 +358,7 @@ void VP9::WriteMvProbabilityUpdate(VpxRangeEncoder& writer, u8 new_prob, u8 old_ | |||
| 358 | 358 | ||
| 359 | Vp9PictureInfo VP9::GetVp9PictureInfo(const Host1x::NvdecCommon::NvdecRegisters& state) { | 359 | Vp9PictureInfo VP9::GetVp9PictureInfo(const Host1x::NvdecCommon::NvdecRegisters& state) { |
| 360 | PictureInfo picture_info; | 360 | PictureInfo picture_info; |
| 361 | host1x.MemoryManager().ReadBlock(state.picture_info_offset, &picture_info, sizeof(PictureInfo)); | 361 | host1x.GMMU().ReadBlock(state.picture_info_offset, &picture_info, sizeof(PictureInfo)); |
| 362 | Vp9PictureInfo vp9_info = picture_info.Convert(); | 362 | Vp9PictureInfo vp9_info = picture_info.Convert(); |
| 363 | 363 | ||
| 364 | InsertEntropy(state.vp9_entropy_probs_offset, vp9_info.entropy); | 364 | InsertEntropy(state.vp9_entropy_probs_offset, vp9_info.entropy); |
| @@ -373,7 +373,7 @@ Vp9PictureInfo VP9::GetVp9PictureInfo(const Host1x::NvdecCommon::NvdecRegisters& | |||
| 373 | 373 | ||
| 374 | void VP9::InsertEntropy(u64 offset, Vp9EntropyProbs& dst) { | 374 | void VP9::InsertEntropy(u64 offset, Vp9EntropyProbs& dst) { |
| 375 | EntropyProbs entropy; | 375 | EntropyProbs entropy; |
| 376 | host1x.MemoryManager().ReadBlock(offset, &entropy, sizeof(EntropyProbs)); | 376 | host1x.GMMU().ReadBlock(offset, &entropy, sizeof(EntropyProbs)); |
| 377 | entropy.Convert(dst); | 377 | entropy.Convert(dst); |
| 378 | } | 378 | } |
| 379 | 379 | ||
| @@ -383,7 +383,7 @@ 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.MemoryManager().ReadBlock(state.frame_bitstream_offset, | 386 | host1x.GMMU().ReadBlock(state.frame_bitstream_offset, |
| 387 | current_frame.bit_stream.data(), | 387 | current_frame.bit_stream.data(), |
| 388 | current_frame.info.bitstream_size); | 388 | current_frame.info.bitstream_size); |
| 389 | } | 389 | } |
diff --git a/src/video_core/host1x/gpu_device_memory_manager.h b/src/video_core/host1x/gpu_device_memory_manager.h index a406ce965..6c7858848 100644 --- a/src/video_core/host1x/gpu_device_memory_manager.h +++ b/src/video_core/host1x/gpu_device_memory_manager.h | |||
| @@ -15,7 +15,7 @@ struct MaxwellDeviceMethods; | |||
| 15 | 15 | ||
| 16 | struct MaxwellDeviceTraits { | 16 | struct MaxwellDeviceTraits { |
| 17 | static constexpr bool supports_pinning = false; | 17 | static constexpr bool supports_pinning = false; |
| 18 | static constexpr size_t device_virtual_bits = 32; | 18 | static constexpr size_t device_virtual_bits = 34; |
| 19 | using DeviceInterface = typename VideoCore::RasterizerInterface; | 19 | using DeviceInterface = typename VideoCore::RasterizerInterface; |
| 20 | using DeviceMethods = typename MaxwellDeviceMethods; | 20 | using DeviceMethods = typename MaxwellDeviceMethods; |
| 21 | }; | 21 | }; |
diff --git a/src/video_core/host1x/host1x.cpp b/src/video_core/host1x/host1x.cpp index d05bcaf26..b7f9a08cf 100644 --- a/src/video_core/host1x/host1x.cpp +++ b/src/video_core/host1x/host1x.cpp | |||
| @@ -9,7 +9,9 @@ namespace Tegra { | |||
| 9 | namespace Host1x { | 9 | namespace Host1x { |
| 10 | 10 | ||
| 11 | Host1x::Host1x(Core::System& system_) | 11 | Host1x::Host1x(Core::System& system_) |
| 12 | : system{system_}, syncpoint_manager{}, memory_manager(system.DeviceMemory()) {} | 12 | : system{system_}, syncpoint_manager{}, |
| 13 | memory_manager(system.DeviceMemory()), gmmu_manager{system, memory_manager, 32, 12}, | ||
| 14 | allocator{std::make_unique<Common::FlatAllocator<u32, 0, 32>>(1 << 12)} {} | ||
| 13 | 15 | ||
| 14 | } // namespace Host1x | 16 | } // namespace Host1x |
| 15 | 17 | ||
diff --git a/src/video_core/host1x/host1x.h b/src/video_core/host1x/host1x.h index 18f7389f6..13c37e6b4 100644 --- a/src/video_core/host1x/host1x.h +++ b/src/video_core/host1x/host1x.h | |||
| @@ -5,8 +5,10 @@ | |||
| 5 | 5 | ||
| 6 | #include "common/common_types.h" | 6 | #include "common/common_types.h" |
| 7 | 7 | ||
| 8 | #include "common/address_space.h" | ||
| 8 | #include "video_core/host1x/gpu_device_memory_manager.h" | 9 | #include "video_core/host1x/gpu_device_memory_manager.h" |
| 9 | #include "video_core/host1x/syncpoint_manager.h" | 10 | #include "video_core/host1x/syncpoint_manager.h" |
| 11 | #include "video_core/memory_manager.h" | ||
| 10 | 12 | ||
| 11 | namespace Core { | 13 | namespace Core { |
| 12 | class System; | 14 | class System; |
| @@ -36,10 +38,28 @@ public: | |||
| 36 | return memory_manager; | 38 | return memory_manager; |
| 37 | } | 39 | } |
| 38 | 40 | ||
| 41 | Tegra::MemoryManager& GMMU() { | ||
| 42 | return gmmu_manager; | ||
| 43 | } | ||
| 44 | |||
| 45 | const Tegra::MemoryManager& GMMU() const { | ||
| 46 | return gmmu_manager; | ||
| 47 | } | ||
| 48 | |||
| 49 | Common::FlatAllocator<u32, 0, 32>& Allocator() { | ||
| 50 | return *allocator; | ||
| 51 | } | ||
| 52 | |||
| 53 | const Common::FlatAllocator<u32, 0, 32>& Allocator() const { | ||
| 54 | return *allocator; | ||
| 55 | } | ||
| 56 | |||
| 39 | private: | 57 | private: |
| 40 | Core::System& system; | 58 | Core::System& system; |
| 41 | SyncpointManager syncpoint_manager; | 59 | SyncpointManager syncpoint_manager; |
| 42 | Tegra::MaxwellDeviceMemoryManager memory_manager; | 60 | Tegra::MaxwellDeviceMemoryManager memory_manager; |
| 61 | Tegra::MemoryManager gmmu_manager; | ||
| 62 | std::unique_ptr<Common::FlatAllocator<u32, 0, 32>> allocator; | ||
| 43 | }; | 63 | }; |
| 44 | 64 | ||
| 45 | } // namespace Host1x | 65 | } // namespace Host1x |
diff --git a/src/video_core/host1x/vic.cpp b/src/video_core/host1x/vic.cpp index 2a5eba415..1826211a1 100644 --- a/src/video_core/host1x/vic.cpp +++ b/src/video_core/host1x/vic.cpp | |||
| @@ -81,7 +81,7 @@ void Vic::Execute() { | |||
| 81 | LOG_ERROR(Service_NVDRV, "VIC Luma address not set."); | 81 | LOG_ERROR(Service_NVDRV, "VIC Luma address not set."); |
| 82 | return; | 82 | return; |
| 83 | } | 83 | } |
| 84 | const VicConfig config{host1x.MemoryManager().Read<u64>(config_struct_address + 0x20)}; | 84 | const VicConfig config{host1x.GMMU().Read<u64>(config_struct_address + 0x20)}; |
| 85 | auto frame = nvdec_processor->GetFrame(); | 85 | auto frame = nvdec_processor->GetFrame(); |
| 86 | if (!frame) { | 86 | if (!frame) { |
| 87 | return; | 87 | return; |
| @@ -162,11 +162,11 @@ void Vic::WriteRGBFrame(std::unique_ptr<FFmpeg::Frame> frame, const VicConfig& c | |||
| 162 | Texture::SwizzleSubrect(luma_buffer, frame_buff, 4, width, height, 1, 0, 0, width, height, | 162 | Texture::SwizzleSubrect(luma_buffer, frame_buff, 4, width, height, 1, 0, 0, width, height, |
| 163 | block_height, 0, width * 4); | 163 | block_height, 0, width * 4); |
| 164 | 164 | ||
| 165 | host1x.MemoryManager().WriteBlock(output_surface_luma_address, luma_buffer.data(), size); | 165 | host1x.GMMU().WriteBlock(output_surface_luma_address, luma_buffer.data(), size); |
| 166 | } else { | 166 | } else { |
| 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.MemoryManager().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 | } |
| @@ -193,7 +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.MemoryManager().WriteBlock(output_surface_luma_address, luma_buffer.data(), | 196 | host1x.GMMU().WriteBlock(output_surface_luma_address, luma_buffer.data(), |
| 197 | luma_buffer.size()); | 197 | luma_buffer.size()); |
| 198 | 198 | ||
| 199 | // Chroma | 199 | // Chroma |
| @@ -233,7 +233,7 @@ void Vic::WriteYUVFrame(std::unique_ptr<FFmpeg::Frame> frame, const VicConfig& c | |||
| 233 | ASSERT(false); | 233 | ASSERT(false); |
| 234 | break; | 234 | break; |
| 235 | } | 235 | } |
| 236 | host1x.MemoryManager().WriteBlock(output_surface_chroma_address, chroma_buffer.data(), | 236 | host1x.GMMU().WriteBlock(output_surface_chroma_address, chroma_buffer.data(), |
| 237 | chroma_buffer.size()); | 237 | chroma_buffer.size()); |
| 238 | } | 238 | } |
| 239 | 239 | ||
diff --git a/src/video_core/memory_manager.cpp b/src/video_core/memory_manager.cpp index 82f7a1c3b..ac1417fbc 100644 --- a/src/video_core/memory_manager.cpp +++ b/src/video_core/memory_manager.cpp | |||
| @@ -16,18 +16,17 @@ | |||
| 16 | #include "video_core/rasterizer_interface.h" | 16 | #include "video_core/rasterizer_interface.h" |
| 17 | #include "video_core/renderer_base.h" | 17 | #include "video_core/renderer_base.h" |
| 18 | 18 | ||
| 19 | |||
| 20 | namespace Tegra { | 19 | namespace Tegra { |
| 21 | using Tegra::Memory::GuestMemoryFlags; | 20 | using Tegra::Memory::GuestMemoryFlags; |
| 22 | 21 | ||
| 23 | std::atomic<size_t> MemoryManager::unique_identifier_generator{}; | 22 | std::atomic<size_t> MemoryManager::unique_identifier_generator{}; |
| 24 | 23 | ||
| 25 | MemoryManager::MemoryManager(Core::System& system_, u64 address_space_bits_, u64 big_page_bits_, | 24 | MemoryManager::MemoryManager(Core::System& system_, MaxwellDeviceMemoryManager& memory_, |
| 26 | u64 page_bits_) | 25 | u64 address_space_bits_, u64 big_page_bits_, u64 page_bits_) |
| 27 | : system{system_}, memory{system.Host1x().MemoryManager()}, | 26 | : system{system_}, memory{memory_}, address_space_bits{address_space_bits_}, |
| 28 | address_space_bits{address_space_bits_}, page_bits{page_bits_}, big_page_bits{big_page_bits_}, | 27 | page_bits{page_bits_}, big_page_bits{big_page_bits_}, entries{}, big_entries{}, |
| 29 | entries{}, big_entries{}, page_table{address_space_bits, address_space_bits + page_bits - 38, | 28 | page_table{address_space_bits, address_space_bits + page_bits - 38, |
| 30 | page_bits != big_page_bits ? page_bits : 0}, | 29 | page_bits != big_page_bits ? page_bits : 0}, |
| 31 | kind_map{PTEKind::INVALID}, unique_identifier{unique_identifier_generator.fetch_add( | 30 | kind_map{PTEKind::INVALID}, unique_identifier{unique_identifier_generator.fetch_add( |
| 32 | 1, std::memory_order_acq_rel)}, | 31 | 1, std::memory_order_acq_rel)}, |
| 33 | accumulator{std::make_unique<VideoCommon::InvalidationAccumulator>()} { | 32 | accumulator{std::make_unique<VideoCommon::InvalidationAccumulator>()} { |
| @@ -49,6 +48,11 @@ MemoryManager::MemoryManager(Core::System& system_, u64 address_space_bits_, u64 | |||
| 49 | entries.resize(page_table_size / 32, 0); | 48 | entries.resize(page_table_size / 32, 0); |
| 50 | } | 49 | } |
| 51 | 50 | ||
| 51 | MemoryManager::MemoryManager(Core::System& system_, u64 address_space_bits_, u64 big_page_bits_, | ||
| 52 | u64 page_bits_) | ||
| 53 | : MemoryManager(system_, system_.Host1x().MemoryManager(), address_space_bits_, big_page_bits_, | ||
| 54 | page_bits_) {} | ||
| 55 | |||
| 52 | MemoryManager::~MemoryManager() = default; | 56 | MemoryManager::~MemoryManager() = default; |
| 53 | 57 | ||
| 54 | template <bool is_big_page> | 58 | template <bool is_big_page> |
diff --git a/src/video_core/memory_manager.h b/src/video_core/memory_manager.h index e2912a73f..6b2cd7efb 100644 --- a/src/video_core/memory_manager.h +++ b/src/video_core/memory_manager.h | |||
| @@ -38,6 +38,8 @@ 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, | ||
| 42 | u64 big_page_bits_ = 16, u64 page_bits_ = 12); | ||
| 41 | ~MemoryManager(); | 43 | ~MemoryManager(); |
| 42 | 44 | ||
| 43 | size_t GetID() const { | 45 | size_t GetID() const { |