tizen 2.4 release
[kernel/linux-3.0.git] / drivers / gpu / arm / mali400 / r4p0_rel0 / common / mali_pp_scheduler.h
1 /*
2  * Copyright (C) 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 #ifndef __MALI_PP_SCHEDULER_H__
12 #define __MALI_PP_SCHEDULER_H__
13
14 #include "mali_osk.h"
15 #include "mali_pp_job.h"
16 #include "mali_group.h"
17 #include "linux/mali/mali_utgard.h"
18
19 /** Initalize the HW independent parts of the  PP scheduler
20  */
21 _mali_osk_errcode_t mali_pp_scheduler_initialize(void);
22 void mali_pp_scheduler_terminate(void);
23
24 /** Poplulate the PP scheduler with groups
25  */
26 void mali_pp_scheduler_populate(void);
27 void mali_pp_scheduler_depopulate(void);
28
29 /**
30  * @brief Handle job completion.
31  *
32  * Will attempt to start a new job on the locked group.
33  *
34  * If all sub jobs have completed the job's tracker will be released, any other resources associated
35  * with the job will be freed.  A notification will also be sent to user space.
36  *
37  * Releasing the tracker might activate other jobs, so if appropriate we also schedule them.
38  *
39  * @note Group must be locked when entering this function.  Will be unlocked before exiting.
40  *
41  * @param group The group that completed the job.
42  * @param job The job that is done.
43  * @param sub_job Sub job of job.
44  * @param success MALI_TRUE if job completed successfully, MALI_FALSE if not.
45  * @param in_upper_half MALI_TRUE if called from upper half, MALI_FALSE if not.
46  */
47 void mali_pp_scheduler_job_done(struct mali_group *group, struct mali_pp_job *job, u32 sub_job, mali_bool success, mali_bool in_upper_half);
48
49 void mali_pp_scheduler_suspend(void);
50 void mali_pp_scheduler_resume(void);
51
52 /**
53  * @brief Abort all running and queued PP jobs from session.
54  *
55  * This functions aborts all PP jobs from the specified session. Queued jobs are removed from the
56  * queue and jobs currently running on a core will be aborted.
57  *
58  * @param session Session that is aborting.
59  */
60 void mali_pp_scheduler_abort_session(struct mali_session_data *session);
61
62 /**
63  * @brief Reset all groups
64  *
65  * This function resets all groups known by the PP scheuduler. This must be
66  * called after the Mali HW has been powered on in order to reset the HW.
67  *
68  * This function is intended for power on reset of all cores.
69  * No locking is done, which can only be safe if the scheduler is paused and
70  * all cores idle. That is always the case on init and power on.
71  */
72 void mali_pp_scheduler_reset_all_groups(void);
73
74 /**
75  * @brief Zap TLB on all groups with \a session active
76  *
77  * The scheculer will zap the session on all groups it owns.
78  */
79 void mali_pp_scheduler_zap_all_active(struct mali_session_data *session);
80
81 /**
82  * @brief Get the virtual PP core
83  *
84  * The returned PP core may only be used to prepare DMA command buffers for the
85  * PP core. Other actions must go through the PP scheduler, or the virtual
86  * group.
87  *
88  * @return Pointer to the virtual PP core, NULL if this doesn't exist
89  */
90 struct mali_pp_core *mali_pp_scheduler_get_virtual_pp(void);
91
92 u32 mali_pp_scheduler_dump_state(char *buf, u32 size);
93
94 void mali_pp_scheduler_enable_group(struct mali_group *group);
95 void mali_pp_scheduler_disable_group(struct mali_group *group);
96
97 /**
98  * @brief Used by the Timeline system to queue a PP job.
99  *
100  * @note @ref mali_scheduler_schedule_from_mask() should be called if this function returns non-zero.
101  *
102  * @param job The PP job that is being activated.
103  *
104  * @return A scheduling bitmask that can be used to decide if scheduling is necessary after this
105  * call.
106  */
107 mali_scheduler_mask mali_pp_scheduler_activate_job(struct mali_pp_job *job);
108
109 /**
110  * @brief Schedule queued jobs on idle cores.
111  */
112 void mali_pp_scheduler_schedule(void);
113
114 int mali_pp_scheduler_set_perf_level(u32 cores, mali_bool override);
115
116 void mali_pp_scheduler_core_scaling_enable(void);
117 void mali_pp_scheduler_core_scaling_disable(void);
118 mali_bool mali_pp_scheduler_core_scaling_is_enabled(void);
119
120 u32 mali_pp_scheduler_get_num_cores_total(void);
121 u32 mali_pp_scheduler_get_num_cores_enabled(void);
122
123 /**
124  * @brief Returns the number of Pixel Processors in the system irrespective of the context
125  *
126  * @return number of physical Pixel Processor cores in the system
127  */
128 u32 mali_pp_scheduler_get_num_cores_total(void);
129
130 #endif /* __MALI_PP_SCHEDULER_H__ */