Get Framebuffer and its modes

This commit is contained in:
Jozef Nagy 2025-04-20 19:17:03 +02:00
parent 42cc0d9f40
commit 5c682c4209
Signed by untrusted user who does not match committer: crz
GPG key ID: 459A4811CEAC7068
5 changed files with 129 additions and 14 deletions

View file

@ -18,9 +18,7 @@
/*********************************************************************************/
#include <vfs/vfs.h>
#include <mm/mman.h>
#include <mm/vmm.h>
#include <proto/aurix.h>
#include <ui/ui.h>
#include <print.h>
void axboot_init()
@ -31,7 +29,5 @@ void axboot_init()
while (1);
}
aurix_load("\\System\\axkrnl");
while (1);
ui_init();
}

View file

@ -17,18 +17,40 @@
/* SOFTWARE. */
/*********************************************************************************/
#include <ui/framebuffer.h>
#include <print.h>
#include <stdint.h>
enum framebuffer_type {
FB_ARGB = 0,
FB_RGBA = 1,
};
struct ui_config {
uintptr_t framebuffer;
int framebuffer_type;
uintptr_t fb_addr;
struct fb_mode *fb_modes;
int total_modes;
int current_mode;
};
void init_ui()
struct ui_config config;
void ui_init()
{
struct fb_mode *available_fb_modes = NULL;
int total_modes = 0;
int current_mode = 0;
if (!get_framebuffer(&config.fb_addr, &config.fb_modes, &config.total_modes, &config.current_mode)) {
debug("Failed to acquire a framebuffer!\n");
while (1);
}
debug("Dumping framebuffer information\n");
debug("--------------------------------\n");
debug("Address: 0x%llx\n", config.fb_addr);
for (int i = 0; i < config.total_modes; i++) {
debug("\nMode %u:%s\n", i, (i == config.current_mode) ? " (current)" : "");
debug("Resolution: %ux%u\n", config.fb_modes[i].width, config.fb_modes[i].height);
debug("Bits Per Pixel: %u\n", config.fb_modes[i].bpp);
debug("Pitch: %u\n", config.fb_modes[i].pitch);
}
while(1);
}