Commit 20bf377e authored by Jesse Barnes's avatar Jesse Barnes Committed by Eric Anholt

drm/i915: cleanup FBC buffers at unload time

This keeps the memory manager from complaining when we take it down.
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: default avatarEric Anholt <eric@anholt.net>
parent c36a2a6d
...@@ -1357,6 +1357,8 @@ static void i915_setup_compression(struct drm_device *dev, int size) ...@@ -1357,6 +1357,8 @@ static void i915_setup_compression(struct drm_device *dev, int size)
dev_priv->cfb_size = size; dev_priv->cfb_size = size;
dev_priv->compressed_fb = compressed_fb;
if (IS_GM45(dev)) { if (IS_GM45(dev)) {
g4x_disable_fbc(dev); g4x_disable_fbc(dev);
I915_WRITE(DPFC_CB_BASE, compressed_fb->start); I915_WRITE(DPFC_CB_BASE, compressed_fb->start);
...@@ -1364,12 +1366,22 @@ static void i915_setup_compression(struct drm_device *dev, int size) ...@@ -1364,12 +1366,22 @@ static void i915_setup_compression(struct drm_device *dev, int size)
i8xx_disable_fbc(dev); i8xx_disable_fbc(dev);
I915_WRITE(FBC_CFB_BASE, cfb_base); I915_WRITE(FBC_CFB_BASE, cfb_base);
I915_WRITE(FBC_LL_BASE, ll_base); I915_WRITE(FBC_LL_BASE, ll_base);
dev_priv->compressed_llb = compressed_llb;
} }
DRM_DEBUG("FBC base 0x%08lx, ll base 0x%08lx, size %dM\n", cfb_base, DRM_DEBUG("FBC base 0x%08lx, ll base 0x%08lx, size %dM\n", cfb_base,
ll_base, size >> 20); ll_base, size >> 20);
} }
static void i915_cleanup_compression(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
drm_mm_put_block(dev_priv->compressed_fb);
if (!IS_GM45(dev))
drm_mm_put_block(dev_priv->compressed_llb);
}
/* true = enable decode, false = disable decoder */ /* true = enable decode, false = disable decoder */
static unsigned int i915_vga_set_decode(void *cookie, bool state) static unsigned int i915_vga_set_decode(void *cookie, bool state)
{ {
...@@ -1787,6 +1799,8 @@ int i915_driver_unload(struct drm_device *dev) ...@@ -1787,6 +1799,8 @@ int i915_driver_unload(struct drm_device *dev)
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
i915_gem_cleanup_ringbuffer(dev); i915_gem_cleanup_ringbuffer(dev);
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
if (I915_HAS_FBC(dev) && i915_powersave)
i915_cleanup_compression(dev);
drm_mm_takedown(&dev_priv->vram); drm_mm_takedown(&dev_priv->vram);
i915_gem_lastclose(dev); i915_gem_lastclose(dev);
......
...@@ -631,6 +631,9 @@ typedef struct drm_i915_private { ...@@ -631,6 +631,9 @@ typedef struct drm_i915_private {
u8 max_delay; u8 max_delay;
enum no_fbc_reason no_fbc_reason; enum no_fbc_reason no_fbc_reason;
struct drm_mm_node *compressed_fb;
struct drm_mm_node *compressed_llb;
} drm_i915_private_t; } drm_i915_private_t;
/** driver private structure attached to each drm_gem_object */ /** driver private structure attached to each drm_gem_object */
......
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