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:
parent
c49430bfd4
commit
2be4e82991
@ -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.
|
||||
|
||||
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
|
||||
|
||||
- [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.
|
||||
|
@ -376,9 +376,16 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
|
||||
}
|
||||
else {
|
||||
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;
|
||||
|
||||
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) {
|
||||
perf_monitor.elaps_sum = 1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user