From 687312e30ad266a64942b752058cfb867a1c95aa Mon Sep 17 00:00:00 2001 From: Charles Dias Date: Sat, 1 Nov 2025 20:50:33 -0300 Subject: [PATCH 1/2] samples: input: draw_touch_events: avoid avoid OOB writes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When CROSS_DIM doesn’t evenly divide the panel WIDTH/HEIGHT, the last tile on the right/bottom edge can extend past the display bounds. Fix by clipping the edge tiles. Signed-off-by: Charles Dias --- samples/subsys/input/draw_touch_events/src/main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/samples/subsys/input/draw_touch_events/src/main.c b/samples/subsys/input/draw_touch_events/src/main.c index ed232de08624a..a1bef59988fd3 100644 --- a/samples/subsys/input/draw_touch_events/src/main.c +++ b/samples/subsys/input/draw_touch_events/src/main.c @@ -70,7 +70,15 @@ static void clear_screen(void) for (x = 0; x < WIDTH; x += CROSS_DIM) { for (y = 0; y < HEIGHT; y += CROSS_DIM) { - display_write(display_dev, x, y, &buf_desc, buffer_cross_empty); + struct display_buffer_descriptor ddesc = buf_desc; + uint16_t rem_w = WIDTH - x; + uint16_t rem_h = HEIGHT - y; + + ddesc.width = MIN(buf_desc.width, rem_w); + ddesc.height = MIN(buf_desc.height, rem_h); + ddesc.buf_size = ddesc.width * ddesc.height * BPP; + + display_write(display_dev, x, y, &ddesc, buffer_cross_empty); } } } From 1a1801915e2dfa42ec203705878ecf78c06fabba Mon Sep 17 00:00:00 2001 From: Charles Dias Date: Wed, 5 Nov 2025 17:35:52 -0300 Subject: [PATCH 2/2] boards: shields: st_lcd_dsi_mb1835: set LTDC pixel-format Set zephyr_lcd_controller pixel-format to PANEL_PIXEL_FORMAT_ARGB_8888 to match the driver configuration. Signed-off-by: Charles Dias --- boards/shields/st_lcd_dsi_mb1835/st_lcd_dsi_mb1835.overlay | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/shields/st_lcd_dsi_mb1835/st_lcd_dsi_mb1835.overlay b/boards/shields/st_lcd_dsi_mb1835/st_lcd_dsi_mb1835.overlay index df57cd40a1bfd..c3361d3aee88b 100644 --- a/boards/shields/st_lcd_dsi_mb1835/st_lcd_dsi_mb1835.overlay +++ b/boards/shields/st_lcd_dsi_mb1835/st_lcd_dsi_mb1835.overlay @@ -88,7 +88,7 @@ status = "okay"; width = <480>; height = <480>; - pixel-format = ; + pixel-format = ; bl-ctrl-gpios = <&dsi_lcd_qsh_030 53 GPIO_ACTIVE_HIGH>;