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: 10631883 X-Patchwork-Delegate: agross@codeaurora.org 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 E22F3112B for ; Tue, 9 Oct 2018 04:28:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D36D629A4D for ; Tue, 9 Oct 2018 04:28:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C7C1429A52; Tue, 9 Oct 2018 04:28:56 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D21D29A4D for ; Tue, 9 Oct 2018 04:28:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726481AbeJILnx (ORCPT ); Tue, 9 Oct 2018 07:43:53 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:33490 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726427AbeJILnx (ORCPT ); Tue, 9 Oct 2018 07:43:53 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id ADCEB60D51; Tue, 9 Oct 2018 04:28:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539059334; bh=VBvuv1FakQRN2Sa2HOJ17KJOA//OJe+mQLS7KYoso+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SvRg+YqSEP06cndO/jPP7+eSp735CQRlD0pevDsSSWYqIkCqeDkXJTjGJXcY+R5eV 1/w8brGT7GapQOcojle1oRw2YzHHxYhzsTBIk7AAtE3Sc/3YWerLj/Qvypdm7woLJ9 8NYp/9VwVIcnlrO/4Dus9ugzzrlW2/ULlJ3ZDwpE= 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539059297; bh=VBvuv1FakQRN2Sa2HOJ17KJOA//OJe+mQLS7KYoso+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IRP/dszqVcG7Ka2o9hdBQIycm94AeICqM2cVLqMkiPof6zjWRyep7Tndh5LveII85 I3uiklR3S2Bw3F3t/Jr55NWtRqzI4DQ15dBYfNx0IWxFFAbJYSdGMxMhYyKAm3bf0F Ut2mRP9RjFJHaLLwzBQrPmR5Aog33gB1zjHpd9u0= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 402BD60CDD Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=jsanka@codeaurora.org From: Jeykumar Sankaran To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: Jeykumar Sankaran , seanpaul@chromium.org, robdclark@gmail.com, hoegsberg@google.com, jcrouse@codeaurora.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> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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; } }