summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimon Kruiper <timonkruiper@gmail.com>2022-09-21 17:20:23 +0200
committerAndreas Kling <kling@serenityos.org>2022-10-01 14:09:01 +0200
commit779a1d12327c3954cc8ab80a36a3dc563087a0f4 (patch)
treedbf04189058046f8483d2abe574166b9d4b52fb2
parent15b818cd576cac1e115ced5c69ad79cbea2345fe (diff)
downloadserenity-779a1d12327c3954cc8ab80a36a3dc563087a0f4.zip
Kernel/aarch64: Get framebuffer data from BootFramebufferConsole
The BootFramebufferConsole class maps the framebuffer using the MemoryManager, so to be able to draw the logo, we need to get this mapped framebuffer. This commit adds a unsafe API for that.
-rw-r--r--Kernel/Arch/aarch64/init.cpp8
-rw-r--r--Kernel/Graphics/Console/BootFramebufferConsole.h2
2 files changed, 6 insertions, 4 deletions
diff --git a/Kernel/Arch/aarch64/init.cpp b/Kernel/Arch/aarch64/init.cpp
index f41ad34a63..b2a1029225 100644
--- a/Kernel/Arch/aarch64/init.cpp
+++ b/Kernel/Arch/aarch64/init.cpp
@@ -76,7 +76,7 @@ READONLY_AFTER_INIT bool g_in_early_boot;
namespace Kernel {
-static void draw_logo();
+static void draw_logo(u8* framebuffer_data);
static u32 query_firmware_version();
extern "C" [[noreturn]] void halt();
@@ -143,7 +143,7 @@ extern "C" [[noreturn]] void init()
auto& framebuffer = RPi::Framebuffer::the();
if (framebuffer.initialized()) {
g_boot_console = &try_make_lock_ref_counted<Graphics::BootFramebufferConsole>(PhysicalAddress((PhysicalPtr)framebuffer.gpu_buffer()), framebuffer.width(), framebuffer.height(), framebuffer.pitch()).value().leak_ref();
- draw_logo();
+ draw_logo(static_cast<Graphics::BootFramebufferConsole*>(g_boot_console.load())->unsafe_framebuffer_data());
}
initialize_interrupts();
@@ -196,7 +196,7 @@ static u32 query_firmware_version()
extern "C" const u32 serenity_boot_logo_start;
extern "C" const u32 serenity_boot_logo_size;
-static void draw_logo()
+static void draw_logo(u8* framebuffer_data)
{
BootPPMParser logo_parser(reinterpret_cast<u8 const*>(&serenity_boot_logo_start), serenity_boot_logo_size);
if (!logo_parser.parse()) {
@@ -207,7 +207,7 @@ static void draw_logo()
dbgln("Boot logo size: {} ({} x {})", serenity_boot_logo_size, logo_parser.image.width, logo_parser.image.height);
auto& framebuffer = RPi::Framebuffer::the();
- auto fb_ptr = framebuffer.gpu_buffer();
+ auto fb_ptr = framebuffer_data;
auto image_left = (framebuffer.width() - logo_parser.image.width) / 2;
auto image_right = image_left + logo_parser.image.width;
auto image_top = (framebuffer.height() - logo_parser.image.height) / 2;
diff --git a/Kernel/Graphics/Console/BootFramebufferConsole.h b/Kernel/Graphics/Console/BootFramebufferConsole.h
index f37ea6ccd5..b9819f5e12 100644
--- a/Kernel/Graphics/Console/BootFramebufferConsole.h
+++ b/Kernel/Graphics/Console/BootFramebufferConsole.h
@@ -23,6 +23,8 @@ public:
virtual void flush(size_t, size_t, size_t, size_t) override { }
virtual void set_resolution(size_t, size_t, size_t) override { }
+ u8* unsafe_framebuffer_data() { return m_framebuffer_data; }
+
BootFramebufferConsole(PhysicalAddress framebuffer_addr, size_t width, size_t height, size_t pitch);
private: