diff options
author | Ben Widawsky <benjamin.widawsky@intel.com> | 2014-06-19 12:06:11 -0700 |
---|---|---|
committer | Jani Nikula <jani.nikula@intel.com> | 2014-07-03 11:27:43 +0300 |
commit | edc0fdbbf6d8e179a0b28b9fc7597cbadabe77a8 (patch) | |
tree | 8969b45f24e18f3542e9e6338cebdca6d75fe2cf /drivers/gpu/drm/i915/i915_gem_stolen.c | |
parent | c4213885cd01c6ec15f44b4d06d67790601e1731 (diff) | |
download | op-kernel-dev-edc0fdbbf6d8e179a0b28b9fc7597cbadabe77a8.zip op-kernel-dev-edc0fdbbf6d8e179a0b28b9fc7597cbadabe77a8.tar.gz |
drm/i915: Extract CFB threshold calculation
Right now, there is no threshold (0 means fail, 1 means 1:1 compression
limit). This is to split the function/non-functional change of the next
patch.
The next patch will start to attempt to reduce the amount of CFB space
we need for dire situations. It will be contained within this function.
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem_stolen.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_stolen.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c index 642fd36..a86b331 100644 --- a/drivers/gpu/drm/i915/i915_gem_stolen.c +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c @@ -103,22 +103,36 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev) return base; } -static int i915_setup_compression(struct drm_device *dev, int size) +static int find_compression_threshold(struct drm_device *dev, + struct drm_mm_node *node, + int size) { struct drm_i915_private *dev_priv = dev->dev_private; - struct drm_mm_node *uninitialized_var(compressed_llb); + const int compression_threshold = 1; int ret; /* Try to over-allocate to reduce reallocations and fragmentation */ - ret = drm_mm_insert_node(&dev_priv->mm.stolen, - &dev_priv->fbc.compressed_fb, + ret = drm_mm_insert_node(&dev_priv->mm.stolen, node, size <<= 1, 4096, DRM_MM_SEARCH_DEFAULT); if (ret) - ret = drm_mm_insert_node(&dev_priv->mm.stolen, - &dev_priv->fbc.compressed_fb, + ret = drm_mm_insert_node(&dev_priv->mm.stolen, node, size >>= 1, 4096, DRM_MM_SEARCH_DEFAULT); if (ret) + return 0; + else + return compression_threshold; +} + +static int i915_setup_compression(struct drm_device *dev, int size) +{ + struct drm_i915_private *dev_priv = dev->dev_private; + struct drm_mm_node *uninitialized_var(compressed_llb); + int ret; + + ret = find_compression_threshold(dev, &dev_priv->fbc.compressed_fb, + size); + if (!ret) goto err_llb; if (HAS_PCH_SPLIT(dev)) |