* [PATCH RESEND 1/2] drm/tiny: sharp-memory: fix line address assignment on partial update
2026-09-01 11:53 [PATCH RESEND 0/2] drm/tiny: sharp-memory: fix TX buffer corruption on partial update Tobias Johansson
@ 2026-09-01 11:53 ` Tobias Johansson
2026-09-01 11:53 ` [PATCH RESEND 2/2] drm/tiny: sharp-memory: avoid transmitting stale TX buffer data Tobias Johansson
1 sibling, 0 replies; 3+ messages in thread
From: Tobias Johansson @ 2026-09-01 11:53 UTC (permalink / raw)
To: Alex Lanzano, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Dmitry Baryshkov,
Mehdi Djait, Uwe Kleine-König
Cc: dri-devel, linux-kernel, Tobias Johansson, kernel
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@axis.com>
---
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
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH RESEND 2/2] drm/tiny: sharp-memory: avoid transmitting stale TX buffer data
2026-09-01 11:53 [PATCH RESEND 0/2] drm/tiny: sharp-memory: fix TX buffer corruption on partial update Tobias Johansson
2026-09-01 11:53 ` [PATCH RESEND 1/2] drm/tiny: sharp-memory: fix line address assignment " Tobias Johansson
@ 2026-09-01 11:53 ` Tobias Johansson
1 sibling, 0 replies; 3+ messages in thread
From: Tobias Johansson @ 2026-09-01 11:53 UTC (permalink / raw)
To: Alex Lanzano, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Dmitry Baryshkov,
Mehdi Djait, Uwe Kleine-König
Cc: dri-devel, linux-kernel, Tobias Johansson, kernel
When only a subset of lines is dirty, the TX buffer sent to the
panel contains stale line data from previous updates, resulting
in visible flickering on the display.
sharp_memory_update_display() transmits the entire TX buffer
regardless of how many lines were updated. Entries written by a
previous larger update linger in the buffer and
are retransmitted on every subsequent smaller update, overwriting
the newly written data with stale content.
Fix sharp_memory_update_display() to transmit only the buffer
entries populated by the current update.
Fixes: b8f9f21716fec ("drm/tiny: Add driver for Sharp Memory LCD")
Signed-off-by: Tobias Johansson <tobias.johansson@axis.com>
---
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 595926ed660e..e7521fc6a010 100644
--- a/drivers/gpu/drm/tiny/sharp-memory.c
+++ b/drivers/gpu/drm/tiny/sharp-memory.c
@@ -155,7 +155,7 @@ static int sharp_memory_update_display(struct sharp_memory_device *smd,
u32 pitch = smd->pitch;
u8 vcom = smd->vcom;
u8 *tx_buffer = smd->tx_buffer;
- u32 tx_buffer_size = smd->tx_buffer_size;
+ u32 tx_len = 1 + (drm_rect_height(&clip) * pitch);
mutex_lock(&smd->tx_mutex);
@@ -165,7 +165,7 @@ static int sharp_memory_update_display(struct sharp_memory_device *smd,
sharp_memory_set_tx_buffer_addresses(&tx_buffer[1], clip, pitch);
sharp_memory_set_tx_buffer_data(&tx_buffer[2], fb, vmap, clip, pitch, fmtcnv_state);
- ret = sharp_memory_spi_write(smd->spi, tx_buffer, tx_buffer_size);
+ ret = sharp_memory_spi_write(smd->spi, tx_buffer, tx_len);
mutex_unlock(&smd->tx_mutex);
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread