dri-devel.lists.freedesktop.org archive mirror
 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 09/14] drm/msm/dpu: make crtc get_mixer_width helper static
Date: Fri, 31 Aug 2018 10:40:05 -0400	[thread overview]
Message-ID: <20180831144005.GA91962@art_vandelay> (raw)
In-Reply-To: <1535503203-22054-10-git-send-email-jsanka@codeaurora.org>

On Tue, Aug 28, 2018 at 05:39:58PM -0700, Jeykumar Sankaran wrote:
> Mark CRTC get_mixer_width helper API static as it is
> not used outside the file.
> 
> Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 21 ++++++++++++++++++---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h | 18 ------------------
>  2 files changed, 18 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> index 92eda3e..e061847 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> @@ -47,6 +47,20 @@
>  #define LEFT_MIXER 0
>  #define RIGHT_MIXER 1
>  
> +static inline int _dpu_crtc_get_mixer_width(struct dpu_crtc *dpu_crtc,
> +	struct dpu_crtc_state *cstate, struct drm_display_mode *mode)
> +{
> +	u32 mixer_width;
> +
> +	if (!dpu_crtc || !cstate || !mode)
> +		return 0;
> +
> +	mixer_width = (cstate->num_mixers == CRTC_DUAL_MIXERS ?
> +			mode->hdisplay / CRTC_DUAL_MIXERS : mode->hdisplay);
> +
> +	return mixer_width;
> +}

This function feels a little too beefy to be inline.

However(!!): 
 - None of the NULL checks are needed
 - the mixer_width local variable isn't needed
 - dpu_crtc isn't even used
 - the divisor is always == cstate->num_mixers

So you can actually get an inline-worth function out of this, all of that
simplifies down to:

static inline int dpu_crtc_get_mixer_width(struct dpu_crtc_state *cstate,
                                           struct drm_display_mode *mode)
{
        return mode->hdisplay / cstate->num_mixers;
}

> +
>  static inline struct dpu_kms *_dpu_crtc_get_kms(struct drm_crtc *crtc)
>  {
>  	struct msm_drm_private *priv;
> @@ -601,7 +615,8 @@ static void _dpu_crtc_setup_lm_bounds(struct drm_crtc *crtc,
>  	cstate = to_dpu_crtc_state(state);
>  
>  	adj_mode = &state->adjusted_mode;
> -	crtc_split_width = dpu_crtc_get_mixer_width(dpu_crtc, cstate, adj_mode);
> +	crtc_split_width = _dpu_crtc_get_mixer_width(dpu_crtc, cstate,
> +						    adj_mode);
>  
>  	for (i = 0; i < dpu_crtc->num_mixers; i++) {
>  		struct drm_rect *r = &cstate->lm_bounds[i];
> @@ -1299,7 +1314,7 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc,
>  
>  	memset(pipe_staged, 0, sizeof(pipe_staged));
>  
> -	mixer_width = dpu_crtc_get_mixer_width(dpu_crtc, cstate, mode);
> +	mixer_width = _dpu_crtc_get_mixer_width(dpu_crtc, cstate, mode);
>  
>  	_dpu_crtc_setup_lm_bounds(crtc, state);
>  
> @@ -1536,7 +1551,7 @@ static int _dpu_debugfs_status_show(struct seq_file *s, void *data)
>  
>  	mutex_lock(&dpu_crtc->crtc_lock);
>  	mode = &crtc->state->adjusted_mode;
> -	out_width = dpu_crtc_get_mixer_width(dpu_crtc, cstate, mode);
> +	out_width = _dpu_crtc_get_mixer_width(dpu_crtc, cstate, mode);
>  
>  	seq_printf(s, "crtc:%d width:%d height:%d\n", crtc->base.id,
>  				mode->hdisplay, mode->vdisplay);
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
> index ec9c538..5e4dc5c 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h
> @@ -238,24 +238,6 @@ struct dpu_crtc_state {
>  	container_of(x, struct dpu_crtc_state, base)
>  
>  /**
> - * dpu_crtc_get_mixer_width - get the mixer width
> - * Mixer width will be same as panel width(/2 for split)
> - */
> -static inline int dpu_crtc_get_mixer_width(struct dpu_crtc *dpu_crtc,
> -	struct dpu_crtc_state *cstate, struct drm_display_mode *mode)
> -{
> -	u32 mixer_width;
> -
> -	if (!dpu_crtc || !cstate || !mode)
> -		return 0;
> -
> -	mixer_width = (dpu_crtc->num_mixers == CRTC_DUAL_MIXERS ?
> -			mode->hdisplay / CRTC_DUAL_MIXERS : mode->hdisplay);
> -
> -	return mixer_width;
> -}
> -
> -/**
>   * dpu_crtc_get_mixer_height - get the mixer height
>   * Mixer height will be same as panel height
>   */
> -- 
> 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-08-31 14:40 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-29  0:39 [PATCH 00/14] clean up DPU for RM refactor Jeykumar Sankaran
2018-08-29  0:39 ` [PATCH 01/14] drm/msm/dpu: remove debugfs support for misr Jeykumar Sankaran
     [not found]   ` <1535503203-22054-2-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-08-30 16:15     ` Sean Paul
     [not found] ` <1535503203-22054-1-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-08-29  0:39   ` [PATCH 02/14] drm/msm/dpu: remove scalar config definitions Jeykumar Sankaran
2018-08-29  0:39   ` [PATCH 03/14] drm/msm/dpu: remove resource pool manager Jeykumar Sankaran
2018-08-29  0:39   ` [PATCH 04/14] drm/msm/dpu: remove ping pong split topology variables Jeykumar Sankaran
2018-08-29  0:39   ` [PATCH 05/14] drm/msm/dpu: enable master-slave encoders explicitly Jeykumar Sankaran
2018-08-30 16:24     ` Sean Paul
2018-08-31 19:16       ` Jeykumar Sankaran
     [not found]         ` <3c3232c852b8f3a17955322c8ec3fbd8-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-08-31 20:12           ` Sean Paul
2018-08-29  0:39   ` [PATCH 06/14] drm/msm/dpu: use kms stored hw mdp block Jeykumar Sankaran
2018-08-29  0:39   ` [PATCH 07/14] drm/msm/dpu: iterate for assigned hw ctl in virtual encoder Jeykumar Sankaran
     [not found]     ` <1535503203-22054-8-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-08-30 16:28       ` Sean Paul
2018-08-29  0:39   ` [PATCH 08/14] drm/msm/dpu: avoid querying for hw intf before assignment Jeykumar Sankaran
     [not found]     ` <1535503203-22054-9-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-08-30 16:39       ` Sean Paul
2018-08-29  0:39   ` [PATCH 09/14] drm/msm/dpu: make crtc get_mixer_width helper static Jeykumar Sankaran
2018-08-31 14:40     ` Sean Paul [this message]
2018-08-29  0:39   ` [PATCH 10/14] drm/msm/dpu: move hw resource tracking to crtc state Jeykumar Sankaran
2018-08-31 14:56     ` Sean Paul
2018-08-31 19:22       ` Jeykumar Sankaran
     [not found]         ` <b09b0a69d6b72ae170c0b02f6acfb9d5-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-08-31 20:13           ` Sean Paul
2018-09-04 22:36       ` Jeykumar Sankaran
2018-08-29  0:40   ` [PATCH 11/14] drm/msm/dpu: rename hw_ctl to lm_ctl Jeykumar Sankaran
2018-08-31 15:54     ` Sean Paul
2018-08-29  0:40   ` [PATCH 12/14] drm/msm/dpu: remove topology name Jeykumar Sankaran
     [not found]     ` <1535503203-22054-13-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-08-31 16:08       ` Sean Paul
2018-09-04 23:03         ` Jeykumar Sankaran
     [not found]           ` <6e6b8dd4bbc3343c82b3e093db23b6f5-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-09-05 13:33             ` Sean Paul
2018-08-29  0:40   ` [PATCH 13/14] drm/msm/dpu: remove display H_TILE from encoder Jeykumar Sankaran
2018-08-31 16:10     ` Sean Paul
2018-08-29  0:40   ` [PATCH 14/14] drm/msm/dpu: remove cdm block support from resource manager Jeykumar Sankaran
     [not found]     ` <1535503203-22054-15-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-08-31 16:12       ` 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=20180831144005.GA91962@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;
as well as URLs for NNTP newsgroup(s).