tizen 2.4 release
[kernel/linux-3.0.git] / drivers / gpu / arm / mali400 / mali / common / mali_kernel_vsync.c
1 /*
2  * Copyright (C) 2011-2012 ARM Limited. All rights reserved.
3  *
4  * This program is free software and is provided to you under the terms of the GNU General Public License version 2
5  * as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
6  *
7  * A copy of the licence is included with the program, and can also be obtained from Free Software
8  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
9  */
10
11 #include "mali_kernel_common.h"
12 #include "mali_osk.h"
13 #include "mali_ukk.h"
14
15 #if defined(CONFIG_MALI400_PROFILING)
16 #include "mali_osk_profiling.h"
17 #endif
18
19 _mali_osk_errcode_t _mali_ukk_vsync_event_report(_mali_uk_vsync_event_report_s *args)
20 {
21         _mali_uk_vsync_event event = (_mali_uk_vsync_event)args->event;
22         MALI_IGNORE(event); /* event is not used for release code, and that is OK */
23
24 #if defined(CONFIG_MALI400_PROFILING)
25         /*
26          * Manually generate user space events in kernel space.
27          * This saves user space from calling kernel space twice in this case.
28          * We just need to remember to add pid and tid manually.
29          */
30         if ( event==_MALI_UK_VSYNC_EVENT_BEGIN_WAIT)
31         {
32                 _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_SUSPEND |
33                                               MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
34                                               MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_VSYNC,
35                                               _mali_osk_get_pid(), _mali_osk_get_tid(), 0, 0, 0);
36         }
37
38         if (event==_MALI_UK_VSYNC_EVENT_END_WAIT)
39         {
40
41                 _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_RESUME |
42                                               MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
43                                               MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_VSYNC,
44                                               _mali_osk_get_pid(), _mali_osk_get_tid(), 0, 0, 0);
45         }
46 #endif
47
48         MALI_DEBUG_PRINT(4, ("Received VSYNC event: %d\n", event));
49         MALI_SUCCESS;
50 }
51