Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <przanoni@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [PATCH 4/9] drm/i915: don't free the CFB while FBC is enabled
Date: Tue, 23 Dec 2014 10:35:40 -0200	[thread overview]
Message-ID: <1419338145-1912-5-git-send-email-przanoni@gmail.com> (raw)
In-Reply-To: <1419338145-1912-1-git-send-email-przanoni@gmail.com>

From: Paulo Zanoni <paulo.r.zanoni@intel.com>

Because that is probably not very a good idea: if we used the stolen
memory for more things, there could be a risk that someone would
"allocate" the memory that the HW is still using as the CFB while FBC
was still enabled.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_stolen.c |  3 +++
 drivers/gpu/drm/i915/intel_fbc.c       | 14 +++++++-------
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index d02c102..f84c5f3 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -198,6 +198,8 @@ static int i915_setup_compression(struct drm_device *dev, int size, int fb_cpp)
 	struct drm_mm_node *uninitialized_var(compressed_llb);
 	int ret;
 
+	WARN_ON(dev_priv->fbc.enabled);
+
 	ret = find_compression_threshold(dev, &dev_priv->fbc.compressed_fb,
 					 size, fb_cpp);
 	if (!ret)
@@ -268,6 +270,7 @@ void i915_gem_stolen_cleanup_compression(struct drm_device *dev)
 	if (dev_priv->fbc.compressed_fb.allocated == 0)
 		return;
 
+	WARN_ON(dev_priv->fbc.enabled);
 	drm_mm_remove_node(&dev_priv->fbc.compressed_fb);
 
 	if (dev_priv->fbc.compressed_llb) {
diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c
index 1b10b06..83d3c8a 100644
--- a/drivers/gpu/drm/i915/intel_fbc.c
+++ b/drivers/gpu/drm/i915/intel_fbc.c
@@ -593,13 +593,6 @@ void intel_fbc_update(struct drm_device *dev)
 	if (in_dbg_master())
 		goto out_disable;
 
-	if (i915_gem_stolen_setup_compression(dev, obj->base.size,
-					      drm_format_plane_cpp(fb->pixel_format, 0))) {
-		if (set_no_fbc_reason(dev_priv, FBC_STOLEN_TOO_SMALL))
-			DRM_DEBUG_KMS("framebuffer too large, disabling compression\n");
-		goto out_disable;
-	}
-
 	/* If the scanout has not changed, don't modify the FBC settings.
 	 * Note that we make the fundamental assumption that the fb->obj
 	 * cannot be unpinned (and have its GTT offset and fence revoked)
@@ -638,6 +631,13 @@ void intel_fbc_update(struct drm_device *dev)
 		intel_fbc_disable(dev);
 	}
 
+	if (i915_gem_stolen_setup_compression(dev, obj->base.size,
+					      drm_format_plane_cpp(fb->pixel_format, 0))) {
+		if (set_no_fbc_reason(dev_priv, FBC_STOLEN_TOO_SMALL))
+			DRM_DEBUG_KMS("framebuffer too large, disabling compression\n");
+		return;
+	}
+
 	intel_fbc_enable(crtc);
 	dev_priv->fbc.no_fbc_reason = FBC_OK;
 	return;
-- 
2.1.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2014-12-23 12:36 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-23 12:35 [PATCH 0/9] More simple FBC fixes Paulo Zanoni
2014-12-23 12:35 ` [PATCH 1/9] drm/i915: don't reallocate the compressed FB at every frame Paulo Zanoni
2014-12-23 12:35 ` [PATCH 2/9] drm/i915: fix the FBC CFB size tracking Paulo Zanoni
2014-12-25 10:16   ` Chris Wilson
2014-12-26 13:46     ` Paulo Zanoni
2014-12-26 13:53       ` Chris Wilson
2014-12-23 12:35 ` [PATCH 3/9] drm/i915: don't increment the FBC threshold at fbc_enable Paulo Zanoni
2014-12-23 12:35 ` Paulo Zanoni [this message]
2014-12-25 10:20   ` [PATCH 4/9] drm/i915: don't free the CFB while FBC is enabled Chris Wilson
2014-12-26 13:46     ` Paulo Zanoni
2014-12-26 13:55       ` Chris Wilson
2014-12-23 12:35 ` [PATCH 5/9] drm/i915: don't set the FBC plane select bits on HSW+ Paulo Zanoni
2015-01-05 15:40   ` Daniel Vetter
2014-12-23 12:35 ` [PATCH 6/9] drm/i915: add the FBC mutex Paulo Zanoni
2014-12-25 10:25   ` Chris Wilson
2014-12-26 13:46     ` Paulo Zanoni
2014-12-23 12:35 ` [PATCH 7/9] drm/i915: don't alloc/free fbc_work at every update Paulo Zanoni
2014-12-25 10:33   ` Chris Wilson
2014-12-26 13:49     ` Paulo Zanoni
2014-12-23 12:35 ` [PATCH 8/9] drm/i915: print FBC compression status on debugfs Paulo Zanoni
2014-12-23 12:35 ` [PATCH 9/9] drm/i915: FBC only supports 16bpp and 32bpp Paulo Zanoni

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=1419338145-1912-5-git-send-email-przanoni@gmail.com \
    --to=przanoni@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=paulo.r.zanoni@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox