From e42736e67f7d84d329d9595b7393e6784c5b887f Mon Sep 17 00:00:00 2001 From: Sidath Senanayake Date: Mon, 22 Jan 2018 13:55:38 +0100 Subject: Mali Bifrost DDK r10p0 KMD Provenance: 27ee08eb4 (collaborate/EAC/b_r10p0) BX304L01B-BU-00000-r10p0-01rel0 BX304L06A-BU-00000-r10p0-01rel0 BX304X07X-BU-00000-r10p0-01rel0 Signed-off-by: Sidath Senanayake Change-Id: I31c8d66dad91c5b998f3e07757054c37c6aea963 --- mali_kbase/mali_kbase.h | 76 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 54 insertions(+), 22 deletions(-) (limited to 'mali_kbase/mali_kbase.h') diff --git a/mali_kbase/mali_kbase.h b/mali_kbase/mali_kbase.h index 11113a9..7174ef2 100644 --- a/mali_kbase/mali_kbase.h +++ b/mali_kbase/mali_kbase.h @@ -7,16 +7,21 @@ * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * - * A copy of the licence is included with the program, and can also be obtained - * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you can access it online at + * http://www.gnu.org/licenses/gpl-2.0.html. + * + * SPDX-License-Identifier: GPL-2.0 * */ - - #ifndef _KBASE_H_ #define _KBASE_H_ @@ -24,14 +29,12 @@ #include -#include - #include #include #include #include #include -#include +#include #include #include #include @@ -112,6 +115,49 @@ struct kbase_context * kbase_create_context(struct kbase_device *kbdev, bool is_compat); void kbase_destroy_context(struct kbase_context *kctx); + +/** + * kbase_get_unmapped_area() - get an address range which is currently + * unmapped. + * @filp: File operations associated with kbase device. + * @addr: CPU mapped address (set to 0 since MAP_FIXED mapping is not allowed + * as Mali GPU driver decides about the mapping). + * @len: Length of the address range. + * @pgoff: Page offset within the GPU address space of the kbase context. + * @flags: Flags for the allocation. + * + * Finds the unmapped address range which satisfies requirements specific to + * GPU and those provided by the call parameters. + * + * 1) Requirement for allocations greater than 2MB: + * - alignment offset is set to 2MB and the alignment mask to 2MB decremented + * by 1. + * + * 2) Requirements imposed for the shader memory alignment: + * - alignment is decided by the number of GPU pc bits which can be read from + * GPU properties of the device associated with this kbase context; alignment + * offset is set to this value in bytes and the alignment mask to the offset + * decremented by 1. + * - allocations must not to be at 4GB boundaries. Such cases are indicated + * by the flag KBASE_REG_GPU_NX not being set (check the flags of the kbase + * region). 4GB boundaries can be checked against @ref BASE_MEM_MASK_4GB. + * + * 3) Requirements imposed for tiler memory alignment, cases indicated by + * the flag @ref KBASE_REG_TILER_ALIGN_TOP (check the flags of the kbase + * region): + * - alignment offset is set to the difference between the kbase region + * extent (converted from the original value in pages to bytes) and the kbase + * region initial_commit (also converted from the original value in pages to + * bytes); alignment mask is set to the kbase region extent in bytes and + * decremented by 1. + * + * Return: if successful, address of the unmapped area aligned as required; + * error code (negative) in case of failure; + */ +unsigned long kbase_get_unmapped_area(struct file *filp, + const unsigned long addr, const unsigned long len, + const unsigned long pgoff, const unsigned long flags); + int kbase_jd_init(struct kbase_context *kctx); void kbase_jd_exit(struct kbase_context *kctx); @@ -541,20 +587,6 @@ void kbasep_trace_clear(struct kbase_device *kbdev); /** PRIVATE - do not use directly. Use KBASE_TRACE_DUMP() instead */ void kbasep_trace_dump(struct kbase_device *kbdev); -#ifdef CONFIG_MALI_DEBUG -/** - * kbase_set_driver_inactive - Force driver to go inactive - * @kbdev: Device pointer - * @inactive: true if driver should go inactive, false otherwise - * - * Forcing the driver inactive will cause all future IOCTLs to wait until the - * driver is made active again. This is intended solely for the use of tests - * which require that no jobs are running while the test executes. - */ -void kbase_set_driver_inactive(struct kbase_device *kbdev, bool inactive); -#endif /* CONFIG_MALI_DEBUG */ - - #if defined(CONFIG_DEBUG_FS) && !defined(CONFIG_MALI_NO_MALI) /* kbase_io_history_init - initialize data struct for register access history -- cgit v1.2.3