Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp483827rwb; Fri, 18 Nov 2022 04:26:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf4/lCCxOokfsU/EtuUGkEDKXHCbdcsx2TK+oZg9iQ86F9vrMyNeKD2zXUjz/qkwPjtk1V7W X-Received: by 2002:a62:16d0:0:b0:572:709f:7645 with SMTP id 199-20020a6216d0000000b00572709f7645mr7507594pfw.35.1668774411679; Fri, 18 Nov 2022 04:26:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668774411; cv=none; d=google.com; s=arc-20160816; b=YguOduMN1RG0q6w2CVWgg1uT6IxdWCd7LLCQgfTwXa7xyTu7j56uL4r4kH/xsxp1xO BLflCAAcbBZyNR0J10ctnD/jfIpfE+ltkAJ/5pyDCEE6Y7YO0l8Bsi30MMPHzp1cL/qw SGwK7r9qEqwTxRalFzF7WOS4Eq9tiPfJV7Aj+CYiDAhQ+c6mDZahLlyw/g2lYRJr83XJ So3rMydhfsv+90Glyf0P8xlIwDW2P8gQBCHZ8Gm50WXR63qqt8H/jht3ym3FgcV50HtW 5HukYAXeu6bSfl/VCP2mlTSBuKfoBUnqRg0D5aZrVQ0OAw7eA86mK1pVckSaTjI9v89B Musg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=FcBLrYDz5MLJ+JQbxLtt5oyeeAzeEZbn+lgGXcvd7CA=; b=YMYrRu+EOOXSJxA0h+9NfIAu5IqvZg7URdAtfm6/LlOnoyuej7hfED67LQuM1F/JGy /R5EUKyry7mLVVfA00/eiRlNKMEgavBtId6AzKtHG1h5hy6q+uZLuGOTwfJ1LxAGDDaI m1+ycsNq3VKSBtCwUMbo5Mfj5aMOW/ZlshT67pyUJ2GXn+NyPXybItcz6C93ta1R8zNu SNFdaieuMCb3L1Lx7rUf3SuWzN89SD0+QMyCM81KkyGfdY9WXSrKOrZ76IxjYjy3O3qe bV3U+Py37wWbQre2CaOj/tpHyvUCyUjHXOc0hQfq7tkWNGFLqf+sIMPvmto/9wInq40n ytWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=pYdCHEIO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i123-20020a625481000000b0052da2ea956csi3314435pfb.371.2022.11.18.04.26.40; Fri, 18 Nov 2022 04:26:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=pYdCHEIO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235292AbiKRMRN (ORCPT + 92 others); Fri, 18 Nov 2022 07:17:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235382AbiKRMQ7 (ORCPT ); Fri, 18 Nov 2022 07:16:59 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3143885EC2; Fri, 18 Nov 2022 04:16:59 -0800 (PST) Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AIBjdMG029423; Fri, 18 Nov 2022 12:16:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=qcppdkim1; bh=FcBLrYDz5MLJ+JQbxLtt5oyeeAzeEZbn+lgGXcvd7CA=; b=pYdCHEIOSejvvZaJXtigtufXDc5Qx9edu09VkiLwC9ZqRkpSXHKRVYIlb4QAB/aSJ32O dtMi9xGwjzf0LvOa5Hk4sTe3fhKA/jUe/DXa9ugelIOZ3HZDEj1LCzy3bn3woyZHMF2e dBEeCSThS+4Pu4YEM4DyKpb9/NBocYp6MWUvGTniy6rvo9fjQXeopykKHIpgNIeYZslb g8CVMKNJvg3O+o7kFW7vJL7f3638x7lP2W6qOmg+BU4QX0aXay8mb0l5fWjWKHUvt618 FRqPFNy7QgepcnnqFb9tei5qyD0Kyu8UQm6G0KidLUpvvKB08DIsb0LbZyTOq5XEsj/v Sw== Received: from apblrppmta02.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.18.19]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3kx0se9jxm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 18 Nov 2022 12:16:54 +0000 Received: from pps.filterd (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTP id 2AICGokZ013696; Fri, 18 Nov 2022 12:16:51 GMT Received: from pps.reinject (localhost [127.0.0.1]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTPS id 3kt4jkkc6j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 18 Nov 2022 12:16:51 +0000 Received: from APBLRPPMTA02.qualcomm.com (APBLRPPMTA02.qualcomm.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2AICGoTl013689; Fri, 18 Nov 2022 12:16:50 GMT Received: from kalyant-linux.qualcomm.com (kalyant-linux.qualcomm.com [10.204.66.210]) by APBLRPPMTA02.qualcomm.com (PPS) with ESMTP id 2AICGoN8013687; Fri, 18 Nov 2022 12:16:50 +0000 Received: by kalyant-linux.qualcomm.com (Postfix, from userid 94428) id 8EBF52F35; Fri, 18 Nov 2022 04:16:49 -0800 (PST) From: Kalyan Thota To: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org Cc: Kalyan Thota , linux-kernel@vger.kernel.org, robdclark@chromium.org, dianders@chromium.org, swboyd@chromium.org, quic_vpolimer@quicinc.com, dmitry.baryshkov@linaro.org, quic_abhinavk@quicinc.com Subject: [PATCH v3 1/3] drm/msm/disp/dpu1: pin 1 crtc to 1 encoder Date: Fri, 18 Nov 2022 04:16:45 -0800 Message-Id: <1668773807-19598-2-git-send-email-quic_kalyant@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1668773807-19598-1-git-send-email-quic_kalyant@quicinc.com> References: <1668773807-19598-1-git-send-email-quic_kalyant@quicinc.com> X-QCInternal: smtphost X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: t6XeefnkvIFNUrbioQQLbut3W0meHsXL X-Proofpoint-ORIG-GUID: t6XeefnkvIFNUrbioQQLbut3W0meHsXL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-18_02,2022-11-18_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 spamscore=0 mlxlogscore=999 lowpriorityscore=0 adultscore=0 bulkscore=0 phishscore=0 priorityscore=1501 suspectscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211180073 X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Pin each crtc with one encoder. This arrangement will disallow crtc switching between encoders and also will facilitate to advertise certain features on crtc based on encoder type. Changes in v1: - use drm_for_each_encoder macro while iterating through encoder list (Dmitry) Changes in v2: - make sure no encoder miss to have a crtc (Dmitry) - revisit various factors in deciding the crtc count such as num_mixers, num_sspp (Dmitry) Signed-off-by: Kalyan Thota --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 7a5fabc..4784db8 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -763,7 +763,7 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) drm_for_each_encoder(encoder, dev) num_encoders++; - max_crtc_count = min(catalog->mixer_count, num_encoders); + max_crtc_count = num_encoders; /* Create the planes, keeping track of one primary/cursor per crtc */ for (i = 0; i < catalog->sspp_count; i++) { @@ -795,22 +795,25 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) primary_planes[primary_planes_idx++] = plane; } - max_crtc_count = min(max_crtc_count, primary_planes_idx); + /* + * All the platforms should have at least 1 primary plane for an + * encoder. The below warn should help in setting up the catalog + */ + WARN_ON(num_encoders > primary_planes_idx); /* Create one CRTC per encoder */ - for (i = 0; i < max_crtc_count; i++) { + i = 0; + drm_for_each_encoder(encoder, dev) { crtc = dpu_crtc_init(dev, primary_planes[i], cursor_planes[i]); if (IS_ERR(crtc)) { ret = PTR_ERR(crtc); return ret; } priv->crtcs[priv->num_crtcs++] = crtc; + encoder->possible_crtcs = 1 << drm_crtc_index(crtc); + i++; } - /* All CRTCs are compatible with all encoders */ - drm_for_each_encoder(encoder, dev) - encoder->possible_crtcs = (1 << priv->num_crtcs) - 1; - return 0; } -- 2.7.4