diff options
author | Siddharth Kapoor <ksiddharth@google.com> | 2022-04-01 16:44:58 +0800 |
---|---|---|
committer | Siddharth Kapoor <ksiddharth@google.com> | 2022-04-01 16:44:58 +0800 |
commit | 82f49a8fe599b1d6c9ec6b5e865ce198ef1e7f50 (patch) | |
tree | 48386acd11f463e31ebd8757f7afc0bd193bb15d /mali_kbase/mali_kbase.h | |
parent | 48a339aa2ed0f689a1164a7effe54e52a94277d3 (diff) | |
parent | 5f5ee0748ea9e2cc1d0828c9d1fb00e25df91063 (diff) | |
download | gpu-82f49a8fe599b1d6c9ec6b5e865ce198ef1e7f50.tar.gz |
Merge r36p0 from gs101 into android13-gs-pixel-5.10
Bug: 220942030
Test: boot to Home with IFPO, Camera, Video, Chrome
Signed-off-by: Siddharth Kapoor <ksiddharth@google.com>
Change-Id: I0a7b040d8c756b55b4e54ceb8a33405a52564202
Diffstat (limited to 'mali_kbase/mali_kbase.h')
-rw-r--r-- | mali_kbase/mali_kbase.h | 135 |
1 files changed, 108 insertions, 27 deletions
diff --git a/mali_kbase/mali_kbase.h b/mali_kbase/mali_kbase.h index 2cd00af..d560dfd 100644 --- a/mali_kbase/mali_kbase.h +++ b/mali_kbase/mali_kbase.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * - * (C) COPYRIGHT 2010-2021 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2010-2022 ARM Limited. All rights reserved. * * This program is free software and is provided to you under the terms of the * GNU General Public License version 2 as published by the Free Software @@ -117,9 +117,9 @@ struct kbase_device *kbase_device_alloc(void); /* -* note: configuration attributes member of kbdev needs to have -* been setup before calling kbase_device_init -*/ + * note: configuration attributes member of kbdev needs to have + * been setup before calling kbase_device_init + */ int kbase_device_misc_init(struct kbase_device *kbdev); void kbase_device_misc_term(struct kbase_device *kbdev); @@ -264,8 +264,26 @@ void kbase_jd_done(struct kbase_jd_atom *katom, int slot_nr, ktime_t *end_timest kbasep_js_atom_done_code done_code); void kbase_jd_cancel(struct kbase_device *kbdev, struct kbase_jd_atom *katom); void kbase_jd_zap_context(struct kbase_context *kctx); -bool jd_done_nolock(struct kbase_jd_atom *katom, - struct list_head *completed_jobs_ctx); + +/* + * jd_done_nolock - Perform the necessary handling of an atom that has completed + * the execution. + * + * @katom: Pointer to the atom that completed the execution + * @post_immediately: Flag indicating that completion event can be posted + * immediately for @katom and the other atoms depdendent + * on @katom which also completed execution. The flag is + * false only for the case where the function is called by + * kbase_jd_done_worker() on the completion of atom running + * on the GPU. + * + * Note that if this is a soft-job that has had kbase_prepare_soft_job called on it then the caller + * is responsible for calling kbase_finish_soft_job *before* calling this function. + * + * The caller must hold the kbase_jd_context.lock. + */ +bool jd_done_nolock(struct kbase_jd_atom *katom, bool post_immediately); + void kbase_jd_free_external_resources(struct kbase_jd_atom *katom); void kbase_jd_dep_clear_locked(struct kbase_jd_atom *katom); @@ -307,19 +325,73 @@ void kbase_job_slot_ctx_priority_check_locked(struct kbase_context *kctx, * virtual address space in a growable memory region and the atom currently * executing on a job slot is the tiler job chain at the start of a renderpass. * - * Return 0 if successful, otherwise a negative error code. + * Return: 0 if successful, otherwise a negative error code. */ int kbase_job_slot_softstop_start_rp(struct kbase_context *kctx, struct kbase_va_region *reg); +/** + * kbase_job_slot_softstop - Soft-stop the specified job slot + * + * @kbdev: The kbase device + * @js: The job slot to soft-stop + * @target_katom: The job that should be soft-stopped (or NULL for any job) + * Context: + * The job slot lock must be held when calling this function. + * The job slot must not already be in the process of being soft-stopped. + * + * Where possible any job in the next register is evicted before the soft-stop. + */ void kbase_job_slot_softstop(struct kbase_device *kbdev, int js, struct kbase_jd_atom *target_katom); + void kbase_job_slot_softstop_swflags(struct kbase_device *kbdev, int js, struct kbase_jd_atom *target_katom, u32 sw_flags); + +/** + * kbase_job_slot_hardstop - Hard-stop the specified job slot + * @kctx: The kbase context that contains the job(s) that should + * be hard-stopped + * @js: The job slot to hard-stop + * @target_katom: The job that should be hard-stopped (or NULL for all + * jobs from the context) + * Context: + * The job slot lock must be held when calling this function. + */ void kbase_job_slot_hardstop(struct kbase_context *kctx, int js, struct kbase_jd_atom *target_katom); + +/** + * kbase_job_check_enter_disjoint - potentiall enter disjoint mode + * @kbdev: kbase device + * @action: the event which has occurred + * @core_reqs: core requirements of the atom + * @target_katom: the atom which is being affected + * + * For a certain soft-stop action, work out whether to enter disjoint + * state. + * + * This does not register multiple disjoint events if the atom has already + * started a disjoint period + * + * @core_reqs can be supplied as 0 if the atom had not started on the hardware + * (and so a 'real' soft/hard-stop was not required, but it still interrupted + * flow, perhaps on another context) + * + * kbase_job_check_leave_disjoint() should be used to end the disjoint + * state when the soft/hard-stop action is complete + */ void kbase_job_check_enter_disjoint(struct kbase_device *kbdev, u32 action, base_jd_core_req core_reqs, struct kbase_jd_atom *target_katom); + +/** + * kbase_job_check_leave_disjoint - potentially leave disjoint state + * @kbdev: kbase device + * @target_katom: atom which is finishing + * + * Work out whether to leave disjoint state when finishing an atom that was + * originated by kbase_job_check_enter_disjoint(). + */ void kbase_job_check_leave_disjoint(struct kbase_device *kbdev, struct kbase_jd_atom *target_katom); @@ -342,7 +414,7 @@ void _kbase_event_wakeup(struct kbase_context *kctx, bool sync); * allocation is to be validated. * @info: Pointer to struct @base_jit_alloc_info * which is to be validated. - * @return: 0 if jit allocation is valid; negative error code otherwise + * Return: 0 if jit allocation is valid; negative error code otherwise */ int kbasep_jit_alloc_validate(struct kbase_context *kctx, struct base_jit_alloc_info *info); @@ -389,9 +461,12 @@ static inline void kbase_free_user_buffer( * @buf_data: Pointer to the information about external resources: * pages pertaining to the external resource, number of * pages to copy. + * + * Return: 0 on success, error code otherwise. */ int kbase_mem_copy_from_extres(struct kbase_context *kctx, struct kbase_debug_copy_buffer *buf_data); + #if !MALI_USE_CSF int kbase_process_soft_job(struct kbase_jd_atom *katom); int kbase_prepare_soft_job(struct kbase_jd_atom *katom); @@ -413,7 +488,9 @@ void kbasep_complete_triggered_soft_events(struct kbase_context *kctx, u64 evt); void kbasep_as_do_poke(struct work_struct *work); /** - * Check whether a system suspend is in progress, or has already been suspended + * kbase_pm_is_suspending - Check whether a system suspend is in progress, + * or has already been suspended + * * @kbdev: The kbase device structure for the device * * The caller should ensure that either kbdev->pm.active_count_lock is held, or @@ -547,10 +624,12 @@ void kbase_pm_turn_off_sc_power_rails(struct kbase_device *kbdev); #if !MALI_USE_CSF /** - * Return the atom's ID, as was originally supplied by userspace in + * kbase_jd_atom_id - Return the atom's ID, as was originally supplied by userspace in * base_jd_atom::atom_number * @kctx: KBase context pointer * @katom: Atome for which to return ID + * + * Return: the atom's ID. */ static inline int kbase_jd_atom_id(struct kbase_context *kctx, const struct kbase_jd_atom *katom) @@ -581,7 +660,9 @@ static inline struct kbase_jd_atom *kbase_jd_atom_from_id( #endif /* !MALI_USE_CSF */ /** - * Initialize the disjoint state + * kbase_disjoint_init - Initialize the disjoint state + * + * @kbdev: The kbase device * * The disjoint event count and state are both set to zero. * @@ -603,14 +684,12 @@ static inline struct kbase_jd_atom *kbase_jd_atom_from_id( * The disjoint event counter is also incremented immediately whenever a job is soft stopped * and during context creation. * - * @kbdev: The kbase device - * * Return: 0 on success and non-zero value on failure. */ void kbase_disjoint_init(struct kbase_device *kbdev); /** - * Increase the count of disjoint events + * kbase_disjoint_event - Increase the count of disjoint events * called when a disjoint event has happened * * @kbdev: The kbase device @@ -618,42 +697,44 @@ void kbase_disjoint_init(struct kbase_device *kbdev); void kbase_disjoint_event(struct kbase_device *kbdev); /** - * Increase the count of disjoint events only if the GPU is in a disjoint state + * kbase_disjoint_event_potential - Increase the count of disjoint events + * only if the GPU is in a disjoint state + * + * @kbdev: The kbase device * * This should be called when something happens which could be disjoint if the GPU * is in a disjoint state. The state refcount keeps track of this. - * - * @kbdev: The kbase device */ void kbase_disjoint_event_potential(struct kbase_device *kbdev); /** - * Returns the count of disjoint events + * kbase_disjoint_event_get - Returns the count of disjoint events * * @kbdev: The kbase device - * @return the count of disjoint events + * Return: the count of disjoint events */ u32 kbase_disjoint_event_get(struct kbase_device *kbdev); /** - * Increment the refcount state indicating that the GPU is in a disjoint state. + * kbase_disjoint_state_up - Increment the refcount state indicating that + * the GPU is in a disjoint state. + * + * @kbdev: The kbase device * * Also Increment the disjoint event count (calls @ref kbase_disjoint_event) * eventually after the disjoint state has completed @ref kbase_disjoint_state_down * should be called - * - * @kbdev: The kbase device */ void kbase_disjoint_state_up(struct kbase_device *kbdev); /** - * Decrement the refcount state + * kbase_disjoint_state_down - Decrement the refcount state + * + * @kbdev: The kbase device * * Also Increment the disjoint event count (calls @ref kbase_disjoint_event) * * Called after @ref kbase_disjoint_state_up once the disjoint state is over - * - * @kbdev: The kbase device */ void kbase_disjoint_state_down(struct kbase_device *kbdev); @@ -682,8 +763,8 @@ int kbase_device_pcm_dev_init(struct kbase_device *const kbdev); void kbase_device_pcm_dev_term(struct kbase_device *const kbdev); /** - * If a job is soft stopped and the number of contexts is >= this value - * it is reported as a disjoint event + * KBASE_DISJOINT_STATE_INTERLEAVED_CONTEXT_COUNT_THRESHOLD - If a job is soft stopped + * and the number of contexts is >= this value it is reported as a disjoint event */ #define KBASE_DISJOINT_STATE_INTERLEAVED_CONTEXT_COUNT_THRESHOLD 2 |