From patchwork Wed Mar 24 15:00:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 408268 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C689FC433E3 for ; Wed, 24 Mar 2021 15:01:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 85A4A61A0A for ; Wed, 24 Mar 2021 15:01:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236415AbhCXPA4 (ORCPT ); Wed, 24 Mar 2021 11:00:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236360AbhCXPAf (ORCPT ); Wed, 24 Mar 2021 11:00:35 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB878C061763 for ; Wed, 24 Mar 2021 08:00:34 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id w37so32406171lfu.13 for ; Wed, 24 Mar 2021 08:00:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wYt5A6aqxsEgILETx0qelKpbEQ4Wrji7w4lLAkB91ok=; b=pwmrdmb0IoyHHmOJEO939WC9Iv1n+Yjc452EC5VmjxtnQM+CzQ8gF99xqbyuKKRslR uUfh+eTq/PrGyTGDd5lgwIVns6Olec6g8CT5KIwWpKm82zGWumXozASffCVQdzPe1E88 +yIUzvWvgtNdFI1FIeUPZLe5ZQY4mfyWRuHhqRUO4Jms0eKNkfbEt3X9dlyetAerFcTN NQ1zw2E58SsLdyJDYcSA7N7qsnAgg0QQpz00JxJIPbYrwRrKjpLdBDZZ1j21zAXHb7Lc /Yq+L3sWxrSAVubxwjt72tcQ9kplJ34dNPeqzyhaTGTVKq9Ah5X24GEZ9bneKf6AQR3D Gw0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wYt5A6aqxsEgILETx0qelKpbEQ4Wrji7w4lLAkB91ok=; b=MNHhnJ/igjIMet3A7x49Z6Oi+P0ZAvfeO57wE4L7ZgJj8A9tNyBzjrTBcAIVhK77sC B2tdPnRQMRZjug2Bvvij31KtZ72u4jq90O7Whe7x1ISn9Y1QK6tp5ShFtFNPifS/FRHx 4+yIXrv1UCz988sTG9s4yjpgTnAFYIyZFz9MKotXQUtbN6E8Pp+wD0AhqH3nCqYcrhPA W7YgR7IuoGArrNumFXfLv9rHD+P7K1aFhPr3DbBBNAtMEk+3M48Q/ek85hK86+zICFcS cMq0vT9z1spyaSEl3AQR5kTYOKouQkquHGdl3esIGJ6UGDPsgB3umXpRqiXN/FgFpi8H RKxg== X-Gm-Message-State: AOAM532y1jxYPxG4RFvbIJgJ5Uza9zq2vw/di1KoxH0gG5+8m6GROIZp 1fwFcOAx1Tq92gyNWR8Mh2NAwQ== X-Google-Smtp-Source: ABdhPJyb2px8p8Bw/1HYUNAfSXofxhsDrbqmwG3pNDouzsiD2G2SgWm/7QYjbAaakHQ+/ogrjhHdAA== X-Received: by 2002:ac2:53a1:: with SMTP id j1mr2286941lfh.298.1616598033077; Wed, 24 Mar 2021 08:00:33 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id p5sm252463lfe.154.2021.03.24.08.00.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 08:00:32 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Jonathan Marek Cc: Stephen Boyd , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 03/21] drm/msm/dpu: drop dpu_hw_blk_destroy function Date: Wed, 24 Mar 2021 18:00:06 +0300 Message-Id: <20210324150024.2768215-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210324150024.2768215-1-dmitry.baryshkov@linaro.org> References: <20210324150024.2768215-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The dpu_hw_blk_destroy() function is empty, so we can drop it now. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_blk.c | 13 ------------- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_blk.h | 1 - drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c | 2 -- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.c | 3 --- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 2 -- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c | 2 -- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_merge3d.c | 2 -- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 2 -- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 2 -- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c | 2 -- 10 files changed, 31 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_blk.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_blk.c index abad043f35f5..1f2b74b9eb65 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_blk.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_blk.c @@ -22,16 +22,3 @@ void dpu_hw_blk_init(struct dpu_hw_blk *hw_blk, u32 type, int id) hw_blk->type = type; hw_blk->id = id; } - -/** - * dpu_hw_blk_destroy - destroy hw block object. - * @hw_blk: pointer to hw block object - * return: none - */ -void dpu_hw_blk_destroy(struct dpu_hw_blk *hw_blk) -{ - if (!hw_blk) { - pr_err("invalid parameters\n"); - return; - } -} diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_blk.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_blk.h index fb3be9a36a50..7768694b558a 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_blk.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_blk.h @@ -24,5 +24,4 @@ struct dpu_hw_blk { }; void dpu_hw_blk_init(struct dpu_hw_blk *hw_blk, u32 type, int id); -void dpu_hw_blk_destroy(struct dpu_hw_blk *hw_blk); #endif /*_DPU_HW_BLK_H */ diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c index ad60d59d3106..ac0f10dd0490 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c @@ -591,7 +591,5 @@ struct dpu_hw_ctl *dpu_hw_ctl_init(enum dpu_ctl idx, void dpu_hw_ctl_destroy(struct dpu_hw_ctl *ctx) { - if (ctx) - dpu_hw_blk_destroy(&ctx->base); kfree(ctx); } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.c index d2f1045a736a..977b25968f34 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_dspp.c @@ -117,9 +117,6 @@ struct dpu_hw_dspp *dpu_hw_dspp_init(enum dpu_dspp idx, void dpu_hw_dspp_destroy(struct dpu_hw_dspp *dspp) { - if (dspp) - dpu_hw_blk_destroy(&dspp->base); - kfree(dspp); } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c index db78842e3999..8df75936d906 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c @@ -322,8 +322,6 @@ struct dpu_hw_intf *dpu_hw_intf_init(enum dpu_intf idx, void dpu_hw_intf_destroy(struct dpu_hw_intf *intf) { - if (intf) - dpu_hw_blk_destroy(&intf->base); kfree(intf); } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c index 554bb881de3a..76f8b8f75b82 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c @@ -189,7 +189,5 @@ struct dpu_hw_mixer *dpu_hw_lm_init(enum dpu_lm idx, void dpu_hw_lm_destroy(struct dpu_hw_mixer *lm) { - if (lm) - dpu_hw_blk_destroy(&lm->base); kfree(lm); } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_merge3d.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_merge3d.c index 863229dd0140..406ba950a066 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_merge3d.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_merge3d.c @@ -86,7 +86,5 @@ struct dpu_hw_merge_3d *dpu_hw_merge_3d_init(enum dpu_merge_3d idx, void dpu_hw_merge_3d_destroy(struct dpu_hw_merge_3d *hw) { - if (hw) - dpu_hw_blk_destroy(&hw->base); kfree(hw); } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c index 334d5b28f533..92cd724263ce 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c @@ -289,7 +289,5 @@ struct dpu_hw_pingpong *dpu_hw_pingpong_init(enum dpu_pingpong idx, void dpu_hw_pingpong_destroy(struct dpu_hw_pingpong *pp) { - if (pp) - dpu_hw_blk_destroy(&pp->base); kfree(pp); } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c index ceb2488ea270..8734a47040aa 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c @@ -740,8 +740,6 @@ struct dpu_hw_pipe *dpu_hw_sspp_init(enum dpu_sspp idx, void dpu_hw_sspp_destroy(struct dpu_hw_pipe *ctx) { - if (ctx) - dpu_hw_blk_destroy(&ctx->base); kfree(ctx); } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c index 5d2c33ec1de7..dae77d9c2c74 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c @@ -329,8 +329,6 @@ struct dpu_hw_mdp *dpu_hw_mdptop_init(enum dpu_mdp idx, void dpu_hw_mdp_destroy(struct dpu_hw_mdp *mdp) { - if (mdp) - dpu_hw_blk_destroy(&mdp->base); kfree(mdp); } From patchwork Wed Mar 24 15:00:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 408267 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0871C433E1 for ; Wed, 24 Mar 2021 15:01:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CA18D61A22 for ; Wed, 24 Mar 2021 15:01:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235911AbhCXPA4 (ORCPT ); Wed, 24 Mar 2021 11:00:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236365AbhCXPAh (ORCPT ); Wed, 24 Mar 2021 11:00:37 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC39FC061763 for ; Wed, 24 Mar 2021 08:00:36 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id a1so30625861ljp.2 for ; Wed, 24 Mar 2021 08:00:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yNTLXvqLsHODZghy5dNRi2QvLtORELZGn1VEjilYqGY=; b=NqI+fMBfn6XxtstrYtg1ZR+XxLMePJUyskX7ryxQAE9k9oBJcPIuwUFLhLWCVX7Q4S dJWqTGH0vF44CrNvQCwqgT2laMJEwSsLixPj3ujYK9RrJXX8qsjbYmTFrykAN1W3dMV+ tJbGJ7pQ1rF9wmbdJz6CdO7Is466XV2pLGydz3J44feiXQIKnPlQPFEW5Ifehp7txu4n +hipvl0jJNMxnXyB0+WM03Svg77Z5TQXmRm05vjrBuUzu23Xiw2OMREmHohfkk3q54dX J6Q3XtpDvyG9ZftroJSxP3j1N8XUvw/R5ep1sa2qDJlH758/kxVmaatC4GggSfTga4Id FEWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yNTLXvqLsHODZghy5dNRi2QvLtORELZGn1VEjilYqGY=; b=ti6BH4lYi7Fimz394ePaVDgxZ5XfDXB1bQroD5MAuLY3TVUF2JnThurjSuSP2Ckzj7 bBZ99M4Yop+TCV5rqxZzExG/Myxzf3m/B1ibKEWgtejVFXn9glVi8Bexf/TnKU4vjeTU yn9dj54eseYrQHwvv7bZOUY9e277Z4+Y9bJ5lDRJ/+9cHBSjTpQ++ndS5xB3cjIX4EVQ ESY9BMN8ibKGPtiaOMNlKPNM8fgEjPOu/dngigUBzAnOyEYBxZPnMXwTv6aWjEcDe+bv wknnX0bx27XheAACbY6/vBP3j8zmmkle6jrZCFcbsgXGbwuq7fcpixcNObkwHIeERBln /qaw== X-Gm-Message-State: AOAM533QsLrc1sRCjASG3F37T/exE9UttHSQDic2cRUF5o9oa2VMxLFs wCI5gFRCFhrEY06DzYVxL9sw7Q== X-Google-Smtp-Source: ABdhPJzVFf7m7auwi/rsKAz/YH+kymbvHqvyJ+CW234QQtNXR5I4A4KvYml1QHWpr/pgwi2gZlF+oA== X-Received: by 2002:a05:651c:28b:: with SMTP id b11mr2354175ljo.219.1616598035022; Wed, 24 Mar 2021 08:00:35 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id p5sm252463lfe.154.2021.03.24.08.00.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 08:00:33 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Jonathan Marek Cc: Stephen Boyd , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 04/21] drm/msm/dpu: get DSPP blocks directly rather than through RM Date: Wed, 24 Mar 2021 18:00:07 +0300 Message-Id: <20210324150024.2768215-5-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210324150024.2768215-1-dmitry.baryshkov@linaro.org> References: <20210324150024.2768215-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Each DSPP block is tied to a single LM. No LMs can share single DSPP block. So there is no need to handle DSPP blocks through all resource allocation/deallocation/assignment, just receive DSPP block as a part of LM hardware instance. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 6 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c | 6 + drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h | 1 + drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 1 - drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 116 ++++++-------------- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h | 2 - 6 files changed, 44 insertions(+), 88 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 288e95ee8e1d..b3d50f6d976d 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -977,7 +977,6 @@ static void dpu_encoder_virt_mode_set(struct drm_encoder *drm_enc, struct dpu_hw_blk *hw_pp[MAX_CHANNELS_PER_ENC]; struct dpu_hw_blk *hw_ctl[MAX_CHANNELS_PER_ENC]; struct dpu_hw_blk *hw_lm[MAX_CHANNELS_PER_ENC]; - struct dpu_hw_blk *hw_dspp[MAX_CHANNELS_PER_ENC] = { NULL }; int num_lm, num_ctl, num_pp; int i, j; @@ -1028,9 +1027,6 @@ static void dpu_encoder_virt_mode_set(struct drm_encoder *drm_enc, drm_enc->base.id, DPU_HW_BLK_CTL, hw_ctl, ARRAY_SIZE(hw_ctl)); num_lm = dpu_rm_get_assigned_resources(&dpu_kms->rm, global_state, drm_enc->base.id, DPU_HW_BLK_LM, hw_lm, ARRAY_SIZE(hw_lm)); - dpu_rm_get_assigned_resources(&dpu_kms->rm, global_state, - drm_enc->base.id, DPU_HW_BLK_DSPP, hw_dspp, - ARRAY_SIZE(hw_dspp)); for (i = 0; i < MAX_CHANNELS_PER_ENC; i++) dpu_enc->hw_pp[i] = i < num_pp ? to_dpu_hw_pingpong(hw_pp[i]) @@ -1043,7 +1039,7 @@ static void dpu_encoder_virt_mode_set(struct drm_encoder *drm_enc, cstate->mixers[i].hw_lm = to_dpu_hw_mixer(hw_lm[i]); cstate->mixers[i].lm_ctl = to_dpu_hw_ctl(hw_ctl[ctl_idx]); - cstate->mixers[i].hw_dspp = to_dpu_hw_dspp(hw_dspp[i]); + cstate->mixers[i].hw_dspp = cstate->mixers[i].hw_lm->dspp; } cstate->num_mixers = num_lm; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c index 76f8b8f75b82..35675744a6b7 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c @@ -5,6 +5,7 @@ #include "dpu_kms.h" #include "dpu_hw_catalog.h" #include "dpu_hwio.h" +#include "dpu_hw_dspp.h" #include "dpu_hw_lm.h" #include "dpu_hw_mdss.h" @@ -182,6 +183,9 @@ struct dpu_hw_mixer *dpu_hw_lm_init(enum dpu_lm idx, c->cap = cfg; _setup_mixer_ops(m, &c->ops, c->cap->features); + if (cfg->dspp && cfg->dspp < DSPP_MAX) + c->dspp = dpu_hw_dspp_init(cfg->dspp, addr, m); + dpu_hw_blk_init(&c->base, DPU_HW_BLK_LM, idx); return c; @@ -189,5 +193,7 @@ struct dpu_hw_mixer *dpu_hw_lm_init(enum dpu_lm idx, void dpu_hw_lm_destroy(struct dpu_hw_mixer *lm) { + if (lm) + dpu_hw_dspp_destroy(lm->dspp); kfree(lm); } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h index 4a6b2de19ef6..effb78311a43 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h @@ -64,6 +64,7 @@ struct dpu_hw_mixer { const struct dpu_lm_cfg *cap; const struct dpu_mdp_cfg *mdp; const struct dpu_ctl_cfg *ctl; + struct dpu_hw_dspp *dspp; /* ops */ struct dpu_hw_lm_ops ops; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h index d6717d6672f7..195a854245fa 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h @@ -164,7 +164,6 @@ struct dpu_global_state { uint32_t mixer_to_enc_id[LM_MAX - LM_0]; 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]; }; 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 fd2d104f0a91..bb03ff8b8c9f 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c @@ -9,7 +9,6 @@ #include "dpu_hw_ctl.h" #include "dpu_hw_pingpong.h" #include "dpu_hw_intf.h" -#include "dpu_hw_dspp.h" #include "dpu_hw_merge3d.h" #include "dpu_encoder.h" #include "dpu_trace.h" @@ -35,6 +34,14 @@ int dpu_rm_destroy(struct dpu_rm *rm) { int i; + for (i = 0; i < ARRAY_SIZE(rm->mixer_blks); i++) { + struct dpu_hw_mixer *hw; + + if (rm->mixer_blks[i]) { + hw = to_dpu_hw_mixer(rm->mixer_blks[i]); + dpu_hw_lm_destroy(hw); + } + } for (i = 0; i < ARRAY_SIZE(rm->pingpong_blks); i++) { struct dpu_hw_pingpong *hw; @@ -51,14 +58,6 @@ int dpu_rm_destroy(struct dpu_rm *rm) dpu_hw_merge_3d_destroy(hw); } } - for (i = 0; i < ARRAY_SIZE(rm->mixer_blks); i++) { - struct dpu_hw_mixer *hw; - - if (rm->mixer_blks[i]) { - hw = to_dpu_hw_mixer(rm->mixer_blks[i]); - dpu_hw_lm_destroy(hw); - } - } for (i = 0; i < ARRAY_SIZE(rm->ctl_blks); i++) { struct dpu_hw_ctl *hw; @@ -94,40 +93,6 @@ int dpu_rm_init(struct dpu_rm *rm, memset(rm, 0, sizeof(*rm)); /* Interrogate HW catalog and create tracking items for hw blocks */ - for (i = 0; i < cat->mixer_count; i++) { - struct dpu_hw_mixer *hw; - const struct dpu_lm_cfg *lm = &cat->mixer[i]; - - if (lm->pingpong == PINGPONG_MAX) { - DPU_DEBUG("skip mixer %d without pingpong\n", lm->id); - continue; - } - - if (lm->id < LM_0 || lm->id >= LM_MAX) { - DPU_ERROR("skip mixer %d with invalid id\n", lm->id); - continue; - } - hw = dpu_hw_lm_init(lm->id, mmio, cat); - if (IS_ERR_OR_NULL(hw)) { - rc = PTR_ERR(hw); - DPU_ERROR("failed lm object creation: err %d\n", rc); - goto fail; - } - rm->mixer_blks[lm->id - LM_0] = &hw->base; - - if (!rm->lm_max_width) { - rm->lm_max_width = lm->sblk->maxwidth; - } else if (rm->lm_max_width != lm->sblk->maxwidth) { - /* - * Don't expect to have hw where lm max widths differ. - * If found, take the min. - */ - DPU_ERROR("unsupported: lm maxwidth differs\n"); - if (rm->lm_max_width > lm->sblk->maxwidth) - rm->lm_max_width = lm->sblk->maxwidth; - } - } - for (i = 0; i < cat->merge_3d_count; i++) { struct dpu_hw_merge_3d *hw; const struct dpu_merge_3d_cfg *merge_3d = &cat->merge_3d[i]; @@ -204,21 +169,38 @@ int dpu_rm_init(struct dpu_rm *rm, rm->ctl_blks[ctl->id - CTL_0] = &hw->base; } - for (i = 0; i < cat->dspp_count; i++) { - struct dpu_hw_dspp *hw; - const struct dpu_dspp_cfg *dspp = &cat->dspp[i]; + for (i = 0; i < cat->mixer_count; i++) { + struct dpu_hw_mixer *hw; + const struct dpu_lm_cfg *lm = &cat->mixer[i]; - if (dspp->id < DSPP_0 || dspp->id >= DSPP_MAX) { - DPU_ERROR("skip dspp %d with invalid id\n", dspp->id); + if (lm->pingpong == PINGPONG_MAX) { + DPU_DEBUG("skip mixer %d without pingpong\n", lm->id); + continue; + } + + if (lm->id < LM_0 || lm->id >= LM_MAX) { + DPU_ERROR("skip mixer %d with invalid id\n", lm->id); continue; } - hw = dpu_hw_dspp_init(dspp->id, mmio, cat); + hw = dpu_hw_lm_init(lm->id, mmio, cat); if (IS_ERR_OR_NULL(hw)) { rc = PTR_ERR(hw); - DPU_ERROR("failed dspp object creation: err %d\n", rc); + DPU_ERROR("failed lm object creation: err %d\n", rc); goto fail; } - rm->dspp_blks[dspp->id - DSPP_0] = &hw->base; + rm->mixer_blks[lm->id - LM_0] = &hw->base; + + if (!rm->lm_max_width) { + rm->lm_max_width = lm->sblk->maxwidth; + } else if (rm->lm_max_width != lm->sblk->maxwidth) { + /* + * Don't expect to have hw where lm max widths differ. + * If found, take the min. + */ + DPU_ERROR("unsupported: lm maxwidth differs\n"); + if (rm->lm_max_width > lm->sblk->maxwidth) + rm->lm_max_width = lm->sblk->maxwidth; + } } return 0; @@ -271,15 +253,13 @@ static bool _dpu_rm_check_lm_peer(struct dpu_rm *rm, int primary_idx, * available and appropriate * @pp_idx: output parameter, index of pingpong block attached to the layer * mixer in rm->pingpong_blks[]. - * @dspp_idx: output parameter, index of dspp block attached to the layer - * mixer in rm->dspp_blks[]. * @reqs: input parameter, rm requirements for HW blocks needed in the * datapath. * Return: true if lm matches all requirements, false otherwise */ static bool _dpu_rm_check_lm_and_get_connected_blks(struct dpu_rm *rm, struct dpu_global_state *global_state, - uint32_t enc_id, int lm_idx, int *pp_idx, int *dspp_idx, + uint32_t enc_id, int lm_idx, int *pp_idx, struct dpu_rm_requirements *reqs) { const struct dpu_lm_cfg *lm_cfg; @@ -305,22 +285,6 @@ static bool _dpu_rm_check_lm_and_get_connected_blks(struct dpu_rm *rm, } *pp_idx = idx; - if (!reqs->topology.num_dspp) - return true; - - idx = lm_cfg->dspp - DSPP_0; - if (idx < 0 || idx >= ARRAY_SIZE(rm->dspp_blks)) { - DPU_ERROR("failed to get dspp on lm %d\n", lm_cfg->dspp); - return false; - } - - if (reserved_by_other(global_state->dspp_to_enc_id, idx, enc_id)) { - DPU_DEBUG("lm %d dspp %d already reserved\n", lm_cfg->id, - lm_cfg->dspp); - return false; - } - *dspp_idx = idx; - return true; } @@ -332,7 +296,6 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, { int lm_idx[MAX_BLOCKS]; int pp_idx[MAX_BLOCKS]; - int dspp_idx[MAX_BLOCKS] = {0}; int i, j, lm_count = 0; if (!reqs->topology.num_lm) { @@ -351,7 +314,7 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, if (!_dpu_rm_check_lm_and_get_connected_blks(rm, global_state, enc_id, i, &pp_idx[lm_count], - &dspp_idx[lm_count], reqs)) { + reqs)) { continue; } @@ -371,7 +334,7 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, if (!_dpu_rm_check_lm_and_get_connected_blks(rm, global_state, enc_id, j, - &pp_idx[lm_count], &dspp_idx[lm_count], + &pp_idx[lm_count], reqs)) { continue; } @@ -389,8 +352,6 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, for (i = 0; i < lm_count; i++) { global_state->mixer_to_enc_id[lm_idx[i]] = enc_id; global_state->pingpong_to_enc_id[pp_idx[i]] = enc_id; - global_state->dspp_to_enc_id[dspp_idx[i]] = - reqs->topology.num_dspp ? enc_id : 0; trace_dpu_rm_reserve_lms(lm_idx[i] + LM_0, enc_id, pp_idx[i] + PINGPONG_0); @@ -635,11 +596,6 @@ int dpu_rm_get_assigned_resources(struct dpu_rm *rm, hw_to_enc_id = global_state->intf_to_enc_id; max_blks = ARRAY_SIZE(rm->intf_blks); break; - case DPU_HW_BLK_DSPP: - hw_blks = rm->dspp_blks; - hw_to_enc_id = global_state->dspp_to_enc_id; - max_blks = ARRAY_SIZE(rm->dspp_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..91952af6c75b 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h @@ -19,7 +19,6 @@ struct dpu_global_state; * @mixer_blks: array of layer mixer hardware resources * @ctl_blks: array of ctl hardware resources * @intf_blks: array of intf hardware resources - * @dspp_blks: array of dspp hardware resources * @lm_max_width: cached layer mixer maximum width * @rm_lock: resource manager mutex */ @@ -28,7 +27,6 @@ struct dpu_rm { struct dpu_hw_blk *mixer_blks[LM_MAX - LM_0]; struct dpu_hw_blk *ctl_blks[CTL_MAX - CTL_0]; 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]; uint32_t lm_max_width; From patchwork Wed Mar 24 15:00:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 408265 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01B1FC433E4 for ; Wed, 24 Mar 2021 15:01:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B78BC61A2D for ; Wed, 24 Mar 2021 15:01:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236360AbhCXPA4 (ORCPT ); Wed, 24 Mar 2021 11:00:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236368AbhCXPAi (ORCPT ); Wed, 24 Mar 2021 11:00:38 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD647C061763 for ; Wed, 24 Mar 2021 08:00:37 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id u9so2944216ljd.11 for ; Wed, 24 Mar 2021 08:00:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IjHivPrqaqsAoJFEeR3ZaJm6gd/MnQRlxG1gYfEfS1Y=; b=iQqBJeEURzXhRjjS48/g8gQftOpvxwbzQ2AWxotoAjqHCEZ++BHc9yN8XaTPKf7iEH hb90+ZRMDwoVS3vBASY+D7vW7mBFdb5nOYJ7ItsYj9gI8fLdQ4brBu7GBh8edIM6a/aI GzhZ+HOCVWnOiEZcxl5iC/R+qJvsTWCFT2LFI3d5RknSrYScPvnaJS2lgU2JM5RfFWBP zbb48RCSgbNuQQ9Q2Uz6Tfotx22igOlJXEtE4HjARrFyOcrSnGNGhS/u+yEnhu147zv5 Mv77uzVH1M28kcz8ba/+mbR5cfP+9t7dVsH0SzlkaDWgegg56HWsstFBNiMTotwjCrKr 58bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IjHivPrqaqsAoJFEeR3ZaJm6gd/MnQRlxG1gYfEfS1Y=; b=cx/JV6Qeo2dm3/AJEbO3etY4aS/0C2XaY+/GWKuJ9YNR5K5Q5c4fqkgulGl+XZvXfu EuxW2tcRqPojvi8Njgzn098TO9PpR6eL7f9uFS2GjxV9fBaqoM5DMRouwtWcQeL/YGaH RCws29PEt7nld2VTE+16vLaj463jDSuREoKHJ87Y6R7+FebgR5pUKsWOGyQ1eJUscs0D MfTkafgFyXeSSXBtkVTVEsF1RgqMvcSDWxIglrvJsBsqhh3CbFJOfqL7uqehHRyILvih e2C0zdXNizPMbpj9ojvwEIdn9cuDS61iA4uSnQAJzPLr5gMS5CrEkvPuAYck/S/YvNI7 fsAQ== X-Gm-Message-State: AOAM532WMV0tPXiUkjyCIi1+14xOr79GSE4bScFVsJRDUlFxVErAy+Xs UZMA+fs0H61GYf+gdGPbKfGGkQ== X-Google-Smtp-Source: ABdhPJwzc7RAGodZqGlojo69Aha0EeGzkDU+EsMn5qL5x4MVqe1397aPlyiT7ER/jOMZJFCugJt29Q== X-Received: by 2002:a2e:8e78:: with SMTP id t24mr2413984ljk.161.1616598036186; Wed, 24 Mar 2021 08:00:36 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id p5sm252463lfe.154.2021.03.24.08.00.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 08:00:35 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Jonathan Marek Cc: Stephen Boyd , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 05/21] drm/msm/dpu: get MERGE_3D blocks directly rather than through RM Date: Wed, 24 Mar 2021 18:00:08 +0300 Message-Id: <20210324150024.2768215-6-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210324150024.2768215-1-dmitry.baryshkov@linaro.org> References: <20210324150024.2768215-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org MERGE_3D blocks are not really handled by resource manager, they are used by corresponding PP blocks directly, each merge_3d is used by two known PP blocks. So allocate them outside of RM and use them directly. Signed-off-by: Dmitry Baryshkov --- .../drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 11 +++--- .../gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 7 +++- .../gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h | 6 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 27 +++++++++++++- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 1 + drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 36 +++---------------- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h | 8 ++--- 7 files changed, 48 insertions(+), 48 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c index 9a69fad832cd..e77a68c2fc73 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c @@ -284,7 +284,7 @@ static void dpu_encoder_phys_vid_setup_timing_engine( intf_cfg.stream_sel = 0; /* Don't care value for video mode */ intf_cfg.mode_3d = dpu_encoder_helper_get_3d_blend_mode(phys_enc); if (phys_enc->hw_pp->merge_3d) - intf_cfg.merge_3d = phys_enc->hw_pp->merge_3d->id; + intf_cfg.merge_3d = phys_enc->hw_pp->merge_3d->idx; spin_lock_irqsave(phys_enc->enc_spinlock, lock_flags); phys_enc->hw_intf->ops.setup_timing_gen(phys_enc->hw_intf, @@ -298,11 +298,8 @@ static void dpu_encoder_phys_vid_setup_timing_engine( true, phys_enc->hw_pp->idx); - if (phys_enc->hw_pp->merge_3d) { - struct dpu_hw_merge_3d *merge_3d = to_dpu_hw_merge_3d(phys_enc->hw_pp->merge_3d); - - merge_3d->ops.setup_3d_mode(merge_3d, intf_cfg.mode_3d); - } + if (phys_enc->hw_pp->merge_3d) + phys_enc->hw_pp->merge_3d->ops.setup_3d_mode(phys_enc->hw_pp->merge_3d, intf_cfg.mode_3d); spin_unlock_irqrestore(phys_enc->enc_spinlock, lock_flags); @@ -461,7 +458,7 @@ static void dpu_encoder_phys_vid_enable(struct dpu_encoder_phys *phys_enc) ctl->ops.update_pending_flush_intf(ctl, phys_enc->hw_intf->idx); if (ctl->ops.update_pending_flush_merge_3d && phys_enc->hw_pp->merge_3d) - ctl->ops.update_pending_flush_merge_3d(ctl, phys_enc->hw_pp->merge_3d->id); + ctl->ops.update_pending_flush_merge_3d(ctl, phys_enc->hw_pp->merge_3d->idx); skip_flush: DPU_DEBUG_VIDENC(phys_enc, diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c index 92cd724263ce..89c1123d957f 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c @@ -8,6 +8,7 @@ #include "dpu_hwio.h" #include "dpu_hw_catalog.h" #include "dpu_hw_pingpong.h" +#include "dpu_hw_merge3d.h" #include "dpu_kms.h" #include "dpu_trace.h" @@ -263,7 +264,8 @@ static void _setup_pingpong_ops(struct dpu_hw_pingpong *c, struct dpu_hw_pingpong *dpu_hw_pingpong_init(enum dpu_pingpong idx, void __iomem *addr, - const struct dpu_mdss_cfg *m) + const struct dpu_mdss_cfg *m, + struct dpu_hw_merge_3d **merge_3d_blks) { struct dpu_hw_pingpong *c; const struct dpu_pingpong_cfg *cfg; @@ -282,6 +284,9 @@ struct dpu_hw_pingpong *dpu_hw_pingpong_init(enum dpu_pingpong idx, c->caps = cfg; _setup_pingpong_ops(c, c->caps->features); + if (cfg->merge_3d && cfg->merge_3d < MERGE_3D_MAX) + c->merge_3d = merge_3d_blks[cfg->merge_3d - MERGE_3D_0]; + dpu_hw_blk_init(&c->base, DPU_HW_BLK_PINGPONG, idx); return c; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h index 845b9ce80e31..a9e960b8814b 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h @@ -133,7 +133,7 @@ struct dpu_hw_pingpong { /* pingpong */ enum dpu_pingpong idx; const struct dpu_pingpong_cfg *caps; - struct dpu_hw_blk *merge_3d; + struct dpu_hw_merge_3d *merge_3d; /* ops */ struct dpu_hw_pingpong_ops ops; @@ -155,11 +155,13 @@ static inline struct dpu_hw_pingpong *to_dpu_hw_pingpong(struct dpu_hw_blk *hw) * @idx: Pingpong index for which driver object is required * @addr: Mapped register io address of MDP * @m: Pointer to mdss catalog data + * @merge_3d_blks: Pointer to merge 3d blocks * Returns: Error code or allocated dpu_hw_pingpong context */ struct dpu_hw_pingpong *dpu_hw_pingpong_init(enum dpu_pingpong idx, void __iomem *addr, - const struct dpu_mdss_cfg *m); + const struct dpu_mdss_cfg *m, + struct dpu_hw_merge_3d **merge_3d_blks); /** * dpu_hw_pingpong_destroy - destroys pingpong driver context diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 85f2c3564c96..8e00214426bc 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -22,6 +22,7 @@ #include "dpu_kms.h" #include "dpu_core_irq.h" #include "dpu_formats.h" +#include "dpu_hw_merge3d.h" #include "dpu_hw_vbif.h" #include "dpu_vbif.h" #include "dpu_encoder.h" @@ -687,6 +688,16 @@ static void _dpu_kms_hw_destroy(struct dpu_kms *dpu_kms) dpu_rm_destroy(&dpu_kms->rm); dpu_kms->rm_init = false; + /* After RM destroy, as PP blocks reference MERGE_3D blocks */ + if (dpu_kms->catalog) { + for (i = 0; i < dpu_kms->catalog->merge_3d_count; i++) { + u32 merge_3d_idx = dpu_kms->catalog->merge_3d[i].id; + + if ((merge_3d_idx < MERGE_3D_MAX) && dpu_kms->hw_merge_3d[merge_3d_idx]) + dpu_hw_merge_3d_destroy(dpu_kms->hw_merge_3d[merge_3d_idx]); + } + } + if (dpu_kms->catalog) dpu_hw_catalog_deinit(dpu_kms->catalog); dpu_kms->catalog = NULL; @@ -962,7 +973,21 @@ static int dpu_kms_hw_init(struct msm_kms *kms) goto power_error; } - rc = dpu_rm_init(&dpu_kms->rm, dpu_kms->catalog, dpu_kms->mmio); + /* Before RM init so PP blocks can find MERGE_3D blocks */ + for (i = 0; i < dpu_kms->catalog->merge_3d_count; i++) { + u32 merge_3d_idx = dpu_kms->catalog->merge_3d[i].id; + + dpu_kms->hw_merge_3d[i] = dpu_hw_merge_3d_init(merge_3d_idx, + dpu_kms->mmio, dpu_kms->catalog); + if (IS_ERR(dpu_kms->hw_merge_3d[merge_3d_idx])) { + rc = PTR_ERR(dpu_kms->hw_merge_3d[merge_3d_idx]); + DPU_ERROR("failed to init merge_3d %d: %d\n", merge_3d_idx, rc); + dpu_kms->hw_merge_3d[merge_3d_idx] = NULL; + goto power_error; + } + } + + rc = dpu_rm_init(&dpu_kms->rm, dpu_kms); if (rc) { DPU_ERROR("rm init failed: %d\n", rc); goto power_error; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h index 195a854245fa..057fdf0ca9f4 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h @@ -123,6 +123,7 @@ struct dpu_kms { bool rm_init; struct dpu_hw_vbif *hw_vbif[VBIF_MAX]; + struct dpu_hw_merge_3d *hw_merge_3d[MERGE_3D_MAX]; struct dpu_hw_mdp *hw_mdp; bool has_danger_ctrl; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c index bb03ff8b8c9f..2ddf02eda2e5 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c @@ -9,7 +9,6 @@ #include "dpu_hw_ctl.h" #include "dpu_hw_pingpong.h" #include "dpu_hw_intf.h" -#include "dpu_hw_merge3d.h" #include "dpu_encoder.h" #include "dpu_trace.h" @@ -50,14 +49,6 @@ int dpu_rm_destroy(struct dpu_rm *rm) dpu_hw_pingpong_destroy(hw); } } - for (i = 0; i < ARRAY_SIZE(rm->merge_3d_blks); i++) { - struct dpu_hw_merge_3d *hw; - - if (rm->merge_3d_blks[i]) { - hw = to_dpu_hw_merge_3d(rm->merge_3d_blks[i]); - dpu_hw_merge_3d_destroy(hw); - } - } for (i = 0; i < ARRAY_SIZE(rm->ctl_blks); i++) { struct dpu_hw_ctl *hw; @@ -79,9 +70,10 @@ int dpu_rm_destroy(struct dpu_rm *rm) } int dpu_rm_init(struct dpu_rm *rm, - struct dpu_mdss_cfg *cat, - void __iomem *mmio) + struct dpu_kms *dpu_kms) { + struct dpu_mdss_cfg *cat = dpu_kms->catalog; + void __iomem *mmio = dpu_kms->mmio; int rc, i; if (!rm || !cat || !mmio) { @@ -93,24 +85,6 @@ int dpu_rm_init(struct dpu_rm *rm, memset(rm, 0, sizeof(*rm)); /* Interrogate HW catalog and create tracking items for hw blocks */ - for (i = 0; i < cat->merge_3d_count; i++) { - struct dpu_hw_merge_3d *hw; - const struct dpu_merge_3d_cfg *merge_3d = &cat->merge_3d[i]; - - if (merge_3d->id < MERGE_3D_0 || merge_3d->id >= MERGE_3D_MAX) { - DPU_ERROR("skip merge_3d %d with invalid id\n", merge_3d->id); - continue; - } - hw = dpu_hw_merge_3d_init(merge_3d->id, mmio, cat); - if (IS_ERR_OR_NULL(hw)) { - rc = PTR_ERR(hw); - DPU_ERROR("failed merge_3d object creation: err %d\n", - rc); - goto fail; - } - rm->merge_3d_blks[merge_3d->id - MERGE_3D_0] = &hw->base; - } - for (i = 0; i < cat->pingpong_count; i++) { struct dpu_hw_pingpong *hw; const struct dpu_pingpong_cfg *pp = &cat->pingpong[i]; @@ -119,15 +93,13 @@ int dpu_rm_init(struct dpu_rm *rm, DPU_ERROR("skip pingpong %d with invalid id\n", pp->id); continue; } - hw = dpu_hw_pingpong_init(pp->id, mmio, cat); + hw = dpu_hw_pingpong_init(pp->id, mmio, cat, dpu_kms->hw_merge_3d); if (IS_ERR_OR_NULL(hw)) { rc = PTR_ERR(hw); DPU_ERROR("failed pingpong object creation: err %d\n", rc); goto fail; } - if (pp->merge_3d && pp->merge_3d < MERGE_3D_MAX) - hw->merge_3d = rm->merge_3d_blks[pp->merge_3d - MERGE_3D_0]; rm->pingpong_blks[pp->id - PINGPONG_0] = &hw->base; } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h index 91952af6c75b..4c0c15453c98 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h @@ -27,22 +27,20 @@ struct dpu_rm { struct dpu_hw_blk *mixer_blks[LM_MAX - LM_0]; struct dpu_hw_blk *ctl_blks[CTL_MAX - CTL_0]; struct dpu_hw_blk *intf_blks[INTF_MAX - INTF_0]; - struct dpu_hw_blk *merge_3d_blks[MERGE_3D_MAX - MERGE_3D_0]; uint32_t lm_max_width; }; +struct dpu_kms; /** * dpu_rm_init - Read hardware catalog and create reservation tracking objects * for all HW blocks. * @rm: DPU Resource Manager handle - * @cat: Pointer to hardware catalog - * @mmio: mapped register io address of MDP + * @dpu_kms: DPU KMS data * @Return: 0 on Success otherwise -ERROR */ int dpu_rm_init(struct dpu_rm *rm, - struct dpu_mdss_cfg *cat, - void __iomem *mmio); + struct dpu_kms *dpu_kms); /** * dpu_rm_destroy - Free all memory allocated by dpu_rm_init From patchwork Wed Mar 24 15:00:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 408266 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03515C433E6 for ; Wed, 24 Mar 2021 15:01:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DAFCB61A30 for ; Wed, 24 Mar 2021 15:01:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236365AbhCXPA5 (ORCPT ); Wed, 24 Mar 2021 11:00:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236372AbhCXPAk (ORCPT ); Wed, 24 Mar 2021 11:00:40 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8AFBC061763 for ; Wed, 24 Mar 2021 08:00:39 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id y1so30573943ljm.10 for ; Wed, 24 Mar 2021 08:00:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8ewaZlhe2MFNTmbeCLuqyoAlS7E6lrMJPstjPC4DiTo=; b=rQbjMVWoaJnNfSZAIS/v9St4zxV6clBGzD4wftMsaE9OJyvVtjowWZ/ChqWqxgK+LQ wGhe0WHlEhTTaNYxqC64NOXF/tm/Nw8BNbjsxNSWOZ9jkPrvZQs8FKxTkoInRf6GtttW +plfZcm8PWt+GUMSlp2JS9clM1269lDrOtMNdX/d+JrZl/uvUzqG5Wz/sFbImTQeCA0j 6yA/wWAmx7qblnSl7TFuorN9hBPBqyO6Y9Q2Pm4n6/pLb1MMizTsrl45ZRpyifO2BJKJ joEXe/VSZxIqIPNgeDYWf4iNwFUrUgyBKrhJMMcdmEkj64FxpyDmpso9v0oKx9zEGWYW xzaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8ewaZlhe2MFNTmbeCLuqyoAlS7E6lrMJPstjPC4DiTo=; b=X8G4eXV3Sw4WMqwVf4YTcvuqNKkFZvlOHiwNXrIomv12dDk+owpJVVl1RI1EZYKKtp dfoLiahAhS98fS1rIII/kHO5Iuei4OKqa/5hxcqNoYBw2kKzjzmFZV/qgGv8pMDBCibq vvzR/Y0OPJ+qnNCLVfilvcHnVeoJuah9DoLXszJYqsaYGqKhWfX/a1I2anY0CCoCXDR6 eBzwcwaxACw1SZMovhZNFyRiVW+rLVRhQ6Y37hbXlSrm5F8fKsNNH/rDMww0QqYSBkc3 NWvUn9iHFceJSfLQZDYVdwQn9eT6QvseTTe18l65NMtiP5zTQ7ezjf6Fz0f80O3kZ+JR F3wQ== X-Gm-Message-State: AOAM532vAx71kGFYOd1Q8LZdODUybjs/hzDNlYva1JZ5h4uRgf+9bI9W 4RJEp/inME46F3U+SKsX7Xzabg== X-Google-Smtp-Source: ABdhPJy98KcBgFXSv/sOY/L/e40Avb1qa2PS2CusoV7b3TkP9u/lUvV/fLU17hF0Gs43cSrCki7iGQ== X-Received: by 2002:a2e:a318:: with SMTP id l24mr2333475lje.399.1616598037994; Wed, 24 Mar 2021 08:00:37 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id p5sm252463lfe.154.2021.03.24.08.00.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 08:00:36 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Jonathan Marek Cc: Stephen Boyd , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 06/21] drm/msm/dpu: get PINGPONG blocks directly rather than through RM Date: Wed, 24 Mar 2021 18:00:09 +0300 Message-Id: <20210324150024.2768215-7-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210324150024.2768215-1-dmitry.baryshkov@linaro.org> References: <20210324150024.2768215-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Each PINGPONG block is tied to a single LM. No LMs can share single PINGPONG block. So there is no need to handle PINGPONG blocks through all resource allocation/deallocation/assignment, just receive PINGPONG block as a part of LM hardware instance. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 12 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c | 10 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h | 6 +- .../gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h | 1 + drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 1 - drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 99 ++----------------- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h | 2 - drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h | 9 +- 8 files changed, 26 insertions(+), 114 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index b3d50f6d976d..d98b4e4097fb 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -974,10 +974,9 @@ static void dpu_encoder_virt_mode_set(struct drm_encoder *drm_enc, struct drm_crtc *drm_crtc; struct dpu_crtc_state *cstate; struct dpu_global_state *global_state; - struct dpu_hw_blk *hw_pp[MAX_CHANNELS_PER_ENC]; struct dpu_hw_blk *hw_ctl[MAX_CHANNELS_PER_ENC]; struct dpu_hw_blk *hw_lm[MAX_CHANNELS_PER_ENC]; - int num_lm, num_ctl, num_pp; + int num_lm, num_ctl; int i, j; if (!drm_enc) { @@ -1020,18 +1019,11 @@ static void dpu_encoder_virt_mode_set(struct drm_encoder *drm_enc, break; /* Query resource that have been reserved in atomic check step. */ - num_pp = dpu_rm_get_assigned_resources(&dpu_kms->rm, global_state, - drm_enc->base.id, DPU_HW_BLK_PINGPONG, hw_pp, - ARRAY_SIZE(hw_pp)); num_ctl = dpu_rm_get_assigned_resources(&dpu_kms->rm, global_state, drm_enc->base.id, DPU_HW_BLK_CTL, hw_ctl, ARRAY_SIZE(hw_ctl)); num_lm = dpu_rm_get_assigned_resources(&dpu_kms->rm, global_state, drm_enc->base.id, DPU_HW_BLK_LM, hw_lm, ARRAY_SIZE(hw_lm)); - for (i = 0; i < MAX_CHANNELS_PER_ENC; i++) - dpu_enc->hw_pp[i] = i < num_pp ? to_dpu_hw_pingpong(hw_pp[i]) - : NULL; - cstate = to_dpu_crtc_state(drm_crtc->state); for (i = 0; i < num_lm; i++) { @@ -1040,6 +1032,8 @@ static void dpu_encoder_virt_mode_set(struct drm_encoder *drm_enc, cstate->mixers[i].hw_lm = to_dpu_hw_mixer(hw_lm[i]); cstate->mixers[i].lm_ctl = to_dpu_hw_ctl(hw_ctl[ctl_idx]); cstate->mixers[i].hw_dspp = cstate->mixers[i].hw_lm->dspp; + + dpu_enc->hw_pp[i] = cstate->mixers[i].hw_lm->pingpong; } cstate->num_mixers = num_lm; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c index 35675744a6b7..fd09b9ab9b4b 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c @@ -8,6 +8,7 @@ #include "dpu_hw_dspp.h" #include "dpu_hw_lm.h" #include "dpu_hw_mdss.h" +#include "dpu_hw_pingpong.h" #define LM_OP_MODE 0x00 #define LM_OUT_SIZE 0x04 @@ -163,7 +164,8 @@ static void _setup_mixer_ops(const struct dpu_mdss_cfg *m, struct dpu_hw_mixer *dpu_hw_lm_init(enum dpu_lm idx, void __iomem *addr, - const struct dpu_mdss_cfg *m) + const struct dpu_mdss_cfg *m, + struct dpu_hw_merge_3d **merge_3d_blks) { struct dpu_hw_mixer *c; const struct dpu_lm_cfg *cfg; @@ -185,6 +187,8 @@ struct dpu_hw_mixer *dpu_hw_lm_init(enum dpu_lm idx, if (cfg->dspp && cfg->dspp < DSPP_MAX) c->dspp = dpu_hw_dspp_init(cfg->dspp, addr, m); + if (cfg->pingpong && cfg->pingpong < PINGPONG_MAX) + c->pingpong = dpu_hw_pingpong_init(cfg->pingpong, addr, m, merge_3d_blks); dpu_hw_blk_init(&c->base, DPU_HW_BLK_LM, idx); @@ -193,7 +197,9 @@ struct dpu_hw_mixer *dpu_hw_lm_init(enum dpu_lm idx, void dpu_hw_lm_destroy(struct dpu_hw_mixer *lm) { - if (lm) + if (lm) { dpu_hw_dspp_destroy(lm->dspp); + dpu_hw_pingpong_destroy(lm->pingpong); + } kfree(lm); } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h index effb78311a43..182740f2914b 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h @@ -64,6 +64,7 @@ struct dpu_hw_mixer { const struct dpu_lm_cfg *cap; const struct dpu_mdp_cfg *mdp; const struct dpu_ctl_cfg *ctl; + struct dpu_hw_pingpong *pingpong; struct dpu_hw_dspp *dspp; /* ops */ @@ -83,16 +84,19 @@ static inline struct dpu_hw_mixer *to_dpu_hw_mixer(struct dpu_hw_blk *hw) return container_of(hw, struct dpu_hw_mixer, base); } +struct dpu_hw_merge_3d; /** * dpu_hw_lm_init(): Initializes the mixer hw driver object. * should be called once before accessing every mixer. * @idx: mixer index for which driver object is required * @addr: mapped register io address of MDP * @m : pointer to mdss catalog data + * @merge_3d_blks: Pointer to merge 3d blocks */ struct dpu_hw_mixer *dpu_hw_lm_init(enum dpu_lm idx, void __iomem *addr, - const struct dpu_mdss_cfg *m); + const struct dpu_mdss_cfg *m, + struct dpu_hw_merge_3d **merge_3d_blks); /** * dpu_hw_lm_destroy(): Destroys layer mixer driver context diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h index a9e960b8814b..a3db536210bf 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h @@ -149,6 +149,7 @@ static inline struct dpu_hw_pingpong *to_dpu_hw_pingpong(struct dpu_hw_blk *hw) return container_of(hw, struct dpu_hw_pingpong, base); } +struct dpu_rm; /** * dpu_hw_pingpong_init - initializes the pingpong driver for the passed * pingpong idx. diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h index 057fdf0ca9f4..0b936258bde0 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h @@ -161,7 +161,6 @@ struct vsync_info { struct dpu_global_state { struct drm_private_state base; - uint32_t pingpong_to_enc_id[PINGPONG_MAX - PINGPONG_0]; uint32_t mixer_to_enc_id[LM_MAX - LM_0]; uint32_t ctl_to_enc_id[CTL_MAX - CTL_0]; uint32_t intf_to_enc_id[INTF_MAX - INTF_0]; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c index 2ddf02eda2e5..7792dff60bcd 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c @@ -7,7 +7,6 @@ #include "dpu_kms.h" #include "dpu_hw_lm.h" #include "dpu_hw_ctl.h" -#include "dpu_hw_pingpong.h" #include "dpu_hw_intf.h" #include "dpu_encoder.h" #include "dpu_trace.h" @@ -41,14 +40,6 @@ int dpu_rm_destroy(struct dpu_rm *rm) dpu_hw_lm_destroy(hw); } } - for (i = 0; i < ARRAY_SIZE(rm->pingpong_blks); i++) { - struct dpu_hw_pingpong *hw; - - if (rm->pingpong_blks[i]) { - hw = to_dpu_hw_pingpong(rm->pingpong_blks[i]); - dpu_hw_pingpong_destroy(hw); - } - } for (i = 0; i < ARRAY_SIZE(rm->ctl_blks); i++) { struct dpu_hw_ctl *hw; @@ -85,24 +76,6 @@ int dpu_rm_init(struct dpu_rm *rm, memset(rm, 0, sizeof(*rm)); /* Interrogate HW catalog and create tracking items for hw blocks */ - for (i = 0; i < cat->pingpong_count; i++) { - struct dpu_hw_pingpong *hw; - const struct dpu_pingpong_cfg *pp = &cat->pingpong[i]; - - if (pp->id < PINGPONG_0 || pp->id >= PINGPONG_MAX) { - DPU_ERROR("skip pingpong %d with invalid id\n", pp->id); - continue; - } - hw = dpu_hw_pingpong_init(pp->id, mmio, cat, dpu_kms->hw_merge_3d); - if (IS_ERR_OR_NULL(hw)) { - rc = PTR_ERR(hw); - DPU_ERROR("failed pingpong object creation: err %d\n", - rc); - goto fail; - } - rm->pingpong_blks[pp->id - PINGPONG_0] = &hw->base; - } - for (i = 0; i < cat->intf_count; i++) { struct dpu_hw_intf *hw; const struct dpu_intf_cfg *intf = &cat->intf[i]; @@ -154,7 +127,7 @@ int dpu_rm_init(struct dpu_rm *rm, DPU_ERROR("skip mixer %d with invalid id\n", lm->id); continue; } - hw = dpu_hw_lm_init(lm->id, mmio, cat); + hw = dpu_hw_lm_init(lm->id, mmio, cat, dpu_kms->hw_merge_3d); if (IS_ERR_OR_NULL(hw)) { rc = PTR_ERR(hw); DPU_ERROR("failed lm object creation: err %d\n", rc); @@ -213,53 +186,6 @@ static bool _dpu_rm_check_lm_peer(struct dpu_rm *rm, int primary_idx, return true; } -/** - * _dpu_rm_check_lm_and_get_connected_blks - check if proposed layer mixer meets - * proposed use case requirements, incl. hardwired dependent blocks like - * pingpong - * @rm: dpu resource manager handle - * @global_state: resources shared across multiple kms objects - * @enc_id: encoder id requesting for allocation - * @lm_idx: index of proposed layer mixer in rm->mixer_blks[], function checks - * if lm, and all other hardwired blocks connected to the lm (pp) is - * available and appropriate - * @pp_idx: output parameter, index of pingpong block attached to the layer - * mixer in rm->pingpong_blks[]. - * @reqs: input parameter, rm requirements for HW blocks needed in the - * datapath. - * Return: true if lm matches all requirements, false otherwise - */ -static bool _dpu_rm_check_lm_and_get_connected_blks(struct dpu_rm *rm, - struct dpu_global_state *global_state, - uint32_t enc_id, int lm_idx, int *pp_idx, - struct dpu_rm_requirements *reqs) -{ - const struct dpu_lm_cfg *lm_cfg; - int idx; - - /* Already reserved? */ - if (reserved_by_other(global_state->mixer_to_enc_id, lm_idx, enc_id)) { - DPU_DEBUG("lm %d already reserved\n", lm_idx + LM_0); - return false; - } - - lm_cfg = to_dpu_hw_mixer(rm->mixer_blks[lm_idx])->cap; - idx = lm_cfg->pingpong - PINGPONG_0; - if (idx < 0 || idx >= ARRAY_SIZE(rm->pingpong_blks)) { - DPU_ERROR("failed to get pp on lm %d\n", lm_cfg->pingpong); - return false; - } - - if (reserved_by_other(global_state->pingpong_to_enc_id, idx, enc_id)) { - DPU_DEBUG("lm %d pp %d already reserved\n", lm_cfg->id, - lm_cfg->pingpong); - return false; - } - *pp_idx = idx; - - return true; -} - static int _dpu_rm_reserve_lms(struct dpu_rm *rm, struct dpu_global_state *global_state, uint32_t enc_id, @@ -267,7 +193,6 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, { int lm_idx[MAX_BLOCKS]; - int pp_idx[MAX_BLOCKS]; int i, j, lm_count = 0; if (!reqs->topology.num_lm) { @@ -284,9 +209,8 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, lm_count = 0; lm_idx[lm_count] = i; - if (!_dpu_rm_check_lm_and_get_connected_blks(rm, global_state, - enc_id, i, &pp_idx[lm_count], - reqs)) { + if (reserved_by_other(global_state->mixer_to_enc_id, i, enc_id)) { + DPU_DEBUG("lm %d already reserved\n", i + LM_0); continue; } @@ -304,10 +228,8 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, continue; } - if (!_dpu_rm_check_lm_and_get_connected_blks(rm, - global_state, enc_id, j, - &pp_idx[lm_count], - reqs)) { + if (reserved_by_other(global_state->mixer_to_enc_id, j, enc_id)) { + DPU_DEBUG("lm %d already reserved\n", j + LM_0); continue; } @@ -323,10 +245,8 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, for (i = 0; i < lm_count; i++) { global_state->mixer_to_enc_id[lm_idx[i]] = enc_id; - global_state->pingpong_to_enc_id[pp_idx[i]] = enc_id; - trace_dpu_rm_reserve_lms(lm_idx[i] + LM_0, enc_id, - pp_idx[i] + PINGPONG_0); + trace_dpu_rm_reserve_lms(lm_idx[i] + LM_0, enc_id); } return 0; @@ -492,8 +412,6 @@ static void _dpu_rm_clear_mapping(uint32_t *res_mapping, int cnt, void dpu_rm_release(struct dpu_global_state *global_state, struct drm_encoder *enc) { - _dpu_rm_clear_mapping(global_state->pingpong_to_enc_id, - ARRAY_SIZE(global_state->pingpong_to_enc_id), enc->base.id); _dpu_rm_clear_mapping(global_state->mixer_to_enc_id, ARRAY_SIZE(global_state->mixer_to_enc_id), enc->base.id); _dpu_rm_clear_mapping(global_state->ctl_to_enc_id, @@ -548,11 +466,6 @@ int dpu_rm_get_assigned_resources(struct dpu_rm *rm, int i, num_blks, max_blks; switch (type) { - case DPU_HW_BLK_PINGPONG: - hw_blks = rm->pingpong_blks; - hw_to_enc_id = global_state->pingpong_to_enc_id; - max_blks = ARRAY_SIZE(rm->pingpong_blks); - break; case DPU_HW_BLK_LM: hw_blks = rm->mixer_blks; hw_to_enc_id = global_state->mixer_to_enc_id; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h index 4c0c15453c98..a618c0ef43db 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h @@ -15,7 +15,6 @@ struct dpu_global_state; /** * struct dpu_rm - DPU dynamic hardware resource manager - * @pingpong_blks: array of pingpong hardware resources * @mixer_blks: array of layer mixer hardware resources * @ctl_blks: array of ctl hardware resources * @intf_blks: array of intf hardware resources @@ -23,7 +22,6 @@ struct dpu_global_state; * @rm_lock: resource manager mutex */ struct dpu_rm { - struct dpu_hw_blk *pingpong_blks[PINGPONG_MAX - PINGPONG_0]; struct dpu_hw_blk *mixer_blks[LM_MAX - LM_0]; struct dpu_hw_blk *ctl_blks[CTL_MAX - CTL_0]; struct dpu_hw_blk *intf_blks[INTF_MAX - INTF_0]; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h index 6714b088970f..23b587b10d77 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h @@ -835,20 +835,17 @@ DEFINE_EVENT(dpu_rm_iter_template, dpu_rm_reserve_ctls, ); TRACE_EVENT(dpu_rm_reserve_lms, - TP_PROTO(uint32_t id, uint32_t enc_id, uint32_t pp_id), - TP_ARGS(id, enc_id, pp_id), + TP_PROTO(uint32_t id, uint32_t enc_id), + TP_ARGS(id, enc_id), TP_STRUCT__entry( __field( uint32_t, id ) __field( uint32_t, enc_id ) - __field( uint32_t, pp_id ) ), TP_fast_assign( __entry->id = id; __entry->enc_id = enc_id; - __entry->pp_id = pp_id; ), - TP_printk("id:%d enc_id:%u pp_id:%u", __entry->id, - __entry->enc_id, __entry->pp_id) + TP_printk("id:%d enc_id:%u", __entry->id, __entry->enc_id) ); TRACE_EVENT(dpu_vbif_wait_xin_halt_fail, From patchwork Wed Mar 24 15:00:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 408262 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 204BEC433E8 for ; Wed, 24 Mar 2021 15:01:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EED7961A12 for ; Wed, 24 Mar 2021 15:01:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236372AbhCXPA5 (ORCPT ); Wed, 24 Mar 2021 11:00:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236375AbhCXPAl (ORCPT ); Wed, 24 Mar 2021 11:00:41 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 048A3C0613DE for ; Wed, 24 Mar 2021 08:00:41 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id f26so30606090ljp.8 for ; Wed, 24 Mar 2021 08:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AHRJn3HeD8IJU2kEBHlBE7mssbK+pfVkIEgT2l1YUTM=; b=cxYmsvKjXhJjLy3e9DksD1CayKvLvTfTmZH0sVaTZ7cB7jjVCe9KeRuYSijoLFMyKZ X9v9Jp09fef0JVJiKf5rwZLtgN+k+4B14w1RQD0qS8cLZPKxHS3ULBIhUCJ/QG+fSpze I71JnFaX/hjoQsXf4O7PQ6p8u4BelyoJsr5IuKr/Berx4JNttfJvaCKtzRLJHjoG0HHu DSH+qzfRUH7LQr4ODgP2TeWHXBoJhDBWiFE4A2WbF59l6vCZZJC9nmy1Y+TYigEygOdA cdb58TQ0+SfWDyCYYpZEIriXa7mlYz5bBGrR2poKk9ToK62dCcooaoA71ejbqCu9JvaB CRpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AHRJn3HeD8IJU2kEBHlBE7mssbK+pfVkIEgT2l1YUTM=; b=WJh45yrJxVzeDYQ7tp1S91WC2AjLvxk6Sv2GiqqpJuswrzAXYEQ1nAsmKCxzNIdrWg +sb9os84BTgfzZNQs9ZIw5gOUZ7TN/ibGTHbsCT9D0GBVCGvUH+PLZVjP64bIAW8TPis Of0dLjpdi/mYoHrbmkciHnVTSD+zjyGwY68yp3qsvv0RGF+hzQdyAgzMBnzMWkAZ7+hw qcHk5jNreNndbt2j7HNFfs9cvzDfbHovjyQGwcOQIh17vy9it/vWAllD9Jr9PAwxpQIh rIIrJOQhIoA6SaIyQf3zOrLjh1zqkj6esHyumW+ZGyjEOdaoTYu0QNWmM7bo/Kb0UT+e 3/ow== X-Gm-Message-State: AOAM530QUA/RsvoDFRXH4JkjycoC8yjWyu+bAPzKFX9YcLvQO9gwS+ur LFW0dqOdjXKRCeq85hPgyU7NKg== X-Google-Smtp-Source: ABdhPJyVRmXnobLh21+0UZoLstd0UTYvuDgQT5sp6teUqBtBlDADaY3Q6uDvRmbOqLK4Uh4jE4EWZQ== X-Received: by 2002:a2e:b0d4:: with SMTP id g20mr2400673ljl.127.1616598039471; Wed, 24 Mar 2021 08:00:39 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id p5sm252463lfe.154.2021.03.24.08.00.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 08:00:38 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Jonathan Marek Cc: Stephen Boyd , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 07/21] drm/msm/dpu: drop unused lm_max_width from RM Date: Wed, 24 Mar 2021 18:00:10 +0300 Message-Id: <20210324150024.2768215-8-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210324150024.2768215-1-dmitry.baryshkov@linaro.org> References: <20210324150024.2768215-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org No code uses lm_max_width from resource manager, so drop it. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 12 ------------ drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h | 4 ---- 2 files changed, 16 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c index 7792dff60bcd..dbcf4929810b 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c @@ -134,18 +134,6 @@ int dpu_rm_init(struct dpu_rm *rm, goto fail; } rm->mixer_blks[lm->id - LM_0] = &hw->base; - - if (!rm->lm_max_width) { - rm->lm_max_width = lm->sblk->maxwidth; - } else if (rm->lm_max_width != lm->sblk->maxwidth) { - /* - * Don't expect to have hw where lm max widths differ. - * If found, take the min. - */ - DPU_ERROR("unsupported: lm maxwidth differs\n"); - if (rm->lm_max_width > lm->sblk->maxwidth) - rm->lm_max_width = lm->sblk->maxwidth; - } } 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 a618c0ef43db..3f68a1c0dc1e 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h @@ -18,15 +18,11 @@ struct dpu_global_state; * @mixer_blks: array of layer mixer hardware resources * @ctl_blks: array of ctl hardware resources * @intf_blks: array of intf hardware resources - * @lm_max_width: cached layer mixer maximum width - * @rm_lock: resource manager mutex */ struct dpu_rm { struct dpu_hw_blk *mixer_blks[LM_MAX - LM_0]; struct dpu_hw_blk *ctl_blks[CTL_MAX - CTL_0]; struct dpu_hw_blk *intf_blks[INTF_MAX - INTF_0]; - - uint32_t lm_max_width; }; struct dpu_kms; From patchwork Wed Mar 24 15:00:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 408263 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 418F9C433E9 for ; Wed, 24 Mar 2021 15:01:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 309D461A23 for ; Wed, 24 Mar 2021 15:01:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236381AbhCXPA6 (ORCPT ); Wed, 24 Mar 2021 11:00:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236388AbhCXPAq (ORCPT ); Wed, 24 Mar 2021 11:00:46 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBE5FC061763 for ; Wed, 24 Mar 2021 08:00:45 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id 184so30595721ljf.9 for ; Wed, 24 Mar 2021 08:00:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ymuaM6Pd6xrvcM6FbW+2BkGMeDk6kUhNBZmYCuS0atM=; b=XZS/71IelK6zWNH+FZpYDt0mLjGgnRIKztIMBl4jX14TorIG1BVzITyDd1rCACNEFA fxf8BpmHATvgSQ+43t+wJBWkOos52lECPy0Ey7wu5Um8P7EeWetGbmcKrwLWwU8tgV1d EPlw3cIXhOXG9wxrri+ZWKbdh1tQt+4RvK3WxHCFR6NO43BLegiYcED1/cvvRhITy7Ar FmAuSXhXwOPwFTRJpcldmRepcsKyW7BSNN9jLheR/ZbExwECYIECEC/UWZr8lKYeLcoi EFsRTxL003dytcW9+4m5/u9UhhwuJjem5NqoHvpwGTZp/4y7TmmwU2/Cnr0f94MXEvSL 9o4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ymuaM6Pd6xrvcM6FbW+2BkGMeDk6kUhNBZmYCuS0atM=; b=LY+dMk3XttTpkH24OESNp/9FKRFlusES54TCRo9XrU684N7fagI1bo7uzTEfjSLWzD gpAXAmQkCpo5SRu1J+IVKz3r5SGwWIDwXHXu+hg+TZP68Prx5MgMRcPGV2pwZQeL62XA c1nZMBMlgDj7jMyzhxbDz0KFUcbmJnTsSGu7mGocslv2ez2iw89I85JiOinrOfTtGBvv wNqHQFLReEO2tB1xzOZTHyj3y396xc8KSdZek8T+bni6maIcmR3wEhWnDqosFeTdV2D9 NkcM8XJ4QyTKhwSv2Bv4oQxgB7VtZSq9HQdJoKxOi7iMth7DWG9NiTv4W1wjAEEDXo0d Ak0Q== X-Gm-Message-State: AOAM531ljMay08pSBEZMvXLEftLYadWklrBH2Jl00S7K3ph/dJBMmQqE IGhXUuH/FrtgFW2MGpyalWjWPQ== X-Google-Smtp-Source: ABdhPJySUCVwKnhGyJG+czzaQ664CjjfSBftCDz968Vrk2wFwEhmxwKfP11qz6iIc/OqdN+PdMGR8A== X-Received: by 2002:a2e:bc25:: with SMTP id b37mr2403770ljf.342.1616598043831; Wed, 24 Mar 2021 08:00:43 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id p5sm252463lfe.154.2021.03.24.08.00.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 08:00:43 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Jonathan Marek Cc: Stephen Boyd , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 11/21] drm/msm/dpu: call hw_lm ops directly Date: Wed, 24 Mar 2021 18:00:14 +0300 Message-Id: <20210324150024.2768215-12-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210324150024.2768215-1-dmitry.baryshkov@linaro.org> References: <20210324150024.2768215-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Replace dpu_hw_lm callbacks with direct functions calls. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 6 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c | 19 ++------ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h | 59 ++++++++++------------- 3 files changed, 33 insertions(+), 51 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index 56eb22554197..5a0a6741a431 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -84,7 +84,7 @@ static void _dpu_crtc_setup_blend_cfg(struct dpu_crtc_mixer *mixer, DPU_BLEND_BG_INV_ALPHA; } - lm->ops.setup_blend_config(lm, pstate->stage, + dpu_hw_lm_setup_blend_config(lm, pstate->stage, 0xFF, 0, blend_op); DPU_DEBUG("format:%s, alpha_en:%u blend_op:0x%x\n", @@ -112,7 +112,7 @@ static void _dpu_crtc_program_lm_output_roi(struct drm_crtc *crtc) cfg.out_height = drm_rect_height(lm_roi); cfg.right_mixer = lm_horiz_position++; cfg.flags = 0; - hw_lm->ops.setup_mixer_out(hw_lm, &cfg); + dpu_hw_lm_setup_mixer_out(hw_lm, &cfg); } } @@ -217,7 +217,7 @@ static void _dpu_crtc_blend_setup(struct drm_crtc *crtc) ctl = mixer[i].lm_ctl; lm = mixer[i].hw_lm; - lm->ops.setup_alpha_out(lm, mixer[i].mixer_op_mode); + dpu_hw_lm_setup_alpha_out(lm, mixer[i].mixer_op_mode); mixer[i].flush_mask |= ctl->ops.get_bitmask_mixer(ctl, mixer[i].hw_lm->idx); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c index 7d5b620f7f42..1e95d52180cd 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c @@ -59,7 +59,7 @@ static inline int _stage_offset(struct dpu_hw_mixer *ctx, enum dpu_stage stage) return -EINVAL; } -static void dpu_hw_lm_setup_out(struct dpu_hw_mixer *ctx, +void dpu_hw_lm_setup_mixer_out(struct dpu_hw_mixer *ctx, struct dpu_hw_mixer_cfg *mixer) { struct dpu_hw_blk_reg_map *c = &ctx->hw; @@ -79,7 +79,7 @@ static void dpu_hw_lm_setup_out(struct dpu_hw_mixer *ctx, DPU_REG_WRITE(c, LM_OP_MODE, op_mode); } -static void dpu_hw_lm_setup_border_color(struct dpu_hw_mixer *ctx, +void dpu_hw_lm_setup_border_color(struct dpu_hw_mixer *ctx, struct dpu_mdss_color *color, u8 border_en) { @@ -95,7 +95,7 @@ static void dpu_hw_lm_setup_border_color(struct dpu_hw_mixer *ctx, } } -static void dpu_hw_lm_setup_blend_config_sdm845(struct dpu_hw_mixer *ctx, +void dpu_hw_lm_setup_blend_config(struct dpu_hw_mixer *ctx, u32 stage, u32 fg_alpha, u32 bg_alpha, u32 blend_op) { struct dpu_hw_blk_reg_map *c = &ctx->hw; @@ -114,7 +114,7 @@ static void dpu_hw_lm_setup_blend_config_sdm845(struct dpu_hw_mixer *ctx, DPU_REG_WRITE(c, LM_BLEND0_OP + stage_off, blend_op); } -static void dpu_hw_lm_setup_color3(struct dpu_hw_mixer *ctx, +void dpu_hw_lm_setup_alpha_out(struct dpu_hw_mixer *ctx, uint32_t mixer_op_mode) { struct dpu_hw_blk_reg_map *c = &ctx->hw; @@ -128,16 +128,6 @@ static void dpu_hw_lm_setup_color3(struct dpu_hw_mixer *ctx, DPU_REG_WRITE(c, LM_OP_MODE, op_mode); } -static void _setup_mixer_ops(const struct dpu_mdss_cfg *m, - struct dpu_hw_lm_ops *ops, - unsigned long features) -{ - ops->setup_mixer_out = dpu_hw_lm_setup_out; - ops->setup_blend_config = dpu_hw_lm_setup_blend_config_sdm845; - ops->setup_alpha_out = dpu_hw_lm_setup_color3; - ops->setup_border_color = dpu_hw_lm_setup_border_color; -} - struct dpu_hw_mixer *dpu_hw_lm_init(enum dpu_lm idx, void __iomem *addr, const struct dpu_mdss_cfg *m, @@ -159,7 +149,6 @@ struct dpu_hw_mixer *dpu_hw_lm_init(enum dpu_lm idx, /* Assign ops */ c->idx = idx; c->cap = cfg; - _setup_mixer_ops(m, &c->ops, c->cap->features); if (cfg->dspp && cfg->dspp < DSPP_MAX) c->dspp = dpu_hw_dspp_init(cfg->dspp, addr, m); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h index 182740f2914b..a43c1931c5e4 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.h @@ -22,38 +22,34 @@ struct dpu_hw_color3_cfg { u8 keep_fg[DPU_STAGE_MAX]; }; -/** - * - * struct dpu_hw_lm_ops : Interface to the mixer Hw driver functions +/* * Assumption is these functions will be called after clocks are enabled */ -struct dpu_hw_lm_ops { - /* - * Sets up mixer output width and height - * and border color if enabled - */ - void (*setup_mixer_out)(struct dpu_hw_mixer *ctx, - struct dpu_hw_mixer_cfg *cfg); - - /* - * Alpha blending configuration - * for the specified stage - */ - void (*setup_blend_config)(struct dpu_hw_mixer *ctx, uint32_t stage, - uint32_t fg_alpha, uint32_t bg_alpha, uint32_t blend_op); - - /* - * Alpha color component selection from either fg or bg - */ - void (*setup_alpha_out)(struct dpu_hw_mixer *ctx, uint32_t mixer_op); - - /** - * setup_border_color : enable/disable border color - */ - void (*setup_border_color)(struct dpu_hw_mixer *ctx, - struct dpu_mdss_color *color, - u8 border_en); -}; +/* + * Sets up mixer output width and height + * and border color if enabled + */ +void dpu_hw_lm_setup_mixer_out(struct dpu_hw_mixer *ctx, + struct dpu_hw_mixer_cfg *cfg); + +/* + * Alpha blending configuration + * for the specified stage + */ +void dpu_hw_lm_setup_blend_config(struct dpu_hw_mixer *ctx, uint32_t stage, + uint32_t fg_alpha, uint32_t bg_alpha, uint32_t blend_op); + +/* + * Alpha color component selection from either fg or bg + */ +void dpu_hw_lm_setup_alpha_out(struct dpu_hw_mixer *ctx, uint32_t mixer_op); + +/** + * setup_border_color : enable/disable border color + */ +void dpu_hw_lm_setup_border_color(struct dpu_hw_mixer *ctx, + struct dpu_mdss_color *color, + u8 border_en); struct dpu_hw_mixer { struct dpu_hw_blk base; @@ -67,9 +63,6 @@ struct dpu_hw_mixer { struct dpu_hw_pingpong *pingpong; struct dpu_hw_dspp *dspp; - /* ops */ - struct dpu_hw_lm_ops ops; - /* store mixer info specific to display */ struct dpu_hw_mixer_cfg cfg; }; From patchwork Wed Mar 24 15:00:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 408264 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7243EC433F1 for ; Wed, 24 Mar 2021 15:01:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 60DB361A16 for ; Wed, 24 Mar 2021 15:01:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236389AbhCXPA7 (ORCPT ); Wed, 24 Mar 2021 11:00:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236391AbhCXPAs (ORCPT ); Wed, 24 Mar 2021 11:00:48 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 325D1C061763 for ; Wed, 24 Mar 2021 08:00:48 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id u9so2945004ljd.11 for ; Wed, 24 Mar 2021 08:00:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=d5O4S87sSonR8b8YReuDQ+tyO7OoPApI6qR6ZtyWtNo=; b=ag41z3TTI+1hBOp+V0y4TJVbNjU4P32YDILwsy7eFogpNU14hviu29k6mpVJXDa0/O ZAKTkSO145kL4WjVZSc3XzIoAaxYiPPZ9SMz/64GtrFp3ovjG38Rg4O8EBNaWk1O+0Kq XnnFzHB3jqgTkfQ2c2HL3O13OmbKf7NUiJ5OD4GXA62V6Dc4NA/ysda9maA2cIXl/Cm2 cXXPSs+nzdrt7uH5OcNULCqokEROmZKlR1ekDxYlKzVsPEMJOphetpg0MvnjLar5EJBH 3Q6jZjWbGGzkoihRkVXkCAHYbmYer8U2Wb1xszsMI0DsTJ+wCBHQKGudylwMsWa0fvsi 9bag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d5O4S87sSonR8b8YReuDQ+tyO7OoPApI6qR6ZtyWtNo=; b=CuCyZWWx5rLnt/uacH97ZwFFurdax1coYfuyXsboLtqXDmDwWDRSbd2ms0JQW4Q+xw c5JiliDHvfoEAmXssEJciis3CfdsaFAm5t6q48Gby2D4ziOXqceyEtFH8fmsY+itFTLr JKMsAUzZzvC9Sq/UqESSx12CVDT9PhKjJCln5nU7B0Om+lm3nLOTKLFUqHtp9gJZtPOf rhw7bZqIB8Hwze7cQdn8SrXIPoWZw5Ix7jHPFXO9AJ06vV/diQbmO3F2T0d/63moa8Oa IvuycLmUUWVy0cSUthFel3dOH/mtg9ltXuy8WzHdO5f7D/KsSJDxt2UKR4dQ3Q9tMW4g jrNQ== X-Gm-Message-State: AOAM530okRxYWZM3sO7BM1YziRhXEpjiPiXzIft3AAztvHkXmTP/s9Q/ BTIkuhLzpF1ZO3PGmDVFUeoMeQ== X-Google-Smtp-Source: ABdhPJxKAmSj+KeuEBTRDy807NV2uoHenAL8d/JKDr/XiRp5IT+zSvPM1S4LjmLY5sC2E0blLpRhcw== X-Received: by 2002:a2e:6c10:: with SMTP id h16mr2397033ljc.388.1616598045961; Wed, 24 Mar 2021 08:00:45 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id p5sm252463lfe.154.2021.03.24.08.00.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 08:00:45 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Jonathan Marek Cc: Stephen Boyd , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 13/21] drm/msm/dpu: hw_pp: make setup_dither mandatory Date: Wed, 24 Mar 2021 18:00:16 +0300 Message-Id: <20210324150024.2768215-14-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210324150024.2768215-1-dmitry.baryshkov@linaro.org> References: <20210324150024.2768215-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org All supported hardware instances feature DPU_PINGPONG_DITHER option, so just mark setup_dither as mandatory rather than optional callback. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 3 --- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 3 +-- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index f80694456fd6..ac03f329491d 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -217,9 +217,6 @@ static void _dpu_encoder_setup_dither(struct dpu_hw_pingpong *hw_pp, unsigned bp { struct dpu_hw_dither_cfg dither_cfg = { 0 }; - if (!hw_pp->ops.setup_dither) - return; - switch (bpc) { case 6: dither_cfg.c0_bitdepth = 6; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c index 89c1123d957f..5c1ce835cf49 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c @@ -258,8 +258,7 @@ static void _setup_pingpong_ops(struct dpu_hw_pingpong *c, c->ops.poll_timeout_wr_ptr = dpu_hw_pp_poll_timeout_wr_ptr; c->ops.get_line_count = dpu_hw_pp_get_line_count; - if (test_bit(DPU_PINGPONG_DITHER, &features)) - c->ops.setup_dither = dpu_hw_pp_setup_dither; + c->ops.setup_dither = dpu_hw_pp_setup_dither; }; struct dpu_hw_pingpong *dpu_hw_pingpong_init(enum dpu_pingpong idx, From patchwork Wed Mar 24 15:00:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 408261 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7B08C433F7 for ; Wed, 24 Mar 2021 15:01:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8FA8361A0A for ; Wed, 24 Mar 2021 15:01:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236393AbhCXPA7 (ORCPT ); Wed, 24 Mar 2021 11:00:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236397AbhCXPAu (ORCPT ); Wed, 24 Mar 2021 11:00:50 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4999DC061763 for ; Wed, 24 Mar 2021 08:00:50 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id a1so30626953ljp.2 for ; Wed, 24 Mar 2021 08:00:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4xBWnRFLzgW237I3IPU/dTmdpNU+vr+gRr0l627r2lg=; b=F3Ho8iwroYaQFu7HWMIfe3Za6LaUXey1JCQsLwM4KwIUpSki/hqQymQW42OZosdgwz 3zMdOEsKwEwVGqlho38UHAsxn06rGlrTlbPvvhf/B45A3hDb/9oNty/00/oqfYvIYVat A7e8+SkMO656TvubyMtLYrP6WldX+xkv8OoBI/v+Ct18NXRoxvOlkUXR/XOwTMwvQrGA Js5LvJnwKjvcNpZO7j4GO0B+WSa5ENHcYoIZIuJ/J76mcVsWnh07FCd2owUSXMMibp9M Zo74urrWNJJMxxPrHoMR7BohLQjITVKt4YM1yGpIrzMO5ULU4t5QIi2iu/6F5ueBvFWR g8GA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4xBWnRFLzgW237I3IPU/dTmdpNU+vr+gRr0l627r2lg=; b=qdmiqN74DsJTxpNi8aF7f897vGx5O2MCK6/xlaA4NsqpqTq4lo/2lxkNlzuW9+ZhLU A6DfDPjte686pC2iGXJsmGZlSBqVMIULOrPnuFNV8dW6mk138CFLmm2YePs3CtQK80E0 Q+KOyh+4q7bCxy4Of/JXVMZYTHgTQFXrXxZgv/dEgCGivzU5ki9Si4xVM9N8ZqFOLp8U 0TO88+H/RX7OImLZ7Hr2sVv3GVV6k//JivZj2O5sSftlFYeYzvHD8iHStDMizOA95LOU Bei9IhetzxjrNZDC3xAzX968vtsdb7eEDrHcxhAhpPnrvFUUFF0arWJ4AqlukacTeYpX 1Idg== X-Gm-Message-State: AOAM532BFeUVdIpdhIU5BERtdwQWJkbAWoi528TcDSA+mxEVoemxQ1v9 b0uuyeSJotHFRpiDGI0FoWLQxGqafa0WVg== X-Google-Smtp-Source: ABdhPJw/1RFMmGWS/+ddpoGpWFFHQqI/jXqv4YP30SQqM0oTtdHyWByokbJH4u3YHs3JXKdcT//Q1A== X-Received: by 2002:a2e:9809:: with SMTP id a9mr2339301ljj.323.1616598048646; Wed, 24 Mar 2021 08:00:48 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id p5sm252463lfe.154.2021.03.24.08.00.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 08:00:47 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Jonathan Marek Cc: Stephen Boyd , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 15/21] drm/msm/dpu: call hw_merge_3d ops directly Date: Wed, 24 Mar 2021 18:00:18 +0300 Message-Id: <20210324150024.2768215-16-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210324150024.2768215-1-dmitry.baryshkov@linaro.org> References: <20210324150024.2768215-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Replace dpu_hw_merge_3d callbacks with direct functions calls. Signed-off-by: Dmitry Baryshkov --- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_merge3d.c | 9 +-------- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_merge3d.h | 13 ++----------- 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c index b6a004ca3927..868bb2f06125 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c @@ -299,7 +299,7 @@ static void dpu_encoder_phys_vid_setup_timing_engine( phys_enc->hw_pp->idx); if (phys_enc->hw_pp->merge_3d) - phys_enc->hw_pp->merge_3d->ops.setup_3d_mode(phys_enc->hw_pp->merge_3d, intf_cfg.mode_3d); + dpu_hw_merge_3d_setup_3d_mode(phys_enc->hw_pp->merge_3d, intf_cfg.mode_3d); spin_unlock_irqrestore(phys_enc->enc_spinlock, lock_flags); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_merge3d.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_merge3d.c index 406ba950a066..4f23bd96b6b9 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_merge3d.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_merge3d.c @@ -35,7 +35,7 @@ static const struct dpu_merge_3d_cfg *_merge_3d_offset(enum dpu_merge_3d idx, return ERR_PTR(-EINVAL); } -static void dpu_hw_merge_3d_setup_3d_mode(struct dpu_hw_merge_3d *merge_3d, +void dpu_hw_merge_3d_setup_3d_mode(struct dpu_hw_merge_3d *merge_3d, enum dpu_3d_blend_mode mode_3d) { struct dpu_hw_blk_reg_map *c; @@ -52,12 +52,6 @@ static void dpu_hw_merge_3d_setup_3d_mode(struct dpu_hw_merge_3d *merge_3d, } } -static void _setup_merge_3d_ops(struct dpu_hw_merge_3d *c, - unsigned long features) -{ - c->ops.setup_3d_mode = dpu_hw_merge_3d_setup_3d_mode; -}; - struct dpu_hw_merge_3d *dpu_hw_merge_3d_init(enum dpu_merge_3d idx, void __iomem *addr, const struct dpu_mdss_cfg *m) @@ -77,7 +71,6 @@ struct dpu_hw_merge_3d *dpu_hw_merge_3d_init(enum dpu_merge_3d idx, c->idx = idx; c->caps = cfg; - _setup_merge_3d_ops(c, c->caps->features); dpu_hw_blk_init(&c->base, DPU_HW_BLK_MERGE_3D, idx); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_merge3d.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_merge3d.h index 870bdb14613e..024e8462ef7f 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_merge3d.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_merge3d.h @@ -12,18 +12,12 @@ struct dpu_hw_merge_3d; -/** - * - * struct dpu_hw_merge_3d_ops : Interface to the merge_3d Hw driver functions +/* * Assumption is these functions will be called after clocks are enabled - * @setup_3d_mode : enable 3D merge */ -struct dpu_hw_merge_3d_ops { - void (*setup_3d_mode)(struct dpu_hw_merge_3d *merge_3d, +void dpu_hw_merge_3d_setup_3d_mode(struct dpu_hw_merge_3d *merge_3d, enum dpu_3d_blend_mode mode_3d); -}; - struct dpu_hw_merge_3d { struct dpu_hw_blk base; struct dpu_hw_blk_reg_map hw; @@ -31,9 +25,6 @@ struct dpu_hw_merge_3d { /* merge_3d */ enum dpu_merge_3d idx; const struct dpu_merge_3d_cfg *caps; - - /* ops */ - struct dpu_hw_merge_3d_ops ops; }; /** From patchwork Wed Mar 24 15:00:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 408260 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85FB6C433C1 for ; Wed, 24 Mar 2021 15:01:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5E49A61A06 for ; Wed, 24 Mar 2021 15:01:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236368AbhCXPB2 (ORCPT ); Wed, 24 Mar 2021 11:01:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236380AbhCXPA6 (ORCPT ); Wed, 24 Mar 2021 11:00:58 -0400 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED26BC061763 for ; Wed, 24 Mar 2021 08:00:57 -0700 (PDT) Received: by mail-lj1-x231.google.com with SMTP id r20so30619479ljk.4 for ; Wed, 24 Mar 2021 08:00:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=26IOf6ZGfzqvI713tnEwpFJ5rZXSRn45wHEBAEtfFJw=; b=bEU4tJj2hUeNmYMj40zFcr+OdrAN7FwpKiGZp8uV1d3eqdI4CntrRVHwQf32ki++uf 4KGsaLSW6+6+xNVGRwm8y3ECdHik1YaU37DghmO5i4oSvIfaf+aiqUBTi2Ll7e1l/xra 6Z9W1yKnjAkjNltc4/bA0s/gyf87F+3jOcPtXVZrFaUj9gxmlS1gr8zmZ126sh5lE+hK 1zjCrRw9MOge75GOILWftmoYoHvukqP58/tX8of1h5dQlOQXam5hdFyIVP5+HIPoSw91 btZ7qwFsAIg9IG98eF8p0Gs4NSLaffwyUNiLCmgZ7rEsFUQ+vbC5vymkbEr0a5hWLmQk a+MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=26IOf6ZGfzqvI713tnEwpFJ5rZXSRn45wHEBAEtfFJw=; b=pL8ucr8RbgT6Eii8+GwScGcBBr+fdYSW5Sf57nBesis0ffmz63HyhRgs5TNq3hCIge k8n3QtXVNGG1UtLjgWGhmlxCHov3KcehFN1qQw9rpQZm1wioUzubAwZoRzNFbkNGQx/D Ow/ZcCY9LYsrxdJr9ELXNTWnZ5HfXmdlZshTEKxaVonsJcVhPhJDh0SI21txENwZV4Xi mXw4w+55tFCojH2ulTNogJYM+REc6pszVI472kqUQ//WpGzFxmPGHqrJ/MNT8a74hSNi 0STVxb2hoD+Jr86z9OSImU9zMtDpUeHOuWj09YVDGy/G1AO3dHT9EEDByY2atQSZG4Ph K9bQ== X-Gm-Message-State: AOAM532B+oACEE0rQE4KsCu76Sol++dNTri2rYG+goUQEiQzBLeBFdx6 Q4vSBVhmBFJiGktn39hhPhFDWA== X-Google-Smtp-Source: ABdhPJw1DTyDNc5Uk4UUuw0ofKPSgYgDUc7v5H+MYCxYXtkoEhw/ZjgfqGG/gGQ+T7XJAEdae5ylTg== X-Received: by 2002:a2e:95d6:: with SMTP id y22mr2334376ljh.361.1616598053703; Wed, 24 Mar 2021 08:00:53 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id p5sm252463lfe.154.2021.03.24.08.00.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 08:00:53 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Jonathan Marek Cc: Stephen Boyd , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 19/21] drm/msm/dpu: call hw_vbif ops directly Date: Wed, 24 Mar 2021 18:00:22 +0300 Message-Id: <20210324150024.2768215-20-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210324150024.2768215-1-dmitry.baryshkov@linaro.org> References: <20210324150024.2768215-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Replace dpu_hw_vbif callbacks with direct functions calls. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_vbif.c | 30 +--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_vbif.h | 159 ++++++++++---------- drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c | 39 ++--- 3 files changed, 100 insertions(+), 128 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_vbif.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_vbif.c index 377d5e8ae615..d7d2e7edc0e3 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_vbif.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_vbif.c @@ -32,7 +32,7 @@ #define VBIF_XINL_QOS_RP_REMAP_000 0x0550 #define VBIF_XINL_QOS_LVL_REMAP_000(v) (v < DPU_HW_VER_400 ? 0x570 : 0x0590) -static void dpu_hw_clear_errors(struct dpu_hw_vbif *vbif, +void dpu_hw_vbif_clear_errors(struct dpu_hw_vbif *vbif, u32 *pnd_errors, u32 *src_errors) { struct dpu_hw_blk_reg_map *c; @@ -52,7 +52,7 @@ static void dpu_hw_clear_errors(struct dpu_hw_vbif *vbif, DPU_REG_WRITE(c, VBIF_XIN_CLR_ERR, pnd | src); } -static void dpu_hw_set_mem_type(struct dpu_hw_vbif *vbif, +void dpu_hw_vbif_set_mem_type(struct dpu_hw_vbif *vbif, u32 xin_id, u32 value) { struct dpu_hw_blk_reg_map *c; @@ -82,7 +82,7 @@ static void dpu_hw_set_mem_type(struct dpu_hw_vbif *vbif, DPU_REG_WRITE(c, reg_off, reg_val); } -static void dpu_hw_set_limit_conf(struct dpu_hw_vbif *vbif, +void dpu_hw_vbif_set_limit_conf(struct dpu_hw_vbif *vbif, u32 xin_id, bool rd, u32 limit) { struct dpu_hw_blk_reg_map *c = &vbif->hw; @@ -103,7 +103,7 @@ static void dpu_hw_set_limit_conf(struct dpu_hw_vbif *vbif, DPU_REG_WRITE(c, reg_off, reg_val); } -static u32 dpu_hw_get_limit_conf(struct dpu_hw_vbif *vbif, +u32 dpu_hw_vbif_get_limit_conf(struct dpu_hw_vbif *vbif, u32 xin_id, bool rd) { struct dpu_hw_blk_reg_map *c = &vbif->hw; @@ -125,7 +125,7 @@ static u32 dpu_hw_get_limit_conf(struct dpu_hw_vbif *vbif, return limit; } -static void dpu_hw_set_halt_ctrl(struct dpu_hw_vbif *vbif, +void dpu_hw_vbif_set_halt_ctrl(struct dpu_hw_vbif *vbif, u32 xin_id, bool enable) { struct dpu_hw_blk_reg_map *c = &vbif->hw; @@ -141,7 +141,7 @@ static void dpu_hw_set_halt_ctrl(struct dpu_hw_vbif *vbif, DPU_REG_WRITE(c, VBIF_XIN_HALT_CTRL0, reg_val); } -static bool dpu_hw_get_halt_ctrl(struct dpu_hw_vbif *vbif, +bool dpu_hw_vbif_get_halt_ctrl(struct dpu_hw_vbif *vbif, u32 xin_id) { struct dpu_hw_blk_reg_map *c = &vbif->hw; @@ -152,7 +152,7 @@ static bool dpu_hw_get_halt_ctrl(struct dpu_hw_vbif *vbif, return (reg_val & BIT(xin_id)) ? true : false; } -static void dpu_hw_set_qos_remap(struct dpu_hw_vbif *vbif, +void dpu_hw_vbif_set_qos_remap(struct dpu_hw_vbif *vbif, u32 xin_id, u32 level, u32 remap_level) { struct dpu_hw_blk_reg_map *c; @@ -182,7 +182,7 @@ static void dpu_hw_set_qos_remap(struct dpu_hw_vbif *vbif, DPU_REG_WRITE(c, reg_lvl + reg_high, reg_val_lvl); } -static void dpu_hw_set_write_gather_en(struct dpu_hw_vbif *vbif, u32 xin_id) +void dpu_hw_vbif_set_write_gather_en(struct dpu_hw_vbif *vbif, u32 xin_id) { struct dpu_hw_blk_reg_map *c; u32 reg_val; @@ -197,19 +197,6 @@ static void dpu_hw_set_write_gather_en(struct dpu_hw_vbif *vbif, u32 xin_id) DPU_REG_WRITE(c, VBIF_WRITE_GATHER_EN, reg_val); } -static void _setup_vbif_ops(struct dpu_hw_vbif_ops *ops, - unsigned long cap) -{ - ops->set_limit_conf = dpu_hw_set_limit_conf; - ops->get_limit_conf = dpu_hw_get_limit_conf; - ops->set_halt_ctrl = dpu_hw_set_halt_ctrl; - ops->get_halt_ctrl = dpu_hw_get_halt_ctrl; - ops->set_qos_remap = dpu_hw_set_qos_remap; - ops->set_mem_type = dpu_hw_set_mem_type; - ops->clear_errors = dpu_hw_clear_errors; - ops->set_write_gather_en = dpu_hw_set_write_gather_en; -} - static const struct dpu_vbif_cfg *_top_offset(enum dpu_vbif vbif, const struct dpu_mdss_cfg *m, void __iomem *addr, @@ -253,7 +240,6 @@ struct dpu_hw_vbif *dpu_hw_vbif_init(enum dpu_vbif idx, */ c->idx = idx; c->cap = cfg; - _setup_vbif_ops(&c->ops, c->cap->features); /* no need to register sub-range in dpu dbg, dump entire vbif io base */ diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_vbif.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_vbif.h index 6417aa28d32c..7a81f0729d9b 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_vbif.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_vbif.h @@ -11,87 +11,85 @@ struct dpu_hw_vbif; -/** - * struct dpu_hw_vbif_ops : Interface to the VBIF hardware driver functions +/* * Assumption is these functions will be called after clocks are enabled */ -struct dpu_hw_vbif_ops { - /** - * set_limit_conf - set transaction limit config - * @vbif: vbif context driver - * @xin_id: client interface identifier - * @rd: true for read limit; false for write limit - * @limit: outstanding transaction limit - */ - void (*set_limit_conf)(struct dpu_hw_vbif *vbif, - u32 xin_id, bool rd, u32 limit); - - /** - * get_limit_conf - get transaction limit config - * @vbif: vbif context driver - * @xin_id: client interface identifier - * @rd: true for read limit; false for write limit - * @return: outstanding transaction limit - */ - u32 (*get_limit_conf)(struct dpu_hw_vbif *vbif, - u32 xin_id, bool rd); - - /** - * set_halt_ctrl - set halt control - * @vbif: vbif context driver - * @xin_id: client interface identifier - * @enable: halt control enable - */ - void (*set_halt_ctrl)(struct dpu_hw_vbif *vbif, - u32 xin_id, bool enable); - - /** - * get_halt_ctrl - get halt control - * @vbif: vbif context driver - * @xin_id: client interface identifier - * @return: halt control enable - */ - bool (*get_halt_ctrl)(struct dpu_hw_vbif *vbif, - u32 xin_id); - - /** - * set_qos_remap - set QoS priority remap - * @vbif: vbif context driver - * @xin_id: client interface identifier - * @level: priority level - * @remap_level: remapped level - */ - void (*set_qos_remap)(struct dpu_hw_vbif *vbif, - u32 xin_id, u32 level, u32 remap_level); - - /** - * set_mem_type - set memory type - * @vbif: vbif context driver - * @xin_id: client interface identifier - * @value: memory type value - */ - void (*set_mem_type)(struct dpu_hw_vbif *vbif, - u32 xin_id, u32 value); - - /** - * clear_errors - clear any vbif errors - * This function clears any detected pending/source errors - * on the VBIF interface, and optionally returns the detected - * error mask(s). - * @vbif: vbif context driver - * @pnd_errors: pointer to pending error reporting variable - * @src_errors: pointer to source error reporting variable - */ - void (*clear_errors)(struct dpu_hw_vbif *vbif, - u32 *pnd_errors, u32 *src_errors); - - /** - * set_write_gather_en - set write_gather enable - * @vbif: vbif context driver - * @xin_id: client interface identifier - */ - void (*set_write_gather_en)(struct dpu_hw_vbif *vbif, u32 xin_id); -}; + +/** + * dpu_hw_vbif_set_limit_conf - set transaction limit config + * @vbif: vbif context driver + * @xin_id: client interface identifier + * @rd: true for read limit; false for write limit + * @limit: outstanding transaction limit + */ +void dpu_hw_vbif_set_limit_conf(struct dpu_hw_vbif *vbif, + u32 xin_id, bool rd, u32 limit); + +/** + * dpu_hw_vbif_get_limit_conf - get transaction limit config + * @vbif: vbif context driver + * @xin_id: client interface identifier + * @rd: true for read limit; false for write limit + * @return: outstanding transaction limit + */ +u32 dpu_hw_vbif_get_limit_conf(struct dpu_hw_vbif *vbif, + u32 xin_id, bool rd); + +/** + * dpu_hw_vbif_set_halt_ctrl - set halt control + * @vbif: vbif context driver + * @xin_id: client interface identifier + * @enable: halt control enable + */ +void dpu_hw_vbif_set_halt_ctrl(struct dpu_hw_vbif *vbif, + u32 xin_id, bool enable); + +/** + * dpu_hw_vbif_get_halt_ctrl - get halt control + * @vbif: vbif context driver + * @xin_id: client interface identifier + * @return: halt control enable + */ +bool dpu_hw_vbif_get_halt_ctrl(struct dpu_hw_vbif *vbif, + u32 xin_id); + +/** + * dpu_hw_vbif_set_qos_remap - set QoS priority remap + * @vbif: vbif context driver + * @xin_id: client interface identifier + * @level: priority level + * @remap_level: remapped level + */ +void dpu_hw_vbif_set_qos_remap(struct dpu_hw_vbif *vbif, + u32 xin_id, u32 level, u32 remap_level); + +/** + * dpu_hw_vbif_set_mem_type - set memory type + * @vbif: vbif context driver + * @xin_id: client interface identifier + * @value: memory type value + */ +void dpu_hw_vbif_set_mem_type(struct dpu_hw_vbif *vbif, + u32 xin_id, u32 value); + +/** + * dpu_hw_vbif_clear_errors - clear any vbif errors + * This function clears any detected pending/source errors + * on the VBIF interface, and optionally returns the detected + * error mask(s). + * @vbif: vbif context driver + * @pnd_errors: pointer to pending error reporting variable + * @src_errors: pointer to source error reporting variable + */ +void dpu_hw_vbif_clear_errors(struct dpu_hw_vbif *vbif, + u32 *pnd_errors, u32 *src_errors); + +/** + * dpu_hw_vbif_set_write_gather_en - set write_gather enable + * @vbif: vbif context driver + * @xin_id: client interface identifier + */ +void dpu_hw_vbif_set_write_gather_en(struct dpu_hw_vbif *vbif, u32 xin_id); struct dpu_hw_vbif { /* base */ @@ -100,9 +98,6 @@ struct dpu_hw_vbif { /* vbif */ enum dpu_vbif idx; const struct dpu_vbif_cfg *cap; - - /* ops */ - struct dpu_hw_vbif_ops ops; }; /** diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c index c9351c69834a..776da9e834a0 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c @@ -23,18 +23,18 @@ static int _dpu_vbif_wait_for_xin_halt(struct dpu_hw_vbif *vbif, u32 xin_id) bool status; int rc; - if (!vbif || !vbif->cap || !vbif->ops.get_halt_ctrl) { + if (!vbif || !vbif->cap) { DPU_ERROR("invalid arguments vbif %d\n", vbif != NULL); return -EINVAL; } timeout = ktime_add_us(ktime_get(), vbif->cap->xin_halt_timeout); for (;;) { - status = vbif->ops.get_halt_ctrl(vbif, xin_id); + status = dpu_hw_vbif_get_halt_ctrl(vbif, xin_id); if (status) break; if (ktime_compare_safe(ktime_get(), timeout) > 0) { - status = vbif->ops.get_halt_ctrl(vbif, xin_id); + status = dpu_hw_vbif_get_halt_ctrl(vbif, xin_id); break; } usleep_range(501, 1000); @@ -125,8 +125,8 @@ static u32 _dpu_vbif_get_ot_limit(struct dpu_hw_vbif *vbif, /* Modify the limits if the target and the use case requires it */ _dpu_vbif_apply_dynamic_ot_limit(vbif, &ot_lim, params); - if (vbif && vbif->ops.get_limit_conf) { - val = vbif->ops.get_limit_conf(vbif, + if (vbif) { + val = dpu_hw_vbif_get_limit_conf(vbif, params->xin_id, params->rd); if (val == ot_lim) ot_lim = 0; @@ -168,13 +168,9 @@ void dpu_vbif_set_ot_limit(struct dpu_kms *dpu_kms, return; } - if (!vbif->ops.set_limit_conf || - !vbif->ops.set_halt_ctrl) - return; - /* set write_gather_en for all write clients */ - if (vbif->ops.set_write_gather_en && !params->rd) - vbif->ops.set_write_gather_en(vbif, params->xin_id); + if (!params->rd) + dpu_hw_vbif_set_write_gather_en(vbif, params->xin_id); ot_lim = _dpu_vbif_get_ot_limit(vbif, params) & 0xFF; @@ -186,15 +182,15 @@ void dpu_vbif_set_ot_limit(struct dpu_kms *dpu_kms, forced_on = dpu_hw_setup_clk_force_ctrl(mdp, params->clk_ctrl, true); - vbif->ops.set_limit_conf(vbif, params->xin_id, params->rd, ot_lim); + dpu_hw_vbif_set_limit_conf(vbif, params->xin_id, params->rd, ot_lim); - vbif->ops.set_halt_ctrl(vbif, params->xin_id, true); + dpu_hw_vbif_set_halt_ctrl(vbif, params->xin_id, true); ret = _dpu_vbif_wait_for_xin_halt(vbif, params->xin_id); if (ret) trace_dpu_vbif_wait_xin_halt_fail(vbif->idx, params->xin_id); - vbif->ops.set_halt_ctrl(vbif, params->xin_id, false); + dpu_hw_vbif_set_halt_ctrl(vbif, params->xin_id, false); if (forced_on) dpu_hw_setup_clk_force_ctrl(mdp, params->clk_ctrl, false); @@ -228,11 +224,6 @@ void dpu_vbif_set_qos_remap(struct dpu_kms *dpu_kms, return; } - if (!vbif->ops.set_qos_remap) { - DPU_DEBUG("qos remap not supported\n"); - return; - } - qos_tbl = params->is_rt ? &vbif->cap->qos_rt_tbl : &vbif->cap->qos_nrt_tbl; @@ -247,7 +238,7 @@ void dpu_vbif_set_qos_remap(struct dpu_kms *dpu_kms, DPU_DEBUG("vbif:%d xin:%d lvl:%d/%d\n", params->vbif_idx, params->xin_id, i, qos_tbl->priority_lvl[i]); - vbif->ops.set_qos_remap(vbif, params->xin_id, i, + dpu_hw_vbif_set_qos_remap(vbif, params->xin_id, i, qos_tbl->priority_lvl[i]); } @@ -262,8 +253,8 @@ void dpu_vbif_clear_errors(struct dpu_kms *dpu_kms) for (i = 0; i < ARRAY_SIZE(dpu_kms->hw_vbif); i++) { vbif = dpu_kms->hw_vbif[i]; - if (vbif && vbif->ops.clear_errors) { - vbif->ops.clear_errors(vbif, &pnd, &src); + if (vbif) { + dpu_hw_vbif_clear_errors(vbif, &pnd, &src); if (pnd || src) { DRM_DEBUG_KMS("VBIF %d: pnd 0x%X, src 0x%X\n", vbif->idx - VBIF_0, pnd, src); @@ -279,9 +270,9 @@ void dpu_vbif_init_memtypes(struct dpu_kms *dpu_kms) for (i = 0; i < ARRAY_SIZE(dpu_kms->hw_vbif); i++) { vbif = dpu_kms->hw_vbif[i]; - if (vbif && vbif->cap && vbif->ops.set_mem_type) { + if (vbif && vbif->cap) { for (j = 0; j < vbif->cap->memtype_count; j++) - vbif->ops.set_mem_type( + dpu_hw_vbif_set_mem_type( vbif, j, vbif->cap->memtype[j]); } } From patchwork Wed Mar 24 15:00:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 408259 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10AC4C433E2 for ; Wed, 24 Mar 2021 15:01:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DF35561A1F for ; Wed, 24 Mar 2021 15:01:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236399AbhCXPB3 (ORCPT ); Wed, 24 Mar 2021 11:01:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236420AbhCXPBB (ORCPT ); Wed, 24 Mar 2021 11:01:01 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 198BCC061763 for ; Wed, 24 Mar 2021 08:01:01 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id o10so32456951lfb.9 for ; Wed, 24 Mar 2021 08:01:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=K+oEmbTI+ZjniTkaGXPzbMX+/sehusvnH9bTTAOnwik=; b=h3TsOptXkBV6pylgZf1iYu94H3nrLg1EwnaNNEn9LlAolu9IzdqonaCKrZyL11Gn4N oHvLrS4PHorXoD4nkVdZhJGWSVAOnFT/SLBFpdjUxWz6DSgsj9QXiByoje7C/1ulCkUM lN4o0qCZyrEky1Qfe/p+65IVZV79m5NOv25qPIdsJzXejeSQeX8YlHK8D+WaL6VykIeC PLSlhFrBN6nbEgbCFF8RrG93yw8wg53Y6UZqhD8T3qdJX99/HfHp68gtARw9ce3+mgxZ 4SixgYMilY+/VyQ/Eod/obkuI5dMCvhOyonvrfnvgFHve1ZgttAdeykzA/S4bajScUK2 N6Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=K+oEmbTI+ZjniTkaGXPzbMX+/sehusvnH9bTTAOnwik=; b=RxnGDWH6xb0dc/bIxv4VmMVplCncTwI6b3IW1XOyCYIkiUUKXk8s46dOaNaHcug3Uy 4o0JJ4shKJvuWUe1kvCZLbrf+GRlouHCqC5G2n567C1zUtRRpcgAqwesQ+eei/X7wygb lpua73Am1ihlykoyxdjuOf4Czy/pR2UzByYpayd8r5JgvI7RmWHUzPGPJs9tAbKKXKik 5x8fYDj3lZQ+dxvnJ1bA1n0FiCrxXB/iu7vZPXS284DTzjb4AOwASxnZWjAB1jcGvlNd 2WQib3Q+heNUJLPdOYrF5pgCjKNFVLJsnXBq39IMxOZHVKLQzeuRw6ACrTsPl32JMwaq vmMw== X-Gm-Message-State: AOAM533WerIwh2zRI9rP0o5tK68EveaGeJXioFiT7jBzfdWNk3h/W+he 1YI+bU2c6f/gST/E0YzwWiEJnw== X-Google-Smtp-Source: ABdhPJyHdvvAdtwxnzTedyfBeteO6j/xvWanyBm7xmdbrtMm3eiFqf7AGt26qzEdoqSXtqCjQLSkng== X-Received: by 2002:a19:b81:: with SMTP id 123mr2193932lfl.553.1616598055149; Wed, 24 Mar 2021 08:00:55 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id p5sm252463lfe.154.2021.03.24.08.00.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 08:00:54 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Jonathan Marek Cc: Stephen Boyd , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 20/21] drm/msm/dpu: fix smart dma support Date: Wed, 24 Mar 2021 18:00:23 +0300 Message-Id: <20210324150024.2768215-21-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210324150024.2768215-1-dmitry.baryshkov@linaro.org> References: <20210324150024.2768215-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Downstream driver uses dpu->caps->smart_dma_rev to update sspp->cap->features with the bit corresponding to the supported SmartDMA version. Upstream driver does not do this, resulting in SSPP subdriver not enbaling setup_multirect callback. Make SSPP subdriver check global smart_dma_rev to decide if setup_multirect should be enabled. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 8 ++++---- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 16 ++++++++++++---- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 9 +++++---- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c index f21f630af476..5552f45f818c 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c @@ -145,7 +145,7 @@ static const struct dpu_caps sdm845_dpu_caps = { .max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH, .max_mixer_blendstages = 0xb, .qseed_type = DPU_SSPP_SCALER_QSEED3, - .smart_dma_rev = DPU_SSPP_SMART_DMA_V2, + .smart_dma_rev = DPU_SMART_DMA_V2, .ubwc_version = DPU_HW_UBWC_VER_20, .has_src_split = true, .has_dim_layer = true, @@ -161,7 +161,7 @@ static const struct dpu_caps sc7180_dpu_caps = { .max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH, .max_mixer_blendstages = 0x9, .qseed_type = DPU_SSPP_SCALER_QSEED4, - .smart_dma_rev = DPU_SSPP_SMART_DMA_V2, + .smart_dma_rev = DPU_SMART_DMA_V2, .ubwc_version = DPU_HW_UBWC_VER_20, .has_dim_layer = true, .has_idle_pc = true, @@ -173,7 +173,7 @@ static const struct dpu_caps sm8150_dpu_caps = { .max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH, .max_mixer_blendstages = 0xb, .qseed_type = DPU_SSPP_SCALER_QSEED3, - .smart_dma_rev = DPU_SSPP_SMART_DMA_V2, /* TODO: v2.5 */ + .smart_dma_rev = DPU_SMART_DMA_V2, /* TODO: v2.5 */ .ubwc_version = DPU_HW_UBWC_VER_30, .has_src_split = true, .has_dim_layer = true, @@ -189,7 +189,7 @@ static const struct dpu_caps sm8250_dpu_caps = { .max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH, .max_mixer_blendstages = 0xb, .qseed_type = DPU_SSPP_SCALER_QSEED3LITE, - .smart_dma_rev = DPU_SSPP_SMART_DMA_V2, /* TODO: v2.5 */ + .smart_dma_rev = DPU_SMART_DMA_V2, /* TODO: v2.5 */ .ubwc_version = DPU_HW_UBWC_VER_40, .has_src_split = true, .has_dim_layer = true, diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h index 08864f0addc4..1202a82918eb 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h @@ -70,6 +70,18 @@ enum { DPU_HW_UBWC_VER_40 = 0x400, }; +/** + * SmartDMA support + * @DPU_SMART_DMA_UNSUPPORTED, SmartDMA not support + * @DPU_SMART_DMA_V1, SmartDMA 1.0 support + * @DPU_SMART_DMA_V2, SmartDMA 2.0 support + */ +enum { + DPU_SMART_DMA_UNSUPPORTED, + DPU_SMART_DMA_V1, + DPU_SMART_DMA_V2, +}; + /** * MDP TOP BLOCK features * @DPU_MDP_PANIC_PER_PIPE Panic configuration needs to be be done per pipe @@ -104,8 +116,6 @@ enum { * @DPU_SSPP_QOS, SSPP support QoS control, danger/safe/creq * @DPU_SSPP_QOS_8LVL, SSPP support 8-level QoS control * @DPU_SSPP_EXCL_RECT, SSPP supports exclusion rect - * @DPU_SSPP_SMART_DMA_V1, SmartDMA 1.0 support - * @DPU_SSPP_SMART_DMA_V2, SmartDMA 2.0 support * @DPU_SSPP_TS_PREFILL Supports prefill with traffic shaper * @DPU_SSPP_TS_PREFILL_REC1 Supports prefill with traffic shaper multirec * @DPU_SSPP_CDP Supports client driven prefetch @@ -124,8 +134,6 @@ enum { DPU_SSPP_QOS, DPU_SSPP_QOS_8LVL, DPU_SSPP_EXCL_RECT, - DPU_SSPP_SMART_DMA_V1, - DPU_SSPP_SMART_DMA_V2, DPU_SSPP_TS_PREFILL, DPU_SSPP_TS_PREFILL_REC1, DPU_SSPP_CDP, diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c index 8734a47040aa..4165ff2d7a3c 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c @@ -647,7 +647,8 @@ static void dpu_hw_sspp_setup_cdp(struct dpu_hw_pipe *ctx, } static void _setup_layer_ops(struct dpu_hw_pipe *c, - unsigned long features) + unsigned long features, + int smart_dma_rev) { if (test_bit(DPU_SSPP_SRC, &features)) { c->ops.setup_format = dpu_hw_sspp_setup_format; @@ -668,8 +669,8 @@ static void _setup_layer_ops(struct dpu_hw_pipe *c, test_bit(DPU_SSPP_CSC_10BIT, &features)) c->ops.setup_csc = dpu_hw_sspp_setup_csc; - if (test_bit(DPU_SSPP_SMART_DMA_V1, &c->cap->features) || - test_bit(DPU_SSPP_SMART_DMA_V2, &c->cap->features)) + if (smart_dma_rev == DPU_SMART_DMA_V1 || + smart_dma_rev == DPU_SMART_DMA_V2) c->ops.setup_multirect = dpu_hw_sspp_setup_multirect; if (test_bit(DPU_SSPP_SCALER_QSEED3, &features) || @@ -731,7 +732,7 @@ struct dpu_hw_pipe *dpu_hw_sspp_init(enum dpu_sspp idx, hw_pipe->mdp = &catalog->mdp[0]; hw_pipe->idx = idx; hw_pipe->cap = cfg; - _setup_layer_ops(hw_pipe, hw_pipe->cap->features); + _setup_layer_ops(hw_pipe, hw_pipe->cap->features, catalog->caps->smart_dma_rev); dpu_hw_blk_init(&hw_pipe->base, DPU_HW_BLK_SSPP, idx); From patchwork Wed Mar 24 15:00:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 408258 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23250C433E3 for ; Wed, 24 Mar 2021 15:01:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EDD6F61A0E for ; Wed, 24 Mar 2021 15:01:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236380AbhCXPB2 (ORCPT ); Wed, 24 Mar 2021 11:01:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236399AbhCXPBC (ORCPT ); Wed, 24 Mar 2021 11:01:02 -0400 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 13E2EC0613DE for ; Wed, 24 Mar 2021 08:01:02 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id b83so32438710lfd.11 for ; Wed, 24 Mar 2021 08:01:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AET1QWQCuGDwvguQyzk6xCA72n9Vcrqjv6IU3ip+Y3E=; b=gPqmJSWZ0695O/tVTGFbsaPlONQ8hS2be7mGgtrqHUEKwDsGIYR72EiezurjB5tt/h RL3lTPw5peMqUEWhbYpgs0kng1T+WS+IQ9IaptY0CrpWm27lrhIDK6BC/+NkJDjbHRVS RxYsiQBsknToVG+spJAOj5s8yrVBKKT1PISnJcEbkNwyrcT5PBSKyl8GslP6OcUZzeQy H6+KP0JNCIcSFzLf59HSTkV1BTYWN3Bv59LUigQ7/IM2bkRanttEKPmxJ8uV/3NkIc0y sQ8PaKiQyE8yOddcNYhV7hxR6yzh2CzxKCsyUMDH90HDjLnQq6setE3xjg1b8CeT1VSl LTmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AET1QWQCuGDwvguQyzk6xCA72n9Vcrqjv6IU3ip+Y3E=; b=fUmWnQ/Mz2kfrMYympZ9PsPWQq+tI3Fex2iKzMtHWC+dJWVtOSGH3chdFa5pkXaTwZ d5t+XZ3gwWvTa73WGtma7IH+r5HdZVDbNZ/4oXVsNiv7JU5NKiG4SVUy8Ri89RnsWKzN 5QbqeYd3/FNScJswFskuce3xWdt+JPYp5D2oxF5i2S+tFhJKCWDxxt0EuWWkHXBq2isl 5u7HbwC44nqQcUCBDzXtH4TvsTBGXgJsq2lq+ZR9BocHGlggGWFtVSl3mnOC9E8Z4FjQ Q6a43i+SG6XYKTIn+WfjO6EtXZ6S2IvnLVOC+cnao8gjbf/1ARH33YE2Ck9FWq6peYsr b90A== X-Gm-Message-State: AOAM532zHf4L1vTYHkrW6hzLFQchd9+pCjrNcfta/jeJtPXVuG0mc+YS +ak0JzM513w3d/vCRCSePZQl8yp/zpiv1A== X-Google-Smtp-Source: ABdhPJwy3TuCN5KIkqI6hd0f+p6WRaqdqjWO8JOAo7ZD4wxVSO4J/VqRHx/CBR7QVo6+/mniT6wH/Q== X-Received: by 2002:a19:946:: with SMTP id 67mr2408949lfj.74.1616598057304; Wed, 24 Mar 2021 08:00:57 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id p5sm252463lfe.154.2021.03.24.08.00.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 08:00:55 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Jonathan Marek Cc: Stephen Boyd , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 21/21] drm/msm/dpu: call hw_intr ops directly Date: Wed, 24 Mar 2021 18:00:24 +0300 Message-Id: <20210324150024.2768215-22-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210324150024.2768215-1-dmitry.baryshkov@linaro.org> References: <20210324150024.2768215-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Replace dpu_hw_intr callbacks with direct functions calls. Signed-off-by: Dmitry Baryshkov Reported-by: kernel test robot Reported-by: kernel test robot --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c | 27 ++- .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c | 36 ++-- .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 180 +++++++++--------- 3 files changed, 111 insertions(+), 132 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c index 84ea09d9692f..57c5485c0213 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.c @@ -47,7 +47,7 @@ static void dpu_core_irq_callback_handler(void *arg, int irq_idx) * NOTE: dpu_core_irq_callback_handler is protected by top-level * spinlock, so it is safe to clear any interrupt status here. */ - dpu_kms->hw_intr->ops.clear_intr_status_nolock( + dpu_hw_intr_clear_intr_status_nolock( dpu_kms->hw_intr, irq_idx); } @@ -55,10 +55,10 @@ static void dpu_core_irq_callback_handler(void *arg, int irq_idx) int dpu_core_irq_idx_lookup(struct dpu_kms *dpu_kms, enum dpu_intr_type intr_type, u32 instance_idx) { - if (!dpu_kms->hw_intr || !dpu_kms->hw_intr->ops.irq_idx_lookup) + if (!dpu_kms->hw_intr) return -EINVAL; - return dpu_kms->hw_intr->ops.irq_idx_lookup(intr_type, + return dpu_hw_intr_irq_idx_lookup(intr_type, instance_idx); } @@ -89,7 +89,7 @@ static int _dpu_core_irq_enable(struct dpu_kms *dpu_kms, int irq_idx) trace_dpu_core_irq_enable_idx(irq_idx, enable_count); if (atomic_inc_return(&dpu_kms->irq_obj.enable_counts[irq_idx]) == 1) { - ret = dpu_kms->hw_intr->ops.enable_irq( + ret = dpu_hw_intr_enable_irq( dpu_kms->hw_intr, irq_idx); if (ret) @@ -152,7 +152,7 @@ static int _dpu_core_irq_disable(struct dpu_kms *dpu_kms, int irq_idx) trace_dpu_core_irq_disable_idx(irq_idx, enable_count); if (atomic_dec_return(&dpu_kms->irq_obj.enable_counts[irq_idx]) == 0) { - ret = dpu_kms->hw_intr->ops.disable_irq( + ret = dpu_hw_intr_disable_irq( dpu_kms->hw_intr, irq_idx); if (ret) @@ -185,8 +185,7 @@ int dpu_core_irq_disable(struct dpu_kms *dpu_kms, int *irq_idxs, u32 irq_count) u32 dpu_core_irq_read(struct dpu_kms *dpu_kms, int irq_idx, bool clear) { - if (!dpu_kms->hw_intr || - !dpu_kms->hw_intr->ops.get_interrupt_status) + if (!dpu_kms->hw_intr) return 0; if (irq_idx < 0) { @@ -195,7 +194,7 @@ u32 dpu_core_irq_read(struct dpu_kms *dpu_kms, int irq_idx, bool clear) return 0; } - return dpu_kms->hw_intr->ops.get_interrupt_status(dpu_kms->hw_intr, + return dpu_hw_intr_get_interrupt_status(dpu_kms->hw_intr, irq_idx, clear); } @@ -273,18 +272,18 @@ int dpu_core_irq_unregister_callback(struct dpu_kms *dpu_kms, int irq_idx, static void dpu_clear_all_irqs(struct dpu_kms *dpu_kms) { - if (!dpu_kms->hw_intr || !dpu_kms->hw_intr->ops.clear_all_irqs) + if (!dpu_kms->hw_intr) return; - dpu_kms->hw_intr->ops.clear_all_irqs(dpu_kms->hw_intr); + dpu_hw_intr_clear_all_irqs(dpu_kms->hw_intr); } static void dpu_disable_all_irqs(struct dpu_kms *dpu_kms) { - if (!dpu_kms->hw_intr || !dpu_kms->hw_intr->ops.disable_all_irqs) + if (!dpu_kms->hw_intr) return; - dpu_kms->hw_intr->ops.disable_all_irqs(dpu_kms->hw_intr); + dpu_hw_intr_disable_all_irqs(dpu_kms->hw_intr); } #ifdef CONFIG_DEBUG_FS @@ -383,7 +382,7 @@ irqreturn_t dpu_core_irq(struct dpu_kms *dpu_kms) * Individual interrupt status bit will only get stored if it * is enabled. */ - dpu_kms->hw_intr->ops.get_interrupt_statuses(dpu_kms->hw_intr); + dpu_hw_intr_get_interrupt_statuses(dpu_kms->hw_intr); /* * Dispatch to HW driver to handle interrupt lookup that is being @@ -393,7 +392,7 @@ irqreturn_t dpu_core_irq(struct dpu_kms *dpu_kms) * callback, and do the interrupt status clearing once the registered * callback is finished. */ - dpu_kms->hw_intr->ops.dispatch_irqs( + dpu_hw_intr_dispatch_irqs( dpu_kms->hw_intr, dpu_core_irq_callback_handler, dpu_kms); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c index 5c521de71567..a2db9807b41d 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c @@ -755,7 +755,7 @@ static const struct dpu_irq_type dpu_irq_map[] = { { DPU_IRQ_TYPE_RESERVED, 0, 0, 9}, }; -static int dpu_hw_intr_irqidx_lookup(enum dpu_intr_type intr_type, +int dpu_hw_intr_irq_idx_lookup(enum dpu_intr_type intr_type, u32 instance_idx) { int i; @@ -771,7 +771,7 @@ static int dpu_hw_intr_irqidx_lookup(enum dpu_intr_type intr_type, return -EINVAL; } -static void dpu_hw_intr_dispatch_irq(struct dpu_hw_intr *intr, +void dpu_hw_intr_dispatch_irqs(struct dpu_hw_intr *intr, void (*cbfunc)(void *, int), void *arg) { @@ -825,7 +825,7 @@ static void dpu_hw_intr_dispatch_irq(struct dpu_hw_intr *intr, if (cbfunc) cbfunc(arg, irq_idx); else - intr->ops.clear_intr_status_nolock( + dpu_hw_intr_clear_intr_status_nolock( intr, irq_idx); /* @@ -839,7 +839,7 @@ static void dpu_hw_intr_dispatch_irq(struct dpu_hw_intr *intr, spin_unlock_irqrestore(&intr->irq_lock, irq_flags); } -static int dpu_hw_intr_enable_irq(struct dpu_hw_intr *intr, int irq_idx) +int dpu_hw_intr_enable_irq(struct dpu_hw_intr *intr, int irq_idx) { int reg_idx; unsigned long irq_flags; @@ -886,7 +886,7 @@ static int dpu_hw_intr_enable_irq(struct dpu_hw_intr *intr, int irq_idx) return 0; } -static int dpu_hw_intr_disable_irq_nolock(struct dpu_hw_intr *intr, int irq_idx) +int dpu_hw_intr_disable_irq_nolock(struct dpu_hw_intr *intr, int irq_idx) { int reg_idx; const struct dpu_intr_reg *reg; @@ -930,7 +930,7 @@ static int dpu_hw_intr_disable_irq_nolock(struct dpu_hw_intr *intr, int irq_idx) return 0; } -static int dpu_hw_intr_disable_irq(struct dpu_hw_intr *intr, int irq_idx) +int dpu_hw_intr_disable_irq(struct dpu_hw_intr *intr, int irq_idx) { unsigned long irq_flags; @@ -949,7 +949,7 @@ static int dpu_hw_intr_disable_irq(struct dpu_hw_intr *intr, int irq_idx) return 0; } -static int dpu_hw_intr_clear_irqs(struct dpu_hw_intr *intr) +int dpu_hw_intr_clear_all_irqs(struct dpu_hw_intr *intr) { int i; @@ -968,7 +968,7 @@ static int dpu_hw_intr_clear_irqs(struct dpu_hw_intr *intr) return 0; } -static int dpu_hw_intr_disable_irqs(struct dpu_hw_intr *intr) +int dpu_hw_intr_disable_all_irqs(struct dpu_hw_intr *intr) { int i; @@ -987,7 +987,7 @@ static int dpu_hw_intr_disable_irqs(struct dpu_hw_intr *intr) return 0; } -static void dpu_hw_intr_get_interrupt_statuses(struct dpu_hw_intr *intr) +void dpu_hw_intr_get_interrupt_statuses(struct dpu_hw_intr *intr) { int i; u32 enable_mask; @@ -1023,7 +1023,7 @@ static void dpu_hw_intr_get_interrupt_statuses(struct dpu_hw_intr *intr) spin_unlock_irqrestore(&intr->irq_lock, irq_flags); } -static void dpu_hw_intr_clear_intr_status_nolock(struct dpu_hw_intr *intr, +void dpu_hw_intr_clear_intr_status_nolock(struct dpu_hw_intr *intr, int irq_idx) { int reg_idx; @@ -1039,7 +1039,7 @@ static void dpu_hw_intr_clear_intr_status_nolock(struct dpu_hw_intr *intr, wmb(); } -static u32 dpu_hw_intr_get_interrupt_status(struct dpu_hw_intr *intr, +u32 dpu_hw_intr_get_interrupt_status(struct dpu_hw_intr *intr, int irq_idx, bool clear) { int reg_idx; @@ -1072,19 +1072,6 @@ static u32 dpu_hw_intr_get_interrupt_status(struct dpu_hw_intr *intr, return intr_status; } -static void __setup_intr_ops(struct dpu_hw_intr_ops *ops) -{ - ops->irq_idx_lookup = dpu_hw_intr_irqidx_lookup; - ops->enable_irq = dpu_hw_intr_enable_irq; - ops->disable_irq = dpu_hw_intr_disable_irq; - ops->dispatch_irqs = dpu_hw_intr_dispatch_irq; - ops->clear_all_irqs = dpu_hw_intr_clear_irqs; - ops->disable_all_irqs = dpu_hw_intr_disable_irqs; - ops->get_interrupt_statuses = dpu_hw_intr_get_interrupt_statuses; - ops->clear_intr_status_nolock = dpu_hw_intr_clear_intr_status_nolock; - ops->get_interrupt_status = dpu_hw_intr_get_interrupt_status; -} - static void __intr_offset(struct dpu_mdss_cfg *m, void __iomem *addr, struct dpu_hw_blk_reg_map *hw) { @@ -1106,7 +1093,6 @@ struct dpu_hw_intr *dpu_hw_intr_init(void __iomem *addr, return ERR_PTR(-ENOMEM); __intr_offset(m, addr, &intr->hw); - __setup_intr_ops(&intr->ops); intr->irq_idx_tbl_size = ARRAY_SIZE(dpu_irq_map); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h index fc9c98617281..17b0f7a862a5 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h @@ -77,99 +77,94 @@ enum dpu_intr_type { struct dpu_hw_intr; /** - * Interrupt operations. + * dpu_hw_intr_irq_idx_lookup - Lookup IRQ index on the HW interrupt type + * Used for all irq related ops + * @intr_type: Interrupt type defined in dpu_intr_type + * @instance_idx: HW interrupt block instance + * @return: irq_idx or -EINVAL for lookup fail */ -struct dpu_hw_intr_ops { - /** - * irq_idx_lookup - Lookup IRQ index on the HW interrupt type - * Used for all irq related ops - * @intr_type: Interrupt type defined in dpu_intr_type - * @instance_idx: HW interrupt block instance - * @return: irq_idx or -EINVAL for lookup fail - */ - int (*irq_idx_lookup)( - enum dpu_intr_type intr_type, - u32 instance_idx); - - /** - * enable_irq - Enable IRQ based on lookup IRQ index - * @intr: HW interrupt handle - * @irq_idx: Lookup irq index return from irq_idx_lookup - * @return: 0 for success, otherwise failure - */ - int (*enable_irq)( - struct dpu_hw_intr *intr, - int irq_idx); - - /** - * disable_irq - Disable IRQ based on lookup IRQ index - * @intr: HW interrupt handle - * @irq_idx: Lookup irq index return from irq_idx_lookup - * @return: 0 for success, otherwise failure - */ - int (*disable_irq)( - struct dpu_hw_intr *intr, - int irq_idx); - - /** - * clear_all_irqs - Clears all the interrupts (i.e. acknowledges - * any asserted IRQs). Useful during reset. - * @intr: HW interrupt handle - * @return: 0 for success, otherwise failure - */ - int (*clear_all_irqs)( - struct dpu_hw_intr *intr); - - /** - * disable_all_irqs - Disables all the interrupts. Useful during reset. - * @intr: HW interrupt handle - * @return: 0 for success, otherwise failure - */ - int (*disable_all_irqs)( - struct dpu_hw_intr *intr); - - /** - * dispatch_irqs - IRQ dispatcher will call the given callback - * function when a matching interrupt status bit is - * found in the irq mapping table. - * @intr: HW interrupt handle - * @cbfunc: Callback function pointer - * @arg: Argument to pass back during callback - */ - void (*dispatch_irqs)( - struct dpu_hw_intr *intr, - void (*cbfunc)(void *arg, int irq_idx), - void *arg); - - /** - * get_interrupt_statuses - Gets and store value from all interrupt - * status registers that are currently fired. - * @intr: HW interrupt handle - */ - void (*get_interrupt_statuses)( - struct dpu_hw_intr *intr); - - /** - * clear_intr_status_nolock() - clears the HW interrupts without lock - * @intr: HW interrupt handle - * @irq_idx: Lookup irq index return from irq_idx_lookup - */ - void (*clear_intr_status_nolock)( - struct dpu_hw_intr *intr, - int irq_idx); - - /** - * get_interrupt_status - Gets HW interrupt status, and clear if set, - * based on given lookup IRQ index. - * @intr: HW interrupt handle - * @irq_idx: Lookup irq index return from irq_idx_lookup - * @clear: True to clear irq after read - */ - u32 (*get_interrupt_status)( - struct dpu_hw_intr *intr, - int irq_idx, - bool clear); -}; +int dpu_hw_intr_irq_idx_lookup( + enum dpu_intr_type intr_type, + u32 instance_idx); + +/** + * dpu_hw_intr_enable_irq - Enable IRQ based on lookup IRQ index + * @intr: HW interrupt handle + * @irq_idx: Lookup irq index return from irq_idx_lookup + * @return: 0 for success, otherwise failure + */ +int dpu_hw_intr_enable_irq( + struct dpu_hw_intr *intr, + int irq_idx); + +/** + * dpu_hw_intr_disable_irq - Disable IRQ based on lookup IRQ index + * @intr: HW interrupt handle + * @irq_idx: Lookup irq index return from irq_idx_lookup + * @return: 0 for success, otherwise failure + */ +int dpu_hw_intr_disable_irq( + struct dpu_hw_intr *intr, + int irq_idx); + +/** + * dpu_hw_intr_clear_all_irqs - Clears all the interrupts (i.e. acknowledges + * any asserted IRQs). Useful during reset. + * @intr: HW interrupt handle + * @return: 0 for success, otherwise failure + */ +int dpu_hw_intr_clear_all_irqs( + struct dpu_hw_intr *intr); + +/** + * dpu_hw_intr_disable_all_irqs - Disables all the interrupts. Useful during reset. + * @intr: HW interrupt handle + * @return: 0 for success, otherwise failure + */ +int dpu_hw_intr_disable_all_irqs( + struct dpu_hw_intr *intr); + +/** + * dpu_hw_intr_dispatch_irqs - IRQ dispatcher will call the given callback + * function when a matching interrupt status bit is + * found in the irq mapping table. + * @intr: HW interrupt handle + * @cbfunc: Callback function pointer + * @arg: Argument to pass back during callback + */ +void dpu_hw_intr_dispatch_irqs( + struct dpu_hw_intr *intr, + void dpu_hw_intr_cbfunc(void *arg, int irq_idx), + void *arg); + +/** + * dpu_hw_intr_get_interrupt_statuses - Gets and store value from all interrupt + * status registers that are currently fired. + * @intr: HW interrupt handle + */ +void dpu_hw_intr_get_interrupt_statuses( + struct dpu_hw_intr *intr); + +/** + * dpu_hw_intr_clear_intr_status_nolock() - clears the HW interrupts without lock + * @intr: HW interrupt handle + * @irq_idx: Lookup irq index return from irq_idx_lookup + */ +void dpu_hw_intr_clear_intr_status_nolock( + struct dpu_hw_intr *intr, + int irq_idx); + +/** + * dpu_hw_intr_get_interrupt_status - Gets HW interrupt status, and clear if set, + * based on given lookup IRQ index. + * @intr: HW interrupt handle + * @irq_idx: Lookup irq index return from irq_idx_lookup + * @clear: True to clear irq after read + */ +u32 dpu_hw_intr_get_interrupt_status( + struct dpu_hw_intr *intr, + int irq_idx, + bool clear); /** * struct dpu_hw_intr: hw interrupts handling data structure @@ -182,7 +177,6 @@ struct dpu_hw_intr_ops { */ struct dpu_hw_intr { struct dpu_hw_blk_reg_map hw; - struct dpu_hw_intr_ops ops; u32 *cache_irq_mask; u32 *save_irq_status; u32 irq_idx_tbl_size;