xref: /OK3568_Linux_fs/kernel/drivers/gpu/arm/mali400/mali/common/mali_kernel_vsync.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright (C) 2011-2014, 2016-2017 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 #include "mali_osk_profiling.h"
16 
_mali_ukk_vsync_event_report(_mali_uk_vsync_event_report_s * args)17 _mali_osk_errcode_t _mali_ukk_vsync_event_report(_mali_uk_vsync_event_report_s *args)
18 {
19 	_mali_uk_vsync_event event = (_mali_uk_vsync_event)args->event;
20 	MALI_IGNORE(event); /* event is not used for release code, and that is OK */
21 
22 	/*
23 	 * Manually generate user space events in kernel space.
24 	 * This saves user space from calling kernel space twice in this case.
25 	 * We just need to remember to add pid and tid manually.
26 	 */
27 	if (event == _MALI_UK_VSYNC_EVENT_BEGIN_WAIT) {
28 		_mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_SUSPEND |
29 					      MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
30 					      MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_VSYNC,
31 					      _mali_osk_get_pid(), _mali_osk_get_tid(), 0, 0, 0);
32 	}
33 
34 	if (event == _MALI_UK_VSYNC_EVENT_END_WAIT) {
35 		_mali_osk_profiling_add_event(MALI_PROFILING_EVENT_TYPE_RESUME |
36 					      MALI_PROFILING_EVENT_CHANNEL_SOFTWARE |
37 					      MALI_PROFILING_EVENT_REASON_SUSPEND_RESUME_SW_VSYNC,
38 					      _mali_osk_get_pid(), _mali_osk_get_tid(), 0, 0, 0);
39 	}
40 
41 
42 	MALI_DEBUG_PRINT(4, ("Received VSYNC event: %d\n", event));
43 	MALI_SUCCESS;
44 }
45 
46