mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 19:00:14 -05:00
nvdrv: clean up preallocation
This commit is contained in:
parent
b6c6534c30
commit
32f623e029
1 changed files with 5 additions and 3 deletions
|
@ -41,6 +41,8 @@ Container::Container(Tegra::Host1x::Host1x& host1x_) {
|
||||||
Container::~Container() = default;
|
Container::~Container() = default;
|
||||||
|
|
||||||
SessionId Container::OpenSession(Kernel::KProcess* process) {
|
SessionId Container::OpenSession(Kernel::KProcess* process) {
|
||||||
|
using namespace Common::Literals;
|
||||||
|
|
||||||
std::scoped_lock lk(impl->session_guard);
|
std::scoped_lock lk(impl->session_guard);
|
||||||
for (auto& session : impl->sessions) {
|
for (auto& session : impl->sessions) {
|
||||||
if (!session.is_active) {
|
if (!session.is_active) {
|
||||||
|
@ -79,7 +81,7 @@ SessionId Container::OpenSession(Kernel::KProcess* process) {
|
||||||
cur_addr));
|
cur_addr));
|
||||||
auto svc_mem_info = mem_info.GetSvcMemoryInfo();
|
auto svc_mem_info = mem_info.GetSvcMemoryInfo();
|
||||||
|
|
||||||
// check if this memory block is heap
|
// Check if this memory block is heap.
|
||||||
if (svc_mem_info.state == Kernel::Svc::MemoryState::Normal) {
|
if (svc_mem_info.state == Kernel::Svc::MemoryState::Normal) {
|
||||||
if (svc_mem_info.size > region_size) {
|
if (svc_mem_info.size > region_size) {
|
||||||
region_size = svc_mem_info.size;
|
region_size = svc_mem_info.size;
|
||||||
|
@ -96,13 +98,13 @@ SessionId Container::OpenSession(Kernel::KProcess* process) {
|
||||||
cur_addr = next_address;
|
cur_addr = next_address;
|
||||||
}
|
}
|
||||||
session.has_preallocated_area = false;
|
session.has_preallocated_area = false;
|
||||||
auto start_region = (region_size >> 15) >= 1024 ? smmu.Allocate(region_size) : 0;
|
auto start_region = region_size >= 32_MiB ? smmu.Allocate(region_size) : 0;
|
||||||
if (start_region != 0) {
|
if (start_region != 0) {
|
||||||
session.mapper = std::make_unique<HeapMapper>(region_start, start_region, region_size,
|
session.mapper = std::make_unique<HeapMapper>(region_start, start_region, region_size,
|
||||||
asid, impl->host1x);
|
asid, impl->host1x);
|
||||||
smmu.TrackContinuity(start_region, region_start, region_size, asid);
|
smmu.TrackContinuity(start_region, region_start, region_size, asid);
|
||||||
session.has_preallocated_area = true;
|
session.has_preallocated_area = true;
|
||||||
LOG_CRITICAL(Debug, "Preallocation created!");
|
LOG_DEBUG(Debug, "Preallocation created!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return SessionId{new_id};
|
return SessionId{new_id};
|
||||||
|
|
Loading…
Reference in a new issue