Expand the driver's DebugFS GEMS file to display entries for the heap chunks' GEM objects, both those allocated at heap creation time through an ioctl(), or in response to a tiler OOM event. Signed-off-by: Adrián Larumbe <adrian.larumbe@xxxxxxxxxxxxx> --- drivers/gpu/drm/panthor/panthor_heap.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/gpu/drm/panthor/panthor_heap.c b/drivers/gpu/drm/panthor/panthor_heap.c index db0285ce5812..520d1fcf5c36 100644 --- a/drivers/gpu/drm/panthor/panthor_heap.c +++ b/drivers/gpu/drm/panthor/panthor_heap.c @@ -139,6 +139,10 @@ static int panthor_alloc_heap_chunk(struct panthor_device *ptdev, struct panthor_heap_chunk *chunk; struct panthor_heap_chunk_header *hdr; int ret; +#ifdef CONFIG_DEBUG_FS + struct panthor_gem_object *obj; + const char *label; +#endif chunk = kmalloc(sizeof(*chunk), GFP_KERNEL); if (!chunk) @@ -180,6 +184,17 @@ static int panthor_alloc_heap_chunk(struct panthor_device *ptdev, heap->chunk_count++; mutex_unlock(&heap->lock); +#ifdef CONFIG_DEBUG_FS + obj = to_panthor_bo(chunk->bo->obj); + + mutex_lock(&ptdev->gems_lock); + list_add_tail(&obj->gems_node, &ptdev->gems); + mutex_unlock(&ptdev->gems_lock); + + label = kstrdup_const("\"Tiler heap chunk\"", GFP_KERNEL); + panthor_gem_label_bo(chunk->bo->obj, label); +#endif + return 0; err_destroy_bo: -- 2.48.1