Commit 60ee5cd2 authored by Jani Nikula's avatar Jani Nikula Committed by Daniel Vetter

drm/i915/fbc: fix the check for already reserved fbc size

The check for previously reserved stolen space size for FBC in
i915_gem_stolen_setup_compression() did not take the compression
threshold into account. Fix this by storing and comparing to
uncompressed size instead.

The bug has been introduced in

commit 5e59f717
Author: Ben Widawsky <benjamin.widawsky@intel.com>
Date:   Mon Jun 30 10:41:24 2014 -0700

    drm/i915: Try harder to get FBC

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88975Suggested-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Ben Widawsky <benjamin.widawsky@intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 719388e1
...@@ -772,7 +772,7 @@ struct intel_context { ...@@ -772,7 +772,7 @@ struct intel_context {
}; };
struct i915_fbc { struct i915_fbc {
unsigned long size; unsigned long uncompressed_size;
unsigned threshold; unsigned threshold;
unsigned int fb_id; unsigned int fb_id;
enum plane plane; enum plane plane;
......
...@@ -231,7 +231,7 @@ static int i915_setup_compression(struct drm_device *dev, int size, int fb_cpp) ...@@ -231,7 +231,7 @@ static int i915_setup_compression(struct drm_device *dev, int size, int fb_cpp)
dev_priv->mm.stolen_base + compressed_llb->start); dev_priv->mm.stolen_base + compressed_llb->start);
} }
dev_priv->fbc.size = size / dev_priv->fbc.threshold; dev_priv->fbc.uncompressed_size = size;
DRM_DEBUG_KMS("reserved %d bytes of contiguous stolen space for FBC\n", DRM_DEBUG_KMS("reserved %d bytes of contiguous stolen space for FBC\n",
size); size);
...@@ -253,7 +253,7 @@ int i915_gem_stolen_setup_compression(struct drm_device *dev, int size, int fb_c ...@@ -253,7 +253,7 @@ int i915_gem_stolen_setup_compression(struct drm_device *dev, int size, int fb_c
if (!drm_mm_initialized(&dev_priv->mm.stolen)) if (!drm_mm_initialized(&dev_priv->mm.stolen))
return -ENODEV; return -ENODEV;
if (size < dev_priv->fbc.size) if (size < dev_priv->fbc.uncompressed_size)
return 0; return 0;
/* Release any current block */ /* Release any current block */
...@@ -266,7 +266,7 @@ void i915_gem_stolen_cleanup_compression(struct drm_device *dev) ...@@ -266,7 +266,7 @@ void i915_gem_stolen_cleanup_compression(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
if (dev_priv->fbc.size == 0) if (dev_priv->fbc.uncompressed_size == 0)
return; return;
drm_mm_remove_node(&dev_priv->fbc.compressed_fb); drm_mm_remove_node(&dev_priv->fbc.compressed_fb);
...@@ -276,7 +276,7 @@ void i915_gem_stolen_cleanup_compression(struct drm_device *dev) ...@@ -276,7 +276,7 @@ void i915_gem_stolen_cleanup_compression(struct drm_device *dev)
kfree(dev_priv->fbc.compressed_llb); kfree(dev_priv->fbc.compressed_llb);
} }
dev_priv->fbc.size = 0; dev_priv->fbc.uncompressed_size = 0;
} }
void i915_gem_cleanup_stolen(struct drm_device *dev) void i915_gem_cleanup_stolen(struct drm_device *dev)
......
...@@ -78,7 +78,8 @@ static void i8xx_fbc_enable(struct drm_crtc *crtc) ...@@ -78,7 +78,8 @@ static void i8xx_fbc_enable(struct drm_crtc *crtc)
dev_priv->fbc.enabled = true; dev_priv->fbc.enabled = true;
cfb_pitch = dev_priv->fbc.size / FBC_LL_SIZE; /* Note: fbc.threshold == 1 for i8xx */
cfb_pitch = dev_priv->fbc.uncompressed_size / FBC_LL_SIZE;
if (fb->pitches[0] < cfb_pitch) if (fb->pitches[0] < cfb_pitch)
cfb_pitch = fb->pitches[0]; cfb_pitch = fb->pitches[0];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment