Compare commits
3 Commits
a6fc3cf7a6
...
1f5073d0ac
Author | SHA1 | Date |
---|---|---|
Bananymous | 1f5073d0ac | |
Bananymous | 8dbbbc1a1a | |
Bananymous | f985673dc3 |
|
@ -55,5 +55,6 @@ namespace Kernel
|
||||||
BAN::StringView get_early_boot_command_line(uint32_t magic, uint32_t info);
|
BAN::StringView get_early_boot_command_line(uint32_t magic, uint32_t info);
|
||||||
|
|
||||||
extern BootInfo g_boot_info;
|
extern BootInfo g_boot_info;
|
||||||
|
extern bool g_disable_disk_write;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ namespace Kernel
|
||||||
{
|
{
|
||||||
|
|
||||||
BootInfo g_boot_info;
|
BootInfo g_boot_info;
|
||||||
|
bool g_disable_disk_write { false };
|
||||||
|
|
||||||
static MemoryMapEntry::Type bios_number_to_memory_type(uint32_t number)
|
static MemoryMapEntry::Type bios_number_to_memory_type(uint32_t number)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include <kernel/BootInfo.h>
|
||||||
#include <kernel/Lock/LockGuard.h>
|
#include <kernel/Lock/LockGuard.h>
|
||||||
#include <kernel/Memory/Heap.h>
|
#include <kernel/Memory/Heap.h>
|
||||||
#include <kernel/Memory/PageTable.h>
|
#include <kernel/Memory/PageTable.h>
|
||||||
|
@ -105,6 +106,9 @@ namespace Kernel
|
||||||
|
|
||||||
BAN::ErrorOr<void> DiskCache::sync()
|
BAN::ErrorOr<void> DiskCache::sync()
|
||||||
{
|
{
|
||||||
|
if (g_disable_disk_write)
|
||||||
|
return {};
|
||||||
|
|
||||||
for (auto& cache : m_cache)
|
for (auto& cache : m_cache)
|
||||||
{
|
{
|
||||||
if (cache.dirty_mask == 0)
|
if (cache.dirty_mask == 0)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <BAN/ScopeGuard.h>
|
#include <BAN/ScopeGuard.h>
|
||||||
#include <BAN/StringView.h>
|
#include <BAN/StringView.h>
|
||||||
#include <BAN/UTF8.h>
|
#include <BAN/UTF8.h>
|
||||||
|
#include <kernel/BootInfo.h>
|
||||||
#include <kernel/FS/DevFS/FileSystem.h>
|
#include <kernel/FS/DevFS/FileSystem.h>
|
||||||
#include <kernel/FS/VirtualFileSystem.h>
|
#include <kernel/FS/VirtualFileSystem.h>
|
||||||
#include <kernel/Lock/LockGuard.h>
|
#include <kernel/Lock/LockGuard.h>
|
||||||
|
@ -265,6 +266,13 @@ namespace Kernel
|
||||||
|
|
||||||
LockGuard _(m_mutex);
|
LockGuard _(m_mutex);
|
||||||
|
|
||||||
|
if (g_disable_disk_write)
|
||||||
|
{
|
||||||
|
if (!m_disk_cache.has_value())
|
||||||
|
return BAN::Error::from_errno(EIO);
|
||||||
|
return m_disk_cache->write_to_cache(lba, buffer, true);
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_disk_cache.has_value())
|
if (!m_disk_cache.has_value())
|
||||||
return write_sectors_impl(lba, sector_count, buffer);
|
return write_sectors_impl(lba, sector_count, buffer);
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,8 @@ static void parse_command_line()
|
||||||
cmdline.disable_usb = true;
|
cmdline.disable_usb = true;
|
||||||
else if (argument == "noacpi")
|
else if (argument == "noacpi")
|
||||||
cmdline.disable_acpi = true;
|
cmdline.disable_acpi = true;
|
||||||
|
else if (argument == "readonly")
|
||||||
|
Kernel::g_disable_disk_write = true;
|
||||||
else if (argument == "nodebug")
|
else if (argument == "nodebug")
|
||||||
g_disable_debug = true;
|
g_disable_debug = true;
|
||||||
else if (argument.starts_with("ps2="))
|
else if (argument.starts_with("ps2="))
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
From 70c235938f0b64c4f08a478d3107e5254ad904c6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Bananymous <bananymousosq@gmail.com>
|
||||||
|
Date: Wed, 27 Nov 2024 13:28:42 +0200
|
||||||
|
Subject: [PATCH] Remove unnecessary copy from framebuffer
|
||||||
|
|
||||||
|
---
|
||||||
|
doomgeneric/doomgeneric.c | 2 --
|
||||||
|
doomgeneric/doomgeneric_banan_os.cpp | 6 +++---
|
||||||
|
2 files changed, 3 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/doomgeneric/doomgeneric.c b/doomgeneric/doomgeneric.c
|
||||||
|
index 782a7e7..f4eb63e 100644
|
||||||
|
--- a/doomgeneric/doomgeneric.c
|
||||||
|
+++ b/doomgeneric/doomgeneric.c
|
||||||
|
@@ -18,8 +18,6 @@ void doomgeneric_Create(int argc, char **argv)
|
||||||
|
|
||||||
|
M_FindResponseFile();
|
||||||
|
|
||||||
|
- DG_ScreenBuffer = malloc(DOOMGENERIC_RESX * DOOMGENERIC_RESY * 4);
|
||||||
|
-
|
||||||
|
DG_Init();
|
||||||
|
|
||||||
|
D_DoomMain ();
|
||||||
|
diff --git a/doomgeneric/doomgeneric_banan_os.cpp b/doomgeneric/doomgeneric_banan_os.cpp
|
||||||
|
index d00c30d..9d13b43 100644
|
||||||
|
--- a/doomgeneric/doomgeneric_banan_os.cpp
|
||||||
|
+++ b/doomgeneric/doomgeneric_banan_os.cpp
|
||||||
|
@@ -80,13 +80,13 @@ void DG_Init()
|
||||||
|
s_key_write_index = (s_key_write_index + 1) % s_key_queue_size;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
+
|
||||||
|
+ ASSERT(DG_ScreenBuffer == nullptr);
|
||||||
|
+ DG_ScreenBuffer = s_window->pixels().data();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DG_DrawFrame()
|
||||||
|
{
|
||||||
|
- for (size_t y = 0; y < DOOMGENERIC_RESY; y++)
|
||||||
|
- for (size_t x = 0; x < DOOMGENERIC_RESX; x++)
|
||||||
|
- s_window->set_pixel(x, y, 0xFF000000 | DG_ScreenBuffer[y * DOOMGENERIC_RESX + x]);
|
||||||
|
s_window->invalidate();
|
||||||
|
s_window->poll_events();
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.47.1
|
||||||
|
|
|
@ -43,6 +43,8 @@ namespace LibGUI
|
||||||
return m_framebuffer[y * m_width + x];
|
return m_framebuffer[y * m_width + x];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BAN::Span<uint32_t> pixels() { return m_framebuffer.span(); }
|
||||||
|
|
||||||
void fill_rect(int32_t x, int32_t y, uint32_t width, uint32_t height, uint32_t color);
|
void fill_rect(int32_t x, int32_t y, uint32_t width, uint32_t height, uint32_t color);
|
||||||
void fill(uint32_t color) { return fill_rect(0, 0, width(), height(), color); }
|
void fill(uint32_t color) { return fill_rect(0, 0, width(), height(), color); }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue