0903551
From eacd0ecb98a93e3ff83a4479eadeb9cda05d3579 Mon Sep 17 00:00:00 2001
0903551
From: Fedora Kernel Team <kernel-team@fedoraproject.org>
0903551
Date: Mon, 20 Jun 2016 12:41:01 +0200
0903551
Subject: [PATCH 11/17] drm/i915/gen9: Calculate plane WM's from state
0903551
0903551
Upstream: since drm-intel-next-2016-05-22
0903551
commit 33815fa55b31a5de4b197c09926ecab3dfb79732
0903551
0903551
Author:     Matt Roper <matthew.d.roper@intel.com>
0903551
AuthorDate: Thu May 12 07:06:05 2016 -0700
0903551
Commit:     Matt Roper <matthew.d.roper@intel.com>
0903551
CommitDate: Fri May 13 07:34:12 2016 -0700
0903551
0903551
    drm/i915/gen9: Calculate plane WM's from state
0903551
0903551
    In a future patch we'll want to calculate plane watermarks for in-flight
0903551
    atomic state rather than the already-committed state.
0903551
0903551
    Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
0903551
    Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
0903551
    Link: http://patchwork.freedesktop.org/patch/msgid/1463061971-19638-12-git-send-email-matthew.d.roper@intel.com
0903551
---
0903551
 drivers/gpu/drm/i915/intel_pm.c | 16 ++++++++--------
0903551
 1 file changed, 8 insertions(+), 8 deletions(-)
0903551
0903551
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
0903551
index 80f9f18..3164f30 100644
0903551
--- a/drivers/gpu/drm/i915/intel_pm.c
0903551
+++ b/drivers/gpu/drm/i915/intel_pm.c
0903551
@@ -3179,16 +3179,14 @@ static bool skl_ddb_allocation_changed(const struct skl_ddb_allocation *new_ddb,
0903551
 
0903551
 static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
0903551
 				 struct intel_crtc_state *cstate,
0903551
-				 struct intel_plane *intel_plane,
0903551
+				 struct intel_plane_state *intel_pstate,
0903551
 				 uint16_t ddb_allocation,
0903551
 				 int level,
0903551
 				 uint16_t *out_blocks, /* out */
0903551
 				 uint8_t *out_lines /* out */)
0903551
 {
0903551
-	struct drm_plane *plane = &intel_plane->base;
0903551
-	struct drm_framebuffer *fb = plane->state->fb;
0903551
-	struct intel_plane_state *intel_pstate =
0903551
-					to_intel_plane_state(plane->state);
0903551
+	struct drm_plane_state *pstate = &intel_pstate->base;
0903551
+	struct drm_framebuffer *fb = pstate->fb;
0903551
 	uint32_t latency = dev_priv->wm.skl_latency[level];
0903551
 	uint32_t method1, method2;
0903551
 	uint32_t plane_bytes_per_line, plane_blocks_per_line;
0903551
@@ -3203,7 +3201,7 @@ static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
0903551
 	width = drm_rect_width(&intel_pstate->src) >> 16;
0903551
 	height = drm_rect_height(&intel_pstate->src) >> 16;
0903551
 
0903551
-	if (intel_rotation_90_or_270(plane->state->rotation))
0903551
+	if (intel_rotation_90_or_270(pstate->rotation))
0903551
 		swap(width, height);
0903551
 
0903551
 	cpp = drm_format_plane_cpp(fb->pixel_format, 0);
0903551
@@ -3223,7 +3221,7 @@ static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
0903551
 	    fb->modifier[0] == I915_FORMAT_MOD_Yf_TILED) {
0903551
 		uint32_t min_scanlines = 4;
0903551
 		uint32_t y_tile_minimum;
0903551
-		if (intel_rotation_90_or_270(plane->state->rotation)) {
0903551
+		if (intel_rotation_90_or_270(pstate->rotation)) {
0903551
 			int cpp = (fb->pixel_format == DRM_FORMAT_NV12) ?
0903551
 				drm_format_plane_cpp(fb->pixel_format, 1) :
0903551
 				drm_format_plane_cpp(fb->pixel_format, 0);
0903551
@@ -3277,17 +3275,19 @@ static void skl_compute_wm_level(const struct drm_i915_private *dev_priv,
0903551
 	struct drm_device *dev = dev_priv->dev;
0903551
 	struct intel_crtc *intel_crtc = to_intel_crtc(cstate->base.crtc);
0903551
 	struct intel_plane *intel_plane;
0903551
+	struct intel_plane_state *intel_pstate;
0903551
 	uint16_t ddb_blocks;
0903551
 	enum pipe pipe = intel_crtc->pipe;
0903551
 
0903551
 	for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) {
0903551
 		int i = skl_wm_plane_id(intel_plane);
0903551
 
0903551
+		intel_pstate = to_intel_plane_state(intel_plane->base.state);
0903551
 		ddb_blocks = skl_ddb_entry_size(&ddb->plane[pipe][i]);
0903551
 
0903551
 		result->plane_en[i] = skl_compute_plane_wm(dev_priv,
0903551
 						cstate,
0903551
-						intel_plane,
0903551
+						intel_pstate,
0903551
 						ddb_blocks,
0903551
 						level,
0903551
 						&result->plane_res_b[i],
0903551
-- 
0903551
2.7.4
0903551