mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
feat(env_support): cmsis pack monthly update (#3209)
* feat(gpu): update lv_gpu_arm2d * feat(cmsis-pack): Monthly update for March
This commit is contained in:
parent
f426d546fa
commit
a5b9a1c210
Binary file not shown.
@ -36,7 +36,7 @@
|
||||
<repository type="git">https://github.com/lvgl/lvgl.git</repository>
|
||||
|
||||
<releases>
|
||||
<release date="2022-03-11" version="1.0.2-alpha1" url="https://raw.githubusercontent.com/lvgl/lvgl/master/env_support/cmsis-pack/LVGL.lvgl.1.0.2-alpha1.pack">
|
||||
<release date="2022-03-27" version="1.0.2" url="https://raw.githubusercontent.com/lvgl/lvgl/master/env_support/cmsis-pack/LVGL.lvgl.1.0.2.pack">
|
||||
- LVGL 8.3.0-dev
|
||||
- Monthly update for March
|
||||
- Add GPU support for Arm-2D library
|
||||
@ -326,7 +326,7 @@
|
||||
</files>
|
||||
</component>
|
||||
|
||||
<component Cgroup="lvgl" Csub="GPU Arm-2D" condition="LVGL-Essential" Cversion="1.0.0-dev">
|
||||
<component Cgroup="lvgl" Csub="GPU Arm-2D" condition="LVGL-Essential" Cversion="1.0.1">
|
||||
<description>A 2D image processing library from Arm (i.e. Arm-2D) for All Cortex-M processors including Cortex-M0</description>
|
||||
<files>
|
||||
<file category="sourceC" name="src/draw/arm2d/lv_gpu_arm2d.c" condition="Arm-2D"/>
|
||||
@ -336,6 +336,11 @@
|
||||
|
||||
/*! \brief enable Arm-2D support*/
|
||||
#define LV_USE_GPU_ARM2D 1
|
||||
|
||||
/*! \brief disable asynchronouse mode by default */
|
||||
#ifndef __ARM_2D_HAS_ASYNC__
|
||||
# define __ARM_2D_HAS_ASYNC__ 0
|
||||
#endif
|
||||
</RTE_Components_h>
|
||||
|
||||
</component>
|
||||
|
@ -2,8 +2,8 @@
|
||||
<index schemaVersion="1.0.0" xs:noNamespaceSchemaLocation="PackIndex.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<vendor>LVGL</vendor>
|
||||
<url>https://raw.githubusercontent.com/lvgl/lvgl/master/env_support/cmsis-pack/</url>
|
||||
<timestamp>2022-02-26T12:01:00</timestamp>
|
||||
<timestamp>2022-03-27T20:44:00</timestamp>
|
||||
<pindex>
|
||||
<pdsc url="https://raw.githubusercontent.com/lvgl/lvgl/master/env_support/cmsis-pack/" vendor="LVGL" name="lvgl" version="1.0.1"/>
|
||||
<pdsc url="https://raw.githubusercontent.com/lvgl/lvgl/master/env_support/cmsis-pack/" vendor="LVGL" name="lvgl" version="1.0.2"/>
|
||||
</pindex>
|
||||
</index>
|
@ -38,6 +38,7 @@
|
||||
#define __arm_2d_impl_copy __arm_2d_impl_rgb16_copy
|
||||
#define __arm_2d_impl_alpha_blending __arm_2d_impl_rgb565_alpha_blending
|
||||
#define __arm_2d_impl_src_msk_copy __arm_2d_impl_rgb565_src_msk_copy
|
||||
#define __arm_2d_impl_src_chn_msk_copy __arm_2d_impl_rgb565_src_chn_msk_copy
|
||||
#define color_int uint16_t
|
||||
|
||||
#elif LV_COLOR_DEPTH == 32
|
||||
@ -62,6 +63,7 @@
|
||||
#define __arm_2d_impl_copy __arm_2d_impl_rgb32_copy
|
||||
#define __arm_2d_impl_alpha_blending __arm_2d_impl_cccn888_alpha_blending
|
||||
#define __arm_2d_impl_src_msk_copy __arm_2d_impl_cccn888_src_msk_copy
|
||||
#define __arm_2d_impl_src_chn_msk_copy __arm_2d_impl_cccn888_src_chn_msk_copy
|
||||
#define color_int uint32_t
|
||||
|
||||
#else
|
||||
@ -159,6 +161,16 @@ void __arm_2d_impl_src_msk_copy(color_int * __RESTRICT pSourceBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t * __RESTRICT ptCopySize);
|
||||
|
||||
extern
|
||||
void __arm_2d_impl_src_chn_msk_copy(color_int * __RESTRICT pSourceBase,
|
||||
int16_t iSourceStride,
|
||||
uint32_t * __RESTRICT ptSourceMaskBase,
|
||||
int16_t iSourceMaskStride,
|
||||
arm_2d_size_t * __RESTRICT ptSourceMaskSize,
|
||||
color_int * __RESTRICT pTargetBase,
|
||||
int16_t iTargetStride,
|
||||
arm_2d_size_t * __RESTRICT ptCopySize);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM
|
||||
static bool arm_2d_fill_normal(lv_color_t * dest_buf,
|
||||
const lv_area_t * dest_area,
|
||||
@ -183,6 +195,12 @@ LV_ATTRIBUTE_FAST_MEM
|
||||
static void lv_draw_arm2d_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM
|
||||
static void lv_gpu_arm2d_wait_cb(lv_draw_ctx_t * draw_ctx);
|
||||
LV_ATTRIBUTE_FAST_MEM
|
||||
static void lv_draw_arm2d_img_decoded(struct _lv_draw_ctx_t * draw_ctx,
|
||||
const lv_draw_img_dsc_t * draw_dsc,
|
||||
const lv_area_t * coords,
|
||||
const uint8_t * src_buf,
|
||||
lv_img_cf_t cf);
|
||||
|
||||
|
||||
|
||||
@ -198,14 +216,10 @@ static void lv_gpu_arm2d_wait_cb(lv_draw_ctx_t * draw_ctx);
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
void lv_draw_arm2d_init(void)
|
||||
{
|
||||
arm_2d_init();
|
||||
}
|
||||
|
||||
|
||||
void lv_draw_arm2d_ctx_init(lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx)
|
||||
{
|
||||
arm_2d_init();
|
||||
|
||||
lv_draw_sw_init_ctx(drv, draw_ctx);
|
||||
|
||||
lv_draw_arm2d_ctx_t * arm2d_draw_ctx = (lv_draw_sw_ctx_t *)draw_ctx;
|
||||
@ -213,6 +227,10 @@ void lv_draw_arm2d_ctx_init(lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx)
|
||||
arm2d_draw_ctx->blend = lv_draw_arm2d_blend;
|
||||
arm2d_draw_ctx->base_draw.wait_for_finish = lv_gpu_arm2d_wait_cb;
|
||||
|
||||
#if !__ARM_2D_HAS_ASYNC__
|
||||
arm2d_draw_ctx->base_draw.draw_img_decoded = lv_draw_arm2d_img_decoded;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void lv_draw_arm2d_ctx_deinit(lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx)
|
||||
@ -516,9 +534,8 @@ static void lv_draw_arm2d_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend
|
||||
}
|
||||
|
||||
lv_color_t * dest_buf = draw_ctx->buf;
|
||||
if(disp->driver->set_px_cb == NULL) {
|
||||
dest_buf += dest_stride * (blend_area.y1 - draw_ctx->buf_area->y1) + (blend_area.x1 - draw_ctx->buf_area->x1);
|
||||
}
|
||||
dest_buf += dest_stride * (blend_area.y1 - draw_ctx->buf_area->y1)
|
||||
+ (blend_area.x1 - draw_ctx->buf_area->x1);
|
||||
|
||||
const lv_color_t * src_buf = dsc->src_buf;
|
||||
lv_coord_t src_stride;
|
||||
@ -661,9 +678,6 @@ static bool arm_2d_copy_normal(lv_color_t * dest_buf,
|
||||
int32_t w = lv_area_get_width(dest_area);
|
||||
int32_t h = lv_area_get_height(dest_area);
|
||||
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
|
||||
arm_2d_size_t copy_size = {
|
||||
.iWidth = lv_area_get_width(dest_area),
|
||||
.iHeight = lv_area_get_height(dest_area),
|
||||
@ -739,6 +753,283 @@ static bool arm_2d_copy_normal(lv_color_t * dest_buf,
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM
|
||||
static void lv_draw_arm2d_img_decoded(struct _lv_draw_ctx_t * draw_ctx,
|
||||
const lv_draw_img_dsc_t * draw_dsc,
|
||||
const lv_area_t * coords,
|
||||
const uint8_t * src_buf,
|
||||
lv_img_cf_t cf)
|
||||
{
|
||||
bool mask_any = lv_draw_mask_is_any(draw_ctx->clip_area);
|
||||
|
||||
/*The simplest case just copy the pixels into the draw_buf*/
|
||||
if(!mask_any && draw_dsc->angle == 0 && draw_dsc->zoom == LV_IMG_ZOOM_NONE &&
|
||||
cf == LV_IMG_CF_TRUE_COLOR && draw_dsc->recolor_opa == LV_OPA_TRANSP) {
|
||||
|
||||
lv_draw_sw_img_decoded(draw_ctx, draw_dsc, coords, src_buf, cf);
|
||||
return ;
|
||||
}
|
||||
/*In the other cases every pixel need to be checked one-by-one*/
|
||||
else {
|
||||
/*Use the clip area as draw area*/
|
||||
lv_area_t draw_area;
|
||||
lv_area_copy(&draw_area, draw_ctx->clip_area);
|
||||
|
||||
lv_draw_sw_blend_dsc_t blend_dsc;
|
||||
lv_memset_00(&blend_dsc, sizeof(blend_dsc));
|
||||
blend_dsc.opa = draw_dsc->opa;
|
||||
blend_dsc.blend_mode = draw_dsc->blend_mode;
|
||||
|
||||
|
||||
//#if LV_DRAW_COMPLEX
|
||||
/*The pixel size in byte is different if an alpha byte is added too*/
|
||||
uint8_t px_size_byte = cf == LV_IMG_CF_TRUE_COLOR_ALPHA ? LV_IMG_PX_SIZE_ALPHA_BYTE : sizeof(lv_color_t);
|
||||
|
||||
/*Go to the first displayed pixel of the map*/
|
||||
int32_t src_stride = lv_area_get_width(coords);
|
||||
|
||||
lv_color_t c;
|
||||
lv_color_t chroma_keyed_color = LV_COLOR_CHROMA_KEY;
|
||||
uint32_t px_i = 0;
|
||||
|
||||
const uint8_t * map_px;
|
||||
|
||||
lv_coord_t draw_area_h = lv_area_get_height(&draw_area);
|
||||
lv_coord_t draw_area_w = lv_area_get_width(&draw_area);
|
||||
|
||||
lv_area_t blend_area;
|
||||
blend_area.x1 = draw_area.x1;
|
||||
blend_area.x2 = draw_area.x2;
|
||||
blend_area.y1 = draw_area.y1;
|
||||
blend_area.y2 = blend_area.y1;
|
||||
blend_dsc.blend_area = &blend_area;
|
||||
|
||||
bool transform = draw_dsc->angle != 0 || draw_dsc->zoom != LV_IMG_ZOOM_NONE ? true : false;
|
||||
/*Simple ARGB image. Handle it as special case because it's very common*/
|
||||
if(!mask_any && !transform && cf == LV_IMG_CF_TRUE_COLOR_ALPHA && draw_dsc->recolor_opa == LV_OPA_TRANSP) {
|
||||
|
||||
const uint8_t * src_buf_tmp = src_buf;
|
||||
src_buf_tmp += src_stride * (draw_area.y1 - coords->y1) * px_size_byte;
|
||||
src_buf_tmp += (draw_area.x1 - coords->x1) * px_size_byte;
|
||||
|
||||
#if LV_COLOR_DEPTH == 32
|
||||
if(blend_dsc.opa >= LV_OPA_MAX) {
|
||||
lv_area_t blend_area2;
|
||||
if(!_lv_area_intersect(&blend_area2, &draw_area, draw_ctx->clip_area)) return;
|
||||
|
||||
int32_t w = lv_area_get_width(&blend_area2);
|
||||
int32_t h = lv_area_get_height(&blend_area2);
|
||||
|
||||
lv_coord_t dest_stride = lv_area_get_width(draw_ctx->buf_area);
|
||||
|
||||
lv_color_t * dest_buf = draw_ctx->buf;
|
||||
dest_buf += dest_stride * (blend_area2.y1 - draw_ctx->buf_area->y1)
|
||||
+ (blend_area2.x1 - draw_ctx->buf_area->x1);
|
||||
|
||||
arm_2d_size_t copy_size = {
|
||||
.iWidth = lv_area_get_width(&blend_area2),
|
||||
.iHeight = lv_area_get_height(&blend_area2),
|
||||
};
|
||||
|
||||
//lv_area_move(&blend_area2, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
|
||||
__arm_2d_impl_src_chn_msk_copy(
|
||||
(color_int *)src_buf_tmp,
|
||||
src_stride,
|
||||
(uint32_t *)((uintptr_t)src_buf_tmp + LV_IMG_PX_SIZE_ALPHA_BYTE - 1),
|
||||
src_stride,
|
||||
©_size,
|
||||
(color_int *)dest_buf,
|
||||
dest_stride,
|
||||
©_size);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
lv_draw_sw_img_decoded(draw_ctx, draw_dsc, coords, src_buf, cf);
|
||||
return ;
|
||||
}
|
||||
|
||||
}
|
||||
/*Most complicated case: transform or other mask or chroma keyed*/
|
||||
else {
|
||||
/*Build the image and a mask line-by-line*/
|
||||
uint32_t hor_res = (uint32_t) lv_disp_get_hor_res(_lv_refr_get_disp_refreshing());
|
||||
uint32_t mask_buf_size = lv_area_get_size(&draw_area) > hor_res ? hor_res : lv_area_get_size(&draw_area);
|
||||
lv_color_t * src_buf_rgb = lv_mem_buf_get(mask_buf_size * sizeof(lv_color_t));
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(mask_buf_size);
|
||||
blend_dsc.mask_buf = mask_buf;
|
||||
blend_dsc.mask_area = &blend_area;
|
||||
blend_dsc.mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
blend_dsc.src_buf = src_buf_rgb;
|
||||
|
||||
const uint8_t * src_buf_tmp = NULL;
|
||||
#if LV_DRAW_COMPLEX
|
||||
lv_img_transform_dsc_t trans_dsc;
|
||||
lv_memset_00(&trans_dsc, sizeof(lv_img_transform_dsc_t));
|
||||
if(transform) {
|
||||
trans_dsc.cfg.angle = draw_dsc->angle;
|
||||
trans_dsc.cfg.zoom = draw_dsc->zoom;
|
||||
trans_dsc.cfg.src = src_buf;
|
||||
trans_dsc.cfg.src_w = src_stride;
|
||||
trans_dsc.cfg.src_h = lv_area_get_height(coords);
|
||||
trans_dsc.cfg.cf = cf;
|
||||
trans_dsc.cfg.pivot_x = draw_dsc->pivot.x;
|
||||
trans_dsc.cfg.pivot_y = draw_dsc->pivot.y;
|
||||
trans_dsc.cfg.color = draw_dsc->recolor;
|
||||
trans_dsc.cfg.antialias = draw_dsc->antialias;
|
||||
|
||||
_lv_img_buf_transform_init(&trans_dsc);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
src_buf_tmp = src_buf;
|
||||
src_buf_tmp += src_stride * (draw_area.y1 - coords->y1) * px_size_byte;
|
||||
src_buf_tmp += (draw_area.x1 - coords->x1) * px_size_byte;
|
||||
}
|
||||
|
||||
uint16_t recolor_premult[3] = {0};
|
||||
lv_opa_t recolor_opa_inv = 255 - draw_dsc->recolor_opa;
|
||||
if(draw_dsc->recolor_opa != 0) {
|
||||
lv_color_premult(draw_dsc->recolor, draw_dsc->recolor_opa, recolor_premult);
|
||||
}
|
||||
|
||||
blend_dsc.mask_res = (cf != LV_IMG_CF_TRUE_COLOR || draw_dsc->angle ||
|
||||
draw_dsc->zoom != LV_IMG_ZOOM_NONE) ? LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER;
|
||||
|
||||
/*Prepare the `mask_buf`if there are other masks*/
|
||||
if(mask_any) {
|
||||
lv_memset_ff(mask_buf, mask_buf_size);
|
||||
}
|
||||
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
#if LV_DRAW_COMPLEX
|
||||
int32_t rot_y = blend_area.y1 - coords->y1;
|
||||
#endif
|
||||
for(y = 0; y < draw_area_h; y++) {
|
||||
map_px = src_buf_tmp;
|
||||
#if LV_DRAW_COMPLEX
|
||||
uint32_t px_i_start = px_i;
|
||||
int32_t rot_x = blend_area.x1 - coords->x1;
|
||||
#endif
|
||||
|
||||
for(x = 0; x < draw_area_w; x++, px_i++, map_px += px_size_byte) {
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
if(transform) {
|
||||
|
||||
/*Transform*/
|
||||
bool ret;
|
||||
ret = _lv_img_buf_transform(&trans_dsc, rot_x + x, rot_y + y);
|
||||
if(ret == false) {
|
||||
mask_buf[px_i] = LV_OPA_TRANSP;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
mask_buf[px_i] = trans_dsc.res.opa;
|
||||
c.full = trans_dsc.res.color.full;
|
||||
}
|
||||
}
|
||||
/*No transform*/
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if(cf == LV_IMG_CF_TRUE_COLOR_ALPHA) {
|
||||
lv_opa_t px_opa = map_px[LV_IMG_PX_SIZE_ALPHA_BYTE - 1];
|
||||
mask_buf[px_i] = px_opa;
|
||||
if(px_opa == 0) {
|
||||
#if LV_COLOR_DEPTH == 32
|
||||
src_buf_rgb[px_i].full = 0;
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
mask_buf[px_i] = 0xFF;
|
||||
}
|
||||
|
||||
#if LV_COLOR_DEPTH == 1
|
||||
c.full = map_px[0];
|
||||
#elif LV_COLOR_DEPTH == 8
|
||||
c.full = map_px[0];
|
||||
#elif LV_COLOR_DEPTH == 16
|
||||
c.full = map_px[0] + (map_px[1] << 8);
|
||||
#elif LV_COLOR_DEPTH == 32
|
||||
c.full = *((uint32_t *)map_px);
|
||||
c.ch.alpha = 0xFF;
|
||||
#endif
|
||||
if(cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED) {
|
||||
if(c.full == chroma_keyed_color.full) {
|
||||
mask_buf[px_i] = LV_OPA_TRANSP;
|
||||
#if LV_COLOR_DEPTH == 32
|
||||
src_buf_rgb[px_i].full = 0;
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(draw_dsc->recolor_opa != 0) {
|
||||
c = lv_color_mix_premult(recolor_premult, c, recolor_opa_inv);
|
||||
}
|
||||
|
||||
src_buf_rgb[px_i].full = c.full;
|
||||
}
|
||||
#if LV_DRAW_COMPLEX
|
||||
/*Apply the masks if any*/
|
||||
if(mask_any) {
|
||||
lv_draw_mask_res_t mask_res_sub;
|
||||
mask_res_sub = lv_draw_mask_apply(mask_buf + px_i_start, blend_area.x1,
|
||||
y + draw_area.y1, draw_area_w);
|
||||
if(mask_res_sub == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(mask_buf + px_i_start, draw_area_w);
|
||||
blend_dsc.mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
else if(mask_res_sub == LV_DRAW_MASK_RES_CHANGED) {
|
||||
blend_dsc.mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
src_buf_tmp += src_stride * px_size_byte;
|
||||
if(px_i + draw_area_w < mask_buf_size) {
|
||||
blend_area.y2 ++;
|
||||
}
|
||||
else {
|
||||
lv_draw_sw_blend(draw_ctx, &blend_dsc);
|
||||
|
||||
blend_area.y1 = blend_area.y2 + 1;
|
||||
blend_area.y2 = blend_area.y1;
|
||||
|
||||
px_i = 0;
|
||||
blend_dsc.mask_res = (cf != LV_IMG_CF_TRUE_COLOR || draw_dsc->angle ||
|
||||
draw_dsc->zoom != LV_IMG_ZOOM_NONE) ? LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER;
|
||||
|
||||
/*Prepare the `mask_buf`if there are other masks*/
|
||||
if(mask_any) {
|
||||
lv_memset_ff(mask_buf, mask_buf_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*Flush the last part*/
|
||||
if(blend_area.y1 != blend_area.y2) {
|
||||
blend_area.y2--;
|
||||
lv_draw_sw_blend(draw_ctx, &blend_dsc);
|
||||
}
|
||||
|
||||
lv_mem_buf_release(mask_buf);
|
||||
lv_mem_buf_release(src_buf_rgb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void lv_gpu_arm2d_wait_cb(lv_draw_ctx_t * draw_ctx)
|
||||
{
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
|
@ -34,8 +34,6 @@ struct _lv_disp_drv_t;
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_draw_arm2d_init(void);
|
||||
|
||||
void lv_draw_arm2d_ctx_init(struct _lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
void lv_draw_arm2d_ctx_deinit(struct _lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx);
|
||||
|
Loading…
x
Reference in New Issue
Block a user