Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modules: LVGL: Add Support for Rounder Callback #69410

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions boards/renesas/da1469x_dk_pro/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# DA1469x series Development Kit Pro board configuration

# Copyright (c) 2024 Renesas Electronics Corporation
# SPDX-License-Identifier: Apache-2.0

if BOARD_DA1469X_DK_PRO

config LV_Z_AREA_X_ALIGNMENT_WIDTH
default 2
depends on LVGL

endif # BOARD_DA1469X_DK_PRO
20 changes: 20 additions & 0 deletions modules/lvgl/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ config LV_Z_LOG_LEVEL
default 3 if LV_LOG_LEVEL_USER
default 4 if LV_LOG_LEVEL_TRACE

config LV_Z_USE_ROUNDER_CB
bool
default y if LV_Z_AREA_X_ALIGNMENT_WIDTH != 1 || LV_Z_AREA_Y_ALIGNMENT_WIDTH != 1

config APP_LINK_WITH_LVGL
bool "Link 'app' with LVGL"
default y
Expand Down Expand Up @@ -107,6 +111,22 @@ config LV_Z_FLUSH_THREAD_PRIO

endif # LV_Z_FLUSH_THREAD

config LV_Z_AREA_X_ALIGNMENT_WIDTH
int "Frame X alignment size"
default 1
help
Number of pixels, X axis should be rounded to. Should be used to override
the current frame dimensions to meet display and/or LCD host
controller requirements. The value must be power of 2.

config LV_Z_AREA_Y_ALIGNMENT_WIDTH
int "Frame Y alignment size"
default 1
help
Number of pixels, Y axis should be rounded to. Should be used to override
the current frame dimensions to meet display and/or LCD host
controller requirements. The value must be power of 2.

rsource "Kconfig.memory"
rsource "Kconfig.input"
rsource "Kconfig.shell"
Expand Down
4 changes: 4 additions & 0 deletions modules/lvgl/include/lvgl_display.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ int set_lvgl_rendering_cb(lv_disp_drv_t *disp_drv);

void lvgl_flush_display(struct lvgl_display_flush *request);

#ifdef CONFIG_LV_Z_USE_ROUNDER_CB
void lvgl_rounder_cb(lv_disp_drv_t *disp_drv, lv_area_t *area);
#endif

#ifdef __cplusplus
}
#endif
Expand Down
26 changes: 23 additions & 3 deletions modules/lvgl/lvgl_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,26 @@ void lvgl_wait_cb(lv_disp_drv_t *disp_drv)

#endif /* CONFIG_LV_Z_FLUSH_THREAD */

#ifdef CONFIG_LV_Z_USE_ROUNDER_CB
void lvgl_rounder_cb(lv_disp_drv_t *disp_drv, lv_area_t *area)
pdgendt marked this conversation as resolved.
Show resolved Hide resolved
{
#if CONFIG_LV_Z_AREA_X_ALIGNMENT_WIDTH != 1
__ASSERT(POPCOUNT(CONFIG_LV_Z_AREA_X_ALIGNMENT_WIDTH) == 1, "Invalid X alignment width");

area->x1 &= ~(CONFIG_LV_Z_AREA_X_ALIGNMENT_WIDTH - 1);
area->x2 |= (CONFIG_LV_Z_AREA_X_ALIGNMENT_WIDTH - 1);
#endif
#if CONFIG_LV_Z_AREA_Y_ALIGNMENT_WIDTH != 1
__ASSERT(POPCOUNT(CONFIG_LV_Z_AREA_Y_ALIGNMENT_WIDTH) == 1, "Invalid Y alignment width");

area->y1 &= ~(CONFIG_LV_Z_AREA_Y_ALIGNMENT_WIDTH - 1);
area->y2 |= (CONFIG_LV_Z_AREA_Y_ALIGNMENT_WIDTH - 1);
#endif
}
#else
#define lvgl_rounder_cb NULL
#endif

int set_lvgl_rendering_cb(lv_disp_drv_t *disp_drv)
{
int err = 0;
Expand All @@ -57,7 +77,7 @@ int set_lvgl_rendering_cb(lv_disp_drv_t *disp_drv)
switch (data->cap.current_pixel_format) {
case PIXEL_FORMAT_ARGB_8888:
disp_drv->flush_cb = lvgl_flush_cb_32bit;
disp_drv->rounder_cb = NULL;
disp_drv->rounder_cb = lvgl_rounder_cb;
#ifdef CONFIG_LV_COLOR_DEPTH_32
disp_drv->set_px_cb = NULL;
#else
Expand All @@ -66,13 +86,13 @@ int set_lvgl_rendering_cb(lv_disp_drv_t *disp_drv)
break;
case PIXEL_FORMAT_RGB_888:
disp_drv->flush_cb = lvgl_flush_cb_24bit;
disp_drv->rounder_cb = NULL;
disp_drv->rounder_cb = lvgl_rounder_cb;
disp_drv->set_px_cb = lvgl_set_px_cb_24bit;
break;
case PIXEL_FORMAT_RGB_565:
case PIXEL_FORMAT_BGR_565:
disp_drv->flush_cb = lvgl_flush_cb_16bit;
disp_drv->rounder_cb = NULL;
disp_drv->rounder_cb = lvgl_rounder_cb;
#ifdef CONFIG_LV_COLOR_DEPTH_16
disp_drv->set_px_cb = NULL;
#else
Expand Down
Loading