Skip to content

Commit

Permalink
xgu: Update commands to GPU more frequently
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryzee119 committed Oct 5, 2023
1 parent dbf2e0c commit 1d73c78
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/lvgl_drivers/video/xgu/lv_xgu_disp.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ uint32_t *p;

static void end_frame()
{
pb_end(p);
while (pb_finished());
}

Expand All @@ -28,6 +27,7 @@ static void begin_frame()
p = pb_begin();
p = xgu_set_color_clear_value(p, 0xff000000);
p = xgu_clear_surface(p, XGU_CLEAR_Z | XGU_CLEAR_STENCIL | XGU_CLEAR_COLOR);
pb_end(p);
}

void lvgl_getlock(void);
Expand Down
4 changes: 4 additions & 0 deletions src/lvgl_drivers/video/xgu/lv_xgu_rect.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ void xgu_draw_rect(lv_draw_ctx_t *draw_ctx, const lv_draw_rect_dsc_t *dsc, const
return;
}

p = pb_begin();

if (xgu_ctx->xgu_data->combiner_mode != 0)
{
#include "lvgl_drivers/video/xgu/notexture.inl"
Expand Down Expand Up @@ -174,6 +176,8 @@ void xgu_draw_rect(lv_draw_ctx_t *draw_ctx, const lv_draw_rect_dsc_t *dsc, const

rect_draw_image(&draw_area, dsc);
rect_draw_border(&draw_area, dsc);

pb_end(p);
}

void xgu_draw_bg(struct _lv_draw_ctx_t *draw_ctx, const lv_draw_rect_dsc_t *draw_dsc, const lv_area_t *src_area)
Expand Down
18 changes: 12 additions & 6 deletions src/lvgl_drivers/video/xgu/lv_xgu_texture.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,6 @@ void xgu_draw_letter(struct _lv_draw_ctx_t *draw_ctx, const lv_draw_label_dsc_t
return;
}

if (xgu_ctx->xgu_data->combiner_mode != 1)
{
#include "lvgl_drivers/video/xgu/texture.inl"
xgu_ctx->xgu_data->combiner_mode = 1;
}

lv_lru_get(xgu_ctx->xgu_data->texture_cache, &bmp, sizeof(bmp), (void **)&texture);
if (texture == NULL)
{
Expand All @@ -229,12 +223,21 @@ void xgu_draw_letter(struct _lv_draw_ctx_t *draw_ctx, const lv_draw_label_dsc_t
}
}

p = pb_begin();

if (xgu_ctx->xgu_data->combiner_mode != 1)
{
#include "lvgl_drivers/video/xgu/texture.inl"
xgu_ctx->xgu_data->combiner_mode = 1;
}

p = xgux_set_color4ub(p, dsc->color.ch.red, dsc->color.ch.green,
dsc->color.ch.blue, dsc->opa);

bind_texture(xgu_ctx, texture, (uint32_t)bmp, XGU_TEXTURE_FILTER_LINEAR);

map_textured_rect(texture, &letter_area, &draw_area, 256.0f);
pb_end(p);
}

lv_res_t xgu_draw_img(struct _lv_draw_ctx_t *draw_ctx, const lv_draw_img_dsc_t *dsc,
Expand Down Expand Up @@ -297,6 +300,7 @@ void xgu_draw_img_decoded(struct _lv_draw_ctx_t *draw_ctx, const lv_draw_img_dsc

lv_color_t recolor = lv_color_make(255, 255, 255);

p = pb_begin();
// If we are about the draw 1 bit indexed image. Setup draw color froms src_buf;
if (cf == LV_IMG_CF_INDEXED_1BIT)
{
Expand Down Expand Up @@ -381,6 +385,7 @@ void xgu_draw_img_decoded(struct _lv_draw_ctx_t *draw_ctx, const lv_draw_img_dsc
}
if (texture == NULL)
{
pb_end(p);
return;
}
}
Expand All @@ -399,4 +404,5 @@ void xgu_draw_img_decoded(struct _lv_draw_ctx_t *draw_ctx, const lv_draw_img_dsc
(dsc->antialias) ? XGU_TEXTURE_FILTER_LINEAR : XGU_TEXTURE_FILTER_NEAREST);

map_textured_rect(texture, &src_area_transformed, &draw_area, (float)dsc->zoom);
pb_end(p);
}

0 comments on commit 1d73c78

Please sign in to comment.