1/* 2 * Copyright (C) 2010-2015 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#ifndef __MALI_KERNEL_UTILIZATION_H__ 12#define __MALI_KERNEL_UTILIZATION_H__ 13 14#include <linux/mali/mali_utgard.h> 15#include "mali_osk.h" 16 17/** 18 * Initialize/start the Mali GPU utilization metrics reporting. 19 * 20 * @return _MALI_OSK_ERR_OK on success, otherwise failure. 21 */ 22_mali_osk_errcode_t mali_utilization_init(void); 23 24/** 25 * Terminate the Mali GPU utilization metrics reporting 26 */ 27void mali_utilization_term(void); 28 29/** 30 * Check if Mali utilization is enabled 31 */ 32mali_bool mali_utilization_enabled(void); 33 34/** 35 * Should be called when a job is about to execute a GP job 36 */ 37void mali_utilization_gp_start(void); 38 39/** 40 * Should be called when a job has completed executing a GP job 41 */ 42void mali_utilization_gp_end(void); 43 44/** 45 * Should be called when a job is about to execute a PP job 46 */ 47void mali_utilization_pp_start(void); 48 49/** 50 * Should be called when a job has completed executing a PP job 51 */ 52void mali_utilization_pp_end(void); 53 54/** 55 * Should be called to calcution the GPU utilization 56 */ 57struct mali_gpu_utilization_data *mali_utilization_calculate(u64 *start_time, u64 *time_period, mali_bool *need_add_timer); 58 59_mali_osk_spinlock_irq_t *mali_utilization_get_lock(void); 60 61void mali_utilization_platform_realize(struct mali_gpu_utilization_data *util_data); 62 63void mali_utilization_data_lock(void); 64 65void mali_utilization_data_unlock(void); 66 67void mali_utilization_data_assert_locked(void); 68 69void mali_utilization_reset(void); 70 71 72#endif /* __MALI_KERNEL_UTILIZATION_H__ */ 73