BigW Consortium Gitlab

Commit f6c459d2 by Kiss-Vamosi Gabor

lv_refr: refresh time monitor added

parent b4c877c0
...@@ -16,11 +16,7 @@ ...@@ -16,11 +16,7 @@
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#define MONITOR_EXEC_TIME 0
#if MONITOR_EXEC_TIME != 0
#include <time.h>
#include <stdio.h>
#endif
/********************** /**********************
* TYPEDEFS * TYPEDEFS
**********************/ **********************/
...@@ -51,6 +47,7 @@ static void lv_refr_obj(lv_obj_t * obj, const area_t * mask_ori_p); ...@@ -51,6 +47,7 @@ static void lv_refr_obj(lv_obj_t * obj, const area_t * mask_ori_p);
**********************/ **********************/
static lv_join_t inv_buf[LV_INV_FIFO_SIZE]; static lv_join_t inv_buf[LV_INV_FIFO_SIZE];
static uint16_t inv_buf_p; static uint16_t inv_buf_p;
static void (*monitor_cb)(uint32_t, uint32_t);
/********************** /**********************
* MACROS * MACROS
...@@ -126,6 +123,15 @@ void lv_inv_area(const area_t * area_p) ...@@ -126,6 +123,15 @@ void lv_inv_area(const area_t * area_p)
} }
} }
/**
* Set a function to call after every refresh to announce the refresh time and the number of refreshed pixels
* @param cb pointer to a callback function (void my_refr_cb(uint32_t time_ms, uint32_t px_num))
*/
void lv_refr_set_monitor_cb(void (*cb)(uint32_t, uint32_t))
{
monitor_cb = cb;
}
/********************** /**********************
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
...@@ -191,10 +197,8 @@ static void lv_refr_join_area(void) ...@@ -191,10 +197,8 @@ static void lv_refr_join_area(void)
static void lv_refr_areas(void) static void lv_refr_areas(void)
{ {
uint32_t i; uint32_t i;
uint32_t start = systick_get();
#if MONITOR_EXEC_TIME != 0 uint32_t px_num = 0;
clock_t start = clock();
#endif
for(i = 0; i < inv_buf_p; i++) { for(i = 0; i < inv_buf_p; i++) {
/*Refresh the unjoined areas*/ /*Refresh the unjoined areas*/
...@@ -206,16 +210,16 @@ static void lv_refr_areas(void) ...@@ -206,16 +210,16 @@ static void lv_refr_areas(void)
/*If VDB is used...*/ /*If VDB is used...*/
lv_refr_area_with_vdb(&inv_buf[i].area); lv_refr_area_with_vdb(&inv_buf[i].area);
#endif #endif
if(monitor_cb != NULL) px_num += area_get_size(&inv_buf[i].area);
} }
} }
#if MONITOR_EXEC_TIME != 0
if(inv_buf_p != 0) { if(inv_buf_p != 0) {
clock_t end = clock(); if(monitor_cb != NULL) {
float time_spent = (float)(end - start) / CLOCKS_PER_SEC; monitor_cb(systick_elaps(start), px_num);
printf("Exec time: %08f ms\n", (float)time_spent * 1000); }
} }
#endif
} }
#if LV_VDB_SIZE == 0 #if LV_VDB_SIZE == 0
...@@ -343,7 +347,7 @@ static lv_obj_t * lv_refr_get_top_obj(const area_t * area_p, lv_obj_t * obj) ...@@ -343,7 +347,7 @@ static lv_obj_t * lv_refr_get_top_obj(const area_t * area_p, lv_obj_t * obj)
} }
/** /**
* Make the refreshing from an object. Draw all its children and the yungers too. * Make the refreshing from an object. Draw all its children and the youngers too.
* @param top_p pointer to an objects. Start the drawing from it. * @param top_p pointer to an objects. Start the drawing from it.
* @param mask_p pointer to an area, the objects will be drawn only here * @param mask_p pointer to an area, the objects will be drawn only here
*/ */
......
...@@ -44,6 +44,11 @@ void lv_refr_init(void); ...@@ -44,6 +44,11 @@ void lv_refr_init(void);
*/ */
void lv_inv_area(const area_t * area_p); void lv_inv_area(const area_t * area_p);
/**
* Set a function to call after every refresh to announce the refresh time and the number of refreshed pixels
* @param cb pointer to a callback function (void my_refr_cb(uint32_t time_ms, uint32_t px_num))
*/
void lv_refr_set_monitor_cb(void (*cb)(uint32_t, uint32_t));
/********************** /**********************
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment