From patchwork Fri Mar 10 00:56:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 661772 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 727F2C64EC4 for ; Fri, 10 Mar 2023 00:57:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229817AbjCJA5Y (ORCPT ); Thu, 9 Mar 2023 19:57:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbjCJA5X (ORCPT ); Thu, 9 Mar 2023 19:57:23 -0500 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93081FB255 for ; Thu, 9 Mar 2023 16:57:09 -0800 (PST) Received: by mail-lj1-x22d.google.com with SMTP id h9so3746340ljq.2 for ; Thu, 09 Mar 2023 16:57:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678409828; 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=2xQMaDi3BI5TkSG8DhQH3KNXQ/7LC3rKBxsZewJw5XU=; b=xnymGRANYgM/u3OlNLnUuuvum3Umtt5hz7hX+phGf0pFyKwuSl0HTKCEaQ0FaFSgwg 585KWt3XkSSVymtpZXu1QwOG5KCLUaCcPELrvoqyK8SqB+csMTvhCxTNahMQuumBkhO6 9H8xtaAnirjCh0u1YSgOfD+5dQj7kLDvxYRsYZL4kEcMOe/sf/WIAoOKc7/TcQ5rmPNt Vo+XcbXVZ8IfUUP92celkTEG6/cabVE8JePfg8ImBf1XCAh0nUiqgCH/oWUWK4gAbthu YOVMpe5pJ7WeYBPpfk8+QvokuHkE2svOmcdsxl42aBJs+4D770gBgk9myXBfnlsnfyid VNwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678409828; 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=2xQMaDi3BI5TkSG8DhQH3KNXQ/7LC3rKBxsZewJw5XU=; b=LrZAASqxi9kkPm+iPsi5c6YJL57hRpqIc3AfcH/XZqUTSVlqqphYYkYdcleUgaSqXH qQj5EOE9Uqne9pI+olJaX9zOg5YuUTLcNj7Bb1lrBY5wOeluraGnuGQ9tbSN0dJ9TWGu 9tLtKeI04OR53TPBSlPw/7BuM5f1okbrtBljQf1RK3D/vjds9Bld7HYp4kg47mxi+0Dl qxtZk1ltfJEBMbaZTrtRvnQ+wuJEGoIf9kQsPGcFMv31qHt+WZgGA/U2YqBhwboTtjtL APGdeALWM01KPTg+/Huuz6AdZUCzvtwlAgp4FEUjJx9THrMm4dtZAHMdE89cTUkGSM+x 7aoQ== X-Gm-Message-State: AO0yUKXy3FgEHk5URNMOp8ukZp9ziV38fdoP3FdR2RciNzNGt1laEYGy fgG/KpeIsWtpPNbm8g69rtv24hPAC83Cev92SMQ= X-Google-Smtp-Source: AK7set+Dnrc5+nIEvktYnPWNfizWmM9hfrJp/VTJaHBh/IVCTfRNgfssSWMsMhcZVh7/uDVt38jbyA== X-Received: by 2002:a05:651c:32c:b0:295:a7f3:9a03 with SMTP id b12-20020a05651c032c00b00295a7f39a03mr6123559ljp.7.1678409827805; Thu, 09 Mar 2023 16:57:07 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id m13-20020ac2428d000000b004d8540b947asm75280lfh.56.2023.03.09.16.57.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Mar 2023 16:57:07 -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 v5 02/32] drm/msm/dpu: move SSPP allocation to the RM Date: Fri, 10 Mar 2023 02:56:34 +0200 Message-Id: <20230310005704.1332368-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230310005704.1332368-1-dmitry.baryshkov@linaro.org> References: <20230310005704.1332368-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. Reviewed-by: Abhinav Kumar Signed-off-by: Dmitry Baryshkov --- 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 5a4578ab62a6..b054055f120b 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 396429e63756..53c644ca52ef 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__ */