Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp73003pxb; Wed, 16 Feb 2022 22:10:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJx+3Y8+iP2vBr/a8l0E4eodX3cnMMLCILy4+ecMbk6L2Ttm1ubY6vgAOSmZYFNeQ9DJTp0b X-Received: by 2002:a50:baaa:0:b0:410:a098:2a7f with SMTP id x39-20020a50baaa000000b00410a0982a7fmr1074484ede.53.1645078251948; Wed, 16 Feb 2022 22:10:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645078251; cv=none; d=google.com; s=arc-20160816; b=G8kbwzNBNOSsmwcIJQeL8RT7PDdvnrY4k5bcfCCD+8mhZy5AtoSCL3wXbEVRKRi7Un P2vdTam8Cqk5nQ/Un/pm4UFSDAysQyoQOupRoNgHvlCplpwYC0eA95dQWA9LRcJuj2tY Y9XrYYiMoIfXCfnYc644i6HqRH9bGwBq/NJopW776dnwD/v0YceKus0+TehbUH+Mvem5 BUzqNaqiV8g0wda4j291JatxeGOA6eCUYH1379BDsdlVSrlH3BzK8tzUAPieXKqhEno4 PG9QqxJh7uJhEdvGHej6PdtvC9z7mbQVPwQHxzjWewTz7eOgrw77TMNFOC+b4XOtwlFD lbmA== 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=7c5qPhNtgRk69J0dGeUIKOWwKPD0CRs0eHIEIsCitqU=; b=tWIpEbO0GZvfEPVqRFQRNRiwREXFGJNsMPUHiS51NUCtOB3SZ+ljM42WfUKAIBUCP0 3MAyQo+gfnNki7j8jdYZtz/7KJg89ggGSTdE9iaPT6L+1IXAlzyC8ZpXPCvUPCOv3WzK 9NbGk+xBr1v19wPJjGf8qlRIXqWoDWjjkz4aHnv/Tqh/Fay3pM48UT1/eQjIZL5R/44G DDMjYHac7Yx7suMGjhGj14gyVItFTYQzu4HnJbXBuSfHiPuT+E9Mz+lY7a9sThYuQglc Sccu3P7yaFPtlgzEw8O8mGD+5lvHiDz1DbWiboqItSTc0tBIqJ8ED7yNeVojSxDTuXXd tg6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=uIcEcQbT; 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 10si1133291ejj.846.2022.02.16.22.10.28; Wed, 16 Feb 2022 22:10: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=qcdkim header.b=uIcEcQbT; 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 S232466AbiBQDOc (ORCPT + 99 others); Wed, 16 Feb 2022 22:14:32 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:52048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231329AbiBQDOb (ORCPT ); Wed, 16 Feb 2022 22:14:31 -0500 Received: from alexa-out-sd-01.qualcomm.com (alexa-out-sd-01.qualcomm.com [199.106.114.38]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 384FD137769; Wed, 16 Feb 2022 19:14:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1645067658; x=1676603658; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=7c5qPhNtgRk69J0dGeUIKOWwKPD0CRs0eHIEIsCitqU=; b=uIcEcQbTkfJFoJ/cnG8lAxucHfxuPMPAopyc++wHVkghBshpfXYhmNJP ETDiNNbmSuLxluY8XCW8aQlbXQ5wesxyp0DAPB0YwGmhoGaDABUhJORId 9o11wMTe+38wD29ibWOo8MjztAiG4SCTQqXNK9CmP4itksD/HkaQD3LvB c=; Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) by alexa-out-sd-01.qualcomm.com with ESMTP; 16 Feb 2022 19:14:17 -0800 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg01-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2022 19:14:16 -0800 Received: from nalasex01b.na.qualcomm.com (10.47.209.197) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15; Wed, 16 Feb 2022 19:14:16 -0800 Received: from [10.111.174.92] (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.19; Wed, 16 Feb 2022 19:14:13 -0800 Message-ID: Date: Wed, 16 Feb 2022 19:14:11 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [REPOST PATCH v4 11/13] drm/msm/disp/dpu1: Add DSC support in RM Content-Language: en-US To: Vinod Koul , Rob Clark CC: , Bjorn Andersson , David Airlie , Daniel Vetter , Jonathan Marek , Dmitry Baryshkov , Abhinav Kumar , , , References: <20220210103423.271016-1-vkoul@kernel.org> <20220210103423.271016-12-vkoul@kernel.org> From: Abhinav Kumar In-Reply-To: <20220210103423.271016-12-vkoul@kernel.org> 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 nalasex01b.na.qualcomm.com (10.47.209.197) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, 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 On 2/10/2022 2:34 AM, Vinod Koul wrote: > This add the bits in RM to enable the DSC blocks > > Reviewed-by: Dmitry Baryshkov > Signed-off-by: Vinod Koul > --Reviewed-by: Abhinav Kumar > drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 1 + > drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 56 +++++++++++++++++++++++++ > drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h | 1 + > 3 files changed, 58 insertions(+) > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h > index 2d385b4b7f5e..8f2fb667b05c 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h > @@ -146,6 +146,7 @@ struct dpu_global_state { > uint32_t ctl_to_enc_id[CTL_MAX - CTL_0]; > uint32_t intf_to_enc_id[INTF_MAX - INTF_0]; > uint32_t dspp_to_enc_id[DSPP_MAX - DSPP_0]; > + uint32_t dsc_to_enc_id[DSC_MAX - DSC_0]; > }; > > struct dpu_global_state > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c > index f9c83d6e427a..fbb24bb2b998 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c > @@ -11,6 +11,7 @@ > #include "dpu_hw_intf.h" > #include "dpu_hw_dspp.h" > #include "dpu_hw_merge3d.h" > +#include "dpu_hw_dsc.h" > #include "dpu_encoder.h" > #include "dpu_trace.h" > > @@ -75,6 +76,14 @@ int dpu_rm_destroy(struct dpu_rm *rm) > dpu_hw_intf_destroy(hw); > } > } > + for (i = 0; i < ARRAY_SIZE(rm->dsc_blks); i++) { > + struct dpu_hw_dsc *hw; > + > + if (rm->dsc_blks[i]) { > + hw = to_dpu_hw_dsc(rm->dsc_blks[i]); > + dpu_hw_dsc_destroy(hw); > + } > + } > > return 0; > } > @@ -221,6 +230,19 @@ int dpu_rm_init(struct dpu_rm *rm, > rm->dspp_blks[dspp->id - DSPP_0] = &hw->base; > } > > + for (i = 0; i < cat->dsc_count; i++) { > + struct dpu_hw_dsc *hw; > + const struct dpu_dsc_cfg *dsc = &cat->dsc[i]; > + > + hw = dpu_hw_dsc_init(dsc->id, mmio, cat); > + if (IS_ERR_OR_NULL(hw)) { > + rc = PTR_ERR(hw); > + DPU_ERROR("failed dsc object creation: err %d\n", rc); > + goto fail; > + } > + rm->dsc_blks[dsc->id - DSC_0] = &hw->base; > + } > + > return 0; > > fail: > @@ -476,6 +498,7 @@ static int _dpu_rm_reserve_intf( > } > > global_state->intf_to_enc_id[idx] = enc_id; > + > return 0; > } > > @@ -500,6 +523,28 @@ static int _dpu_rm_reserve_intf_related_hw( > return ret; > } > > +static int _dpu_rm_reserve_dsc(struct dpu_rm *rm, > + struct dpu_global_state *global_state, > + struct drm_encoder *enc, > + const struct msm_display_topology *top) > +{ > + int num_dsc = top->num_dsc; > + int i; > + > + /* check if DSC required are allocated or not */ > + for (i = 0; i < num_dsc; i++) { > + if (global_state->dsc_to_enc_id[i]) { > + DPU_ERROR("DSC %d is already allocated\n", i); > + return -EIO; > + } > + } > + > + for (i = 0; i < num_dsc; i++) > + global_state->dsc_to_enc_id[i] = enc->base.id; > + > + return 0; > +} > + > static int _dpu_rm_make_reservation( > struct dpu_rm *rm, > struct dpu_global_state *global_state, > @@ -526,6 +571,10 @@ static int _dpu_rm_make_reservation( > if (ret) > return ret; > > + ret = _dpu_rm_reserve_dsc(rm, global_state, enc, &reqs->topology); > + if (ret) > + return ret; > + > return ret; > } > > @@ -567,6 +616,8 @@ void dpu_rm_release(struct dpu_global_state *global_state, > ARRAY_SIZE(global_state->ctl_to_enc_id), enc->base.id); > _dpu_rm_clear_mapping(global_state->intf_to_enc_id, > ARRAY_SIZE(global_state->intf_to_enc_id), enc->base.id); > + _dpu_rm_clear_mapping(global_state->dsc_to_enc_id, > + ARRAY_SIZE(global_state->dsc_to_enc_id), enc->base.id); > } > > int dpu_rm_reserve( > @@ -640,6 +691,11 @@ int dpu_rm_get_assigned_resources(struct dpu_rm *rm, > hw_to_enc_id = global_state->dspp_to_enc_id; > max_blks = ARRAY_SIZE(rm->dspp_blks); > break; > + case DPU_HW_BLK_DSC: > + hw_blks = rm->dsc_blks; > + hw_to_enc_id = global_state->dsc_to_enc_id; > + max_blks = ARRAY_SIZE(rm->dsc_blks); > + break; > default: > DPU_ERROR("blk type %d not managed by rm\n", type); > return 0; > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h > index 1f12c8d5b8aa..278d2a510b80 100644 > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h > @@ -30,6 +30,7 @@ struct dpu_rm { > struct dpu_hw_blk *intf_blks[INTF_MAX - INTF_0]; > struct dpu_hw_blk *dspp_blks[DSPP_MAX - DSPP_0]; > struct dpu_hw_blk *merge_3d_blks[MERGE_3D_MAX - MERGE_3D_0]; > + struct dpu_hw_blk *dsc_blks[DSC_MAX - DSC_0]; > > uint32_t lm_max_width; > };