Skip to content

Commit 1f1826d

Browse files
committed
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>
1 parent bb5c8e7 commit 1f1826d

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

src/display.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,7 @@ int display_init(void)
546546
return display_configure(NULL);
547547
} else if (!(cur_boot_args.video.depth & FB_DEPTH_FLAG_RETINA)) {
548548
printf("display: Internal display with non-retina flag, assuming Sonoma bug and reconfiguring\n");
549+
fb_clear_direct(); // Old m1n1 stage1 ends up with an ugly logo situation, clear it.
549550
return display_configure(NULL);
550551
} else {
551552
printf("display: Display is already initialized (%ldx%ld)\n", cur_boot_args.video.width,

src/fb.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,16 @@ static void fb_clear_console(void)
325325
fb_update();
326326
}
327327

328+
void fb_clear_direct(void)
329+
{
330+
size_t fb_size = cur_boot_args.video.stride * cur_boot_args.video.height;
331+
332+
mmu_add_mapping(cur_boot_args.video.base, cur_boot_args.video.base, ALIGN_UP(fb_size, 0x4000),
333+
MAIR_IDX_NORMAL_NC, PERM_RW);
334+
335+
memset64((void *)cur_boot_args.video.base, 0, fb_size);
336+
}
337+
328338
void fb_init(bool clear)
329339
{
330340
fb.hwptr = (void *)cur_boot_args.video.base;

src/fb.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ void fb_blit(u32 x, u32 y, u32 w, u32 h, void *data, u32 stride, pix_fmt_t forma
4545
void fb_unblit(u32 x, u32 y, u32 w, u32 h, void *data, u32 stride);
4646
void fb_fill(u32 x, u32 y, u32 w, u32 h, rgb_t color);
4747
void fb_clear(rgb_t color);
48+
void fb_clear_direct(void);
4849

4950
void fb_display_logo(void);
5051
void fb_restore_logo(void);

0 commit comments

Comments
 (0)