Improve lvgl from ding.
This commit is contained in:
parent
0dbe58adbd
commit
139a66c818
|
@ -16,8 +16,6 @@
|
||||||
#define UPDFW_MODE ENABLE
|
#define UPDFW_MODE ENABLE
|
||||||
#define VOICE_MODE DISABLE
|
#define VOICE_MODE DISABLE
|
||||||
|
|
||||||
#define MOVIE_EIS DISABLE
|
|
||||||
|
|
||||||
#define IPCAM_FUNC DISABLE
|
#define IPCAM_FUNC DISABLE
|
||||||
#define STAMP_FUNC DISABLE
|
#define STAMP_FUNC DISABLE
|
||||||
#define UI_FUNC ENABLE
|
#define UI_FUNC ENABLE
|
||||||
|
@ -995,9 +993,16 @@
|
||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
* OSD res is determined by lvgl library (LV_HOR_RES_MAX / LV_VER_RES_MAX in the lv_conf.h)
|
* OSD res is determined by lvgl library (LV_HOR_RES_MAX / LV_VER_RES_MAX in the lv_conf.h)
|
||||||
******************************************************************************************/
|
******************************************************************************************/
|
||||||
#define DISPLAY_OSD_W LV_HOR_RES_MAX
|
#define DISPLAY_OSD_W_PADDING 0
|
||||||
#define DISPLAY_OSD_H LV_VER_RES_MAX
|
#define DISPLAY_OSD_H_PADDING 0
|
||||||
|
#define DISPLAY_OSD_W_OFFSET (DISPLAY_OSD_W_PADDING / 2)
|
||||||
|
#define DISPLAY_OSD_H_OFFSET (DISPLAY_OSD_H_PADDING / 2)
|
||||||
|
#define DISPLAY_OSD_W (LV_HOR_RES_MAX + DISPLAY_OSD_W_PADDING)
|
||||||
|
#define DISPLAY_OSD_H (LV_VER_RES_MAX + DISPLAY_OSD_H_PADDING)
|
||||||
|
|
||||||
|
#if (DISPLAY_OSD_W_OFFSET > DISPLAY_OSD_W_PADDING) || (DISPLAY_OSD_H_OFFSET > DISPLAY_OSD_H_PADDING)
|
||||||
|
#error "DISPLAY_OSD_OFFSET must be smaller than DISPLAY_OSD_PADDING !"
|
||||||
|
#endif
|
||||||
|
|
||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
* OSD format is determined by lvgl library (LV_COLOR_DEPTH in the lv_conf.h)
|
* OSD format is determined by lvgl library (LV_COLOR_DEPTH in the lv_conf.h)
|
||||||
|
@ -1056,7 +1061,10 @@
|
||||||
#define LV_USER_CFG_USE_ROTATE_BUFFER 0
|
#define LV_USER_CFG_USE_ROTATE_BUFFER 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define LV_USER_CFG_USE_TWO_BUFFER 0
|
//#NT#2023/10/25#Eric - begin
|
||||||
|
//#NT#Support IVOT_N12144_CO-145
|
||||||
|
#define LV_USER_CFG_USE_TWO_BUFFER 1
|
||||||
|
//#NT#2023/10/25#Eric - end
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -104,16 +104,6 @@ static struct bsd_fb_var_info vinfo;
|
||||||
#endif
|
#endif
|
||||||
#endif /* USE_BSD_FBDEV */
|
#endif /* USE_BSD_FBDEV */
|
||||||
|
|
||||||
#if LV_COLOR_DEPTH == 24
|
|
||||||
|
|
||||||
HD_RESULT disp_gfx_copy_8565(UINT32 dst_pa, UINT32 src_pa,lv_disp_drv_t * disp_drv);
|
|
||||||
HD_RESULT disp_gfx_rotate_8565(UINT32 dst_pa, UINT32 src_pa,lv_disp_drv_t * disp_drv);
|
|
||||||
void lv_gpu_nvt_dma2d_rotate_8565(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_coord_t map_w, lv_area_t area, UINT32 dir);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void lv_gpu_nvt_dma2d_rotate(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_coord_t map_w, lv_area_t area, UINT32 dir, bool flush);
|
|
||||||
|
|
||||||
char *fbp = 0;
|
char *fbp = 0;
|
||||||
long int screensize = 0;
|
long int screensize = 0;
|
||||||
static UINT32 buf1_pa;
|
static UINT32 buf1_pa;
|
||||||
|
@ -122,8 +112,6 @@ static UINT32 buf1_pa;
|
||||||
|
|
||||||
#include "lvgl/src/lv_gpu/lv_gpu_nvt_dma2d.h"
|
#include "lvgl/src/lv_gpu/lv_gpu_nvt_dma2d.h"
|
||||||
|
|
||||||
static UINT32 hdal_fmt=DISPLAY_HDAL_OSD_FMT; //for gfx need hdal fmt
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int fbfd = 0;
|
static int fbfd = 0;
|
||||||
|
@ -147,9 +135,6 @@ void lv_user_rounder_callback(
|
||||||
{
|
{
|
||||||
#if LV_USE_GPU_NVT_DMA2D == 1
|
#if LV_USE_GPU_NVT_DMA2D == 1
|
||||||
|
|
||||||
|
|
||||||
#if LV_COLOR_DEPTH != 8
|
|
||||||
|
|
||||||
#if LV_USER_CFG_USE_ROTATE_BUFFER
|
#if LV_USER_CFG_USE_ROTATE_BUFFER
|
||||||
uint8_t alignment = 16;
|
uint8_t alignment = 16;
|
||||||
#else
|
#else
|
||||||
|
@ -159,8 +144,8 @@ void lv_user_rounder_callback(
|
||||||
area->x1 = ALIGN_FLOOR(area->x1, alignment);
|
area->x1 = ALIGN_FLOOR(area->x1, alignment);
|
||||||
area->y1 = ALIGN_FLOOR(area->y1, alignment);
|
area->y1 = ALIGN_FLOOR(area->y1, alignment);
|
||||||
|
|
||||||
lv_coord_t copy_w = (area->x2 - area->x1) + 1;
|
lv_coord_t copy_w = lv_area_get_width(area);
|
||||||
lv_coord_t copy_h = (area->y2 - area->y1) + 1;
|
lv_coord_t copy_h = lv_area_get_height(area);
|
||||||
uint8_t remainder_copy_w = copy_w % alignment;
|
uint8_t remainder_copy_w = copy_w % alignment;
|
||||||
uint8_t remainder_copy_h = copy_h % alignment;
|
uint8_t remainder_copy_h = copy_h % alignment;
|
||||||
|
|
||||||
|
@ -186,20 +171,6 @@ void lv_user_rounder_callback(
|
||||||
if(area->y2 > (disp_drv->ver_res - 1))
|
if(area->y2 > (disp_drv->ver_res - 1))
|
||||||
area->y2 = disp_drv->ver_res - 1;
|
area->y2 = disp_drv->ver_res - 1;
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
/*******************************************************************
|
|
||||||
* invalidate area update still has issues for LV_COLOR_DEPTH = 8,
|
|
||||||
* keep fully update.
|
|
||||||
******************************************************************/
|
|
||||||
|
|
||||||
area->x1 = 0;
|
|
||||||
area->y1 = 0;
|
|
||||||
area->x2 = disp_drv->hor_res - 1;
|
|
||||||
area->y2 = disp_drv->ver_res - 1;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -492,11 +463,11 @@ void fbdev_exit(void)
|
||||||
#if LV_USER_CFG_USE_TWO_BUFFER
|
#if LV_USER_CFG_USE_TWO_BUFFER
|
||||||
|
|
||||||
UINT32 fpb_scr, fpb_dst;
|
UINT32 fpb_scr, fpb_dst;
|
||||||
const lv_area_t area = {0, 0, disp_drv->hor_res - 1, disp_drv->ver_res - 1};
|
const lv_area_t area = {0, 0, DISPLAY_OSD_W - 1, DISPLAY_OSD_H - 1};
|
||||||
|
// CHKPNT;
|
||||||
/* check is last chunk */
|
/* check is last chunk */
|
||||||
if(disp_drv->buffer->flushing_last){
|
if(disp_drv->buffer->flushing_last){
|
||||||
|
// CHKPNT;
|
||||||
if(vinfo.yoffset == 0){
|
if(vinfo.yoffset == 0){
|
||||||
vinfo.yoffset = vinfo.yres;
|
vinfo.yoffset = vinfo.yres;
|
||||||
fpb_scr = (UINT32)fbp + screensize;
|
fpb_scr = (UINT32)fbp + screensize;
|
||||||
|
@ -514,12 +485,14 @@ void fbdev_exit(void)
|
||||||
|
|
||||||
lv_gpu_nvt_dma2d_copy(
|
lv_gpu_nvt_dma2d_copy(
|
||||||
(lv_color_t *) fpb_scr,
|
(lv_color_t *) fpb_scr,
|
||||||
disp_drv->hor_res,
|
DISPLAY_OSD_W,
|
||||||
disp_drv->ver_res,
|
DISPLAY_OSD_H,
|
||||||
(lv_color_t *) fpb_dst,
|
|
||||||
disp_drv->hor_res,
|
|
||||||
disp_drv->ver_res,
|
|
||||||
&area,
|
&area,
|
||||||
|
(lv_color_t *) fpb_dst,
|
||||||
|
DISPLAY_OSD_W,
|
||||||
|
DISPLAY_OSD_H,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -540,10 +513,19 @@ void fbdev_exit(void)
|
||||||
{
|
{
|
||||||
UINT32 dst_va = disp_get_dst_va(disp_drv);
|
UINT32 dst_va = disp_get_dst_va(disp_drv);
|
||||||
|
|
||||||
lv_gpu_nvt_dma2d_rotate_8565(
|
lv_gpu_nvt_dma2d_rotate(
|
||||||
(lv_color_t *)dst_va, disp_drv->hor_res,
|
(lv_color_t *)color_p,
|
||||||
(lv_color_t *)color_p, disp_drv->hor_res,
|
disp_drv->hor_res,
|
||||||
*area, VDO_ROTATE_DIR);
|
disp_drv->ver_res,
|
||||||
|
area,
|
||||||
|
(lv_color_t *)dst_va,
|
||||||
|
DISPLAY_OSD_W,
|
||||||
|
DISPLAY_OSD_H,
|
||||||
|
DISPLAY_OSD_W_OFFSET,
|
||||||
|
DISPLAY_OSD_H_OFFSET,
|
||||||
|
VDO_ROTATE_DIR,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
disp_set_pan_display(disp_drv);
|
disp_set_pan_display(disp_drv);
|
||||||
|
|
||||||
|
@ -556,40 +538,19 @@ void fbdev_exit(void)
|
||||||
{
|
{
|
||||||
UINT32 dst_va = disp_get_dst_va(disp_drv);
|
UINT32 dst_va = disp_get_dst_va(disp_drv);
|
||||||
|
|
||||||
#if 1
|
|
||||||
|
|
||||||
lv_gpu_nvt_dma2d_copy(
|
lv_gpu_nvt_dma2d_copy(
|
||||||
color_p,
|
color_p,
|
||||||
disp_drv->hor_res,
|
lv_area_get_width(area),
|
||||||
disp_drv->ver_res,
|
lv_area_get_height(area),
|
||||||
(lv_color_t *)dst_va,
|
|
||||||
disp_drv->hor_res,
|
|
||||||
disp_drv->ver_res,
|
|
||||||
area,
|
area,
|
||||||
|
(lv_color_t *)dst_va,
|
||||||
|
DISPLAY_OSD_W,
|
||||||
|
DISPLAY_OSD_H,
|
||||||
|
DISPLAY_OSD_W_OFFSET,
|
||||||
|
DISPLAY_OSD_H_OFFSET,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
#else /* CPU flush for debugging */
|
|
||||||
|
|
||||||
uint32_t location, location2;
|
|
||||||
const uint32_t alpha_offset = LV_HOR_RES_MAX * LV_VER_RES_MAX * 2;
|
|
||||||
|
|
||||||
|
|
||||||
for(int i=area->x1 ; i<=area->x2 ; i++)
|
|
||||||
{
|
|
||||||
for(int j=area->y1 ; j<=area->y2 ; j++)
|
|
||||||
{
|
|
||||||
location = i + j * disp_drv->hor_res;
|
|
||||||
location2 = (i-area->x1) + (j-area->y1) * disp_drv->hor_res;
|
|
||||||
*(((uint16_t*)dst_va) + location ) = *((uint16_t*)(vir_meminfo.va) + location2);
|
|
||||||
*((uint8_t*)(dst_va + alpha_offset + location)) = *((uint8_t*)(vir_meminfo.va) + location2 + alpha_offset);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
hd_common_mem_flush_cache(color_p, disp_drv->hor_res * disp_drv->ver_res * sizeof(lv_color_t));
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
disp_set_pan_display(disp_drv);
|
disp_set_pan_display(disp_drv);
|
||||||
|
|
||||||
lv_disp_flush_ready(disp_drv);
|
lv_disp_flush_ready(disp_drv);
|
||||||
|
@ -607,9 +568,18 @@ void fbdev_exit(void)
|
||||||
UINT32 dst_va = disp_get_dst_va(disp_drv);
|
UINT32 dst_va = disp_get_dst_va(disp_drv);
|
||||||
|
|
||||||
lv_gpu_nvt_dma2d_rotate(
|
lv_gpu_nvt_dma2d_rotate(
|
||||||
(lv_color_t *)dst_va, disp_drv->hor_res,
|
(lv_color_t *)color_p,
|
||||||
(lv_color_t *)color_p, disp_drv->hor_res,
|
disp_drv->hor_res,
|
||||||
*area, VDO_ROTATE_DIR, true);
|
disp_drv->ver_res,
|
||||||
|
area,
|
||||||
|
(lv_color_t *)dst_va,
|
||||||
|
DISPLAY_OSD_W,
|
||||||
|
DISPLAY_OSD_H,
|
||||||
|
DISPLAY_OSD_W_OFFSET,
|
||||||
|
DISPLAY_OSD_H_OFFSET,
|
||||||
|
VDO_ROTATE_DIR,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
disp_set_pan_display(disp_drv);
|
disp_set_pan_display(disp_drv);
|
||||||
|
|
||||||
|
@ -621,15 +591,21 @@ void fbdev_exit(void)
|
||||||
void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
|
void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
|
||||||
{
|
{
|
||||||
UINT32 dst_va = disp_get_dst_va(disp_drv);
|
UINT32 dst_va = disp_get_dst_va(disp_drv);
|
||||||
|
fbdev_msg("disp_flush x1=. %s\n",area->x1);
|
||||||
|
fbdev_msg("disp_flush x2=. %s\n",area->x2);
|
||||||
|
fbdev_msg("disp_flush y1=. %s\n",area->y1);
|
||||||
|
fbdev_msg("disp_flush y2=. %s\n",area->y2);
|
||||||
|
|
||||||
lv_gpu_nvt_dma2d_copy(
|
lv_gpu_nvt_dma2d_copy(
|
||||||
color_p,
|
color_p,
|
||||||
lv_area_get_width(area),
|
lv_area_get_width(area),
|
||||||
lv_area_get_height(area),
|
lv_area_get_height(area),
|
||||||
(lv_color_t *)dst_va,
|
|
||||||
disp_drv->hor_res,
|
|
||||||
disp_drv->ver_res,
|
|
||||||
area,
|
area,
|
||||||
|
(lv_color_t *)dst_va,
|
||||||
|
DISPLAY_OSD_W,
|
||||||
|
DISPLAY_OSD_H,
|
||||||
|
DISPLAY_OSD_W_OFFSET,
|
||||||
|
DISPLAY_OSD_H_OFFSET,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -697,216 +673,11 @@ void set_px_cb_8565(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void lv_gpu_nvt_dma2d_rotate_8565(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_coord_t map_w, lv_area_t area, UINT32 dir)
|
|
||||||
{
|
|
||||||
UINT32 dst_pa = 0;
|
|
||||||
UINT32 src_pa = 0;
|
|
||||||
HD_GFX_ROTATE param = {0};
|
|
||||||
HD_RESULT ret = HD_OK;
|
|
||||||
HD_COMMON_MEM_VIRT_INFO vir_meminfo = {0};
|
|
||||||
lv_coord_t copy_w = (area.x2 - area.x1) + 1;
|
|
||||||
lv_coord_t copy_h = (area.y2 - area.y1) + 1;
|
|
||||||
bool swap_xy = false;
|
|
||||||
HD_IPOINT dst_pos = {-1, -1};
|
|
||||||
|
|
||||||
const uint8_t pixel_size_rgb = sizeof(LV_COLOR_BLACK.full);
|
|
||||||
const uint8_t pixel_size_alpha = sizeof(LV_COLOR_BLACK.ext_ch.alpha);
|
|
||||||
const uint32_t alpha_offset = LV_VER_RES_MAX * LV_HOR_RES_MAX * pixel_size_rgb;
|
|
||||||
|
|
||||||
|
|
||||||
/* convert va to pa */
|
|
||||||
vir_meminfo.va = (void *)(map);
|
|
||||||
if ( hd_common_mem_get(HD_COMMON_MEM_PARAM_VIRT_INFO, &vir_meminfo) != HD_OK) {
|
|
||||||
fbdev_msg("convert map failed!\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
src_pa = vir_meminfo.pa;
|
|
||||||
|
|
||||||
vir_meminfo.va = (void *)(buf);
|
|
||||||
if ( hd_common_mem_get(HD_COMMON_MEM_PARAM_VIRT_INFO, &vir_meminfo) != HD_OK) {
|
|
||||||
fbdev_msg("convert buf failed!\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dst_pa = vir_meminfo.pa;
|
|
||||||
|
|
||||||
|
|
||||||
memset(¶m, 0, sizeof(HD_GFX_ROTATE));
|
|
||||||
|
|
||||||
/* check dir */
|
|
||||||
|
|
||||||
switch(dir)
|
|
||||||
{
|
|
||||||
case HD_VIDEO_DIR_ROTATE_90:
|
|
||||||
dst_pos = (HD_IPOINT){LV_VER_RES_MAX - area.y1 - copy_h, area.x1};
|
|
||||||
swap_xy = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HD_VIDEO_DIR_ROTATE_270:
|
|
||||||
dst_pos = (HD_IPOINT){area.y1, LV_HOR_RES_MAX - area.x1 - copy_w};
|
|
||||||
swap_xy = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HD_VIDEO_DIR_ROTATE_180:
|
|
||||||
dst_pos = (HD_IPOINT){LV_HOR_RES_MAX - area.x1 - copy_w, LV_VER_RES_MAX - area.y1 - copy_h};
|
|
||||||
swap_xy = false;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
LV_LOG_ERROR("dir(%lx) is currently not supported", dir);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* rotate rgb channels */
|
|
||||||
|
|
||||||
param.src_img.dim.w = LV_HOR_RES_MAX;
|
|
||||||
param.src_img.dim.h = LV_VER_RES_MAX;
|
|
||||||
param.src_img.p_phy_addr[0] = src_pa;
|
|
||||||
param.src_img.lineoffset[0] = LV_HOR_RES_MAX * pixel_size_rgb;
|
|
||||||
param.src_img.format = HD_VIDEO_PXLFMT_RGB565;
|
|
||||||
|
|
||||||
param.src_region.x = 0;
|
|
||||||
param.src_region.y = 0;
|
|
||||||
param.src_region.w = copy_w;
|
|
||||||
param.src_region.h = copy_h;
|
|
||||||
|
|
||||||
param.dst_img.format = HD_VIDEO_PXLFMT_RGB565;
|
|
||||||
param.dst_img.dim.w = swap_xy ? LV_VER_RES_MAX : LV_HOR_RES_MAX;
|
|
||||||
param.dst_img.dim.h = swap_xy ? LV_HOR_RES_MAX : LV_VER_RES_MAX;
|
|
||||||
param.dst_img.p_phy_addr[0] = dst_pa;
|
|
||||||
param.dst_img.lineoffset[0] = (swap_xy ? LV_VER_RES_MAX : LV_HOR_RES_MAX) * pixel_size_rgb;
|
|
||||||
param.dst_pos = dst_pos;
|
|
||||||
param.angle = dir;
|
|
||||||
|
|
||||||
ret = hd_gfx_rotate(¶m);
|
|
||||||
|
|
||||||
if(ret != HD_OK){
|
|
||||||
fbdev_msg("ret = %d\n", ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* rotate alpha channel */
|
|
||||||
param.src_img.dim.w = LV_HOR_RES_MAX;
|
|
||||||
param.src_img.dim.h = LV_VER_RES_MAX;
|
|
||||||
param.src_img.p_phy_addr[0] = src_pa + alpha_offset;
|
|
||||||
param.src_img.lineoffset[0] = LV_HOR_RES_MAX * pixel_size_alpha;
|
|
||||||
param.src_img.format = HD_VIDEO_PXLFMT_I8;
|
|
||||||
|
|
||||||
param.src_region.x = 0;
|
|
||||||
param.src_region.y = 0;
|
|
||||||
param.src_region.w = copy_w;
|
|
||||||
param.src_region.h = copy_h;
|
|
||||||
|
|
||||||
param.dst_img.format = HD_VIDEO_PXLFMT_I8;
|
|
||||||
param.dst_img.dim.w = swap_xy ? LV_VER_RES_MAX : LV_HOR_RES_MAX;
|
|
||||||
param.dst_img.dim.h = swap_xy ? LV_HOR_RES_MAX : LV_VER_RES_MAX;
|
|
||||||
param.dst_img.p_phy_addr[0] = dst_pa + alpha_offset;
|
|
||||||
param.dst_img.lineoffset[0] = (swap_xy ? LV_VER_RES_MAX : LV_HOR_RES_MAX) * pixel_size_alpha;
|
|
||||||
param.dst_pos = dst_pos;
|
|
||||||
param.angle = dir;
|
|
||||||
|
|
||||||
ret = hd_gfx_rotate(¶m);
|
|
||||||
|
|
||||||
if(ret != HD_OK){
|
|
||||||
fbdev_msg("ret = %d\n", ret);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "kwrap/debug.h"
|
#include "kwrap/debug.h"
|
||||||
#include "FileSysTsk.h"
|
#include "FileSysTsk.h"
|
||||||
|
|
||||||
void lv_gpu_nvt_dma2d_rotate(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_coord_t map_w, lv_area_t area, UINT32 dir, bool flush)
|
|
||||||
{
|
|
||||||
UINT32 dst_pa = 0;
|
|
||||||
UINT32 src_pa = 0;
|
|
||||||
HD_GFX_ROTATE param = {0};
|
|
||||||
HD_RESULT ret = HD_OK;
|
|
||||||
HD_COMMON_MEM_VIRT_INFO vir_meminfo = {0};
|
|
||||||
lv_coord_t copy_w = lv_area_get_width(&area);
|
|
||||||
lv_coord_t copy_h = lv_area_get_height(&area);
|
|
||||||
bool swap_xy = false;
|
|
||||||
HD_IPOINT dst_pos = {-1, -1};
|
|
||||||
|
|
||||||
/* convert va to pa */
|
|
||||||
vir_meminfo.va = (void *)(map);
|
|
||||||
if ( hd_common_mem_get(HD_COMMON_MEM_PARAM_VIRT_INFO, &vir_meminfo) != HD_OK) {
|
|
||||||
fbdev_msg("convert map failed!\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
src_pa = vir_meminfo.pa;
|
|
||||||
|
|
||||||
vir_meminfo.va = (void *)(buf);
|
|
||||||
if ( hd_common_mem_get(HD_COMMON_MEM_PARAM_VIRT_INFO, &vir_meminfo) != HD_OK) {
|
|
||||||
fbdev_msg("convert buf failed!\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dst_pa = vir_meminfo.pa;
|
|
||||||
|
|
||||||
|
|
||||||
memset(¶m, 0, sizeof(HD_GFX_ROTATE));
|
|
||||||
|
|
||||||
/* check dir */
|
|
||||||
|
|
||||||
switch(dir)
|
|
||||||
{
|
|
||||||
case HD_VIDEO_DIR_ROTATE_90:
|
|
||||||
dst_pos = (HD_IPOINT){LV_VER_RES_MAX - area.y1 - copy_h, area.x1};
|
|
||||||
swap_xy = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HD_VIDEO_DIR_ROTATE_270:
|
|
||||||
dst_pos = (HD_IPOINT){area.y1, LV_HOR_RES_MAX - area.x1 - copy_w};
|
|
||||||
swap_xy = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HD_VIDEO_DIR_ROTATE_180:
|
|
||||||
dst_pos = (HD_IPOINT){LV_HOR_RES_MAX - area.x1 - copy_w, LV_VER_RES_MAX - area.y1 - copy_h};
|
|
||||||
swap_xy = false;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
LV_LOG_ERROR("dir(%lx) is currently not supported", dir);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* rotate rgb channels */
|
|
||||||
|
|
||||||
param.src_img.dim.w = copy_w;
|
|
||||||
param.src_img.dim.h = copy_h;
|
|
||||||
param.src_img.p_phy_addr[0] = src_pa;
|
|
||||||
param.src_img.lineoffset[0] = copy_w * sizeof(lv_color_t);
|
|
||||||
param.src_img.format = hdal_fmt;
|
|
||||||
|
|
||||||
param.src_region.x = 0;
|
|
||||||
param.src_region.y = 0;
|
|
||||||
param.src_region.w = copy_w;
|
|
||||||
param.src_region.h = copy_h;
|
|
||||||
|
|
||||||
param.dst_img.format = hdal_fmt;
|
|
||||||
param.dst_img.dim.w = swap_xy ? LV_VER_RES_MAX : LV_HOR_RES_MAX;
|
|
||||||
param.dst_img.dim.h = swap_xy ? LV_HOR_RES_MAX : LV_VER_RES_MAX;
|
|
||||||
param.dst_img.p_phy_addr[0] = dst_pa;
|
|
||||||
param.dst_img.lineoffset[0] = (swap_xy ? LV_VER_RES_MAX : LV_HOR_RES_MAX) * sizeof(lv_color_t);
|
|
||||||
param.dst_pos = dst_pos;
|
|
||||||
param.angle = dir;
|
|
||||||
|
|
||||||
if(flush){
|
|
||||||
ret = hd_gfx_rotate(¶m);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
ret = vendor_gfx_rotate_no_flush(¶m);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ret != HD_OK){
|
|
||||||
fbdev_msg("ret = %d\n", ret);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -914,73 +685,73 @@ void lv_gpu_nvt_dma2d_rotate(lv_color_t * buf, lv_coord_t buf_w, const lv_color_
|
||||||
* Local Functions
|
* Local Functions
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
#if LV_COLOR_DEPTH == 24
|
//#if LV_COLOR_DEPTH == 24
|
||||||
|
//
|
||||||
HD_RESULT disp_gfx_rotate_8565(UINT32 dst_pa, UINT32 src_pa, lv_disp_drv_t * disp_drv)
|
//HD_RESULT disp_gfx_rotate_8565(UINT32 dst_pa, UINT32 src_pa, lv_disp_drv_t * disp_drv)
|
||||||
{
|
//{
|
||||||
HD_GFX_ROTATE param;
|
// HD_GFX_ROTATE param;
|
||||||
HD_RESULT ret;
|
// HD_RESULT ret;
|
||||||
HD_VIDEO_PXLFMT fmt;
|
// HD_VIDEO_PXLFMT fmt;
|
||||||
|
//
|
||||||
fmt = HD_VIDEO_PXLFMT_RGB565;
|
// fmt = HD_VIDEO_PXLFMT_RGB565;
|
||||||
|
//
|
||||||
fbdev_msg("disp_gfx_rotate: dst_pa = 0x%x,src_pa = 0x%x fmt 0x%x\n", dst_pa,src_pa,fmt);
|
// fbdev_msg("disp_gfx_rotate: dst_pa = 0x%x,src_pa = 0x%x fmt 0x%x\n", dst_pa,src_pa,fmt);
|
||||||
|
//
|
||||||
memset(¶m, 0, sizeof(HD_GFX_ROTATE));
|
// memset(¶m, 0, sizeof(HD_GFX_ROTATE));
|
||||||
param.src_img.dim.w = disp_drv->hor_res;
|
// param.src_img.dim.w = disp_drv->hor_res;
|
||||||
param.src_img.dim.h = disp_drv->ver_res;
|
// param.src_img.dim.h = disp_drv->ver_res;
|
||||||
param.src_img.p_phy_addr[0] = src_pa;
|
// param.src_img.p_phy_addr[0] = src_pa;
|
||||||
param.src_img.lineoffset[0] = disp_drv->hor_res * 2;
|
// param.src_img.lineoffset[0] = disp_drv->hor_res * 2;
|
||||||
param.src_img.format = fmt;
|
// param.src_img.format = fmt;
|
||||||
|
//
|
||||||
param.dst_img.dim.w = disp_drv->ver_res;
|
// param.dst_img.dim.w = disp_drv->ver_res;
|
||||||
param.dst_img.dim.h = disp_drv->hor_res;
|
// param.dst_img.dim.h = disp_drv->hor_res;
|
||||||
param.dst_img.p_phy_addr[0] = dst_pa;
|
// param.dst_img.p_phy_addr[0] = dst_pa;
|
||||||
param.dst_img.lineoffset[0] = disp_drv->ver_res * 2;
|
// param.dst_img.lineoffset[0] = disp_drv->ver_res * 2;
|
||||||
param.dst_img.format = fmt;
|
// param.dst_img.format = fmt;
|
||||||
|
//
|
||||||
param.src_region.x = 0;
|
// param.src_region.x = 0;
|
||||||
param.src_region.y = 0;
|
// param.src_region.y = 0;
|
||||||
param.src_region.w = disp_drv->hor_res;
|
// param.src_region.w = disp_drv->hor_res;
|
||||||
param.src_region.h = disp_drv->ver_res;
|
// param.src_region.h = disp_drv->ver_res;
|
||||||
|
//
|
||||||
param.dst_pos.x = 0;
|
// param.dst_pos.x = 0;
|
||||||
param.dst_pos.y = 0;
|
// param.dst_pos.y = 0;
|
||||||
param.angle = VDO_ROTATE_DIR;
|
// param.angle = VDO_ROTATE_DIR;
|
||||||
|
//
|
||||||
ret = hd_gfx_rotate(¶m);
|
// ret = hd_gfx_rotate(¶m);
|
||||||
|
//
|
||||||
|
//
|
||||||
fmt = HD_VIDEO_PXLFMT_I8;
|
// fmt = HD_VIDEO_PXLFMT_I8;
|
||||||
|
//
|
||||||
memset(¶m, 0, sizeof(HD_GFX_ROTATE));
|
// memset(¶m, 0, sizeof(HD_GFX_ROTATE));
|
||||||
param.src_img.dim.w = disp_drv->hor_res;
|
// param.src_img.dim.w = disp_drv->hor_res;
|
||||||
param.src_img.dim.h = disp_drv->ver_res;
|
// param.src_img.dim.h = disp_drv->ver_res;
|
||||||
param.src_img.p_phy_addr[0] = src_pa + disp_drv->hor_res * disp_drv->ver_res * 2;
|
// param.src_img.p_phy_addr[0] = src_pa + disp_drv->hor_res * disp_drv->ver_res * 2;
|
||||||
param.src_img.lineoffset[0] = disp_drv->hor_res;
|
// param.src_img.lineoffset[0] = disp_drv->hor_res;
|
||||||
param.src_img.format = fmt;
|
// param.src_img.format = fmt;
|
||||||
|
//
|
||||||
param.dst_img.dim.w = disp_drv->ver_res;
|
// param.dst_img.dim.w = disp_drv->ver_res;
|
||||||
param.dst_img.dim.h = disp_drv->hor_res;
|
// param.dst_img.dim.h = disp_drv->hor_res;
|
||||||
param.dst_img.p_phy_addr[0] = dst_pa + disp_drv->hor_res * disp_drv->ver_res * 2;
|
// param.dst_img.p_phy_addr[0] = dst_pa + disp_drv->hor_res * disp_drv->ver_res * 2;
|
||||||
param.dst_img.lineoffset[0] = disp_drv->ver_res;
|
// param.dst_img.lineoffset[0] = disp_drv->ver_res;
|
||||||
param.dst_img.format = fmt;
|
// param.dst_img.format = fmt;
|
||||||
|
//
|
||||||
param.src_region.x = 0;
|
// param.src_region.x = 0;
|
||||||
param.src_region.y = 0;
|
// param.src_region.y = 0;
|
||||||
param.src_region.w = disp_drv->hor_res;
|
// param.src_region.w = disp_drv->hor_res;
|
||||||
param.src_region.h = disp_drv->ver_res;
|
// param.src_region.h = disp_drv->ver_res;
|
||||||
|
//
|
||||||
param.dst_pos.x = 0;
|
// param.dst_pos.x = 0;
|
||||||
param.dst_pos.y = 0;
|
// param.dst_pos.y = 0;
|
||||||
param.angle = VDO_ROTATE_DIR;
|
// param.angle = VDO_ROTATE_DIR;
|
||||||
|
//
|
||||||
ret = hd_gfx_rotate(¶m);
|
// ret = hd_gfx_rotate(¶m);
|
||||||
|
//
|
||||||
return ret;
|
// return ret;
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* USE_FBDEV || USE_BSD_FBDEV */
|
#endif /* USE_FBDEV || USE_BSD_FBDEV */
|
||||||
|
|
|
@ -44,12 +44,6 @@ void fbdev_init(void);
|
||||||
void fbdev_exit(void);
|
void fbdev_exit(void);
|
||||||
void fbdev_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_p);
|
void fbdev_flush(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_p);
|
||||||
void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p);
|
void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p);
|
||||||
void fbdev_fill(lv_color_t *fbp,int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color);
|
|
||||||
void disp_fill(struct _disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width,
|
|
||||||
const lv_area_t * fill_area, lv_color_t color);
|
|
||||||
void fbdev_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_p);
|
|
||||||
void fbdev_get_sizes(uint32_t *width, uint32_t *height);
|
|
||||||
|
|
||||||
void lv_user_rounder_callback(lv_disp_drv_t* disp_drv,lv_area_t* area);
|
void lv_user_rounder_callback(lv_disp_drv_t* disp_drv,lv_area_t* area);
|
||||||
|
|
||||||
#if LV_USE_GPU_NVT_DMA2D
|
#if LV_USE_GPU_NVT_DMA2D
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "hd_common.h"
|
#include "hd_common.h"
|
||||||
#include "Utility/Color.h"
|
#include "Utility/Color.h"
|
||||||
|
|
||||||
//extern const uint32_t gDemoKit_Palette_Palette[256];
|
extern const uint32_t gDemoKit_Palette_Palette[256];
|
||||||
|
|
||||||
lv_color8_t gDemoKit_Palette_RGB332[256];
|
lv_color8_t gDemoKit_Palette_RGB332[256];
|
||||||
uint32_t gDemoKit_Palette_BGRA8888[256];
|
uint32_t gDemoKit_Palette_BGRA8888[256];
|
||||||
|
@ -125,17 +125,21 @@ UINT32 COLOR_YUV_2_RGB(UINT32 yuv, UINT32 a)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//void PALETTE_PREPARE_DATA(void)
|
#if 0
|
||||||
//{
|
void PALETTE_PREPARE_DATA(void)
|
||||||
// UINT32 i = 0;
|
{
|
||||||
// uint32_t gDemoKit_Palette_Index8[256];
|
UINT32 i = 0;
|
||||||
//
|
uint32_t gDemoKit_Palette_Index8[256];
|
||||||
// for (i = 0; i < 256; i++) {
|
|
||||||
// gDemoKit_Palette_Index8[i] = COLOR_YUV_2_RGB(gDemoKit_Palette_Palette[i], 0xff);
|
for (i = 0; i < 256; i++) {
|
||||||
// //DBG_DUMP("%d %x \r\n",i,gDemoKit_Palette_Index8[i]);
|
gDemoKit_Palette_Index8[i] = COLOR_YUV_2_RGB(gDemoKit_Palette_Palette[i], 0xff);
|
||||||
// }
|
//DBG_DUMP("%d %x \r\n",i,gDemoKit_Palette_Index8[i]);
|
||||||
// gDemoKit_Palette_Index8[0] = COLOR_YUV_2_RGB(gDemoKit_Palette_Palette[0], 0);
|
}
|
||||||
//
|
gDemoKit_Palette_Index8[0] = COLOR_YUV_2_RGB(gDemoKit_Palette_Palette[0], 0);
|
||||||
// //copy convert palette to org palette table
|
|
||||||
// memcpy((void *)gDemoKit_Palette_Palette,(void *)gDemoKit_Palette_Index8,sizeof(UINT32)*256);
|
//copy convert palette to org palette table
|
||||||
//}
|
memcpy((void *)gDemoKit_Palette_Palette,(void *)gDemoKit_Palette_Index8,sizeof(UINT32)*256);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -63,9 +63,12 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//#NT#2023/10/25#Eric - begin
|
||||||
|
//#NT#Support IVOT_N12144_CO-145
|
||||||
/* Default display refresh period.
|
/* Default display refresh period.
|
||||||
* Can be changed in the display driver (`lv_disp_drv_t`).*/
|
* Can be changed in the display driver (`lv_disp_drv_t`).*/
|
||||||
#define LV_DISP_DEF_REFR_PERIOD 20 /*[ms]*/
|
#define LV_DISP_DEF_REFR_PERIOD 33 /*[ms]*/
|
||||||
|
//#NT#2023/10/25#Eric - end
|
||||||
|
|
||||||
/* Dot Per Inch: used to initialize default sizes.
|
/* Dot Per Inch: used to initialize default sizes.
|
||||||
* E.g. a button with width = LV_DPI / 2 -> half inch wide
|
* E.g. a button with width = LV_DPI / 2 -> half inch wide
|
||||||
|
|
|
@ -52,350 +52,16 @@ lv_res_t lv_gpu_nvt_dma2d_init()
|
||||||
return LV_RES_OK;
|
return LV_RES_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_res_t lv_gpu_nvt_dma2d_fill_with_alpha(
|
|
||||||
lv_color_t * dst_buf,
|
|
||||||
lv_coord_t dst_width,
|
|
||||||
lv_coord_t dst_height,
|
|
||||||
const lv_area_t * area,
|
|
||||||
lv_color_t color,
|
|
||||||
lv_opa_t opa,
|
|
||||||
bool flush)
|
|
||||||
{
|
|
||||||
#if LV_COLOR_DEPTH == 32
|
|
||||||
lv_color_t* src_buf = get_working_buffer();
|
|
||||||
lv_res_t res;
|
|
||||||
lv_coord_t draw_area_w = lv_area_get_width(area);
|
|
||||||
lv_coord_t draw_area_h = lv_area_get_height(area);
|
|
||||||
lv_coord_t line_h = (LV_GPU_NVT_WORKING_BUFFER_SIZE / (sizeof(lv_color_t) * draw_area_w));
|
|
||||||
lv_coord_t src_h = line_h > draw_area_h ? draw_area_h : line_h;
|
|
||||||
lv_coord_t src_w = draw_area_w;
|
|
||||||
lv_area_t fill_area = (lv_area_t) {0, 0, src_w - 1, src_h - 1};
|
|
||||||
uint16_t y = 0, blend_cnt = 0;
|
|
||||||
|
|
||||||
color.ch.alpha = ((color.ch.alpha * opa) / 0xFF);
|
|
||||||
|
|
||||||
res = lv_gpu_nvt_dma2d_fill(
|
|
||||||
src_buf,
|
|
||||||
src_w,
|
|
||||||
src_h,
|
|
||||||
&fill_area,
|
|
||||||
color,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
if(res != LV_RES_OK)
|
|
||||||
return res;
|
|
||||||
|
|
||||||
lv_area_t blend_area;
|
|
||||||
bool need_flush = false;
|
|
||||||
|
|
||||||
blend_area.x1 = area->x1;
|
|
||||||
blend_area.x2 = area->x2;
|
|
||||||
|
|
||||||
for( y = 0 ; y <= draw_area_h - src_h ; y += src_h)
|
|
||||||
{
|
|
||||||
blend_area.y1 = (area->y1 + blend_cnt * src_h);
|
|
||||||
blend_area.y2 = blend_area.y1 + src_h;
|
|
||||||
blend_cnt++;
|
|
||||||
|
|
||||||
if((blend_cnt == (draw_area_h / src_h)) && (draw_area_h % src_h == 0) && flush){
|
|
||||||
need_flush = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
res = lv_gpu_nvt_dma2d_blend(
|
|
||||||
src_buf,
|
|
||||||
src_w,
|
|
||||||
src_h,
|
|
||||||
dst_buf,
|
|
||||||
dst_width,
|
|
||||||
dst_height,
|
|
||||||
&blend_area,
|
|
||||||
need_flush);
|
|
||||||
|
|
||||||
if(res != LV_RES_OK)
|
|
||||||
return res;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if(y != draw_area_h){
|
|
||||||
|
|
||||||
if((draw_area_h - y) < 2){
|
|
||||||
LV_LOG_WARN("last line height should greater than 2");
|
|
||||||
}
|
|
||||||
|
|
||||||
blend_area.y1 = (area->y1 + blend_cnt * src_h);
|
|
||||||
blend_area.y2 = blend_area.y1 + (draw_area_h - y);
|
|
||||||
blend_cnt++;
|
|
||||||
|
|
||||||
res = lv_gpu_nvt_dma2d_blend(
|
|
||||||
src_buf,
|
|
||||||
src_w,
|
|
||||||
draw_area_h - y,
|
|
||||||
dst_buf,
|
|
||||||
dst_width,
|
|
||||||
dst_height,
|
|
||||||
&blend_area,
|
|
||||||
flush);
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
LV_LOG_ERROR("lv_gpu_nvt_dma2d_fill_with_alpha is unsupported for current LV_COLOR_DEPTH(%u)", LV_COLOR_DEPTH);
|
|
||||||
return LV_RES_INV;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
lv_res_t lv_gpu_nvt_dma2d_blend_src_memcpy(
|
|
||||||
const lv_color_t * src,
|
|
||||||
lv_coord_t src_w,
|
|
||||||
lv_coord_t src_h,
|
|
||||||
lv_color_t * dst,
|
|
||||||
lv_coord_t dst_w,
|
|
||||||
lv_coord_t dst_h,
|
|
||||||
const lv_area_t* blend_area,
|
|
||||||
bool flush
|
|
||||||
)
|
|
||||||
{
|
|
||||||
#if LV_COLOR_DEPTH == 32
|
|
||||||
|
|
||||||
lv_coord_t blend_w = lv_area_get_width(blend_area);
|
|
||||||
lv_coord_t blend_h = lv_area_get_height(blend_area);
|
|
||||||
lv_coord_t line_h = (LV_GPU_NVT_WORKING_BUFFER_SIZE / (sizeof(lv_color_t) * blend_w));
|
|
||||||
lv_coord_t real_src_h = line_h > blend_h ? blend_h : line_h;
|
|
||||||
lv_color_t *real_src = get_working_buffer();
|
|
||||||
lv_area_t real_blend_area = *blend_area;
|
|
||||||
lv_coord_t y;
|
|
||||||
lv_res_t res;
|
|
||||||
uint16_t blend_cnt = 0;
|
|
||||||
bool need_flush = false;
|
|
||||||
|
|
||||||
|
|
||||||
real_blend_area.x1 = blend_area->x1;
|
|
||||||
real_blend_area.x2 = blend_area->x2;
|
|
||||||
|
|
||||||
for( y = 0 ; y <= blend_h - real_src_h ; y += real_src_h)
|
|
||||||
{
|
|
||||||
|
|
||||||
_lv_memcpy(real_src, src, src_w * real_src_h * sizeof(lv_color_t));
|
|
||||||
|
|
||||||
real_blend_area.y1 = (blend_area->y1 + blend_cnt * real_src_h);
|
|
||||||
real_blend_area.y2 = real_blend_area.y1 + real_src_h;
|
|
||||||
blend_cnt++;
|
|
||||||
|
|
||||||
if((blend_cnt == (blend_h / real_src_h)) && (blend_h % real_src_h == 0) && flush){
|
|
||||||
need_flush = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
res = lv_gpu_nvt_dma2d_blend(
|
|
||||||
real_src,
|
|
||||||
src_w,
|
|
||||||
real_src_h,
|
|
||||||
dst,
|
|
||||||
dst_w,
|
|
||||||
dst_h,
|
|
||||||
&real_blend_area,
|
|
||||||
need_flush);
|
|
||||||
|
|
||||||
if(res != LV_RES_OK)
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(y != src_h){
|
|
||||||
|
|
||||||
if((src_h - y) < 2){
|
|
||||||
LV_LOG_WARN("last line height should greater than 2");
|
|
||||||
}
|
|
||||||
|
|
||||||
real_blend_area.y1 = (blend_area->y1 + blend_cnt * real_src_h);
|
|
||||||
real_blend_area.y2 = real_blend_area.y1 + (src_h - y);
|
|
||||||
blend_cnt++;
|
|
||||||
|
|
||||||
res = lv_gpu_nvt_dma2d_blend(
|
|
||||||
real_src,
|
|
||||||
src_w,
|
|
||||||
(src_h - y),
|
|
||||||
dst,
|
|
||||||
dst_w,
|
|
||||||
dst_h,
|
|
||||||
&real_blend_area,
|
|
||||||
flush);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
LV_LOG_ERROR("lv_gpu_nvt_dma2d_fill is unsupported for current LV_COLOR_DEPTH(%u)", LV_COLOR_DEPTH);
|
|
||||||
return LV_RES_INV;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return LV_RES_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
lv_res_t lv_gpu_nvt_dma2d_blend(
|
|
||||||
const lv_color_t * src,
|
|
||||||
lv_coord_t src_w,
|
|
||||||
lv_coord_t src_h,
|
|
||||||
lv_color_t * dst,
|
|
||||||
lv_coord_t dst_w,
|
|
||||||
lv_coord_t dst_h,
|
|
||||||
const lv_area_t* area,
|
|
||||||
bool flush)
|
|
||||||
{
|
|
||||||
#if LV_COLOR_DEPTH == 32
|
|
||||||
UINT32 dst_pa = 0;
|
|
||||||
UINT32 src_pa = 0;
|
|
||||||
lv_coord_t blend_w = src_w; /* should equal to lv_area_get_width(area) */
|
|
||||||
lv_coord_t blend_h = src_h; /* should equal to lv_area_get_height(area) */
|
|
||||||
HD_RESULT ret = HD_OK;
|
|
||||||
HD_COMMON_MEM_VIRT_INFO vir_meminfo = {0};
|
|
||||||
VENDOR_GFX_ALPHA_BLEND param = {0} ;
|
|
||||||
HD_VIDEO_PXLFMT fmt = color_depth_to_hd_video_pxlfmt();
|
|
||||||
|
|
||||||
/* convert src va to pa */
|
|
||||||
vir_meminfo.va = (void *)(src);
|
|
||||||
if ( hd_common_mem_get(HD_COMMON_MEM_PARAM_VIRT_INFO, &vir_meminfo) != HD_OK) {
|
|
||||||
LV_LOG_ERROR("convert scr va(0x%08lX) failed!", src);
|
|
||||||
return LV_RES_INV;
|
|
||||||
}
|
|
||||||
|
|
||||||
src_pa = vir_meminfo.pa;
|
|
||||||
|
|
||||||
/* convert dst va to pa */
|
|
||||||
vir_meminfo.va = (void *)(dst);
|
|
||||||
if ( hd_common_mem_get(HD_COMMON_MEM_PARAM_VIRT_INFO, &vir_meminfo) != HD_OK) {
|
|
||||||
LV_LOG_ERROR("convert dst va(0x%08lX) failed!", dst);
|
|
||||||
return LV_RES_INV;
|
|
||||||
}
|
|
||||||
|
|
||||||
dst_pa = vir_meminfo.pa;
|
|
||||||
|
|
||||||
LV_LOG_TRACE("lv_gpu_nvt_dma2d_blend(area = {%d, %d}-{%d, %d})", area->x1, area->y1, area->x2, area->y2);
|
|
||||||
|
|
||||||
memset(¶m, 0, sizeof(VENDOR_GFX_ALPHA_BLEND));
|
|
||||||
param.src_img.dim.w = blend_w;
|
|
||||||
param.src_img.dim.h = blend_h;
|
|
||||||
param.src_img.p_phy_addr[0] = src_pa;
|
|
||||||
param.src_img.lineoffset[0] = blend_w * sizeof(lv_color_t);
|
|
||||||
param.src_img.format = fmt;
|
|
||||||
|
|
||||||
param.dst_img.dim.w = dst_w;
|
|
||||||
param.dst_img.dim.h = dst_h;
|
|
||||||
param.dst_img.p_phy_addr[0] = dst_pa;
|
|
||||||
param.dst_img.lineoffset[0] = dst_w * sizeof(lv_color_t);
|
|
||||||
param.dst_img.format = fmt;
|
|
||||||
|
|
||||||
param.p_alpha = 1; /* actually p_alpha is unused for ARGB8888 */
|
|
||||||
param.dst_pos = (HD_IPOINT) {area->x1, area->y1};
|
|
||||||
|
|
||||||
if(flush)
|
|
||||||
ret = vendor_gfx_alpha_blend(¶m);
|
|
||||||
else
|
|
||||||
ret = vendor_gfx_alpha_blend_no_flush(¶m);
|
|
||||||
|
|
||||||
if(ret != HD_OK){
|
|
||||||
LV_LOG_ERROR("ret = %d", ret);
|
|
||||||
return LV_RES_INV;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
LV_UNUSED(color_depth_to_hd_video_pxlfmt);
|
|
||||||
|
|
||||||
LV_LOG_ERROR("lv_gpu_nvt_dma2d_fill is unsupported for current LV_COLOR_DEPTH(%u)", LV_COLOR_DEPTH);
|
|
||||||
return LV_RES_INV;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return LV_RES_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
lv_res_t lv_gpu_nvt_dma2d_fill(
|
|
||||||
lv_color_t * dst_buf,
|
|
||||||
lv_coord_t dst_width,
|
|
||||||
lv_coord_t dst_height,
|
|
||||||
const lv_area_t * fill_area,
|
|
||||||
lv_color_t color,
|
|
||||||
bool flush)
|
|
||||||
{
|
|
||||||
#if LV_COLOR_DEPTH == 32
|
|
||||||
|
|
||||||
UINT32 dst_pa = 0;
|
|
||||||
HD_GFX_DRAW_RECT param;
|
|
||||||
HD_RESULT ret;
|
|
||||||
lv_coord_t fill_w = lv_area_get_width(fill_area);
|
|
||||||
lv_coord_t fill_h = lv_area_get_height(fill_area);
|
|
||||||
HD_COMMON_MEM_VIRT_INFO vir_meminfo = {0};
|
|
||||||
HD_VIDEO_PXLFMT fmt = color_depth_to_hd_video_pxlfmt();
|
|
||||||
|
|
||||||
|
|
||||||
/* convert dst va to pa */
|
|
||||||
vir_meminfo.va = (void *)(dst_buf);
|
|
||||||
if ( hd_common_mem_get(HD_COMMON_MEM_PARAM_VIRT_INFO, &vir_meminfo) != HD_OK) {
|
|
||||||
LV_LOG_ERROR("convert dst failed!");
|
|
||||||
return LV_RES_INV;
|
|
||||||
}
|
|
||||||
|
|
||||||
dst_pa = vir_meminfo.pa;
|
|
||||||
|
|
||||||
LV_LOG_TRACE("lv_gpu_nvt_dma2d_fill(dst_pa = %x, fill area = {%d, %d}-{%d %d}, 0x%08lX)",
|
|
||||||
dst_pa,
|
|
||||||
fill_area->x1,
|
|
||||||
fill_area->y1,
|
|
||||||
fill_area->x2,
|
|
||||||
fill_area->y2,
|
|
||||||
color);
|
|
||||||
|
|
||||||
memset(¶m, 0, sizeof(HD_GFX_DRAW_RECT));
|
|
||||||
|
|
||||||
param.dst_img.dim.w = dst_width;
|
|
||||||
param.dst_img.dim.h = dst_height;
|
|
||||||
param.dst_img.p_phy_addr[0] = dst_pa;
|
|
||||||
param.dst_img.lineoffset[0] = dst_width * sizeof(lv_color_t);
|
|
||||||
param.dst_img.format = fmt;
|
|
||||||
|
|
||||||
param.color = color.full;
|
|
||||||
param.rect.x = fill_area->x1;
|
|
||||||
param.rect.y = fill_area->y1;
|
|
||||||
param.rect.w = fill_w;
|
|
||||||
param.rect.h = fill_h;
|
|
||||||
param.type = HD_GFX_RECT_SOLID;
|
|
||||||
|
|
||||||
if(flush){
|
|
||||||
ret = hd_gfx_draw_rect(¶m);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
ret = vendor_gfx_draw_rect_no_flush(¶m);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ret != HD_OK){
|
|
||||||
LV_LOG_ERROR("ret = %d", ret);
|
|
||||||
return LV_RES_INV;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
|
|
||||||
LV_UNUSED(color_depth_to_hd_video_pxlfmt);
|
|
||||||
|
|
||||||
LV_LOG_ERROR("lv_gpu_nvt_dma2d_fill is unsupported for current LV_COLOR_DEPTH(%u)", LV_COLOR_DEPTH);
|
|
||||||
return LV_RES_INV;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return LV_RES_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
lv_res_t lv_gpu_nvt_dma2d_copy(
|
lv_res_t lv_gpu_nvt_dma2d_copy(
|
||||||
const lv_color_t * src,
|
const lv_color_t * src,
|
||||||
lv_coord_t src_w,
|
lv_coord_t src_w,
|
||||||
lv_coord_t src_h,
|
lv_coord_t src_h,
|
||||||
|
const lv_area_t* src_area,
|
||||||
lv_color_t * dst,
|
lv_color_t * dst,
|
||||||
lv_coord_t dst_w,
|
lv_coord_t dst_w,
|
||||||
lv_coord_t dst_h,
|
lv_coord_t dst_h,
|
||||||
const lv_area_t* area,
|
const lv_coord_t dst_x,
|
||||||
|
const lv_coord_t dst_y,
|
||||||
bool flush
|
bool flush
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -411,7 +77,8 @@ lv_res_t lv_gpu_nvt_dma2d_copy(
|
||||||
lv_coord_t copy_h = lv_area_get_height(area);
|
lv_coord_t copy_h = lv_area_get_height(area);
|
||||||
const static uint8_t pixel_size_rgb = sizeof(LV_COLOR_BLACK.full);
|
const static uint8_t pixel_size_rgb = sizeof(LV_COLOR_BLACK.full);
|
||||||
const static uint8_t pixel_size_alpha = sizeof(LV_COLOR_BLACK.ext_ch.alpha);
|
const static uint8_t pixel_size_alpha = sizeof(LV_COLOR_BLACK.ext_ch.alpha);
|
||||||
const uint32_t alpha_offset = LV_VER_RES_MAX * LV_HOR_RES_MAX * pixel_size_rgb;
|
const uint32_t alpha_offset_src = LV_VER_RES_MAX * LV_HOR_RES_MAX * pixel_size_rgb;
|
||||||
|
uint32_t alpha_offset_dst = dst_w * dst_h * pixel_size_rgb;
|
||||||
|
|
||||||
LV_UNUSED(color_depth_to_hd_video_pxlfmt);
|
LV_UNUSED(color_depth_to_hd_video_pxlfmt);
|
||||||
|
|
||||||
|
@ -440,10 +107,10 @@ lv_res_t lv_gpu_nvt_dma2d_copy(
|
||||||
param.src_img.lineoffset[0] = LV_HOR_RES_MAX * pixel_size_rgb;
|
param.src_img.lineoffset[0] = LV_HOR_RES_MAX * pixel_size_rgb;
|
||||||
param.src_img.format = fmt;
|
param.src_img.format = fmt;
|
||||||
|
|
||||||
param.dst_img.dim.w = LV_HOR_RES_MAX;
|
param.dst_img.dim.w = dst_w;
|
||||||
param.dst_img.dim.h = LV_VER_RES_MAX;
|
param.dst_img.dim.h = dst_h;
|
||||||
param.dst_img.p_phy_addr[0] = dst_pa;
|
param.dst_img.p_phy_addr[0] = dst_pa;
|
||||||
param.dst_img.lineoffset[0] = LV_HOR_RES_MAX * pixel_size_rgb;
|
param.dst_img.lineoffset[0] = dst_w * pixel_size_rgb;
|
||||||
param.dst_img.format = fmt;
|
param.dst_img.format = fmt;
|
||||||
|
|
||||||
param.src_region.x = 0;
|
param.src_region.x = 0;
|
||||||
|
@ -451,8 +118,8 @@ lv_res_t lv_gpu_nvt_dma2d_copy(
|
||||||
param.src_region.w = copy_w;
|
param.src_region.w = copy_w;
|
||||||
param.src_region.h = copy_h;
|
param.src_region.h = copy_h;
|
||||||
|
|
||||||
param.dst_pos.x = area->x1;
|
param.dst_pos.x = dst_x + area->x1;
|
||||||
param.dst_pos.y = area->y1;
|
param.dst_pos.y = dst_y + area->y1;
|
||||||
param.colorkey = 0;
|
param.colorkey = 0;
|
||||||
param.alpha = 255;
|
param.alpha = 255;
|
||||||
|
|
||||||
|
@ -474,14 +141,14 @@ lv_res_t lv_gpu_nvt_dma2d_copy(
|
||||||
memset(¶m, 0, sizeof(HD_GFX_COPY));
|
memset(¶m, 0, sizeof(HD_GFX_COPY));
|
||||||
param.src_img.dim.w = LV_HOR_RES_MAX;
|
param.src_img.dim.w = LV_HOR_RES_MAX;
|
||||||
param.src_img.dim.h = LV_VER_RES_MAX;
|
param.src_img.dim.h = LV_VER_RES_MAX;
|
||||||
param.src_img.p_phy_addr[0] = src_pa + alpha_offset;
|
param.src_img.p_phy_addr[0] = src_pa + alpha_offset_src;
|
||||||
param.src_img.lineoffset[0] = LV_HOR_RES_MAX * pixel_size_alpha;
|
param.src_img.lineoffset[0] = LV_HOR_RES_MAX * pixel_size_alpha;
|
||||||
param.src_img.format = fmt;
|
param.src_img.format = fmt;
|
||||||
|
|
||||||
param.dst_img.dim.w = LV_HOR_RES_MAX;
|
param.dst_img.dim.w = dst_w;
|
||||||
param.dst_img.dim.h = LV_VER_RES_MAX;
|
param.dst_img.dim.h = dst_h;
|
||||||
param.dst_img.p_phy_addr[0] = dst_pa + alpha_offset;
|
param.dst_img.p_phy_addr[0] = dst_pa + alpha_offset_dst;
|
||||||
param.dst_img.lineoffset[0] = LV_HOR_RES_MAX * pixel_size_alpha;
|
param.dst_img.lineoffset[0] = dst_w * pixel_size_alpha;
|
||||||
param.dst_img.format = fmt;
|
param.dst_img.format = fmt;
|
||||||
|
|
||||||
param.src_region.x = 0;
|
param.src_region.x = 0;
|
||||||
|
@ -489,8 +156,8 @@ lv_res_t lv_gpu_nvt_dma2d_copy(
|
||||||
param.src_region.w = copy_w;
|
param.src_region.w = copy_w;
|
||||||
param.src_region.h = copy_h;
|
param.src_region.h = copy_h;
|
||||||
|
|
||||||
param.dst_pos.x = area->x1;
|
param.dst_pos.x = dst_x + area->x1;
|
||||||
param.dst_pos.y = area->y1;
|
param.dst_pos.y = dst_y + area->y1;
|
||||||
param.colorkey = 0;
|
param.colorkey = 0;
|
||||||
param.alpha = 255;
|
param.alpha = 255;
|
||||||
|
|
||||||
|
@ -513,8 +180,8 @@ lv_res_t lv_gpu_nvt_dma2d_copy(
|
||||||
HD_RESULT ret;
|
HD_RESULT ret;
|
||||||
HD_COMMON_MEM_VIRT_INFO vir_meminfo = {0};
|
HD_COMMON_MEM_VIRT_INFO vir_meminfo = {0};
|
||||||
HD_VIDEO_PXLFMT fmt = color_depth_to_hd_video_pxlfmt();
|
HD_VIDEO_PXLFMT fmt = color_depth_to_hd_video_pxlfmt();
|
||||||
lv_coord_t copy_w = lv_area_get_width(area);
|
lv_coord_t copy_w = lv_area_get_width(src_area);
|
||||||
lv_coord_t copy_h = lv_area_get_height(area);
|
lv_coord_t copy_h = lv_area_get_height(src_area);
|
||||||
|
|
||||||
|
|
||||||
vir_meminfo.va = (void *)(src);
|
vir_meminfo.va = (void *)(src);
|
||||||
|
@ -551,8 +218,8 @@ lv_res_t lv_gpu_nvt_dma2d_copy(
|
||||||
param.src_region.w = copy_w;
|
param.src_region.w = copy_w;
|
||||||
param.src_region.h = copy_h;
|
param.src_region.h = copy_h;
|
||||||
|
|
||||||
param.dst_pos.x = area->x1;
|
param.dst_pos.x = dst_x + src_area->x1;
|
||||||
param.dst_pos.y = area->y1;
|
param.dst_pos.y = dst_y + src_area->y1;
|
||||||
param.colorkey = 0;
|
param.colorkey = 0;
|
||||||
param.alpha = 255;
|
param.alpha = 255;
|
||||||
|
|
||||||
|
@ -564,7 +231,13 @@ lv_res_t lv_gpu_nvt_dma2d_copy(
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ret != HD_OK){
|
if(ret != HD_OK){
|
||||||
LV_LOG_ERROR("ret = %d", ret);
|
LV_LOG_ERROR("ret = %d src { %lu, %lu , %lu, %lu} dst{ %lu, %lu , %lu, %lu} x1 = %lu , x2 = %lu",
|
||||||
|
ret, src_w, src_h, copy_w, copy_h, dst_w, dst_h, dst_x, dst_y,
|
||||||
|
src_area->x1, src_area->y1
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return LV_RES_INV;
|
return LV_RES_INV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -573,90 +246,230 @@ lv_res_t lv_gpu_nvt_dma2d_copy(
|
||||||
return LV_RES_OK;
|
return LV_RES_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_res_t lv_gpu_nvt_dma2d_copy_src_memcpy(
|
void lv_gpu_nvt_dma2d_rotate(
|
||||||
const lv_color_t * src,
|
lv_color_t * src,
|
||||||
lv_coord_t src_w,
|
lv_coord_t src_w,
|
||||||
lv_coord_t src_h,
|
lv_coord_t src_h,
|
||||||
|
const lv_area_t* src_area,
|
||||||
lv_color_t * dst,
|
lv_color_t * dst,
|
||||||
lv_coord_t dst_w,
|
lv_coord_t dst_w,
|
||||||
lv_coord_t dst_h,
|
lv_coord_t dst_h,
|
||||||
const lv_area_t* copy_area,
|
const lv_coord_t dst_x,
|
||||||
bool flush
|
const lv_coord_t dst_y,
|
||||||
)
|
uint32_t dir,
|
||||||
|
bool flush)
|
||||||
{
|
{
|
||||||
#if LV_COLOR_DEPTH == 32 || LV_COLOR_DEPTH == 8
|
|
||||||
|
|
||||||
lv_coord_t copy_w = lv_area_get_width(copy_area);
|
#if LV_COLOR_DEPTH == 24
|
||||||
lv_coord_t copy_h = lv_area_get_height(copy_area);
|
|
||||||
lv_coord_t line_h = (LV_GPU_NVT_WORKING_BUFFER_SIZE / (sizeof(lv_color_t) * copy_w));
|
UINT32 dst_pa = 0;
|
||||||
lv_coord_t real_src_h = line_h > copy_h ? copy_h : line_h;
|
UINT32 src_pa = 0;
|
||||||
lv_color_t *real_src = get_working_buffer();
|
HD_GFX_ROTATE param = {0};
|
||||||
lv_area_t real_copy_area = *copy_area;
|
HD_RESULT ret = HD_OK;
|
||||||
lv_coord_t y;
|
HD_COMMON_MEM_VIRT_INFO vir_meminfo = {0};
|
||||||
lv_res_t res;
|
lv_coord_t copy_w = lv_area_get_width(src_area);
|
||||||
uint16_t copy_cnt = 0;
|
lv_coord_t copy_h = lv_area_get_height(src_area);
|
||||||
bool need_flush = false;
|
bool swap_xy = false;
|
||||||
|
HD_IPOINT dst_pos = {-1, -1};
|
||||||
|
|
||||||
|
const uint8_t pixel_size_rgb = sizeof(LV_COLOR_BLACK.full);
|
||||||
|
const uint8_t pixel_size_alpha = sizeof(LV_COLOR_BLACK.ext_ch.alpha);
|
||||||
|
uint32_t alpha_offset_src = LV_VER_RES_MAX * LV_HOR_RES_MAX * pixel_size_rgb;
|
||||||
|
uint32_t alpha_offset_dst = dst_w * dst_h * pixel_size_rgb;
|
||||||
|
|
||||||
|
LV_UNUSED(color_depth_to_hd_video_pxlfmt);
|
||||||
|
|
||||||
|
/* convert va to pa */
|
||||||
|
vir_meminfo.va = (void *)(src);
|
||||||
|
if ( hd_common_mem_get(HD_COMMON_MEM_PARAM_VIRT_INFO, &vir_meminfo) != HD_OK) {
|
||||||
|
LV_LOG_ERROR("convert map failed!\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
src_pa = vir_meminfo.pa;
|
||||||
|
|
||||||
|
vir_meminfo.va = (void *)(dst);
|
||||||
|
if ( hd_common_mem_get(HD_COMMON_MEM_PARAM_VIRT_INFO, &vir_meminfo) != HD_OK) {
|
||||||
|
LV_LOG_ERROR("convert buf failed!\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dst_pa = vir_meminfo.pa;
|
||||||
|
|
||||||
|
|
||||||
real_copy_area.x1 = copy_area->x1;
|
memset(¶m, 0, sizeof(HD_GFX_ROTATE));
|
||||||
real_copy_area.x2 = copy_area->x2;
|
|
||||||
|
|
||||||
for( y = 0 ; y <= copy_h - real_src_h ; y += real_src_h)
|
/* check dir */
|
||||||
{
|
|
||||||
|
|
||||||
_lv_memcpy(real_src, src, src_w * real_src_h * sizeof(lv_color_t));
|
switch(dir)
|
||||||
|
{
|
||||||
|
case HD_VIDEO_DIR_ROTATE_90:
|
||||||
|
dst_pos = (HD_IPOINT){dst_h - src_area.y1 - copy_h - dst_y, src_area.x1 + dst_x};
|
||||||
|
swap_xy = true;
|
||||||
|
break;
|
||||||
|
|
||||||
real_copy_area.y1 = (copy_area->y1 + copy_cnt * real_src_h);
|
case HD_VIDEO_DIR_ROTATE_270:
|
||||||
real_copy_area.y2 = real_copy_area.y1 + real_src_h;
|
dst_pos = (HD_IPOINT){src_area.y1 + dst_y, dst_w - src_area.x1 - copy_w - dst_x};
|
||||||
copy_cnt++;
|
swap_xy = true;
|
||||||
|
break;
|
||||||
|
|
||||||
if((copy_cnt == (copy_h / real_src_h)) && (copy_h % real_src_h == 0) && flush){
|
case HD_VIDEO_DIR_ROTATE_180:
|
||||||
need_flush = true;
|
dst_pos = (HD_IPOINT){dst_w - src_area.x1 - copy_w - dst_x, dst_h - src_area.y1 - copy_h - dst_y};
|
||||||
}
|
swap_xy = false;
|
||||||
|
break;
|
||||||
|
|
||||||
res = lv_gpu_nvt_dma2d_copy(
|
default:
|
||||||
real_src,
|
LV_LOG_ERROR("dir(%lx) is currently not supported", dir);
|
||||||
src_w,
|
return;
|
||||||
real_src_h,
|
}
|
||||||
dst,
|
|
||||||
dst_w,
|
|
||||||
dst_h,
|
|
||||||
&real_copy_area,
|
|
||||||
need_flush);
|
|
||||||
|
|
||||||
if(res != LV_RES_OK)
|
/* rotate rgb channels */
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(y != src_h){
|
param.src_img.dim.w = LV_HOR_RES_MAX;
|
||||||
|
param.src_img.dim.h = LV_VER_RES_MAX;
|
||||||
|
param.src_img.p_phy_addr[0] = src_pa;
|
||||||
|
param.src_img.lineoffset[0] = LV_HOR_RES_MAX * pixel_size_rgb;
|
||||||
|
param.src_img.format = HD_VIDEO_PXLFMT_RGB565;
|
||||||
|
|
||||||
if((src_h - y) < 2){
|
param.src_region.x = 0;
|
||||||
LV_LOG_WARN("last line height should greater than 2");
|
param.src_region.y = 0;
|
||||||
}
|
param.src_region.w = copy_w;
|
||||||
|
param.src_region.h = copy_h;
|
||||||
|
|
||||||
real_copy_area.y1 = (copy_area->y1 + copy_cnt * real_src_h);
|
param.dst_img.format = HD_VIDEO_PXLFMT_RGB565;
|
||||||
real_copy_area.y2 = real_copy_area.y1 + (src_h - y);
|
param.dst_img.dim.w = swap_xy ? dst_h : dst_w;
|
||||||
copy_cnt++;
|
param.dst_img.dim.h = swap_xy ? dst_w : dst_h;
|
||||||
|
param.dst_img.p_phy_addr[0] = dst_pa;
|
||||||
|
param.dst_img.lineoffset[0] = (swap_xy ? dst_h : dst_w) * pixel_size_rgb;
|
||||||
|
param.dst_pos = dst_pos;
|
||||||
|
param.angle = dir;
|
||||||
|
|
||||||
res = lv_gpu_nvt_dma2d_copy(
|
ret = hd_gfx_rotate(¶m);
|
||||||
real_src,
|
|
||||||
src_w,
|
if(ret != HD_OK){
|
||||||
(src_h - y),
|
LV_LOG_ERROR("ret = %d\n", ret);
|
||||||
dst,
|
}
|
||||||
dst_w,
|
|
||||||
dst_h,
|
/* rotate alpha channel */
|
||||||
&real_copy_area,
|
param.src_img.dim.w = LV_HOR_RES_MAX;
|
||||||
flush);
|
param.src_img.dim.h = LV_VER_RES_MAX;
|
||||||
}
|
param.src_img.p_phy_addr[0] = src_pa + alpha_offset_src;
|
||||||
|
param.src_img.lineoffset[0] = LV_HOR_RES_MAX * pixel_size_alpha;
|
||||||
|
param.src_img.format = HD_VIDEO_PXLFMT_I8;
|
||||||
|
|
||||||
|
param.src_region.x = 0;
|
||||||
|
param.src_region.y = 0;
|
||||||
|
param.src_region.w = copy_w;
|
||||||
|
param.src_region.h = copy_h;
|
||||||
|
|
||||||
|
param.dst_img.format = HD_VIDEO_PXLFMT_I8;
|
||||||
|
param.dst_img.dim.w = swap_xy ? dst_h : dst_w;
|
||||||
|
param.dst_img.dim.h = swap_xy ? dst_w : dst_h;
|
||||||
|
param.dst_img.p_phy_addr[0] = dst_pa + alpha_offset_dst;
|
||||||
|
param.dst_img.lineoffset[0] = (swap_xy ? dst_h : dst_w) * pixel_size_alpha;
|
||||||
|
param.dst_pos = dst_pos;
|
||||||
|
param.angle = dir;
|
||||||
|
|
||||||
|
if(flush){
|
||||||
|
ret = hd_gfx_rotate(¶m);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
ret = vendor_gfx_rotate_no_flush(¶m);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ret != HD_OK){
|
||||||
|
LV_LOG_ERROR("ret = %d\n", ret);
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
LV_LOG_ERROR("lv_gpu_nvt_dma2d_copy_src_memcpy is unsupported for current LV_COLOR_DEPTH(%u)", LV_COLOR_DEPTH);
|
UINT32 dst_pa = 0;
|
||||||
return LV_RES_INV;
|
UINT32 src_pa = 0;
|
||||||
|
HD_GFX_ROTATE param = {0};
|
||||||
|
HD_RESULT ret = HD_OK;
|
||||||
|
HD_COMMON_MEM_VIRT_INFO vir_meminfo = {0};
|
||||||
|
HD_VIDEO_PXLFMT fmt = color_depth_to_hd_video_pxlfmt();
|
||||||
|
lv_coord_t copy_w = lv_area_get_width(src_area);
|
||||||
|
lv_coord_t copy_h = lv_area_get_height(src_area);
|
||||||
|
bool swap_xy = false;
|
||||||
|
HD_IPOINT dst_pos = {-1, -1};
|
||||||
|
|
||||||
|
/* convert va to pa */
|
||||||
|
vir_meminfo.va = (void *)(src);
|
||||||
|
if ( hd_common_mem_get(HD_COMMON_MEM_PARAM_VIRT_INFO, &vir_meminfo) != HD_OK) {
|
||||||
|
LV_LOG_ERROR("convert map failed!\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
src_pa = vir_meminfo.pa;
|
||||||
|
|
||||||
|
vir_meminfo.va = (void *)(dst);
|
||||||
|
if ( hd_common_mem_get(HD_COMMON_MEM_PARAM_VIRT_INFO, &vir_meminfo) != HD_OK) {
|
||||||
|
LV_LOG_ERROR("convert buf failed!\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dst_pa = vir_meminfo.pa;
|
||||||
|
|
||||||
|
|
||||||
|
memset(¶m, 0, sizeof(HD_GFX_ROTATE));
|
||||||
|
|
||||||
|
/* check dir */
|
||||||
|
switch(dir)
|
||||||
|
{
|
||||||
|
case HD_VIDEO_DIR_ROTATE_90:
|
||||||
|
dst_pos = (HD_IPOINT){dst_h - src_area->y1 - copy_h - dst_y, src_area->x1 + dst_x};
|
||||||
|
swap_xy = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HD_VIDEO_DIR_ROTATE_270:
|
||||||
|
dst_pos = (HD_IPOINT){src_area->y1 + dst_y, dst_w - src_area->x1 - copy_w - dst_x};
|
||||||
|
swap_xy = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HD_VIDEO_DIR_ROTATE_180:
|
||||||
|
dst_pos = (HD_IPOINT){dst_w - src_area->x1 - copy_w - dst_x, dst_h - src_area->y1 - copy_h - dst_y};
|
||||||
|
swap_xy = false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
LV_LOG_ERROR("dir(%lx) is currently not supported", dir);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* rotate rgb channels */
|
||||||
|
|
||||||
|
param.src_img.dim.w = copy_w;
|
||||||
|
param.src_img.dim.h = copy_h;
|
||||||
|
param.src_img.p_phy_addr[0] = src_pa;
|
||||||
|
param.src_img.lineoffset[0] = copy_w * sizeof(lv_color_t);
|
||||||
|
param.src_img.format = fmt;
|
||||||
|
|
||||||
|
param.src_region.x = 0;
|
||||||
|
param.src_region.y = 0;
|
||||||
|
param.src_region.w = copy_w;
|
||||||
|
param.src_region.h = copy_h;
|
||||||
|
|
||||||
|
param.dst_img.format = fmt;
|
||||||
|
param.dst_img.dim.w = swap_xy ? dst_h : dst_w;
|
||||||
|
param.dst_img.dim.h = swap_xy ? dst_w : dst_h;
|
||||||
|
param.dst_img.p_phy_addr[0] = dst_pa;
|
||||||
|
param.dst_img.lineoffset[0] = (swap_xy ? dst_h : dst_w) * sizeof(lv_color_t);
|
||||||
|
param.dst_pos = dst_pos;
|
||||||
|
param.angle = dir;
|
||||||
|
|
||||||
|
if(flush){
|
||||||
|
ret = hd_gfx_rotate(¶m);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
ret = vendor_gfx_rotate_no_flush(¶m);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ret != HD_OK){
|
||||||
|
LV_LOG_ERROR("ret = %d\n", ret);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return LV_RES_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
|
|
|
@ -36,69 +36,31 @@ extern "C" {
|
||||||
**********************/
|
**********************/
|
||||||
lv_res_t lv_gpu_nvt_dma2d_init(void);
|
lv_res_t lv_gpu_nvt_dma2d_init(void);
|
||||||
|
|
||||||
lv_res_t lv_gpu_nvt_dma2d_blend(
|
|
||||||
const lv_color_t * src,
|
|
||||||
lv_coord_t src_w,
|
|
||||||
lv_coord_t src_h,
|
|
||||||
lv_color_t * dst,
|
|
||||||
lv_coord_t dst_w,
|
|
||||||
lv_coord_t dst_h,
|
|
||||||
const lv_area_t* blend_area,
|
|
||||||
bool flush
|
|
||||||
);
|
|
||||||
|
|
||||||
lv_res_t lv_gpu_nvt_dma2d_blend_src_memcpy(
|
|
||||||
const lv_color_t * src,
|
|
||||||
lv_coord_t src_w,
|
|
||||||
lv_coord_t src_h,
|
|
||||||
lv_color_t * dst,
|
|
||||||
lv_coord_t dst_w,
|
|
||||||
lv_coord_t dst_h,
|
|
||||||
const lv_area_t* blend_area,
|
|
||||||
bool flush
|
|
||||||
);
|
|
||||||
|
|
||||||
lv_res_t lv_gpu_nvt_dma2d_fill(
|
|
||||||
lv_color_t * dst_buf,
|
|
||||||
lv_coord_t dst_width,
|
|
||||||
lv_coord_t dst_height,
|
|
||||||
const lv_area_t * fill_area,
|
|
||||||
lv_color_t color,
|
|
||||||
bool flush
|
|
||||||
);
|
|
||||||
|
|
||||||
lv_res_t lv_gpu_nvt_dma2d_fill_with_alpha(
|
|
||||||
lv_color_t * dst_buf,
|
|
||||||
lv_coord_t dst_width,
|
|
||||||
lv_coord_t dst_height,
|
|
||||||
const lv_area_t * fill_area,
|
|
||||||
lv_color_t color,
|
|
||||||
lv_opa_t,
|
|
||||||
bool flush
|
|
||||||
);
|
|
||||||
|
|
||||||
lv_res_t lv_gpu_nvt_dma2d_copy(
|
lv_res_t lv_gpu_nvt_dma2d_copy(
|
||||||
const lv_color_t * src,
|
const lv_color_t * src,
|
||||||
lv_coord_t src_w,
|
lv_coord_t src_w,
|
||||||
lv_coord_t src_h,
|
lv_coord_t src_h,
|
||||||
|
const lv_area_t* src_area,
|
||||||
lv_color_t * dst,
|
lv_color_t * dst,
|
||||||
lv_coord_t dst_w,
|
lv_coord_t dst_w,
|
||||||
lv_coord_t dst_h,
|
lv_coord_t dst_h,
|
||||||
const lv_area_t* area,
|
const lv_coord_t dst_x,
|
||||||
|
const lv_coord_t dst_y,
|
||||||
bool flush
|
bool flush
|
||||||
);
|
);
|
||||||
|
|
||||||
lv_res_t lv_gpu_nvt_dma2d_copy_src_memcpy(
|
void lv_gpu_nvt_dma2d_rotate(
|
||||||
const lv_color_t * src,
|
lv_color_t * src,
|
||||||
lv_coord_t src_w,
|
lv_coord_t src_w,
|
||||||
lv_coord_t src_h,
|
lv_coord_t src_h,
|
||||||
|
const lv_area_t* src_area,
|
||||||
lv_color_t * dst,
|
lv_color_t * dst,
|
||||||
lv_coord_t dst_w,
|
lv_coord_t dst_w,
|
||||||
lv_coord_t dst_h,
|
lv_coord_t dst_h,
|
||||||
const lv_area_t* area,
|
const lv_coord_t dst_x,
|
||||||
bool flush
|
const lv_coord_t dst_y,
|
||||||
);
|
uint32_t dir,
|
||||||
|
bool flush);
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
|
|
Loading…
Reference in New Issue
Block a user