Commit 595091c6 authored by Aurabindo Pillai's avatar Aurabindo Pillai Committed by Alex Deucher
Browse files

drm/amd/display: use actual cursor size instead of max for CAB allocation



[Why&How]
When calculating allocation for cursor size, get the real cursor through
the HUBP instead of using the maximum cursor size for more optimal
allocation

Reviewed-by: default avatarAlvin Lee <Alvin.Lee2@amd.com>
Reviewed-by: default avatarNicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: default avatarBrian Chang <Brian.Chang@amd.com>
Signed-off-by: default avatarAurabindo Pillai <aurabindo.pillai@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 94a82c9e
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -295,7 +295,20 @@ static uint32_t dcn32_calculate_cab_allocation(struct dc *dc, struct dc_state *c
		}

		// Include cursor size for CAB allocation
		cursor_size = dc->caps.max_cursor_size * dc->caps.max_cursor_size;
		for (i = 0; i < dc->res_pool->pipe_count; i++) {
			struct pipe_ctx *pipe = &ctx->res_ctx.pipe_ctx[i];
			struct hubp *hubp = pipe->plane_res.hubp;

			if (pipe->stream && pipe->plane_state && hubp)
				/* Find the cursor plane and use the exact size instead of
				 * using the max for calculation
				 */
				if (hubp->curs_attr.width > 0) {
					cursor_size = hubp->curs_attr.width * hubp->curs_attr.height;
					break;
				}
		}

		switch (stream->cursor_attributes.color_format) {
		case CURSOR_MODE_MONO:
			cursor_size /= 2;