Skip to content

Commit

Permalink
Zephyr: improve render performance when using the NXP ELCDIF driver
Browse files Browse the repository at this point in the history
When this driver is using the DMA API, we cannot do partial updates.
Previously, this code would then perform a full-screen DMA transfer for
each region the renderer changes. Now we make modifications to the pixel
data of the dirty regions, if required, and then do one fill-scren DMA
transfer of the final render buffer.
  • Loading branch information
0x6e authored and tronical committed Dec 19, 2024
1 parent 8719c0e commit 33dbdbc
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions demos/printerdemo/zephyr/src/slint-zephyr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,15 +283,11 @@ void ZephyrWindowAdapter::maybe_redraw()
*px = (*px << 8) | (*px >> 8);
}
}
LOG_DBG(" - converted pixel data for x: %d y: %d w: %d h: %d", o.x, o.y, s.width,
s.height);
#endif

#ifdef CONFIG_MCUX_ELCDIF_PXP
// The display driver cannot do partial updates when the PXP is using the DMA API.
if (const auto ret =
display_write(m_display, 0, 0, &m_buffer_descriptor, m_buffer.data()) != 0) {
LOG_WRN("display_write returned non-zero: %d", ret);
}
#else
#ifndef CONFIG_MCUX_ELCDIF_PXP
m_buffer_descriptor.width = s.width;
m_buffer_descriptor.height = s.height;

Expand All @@ -300,9 +296,20 @@ void ZephyrWindowAdapter::maybe_redraw()
!= 0) {
LOG_WRN("display_write returned non-zero: %d", ret);
}
#endif
LOG_DBG(" - rendered x: %d y: %d w: %d h: %d", o.x, o.y, s.width, s.height);
#endif
}

#ifdef CONFIG_MCUX_ELCDIF_PXP
// The display driver cannot do partial updates when the PXP is using the DMA API.
if (const auto ret =
display_write(m_display, 0, 0, &m_buffer_descriptor, m_buffer.data()) != 0) {
LOG_WRN("display_write returned non-zero: %d", ret);
}
LOG_DBG(" - rendered x: 0 y: 0 w: %d h: %d", m_buffer_descriptor.width,
m_buffer_descriptor.height);
#endif

const auto displayWriteDelta = k_uptime_delta(&start);
LOG_DBG(" - total: %lld ms, slint: %lld ms, write: %lld ms",
slintRenderDelta + displayWriteDelta, slintRenderDelta, displayWriteDelta);
Expand Down

0 comments on commit 33dbdbc

Please sign in to comment.