From patchwork Tue Oct 9 04:27:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeykumar Sankaran X-Patchwork-Id: 10631875 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 B095216B1 for ; Tue, 9 Oct 2018 04:28:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9DF9B29A4D for ; Tue, 9 Oct 2018 04:28:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 928D529A52; Tue, 9 Oct 2018 04:28:47 +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 3178829A4D for ; Tue, 9 Oct 2018 04:28:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 87CF66E207; Tue, 9 Oct 2018 04:28:17 +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 B8D8D6E205; Tue, 9 Oct 2018 04:28:15 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 1A44460CC8; Tue, 9 Oct 2018 04:28:08 +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 26BD360DA8; Tue, 9 Oct 2018 04:28:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 26BD360DA8 From: Jeykumar Sankaran To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 13/25] drm/msm/dpu: make RM iterator hw type specific Date: Mon, 8 Oct 2018 21:27:30 -0700 Message-Id: <1539059262-8326-14-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 Usage of hw block iterators are only RM internal. Instead of using generic void pointers for HW blocks, use dpu specific structure. It helps us to get rid of duplicate hw block id's maintained in RM wrapper. Signed-off-by: Jeykumar Sankaran Reviewed-by: Sean Paul --- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c index 561120d..303f1b3 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c @@ -38,13 +38,11 @@ struct dpu_rm_requirements { /** * struct dpu_rm_hw_blk - hardware block tracking list member * @list: List head for list of all hardware blocks tracking items - * @id: Hardware ID number, within it's own space, ie. LM_X * @enc_id: Encoder id to which this blk is binded * @hw: Pointer to the hardware register access object for this block */ struct dpu_rm_hw_blk { struct list_head list; - uint32_t id; uint32_t enc_id; struct dpu_hw_blk *hw; }; @@ -57,7 +55,7 @@ struct dpu_rm_hw_blk { * @type: Hardware Block Type client wishes to search for. */ struct dpu_rm_hw_iter { - void *hw; + struct dpu_hw_blk *hw; struct dpu_rm_hw_blk *blk; uint32_t enc_id; enum dpu_hw_blk_type type; @@ -96,7 +94,7 @@ static bool _dpu_rm_get_hw_locked(struct dpu_rm *rm, struct dpu_rm_hw_iter *i) if (i->enc_id == i->blk->enc_id) { i->hw = i->blk->hw; DPU_DEBUG("found type %d id %d for enc %d\n", - i->type, i->blk->id, i->enc_id); + i->type, i->blk->hw->id, i->enc_id); return true; } } @@ -197,7 +195,6 @@ static int _dpu_rm_hw_blk_create( return -ENOMEM; } - blk->id = id; blk->hw = hw; blk->enc_id = 0; list_add_tail(&blk->list, &rm->hw_blks[type]); @@ -350,7 +347,7 @@ static bool _dpu_rm_check_lm_and_get_connected_blks( _dpu_rm_init_hw_iter(&iter, 0, DPU_HW_BLK_PINGPONG); while (_dpu_rm_get_hw_locked(rm, &iter)) { - if (iter.blk->id == lm_cfg->pingpong) { + if (iter.blk->hw->id == lm_cfg->pingpong) { *pp = iter.blk; break; } @@ -362,8 +359,8 @@ static bool _dpu_rm_check_lm_and_get_connected_blks( } if (RESERVED_BY_OTHER(*pp, enc_id)) { - DPU_DEBUG("lm %d pp %d already reserved\n", lm->id, - (*pp)->id); + DPU_DEBUG("lm %d pp %d already reserved\n", lm->hw->id, + (*pp)->hw->id); return false; } @@ -436,8 +433,8 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, uint32_t enc_id, dpu_cstate->mixers[i].hw_lm = to_dpu_hw_mixer(lm[i]->hw); dpu_cstate->mixers[i].hw_pp = to_dpu_hw_pingpong(pp[i]->hw); - trace_dpu_rm_reserve_lms(lm[i]->id, DPU_HW_BLK_LM, enc_id, - pp[i]->id); + trace_dpu_rm_reserve_lms(lm[i]->hw->id, DPU_HW_BLK_LM, enc_id, + pp[i]->hw->id); } dpu_cstate->num_mixers = lm_count; @@ -474,13 +471,13 @@ static int _dpu_rm_reserve_ctls( has_split_display = BIT(DPU_CTL_SPLIT_DISPLAY) & features; - DPU_DEBUG("ctl %d caps 0x%lX\n", iter.blk->id, features); + DPU_DEBUG("ctl %d caps 0x%lX\n", iter.blk->hw->id, features); if (needs_split_display != has_split_display) continue; ctls[i] = iter.blk; - DPU_DEBUG("ctl %d match\n", iter.blk->id); + DPU_DEBUG("ctl %d match\n", iter.blk->hw->id); if (++i == num_ctls) break; @@ -493,7 +490,7 @@ static int _dpu_rm_reserve_ctls( ctls[i]->enc_id = enc_id; dpu_cstate->hw_ctls[i] = to_dpu_hw_ctl(ctls[i]->hw); - trace_dpu_rm_reserve_ctls(ctls[i]->id, DPU_HW_BLK_CTL, + trace_dpu_rm_reserve_ctls(ctls[i]->hw->id, DPU_HW_BLK_CTL, enc_id); } @@ -513,7 +510,7 @@ static struct dpu_rm_hw_blk *_dpu_rm_reserve_intf( /* Find the block entry in the rm, and note the reservation */ _dpu_rm_init_hw_iter(&iter, 0, type); while (_dpu_rm_get_hw_locked(rm, &iter)) { - if (iter.blk->id != id) + if (iter.blk->hw->id != id) continue; if (RESERVED_BY_OTHER(iter.blk, enc_id)) { @@ -522,7 +519,7 @@ static struct dpu_rm_hw_blk *_dpu_rm_reserve_intf( } iter.blk->enc_id = enc_id; - trace_dpu_rm_reserve_intf(iter.blk->id, DPU_HW_BLK_INTF, + trace_dpu_rm_reserve_intf(iter.blk->hw->id, DPU_HW_BLK_INTF, enc_id); break; }