From 046d9ca982c6dcc7d00b4a63f8f6222196e5a5f5 Mon Sep 17 00:00:00 2001 From: cepetr Date: Fri, 17 Jan 2025 12:01:24 +0100 Subject: [PATCH] fix(core): fix gfx_bitblt initialization [no changelog] --- core/embed/io/display/ltdc_dsi/display_driver.c | 4 ++++ core/embed/io/display/st-7789/display_driver.c | 4 ++++ core/embed/io/display/stm32f429i-disc1/display_driver.c | 4 ++++ core/embed/io/display/unix/display_driver.c | 5 +++++ core/embed/io/display/vg-2864/display_driver.c | 4 ++++ core/embed/projects/boardloader/main.c | 2 -- core/embed/projects/bootloader/main.c | 2 -- core/embed/projects/kernel/main.c | 2 -- 8 files changed, 21 insertions(+), 6 deletions(-) diff --git a/core/embed/io/display/ltdc_dsi/display_driver.c b/core/embed/io/display/ltdc_dsi/display_driver.c index 9fe5bad48ae..717ecd0fdb0 100644 --- a/core/embed/io/display/ltdc_dsi/display_driver.c +++ b/core/embed/io/display/ltdc_dsi/display_driver.c @@ -412,6 +412,8 @@ bool display_init(display_content_mode_t mode) { __HAL_LTDC_ENABLE_IT(&drv->hlcd_ltdc, LTDC_IT_LI | LTDC_IT_FU | LTDC_IT_TE); + gfx_bitblt_init(); + drv->initialized = true; return true; @@ -427,6 +429,8 @@ void display_deinit(display_content_mode_t mode) { GPIO_InitTypeDef GPIO_InitStructure = {0}; + gfx_bitblt_deinit(); + NVIC_DisableIRQ(LTDC_IRQn); NVIC_DisableIRQ(LTDC_ER_IRQn); diff --git a/core/embed/io/display/st-7789/display_driver.c b/core/embed/io/display/st-7789/display_driver.c index f55c3f2fbfc..88cde741bdd 100644 --- a/core/embed/io/display/st-7789/display_driver.c +++ b/core/embed/io/display/st-7789/display_driver.c @@ -89,6 +89,8 @@ bool display_init(display_content_mode_t mode) { #endif #endif + gfx_bitblt_init(); + drv->initialized = true; return true; } @@ -110,6 +112,8 @@ void display_deinit(display_content_mode_t mode) { #endif #endif + gfx_bitblt_deinit(); + mpu_set_active_fb(NULL, 0); backlight_pwm_deinit(mode == DISPLAY_RESET_CONTENT ? BACKLIGHT_RESET diff --git a/core/embed/io/display/stm32f429i-disc1/display_driver.c b/core/embed/io/display/stm32f429i-disc1/display_driver.c index 1f7170acbe9..36dc4cec27a 100644 --- a/core/embed/io/display/stm32f429i-disc1/display_driver.c +++ b/core/embed/io/display/stm32f429i-disc1/display_driver.c @@ -67,6 +67,8 @@ bool display_init(display_content_mode_t mode) { ili9341_init(); } + gfx_bitblt_init(); + drv->initialized = true; return true; } @@ -74,6 +76,8 @@ bool display_init(display_content_mode_t mode) { void display_deinit(display_content_mode_t mode) { display_driver_t *drv = &g_display_driver; + gfx_bitblt_deinit(); + mpu_set_active_fb(NULL, 0); drv->initialized = false; diff --git a/core/embed/io/display/unix/display_driver.c b/core/embed/io/display/unix/display_driver.c index 77ff5eeaba2..5d57fda7563 100644 --- a/core/embed/io/display/unix/display_driver.c +++ b/core/embed/io/display/unix/display_driver.c @@ -178,6 +178,9 @@ bool display_init(display_content_mode_t mode) { #else drv->orientation_angle = 0; #endif + + gfx_bitblt_init(); + drv->initialized = true; return true; } @@ -189,6 +192,8 @@ void display_deinit(display_content_mode_t mode) { return; } + gfx_bitblt_deinit(); + SDL_FreeSurface(drv->prev_saved); SDL_FreeSurface(drv->buffer); if (drv->background != NULL) { diff --git a/core/embed/io/display/vg-2864/display_driver.c b/core/embed/io/display/vg-2864/display_driver.c index 680e4cc740b..30caf8df74e 100644 --- a/core/embed/io/display/vg-2864/display_driver.c +++ b/core/embed/io/display/vg-2864/display_driver.c @@ -318,6 +318,8 @@ bool display_init(display_content_mode_t mode) { display_init_spi(drv); } + gfx_bitblt_init(); + drv->initialized = true; return true; } @@ -327,6 +329,8 @@ void display_deinit(display_content_mode_t mode) { mpu_set_active_fb(NULL, 0); + gfx_bitblt_deinit(); + drv->initialized = false; } diff --git a/core/embed/projects/boardloader/main.c b/core/embed/projects/boardloader/main.c index 21e7e87be36..ede63c0a1bc 100644 --- a/core/embed/projects/boardloader/main.c +++ b/core/embed/projects/boardloader/main.c @@ -92,7 +92,6 @@ static void drivers_init(void) { #ifdef USE_HASH_PROCESSOR hash_processor_init(); #endif - gfx_bitblt_init(); display_init(DISPLAY_RESET_CONTENT); #ifdef USE_SD_CARD sdcard_init(); @@ -103,7 +102,6 @@ static void drivers_deinit(void) { #ifdef FIXED_HW_DEINIT // TODO #endif - gfx_bitblt_deinit(); display_deinit(DISPLAY_JUMP_BEHAVIOR); #ifdef USE_POWERCTL powerctl_deinit(); diff --git a/core/embed/projects/bootloader/main.c b/core/embed/projects/bootloader/main.c index 728e7e1acbf..2182d5d38b0 100644 --- a/core/embed/projects/bootloader/main.c +++ b/core/embed/projects/bootloader/main.c @@ -98,7 +98,6 @@ static void drivers_init(secbool *touch_initialized) { #ifdef USE_HASH_PROCESSOR hash_processor_init(); #endif - gfx_bitblt_init(); display_init(DISPLAY_JUMP_BEHAVIOR); unit_properties_init(); @@ -138,7 +137,6 @@ static void drivers_deinit(void) { button_deinit(); #endif #endif - gfx_bitblt_deinit(); display_deinit(DISPLAY_JUMP_BEHAVIOR); } diff --git a/core/embed/projects/kernel/main.c b/core/embed/projects/kernel/main.c index 4c4fab480ff..4a03059ca42 100644 --- a/core/embed/projects/kernel/main.c +++ b/core/embed/projects/kernel/main.c @@ -116,8 +116,6 @@ void drivers_init() { hash_processor_init(); #endif - gfx_bitblt_init(); - display_init(DISPLAY_JUMP_BEHAVIOR); #ifdef USE_OEM_KEYS_CHECK