1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-28 16:21:03 +00:00

fix(core): fix flashing old display content on model T

[no changelog]
This commit is contained in:
tychovrahe 2025-01-17 14:02:11 +01:00 committed by TychoVrahe
parent fa8043cfa3
commit 8bad0c8675
4 changed files with 32 additions and 7 deletions

View File

@ -102,11 +102,11 @@ void display_deinit(display_content_mode_t mode) {
return;
}
#ifdef FRAMEBUFFER
#ifndef BOARDLOADER
// Ensure that the ready frame buffer is transfered to
// Ensure that the ready frame buffer is transferred to
// the display controller
display_ensure_refreshed();
#ifdef FRAMEBUFFER
// Disable periodical interrupt
NVIC_DisableIRQ(DISPLAY_TE_INTERRUPT_NUM);
#endif
@ -138,13 +138,11 @@ int display_set_backlight(int level) {
return 0;
}
#ifdef FRAMEBUFFER
#ifndef BOARDLOADER
// if turning on the backlight, wait until the panel is refreshed
if (backlight_pwm_get() < level && !is_mode_exception()) {
display_ensure_refreshed();
}
#endif
#endif
return backlight_pwm_set(level);

View File

@ -29,8 +29,6 @@ void display_fb_init(void);
// Clears both physical frame buffers
void display_fb_clear(void);
void display_ensure_refreshed(void);
#endif // FRAMEBUFFER
#endif // TREZORHAL_DISPLAY_FB_H

View File

@ -38,4 +38,6 @@ static inline uint32_t is_mode_exception(void) {
return (isr_number != 0) && (isr_number != 11);
}
void display_ensure_refreshed(void);
#endif // TREZORHAL_DISPLAY_INTERNAL_H

View File

@ -22,15 +22,26 @@
#include <io/display.h>
#include "display_internal.h"
#include "display_io.h"
#include "display_panel.h"
#ifdef KERNEL_MODE
void display_refresh(void) {
// If the framebuffer is not used the, we do not need
// If the framebuffer is not used then, we do not need
// to refresh the display explicitly as we write the data
// directly to the display internal RAM.
// but still, we will wait before raising backlight
// to make sure the display is showing new content
display_driver_t* drv = &g_display_driver;
if (!drv->initialized) {
return;
}
drv->update_pending = 2;
}
void display_wait_for_sync(void) {
@ -47,6 +58,22 @@ void display_wait_for_sync(void) {
#endif
}
void display_ensure_refreshed(void) {
#ifndef BOARDLOADER
display_driver_t* drv = &g_display_driver;
if (!drv->initialized) {
return;
}
while (drv->update_pending > 0) {
display_wait_for_sync();
drv->update_pending--;
}
#endif
}
static inline void set_window(const gfx_bitblt_t* bb) {
display_panel_set_window(bb->dst_x, bb->dst_y, bb->dst_x + bb->width - 1,
bb->dst_y + bb->height + 1);