From nobody Sun Sep 7 04:31:58 2025 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 62B4126D4C0 for ; Mon, 28 Jul 2025 13:15:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753708542; cv=none; b=V6FzuL0nQH32EeZ3HUnnTv/k6pSwWQdLobrST5snRDj0D9dxXbCF55BrMIWRtQRX0Rnw5EJsB+amgiWNgSVAkxCr5t5xj7w1ng8SB9EeeNf7XyWYH1jAFZSgxAhF3S8srZFuKe7T2jRqSJMMxPaCcQU7uNuYmqbtazLHUDNZgm8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753708542; c=relaxed/simple; bh=CF4TPmOyKCuR1vONvBUPDXaEUNdePxwbzP99ZGSmrmQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=C6AK/xYxuHQ+zb2uQLWu7mVIFiAu8X7yo6cuJ5AY1Dx+bjo2zLOTNL7UIlICbL0KPwUF+/zSzm1TFsLRNs6z8g/uPmJtwlwS+HkKB0DdFJe7sjzC5Z9VReNYLeNqrRYy7/vWhCqf9nznmJROynaeWYpcHpyNQlrggFJIYIrNCXE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=AqQY/dPY; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="AqQY/dPY" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-74b54cead6cso2833995b3a.1 for ; Mon, 28 Jul 2025 06:15:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1753708540; x=1754313340; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=4X9gMtrXb7FnTuL7OxdpBsAZ9YfPLCWw/9fwnW/EYKc=; b=AqQY/dPYxFjgCGp7Em/V7RcS9wuHv9zoCzxofpvKH45+2lqU/sLoBRJ4LeTfCRdUrg SdAaLePoS9i3B54SyNPILdSw/xuqN2corI8bgV/qmZ0NzWTO0vk0/GrhfWGbTU/H8MI+ fO+aLYmdnjPJIiaRW0yWAtemYpAH0uhobakfGrVOualKX1bKTrLQLnzMDpNzWWRd5MgS 4XIK8cvkbMrDpEpE7lU7V2QBlBry79JREbit3k45/WDUBRgeTVVI50Pxk5VSO9s0ID8c Sm7esVqa34VaV9iRe0BrCFpkfhCx1W5+VGJPfHg4WWGXoUoK+MiJ/lEJlGtFPtQv+VJf YYXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753708540; x=1754313340; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4X9gMtrXb7FnTuL7OxdpBsAZ9YfPLCWw/9fwnW/EYKc=; b=t2PEtVkp/ClcU5jfSV4rhJmB9mqQEdj4yR9nL+frOYJB+/Pfng47rlQaTtSfVJwyaA 6mL9syLYkoZL5+pEDeU/siMCbZNhjK7eG84bR5i+rTrxyc3NcCJNg8N0Dm8slx5xfvNq YvPdtWnoKmy8SvmcGrLLQZ1945m+nqjXAZztGKqd8yJYA+XT3aqZDR4uVLkqzfOwe88n 5/g8zMyTyFy7vpq/4tvWPn4HRizQDHdDa30zrzyFwN3s0J1tzz+bufKTWnLpqRhSnWv4 9hEMAAJvkeAsVR10pUB41nLw5kOB1ZOBqe28hiWmq9h/OlSK0LsRQDghK2AGXK2qaPjO ypmg== X-Forwarded-Encrypted: i=1; AJvYcCUyTpFrDZwyVPBSquui2L8q/qWonHKvIchcRCiJQupBGX0qbqoX9exwbJYTdlEKdShJB+Csp5/L1hUSTO4=@vger.kernel.org X-Gm-Message-State: AOJu0YxCD0ElqulPUdZERB2k0G23SYpMd0ZyG8mWFAYiFe9X3m3mklI8 UxAWN2jLKj+r7rPzCqtagO3cb6BH10DKd0+vA9gd7dY7wQ4SVbx0HHdICwP8InnzHeM= X-Gm-Gg: ASbGncucDL3HGiQWg/mtrU99XhKwEt2eCSIToqedqoSPTYvZXit6CCPgNYRD8+AU0Ng rJTh3NT89xgwXaYhWrzZ6aKInKWtYFz3aasNL7PSDi4AhcVZT4YM8pvVk0m2apLOfhtua1PQqdk fJvhHg+9N1cZC0LUG5KCq4Nrn1fM/R9BZjaAri3t1EbF7sr2vF/Ls1d8UZ8w0kHPIu7NRuyeINo lN9RvzjJm/vWQ6FL05iApT26d6HxSDoxS3ixiyMJXPyEgLC37lUHdGD54p6r2rvdmYfwocIkk3/ GNzO1+l3ReQISriI3BtYAQ9xfrKOHKNtvDsQBi3w6mUJNNRg1XuMs0oHcGTN2oREYYiYMPeucRe D+FGsREMOQM0pyMCJ1g== X-Google-Smtp-Source: AGHT+IHEkSAYyjZT4VNq7APpGgYHFTvAHWKfzG/ELkQoEDWy4X8OiOz3JWfDKavY/t9jLc7fjIEXjA== X-Received: by 2002:a05:6a00:4650:b0:730:9946:5973 with SMTP id d2e1a72fcca58-763358483d2mr17156091b3a.5.1753708539621; Mon, 28 Jul 2025 06:15:39 -0700 (PDT) Received: from [127.0.1.1] ([112.64.60.64]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-76408c0287fsm5590318b3a.47.2025.07.28.06.15.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Jul 2025 06:15:39 -0700 (PDT) From: Jun Nie Date: Mon, 28 Jul 2025 21:14:33 +0800 Subject: [PATCH v13 09/12] drm/msm/dpu: blend pipes per mixer pairs config Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250728-v6-16-rc2-quad-pipe-upstream-v13-9-954e4917fe4f@linaro.org> References: <20250728-v6-16-rc2-quad-pipe-upstream-v13-0-954e4917fe4f@linaro.org> In-Reply-To: <20250728-v6-16-rc2-quad-pipe-upstream-v13-0-954e4917fe4f@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter , Jessica Zhang Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jun Nie , Dmitry Baryshkov X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1753708472; l=5682; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=CF4TPmOyKCuR1vONvBUPDXaEUNdePxwbzP99ZGSmrmQ=; b=AqyfvXqypj2NxL0MC/YtWgC4WgzNfT9Hsjf83uDvjhK/TGjgIQbWsD2VuIJOKPYNAT4KhKQrZ VC9sXNk2RH0AWqQx3F/m3xP8LLQuhgK4WitOhn9GeRkvqtCYVP5f2GL X-Developer-Key: i=jun.nie@linaro.org; a=ed25519; pk=MNiBt/faLPvo+iJoP1hodyY2x6ozVXL8QMptmsKg3cc= Currently, only 2 pipes are used at most for a plane. A stage structure describes the configuration for a mixer pair. So only one stage is needed for current usage cases. The quad-pipe case will be added in future and 2 stages are used in the case. So extend the stage to an array with array size STAGES_PER_PLANE and blend pipes per mixer pair with configuration in the stage structure. Signed-off-by: Jun Nie Reviewed-by: Dmitry Baryshkov Reviewed-by: Jessica Zhang --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 49 ++++++++++++++++++-------= ---- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h | 3 +- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm= /disp/dpu1/dpu_crtc.c index 30fbd7565b82c6b6b13dc3ec0f4c91328a8e94c9..c7dc5b47ae18ebd78de30d2a060= 5caa7dd547850 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -400,7 +400,7 @@ static void _dpu_crtc_program_lm_output_roi(struct drm_= crtc *crtc) static void _dpu_crtc_blend_setup_pipe(struct drm_crtc *crtc, struct drm_plane *plane, struct dpu_crtc_mixer *mixer, - u32 num_mixers, + u32 lms_in_pair, enum dpu_stage stage, const struct msm_format *format, uint64_t modifier, @@ -434,7 +434,7 @@ static void _dpu_crtc_blend_setup_pipe(struct drm_crtc = *crtc, stage_cfg->multirect_index[stage][stage_idx] =3D pipe->multirect_index; =20 /* blend config update */ - for (lm_idx =3D 0; lm_idx < num_mixers; lm_idx++) + for (lm_idx =3D 0; lm_idx < lms_in_pair; lm_idx++) mixer[lm_idx].lm_ctl->ops.update_pending_flush_sspp(mixer[lm_idx].lm_ctl= , sspp_idx); } =20 @@ -449,7 +449,7 @@ static void _dpu_crtc_blend_setup_mixer(struct drm_crtc= *crtc, struct dpu_plane_state *pstate =3D NULL; const struct msm_format *format; struct dpu_hw_ctl *ctl =3D mixer->lm_ctl; - u32 lm_idx, i; + u32 lm_idx, stage, i, pipe_idx, head_pipe_in_stage, lms_in_pair; bool bg_alpha_enable =3D false; DECLARE_BITMAP(active_fetch, SSPP_MAX); DECLARE_BITMAP(active_pipes, SSPP_MAX); @@ -472,16 +472,25 @@ static void _dpu_crtc_blend_setup_mixer(struct drm_cr= tc *crtc, if (pstate->stage =3D=3D DPU_STAGE_BASE && format->alpha_enable) bg_alpha_enable =3D true; =20 - for (i =3D 0; i < PIPES_PER_PLANE; i++) { - if (!pstate->pipe[i].sspp) - continue; - set_bit(pstate->pipe[i].sspp->idx, active_fetch); - set_bit(pstate->pipe[i].sspp->idx, active_pipes); - _dpu_crtc_blend_setup_pipe(crtc, plane, - mixer, cstate->num_mixers, - pstate->stage, - format, fb ? fb->modifier : 0, - &pstate->pipe[i], i, stage_cfg); + /* loop pipe per mixer pair with config in stage structure */ + for (stage =3D 0; stage < STAGES_PER_PLANE; stage++) { + head_pipe_in_stage =3D stage * PIPES_PER_STAGE; + for (i =3D 0; i < PIPES_PER_STAGE; i++) { + pipe_idx =3D i + head_pipe_in_stage; + if (!pstate->pipe[pipe_idx].sspp) + continue; + lms_in_pair =3D min(cstate->num_mixers - (stage * PIPES_PER_STAGE), + PIPES_PER_STAGE); + set_bit(pstate->pipe[pipe_idx].sspp->idx, active_fetch); + set_bit(pstate->pipe[pipe_idx].sspp->idx, active_pipes); + _dpu_crtc_blend_setup_pipe(crtc, plane, + &mixer[head_pipe_in_stage], + lms_in_pair, + pstate->stage, + format, fb ? fb->modifier : 0, + &pstate->pipe[pipe_idx], i, + &stage_cfg[stage]); + } } =20 /* blend config update */ @@ -517,7 +526,7 @@ static void _dpu_crtc_blend_setup(struct drm_crtc *crtc) struct dpu_crtc_mixer *mixer =3D cstate->mixers; struct dpu_hw_ctl *ctl; struct dpu_hw_mixer *lm; - struct dpu_hw_stage_cfg stage_cfg; + struct dpu_hw_stage_cfg stage_cfg[STAGES_PER_PLANE]; DECLARE_BITMAP(active_lms, LM_MAX); int i; =20 @@ -538,10 +547,10 @@ static void _dpu_crtc_blend_setup(struct drm_crtc *cr= tc) } =20 /* initialize stage cfg */ - memset(&stage_cfg, 0, sizeof(struct dpu_hw_stage_cfg)); + memset(&stage_cfg, 0, sizeof(stage_cfg)); memset(active_lms, 0, sizeof(active_lms)); =20 - _dpu_crtc_blend_setup_mixer(crtc, dpu_crtc, mixer, &stage_cfg); + _dpu_crtc_blend_setup_mixer(crtc, dpu_crtc, mixer, stage_cfg); =20 for (i =3D 0; i < cstate->num_mixers; i++) { ctl =3D mixer[i].lm_ctl; @@ -562,13 +571,17 @@ static void _dpu_crtc_blend_setup(struct drm_crtc *cr= tc) mixer[i].mixer_op_mode, ctl->idx - CTL_0); =20 + /* + * call dpu_hw_ctl_setup_blendstage() to blend layers per stage cfg. + * stage data is shared between PIPES_PER_STAGE pipes. + */ if (ctl->ops.setup_blendstage) ctl->ops.setup_blendstage(ctl, mixer[i].hw_lm->idx, - &stage_cfg); + &stage_cfg[i / PIPES_PER_STAGE]); =20 if (lm->ops.setup_blendstage) lm->ops.setup_blendstage(lm, mixer[i].hw_lm->idx, - &stage_cfg); + &stage_cfg[i / PIPES_PER_STAGE]); } } =20 diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h b/drivers/gpu/drm/= msm/disp/dpu1/dpu_hw_mdss.h index 9f75b497aa0c939296207d58dde32028d0a76a6d..e4875a1f638db6f1983d9c51cb3= 99319d27675e9 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h @@ -34,8 +34,9 @@ #define DPU_MAX_PLANES 4 #endif =20 -#define PIPES_PER_PLANE 2 +#define STAGES_PER_PLANE 1 #define PIPES_PER_STAGE 2 +#define PIPES_PER_PLANE (PIPES_PER_STAGE * STAGES_PER_PLANE) #ifndef DPU_MAX_DE_CURVES #define DPU_MAX_DE_CURVES 3 #endif --=20 2.34.1