public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: ville.syrjala@linux.intel.com
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v4 8/9] drm/i915: Nuke FBC from SW_FINISH ioctl
Date: Wed,  4 Dec 2013 18:28:50 +0200	[thread overview]
Message-ID: <1386174530-31886-1-git-send-email-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <1385392748-28984-1-git-send-email-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

FBC host modification tracking only works through GTT mmaps, so any
direct CPU access needs to manually nuke the compressed framebuffer
on modifications. Do the nuking from the SW_FINISH ioctl.

v2: nuke from SW_FINISH insted of DIRTYFB ioctl
v3: Call intel_fbc_nuke() only when pin_display is true
v4: Don't oops if dev_priv->fbc.fb is NULL

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c  |  4 +++-
 drivers/gpu/drm/i915/intel_drv.h |  1 +
 drivers/gpu/drm/i915/intel_pm.c  | 33 +++++++++++++++++++++++++++++++++
 3 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 0ecc735..b5395aa 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1306,8 +1306,10 @@ i915_gem_sw_finish_ioctl(struct drm_device *dev, void *data,
 	}
 
 	/* Pinned buffers may be scanout, so flush the cache */
-	if (obj->pin_display)
+	if (obj->pin_display) {
 		i915_gem_object_flush_cpu_write_domain(obj, true);
+		intel_fbc_nuke(obj);
+	}
 
 	drm_gem_object_unreference(&obj->base);
 unlock:
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 2fa843f..2baf0dd 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -836,6 +836,7 @@ void intel_update_sprite_watermarks(struct drm_plane *plane,
 				    bool enabled, bool scaled);
 void intel_init_pm(struct drm_device *dev);
 bool intel_fbc_enabled(struct drm_device *dev);
+void intel_fbc_nuke(struct drm_i915_gem_object *obj);
 void intel_update_fbc(struct drm_device *dev);
 void intel_gpu_ips_init(struct drm_i915_private *dev_priv);
 void intel_gpu_ips_teardown(void);
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 4f274ca..f46bc36 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -418,6 +418,39 @@ void intel_disable_fbc(struct drm_device *dev)
 	}
 }
 
+void intel_fbc_nuke(struct drm_i915_gem_object *obj)
+{
+	struct drm_device *dev = obj->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_crtc *crtc;
+
+	if (dev_priv->fbc.fbc_work) {
+		if (to_intel_framebuffer(dev_priv->fbc.fbc_work->fb)->obj != obj)
+			return;
+
+		crtc = dev_priv->fbc.fbc_work->crtc;
+	} else {
+		if (!dev_priv->fbc.fb)
+			return;
+
+		if (to_intel_framebuffer(dev_priv->fbc.fb)->obj != obj)
+			return;
+
+		if (WARN_ON(dev_priv->fbc.plane < 0))
+			return;
+
+		crtc = dev_priv->plane_to_crtc_mapping[dev_priv->fbc.plane];
+	}
+
+	intel_disable_fbc(dev);
+
+	/*
+	 * Must wait until the next vblank before re-enabling
+	 * otherwise the nuking won't actually happen.
+	 */
+	intel_enable_fbc(crtc, 500);
+}
+
 static bool set_no_fbc_reason(struct drm_i915_private *dev_priv,
 			      enum no_fbc_reason reason)
 {
-- 
1.8.3.2

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

  reply	other threads:[~2013-12-04 16:29 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-21 19:29 [PATCH 0/9] drm/i915: Some more FBC stuff ville.syrjala
2013-11-21 19:29 ` [PATCH 1/9] drm/i915: Don't set the fence number in DPFC_CTL on SNB ville.syrjala
2013-11-21 23:22   ` Chris Wilson
2013-11-25  8:43     ` Daniel Vetter
2013-11-21 19:29 ` [PATCH 2/9] drm/i915: Don't set persistent FBC mode on ILK/SNB ville.syrjala
2013-11-21 19:29 ` [PATCH 3/9] drm/i915: Don't set DPFC_HT_MODIFY bit on CTG/ILK/SNB ville.syrjala
2013-11-21 19:29 ` [PATCH 4/9] drm/i915: Use LRI based FBC render tracking for ILK ville.syrjala
2013-11-27 15:24   ` [PATCH v2 " ville.syrjala
2013-11-28 11:29     ` Chris Wilson
2013-11-21 19:29 ` [PATCH 5/9] drm/i915: Reorder i915_gem_execbuffer_move_to_gpu() and i915_switch_context() ville.syrjala
2013-11-21 19:29 ` [PATCH 6/9] drm/i915: Improve page flip vs. FBC interaction ville.syrjala
2013-11-21 19:29 ` [PATCH 7/9] drm: Push dirtyfb ioctl kms locking down to drivers ville.syrjala
2013-12-03 21:38   ` Daniel Vetter
2013-11-21 19:29 ` [PATCH 8/9] drm/i915: Hook up dirtyfb ioctl for FBC nuke ville.syrjala
2013-11-21 23:18   ` Chris Wilson
2013-11-22 15:19     ` Ville Syrjälä
2013-11-25  8:46       ` Daniel Vetter
2013-11-25 14:54     ` [PATCH v2 8/9] drm/i915: Nuke FBC from SW_FINISH ioctl ville.syrjala
2013-11-25 15:04       ` Chris Wilson
2013-11-25 15:19         ` [PATCH v3 " ville.syrjala
2013-12-04 16:28           ` ville.syrjala [this message]
2013-11-21 19:29 ` [PATCH 9/9] drm/i915: Flush caches for scanout during cpu->gtt move ville.syrjala
2013-11-21 23:20   ` Chris Wilson
2013-11-25  8:47     ` Daniel Vetter
2013-11-25 11:04       ` Chris Wilson
2013-11-25 14:40         ` Ville Syrjälä
2013-11-25 15:12           ` Daniel Vetter
2013-12-03 21:42 ` [PATCH 0/9] drm/i915: Some more FBC stuff Daniel Vetter

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=1386174530-31886-1-git-send-email-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox