From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Karthik B S <karthik.b.s@intel.com>
Cc: paulo.r.zanoni@intel.com, michel@daenzer.net,
dri-devel@lists.freedesktop.org, nicholas.kazlauskas@amd.com,
daniel.vetter@intel.com, harry.wentland@amd.com,
intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v10 3/8] drm/i915: Add checks specific to async flips
Date: Fri, 18 Sep 2020 14:51:32 +0300 [thread overview]
Message-ID: <20200918115132.GI6112@intel.com> (raw)
In-Reply-To: <20200918090234.18038-1-karthik.b.s@intel.com>
On Fri, Sep 18, 2020 at 02:32:34PM +0530, Karthik B S wrote:
> If flip is requested on any other plane, reject it.
>
> Make sure there is no change in fbc, offset and framebuffer modifiers
> when async flip is requested.
>
> If any of these are modified, reject async flip.
>
> v2: -Replace DRM_ERROR (Paulo)
> -Add check for changes in OFFSET, FBC, RC(Paulo)
>
> v3: -Removed TODO as benchmarking tests have been run now.
>
> v4: -Added more state checks for async flip (Ville)
> -Moved intel_atomic_check_async to the end of intel_atomic_check
> as the plane checks needs to pass before this. (Ville)
> -Removed crtc_state->enable_fbc check. (Ville)
> -Set the I915_MODE_FLAG_GET_SCANLINE_FROM_TIMESTAMP flag for async
> flip case as scanline counter is not reliable here.
>
> v5: -Fix typo and other check patch errors seen in CI
> in 'intel_atomic_check_async' function.
>
> v6: -Don't call intel_atomic_check_async multiple times. (Ville)
> -Remove the check for n_planes in intel_atomic_check_async
> -Added documentation for async flips. (Paulo)
>
> v7: -Replace 'intel_plane' with 'plane'. (Ville)
> -Replace all uapi.foo as hw.foo. (Ville)
> -Do not use intel_wm_need_update function. (Ville)
> -Add destination coordinate check. (Ville)
> -Do not allow async flip with linear buffer
> on older hw as it has issues with this. (Ville)
> -Remove break after intel_atomic_check_async. (Ville)
>
> v8: -Rebased.
>
> v9: -Replace DRM_DEBUG_KMS with drm_dbg_kms(). (Ville)
> -Fix comment formatting. (Ville)
> -Remove gen specific checks. (Ville)
> -Remove irrelevant FB size check. (Ville)
> -Add missing stride check. (Ville)
> -Use drm_rect_equals() instead of individual checks. (Ville)
> -Call intel_atomic_check_async before state dump. (Ville)
>
> v10: -Fix the checkpatch errors seen on CI.
>
> Signed-off-by: Karthik B S <karthik.b.s@intel.com>
> Signed-off-by: Vandita Kulkarni <vandita.kulkarni@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_display.c | 137 +++++++++++++++++++
> 1 file changed, 137 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 30e8908ee263..7327ed4a04f8 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -14877,6 +14877,137 @@ static bool intel_cpu_transcoders_need_modeset(struct intel_atomic_state *state,
> return false;
> }
>
> +/**
> + * DOC: asynchronous flip implementation
> + *
> + * Asynchronous page flip is the implementation for the DRM_MODE_PAGE_FLIP_ASYNC
> + * flag. Currently async flip is only supported via the drmModePageFlip IOCTL.
> + * Correspondingly, support is currently added for primary plane only.
> + *
> + * Async flip can only change the plane surface address, so anything else
> + * changing is rejected from the intel_atomic_check_async() function.
> + * Once this check is cleared, flip done interrupt is enabled using
> + * the skl_enable_flip_done() function.
> + *
> + * As soon as the surface address register is written, flip done interrupt is
> + * generated and the requested events are sent to the usersapce in the interrupt
> + * handler itself. The timestamp and sequence sent during the flip done event
> + * correspond to the last vblank and have no relation to the actual time when
> + * the flip done event was sent.
> + */
> +
> +static int intel_atomic_check_async(struct intel_atomic_state *state)
> +{
> + struct drm_i915_private *i915 = to_i915(state->base.dev);
> + struct intel_crtc_state *old_crtc_state, *new_crtc_state;
> + struct intel_plane_state *new_plane_state, *old_plane_state;a
All plane/crtc states can be const I believe.
> + struct intel_crtc *crtc;
> + struct intel_plane *plane;
> + int i;
> +
> + for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
> + new_crtc_state, i) {
> + if (needs_modeset(new_crtc_state)) {
> + drm_dbg_kms(&i915->drm, "Modeset Required. Async flip not supported\n");
> + return -EINVAL;
> + }
> +
> + if (!new_crtc_state->hw.active) {
> + drm_dbg_kms(&i915->drm, "CRTC inactive\n");
> + return -EINVAL;
> + }
> + if (old_crtc_state->active_planes != new_crtc_state->active_planes) {
> + drm_dbg_kms(&i915->drm,
> + "Active planes cannot be changed during async flip\n");
> + return -EINVAL;
> + }
> + }
> +
> + for_each_oldnew_intel_plane_in_state(state, plane, old_plane_state,
> + new_plane_state, i) {
> + /*
> + * TODO: Async flip is only supported through the page flip IOCTL
> + * as of now. So support currently added for primary plane only.
> + * Support for other planes on platforms on which supports
> + * this(vlv/chv and icl+) should be added when async flip is
> + * enabled in the atomic IOCTL path.
> + */
> + if (plane->id != PLANE_PRIMARY)
> + return -EINVAL;
> +
> + /*
> + * FIXME: This check is kept generic for all platforms.
> + * Need to verify this for all gen9 and gen10 platforms to enable
> + * this selectively if required.
> + */
> + if (!(new_plane_state->hw.fb->modifier != I915_FORMAT_MOD_X_TILED ||
> + new_plane_state->hw.fb->modifier != I915_FORMAT_MOD_Y_TILED ||
> + new_plane_state->hw.fb->modifier != I915_FORMAT_MOD_Yf_TILED)) {
I suspect a switch() would be less ugly
looks good otherwise
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> + drm_dbg_kms(&i915->drm,
> + "Linear memory/CCS does not support async flips\n");
> + return -EINVAL;
> + }
> +
> + if (old_plane_state->color_plane[0].stride !=
> + new_plane_state->color_plane[0].stride) {
> + drm_dbg_kms(&i915->drm, "Stride cannot be changed in async flip\n");
> + return -EINVAL;
> + }
> +
> + if (old_plane_state->hw.fb->modifier !=
> + new_plane_state->hw.fb->modifier) {
> + drm_dbg_kms(&i915->drm,
> + "Framebuffer modifiers cannot be changed in async flip\n");
> + return -EINVAL;
> + }
> +
> + if (old_plane_state->hw.fb->format !=
> + new_plane_state->hw.fb->format) {
> + drm_dbg_kms(&i915->drm,
> + "Framebuffer format cannot be changed in async flip\n");
> + return -EINVAL;
> + }
> +
> + if (old_plane_state->hw.rotation !=
> + new_plane_state->hw.rotation) {
> + drm_dbg_kms(&i915->drm, "Rotation cannot be changed in async flip\n");
> + return -EINVAL;
> + }
> +
> + if (!drm_rect_equals(&old_plane_state->uapi.src, &new_plane_state->uapi.src) ||
> + !drm_rect_equals(&old_plane_state->uapi.dst, &new_plane_state->uapi.dst)) {
> + drm_dbg_kms(&i915->drm,
> + "Plane size/co-ordinates cannot be changed in async flip\n");
> + return -EINVAL;
> + }
> +
> + if (old_plane_state->hw.alpha != new_plane_state->hw.alpha) {
> + drm_dbg_kms(&i915->drm, "Alpha value cannot be changed in async flip\n");
> + return -EINVAL;
> + }
> +
> + if (old_plane_state->hw.pixel_blend_mode !=
> + new_plane_state->hw.pixel_blend_mode) {
> + drm_dbg_kms(&i915->drm,
> + "Pixel blend mode cannot be changed in async flip\n");
> + return -EINVAL;
> + }
> +
> + if (old_plane_state->hw.color_encoding != new_plane_state->hw.color_encoding) {
> + drm_dbg_kms(&i915->drm,
> + "Color encoding cannot be changed in async flip\n");
> + return -EINVAL;
> + }
> +
> + if (old_plane_state->hw.color_range != new_plane_state->hw.color_range) {
> + drm_dbg_kms(&i915->drm, "Color range cannot be changed in async flip\n");
> + return -EINVAL;
> + }
> + }
> +
> + return 0;
> +}
> +
> /**
> * intel_atomic_check - validate state object
> * @dev: drm device
> @@ -15045,6 +15176,12 @@ static int intel_atomic_check(struct drm_device *dev,
>
> for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
> new_crtc_state, i) {
> + if (new_crtc_state->uapi.async_flip) {
> + ret = intel_atomic_check_async(state);
> + if (ret)
> + goto fail;
> + }
> +
> if (!needs_modeset(new_crtc_state) &&
> !new_crtc_state->update_pipe)
> continue;
> --
> 2.22.0
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2020-09-18 11:51 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-16 15:08 [Intel-gfx] [PATCH v9 0/8] Asynchronous flip implementation for i915 Karthik B S
2020-09-16 15:08 ` [Intel-gfx] [PATCH v9 1/8] drm/i915: Add enable/disable flip done and flip done handler Karthik B S
2020-09-16 15:08 ` [Intel-gfx] [PATCH v9 2/8] drm/i915: Add support for async flips in I915 Karthik B S
2020-09-16 15:08 ` [Intel-gfx] [PATCH v9 3/8] drm/i915: Add checks specific to async flips Karthik B S
2020-09-18 9:02 ` [Intel-gfx] [PATCH v10 " Karthik B S
2020-09-18 11:51 ` Ville Syrjälä [this message]
2020-09-21 10:49 ` Karthik B S
2020-09-16 15:08 ` [Intel-gfx] [PATCH v9 4/8] drm/i915: Do not call drm_crtc_arm_vblank_event in " Karthik B S
2020-09-16 15:08 ` [Intel-gfx] [PATCH v9 5/8] drm/i915: Add dedicated plane hook for async flip case Karthik B S
2020-09-18 7:00 ` [Intel-gfx] [PATCH v10 " Karthik B S
2020-09-18 11:53 ` Ville Syrjälä
2020-09-21 10:52 ` Karthik B S
2020-09-16 15:08 ` [Intel-gfx] [PATCH v9 6/8] drm/i915: WA for platforms with double buffered address update enable bit Karthik B S
2020-09-18 11:54 ` Ville Syrjälä
2020-09-21 10:53 ` Karthik B S
2020-09-16 15:08 ` [Intel-gfx] [PATCH v9 7/8] Documentation/gpu: Add asynchronous flip documentation for i915 Karthik B S
2020-09-18 11:58 ` Ville Syrjälä
2020-09-21 10:55 ` Karthik B S
2020-09-16 15:08 ` [Intel-gfx] [PATCH v9 8/8] drm/i915: Enable async flips in i915 Karthik B S
2020-09-18 12:03 ` Ville Syrjälä
2020-09-21 10:59 ` Karthik B S
2020-09-16 15:46 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Asynchronous flip implementation for i915 (rev9) Patchwork
2020-09-16 15:48 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2020-09-16 16:11 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-09-16 21:27 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2020-09-18 7:55 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Asynchronous flip implementation for i915 (rev10) Patchwork
2020-09-18 7:56 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2020-09-18 8:20 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-09-18 9:26 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2020-09-18 9:58 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for Asynchronous flip implementation for i915 (rev11) Patchwork
2020-09-18 10:22 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-09-18 12:17 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " 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=20200918115132.GI6112@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=karthik.b.s@intel.com \
--cc=michel@daenzer.net \
--cc=nicholas.kazlauskas@amd.com \
--cc=paulo.r.zanoni@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