Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp707869rdb; Thu, 30 Nov 2023 16:46:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IFW/FWsF4yq8J3CcJ0qxFPUKAucPy8NWXU1HARE7W1gBpMxDw+V8WZvaO3u3oLVroCjz+nH X-Received: by 2002:a05:6870:d90e:b0:1ea:137:7dba with SMTP id gq14-20020a056870d90e00b001ea01377dbamr27924414oab.10.1701391562494; Thu, 30 Nov 2023 16:46:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701391562; cv=none; d=google.com; s=arc-20160816; b=xuE8tVHe33XpV4LOXOnAkyMU5SBAwEq27a64GQEo9C5nKws7JABMVigznd4YQNz+hW IByDWePdBUPorraHTGTcFZMOWClhoTL32FifyQtRj/EH+DP9RFYmczt81uUomSK4jtgF MOB83v/Ljy5LVjfGZCHOdBHrRb5FcKheT9+YKAINOr8PtwLqIGK9+1lKyl5dhRrX9i+w unrPQ+ONvb1DbIch7hXo0ttTm+o65DiUdX6OKb77tbfPx7G27I+umz5n9VJdeO5IMnam 9Um5kyoCAn7iW0Fqulpx2SXBEfabQK+IRXtEtauxHHDLv5KPs1Kj6dBvegSMGdTKsbUd 9JxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=q2j5esPb16Qm1SQeGYN2u5lLfs7OVmpQAPEFRVX9gXQ=; fh=PV8mTOqHBITZfXWDdpO6auBL9NA1tybqIGg9DEXyy5s=; b=iPdUgexl50KvzDOAmUa7HsC8qCW6aCCKaGkSne8WpVdhESF++H1VTCm0AkFRm4Ni7R rfK0eSV9d9E/CPQszGfqFDEIA2qJy4tLw+0j0HePx0yLNHMf8Vkm3EDXaxojGtQUCJHC Kt09VwhDd8G5x/QJo/HUv2G5t4yf0shhMk82DSJQ1/zakPwJj2yYANYGdYhSy5TthiKn sBcn5P3ooeEzc25U4wc+KKrxEWMEZfekVsORTH7t2i9pZKCAFblVzQYkyor8GDlPqqxT zfxr2YZg95xyy+o2ZL+npfW5GhmQvBAPPHqR1sSlPZO9MAkwASxuMMLXrszeSuQHdURJ aHyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="WpDLp+a/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id q63-20020a634342000000b005c1b323da1bsi2416166pga.695.2023.11.30.16.46.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 16:46:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="WpDLp+a/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 4509F80A22F2; Thu, 30 Nov 2023 16:45:52 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377472AbjLAApi (ORCPT + 99 others); Thu, 30 Nov 2023 19:45:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377451AbjLAAph (ORCPT ); Thu, 30 Nov 2023 19:45:37 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E95A410D0; Thu, 30 Nov 2023 16:45:42 -0800 (PST) Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AUNPPG4008774; Fri, 1 Dec 2023 00:45:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=q2j5esPb16Qm1SQeGYN2u5lLfs7OVmpQAPEFRVX9gXQ=; b=WpDLp+a/mwOY/1j+hS4unOA/Uimn4mimn8/zWSXKnhZFdADAjBvffbjfjp9RLLjlyoQM cTHg6zt1BOTlaQOMZPLoES8PhKWSqmdQJu8CwrES8Y3GUh3IhttTR8pkLI3lLt+VZvvo cpgNzvTN/iJcg5RY1BJdmP6gJUXAAoccrOqwg4uNB3V0ouscPB3VZtKFCRRp7J8Yo7mk +gAnkBCm9lfRE4YAx5BIpC7zs5DcTj9mgVIcsyeBxmuhg6hPe8ityrV1RG0+vEo3KU13 XZwqsOPmeO4YR8qYdzEZIjxH+tFOZ/3Cm4yNLGb91czNVunEVYpSCgfgwQJCMkXjxJDK Rg== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3upjdqb01e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 01 Dec 2023 00:45:28 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3B10jSEv011158 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 1 Dec 2023 00:45:28 GMT Received: from [10.71.109.77] (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Thu, 30 Nov 2023 16:45:27 -0800 Message-ID: Date: Thu, 30 Nov 2023 16:45:27 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH 13/16] drm/msm/dpu: reserve cdm blocks for writeback in case of YUV output Content-Language: en-US To: Dmitry Baryshkov CC: , Rob Clark , "Sean Paul" , Marijn Suijten , "David Airlie" , Daniel Vetter , , , , , , References: <20230830224910.8091-1-quic_abhinavk@quicinc.com> <20230830224910.8091-14-quic_abhinavk@quicinc.com> From: Abhinav Kumar In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: dPc8K0vqW-aMpWJIqgCo2jrE4JuKkAvL X-Proofpoint-ORIG-GUID: dPc8K0vqW-aMpWJIqgCo2jrE4JuKkAvL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-30_25,2023-11-30_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 adultscore=0 mlxlogscore=713 lowpriorityscore=0 clxscore=1015 spamscore=0 suspectscore=0 impostorscore=0 bulkscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2312010004 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 30 Nov 2023 16:45:52 -0800 (PST) On 8/30/2023 5:23 PM, Dmitry Baryshkov wrote: > On Thu, 31 Aug 2023 at 01:50, Abhinav Kumar wrote: >> >> Reserve CDM blocks for writeback if the format of the output fb >> is YUV. At the moment, the reservation is done only for writeback >> but can easily be extended by relaxing the checks once other >> interfaces are ready to output YUV. >> >> Signed-off-by: Abhinav Kumar >> --- >> drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 35 ++++++++++++++++++++- >> 1 file changed, 34 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c >> index 1b1e07292a9e..7a3d179bdfba 100644 >> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c >> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c >> @@ -16,6 +16,7 @@ >> #include >> #include >> #include >> +#include >> >> #include "msm_drv.h" >> #include "dpu_kms.h" >> @@ -615,9 +616,11 @@ static int dpu_encoder_virt_atomic_check( >> struct drm_display_mode *adj_mode; >> struct msm_display_topology topology; >> struct dpu_global_state *global_state; >> + struct drm_framebuffer *fb; >> struct drm_dsc_config *dsc; >> int i = 0; >> int ret = 0; >> + bool needs_cdm = false; >> >> if (!drm_enc || !crtc_state || !conn_state) { >> DPU_ERROR("invalid arg(s), drm_enc %d, crtc/conn state %d/%d\n", >> @@ -655,6 +658,22 @@ 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() >> + * earlier. >> + */ >> + if (dpu_enc->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)))) >> + needs_cdm = true; >> + if (needs_cdm && !dpu_enc->cur_master->hw_cdm) >> + crtc_state->mode_changed = true; >> + else if (!needs_cdm && dpu_enc->cur_master->hw_cdm) >> + crtc_state->mode_changed = true; >> + } > > What would be the (estimated) check for DP? > Originally we were planning a lot more but now we are going to start with the mode being drm_mode_is_420_only and use CDM for that. >> + >> /* >> * Release and Allocate resources on every modeset >> * Dont allocate when active is false. >> @@ -664,7 +683,7 @@ static int dpu_encoder_virt_atomic_check( >> >> if (!crtc_state->active_changed || crtc_state->enable) >> ret = dpu_rm_reserve(&dpu_kms->rm, global_state, >> - drm_enc, crtc_state, topology, false); >> + drm_enc, crtc_state, topology, needs_cdm); >> } >> >> trace_dpu_enc_atomic_check_flags(DRMID(drm_enc), adj_mode->flags); >> @@ -1126,6 +1145,20 @@ 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) { >> + struct dpu_hw_blk *hw_cdm = NULL; >> + struct drm_framebuffer *fb; >> + >> + fb = conn_state->writeback_job->fb; >> + >> + if (fb && DPU_FORMAT_IS_YUV(to_dpu_format(msm_framebuffer_format(fb)))) { > > You can drop all fb-related conditions here. If we have CDM, we know > that we asked for it. If we do not, it's because we do not need it. > hmmm .... let me do some testing with this and if it works I will make this change as well. Thanks. >> + dpu_rm_get_assigned_resources(&dpu_kms->rm, global_state, >> + drm_enc->base.id, DPU_HW_BLK_CDM, >> + &hw_cdm, 1); >> + } >> + dpu_enc->cur_master->hw_cdm = hw_cdm ? to_dpu_hw_cdm(hw_cdm) : NULL; >> + } >> + >> cstate = to_dpu_crtc_state(crtc_state); >> >> for (i = 0; i < num_lm; i++) { >> -- >> 2.40.1 >> > >