}
/* create a fd representing the fence */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)
+ fd = get_unused_fd_flag(O_CLOEXEC);
+ if (fd < 0)
+ {
+ sync_fence_put(fence);
+ goto out;
+ }
+#else
fd = get_unused_fd();
if (fd < 0)
{
FD_SET(fd, fdt->close_on_exec);
#endif
spin_unlock(&files->file_lock);
+#endif /* Linux > 3.6 */
+
+ files = current->files;
+ spin_lock(&files->file_lock);
+ fdt = files_fdtable(files);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)
+ __set_close_on_exec(fd, fdt);
+#else
+ FD_SET(fd, fdt->close_on_exec);
+#endif
+ spin_unlock(&files->file_lock);
/* bind fence to the new fd */
sync_fence_install(fence, fd);
}
}
-static void enable_one_core(void)
+static u32 enable_one_core(void)
{
+ u32 ret = 0;
if (num_cores_enabled < num_cores_total)
{
++num_cores_enabled;
schedule_work(&wq_work);
+ ret = 1;
MALI_DEBUG_PRINT(3, ("Core scaling: Enabling one more core\n"));
}
MALI_DEBUG_ASSERT( 1 <= num_cores_enabled);
MALI_DEBUG_ASSERT(num_cores_total >= num_cores_enabled);
+ return ret;
}
static void disable_one_core(void)
{
+ u32 ret = 0;
if (min_pp_num < num_cores_enabled)
{
--num_cores_enabled;
schedule_work(&wq_work);
+ ret = 1;
MALI_DEBUG_PRINT(3, ("Core scaling: Disabling one core\n"));
}
MALI_DEBUG_ASSERT( min_pp_num <= num_cores_enabled);
MALI_DEBUG_ASSERT(num_cores_total >= num_cores_enabled);
+ return ret;
}
static void enable_max_num_cores(void)
{
+ u32 ret = 0;
if (num_cores_enabled < num_cores_total)
{
num_cores_enabled = num_cores_total;
schedule_work(&wq_work);
+ ret = 1;
MALI_DEBUG_PRINT(3, ("Core scaling: Enabling maximum number of cores\n"));
}
MALI_DEBUG_ASSERT(num_cores_total == num_cores_enabled);
+ return ret;
}
void mali_core_scaling_init(int num_pp_cores, int clock_rate_index)