feat(NemaGFX): add TSC color formats
This commit is contained in:
committed by
Gabor Kiss-Vamosi
parent
3c07bd9456
commit
07854b1d0b
@@ -54,6 +54,27 @@ no locking is done). It may conflict with existing definitions
|
|||||||
if you have an existing Nema HAL implementation. You may
|
if you have an existing Nema HAL implementation. You may
|
||||||
simply be able to remove yours.
|
simply be able to remove yours.
|
||||||
|
|
||||||
|
TSC Images
|
||||||
|
**********
|
||||||
|
|
||||||
|
TSC (ThinkSillicon Compression) images can be drawn by this renderer. The
|
||||||
|
TSC 4/6/6A/12/12A color formats are part of :cpp:type:`lv_color_format_t`.
|
||||||
|
All other renderers will ignore images with these color formats.
|
||||||
|
Define an image descriptor variable with the corresponding
|
||||||
|
TSC color format and the GPU will be able to draw it directly.
|
||||||
|
Stride does not need to be specified because it will be computed by the
|
||||||
|
renderer.
|
||||||
|
|
||||||
|
.. code-block:: c
|
||||||
|
|
||||||
|
const lv_image_dsc_t img_demo_widgets_avatar_tsc6a = {
|
||||||
|
.header.cf = LV_COLOR_FORMAT_NEMA_TSC6A,
|
||||||
|
.header.w = 144,
|
||||||
|
.header.h = 144,
|
||||||
|
.data = img_demo_widgets_avatar_tsc6a_map,
|
||||||
|
.data_size = sizeof(img_demo_widgets_avatar_tsc6a_map),
|
||||||
|
};
|
||||||
|
|
||||||
DMA2D
|
DMA2D
|
||||||
*****
|
*****
|
||||||
|
|
||||||
|
|||||||
@@ -292,7 +292,8 @@ static int32_t evaluate_cb(lv_draw_unit_t * draw_unit, lv_draw_task_t * task)
|
|||||||
break;
|
break;
|
||||||
case LV_DRAW_TASK_TYPE_IMAGE: {
|
case LV_DRAW_TASK_TYPE_IMAGE: {
|
||||||
lv_draw_image_dsc_t * dsc = task->draw_dsc;
|
lv_draw_image_dsc_t * dsc = task->draw_dsc;
|
||||||
if(!(dsc->clip_radius == 0
|
if(!(dsc->header.cf < LV_COLOR_FORMAT_PROPRIETARY_START
|
||||||
|
&& dsc->clip_radius == 0
|
||||||
&& dsc->bitmap_mask_src == NULL
|
&& dsc->bitmap_mask_src == NULL
|
||||||
&& dsc->sup == NULL
|
&& dsc->sup == NULL
|
||||||
&& dsc->tile == 0
|
&& dsc->tile == 0
|
||||||
|
|||||||
@@ -140,7 +140,9 @@ static void _draw_nema_gfx_img(lv_draw_unit_t * draw_unit, const lv_draw_image_d
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t src_nema_cf = lv_nemagfx_cf_to_nema(src_cf);
|
uint32_t src_nema_cf = lv_nemagfx_cf_to_nema(src_cf);
|
||||||
uint32_t src_stride = img_dsc->header.stride;
|
/* the stride should be computed internally for NEMA_TSC images and images missing a stride value */
|
||||||
|
uint32_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 : img_dsc->header.stride;
|
||||||
|
|
||||||
nema_bind_dst_tex((uintptr_t)NEMA_VIRT2PHYS(layer->draw_buf->data), lv_area_get_width(&(layer->buf_area)),
|
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_height(&(layer->buf_area)), dst_nema_cf,
|
||||||
|
|||||||
@@ -68,6 +68,16 @@ uint32_t lv_nemagfx_cf_to_nema(lv_color_format_t cf)
|
|||||||
return NEMA_BGRA8888;
|
return NEMA_BGRA8888;
|
||||||
case LV_COLOR_FORMAT_XRGB8888:
|
case LV_COLOR_FORMAT_XRGB8888:
|
||||||
return NEMA_BGRX8888;
|
return NEMA_BGRX8888;
|
||||||
|
case LV_COLOR_FORMAT_NEMA_TSC4:
|
||||||
|
return NEMA_TSC4;
|
||||||
|
case LV_COLOR_FORMAT_NEMA_TSC6:
|
||||||
|
return NEMA_TSC6;
|
||||||
|
case LV_COLOR_FORMAT_NEMA_TSC6A:
|
||||||
|
return NEMA_TSC6A;
|
||||||
|
case LV_COLOR_FORMAT_NEMA_TSC12:
|
||||||
|
return NEMA_TSC12;
|
||||||
|
case LV_COLOR_FORMAT_NEMA_TSC12A:
|
||||||
|
return NEMA_TSC12A;
|
||||||
default:
|
default:
|
||||||
return LV_NEMA_GFX_COLOR_FORMAT;
|
return LV_NEMA_GFX_COLOR_FORMAT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -288,6 +288,9 @@ static int32_t _pxp_evaluate(lv_draw_unit_t * u, lv_draw_task_t * t)
|
|||||||
lv_draw_image_dsc_t * draw_dsc = (lv_draw_image_dsc_t *) t->draw_dsc;
|
lv_draw_image_dsc_t * draw_dsc = (lv_draw_image_dsc_t *) t->draw_dsc;
|
||||||
const lv_image_dsc_t * img_dsc = draw_dsc->src;
|
const lv_image_dsc_t * img_dsc = draw_dsc->src;
|
||||||
|
|
||||||
|
if(img_dsc->header.cf >= LV_COLOR_FORMAT_PROPRIETARY_START)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if(draw_dsc->tile)
|
if(draw_dsc->tile)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|||||||
@@ -252,6 +252,10 @@ static int32_t _vglite_evaluate(lv_draw_unit_t * u, lv_draw_task_t * t)
|
|||||||
lv_draw_image_dsc_t * draw_dsc = (lv_draw_image_dsc_t *) t->draw_dsc;
|
lv_draw_image_dsc_t * draw_dsc = (lv_draw_image_dsc_t *) t->draw_dsc;
|
||||||
const lv_image_dsc_t * img_dsc = draw_dsc->src;
|
const lv_image_dsc_t * img_dsc = draw_dsc->src;
|
||||||
|
|
||||||
|
if(img_dsc->header.cf >= LV_COLOR_FORMAT_PROPRIETARY_START) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#if LV_USE_VGLITE_BLIT_SPLIT
|
#if LV_USE_VGLITE_BLIT_SPLIT
|
||||||
bool has_transform = (draw_dsc->rotation != 0 || draw_dsc->scale_x != LV_SCALE_NONE ||
|
bool has_transform = (draw_dsc->rotation != 0 || draw_dsc->scale_x != LV_SCALE_NONE ||
|
||||||
draw_dsc->scale_y != LV_SCALE_NONE);
|
draw_dsc->scale_y != LV_SCALE_NONE);
|
||||||
|
|||||||
@@ -219,6 +219,11 @@ static int32_t evaluate(lv_draw_unit_t * draw_unit, lv_draw_task_t * task)
|
|||||||
{
|
{
|
||||||
LV_UNUSED(draw_unit);
|
LV_UNUSED(draw_unit);
|
||||||
|
|
||||||
|
if(task->type == LV_DRAW_TASK_TYPE_IMAGE &&
|
||||||
|
((lv_draw_image_dsc_t *)task->draw_dsc)->header.cf >= LV_COLOR_FORMAT_PROPRIETARY_START) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*If not refreshing the display probably it's a canvas rendering
|
/*If not refreshing the display probably it's a canvas rendering
|
||||||
*which his not support in SDL as it's not a texture.*/
|
*which his not support in SDL as it's not a texture.*/
|
||||||
if(lv_refr_get_disp_refreshing() == NULL) return 0;
|
if(lv_refr_get_disp_refreshing() == NULL) return 0;
|
||||||
|
|||||||
@@ -243,6 +243,11 @@ static int32_t _dave2d_evaluate(lv_draw_unit_t * u, lv_draw_task_t * t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case LV_DRAW_TASK_TYPE_IMAGE: {
|
case LV_DRAW_TASK_TYPE_IMAGE: {
|
||||||
|
lv_draw_image_dsc_t * dsc = t->draw_dsc;
|
||||||
|
if(dsc->header.cf >= LV_COLOR_FORMAT_PROPRIETARY_START) {
|
||||||
|
ret = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
#if USE_D2
|
#if USE_D2
|
||||||
t->preferred_draw_unit_id = DRAW_UNIT_ID_DAVE2D;
|
t->preferred_draw_unit_id = DRAW_UNIT_ID_DAVE2D;
|
||||||
t->preference_score = 0;
|
t->preference_score = 0;
|
||||||
|
|||||||
@@ -168,6 +168,11 @@ static int32_t evaluate(lv_draw_unit_t * draw_unit, lv_draw_task_t * task)
|
|||||||
{
|
{
|
||||||
LV_UNUSED(draw_unit);
|
LV_UNUSED(draw_unit);
|
||||||
|
|
||||||
|
if(task->type == LV_DRAW_TASK_TYPE_IMAGE &&
|
||||||
|
((lv_draw_image_dsc_t *)task->draw_dsc)->header.cf >= LV_COLOR_FORMAT_PROPRIETARY_START) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*If not refreshing the display probably it's a canvas rendering
|
/*If not refreshing the display probably it's a canvas rendering
|
||||||
*which his not support in SDL as it's not a texture.*/
|
*which his not support in SDL as it's not a texture.*/
|
||||||
if(lv_refr_get_disp_refreshing() == NULL) return 0;
|
if(lv_refr_get_disp_refreshing() == NULL) return 0;
|
||||||
|
|||||||
@@ -414,6 +414,10 @@ static int32_t evaluate(lv_draw_unit_t * draw_unit, lv_draw_task_t * task)
|
|||||||
if(masked && (cf == LV_COLOR_FORMAT_A8 || cf == LV_COLOR_FORMAT_RGB565A8)) {
|
if(masked && (cf == LV_COLOR_FORMAT_A8 || cf == LV_COLOR_FORMAT_RGB565A8)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(cf >= LV_COLOR_FORMAT_PROPRIETARY_START) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -171,6 +171,16 @@ typedef enum {
|
|||||||
|
|
||||||
LV_COLOR_FORMAT_YUV_END = LV_COLOR_FORMAT_UYVY,
|
LV_COLOR_FORMAT_YUV_END = LV_COLOR_FORMAT_UYVY,
|
||||||
|
|
||||||
|
LV_COLOR_FORMAT_PROPRIETARY_START = 0x30,
|
||||||
|
|
||||||
|
LV_COLOR_FORMAT_NEMA_TSC_START = LV_COLOR_FORMAT_PROPRIETARY_START,
|
||||||
|
LV_COLOR_FORMAT_NEMA_TSC4 = LV_COLOR_FORMAT_NEMA_TSC_START,
|
||||||
|
LV_COLOR_FORMAT_NEMA_TSC6 = 0x31,
|
||||||
|
LV_COLOR_FORMAT_NEMA_TSC6A = 0x32,
|
||||||
|
LV_COLOR_FORMAT_NEMA_TSC12 = 0x33,
|
||||||
|
LV_COLOR_FORMAT_NEMA_TSC12A = 0x34,
|
||||||
|
LV_COLOR_FORMAT_NEMA_TSC_END = LV_COLOR_FORMAT_NEMA_TSC12A,
|
||||||
|
|
||||||
/*Color formats in which LVGL can render*/
|
/*Color formats in which LVGL can render*/
|
||||||
#if LV_COLOR_DEPTH == 1
|
#if LV_COLOR_DEPTH == 1
|
||||||
LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_I1,
|
LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_I1,
|
||||||
|
|||||||
Reference in New Issue
Block a user