From 779a1d12327c3954cc8ab80a36a3dc563087a0f4 Mon Sep 17 00:00:00 2001 From: Timon Kruiper Date: Wed, 21 Sep 2022 17:20:23 +0200 Subject: 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. --- Kernel/Arch/aarch64/init.cpp | 8 ++++---- Kernel/Graphics/Console/BootFramebufferConsole.h | 2 ++ 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(PhysicalAddress((PhysicalPtr)framebuffer.gpu_buffer()), framebuffer.width(), framebuffer.height(), framebuffer.pitch()).value().leak_ref(); - draw_logo(); + draw_logo(static_cast(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(&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: -- cgit v1.2.3