From patchwork Tue Oct 9 04:27:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeykumar Sankaran X-Patchwork-Id: 10631871 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 8B2B6112B for ; Tue, 9 Oct 2018 04:28:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D01A29A4D for ; Tue, 9 Oct 2018 04:28:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7194529A52; Tue, 9 Oct 2018 04:28:43 +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 0CF8829A4D for ; Tue, 9 Oct 2018 04:28:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726461AbeJILnk (ORCPT ); Tue, 9 Oct 2018 07:43:40 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:32864 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726434AbeJILnk (ORCPT ); Tue, 9 Oct 2018 07:43:40 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id B8FE860D06; Tue, 9 Oct 2018 04:28:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539059320; bh=63nUAY8qlQUKxoMlYbjbtzQVRK+9DDk3Q5H6oelxLcc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BYtReuQ/x4MYrQu/qFEsKE2x+POWRJuQ7+o/hA/yUBQ9IOmtg/FDZ95HhfIUfuL8F Wch0P/D+mOCmnhrytHUD1/X9u/QUxIIsisjVYv+KyEiRTQNznPLjKAZPgjn+xnSH8K aTC0a8HgYZZWArEA5Ex2SL89ARgQpKiCtlcAHK7Y= 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 D4BFB60C82; Tue, 9 Oct 2018 04:28:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539059299; bh=63nUAY8qlQUKxoMlYbjbtzQVRK+9DDk3Q5H6oelxLcc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XNdxeCnlLRrXI40n27WJ6AvbG5C8Ts8IcjJl6M35e6JgH3VinzEzvWe/uNOz3dfKk dsZj6KPTn+28bBZntHW7ByB1Db1NKCQFMtZ7bDia1CbGPMUF1gMq+GnpUnD9wx1VKN pdEjaZIy9L9i2tIC6tGqFlB7Y77xqZlBmMSSic9Q= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org D4BFB60C82 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 21/25] drm/msm/dpu: merge RM reservation helpers Date: Mon, 8 Oct 2018 21:27:38 -0700 Message-Id: <1539059262-8326-22-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 We cleaned up RM reserve api's enough to get rid of most of its unwanted checks and release handlers. To improve further the readability of the function, merging down the individual HW type allocators into one function. Signed-off-by: Jeykumar Sankaran --- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 73 +++++++++++----------------------- 1 file changed, 24 insertions(+), 49 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c index f794d13..5304597 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c @@ -22,15 +22,6 @@ #include "dpu_trace.h" /** - * struct dpu_rm_requirements - Reservation requirements parameter bundle - * @hw_res: Hardware resources required as reported by the encoders - */ -struct dpu_rm_requirements { - struct dpu_encoder_hw_resources hw_res; -}; - - -/** * struct dpu_rm_hw_blk - hardware block tracking list member * @list: List head for list of all hardware blocks tracking items * @in_use: True, if the hw block is assigned to a display pipeline. @@ -427,41 +418,6 @@ static int _dpu_rm_reserve_intfs( return 0; } -static int _dpu_rm_make_reservation( - struct dpu_rm *rm, - struct dpu_crtc_state *dpu_cstate, - struct dpu_rm_requirements *reqs) -{ - int ret; - - ret = _dpu_rm_reserve_lms(rm, dpu_cstate); - if (ret) { - DPU_ERROR("unable to find appropriate mixers\n"); - return ret; - } - - ret = _dpu_rm_reserve_ctls(rm, dpu_cstate); - if (ret) { - DPU_ERROR("unable to find appropriate CTL\n"); - return ret; - } - - ret = _dpu_rm_reserve_intfs(rm, dpu_cstate, &reqs->hw_res); - if (ret) { - DPU_ERROR("unable to find appropriate INTF\n"); - return ret; - } - - return ret; -} - -static void _dpu_rm_populate_requirements( - struct drm_encoder *enc, - struct dpu_rm_requirements *reqs) -{ - dpu_encoder_get_hw_resources(enc, &reqs->hw_res); -} - static int _dpu_rm_release_hw(struct dpu_rm *rm, enum dpu_hw_blk_type type, int id) { @@ -535,7 +491,7 @@ int dpu_rm_reserve( struct drm_encoder *enc, struct drm_crtc_state *crtc_state) { - struct dpu_rm_requirements reqs; + struct dpu_encoder_hw_resources hw_res; struct dpu_crtc_state *dpu_cstate = to_dpu_crtc_state(crtc_state); int ret; @@ -548,14 +504,33 @@ int dpu_rm_reserve( mutex_lock(&rm->rm_lock); - _dpu_rm_populate_requirements(enc, &reqs); + dpu_encoder_get_hw_resources(enc, &hw_res); - ret = _dpu_rm_make_reservation(rm, dpu_cstate, &reqs); + ret = _dpu_rm_reserve_lms(rm, dpu_cstate); if (ret) { - DPU_ERROR("failed to reserve hw resources: %d\n", ret); - _dpu_rm_release_reservation(rm, dpu_cstate); + DPU_ERROR("unable to find appropriate mixers\n"); + goto cleanup_on_fail; } + ret = _dpu_rm_reserve_ctls(rm, dpu_cstate); + if (ret) { + DPU_ERROR("unable to find appropriate CTL\n"); + goto cleanup_on_fail; + } + + ret = _dpu_rm_reserve_intfs(rm, dpu_cstate, &hw_res); + if (ret) { + DPU_ERROR("unable to find appropriate INTF\n"); + goto cleanup_on_fail; + } + + mutex_unlock(&rm->rm_lock); + + return ret; + +cleanup_on_fail: + _dpu_rm_release_reservation(rm, dpu_cstate); + mutex_unlock(&rm->rm_lock); return ret;