Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp51726pxb; Wed, 16 Feb 2022 21:32:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJw38IZq1v6HTA9FMT/ya5c21L/bAW8NthvNssGeB8AFvFWMiCIEcWoch1MQp7nTtj9O6Z6F X-Received: by 2002:a17:90b:1d07:b0:1b8:b862:6ff3 with SMTP id on7-20020a17090b1d0700b001b8b8626ff3mr1389790pjb.99.1645075947277; Wed, 16 Feb 2022 21:32:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645075947; cv=none; d=google.com; s=arc-20160816; b=kE7EJ1+3lBJrMYke37ySd/0wyFH+9d9pTy8znzqmLyHmPXH/4BLWX9gaBGs+HeoaQZ EWQVUZL69jG7YE94tQksYQgR/KEwJkSHQhJUyhv57tQMxGw8bbWzOyU7UV+Ri/ZQ0omq /LlgT3ZDe3MxpxaxEiDUvXdHCHExEpjIFzEsM/6i+foMzmXqThPcmuo5B+BYSXA9PQCi td0u10IhePjZrHLF7yTjGevN+556tALnNzITKTt5Wyi5Y30W0iLe/PiSy+Ol45S0pFbP pmwunjJGa3XCC8oQgmSbmR5bhURFc0GpcsFS6GJA9NajKZBwmDLHwd6fCGT2AvxP+dpW gftA== 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=kYvbaNX8KANDbWLuij66r+CS+FF5V2ytJdKK2SJ7z28=; b=PjCDeGQaSxmj1RT6qhwTRBvQQyEW18j5QziRM6NJUHy0A27C/w2+72PiqBLYuyPMUZ 6gSihzX+egunGMUbsJgjx/JXtIApviKY/JyHER5G147jb66kWng6gjk+1XeY5MKmWCzJ otwQCbHbqV5fIrkfR3eOAIioDA6283BZFnJ5XuMsHIjt80/Z2aLVCGE8nZUq/+9SyIP0 NITp0G0BSXRngtc5AhgdiYljN7oedrZuB8nOu5027pfChpXMu63k9+p6QLZ5n07wroSX fG3YNdMm/+OJYCDpYUxQBhdu04+jkiG7w6tKpK3h+IK4pM0SbS2XcdWqOgULa+zQcPlW jIpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=Xfl9EgAt; 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 h12si21557271plo.280.2022.02.16.21.32.10; Wed, 16 Feb 2022 21:32:27 -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=Xfl9EgAt; 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 S232711AbiBQDV4 (ORCPT + 99 others); Wed, 16 Feb 2022 22:21:56 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:46050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229554AbiBQDVx (ORCPT ); Wed, 16 Feb 2022 22:21:53 -0500 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55BB8149940; Wed, 16 Feb 2022 19:21:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1645068099; x=1676604099; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=kYvbaNX8KANDbWLuij66r+CS+FF5V2ytJdKK2SJ7z28=; b=Xfl9EgAtu98IOlaLif1NKJXxtQvfPHsmsXZbSph26d8mwsysEKBStG+q 431aOcu7p7lWHYlDOKLw1xxcMz4l/nyYWSlbqCSbjN6HfxvAfHenyLZOq 09UOIZsgI/sO/AM5/JdnM4B3f+h46/nvp4kMedbK6GZ+wUl2czI9BaydL Y=; Received: from unknown (HELO ironmsg03-sd.qualcomm.com) ([10.53.140.143]) by alexa-out-sd-02.qualcomm.com with ESMTP; 16 Feb 2022 19:21:39 -0800 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg03-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2022 19:21:38 -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:21:37 -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:21:35 -0800 Message-ID: Date: Wed, 16 Feb 2022 19:21:32 -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: nasanex01b.na.qualcomm.com (10.46.141.250) 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; > };