mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-31 09:50:58 +00:00
fixup! feat(core): display driver for T3W1
This commit is contained in:
parent
5b29060167
commit
6687a95b8e
@ -111,7 +111,8 @@ bool display_get_frame_buffer(display_fb_info_t *fb_dest) {
|
||||
#define FB_PIXEL_SIZE 2
|
||||
#endif
|
||||
|
||||
int16_t fb_idx = fb_queue_get_for_write(&drv->queue);
|
||||
fb_queue_wait(&drv->empty_frames);
|
||||
int16_t fb_idx = fb_queue_peek(&drv->empty_frames);
|
||||
|
||||
if (fb_idx < 0) {
|
||||
fb_dest->ptr = NULL;
|
||||
@ -146,16 +147,13 @@ void display_refresh(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
int16_t fb_idx = fb_queue_get_for_copy(&drv->queue);
|
||||
|
||||
if (fb_idx < 0) {
|
||||
if (!fb_queue_peeked(&drv->empty_frames)) {
|
||||
// No refresh needed as the frame buffer is not in
|
||||
// the state to be copied to the display
|
||||
return;
|
||||
}
|
||||
|
||||
// Mark the buffer ready to switch to
|
||||
fb_queue_set_ready_for_transfer(&drv->queue);
|
||||
fb_queue_put(&drv->ready_frames, fb_queue_take(&drv->empty_frames));
|
||||
}
|
||||
|
||||
void display_ensure_refreshed(void) {
|
||||
@ -172,7 +170,7 @@ void display_ensure_refreshed(void) {
|
||||
// so we can be sure there's not scheduled or pending
|
||||
// background copying
|
||||
do {
|
||||
copy_pending = !fb_queue_is_processed(&drv->queue);
|
||||
copy_pending = !fb_queue_empty(&drv->ready_frames);
|
||||
__WFI();
|
||||
} while (copy_pending || drv->update_pending > 0);
|
||||
}
|
||||
@ -187,15 +185,14 @@ void display_fb_clear(void) {
|
||||
}
|
||||
|
||||
uint32_t display_fb_get_initial_addr(void) {
|
||||
display_fb_info_t fb_info;
|
||||
fb_queue_reset(&g_display_driver.empty_frames);
|
||||
fb_queue_reset(&g_display_driver.ready_frames);
|
||||
|
||||
display_get_frame_buffer(&fb_info);
|
||||
fb_queue_put(&g_display_driver.empty_frames, 1);
|
||||
|
||||
fb_queue_set_ready_for_transfer(&g_display_driver.queue);
|
||||
g_display_driver.active_frame = 0;
|
||||
|
||||
fb_queue_get_for_transfer(&g_display_driver.queue);
|
||||
|
||||
return (uint32_t)fb_info.ptr;
|
||||
return (uint32_t)get_fb_ptr(0);
|
||||
}
|
||||
|
||||
void HAL_LTDC_LineEvenCallback(LTDC_HandleTypeDef *hltdc) {
|
||||
@ -209,10 +206,11 @@ void HAL_LTDC_LineEvenCallback(LTDC_HandleTypeDef *hltdc) {
|
||||
drv->update_pending--;
|
||||
}
|
||||
|
||||
int16_t fb_idx = fb_queue_get_for_transfer(&drv->queue);
|
||||
int16_t fb_idx = fb_queue_take(&drv->ready_frames);
|
||||
if (fb_idx >= 0) {
|
||||
fb_queue_set_switched(&drv->queue);
|
||||
display_set_fb((uint32_t)get_fb_ptr(fb_idx));
|
||||
fb_queue_put(&drv->empty_frames, drv->active_frame);
|
||||
drv->active_frame = fb_idx;
|
||||
display_set_fb((uint32_t)get_fb_ptr(drv->active_frame));
|
||||
drv->update_pending = 3;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,11 @@
|
||||
typedef struct {
|
||||
bool initialized;
|
||||
uint16_t update_pending;
|
||||
frame_buffer_queue_t queue;
|
||||
|
||||
fb_queue_t empty_frames;
|
||||
fb_queue_t ready_frames;
|
||||
|
||||
int16_t active_frame;
|
||||
|
||||
// Current display orientation (0, 90, 180, 270)
|
||||
int orientation_angle;
|
||||
|
Loading…
Reference in New Issue
Block a user