Skip to content

Commit 79ac512

Browse files
mairacanalpopcornmix
authored andcommitted
drm/v3d: Reduce the alignment of the node allocation
Commit 8dd6074 upstream Currently, we are using an alignment of 128 kB to insert a node, which ends up wasting memory as we perform plenty of small BOs allocations (<= 4 kB). We require that allocations are aligned to 128Kb so for any allocation smaller than that, we are wasting the difference. This implies that we cannot effectively use the whole 4 GB address space available for the GPU in the RPi 4. Currently, we can allocate up to 32000 BOs of 4 kB (~140 MB) and 3000 BOs of 400 kB (~1,3 GB). This can be quite limiting for applications that have a high memory requirement, such as vkoverhead [1]. By reducing the page alignment to 4 kB, we can allocate up to 1000000 BOs of 4 kB (~4 GB) and 10000 BOs of 400 kB (~4 GB). Moreover, by performing benchmarks, we were able to attest that reducing the page alignment to 4 kB can provide a general performance improvement in OpenGL applications (e.g. glmark2). Therefore, this patch reduces the alignment of the node allocation to 4 kB, which will allow RPi users to explore the whole 4GB virtual address space provided by the hardware. Also, this patch allow users to fully run vkoverhead in the RPi 4/5, solving the issue reported in [1]. [1] zmike/vkoverhead#14 Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240923141348.2422499-8-mcanal@igalia.com
1 parent 6fb1bba commit 79ac512

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

drivers/gpu/drm/v3d/v3d_bo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ v3d_bo_create_finish(struct drm_gem_object *obj)
123123
*/
124124
ret = drm_mm_insert_node_generic(&v3d->mm, &bo->node,
125125
obj->size >> V3D_MMU_PAGE_SHIFT,
126-
GMP_GRANULARITY >> V3D_MMU_PAGE_SHIFT, 0, 0);
126+
SZ_4K >> V3D_MMU_PAGE_SHIFT, 0, 0);
127127
spin_unlock(&v3d->mm_lock);
128128
if (ret)
129129
return ret;

drivers/gpu/drm/v3d/v3d_drv.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ struct clk;
1919
struct platform_device;
2020
struct reset_control;
2121

22-
#define GMP_GRANULARITY (128 * 1024)
23-
2422
#define V3D_MMU_PAGE_SHIFT 12
2523

2624
#define V3D_MAX_QUEUES (V3D_CPU + 1)

0 commit comments

Comments
 (0)