aboutsummaryrefslogtreecommitdiff
path: root/src/userspace
diff options
context:
space:
mode:
authorMarvin Borner2019-12-14 00:26:49 +0100
committerMarvin Borner2019-12-14 00:26:49 +0100
commit31aaf43b77bb86d3668f6903ca48ffdb0812cfe2 (patch)
tree2365961919f39eedd6f9725610e5a9db2c9ba418 /src/userspace
parente7d88df7a5a7e11677b68303a0d05455bf9a60d6 (diff)
idk
Diffstat (limited to 'src/userspace')
-rw-r--r--src/userspace/graphics/framebuffer.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/userspace/graphics/framebuffer.c b/src/userspace/graphics/framebuffer.c
index f7b793b..17e841d 100644
--- a/src/userspace/graphics/framebuffer.c
+++ b/src/userspace/graphics/framebuffer.c
@@ -2,9 +2,9 @@
#include <graphics/graphics.h>
unsigned char *fb;
-int vbe_bpl = 3;
-int vbe_pitch = 3000;
-int vbe_height = 1080;
+int vbe_bpl = 4;
+int vbe_pitch = 10240;
+int vbe_height = 1600;
int vbe_width = 2560;
void vesa_draw_rectangle(int x1, int y1, int x2, int y2, const uint32_t color[3])
@@ -21,14 +21,33 @@ void vesa_draw_rectangle(int x1, int y1, int x2, int y2, const uint32_t color[3]
}
}
+void vesa_set_pixel(uint16_t x, uint16_t y, const uint32_t color[3])
+{
+ unsigned pos = x * vbe_bpl + y * vbe_pitch;
+ char *draw = (char *) &fb[pos];
+ draw[pos] = color[2];
+ draw[pos + 1] = color[1];
+ draw[pos + 2] = color[0];
+}
+
void vesa_clear()
{
- vesa_draw_rectangle(0, 0, vbe_width - 1, vbe_height - 1, 0);
+ uint32_t color[3] = {0, 0, 0};
+ vesa_draw_rectangle(0, 0, vbe_width - 1, vbe_height - 1, color);
}
void init_framebuffer()
{
struct userspace_pointers *pointers = (struct userspace_pointers *) syscall_get_pointers();
- fb = pointers->fb;
- vesa_clear();
+ fb = (unsigned char *) 0xfd000000;
+
+ uint32_t color[3] = {0xab, 0xb2, 0xbf};
+ vesa_set_pixel(50, 50, color);
+ vesa_set_pixel(50, 51, color);
+ vesa_set_pixel(50, 52, color);
+ vesa_set_pixel(50, 53, color);
+ vesa_set_pixel(50, 54, color);
+ vesa_set_pixel(50, 55, color);
+ vesa_set_pixel(50, 56, color);
+ vesa_set_pixel(50, 57, color);
} \ No newline at end of file