[PATCH 1/2] drm/tiny: sharp-memory: fix line address assignment on partial update

From: Tobias Johansson

Date: Mon Mar 30 2026 - 03:20:54 EST


When only a subset of lines is dirty, the TX buffer sent to the
panel contains incorrect line addresses, resulting in visible
flickering on the display.

sharp_memory_set_tx_buffer_addresses() iterates from line 0 to the
last damaged line, assigning addresses sequentially from 1. When
only lines 10-20 are dirty, line 10's pixel data is written to the
slot with address 1 instead of address 11, corrupting the address-
to-data mapping.

Fix sharp_memory_set_tx_buffer_addresses() to iterate over only the
damaged line count and offset assigned addresses by the clip start,
so that addresses match the pixel data that follows.

Fixes: b8f9f21716fec ("drm/tiny: Add driver for Sharp Memory LCD")
Signed-off-by: Tobias Johansson <tobias.johansson@xxxxxxxx>
---
drivers/gpu/drm/tiny/sharp-memory.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tiny/sharp-memory.c b/drivers/gpu/drm/tiny/sharp-memory.c
index cbf69460ebf3..595926ed660e 100644
--- a/drivers/gpu/drm/tiny/sharp-memory.c
+++ b/drivers/gpu/drm/tiny/sharp-memory.c
@@ -120,8 +120,8 @@ static inline void sharp_memory_set_tx_buffer_addresses(u8 *buffer,
struct drm_rect clip,
u32 pitch)
{
- for (u32 line = 0; line < clip.y2; ++line)
- buffer[line * pitch] = line + 1;
+ for (u32 line = 0; line < drm_rect_height(&clip); ++line)
+ buffer[line * pitch] = clip.y1 + line + 1;
}

static void sharp_memory_set_tx_buffer_data(u8 *buffer,

--
2.43.0