From patchwork Tue Oct 9 04:27:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeykumar Sankaran X-Patchwork-Id: 10631887 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 1512B16B1 for ; Tue, 9 Oct 2018 04:29:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05EB029A4D for ; Tue, 9 Oct 2018 04:29:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EEA2629A51; Tue, 9 Oct 2018 04:28:59 +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 C245429A5C for ; Tue, 9 Oct 2018 04:28:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726486AbeJILnz (ORCPT ); Tue, 9 Oct 2018 07:43:55 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:33508 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726476AbeJILny (ORCPT ); Tue, 9 Oct 2018 07:43:54 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 0A85A60D7F; 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=1539059335; bh=Eoqro3B82cl48KZre0kCRRzpwPoDsfkEz8HbqzCIZek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e52yABDmKLDFAmaevm3bKi4loZkcV4yeiS2xnlcUcy6VsejRdl4SR6q2lgKeiMe1m CMqcTQWCoRpB5ybYHnxx2g8sKRF4uU3wsoMHbxeeYuAyQ2x17NYKaUpg13hgu6svOX vZ0oRgG1A/N8CoA4gvNcyO71kmOG0/eHwNYuZXOE= 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 B1EBD60DAB; Tue, 9 Oct 2018 04:28:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539059296; bh=Eoqro3B82cl48KZre0kCRRzpwPoDsfkEz8HbqzCIZek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n/p+PUfFRlUMdz1Xg+EQZCG6UqKqj0vKJlAzYn11GNd+6WapTpc2KnE6Ss+EH4xgS n+XvZENrMMfrWdpC0hoWVFb1GYYB9AAnSRNDaK0bgbM2Et0hWUDWtiKFEsiP4D+5UX 3QoequKvlk4d3OSWclzHslFz1Xada7f+8tzRjfJw= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org B1EBD60DAB 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 19/25] drm/msm/dpu: remove msm_display_topology Date: Mon, 8 Oct 2018 21:27:36 -0700 Message-Id: <1539059262-8326-20-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 msm_display_topology was used for providing HW block layout of the pipeline for a specific display topology. We already got rid of its usage from DSI driver. In DPU, it was used to provide the details on HW blocks while reserving resources. Since we can use the crtc state used for storing the assigned HW blocks for providing the info, we can conveniently get rid of this structure. Signed-off-by: Jeykumar Sankaran --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 29 ++++------ drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 82 ++++++++--------------------- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h | 4 +- drivers/gpu/drm/msm/msm_drv.h | 12 ----- 4 files changed, 33 insertions(+), 94 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index dd17528..5d501c8 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -166,7 +166,6 @@ enum dpu_enc_rc_states { * @delayed_off_work: delayed worker to schedule disabling of * clks and resources after IDLE_TIMEOUT time. * @vsync_event_work: worker to handle vsync event for autorefresh - * @topology: topology of the display * @idle_timeout: idle timeout duration in milliseconds */ struct dpu_encoder_virt { @@ -202,7 +201,6 @@ struct dpu_encoder_virt { enum dpu_enc_rc_states rc_state; struct kthread_delayed_work delayed_off_work; struct kthread_work vsync_event_work; - struct msm_display_topology topology; u32 idle_timeout; }; @@ -557,25 +555,19 @@ static void _dpu_encoder_adjust_mode(struct drm_connector *connector, } } -static struct msm_display_topology dpu_encoder_get_topology( +static void _dpu_encoder_get_topology( struct dpu_encoder_virt *dpu_enc, - struct dpu_kms *dpu_kms, + struct drm_crtc_state *crtc_state, struct drm_display_mode *mode) { - struct msm_display_topology topology; - int i, intf_count = 0; - - for (i = 0; i < MAX_PHYS_ENCODERS_PER_VIRTUAL; i++) - if (dpu_enc->phys_encs[i]) - intf_count++; + struct dpu_crtc_state *dpu_cstate = to_dpu_crtc_state(crtc_state); /* User split topology for width > 1080 */ - topology.num_lm = (mode->vdisplay > MAX_VDISPLAY_SPLIT) ? 2 : 1; - topology.num_enc = 0; - topology.num_intf = intf_count; - - return topology; + dpu_cstate->num_mixers = (mode->vdisplay > MAX_VDISPLAY_SPLIT) ? 2 : 1; + dpu_cstate->num_ctls = dpu_enc->num_phys_encs; + dpu_cstate->num_intfs = dpu_enc->num_phys_encs; } + static int dpu_encoder_virt_atomic_check( struct drm_encoder *drm_enc, struct drm_crtc_state *crtc_state, @@ -586,7 +578,6 @@ static int dpu_encoder_virt_atomic_check( struct dpu_kms *dpu_kms; const struct drm_display_mode *mode; struct drm_display_mode *adj_mode; - struct msm_display_topology topology; int i = 0; int ret = 0; @@ -632,11 +623,9 @@ static int dpu_encoder_virt_atomic_check( } } - topology = dpu_encoder_get_topology(dpu_enc, dpu_kms, adj_mode); - + _dpu_encoder_get_topology(dpu_enc, crtc_state, adj_mode); if (!ret && drm_atomic_crtc_needs_modeset(crtc_state)) - ret = dpu_rm_reserve(&dpu_kms->rm, drm_enc, crtc_state, - topology); + ret = dpu_rm_reserve(&dpu_kms->rm, drm_enc, crtc_state); if (!ret) drm_mode_set_crtcinfo(adj_mode, 0); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c index bb59250..85a0fe2 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c @@ -23,11 +23,9 @@ /** * struct dpu_rm_requirements - Reservation requirements parameter bundle - * @topology: selected topology for the display * @hw_res: Hardware resources required as reported by the encoders */ struct dpu_rm_requirements { - struct msm_display_topology topology; struct dpu_encoder_hw_resources hw_res; }; @@ -231,9 +229,9 @@ int dpu_rm_init(struct dpu_rm *rm, return rc; } -static bool _dpu_rm_needs_split_display(const struct msm_display_topology *top) +static bool _dpu_rm_needs_split_display(const struct dpu_crtc_state *dpu_cstate) { - return top->num_intf > 1; + return dpu_cstate->num_intfs > 1; } /** @@ -241,7 +239,6 @@ static bool _dpu_rm_needs_split_display(const struct msm_display_topology *top) * proposed use case requirements, incl. hardwired dependent blocks like * pingpong * @rm: dpu resource manager handle - * @reqs: proposed use case requirements * @lm: proposed layer mixer, function checks if lm, and all other hardwired * blocks connected to the lm (pp) is available and appropriate * @pp: output parameter, pingpong block attached to the layer mixer. @@ -252,7 +249,6 @@ static bool _dpu_rm_needs_split_display(const struct msm_display_topology *top) */ static bool _dpu_rm_check_lm_and_get_connected_blks( struct dpu_rm *rm, - struct dpu_rm_requirements *reqs, struct dpu_rm_hw_blk *lm, struct dpu_rm_hw_blk **pp, struct dpu_rm_hw_blk *primary_lm) @@ -297,9 +293,7 @@ static bool _dpu_rm_check_lm_and_get_connected_blks( } static int _dpu_rm_reserve_lms(struct dpu_rm *rm, - struct dpu_crtc_state *dpu_cstate, - struct dpu_rm_requirements *reqs) - + struct dpu_crtc_state *dpu_cstate) { struct dpu_rm_hw_blk *lm[MAX_BLOCKS]; struct dpu_rm_hw_blk *pp[MAX_BLOCKS]; @@ -308,17 +302,12 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, int lm_count = 0; int i, rc = 0; - if (!reqs->topology.num_lm) { - DPU_ERROR("invalid number of lm: %d\n", reqs->topology.num_lm); - return -EINVAL; - } - /* Find a primary mixer */ list_for_each_entry(iter_i, blk_list, list) { if (iter_i->in_use) continue; - if (lm_count == reqs->topology.num_lm) + if (lm_count == dpu_cstate->num_mixers) break; memset(&lm, 0, sizeof(lm)); @@ -328,8 +317,7 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, lm[lm_count] = iter_i; if (!_dpu_rm_check_lm_and_get_connected_blks( - rm, reqs, lm[lm_count], - &pp[lm_count], NULL)) + rm, lm[lm_count], &pp[lm_count], NULL)) continue; ++lm_count; @@ -339,15 +327,14 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, if (iter_j->in_use) continue; - if (lm_count == reqs->topology.num_lm) + if (lm_count == dpu_cstate->num_mixers) break; if (iter_i == iter_j) continue; if (!_dpu_rm_check_lm_and_get_connected_blks( - rm, reqs, iter_j, - &pp[lm_count], iter_i)) + rm, iter_j, &pp[lm_count], iter_i)) continue; lm[lm_count] = iter_j; @@ -355,7 +342,7 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, } } - if (lm_count != reqs->topology.num_lm) { + if (lm_count != dpu_cstate->num_mixers) { DPU_DEBUG("unable to find appropriate mixers\n"); return -ENAVAIL; } @@ -374,29 +361,22 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, pp[i]->hw->id); } - dpu_cstate->num_mixers = lm_count; - return rc; } static int _dpu_rm_reserve_ctls( struct dpu_rm *rm, - struct dpu_crtc_state *dpu_cstate, - const struct msm_display_topology *top) + struct dpu_crtc_state *dpu_cstate) { struct dpu_rm_hw_blk *ctls[MAX_BLOCKS]; struct dpu_rm_hw_blk *iter; struct list_head *blk_list = &rm->hw_blks[DPU_HW_BLK_CTL]; - - int i = 0, num_ctls = 0; + int i = 0; bool needs_split_display = false; memset(&ctls, 0, sizeof(ctls)); - /* each hw_intf needs its own hw_ctrl to program its control path */ - num_ctls = top->num_intf; - - needs_split_display = _dpu_rm_needs_split_display(top); + needs_split_display = _dpu_rm_needs_split_display(dpu_cstate); list_for_each_entry(iter, blk_list, list) { const struct dpu_hw_ctl *ctl = to_dpu_hw_ctl(iter->hw); @@ -416,22 +396,20 @@ static int _dpu_rm_reserve_ctls( ctls[i] = iter; DPU_DEBUG("ctl %d match\n", iter->hw->id); - if (++i == num_ctls) + if (++i == dpu_cstate->num_ctls) break; } - if (i != num_ctls) + if (i != dpu_cstate->num_ctls) return -ENAVAIL; - for (i = 0; i < ARRAY_SIZE(ctls) && i < num_ctls; i++) { + for (i = 0; i < ARRAY_SIZE(ctls) && i < dpu_cstate->num_ctls; i++) { ctls[i]->in_use = true; dpu_cstate->hw_ctls[i] = to_dpu_hw_ctl(ctls[i]->hw); trace_dpu_rm_reserve_ctls(ctls[i]->hw->id, DPU_HW_BLK_CTL); } - dpu_cstate->num_ctls = num_ctls; - return 0; } @@ -470,7 +448,8 @@ static int _dpu_rm_reserve_intfs( trace_dpu_rm_reserve_intf(intf_blk->hw->id, DPU_HW_BLK_INTF); } - dpu_cstate->num_intfs = num_intfs; + if (dpu_cstate->num_intfs != num_intfs) + return -EINVAL; return 0; } @@ -482,13 +461,13 @@ static int _dpu_rm_make_reservation( { int ret; - ret = _dpu_rm_reserve_lms(rm, dpu_cstate, reqs); + 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, &reqs->topology); + ret = _dpu_rm_reserve_ctls(rm, dpu_cstate); if (ret) { DPU_ERROR("unable to find appropriate CTL\n"); return ret; @@ -503,21 +482,11 @@ static int _dpu_rm_make_reservation( return ret; } -static int _dpu_rm_populate_requirements( - struct dpu_rm *rm, +static void _dpu_rm_populate_requirements( struct drm_encoder *enc, - struct dpu_rm_requirements *reqs, - struct msm_display_topology req_topology) + struct dpu_rm_requirements *reqs) { 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", - reqs->topology.num_lm, reqs->topology.num_enc, - reqs->topology.num_intf); - - return 0; } static int _dpu_rm_release_hw(struct dpu_rm *rm, enum dpu_hw_blk_type type, @@ -591,8 +560,7 @@ void dpu_rm_release(struct dpu_rm *rm, struct drm_crtc_state *crtc_state) int dpu_rm_reserve( struct dpu_rm *rm, struct drm_encoder *enc, - struct drm_crtc_state *crtc_state, - struct msm_display_topology topology) + struct drm_crtc_state *crtc_state) { struct dpu_rm_requirements reqs; struct dpu_crtc_state *dpu_cstate = to_dpu_crtc_state(crtc_state); @@ -607,18 +575,14 @@ int dpu_rm_reserve( mutex_lock(&rm->rm_lock); - ret = _dpu_rm_populate_requirements(rm, enc, &reqs, topology); - if (ret) { - DPU_ERROR("failed to populate hw requirements\n"); - goto end; - } + _dpu_rm_populate_requirements(enc, &reqs); ret = _dpu_rm_make_reservation(rm, dpu_cstate, &reqs); if (ret) { DPU_ERROR("failed to reserve hw resources: %d\n", ret); _dpu_rm_release_reservation(rm, dpu_cstate); } -end: + mutex_unlock(&rm->rm_lock); return ret; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h index 415eeec..1626cef 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h @@ -62,13 +62,11 @@ int dpu_rm_init(struct dpu_rm *rm, * @rm: DPU Resource Manager handle * @drm_enc: DRM Encoder handle * @crtc_state: Proposed Atomic DRM CRTC State handle - * @topology: Pointer to topology info for the display * @Return: 0 on Success otherwise -ERROR */ int dpu_rm_reserve(struct dpu_rm *rm, struct drm_encoder *drm_enc, - struct drm_crtc_state *crtc_state, - struct msm_display_topology topology); + struct drm_crtc_state *crtc_state); /** * dpu_rm_release - Given the encoder for the display chain, release any diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 9d11f32..3515fb0 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -113,18 +113,6 @@ enum msm_event_wait { }; /** - * struct msm_display_topology - defines a display topology pipeline - * @num_lm: number of layer mixers used - * @num_enc: number of compression encoder blocks used - * @num_intf: number of interfaces the panel is mounted on - */ -struct msm_display_topology { - u32 num_lm; - u32 num_enc; - u32 num_intf; -}; - -/** * struct msm_display_info - defines display properties * @intf_type: DRM_MODE_CONNECTOR_ display type * @capabilities: Bitmask of display flags