From patchwork Tue Sep 24 22:59:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jessica Zhang X-Patchwork-Id: 13811347 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 D1B1E184543; Tue, 24 Sep 2024 23:00:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727218812; cv=none; b=njFQKi6M4rQEpqutjpdQzXGMK0SG8ktRuMY+GT9FAkc+MF/yRPhBzyG0tvWKwMrN17JBUWzfk1EUwidHyk+DqGugl/qOawcXvMWi9qG6OHsMVMR7MY3IJ0UKVL/C78jgD+vPQd98aDADcFOmB9aV6CkMXjl4YhhUFuIhgUUn0Fg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727218812; c=relaxed/simple; bh=xdBoFcUWvNSq5o8KmxPrNm+9PSYOVbtUzpN4xxjQMPo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=lbF5SOVM9yMueqNIAAy4GK0UuKJpVAVDZKL9iWnEQq8fzxDFLjlNOD+jReK9JZTpYlOtQ/1UgBvtFfrjikQL5wOeMp7YsTD2MgYSMKdqeeFX0Vu/g4ktW/gmnrxHJBzmNQ3M/jsTfwrBBzQ5nFeH8lLAkSySlN3CHMm5kY6euXk= 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=DA03RBZ9; arc=none smtp.client-ip=205.220.168.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="DA03RBZ9" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48OHrasT018535; Tue, 24 Sep 2024 22:59:55 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= SnS8OHPepCR63xBC9mC7floo3MuA94eVccX4LBAl6R0=; b=DA03RBZ90YBfydfw zbNiAkYnwvBltRv7NwdzaSqaMZ1UZPfYLZ5q6jf3glIklyVDOMCH2+RGVEFtbgcq fXHWkMrGDbKzsp8DR+AIFQRVb0H1Z6iGYrnLrK6pIA4uzRt/U9cKevxaOf7nQxx3 C5DSAVZzMxoR/EiaK5huMGX0sl5uZLZpOTXr2kMt2OtNEK9p3Y4uVqcnrcuQGjeO /HY4phKJ5WnKG5KjncM3x2BurNSU778sfXp4nDJlrHeJ4ts9qQjB8m4CAKo/kREQ hG3eps+uoodym36aeQLq1eAJqYNlACHghuU5Y9ezdUEiCDqH4BFc1y24tcdvMx6i zQMVKw== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 41sqakhu9n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Sep 2024 22:59:55 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA05.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 48OMxsbh007380 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 24 Sep 2024 22:59:54 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; Tue, 24 Sep 2024 15:59:54 -0700 From: Jessica Zhang Date: Tue, 24 Sep 2024 15:59:18 -0700 Subject: [PATCH v2 02/22] 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: <20240924-concurrent-wb-v2-2-7849f900e863@quicinc.com> References: <20240924-concurrent-wb-v2-0-7849f900e863@quicinc.com> In-Reply-To: <20240924-concurrent-wb-v2-0-7849f900e863@quicinc.com> To: Rob Clark , Dmitry Baryshkov , , Sean Paul , Marijn Suijten , "David Airlie" , Daniel Vetter , "Maarten Lankhorst" , Maxime Ripard , Thomas Zimmermann CC: , , , , , Rob Clark , =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , "Jessica Zhang" X-Mailer: b4 0.15-dev-99b12 X-Developer-Signature: v=1; a=ed25519-sha256; t=1727218793; l=1549; i=quic_jesszhan@quicinc.com; s=20230329; h=from:subject:message-id; bh=xdBoFcUWvNSq5o8KmxPrNm+9PSYOVbtUzpN4xxjQMPo=; b=LuXBkDjCAbqgESNEr6gEQIKY01V2i8vlWOPd7c5vDf4ZQSSDFwjNyf+dTxwr/D+m5d1NSbmO3 ej3sRl8vgutCQxFOcLEIp7lM6AUWMkn/BuS6Wc28o/NE+oFUjqHDeKk 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: p0HlManeeI0KKzKhnMHlMMi26OSX-mK4 X-Proofpoint-GUID: p0HlManeeI0KKzKhnMHlMMi26OSX-mK4 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 mlxscore=0 priorityscore=1501 bulkscore=0 impostorscore=0 suspectscore=0 phishscore=0 adultscore=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 mlxlogscore=922 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2408220000 definitions=main-2409240160 Check that all encoders attached to a given CRTC are valid possible_clones of each other. Signed-off-by: Jessica Zhang --- 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 43cdf39019a4..cc4001804fdc 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; } /*