7d2c2f2
From dede2d508785eda5affae9d3ac2e245e0d864144 Mon Sep 17 00:00:00 2001
7d2c2f2
From: Matt Roper <matthew.d.roper@intel.com>
7d2c2f2
Date: Thu, 12 May 2016 07:06:05 -0700
7d2c2f2
Subject: [PATCH 11/17] drm/i915/gen9: Calculate plane WM's from state
7d2c2f2
7d2c2f2
In a future patch we'll want to calculate plane watermarks for in-flight
7d2c2f2
atomic state rather than the already-committed state.
7d2c2f2
7d2c2f2
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
7d2c2f2
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
7d2c2f2
Link: http://patchwork.freedesktop.org/patch/msgid/1463061971-19638-12-git-send-email-matthew.d.roper@intel.com
7d2c2f2
---
7d2c2f2
 drivers/gpu/drm/i915/intel_pm.c | 16 ++++++++--------
7d2c2f2
 1 file changed, 8 insertions(+), 8 deletions(-)
7d2c2f2
7d2c2f2
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
7d2c2f2
index 0f0d4e1..518178a 100644
7d2c2f2
--- a/drivers/gpu/drm/i915/intel_pm.c
7d2c2f2
+++ b/drivers/gpu/drm/i915/intel_pm.c
7d2c2f2
@@ -3240,16 +3240,14 @@ static bool skl_ddb_allocation_changed(const struct skl_ddb_allocation *new_ddb,
7d2c2f2
 
7d2c2f2
 static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
7d2c2f2
 				 struct intel_crtc_state *cstate,
7d2c2f2
-				 struct intel_plane *intel_plane,
7d2c2f2
+				 struct intel_plane_state *intel_pstate,
7d2c2f2
 				 uint16_t ddb_allocation,
7d2c2f2
 				 int level,
7d2c2f2
 				 uint16_t *out_blocks, /* out */
7d2c2f2
 				 uint8_t *out_lines /* out */)
7d2c2f2
 {
7d2c2f2
-	struct drm_plane *plane = &intel_plane->base;
7d2c2f2
-	struct drm_framebuffer *fb = plane->state->fb;
7d2c2f2
-	struct intel_plane_state *intel_pstate =
7d2c2f2
-					to_intel_plane_state(plane->state);
7d2c2f2
+	struct drm_plane_state *pstate = &intel_pstate->base;
7d2c2f2
+	struct drm_framebuffer *fb = pstate->fb;
7d2c2f2
 	uint32_t latency = dev_priv->wm.skl_latency[level];
7d2c2f2
 	uint32_t method1, method2;
7d2c2f2
 	uint32_t plane_bytes_per_line, plane_blocks_per_line;
7d2c2f2
@@ -3264,7 +3262,7 @@ static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
7d2c2f2
 	width = drm_rect_width(&intel_pstate->src) >> 16;
7d2c2f2
 	height = drm_rect_height(&intel_pstate->src) >> 16;
7d2c2f2
 
7d2c2f2
-	if (intel_rotation_90_or_270(plane->state->rotation))
7d2c2f2
+	if (intel_rotation_90_or_270(pstate->rotation))
7d2c2f2
 		swap(width, height);
7d2c2f2
 
7d2c2f2
 	cpp = drm_format_plane_cpp(fb->pixel_format, 0);
7d2c2f2
@@ -3284,7 +3282,7 @@ static bool skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
7d2c2f2
 	    fb->modifier[0] == I915_FORMAT_MOD_Yf_TILED) {
7d2c2f2
 		uint32_t min_scanlines = 4;
7d2c2f2
 		uint32_t y_tile_minimum;
7d2c2f2
-		if (intel_rotation_90_or_270(plane->state->rotation)) {
7d2c2f2
+		if (intel_rotation_90_or_270(pstate->rotation)) {
7d2c2f2
 			int cpp = (fb->pixel_format == DRM_FORMAT_NV12) ?
7d2c2f2
 				drm_format_plane_cpp(fb->pixel_format, 1) :
7d2c2f2
 				drm_format_plane_cpp(fb->pixel_format, 0);
7d2c2f2
@@ -3338,17 +3336,19 @@ static void skl_compute_wm_level(const struct drm_i915_private *dev_priv,
7d2c2f2
 	struct drm_device *dev = dev_priv->dev;
7d2c2f2
 	struct intel_crtc *intel_crtc = to_intel_crtc(cstate->base.crtc);
7d2c2f2
 	struct intel_plane *intel_plane;
7d2c2f2
+	struct intel_plane_state *intel_pstate;
7d2c2f2
 	uint16_t ddb_blocks;
7d2c2f2
 	enum pipe pipe = intel_crtc->pipe;
7d2c2f2
 
7d2c2f2
 	for_each_intel_plane_on_crtc(dev, intel_crtc, intel_plane) {
7d2c2f2
 		int i = skl_wm_plane_id(intel_plane);
7d2c2f2
 
7d2c2f2
+		intel_pstate = to_intel_plane_state(intel_plane->base.state);
7d2c2f2
 		ddb_blocks = skl_ddb_entry_size(&ddb->plane[pipe][i]);
7d2c2f2
 
7d2c2f2
 		result->plane_en[i] = skl_compute_plane_wm(dev_priv,
7d2c2f2
 						cstate,
7d2c2f2
-						intel_plane,
7d2c2f2
+						intel_pstate,
7d2c2f2
 						ddb_blocks,
7d2c2f2
 						level,
7d2c2f2
 						&result->plane_res_b[i],
7d2c2f2
-- 
7d2c2f2
2.7.4
7d2c2f2