All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paloma Arellano <quic_parellan@quicinc.com>
To: <freedreno@lists.freedesktop.org>
Cc: Paloma Arellano <quic_parellan@quicinc.com>,
	<linux-arm-msm@vger.kernel.org>,
	<dri-devel@lists.freedesktop.org>, <robdclark@gmail.com>,
	<seanpaul@chromium.org>, <swboyd@chromium.org>,
	<dmitry.baryshkov@linaro.org>, <quic_abhinavk@quicinc.com>,
	<quic_jesszhan@quicinc.com>, <quic_khsieh@quicinc.com>,
	<marijn.suijten@somainline.org>, <neil.armstrong@linaro.org>
Subject: [PATCH v5 18/19] drm/msm/dpu: reserve CDM blocks for DP if mode is YUV420
Date: Thu, 22 Feb 2024 11:40:03 -0800	[thread overview]
Message-ID: <20240222194025.25329-19-quic_parellan@quicinc.com> (raw)
In-Reply-To: <20240222194025.25329-1-quic_parellan@quicinc.com>

Reserve CDM blocks for DP if the mode format is YUV420. Currently this
reservation only works for writeback and DP if the format is YUV420. But
this can be easily extented to other YUV formats for DP.

Changes in v2:
	- Minor code simplification

Signed-off-by: Paloma Arellano <quic_parellan@quicinc.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 22 +++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
index 84778adc7f791..e636215c8f834 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
@@ -635,6 +635,7 @@ static int dpu_encoder_virt_atomic_check(
 	struct dpu_kms *dpu_kms;
 	struct drm_display_mode *adj_mode;
 	struct msm_display_topology topology;
+	struct msm_display_info *disp_info;
 	struct dpu_global_state *global_state;
 	struct drm_framebuffer *fb;
 	struct drm_dsc_config *dsc;
@@ -651,6 +652,7 @@ static int dpu_encoder_virt_atomic_check(
 	DPU_DEBUG_ENC(dpu_enc, "\n");
 
 	priv = drm_enc->dev->dev_private;
+	disp_info = &dpu_enc->disp_info;
 	dpu_kms = to_dpu_kms(priv->kms);
 	adj_mode = &crtc_state->adjusted_mode;
 	global_state = dpu_kms_get_global_state(crtc_state->state);
@@ -678,21 +680,24 @@ static int dpu_encoder_virt_atomic_check(
 	topology = dpu_encoder_get_topology(dpu_enc, dpu_kms, adj_mode, crtc_state, dsc);
 
 	/*
-	 * Use CDM only for writeback at the moment as other interfaces cannot handle it.
-	 * if writeback itself cannot handle cdm for some reason it will fail in its atomic_check()
+	 * Use CDM only for writeback or DP at the moment as other interfaces cannot handle it.
+	 * If writeback itself cannot handle cdm for some reason it will fail in its atomic_check()
 	 * earlier.
 	 */
-	if (dpu_enc->disp_info.intf_type == INTF_WB && conn_state->writeback_job) {
+	if (disp_info->intf_type == INTF_WB && conn_state->writeback_job) {
 		fb = conn_state->writeback_job->fb;
 
 		if (fb && DPU_FORMAT_IS_YUV(to_dpu_format(msm_framebuffer_format(fb))))
 			topology.needs_cdm = true;
-		if (topology.needs_cdm && !dpu_enc->cur_master->hw_cdm)
-			crtc_state->mode_changed = true;
-		else if (!topology.needs_cdm && dpu_enc->cur_master->hw_cdm)
-			crtc_state->mode_changed = true;
+	} else if (disp_info->intf_type == INTF_DP) {
+		if (msm_dp_is_yuv_420_enabled(priv->dp[disp_info->h_tile_instance[0]], adj_mode))
+			topology.needs_cdm = true;
 	}
 
+	if (topology.needs_cdm && !dpu_enc->cur_master->hw_cdm)
+		crtc_state->mode_changed = true;
+	else if (!topology.needs_cdm && dpu_enc->cur_master->hw_cdm)
+		crtc_state->mode_changed = true;
 	/*
 	 * Release and Allocate resources on every modeset
 	 * Dont allocate when active is false.
@@ -1133,7 +1138,8 @@ static void dpu_encoder_virt_atomic_mode_set(struct drm_encoder *drm_enc,
 
 	dpu_enc->dsc_mask = dsc_mask;
 
-	if (dpu_enc->disp_info.intf_type == INTF_WB && conn_state->writeback_job) {
+	if ((dpu_enc->disp_info.intf_type == INTF_WB && conn_state->writeback_job) ||
+	    dpu_enc->disp_info.intf_type == INTF_DP) {
 		struct dpu_hw_blk *hw_cdm = NULL;
 
 		dpu_rm_get_assigned_resources(&dpu_kms->rm, global_state,
-- 
2.39.2


  parent reply	other threads:[~2024-02-22 19:41 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22 19:39 [PATCH v5 00/19] Add support for CDM over DP Paloma Arellano
2024-02-22 19:39 ` [PATCH v5 01/19] drm/msm/dpu: allow certain formats for CDM for DP Paloma Arellano
2024-02-22 19:39 ` [PATCH v5 02/19] drm/msm/dpu: add division of drm_display_mode's hskew parameter Paloma Arellano
2024-02-22 19:39 ` [PATCH v5 03/19] drm/msm/dpu: pass mode dimensions instead of fb size in CDM setup Paloma Arellano
2024-02-22 19:39 ` [PATCH v5 04/19] drm/msm/dpu: allow dpu_encoder_helper_phys_setup_cdm to work for DP Paloma Arellano
2024-02-22 19:39 ` [PATCH v5 05/19] drm/msm/dpu: move dpu_encoder_helper_phys_setup_cdm to dpu_encoder Paloma Arellano
2024-02-22 19:39 ` [PATCH v5 06/19] drm/msm/dp: rename wide_bus_en to wide_bus_supported Paloma Arellano
2024-02-22 19:39 ` [PATCH v5 07/19] drm/msm/dp: store mode YUV420 information to be used by rest of DP Paloma Arellano
2024-02-22 19:39 ` [PATCH v5 08/19] drm/msm/dp: check if VSC SDP is supported in DP programming Paloma Arellano
2024-02-22 19:39 ` [PATCH v5 09/19] drm/msm/dpu: move widebus logic to its own API Paloma Arellano
2024-02-22 19:39 ` [PATCH v5 10/19] drm/msm/dp: program config ctrl for YUV420 over DP Paloma Arellano
2024-02-22 19:39 ` [PATCH v5 11/19] drm/msm/dp: change clock related programming " Paloma Arellano
2024-02-22 19:39 ` [PATCH v5 12/19] drm/msm/dp: move parity calculation to dp_utils Paloma Arellano
2024-02-22 19:39 ` [PATCH v5 13/19] drm/msm/dp: add VSC SDP support for YUV420 over DP Paloma Arellano
2024-02-22 21:18   ` Dmitry Baryshkov
2024-02-22 21:28     ` Paloma Arellano
2024-02-22 21:56       ` Dmitry Baryshkov
2024-02-22 23:11         ` Paloma Arellano
2024-02-22 19:39 ` [PATCH v5 14/19] drm/msm/dpu: add support of new peripheral flush mechanism Paloma Arellano
2024-02-22 19:40 ` [PATCH v5 15/19] drm/msm/dp: enable SDP and SDE periph flush update Paloma Arellano
2024-02-22 19:40 ` [PATCH v5 16/19] drm/msm/dpu: modify encoder programming for CDM over DP Paloma Arellano
2024-02-22 19:40 ` [PATCH v5 17/19] drm/msm/dpu: modify timing engine programming for YUV420 " Paloma Arellano
2024-02-22 19:40 ` Paloma Arellano [this message]
2024-02-22 19:40 ` [PATCH v5 19/19] drm/msm/dp: allow YUV420 mode for DP connector when CDM available Paloma Arellano
2024-03-05  0:28 ` [PATCH v5 00/19] Add support for CDM over DP Dmitry Baryshkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240222194025.25329-19-quic_parellan@quicinc.com \
    --to=quic_parellan@quicinc.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=neil.armstrong@linaro.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=quic_jesszhan@quicinc.com \
    --cc=quic_khsieh@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=seanpaul@chromium.org \
    --cc=swboyd@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.