rockchip: mali400: update to R4P1-01REL0
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / arm / mali400 / mali / common / mali_kernel_vsync.c
1 /*
2  * This confidential and proprietary software may be used only as
3  * authorised by a licensing agreement from ARM Limited
4  * (C) COPYRIGHT 2011-2014 ARM Limited
5  * ALL RIGHTS RESERVED
6  * The entire notice above must be reproduced on all authorised
7  * copies and copies may only be made to the extent permitted
8  * by a licensing agreement from ARM Limited.
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                 _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_SUSPEND |
32                                               MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
33                                               MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_VSYNC,
34                                               _mali_osk_get_pid(), _mali_osk_get_tid(), 0, 0, 0);
35         }
36
37         if (event == _MALI_UK_VSYNC_EVENT_END_WAIT) {
38
39                 _mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_RESUME |
40                                               MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
41                                               MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_VSYNC,
42                                               _mali_osk_get_pid(), _mali_osk_get_tid(), 0, 0, 0);
43         }
44 #endif
45
46         MALI_DEBUG_PRINT(4, ("Received VSYNC event: %d\n", event));
47         MALI_SUCCESS;
48 }
49