2 * Copyright (C) 2011-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_GP_JOB_H__
12 #define __MALI_GP_JOB_H__
15 #include "mali_osk_list.h"
16 #include "mali_uk_types.h"
17 #include "mali_session.h"
20 * The structure represents a GP job, including all sub-jobs
21 * (This struct unfortunately needs to be public because of how the _mali_osk_list_*
26 _mali_osk_list_t list; /**< Used to link jobs together in the scheduler queue */
27 struct mali_session_data *session; /**< Session which submitted this job */
28 _mali_uk_gp_start_job_s uargs; /**< Arguments from user space */
29 u32 id; /**< identifier for this job in kernel space (sequential numbering) */
30 u32 heap_current_addr; /**< Holds the current HEAP address when the job has completed */
31 u32 perf_counter_value0; /**< Value of performance counter 0 (to be returned to user space) */
32 u32 perf_counter_value1; /**< Value of performance counter 1 (to be returned to user space) */
33 u32 pid; /**< Process ID of submitting process */
34 u32 tid; /**< Thread ID of submitting thread */
35 _mali_osk_notification_t *finished_notification; /**< Notification sent back to userspace on job complete */
36 _mali_osk_notification_t *oom_notification; /**< Notification sent back to userspace on OOM */
39 struct mali_gp_job *mali_gp_job_create(struct mali_session_data *session, _mali_uk_gp_start_job_s *uargs, u32 id);
40 void mali_gp_job_delete(struct mali_gp_job *job);
42 u32 mali_gp_job_get_gp_counter_src0(void);
43 mali_bool mali_gp_job_set_gp_counter_src0(u32 counter);
44 u32 mali_gp_job_get_gp_counter_src1(void);
45 mali_bool mali_gp_job_set_gp_counter_src1(u32 counter);
47 MALI_STATIC_INLINE u32 mali_gp_job_get_id(struct mali_gp_job *job)
49 return (NULL == job) ? 0 : job->id;
52 MALI_STATIC_INLINE u32 mali_gp_job_get_user_id(struct mali_gp_job *job)
54 return job->uargs.user_job_ptr;
57 MALI_STATIC_INLINE u32 mali_gp_job_get_frame_builder_id(struct mali_gp_job *job)
59 return job->uargs.frame_builder_id;
62 MALI_STATIC_INLINE u32 mali_gp_job_get_flush_id(struct mali_gp_job *job)
64 return job->uargs.flush_id;
67 MALI_STATIC_INLINE u32 mali_gp_job_get_pid(struct mali_gp_job *job)
72 MALI_STATIC_INLINE u32 mali_gp_job_get_tid(struct mali_gp_job *job)
77 MALI_STATIC_INLINE u32* mali_gp_job_get_frame_registers(struct mali_gp_job *job)
79 return job->uargs.frame_registers;
82 MALI_STATIC_INLINE struct mali_session_data *mali_gp_job_get_session(struct mali_gp_job *job)
87 MALI_STATIC_INLINE mali_bool mali_gp_job_has_vs_job(struct mali_gp_job *job)
89 return (job->uargs.frame_registers[0] != job->uargs.frame_registers[1]) ? MALI_TRUE : MALI_FALSE;
92 MALI_STATIC_INLINE mali_bool mali_gp_job_has_plbu_job(struct mali_gp_job *job)
94 return (job->uargs.frame_registers[2] != job->uargs.frame_registers[3]) ? MALI_TRUE : MALI_FALSE;
97 MALI_STATIC_INLINE u32 mali_gp_job_get_current_heap_addr(struct mali_gp_job *job)
99 return job->heap_current_addr;
102 MALI_STATIC_INLINE void mali_gp_job_set_current_heap_addr(struct mali_gp_job *job, u32 heap_addr)
104 job->heap_current_addr = heap_addr;
107 MALI_STATIC_INLINE u32 mali_gp_job_get_perf_counter_flag(struct mali_gp_job *job)
109 return job->uargs.perf_counter_flag;
112 MALI_STATIC_INLINE u32 mali_gp_job_get_perf_counter_src0(struct mali_gp_job *job)
114 return job->uargs.perf_counter_src0;
117 MALI_STATIC_INLINE u32 mali_gp_job_get_perf_counter_src1(struct mali_gp_job *job)
119 return job->uargs.perf_counter_src1;
122 MALI_STATIC_INLINE u32 mali_gp_job_get_perf_counter_value0(struct mali_gp_job *job)
124 return job->perf_counter_value0;
127 MALI_STATIC_INLINE u32 mali_gp_job_get_perf_counter_value1(struct mali_gp_job *job)
129 return job->perf_counter_value1;
132 MALI_STATIC_INLINE void mali_gp_job_set_perf_counter_src0(struct mali_gp_job *job, u32 src)
134 job->uargs.perf_counter_src0 = src;
137 MALI_STATIC_INLINE void mali_gp_job_set_perf_counter_src1(struct mali_gp_job *job, u32 src)
139 job->uargs.perf_counter_src1 = src;
142 MALI_STATIC_INLINE void mali_gp_job_set_perf_counter_value0(struct mali_gp_job *job, u32 value)
144 job->perf_counter_value0 = value;
147 MALI_STATIC_INLINE void mali_gp_job_set_perf_counter_value1(struct mali_gp_job *job, u32 value)
149 job->perf_counter_value1 = value;
152 #endif /* __MALI_GP_JOB_H__ */