Revert "lib/fb: Add preserve_screen option to skip fb_clear on init"
This reverts commit 2e2fc63628d95644c0065c265b4cde2a3f3bc1da.
diff --git a/common/drivers/gop.c b/common/drivers/gop.c
index 2f4726be..59fa374c 100644
--- a/common/drivers/gop.c
+++ b/common/drivers/gop.c
@@ -127,7 +127,7 @@ bool gop_force_16 = false;
static bool try_mode(struct fb_info *ret, EFI_GRAPHICS_OUTPUT_PROTOCOL *gop,
size_t mode, uint64_t width, uint64_t height, int bpp,
struct fb_info *fbs, size_t fbs_count,
- bool *setmode_called, bool preserve_screen) {
+ bool *setmode_called) {
EFI_STATUS status;
if (!mode_to_fb_info(ret, gop, mode)) {
@@ -181,9 +181,7 @@ static bool try_mode(struct fb_info *ret, EFI_GRAPHICS_OUTPUT_PROTOCOL *gop,
ret->framebuffer_addr = gop->Mode->FrameBufferBase;
- if (!preserve_screen) {
- fb_clear(ret);
- }
+ fb_clear(ret);
return true;
}
@@ -216,8 +214,7 @@ no_unwind static bool setmode_called[MAX_PRESET_MODES];
no_unwind static bool preset_modes_initialised = false;
void init_gop(struct fb_info **ret, size_t *_fbs_count,
- uint64_t target_width, uint64_t target_height, uint16_t target_bpp,
- bool preserve_screen) {
+ uint64_t target_width, uint64_t target_height, uint16_t target_bpp) {
if (preset_modes_initialised == false) {
for (size_t i = 0; i < MAX_PRESET_MODES; i++) {
preset_modes[i] = -1;
@@ -322,7 +319,7 @@ void init_gop(struct fb_info **ret, size_t *_fbs_count,
retry:
for (size_t j = 0; j < modes_count; j++) {
- if (try_mode(fb, gop, j, _target_width, _target_height, _target_bpp, *ret, fbs_count, &setmode_called[i], preserve_screen)) {
+ if (try_mode(fb, gop, j, _target_width, _target_height, _target_bpp, *ret, fbs_count, &setmode_called[i])) {
goto success;
}
}
@@ -349,7 +346,7 @@ fallback:
if (current_fallback == 1) {
current_fallback++;
- if (try_mode(fb, gop, preset_modes[i], 0, 0, 0, *ret, fbs_count, &setmode_called[i], preserve_screen)) {
+ if (try_mode(fb, gop, preset_modes[i], 0, 0, 0, *ret, fbs_count, &setmode_called[i])) {
goto success;
}
}
diff --git a/common/drivers/gop.h b/common/drivers/gop.h
index bf0c41de..24a463ab 100644
--- a/common/drivers/gop.h
+++ b/common/drivers/gop.h
@@ -9,8 +9,7 @@
#include <lib/fb.h>
void init_gop(struct fb_info **ret, size_t *_fbs_count,
- uint64_t target_width, uint64_t target_height, uint16_t target_bpp,
- bool preserve_screen);
+ uint64_t target_width, uint64_t target_height, uint16_t target_bpp);
extern bool gop_force_16;
diff --git a/common/drivers/vbe.c b/common/drivers/vbe.c
index eff5c000..735d16bf 100644
--- a/common/drivers/vbe.c
+++ b/common/drivers/vbe.c
@@ -231,8 +231,7 @@ struct fb_info *vbe_get_mode_list(size_t *count) {
}
bool init_vbe(struct fb_info *ret,
- uint16_t target_width, uint16_t target_height, uint16_t target_bpp,
- bool preserve_screen) {
+ uint16_t target_width, uint16_t target_height, uint16_t target_bpp) {
printv("vbe: Initialising...\n");
size_t current_fallback = 0;
@@ -344,9 +343,7 @@ retry:
continue;
}
- if (!preserve_screen) {
- fb_clear(ret);
- }
+ fb_clear(ret);
return true;
}
diff --git a/common/drivers/vbe.h b/common/drivers/vbe.h
index fbbdf937..f5da1f88 100644
--- a/common/drivers/vbe.h
+++ b/common/drivers/vbe.h
@@ -7,8 +7,7 @@
#include <lib/fb.h>
bool init_vbe(struct fb_info *ret,
- uint16_t target_width, uint16_t target_height, uint16_t target_bpp,
- bool preserve_screen);
+ uint16_t target_width, uint16_t target_height, uint16_t target_bpp);
struct fb_info *vbe_get_mode_list(size_t *count);
diff --git a/common/lib/fb.c b/common/lib/fb.c
index 4c64a81a..38ec277d 100644
--- a/common/lib/fb.c
+++ b/common/lib/fb.c
@@ -12,11 +12,10 @@ struct fb_info *fb_fbs;
size_t fb_fbs_count = 0;
void fb_init(struct fb_info **ret, size_t *_fbs_count,
- uint64_t target_width, uint64_t target_height, uint16_t target_bpp,
- bool preserve_screen) {
+ uint64_t target_width, uint64_t target_height, uint16_t target_bpp) {
#if defined (BIOS)
*ret = ext_mem_alloc(sizeof(struct fb_info));
- if (init_vbe(*ret, target_width, target_height, target_bpp, preserve_screen)) {
+ if (init_vbe(*ret, target_width, target_height, target_bpp)) {
*_fbs_count = 1;
(*ret)->edid = get_edid_info();
@@ -28,7 +27,7 @@ void fb_init(struct fb_info **ret, size_t *_fbs_count,
pmm_free(*ret, sizeof(struct fb_info));
}
#elif defined (UEFI)
- init_gop(ret, _fbs_count, target_width, target_height, target_bpp, preserve_screen);
+ init_gop(ret, _fbs_count, target_width, target_height, target_bpp);
#endif
fb_fbs = *ret;
diff --git a/common/lib/fb.h b/common/lib/fb.h
index fd46ff59..b34c6e1a 100644
--- a/common/lib/fb.h
+++ b/common/lib/fb.h
@@ -3,7 +3,6 @@
#include <stdint.h>
#include <stddef.h>
-#include <stdbool.h>
#include <drivers/edid.h>
struct resolution {
@@ -37,8 +36,7 @@ extern struct fb_info *fb_fbs;
extern size_t fb_fbs_count;
void fb_init(struct fb_info **ret, size_t *_fbs_count,
- uint64_t target_width, uint64_t target_height, uint16_t target_bpp,
- bool preserve_screen);
+ uint64_t target_width, uint64_t target_height, uint16_t target_bpp);
void fb_clear(struct fb_info *fb);
diff --git a/common/lib/gterm.c b/common/lib/gterm.c
index 975184ff..1f096b48 100644
--- a/common/lib/gterm.c
+++ b/common/lib/gterm.c
@@ -769,7 +769,7 @@ bool gterm_init(struct fb_info **_fbs, size_t *_fbs_count,
term_notready();
// We force bpp to 32
- fb_init(&fbs, &fbs_count, width, height, 32, false);
+ fb_init(&fbs, &fbs_count, width, height, 32);
if (_fbs != NULL) {
*_fbs = fbs;
diff --git a/common/protos/chainload.c b/common/protos/chainload.c
index 6dbfc8f2..a5512f46 100644
--- a/common/protos/chainload.c
+++ b/common/protos/chainload.c
@@ -293,7 +293,7 @@ noreturn void chainload(char *config, char *cmdline) {
struct fb_info *fbinfo;
size_t fb_count;
- fb_init(&fbinfo, &fb_count, req_width, req_height, req_bpp, false);
+ fb_init(&fbinfo, &fb_count, req_width, req_height, req_bpp);
size_t cmdline_len = strlen(cmdline);
CHAR16 *new_cmdline;
diff --git a/common/protos/limine.c b/common/protos/limine.c
index f2fe591d..64f7a445 100644
--- a/common/protos/limine.c
+++ b/common/protos/limine.c
@@ -1323,8 +1323,7 @@ FEAT_END
term_notready();
- bool preserve_screen = get_request(LIMINE_FLANTERM_FB_INIT_PARAMS_REQUEST_ID) != NULL;
- fb_init(&fbs, &fbs_count, req_width, req_height, req_bpp, preserve_screen);
+ fb_init(&fbs, &fbs_count, req_width, req_height, req_bpp);
if (fbs_count == 0) {
goto no_fb;
}
diff --git a/common/protos/linux_risc.c b/common/protos/linux_risc.c
index c53f1dd7..43875d5c 100644
--- a/common/protos/linux_risc.c
+++ b/common/protos/linux_risc.c
@@ -245,7 +245,7 @@ static void prepare_efi_tables(struct boot_param *p, char *config) {
term_notready();
- fb_init(&fbs, &fbs_count, req_width, req_height, req_bpp, false);
+ fb_init(&fbs, &fbs_count, req_width, req_height, req_bpp);
// TODO(qookie): Let the user pick a framebuffer if there's > 1
if (fbs_count > 0) {
diff --git a/common/protos/linux_x86.c b/common/protos/linux_x86.c
index cce595ec..ec5520ce 100644
--- a/common/protos/linux_x86.c
+++ b/common/protos/linux_x86.c
@@ -542,7 +542,7 @@ no_modules:;
#if defined (UEFI)
gop_force_16 = true;
#endif
- fb_init(&fbs, &fbs_count, req_width, req_height, req_bpp, false);
+ fb_init(&fbs, &fbs_count, req_width, req_height, req_bpp);
if (fbs_count == 0) {
#if defined (UEFI)
goto no_fb;
diff --git a/common/protos/multiboot1.c b/common/protos/multiboot1.c
index 5e95e292..d7c5c201 100644
--- a/common/protos/multiboot1.c
+++ b/common/protos/multiboot1.c
@@ -399,7 +399,7 @@ modeset:;
struct fb_info *fbs;
size_t fbs_count;
- fb_init(&fbs, &fbs_count, req_width, req_height, req_bpp, false);
+ fb_init(&fbs, &fbs_count, req_width, req_height, req_bpp);
if (fbs_count == 0) {
#if defined (UEFI)
goto skip_modeset;
diff --git a/common/protos/multiboot2.c b/common/protos/multiboot2.c
index 18721cd3..3acbdba6 100644
--- a/common/protos/multiboot2.c
+++ b/common/protos/multiboot2.c
@@ -736,7 +736,7 @@ modeset:;
struct fb_info *fbs;
size_t fbs_count;
- fb_init(&fbs, &fbs_count, req_width, req_height, req_bpp, false);
+ fb_init(&fbs, &fbs_count, req_width, req_height, req_bpp);
if (fbs_count == 0) {
#if defined (BIOS)
textmode:
