summaryrefslogtreecommitdiff
path: root/drivers/gpu/arm/midgard/mali_kbase.h
diff options
context:
space:
mode:
authorchenzhen <chenzhen@rock-chips.com>2015-08-05 17:51:30 +0800
committerchenzhen <chenzhen@rock-chips.com>2015-08-05 17:55:59 +0800
commit71d4fbd8cced98e1c99f0a95dbda8d9c8a41143e (patch)
tree5984f8f5fab6306481b960787c103ad76c7e75d8 /drivers/gpu/arm/midgard/mali_kbase.h
parent607b4fdb2c93cf94766501cfe45728a1592c4e54 (diff)
rk3288_mali_t760_driver_r6p0-02rel0_12_x@0
Diffstat (limited to 'drivers/gpu/arm/midgard/mali_kbase.h')
-rw-r--r--[-rwxr-xr-x]drivers/gpu/arm/midgard/mali_kbase.h177
1 files changed, 59 insertions, 118 deletions
diff --git a/drivers/gpu/arm/midgard/mali_kbase.h b/drivers/gpu/arm/midgard/mali_kbase.h
index e94681f474af..be3527820fa0 100755..100644
--- a/drivers/gpu/arm/midgard/mali_kbase.h
+++ b/drivers/gpu/arm/midgard/mali_kbase.h
@@ -1,6 +1,6 @@
/*
*
- * (C) COPYRIGHT ARM Limited. All rights reserved.
+ * (C) COPYRIGHT 2010-2015 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
@@ -20,7 +20,7 @@
#ifndef _KBASE_H_
#define _KBASE_H_
-#include <malisw/mali_malisw.h>
+#include <mali_malisw.h>
#include <mali_kbase_debug.h>
@@ -58,6 +58,8 @@
#include "mali_kbase_jd_debugfs.h"
#include "mali_kbase_cpuprops.h"
#include "mali_kbase_gpuprops.h"
+#include "mali_kbase_jm.h"
+#include "mali_kbase_vinstr.h"
#ifdef CONFIG_GPU_TRACEPOINTS
#include <trace/events/gpu.h>
#endif
@@ -86,73 +88,61 @@ const struct list_head *kbase_dev_list_get(void);
/* API to release the device list semaphore */
void kbase_dev_list_put(const struct list_head *dev_list);
-mali_error kbase_device_init(struct kbase_device * const kbdev);
+int kbase_device_init(struct kbase_device * const kbdev);
void kbase_device_term(struct kbase_device *kbdev);
void kbase_device_free(struct kbase_device *kbdev);
int kbase_device_has_feature(struct kbase_device *kbdev, u32 feature);
-struct kbase_device *kbase_find_device(int minor); /* Only needed for gator integration */
+
+/* Needed for gator integration and for reporting vsync information */
+struct kbase_device *kbase_find_device(int minor);
void kbase_release_device(struct kbase_device *kbdev);
void kbase_set_profiling_control(struct kbase_device *kbdev, u32 control, u32 value);
u32 kbase_get_profiling_control(struct kbase_device *kbdev, u32 control);
-/**
- * Ensure that all IRQ handlers have completed execution
- *
- * @param kbdev The kbase device
- */
-void kbase_synchronize_irqs(struct kbase_device *kbdev);
-void kbase_synchronize_irqs(struct kbase_device *kbdev);
-
struct kbase_context *
kbase_create_context(struct kbase_device *kbdev, bool is_compat);
void kbase_destroy_context(struct kbase_context *kctx);
-mali_error kbase_context_set_create_flags(struct kbase_context *kctx, u32 flags);
-
-mali_error kbase_instr_hwcnt_setup(struct kbase_context *kctx, struct kbase_uk_hwcnt_setup *setup);
-mali_error kbase_instr_hwcnt_enable(struct kbase_context *kctx, struct kbase_uk_hwcnt_setup *setup);
-mali_error kbase_instr_hwcnt_disable(struct kbase_context *kctx);
-mali_error kbase_instr_hwcnt_clear(struct kbase_context *kctx);
-mali_error kbase_instr_hwcnt_dump(struct kbase_context *kctx);
-mali_error kbase_instr_hwcnt_dump_irq(struct kbase_context *kctx);
-mali_bool kbase_instr_hwcnt_dump_complete(struct kbase_context *kctx, mali_bool * const success);
-void kbase_instr_hwcnt_suspend(struct kbase_device *kbdev);
-void kbase_instr_hwcnt_resume(struct kbase_device *kbdev);
+int kbase_context_set_create_flags(struct kbase_context *kctx, u32 flags);
-void kbasep_cache_clean_worker(struct work_struct *data);
-void kbase_clean_caches_done(struct kbase_device *kbdev);
-
-/**
- * The GPU has completed performance count sampling successfully.
- */
-void kbase_instr_hwcnt_sample_done(struct kbase_device *kbdev);
-
-mali_error kbase_jd_init(struct kbase_context *kctx);
+int kbase_jd_init(struct kbase_context *kctx);
void kbase_jd_exit(struct kbase_context *kctx);
#ifdef BASE_LEGACY_UK6_SUPPORT
-mali_error kbase_jd_submit(struct kbase_context *kctx,
+int kbase_jd_submit(struct kbase_context *kctx,
const struct kbase_uk_job_submit *submit_data,
int uk6_atom);
#else
-mali_error kbase_jd_submit(struct kbase_context *kctx,
+int kbase_jd_submit(struct kbase_context *kctx,
const struct kbase_uk_job_submit *submit_data);
#endif
void kbase_jd_done(struct kbase_jd_atom *katom, int slot_nr, ktime_t *end_timestamp,
- kbasep_js_atom_done_code done_code);
+ kbasep_js_atom_done_code done_code);
void kbase_jd_cancel(struct kbase_device *kbdev, struct kbase_jd_atom *katom);
+void kbase_jd_evict(struct kbase_device *kbdev, struct kbase_jd_atom *katom);
void kbase_jd_zap_context(struct kbase_context *kctx);
-mali_bool jd_done_nolock(struct kbase_jd_atom *katom);
+bool jd_done_nolock(struct kbase_jd_atom *katom);
void kbase_jd_free_external_resources(struct kbase_jd_atom *katom);
-mali_bool jd_submit_atom(struct kbase_context *kctx,
+bool jd_submit_atom(struct kbase_context *kctx,
const struct base_jd_atom_v2 *user_atom,
struct kbase_jd_atom *katom);
-mali_error kbase_job_slot_init(struct kbase_device *kbdev);
-void kbase_job_slot_halt(struct kbase_device *kbdev);
-void kbase_job_slot_term(struct kbase_device *kbdev);
void kbase_job_done(struct kbase_device *kbdev, u32 done);
-void kbase_job_zap_context(struct kbase_context *kctx);
+
+/**
+ * kbase_job_slot_ctx_priority_check_locked(): - Check for lower priority atoms
+ * and soft stop them
+ * @kctx: Pointer to context to check.
+ * @katom: Pointer to priority atom.
+ *
+ * Atoms from @kctx on the same job slot as @katom, which have lower priority
+ * than @katom will be soft stopped and put back in the queue, so that atoms
+ * with higher priority can run.
+ *
+ * The js_data.runpool_irq.lock must be held when calling this function.
+ */
+void kbase_job_slot_ctx_priority_check_locked(struct kbase_context *kctx,
+ struct kbase_jd_atom *katom);
void kbase_job_slot_softstop(struct kbase_device *kbdev, int js,
struct kbase_jd_atom *target_katom);
@@ -168,13 +158,13 @@ void kbase_job_check_leave_disjoint(struct kbase_device *kbdev,
void kbase_event_post(struct kbase_context *ctx, struct kbase_jd_atom *event);
int kbase_event_dequeue(struct kbase_context *ctx, struct base_jd_event_v2 *uevent);
int kbase_event_pending(struct kbase_context *ctx);
-mali_error kbase_event_init(struct kbase_context *kctx);
+int kbase_event_init(struct kbase_context *kctx);
void kbase_event_close(struct kbase_context *kctx);
void kbase_event_cleanup(struct kbase_context *kctx);
void kbase_event_wakeup(struct kbase_context *kctx);
int kbase_process_soft_job(struct kbase_jd_atom *katom);
-mali_error kbase_prepare_soft_job(struct kbase_jd_atom *katom);
+int kbase_prepare_soft_job(struct kbase_jd_atom *katom);
void kbase_finish_soft_job(struct kbase_jd_atom *katom);
void kbase_cancel_soft_job(struct kbase_jd_atom *katom);
void kbase_resume_suspended_soft_jobs(struct kbase_device *kbdev);
@@ -182,8 +172,6 @@ void kbase_resume_suspended_soft_jobs(struct kbase_device *kbdev);
bool kbase_replay_process(struct kbase_jd_atom *katom);
/* api used internally for register access. Contains validation and tracing */
-void kbase_reg_write(struct kbase_device *kbdev, u16 offset, u32 value, struct kbase_context *kctx);
-u32 kbase_reg_read(struct kbase_device *kbdev, u16 offset, struct kbase_context *kctx);
void kbase_device_trace_register_access(struct kbase_context *kctx, enum kbase_reg_access_type type, u16 reg_offset, u32 reg_value);
void kbase_device_trace_buffer_install(struct kbase_context *kctx, u32 *tb, size_t size);
void kbase_device_trace_buffer_uninstall(struct kbase_context *kctx);
@@ -192,84 +180,20 @@ void kbase_device_trace_buffer_uninstall(struct kbase_context *kctx);
void kbase_os_reg_write(struct kbase_device *kbdev, u16 offset, u32 value);
u32 kbase_os_reg_read(struct kbase_device *kbdev, u16 offset);
+
void kbasep_as_do_poke(struct work_struct *work);
-/** Report a GPU fault.
+/** Returns the name associated with a Mali exception code
*
* This function is called from the interrupt handler when a GPU fault occurs.
* It reports the details of the fault using KBASE_DEBUG_PRINT_WARN.
*
- * @param kbdev The kbase device that the GPU fault occurred from.
- * @param multiple Zero if only GPU_FAULT was raised, non-zero if MULTIPLE_GPU_FAULTS was also set
- */
-void kbase_report_gpu_fault(struct kbase_device *kbdev, int multiple);
-
-/** Kill all jobs that are currently running from a context
- *
- * This is used in response to a page fault to remove all jobs from the faulting context from the hardware.
- *
- * @param kctx The context to kill jobs from
- */
-void kbase_job_kill_jobs_from_context(struct kbase_context *kctx);
-
-/**
- * GPU interrupt handler
- *
- * This function is called from the interrupt handler when a GPU irq is to be handled.
- *
- * @param kbdev The kbase device to handle an IRQ for
- * @param val The value of the GPU IRQ status register which triggered the call
- */
-void kbase_gpu_interrupt(struct kbase_device *kbdev, u32 val);
-
-/**
- * Prepare for resetting the GPU.
- * This function just soft-stops all the slots to ensure that as many jobs as possible are saved.
- *
- * The function returns a boolean which should be interpreted as follows:
- * - MALI_TRUE - Prepared for reset, kbase_reset_gpu should be called.
- * - MALI_FALSE - Another thread is performing a reset, kbase_reset_gpu should not be called.
- *
- * @return See description
- */
-mali_bool kbase_prepare_to_reset_gpu(struct kbase_device *kbdev);
-
-/**
- * Pre-locked version of @a kbase_prepare_to_reset_gpu.
- *
- * Identical to @a kbase_prepare_to_reset_gpu, except that the
- * kbasep_js_device_data::runpool_irq::lock is externally locked.
- *
- * @see kbase_prepare_to_reset_gpu
- */
-mali_bool kbase_prepare_to_reset_gpu_locked(struct kbase_device *kbdev);
-
-/** Reset the GPU
- *
- * This function should be called after kbase_prepare_to_reset_gpu iff it returns MALI_TRUE.
- * It should never be called without a corresponding call to kbase_prepare_to_reset_gpu.
- *
- * After this function is called (or not called if kbase_prepare_to_reset_gpu returned MALI_FALSE),
- * the caller should wait for kbdev->reset_waitq to be signalled to know when the reset has completed.
- */
-void kbase_reset_gpu(struct kbase_device *kbdev);
-
-/**
- * Pre-locked version of @a kbase_reset_gpu.
- *
- * Identical to @a kbase_reset_gpu, except that the
- * kbasep_js_device_data::runpool_irq::lock is externally locked.
- *
- * @see kbase_reset_gpu
- */
-void kbase_reset_gpu_locked(struct kbase_device *kbdev);
-
-/** Returns the name associated with a Mali exception code
- *
+ * @param[in] kbdev The kbase device that the GPU fault occurred from.
* @param[in] exception_code exception code
* @return name associated with the exception code
*/
-const char *kbase_exception_name(u32 exception_code);
+const char *kbase_exception_name(struct kbase_device *kbdev,
+ u32 exception_code);
/**
* Check whether a system suspend is in progress, or has already been suspended
@@ -278,10 +202,11 @@ const char *kbase_exception_name(u32 exception_code);
* a dmb was executed recently (to ensure the value is most
* up-to-date). However, without a lock the value could change afterwards.
*
- * @return MALI_FALSE if a suspend is not in progress
- * @return !=MALI_FALSE otherwise
+ * @return false if a suspend is not in progress
+ * @return !=false otherwise
*/
-static INLINE mali_bool kbase_pm_is_suspending(struct kbase_device *kbdev) {
+static inline bool kbase_pm_is_suspending(struct kbase_device *kbdev)
+{
return kbdev->pm.suspending;
}
@@ -289,9 +214,10 @@ static INLINE mali_bool kbase_pm_is_suspending(struct kbase_device *kbdev) {
* Return the atom's ID, as was originally supplied by userspace in
* base_jd_atom_v2::atom_number
*/
-static INLINE int kbase_jd_atom_id(struct kbase_context *kctx, struct kbase_jd_atom *katom)
+static inline int kbase_jd_atom_id(struct kbase_context *kctx, struct kbase_jd_atom *katom)
{
int result;
+
KBASE_DEBUG_ASSERT(kctx);
KBASE_DEBUG_ASSERT(katom);
KBASE_DEBUG_ASSERT(katom->kctx == kctx);
@@ -302,6 +228,19 @@ static INLINE int kbase_jd_atom_id(struct kbase_context *kctx, struct kbase_jd_a
}
/**
+ * kbase_jd_atom_from_id - Return the atom structure for the given atom ID
+ * @kctx: Context pointer
+ * @id: ID of atom to retrieve
+ *
+ * Return: Pointer to struct kbase_jd_atom associated with the supplied ID
+ */
+static inline struct kbase_jd_atom *kbase_jd_atom_from_id(
+ struct kbase_context *kctx, int id)
+{
+ return &kctx->jctx.atoms[id];
+}
+
+/**
* Initialize the disjoint state
*
* The disjoint event count and state are both set to zero.
@@ -384,6 +323,8 @@ void kbase_disjoint_state_down(struct kbase_device *kbdev);
#define KBASE_DISJOINT_STATE_INTERLEAVED_CONTEXT_COUNT_THRESHOLD 2
#if KBASE_TRACE_ENABLE
+void kbasep_trace_debugfs_init(struct kbase_device *kbdev);
+
#ifndef CONFIG_MALI_SYSTEM_TRACE
/** Add trace values about a job-slot
*