add fence support
authorKasin Lee <kasin.li@amlogic.com>
Sat, 21 Sep 2013 10:44:11 +0000 (18:44 +0800)
committerKasin Lee <kasin.li@amlogic.com>
Sat, 21 Sep 2013 10:44:11 +0000 (18:44 +0800)
mali/linux/mali_sync_user.c
mali/platform/meson8/mali_scaling.c

index b47d6626fcb1fe0a0eae005bd937c3005b694033..87988193048d603ab39742eb69eb552e11c455fb 100644 (file)
@@ -127,6 +127,14 @@ int mali_stream_create_fence(mali_sync_pt *pt)
        }
 
        /* 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)
        {
@@ -143,6 +151,17 @@ int mali_stream_create_fence(mali_sync_pt *pt)
        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);
index 497939742832b3c632e912ee74fb82b92c73bf5c..b3ad941f98ed3d2ee3589e25a2ffa3804866a4c0 100755 (executable)
@@ -80,42 +80,51 @@ static void do_scaling(struct work_struct *work)
        }
 }
 
-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)