drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
Extension
.c
Size
22891 bytes
Lines
758
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (ctx->mdss_ver->core_major_ver >= 8) {
			ubwc_ctrl_off = SSPP_UBWC_STATIC_CTRL_REC1;
			ubwc_error_off = SSPP_UBWC_ERROR_STATUS_REC1;
		} else {
			ubwc_ctrl_off = SSPP_UBWC_STATIC_CTRL;
			ubwc_error_off = SSPP_UBWC_ERROR_STATUS;
		}
	}

	if (fmt->fetch_mode != MDP_FETCH_LINEAR) {
		u32 hbb = ctx->ubwc->highest_bank_bit - 13;

		DPU_REG_WRITE(&ctx->hw, SSPP_FETCH_CONFIG,
			      DPU_FETCH_CONFIG_RESET_VALUE |
			      hbb << 18);
	}

	dpu_hw_setup_format_impl(pipe, fmt, flags, ctx, op_mode_off,
				 unpack_pat_off, format_off,
				 ubwc_ctrl_off, ubwc_error_off);
}

void dpu_hw_setup_format_impl(struct dpu_sw_pipe *pipe, const struct msm_format *fmt,
			      u32 flags, struct dpu_hw_sspp *ctx, u32 op_mode_off,
			      u32 unpack_pat_off, u32 format_off, u32 ubwc_ctrl_off,
			      u32 ubwc_error_off)
{
	struct dpu_hw_blk_reg_map *c;
	u32 chroma_samp, unpack, src_format;
	u32 opmode;
	u32 fast_clear;

	c = &ctx->hw;
	opmode = DPU_REG_READ(c, op_mode_off);
	opmode &= ~(MDSS_MDP_OP_FLIP_LR | MDSS_MDP_OP_FLIP_UD |
			MDSS_MDP_OP_BWC_EN | MDSS_MDP_OP_PE_OVERRIDE);

	if (flags & DPU_SSPP_FLIP_LR)
		opmode |= MDSS_MDP_OP_FLIP_LR;
	if (flags & DPU_SSPP_FLIP_UD)
		opmode |= MDSS_MDP_OP_FLIP_UD;

	chroma_samp = fmt->chroma_sample;
	if (flags & DPU_SSPP_SOURCE_ROTATED_90) {
		if (chroma_samp == CHROMA_H2V1)
			chroma_samp = CHROMA_H1V2;
		else if (chroma_samp == CHROMA_H1V2)
			chroma_samp = CHROMA_H2V1;
	}

	src_format = (chroma_samp << 23) | (fmt->fetch_type << 19) |
		(fmt->bpc_a << 6) | (fmt->bpc_r_cr << 4) |
		(fmt->bpc_b_cb << 2) | (fmt->bpc_g_y << 0);

	if (flags & DPU_SSPP_ROT_90)
		src_format |= BIT(11); /* ROT90 */

	if (fmt->alpha_enable && fmt->fetch_type == MDP_PLANE_INTERLEAVED)
		src_format |= BIT(8); /* SRCC3_EN */

	if (flags & DPU_SSPP_SOLID_FILL)
		src_format |= BIT(22);

	unpack = (fmt->element[3] << 24) | (fmt->element[2] << 16) |
		(fmt->element[1] << 8) | (fmt->element[0] << 0);
	src_format |= ((fmt->unpack_count - 1) << 12) |
		((fmt->flags & MSM_FORMAT_FLAG_UNPACK_TIGHT ? 1 : 0) << 17) |
		((fmt->flags & MSM_FORMAT_FLAG_UNPACK_ALIGN_MSB ? 1 : 0) << 18) |
		((fmt->bpp - 1) << 9);

	if (fmt->fetch_mode != MDP_FETCH_LINEAR) {
		u32 hbb = ctx->ubwc->highest_bank_bit - 13;
		u32 ctrl_val = 0;

		if (MSM_FORMAT_IS_UBWC(fmt))
			opmode |= MDSS_MDP_OP_BWC_EN;
		src_format |= (fmt->fetch_mode & 3) << 30; /*FRAME_FORMAT */

		if (ctx->ubwc->ubwc_enc_version > UBWC_6_0) {
			DRM_WARN_ONCE("Unsupported UBWC version %x\n", ctx->ubwc->ubwc_enc_version);
		} else if (ctx->ubwc->ubwc_enc_version >= UBWC_5_0) {
			if (!MSM_FORMAT_IS_YUV(fmt)) {
				ctrl_val = BIT(30);
				if (!MSM_FORMAT_IS_DX(fmt)) /* and not FP16, but it's unsupported */
					ctrl_val |= BIT(31);
			}
			/* SDE also sets bits for lossy formats, but we don't support them yet */
		} else if (ctx->ubwc->ubwc_enc_version >= UBWC_4_0) {
			ctrl_val = MSM_FORMAT_IS_YUV(fmt) ? 0 : BIT(30);
		} else if (ctx->ubwc->ubwc_enc_version >= UBWC_3_0) {

Annotation

Implementation Notes