From: "Lisovskiy, Stanislav" <stanislav.lisovskiy@intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 18/23] drm/i915: Add bigjoiner aware plane clipping checks
Date: Tue, 17 Nov 2020 16:54:11 +0200 [thread overview]
Message-ID: <20201117145404.GA31218@intel.com> (raw)
In-Reply-To: <20201113220358.24794-19-ville.syrjala@linux.intel.com>
On Sat, Nov 14, 2020 at 12:03:53AM +0200, Ville Syrjala wrote:
> From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>
> We need to look at hw.fb for the framebuffer, and add the translation
> for the slave_plane_state. With these changes we set the correct
> rectangle on the bigjoiner slave, and don't set incorrect
> src/dst/visibility on the slave plane.
>
> v2:
> * Manual rebase (Manasi)
>
> v3:
> * hw.rotation instead of uapi.rotation (Ville)
>
Looks good to me,
Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
> ---
> .../gpu/drm/i915/display/intel_atomic_plane.c | 60 +++++++++++++++++++
> .../gpu/drm/i915/display/intel_atomic_plane.h | 4 ++
> drivers/gpu/drm/i915/display/intel_display.c | 19 +++---
> drivers/gpu/drm/i915/display/intel_sprite.c | 21 +++----
> 4 files changed, 80 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.c b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> index 7abb0e3d6c0b..7e9f84b00859 100644
> --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.c
> @@ -271,6 +271,9 @@ void intel_plane_copy_uapi_to_hw_state(struct intel_plane_state *plane_state,
> plane_state->hw.color_encoding = from_plane_state->uapi.color_encoding;
> plane_state->hw.color_range = from_plane_state->uapi.color_range;
> plane_state->hw.scaling_filter = from_plane_state->uapi.scaling_filter;
> +
> + plane_state->uapi.src = drm_plane_state_src(&from_plane_state->uapi);
> + plane_state->uapi.dst = drm_plane_state_dest(&from_plane_state->uapi);
> }
>
> void intel_plane_copy_hw_state(struct intel_plane_state *plane_state,
> @@ -514,6 +517,63 @@ void i9xx_update_planes_on_crtc(struct intel_atomic_state *state,
> }
> }
>
> +int intel_atomic_plane_check_clipping(struct intel_plane_state *plane_state,
> + struct intel_crtc_state *crtc_state,
> + int min_scale, int max_scale,
> + bool can_position)
> +{
> + struct drm_framebuffer *fb = plane_state->hw.fb;
> + struct drm_rect *src = &plane_state->uapi.src;
> + struct drm_rect *dst = &plane_state->uapi.dst;
> + unsigned int rotation = plane_state->hw.rotation;
> + struct drm_rect clip = {};
> + int hscale, vscale;
> +
> + if (!fb) {
> + plane_state->uapi.visible = false;
> + return 0;
> + }
> +
> + drm_rect_rotate(src, fb->width << 16, fb->height << 16, rotation);
> +
> + /* Check scaling */
> + hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale);
> + vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale);
> + if (hscale < 0 || vscale < 0) {
> + DRM_DEBUG_KMS("Invalid scaling of plane\n");
> + drm_rect_debug_print("src: ", src, true);
> + drm_rect_debug_print("dst: ", dst, false);
> + return -ERANGE;
> + }
> +
> + if (crtc_state->hw.enable) {
> + clip.x2 = crtc_state->pipe_src_w;
> + clip.y2 = crtc_state->pipe_src_h;
> + }
> +
> + /* right side of the image is on the slave crtc, adjust dst to match */
> + if (crtc_state->bigjoiner_slave)
> + drm_rect_translate(dst, -crtc_state->pipe_src_w, 0);
> +
> + /*
> + * FIXME: This might need further adjustment for seamless scaling
> + * with phase information, for the 2p2 and 2p1 scenarios.
> + */
> + plane_state->uapi.visible = drm_rect_clip_scaled(src, dst, &clip);
> +
> + drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, rotation);
> +
> + if (!can_position && plane_state->uapi.visible &&
> + !drm_rect_equals(dst, &clip)) {
> + DRM_DEBUG_KMS("Plane must cover entire CRTC\n");
> + drm_rect_debug_print("dst: ", dst, false);
> + drm_rect_debug_print("clip: ", &clip, false);
> + return -EINVAL;
> + }
> +
> + return 0;
> +}
> +
> const struct drm_plane_helper_funcs intel_plane_helper_funcs = {
> .prepare_fb = intel_prepare_plane_fb,
> .cleanup_fb = intel_cleanup_plane_fb,
> diff --git a/drivers/gpu/drm/i915/display/intel_atomic_plane.h b/drivers/gpu/drm/i915/display/intel_atomic_plane.h
> index 5cae9db41062..5c78a087ed86 100644
> --- a/drivers/gpu/drm/i915/display/intel_atomic_plane.h
> +++ b/drivers/gpu/drm/i915/display/intel_atomic_plane.h
> @@ -55,6 +55,10 @@ int intel_plane_atomic_calc_changes(const struct intel_crtc_state *old_crtc_stat
> int intel_plane_calc_min_cdclk(struct intel_atomic_state *state,
> struct intel_plane *plane,
> bool *need_cdclk_calc);
> +int intel_atomic_plane_check_clipping(struct intel_plane_state *plane_state,
> + struct intel_crtc_state *crtc_state,
> + int min_scale, int max_scale,
> + bool can_position);
> void intel_plane_set_invisible(struct intel_crtc_state *crtc_state,
> struct intel_plane_state *plane_state);
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 55e0a2f21d98..eeb50413fc8e 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -4315,12 +4315,10 @@ i9xx_plane_check(struct intel_crtc_state *crtc_state,
> if (ret)
> return ret;
>
> - ret = drm_atomic_helper_check_plane_state(&plane_state->uapi,
> - &crtc_state->uapi,
> - DRM_PLANE_HELPER_NO_SCALING,
> - DRM_PLANE_HELPER_NO_SCALING,
> - i9xx_plane_has_windowing(plane),
> - true);
> + ret = intel_atomic_plane_check_clipping(plane_state, crtc_state,
> + DRM_PLANE_HELPER_NO_SCALING,
> + DRM_PLANE_HELPER_NO_SCALING,
> + i9xx_plane_has_windowing(plane));
> if (ret)
> return ret;
>
> @@ -11660,11 +11658,10 @@ static int intel_check_cursor(struct intel_crtc_state *crtc_state,
> return -EINVAL;
> }
>
> - ret = drm_atomic_helper_check_plane_state(&plane_state->uapi,
> - &crtc_state->uapi,
> - DRM_PLANE_HELPER_NO_SCALING,
> - DRM_PLANE_HELPER_NO_SCALING,
> - true, true);
> + ret = intel_atomic_plane_check_clipping(plane_state, crtc_state,
> + DRM_PLANE_HELPER_NO_SCALING,
> + DRM_PLANE_HELPER_NO_SCALING,
> + true);
> if (ret)
> return ret;
>
> diff --git a/drivers/gpu/drm/i915/display/intel_sprite.c b/drivers/gpu/drm/i915/display/intel_sprite.c
> index a3ab44694118..019a2d6d807a 100644
> --- a/drivers/gpu/drm/i915/display/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/display/intel_sprite.c
> @@ -2187,10 +2187,8 @@ g4x_sprite_check(struct intel_crtc_state *crtc_state,
> }
> }
>
> - ret = drm_atomic_helper_check_plane_state(&plane_state->uapi,
> - &crtc_state->uapi,
> - min_scale, max_scale,
> - true, true);
> + ret = intel_atomic_plane_check_clipping(plane_state, crtc_state,
> + min_scale, max_scale, true);
> if (ret)
> return ret;
>
> @@ -2245,11 +2243,10 @@ vlv_sprite_check(struct intel_crtc_state *crtc_state,
> if (ret)
> return ret;
>
> - ret = drm_atomic_helper_check_plane_state(&plane_state->uapi,
> - &crtc_state->uapi,
> - DRM_PLANE_HELPER_NO_SCALING,
> - DRM_PLANE_HELPER_NO_SCALING,
> - true, true);
> + ret = intel_atomic_plane_check_clipping(plane_state, crtc_state,
> + DRM_PLANE_HELPER_NO_SCALING,
> + DRM_PLANE_HELPER_NO_SCALING,
> + true);
> if (ret)
> return ret;
>
> @@ -2456,10 +2453,8 @@ static int skl_plane_check(struct intel_crtc_state *crtc_state,
> max_scale = skl_plane_max_scale(dev_priv, fb);
> }
>
> - ret = drm_atomic_helper_check_plane_state(&plane_state->uapi,
> - &crtc_state->uapi,
> - min_scale, max_scale,
> - true, true);
> + ret = intel_atomic_plane_check_clipping(plane_state, crtc_state,
> + min_scale, max_scale, true);
> if (ret)
> return ret;
>
> --
> 2.26.2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2020-11-17 14:53 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-13 22:03 [Intel-gfx] [PATCH 00/23] drm/i915: Big bigjoiner series Ville Syrjala
2020-11-13 22:03 ` [Intel-gfx] [PATCH 01/23] drm/i915: Copy the plane hw state directly for Y planes Ville Syrjala
2020-11-17 9:19 ` Lisovskiy, Stanislav
2020-11-13 22:03 ` [Intel-gfx] [PATCH 02/23] drm/i915: Pass intel_atomic_state around Ville Syrjala
2020-11-13 22:03 ` [Intel-gfx] [PATCH 03/23] drm/i915: Nuke intel_atomic_crtc_state_for_each_plane_state() from skl+ wm code Ville Syrjala
2020-11-13 22:03 ` [Intel-gfx] [PATCH 04/23] drm/i915: Pimp the watermark documentation a bit Ville Syrjala
2020-11-13 22:03 ` [Intel-gfx] [PATCH 05/23] drm/i915: Precompute can_sagv for each wm level Ville Syrjala
2020-11-13 22:03 ` [Intel-gfx] [PATCH 06/23] drm/i915: Store plane relative data rate in crtc_state Ville Syrjala
2020-11-13 22:03 ` [Intel-gfx] [PATCH 07/23] drm/i915: Remove skl_adjusted_plane_pixel_rate() Ville Syrjala
2020-11-13 22:03 ` [Intel-gfx] [PATCH 08/23] drm/i915: Pass intel_atomic_state instead of drm_atomic_state Ville Syrjala
2020-11-13 22:03 ` [Intel-gfx] [PATCH 09/23] drm/i915/dp: Add from_crtc_state to copy color blobs Ville Syrjala
2020-11-13 22:03 ` [Intel-gfx] [PATCH 10/23] drm/i915/dp: Allow big joiner modes in intel_dp_mode_valid(), v3 Ville Syrjala
2020-11-13 22:03 ` [Intel-gfx] [PATCH 11/23] drm/i915: Try to make bigjoiner work in atomic check Ville Syrjala
2020-11-17 8:28 ` Manna, Animesh
2020-11-13 22:03 ` [Intel-gfx] [PATCH 12/23] drm/i915/dp: Modify VDSC helpers to configure DSC for Bigjoiner slave Ville Syrjala
2020-11-13 22:03 ` [Intel-gfx] [PATCH 13/23] drm/i915/dp: Master/Slave enable/disable sequence for bigjoiner Ville Syrjala
2020-11-17 9:17 ` Manna, Animesh
2020-11-13 22:03 ` [Intel-gfx] [PATCH 14/23] drm/i915: HW state readout for Bigjoiner case Ville Syrjala
2020-11-17 9:51 ` Manna, Animesh
2020-11-13 22:03 ` [Intel-gfx] [PATCH 15/23] drm/i915: Add crtcs affected by bigjoiner to the state Ville Syrjala
2020-11-16 23:37 ` Navare, Manasi
2020-11-13 22:03 ` [Intel-gfx] [PATCH 16/23] drm/i915: Add planes " Ville Syrjala
2020-11-17 0:09 ` Navare, Manasi
2020-11-17 15:14 ` Ville Syrjälä
2020-11-17 15:50 ` Navare, Manasi
2020-11-13 22:03 ` [Intel-gfx] [PATCH 17/23] drm/i915: Get the uapi state from the correct plane when bigjoiner is used Ville Syrjala
2020-11-17 0:24 ` Navare, Manasi
2020-11-17 15:17 ` Ville Syrjälä
2020-11-17 15:48 ` Navare, Manasi
2020-11-13 22:03 ` [Intel-gfx] [PATCH 18/23] drm/i915: Add bigjoiner aware plane clipping checks Ville Syrjala
2020-11-17 14:54 ` Lisovskiy, Stanislav [this message]
2020-11-13 22:03 ` [Intel-gfx] [PATCH 19/23] drm/i915: Add debugfs dumping for bigjoiner, v3 Ville Syrjala
2020-11-17 11:07 ` Manna, Animesh
2020-11-13 22:03 ` [Intel-gfx] [PATCH 20/23] drm/i915: Disable legacy cursor fastpath for bigjoiner Ville Syrjala
2020-11-17 0:27 ` Navare, Manasi
2020-11-13 22:03 ` [Intel-gfx] [PATCH 21/23] drm/i915: Fix cursor src/dst rectangle with bigjoiner Ville Syrjala
2020-11-17 0:33 ` Navare, Manasi
2020-11-17 15:09 ` Ville Syrjälä
2020-11-17 15:52 ` Navare, Manasi
2020-11-13 22:03 ` [Intel-gfx] [PATCH 22/23] drm/i915: Add bigjoiner state dump Ville Syrjala
2020-11-17 0:36 ` Navare, Manasi
2020-11-13 22:03 ` [Intel-gfx] [PATCH 23/23] drm/i915: Enable bigjoiner Ville Syrjala
2020-11-17 0:36 ` Navare, Manasi
2020-11-14 0:13 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Big bigjoiner series Patchwork
2020-11-14 0:14 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2020-11-14 0:42 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-11-14 4:10 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
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=20201117145404.GA31218@intel.com \
--to=stanislav.lisovskiy@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=ville.syrjala@linux.intel.com \
/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