drm/tiny: sharp-memory: fix TX buffer corruption on partial update
Subsystems (3)
cover drm/tiny: sharp-memory: fix TX buffer corruption on partial update
Users running applications that submit partial framebuffer updates (such as LVGL with dirty-region tracking) can observe persistent flickering on the display when using animations.
The flickering is caused by two bugs that corrupt the TX buffer on partial updates. The first patch fixes incorrect line address assignment in sharp_memory_set_tx_buffer_addresses(). The second patch fixes stale data transmission in sharp_memory_update_display(). Both patches are needed to fully eliminate the flickering.
---
Tobias Johansson (2):
drm/tiny: sharp-memory: fix line address assignment on partial update drm/tiny: sharp-memory: avoid transmitting stale TX buffer data
drivers/gpu/drm/tiny/sharp-memory.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
---
base-commit: ba683f774299d89d17cde03bb1bdb13f3513cd20
change-id: 20260316-flickering-f9df09243d2f
Best regards,
Signature · 1 line
Tobias Johansson <[email protected]>
PATCH 1/2 drm/tiny: sharp-memory: fix line address assignment on partial update
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.
--- drivers/gpu/drm/tiny/sharp-memory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tiny/sharp-memory.c +2 -2
@@ -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,
Signature · 1 line
2.43.0
PATCH 2/2 drm/tiny: sharp-memory: avoid transmitting stale TX buffer data
In reply to Tobias JohanssonWhen 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.
--- drivers/gpu/drm/tiny/sharp-memory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tiny/sharp-memory.c +2 -2
@@ -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);
Signature · 1 line
2.43.0