fix(dave2d): required when using LVGL with LV_COLOR_DEPTH 32 (#7323)

This commit is contained in:
jeremy-baker 2024-11-21 09:05:00 +00:00 committed by GitHub
parent bc5a040519
commit d5759a0926
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 57 additions and 3 deletions

View File

@ -217,6 +217,11 @@ static int32_t _dave2d_evaluate(lv_draw_unit_t * u, lv_draw_task_t * t)
LV_UNUSED(u);
int32_t ret = 0;
lv_draw_dsc_base_t * draw_dsc_base = (lv_draw_dsc_base_t *) t->draw_dsc;
if(!lv_draw_dave2d_is_dest_cf_supported(draw_dsc_base->layer->color_format))
return 0;
switch(t->type) {
case LV_DRAW_TASK_TYPE_FILL: {
#if USE_D2
@ -367,6 +372,11 @@ static int32_t lv_draw_dave2d_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t *
return LV_DRAW_UNIT_IDLE; /*Couldn't start rendering*/
}
/* Return if target buffer format is not supported. */
if(!lv_draw_dave2d_is_dest_cf_supported(layer->color_format)) {
return LV_DRAW_UNIT_IDLE; /*Couldn't start rendering*/
}
void * buf = lv_draw_layer_alloc_buf(layer);
if(buf == NULL) {
return LV_DRAW_UNIT_IDLE; /*Couldn't start rendering*/

View File

@ -75,7 +75,7 @@ d2_s32 lv_draw_dave2d_cf_fb_get(void)
d2_fb_mode = d2_mode_argb8888;
break;
case DISPLAY_IN_FORMAT_32BITS_RGB888: ///< RGB888, 32 bits
d2_fb_mode = d2_mode_rgb888;
d2_fb_mode = d2_mode_argb8888; //GLCDC ignores Alpha when configured for RGB888
break;
case DISPLAY_IN_FORMAT_16BITS_ARGB4444: ///< ARGB4444, 16 bits
d2_fb_mode = d2_mode_argb4444;
@ -99,18 +99,39 @@ d2_u32 lv_draw_dave2d_lv_colour_fmt_to_d2_fmt(lv_color_format_t colour_format)
d2_u32 d2_lvgl_mode = 0;
switch(colour_format) {
case(LV_COLOR_FORMAT_I1):
d2_lvgl_mode = d2_mode_i1;
break;
case(LV_COLOR_FORMAT_I2):
d2_lvgl_mode = d2_mode_i2;
break;
case(LV_COLOR_FORMAT_I4):
d2_lvgl_mode = d2_mode_i4;
break;
case(LV_COLOR_FORMAT_I8):
d2_lvgl_mode = d2_mode_i4;
break;
case(LV_COLOR_FORMAT_A8):
d2_lvgl_mode = d2_mode_alpha8; //?
d2_lvgl_mode = d2_mode_alpha8;
break;
case(LV_COLOR_FORMAT_RGB565):
d2_lvgl_mode = d2_mode_rgb565;
break;
case(LV_COLOR_FORMAT_RGB888):
d2_lvgl_mode = d2_mode_argb8888; //?
d2_lvgl_mode = d2_mode_rgb888;
break;
case(LV_COLOR_FORMAT_ARGB1555):
d2_lvgl_mode = d2_mode_argb1555;
break;
case(LV_COLOR_FORMAT_ARGB4444):
d2_lvgl_mode = d2_mode_argb4444;
break;
case(LV_COLOR_FORMAT_ARGB8888):
d2_lvgl_mode = d2_mode_argb8888;
break;
case(LV_COLOR_FORMAT_XRGB8888):
d2_lvgl_mode = d2_mode_argb8888;
break;
default:
LV_ASSERT(0);
@ -133,6 +154,27 @@ void d2_framebuffer_from_layer(d2_device * handle, lv_layer_t * layer)
lv_draw_dave2d_lv_colour_fmt_to_d2_fmt(layer->color_format));
}
bool lv_draw_dave2d_is_dest_cf_supported(lv_color_format_t cf)
{
bool result;
switch(cf) {
case LV_COLOR_FORMAT_A8:
case LV_COLOR_FORMAT_RGB565:
case LV_COLOR_FORMAT_ARGB8888:
case LV_COLOR_FORMAT_XRGB8888:
case LV_COLOR_FORMAT_ARGB4444:
result = true;
break;
default:
result = false;
break;
}
return result;
}
/**********************
* STATIC FUNCTIONS
**********************/

View File

@ -34,6 +34,8 @@ d2_u32 lv_draw_dave2d_lv_colour_fmt_to_d2_fmt(lv_color_format_t colour_format);
void d2_framebuffer_from_layer(d2_device * handle, lv_layer_t * layer);
bool lv_draw_dave2d_is_dest_cf_supported(lv_color_format_t cf);
/**********************
* MACROS
**********************/