From patchwork Thu Dec 29 19:18:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13083735 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43402C3DA7D for ; Thu, 29 Dec 2022 19:19:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233335AbiL2TTF (ORCPT ); Thu, 29 Dec 2022 14:19:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233981AbiL2TTE (ORCPT ); Thu, 29 Dec 2022 14:19:04 -0500 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFA161409F for ; Thu, 29 Dec 2022 11:19:02 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id g13so28734322lfv.7 for ; Thu, 29 Dec 2022 11:19:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cnd05D4A7qypUQpKTFI55M9QVUdcSTf1oiTJTEwrnk4=; b=l3jOxWWzsZp77w0XV+UDHl+l4bC+5+p06teOdLkpQ6Q75ToPp0yp0akoATeA6wnHIj 5TIq3iBqcbwrGMRgx4DwYtbc6WbOJf94aQPM9r/YLwicI1NHjOQA0s1GOtYTMoTgX0BO C85hlEohsWjU9dNsKOLiEIXwRh/G28DV8nGOpmZJ+BTPYb1ZpFa5uHzQBJvpKjuxjvFk yQCaV1BvPN88bKojSV/k8c1I72xpS7ig8s2RHz+RD5ObADQsDY8aECm0TMdGSlR4ZhMk YLyHGqZLOuBxR4mAXSXjC9+6pBdpzzi5wJhO1DmgsOJnCmH2JtxNV/3tXs7seQOGphsy CK2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cnd05D4A7qypUQpKTFI55M9QVUdcSTf1oiTJTEwrnk4=; b=VM8NwHKtEs+wTSWkGkTCKYlN/MtyRqDaUf4lTycpk6MkA1MOAH1MYgVK5WdU2V+UKa 7Uum6e47TskQUUAjWIm0uf5bfa111yFAW14JaGpipWU+5eztRZOjtwKBC28npbyWmJUB iYSnT8QPmVP+RtbVevF3OHIYTPFoL2AMb8FoC8gbvLydz0KOEjBQukrXHQ1m46VcL/jk uZWnzhnbcH6y57dVmD+2nfXkFS5ykwMPRWnjJLxG90uCgVS24T6a1KzKm0NZcoT7QSID msMKRAtug+Hz0StWvNf1KzvigN/kQ9fFGcWiGQywjtbzRDS8sX/Z+rY2oxaGjnq0Iq+t 0oxA== X-Gm-Message-State: AFqh2krZGnRFti3VMCJr/bxq5MXZhB3ZR5q3F2qhjkDx5CRRTk9cQFmV pbxMFHl/Sy2DTN/D/WHuUuhzwg== X-Google-Smtp-Source: AMrXdXtdx9RcTbs19nR5rS3TUtJ6VHRyzjuL9qJ/tpdGn0d/7jSv/qqgw53B4W2b/dSCenOa3w4oYw== X-Received: by 2002:ac2:4bcc:0:b0:4b6:fae9:c9b7 with SMTP id o12-20020ac24bcc000000b004b6fae9c9b7mr8687857lfq.7.1672341541300; Thu, 29 Dec 2022 11:19:01 -0800 (PST) Received: from eriador.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id t13-20020ac24c0d000000b004cb10c151fasm1162295lfq.88.2022.12.29.11.19.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 11:19:00 -0800 (PST) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 03/27] drm/msm/dpu: move SSPP allocation to the RM Date: Thu, 29 Dec 2022 21:18:32 +0200 Message-Id: <20221229191856.3508092-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221229191856.3508092-1-dmitry.baryshkov@linaro.org> References: <20221229191856.3508092-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Follow the example of all other hw blocks and initialize SSPP blocks in Resource Manager. Signed-off-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar --- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 17 ++++------------- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 22 ++++++++++++++++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h | 12 ++++++++++++ 3 files changed, 38 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c index e1cdd71716f0..e443799de2c1 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -1275,8 +1275,6 @@ static void dpu_plane_destroy(struct drm_plane *plane) /* this will destroy the states as well */ drm_plane_cleanup(plane); - dpu_hw_sspp_destroy(pdpu->pipe_hw); - kfree(pdpu); } } @@ -1482,14 +1480,10 @@ struct drm_plane *dpu_plane_init(struct drm_device *dev, pdpu->pipe = pipe; /* initialize underlying h/w driver */ - pdpu->pipe_hw = dpu_hw_sspp_init(pipe, kms->mmio, kms->catalog); - if (IS_ERR(pdpu->pipe_hw)) { - DPU_ERROR("[%u]SSPP init failed\n", pipe); - ret = PTR_ERR(pdpu->pipe_hw); + pdpu->pipe_hw = dpu_rm_get_sspp(&kms->rm, pipe); + if (!pdpu->pipe_hw || !pdpu->pipe_hw->cap || !pdpu->pipe_hw->cap->sblk) { + DPU_ERROR("[%u]SSPP is invalid\n", pipe); goto clean_plane; - } else if (!pdpu->pipe_hw->cap || !pdpu->pipe_hw->cap->sblk) { - DPU_ERROR("[%u]SSPP init returned invalid cfg\n", pipe); - goto clean_sspp; } format_list = pdpu->pipe_hw->cap->sblk->format_list; @@ -1499,7 +1493,7 @@ struct drm_plane *dpu_plane_init(struct drm_device *dev, format_list, num_formats, supported_format_modifiers, type, NULL); if (ret) - goto clean_sspp; + goto clean_plane; pdpu->catalog = kms->catalog; @@ -1532,9 +1526,6 @@ struct drm_plane *dpu_plane_init(struct drm_device *dev, pipe, plane->base.id); return plane; -clean_sspp: - if (pdpu && pdpu->pipe_hw) - dpu_hw_sspp_destroy(pdpu->pipe_hw); clean_plane: kfree(pdpu); return ERR_PTR(ret); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c index 73b3442e7467..0668009cc9ed 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c @@ -8,6 +8,7 @@ #include "dpu_hw_lm.h" #include "dpu_hw_ctl.h" #include "dpu_hw_pingpong.h" +#include "dpu_hw_sspp.h" #include "dpu_hw_intf.h" #include "dpu_hw_wb.h" #include "dpu_hw_dspp.h" @@ -91,6 +92,9 @@ int dpu_rm_destroy(struct dpu_rm *rm) for (i = 0; i < ARRAY_SIZE(rm->hw_wb); i++) dpu_hw_wb_destroy(rm->hw_wb[i]); + for (i = 0; i < ARRAY_SIZE(rm->hw_sspp); i++) + dpu_hw_sspp_destroy(rm->hw_sspp[i]); + return 0; } @@ -255,6 +259,24 @@ int dpu_rm_init(struct dpu_rm *rm, rm->dsc_blks[dsc->id - DSC_0] = &hw->base; } + for (i = 0; i < cat->sspp_count; i++) { + struct dpu_hw_sspp *hw; + const struct dpu_sspp_cfg *sspp = &cat->sspp[i]; + + if (sspp->id < SSPP_NONE || sspp->id >= SSPP_MAX) { + DPU_ERROR("skip intf %d with invalid id\n", sspp->id); + continue; + } + + hw = dpu_hw_sspp_init(sspp->id, mmio, cat); + if (IS_ERR(hw)) { + rc = PTR_ERR(hw); + DPU_ERROR("failed sspp object creation: err %d\n", rc); + goto fail; + } + rm->hw_sspp[sspp->id - SSPP_NONE] = hw; + } + return 0; fail: diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h index 59de72b381f9..d62c2edb2460 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h @@ -21,6 +21,7 @@ struct dpu_global_state; * @hw_intf: array of intf hardware resources * @hw_wb: array of wb hardware resources * @dspp_blks: array of dspp hardware resources + * @hw_sspp: array of sspp hardware resources */ struct dpu_rm { struct dpu_hw_blk *pingpong_blks[PINGPONG_MAX - PINGPONG_0]; @@ -31,6 +32,7 @@ struct dpu_rm { 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]; + struct dpu_hw_sspp *hw_sspp[SSPP_MAX - SSPP_NONE]; }; /** @@ -108,5 +110,15 @@ static inline struct dpu_hw_wb *dpu_rm_get_wb(struct dpu_rm *rm, enum dpu_wb wb_ return rm->hw_wb[wb_idx - WB_0]; } +/** + * dpu_rm_get_sspp - Return a struct dpu_hw_sspp instance given it's index. + * @rm: DPU Resource Manager handle + * @sspp_idx: SSPP index + */ +static inline struct dpu_hw_sspp *dpu_rm_get_sspp(struct dpu_rm *rm, enum dpu_sspp sspp_idx) +{ + return rm->hw_sspp[sspp_idx - SSPP_NONE]; +} + #endif /* __DPU_RM_H__ */