All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 4/9] drm/i915: Allocate enough DDB for the cursor
Date: Tue, 12 Mar 2019 22:58:39 +0200	[thread overview]
Message-ID: <20190312205844.6339-5-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20190312205844.6339-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Currently we just assume that 32 or 8 blocks of ddb is sufficient
for the cursor. The 32 might be, but the 8 is certainly not. The
minimum we need is at least what level 0 watermarks need, but that
is a bit restrictive, so instead let's calculate what level 7
would need for a 256x256 cursor. We'll use that to determine the
fixed ddb allocation for the cursor. This way the cursor will never
be responsible for missing out on deeper power saving states.

Cc: Neel Desai <neel.desai@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_pm.c | 33 ++++++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 9e7b4412f7a8..ae9a0ce4dcb9 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3924,12 +3924,35 @@ skl_ddb_get_pipe_allocation_limits(struct drm_i915_private *dev_priv,
 	alloc->end = ddb_size * (width_before_pipe + pipe_width) / total_width;
 }
 
-static unsigned int skl_cursor_allocation(int num_active)
+static int skl_compute_wm_params(const struct intel_crtc_state *crtc_state,
+				 int width, const struct drm_format_info *format,
+				 u64 modifier, unsigned int rotation,
+				 u32 plane_pixel_rate, struct skl_wm_params *wp,
+				 int color_plane);
+static void skl_compute_plane_wm(const struct intel_crtc_state *cstate,
+				 int level,
+				 const struct skl_wm_params *wp,
+				 const struct skl_wm_level *result_prev,
+				 struct skl_wm_level *result /* out */);
+
+static unsigned int
+skl_cursor_allocation(const struct intel_crtc_state *crtc_state,
+		      int num_active)
 {
-	if (num_active == 1)
-		return 32;
+	struct skl_wm_level wm = {};
+	struct skl_wm_params wp;
+	int ret;
+
+	ret = skl_compute_wm_params(crtc_state, 256,
+				    drm_format_info(DRM_FORMAT_ARGB8888),
+				    DRM_FORMAT_MOD_LINEAR,
+				    DRM_MODE_ROTATE_0,
+				    crtc_state->pixel_rate, &wp, 0);
+	WARN_ON(ret);
+
+	skl_compute_plane_wm(crtc_state, 7, &wp, &wm, &wm);
 
-	return 8;
+	return max_t(int, num_active == 1 ? 32 : 8, wm.min_ddb_alloc);
 }
 
 static void skl_ddb_entry_init_from_hw(struct drm_i915_private *dev_priv,
@@ -4354,7 +4377,7 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate,
 		return 0;
 
 	/* Allocate fixed number of blocks for cursor. */
-	total[PLANE_CURSOR] = skl_cursor_allocation(num_active);
+	total[PLANE_CURSOR] = skl_cursor_allocation(cstate, num_active);
 	alloc_size -= total[PLANE_CURSOR];
 	cstate->wm.skl.plane_ddb_y[PLANE_CURSOR].start =
 		alloc->end - total[PLANE_CURSOR];
-- 
2.19.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2019-03-12 20:59 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-12 20:58 [PATCH 0/9] skl+ cursor DDB allocation fixes Ville Syrjala
2019-03-12 20:58 ` [PATCH 1/9] drm/i915: Accept alloc_size == blocks Ville Syrjala
2019-03-12 20:58 ` [PATCH 2/9] drm/i915: Don't pass plane state to skl_compute_plane_wm() Ville Syrjala
2019-03-12 20:58 ` [PATCH 3/9] drm/i915: Extract skl_compute_wm_params() Ville Syrjala
2019-03-12 20:58 ` Ville Syrjala [this message]
2019-03-19 10:51   ` [PATCH 4/9] drm/i915: Allocate enough DDB for the cursor Ville Syrjälä
2019-03-19 16:03   ` [PATCH v2 " Ville Syrjala
2019-03-12 20:58 ` [PATCH 5/9] drm/i915: Make sure cursor has enough ddb for the selected wm level Ville Syrjala
2019-03-12 20:58 ` [PATCH 6/9] drm/i915: Keep plane watermarks enabled more aggressively Ville Syrjala
2019-03-19  0:09   ` Matt Roper
2019-03-12 20:58 ` [PATCH 7/9] drm/i915: Move some variables to tighter scope Ville Syrjala
2019-03-19  0:10   ` Matt Roper
2019-03-20 15:27     ` Ville Syrjälä
2019-03-12 20:58 ` [PATCH 8/9] drm/i915: Don't pass pipe_wm around so much Ville Syrjala
2019-03-19  0:10   ` Matt Roper
2019-03-12 20:58 ` [PATCH 9/9] drm/i915: Inline skl_build_pipe_wm() into its only caller Ville Syrjala
2019-03-19  0:11   ` Matt Roper
2019-03-19 10:49     ` Ville Syrjälä
2019-03-13 15:34 ` ✗ Fi.CI.SPARSE: warning for skl+ cursor DDB allocation fixes Patchwork
2019-03-13 16:15 ` ✓ Fi.CI.BAT: success " Patchwork
2019-03-13 20:41 ` ✗ Fi.CI.IGT: failure " Patchwork
2019-03-14 17:11   ` Ville Syrjälä
2019-03-19 16:41 ` ✗ Fi.CI.SPARSE: warning for skl+ cursor DDB allocation fixes (rev2) Patchwork
2019-03-19 17:14 ` ✓ Fi.CI.BAT: success " Patchwork
2019-03-20  2:41 ` ✓ 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=20190312205844.6339-5-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.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 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.