From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Cc: jani.nikula@intel.com, intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v23 05/13] drm/i915: Prepare to extract gen specific functions from intel_can_enable_sagv
Date: Tue, 14 Apr 2020 20:16:41 +0300 [thread overview]
Message-ID: <20200414171641.GD6112@intel.com> (raw)
In-Reply-To: <20200410122432.9001-1-stanislav.lisovskiy@intel.com>
On Fri, Apr 10, 2020 at 03:24:32PM +0300, Stanislav Lisovskiy wrote:
> Addressing one of the comments, recommending to extract platform
> specific code from intel_can_enable_sagv as a preparation, before
> we are going to add support for tgl+.
>
> v2: - Removed whitespace
>
> Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
> ---
> drivers/gpu/drm/i915/intel_pm.c | 66 ++++++++++++++++++---------------
> 1 file changed, 37 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 15ad6a73e0bd..a90cd235954d 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -3757,42 +3757,25 @@ intel_disable_sagv(struct drm_i915_private *dev_priv)
> return 0;
> }
>
> -bool intel_can_enable_sagv(struct intel_atomic_state *state)
> +static bool intel_crtc_can_enable_sagv(const struct intel_crtc_state *crtc_state)
> {
> - struct drm_device *dev = state->base.dev;
> - struct drm_i915_private *dev_priv = to_i915(dev);
> - struct intel_crtc *crtc;
> + struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
> + struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
> struct intel_plane *plane;
> - struct intel_crtc_state *crtc_state;
> - enum pipe pipe;
> + const struct intel_plane_state *plane_state;
> int level, latency;
>
> - if (!intel_has_sagv(dev_priv))
> - return false;
> -
> - /*
> - * If there are no active CRTCs, no additional checks need be performed
> - */
> - if (hweight8(state->active_pipes) == 0)
> + if (!crtc_state->hw.active)
> return true;
>
> - /*
> - * SKL+ workaround: bspec recommends we disable SAGV when we have
> - * more then one pipe enabled
> - */
> - if (hweight8(state->active_pipes) > 1)
> - return false;
> -
> - /* Since we're now guaranteed to only have one active CRTC... */
> - pipe = ffs(state->active_pipes) - 1;
> - crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
> - crtc_state = to_intel_crtc_state(crtc->base.state);
> -
> - if (crtc_state->hw.adjusted_mode.flags & DRM_MODE_FLAG_INTERLACE)
> + if (crtc_state->hw.adjusted_mode.flags & DRM_MODE_FLAG_INTERLACE) {
> + DRM_DEBUG_KMS("No SAGV for interlaced mode on pipe %c\n",
> + pipe_name(crtc->pipe));
Why are we adding new debugs in this patch? Please stick to pure
refactoring.
> return false;
> + }
>
> - for_each_intel_plane_on_crtc(dev, crtc, plane) {
> - struct skl_plane_wm *wm =
> + intel_atomic_crtc_state_for_each_plane_state(plane, plane_state, crtc_state) {
Too early for this change. Again, pure refactoring please.
> + const struct skl_plane_wm *wm =
> &crtc_state->wm.skl.optimal.planes[plane->id];
>
> /* Skip this plane if it's not enabled */
> @@ -3807,7 +3790,7 @@ bool intel_can_enable_sagv(struct intel_atomic_state *state)
> latency = dev_priv->wm.skl_latency[level];
>
> if (skl_needs_memory_bw_wa(dev_priv) &&
> - plane->base.state->fb->modifier ==
> + plane_state->uapi.fb->modifier ==
> I915_FORMAT_MOD_X_TILED)
> latency += 15;
>
> @@ -3823,6 +3806,31 @@ bool intel_can_enable_sagv(struct intel_atomic_state *state)
> return true;
> }
>
> +bool intel_can_enable_sagv(struct intel_atomic_state *state)
> +{
> + struct drm_i915_private *dev_priv = to_i915(state->base.dev);
> + struct intel_crtc *crtc;
> + const struct intel_crtc_state *crtc_state;
> + enum pipe pipe;
> +
> + if (!intel_has_sagv(dev_priv))
> + return false;
> +
> + /*
> + * SKL+ workaround: bspec recommends we disable SAGV when we have
> + * more then one pipe enabled
> + */
> + if (hweight8(state->active_pipes) > 1)
> + return false;
> +
Lost the active_pipes==0 check here, which means pipe=-1 below.
> + /* Since we're now guaranteed to only have one active CRTC... */
> + pipe = ffs(state->active_pipes) - 1;
> + crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
> + crtc_state = to_intel_crtc_state(crtc->base.state);
> +
> + return intel_crtc_can_enable_sagv(crtc_state);
> +}
> +
> /*
> * Calculate initial DBuf slice offset, based on slice size
> * and mask(i.e if slice size is 1024 and second slice is enabled
> --
> 2.24.1.485.gad05a3d8e5
--
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-04-14 17:16 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-09 15:47 [Intel-gfx] [PATCH v22 00/13] SAGV support for Gen12+ Stanislav Lisovskiy
2020-04-09 15:47 ` [Intel-gfx] [PATCH v22 01/13] drm/i915: Start passing latency as parameter Stanislav Lisovskiy
2020-04-14 17:47 ` Ville Syrjälä
2020-04-09 15:47 ` [Intel-gfx] [PATCH v22 02/13] drm/i915: Eliminate magic numbers "0" and "1" from color plane Stanislav Lisovskiy
2020-04-14 17:36 ` Ville Syrjälä
2020-04-15 8:19 ` Lisovskiy, Stanislav
2020-04-09 15:47 ` [Intel-gfx] [PATCH v22 03/13] drm/i915: Introduce skl_plane_wm_level accessor Stanislav Lisovskiy
2020-04-09 15:47 ` [Intel-gfx] [PATCH v22 04/13] drm/i915: Add intel_atomic_get_bw_*_state helpers Stanislav Lisovskiy
2020-04-14 17:40 ` Ville Syrjälä
2020-04-15 8:14 ` Lisovskiy, Stanislav
2020-04-09 15:47 ` [Intel-gfx] [PATCH v22 05/13] drm/i915: Prepare to extract gen specific functions from intel_can_enable_sagv Stanislav Lisovskiy
2020-04-10 12:24 ` [Intel-gfx] [PATCH v23 " Stanislav Lisovskiy
2020-04-14 17:16 ` Ville Syrjälä [this message]
2020-04-09 15:47 ` [Intel-gfx] [PATCH v22 06/13] drm/i915: Add pre/post plane updates for SAGV Stanislav Lisovskiy
2020-04-14 17:42 ` Ville Syrjälä
2020-04-15 8:04 ` Lisovskiy, Stanislav
2020-04-09 15:47 ` [Intel-gfx] [PATCH v22 07/13] drm/i915: Use bw state for per crtc SAGV evaluation Stanislav Lisovskiy
2020-04-10 12:26 ` [Intel-gfx] [PATCH v23 " Stanislav Lisovskiy
2020-04-09 15:47 ` [Intel-gfx] [PATCH v22 08/13] drm/i915: Separate icl and skl SAGV checking Stanislav Lisovskiy
2020-04-10 12:28 ` [Intel-gfx] [PATCH v23 " Stanislav Lisovskiy
2020-04-09 15:47 ` [Intel-gfx] [PATCH v22 09/13] drm/i915: Add TGL+ SAGV support Stanislav Lisovskiy
2020-04-10 12:30 ` [Intel-gfx] [PATCH v23 " Stanislav Lisovskiy
2020-04-09 15:47 ` [Intel-gfx] [PATCH v22 10/13] drm/i915: Added required new PCode commands Stanislav Lisovskiy
2020-04-09 15:47 ` [Intel-gfx] [PATCH v22 11/13] drm/i915: Rename bw_state to new_bw_state Stanislav Lisovskiy
2020-04-09 15:47 ` [Intel-gfx] [PATCH v22 12/13] drm/i915: Restrict qgv points which don't have enough bandwidth Stanislav Lisovskiy
2020-04-09 15:47 ` [Intel-gfx] [PATCH v22 13/13] drm/i915: Enable SAGV support for Gen12 Stanislav Lisovskiy
2020-04-09 17:10 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for SAGV support for Gen12+ (rev14) Patchwork
2020-04-09 17:13 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2020-04-09 17:33 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-04-10 8:03 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2020-04-10 12:59 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for SAGV support for Gen12+ (rev18) Patchwork
2020-04-10 13:20 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2020-04-10 17:04 ` Lisovskiy, Stanislav
2020-04-11 7:26 ` Patchwork
2020-04-13 7:18 ` Lisovskiy, Stanislav
2020-04-13 8:18 ` Vudum, Lakshminarayana
2020-04-13 8:17 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-04-14 6:07 ` [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=20200414171641.GD6112@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
--cc=stanislav.lisovskiy@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.