kbase_platform_config *config;
int attribute_count;
-//#ifdef CONFIG_MALI_PLATFORM_FAKE
-#if 1//defined(CONFIG_MALI_PLATFORM_FAKE) || defined(CONFIG_MALI_PLATFORM_FAKE_MODULE)
+/*#ifdef CONFIG_MALI_PLATFORM_FAKE*/
+#if 1
+/*defined(CONFIG_MALI_PLATFORM_FAKE) || defined(CONFIG_MALI_PLATFORM_FAKE_MODULE)*/
config = kbase_get_platform_config();
attribute_count = kbasep_get_config_attribute_count(config->attributes);
}
platform = (struct rk_context *)dvfs_status->kbdev->platform_context;
- fps = rk_get_real_fps();
+ fps = rk_get_real_fps(0);
spin_lock_irqsave(&mali_dvfs_spinlock, flags);
if ((dvfs_status->utilisation > mali_dvfs_infotbl[dvfs_status->step].max_threshold) && (dvfs_status->step < MALI_DVFS_STEP-1) && (fps < LIMIT_FPS))
}
static int kbase_platform_power_clock_init(kbase_device *kbdev)
{
- //struct device *dev = kbdev->dev;
+ /*struct device *dev = kbdev->dev;*/
struct rk_context *platform;
platform = (struct rk_context *)kbdev->platform_context;
#ifdef CONFIG_MALI_MIDGARD_DVFS
platform = (struct rk_context *)kbdev->platform_context;
if (sysfs_streq("off", buf)) {
- //kbase_platform_dvfs_enable(false, MALI_DVFS_BL_CONFIG_FREQ);
+ /*kbase_platform_dvfs_enable(false, MALI_DVFS_BL_CONFIG_FREQ);*/
kbase_platform_dvfs_enable(false, p_mali_dvfs_infotbl[MALI_DVFS_STEP-1].clock);
platform->dvfs_enabled = false;
} else if (sysfs_streq("on", buf)) {
- //kbase_platform_dvfs_enable(true, MALI_DVFS_START_FREQ);
+ /*kbase_platform_dvfs_enable(true, MALI_DVFS_START_FREQ);*/
kbase_platform_dvfs_enable(true, p_mali_dvfs_infotbl[0].clock);
platform->dvfs_enabled = true;
} else {
ret += snprintf(buf + ret, PAGE_SIZE - ret, "Current Upper Lock Level = %dMhz", locked_level);
else
ret += snprintf(buf + ret, PAGE_SIZE - ret, "Unset the Upper Lock Level");
- //ret += snprintf(buf + ret, PAGE_SIZE - ret, "\nPossible settings : 400, 350,266, 160, 100, If you want to unlock : 600 or off");
+ /*ret += snprintf(buf + ret, PAGE_SIZE - ret, "\nPossible settings : 400, 350,266, 160, 100, If you want to unlock : 600 or off");*/
ret += snprintf(buf + ret, PAGE_SIZE - ret, "\nPossible settings :");
for(i=0;i<MALI_DVFS_STEP;i++)
ret += snprintf(buf + ret, PAGE_SIZE - ret, "%d ",p_mali_dvfs_infotbl[i].clock/1000);
ret += snprintf(buf + ret, PAGE_SIZE - ret, "Current Under Lock Level = %dMhz", locked_level);
else
ret += snprintf(buf + ret, PAGE_SIZE - ret, "Unset the Under Lock Level");
- //ret += snprintf(buf + ret, PAGE_SIZE - ret, "\nPossible settings : 600, 400, 350,266, 160, If you want to unlock : 100 or off");
+ /*ret += snprintf(buf + ret, PAGE_SIZE - ret, "\nPossible settings : 600, 400, 350,266, 160, If you want to unlock : 100 or off");*/
ret += snprintf(buf + ret, PAGE_SIZE - ret, "\nPossible settings :");
for(i=0;i<MALI_DVFS_STEP;i++)
ret += snprintf(buf + ret, PAGE_SIZE - ret, "%d ",p_mali_dvfs_infotbl[i].clock/1000);
mutex_unlock(&dev_drv->output_lock);
return ret;
}
-static int cfgdone_last_time_ms = 0;
-static int cfgdone_interval_ms = 0;
-int rk_get_real_fps(void)
+
+#if 1
+static int cfgdone_distlist[10] = {0};
+static int cfgdone_index = 0;
+static int cfgdone_lasttime = 0;
+
+int rk_get_real_fps(int before)
{
+ if(before > 100) before = 100;
+ if(before < 0) before = 0;
+
struct timespec now;
- int interval_ms = 0;
getnstimeofday(&now);
- interval_ms = (now.tv_sec *1000 + now.tv_nsec/1000000) - cfgdone_last_time_ms;
- interval_ms = (interval_ms > cfgdone_interval_ms) ? interval_ms : cfgdone_interval_ms;
- if(!interval_ms)
- return 60;/*keep cpu clock*/
- else
- return 1000 / interval_ms;
+ int dist_curr = (now.tv_sec * 1000000 + now.tv_nsec/1000) - cfgdone_lasttime;
+ int dist_total = 0;
+ int dist_count = 0;
+ int dist_first = 0;
+
+ int index = cfgdone_index;
+ int i = 0, fps = 0;
+ int total = dist_curr;
+
+ /*
+ printk("fps: ");
+ */
+ for(i=0; i<10; i++) {
+ if(--index < 0) index = 9;
+ total += cfgdone_distlist[index];
+ if(i==0) dist_first = cfgdone_distlist[index];
+ if(total < (before*1000)) {
+ /*
+ printk("[%d:%d] ", dist_count, cfgdone_distlist[index]);
+ */
+ dist_total += cfgdone_distlist[index];
+ dist_count ++;
+ } else {
+ break;
+ }
+ }
+
+ /*
+ printk("total %d, count %d, curr %d, ", dist_total, dist_count, dist_curr);
+ */
+ dist_curr = (dist_curr > dist_first) ? dist_curr : dist_first;
+ dist_total += dist_curr;
+ dist_count ++;
+
+ if(dist_total > 0)
+ fps = (1000000 * dist_count) / dist_total;
+ else
+ fps = 60;
+
+ /*
+ printk("curr2 %d, fps=%d\n", dist_curr, fps);
+ */
+ return fps;
}
EXPORT_SYMBOL(rk_get_real_fps);
+#endif
+
static int rk_fb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
{
struct rk_fb *rk_fb = dev_get_drvdata(info->device);
#endif
case RK_FBIOSET_CONFIG_DONE:
{
- struct timespec now;
- int curr_time_ms = 0;
- getnstimeofday(&now);
- curr_time_ms = now.tv_sec *1000 + now.tv_nsec/1000000;
- cfgdone_interval_ms = curr_time_ms - cfgdone_last_time_ms;
- cfgdone_last_time_ms = curr_time_ms;
+ int curr = 0;
+ struct timespec now;
+
+ getnstimeofday(&now);
+ curr = now.tv_sec * 1000000 + now.tv_nsec/1000;
+ cfgdone_distlist[cfgdone_index++] = curr - cfgdone_lasttime;
+ /*
+ printk("%d ", curr - cfgdone_lasttime);
+ */
+ cfgdone_lasttime = curr;
+ if(cfgdone_index>=10) cfgdone_index = 0;
}
if(copy_from_user(&win_data,
(struct rk_fb_win_cfg_data __user *)argp,
extern char *get_format_string(enum data_format, char *fmt);
extern int support_uboot_display(void);
extern int rk_fb_calc_fps(struct rk_screen * screen, u32 pixclock);
-extern int rk_get_real_fps(void);
+extern int rk_get_real_fps(int time);
#endif