From patchwork Tue Oct 9 04:27:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeykumar Sankaran X-Patchwork-Id: 10631911 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DC48216B1 for ; Tue, 9 Oct 2018 04:29:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC82829A4D for ; Tue, 9 Oct 2018 04:29:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF61329A52; Tue, 9 Oct 2018 04:29:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 637F329A4D for ; Tue, 9 Oct 2018 04:29:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AE6786E1EE; Tue, 9 Oct 2018 04:28:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.codeaurora.org (smtp.codeaurora.org [198.145.29.96]) by gabe.freedesktop.org (Postfix) with ESMTPS id E20A56E21E; Tue, 9 Oct 2018 04:28:51 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 8BCB660C62; Tue, 9 Oct 2018 04:28:19 +0000 (UTC) Received: from jeykumar-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jsanka@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 402BD60CDD; Tue, 9 Oct 2018 04:28:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 402BD60CDD From: Jeykumar Sankaran To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 20/25] drm/msm/dpu: refine layer mixer reservations Date: Mon, 8 Oct 2018 21:27:37 -0700 Message-Id: <1539059262-8326-21-git-send-email-jsanka@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1539059262-8326-1-git-send-email-jsanka@codeaurora.org> References: <1539059262-8326-1-git-send-email-jsanka@codeaurora.org> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hoegsberg@google.com, seanpaul@chromium.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Validate layer mixer pairs for compatibility before retrieving the connected pingpong blocks. Signed-off-by: Jeykumar Sankaran --- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 61 ++++++++++------------------------ 1 file changed, 17 insertions(+), 44 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c index 85a0fe2..f794d13 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c @@ -235,61 +235,32 @@ static bool _dpu_rm_needs_split_display(const struct dpu_crtc_state *dpu_cstate) } /** - * _dpu_rm_check_lm_and_get_connected_blks - check if proposed layer mixer meets - * proposed use case requirements, incl. hardwired dependent blocks like - * pingpong + * _dpu_rm_get_connected_pp - retrieve hardwired pingpong block * @rm: dpu resource manager handle * @lm: proposed layer mixer, function checks if lm, and all other hardwired - * blocks connected to the lm (pp) is available and appropriate - * @pp: output parameter, pingpong block attached to the layer mixer. - * NULL if pp was not available, or not matching requirements. - * @primary_lm: if non-null, this function check if lm is compatible primary_lm - * as well as satisfying all other requirements - * @Return: true if lm matches all requirements, false otherwise + * @Return: handle to ping pong rm block */ -static bool _dpu_rm_check_lm_and_get_connected_blks( - struct dpu_rm *rm, - struct dpu_rm_hw_blk *lm, - struct dpu_rm_hw_blk **pp, - struct dpu_rm_hw_blk *primary_lm) +static struct dpu_rm_hw_blk * +_dpu_rm_get_connected_pp(struct dpu_rm *rm, struct dpu_rm_hw_blk *lm) { const struct dpu_lm_cfg *lm_cfg = to_dpu_hw_mixer(lm->hw)->cap; - struct dpu_rm_hw_blk *iter; struct list_head *blk_list = &rm->hw_blks[DPU_HW_BLK_PINGPONG]; - - *pp = NULL; - - DPU_DEBUG("check lm %d pp %d\n", - lm_cfg->id, lm_cfg->pingpong); - - /* Check if this layer mixer is a peer of the proposed primary LM */ - if (primary_lm) { - const struct dpu_lm_cfg *prim_lm_cfg = - to_dpu_hw_mixer(primary_lm->hw)->cap; - - if (!test_bit(lm_cfg->id, &prim_lm_cfg->lm_pair_mask)) { - DPU_DEBUG("lm %d not peer of lm %d\n", lm_cfg->id, - prim_lm_cfg->id); - return false; - } - } + struct dpu_rm_hw_blk *iter, *pp = NULL; list_for_each_entry(iter, blk_list, list) { if (iter->in_use) continue; if (iter->hw->id == lm_cfg->pingpong) { - *pp = iter; + pp = iter; break; } } - if (!*pp) { - DPU_ERROR("failed to get pp on lm %d\n", lm_cfg->pingpong); - return false; - } + if (!pp) + DPU_ERROR("failed to get pp on lm %d\n", lm->hw->id); - return true; + return pp; } static int _dpu_rm_reserve_lms(struct dpu_rm *rm, @@ -315,15 +286,15 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, lm_count = 0; lm[lm_count] = iter_i; - - if (!_dpu_rm_check_lm_and_get_connected_blks( - rm, lm[lm_count], &pp[lm_count], NULL)) - continue; + pp[lm_count] = _dpu_rm_get_connected_pp(rm, iter_i); ++lm_count; /* Valid primary mixer found, find matching peers */ list_for_each_entry(iter_j, blk_list, list) { + const struct dpu_lm_cfg *prim_lm_cfg = + to_dpu_hw_mixer(iter_i->hw)->cap; + if (iter_j->in_use) continue; @@ -333,11 +304,13 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, if (iter_i == iter_j) continue; - if (!_dpu_rm_check_lm_and_get_connected_blks( - rm, iter_j, &pp[lm_count], iter_i)) + if (!test_bit(iter_j->hw->id, + &prim_lm_cfg->lm_pair_mask)) continue; lm[lm_count] = iter_j; + pp[lm_count] = _dpu_rm_get_connected_pp(rm, iter_j); + ++lm_count; } }