linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeykumar Sankaran <jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
To: Sean Paul <sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	abhinavk-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	bzwang-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
	Rob Clark <robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Sean Paul <seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 2/7] drm/msm: dpu: Move atomic_check_plane_state() call to atomic_check
Date: Tue, 11 Sep 2018 15:44:48 -0700	[thread overview]
Message-ID: <dcd200557d2b1c920bf6e7b42e5567db@codeaurora.org> (raw)
In-Reply-To: <20180911201550.210810-2-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>

On 2018-09-11 13:15, Sean Paul wrote:
> From: Sean Paul <seanpaul@chromium.org>
> 
> src/dst rects are checked in both atomic_check and atomic_update, with
> the more comprehensive check occurring in atomic_update, which is
> backwards. So consolodate the checks in atomic_check.
> 
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 56 +++++++----------------
>  1 file changed, 16 insertions(+), 40 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
> index 0f428f66b951..853902ac4fb9 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
> @@ -1079,13 +1079,26 @@ static bool dpu_plane_validate_src(struct 
> drm_rect
> *src,
>  static int dpu_plane_sspp_atomic_check(struct drm_plane *plane,
>  		struct drm_plane_state *state)
>  {
> -	int ret = 0;
> +	int ret = 0, min_scale;
>  	struct dpu_plane *pdpu = to_dpu_plane(plane);
> +	const struct drm_crtc_state *crtc_state = NULL;
>  	const struct dpu_format *fmt;
>  	struct drm_rect src, dst, fb_rect = { 0 };
> -	uint32_t max_upscale = 1, max_downscale = 1;
>  	uint32_t min_src_size, max_linewidth;
> -	int hscale = 1, vscale = 1;
> +
> +	if (state->crtc)
> +		crtc_state = state->crtc->state;
Isn't the crtc_state retrieved here the old crtc state? Since the plane 
check is called before swap, the CRTC state
for this commit should be retrieved from global atomic state 
state->state using drm_atomic_get_existing_crtc_state.

Jeykumar S.
> +
> +	min_scale = FRAC_16_16(1, pdpu->pipe_sblk->maxdwnscale);
> +	ret = drm_atomic_helper_check_plane_state(state, crtc_state,
> min_scale,
> +					  pdpu->pipe_sblk->maxupscale <<
> 16,
> +					  true, true);
> +	if (ret) {
> +		DPU_ERROR_PLANE(pdpu, "Check plane state failed (%d)\n",
> ret);
> +		return ret;
> +	}
> +	if (!state->visible)
> +		return 0;
> 
>  	src.x1 = state->src_x >> 16;
>  	src.y1 = state->src_y >> 16;
> @@ -1099,25 +1112,6 @@ static int dpu_plane_sspp_atomic_check(struct
> drm_plane *plane,
> 
>  	max_linewidth = pdpu->pipe_sblk->common->maxlinewidth;
> 
> -	if (pdpu->features & DPU_SSPP_SCALER) {
> -		max_downscale = pdpu->pipe_sblk->maxdwnscale;
> -		max_upscale = pdpu->pipe_sblk->maxupscale;
> -	}
> -	if (drm_rect_width(&src) < drm_rect_width(&dst))
> -		hscale = drm_rect_calc_hscale(&src, &dst, 1, max_upscale);
> -	else
> -		hscale = drm_rect_calc_hscale(&dst, &src, 1,
> max_downscale);
> -	if (drm_rect_height(&src) < drm_rect_height(&dst))
> -		vscale = drm_rect_calc_vscale(&src, &dst, 1, max_upscale);
> -	else
> -		vscale = drm_rect_calc_vscale(&dst, &src, 1,
> max_downscale);
> -
> -	DPU_DEBUG_PLANE(pdpu, "check %d -> %d\n",
> -		dpu_plane_enabled(plane->state),
> dpu_plane_enabled(state));
> -
> -	if (!dpu_plane_enabled(state))
> -		goto exit;
> -
>  	fmt = to_dpu_format(msm_framebuffer_format(state->fb));
> 
>  	min_src_size = DPU_FORMAT_IS_YUV(fmt) ? 2 : 1;
> @@ -1156,16 +1150,8 @@ static int dpu_plane_sspp_atomic_check(struct
> drm_plane *plane,
>  		DPU_ERROR_PLANE(pdpu, "invalid src " DRM_RECT_FMT "
> line:%u\n",
>  				DRM_RECT_ARG(&src), max_linewidth);
>  		ret = -E2BIG;
> -
> -	/* check scaler capability */
> -	} else if (hscale < 0 || vscale < 0) {
> -		DPU_ERROR_PLANE(pdpu, "invalid scaling requested src="
> -				DRM_RECT_FMT " dst=" DRM_RECT_FMT "\n",
> -				DRM_RECT_ARG(&src), DRM_RECT_ARG(&dst));
> -		ret = -E2BIG;
>  	}
> 
> -exit:
>  	return ret;
>  }
> 
> @@ -1237,7 +1223,6 @@ static int dpu_plane_sspp_atomic_update(struct
> drm_plane *plane,
>  	const struct dpu_format *fmt;
>  	struct drm_crtc *crtc;
>  	struct drm_framebuffer *fb;
> -	int ret, min_scale;
> 
>  	if (!plane) {
>  		DPU_ERROR("invalid plane\n");
> @@ -1276,15 +1261,6 @@ static int dpu_plane_sspp_atomic_update(struct
> drm_plane *plane,
>  	pdpu->is_rt_pipe = (dpu_crtc_get_client_type(crtc) != NRT_CLIENT);
>  	_dpu_plane_set_qos_ctrl(plane, false, DPU_PLANE_QOS_PANIC_CTRL);
> 
> -	min_scale = FRAC_16_16(1, pdpu->pipe_sblk->maxdwnscale);
> -	ret = drm_atomic_helper_check_plane_state(state, crtc->state,
> min_scale,
> -					  pdpu->pipe_sblk->maxupscale <<
> 16,
> -					  true, false);
> -	if (ret) {
> -		DPU_ERROR_PLANE(pdpu, "Check plane state failed (%d)\n",
> ret);
> -		return ret;
> -	}
> -
>  	DPU_DEBUG_PLANE(pdpu, "FB[%u] " DRM_RECT_FP_FMT "->crtc%u "
> DRM_RECT_FMT
>  			", %4.4s ubwc %d\n", fb->base.id,
> DRM_RECT_FP_ARG(&state->src),
>  			crtc->base.id, DRM_RECT_ARG(&state->dst),

-- 
Jeykumar S
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

  parent reply	other threads:[~2018-09-11 22:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-11 20:15 [PATCH 1/7] drm/msm: dpu: Remove impossible checks Sean Paul
     [not found] ` <20180911201550.210810-1-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-09-11 20:15   ` [PATCH 2/7] drm/msm: dpu: Move atomic_check_plane_state() call to atomic_check Sean Paul
     [not found]     ` <20180911201550.210810-2-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-09-11 22:44       ` Jeykumar Sankaran [this message]
     [not found]         ` <dcd200557d2b1c920bf6e7b42e5567db-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-09-12 13:39           ` Sean Paul
2018-09-11 20:15   ` [PATCH 3/7] drm/msm: dpu: Consolodate atomic_check functions() Sean Paul
     [not found]     ` <20180911201550.210810-3-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-09-11 22:48       ` Jeykumar Sankaran
2018-09-11 20:15   ` [PATCH 4/7] drm/msm: dpu: Remove dpu_plane_sspp_enabled() Sean Paul
2018-09-11 20:15   ` [PATCH 5/7] drm/msm: dpu: Remove dpu_plane_enabled() Sean Paul
2018-09-11 20:15   ` [PATCH 6/7] drm/msm: dpu: Make dpu_plane_sspp_atomic_update() void Sean Paul
2018-09-11 20:15   ` [PATCH 7/7] drm/msm: dpu: Don't continue after error in atomic_check 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=dcd200557d2b1c920bf6e7b42e5567db@codeaurora.org \
    --to=jsanka-sgv2jx0feol9jmxxk+q4oq@public.gmane.org \
    --cc=abhinavk-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=bzwang-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org \
    --cc=seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.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).