All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Widawsky <benjamin.widawsky@intel.com>
To: Intel GFX <intel-gfx@lists.freedesktop.org>
Cc: Ben Widawsky <ben@bwidawsk.net>,
	Ben Widawsky <benjamin.widawsky@intel.com>
Subject: [PATCH 2/4] drm/i915: Extract CFB threshold calculation
Date: Thu, 19 Jun 2014 12:06:11 -0700	[thread overview]
Message-ID: <1403204773-7112-2-git-send-email-benjamin.widawsky@intel.com> (raw)
In-Reply-To: <1403204773-7112-1-git-send-email-benjamin.widawsky@intel.com>

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>
---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 26 ++++++++++++++++++++------
 1 file 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))
-- 
2.0.0

  reply	other threads:[~2014-06-19 19:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-19 19:06 [PATCH 1/4] drm/i915: Move compressed_fb to static allocation Ben Widawsky
2014-06-19 19:06 ` Ben Widawsky [this message]
2014-07-01  0:16   ` [PATCH 2/4] drm/i915: Extract CFB threshold calculation Rodrigo Vivi
2014-06-19 19:06 ` [PATCH 3/4] drm/i915: Try harder to get FBC Ben Widawsky
2014-06-20 15:56   ` Runyan, Arthur J
2014-06-20 16:55     ` Ben Widawsky
2014-06-30 17:41       ` [PATCH] " Rodrigo Vivi
2014-07-01 16:09         ` Rodrigo Vivi
2014-07-03 11:52           ` Jani Nikula
2014-06-19 19:06 ` [PATCH 4/4] drm/i915: Reserve space for FBC (fbcon) Ben Widawsky
2014-06-19 19:28   ` Chris Wilson
2014-06-19 19:41     ` Ben Widawsky
2014-07-01  3:34     ` Ben Widawsky
2014-07-01  0:15 ` [PATCH 1/4] drm/i915: Move compressed_fb to static allocation Rodrigo Vivi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1403204773-7112-2-git-send-email-benjamin.widawsky@intel.com \
    --to=benjamin.widawsky@intel.com \
    --cc=ben@bwidawsk.net \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.