Commit 4b09db0c authored by Jun Nie's avatar Jun Nie Committed by Dmitry Baryshkov
Browse files

drm/msm/dpu: polish log for resource allocation



It is more likely that resource allocation may fail in complex usage
case, such as quad-pipe case, than existing usage cases.
A resource type ID is printed on failure in the current implementation,
but the raw ID number is not explicit enough to help easily understand
which resource caused the failure, so add a table to match the type ID
to an human readable resource name and use it in the error print.

Signed-off-by: default avatarJun Nie <jun.nie@linaro.org>
Reviewed-by: default avatarJessica Zhang <quic_jesszhan@quicinc.com>
Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/669225/
Link: https://lore.kernel.org/r/20250819-v6-16-rc2-quad-pipe-upstream-v15-2-2c7a85089db8@linaro.org


Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
parent 6fc61672
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -865,6 +865,21 @@ void dpu_rm_release_all_sspp(struct dpu_global_state *global_state,
		ARRAY_SIZE(global_state->sspp_to_crtc_id), crtc_id);
}

static char *dpu_hw_blk_type_name[] = {
	[DPU_HW_BLK_TOP] = "TOP",
	[DPU_HW_BLK_SSPP] = "SSPP",
	[DPU_HW_BLK_LM] = "LM",
	[DPU_HW_BLK_CTL] = "CTL",
	[DPU_HW_BLK_PINGPONG] = "pingpong",
	[DPU_HW_BLK_INTF] = "INTF",
	[DPU_HW_BLK_WB] = "WB",
	[DPU_HW_BLK_DSPP] = "DSPP",
	[DPU_HW_BLK_MERGE_3D] = "merge_3d",
	[DPU_HW_BLK_DSC] = "DSC",
	[DPU_HW_BLK_CDM] = "CDM",
	[DPU_HW_BLK_MAX] = "unknown",
};

/**
 * dpu_rm_get_assigned_resources - Get hw resources of the given type that are
 *     assigned to this encoder
@@ -946,13 +961,13 @@ int dpu_rm_get_assigned_resources(struct dpu_rm *rm,
		}

		if (num_blks == blks_size) {
			DPU_ERROR("More than %d resources assigned to crtc %d\n",
				  blks_size, crtc_id);
			DPU_ERROR("More than %d %s assigned to crtc %d\n",
				  blks_size, dpu_hw_blk_type_name[type], crtc_id);
			break;
		}
		if (!hw_blks[i]) {
			DPU_ERROR("Allocated resource %d unavailable to assign to crtc %d\n",
				  type, crtc_id);
			DPU_ERROR("%s unavailable to assign to crtc %d\n",
				  dpu_hw_blk_type_name[type], crtc_id);
			break;
		}
		blks[num_blks++] = hw_blks[i];