lvgl: Add config to disable monochrome pixel software inversion

In some cases, pixel inversion is managed by the display hardware
and software inversion is not required.

Signed-off-by: Robin-Charles Guihéneuf <robin-charles@hotmail.fr>
This commit is contained in:
Robin-Charles Guihéneuf 2025-04-17 08:28:14 +02:00 committed by Maureen Helm
commit b0715dd3f2
3 changed files with 16 additions and 0 deletions

View file

@ -212,6 +212,10 @@ New APIs and options
* :kconfig:option:`CONFIG_NVME_PRP_PAGE_SIZE` * :kconfig:option:`CONFIG_NVME_PRP_PAGE_SIZE`
* Other
* :kconfig:option:`CONFIG_LV_Z_COLOR_MONO_HW_INVERSION`
New Boards New Boards
********** **********

View file

@ -94,6 +94,10 @@ config LV_COLOR_16_SWAP
bool "Swap the 2 bytes of RGB565 color." bool "Swap the 2 bytes of RGB565 color."
depends on LV_COLOR_DEPTH_16 depends on LV_COLOR_DEPTH_16
config LV_Z_COLOR_MONO_HW_INVERSION
bool "Hardware pixel inversion (disables software pixel inversion)."
depends on LV_COLOR_DEPTH_1
config LV_Z_FLUSH_THREAD config LV_Z_FLUSH_THREAD
bool "Flush LVGL frames in a separate thread" bool "Flush LVGL frames in a separate thread"
help help

View file

@ -38,17 +38,25 @@ static ALWAYS_INLINE void set_px_at_pos(uint8_t *dst_buf, uint32_t x, uint32_t y
} }
} }
#ifdef CONFIG_LV_Z_COLOR_MONO_HW_INVERSION
*buf |= BIT(bit);
#else
if (caps->current_pixel_format == PIXEL_FORMAT_MONO10) { if (caps->current_pixel_format == PIXEL_FORMAT_MONO10) {
*buf |= BIT(bit); *buf |= BIT(bit);
} else { } else {
*buf &= ~BIT(bit); *buf &= ~BIT(bit);
} }
#endif
} }
static void lvgl_transform_buffer(uint8_t **px_map, uint32_t width, uint32_t height, static void lvgl_transform_buffer(uint8_t **px_map, uint32_t width, uint32_t height,
const struct display_capabilities *caps) const struct display_capabilities *caps)
{ {
#ifdef CONFIG_LV_Z_COLOR_MONO_HW_INVERSION
uint8_t clear_color = 0x00;
#else
uint8_t clear_color = caps->current_pixel_format == PIXEL_FORMAT_MONO10 ? 0x00 : 0xFF; uint8_t clear_color = caps->current_pixel_format == PIXEL_FORMAT_MONO10 ? 0x00 : 0xFF;
#endif
memset(mono_conv_buf, clear_color, mono_conv_buf_size); memset(mono_conv_buf, clear_color, mono_conv_buf_size);