aboutsummaryrefslogtreecommitdiff
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
parentf95e042ce284510a78c7dab85f8053c966ff114e (diff)
Make changing resolution easier
-rw-r--r--README.md3
-rw-r--r--include/graphics/lfb.h2
-rw-r--r--kernel/graphics/lfb.c17
-rw-r--r--kernel/sys/core.c2
4 files changed, 11 insertions, 13 deletions
diff --git a/README.md b/README.md
index 098d8ca..25ce762 100644
--- a/README.md
+++ b/README.md
@@ -44,7 +44,8 @@ Headers for files in `usr/` are expected in `include/usr/`. They can then be inc
Currently, if you build Jobbed without modifying anything, it will generate the RTOS core testing suite.
This testing suite outputs the tracing, thread switch, low and high priority thread creation, mutex creation, mutex destruction, mutex locking contention, mutex locking non-contention, mutex unlocking, semaphore waiting, semaphore signalling at zero, semaphore signalling non-zero timings to a 1920x1080 display output.
-Currently the graphics driver expects this resolution of display. If you have another resolution, this can be changed in `kernel/graphics/lfb.c` by modifying `SCR_WIDTH` and `SCR_HEIGHT`.
+Currently the graphics driver expects this resolution of display.
+If you have another resolution, this can be changed in `kernel/sys/core.c` by modifying `lfb_init(1920, 1080)` to `lfb_init(YOUR WIDTH, YOUR HEIGHT)`.
### C++
C++ sources in this directory are expected to work with a few missing features such as the `new` and `delete` keywords since memory is not dynamically allocated on the system.
diff --git a/include/graphics/lfb.h b/include/graphics/lfb.h
index 8184959..dec9aad 100644
--- a/include/graphics/lfb.h
+++ b/include/graphics/lfb.h
@@ -6,7 +6,7 @@
#define DRAW64(x,y,v) draw_hex32(x,y,v>>32);draw_hex32(x+8,y,v);
-void lfb_init(void);
+void lfb_init(unsigned long w, unsigned long h);
void lfb_showpicture(void);
void clear_screen(void);
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