From 64e6ff9408975a8b8ae910132bae8325f12dc6b7 Mon Sep 17 00:00:00 2001 From: tychovrahe Date: Wed, 11 Dec 2024 22:51:13 +0100 Subject: [PATCH] fix(core): TS5 - wait for frame to appear on display before raising backlight [no changelog] --- core/embed/io/display/st-7789/display_fb.c | 8 +++++++- core/embed/io/display/st-7789/display_internal.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/embed/io/display/st-7789/display_fb.c b/core/embed/io/display/st-7789/display_fb.c index 63153f5b27..f2b6fba94e 100644 --- a/core/embed/io/display/st-7789/display_fb.c +++ b/core/embed/io/display/st-7789/display_fb.c @@ -120,6 +120,8 @@ void display_physical_fb_clear(void) { static void bg_copy_callback(void) { display_driver_t *drv = &g_display_driver; + drv->update_pending = 1; + fb_queue_put(&drv->empty_frames, fb_queue_take(&drv->ready_frames)); } @@ -129,6 +131,10 @@ static void display_te_interrupt_handler(void) { __HAL_GPIO_EXTI_CLEAR_FLAG(DISPLAY_TE_PIN); + if (drv->update_pending > 0) { + drv->update_pending--; + } + int16_t fb_idx = fb_queue_peek(&drv->ready_frames); if (fb_idx >= 0) { @@ -241,7 +247,7 @@ void display_ensure_refreshed(void) { do { copy_pending = !fb_queue_empty(&drv->ready_frames); __WFI(); - } while (copy_pending); + } while (copy_pending || drv->update_pending); // Wait until the display is fully refreshed // (TE signal is low when the display is updating) diff --git a/core/embed/io/display/st-7789/display_internal.h b/core/embed/io/display/st-7789/display_internal.h index ae357001c5..8aa00f0e71 100644 --- a/core/embed/io/display/st-7789/display_internal.h +++ b/core/embed/io/display/st-7789/display_internal.h @@ -25,6 +25,7 @@ typedef struct { // Current display orientation (0, 90, 180, 270) int orientation_angle; + int update_pending; } display_driver_t;