mirror of
https://gitee.com/Vancouver2017/luban-lite-t3e-pro.git
synced 2025-12-15 19:08:54 +00:00
v1.1.1
This commit is contained in:
@@ -44,7 +44,7 @@
|
||||
#endif
|
||||
|
||||
#define LV_USE_MEM_MONITOR 0
|
||||
#define LV_USE_PERF_MONITOR 1
|
||||
#define LV_USE_PERF_MONITOR 0
|
||||
#define LV_USE_SYSMON 1
|
||||
#define LV_INDEV_DEF_READ_PERIOD 10
|
||||
|
||||
@@ -103,9 +103,13 @@
|
||||
|
||||
#define LV_USE_GIF 1
|
||||
|
||||
#define LV_CACHE_DEF_SIZE 10 * 1024 * 1024
|
||||
#ifndef LV_CACHE_DEF_SIZE
|
||||
#define LV_CACHE_DEF_SIZE 8 * 1024 * 1024
|
||||
#endif
|
||||
|
||||
#ifndef LV_IMAGE_HEADER_CACHE_DEF_CNT
|
||||
#define LV_IMAGE_HEADER_CACHE_DEF_CNT 20
|
||||
#endif
|
||||
|
||||
#define LV_DEF_REFR_PERIOD 10
|
||||
|
||||
|
||||
@@ -382,6 +382,13 @@ static lv_result_t jpeg_decoder_info(lv_image_decoder_t *decoder, const void *sr
|
||||
return LV_RESULT_INVALID;
|
||||
}
|
||||
|
||||
#if defined(MPP_JPEG_DEC_OUT_SIZE_LIMIT_ENABLE)
|
||||
int size_shift = jpeg_size_limit(width, height);
|
||||
width = width >> size_shift;
|
||||
height = height >> size_shift;
|
||||
header->reserved_2 = size_shift;
|
||||
#endif
|
||||
|
||||
header->w = width;
|
||||
header->h = height;
|
||||
header->cf = mpp_fmt_to_lv_fmt(format);
|
||||
@@ -754,7 +761,18 @@ static lv_result_t lv_mpp_dec_open(lv_image_decoder_t *decoder, lv_image_decoder
|
||||
dec_frame.buf.format = config.pix_fmt;
|
||||
dec_frame.buf.buf_type = MPP_PHY_ADDR;
|
||||
|
||||
int size_shift = 0;
|
||||
#if defined(MPP_JPEG_DEC_OUT_SIZE_LIMIT_ENABLE)
|
||||
if (type == MPP_CODEC_VIDEO_DECODER_MJPEG)
|
||||
size_shift = dsc->header.reserved_2;
|
||||
#endif
|
||||
set_frame_buf_size(&dec_frame, buf_size, 0);
|
||||
if (size_shift > 0) {
|
||||
struct mpp_scale_ratio scale;
|
||||
scale.hor_scale = size_shift;
|
||||
scale.ver_scale = size_shift;
|
||||
mpp_decoder_control(dec, MPP_DEC_INIT_CMD_SET_SCALE, &scale);
|
||||
}
|
||||
|
||||
CHECK_RET(frame_buf_alloc(mpp_data, &dec_frame.buf, buf_size, dsc->header.cf), LV_RESULT_OK);
|
||||
|
||||
@@ -894,7 +912,7 @@ void lv_mpp_dec_deinit(void)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(LPKG_USING_LVGL) && defined(LVGL_V_9)
|
||||
#if defined(LPKG_USING_LVGL) && defined(LVGL_V_9) && LV_CACHE_DEF_SIZE > 0
|
||||
bool lv_drop_one_cached_image()
|
||||
{
|
||||
#define img_cache_p (LV_GLOBAL_DEFAULT()->img_cache)
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtconfig.h>
|
||||
#include "lvgl.h"
|
||||
|
||||
#ifndef LV_USE_MPP_DEC
|
||||
#define LV_USE_MPP_DEC 1
|
||||
#endif
|
||||
@@ -25,6 +28,53 @@ extern "C" {
|
||||
#define LV_CACHE_IMG_NUM 8
|
||||
#endif
|
||||
|
||||
#ifndef MPP_JPEG_DEC_OUT_SIZE_LIMIT_ENABLE
|
||||
#define MPP_JPEG_DEC_OUT_SIZE_LIMIT_ENABLE
|
||||
#endif
|
||||
|
||||
#ifndef MPP_JPEG_DEC_MAX_OUT_WIDTH
|
||||
#define MPP_JPEG_DEC_MAX_OUT_WIDTH 2048
|
||||
#endif
|
||||
|
||||
#ifndef MPP_JPEG_DEC_MAX_OUT_HEIGHT
|
||||
#define MPP_JPEG_DEC_MAX_OUT_HEIGHT 2048
|
||||
#endif
|
||||
|
||||
static inline int jpeg_width_limit(int width)
|
||||
{
|
||||
int r = 0;
|
||||
|
||||
while(width > MPP_JPEG_DEC_MAX_OUT_WIDTH) {
|
||||
width = width >> 1;
|
||||
r++;
|
||||
|
||||
if (r == 3) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
static inline int jpeg_height_limit(int height)
|
||||
{
|
||||
int r = 0;
|
||||
|
||||
while(height > MPP_JPEG_DEC_MAX_OUT_HEIGHT) {
|
||||
height = height >> 1;
|
||||
r++;
|
||||
|
||||
if (r == 3) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
static inline int jpeg_size_limit(int w, int h)
|
||||
{
|
||||
return LV_MAX(jpeg_width_limit(w), jpeg_height_limit(h));
|
||||
}
|
||||
|
||||
void lv_mpp_dec_init(void);
|
||||
|
||||
void lv_mpp_dec_deinit(void);
|
||||
|
||||
@@ -8,12 +8,83 @@
|
||||
|
||||
#include <aic_core.h>
|
||||
#include <stdbool.h>
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
#include "lvgl.h"
|
||||
#include "lv_port_disp.h"
|
||||
#include "lv_tpc_run.h"
|
||||
#include "lv_draw_ge2d.h"
|
||||
#include "lv_mpp_dec.h"
|
||||
|
||||
#if LV_DISP_FB_DUMP
|
||||
static char g_save_path[128] = { 0 };
|
||||
static bool g_dump_flag = false;
|
||||
|
||||
static inline void lv_disp_buf_dump(lv_display_t *disp)
|
||||
{
|
||||
if (g_dump_flag) {
|
||||
g_dump_flag = false;
|
||||
lv_fs_res_t res = LV_FS_RES_OK;
|
||||
lv_color_format_t cf = lv_display_get_color_format(disp);
|
||||
uint32_t h = lv_display_get_vertical_resolution(disp);
|
||||
uint32_t w = lv_display_get_horizontal_resolution(disp);
|
||||
uint32_t stride = lv_draw_buf_width_to_stride(w, cf);
|
||||
lv_draw_buf_t *disp_buf = lv_display_get_buf_active(disp);
|
||||
lv_fs_file_t file_save;
|
||||
uint32_t data_write = 0;
|
||||
char src[128];
|
||||
|
||||
snprintf(src, 127, "L:%s", g_save_path);
|
||||
res = lv_fs_open(&file_save, src, LV_FS_MODE_WR);
|
||||
if(res != LV_FS_RES_OK) {
|
||||
LV_LOG_ERROR("open %s failed", src);
|
||||
return;
|
||||
}
|
||||
lv_fs_write(&file_save, disp_buf->data, h * stride, &data_write);
|
||||
lv_fs_close(&file_save);
|
||||
printf("save %s ok\n", g_save_path);
|
||||
}
|
||||
}
|
||||
|
||||
static void lv_fb_dump(int argc, char **argv)
|
||||
{
|
||||
int ret;
|
||||
const char sopts[] = "u:o:";
|
||||
const struct option lopts[] = {
|
||||
{"usage", no_argument, NULL, 'u'},
|
||||
{"output", required_argument, NULL, 'o'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
optind = 0;
|
||||
while ((ret = getopt_long(argc, argv, sopts, lopts, NULL)) != -1) {
|
||||
switch (ret) {
|
||||
case 'o':
|
||||
strcpy(g_save_path, optarg);
|
||||
break;
|
||||
case 'u':
|
||||
printf("Usage: %s [Options]: \n", argv[0]);
|
||||
printf("\t-o, --output image path\n");
|
||||
printf("\tfor example:\n");
|
||||
printf("\tlv_fb_dump -o /sdcard/out.bin\n");
|
||||
return;
|
||||
default:
|
||||
LV_LOG_ERROR("Invalid parameter: %#x\n", ret);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (strlen(g_save_path)) {
|
||||
g_dump_flag = true;
|
||||
} else {
|
||||
printf("please check output path:%s\n", g_save_path);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
MSH_CMD_EXPORT_ALIAS(lv_fb_dump, lv_dump, lvgl dump display buffer);
|
||||
#endif
|
||||
|
||||
static void display_cal_frame_rate(aic_disp_t *aic_disp)
|
||||
{
|
||||
#if DISP_SHOW_FPS == 1
|
||||
@@ -129,6 +200,10 @@ static void disp_flush(lv_display_t *disp, const lv_area_t *area, uint8_t *px_ma
|
||||
(void)px_map;
|
||||
|
||||
if (lv_disp_flush_is_last(disp)) {
|
||||
#if LV_DISP_FB_DUMP
|
||||
// dump frame buffer
|
||||
lv_disp_buf_dump(disp);
|
||||
#endif
|
||||
if (disp_buf->data == aic_disp->buf_aligned) {
|
||||
#ifdef AIC_PAN_DISPLAY
|
||||
aic_disp->buf_id = aic_disp->buf_id > 0 ? 0 : 1;
|
||||
@@ -186,7 +261,7 @@ static lv_color_format_t lv_display_fmt(enum mpp_pixel_format cf)
|
||||
return fmt;
|
||||
}
|
||||
|
||||
#if LV_USE_OS && defined(AIC_PAN_DISPLAY)
|
||||
#if LV_USE_OS && defined(AIC_PAN_DISPLAY) && defined(LV_DISPLAY_ROTATE_EN)
|
||||
static void aic_display_thread(void *ptr)
|
||||
{
|
||||
aic_disp_t *aic_disp = (aic_disp_t *)ptr;
|
||||
@@ -219,7 +294,7 @@ static void aic_display_thread(void *ptr)
|
||||
#if defined(LV_DISPLAY_ROTATE_EN)
|
||||
static uint8_t *create_draw_buf(aic_disp_t *aic_disp, int w, int h, lv_color_format_t cf)
|
||||
{
|
||||
int bpp = lv_color_format_get_bpp(cf);
|
||||
int bpp = lv_color_format_get_bpp(cf) / 8;
|
||||
int buf_size = ALIGN_UP(w, 8) * ALIGN_UP(h, 8) * bpp;
|
||||
|
||||
aic_disp->buf = (uint8_t *)aicos_malloc_try_cma(buf_size + CACHE_LINE_SIZE - 1);
|
||||
@@ -307,7 +382,7 @@ void lv_port_disp_init(void)
|
||||
lv_display_set_rotation(disp, LV_ROTATE_DEGREE / 90);
|
||||
#endif
|
||||
|
||||
#if LV_USE_OS && defined(AIC_PAN_DISPLAY)
|
||||
#if LV_USE_OS && defined(AIC_PAN_DISPLAY) && defined(LV_DISPLAY_ROTATE_EN)
|
||||
aic_disp->sync_ready = true;
|
||||
lv_thread_sync_init(&aic_disp->sync);
|
||||
lv_thread_sync_init(&aic_disp->sync_notify);
|
||||
|
||||
@@ -19,6 +19,10 @@ extern "C" {
|
||||
#define DISP_SHOW_FPS 1
|
||||
#endif
|
||||
|
||||
#ifndef LV_DISP_FB_DUMP
|
||||
#define LV_DISP_FB_DUMP 0
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
struct mpp_fb *fb;
|
||||
struct aicfb_screeninfo info;
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
extern void lv_port_disp_init(void);
|
||||
extern void lv_port_indev_init(void);
|
||||
extern void lv_user_gui_init(void);
|
||||
extern void lv_wait_sdcard_mounted(void);
|
||||
|
||||
static struct rt_thread lvgl_thread;
|
||||
|
||||
@@ -45,7 +46,7 @@ static struct rt_thread lvgl_thread;
|
||||
#endif
|
||||
|
||||
#ifndef LV_MAIN_THREAD_STACK_SIZE
|
||||
#define LV_MAIN_THREAD_STACK_SIZE (4096 * 2)
|
||||
#define LV_MAIN_THREAD_STACK_SIZE LPKG_LVGL_THREAD_STACK_SIZE
|
||||
#endif /* LV_MAIN_THREAD_STACK_SIZE */
|
||||
|
||||
static rt_uint8_t lvgl_thread_stack[LV_MAIN_THREAD_STACK_SIZE];
|
||||
@@ -60,6 +61,7 @@ static void lv_rt_log(lv_log_level_t level, const char *buf)
|
||||
|
||||
static void lvgl_thread_entry(void *parameter)
|
||||
{
|
||||
lv_wait_sdcard_mounted();
|
||||
#if LV_USE_LOG
|
||||
lv_log_register_print_cb(lv_rt_log);
|
||||
#endif /* LV_USE_LOG */
|
||||
|
||||
@@ -49,7 +49,11 @@ typedef enum {
|
||||
LV_THREAD_PRIO_LOWEST,
|
||||
LV_THREAD_PRIO_LOW,
|
||||
LV_THREAD_PRIO_MID,
|
||||
#ifdef LPKG_LVGL_THREAD_PRIO
|
||||
LV_THREAD_PRIO_HIGH = LPKG_LVGL_THREAD_PRIO,
|
||||
#else
|
||||
LV_THREAD_PRIO_HIGH,
|
||||
#endif
|
||||
LV_THREAD_PRIO_HIGHEST,
|
||||
} lv_thread_prio_t;
|
||||
|
||||
|
||||
@@ -188,6 +188,12 @@ static void perf_update_timer_cb(lv_timer_t * t)
|
||||
1000 / disp_refr_period); /*Limit due to possible off-by-one error*/
|
||||
|
||||
info->calculated.cpu = 100 - LV_SYSMON_GET_IDLE();
|
||||
|
||||
#ifdef LPKG_USING_CPU_USAGE
|
||||
#include "cpu_usage.h"
|
||||
info->calculated.cpu = (uint32_t)cpu_load_average();
|
||||
#endif
|
||||
|
||||
info->calculated.refr_avg_time = info->measured.refr_cnt ? (info->measured.refr_elaps_sum / info->measured.refr_cnt) :
|
||||
0;
|
||||
|
||||
|
||||
@@ -226,10 +226,12 @@ void lv_image_set_src(lv_obj_t * obj, const void * src)
|
||||
|
||||
update_align(obj);
|
||||
|
||||
#if !defined(AIC_LVGL_METER_DEMO) || defined(LV_METER_SIMPLE_POINT)
|
||||
/*Provide enough room for the rotated corners*/
|
||||
if(img->rotation || img->scale_x != LV_SCALE_NONE || img->scale_y != LV_SCALE_NONE) {
|
||||
lv_obj_refresh_ext_draw_size(obj);
|
||||
}
|
||||
#endif
|
||||
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
@@ -284,12 +286,14 @@ void lv_image_set_rotation(lv_obj_t * obj, int32_t angle)
|
||||
|
||||
img->rotation = angle;
|
||||
|
||||
#if !defined(AIC_LVGL_METER_DEMO) || defined(LV_METER_SIMPLE_POINT)
|
||||
/* Disable invalidations because lv_obj_refresh_ext_draw_size would invalidate
|
||||
* the whole ext draw area */
|
||||
lv_display_t * disp = lv_obj_get_display(obj);
|
||||
lv_display_enable_invalidation(disp, false);
|
||||
lv_obj_refresh_ext_draw_size(obj);
|
||||
lv_display_enable_invalidation(disp, true);
|
||||
#endif
|
||||
|
||||
_lv_image_buf_get_transformed_area(&a, w, h, img->rotation, img->scale_x, img->scale_y, &pivot_px);
|
||||
a.x1 += obj->coords.x1;
|
||||
@@ -325,14 +329,14 @@ void lv_image_set_pivot(lv_obj_t * obj, int32_t x, int32_t y)
|
||||
lv_obj_invalidate_area(obj, &a);
|
||||
|
||||
lv_point_set(&img->pivot, x, y);
|
||||
|
||||
#if !defined(AIC_LVGL_METER_DEMO) || defined(LV_METER_SIMPLE_POINT)
|
||||
/* Disable invalidations because lv_obj_refresh_ext_draw_size would invalidate
|
||||
* the whole ext draw area */
|
||||
lv_display_t * disp = lv_obj_get_display(obj);
|
||||
lv_display_enable_invalidation(disp, false);
|
||||
lv_obj_refresh_ext_draw_size(obj);
|
||||
lv_display_enable_invalidation(disp, true);
|
||||
|
||||
#endif
|
||||
lv_image_get_pivot(obj, &pivot_px);
|
||||
_lv_image_buf_get_transformed_area(&a, w, h, img->rotation, img->scale_x, img->scale_y, &pivot_px);
|
||||
a.x1 += obj->coords.x1;
|
||||
|
||||
Reference in New Issue
Block a user