Skip to content

Commit

Permalink
chore(conf): default align to 1 instead of 4
Browse files Browse the repository at this point in the history
Default to 1 to make it behave same to lvgl v8.
To avoid confusions raised in lvgl/lv_binding_micropython#313

Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
  • Loading branch information
XuNeo committed Jan 11, 2024
1 parent 87e9d54 commit 439ecea
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/__lv_conf.h__
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
#define LV_DRAW_BUF_STRIDE_ALIGN 1

/*Align the start address of draw_buf addresses to this bytes*/
#define LV_DRAW_BUF_ALIGN 4
#define LV_DRAW_BUF_ALIGN 1

#define LV_USE_DRAW_SW 1
#if LV_USE_DRAW_SW == 1
Expand Down
2 changes: 1 addition & 1 deletion env_support/cmsis-pack/lv_conf_cmsis.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
#define LV_DRAW_BUF_STRIDE_ALIGN 1

/*Align the start address of draw_buf addresses to this bytes*/
#define LV_DRAW_BUF_ALIGN 4
#define LV_DRAW_BUF_ALIGN 1

#define LV_USE_DRAW_SW 1
#if LV_USE_DRAW_SW == 1
Expand Down
2 changes: 1 addition & 1 deletion lv_conf_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
#define LV_DRAW_BUF_STRIDE_ALIGN 1

/*Align the start address of draw_buf addresses to this bytes*/
#define LV_DRAW_BUF_ALIGN 4
#define LV_DRAW_BUF_ALIGN 1

#define LV_USE_DRAW_SW 1
#if LV_USE_DRAW_SW == 1
Expand Down
4 changes: 4 additions & 0 deletions src/draw/lv_draw_buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,12 +382,16 @@ static void * buf_align(void * buf, lv_color_format_t color_format)
{
LV_UNUSED(color_format);

#if LV_DRAW_BUF_ALIGN == 1
return buf;
#else
uint8_t * buf_u8 = buf;
if(buf_u8) {
buf_u8 += LV_DRAW_BUF_ALIGN - 1;
buf_u8 = (uint8_t *)((lv_uintptr_t) buf_u8 & ~(LV_DRAW_BUF_ALIGN - 1));
}
return buf_u8;
#endif
}

static uint32_t width_to_stride(uint32_t w, lv_color_format_t color_format)
Expand Down
10 changes: 7 additions & 3 deletions src/lv_conf_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,14 @@

/*Align the start address of draw_buf addresses to this bytes*/
#ifndef LV_DRAW_BUF_ALIGN
#ifdef CONFIG_LV_DRAW_BUF_ALIGN
#define LV_DRAW_BUF_ALIGN CONFIG_LV_DRAW_BUF_ALIGN
#ifdef _LV_KCONFIG_PRESENT
#ifdef CONFIG_LV_DRAW_BUF_ALIGN
#define LV_DRAW_BUF_ALIGN CONFIG_LV_DRAW_BUF_ALIGN
#else
#define LV_DRAW_BUF_ALIGN 0
#endif
#else
#define LV_DRAW_BUF_ALIGN 4
#define LV_DRAW_BUF_ALIGN 1
#endif
#endif

Expand Down

0 comments on commit 439ecea

Please sign in to comment.