From 3325950648103ee7fd3fb435eca64a0b75beac97 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Thu, 19 Jan 2023 13:40:44 +0100 Subject: [PATCH] v3dv: increase BO allocation size when growing CLs MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This can significantly reduce the number of allocations required to record large command buffers with thousands of draw calls and it improves significantly vkoverhead's results. fps_avg helped: serious_sam_trace01_1280x720.gfxr: 17.96 -> 18.50 (3.01%) fps_avg helped: vehicle-game-2.gfxr: 9.09 -> 9.33 (2.67%) fps_avg helped: ue4_shooter_game_high_quality.gfxr: 17.40 -> 17.66 (1.48%) fps_avg helped: ue4_shooter_game_low_quality.gfxr: 25.25 -> 25.61 (1.44%) fps_avg helped: ue4_sun_temple.gfxr: 24.93 -> 25.15 (0.86%) fps_avg helped: vkQuake_capture_frames_1_through_1200.gfxr: 52.54 -> 52.95 (0.78%) fps_avg helped: rbdoom-3-bfg_capture.gfxr: 13.87 -> 13.96 (0.69%) fps_avg helped: sponza_demo02_800x600.gfxr: 19.59 -> 19.63 (0.21%) fps_avg HURT: ue4_shooter_game_shooting_high_quality.gfxr: 19.14 -> 18.95 (-0.98%) fps_avg HURT: sponza_demo01_800x600.gfxr: 20.03 -> 20 (-0.09%) fps_avg HURT: quake3e_capture_frames_1_through_1800.gfxr: 57.34 -> 57.34 (-0.01%) fps_avg HURT: serious_sam_trace02_1280x720.gfxr: 38.27 -> 38.27 (-0.01%) total fps_min in shared programs: 311.74 -> 313.91 (0.69%) fps_min in affected programs: 311.74 -> 313.91 (0.69%) helped: 10 HURT: 2 total fps_max in shared programs: 319.54 -> 320.24 (0.22%) fps_max in affected programs: 319.54 -> 320.24 (0.22%) helped: 6 HURT: 6 total fps_avg in shared programs: 315.41 -> 317.36 (0.62%) fps_avg in affected programs: 315.41 -> 317.36 (0.62%) helped: 8 HURT: 4 Reviewed-by: Alejandro Piñeiro Part-of: --- src/broadcom/vulkan/v3dv_cl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/broadcom/vulkan/v3dv_cl.c b/src/broadcom/vulkan/v3dv_cl.c index 55cf122..62e6144 100644 --- a/src/broadcom/vulkan/v3dv_cl.c +++ b/src/broadcom/vulkan/v3dv_cl.c @@ -58,6 +58,11 @@ v3dv_cl_destroy(struct v3dv_cl *cl) static bool cl_alloc_bo(struct v3dv_cl *cl, uint32_t space, bool use_branch) { + /* If we are growing, double the BO allocation size to reduce the number + * of allocations with large command buffers. This has a very significant + * impact on the number of draw calls per second reported by vkoverhead. + */ + space = cl->bo ? cl->bo->size * 2 : align(space, 4096); struct v3dv_bo *bo = v3dv_bo_alloc(cl->job->device, space, "CL", true); if (!bo) { fprintf(stderr, "failed to allocate memory for command list\n"); -- 2.7.4