1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

fix(refr): fix performance monitor NULL pointer access (#3105)

* fix(refr) performance monitor NULL pointer access

* doc(refr): describe the setting of LV_DISP_DEF_REFR_PERIOD

Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
_VIFEXTech 2022-02-18 18:32:16 +08:00 committed by GitHub
parent c49430bfd4
commit 2be4e82991
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -228,6 +228,8 @@ If you have multiple displays call `lv_disp_set_deafult(disp1);` to select the d
Note that `lv_timer_handler()` and `_lv_disp_refr_timer()` can not run at the same time. Note that `lv_timer_handler()` and `_lv_disp_refr_timer()` can not run at the same time.
If the performance monitor is enabled, the value of `LV_DISP_DEF_REFR_PERIOD` needs to be set to be consistent with the refresh period of the display to ensure that the statistical results are correct.
## Further reading ## Further reading
- [lv_port_disp_template.c](https://github.com/lvgl/lvgl/blob/master/examples/porting/lv_port_disp_template.c) for a template for your own driver. - [lv_port_disp_template.c](https://github.com/lvgl/lvgl/blob/master/examples/porting/lv_port_disp_template.c) for a template for your own driver.

View File

@ -376,9 +376,16 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
} }
else { else {
perf_monitor.perf_last_time = lv_tick_get(); perf_monitor.perf_last_time = lv_tick_get();
uint32_t fps_limit = 1000 / disp_refr->refr_timer->period; uint32_t fps_limit;
uint32_t fps; uint32_t fps;
if(disp_refr->refr_timer) {
fps_limit = 1000 / disp_refr->refr_timer->period;
}
else {
fps_limit = 1000 / LV_DISP_DEF_REFR_PERIOD;
}
if(perf_monitor.elaps_sum == 0) { if(perf_monitor.elaps_sum == 0) {
perf_monitor.elaps_sum = 1; perf_monitor.elaps_sum = 1;
} }