2 * Copyright (C) 2012 ARM Limited. All rights reserved.
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.
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.
11 #ifndef __MALI_PP_SCHEDULER_H__
12 #define __MALI_PP_SCHEDULER_H__
15 #include "mali_pp_job.h"
16 #include "mali_group.h"
17 #include "linux/mali/mali_utgard.h"
19 /** Initalize the HW independent parts of the PP scheduler
21 _mali_osk_errcode_t mali_pp_scheduler_initialize(void);
22 void mali_pp_scheduler_terminate(void);
24 /** Poplulate the PP scheduler with groups
26 void mali_pp_scheduler_populate(void);
27 void mali_pp_scheduler_depopulate(void);
30 * @brief Handle job completion.
32 * Will attempt to start a new job on the locked group.
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.
37 * Releasing the tracker might activate other jobs, so if appropriate we also schedule them.
39 * @note Group must be locked when entering this function. Will be unlocked before exiting.
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.
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);
49 void mali_pp_scheduler_suspend(void);
50 void mali_pp_scheduler_resume(void);
53 * @brief Abort all running and queued PP jobs from session.
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.
58 * @param session Session that is aborting.
60 void mali_pp_scheduler_abort_session(struct mali_session_data *session);
63 * @brief Reset all groups
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.
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.
72 void mali_pp_scheduler_reset_all_groups(void);
75 * @brief Zap TLB on all groups with \a session active
77 * The scheculer will zap the session on all groups it owns.
79 void mali_pp_scheduler_zap_all_active(struct mali_session_data *session);
82 * @brief Get the virtual PP core
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
88 * @return Pointer to the virtual PP core, NULL if this doesn't exist
90 struct mali_pp_core *mali_pp_scheduler_get_virtual_pp(void);
92 u32 mali_pp_scheduler_dump_state(char *buf, u32 size);
94 void mali_pp_scheduler_enable_group(struct mali_group *group);
95 void mali_pp_scheduler_disable_group(struct mali_group *group);
98 * @brief Used by the Timeline system to queue a PP job.
100 * @note @ref mali_scheduler_schedule_from_mask() should be called if this function returns non-zero.
102 * @param job The PP job that is being activated.
104 * @return A scheduling bitmask that can be used to decide if scheduling is necessary after this
107 mali_scheduler_mask mali_pp_scheduler_activate_job(struct mali_pp_job *job);
110 * @brief Schedule queued jobs on idle cores.
112 void mali_pp_scheduler_schedule(void);
114 int mali_pp_scheduler_set_perf_level(u32 cores, mali_bool override);
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);
120 u32 mali_pp_scheduler_get_num_cores_total(void);
121 u32 mali_pp_scheduler_get_num_cores_enabled(void);
124 * @brief Returns the number of Pixel Processors in the system irrespective of the context
126 * @return number of physical Pixel Processor cores in the system
128 u32 mali_pp_scheduler_get_num_cores_total(void);
130 #endif /* __MALI_PP_SCHEDULER_H__ */