ptos: bpal: Obtain framebuffer information
Signed-off-by: Chloe M. <chloe@yiffware.org>
This commit is contained in:
@@ -12,14 +12,33 @@
|
||||
#include <ptapi/status.h>
|
||||
#include <ptdef.h>
|
||||
|
||||
/*
|
||||
* Represents a framebuffer
|
||||
*/
|
||||
typedef struct {
|
||||
VOID *Address;
|
||||
UQUAD Width;
|
||||
UQUAD Height;
|
||||
UQUAD Pitch;
|
||||
SHORT Bpp;
|
||||
UCHAR RedMaskSize;
|
||||
UCHAR RedMaskShift;
|
||||
UCHAR GreenMaskSize;
|
||||
UCHAR GreenMaskShift;
|
||||
UCHAR BlueMaskSize;
|
||||
UCHAR BlueMaskShift;
|
||||
} BPAL_FRAMEBUFFER;
|
||||
|
||||
/*
|
||||
* Represents a handle for the boot protocol abstraction
|
||||
* layer containing data filled in by the bootloader.
|
||||
*
|
||||
* @KernelBase: Represents the kernel load base
|
||||
* @Framebuffer: Framebuffer information
|
||||
*/
|
||||
typedef struct {
|
||||
UPTR KernelBase;
|
||||
BPAL_FRAMEBUFFER Framebuffer;
|
||||
} BPAL_HANDLE;
|
||||
|
||||
/*
|
||||
|
||||
@@ -9,6 +9,15 @@
|
||||
#include <ke/bpal.h>
|
||||
#include <lib/limine.h>
|
||||
|
||||
#define FRAMEBUFFER FbResp->framebuffers[0]
|
||||
|
||||
/* Framebuffer request */
|
||||
static struct limine_framebuffer_response *FbResp = NULL;
|
||||
static struct limine_framebuffer_request FbReq = {
|
||||
.id = LIMINE_FRAMEBUFFER_REQUEST_ID,
|
||||
.revision = 0
|
||||
};
|
||||
|
||||
/* HHDM request */
|
||||
static struct limine_hhdm_response *HHDMResp = NULL;
|
||||
static volatile struct limine_hhdm_request HHDMReq = {
|
||||
@@ -16,6 +25,28 @@ static volatile struct limine_hhdm_request HHDMReq = {
|
||||
.revision = 0
|
||||
};
|
||||
|
||||
VOID
|
||||
BpalInitFramebuffer(BPAL_HANDLE *Handle)
|
||||
{
|
||||
BPAL_FRAMEBUFFER *Framebuffer;
|
||||
|
||||
if (Handle == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
Framebuffer = &Handle->Framebuffer;
|
||||
Framebuffer->Address = FRAMEBUFFER->address;
|
||||
Framebuffer->Width = FRAMEBUFFER->width;
|
||||
Framebuffer->Height = FRAMEBUFFER->height;
|
||||
Framebuffer->Pitch = FRAMEBUFFER->pitch;
|
||||
Framebuffer->RedMaskSize = FRAMEBUFFER->red_mask_size;
|
||||
Framebuffer->RedMaskShift = FRAMEBUFFER->red_mask_shift;
|
||||
Framebuffer->GreenMaskSize = FRAMEBUFFER->green_mask_size;
|
||||
Framebuffer->GreenMaskShift = FRAMEBUFFER->green_mask_shift;
|
||||
Framebuffer->BlueMaskSize = FRAMEBUFFER->blue_mask_size;
|
||||
Framebuffer->BlueMaskShift = FRAMEBUFFER->blue_mask_shift;
|
||||
}
|
||||
|
||||
VOID
|
||||
KeBpalLimineInit(BPAL_HANDLE *Result)
|
||||
{
|
||||
@@ -24,5 +55,8 @@ KeBpalLimineInit(BPAL_HANDLE *Result)
|
||||
}
|
||||
|
||||
HHDMResp = HHDMReq.response;
|
||||
FbResp = FbReq.response;
|
||||
|
||||
Result->KernelBase = HHDMResp->offset;
|
||||
BpalInitFramebuffer(Result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user