1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-10 07:20:56 +00:00

fix(core): properly limit the display area used in application (ltdc_dsi driver)

[no changelog]

wip: use only part of display area
This commit is contained in:
tychovrahe 2024-12-31 16:09:35 +01:00 committed by TychoVrahe
parent 36d0ce79f9
commit d235ed3d3d
3 changed files with 12 additions and 3 deletions

View File

@ -126,15 +126,18 @@ bool display_get_frame_buffer(display_fb_info_t *fb_dest) {
uint32_t fb_stride = FRAME_BUFFER_PIXELS_PER_LINE * FB_PIXEL_SIZE; uint32_t fb_stride = FRAME_BUFFER_PIXELS_PER_LINE * FB_PIXEL_SIZE;
// We may not utilize whole area of the display // We may not utilize whole area of the display
addr += (LCD_HEIGHT - DISPLAY_RESY) / 2 * FB_PIXEL_SIZE; addr += PANEL_USED_AREA_OFFSET_X * FB_PIXEL_SIZE;
addr += (LCD_WIDTH - DISPLAY_RESX) / 2 * fb_stride; addr += PANEL_USED_AREA_OFFSET_Y * fb_stride;
display_fb_info_t fb = { display_fb_info_t fb = {
.ptr = (void *)addr, .ptr = (void *)addr,
.stride = fb_stride, .stride = fb_stride,
}; };
mpu_set_active_fb((void *)addr, VIRTUAL_FRAME_BUFFER_SIZE); size_t fb_size = fb_stride * (DISPLAY_RESY - 1) * FB_PIXEL_SIZE +
DISPLAY_RESX * FB_PIXEL_SIZE;
mpu_set_active_fb((void *)addr, fb_size);
memcpy(fb_dest, &fb, sizeof(display_fb_info_t)); memcpy(fb_dest, &fb, sizeof(display_fb_info_t));

View File

@ -47,3 +47,6 @@
// Pitch (in pixels) of the virtual frame buffer // Pitch (in pixels) of the virtual frame buffer
#define FRAME_BUFFER_PIXELS_PER_LINE 240 #define FRAME_BUFFER_PIXELS_PER_LINE 240
#define PANEL_USED_AREA_OFFSET_X 0
#define PANEL_USED_AREA_OFFSET_Y 0

View File

@ -53,3 +53,6 @@
// Size of the virtual frame buffer in bytes // Size of the virtual frame buffer in bytes
#define VIRTUAL_FRAME_BUFFER_SIZE \ #define VIRTUAL_FRAME_BUFFER_SIZE \
(FRAME_BUFFER_PIXELS_PER_LINE * LCD_HEIGHT * 4) (FRAME_BUFFER_PIXELS_PER_LINE * LCD_HEIGHT * 4)
#define PANEL_USED_AREA_OFFSET_X 120
#define PANEL_USED_AREA_OFFSET_Y 120