display,fb: Clear framebuffer early in the Sonoma stage2 fixup path

stage1 ends up with an ugly Asahi 100% logo on top of a 200% Apple logo.
Let's just clear it so it looks nicer.

Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
Hector Martin 2023-11-02 15:51:17 +09:00
parent 6af39a9b40
commit 40a9444484
3 changed files with 12 additions and 0 deletions

View file

@ -547,6 +547,7 @@ int display_init(void)
} else if (!(cur_boot_args.video.depth & FB_DEPTH_FLAG_RETINA)) {
printf("display: Internal display with non-retina flag, assuming Sonoma bug and "
"reconfiguring\n");
fb_clear_direct(); // Old m1n1 stage1 ends up with an ugly logo situation, clear it.
return display_configure(NULL);
} else {
printf("display: Display is already initialized (%ldx%ld)\n", cur_boot_args.video.width,

View file

@ -325,6 +325,16 @@ static void fb_clear_console(void)
fb_update();
}
void fb_clear_direct(void)
{
size_t fb_size = cur_boot_args.video.stride * cur_boot_args.video.height;
mmu_add_mapping(cur_boot_args.video.base, cur_boot_args.video.base, ALIGN_UP(fb_size, 0x4000),
MAIR_IDX_NORMAL_NC, PERM_RW);
memset64((void *)cur_boot_args.video.base, 0, fb_size);
}
void fb_init(bool clear)
{
fb.hwptr = (void *)cur_boot_args.video.base;

View file

@ -45,6 +45,7 @@ void fb_blit(u32 x, u32 y, u32 w, u32 h, void *data, u32 stride, pix_fmt_t forma
void fb_unblit(u32 x, u32 y, u32 w, u32 h, void *data, u32 stride);
void fb_fill(u32 x, u32 y, u32 w, u32 h, rgb_t color);
void fb_clear(rgb_t color);
void fb_clear_direct(void);
void fb_display_logo(void);
void fb_restore_logo(void);