From 6778948f9de86c3cfaf36725a7c87dcff9ba247f Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Mon, 11 Dec 2023 08:20:59 +0000 Subject: [PATCH] kernel_5.10 no rt --- kernel/drivers/gpu/arm/bifrost/csf/mali_kbase_csf_tiler_heap.h | 65 +++++++++++++++++++++++--------- 1 files changed, 46 insertions(+), 19 deletions(-) diff --git a/kernel/drivers/gpu/arm/bifrost/csf/mali_kbase_csf_tiler_heap.h b/kernel/drivers/gpu/arm/bifrost/csf/mali_kbase_csf_tiler_heap.h index 04c27f7..1b5cb56 100644 --- a/kernel/drivers/gpu/arm/bifrost/csf/mali_kbase_csf_tiler_heap.h +++ b/kernel/drivers/gpu/arm/bifrost/csf/mali_kbase_csf_tiler_heap.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ /* * - * (C) COPYRIGHT 2019-2021 ARM Limited. All rights reserved. + * (C) COPYRIGHT 2019-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 @@ -23,7 +23,6 @@ #define _KBASE_CSF_TILER_HEAP_H_ #include <mali_kbase.h> - /** * kbase_csf_tiler_heap_context_init - Initialize the tiler heaps context for a * GPU address space @@ -38,10 +37,10 @@ * kbase_csf_tiler_heap_context_term - Terminate the tiler heaps context for a * GPU address space * + * @kctx: Pointer to the kbase context being terminated. + * * This function deletes any chunked tiler heaps that weren't deleted before * context termination. - * - * @kctx: Pointer to the kbase context being terminated. */ void kbase_csf_tiler_heap_context_term(struct kbase_context *kctx); @@ -58,6 +57,12 @@ * @target_in_flight: Number of render-passes that the driver should attempt to * keep in flight for which allocation of new chunks is * allowed. Must not be zero. + * @buf_desc_va: Buffer descriptor GPU virtual address. This is a hint for + * indicating that the caller is intending to perform tiler heap + * chunks reclaim for those that are hoarded with hardware while + * the associated shader activites are suspended and the CSGs are + * off slots. If the referred reclaiming is not desired, can + * set it to 0. * @gpu_heap_va: Where to store the GPU virtual address of the context that was * set up for the tiler heap. * @first_chunk_va: Where to store the GPU virtual address of the first chunk @@ -66,22 +71,21 @@ * * Return: 0 if successful or a negative error code on failure. */ -int kbase_csf_tiler_heap_init(struct kbase_context *kctx, - u32 chunk_size, u32 initial_chunks, u32 max_chunks, - u16 target_in_flight, u64 *gpu_heap_va, - u64 *first_chunk_va); +int kbase_csf_tiler_heap_init(struct kbase_context *kctx, u32 chunk_size, u32 initial_chunks, + u32 max_chunks, u16 target_in_flight, u64 const buf_desc_va, + u64 *gpu_heap_va, u64 *first_chunk_va); /** - * kbasep_cs_tiler_heap_term - Terminate a chunked tiler memory heap. + * kbase_csf_tiler_heap_term - Terminate a chunked tiler memory heap. + * + * @kctx: Pointer to the kbase context in which the tiler heap was initialized. + * @gpu_heap_va: The GPU virtual address of the context that was set up for the + * tiler heap. * * This function will terminate a chunked tiler heap and cause all the chunks * (initial and those added during out-of-memory processing) to be freed. * It is the caller's responsibility to ensure no further operations on this * heap will happen before calling this function. - * - * @kctx: Pointer to the kbase context in which the tiler heap was initialized. - * @gpu_heap_va: The GPU virtual address of the context that was set up for the - * tiler heap. * * Return: 0 if successful or a negative error code on failure. */ @@ -89,12 +93,6 @@ /** * kbase_csf_tiler_heap_alloc_new_chunk - Allocate a new chunk for tiler heap. - * - * This function will allocate a new chunk for the chunked tiler heap depending - * on the settings provided by userspace when the heap was created and the - * heap's statistics (like number of render passes in-flight). - * It would return an appropriate error code if a new chunk couldn't be - * allocated. * * @kctx: Pointer to the kbase context in which the tiler heap was initialized. * @gpu_heap_va: GPU virtual address of the heap context. @@ -105,6 +103,12 @@ * @new_chunk_ptr: Where to store the GPU virtual address & size of the new * chunk allocated for the heap. * + * This function will allocate a new chunk for the chunked tiler heap depending + * on the settings provided by userspace when the heap was created and the + * heap's statistics (like number of render passes in-flight). + * It would return an appropriate error code if a new chunk couldn't be + * allocated. + * * Return: 0 if a new chunk was allocated otherwise an appropriate negative * error code (like -EBUSY when a free chunk is expected to be * available upon completion of a render pass and -EINVAL when @@ -112,4 +116,27 @@ */ int kbase_csf_tiler_heap_alloc_new_chunk(struct kbase_context *kctx, u64 gpu_heap_va, u32 nr_in_flight, u32 pending_frag_count, u64 *new_chunk_ptr); + +/** + * kbase_csf_tiler_heap_scan_kctx_unused_pages - Performs the tiler heap shrinker calim's scan + * functionality. + * + * @kctx: Pointer to the kbase context for which the tiler heap recalim is to be + * operated with. + * @to_free: Number of pages suggested for the reclaim scan (free) method to reach. + * + * Return: the actual number of pages the scan method has freed from the call. + */ +u32 kbase_csf_tiler_heap_scan_kctx_unused_pages(struct kbase_context *kctx, u32 to_free); + +/** + * kbase_csf_tiler_heap_count_kctx_unused_pages - Performs the tiler heap shrinker calim's count + * functionality. + * + * @kctx: Pointer to the kbase context for which the tiler heap recalim is to be + * operated with. + * + * Return: a number of pages that could likely be freed on the subsequent scan method call. + */ +u32 kbase_csf_tiler_heap_count_kctx_unused_pages(struct kbase_context *kctx); #endif -- Gitblit v1.6.2