aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-04-06 11:38:04 -0700
committerChristian Cunningham <cc@localhost>2022-04-06 11:38:04 -0700
commitc91e11c05885a62a9c3ef2bb5af5834edde959c9 (patch)
treef113a0526abd35dc4d5733fa1bccbc6c6b84272f /kernel
parentf95e042ce284510a78c7dab85f8053c966ff114e (diff)
Make changing resolution easier
Diffstat (limited to 'kernel')
-rw-r--r--kernel/graphics/lfb.c17
-rw-r--r--kernel/sys/core.c2
2 files changed, 8 insertions, 11 deletions
diff --git a/kernel/graphics/lfb.c b/kernel/graphics/lfb.c
index 8c41b1c..e76fccb 100644
--- a/kernel/graphics/lfb.c
+++ b/kernel/graphics/lfb.c
@@ -7,13 +7,10 @@
unsigned char *lfb; /* raw frame buffer address */
-#define SCR_WIDTH 1920
-#define SCR_HEIGHT 1080
-
/**
* Set screen resolution
*/
-void lfb_init(void)
+void lfb_init(unsigned long w, unsigned long h)
{
mbox[0] = 35*4;
mbox[1] = MBOX_REQUEST;
@@ -21,14 +18,14 @@ void lfb_init(void)
mbox[2] = 0x48003; //set phy wh
mbox[3] = 8;
mbox[4] = 8;
- mbox[5] = SCR_WIDTH; //FrameBufferInfo.width
- mbox[6] = SCR_HEIGHT; //FrameBufferInfo.height
+ mbox[5] = w; //FrameBufferInfo.width
+ mbox[6] = h; //FrameBufferInfo.height
mbox[7] = 0x48004; //set virt wh
mbox[8] = 8;
mbox[9] = 8;
- mbox[10] = SCR_WIDTH; //FrameBufferInfo.virtual_width
- mbox[11] = SCR_HEIGHT; //FrameBufferInfo.virtual_height
+ mbox[10] = w; //FrameBufferInfo.virtual_width
+ mbox[11] = h; //FrameBufferInfo.virtual_height
mbox[12] = 0x48009; //set virt offset
mbox[13] = 8;
@@ -92,8 +89,8 @@ void lfb_showpicture(void)
clear_screen();
#define FWIDTH 240
#define FHEIGHT 80
- draw_cbox(SCR_WIDTH-FWIDTH, SCR_HEIGHT-FHEIGHT*2, FWIDTH, FHEIGHT, 0x0057b7);
- draw_cbox(SCR_WIDTH-FWIDTH, SCR_HEIGHT-FHEIGHT, FWIDTH, FHEIGHT, 0xffd700);
+ draw_cbox(gwidth-FWIDTH, gheight-FHEIGHT*2, FWIDTH, FHEIGHT, 0x0057b7);
+ draw_cbox(gwidth-FWIDTH, gheight-FHEIGHT, FWIDTH, FHEIGHT, 0xffd700);
}
void draw_cpixel(unsigned int lx, unsigned int ly, unsigned int c)
diff --git a/kernel/sys/core.c b/kernel/sys/core.c
index 551d741..2169b7e 100644
--- a/kernel/sys/core.c
+++ b/kernel/sys/core.c
@@ -29,7 +29,7 @@ void sysinit(void)
store32(0x00, GPU_INTERRUPTS_ROUTING);
// Graphics Initialize
- lfb_init();
+ lfb_init(1920, 1080);
lfb_showpicture();
// Initialize Memory Management Unit