From patchwork Thu Oct 17 01:21:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jessica Zhang X-Patchwork-Id: 836840 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3EDECA2D; Thu, 17 Oct 2024 01:21:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729128097; cv=none; b=fgj+bz6pxqYnz2Qn4YokmQ3ndeBcuwGnrTMgbVYV37h0a/W38n6O0qlsmgz+XiH8T/r3CCa9D+RjjuxlaIhmQSs208KqQzzg97kiFZ7LdDobZbe2ejJer8+XaoCVogIiO/d1SXelY0ohMAe67VPKqOCEkOldNkEHCKQhkeQlGgQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729128097; c=relaxed/simple; bh=pEoerIfotvv8uYv+t7zNQ14NZg+XI6BshDvOg8ZCmLU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=FQs/mg8KDcMhwDWM+IB7N+qC/jI8vZ2YU/Cb/ulMEE2IF3IQDiMniBz+bxDgNVS/nAp86+l7ig1eudcBEf41YkN1DOofTakZYUrzPglzF8NFdPex1ScoWGXrtKHiYz5M5w6Ko+4Iva0gtHe2SRqKc59S+LE/lgtKfoORRSLz90g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=M/xPidMN; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="M/xPidMN" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49GJ4S6e012378; Thu, 17 Oct 2024 01:21:18 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= DX3yM739mZW6FO9ajqTxQJNsdppeAkhuz2OvTDewZ9Y=; b=M/xPidMNPg4oFsAn EonzsW8s9gjJ5nXEtD/YF2/egcowRzXq1p/2uDrUxJWqBz9M6NdCZOOASUTV2Yot xzwIFnPXNIN3E88VjvGKhmTLnI+mND2037mVt01AjI4I2/Fb5TJtgRDJjECik0iR 9xXdBSlWH71t4MVsLBRmq3bsQTcfDao8+PglY5tq3llNzIUMH+dn0M6Y+HhtBMgF vpWSdxl8ZxxNe48r6PA79rsacfMnEj0EkcajIu2SAluS2ya4geJOiy153Xm95HpZ 3SY3ik7yaEpLtqf5UYXzpZSbUK2R6Nht7EIkWsFfzMWT7N4WDzQg+zVrHJcrgIY5 LOqlrQ== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 42abbxtc6d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Oct 2024 01:21:18 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA02.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 49H1LGmj022706 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Oct 2024 01:21:16 GMT Received: from jesszhan-linux.qualcomm.com (10.80.80.8) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Wed, 16 Oct 2024 18:21:16 -0700 From: Jessica Zhang Date: Wed, 16 Oct 2024 18:21:08 -0700 Subject: [PATCH v3 02/23] drm: Add valid clones check Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <20241016-concurrent-wb-v3-2-a33cf9b93835@quicinc.com> References: <20241016-concurrent-wb-v3-0-a33cf9b93835@quicinc.com> In-Reply-To: <20241016-concurrent-wb-v3-0-a33cf9b93835@quicinc.com> To: Rob Clark , Dmitry Baryshkov , , Sean Paul , Marijn Suijten , "David Airlie" , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Simona Vetter , Simona Vetter CC: , , , , , Rob Clark , =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , "Jessica Zhang" X-Mailer: b4 0.15-dev-2a633 X-Developer-Signature: v=1; a=ed25519-sha256; t=1729128075; l=1696; i=quic_jesszhan@quicinc.com; s=20230329; h=from:subject:message-id; bh=pEoerIfotvv8uYv+t7zNQ14NZg+XI6BshDvOg8ZCmLU=; b=bEQylvcb+ku5lfCqbwpbcmCUo17qUGZFfHvJw/UM8x3H4lvYk0+xlVQFb3eTLmvK+0/hlygtN ZVBsq+5f+8qCEIhQXjbPNuQyovkuJ1RpoZvYijtfvuxfUvFsYKeIVAL X-Developer-Key: i=quic_jesszhan@quicinc.com; a=ed25519; pk=gAUCgHZ6wTJOzQa3U0GfeCDH7iZLlqIEPo4rrjfDpWE= X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 1SWUYLqxOpWpJ8rmRHQFS_F2fGf0M7YF X-Proofpoint-GUID: 1SWUYLqxOpWpJ8rmRHQFS_F2fGf0M7YF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 clxscore=1015 priorityscore=1501 impostorscore=0 mlxscore=0 mlxlogscore=959 bulkscore=0 spamscore=0 malwarescore=0 lowpriorityscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2410170008 Check that all encoders attached to a given CRTC are valid possible_clones of each other. Signed-off-by: Jessica Zhang --- 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; } /*