public inbox for linux-arm-msm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Paul <sean@poorly.run>
To: Jeykumar Sankaran <jsanka@codeaurora.org>
Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
	seanpaul@chromium.org, hoegsberg@google.com,
	freedreno@lists.freedesktop.org
Subject: Re: [PATCH 08/25] drm/msm/dpu: release reservation using crtc state
Date: Wed, 10 Oct 2018 10:50:27 -0400	[thread overview]
Message-ID: <20181010145027.GU154160@art_vandelay> (raw)
In-Reply-To: <1539059262-8326-9-git-send-email-jsanka@codeaurora.org>

On Mon, Oct 08, 2018 at 09:27:25PM -0700, Jeykumar Sankaran wrote:
> Use the hw block pointers stored in crtc state to
> release them back to RM resource pool. This change
> is made to uncouple RM reservation from encoder_id.
> Separate change is submitted to clean up RM of
> encoder id tagging.
> 
> Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c |  2 +-
>  drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c      | 69 +++++++++++++++++++++++------
>  drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h      |  6 +--
>  3 files changed, 60 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> index 17dbbc3..a8fd14e 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
> @@ -1223,7 +1223,7 @@ static void dpu_encoder_virt_disable(struct drm_encoder *drm_enc)
>  
>  	DPU_DEBUG_ENC(dpu_enc, "encoder disabled\n");
>  
> -	dpu_rm_release(&dpu_kms->rm, drm_enc);
> +	dpu_rm_release(&dpu_kms->rm, drm_enc->crtc->state);

From drm_encoder.h:

        * @crtc: Currently bound CRTC, only really meaningful for non-atomic
        * drivers.  Atomic drivers should instead check
        * &drm_connector_state.crtc.


>  }
>  
>  static enum dpu_intf dpu_encoder_get_intf(struct dpu_mdss_cfg *catalog,
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
> index 5703b11..619b596 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
> @@ -625,27 +625,70 @@ static int _dpu_rm_populate_requirements(
>  	return 0;
>  }
>  
> -static void _dpu_rm_release_reservation(struct dpu_rm *rm, uint32_t enc_id)
> +static int _dpu_rm_release_hw(struct dpu_rm *rm, enum dpu_hw_blk_type type,
> +			      int id)
>  {
>  	struct dpu_rm_hw_blk *blk;
> -	enum dpu_hw_blk_type type;
>  
> -	for (type = 0; type < DPU_HW_BLK_MAX; type++) {
> -		list_for_each_entry(blk, &rm->hw_blks[type], list) {
> -			if (blk->enc_id == enc_id) {
> -				blk->enc_id = 0;
> -				DPU_DEBUG("rel enc %d %d %d\n", enc_id,
> -					  blk->type, blk->id);
> -			}
> +	list_for_each_entry(blk, &rm->hw_blks[type], list) {
> +		if (blk->hw->id == id) {
> +			blk->enc_id = 0;
> +			return 0;
>  		}
>  	}
> +
> +	DRM_DEBUG_KMS("failed to find hw id(%d) of type(%d) for releasing\n",
> +		      id, type);
> +
> +	return -EINVAL;
>  }
>  
> -void dpu_rm_release(struct dpu_rm *rm, struct drm_encoder *enc)
> +static void _dpu_rm_release_reservation(struct dpu_rm *rm,
> +					struct dpu_crtc_state *dpu_cstate)
>  {
> +	int i;
> +
> +	for (i = 0; i < dpu_cstate->num_mixers; i++) {
> +		struct dpu_crtc_mixer *mixer = &dpu_cstate->mixers[i];
> +
> +		if (!mixer->hw_lm)
> +			continue;
> +
> +		if (!_dpu_rm_release_hw(rm, DPU_HW_BLK_LM,
> +					mixer->hw_lm->base.id))
> +			mixer->hw_lm = NULL;
> +
> +		if (!_dpu_rm_release_hw(rm, DPU_HW_BLK_PINGPONG,
> +					mixer->hw_pp->base.id))
> +			mixer->hw_pp = NULL;
> +	}
> +
> +	for (i = 0; i < dpu_cstate->num_ctls; i++) {
> +		if (!dpu_cstate->hw_ctls[i])
> +			continue;
> +
> +		if (!_dpu_rm_release_hw(rm, DPU_HW_BLK_CTL,
> +					dpu_cstate->hw_ctls[i]->base.id))
> +			dpu_cstate->hw_ctls[i] = NULL;
> +	}
> +
> +	for (i = 0; i < dpu_cstate->num_intfs; i++) {
> +		if (!dpu_cstate->hw_intfs[i])
> +			continue;
> +
> +		if (!_dpu_rm_release_hw(rm, DPU_HW_BLK_INTF,
> +					dpu_cstate->hw_intfs[i]->base.id))
> +			dpu_cstate->hw_intfs[i] = NULL;
> +	}
> +}
> +
> +void dpu_rm_release(struct dpu_rm *rm, struct drm_crtc_state *crtc_state)
> +{
> +	struct dpu_crtc_state *dpu_cstate = to_dpu_crtc_state(crtc_state);
> +
>  	mutex_lock(&rm->rm_lock);
>  
> -	_dpu_rm_release_reservation(rm, enc->base.id);
> +	_dpu_rm_release_reservation(rm, dpu_cstate);
>  
>  	mutex_unlock(&rm->rm_lock);
>  }
> @@ -679,12 +722,12 @@ int dpu_rm_reserve(
>  	ret = _dpu_rm_make_reservation(rm, enc, dpu_cstate, &reqs);
>  	if (ret) {
>  		DPU_ERROR("failed to reserve hw resources: %d\n", ret);
> -		_dpu_rm_release_reservation(rm, enc->base.id);
> +		_dpu_rm_release_reservation(rm, dpu_cstate);
>  	} else if (test_only) {
>  		 /* test_only: test the reservation and then undo */
>  		DPU_DEBUG("test_only: discard test [enc: %d]\n",
>  				enc->base.id);
> -		_dpu_rm_release_reservation(rm, enc->base.id);
> +		_dpu_rm_release_reservation(rm, dpu_cstate);
>  	}
>  
>  end:
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h
> index eb6a6ac..e48e8f2 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h
> @@ -95,13 +95,13 @@ int dpu_rm_reserve(struct dpu_rm *rm,
>  		bool test_only);
>  
>  /**
> - * dpu_rm_reserve - Given the encoder for the display chain, release any
> + * dpu_rm_release - Given the encoder for the display chain, release any
>   *	HW blocks previously reserved for that use case.
>   * @rm: DPU Resource Manager handle
> - * @enc: DRM Encoder handle
> + * @crtc_state: atomic DRM state handle
>   * @Return: 0 on Success otherwise -ERROR
>   */
> -void dpu_rm_release(struct dpu_rm *rm, struct drm_encoder *enc);
> +void dpu_rm_release(struct dpu_rm *rm, struct drm_crtc_state *crtc_state);
>  
>  /**
>   * dpu_rm_get_mdp - Retrieve HW block for MDP TOP.
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 

-- 
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-10-10 14:50 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-09  4:27 [PATCH 00/25] reserve RM resources in CRTC state Jeykumar Sankaran
     [not found] ` <1539059262-8326-1-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-09  4:27   ` [PATCH 01/25] drm/msm/dpu: fix hw ctl retrieval for mixer muxing Jeykumar Sankaran
     [not found]     ` <1539059262-8326-2-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-09 16:05       ` Jordan Crouse
2018-10-09 18:07     ` [Freedreno] " Sean Paul
2018-10-10  5:46       ` Jeykumar Sankaran
2018-10-10 14:29         ` [Freedreno] " Sean Paul
2018-10-10 18:35           ` Jeykumar Sankaran
     [not found]             ` <126041ab035da0674d0e5a6d2ce151da-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-11 14:51               ` Sean Paul
2018-10-09  4:27   ` [PATCH 02/25] drm/msm/dpu: avoid tracking reservations in RM Jeykumar Sankaran
     [not found]     ` <1539059262-8326-3-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-09 19:57       ` Sean Paul
2018-10-09  4:27   ` [PATCH 03/25] drm/msm/dpu: remove dev from RM Jeykumar Sankaran
     [not found]     ` <1539059262-8326-4-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-09 19:58       ` Sean Paul
2018-10-09  4:27   ` [PATCH 04/25] drm/msm/dpu: clean up dpu_rm_check_property_topctl declaration Jeykumar Sankaran
     [not found]     ` <1539059262-8326-5-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-09 19:59       ` Sean Paul
2018-10-09  4:27   ` [PATCH 05/25] drm/msm/dpu: remove encoder from crtc mixer struct Jeykumar Sankaran
     [not found]     ` <1539059262-8326-6-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-09 20:03       ` Sean Paul
2018-10-09  4:27   ` [PATCH 06/25] drm/msm/dpu: clean up redundant hw type Jeykumar Sankaran
     [not found]     ` <1539059262-8326-7-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-09 20:32       ` Sean Paul
2018-10-10  0:40       ` kbuild test robot
2018-10-09  4:27   ` [PATCH 07/25] drm/msm/dpu: reserve using crtc state Jeykumar Sankaran
     [not found]     ` <1539059262-8326-8-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-09 21:06       ` Sean Paul
2018-10-10  6:28         ` Jeykumar Sankaran
     [not found]           ` <eabacae428bee1041fc7f9bafec144f7-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-12 22:19             ` Jeykumar Sankaran
2018-10-09 21:53     ` kbuild test robot
2018-10-09  4:27   ` [PATCH 08/25] drm/msm/dpu: release reservation " Jeykumar Sankaran
2018-10-10 14:50     ` Sean Paul [this message]
2018-10-09  4:27   ` [PATCH 09/25] drm/msm/dpu: make RM iterator static Jeykumar Sankaran
     [not found]     ` <1539059262-8326-10-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-10 14:51       ` Sean Paul
2018-10-09  4:27   ` [PATCH 10/25] drm/msm/dpu: maintain hw_mdp in kms Jeykumar Sankaran
     [not found]     ` <1539059262-8326-11-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-09 16:42       ` Jordan Crouse
2018-10-10 14:54       ` Sean Paul
2018-10-09  4:27   ` [PATCH 11/25] drm/msm/dpu: remove reserve in encoder mode_set Jeykumar Sankaran
     [not found]     ` <1539059262-8326-12-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-10 14:57       ` Sean Paul
2018-10-09  4:27   ` [PATCH 12/25] drm/msm/dpu: remove mode_set_complete Jeykumar Sankaran
2018-10-10 14:59     ` Sean Paul
2018-10-09  4:27   ` [PATCH 13/25] drm/msm/dpu: make RM iterator hw type specific Jeykumar Sankaran
     [not found]     ` <1539059262-8326-14-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-10 15:00       ` Sean Paul
2018-10-09  4:27   ` [PATCH 14/25] drm/msm/dpu: remove enc_id tagging for hw blocks Jeykumar Sankaran
2018-10-10 15:06     ` Sean Paul
2018-10-10 18:41       ` Jeykumar Sankaran
2018-10-09  4:27   ` [PATCH 15/25] drm/msm/dpu: avoid redundant hw blk reference Jeykumar Sankaran
     [not found]     ` <1539059262-8326-16-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-10 15:07       ` Sean Paul
2018-10-09  4:27   ` [PATCH 16/25] drm/msm/dpu: clean up test_only flag for RM reservation Jeykumar Sankaran
2018-10-10 15:10     ` Sean Paul
2018-10-09  4:27   ` [PATCH 17/25] drm/msm/dpu: remove RM HW block list iterator Jeykumar Sankaran
2018-10-09  4:27   ` [PATCH 18/25] drm/msm/dpu: merge RM interface reservation helpers Jeykumar Sankaran
     [not found]     ` <1539059262-8326-19-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-09 16:50       ` Jordan Crouse
     [not found]         ` <20181009165022.GD3130-9PYrDHPZ2Orvke4nUoYGnHL1okKdlPRT@public.gmane.org>
2018-10-09 18:20           ` Jeykumar Sankaran
2018-10-09  4:27   ` [PATCH 19/25] drm/msm/dpu: remove msm_display_topology Jeykumar Sankaran
2018-10-09  4:27   ` [PATCH 20/25] drm/msm/dpu: refine layer mixer reservations Jeykumar Sankaran
2018-10-09  4:27   ` [PATCH 21/25] drm/msm/dpu: merge RM reservation helpers Jeykumar Sankaran
2018-10-09  4:27   ` [PATCH 22/25] drm/msm/dpu: make crtc and encoder specific HW reservation Jeykumar Sankaran
     [not found]     ` <1539059262-8326-23-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-09 20:41       ` Sean Paul
2018-10-10  6:15         ` Jeykumar Sankaran
2018-10-10 14:33           ` [Freedreno] " Sean Paul
2018-10-09  4:27   ` [PATCH 23/25] drm/msm/dpu: remove max_width from RM Jeykumar Sankaran
2018-10-09  4:27   ` [PATCH 24/25] drm/msm/dpu: remove mutex locking for RM interfaces Jeykumar Sankaran
     [not found]     ` <1539059262-8326-25-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-09 19:57       ` Sean Paul
2018-10-10  6:03         ` Jeykumar Sankaran
     [not found]           ` <0c506d6b3edbfec7519a2bffa9bdaedc-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-10-10 14:36             ` Sean Paul
2018-10-10 18:40               ` [Freedreno] " Jeykumar Sankaran
2018-10-09  4:27   ` [PATCH 25/25] drm/msm/dpu: maintain RM init check internally Jeykumar Sankaran
2018-10-09 19:29   ` [PATCH 00/25] reserve RM resources in CRTC state Sean Paul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181010145027.GU154160@art_vandelay \
    --to=sean@poorly.run \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=hoegsberg@google.com \
    --cc=jsanka@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=seanpaul@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox