mirror of
https://github.com/AsahiLinux/m1n1
synced 2025-02-16 13:48:29 +00:00
fb: Add the ability to defer FB console activation
This differs from removing the IODEV usage in that console contents are still buffered. Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
parent
d1dcf16c66
commit
a9088e2278
3 changed files with 18 additions and 6 deletions
22
src/fb.c
22
src/fb.c
|
@ -41,8 +41,9 @@ static struct {
|
|||
u32 cols;
|
||||
} margin;
|
||||
|
||||
int initialized;
|
||||
} console = {.initialized = 0};
|
||||
bool initialized;
|
||||
bool active;
|
||||
} console;
|
||||
|
||||
extern u8 _binary_build_bootlogo_128_bin_start[];
|
||||
extern u8 _binary_build_bootlogo_256_bin_start[];
|
||||
|
@ -268,7 +269,7 @@ ssize_t fb_console_write(const char *bfr, size_t len)
|
|||
{
|
||||
ssize_t wrote = 0;
|
||||
|
||||
if (!console.initialized)
|
||||
if (!console.initialized || !console.active)
|
||||
return 0;
|
||||
|
||||
while (len--) {
|
||||
|
@ -284,7 +285,7 @@ ssize_t fb_console_write(const char *bfr, size_t len)
|
|||
static bool fb_console_iodev_can_write(void *opaque)
|
||||
{
|
||||
UNUSED(opaque);
|
||||
return console.initialized;
|
||||
return console.initialized && console.active;
|
||||
}
|
||||
|
||||
static ssize_t fb_console_iodev_write(void *opaque, const void *buf, size_t len)
|
||||
|
@ -358,7 +359,8 @@ void fb_init(void)
|
|||
console.cursor.max_col =
|
||||
((fb.width - logo->width) / 2) / console.font.width - 2 * console.margin.cols;
|
||||
|
||||
console.initialized = 1;
|
||||
console.initialized = true;
|
||||
console.active = false;
|
||||
|
||||
fb_clear_console();
|
||||
|
||||
|
@ -366,12 +368,20 @@ void fb_init(void)
|
|||
console.cursor.max_col);
|
||||
}
|
||||
|
||||
void fb_set_active(bool active)
|
||||
{
|
||||
console.active = active;
|
||||
if (active)
|
||||
iodev_console_kick();
|
||||
}
|
||||
|
||||
void fb_shutdown(bool restore_logo)
|
||||
{
|
||||
if (!console.initialized)
|
||||
return;
|
||||
|
||||
console.initialized = 0;
|
||||
console.active = false;
|
||||
console.initialized = false;
|
||||
fb_clear_console();
|
||||
if (restore_logo) {
|
||||
fb_restore_logo();
|
||||
|
|
1
src/fb.h
1
src/fb.h
|
@ -31,6 +31,7 @@ static inline rgb_t int2rgb(u32 c)
|
|||
void fb_init(void);
|
||||
void fb_shutdown(bool restore_logo);
|
||||
void fb_update(void);
|
||||
void fb_set_active(bool active);
|
||||
|
||||
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);
|
||||
|
|
|
@ -94,6 +94,7 @@ void m1n1_main(void)
|
|||
display_init();
|
||||
fb_init();
|
||||
fb_display_logo();
|
||||
fb_set_active(true);
|
||||
#endif
|
||||
|
||||
aic_init();
|
||||
|
|
Loading…
Add table
Reference in a new issue