From: Matt Roper <matthew.d.roper@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 2/4] drm/i915/skl+: calculate ddb minimum allocation (v4)
Date: Mon, 16 May 2016 15:51:59 -0700 [thread overview]
Message-ID: <1463439121-28974-3-git-send-email-matthew.d.roper@intel.com> (raw)
In-Reply-To: <1463439121-28974-1-git-send-email-matthew.d.roper@intel.com>
From: "Kumar, Mahesh" <mahesh1.kumar@intel.com>
don't always use 8 ddb as minimum, instead calculate using proper
algorithm.
v2: optimizations as per Matt's comments.
v3 (by Matt):
- Fix boolean logic for !fb test in skl_ddb_min_alloc()
- Adjust negative tiling format comparisons in skl_ddb_min_alloc() to
improve readability.
v4 (by Matt):
- Rebase onto recent atomic watermark changes
- Slight tweaks to code flow to make the logic more closely match the
description in the bspec.
Cc: matthew.d.roper@intel.com
Signed-off-by: Kumar, Mahesh <mahesh1.kumar@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
drivers/gpu/drm/i915/intel_pm.c | 62 +++++++++++++++++++++++++++++++++++++----
1 file changed, 57 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 95f9bb5..d7165b5 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3038,6 +3038,61 @@ skl_get_total_relative_data_rate(struct intel_crtc_state *intel_cstate)
return total_data_rate;
}
+static uint16_t
+skl_ddb_min_alloc(const struct drm_plane_state *pstate,
+ const int y)
+{
+ struct drm_framebuffer *fb = pstate->fb;
+ struct intel_plane_state *intel_pstate = to_intel_plane_state(pstate);
+ uint32_t src_w, src_h;
+ uint32_t min_scanlines = 8;
+ uint8_t plane_bpp;
+
+ if (WARN_ON(!fb))
+ return 0;
+
+ /* For packed formats, no y-plane, return 0 */
+ if (y && fb->pixel_format != DRM_FORMAT_NV12)
+ return 0;
+
+ /* For Non Y-tile return 8-blocks */
+ if (fb->modifier[0] != I915_FORMAT_MOD_Y_TILED &&
+ fb->modifier[0] != I915_FORMAT_MOD_Yf_TILED)
+ return 8;
+
+ src_w = drm_rect_width(&intel_pstate->src) >> 16;
+ src_h = drm_rect_height(&intel_pstate->src) >> 16;
+
+ if (intel_rotation_90_or_270(pstate->rotation))
+ swap(src_w, src_h);
+
+ /* Halve UV plane width and height for NV12 */
+ if (fb->pixel_format == DRM_FORMAT_NV12 && !y) {
+ src_w /= 2;
+ src_h /= 2;
+ }
+
+ plane_bpp = y ? drm_format_plane_cpp(fb->pixel_format, 0) :
+ drm_format_plane_cpp(fb->pixel_format, 1);
+
+ if (intel_rotation_90_or_270(pstate->rotation)) {
+ switch (plane_bpp) {
+ case 1:
+ min_scanlines = 32;
+ break;
+ case 2:
+ min_scanlines = 16;
+ break;
+ default:
+ WARN(1, "Unsupported pixel depth %u for rotation",
+ plane_bpp);
+ min_scanlines = 32;
+ }
+ }
+
+ return DIV_ROUND_UP((4 * src_w * plane_bpp), 512) * min_scanlines/4 + 3;
+}
+
static int
skl_allocate_pipe_ddb(struct intel_crtc_state *cstate,
struct skl_ddb_allocation *ddb /* out */)
@@ -3100,11 +3155,8 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate,
continue;
}
- minimum[id] = 8;
- if (pstate->fb->pixel_format == DRM_FORMAT_NV12)
- y_minimum[id] = 8;
- else
- y_minimum[id] = 0;
+ minimum[id] = skl_ddb_min_alloc(pstate, 0);
+ y_minimum[id] = skl_ddb_min_alloc(pstate, 1);
}
for (i = 0; i < PLANE_CURSOR; i++) {
--
2.1.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-05-16 22:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-16 22:51 [PATCH 0/4] SKL watermark algorithm updates Matt Roper
2016-05-16 22:51 ` [PATCH 1/4] drm/i915: Don't try to calculate relative data rates during hw readout Matt Roper
2016-05-16 22:51 ` Matt Roper [this message]
2016-05-26 22:13 ` [PATCH 2/4] drm/i915/skl+: calculate ddb minimum allocation (v5) Matt Roper
2016-05-30 5:05 ` Mahesh Kumar
2016-05-31 16:58 ` [PATCH 2/4] drm/i915/skl+: calculate ddb minimum allocation (v6) Matt Roper
2016-06-01 14:25 ` Mahesh Kumar
2016-06-01 14:40 ` Matt Roper
2016-05-16 22:52 ` [PATCH 3/4] drm/i915/skl+: calculate plane pixel rate (v4) Matt Roper
2016-05-30 5:28 ` Mahesh Kumar
2016-05-16 22:52 ` [PATCH 4/4] drm/i915/skl+: Use scaling amount for plane data rate calculation (v3) Matt Roper
2016-05-19 22:03 ` [PATCH 4/4] drm/i915/skl+: Use scaling amount for plane data rate calculation (v4) Matt Roper
2016-05-30 5:33 ` Mahesh Kumar
2016-05-17 5:51 ` ✗ Ro.CI.BAT: warning for SKL watermark algorithm updates Patchwork
2016-05-20 8:52 ` ✗ Ro.CI.BAT: warning for SKL watermark algorithm updates (rev2) Patchwork
2016-05-27 6:09 ` ✗ Ro.CI.BAT: warning for SKL watermark algorithm updates (rev3) Patchwork
2016-05-31 17:34 ` ✗ Ro.CI.BAT: warning for SKL watermark algorithm updates (rev4) Patchwork
2016-05-31 18:20 ` Matt Roper
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=1463439121-28974-3-git-send-email-matthew.d.roper@intel.com \
--to=matthew.d.roper@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox