cleanup: rename Graphics:Cursor => Graphics::Framebuffer
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
#include <Timekeeping/ApicTimer.hpp>
|
||||
#include <Drivers/Graphics/IntelGPU.hpp>
|
||||
#include <Drivers/PS2/PS2Controller.hpp>
|
||||
#include <Graphics/Cursor.hpp>
|
||||
#include <Graphics/Framebuffer.hpp>
|
||||
#include <Libraries/Memory.hpp>
|
||||
#include <Hal/MSR.hpp>
|
||||
#include <Hal/SmpBoot.hpp>
|
||||
@@ -401,8 +401,8 @@ namespace Hal {
|
||||
|
||||
// Debug: green rectangle on framebuffer
|
||||
{
|
||||
uint32_t* fb = ::Graphics::Cursor::GetFramebufferBase();
|
||||
uint64_t pitch = ::Graphics::Cursor::GetFramebufferPitch();
|
||||
uint32_t* fb = ::Graphics::Framebuffer::GetBase();
|
||||
uint64_t pitch = ::Graphics::Framebuffer::GetPitch();
|
||||
if (fb && pitch > 0) {
|
||||
for (int y = 0; y < 32; y++) {
|
||||
uint32_t* row = (uint32_t*)((uint8_t*)fb + y * pitch);
|
||||
|
||||
@@ -12,4 +12,4 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define MONTAUK_BUILD_NUMBER 132
|
||||
#define MONTAUK_BUILD_NUMBER 134
|
||||
|
||||
+10
-10
@@ -9,7 +9,7 @@
|
||||
#include <Sched/Scheduler.hpp>
|
||||
#include <Memory/Paging.hpp>
|
||||
#include <Memory/HHDM.hpp>
|
||||
#include <Graphics/Cursor.hpp>
|
||||
#include <Graphics/Framebuffer.hpp>
|
||||
#include <Terminal/Terminal.hpp>
|
||||
|
||||
#include "Syscall.hpp"
|
||||
@@ -20,9 +20,9 @@ namespace montauk::abi {
|
||||
|
||||
static void Sys_FbInfo(FbInfo* out) {
|
||||
if (out == nullptr) return;
|
||||
out->width = Graphics::Cursor::GetFramebufferWidth();
|
||||
out->height = Graphics::Cursor::GetFramebufferHeight();
|
||||
out->pitch = Graphics::Cursor::GetFramebufferPitch();
|
||||
out->width = Graphics::Framebuffer::GetWidth();
|
||||
out->height = Graphics::Framebuffer::GetHeight();
|
||||
out->pitch = Graphics::Framebuffer::GetPitch();
|
||||
out->bpp = 32;
|
||||
out->userAddr = 0;
|
||||
}
|
||||
@@ -31,20 +31,20 @@ namespace montauk::abi {
|
||||
auto* proc = Sched::GetCurrentProcessPtr();
|
||||
if (proc == nullptr) return 0;
|
||||
|
||||
uint32_t* fbBase = Graphics::Cursor::GetFramebufferBase();
|
||||
uint32_t* fbBase = Graphics::Framebuffer::GetBase();
|
||||
if (fbBase == nullptr) return 0;
|
||||
|
||||
uint64_t fbPhys = Memory::SubHHDM((uint64_t)fbBase);
|
||||
uint64_t fbSize = Graphics::Cursor::GetFramebufferHeight()
|
||||
* Graphics::Cursor::GetFramebufferPitch();
|
||||
uint64_t fbSize = Graphics::Framebuffer::GetHeight()
|
||||
* Graphics::Framebuffer::GetPitch();
|
||||
uint64_t numPages = (fbSize + 0xFFF) / 0x1000;
|
||||
|
||||
Kt::KernelLogStream(Kt::INFO, "FbMap") << "fbPhys=" << kcp::hex << fbPhys
|
||||
<< " size=" << kcp::dec << fbSize
|
||||
<< " pages=" << numPages
|
||||
<< " (" << Graphics::Cursor::GetFramebufferWidth()
|
||||
<< "x" << Graphics::Cursor::GetFramebufferHeight()
|
||||
<< " pitch=" << Graphics::Cursor::GetFramebufferPitch() << ")";
|
||||
<< " (" << Graphics::Framebuffer::GetWidth()
|
||||
<< "x" << Graphics::Framebuffer::GetHeight()
|
||||
<< " pitch=" << Graphics::Framebuffer::GetPitch() << ")";
|
||||
|
||||
// Map at a fixed user VA
|
||||
constexpr uint64_t userVa = 0x50000000ULL;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <Efi/UEFI.hpp>
|
||||
#include <Memory/Paging.hpp>
|
||||
#include <Io/IoPort.hpp>
|
||||
#include <Graphics/Cursor.hpp>
|
||||
#include <Graphics/Framebuffer.hpp>
|
||||
#include <ACPI/AcpiShutdown.hpp>
|
||||
#include <ACPI/AcpiSleep.hpp>
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <Memory/Paging.hpp>
|
||||
#include <Memory/PageFrameAllocator.hpp>
|
||||
#include <Io/IoPort.hpp>
|
||||
#include <Graphics/Cursor.hpp>
|
||||
#include <Graphics/Framebuffer.hpp>
|
||||
|
||||
using namespace Kt;
|
||||
|
||||
@@ -266,9 +266,9 @@ namespace Drivers::Graphics::IntelGPU {
|
||||
|
||||
// If we still don't have valid dimensions, fall back to the firmware framebuffer
|
||||
if (g_fbWidth == 0 || g_fbHeight == 0 || g_fbPitch == 0) {
|
||||
g_fbWidth = ::Graphics::Cursor::GetFramebufferWidth();
|
||||
g_fbHeight = ::Graphics::Cursor::GetFramebufferHeight();
|
||||
g_fbPitch = ::Graphics::Cursor::GetFramebufferPitch();
|
||||
g_fbWidth = ::Graphics::Framebuffer::GetWidth();
|
||||
g_fbHeight = ::Graphics::Framebuffer::GetHeight();
|
||||
g_fbPitch = ::Graphics::Framebuffer::GetPitch();
|
||||
|
||||
KernelLogStream(INFO, "IntelGPU") << "Using firmware framebuffer dimensions: "
|
||||
<< base::dec << g_fbWidth << "x" << g_fbHeight
|
||||
@@ -398,7 +398,7 @@ namespace Drivers::Graphics::IntelGPU {
|
||||
// This keeps the same physical memory that the firmware set up (contiguous
|
||||
// pages, already HHDM-mapped), so both kernel and userspace access continue
|
||||
// to work via the original virtual/physical addresses. No copy is needed.
|
||||
uint32_t* fwFb = ::Graphics::Cursor::GetFramebufferBase();
|
||||
uint32_t* fwFb = ::Graphics::Framebuffer::GetBase();
|
||||
if (fwFb == nullptr) {
|
||||
KernelLogStream(ERROR, "IntelGPU") << "No firmware framebuffer available";
|
||||
return false;
|
||||
@@ -570,9 +570,9 @@ namespace Drivers::Graphics::IntelGPU {
|
||||
ProgramDisplayPlane();
|
||||
g_initialized = true;
|
||||
|
||||
uint64_t fwWidth = ::Graphics::Cursor::GetFramebufferWidth();
|
||||
uint64_t fwHeight = ::Graphics::Cursor::GetFramebufferHeight();
|
||||
uint64_t fwPitch = ::Graphics::Cursor::GetFramebufferPitch();
|
||||
uint64_t fwWidth = ::Graphics::Framebuffer::GetWidth();
|
||||
uint64_t fwHeight = ::Graphics::Framebuffer::GetHeight();
|
||||
uint64_t fwPitch = ::Graphics::Framebuffer::GetPitch();
|
||||
|
||||
if (g_fbWidth != fwWidth || g_fbHeight != fwHeight || g_fbPitch != fwPitch) {
|
||||
KernelLogStream(WARNING, "IntelGPU") << "GPU dimensions differ from firmware!";
|
||||
@@ -633,9 +633,9 @@ namespace Drivers::Graphics::IntelGPU {
|
||||
g_initialized = true;
|
||||
|
||||
// Diagnostic: compare GPU-detected values with firmware/Limine values
|
||||
uint64_t fwWidth = ::Graphics::Cursor::GetFramebufferWidth();
|
||||
uint64_t fwHeight = ::Graphics::Cursor::GetFramebufferHeight();
|
||||
uint64_t fwPitch = ::Graphics::Cursor::GetFramebufferPitch();
|
||||
uint64_t fwWidth = ::Graphics::Framebuffer::GetWidth();
|
||||
uint64_t fwHeight = ::Graphics::Framebuffer::GetHeight();
|
||||
uint64_t fwPitch = ::Graphics::Framebuffer::GetPitch();
|
||||
|
||||
if (g_fbWidth != fwWidth || g_fbHeight != fwHeight || g_fbPitch != fwPitch) {
|
||||
KernelLogStream(WARNING, "IntelGPU") << "GPU dimensions differ from firmware!";
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <Drivers/Storage/Nvme.hpp>
|
||||
#include <Drivers/Storage/Gpt.hpp>
|
||||
#include <Drivers/Audio/IntelHda.hpp>
|
||||
#include <Graphics/Cursor.hpp>
|
||||
#include <Graphics/Framebuffer.hpp>
|
||||
#include <Net/Net.hpp>
|
||||
#include <Terminal/Terminal.hpp>
|
||||
|
||||
@@ -176,7 +176,7 @@ namespace Drivers {
|
||||
|
||||
void InitializeGraphics() {
|
||||
if (Graphics::IntelGPU::IsInitialized()) {
|
||||
::Graphics::Cursor::SetFramebuffer(
|
||||
::Graphics::Framebuffer::Set(
|
||||
Graphics::IntelGPU::GetFramebufferBase(),
|
||||
Graphics::IntelGPU::GetWidth(),
|
||||
Graphics::IntelGPU::GetHeight(),
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Cursor.hpp
|
||||
* Framebuffer information storage
|
||||
* Copyright (c) 2025 Daniel Hammer
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <Boot/BootInfo.hpp>
|
||||
|
||||
namespace Graphics::Cursor {
|
||||
|
||||
void Initialize(const montauk::boot::Framebuffer& framebuffer);
|
||||
|
||||
uint32_t* GetFramebufferBase();
|
||||
uint64_t GetFramebufferWidth();
|
||||
uint64_t GetFramebufferHeight();
|
||||
uint64_t GetFramebufferPitch();
|
||||
|
||||
void SetFramebuffer(uint32_t* base, uint64_t width, uint64_t height, uint64_t pitch);
|
||||
uint64_t GetFramebufferPhysBase();
|
||||
|
||||
void MapWriteCombining();
|
||||
|
||||
};
|
||||
@@ -1,16 +1,16 @@
|
||||
/*
|
||||
* Cursor.cpp
|
||||
* Framebuffer.cpp
|
||||
* Framebuffer information storage
|
||||
* Copyright (c) 2025 Daniel Hammer
|
||||
*/
|
||||
|
||||
#include "Cursor.hpp"
|
||||
#include "Framebuffer.hpp"
|
||||
#include <Terminal/Terminal.hpp>
|
||||
#include <Memory/HHDM.hpp>
|
||||
#include <Memory/Paging.hpp>
|
||||
#include <CppLib/Stream.hpp>
|
||||
|
||||
namespace Graphics::Cursor {
|
||||
namespace Graphics::Framebuffer {
|
||||
|
||||
// Framebuffer state
|
||||
static uint32_t* g_FbBase = nullptr;
|
||||
@@ -28,12 +28,12 @@ namespace Graphics::Cursor {
|
||||
<< (uint64_t)g_FbWidth << "x" << (uint64_t)g_FbHeight << ")";
|
||||
}
|
||||
|
||||
uint32_t* GetFramebufferBase() { return g_FbBase; }
|
||||
uint64_t GetFramebufferWidth() { return g_FbWidth; }
|
||||
uint64_t GetFramebufferHeight() { return g_FbHeight; }
|
||||
uint64_t GetFramebufferPitch() { return g_FbPitch; }
|
||||
uint32_t* GetBase() { return g_FbBase; }
|
||||
uint64_t GetWidth() { return g_FbWidth; }
|
||||
uint64_t GetHeight() { return g_FbHeight; }
|
||||
uint64_t GetPitch() { return g_FbPitch; }
|
||||
|
||||
void SetFramebuffer(uint32_t* base, uint64_t width, uint64_t height, uint64_t pitch) {
|
||||
void Set(uint32_t* base, uint64_t width, uint64_t height, uint64_t pitch) {
|
||||
g_FbBase = base;
|
||||
g_FbWidth = width;
|
||||
g_FbHeight = height;
|
||||
@@ -42,12 +42,12 @@ namespace Graphics::Cursor {
|
||||
<< (uint64_t)g_FbWidth << "x" << (uint64_t)g_FbHeight << ")";
|
||||
}
|
||||
|
||||
uint64_t GetFramebufferPhysBase() {
|
||||
uint64_t GetPhysBase() {
|
||||
return Memory::SubHHDM((uint64_t)g_FbBase);
|
||||
}
|
||||
|
||||
void MapWriteCombining() {
|
||||
uint64_t fbPhys = GetFramebufferPhysBase();
|
||||
uint64_t fbPhys = GetPhysBase();
|
||||
uint64_t fbSize = g_FbHeight * g_FbPitch;
|
||||
uint64_t numPages = (fbSize + 0xFFF) / 0x1000;
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Framebuffer.hpp
|
||||
* Framebuffer information storage
|
||||
* Copyright (c) 2025 Daniel Hammer
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <Boot/BootInfo.hpp>
|
||||
|
||||
namespace Graphics::Framebuffer {
|
||||
|
||||
void Initialize(const montauk::boot::Framebuffer& framebuffer);
|
||||
|
||||
uint32_t* GetBase();
|
||||
uint64_t GetWidth();
|
||||
uint64_t GetHeight();
|
||||
uint64_t GetPitch();
|
||||
|
||||
void Set(uint32_t* base, uint64_t width, uint64_t height, uint64_t pitch);
|
||||
uint64_t GetPhysBase();
|
||||
|
||||
void MapWriteCombining();
|
||||
|
||||
};
|
||||
+4
-4
@@ -30,7 +30,7 @@
|
||||
#include <Drivers/PS2/Mouse.hpp>
|
||||
#include <Drivers/Init.hpp>
|
||||
#include <Drivers/USB/Bluetooth/Bluetooth.hpp>
|
||||
#include <Graphics/Cursor.hpp>
|
||||
#include <Graphics/Framebuffer.hpp>
|
||||
#include <Hal/MSR.hpp>
|
||||
#include <Hal/Cpu.hpp>
|
||||
#include <Fs/Boot.hpp>
|
||||
@@ -125,14 +125,14 @@ extern "C" void kmain() {
|
||||
|
||||
#endif
|
||||
|
||||
// Initialize Cursor early so we can WC-map the framebuffer before
|
||||
// Initialize the framebuffer early so we can WC-map it before
|
||||
// the bulk of boot logging begins (ACPI, PCI, drivers, etc.)
|
||||
Graphics::Cursor::Initialize(framebuffer);
|
||||
Graphics::Framebuffer::Initialize(framebuffer);
|
||||
|
||||
#if defined (__x86_64__)
|
||||
// Map framebuffer as Write-Combining immediately for faster screen writes.
|
||||
// All subsequent log output benefits from WC burst transfers.
|
||||
Graphics::Cursor::MapWriteCombining();
|
||||
Graphics::Framebuffer::MapWriteCombining();
|
||||
#endif
|
||||
|
||||
Hal::ACPI g_acpi((Hal::ACPI::XSDP*)Memory::HHDM(boot.rsdpPhysical));
|
||||
|
||||
@@ -69,9 +69,9 @@ namespace Memory::VMM {
|
||||
// just mapped (e.g. in the 32-bit MMIO hole), and it is not guaranteed
|
||||
// to appear as a memory-map region. It MUST be reachable through the
|
||||
// HHDM before we switch to these page tables, because the very next log
|
||||
// line (and PAT setup, and Cursor init) renders to it via phys+hhdmBase.
|
||||
// Map its pages explicitly (write-back for now; Cursor upgrades them to
|
||||
// write-combining once PAT is reprogrammed).
|
||||
// line (and PAT setup, and framebuffer init) renders to it via phys+hhdmBase.
|
||||
// Map its pages explicitly (write-back for now; the framebuffer module
|
||||
// upgrades them to write-combining once PAT is reprogrammed).
|
||||
if (framebuffer.address != 0) {
|
||||
uint64_t fbPhys = Memory::SubHHDM(framebuffer.address);
|
||||
uint64_t fbBytes = framebuffer.height * framebuffer.pitch;
|
||||
|
||||
@@ -201,8 +201,6 @@ namespace Kt {
|
||||
// Install our universal plot_char so rescaling works at any scale
|
||||
struct flanterm_fb_context *fbctx = (struct flanterm_fb_context *)ctx;
|
||||
fbctx->plot_char = plot_char_universal;
|
||||
|
||||
kout << "\n\n\n";
|
||||
}
|
||||
|
||||
void Putchar(char c) {
|
||||
|
||||
Reference in New Issue
Block a user