mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jessica Zhang <quic_jesszhan@quicinc.com>
To: Rob Clark <robdclark@gmail.com>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	<quic_abhinavk@quicinc.com>, Sean Paul <sean@poorly.run>,
	Marijn Suijten <marijn.suijten@somainline.org>,
	"David Airlie" <airlied@gmail.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Simona Vetter <simona@ffwll.ch>,
	Simona Vetter <simona.vetter@ffwll.ch>
Cc: quic_ebharadw@quicinc.com, linux-arm-msm@vger.kernel.org,
	dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org,
	linux-kernel@vger.kernel.org,
	"Rob Clark" <robdclark@chromium.org>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"Jessica Zhang" <quic_jesszhan@quicinc.com>
Subject: [PATCH v3 02/23] drm: Add valid clones check
Date: Wed, 16 Oct 2024 18:21:08 -0700	[thread overview]
Message-ID: <20241016-concurrent-wb-v3-2-a33cf9b93835@quicinc.com> (raw)
In-Reply-To: <20241016-concurrent-wb-v3-0-a33cf9b93835@quicinc.com>

Check that all encoders attached to a given CRTC are valid
possible_clones of each other.

Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
---

NOTE: Appropriate KUnit tests for this change will be posted in a
separate series
---
 drivers/gpu/drm/drm_atomic_helper.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 43cdf39019a44537794cc5a519d139b0cb77073c..cc4001804fdc6155e4200ce5830cdc74be201351 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -574,6 +574,25 @@ mode_valid(struct drm_atomic_state *state)
 	return 0;
 }
 
+static int drm_atomic_check_valid_clones(struct drm_atomic_state *state,
+					 struct drm_crtc *crtc)
+{
+	struct drm_encoder *drm_enc;
+	struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state,
+									  crtc);
+
+	drm_for_each_encoder_mask(drm_enc, crtc->dev, crtc_state->encoder_mask) {
+		if ((crtc_state->encoder_mask & drm_enc->possible_clones) !=
+		    crtc_state->encoder_mask) {
+			DRM_DEBUG("crtc%d failed valid clone check for mask 0x%x\n",
+				  crtc->base.id, crtc_state->encoder_mask);
+			return -EINVAL;
+		}
+	}
+
+	return 0;
+}
+
 /**
  * drm_atomic_helper_check_modeset - validate state object for modeset changes
  * @dev: DRM device
@@ -745,6 +764,10 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
 		ret = drm_atomic_add_affected_planes(state, crtc);
 		if (ret != 0)
 			return ret;
+
+		ret = drm_atomic_check_valid_clones(state, crtc);
+		if (ret != 0)
+			return ret;
 	}
 
 	/*

-- 
2.34.1


  parent reply	other threads:[~2024-10-17  1:21 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17  1:21 [PATCH v3 00/23] drm/msm/dpu: Add Concurrent Writeback Support for DPU 10.x+ Jessica Zhang
2024-10-17  1:21 ` [PATCH v3 01/23] drm: add clone mode check for CRTC Jessica Zhang
2024-10-17  1:21 ` Jessica Zhang [this message]
2024-10-17  1:21 ` [PATCH v3 03/23] drm/msm/dpu: get rid of struct dpu_rm_requirements Jessica Zhang
2024-10-31 21:29   ` Dmitry Baryshkov
2024-10-17  1:21 ` [PATCH v3 04/23] drm/msm/dpu: switch RM to use crtc_id rather than enc_id for allocation Jessica Zhang
2024-10-31 19:18   ` Abhinav Kumar
2024-10-17  1:21 ` [PATCH v3 05/23] drm/msm/dpu: move resource allocation to CRTC Jessica Zhang
2024-10-31 19:37   ` Abhinav Kumar
2024-10-31 19:53     ` Dmitry Baryshkov
2024-10-31 20:47   ` Dmitry Baryshkov
2024-10-17  1:21 ` [PATCH v3 06/23] drm/msm/dpu: fill CRTC resources in dpu_crtc.c Jessica Zhang
2024-10-31 19:46   ` Abhinav Kumar
2024-10-17  1:21 ` [PATCH v3 07/23] drm/msm/dpu: Add CWB entry to catalog for SM8650 Jessica Zhang
2024-10-17  1:21 ` [PATCH v3 08/23] drm/msm/dpu: Specify dedicated CWB pingpong blocks Jessica Zhang
2024-10-17  1:21 ` [PATCH v3 09/23] drm/msm/dpu: add devcoredumps for cwb registers Jessica Zhang
2024-10-17  1:21 ` [PATCH v3 10/23] drm/msm/dpu: Add dpu_hw_cwb abstraction for CWB block Jessica Zhang
2024-12-24 16:31   ` Dmitry Baryshkov
2024-10-17  1:21 ` [PATCH v3 11/23] drm/msm/dpu: add CWB support to dpu_hw_wb Jessica Zhang
2024-10-17  1:21 ` [PATCH v3 12/23] drm/msm/dpu: Add RM support for allocating CWB Jessica Zhang
2024-10-17  1:21 ` [PATCH v3 13/23] drm/msm/dpu: Add CWB to msm_display_topology Jessica Zhang
2024-10-17  1:21 ` [PATCH v3 14/23] drm/msm/dpu: Require modeset if clone mode status changes Jessica Zhang
2024-10-17  1:21 ` [PATCH v3 15/23] drm/msm/dpu: Fail atomic_check if CWB and CDM are enabled Jessica Zhang
2024-10-17  1:21 ` [PATCH v3 16/23] drm/msm/dpu: Reserve resources for CWB Jessica Zhang
2024-10-17  1:21 ` [PATCH v3 17/23] drm/msm/dpu: Configure CWB in writeback encoder Jessica Zhang
2024-10-17  1:21 ` [PATCH v3 18/23] drm/msm/dpu: Support CWB in dpu_hw_ctl Jessica Zhang
2024-10-17  1:21 ` [PATCH v3 19/23] drm/msm/dpu: Adjust writeback phys encoder setup for CWB Jessica Zhang
2024-10-17  1:21 ` [PATCH v3 20/23] drm/msm/dpu: Start frame done timer after encoder kickoff Jessica Zhang
2024-10-17  1:21 ` [PATCH v3 21/23] drm/msm/dpu: Skip trigger flush and start for CWB Jessica Zhang
2024-10-17  1:21 ` [PATCH v3 22/23] drm/msm/dpu: Reorder encoder kickoff " Jessica Zhang
2024-10-17  1:21 ` [PATCH v3 23/23] drm/msm/dpu: Set possible clones for all encoders Jessica Zhang
2024-10-17 14:31 ` [PATCH v3 00/23] drm/msm/dpu: Add Concurrent Writeback Support for DPU 10.x+ Maxime Ripard
2024-10-17 18:15   ` Abhinav Kumar

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=20241016-concurrent-wb-v3-2-a33cf9b93835@quicinc.com \
    --to=quic_jesszhan@quicinc.com \
    --cc=airlied@gmail.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=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=marijn.suijten@somainline.org \
    --cc=mripard@kernel.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=quic_ebharadw@quicinc.com \
    --cc=robdclark@chromium.org \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    --cc=simona.vetter@ffwll.ch \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=ville.syrjala@linux.intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®