Skip to content

Commit 6e110b5

Browse files
committed
lib/term: Move framebuffer clear into term_notready to keep WC active
1 parent 0a0540a commit 6e110b5

18 files changed

Lines changed: 47 additions & 52 deletions

File tree

common/drivers/gop.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ bool gop_force_16 = false;
126126

127127
static bool try_mode(struct fb_info *ret, EFI_GRAPHICS_OUTPUT_PROTOCOL *gop,
128128
size_t mode, uint64_t width, uint64_t height, int bpp,
129-
struct fb_info *fbs, size_t fbs_count,
130-
bool preserve_screen) {
129+
struct fb_info *fbs, size_t fbs_count) {
131130
EFI_STATUS status;
132131

133132
if (!mode_to_fb_info(ret, gop, mode)) {
@@ -179,10 +178,6 @@ static bool try_mode(struct fb_info *ret, EFI_GRAPHICS_OUTPUT_PROTOCOL *gop,
179178

180179
ret->framebuffer_addr = gop->Mode->FrameBufferBase;
181180

182-
if (!preserve_screen) {
183-
fb_clear(ret);
184-
}
185-
186181
return true;
187182
}
188183

@@ -213,8 +208,7 @@ no_unwind static int preset_modes[MAX_PRESET_MODES];
213208
no_unwind static bool preset_modes_initialised = false;
214209

215210
void init_gop(struct fb_info **ret, size_t *_fbs_count,
216-
uint64_t target_width, uint64_t target_height, uint16_t target_bpp,
217-
bool preserve_screen) {
211+
uint64_t target_width, uint64_t target_height, uint16_t target_bpp) {
218212
if (preset_modes_initialised == false) {
219213
for (size_t i = 0; i < MAX_PRESET_MODES; i++) {
220214
preset_modes[i] = -1;
@@ -321,7 +315,7 @@ void init_gop(struct fb_info **ret, size_t *_fbs_count,
321315

322316
retry:
323317
for (size_t j = 0; j < modes_count; j++) {
324-
if (try_mode(fb, gop, j, _target_width, _target_height, _target_bpp, *ret, fbs_count, preserve_screen)) {
318+
if (try_mode(fb, gop, j, _target_width, _target_height, _target_bpp, *ret, fbs_count)) {
325319
goto success;
326320
}
327321
}
@@ -348,7 +342,7 @@ void init_gop(struct fb_info **ret, size_t *_fbs_count,
348342
if (current_fallback == 1) {
349343
current_fallback++;
350344

351-
if (try_mode(fb, gop, preset_modes[i], 0, 0, 0, *ret, fbs_count, preserve_screen)) {
345+
if (try_mode(fb, gop, preset_modes[i], 0, 0, 0, *ret, fbs_count)) {
352346
goto success;
353347
}
354348
}

common/drivers/gop.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
#include <lib/fb.h>
1010

1111
void init_gop(struct fb_info **ret, size_t *_fbs_count,
12-
uint64_t target_width, uint64_t target_height, uint16_t target_bpp,
13-
bool preserve_screen);
12+
uint64_t target_width, uint64_t target_height, uint16_t target_bpp);
1413

1514
extern bool gop_force_16;
1615

common/drivers/vbe.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,7 @@ struct fb_info *vbe_get_mode_list(size_t *count) {
231231
}
232232

233233
bool init_vbe(struct fb_info *ret,
234-
uint16_t target_width, uint16_t target_height, uint16_t target_bpp,
235-
bool preserve_screen) {
234+
uint16_t target_width, uint16_t target_height, uint16_t target_bpp) {
236235
printv("vbe: Initialising...\n");
237236

238237
size_t current_fallback = 0;
@@ -344,10 +343,6 @@ bool init_vbe(struct fb_info *ret,
344343
continue;
345344
}
346345

347-
if (!preserve_screen) {
348-
fb_clear(ret);
349-
}
350-
351346
return true;
352347
}
353348
}

common/drivers/vbe.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
#include <lib/fb.h>
88

99
bool init_vbe(struct fb_info *ret,
10-
uint16_t target_width, uint16_t target_height, uint16_t target_bpp,
11-
bool preserve_screen);
10+
uint16_t target_width, uint16_t target_height, uint16_t target_bpp);
1211

1312
struct fb_info *vbe_get_mode_list(size_t *count);
1413

common/drivers/vga_textmode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ static void text_deinit(struct flanterm_context *_ctx, void (*_free)(void *, siz
267267
}
268268

269269
void vga_textmode_init(bool managed) {
270-
term_notready();
270+
term_notready(true);
271271

272272
if (quiet) {
273273
return;

common/entry.s3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ noreturn void stage3_common(void) {
211211
#endif
212212
#endif
213213

214-
term_notready();
214+
term_notready(true);
215215

216216
#if defined (UEFI)
217217
init_bli();

common/lib/fb.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,10 @@ struct fb_info *fb_fbs;
1212
size_t fb_fbs_count = 0;
1313

1414
void fb_init(struct fb_info **ret, size_t *_fbs_count,
15-
uint64_t target_width, uint64_t target_height, uint16_t target_bpp,
16-
bool preserve_screen) {
17-
if (quiet) {
18-
preserve_screen = true;
19-
}
20-
15+
uint64_t target_width, uint64_t target_height, uint16_t target_bpp) {
2116
#if defined (BIOS)
2217
*ret = ext_mem_alloc(sizeof(struct fb_info));
23-
if (init_vbe(*ret, target_width, target_height, target_bpp, preserve_screen)) {
18+
if (init_vbe(*ret, target_width, target_height, target_bpp)) {
2419
*_fbs_count = 1;
2520

2621
(*ret)->edid = get_edid_info();
@@ -32,7 +27,7 @@ void fb_init(struct fb_info **ret, size_t *_fbs_count,
3227
pmm_free(*ret, sizeof(struct fb_info));
3328
}
3429
#elif defined (UEFI)
35-
init_gop(ret, _fbs_count, target_width, target_height, target_bpp, preserve_screen);
30+
init_gop(ret, _fbs_count, target_width, target_height, target_bpp);
3631
#endif
3732

3833
fb_fbs = *ret;

common/lib/fb.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ extern struct fb_info *fb_fbs;
3737
extern size_t fb_fbs_count;
3838

3939
void fb_init(struct fb_info **ret, size_t *_fbs_count,
40-
uint64_t target_width, uint64_t target_height, uint16_t target_bpp,
41-
bool preserve_screen);
40+
uint64_t target_width, uint64_t target_height, uint16_t target_bpp);
4241

4342
void fb_clear(struct fb_info *fb);
4443

common/lib/gterm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ bool gterm_init(struct fb_info **_fbs, size_t *_fbs_count,
783783
prev_valid = false;
784784

785785
if (quiet) {
786-
term_notready();
786+
term_notready(true);
787787
return false;
788788
}
789789

@@ -794,10 +794,10 @@ bool gterm_init(struct fb_info **_fbs, size_t *_fbs_count,
794794
}
795795
#endif
796796

797-
term_notready();
797+
term_notready(true);
798798

799799
// We force bpp to 32
800-
fb_init(&fbs, &fbs_count, width, height, 32, true);
800+
fb_init(&fbs, &fbs_count, width, height, 32);
801801

802802
if (_fbs != NULL) {
803803
*_fbs = fbs;

common/lib/panic.s2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ noreturn void panic(bool allow_menu, const char *fmt, ...) {
6767
getchar();
6868

6969
// This fixes a crash
70-
term_notready();
70+
term_notready(true);
7171

7272
menu(false);
7373
/*

0 commit comments

Comments
 (0)