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.
12 * @file mali_uk_types.h
13 * Defines the types and constants used in the user-kernel interface
16 #ifndef __MALI_UTGARD_UK_TYPES_H__
17 #define __MALI_UTGARD_UK_TYPES_H__
25 * @addtogroup uddapi Unified Device Driver (UDD) APIs
31 * @addtogroup u_k_api UDD User/Kernel Interface (U/K) APIs
36 /** @defgroup _mali_uk_core U/K Core
39 /** Definition of subsystem numbers, to assist in creating a unique identifier
42 * @see _mali_uk_functions */
45 _MALI_UK_CORE_SUBSYSTEM, /**< Core Group of U/K calls */
46 _MALI_UK_MEMORY_SUBSYSTEM, /**< Memory Group of U/K calls */
47 _MALI_UK_PP_SUBSYSTEM, /**< Fragment Processor Group of U/K calls */
48 _MALI_UK_GP_SUBSYSTEM, /**< Vertex Processor Group of U/K calls */
49 _MALI_UK_PROFILING_SUBSYSTEM, /**< Profiling Group of U/K calls */
50 _MALI_UK_PMM_SUBSYSTEM, /**< Power Management Module Group of U/K calls */
51 _MALI_UK_VSYNC_SUBSYSTEM, /**< VSYNC Group of U/K calls */
52 } _mali_uk_subsystem_t;
54 /** Within a function group each function has its unique sequence number
55 * to assist in creating a unique identifier for each U/K call.
57 * An ordered pair of numbers selected from
58 * ( \ref _mali_uk_subsystem_t,\ref _mali_uk_functions) will uniquely identify the
59 * U/K call across all groups of functions, and all functions. */
64 _MALI_UK_OPEN = 0, /**< _mali_ukk_open() */
65 _MALI_UK_CLOSE, /**< _mali_ukk_close() */
66 _MALI_UK_WAIT_FOR_NOTIFICATION, /**< _mali_ukk_wait_for_notification() */
67 _MALI_UK_GET_API_VERSION, /**< _mali_ukk_get_api_version() */
68 _MALI_UK_POST_NOTIFICATION, /**< _mali_ukk_post_notification() */
69 _MALI_UK_GET_USER_SETTING, /**< _mali_ukk_get_user_setting() *//**< [out] */
70 _MALI_UK_GET_USER_SETTINGS, /**< _mali_ukk_get_user_settings() *//**< [out] */
71 _MALI_UK_STREAM_CREATE, /**< _mali_ukk_stream_create() */
72 _MALI_UK_FENCE_VALIDATE, /**< _mali_ukk_fence_validate() */
74 /** Memory functions */
76 _MALI_UK_INIT_MEM = 0, /**< _mali_ukk_init_mem() */
77 _MALI_UK_TERM_MEM, /**< _mali_ukk_term_mem() */
78 _MALI_UK_GET_BIG_BLOCK, /**< _mali_ukk_get_big_block() */
79 _MALI_UK_FREE_BIG_BLOCK, /**< _mali_ukk_free_big_block() */
80 _MALI_UK_MAP_MEM, /**< _mali_ukk_mem_mmap() */
81 _MALI_UK_UNMAP_MEM, /**< _mali_ukk_mem_munmap() */
82 _MALI_UK_QUERY_MMU_PAGE_TABLE_DUMP_SIZE, /**< _mali_ukk_mem_get_mmu_page_table_dump_size() */
83 _MALI_UK_DUMP_MMU_PAGE_TABLE, /**< _mali_ukk_mem_dump_mmu_page_table() */
84 _MALI_UK_ATTACH_DMA_BUF, /**< _mali_ukk_attach_dma_buf() */
85 _MALI_UK_RELEASE_DMA_BUF, /**< _mali_ukk_release_dma_buf() */
86 _MALI_UK_DMA_BUF_GET_SIZE, /**< _mali_ukk_dma_buf_get_size() */
87 _MALI_UK_ATTACH_UMP_MEM, /**< _mali_ukk_attach_ump_mem() */
88 _MALI_UK_RELEASE_UMP_MEM, /**< _mali_ukk_release_ump_mem() */
89 _MALI_UK_MAP_EXT_MEM, /**< _mali_uku_map_external_mem() */
90 _MALI_UK_UNMAP_EXT_MEM, /**< _mali_uku_unmap_external_mem() */
91 _MALI_UK_VA_TO_MALI_PA, /**< _mali_uku_va_to_mali_pa() */
93 /** Common functions for each core */
95 _MALI_UK_START_JOB = 0, /**< Start a Fragment/Vertex Processor Job on a core */
96 _MALI_UK_GET_NUMBER_OF_CORES, /**< Get the number of Fragment/Vertex Processor cores */
97 _MALI_UK_GET_CORE_VERSION, /**< Get the Fragment/Vertex Processor version compatible with all cores */
99 /** Fragment Processor Functions */
101 _MALI_UK_PP_START_JOB = _MALI_UK_START_JOB, /**< _mali_ukk_pp_start_job() */
102 _MALI_UK_GET_PP_NUMBER_OF_CORES = _MALI_UK_GET_NUMBER_OF_CORES, /**< _mali_ukk_get_pp_number_of_cores() */
103 _MALI_UK_GET_PP_CORE_VERSION = _MALI_UK_GET_CORE_VERSION, /**< _mali_ukk_get_pp_core_version() */
104 _MALI_UK_PP_DISABLE_WB, /**< _mali_ukk_pp_job_disable_wb() */
106 /** Vertex Processor Functions */
108 _MALI_UK_GP_START_JOB = _MALI_UK_START_JOB, /**< _mali_ukk_gp_start_job() */
109 _MALI_UK_GET_GP_NUMBER_OF_CORES = _MALI_UK_GET_NUMBER_OF_CORES, /**< _mali_ukk_get_gp_number_of_cores() */
110 _MALI_UK_GET_GP_CORE_VERSION = _MALI_UK_GET_CORE_VERSION, /**< _mali_ukk_get_gp_core_version() */
111 _MALI_UK_GP_SUSPEND_RESPONSE, /**< _mali_ukk_gp_suspend_response() */
113 /** Profiling functions */
115 _MALI_UK_PROFILING_START = 0, /**< __mali_uku_profiling_start() */
116 _MALI_UK_PROFILING_ADD_EVENT, /**< __mali_uku_profiling_add_event() */
117 _MALI_UK_PROFILING_STOP, /**< __mali_uku_profiling_stop() */
118 _MALI_UK_PROFILING_GET_EVENT, /**< __mali_uku_profiling_get_event() */
119 _MALI_UK_PROFILING_CLEAR, /**< __mali_uku_profiling_clear() */
120 _MALI_UK_PROFILING_GET_CONFIG, /**< __mali_uku_profiling_get_config() */
121 _MALI_UK_PROFILING_REPORT_SW_COUNTERS,/**< __mali_uku_profiling_report_sw_counters() */
123 /** VSYNC reporting fuctions */
124 _MALI_UK_VSYNC_EVENT_REPORT = 0, /**< _mali_ukk_vsync_event_report() */
126 } _mali_uk_functions;
128 /** @brief Get the size necessary for system info
130 * @see _mali_ukk_get_system_info_size()
134 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
135 u32 size; /**< [out] size of buffer necessary to hold system information data, in bytes */
136 } _mali_uk_get_system_info_size_s;
139 /** @defgroup _mali_uk_getsysteminfo U/K Get System Info
143 * Type definition for the core version number.
144 * Used when returning the version number read from a core
146 * Its format is that of the 32-bit Version register for a particular core.
147 * Refer to the "Mali200 and MaliGP2 3D Graphics Processor Technical Reference
148 * Manual", ARM DDI 0415C, for more information.
150 typedef u32 _mali_core_version;
153 * Enum values for the different modes the driver can be put in.
154 * Normal is the default mode. The driver then uses a job queue and takes job objects from the clients.
155 * Job completion is reported using the _mali_ukk_wait_for_notification call.
156 * The driver blocks this io command until a job has completed or failed or a timeout occurs.
158 * The 'raw' mode is reserved for future expansion.
160 typedef enum _mali_driver_mode
162 _MALI_DRIVER_MODE_RAW = 1, /**< Reserved for future expansion */
163 _MALI_DRIVER_MODE_NORMAL = 2 /**< Normal mode of operation */
166 /** @brief List of possible cores
168 * add new entries to the end of this enum */
169 typedef enum _mali_core_type
171 _MALI_GP2 = 2, /**< MaliGP2 Programmable Vertex Processor */
172 _MALI_200 = 5, /**< Mali200 Programmable Fragment Processor */
173 _MALI_400_GP = 6, /**< Mali400 Programmable Vertex Processor */
174 _MALI_400_PP = 7, /**< Mali400 Programmable Fragment Processor */
175 /* insert new core here, do NOT alter the existing values */
179 /** @brief Capabilities of Memory Banks
181 * These may be used to restrict memory banks for certain uses. They may be
182 * used when access is not possible (e.g. Bus does not support access to it)
183 * or when access is possible but not desired (e.g. Access is slow).
185 * In the case of 'possible but not desired', there is no way of specifying
186 * the flags as an optimization hint, so that the memory could be used as a
189 * @see _mali_mem_info
191 typedef enum _mali_bus_usage
194 _MALI_PP_READABLE = (1<<0), /** Readable by the Fragment Processor */
195 _MALI_PP_WRITEABLE = (1<<1), /** Writeable by the Fragment Processor */
196 _MALI_GP_READABLE = (1<<2), /** Readable by the Vertex Processor */
197 _MALI_GP_WRITEABLE = (1<<3), /** Writeable by the Vertex Processor */
198 _MALI_CPU_READABLE = (1<<4), /** Readable by the CPU */
199 _MALI_CPU_WRITEABLE = (1<<5), /** Writeable by the CPU */
200 _MALI_GP_L2_ALLOC = (1<<6), /** GP allocate mali L2 cache lines*/
201 _MALI_MMU_READABLE = _MALI_PP_READABLE | _MALI_GP_READABLE, /** Readable by the MMU (including all cores behind it) */
202 _MALI_MMU_WRITEABLE = _MALI_PP_WRITEABLE | _MALI_GP_WRITEABLE, /** Writeable by the MMU (including all cores behind it) */
205 typedef enum mali_memory_cache_settings
207 MALI_CACHE_STANDARD = 0,
208 MALI_CACHE_GP_READ_ALLOCATE = 1,
209 } mali_memory_cache_settings ;
212 /** @brief Information about the Mali Memory system
214 * Information is stored in a linked list, which is stored entirely in the
215 * buffer pointed to by the system_info member of the
216 * _mali_uk_get_system_info_s arguments provided to _mali_ukk_get_system_info()
218 * Each element of the linked list describes a single Mali Memory bank.
219 * Each allocation can only come from one bank, and will not cross multiple
222 * On Mali-MMU systems, there is only one bank, which describes the maximum
223 * possible address range that could be allocated (which may be much less than
224 * the available physical memory)
226 * The flags member describes the capabilities of the memory. It is an error
227 * to attempt to build a job for a particular core (PP or GP) when the memory
228 * regions used do not have the capabilities for supporting that core. This
229 * would result in a job abort from the Device Driver.
231 * For example, it is correct to build a PP job where read-only data structures
232 * are taken from a memory with _MALI_PP_READABLE set and
233 * _MALI_PP_WRITEABLE clear, and a framebuffer with _MALI_PP_WRITEABLE set and
234 * _MALI_PP_READABLE clear. However, it would be incorrect to use a framebuffer
235 * where _MALI_PP_WRITEABLE is clear.
237 typedef struct _mali_mem_info
239 u32 size; /**< Size of the memory bank in bytes */
240 _mali_bus_usage flags; /**< Capabilitiy flags of the memory */
241 u32 maximum_order_supported; /**< log2 supported size */
242 u32 identifier; /* mali_memory_cache_settings cache_settings; */
243 struct _mali_mem_info * next; /**< Next List Link */
248 /** @} */ /* end group _mali_uk_core */
251 /** @defgroup _mali_uk_gp U/K Vertex Processor
254 /** @defgroup _mali_uk_gp_suspend_response_s Vertex Processor Suspend Response
257 /** @brief Arguments for _mali_ukk_gp_suspend_response()
259 * When _mali_wait_for_notification() receives notification that a
260 * Vertex Processor job was suspended, you need to send a response to indicate
261 * what needs to happen with this job. You can either abort or resume the job.
263 * - set @c code to indicate response code. This is either @c _MALIGP_JOB_ABORT or
264 * @c _MALIGP_JOB_RESUME_WITH_NEW_HEAP to indicate you will provide a new heap
265 * for the job that will resolve the out of memory condition for the job.
266 * - copy the @c cookie value from the @c _mali_uk_gp_job_suspended_s notification;
267 * this is an identifier for the suspended job
268 * - set @c arguments[0] and @c arguments[1] to zero if you abort the job. If
269 * you resume it, @c argument[0] should specify the Mali start address for the new
270 * heap and @c argument[1] the Mali end address of the heap.
271 * - pass in the user-kernel context @c ctx that was returned from _mali_ukk_open()
274 typedef enum _maligp_job_suspended_response_code
276 _MALIGP_JOB_ABORT, /**< Abort the Vertex Processor job */
277 _MALIGP_JOB_RESUME_WITH_NEW_HEAP /**< Resume the Vertex Processor job with a new heap */
278 } _maligp_job_suspended_response_code;
282 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
283 u32 cookie; /**< [in] cookie from the _mali_uk_gp_job_suspended_s notification */
284 _maligp_job_suspended_response_code code; /**< [in] abort or resume response code, see \ref _maligp_job_suspended_response_code */
285 u32 arguments[2]; /**< [in] 0 when aborting a job. When resuming a job, the Mali start and end address for a new heap to resume the job with */
286 } _mali_uk_gp_suspend_response_s;
288 /** @} */ /* end group _mali_uk_gp_suspend_response_s */
290 /** @defgroup _mali_uk_gpstartjob_s Vertex Processor Start Job
293 /** @brief Status indicating the result of starting a Vertex or Fragment processor job */
296 _MALI_UK_START_JOB_STARTED, /**< Job started */
297 _MALI_UK_START_JOB_NOT_STARTED_DO_REQUEUE /**< Job could not be started at this time. Try starting the job again */
298 } _mali_uk_start_job_status;
300 /** @brief Status indicating the result of the execution of a Vertex or Fragment processor job */
304 _MALI_UK_JOB_STATUS_END_SUCCESS = 1<<(16+0),
305 _MALI_UK_JOB_STATUS_END_OOM = 1<<(16+1),
306 _MALI_UK_JOB_STATUS_END_ABORT = 1<<(16+2),
307 _MALI_UK_JOB_STATUS_END_TIMEOUT_SW = 1<<(16+3),
308 _MALI_UK_JOB_STATUS_END_HANG = 1<<(16+4),
309 _MALI_UK_JOB_STATUS_END_SEG_FAULT = 1<<(16+5),
310 _MALI_UK_JOB_STATUS_END_ILLEGAL_JOB = 1<<(16+6),
311 _MALI_UK_JOB_STATUS_END_UNKNOWN_ERR = 1<<(16+7),
312 _MALI_UK_JOB_STATUS_END_SHUTDOWN = 1<<(16+8),
313 _MALI_UK_JOB_STATUS_END_SYSTEM_UNUSABLE = 1<<(16+9)
314 } _mali_uk_job_status;
316 #define MALIGP2_NUM_REGS_FRAME (6)
318 /** @brief Arguments for _mali_ukk_gp_start_job()
320 * To start a Vertex Processor job
321 * - associate the request with a reference to a @c mali_gp_job_info by setting
322 * user_job_ptr to the address of the @c mali_gp_job_info of the job.
323 * - set @c priority to the priority of the @c mali_gp_job_info
324 * - specify a timeout for the job by setting @c watchdog_msecs to the number of
325 * milliseconds the job is allowed to run. Specifying a value of 0 selects the
326 * default timeout in use by the device driver.
327 * - copy the frame registers from the @c mali_gp_job_info into @c frame_registers.
328 * - set the @c perf_counter_flag, @c perf_counter_src0 and @c perf_counter_src1 to zero
329 * for a non-instrumented build. For an instrumented build you can use up
330 * to two performance counters. Set the corresponding bit in @c perf_counter_flag
331 * to enable them. @c perf_counter_src0 and @c perf_counter_src1 specify
332 * the source of what needs to get counted (e.g. number of vertex loader
333 * cache hits). For source id values, see ARM DDI0415A, Table 3-60.
334 * - pass in the user-kernel context @c ctx that was returned from _mali_ukk_open()
336 * When @c _mali_ukk_gp_start_job() returns @c _MALI_OSK_ERR_OK, status contains the
337 * result of the request (see \ref _mali_uk_start_job_status). If the job could
338 * not get started (@c _MALI_UK_START_JOB_NOT_STARTED_DO_REQUEUE) it should be
341 * After the job has started, @c _mali_wait_for_notification() will be notified
342 * that the job finished or got suspended. It may get suspended due to
343 * resource shortage. If it finished (see _mali_ukk_wait_for_notification())
344 * the notification will contain a @c _mali_uk_gp_job_finished_s result. If
345 * it got suspended the notification will contain a @c _mali_uk_gp_job_suspended_s
348 * The @c _mali_uk_gp_job_finished_s contains the job status (see \ref _mali_uk_job_status),
349 * the number of milliseconds the job took to render, and values of core registers
350 * when the job finished (irq status, performance counters, renderer list
351 * address). A job has finished succesfully when its status is
352 * @c _MALI_UK_JOB_STATUS_FINISHED. If the hardware detected a timeout while rendering
353 * the job, or software detected the job is taking more than watchdog_msecs to
354 * complete, the status will indicate @c _MALI_UK_JOB_STATUS_HANG.
355 * If the hardware detected a bus error while accessing memory associated with the
356 * job, status will indicate @c _MALI_UK_JOB_STATUS_SEG_FAULT.
357 * status will indicate @c _MALI_UK_JOB_STATUS_NOT_STARTED if the driver had to
358 * stop the job but the job didn't start on the hardware yet, e.g. when the
361 * In case the job got suspended, @c _mali_uk_gp_job_suspended_s contains
362 * the @c user_job_ptr identifier used to start the job with, the @c reason
363 * why the job stalled (see \ref _maligp_job_suspended_reason) and a @c cookie
364 * to identify the core on which the job stalled. This @c cookie will be needed
365 * when responding to this nofication by means of _mali_ukk_gp_suspend_response().
366 * (see _mali_ukk_gp_suspend_response()). The response is either to abort or
367 * resume the job. If the job got suspended due to an out of memory condition
368 * you may be able to resolve this by providing more memory and resuming the job.
373 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
374 u32 user_job_ptr; /**< [in] identifier for the job in user space, a @c mali_gp_job_info* */
375 u32 priority; /**< [in] job priority. A lower number means higher priority */
376 u32 frame_registers[MALIGP2_NUM_REGS_FRAME]; /**< [in] core specific registers associated with this job */
377 u32 perf_counter_flag; /**< [in] bitmask indicating which performance counters to enable, see \ref _MALI_PERFORMANCE_COUNTER_FLAG_SRC0_ENABLE and related macro definitions */
378 u32 perf_counter_src0; /**< [in] source id for performance counter 0 (see ARM DDI0415A, Table 3-60) */
379 u32 perf_counter_src1; /**< [in] source id for performance counter 1 (see ARM DDI0415A, Table 3-60) */
380 u32 frame_builder_id; /**< [in] id of the originating frame builder */
381 u32 flush_id; /**< [in] flush id within the originating frame builder */
382 } _mali_uk_gp_start_job_s;
384 #define _MALI_PERFORMANCE_COUNTER_FLAG_SRC0_ENABLE (1<<0) /**< Enable performance counter SRC0 for a job */
385 #define _MALI_PERFORMANCE_COUNTER_FLAG_SRC1_ENABLE (1<<1) /**< Enable performance counter SRC1 for a job */
387 /** @} */ /* end group _mali_uk_gpstartjob_s */
391 u32 user_job_ptr; /**< [out] identifier for the job in user space */
392 _mali_uk_job_status status; /**< [out] status of finished job */
393 u32 heap_current_addr; /**< [out] value of the GP PLB PL heap start address register */
394 u32 perf_counter0; /**< [out] value of perfomance counter 0 (see ARM DDI0415A) */
395 u32 perf_counter1; /**< [out] value of perfomance counter 1 (see ARM DDI0415A) */
396 } _mali_uk_gp_job_finished_s;
398 typedef enum _maligp_job_suspended_reason
400 _MALIGP_JOB_SUSPENDED_OUT_OF_MEMORY /**< Polygon list builder unit (PLBU) has run out of memory */
401 } _maligp_job_suspended_reason;
405 u32 user_job_ptr; /**< [out] identifier for the job in user space */
406 _maligp_job_suspended_reason reason; /**< [out] reason why the job stalled */
407 u32 cookie; /**< [out] identifier for the core in kernel space on which the job stalled */
408 } _mali_uk_gp_job_suspended_s;
410 /** @} */ /* end group _mali_uk_gp */
413 /** @defgroup _mali_uk_pp U/K Fragment Processor
416 #define _MALI_PP_MAX_SUB_JOBS 8
418 #define _MALI_PP_MAX_FRAME_REGISTERS ((0x058/4)+1)
420 #define _MALI_PP_MAX_WB_REGISTERS ((0x02C/4)+1)
422 #define _MALI_DLBU_MAX_REGISTERS 4
424 /** Flag for _mali_uk_pp_start_job_s */
425 #define _MALI_PP_JOB_FLAG_NO_NOTIFICATION (1<<0)
426 #define _MALI_PP_JOB_FLAG_BARRIER (1<<1)
427 #define _MALI_PP_JOB_FLAG_FENCE (1<<2)
429 /** @defgroup _mali_uk_ppstartjob_s Fragment Processor Start Job
432 /** @brief Arguments for _mali_ukk_pp_start_job()
434 * To start a Fragment Processor job
435 * - associate the request with a reference to a mali_pp_job by setting
436 * @c user_job_ptr to the address of the @c mali_pp_job of the job.
437 * - set @c priority to the priority of the mali_pp_job
438 * - specify a timeout for the job by setting @c watchdog_msecs to the number of
439 * milliseconds the job is allowed to run. Specifying a value of 0 selects the
440 * default timeout in use by the device driver.
441 * - copy the frame registers from the @c mali_pp_job into @c frame_registers.
442 * For MALI200 you also need to copy the write back 0,1 and 2 registers.
443 * - set the @c perf_counter_flag, @c perf_counter_src0 and @c perf_counter_src1 to zero
444 * for a non-instrumented build. For an instrumented build you can use up
445 * to two performance counters. Set the corresponding bit in @c perf_counter_flag
446 * to enable them. @c perf_counter_src0 and @c perf_counter_src1 specify
447 * the source of what needs to get counted (e.g. number of vertex loader
448 * cache hits). For source id values, see ARM DDI0415A, Table 3-60.
449 * - pass in the user-kernel context in @c ctx that was returned from _mali_ukk_open()
451 * When _mali_ukk_pp_start_job() returns @c _MALI_OSK_ERR_OK, @c status contains the
452 * result of the request (see \ref _mali_uk_start_job_status). If the job could
453 * not get started (@c _MALI_UK_START_JOB_NOT_STARTED_DO_REQUEUE) it should be
456 * After the job has started, _mali_wait_for_notification() will be notified
457 * when the job finished. The notification will contain a
458 * @c _mali_uk_pp_job_finished_s result. It contains the @c user_job_ptr
459 * identifier used to start the job with, the job @c status (see \ref _mali_uk_job_status),
460 * the number of milliseconds the job took to render, and values of core registers
461 * when the job finished (irq status, performance counters, renderer list
462 * address). A job has finished succesfully when its status is
463 * @c _MALI_UK_JOB_STATUS_FINISHED. If the hardware detected a timeout while rendering
464 * the job, or software detected the job is taking more than @c watchdog_msecs to
465 * complete, the status will indicate @c _MALI_UK_JOB_STATUS_HANG.
466 * If the hardware detected a bus error while accessing memory associated with the
467 * job, status will indicate @c _MALI_UK_JOB_STATUS_SEG_FAULT.
468 * status will indicate @c _MALI_UK_JOB_STATUS_NOT_STARTED if the driver had to
469 * stop the job but the job didn't start on the hardware yet, e.g. when the
475 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
476 u32 user_job_ptr; /**< [in] identifier for the job in user space */
477 u32 priority; /**< [in] job priority. A lower number means higher priority */
478 u32 frame_registers[_MALI_PP_MAX_FRAME_REGISTERS]; /**< [in] core specific registers associated with first sub job, see ARM DDI0415A */
479 u32 frame_registers_addr_frame[_MALI_PP_MAX_SUB_JOBS - 1]; /**< [in] ADDR_FRAME registers for sub job 1-7 */
480 u32 frame_registers_addr_stack[_MALI_PP_MAX_SUB_JOBS - 1]; /**< [in] ADDR_STACK registers for sub job 1-7 */
481 u32 wb0_registers[_MALI_PP_MAX_WB_REGISTERS];
482 u32 wb1_registers[_MALI_PP_MAX_WB_REGISTERS];
483 u32 wb2_registers[_MALI_PP_MAX_WB_REGISTERS];
484 u32 dlbu_registers[_MALI_DLBU_MAX_REGISTERS]; /**< [in] Dynamic load balancing unit registers */
485 u32 num_cores; /**< [in] Number of cores to set up (valid range: 1-4) */
486 u32 perf_counter_flag; /**< [in] bitmask indicating which performance counters to enable, see \ref _MALI_PERFORMANCE_COUNTER_FLAG_SRC0_ENABLE and related macro definitions */
487 u32 perf_counter_src0; /**< [in] source id for performance counter 0 (see ARM DDI0415A, Table 3-60) */
488 u32 perf_counter_src1; /**< [in] source id for performance counter 1 (see ARM DDI0415A, Table 3-60) */
489 u32 frame_builder_id; /**< [in] id of the originating frame builder */
490 u32 flush_id; /**< [in] flush id within the originating frame builder */
491 u32 flags; /**< [in] See _MALI_PP_JOB_FLAG_* for a list of avaiable flags */
492 s32 fence; /**< [in,out] Fence to wait on / fence that will be signalled on job completion, if _MALI_PP_JOB_FLAG_FENCE is set */
493 s32 stream; /**< [in] Steam identifier */
494 } _mali_uk_pp_start_job_s;
495 /** @} */ /* end group _mali_uk_ppstartjob_s */
499 u32 user_job_ptr; /**< [out] identifier for the job in user space */
500 _mali_uk_job_status status; /**< [out] status of finished job */
501 u32 perf_counter0[_MALI_PP_MAX_SUB_JOBS]; /**< [out] value of perfomance counter 0 (see ARM DDI0415A), one for each sub job */
502 u32 perf_counter1[_MALI_PP_MAX_SUB_JOBS]; /**< [out] value of perfomance counter 1 (see ARM DDI0415A), one for each sub job */
503 } _mali_uk_pp_job_finished_s;
506 * Flags to indicate write-back units
510 _MALI_UK_PP_JOB_WB0 = 1,
511 _MALI_UK_PP_JOB_WB1 = 2,
512 _MALI_UK_PP_JOB_WB2 = 4,
513 } _mali_uk_pp_job_wbx_flag;
517 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
518 u32 fb_id; /**< [in] Frame builder ID of job to disable WB units for */
519 u32 flush_id; /**< [in] Flush ID of job to disable WB units for */
520 _mali_uk_pp_job_wbx_flag wbx; /**< [in] write-back units to disable */
521 } _mali_uk_pp_disable_wb_s;
524 /** @} */ /* end group _mali_uk_pp */
527 /** @addtogroup _mali_uk_core U/K Core
530 /** @defgroup _mali_uk_waitfornotification_s Wait For Notification
533 /** @brief Notification type encodings
535 * Each Notification type is an ordered pair of (subsystem,id), and is unique.
537 * The encoding of subsystem,id into a 32-bit word is:
538 * encoding = (( subsystem << _MALI_NOTIFICATION_SUBSYSTEM_SHIFT ) & _MALI_NOTIFICATION_SUBSYSTEM_MASK)
539 * | (( id << _MALI_NOTIFICATION_ID_SHIFT ) & _MALI_NOTIFICATION_ID_MASK)
541 * @see _mali_uk_wait_for_notification_s
545 /** core notifications */
547 _MALI_NOTIFICATION_CORE_SHUTDOWN_IN_PROGRESS = (_MALI_UK_CORE_SUBSYSTEM << 16) | 0x20,
548 _MALI_NOTIFICATION_APPLICATION_QUIT = (_MALI_UK_CORE_SUBSYSTEM << 16) | 0x40,
549 _MALI_NOTIFICATION_SETTINGS_CHANGED = (_MALI_UK_CORE_SUBSYSTEM << 16) | 0x80,
551 /** Fragment Processor notifications */
553 _MALI_NOTIFICATION_PP_FINISHED = (_MALI_UK_PP_SUBSYSTEM << 16) | 0x10,
555 /** Vertex Processor notifications */
557 _MALI_NOTIFICATION_GP_FINISHED = (_MALI_UK_GP_SUBSYSTEM << 16) | 0x10,
558 _MALI_NOTIFICATION_GP_STALLED = (_MALI_UK_GP_SUBSYSTEM << 16) | 0x20,
560 } _mali_uk_notification_type;
562 /** to assist in splitting up 32-bit notification value in subsystem and id value */
563 #define _MALI_NOTIFICATION_SUBSYSTEM_MASK 0xFFFF0000
564 #define _MALI_NOTIFICATION_SUBSYSTEM_SHIFT 16
565 #define _MALI_NOTIFICATION_ID_MASK 0x0000FFFF
566 #define _MALI_NOTIFICATION_ID_SHIFT 0
569 /** @brief Enumeration of possible settings which match mali_setting_t in user space
575 _MALI_UK_USER_SETTING_SW_EVENTS_ENABLE = 0,
576 _MALI_UK_USER_SETTING_COLORBUFFER_CAPTURE_ENABLED,
577 _MALI_UK_USER_SETTING_DEPTHBUFFER_CAPTURE_ENABLED,
578 _MALI_UK_USER_SETTING_STENCILBUFFER_CAPTURE_ENABLED,
579 _MALI_UK_USER_SETTING_PER_TILE_COUNTERS_CAPTURE_ENABLED,
580 _MALI_UK_USER_SETTING_BUFFER_CAPTURE_COMPOSITOR,
581 _MALI_UK_USER_SETTING_BUFFER_CAPTURE_WINDOW,
582 _MALI_UK_USER_SETTING_BUFFER_CAPTURE_OTHER,
583 _MALI_UK_USER_SETTING_BUFFER_CAPTURE_N_FRAMES,
584 _MALI_UK_USER_SETTING_BUFFER_CAPTURE_RESIZE_FACTOR,
585 _MALI_UK_USER_SETTING_SW_COUNTER_ENABLED,
586 _MALI_UK_USER_SETTING_MAX,
587 } _mali_uk_user_setting_t;
589 /* See mali_user_settings_db.c */
590 extern const char *_mali_uk_user_setting_descriptions[];
591 #define _MALI_UK_USER_SETTING_DESCRIPTIONS \
593 "sw_events_enable", \
594 "colorbuffer_capture_enable", \
595 "depthbuffer_capture_enable", \
596 "stencilbuffer_capture_enable", \
597 "per_tile_counters_enable", \
598 "buffer_capture_compositor", \
599 "buffer_capture_window", \
600 "buffer_capture_other", \
601 "buffer_capture_n_frames", \
602 "buffer_capture_resize_factor", \
603 "sw_counters_enable", \
606 /** @brief struct to hold the value to a particular setting as seen in the kernel space
610 _mali_uk_user_setting_t setting;
612 } _mali_uk_settings_changed_s;
614 /** @brief Arguments for _mali_ukk_wait_for_notification()
616 * On successful return from _mali_ukk_wait_for_notification(), the members of
617 * this structure will indicate the reason for notification.
619 * Specifically, the source of the notification can be identified by the
620 * subsystem and id fields of the mali_uk_notification_type in the code.type
621 * member. The type member is encoded in a way to divide up the types into a
622 * subsystem field, and a per-subsystem ID field. See
623 * _mali_uk_notification_type for more information.
625 * Interpreting the data union member depends on the notification type:
627 * - type == _MALI_NOTIFICATION_CORE_SHUTDOWN_IN_PROGRESS
628 * - The kernel side is shutting down. No further
629 * _mali_uk_wait_for_notification() calls should be made.
630 * - In this case, the value of the data union member is undefined.
631 * - This is used to indicate to the user space client that it should close
632 * the connection to the Mali Device Driver.
633 * - type == _MALI_NOTIFICATION_PP_FINISHED
634 * - The notification data is of type _mali_uk_pp_job_finished_s. It contains the user_job_ptr
635 * identifier used to start the job with, the job status, the number of milliseconds the job took to render,
636 * and values of core registers when the job finished (irq status, performance counters, renderer list
638 * - A job has finished succesfully when its status member is _MALI_UK_JOB_STATUS_FINISHED.
639 * - If the hardware detected a timeout while rendering the job, or software detected the job is
640 * taking more than watchdog_msecs (see _mali_ukk_pp_start_job()) to complete, the status member will
641 * indicate _MALI_UK_JOB_STATUS_HANG.
642 * - If the hardware detected a bus error while accessing memory associated with the job, status will
643 * indicate _MALI_UK_JOB_STATUS_SEG_FAULT.
644 * - Status will indicate MALI_UK_JOB_STATUS_NOT_STARTED if the driver had to stop the job but the job
645 * didn't start the hardware yet, e.g. when the driver closes.
646 * - type == _MALI_NOTIFICATION_GP_FINISHED
647 * - The notification data is of type _mali_uk_gp_job_finished_s. The notification is similar to that of
648 * type == _MALI_NOTIFICATION_PP_FINISHED, except that several other GP core register values are returned.
649 * The status values have the same meaning for type == _MALI_NOTIFICATION_PP_FINISHED.
650 * - type == _MALI_NOTIFICATION_GP_STALLED
651 * - The nofication data is of type _mali_uk_gp_job_suspended_s. It contains the user_job_ptr
652 * identifier used to start the job with, the reason why the job stalled and a cookie to identify the core on
653 * which the job stalled.
654 * - The reason member of gp_job_suspended is set to _MALIGP_JOB_SUSPENDED_OUT_OF_MEMORY
655 * when the polygon list builder unit has run out of memory.
659 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
660 _mali_uk_notification_type type; /**< [out] Type of notification available */
663 _mali_uk_gp_job_suspended_s gp_job_suspended;/**< [out] Notification data for _MALI_NOTIFICATION_GP_STALLED notification type */
664 _mali_uk_gp_job_finished_s gp_job_finished; /**< [out] Notification data for _MALI_NOTIFICATION_GP_FINISHED notification type */
665 _mali_uk_pp_job_finished_s pp_job_finished; /**< [out] Notification data for _MALI_NOTIFICATION_PP_FINISHED notification type */
666 _mali_uk_settings_changed_s setting_changed;/**< [out] Notification data for _MALI_NOTIFICAATION_SETTINGS_CHANGED notification type */
668 } _mali_uk_wait_for_notification_s;
670 /** @brief Arguments for _mali_ukk_post_notification()
672 * Posts the specified notification to the notification queue for this application.
673 * This is used to send a quit message to the callback thread.
677 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
678 _mali_uk_notification_type type; /**< [in] Type of notification to post */
679 } _mali_uk_post_notification_s;
681 /** @} */ /* end group _mali_uk_waitfornotification_s */
683 /** @defgroup _mali_uk_getapiversion_s Get API Version
686 /** helpers for Device Driver API version handling */
688 /** @brief Encode a version ID from a 16-bit input
690 * @note the input is assumed to be 16 bits. It must not exceed 16 bits. */
691 #define _MAKE_VERSION_ID(x) (((x) << 16UL) | (x))
693 /** @brief Check whether a 32-bit value is likely to be Device Driver API
695 #define _IS_VERSION_ID(x) (((x) & 0xFFFF) == (((x) >> 16UL) & 0xFFFF))
697 /** @brief Decode a 16-bit version number from a 32-bit Device Driver API version
699 #define _GET_VERSION(x) (((x) >> 16UL) & 0xFFFF)
701 /** @brief Determine whether two 32-bit encoded version IDs match */
702 #define _IS_API_MATCH(x, y) (IS_VERSION_ID((x)) && IS_VERSION_ID((y)) && (GET_VERSION((x)) == GET_VERSION((y))))
705 * API version define.
706 * Indicates the version of the kernel API
707 * The version is a 16bit integer incremented on each API change.
708 * The 16bit integer is stored twice in a 32bit integer
709 * For example, for version 1 the value would be 0x00010001
711 #define _MALI_API_VERSION 19
712 #define _MALI_UK_API_VERSION _MAKE_VERSION_ID(_MALI_API_VERSION)
715 * The API version is a 16-bit integer stored in both the lower and upper 16-bits
716 * of a 32-bit value. The 16-bit API version value is incremented on each API
717 * change. Version 1 would be 0x00010001. Used in _mali_uk_get_api_version_s.
719 typedef u32 _mali_uk_api_version;
721 /** @brief Arguments for _mali_uk_get_api_version()
723 * The user-side interface version must be written into the version member,
724 * encoded using _MAKE_VERSION_ID(). It will be compared to the API version of
725 * the kernel-side interface.
727 * On successful return, the version member will be the API version of the
728 * kernel-side interface. _MALI_UK_API_VERSION macro defines the current version
731 * The compatible member must be checked to see if the version of the user-side
732 * interface is compatible with the kernel-side interface, since future versions
733 * of the interface may be backwards compatible.
737 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
738 _mali_uk_api_version version; /**< [in,out] API version of user-side interface. */
739 int compatible; /**< [out] @c 1 when @version is compatible, @c 0 otherwise */
740 } _mali_uk_get_api_version_s;
741 /** @} */ /* end group _mali_uk_getapiversion_s */
743 /** @defgroup _mali_uk_get_user_settings_s Get user space settings */
745 /** @brief struct to keep the matching values of the user space settings within certain context
747 * Each member of the settings array corresponds to a matching setting in the user space and its value is the value
748 * of that particular setting.
750 * All settings are given reference to the context pointed to by the ctx pointer.
755 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
756 u32 settings[_MALI_UK_USER_SETTING_MAX]; /**< [out] The values for all settings */
757 } _mali_uk_get_user_settings_s;
759 /** @brief struct to hold the value of a particular setting from the user space within a given context
763 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
764 _mali_uk_user_setting_t setting; /**< [in] setting to get */
765 u32 value; /**< [out] value of setting */
766 } _mali_uk_get_user_setting_s;
768 /** @} */ /* end group _mali_uk_core */
771 /** @defgroup _mali_uk_memory U/K Memory
774 /** @brief Arguments for _mali_ukk_init_mem(). */
777 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
778 u32 mali_address_base; /**< [out] start of MALI address space */
779 u32 memory_size; /**< [out] total MALI address space available */
780 } _mali_uk_init_mem_s;
782 /** @brief Arguments for _mali_ukk_term_mem(). */
785 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
786 } _mali_uk_term_mem_s;
788 /** Flag for _mali_uk_map_external_mem_s, _mali_uk_attach_ump_mem_s and _mali_uk_attach_dma_buf_s */
789 #define _MALI_MAP_EXTERNAL_MAP_GUARD_PAGE (1<<0)
793 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
794 u32 phys_addr; /**< [in] physical address */
795 u32 size; /**< [in] size */
796 u32 mali_address; /**< [in] mali address to map the physical memory to */
797 u32 rights; /**< [in] rights necessary for accessing memory */
798 u32 flags; /**< [in] flags, see \ref _MALI_MAP_EXTERNAL_MAP_GUARD_PAGE */
799 u32 cookie; /**< [out] identifier for mapped memory object in kernel space */
800 } _mali_uk_map_external_mem_s;
804 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
805 u32 cookie; /**< [out] identifier for mapped memory object in kernel space */
806 } _mali_uk_unmap_external_mem_s;
808 /** @note This is identical to _mali_uk_map_external_mem_s above, however phys_addr is replaced by memory descriptor */
811 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
812 u32 mem_fd; /**< [in] Memory descriptor */
813 u32 size; /**< [in] size */
814 u32 mali_address; /**< [in] mali address to map the physical memory to */
815 u32 rights; /**< [in] rights necessary for accessing memory */
816 u32 flags; /**< [in] flags, see \ref _MALI_MAP_EXTERNAL_MAP_GUARD_PAGE */
817 u32 cookie; /**< [out] identifier for mapped memory object in kernel space */
818 } _mali_uk_attach_dma_buf_s;
822 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
823 u32 mem_fd; /**< [in] Memory descriptor */
824 u32 size; /**< [out] size */
825 } _mali_uk_dma_buf_get_size_s;
829 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
830 u32 cookie; /**< [in] identifier for mapped memory object in kernel space */
831 } _mali_uk_release_dma_buf_s;
833 /** @note This is identical to _mali_uk_map_external_mem_s above, however phys_addr is replaced by secure_id */
836 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
837 u32 secure_id; /**< [in] secure id */
838 u32 size; /**< [in] size */
839 u32 mali_address; /**< [in] mali address to map the physical memory to */
840 u32 rights; /**< [in] rights necessary for accessing memory */
841 u32 flags; /**< [in] flags, see \ref _MALI_MAP_EXTERNAL_MAP_GUARD_PAGE */
842 u32 cookie; /**< [out] identifier for mapped memory object in kernel space */
843 } _mali_uk_attach_ump_mem_s;
847 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
848 u32 cookie; /**< [in] identifier for mapped memory object in kernel space */
849 } _mali_uk_release_ump_mem_s;
851 /** @brief Arguments for _mali_ukk_va_to_mali_pa()
853 * if size is zero or not a multiple of the system's page size, it will be
854 * rounded up to the next multiple of the page size. This will occur before
855 * any other use of the size parameter.
857 * if va is not PAGE_SIZE aligned, it will be rounded down to the next page
860 * The range (va) to ((u32)va)+(size-1) inclusive will be checked for physical
863 * The implementor will check that the entire physical range is allowed to be mapped
866 * Failure will occur if either of the above are not satisfied.
868 * Otherwise, the physical base address of the range is returned through pa,
869 * va is updated to be page aligned, and size is updated to be a non-zero
870 * multiple of the system's pagesize.
874 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
875 void *va; /**< [in,out] Virtual address of the start of the range */
876 u32 pa; /**< [out] Physical base address of the range */
877 u32 size; /**< [in,out] Size of the range, in bytes. */
878 } _mali_uk_va_to_mali_pa_s;
883 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
884 u32 size; /**< [out] size of MMU page table information (registers + page tables) */
885 } _mali_uk_query_mmu_page_table_dump_size_s;
889 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
890 u32 size; /**< [in] size of buffer to receive mmu page table information */
891 void *buffer; /**< [in,out] buffer to receive mmu page table information */
892 u32 register_writes_size; /**< [out] size of MMU register dump */
893 u32 *register_writes; /**< [out] pointer within buffer where MMU register dump is stored */
894 u32 page_table_dump_size; /**< [out] size of MMU page table dump */
895 u32 *page_table_dump; /**< [out] pointer within buffer where MMU page table dump is stored */
896 } _mali_uk_dump_mmu_page_table_s;
898 /** @} */ /* end group _mali_uk_memory */
901 /** @addtogroup _mali_uk_pp U/K Fragment Processor
904 /** @brief Arguments for _mali_ukk_get_pp_number_of_cores()
906 * - pass in the user-kernel context @c ctx that was returned from _mali_ukk_open()
907 * - Upon successful return from _mali_ukk_get_pp_number_of_cores(), @c number_of_cores
908 * will contain the number of Fragment Processor cores in the system.
912 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
913 u32 number_of_cores; /**< [out] number of Fragment Processor cores in the system */
914 } _mali_uk_get_pp_number_of_cores_s;
916 /** @brief Arguments for _mali_ukk_get_pp_core_version()
918 * - pass in the user-kernel context @c ctx that was returned from _mali_ukk_open()
919 * - Upon successful return from _mali_ukk_get_pp_core_version(), @c version contains
920 * the version that all Fragment Processor cores are compatible with.
924 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
925 _mali_core_version version; /**< [out] version returned from core, see \ref _mali_core_version */
926 } _mali_uk_get_pp_core_version_s;
928 /** @} */ /* end group _mali_uk_pp */
931 /** @addtogroup _mali_uk_gp U/K Vertex Processor
934 /** @brief Arguments for _mali_ukk_get_gp_number_of_cores()
936 * - pass in the user-kernel context @c ctx that was returned from _mali_ukk_open()
937 * - Upon successful return from _mali_ukk_get_gp_number_of_cores(), @c number_of_cores
938 * will contain the number of Vertex Processor cores in the system.
942 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
943 u32 number_of_cores; /**< [out] number of Vertex Processor cores in the system */
944 } _mali_uk_get_gp_number_of_cores_s;
946 /** @brief Arguments for _mali_ukk_get_gp_core_version()
948 * - pass in the user-kernel context @c ctx that was returned from _mali_ukk_open()
949 * - Upon successful return from _mali_ukk_get_gp_core_version(), @c version contains
950 * the version that all Vertex Processor cores are compatible with.
954 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
955 _mali_core_version version; /**< [out] version returned from core, see \ref _mali_core_version */
956 } _mali_uk_get_gp_core_version_s;
960 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
961 u32 limit; /**< [in,out] The desired limit for number of events to record on input, actual limit on output */
962 } _mali_uk_profiling_start_s;
966 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
967 u32 event_id; /**< [in] event id to register (see enum mali_profiling_events for values) */
968 u32 data[5]; /**< [in] event specific data */
969 } _mali_uk_profiling_add_event_s;
973 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
974 u32 count; /**< [out] The number of events sampled */
975 } _mali_uk_profiling_stop_s;
979 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
980 u32 index; /**< [in] which index to get (starting at zero) */
981 u64 timestamp; /**< [out] timestamp of event */
982 u32 event_id; /**< [out] event id of event (see enum mali_profiling_events for values) */
983 u32 data[5]; /**< [out] event specific data */
984 } _mali_uk_profiling_get_event_s;
988 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
989 } _mali_uk_profiling_clear_s;
991 /** @} */ /* end group _mali_uk_gp */
994 /** @addtogroup _mali_uk_memory U/K Memory
997 /** @brief Arguments to _mali_ukk_mem_mmap()
999 * Use of the phys_addr member depends on whether the driver is compiled for
1000 * Mali-MMU or nonMMU:
1001 * - in the nonMMU case, this is the physical address of the memory as seen by
1002 * the CPU (which may be a constant offset from that used by Mali)
1003 * - in the MMU case, this is the Mali Virtual base address of the memory to
1004 * allocate, and the particular physical pages used to back the memory are
1005 * entirely determined by _mali_ukk_mem_mmap(). The details of the physical pages
1006 * are not reported to user-space for security reasons.
1008 * The cookie member must be stored for use later when freeing the memory by
1009 * calling _mali_ukk_mem_munmap(). In the Mali-MMU case, the cookie is secure.
1011 * The ukk_private word must be set to zero when calling from user-space. On
1012 * Kernel-side, the OS implementation of the U/K interface can use it to
1013 * communicate data to the OS implementation of the OSK layer. In particular,
1014 * _mali_ukk_get_big_block() directly calls _mali_ukk_mem_mmap directly, and
1015 * will communicate its own ukk_private word through the ukk_private member
1016 * here. The common code itself will not inspect or modify the ukk_private
1017 * word, and so it may be safely used for whatever purposes necessary to
1018 * integrate Mali Memory handling into the OS.
1020 * The uku_private member is currently reserved for use by the user-side
1021 * implementation of the U/K interface. Its value must be zero.
1025 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
1026 void *mapping; /**< [out] Returns user-space virtual address for the mapping */
1027 u32 size; /**< [in] Size of the requested mapping */
1028 u32 phys_addr; /**< [in] Physical address - could be offset, depending on caller+callee convention */
1029 u32 cookie; /**< [out] Returns a cookie for use in munmap calls */
1030 void *uku_private; /**< [in] User-side Private word used by U/K interface */
1031 void *ukk_private; /**< [in] Kernel-side Private word used by U/K interface */
1032 mali_memory_cache_settings cache_settings; /**< [in] Option to set special cache flags, tuning L2 efficency */
1033 } _mali_uk_mem_mmap_s;
1035 /** @brief Arguments to _mali_ukk_mem_munmap()
1037 * The cookie and mapping members must be that returned from the same previous
1038 * call to _mali_ukk_mem_mmap(). The size member must correspond to cookie
1039 * and mapping - that is, it must be the value originally supplied to a call to
1040 * _mali_ukk_mem_mmap that returned the values of mapping and cookie.
1042 * An error will be returned if an attempt is made to unmap only part of the
1043 * originally obtained range, or to unmap more than was originally obtained.
1047 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
1048 void *mapping; /**< [in] The mapping returned from mmap call */
1049 u32 size; /**< [in] The size passed to mmap call */
1050 u32 cookie; /**< [in] Cookie from mmap call */
1051 } _mali_uk_mem_munmap_s;
1052 /** @} */ /* end group _mali_uk_memory */
1054 /** @defgroup _mali_uk_vsync U/K VSYNC Wait Reporting Module
1057 /** @brief VSYNC events
1059 * These events are reported when DDK starts to wait for vsync and when the
1060 * vsync has occured and the DDK can continue on the next frame.
1062 typedef enum _mali_uk_vsync_event
1064 _MALI_UK_VSYNC_EVENT_BEGIN_WAIT = 0,
1065 _MALI_UK_VSYNC_EVENT_END_WAIT
1066 } _mali_uk_vsync_event;
1068 /** @brief Arguments to _mali_ukk_vsync_event()
1073 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
1074 _mali_uk_vsync_event event; /**< [in] VSYNCH event type */
1075 } _mali_uk_vsync_event_report_s;
1077 /** @} */ /* end group _mali_uk_vsync */
1079 /** @defgroup _mali_uk_sw_counters_report U/K Software Counter Reporting
1082 /** @brief Software counter values
1084 * Values recorded for each of the software counters during a single renderpass.
1088 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
1089 u32* counters; /**< [in] The array of counter values */
1090 u32 num_counters; /**< [in] The number of elements in counters array */
1091 } _mali_uk_sw_counters_report_s;
1093 /** @} */ /* end group _mali_uk_sw_counters_report */
1095 /** @defgroup _mali_uk_stream U/K Mali stream module
1098 /** @brief Create stream
1102 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
1103 int fd; /**< [out] file descriptor describing stream */
1104 } _mali_uk_stream_create_s;
1106 /** @brief Destroy stream
1110 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
1111 int fd; /**< [in] file descriptor describing stream */
1112 } _mali_uk_stream_destroy_s;
1114 /** @brief Check fence validity
1118 void *ctx; /**< [in,out] user-kernel context (trashed on output) */
1119 int fd; /**< [in] file descriptor describing fence */
1120 } _mali_uk_fence_validate_s;
1122 /** @} */ /* end group _mali_uk_stream */
1124 /** @} */ /* end group u_k_api */
1126 /** @} */ /* end group uddapi */
1132 #endif /* __MALI_UTGARD_UK_TYPES_H__ */