panfrost: add tiler-heap driconfs
We currently allocate 10 MB up-front for tiler heaps. That can sometimes be a lot, depending on the system. So let's add some DRIconf variables to allow tweaking these. Until we have incremental-rendering implemented, it's a bit risky to lower these too much. Be warned. Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28594>
This commit is contained in:
committed by
Marge Bot
parent
d55f85491c
commit
6bf80841a8
@@ -1,4 +1,12 @@
|
||||
/* panfrost specific driconf options */
|
||||
DRI_CONF_SECTION_PERFORMANCE
|
||||
DRI_CONF_OPT_B(pan_force_afbc_packing, false, "Use AFBC-P for textures")
|
||||
|
||||
/* 2M chunks. */
|
||||
DRI_CONF_OPT_I(pan_csf_chunk_size, 2 * 1024 * 1024, 256 * 1024, 8 * 1024 * 1024, "CSF Tiler Chunk Size")
|
||||
DRI_CONF_OPT_I(pan_csf_initial_chunks, 5, 1, 65535, "CSF Tiler Initial Chunks")
|
||||
/* 64 x 2M = 128M, which matches the tiler_heap BO allocated in
|
||||
* panfrost_open_device() for pre-v10 HW.
|
||||
*/
|
||||
DRI_CONF_OPT_I(pan_csf_max_chunks, 64, 1, 65535, "CSF Tiler Max Chunks")
|
||||
DRI_CONF_SECTION_END
|
||||
|
||||
@@ -974,14 +974,9 @@ GENX(csf_init_context)(struct panfrost_context *ctx)
|
||||
/* Get tiler heap */
|
||||
struct drm_panthor_tiler_heap_create thc = {
|
||||
.vm_id = pan_kmod_vm_handle(dev->kmod.vm),
|
||||
/* 2M chunks. */
|
||||
.chunk_size = 2 * 1024 * 1024,
|
||||
.initial_chunk_count = 5,
|
||||
|
||||
/* 64 x 2M = 128M, which matches the tiler_heap BO allocated in
|
||||
* panfrost_open_device() for pre-v10 HW.
|
||||
*/
|
||||
.max_chunks = 64,
|
||||
.chunk_size = pan_screen(ctx->base.screen)->csf_tiler_heap.chunk_size,
|
||||
.initial_chunk_count = pan_screen(ctx->base.screen)->csf_tiler_heap.initial_chunks,
|
||||
.max_chunks = pan_screen(ctx->base.screen)->csf_tiler_heap.max_chunks,
|
||||
.target_in_flight = 65535,
|
||||
};
|
||||
ret = drmIoctl(panfrost_device_fd(dev), DRM_IOCTL_PANTHOR_TILER_HEAP_CREATE,
|
||||
@@ -994,7 +989,7 @@ GENX(csf_init_context)(struct panfrost_context *ctx)
|
||||
ctx->csf.heap.desc_bo =
|
||||
panfrost_bo_create(dev, pan_size(TILER_HEAP), 0, "Tiler Heap");
|
||||
pan_pack(ctx->csf.heap.desc_bo->ptr.cpu, TILER_HEAP, heap) {
|
||||
heap.size = 2 * 1024 * 1024;
|
||||
heap.size = pan_screen(ctx->base.screen)->csf_tiler_heap.chunk_size;
|
||||
heap.base = thc.first_heap_chunk_gpu_va;
|
||||
heap.bottom = heap.base + 64;
|
||||
heap.top = heap.base + heap.size;
|
||||
|
||||
@@ -861,6 +861,13 @@ panfrost_create_screen(int fd, const struct pipe_screen_config *config,
|
||||
screen->force_afbc_packing = driQueryOptionb(config->options,
|
||||
"pan_force_afbc_packing");
|
||||
|
||||
screen->csf_tiler_heap.chunk_size = driQueryOptioni(config->options,
|
||||
"pan_csf_chunk_size");
|
||||
screen->csf_tiler_heap.initial_chunks = driQueryOptioni(config->options,
|
||||
"pan_csf_initial_chunks");
|
||||
screen->csf_tiler_heap.max_chunks = driQueryOptioni(config->options,
|
||||
"pan_csf_max_chunks");
|
||||
|
||||
dev->ro = ro;
|
||||
|
||||
screen->base.destroy = panfrost_destroy_screen;
|
||||
|
||||
@@ -118,6 +118,12 @@ struct panfrost_screen {
|
||||
struct disk_cache *disk_cache;
|
||||
unsigned max_afbc_packing_ratio;
|
||||
bool force_afbc_packing;
|
||||
|
||||
struct {
|
||||
unsigned chunk_size;
|
||||
unsigned initial_chunks;
|
||||
unsigned max_chunks;
|
||||
} csf_tiler_heap;
|
||||
};
|
||||
|
||||
static inline struct panfrost_screen *
|
||||
|
||||
Reference in New Issue
Block a user