Re: [PATCH 09/14] drm/msm/dpu: make crtc get_mixer_width helper static

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
> ---
>  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@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux