From b2211a7e1373eab75b4113102582966282be3b45 Mon Sep 17 00:00:00 2001 From: mintsuki Date: Sun, 20 Mar 2022 19:11:22 +0100 Subject: [PATCH] Revert "limine: Move framebuffer request to using SoA" This reverts commit 76b9312d725b30fb678b2f8e2b16276ee1e9ba1b. --- common/limine.h | 36 ++++++++++++++---------- common/protos/limine.c | 62 ++++++++++++------------------------------ test/limine.c | 33 +++++++++++----------- 3 files changed, 55 insertions(+), 76 deletions(-) diff --git a/common/limine.h b/common/limine.h index 2c87857b..c9adb9b9 100644 --- a/common/limine.h +++ b/common/limine.h @@ -67,24 +67,30 @@ struct limine_hhdm_request { #define LIMINE_FRAMEBUFFER_RGB 1 +struct limine_framebuffer { + LIMINE_PTR(void *) address; + uint16_t width; + uint16_t height; + uint16_t pitch; + uint16_t bpp; + uint8_t memory_model; + uint8_t red_mask_size; + uint8_t red_mask_shift; + uint8_t green_mask_size; + uint8_t green_mask_shift; + uint8_t blue_mask_size; + uint8_t blue_mask_shift; + uint8_t unused; + uint64_t edid_size; + LIMINE_PTR(void *) edid; + uint8_t reserved[256]; +}; + struct limine_framebuffer_response { uint64_t revision; - uint64_t fb_count; - LIMINE_PTR(LIMINE_PTR(void *) *) fb_address; - LIMINE_PTR(uint16_t *) fb_width; - LIMINE_PTR(uint16_t *) fb_height; - LIMINE_PTR(uint16_t *) fb_pitch; - LIMINE_PTR(uint16_t *) fb_bpp; - LIMINE_PTR(uint8_t *) fb_memory_model; - LIMINE_PTR(uint8_t *) fb_red_mask_size; - LIMINE_PTR(uint8_t *) fb_red_mask_shift; - LIMINE_PTR(uint8_t *) fb_green_mask_size; - LIMINE_PTR(uint8_t *) fb_green_mask_shift; - LIMINE_PTR(uint8_t *) fb_blue_mask_size; - LIMINE_PTR(uint8_t *) fb_blue_mask_shift; - LIMINE_PTR(uint64_t *) fb_edid_size; - LIMINE_PTR(LIMINE_PTR(void *) *) fb_edid; + uint64_t fbs_count; + LIMINE_PTR(struct limine_framebuffer *) fbs; }; struct limine_framebuffer_request { diff --git a/common/protos/limine.c b/common/protos/limine.c index e2d9b568..a5788bae 100644 --- a/common/protos/limine.c +++ b/common/protos/limine.c @@ -439,56 +439,28 @@ FEAT_START ext_mem_alloc(sizeof(struct limine_framebuffer_response)); // For now we only support 1 framebuffer - size_t fb_count = 1; - uint64_t *fb_address = ext_mem_alloc(sizeof(uint64_t) * fb_count); - uint16_t *fb_width = ext_mem_alloc(sizeof(uint16_t) * fb_count); - uint16_t *fb_height = ext_mem_alloc(sizeof(uint16_t) * fb_count); - uint16_t *fb_pitch = ext_mem_alloc(sizeof(uint16_t) * fb_count); - uint16_t *fb_bpp = ext_mem_alloc(sizeof(uint16_t) * fb_count); - uint8_t *fb_memory_model = ext_mem_alloc(sizeof(uint8_t) * fb_count); - uint8_t *fb_red_mask_size = ext_mem_alloc(sizeof(uint8_t) * fb_count); - uint8_t *fb_red_mask_shift = ext_mem_alloc(sizeof(uint8_t) * fb_count); - uint8_t *fb_green_mask_size = ext_mem_alloc(sizeof(uint8_t) * fb_count); - uint8_t *fb_green_mask_shift = ext_mem_alloc(sizeof(uint8_t) * fb_count); - uint8_t *fb_blue_mask_size = ext_mem_alloc(sizeof(uint8_t) * fb_count); - uint8_t *fb_blue_mask_shift = ext_mem_alloc(sizeof(uint8_t) * fb_count); - uint64_t *fb_edid_size = ext_mem_alloc(sizeof(uint64_t) * fb_count); - uint64_t *fb_edid = ext_mem_alloc(sizeof(uint64_t) * fb_count); - - framebuffer_response->fb_count = fb_count; - framebuffer_response->fb_address = reported_addr(fb_address); - framebuffer_response->fb_width = reported_addr(fb_width); - framebuffer_response->fb_height = reported_addr(fb_height); - framebuffer_response->fb_pitch = reported_addr(fb_pitch); - framebuffer_response->fb_bpp = reported_addr(fb_bpp); - framebuffer_response->fb_memory_model = reported_addr(fb_memory_model); - framebuffer_response->fb_red_mask_size = reported_addr(fb_red_mask_size); - framebuffer_response->fb_red_mask_shift = reported_addr(fb_red_mask_shift); - framebuffer_response->fb_green_mask_size = reported_addr(fb_green_mask_size); - framebuffer_response->fb_green_mask_shift = reported_addr(fb_green_mask_shift); - framebuffer_response->fb_blue_mask_size = reported_addr(fb_blue_mask_size); - framebuffer_response->fb_blue_mask_shift = reported_addr(fb_blue_mask_shift); - framebuffer_response->fb_edid_size = reported_addr(fb_edid_size); - framebuffer_response->fb_edid = reported_addr(fb_edid); + struct limine_framebuffer *fbp = ext_mem_alloc(sizeof(struct limine_framebuffer)); + framebuffer_response->fbs = reported_addr(fbp); + framebuffer_response->fbs_count = 1; struct edid_info_struct *edid_info = get_edid_info(); if (edid_info != NULL) { - *fb_edid_size = sizeof(struct edid_info_struct); - *fb_edid = reported_addr(edid_info); + fbp->edid_size = sizeof(struct edid_info_struct); + fbp->edid = reported_addr(edid_info); } - *fb_memory_model = LIMINE_FRAMEBUFFER_RGB; - *fb_address = reported_addr((void *)(uintptr_t)fb.framebuffer_addr); - *fb_width = fb.framebuffer_width; - *fb_height = fb.framebuffer_height; - *fb_bpp = fb.framebuffer_bpp; - *fb_pitch = fb.framebuffer_pitch; - *fb_red_mask_size = fb.red_mask_size; - *fb_red_mask_shift = fb.red_mask_shift; - *fb_green_mask_size = fb.green_mask_size; - *fb_green_mask_shift = fb.green_mask_shift; - *fb_blue_mask_size = fb.blue_mask_size; - *fb_blue_mask_shift = fb.blue_mask_shift; + fbp->memory_model = LIMINE_FRAMEBUFFER_RGB; + fbp->address = reported_addr((void *)(uintptr_t)fb.framebuffer_addr); + fbp->width = fb.framebuffer_width; + fbp->height = fb.framebuffer_height; + fbp->bpp = fb.framebuffer_bpp; + fbp->pitch = fb.framebuffer_pitch; + fbp->red_mask_size = fb.red_mask_size; + fbp->red_mask_shift = fb.red_mask_shift; + fbp->green_mask_size = fb.green_mask_size; + fbp->green_mask_shift = fb.green_mask_shift; + fbp->blue_mask_size = fb.blue_mask_size; + fbp->blue_mask_shift = fb.blue_mask_shift; framebuffer_request->response = reported_addr(framebuffer_response); FEAT_END diff --git a/test/limine.c b/test/limine.c index 46e92791..71f9d231 100644 --- a/test/limine.c +++ b/test/limine.c @@ -182,22 +182,23 @@ FEAT_START break; } struct limine_framebuffer_response *fb_response = framebuffer_request.response; - e9_printf("%d framebuffer(s)", fb_response->fb_count); - for (size_t i = 0; i < fb_response->fb_count; i++) { - e9_printf("Address: %x", fb_response->fb_address[i]); - e9_printf("Width: %d", fb_response->fb_width[i]); - e9_printf("Height: %d", fb_response->fb_height[i]); - e9_printf("Pitch: %d", fb_response->fb_pitch[i]); - e9_printf("BPP: %d", fb_response->fb_bpp[i]); - e9_printf("Memory model: %d", fb_response->fb_memory_model[i]); - e9_printf("Red mask size: %d", fb_response->fb_red_mask_size[i]); - e9_printf("Red mask shift: %d", fb_response->fb_red_mask_shift[i]); - e9_printf("Green mask size: %d", fb_response->fb_green_mask_size[i]); - e9_printf("Green mask shift: %d", fb_response->fb_green_mask_shift[i]); - e9_printf("Blue mask size: %d", fb_response->fb_blue_mask_size[i]); - e9_printf("Blue mask shift: %d", fb_response->fb_blue_mask_shift[i]); - e9_printf("EDID size: %d", fb_response->fb_edid_size[i]); - e9_printf("EDID at: %x", fb_response->fb_edid[i]); + e9_printf("%d framebuffer(s)", fb_response->fbs_count); + for (size_t i = 0; i < fb_response->fbs_count; i++) { + struct limine_framebuffer *fb = &fb_response->fbs[i]; + e9_printf("Address: %x", fb->address); + e9_printf("Width: %d", fb->width); + e9_printf("Height: %d", fb->height); + e9_printf("Pitch: %d", fb->pitch); + e9_printf("BPP: %d", fb->bpp); + e9_printf("Memory model: %d", fb->memory_model); + e9_printf("Red mask size: %d", fb->red_mask_size); + e9_printf("Red mask shift: %d", fb->red_mask_shift); + e9_printf("Green mask size: %d", fb->green_mask_size); + e9_printf("Green mask shift: %d", fb->green_mask_shift); + e9_printf("Blue mask size: %d", fb->blue_mask_size); + e9_printf("Blue mask shift: %d", fb->blue_mask_shift); + e9_printf("EDID size: %d", fb->edid_size); + e9_printf("EDID at: %x", fb->edid); } FEAT_END