Skip to contentSkip to conversation

Patch "drm/i915/fbc: fix CFB size calculation for gen8+" has been added to the 4.8-stable tree

PATCH [email protected] 1 participant 1 message Nov 9, 2016

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

drm/i915/fbc: fix CFB size calculation for gen8+

to the 4.8-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
drm-i915-fbc-fix-cfb-size-calculation-for-gen8.patch
and it can be found in the queue-4.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From e3b9e6e3a989904ae062e7a48a9431edc837ea6b Mon Sep 17 00:00:00 2001

From: Paulo Zanoni <[email protected]>
Date: Fri, 21 Oct 2016 13:55:45 -0200
Subject: drm/i915/fbc: fix CFB size calculation for gen8+
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

From: Paulo Zanoni <[email protected]>

commit e3b9e6e3a989904ae062e7a48a9431edc837ea6b upstream.

Broadwell and newer actually compress up to 2560 lines instead of 2048 (as documented in the FBC_CTL page). If we don't take this into consideration we end up reserving too little stolen memory for the CFB, so we may allocate something else (such as a ring) right after what we reserved, and the hardware will overwrite it with the contents of the CFB when FBC is active, causing GPU hangs. Another possibility is that the CFB may be allocated at the very end of the available space, so the CFB will overlap the reserved stolen area, leading to FIFO underruns.

This bug has always been a problem on BDW (the only affected platform where FBC is enabled by default), but it's much easier to reproduce since the following commit:
commit c58b735fc762e891481e92af7124b85cb0a51fce
Author: Chris Wilson <[email protected]>
Date: Thu Aug 18 17:16:57 2016 +0100
drm/i915: Allocate rings from stolen

Of course, you can only reproduce the bug if your screen is taller than 2048 lines.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98213

Fixes a98ee79317b4 ("drm/i915/fbc: enable FBC by default on HSW and BDW")
(cherry picked from commit 79f2624b1b9f776b173b41d743fb3dd7374b3827)
---
 drivers/gpu/drm/i915/intel_fbc.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_fbc.c +3 -1
@@ -104,8 +104,10 @@ static int intel_fbc_calculate_cfb_size(
 	int lines;
 
 	intel_fbc_get_plane_source_size(cache, NULL, &lines);
-	if (INTEL_INFO(dev_priv)->gen >= 7)
+	if (INTEL_GEN(dev_priv) == 7)
 		lines = min(lines, 2048);
+	else if (INTEL_GEN(dev_priv) >= 8)
+		lines = min(lines, 2560);
 
 	/* Hardware needs the full buffer stride, not just the active area. */
 	return lines * cache->fb.stride;

Patches currently in stable-queue which might be from [email protected] are

queue-4.8/drm-i915-gen9-fix-ddb-partitioning-for-multi-screen-cases.patch queue-4.8/drm-i915-fbc-fix-cfb-size-calculation-for-gen8.patch queue-4.8/drm-i915-gen9-fix-watermarks-when-using-the-pipe-scaler.patch