fix: fix login wallpaper startup delay
This commit is contained in:
1 parent
21828990c4
commit
fdbb233cd3
12 files changed
+271
-32
No files matched your search
@@ -48,6 +48,10 @@ namespace Fs {
|
||||
{"/config/init.toml", false, montauk::abi::CAP_USER_ADMIN},
|
||||
{"/config/ssh.toml", false, montauk::abi::CAP_USER_ADMIN},
|
||||
{"/config/capabilities.toml",false, montauk::abi::CAP_USER_ADMIN},
|
||||
// Pre-scaled wallpaper the login screen blits before it has decoded
|
||||
// anything. It is drawn on a screen that is about to take a password,
|
||||
// so it must not be plantable by an unprivileged process.
|
||||
{"/config/wallpaper.cache", false, montauk::abi::CAP_USER_ADMIN},
|
||||
// Read by the Bluetooth driver at controller bring-up.
|
||||
{"/config/bluetooth.toml", false, montauk::abi::CAP_DEVICE_ADMIN},
|
||||
// Program images. Capability grants are keyed on binary path, so a
|
||||
|
||||
@@ -355,10 +355,18 @@ namespace Fs::Ramdisk {
|
||||
uint64_t newCap = entry.size;
|
||||
if (endOffset > newCap) newCap = endOffset;
|
||||
if (newCap < 256) newCap = 256;
|
||||
// Round up to next power of 2 for growth
|
||||
uint64_t rounded = 256;
|
||||
while (rounded < newCap) rounded *= 2;
|
||||
newCap = rounded;
|
||||
// Small files round to the next power of 2, so an appender grows
|
||||
// in a few steps. Large ones round to a page instead: the kernel
|
||||
// heap grows in physically contiguous runs, and doubling an 8 MiB
|
||||
// write into a 16 MiB block asks the frame allocator for twice the
|
||||
// contiguous span the file actually needs.
|
||||
if (newCap < 64 * 1024) {
|
||||
uint64_t rounded = 256;
|
||||
while (rounded < newCap) rounded *= 2;
|
||||
newCap = rounded;
|
||||
} else {
|
||||
newCap = (newCap + 0xFFFULL) & ~0xFFFULL;
|
||||
}
|
||||
|
||||
uint8_t* newBuf = (uint8_t*)Memory::g_heap->Request(newCap);
|
||||
if (newBuf == nullptr) return -1;
|
||||
@@ -374,8 +382,14 @@ namespace Fs::Ramdisk {
|
||||
|
||||
// Grow buffer if needed
|
||||
if (endOffset > entry.capacity) {
|
||||
uint64_t newCap = entry.capacity;
|
||||
while (newCap < endOffset) newCap *= 2;
|
||||
// Double while small, then grow in fixed 1 MiB steps. Doubling all
|
||||
// the way keeps growth amortized but overshoots badly on multi-MiB
|
||||
// files, and every byte of overshoot is a physically contiguous
|
||||
// kernel-heap run this file holds for the rest of the boot.
|
||||
static constexpr uint64_t MaxGrowStep = 1024 * 1024;
|
||||
uint64_t newCap = entry.capacity < 256 ? 256 : entry.capacity;
|
||||
while (newCap < endOffset)
|
||||
newCap += (newCap < MaxGrowStep) ? newCap : MaxGrowStep;
|
||||
|
||||
uint8_t* newBuf = (uint8_t*)Memory::g_heap->Request(newCap);
|
||||
if (newBuf == nullptr) return -1;
|
||||
|
||||
Reference in new issue
Block a user