From patchwork Sat May 15 22:57:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 439505 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.7 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 22A36C433ED for ; Sat, 15 May 2021 22:58:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EEA3F61283 for ; Sat, 15 May 2021 22:58:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230087AbhEOW7U (ORCPT ); Sat, 15 May 2021 18:59:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230210AbhEOW7R (ORCPT ); Sat, 15 May 2021 18:59:17 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44F72C06174A for ; Sat, 15 May 2021 15:58:02 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id f12so2789325ljp.2 for ; Sat, 15 May 2021 15:58:02 -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=yAdVAHX0DUpLEvZMk6JuLqTaqGiu1ixMcWIXbtyHNxM=; b=mb8pj9WCvdFLUcPExJx42vwYma1QNPoOrmJdIcRcDuuqQlxGEUr19he9413/1609up JCZpaYgIiqMXfBQ+pW+kvnOJ6XAGLPRo8ObVBFDyg2B+f+htEm4v+O0/zBygzWYYprA4 md4UEIC0qpOdW4yBZdU32D//0nru37Q807AMNS/WRyd+oUx4Wh5R/tBjEp5dDhadWYbq QRRRQzdqwyyktV+wEIxRyqQGEORNxkgROkJtAYQGKk6XaZFyiu2dvzabcJpSGmlseIHj 2QJlK1pBpQFcbtK+y3ZrlMhdthpGO5M5xzEbUWGBkkUtsrheUUmzqkR7VlmhAHptLnyC S1qw== 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=yAdVAHX0DUpLEvZMk6JuLqTaqGiu1ixMcWIXbtyHNxM=; b=n970bGQ3dRyLpVSHc1L/6NTFKyRlHr83gdSri9r19nK035dYYHb8kO+Zjx8Tc6sIgd xbyw0x4aeFPchd77tfDIJHm7A0klg8MRY0bfdRMbcWkvAknaIpJdBkZlVSQf+EYkO5Ga Uv2epGRjs+S9yNi9M938rSWvonCZ8xqXkc2Sa2yjTLlnoxHcQJA/ohDfft1MEBP3ntyk vPz9lCELfUr5TnQ9VRaLA64o+HplyUppk82/7Sa0rXPhJO+fj3ih416MENVJGKWZfcRJ Nx6wisLAHjuETMpwiCh55vWWx1HtS8L9pApz6f9AQBDkz3evTQvBUcSuswfWqtPqx1gh YnCQ== X-Gm-Message-State: AOAM533DQhqnrwQt0WomYSRK3XYTyLcJgEAtWzI89VG/Pubpqr0UlRmK E54KV3qQzWdYIaelALLwSIfVkQ== X-Google-Smtp-Source: ABdhPJwJDqXYXcBjYPio8hIM0nbQl2EN+vOWyQ4cieoNkWRCmR9jHKHfmBVfkg8nrzmk2yqzIes+gQ== X-Received: by 2002:a2e:814d:: with SMTP id t13mr41423262ljg.467.1621119480673; Sat, 15 May 2021 15:58:00 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id j3sm1499729lfe.5.2021.05.15.15.58.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 May 2021 15:58:00 -0700 (PDT) From: Dmitry Baryshkov To: Bjorn Andersson , Rob Clark , Sean Paul , Abhinav Kumar Cc: Jonathan Marek , Stephen Boyd , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 1/6] drm/msm/dpu: get DSPP blocks directly rather than through RM Date: Sun, 16 May 2021 01:57:52 +0300 Message-Id: <20210515225757.1989955-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210515225757.1989955-1-dmitry.baryshkov@linaro.org> References: <20210515225757.1989955-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 | 50 ++------------------- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h | 2 - 6 files changed, 11 insertions(+), 55 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 8d942052db8a..2b750da8b30c 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -1007,7 +1007,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; @@ -1058,9 +1057,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]) @@ -1073,7 +1069,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 cb6bb7a22c15..7f02078db7e7 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,10 +183,15 @@ 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); + return c; } 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 f9c83d6e427a..6e7b5578cc81 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" @@ -204,23 +203,6 @@ 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]; - - if (dspp->id < DSPP_0 || dspp->id >= DSPP_MAX) { - DPU_ERROR("skip dspp %d with invalid id\n", dspp->id); - continue; - } - hw = dpu_hw_dspp_init(dspp->id, mmio, cat); - if (IS_ERR_OR_NULL(hw)) { - rc = PTR_ERR(hw); - DPU_ERROR("failed dspp object creation: err %d\n", rc); - goto fail; - } - rm->dspp_blks[dspp->id - DSPP_0] = &hw->base; - } - return 0; fail: @@ -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 Sat May 15 22:57:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 439466 Delivered-To: patch@linaro.org Received: by 2002:a02:b78d:0:0:0:0:0 with SMTP id f13csp1455698jam; Sat, 15 May 2021 15:58:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMDXMQ1piL4hQ4L6shAawG2OzKCErSIx2DmzpaNV4Q9SezZF1WHoHggdtVkAflW+2h6U6l X-Received: by 2002:a05:6402:13c3:: with SMTP id a3mr26498551edx.18.1621119492004; Sat, 15 May 2021 15:58:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621119492; cv=none; d=google.com; s=arc-20160816; b=xWE5wJl33/LlQM83VVnOaaOOqVnJga57gM6K1ZGdOBIWfj1sl4dNsDzk2s6SxY+ZX7 qvGI2kPbAVq9zGDrUr8yn6ZOxBg7U4qs+gwcyE5lvkhUpIsOdmbKfKwOB+B0SbbeRt9T yDqfhqROvwGpLYgIBJtVtFp6UEEE5f2krkPa0AD+29WgeAhQHelgNrEMfgVtkEvYg2NC B1JdYkghmovSubFz7IId05s1ODJHACEAFbBsGpbBBBUhZUOESJ/XsoI7Xcura0UDm/YB +/aWiaWINP8Swx99UcjZ/ndapouTPUCXUq74nWqHrCouu+StsBAqor5o674g6RXEjOXm SotQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pS41R21Kdg2MmcKBTyjnw0yHw3Ez1TlaPoWHnStvfNA=; b=wBb249Hny4JtEtGMruA5x9YfZaiX1PjqKMlmAC4q5wMS6PWxxe4hNUktqI7psROhKN +i6ZA/HzqR+RJ7SRT8JsiQmMEdK7W1m2yml8aBnpkm3jhahBDpnHa/eqOaXRUuq01m6D 7XF0VdvDGLmnbES9cIGCs7hI55w5d7vVGBjXXJYQzWeampEylvgBybU4C+CDCcIteZdc ipkHw/+EPFmABkT307LKR9pmXoXdUPIAN9e8JXvezP5mhmEjahjD7R1igE6+9j7KuWWO er937bGO1/F/A2tkEdWI785rjcvpBZ0d4ZF+XgkaWsMmgD/o4u4F6vFfdgd7bjp1wIxg FviA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aPUCWGh+; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m18si9582668edd.77.2021.05.15.15.58.11; Sat, 15 May 2021 15:58:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aPUCWGh+; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230469AbhEOW7V (ORCPT + 17 others); Sat, 15 May 2021 18:59:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230233AbhEOW7R (ORCPT ); Sat, 15 May 2021 18:59:17 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01F51C061756 for ; Sat, 15 May 2021 15:58:03 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id p20so2758971ljj.8 for ; Sat, 15 May 2021 15:58:02 -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=pS41R21Kdg2MmcKBTyjnw0yHw3Ez1TlaPoWHnStvfNA=; b=aPUCWGh+vNfJNivK/BITT25rtgA6N/cMRPumGioUlS799PWqV8rG/J2p3TzNETY6nP h9YHoeYqAeyVNn40tc7a38OQYUqGFgmfJICTmUNaW1xiwJSPnEdcCvxA9Rw02LAejhEc R/1N+gH45A+hjOEPHhFUzG1Rs0T6v24crKVDmAcXkqvc5JMpGiMU74x2CQwVsbC2p6H2 5M0XZsL2OmdhMYHyym/oTrm9m5fbUFsAeBqI6doB+vLpCiQXcpZLLsy26loNRB4MK5bc vt0BblfIDQR5fyZR15ydNu58j/VpQITYzkAHwXAnhBocVgtdCEH4V/vOWwEYbEed4f7r ThxQ== 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=pS41R21Kdg2MmcKBTyjnw0yHw3Ez1TlaPoWHnStvfNA=; b=t9Qy7JBNknkT4e/xWn6uTxdxjUc4vLmghMSRGbQRIVgFWXT16Y/UkjkuHP5E+SoG0z ktDFj1KILBpWexslh6yhE8gHN6CBmVK5KwJ7cZvXHComk+chTdpmsF6ITlDHpmawZjL2 aGce1QCkH5RXfYrStayu4Sp68AdTjVFI4d0tocF+Wk0WgUsVtMT40H8JIzPak1A/Fnsh PjOfuXC71Ctt3dtBzzyiAqrggLVGjXRo7mxV70vuUjCXcnYiMoDgKGTjOPed3VlXvWxS tZyG93N3s82vDue4gaAj0/R2TgZYVSaq7oqMkXU3RotES9Ll68X4o83802DezRMmxtWv 8XWg== X-Gm-Message-State: AOAM532WLhzUgLyPdxRvsAUmdv7bJvwQKlkVYqU4GHafKeBCM1HFO5Rr GnrWrbHjfoHNd8NeYNhkWZc8tQ== X-Received: by 2002:a2e:5347:: with SMTP id t7mr35575027ljd.464.1621119481416; Sat, 15 May 2021 15:58:01 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id j3sm1499729lfe.5.2021.05.15.15.58.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 May 2021 15:58:01 -0700 (PDT) From: Dmitry Baryshkov To: Bjorn Andersson , Rob Clark , Sean Paul , Abhinav Kumar Cc: Jonathan Marek , Stephen Boyd , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 2/6] drm/msm/dpu: get MERGE_3D blocks directly rather than through RM Date: Sun, 16 May 2021 01:57:53 +0300 Message-Id: <20210515225757.1989955-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210515225757.1989955-1-dmitry.baryshkov@linaro.org> References: <20210515225757.1989955-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 --- .../gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.c | 7 +++- .../gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h | 4 ++- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 29 ++++++++++++++- 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 ++--- 6 files changed, 45 insertions(+), 40 deletions(-) -- 2.30.2 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 55766c97c4c8..3ac53ff8c2ae 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]; + 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 89d08a715c16..75e6cb393b9c 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_pingpong.h @@ -157,11 +157,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 e3aed844bf82..ca89229d9f42 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -23,6 +23,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" @@ -688,6 +689,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,23 @@ 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[merge_3d_idx] = dpu_hw_merge_3d_init(merge_3d_idx, + dpu_kms->mmio, dpu_kms->catalog); + if (IS_ERR_OR_NULL(dpu_kms->hw_merge_3d[merge_3d_idx])) { + rc = PTR_ERR(dpu_kms->hw_merge_3d[merge_3d_idx]); + if (!dpu_kms->hw_merge_3d[merge_3d_idx]) + rc = -EINVAL; + 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 6e7b5578cc81..138efa7e51e5 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" @@ -42,14 +41,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->mixer_blks); i++) { struct dpu_hw_mixer *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) { @@ -127,24 +119,6 @@ int dpu_rm_init(struct dpu_rm *rm, } } - 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]; @@ -153,15 +127,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 = to_dpu_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 Sat May 15 22:57:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 439467 Delivered-To: patch@linaro.org Received: by 2002:a02:b78d:0:0:0:0:0 with SMTP id f13csp1455706jam; Sat, 15 May 2021 15:58:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMiBuAJV08eyrG46dhszyqh+9dFvBwfMPkHjN0nOcj4xw8NqolVG/2do32e+ksZjx+jc+y X-Received: by 2002:a17:906:4c82:: with SMTP id q2mr54571932eju.80.1621119492530; Sat, 15 May 2021 15:58:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621119492; cv=none; d=google.com; s=arc-20160816; b=IgbltI0RkmNJ74myaSSzzd97OwJTht9ZzSK9/klFtVrnieR6E4ZWNu1GptfAu1zAA+ fIUkmLg9p8q5v5k8fFOpUHDCqLQlUPj4OIqxRuR2hRkU6rv30C8dhI4vda96N/kjH5Fp DgHtVT49XHa7c/L7hO3dRHKiLVXcZ5+p+56CVpmvTxUvanh7bEBCpVHjm6yYaVGwLG/s XOQ+EqH+nNIL1IyBVSAz3/sUkE7iONLVcjXtkMDtC2/AVoZ6wbjAlYAeswa5GBloM9ql oJSCg+k98U14cqNgJJIKVXE0cs5bSVLZcbeAspPXqTt0+Ih4hXcD96PfjHTkzrkgbgX9 HNwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wTzH2vCaEnkJupEgOODl/vS26BCkq6ay395pDolBYfI=; b=fowjfuaPC22uXUECgWNboC4soYcM5I9K5vxGj6bHC8+inEd82S9RzYPZdQ7CvTprW2 03QDyYi9OQEkZkvF4Vz58VOKHA/mU3T6krbhyGZjAMTklIlneSH9KPOhEMUTGupB0qTY zVXramXcRMQ1rQ1lDI06lrlM8ql8tEWw4TvYdZQ5EtACCq5lr24c6jXrr19un8ap+tgs vWL/309iLG2wc74Ll10nWcblOLSsRLiwXjxYAirVFCbsq0mmhx2Md2s/b6YZG5aOzNGz T4S/+ByZZoBkSB6+OKEroXSA0FxEg8LOc66XtwnQ4NAUf46NuzlLcs78AAT+mQWopuVj C/Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zyL9znUf; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m18si9582668edd.77.2021.05.15.15.58.12; Sat, 15 May 2021 15:58:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zyL9znUf; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230233AbhEOW7X (ORCPT + 17 others); Sat, 15 May 2021 18:59:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229568AbhEOW7R (ORCPT ); Sat, 15 May 2021 18:59:17 -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 EA468C06175F for ; Sat, 15 May 2021 15:58:03 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id r5so3458034lfr.5 for ; Sat, 15 May 2021 15:58:03 -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=wTzH2vCaEnkJupEgOODl/vS26BCkq6ay395pDolBYfI=; b=zyL9znUfOLEBULudJXjAcKF31JB+ApzSImyZKyarwBGXai4B40y2GBAPUK1TUco7KZ /bJOHoqmIY8Xd2eKEJ6jE1/AdXZqq1rFXDeIrN6qz4388eBHDjzFzwhHOgGVXPx2POJ3 qVl+6qVheLj0BOezZSrq2xBdLUsxSkaPefjb6j7zHNUKB1mqL1kWuDrECDm8LIKcbRgC ixkUsd1UeXOeQt5R+zMm/jKvEIc0CLzd1VHkbu81YOgqHSh8lSkJ4+nOACYtq2+ruFa6 0/yppCzFZELknFKDSfAIjJyp8VWi+KKJpUnlv02ij45nyI1GR9wW1NzZzt6gQxkQ7AkX V35w== 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=wTzH2vCaEnkJupEgOODl/vS26BCkq6ay395pDolBYfI=; b=Hui/6l/L/D3HS0fOyKvN9cSYfKmioduinCFtj3Rj593Kz27g0rHa7fXVEIzfqeKOIP J1by8sz2JO3vujcWq1Jqe8uJjxjqPbTIAi/SBnA9BgJuIS9cU0SjPG75BjpwHZJCUTPv G+eJ8b9Djx1/mdDW3yUJlyMWikyqiGJhelx7YnmQ+Z4wcADVfuXyvk/h7ne8jDmuGBYl cVgVm/3vTLo3SoaCTFuP74Rd9QY+BTU5f9IZCFlWvbnf5EzZxapiVl/tBLgnt8yL56c8 jf9uhxO3tg7voUVXOvJugWy1/T7/pRyJ3IP9ZbloZIZo8vGsuT7EhJrOYR4q+GAnpJgA 3QmQ== X-Gm-Message-State: AOAM531YtWcWgsG+QBpfvWRYiItu/S+4zu2VnjKiTQZDvOmPMaO33kqa mOZPnv2SOSo/HcFvZYJiFpEzZA== X-Received: by 2002:ac2:5977:: with SMTP id h23mr4017125lfp.596.1621119482245; Sat, 15 May 2021 15:58:02 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id j3sm1499729lfe.5.2021.05.15.15.58.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 May 2021 15:58:01 -0700 (PDT) From: Dmitry Baryshkov To: Bjorn Andersson , Rob Clark , Sean Paul , Abhinav Kumar Cc: Jonathan Marek , Stephen Boyd , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 3/6] drm/msm/dpu: get PINGPONG blocks directly rather than through RM Date: Sun, 16 May 2021 01:57:54 +0300 Message-Id: <20210515225757.1989955-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210515225757.1989955-1-dmitry.baryshkov@linaro.org> References: <20210515225757.1989955-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 +- 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 +- 7 files changed, 25 insertions(+), 114 deletions(-) -- 2.30.2 diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 2b750da8b30c..3f4d2ba53604 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -1004,10 +1004,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) { @@ -1050,18 +1049,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++) { @@ -1070,6 +1062,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 7f02078db7e7..04a835b9c2a3 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,13 +187,17 @@ 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); return c; } 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_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 138efa7e51e5..acadb7240d09 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" @@ -33,14 +32,6 @@ int dpu_rm_destroy(struct dpu_rm *rm) { int i; - 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->mixer_blks); i++) { struct dpu_hw_mixer *hw; @@ -98,7 +89,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); @@ -119,24 +110,6 @@ int dpu_rm_init(struct dpu_rm *rm, } } - 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]; @@ -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 Sat May 15 22:57:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 439469 Delivered-To: patch@linaro.org Received: by 2002:a02:b78d:0:0:0:0:0 with SMTP id f13csp1455751jam; Sat, 15 May 2021 15:58:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynhdJXtwyGvQL2WawPmg5uToyy+XVMeUXn0m+0rOL15rBawcOQIznw2WqGqGBPe1BT2p/0 X-Received: by 2002:a17:906:fb88:: with SMTP id lr8mr9840507ejb.429.1621119496820; Sat, 15 May 2021 15:58:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621119496; cv=none; d=google.com; s=arc-20160816; b=064HJmlQAdr7GWTVXyb7N5H+jiYL9VLpF5msaauVMktD7Gm5xh59I41V3iMj+2tE2o uFujxKrFDVlb5tgCtD8cS0qkDrkOgRgtdrdgvm7eoAhLvBf34Ys1LVTHKlLs/DJGhhjM 6aI7Cg4nn4KYDzCHRQ9z8J/adUrEawHjEWPRCeTouEgTq66rwE4ifNjyk9pMz4vjTxmJ SaMYNZJlMyyPAe8iI3VVmA4L3n45X/BvGIV8kQt2OHjPxns7BOwV3mQXhfpi1Oux2SYz hm3WiyPnqN6pxgDFzM046WWtJxcPpsd/C6uyUAHL3Ktlyn2hAvQih81Rw8Dcaf3Ql22j K6VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=E5qe9ZMM3P04rkX7k1lm5GVbCa/n902FJD9qz2YgUU8=; b=iK2aut9Ykh+LR6spde843EQiP6Dw0ljyUMWNauU83moCgRnzAQVJI5PKxdjvvG5Ias znpFmCojGkpbBAiOEFQBCsLs73aTw2e3xM/X/mIz3gnygk06ocUrGzhKXMAmxiVdfR9I N1F9GjTr8lVhlF/KJRkM0ujk+ckvYtaMoMtpc9PDGoIRKhIlc/+JKum8DWRq36yYiQN8 qWpbkgtmWp3Jg9qBVw38y7CwQYBTGiW320n7+prxBMPfmFv31UYCg9oTXjWtSLgAxgPD GDdkE7T/n3XR1pRZNhhqz5szn6rZZpnc38Y7sZ+0JinYsOQGw+ut5QaJ2B7t4upijBTT E+uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F9oY67eB; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m18si9582668edd.77.2021.05.15.15.58.16; Sat, 15 May 2021 15:58:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F9oY67eB; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230393AbhEOW70 (ORCPT + 17 others); Sat, 15 May 2021 18:59:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230411AbhEOW7T (ORCPT ); Sat, 15 May 2021 18:59:19 -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 BE3B9C061573 for ; Sat, 15 May 2021 15:58:04 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id p12so2795992ljg.1 for ; Sat, 15 May 2021 15:58:04 -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=E5qe9ZMM3P04rkX7k1lm5GVbCa/n902FJD9qz2YgUU8=; b=F9oY67eB5OfIf1EHpVLm01gK+I6Kawvh9AGiGrEU0qVXMnIb0gGpusvk8N3gw+5aot DAVls/3BydP4pL0PcdO2hDYbsck+qzjoE42q4dBDaqOnQw01yR5LEzTtBpzpFiZaLMCx r6tLmjwT/32GBWwen7AUis9OebhPrXJJ48WAX9udmh9VCRDfq6a/EI5TZ4K8bE6EPp9m meHB7kMUNka3g/R9Ji20FZy8kpXNN3pecx5BHiGXQ2sGcK9SI818T7wMdnYMdYpesru+ OnxsADAImCN/m3WOwJje53iUnmK9IiWgpoCYjqAZrQXeDo7TKUoVnLt0557j6taaCjdV Ckaw== 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=E5qe9ZMM3P04rkX7k1lm5GVbCa/n902FJD9qz2YgUU8=; b=hvI6hbNESNGQX5A7tqlg4A2UZTi68EzVBeaRQFZB4a3rHmpVe0yDM+bcNOa1oQb2bo xnyM9i2U3XY3FEAxf8gatVGL/jXSQzPSg1T102OHL5ax5jyDuiMda7rBot7E4uoscYJW CH4KAzNmQ/s6WBes66458a4LxVN6JSlHZJBmkJQ7y/VLHbJw5ZvfXkjn0G4ek/7w1fdb +UIuinQljKUosZalwsi198XfY/Kf5ynv4DcFNWOVdYOy2q3z3dmbtoTg59qSuChCAYU8 CMraJ/E5zzjfpJkgKsXvMvgScPJuK7Tj59znZlpw6NgqqMHzKWBsVCj5yr8g/p21pDvk G5xw== X-Gm-Message-State: AOAM5332sOTpWzeGhz3eQnUkOCv43g12GOYTNmuNUx1I0m013L8kswgO MLSIOaP0uOTYIOXygaRGdB8qsw== X-Received: by 2002:a2e:90d6:: with SMTP id o22mr18584895ljg.473.1621119483251; Sat, 15 May 2021 15:58:03 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id j3sm1499729lfe.5.2021.05.15.15.58.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 May 2021 15:58:02 -0700 (PDT) From: Dmitry Baryshkov To: Bjorn Andersson , Rob Clark , Sean Paul , Abhinav Kumar Cc: Jonathan Marek , Stephen Boyd , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 4/6] drm/msm/dpu: get INTF blocks directly rather than through RM Date: Sun, 16 May 2021 01:57:55 +0300 Message-Id: <20210515225757.1989955-5-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210515225757.1989955-1-dmitry.baryshkov@linaro.org> References: <20210515225757.1989955-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org INTF blocks are not really handled by resource manager, they are assigned at dpu_encoder_setup_display using dpu_encoder_get_intf(). Then this allocation is passed to RM and then returned to then dpu_encoder. So allocate them outside of RM and use them directly. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 36 +------- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h | 8 -- .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h | 5 - .../drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 8 -- .../drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 8 -- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 24 +++++ drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 91 ------------------- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h | 2 - 9 files changed, 28 insertions(+), 156 deletions(-) -- 2.30.2 diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 3f4d2ba53604..8a8a98f9d132 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -456,26 +456,6 @@ int dpu_encoder_get_linecount(struct drm_encoder *drm_enc) return linecount; } -void dpu_encoder_get_hw_resources(struct drm_encoder *drm_enc, - struct dpu_encoder_hw_resources *hw_res) -{ - struct dpu_encoder_virt *dpu_enc = NULL; - int i = 0; - - dpu_enc = to_dpu_encoder_virt(drm_enc); - DPU_DEBUG_ENC(dpu_enc, "\n"); - - /* Query resources used by phys encs, expected to be without overlap */ - memset(hw_res, 0, sizeof(*hw_res)); - - for (i = 0; i < dpu_enc->num_phys_encs; i++) { - struct dpu_encoder_phys *phys = dpu_enc->phys_encs[i]; - - if (phys->ops.get_hw_resources) - phys->ops.get_hw_resources(phys, hw_res); - } -} - static void dpu_encoder_destroy(struct drm_encoder *drm_enc) { struct dpu_encoder_virt *dpu_enc = NULL; @@ -1007,7 +987,7 @@ static void dpu_encoder_virt_mode_set(struct drm_encoder *drm_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; - int i, j; + int i; if (!drm_enc) { DPU_ERROR("invalid encoder\n"); @@ -1069,8 +1049,6 @@ static void dpu_encoder_virt_mode_set(struct drm_encoder *drm_enc, cstate->num_mixers = num_lm; for (i = 0; i < dpu_enc->num_phys_encs; i++) { - int num_blk; - struct dpu_hw_blk *hw_blk[MAX_CHANNELS_PER_ENC]; struct dpu_encoder_phys *phys = dpu_enc->phys_encs[i]; if (!dpu_enc->hw_pp[i]) { @@ -1088,16 +1066,8 @@ static void dpu_encoder_virt_mode_set(struct drm_encoder *drm_enc, phys->hw_pp = dpu_enc->hw_pp[i]; phys->hw_ctl = to_dpu_hw_ctl(hw_ctl[i]); - num_blk = dpu_rm_get_assigned_resources(&dpu_kms->rm, - global_state, drm_enc->base.id, DPU_HW_BLK_INTF, - hw_blk, ARRAY_SIZE(hw_blk)); - for (j = 0; j < num_blk; j++) { - struct dpu_hw_intf *hw_intf; - - hw_intf = to_dpu_hw_intf(hw_blk[i]); - if (hw_intf->idx == phys->intf_idx) - phys->hw_intf = hw_intf; - } + if (phys->intf_idx >= INTF_0 && phys->intf_idx < INTF_MAX) + phys->hw_intf = dpu_kms->hw_intf[phys->intf_idx]; if (!phys->hw_intf) { DPU_ERROR_ENC(dpu_enc, diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h index 99a5d73c9b88..09db83f8339f 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h @@ -26,14 +26,6 @@ struct dpu_encoder_hw_resources { enum dpu_intf_mode intfs[INTF_MAX]; }; -/** - * dpu_encoder_get_hw_resources - Populate table of required hardware resources - * @encoder: encoder pointer - * @hw_res: resource table to populate with encoder required resources - */ -void dpu_encoder_get_hw_resources(struct drm_encoder *encoder, - struct dpu_encoder_hw_resources *hw_res); - /** * dpu_encoder_assign_crtc - Link the encoder to the crtc it's assigned to * @encoder: encoder pointer diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h index ecbc4be98980..fc8f070981c2 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h @@ -91,9 +91,6 @@ struct dpu_encoder_virt_ops { * @disable: DRM Call. Disable mode. * @atomic_check: DRM Call. Atomic check new DRM state. * @destroy: DRM Call. Destroy and release resources. - * @get_hw_resources: Populate the structure with the hardware - * resources that this phys_enc is using. - * Expect no overlap between phys_encs. * @control_vblank_irq Register/Deregister for VBLANK IRQ * @wait_for_commit_done: Wait for hardware to have flushed the * current pending frames to hardware @@ -129,8 +126,6 @@ struct dpu_encoder_phys_ops { struct drm_crtc_state *crtc_state, struct drm_connector_state *conn_state); void (*destroy)(struct dpu_encoder_phys *encoder); - void (*get_hw_resources)(struct dpu_encoder_phys *encoder, - struct dpu_encoder_hw_resources *hw_res); int (*control_vblank_irq)(struct dpu_encoder_phys *enc, bool enable); int (*wait_for_commit_done)(struct dpu_encoder_phys *phys_enc); int (*wait_for_tx_complete)(struct dpu_encoder_phys *phys_enc); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c index b2be39b9144e..adbd59326b99 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c @@ -541,13 +541,6 @@ static void dpu_encoder_phys_cmd_destroy(struct dpu_encoder_phys *phys_enc) kfree(cmd_enc); } -static void dpu_encoder_phys_cmd_get_hw_resources( - struct dpu_encoder_phys *phys_enc, - struct dpu_encoder_hw_resources *hw_res) -{ - hw_res->intfs[phys_enc->intf_idx - INTF_0] = INTF_MODE_CMD; -} - static void dpu_encoder_phys_cmd_prepare_for_kickoff( struct dpu_encoder_phys *phys_enc) { @@ -747,7 +740,6 @@ static void dpu_encoder_phys_cmd_init_ops( ops->enable = dpu_encoder_phys_cmd_enable; ops->disable = dpu_encoder_phys_cmd_disable; ops->destroy = dpu_encoder_phys_cmd_destroy; - ops->get_hw_resources = dpu_encoder_phys_cmd_get_hw_resources; ops->control_vblank_irq = dpu_encoder_phys_cmd_control_vblank_irq; ops->wait_for_commit_done = dpu_encoder_phys_cmd_wait_for_commit_done; ops->prepare_for_kickoff = dpu_encoder_phys_cmd_prepare_for_kickoff; 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 4feec24162bc..4333b94cb04f 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 @@ -477,13 +477,6 @@ static void dpu_encoder_phys_vid_destroy(struct dpu_encoder_phys *phys_enc) kfree(phys_enc); } -static void dpu_encoder_phys_vid_get_hw_resources( - struct dpu_encoder_phys *phys_enc, - struct dpu_encoder_hw_resources *hw_res) -{ - hw_res->intfs[phys_enc->intf_idx - INTF_0] = INTF_MODE_VIDEO; -} - static int dpu_encoder_phys_vid_wait_for_vblank( struct dpu_encoder_phys *phys_enc) { @@ -688,7 +681,6 @@ static void dpu_encoder_phys_vid_init_ops(struct dpu_encoder_phys_ops *ops) ops->enable = dpu_encoder_phys_vid_enable; ops->disable = dpu_encoder_phys_vid_disable; ops->destroy = dpu_encoder_phys_vid_destroy; - ops->get_hw_resources = dpu_encoder_phys_vid_get_hw_resources; ops->control_vblank_irq = dpu_encoder_phys_vid_control_vblank_irq; ops->wait_for_commit_done = dpu_encoder_phys_vid_wait_for_commit_done; ops->wait_for_vblank = dpu_encoder_phys_vid_wait_for_vblank; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index ca89229d9f42..364ab1987510 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -683,6 +683,12 @@ static void _dpu_kms_hw_destroy(struct dpu_kms *dpu_kms) if ((vbif_idx < VBIF_MAX) && dpu_kms->hw_vbif[vbif_idx]) dpu_hw_vbif_destroy(dpu_kms->hw_vbif[vbif_idx]); } + for (i = 0; i < dpu_kms->catalog->intf_count; i++) { + u32 intf_idx = dpu_kms->catalog->intf[i].id; + + if ((intf_idx < INTF_MAX) && dpu_kms->hw_intf[intf_idx]) + dpu_hw_intf_destroy(dpu_kms->hw_intf[intf_idx]); + } } if (dpu_kms->rm_init) @@ -1021,6 +1027,24 @@ static int dpu_kms_hw_init(struct msm_kms *kms) } } + for (i = 0; i < dpu_kms->catalog->intf_count; i++) { + u32 intf_idx = dpu_kms->catalog->intf[i].id; + + if (dpu_kms->catalog->intf[i].type == INTF_NONE) + continue; + + dpu_kms->hw_intf[intf_idx] = dpu_hw_intf_init(intf_idx, + dpu_kms->mmio, dpu_kms->catalog); + if (IS_ERR_OR_NULL(dpu_kms->hw_intf[intf_idx])) { + rc = PTR_ERR(dpu_kms->hw_intf[intf_idx]); + if (!dpu_kms->hw_intf[intf_idx]) + rc = -EINVAL; + DPU_ERROR("failed to init intf %d: %d\n", intf_idx, rc); + dpu_kms->hw_intf[intf_idx] = NULL; + goto power_error; + } + } + rc = dpu_core_perf_init(&dpu_kms->perf, dev, dpu_kms->catalog, _dpu_kms_get_clk(dpu_kms, "core")); if (rc) { diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h index 0b936258bde0..6e2ec3171a79 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h @@ -124,6 +124,7 @@ struct dpu_kms { struct dpu_hw_vbif *hw_vbif[VBIF_MAX]; struct dpu_hw_merge_3d *hw_merge_3d[MERGE_3D_MAX]; + struct dpu_hw_intf *hw_intf[INTF_MAX]; struct dpu_hw_mdp *hw_mdp; bool has_danger_ctrl; @@ -163,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]; }; 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 acadb7240d09..c36700a06ff2 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c @@ -48,14 +48,6 @@ int dpu_rm_destroy(struct dpu_rm *rm) dpu_hw_ctl_destroy(hw); } } - for (i = 0; i < ARRAY_SIZE(rm->intf_blks); i++) { - struct dpu_hw_intf *hw; - - if (rm->intf_blks[i]) { - hw = to_dpu_hw_intf(rm->intf_blks[i]); - dpu_hw_intf_destroy(hw); - } - } return 0; } @@ -110,27 +102,6 @@ int dpu_rm_init(struct dpu_rm *rm, } } - for (i = 0; i < cat->intf_count; i++) { - struct dpu_hw_intf *hw; - const struct dpu_intf_cfg *intf = &cat->intf[i]; - - if (intf->type == INTF_NONE) { - DPU_DEBUG("skip intf %d with type none\n", i); - continue; - } - if (intf->id < INTF_0 || intf->id >= INTF_MAX) { - DPU_ERROR("skip intf %d with invalid id\n", intf->id); - continue; - } - hw = dpu_hw_intf_init(intf->id, mmio, cat); - if (IS_ERR_OR_NULL(hw)) { - rc = PTR_ERR(hw); - DPU_ERROR("failed intf object creation: err %d\n", rc); - goto fail; - } - rm->intf_blks[intf->id - INTF_0] = &hw->base; - } - for (i = 0; i < cat->ctl_count; i++) { struct dpu_hw_ctl *hw; const struct dpu_ctl_cfg *ctl = &cat->ctl[i]; @@ -305,54 +276,6 @@ static int _dpu_rm_reserve_ctls( return 0; } -static int _dpu_rm_reserve_intf( - struct dpu_rm *rm, - struct dpu_global_state *global_state, - uint32_t enc_id, - uint32_t id) -{ - int idx = id - INTF_0; - - if (idx < 0 || idx >= ARRAY_SIZE(rm->intf_blks)) { - DPU_ERROR("invalid intf id: %d", id); - return -EINVAL; - } - - if (!rm->intf_blks[idx]) { - DPU_ERROR("couldn't find intf id %d\n", id); - return -EINVAL; - } - - if (reserved_by_other(global_state->intf_to_enc_id, idx, enc_id)) { - DPU_ERROR("intf id %d already reserved\n", id); - return -ENAVAIL; - } - - global_state->intf_to_enc_id[idx] = enc_id; - return 0; -} - -static int _dpu_rm_reserve_intf_related_hw( - struct dpu_rm *rm, - struct dpu_global_state *global_state, - uint32_t enc_id, - struct dpu_encoder_hw_resources *hw_res) -{ - int i, ret = 0; - u32 id; - - for (i = 0; i < ARRAY_SIZE(hw_res->intfs); i++) { - if (hw_res->intfs[i] == INTF_MODE_NONE) - continue; - id = i + INTF_0; - ret = _dpu_rm_reserve_intf(rm, global_state, enc_id, id); - if (ret) - return ret; - } - - return ret; -} - static int _dpu_rm_make_reservation( struct dpu_rm *rm, struct dpu_global_state *global_state, @@ -374,11 +297,6 @@ static int _dpu_rm_make_reservation( return ret; } - ret = _dpu_rm_reserve_intf_related_hw(rm, global_state, enc->base.id, - &reqs->hw_res); - if (ret) - return ret; - return ret; } @@ -387,8 +305,6 @@ static int _dpu_rm_populate_requirements( struct dpu_rm_requirements *reqs, struct msm_display_topology req_topology) { - dpu_encoder_get_hw_resources(enc, &reqs->hw_res); - reqs->topology = req_topology; DRM_DEBUG_KMS("num_lm: %d num_enc: %d num_intf: %d\n", @@ -416,8 +332,6 @@ void dpu_rm_release(struct dpu_global_state *global_state, ARRAY_SIZE(global_state->mixer_to_enc_id), enc->base.id); _dpu_rm_clear_mapping(global_state->ctl_to_enc_id, ARRAY_SIZE(global_state->ctl_to_enc_id), enc->base.id); - _dpu_rm_clear_mapping(global_state->intf_to_enc_id, - ARRAY_SIZE(global_state->intf_to_enc_id), enc->base.id); } int dpu_rm_reserve( @@ -476,11 +390,6 @@ int dpu_rm_get_assigned_resources(struct dpu_rm *rm, hw_to_enc_id = global_state->ctl_to_enc_id; max_blks = ARRAY_SIZE(rm->ctl_blks); break; - case DPU_HW_BLK_INTF: - hw_blks = rm->intf_blks; - hw_to_enc_id = global_state->intf_to_enc_id; - max_blks = ARRAY_SIZE(rm->intf_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 a618c0ef43db..ee90b1233430 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h @@ -17,14 +17,12 @@ struct dpu_global_state; * struct dpu_rm - DPU dynamic hardware resource manager * @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; }; From patchwork Sat May 15 22:57:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 439468 Delivered-To: patch@linaro.org Received: by 2002:a02:b78d:0:0:0:0:0 with SMTP id f13csp1455730jam; Sat, 15 May 2021 15:58:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaESvBp4Fu8BT6Bwlk0NRGQFHNlsliOWCLusUYDJtbG73NREK+Vxa4RfKlThSAtudTMskg X-Received: by 2002:a17:906:90c9:: with SMTP id v9mr15699161ejw.102.1621119494363; Sat, 15 May 2021 15:58:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621119494; cv=none; d=google.com; s=arc-20160816; b=JSRYsfLJ/p1qGs2LLZXDTg73Pzj/17yGmnBJH6iTNmcz9Puze+sxxw0cfMG4r5hgcD YYHE3jqAwZTStfTH5AjmbodDCT/G9feQPFleL0Gpwt+sJrywuiEATxMcnhzI2uQn/J/e W+SZXnKdWEE2x4GQfHKwMY0cKiVBprTh37ZLz4hz+I3Z+L/VZIwJOLNSEM5iCCnrQSJD kpmSaw02bKa20M0jIdZmm/5PgiLIa+5qBYlolGvp1vAwQWf0R00JxJKA11r7jTShCGK+ cxnzpxsTNt1m5Vwb3TnGYa0gD7U1P0SUDKkNjTb0a0e0uWQAefDSQLGw9hqI4Ypyte+w f1fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ALt2xpqxR2M7ID0/lSTYxo899aEF0TaxPvxXAG/ycDA=; b=yOrz1lvlefpQjJRyRrxc/AfCuBRnUHEo1PeVzUJDDBJLqtYFzjRGmjFQ2B6qvZtdA7 vUZxl1PCL2e/FKIkktrT2s98H+qtMvie+uVH39GGpAZq2QVCWNJp4HsmWGIhWMO3XcIO 7QmFJrgjw+EHfVNPHhz73G5kuomDZnhpAJb15b2zCKOEWBlCFAB9RpbHGrwdr6sM4Aj7 PeyMZr0qcNZnonutqyUlNk6DYoZ6C2kFMjVO1A+7Cd+mTA2o6b4mfVz3JWBsBXplfKvI ucuIIpvHX2Lni3WhoM+OyzU4BDawTC8hSSg4qvqNR9z/78MtsR5SuOZ/rDHgP0OR/7ru TOQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gvXEsRJs; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m18si9582668edd.77.2021.05.15.15.58.14; Sat, 15 May 2021 15:58:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gvXEsRJs; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229568AbhEOW7Z (ORCPT + 17 others); Sat, 15 May 2021 18:59:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230393AbhEOW7T (ORCPT ); Sat, 15 May 2021 18:59:19 -0400 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8523AC06174A for ; Sat, 15 May 2021 15:58:05 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id y9so2763693ljn.6 for ; Sat, 15 May 2021 15:58:05 -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=ALt2xpqxR2M7ID0/lSTYxo899aEF0TaxPvxXAG/ycDA=; b=gvXEsRJs033GcqK2sH1Iyi/TjQHWKRC+qN8Ak/KNQd+PQsq7r659fLB/3hCUzmK+T1 aXtxVuxw0vsnxFpV58u+qgoSKhHQvZRg9EaqykOAXGe/8wfFsmYzV2tk0PyFOF5ZQqVj hMXiMQtcBnxFlmULIHYH2BmktuhSk7RxsQl4+OFYTuVdnx0QLjeATmpcIdnUQCfXyVTQ 4us/PzwIB1MauLsrLjGHG8nKWI3CbWccHFIG0hKABubseVKwgP/rOkDjwKMN3jXIiD/m acc8wQJkqhj26mxeUeGHda0Lu3zdHnqo5jwO2RRPD8at0wu2M9Fl4fGA6njNFkKmttfN 3JAw== 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=ALt2xpqxR2M7ID0/lSTYxo899aEF0TaxPvxXAG/ycDA=; b=hGHJhwRVDtf5JIDB0dGS5ioiHjxF8A3wbmv6mXC4BtoiSSdrO6bIu0LygeHQ1cV7P8 p7G+8UcNWHhMqjP1lX5hk7ZytU5u4myyNtkeNmNRyaPTfSZesbXG/7XiJASQjDlIyu+y yBLaC0w3lD3G/V5MeJ4NHDIKi1vD/mfmvT8PwFDKNHAutiw6dZ1ZHgUlhjnpEw6Q12QU 5B6rpgz19VfpYEr8l6BW3HL2Lzk3YrKNaGxHZoR/dLaGLYG0AOVtKwEgEh4zlfiqP0Oj 0UCpK2yMCqQogDnOm86hn9F/u2p3nlYPs24RxXalxABUG9w2g9UE8tAfvLm+An+JUat4 b0Rg== X-Gm-Message-State: AOAM533LaX8sB39tFl9vCXT213bN7KONidAzXnSJ9W22qFCft+noT4rb 3LdAK74Mhli9fXuIEf2k9vTZrw== X-Received: by 2002:a2e:a370:: with SMTP id i16mr25862713ljn.90.1621119484091; Sat, 15 May 2021 15:58:04 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id j3sm1499729lfe.5.2021.05.15.15.58.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 May 2021 15:58:03 -0700 (PDT) From: Dmitry Baryshkov To: Bjorn Andersson , Rob Clark , Sean Paul , Abhinav Kumar Cc: Jonathan Marek , Stephen Boyd , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 5/6] drm/msm/dpu: drop unused lm_max_width from RM Date: Sun, 16 May 2021 01:57:56 +0300 Message-Id: <20210515225757.1989955-6-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210515225757.1989955-1-dmitry.baryshkov@linaro.org> References: <20210515225757.1989955-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(-) -- 2.30.2 diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c index c36700a06ff2..ec4387ad1182 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c @@ -88,18 +88,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; - } } for (i = 0; i < cat->ctl_count; i++) { diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h index ee90b1233430..0c9113581d71 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h @@ -17,14 +17,10 @@ struct dpu_global_state; * struct dpu_rm - DPU dynamic hardware resource manager * @mixer_blks: array of layer mixer hardware resources * @ctl_blks: array of ctl 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]; - - uint32_t lm_max_width; }; struct dpu_kms; From patchwork Sat May 15 22:57:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 439470 Delivered-To: patch@linaro.org Received: by 2002:a02:b78d:0:0:0:0:0 with SMTP id f13csp1455763jam; Sat, 15 May 2021 15:58:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyt5mecZVfp65jW5NI8YLM9ayaUW96ptIrerkSPWwmzof7MHej2QCmN7Ns0yJtpqPjkG5iz X-Received: by 2002:a17:906:4341:: with SMTP id z1mr17753344ejm.422.1621119497823; Sat, 15 May 2021 15:58:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621119497; cv=none; d=google.com; s=arc-20160816; b=yJzp19weanIGPLiCnVTAy1LY6OpQuMcdx/IO9DV1iuCagl9dRtWB2LH0bt2CuiZqYZ u3uqZGUvWovxVR5aKgGYyKQ+hAgXOB/fUDy8aCTxFgHppefeydTVUrv2p8v7qYt6rsnC 4t1mE/7XPRhc6ioCK6y8jpz6DiAhF5PvQPthqO51INlLdwFG1iAY5sY1txKMJAcX8qJD UXWGAZg0sWGgHkuLSl5Z3gHSFCqeBltTWVZTkCiKR4thHjm0SCTIix0WXAOqcd7RlvvN ZZEwkChe1cOnSrX6MZ718jAEq5F9xCVDwu4BewQX4DetizK18yR/3Nm5pWvA/TU644Ih rpYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qJQofiqb3TH83HNq4q/uODxswUVtxbMvEOcsV4NaxVo=; b=OAwzZRiTCumWTPToHERu5mGTj8N/REWDmx1uL+JQ7KdOvcYvkN2ONrOC8rjkNa4RgK QVJRR+Xv/UHder5sLeliXpGuF9kZ78Q4CFTnqNt3OcjsNSdddXS5UV0kWjR5rWt61ySB Iaf1qtr3uYSL8QLaQOTpSaVJMJ7SWvgJHeBV4uA8Z9mCqIvAx63RgX6ndRhwXQ75nS7m tSN3YPUCh7h5l0Fsyji8jqXRIdhXy8zlCCjPlxbyokoA/J8PU5zyux4EuKOY8v2YELO2 I2jp1k46wRv/aJg5DO7BB/qzrGNui1vn+jOq4IrpQANMjh6MzDZr8cdD0YFG+fvRlJ0r VQMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tn+X0wte; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m18si9582668edd.77.2021.05.15.15.58.17; Sat, 15 May 2021 15:58:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tn+X0wte; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230411AbhEOW71 (ORCPT + 17 others); Sat, 15 May 2021 18:59:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230440AbhEOW7U (ORCPT ); Sat, 15 May 2021 18:59:20 -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 46E0DC061756 for ; Sat, 15 May 2021 15:58:06 -0700 (PDT) Received: by mail-lj1-x231.google.com with SMTP id v5so2735611ljg.12 for ; Sat, 15 May 2021 15:58:06 -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=qJQofiqb3TH83HNq4q/uODxswUVtxbMvEOcsV4NaxVo=; b=tn+X0wtelq9WOWDO6OHygErFpAsAZxcqZ1VkpDXDwyTUul9nTNpWtGcRsTrC5VHcX1 ZTbKqyuA2zGU7ni/pSrI+S6w4Ym5ikQVAXVp3DduC+7PPLWX1lBVWT4T5ThpTmcK6NWc jCgKRXGdxsF4e2FLUTy3NsXtciO5KazUcLBeskI9wjJ5xb2gt1GSBJKA90syLEnrVYD9 VfWhaLkolOt7di3apXv3GXcvsosztCUl1YnJ2///FBRuj5jZsS5oyyOnUroh2Lx0rd9e oPnl+E4xStBqOvXOH+mU7LK3Deb9PmwftG3KEKHMa1LMy5b9CEHL4hdW5k7EPZnseqvw Q2+Q== 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=qJQofiqb3TH83HNq4q/uODxswUVtxbMvEOcsV4NaxVo=; b=RVeQL6v+MRF4xiCBqcdxPbBbHlaAzFu53XNl1dkcxHQeuoN+2sJ+QjU8GGb3y5bXwT 0XaSmCLys5ySYtfgS5OoN63Q3+Y7gemQdo1Zlt2bxRGcDwP5qUQkegWcT75yTJ+LtxuA C4eL3N6m9SXuDh46Q0888uRndOUhM3jpoG1GUHyhGCg+xeAOhgQvLuRqbqx8FD3xw2ES vts1kwPAvo1Il3++gwOgi84KWgX54pMjOXnLzGWuKN+EP/ThatO2IZ91W8xUzfE6vlud o05gKlmd1lADjwBcPHePAZJgVeJmCaH7fLYCfoL3y+n5266ywTItcfHdmID5eIYRV73A UTxA== X-Gm-Message-State: AOAM530l6UhQCIICxOVKXl438q/QMOcgQmSIHdrEKMqW19MZhg99lXrk oIY6PEYxWxN2e/KKB/sMBTCuOg== X-Received: by 2002:a2e:780a:: with SMTP id t10mr40137463ljc.38.1621119484858; Sat, 15 May 2021 15:58:04 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id j3sm1499729lfe.5.2021.05.15.15.58.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 May 2021 15:58:04 -0700 (PDT) From: Dmitry Baryshkov To: Bjorn Andersson , Rob Clark , Sean Paul , Abhinav Kumar Cc: Jonathan Marek , Stephen Boyd , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH v2 6/6] drm/msm/dpu: simplify peer LM handling Date: Sun, 16 May 2021 01:57:57 +0300 Message-Id: <20210515225757.1989955-7-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210515225757.1989955-1-dmitry.baryshkov@linaro.org> References: <20210515225757.1989955-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org For each LM there is at max 1 peer LM which can be driven by the same CTL, so there no need to have a mask instead of just an ID of the peer LM. Signed-off-by: Dmitry Baryshkov --- .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 2 +- .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 4 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 30 +++++-------------- 3 files changed, 11 insertions(+), 25 deletions(-) -- 2.30.2 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 b569030a0847..e7b132dce849 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c @@ -571,7 +571,7 @@ static const struct dpu_lm_sub_blks sdm845_lm_sblk = { .features = _fmask, \ .sblk = _sblk, \ .pingpong = _pp, \ - .lm_pair_mask = (1 << _lmpair), \ + .lm_pair = _lmpair, \ .dspp = _dspp \ } 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 4dfd8a20ad5c..3199bf8dc085 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h @@ -498,14 +498,14 @@ struct dpu_sspp_cfg { * @features bit mask identifying sub-blocks/features * @sblk: LM Sub-blocks information * @pingpong: ID of connected PingPong, PINGPONG_MAX if unsupported - * @lm_pair_mask: Bitmask of LMs that can be controlled by same CTL + * @lm_pair: ID of LM that can be controlled by same CTL */ struct dpu_lm_cfg { DPU_HW_BLK_INFO; const struct dpu_lm_sub_blks *sblk; u32 pingpong; u32 dspp; - unsigned long lm_pair_mask; + unsigned long lm_pair; }; /** diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c index ec4387ad1182..030bc30aba64 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c @@ -121,28 +121,19 @@ static bool _dpu_rm_needs_split_display(const struct msm_display_topology *top) } /** - * _dpu_rm_check_lm_peer - check if a mixer is a peer of the primary + * _dpu_rm_get_lm_peer - get the id of a mixer which is a peer of the primary * @rm: dpu resource manager handle * @primary_idx: index of primary mixer in rm->mixer_blks[] - * @peer_idx: index of other mixer in rm->mixer_blks[] - * Return: true if rm->mixer_blks[peer_idx] is a peer of - * rm->mixer_blks[primary_idx] */ -static bool _dpu_rm_check_lm_peer(struct dpu_rm *rm, int primary_idx, - int peer_idx) +static int _dpu_rm_get_lm_peer(struct dpu_rm *rm, int primary_idx) { const struct dpu_lm_cfg *prim_lm_cfg; - const struct dpu_lm_cfg *peer_cfg; prim_lm_cfg = to_dpu_hw_mixer(rm->mixer_blks[primary_idx])->cap; - peer_cfg = to_dpu_hw_mixer(rm->mixer_blks[peer_idx])->cap; - if (!test_bit(peer_cfg->id, &prim_lm_cfg->lm_pair_mask)) { - DPU_DEBUG("lm %d not peer of lm %d\n", peer_cfg->id, - peer_cfg->id); - return false; - } - return true; + if (prim_lm_cfg->lm_pair >= LM_0 && prim_lm_cfg->lm_pair < LM_MAX) + return prim_lm_cfg->lm_pair - LM_0; + return -EINVAL; } static int _dpu_rm_reserve_lms(struct dpu_rm *rm, @@ -176,17 +167,12 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, ++lm_count; /* Valid primary mixer found, find matching peers */ - for (j = i + 1; j < ARRAY_SIZE(rm->mixer_blks) && - lm_count < reqs->topology.num_lm; j++) { + j = _dpu_rm_get_lm_peer(rm, i); + /* ignore the peer if there is an error or if the peer was already processed */ + if (j < 0 || j < i) { if (!rm->mixer_blks[j]) continue; - if (!_dpu_rm_check_lm_peer(rm, i, j)) { - DPU_DEBUG("lm %d not peer of lm %d\n", LM_0 + j, - LM_0 + i); - continue; - } - if (reserved_by_other(global_state->mixer_to_enc_id, j, enc_id)) { DPU_DEBUG("lm %d already reserved\n", j + LM_0); continue;