static void device_update_fps(v4l_device_t *dev) { struct timeval tv; unsigned long long tstamp; gettimeofday(&tv, NULL); tstamp = (((unsigned long long) tv.tv_sec) * 1000000ULL) + tv.tv_usec; fps_update(&dev->fps, tstamp); }
static int adp_fps_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state) { int gpu_loading; if ((state != 0) && (state != 1)) { mtk_cooler_fps_dprintk("[%s] invalid input (0: no thro; 1: adp fps thro on)\n", __func__); return 0; } mtk_cooler_fps_dprintk("[%s] %s %lu\n", __func__, cdev->type, state); cl_adp_fps_state = state; /* check the fps update from display */ fps_update(); set_sma_val(fps_history, fps_sma_len, &fps_history_idx, tm_input_fps); set_sma_val(tpcb_history, tpcb_sma_len, &tpcb_history_idx, mtk_thermal_get_temp(MTK_THERMAL_SENSOR_AP)); if (!mtk_get_gpu_loading(&gpu_loading)) gpu_loading = 0; set_sma_val(gpu_loading_history, gpu_loading_sma_len, &gpu_loading_history_idx, gpu_loading); /* 1. update the parameter of "cl_adp_fps_limit" */ /* do we already leave game? */ if (!in_consistent_scene()) unlimit_fps_limit(); cl_adp_fps_limit = adp_calc_fps_limit(); /* 2. set the the limit */ mtk_cl_fps_set_fps_limit(); return 0; }