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

fix(nema): Broken build after draw unit refactoring, draw_label changes #7759

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
11 changes: 11 additions & 0 deletions src/draw/nema_gfx/TSILVGL.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
MarkIoanAmat marked this conversation as resolved.
Show resolved Hide resolved
"folders": [
{
"path": "../../.."
},
{
"path": "../../../../NemaLVGL"
}
],
"settings": {}
}
17 changes: 13 additions & 4 deletions src/draw/nema_gfx/lv_draw_nema_gfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ static int32_t nema_gfx_evaluate(lv_draw_unit_t * draw_unit, lv_draw_task_t * ta

static int32_t nema_gfx_delete(lv_draw_unit_t * draw_unit);

static int32_t nema_gfx_wait_for_finish(lv_draw_unit_t * draw_unit);

/**********************
* STATIC VARIABLES
**********************/
Expand All @@ -91,16 +93,17 @@ static int32_t nema_gfx_delete(lv_draw_unit_t * draw_unit);
void lv_draw_nema_gfx_init(void)
{
lv_draw_nema_gfx_unit_t * draw_nema_gfx_unit = lv_draw_create_unit(sizeof(lv_draw_nema_gfx_unit_t));
/*Initialize NemaGFX*/
/*Initiallize NemaGFX*/
nema_init();

draw_nema_gfx_unit->base_unit.dispatch_cb = nema_gfx_dispatch;
draw_nema_gfx_unit->base_unit.evaluate_cb = nema_gfx_evaluate;
draw_nema_gfx_unit->base_unit.delete_cb = nema_gfx_delete;
draw_nema_gfx_unit->base_unit.wait_for_finish_cb = nema_gfx_wait_for_finish;
draw_nema_gfx_unit->base_unit.name = "NEMA_GFX";

#if LV_USE_NEMA_VG
/*Initialize NemaVG */
/*Initiallize NemaVG */
nema_vg_init(LV_NEMA_GFX_MAX_RESX, LV_NEMA_GFX_MAX_RESY);
/* Allocate VG Buffers*/
draw_nema_gfx_unit->paint = nema_vg_paint_create();
Expand Down Expand Up @@ -130,6 +133,14 @@ void lv_draw_nema_gfx_deinit(void)
* STATIC FUNCTIONS
**********************/

static int32_t nema_gfx_wait_for_finish(lv_draw_unit_t * draw_unit)
{
lv_draw_nema_gfx_unit_t * draw_nema_gfx_unit = (lv_draw_nema_gfx_unit_t *)draw_unit;
nema_cl_submit(&(draw_nema_gfx_unit->cl));
nema_cl_wait(&(draw_nema_gfx_unit->cl));
return 1;
}

static int32_t nema_gfx_evaluate(lv_draw_unit_t * draw_unit, lv_draw_task_t * task)
{
lv_draw_nema_gfx_unit_t * draw_nema_gfx_unit = (lv_draw_nema_gfx_unit_t *)draw_unit;
Expand Down Expand Up @@ -263,8 +274,6 @@ static int32_t nema_gfx_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * layer)
return LV_DRAW_UNIT_IDLE;

t->state = LV_DRAW_TASK_STATE_IN_PROGRESS;
draw_nema_gfx_unit->base_unit.target_layer = layer;
draw_nema_gfx_unit->base_unit.clip_area = &t->clip_area;
draw_nema_gfx_unit->task_act = t;

#if LV_USE_OS
Expand Down
7 changes: 5 additions & 2 deletions src/draw/nema_gfx/lv_draw_nema_gfx_border.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,12 @@ void lv_draw_nema_gfx_border(lv_draw_task_t * t, const lv_draw_border_dsc_t * ds
lv_color_format_t dst_cf = layer->draw_buf->header.cf;
uint32_t dst_nema_cf = lv_nemagfx_cf_to_nema(dst_cf);

/* the stride should be computed internally for NEMA_TSC images and images missing a stride value */
int32_t stride = (dst_cf >= LV_COLOR_FORMAT_NEMA_TSC_START && dst_cf <= LV_COLOR_FORMAT_NEMA_TSC_END) ?
-1 : lv_area_get_width(&(layer->buf_area)) * lv_color_format_get_size(dst_cf);

nema_bind_dst_tex((uintptr_t)NEMA_VIRT2PHYS(layer->draw_buf->data), lv_area_get_width(&(layer->buf_area)),
lv_area_get_height(&(layer->buf_area)), dst_nema_cf,
lv_area_get_width(&(layer->buf_area))*lv_color_format_get_size(dst_cf));
lv_area_get_height(&(layer->buf_area)), dst_nema_cf, stride);

/* Recalculate float Dimensions */
float x1 = (float)coords->x1 + ((float)width / 2.0f) - (float)layer->buf_area.x1;
Expand Down
9 changes: 6 additions & 3 deletions src/draw/nema_gfx/lv_draw_nema_gfx_fill.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void lv_draw_nema_gfx_fill(lv_draw_task_t * t, const lv_draw_fill_dsc_t * dsc, c
lv_area_move(&rel_coords, -layer->buf_area.x1, -layer->buf_area.y1);

lv_area_t rel_clip_area;
lv_area_copy(&rel_clip_area, draw_unit->clip_area);
lv_area_copy(&rel_clip_area, &t->clip_area);
lv_area_move(&rel_clip_area, -layer->buf_area.x1, -layer->buf_area.y1);

nema_set_clip(rel_clip_area.x1, rel_clip_area.y1, lv_area_get_width(&rel_clip_area),
Expand All @@ -64,9 +64,12 @@ void lv_draw_nema_gfx_fill(lv_draw_task_t * t, const lv_draw_fill_dsc_t * dsc, c
lv_color_format_t dst_cf = layer->draw_buf->header.cf;
uint32_t dst_nema_cf = lv_nemagfx_cf_to_nema(dst_cf);

/* the stride should be computed internally for NEMA_TSC images and images missing a stride value */
int32_t stride = (dst_cf >= LV_COLOR_FORMAT_NEMA_TSC_START && dst_cf <= LV_COLOR_FORMAT_NEMA_TSC_END) ?
-1 : lv_area_get_width(&(layer->buf_area)) * lv_color_format_get_size(dst_cf);

nema_bind_dst_tex((uintptr_t)NEMA_VIRT2PHYS(layer->draw_buf->data), lv_area_get_width(&(layer->buf_area)),
lv_area_get_height(&(layer->buf_area)), dst_nema_cf,
lv_area_get_width(&(layer->buf_area))*lv_color_format_get_size(dst_cf));
lv_area_get_height(&(layer->buf_area)), dst_nema_cf, stride);

int32_t coords_bg_w = lv_area_get_width(&rel_coords);
int32_t coords_bg_h = lv_area_get_height(&rel_coords);
Expand Down
12 changes: 7 additions & 5 deletions src/draw/nema_gfx/lv_draw_nema_gfx_img.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ static void _draw_nema_gfx_tile(lv_draw_task_t * t, const lv_draw_image_dsc_t *

int32_t tile_x_start = tile_area.x1;

while(tile_area.y1 <= t->clip_area->y2) {
while(tile_area.x1 <= t->clip_area->x2) {
while(tile_area.y1 <= t->clip_area.y2) {
while(tile_area.x1 <= t->clip_area.x2) {

lv_area_t clipped_img_area;
if(lv_area_intersect(&clipped_img_area, &tile_area, &t->clip_area)) {
_draw_nema_gfx_img(draw_unit, dsc, &tile_area);
_draw_nema_gfx_img(t, dsc, &tile_area);
}

tile_area.x1 += img_w;
Expand Down Expand Up @@ -148,9 +148,11 @@ static void _draw_nema_gfx_img(lv_draw_task_t * t, const lv_draw_image_dsc_t * d
int32_t src_stride = (src_cf >= LV_COLOR_FORMAT_NEMA_TSC_START && src_cf <= LV_COLOR_FORMAT_NEMA_TSC_END)
|| img_dsc->header.stride == 0 ? -1 : (int32_t)img_dsc->header.stride;

int32_t stride = (dst_cf >= LV_COLOR_FORMAT_NEMA_TSC_START && dst_cf <= LV_COLOR_FORMAT_NEMA_TSC_END) ?
-1 : lv_area_get_width(&(layer->buf_area)) * lv_color_format_get_size(dst_cf);

nema_bind_dst_tex((uintptr_t)NEMA_VIRT2PHYS(layer->draw_buf->data), lv_area_get_width(&(layer->buf_area)),
lv_area_get_height(&(layer->buf_area)), dst_nema_cf,
lv_area_get_width(&(layer->buf_area))*lv_color_format_get_size(dst_cf));
lv_area_get_height(&(layer->buf_area)), dst_nema_cf, stride);

if(!LV_COLOR_FORMAT_IS_INDEXED(src_cf)) {
nema_bind_src_tex((uintptr_t)(src_buf), tex_w, tex_h, src_nema_cf, src_stride,
Expand Down
Loading
Loading