public inbox for intel-gfx@lists.freedesktop.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 5/8] drm/i915: simplify FBC start/stop at invalidate/flush
Date: Tue, 30 Jun 2015 10:53:09 -0300	[thread overview]
Message-ID: <1435672392-7329-6-git-send-email-przanoni@gmail.com> (raw)
In-Reply-To: <1435672392-7329-1-git-send-email-przanoni@gmail.com>

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

The problem with calling intel_fbc_update() at flush is that it fully
rechecks and recomputes the FBC state, and that includes reallocating
the CFB, which requires a struct_mutex lock that we don't always have.

The lack of struct_mutex lock can be considered a regression from:

commit dbef0f15b5c83231dacb214dbf9a6dba063ca21c
Author: Paulo Zanoni <paulo.r.zanoni@intel.com>
Date:   Fri Feb 13 17:23:46 2015 -0200
    drm/i915: add frontbuffer tracking to FBC

So introduce intel_fbc_stop() that doesn't unset fbc.crtc, then call
stop/enable at invalidate/flush.

Notice that invalidate/flush is only called by the frontbuffer
tracking infrastrucutre, so it's safe to not do a full
intel_fbc_update() here.

Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 drivers/gpu/drm/i915/intel_fbc.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c
index 316feb1..0a66814 100644
--- a/drivers/gpu/drm/i915/intel_fbc.c
+++ b/drivers/gpu/drm/i915/intel_fbc.c
@@ -422,7 +422,7 @@ static void intel_fbc_enable(struct drm_crtc *crtc)
 	schedule_delayed_work(&work->work, msecs_to_jiffies(50));
 }
 
-static void __intel_fbc_disable(struct drm_device *dev)
+static void intel_fbc_stop(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
@@ -434,6 +434,13 @@ static void __intel_fbc_disable(struct drm_device *dev)
 		return;
 
 	dev_priv->display.disable_fbc(dev);
+}
+
+static void __intel_fbc_disable(struct drm_device *dev)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+
+	intel_fbc_stop(dev);
 	dev_priv->fbc.crtc = NULL;
 }
 
@@ -753,7 +760,7 @@ void intel_fbc_invalidate(struct drm_i915_private *dev_priv,
 	dev_priv->fbc.busy_bits |= (fbc_bits & frontbuffer_bits);
 
 	if (dev_priv->fbc.busy_bits)
-		__intel_fbc_disable(dev);
+		intel_fbc_stop(dev);
 
 	mutex_unlock(&dev_priv->fbc.lock);
 }
@@ -770,8 +777,11 @@ void intel_fbc_flush(struct drm_i915_private *dev_priv,
 
 	dev_priv->fbc.busy_bits &= ~frontbuffer_bits;
 
-	if (!dev_priv->fbc.busy_bits)
-		__intel_fbc_update(dev);
+	if (!dev_priv->fbc.busy_bits && dev_priv->fbc.crtc) {
+		if (dev_priv->fbc.enabled)
+			intel_fbc_stop(dev);
+		intel_fbc_enable(&dev_priv->fbc.crtc->base);
+	}
 
 out:
 	mutex_unlock(&dev_priv->fbc.lock);
-- 
2.1.4

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

  parent reply	other threads:[~2015-06-30 13:54 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30 13:53 [PATCH 0/8] FBC locking v3 Paulo Zanoni
2015-06-30 13:53 ` [PATCH 1/8] drm/i915: don't increment the FBC threshold at fbc_enable Paulo Zanoni
2015-06-30 14:22   ` Chris Wilson
2015-07-01 13:52     ` Daniel Vetter
2015-06-30 13:53 ` [PATCH 2/8] drm/i915: add the FBC mutex Paulo Zanoni
2015-06-30 14:10   ` Chris Wilson
2015-06-30 14:12   ` Chris Wilson
2015-06-30 14:25   ` Chris Wilson
2015-06-30 14:34     ` Paulo Zanoni
2015-06-30 13:53 ` [PATCH 3/8] drm/i915: remove unneded locks on debugs FBC functions Paulo Zanoni
2015-06-30 13:53 ` [PATCH 4/8] drm/i915: remove struct_mutex lock from the FBC work function Paulo Zanoni
2015-06-30 13:53 ` Paulo Zanoni [this message]
2015-06-30 14:34   ` [PATCH 5/8] drm/i915: simplify FBC start/stop at invalidate/flush Chris Wilson
2015-06-30 21:12     ` Paulo Zanoni
2015-07-01 14:04       ` Chris Wilson
2015-06-30 13:53 ` [PATCH 6/8] drm/i915: add struct_mutex WARNs to i915_gem_stolen.c Paulo Zanoni
2015-06-30 14:15   ` Chris Wilson
2015-06-30 14:26     ` Paulo Zanoni
2015-06-30 14:36       ` Chris Wilson
2015-06-30 20:30         ` Jesse Barnes
2015-06-30 21:00           ` Chris Wilson
2015-07-01 13:56           ` Daniel Vetter
2015-07-01 15:17             ` Jesse Barnes
2015-07-01 15:43               ` Daniel Vetter
2015-06-30 14:34   ` Chris Wilson
2015-07-01 14:00     ` Daniel Vetter
2015-07-01 14:02       ` Chris Wilson
2015-07-01 14:03         ` Paulo Zanoni
2015-06-30 13:53 ` [PATCH 7/8] drm/i915: reduce struct_mutex coverage at intel_crtc_page_flip() Paulo Zanoni
2015-06-30 13:53 ` [PATCH 8/8] drm/i915: remove struct_mutex lock from intel_modeset_cleanup() 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=1435672392-7329-6-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