fb: Do not restore logo when using kboot

Also don't clear the whole screen, only the console section so the logo
is glitchless.

Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
Hector Martin 2021-08-31 14:10:03 +09:00
parent 77b0cdb7c9
commit fa50bb6474
8 changed files with 29 additions and 17 deletions

View file

@ -1226,7 +1226,7 @@ class HV(Reloadable):
self.p.fb_improve_logo()
print("Shutting down framebuffer...")
self.p.fb_shutdown()
self.p.fb_shutdown(True)
print("Enabling SPRR...")
self.u.msr(SPRR_CONFIG_EL1, 1)

View file

@ -958,8 +958,8 @@ class M1N1Proxy(Reloadable):
def fb_init(self):
return self.request(self.P_FB_INIT)
def fb_shutdown(self):
return self.request(self.P_FB_SHUTDOWN)
def fb_shutdown(self, restore_logo=True):
return self.request(self.P_FB_SHUTDOWN, restore_logo)
def fb_blit(self, x, y, w, h, ptr, stride):
return self.request(self.P_FB_BLIP, x, y, w, h, ptr, stride)
def fb_unblit(self, x, y, w, h, ptr, stride):

View file

@ -291,6 +291,12 @@ struct iodev iodev_fb = {
.usage = USAGE_CONSOLE,
};
static void fb_clear_console(void)
{
for (u32 row = 0; row < console.cursor.max_row; ++row)
fb_clear_font_row(row);
}
void fb_init(void)
{
fb.ptr = (void *)cur_boot_args.video.base;
@ -312,10 +318,12 @@ void fb_init(void)
console.font.height = 16;
}
orig_logo = *logo;
orig_logo.ptr = malloc(orig_logo.width * orig_logo.height * 4);
fb_unblit_image((fb.width - orig_logo.width) / 2, (fb.height - orig_logo.height) / 2,
&orig_logo);
if (!orig_logo.ptr) {
orig_logo = *logo;
orig_logo.ptr = malloc(orig_logo.width * orig_logo.height * 4);
fb_unblit_image((fb.width - orig_logo.width) / 2, (fb.height - orig_logo.height) / 2,
&orig_logo);
}
console.margin.rows = 2;
console.margin.cols = 4;
@ -328,21 +336,22 @@ void fb_init(void)
console.initialized = 1;
for (u32 row = 0; row < console.cursor.max_row; ++row)
fb_clear_font_row(row);
fb_clear_console();
printf("fb console: max rows %d, max cols %d\n", console.cursor.max_row,
console.cursor.max_col);
}
void fb_shutdown(void)
void fb_shutdown(bool restore_logo)
{
if (!console.initialized)
return;
console.initialized = 0;
fb_clear((rgb_t){0, 0, 0});
fb_restore_logo();
free(orig_logo.ptr);
orig_logo.ptr = NULL;
fb_clear_console();
if (restore_logo) {
fb_restore_logo();
free(orig_logo.ptr);
orig_logo.ptr = NULL;
}
}

View file

@ -27,7 +27,7 @@ static inline rgb_t int2rgb(u32 c)
}
void fb_init(void);
void fb_shutdown(void);
void fb_shutdown(bool restore_logo);
void fb_blit(u32 x, u32 y, u32 w, u32 h, void *data, u32 stride);
void fb_unblit(u32 x, u32 y, u32 w, u32 h, void *data, u32 stride);

View file

@ -350,6 +350,7 @@ int kboot_boot(void *kernel)
next_stage.args[1] = 0;
next_stage.args[2] = 0;
next_stage.args[3] = 0;
next_stage.restore_logo = false;
return 0;
}

View file

@ -104,7 +104,7 @@ void m1n1_main(void)
usb_iodev_shutdown();
mmu_shutdown();
#ifdef USE_FB
fb_shutdown();
fb_shutdown(next_stage.restore_logo);
#endif
printf("Vectoring to next stage...\n");

View file

@ -88,6 +88,7 @@ int proxy_process(ProxyRequest *request, ProxyReply *reply)
iodev_console_flush();
next_stage.entry = (generic_func *)request->args[0];
memcpy(next_stage.args, &request->args[1], 4 * sizeof(u64));
next_stage.restore_logo = true;
return 1;
case P_GL1_CALL:
reply->retval = gl1_call((void *)request->args[0], request->args[1], request->args[2],
@ -440,7 +441,7 @@ int proxy_process(ProxyRequest *request, ProxyReply *reply)
fb_init();
break;
case P_FB_SHUTDOWN:
fb_shutdown();
fb_shutdown(request->args[0]);
break;
case P_FB_BLIT:
fb_blit(request->args[0], request->args[1], request->args[2], request->args[3],

View file

@ -391,6 +391,7 @@ typedef u64(generic_func)(u64, u64, u64, u64);
struct vector_args {
generic_func *entry;
u64 args[4];
bool restore_logo;
};
extern struct vector_args next_stage;