From: Sean Paul <sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
To: freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: bzwang-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
Sean Paul <seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
abhinavk-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org
Subject: [PATCH v2 2/7] drm/msm: dpu: Move atomic_check_plane_state() call to atomic_check
Date: Wed, 12 Sep 2018 09:54:54 -0400 [thread overview]
Message-ID: <20180912135459.216217-2-sean@poorly.run> (raw)
In-Reply-To: <20180912135459.216217-1-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
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.
Changes in v2:
- Use the correct crtc state (Jeykumar)
Cc: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 57 +++++++----------------
1 file changed, 17 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..96e042b66cd7 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
@@ -1079,13 +1079,27 @@ 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 = drm_atomic_get_new_crtc_state(state->state,
+ state->crtc);
+
+ 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 +1113,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 +1151,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 +1224,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 +1262,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),
--
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
next prev parent reply other threads:[~2018-09-12 13:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-12 13:54 [PATCH v2 1/7] drm/msm: dpu: Remove impossible checks Sean Paul
[not found] ` <20180912135459.216217-1-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-09-12 13:54 ` Sean Paul [this message]
[not found] ` <20180912135459.216217-2-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-09-13 22:24 ` [PATCH v2 2/7] drm/msm: dpu: Move atomic_check_plane_state() call to atomic_check Jeykumar Sankaran
2018-09-12 13:54 ` [PATCH v2 3/7] drm/msm: dpu: Consolidate atomic_check functions() Sean Paul
[not found] ` <20180912135459.216217-3-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-09-13 22:24 ` Jeykumar Sankaran
2018-09-12 13:54 ` [PATCH v2 4/7] drm/msm: dpu: Remove dpu_plane_sspp_enabled() Sean Paul
[not found] ` <20180912135459.216217-4-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-09-13 22:25 ` Jeykumar Sankaran
2018-09-12 13:54 ` [PATCH v2 5/7] drm/msm: dpu: Remove dpu_plane_enabled() Sean Paul
[not found] ` <20180912135459.216217-5-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-09-13 22:30 ` Jeykumar Sankaran
2018-09-12 13:54 ` [PATCH v2 6/7] drm/msm: dpu: Make dpu_plane_sspp_atomic_update() void Sean Paul
[not found] ` <20180912135459.216217-6-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-09-13 22:33 ` Jeykumar Sankaran
2018-09-12 13:54 ` [PATCH v2 7/7] drm/msm: dpu: Don't continue after error in atomic_check Sean Paul
[not found] ` <20180912135459.216217-7-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-09-13 22:34 ` Jeykumar Sankaran
2018-09-13 22:23 ` [PATCH v2 1/7] drm/msm: dpu: Remove impossible checks Jeykumar Sankaran
[not found] ` <3782b720d2c4bee1bc20cacff8f6f7f5-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-09-17 15:44 ` 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=20180912135459.216217-2-sean@poorly.run \
--to=sean-p7ytbzm4h96eqtr555yldq@public.gmane.org \
--cc=abhinavk-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=bzwang-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@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).