[Intel-gfx] [PATCH] drm/i915/bdw: Don't allow the FBC base to be 0

Ben Widawsky benjamin.widawsky at intel.com
Fri May 2 03:47:54 CEST 2014


"Restriction :
The offset must be greater than 4K bytes, avoiding the first 4KB of
stolen memory."

Since it looks like we currently allocate an overlay out of stolen
before we get the compressed framebuffer, I believe this is not
currently an issue which fixes anything. We simply want to make the code
as future-proof, and as clear as possible, by match the spec.

Cc: Art Runyan <arthur.j.runyan at intel.com>
Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index 62ef55b..65016b0 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -107,19 +107,24 @@ static int i915_setup_compression(struct drm_device *dev, int size)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct drm_mm_node *compressed_fb, *uninitialized_var(compressed_llb);
+	unsigned long start = 0;
 	int ret;
 
 	compressed_fb = kzalloc(sizeof(*compressed_fb), GFP_KERNEL);
 	if (!compressed_fb)
 		goto err_llb;
 
+	if (IS_BROADWELL(dev))
+		start = 0x1000;
+
 	/* Try to over-allocate to reduce reallocations and fragmentation */
-	ret = drm_mm_insert_node(&dev_priv->mm.stolen, compressed_fb,
-				 size <<= 1, 4096, DRM_MM_SEARCH_DEFAULT);
+	ret = drm_mm_insert_node_in_range(&dev_priv->mm.stolen, compressed_fb,
+					  size <<= 1, 4096, start, dev_priv->gtt.stolen_size,
+					  DRM_MM_SEARCH_DEFAULT);
 	if (ret)
-		ret = drm_mm_insert_node(&dev_priv->mm.stolen, compressed_fb,
-					 size >>= 1, 4096,
-					 DRM_MM_SEARCH_DEFAULT);
+		ret = drm_mm_insert_node_in_range(&dev_priv->mm.stolen, compressed_fb,
+						  size >>= 1, 4096, start, dev_priv->gtt.stolen_size,
+						  DRM_MM_SEARCH_DEFAULT);
 	if (ret)
 		goto err_llb;
 
-- 
1.9.2




More information about the Intel-gfx mailing list