Kernel: Expose boot framebuffer device

This commit is contained in:
Bananymous 2025-10-27 17:28:17 +02:00
parent 37aef630d2
commit f519cb2cc0
2 changed files with 9 additions and 0 deletions

View File

@ -10,6 +10,7 @@ namespace Kernel
{ {
public: public:
static BAN::ErrorOr<BAN::RefPtr<FramebufferDevice>> create_from_boot_framebuffer(); static BAN::ErrorOr<BAN::RefPtr<FramebufferDevice>> create_from_boot_framebuffer();
static BAN::RefPtr<FramebufferDevice> boot_framebuffer();
~FramebufferDevice(); ~FramebufferDevice();
uint32_t width() const { return m_width; } uint32_t width() const { return m_width; }

View File

@ -12,12 +12,19 @@
namespace Kernel namespace Kernel
{ {
static BAN::RefPtr<FramebufferDevice> s_boot_framebuffer;
static uint32_t get_framebuffer_device_index() static uint32_t get_framebuffer_device_index()
{ {
static uint32_t index = 0; static uint32_t index = 0;
return index++; return index++;
} }
BAN::RefPtr<FramebufferDevice> FramebufferDevice::boot_framebuffer()
{
return s_boot_framebuffer;
}
BAN::ErrorOr<BAN::RefPtr<FramebufferDevice>> FramebufferDevice::create_from_boot_framebuffer() BAN::ErrorOr<BAN::RefPtr<FramebufferDevice>> FramebufferDevice::create_from_boot_framebuffer()
{ {
ASSERT(g_boot_info.framebuffer.type == FramebufferInfo::Type::RGB); ASSERT(g_boot_info.framebuffer.type == FramebufferInfo::Type::RGB);
@ -37,6 +44,7 @@ namespace Kernel
auto device = BAN::RefPtr<FramebufferDevice>::adopt(device_ptr); auto device = BAN::RefPtr<FramebufferDevice>::adopt(device_ptr);
TRY(device->initialize()); TRY(device->initialize());
DevFileSystem::get().add_device(device); DevFileSystem::get().add_device(device);
s_boot_framebuffer = device;
return device; return device;
} }