aboutsummaryrefslogtreecommitdiffstats
path: root/src/ppu.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ppu.c')
-rw-r--r--src/ppu.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/ppu.c b/src/ppu.c
index 99574d7..2e0404f 100644
--- a/src/ppu.c
+++ b/src/ppu.c
@@ -2,8 +2,14 @@
2 2
3static u32 *framebuffer = 0; 3static u32 *framebuffer = 0;
4 4
5#define SCREEN_WIDTH 800
6#define SCREEN_HEIGHT 600
7
8static u32 palette[4];
9
5void 10void
6ppu_init(void) { 11ppu_init(void) {
12 // Initialize the framebuffer.
7 static MboxFramebufferRequest fb_request = { 13 static MboxFramebufferRequest fb_request = {
8 .buf_size = 96, 14 .buf_size = 96,
9 .code = MBOX_REQUEST, 15 .code = MBOX_REQUEST,
@@ -12,16 +18,16 @@ ppu_init(void) {
12 .id = 0x48003, 18 .id = 0x48003,
13 .buf_size = 8, 19 .buf_size = 8,
14 }, 20 },
15 .width = 1024, 21 .width = SCREEN_WIDTH,
16 .height = 1024, 22 .height = SCREEN_HEIGHT,
17 }, 23 },
18 .virtual_screen_tag = { 24 .virtual_screen_tag = {
19 .header = { 25 .header = {
20 .id = 0x48004, 26 .id = 0x48004,
21 .buf_size = 8, 27 .buf_size = 8,
22 }, 28 },
23 .width = 1024, 29 .width = SCREEN_WIDTH,
24 .height = 1024, 30 .height = SCREEN_HEIGHT,
25 }, 31 },
26 .depth_tag = { 32 .depth_tag = {
27 .header = { 33 .header = {
@@ -45,10 +51,14 @@ ppu_init(void) {
45 && fb_request.framebuffer_tag.fb_addr != 0) { 51 && fb_request.framebuffer_tag.fb_addr != 0) {
46 fb_request.framebuffer_tag.fb_addr &= 0x3FFFFFFF; 52 fb_request.framebuffer_tag.fb_addr &= 0x3FFFFFFF;
47 framebuffer = (u32*)((uintptr_t)fb_request.framebuffer_tag.fb_addr); 53 framebuffer = (u32*)((uintptr_t)fb_request.framebuffer_tag.fb_addr);
48 for (size_t i = 0; i < 1024 * 100; i++) {
49 framebuffer[i] = 0xffaa22; // 0xBBGGRR
50 }
51 } else { 54 } else {
52 uart_puts("Unable initialize framebuffer\n"); 55 uart_puts("Unable initialize framebuffer\n");
56 return;
53 } 57 }
58
59 // Initialize default palette.
60 palette[0] = 0x00444444;
61 palette[1] = 0x00ffffff;
62 palette[2] = 0x007777ff;
63 palette[3] = 0x00ff7777;
54} 64}