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 v2 01/10] drm/i915: Grab struct_mutex around all FBC updates
Date: Thu, 21 Nov 2013 13:08:15 +0200	[thread overview]
Message-ID: <1385032095-12030-1-git-send-email-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <1383771745-22463-2-git-send-email-ville.syrjala@linux.intel.com>

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

We need some protection for the FBC state, and since struct_mutex
is it currently in most places, make sure all FBC update/disable
calles are protected by it.

v2: Also protect intel_disable_fbc in i9xx_crtc_disable

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index e85d838..326ceca 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3600,8 +3600,10 @@ static void haswell_crtc_disable_planes(struct drm_crtc *crtc)
 	drm_vblank_off(dev, pipe);
 
 	/* FBC must be disabled before disabling the plane on HSW. */
+	mutex_lock(&dev->struct_mutex);
 	if (dev_priv->fbc.plane == plane)
 		intel_disable_fbc(dev);
+	mutex_unlock(&dev->struct_mutex);
 
 	hsw_disable_ips(intel_crtc);
 
@@ -3741,8 +3743,10 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)
 	intel_crtc_wait_for_pending_flips(crtc);
 	drm_vblank_off(dev, pipe);
 
+	mutex_lock(&dev->struct_mutex);
 	if (dev_priv->fbc.plane == plane)
 		intel_disable_fbc(dev);
+	mutex_unlock(&dev->struct_mutex);
 
 	intel_crtc_update_cursor(crtc, false);
 	intel_disable_planes(crtc);
@@ -4126,7 +4130,9 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc)
 	intel_enable_planes(crtc);
 	intel_crtc_update_cursor(crtc, true);
 
+	mutex_lock(&dev->struct_mutex);
 	intel_update_fbc(dev);
+	mutex_unlock(&dev->struct_mutex);
 
 	for_each_encoder_on_crtc(dev, crtc, encoder)
 		encoder->enable(encoder);
@@ -4170,7 +4176,9 @@ static void i9xx_crtc_enable(struct drm_crtc *crtc)
 	/* Give the overlay scaler a chance to enable if it's on this pipe */
 	intel_crtc_dpms_overlay(intel_crtc, true);
 
+	mutex_lock(&dev->struct_mutex);
 	intel_update_fbc(dev);
+	mutex_unlock(&dev->struct_mutex);
 
 	for_each_encoder_on_crtc(dev, crtc, encoder)
 		encoder->enable(encoder);
@@ -4210,8 +4218,10 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
 	intel_crtc_wait_for_pending_flips(crtc);
 	drm_vblank_off(dev, pipe);
 
+	mutex_lock(&dev->struct_mutex);
 	if (dev_priv->fbc.plane == plane)
 		intel_disable_fbc(dev);
+	mutex_unlock(&dev->struct_mutex);
 
 	intel_crtc_dpms_overlay(intel_crtc, false);
 	intel_crtc_update_cursor(crtc, false);
@@ -4234,7 +4244,9 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
 	intel_crtc->active = false;
 	intel_update_watermarks(crtc);
 
+	mutex_lock(&dev->struct_mutex);
 	intel_update_fbc(dev);
+	mutex_unlock(&dev->struct_mutex);
 }
 
 static void i9xx_crtc_off(struct drm_crtc *crtc)
-- 
1.8.3.2

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

  parent reply	other threads:[~2013-11-21 11:08 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-06 21:02 [PATCH 00/10] drm/i915: FBC fixes v2 ville.syrjala
2013-11-06 21:02 ` [PATCH 01/10] drm/i915: Grab struct_mutex around all FBC updates ville.syrjala
2013-11-20 22:39   ` Rodrigo Vivi
2013-11-21  8:22     ` Daniel Vetter
2013-11-21 10:49       ` Ville Syrjälä
2013-11-21 11:08   ` ville.syrjala [this message]
2013-11-06 21:02 ` [PATCH 02/10] drm/i915: Have FBC keep references to the fb ville.syrjala
2013-11-21 11:09   ` [PATCH v2 " ville.syrjala
2013-11-06 21:02 ` [PATCH 03/10] drm/i915: Grab crtc->mutex in intel_fbc_work_fn() ville.syrjala
2013-11-06 21:02 ` [PATCH 04/10] drm/i915: Limit FBC flush to post batch flush ville.syrjala
2013-11-20 22:48   ` Rodrigo Vivi
2013-11-06 21:02 ` [PATCH 05/10] drm/i915: Emit SRM after the MSG_FBC_REND_STATE LRI ville.syrjala
2013-11-20 22:50   ` Rodrigo Vivi
2013-11-06 21:02 ` [PATCH v3 06/10] drm/i915: Implement LRI based FBC tracking ville.syrjala
2013-11-20 22:55   ` Rodrigo Vivi
2013-11-20 23:17     ` Chris Wilson
2013-11-20 23:46       ` Rodrigo Vivi
2013-11-21 11:14       ` [PATCH v4 " ville.syrjala
2013-11-21 11:49         ` Chris Wilson
2013-11-21 16:33           ` Ville Syrjälä
2013-11-21 16:39             ` Chris Wilson
2013-11-22  4:20               ` Ben Widawsky
2013-11-27 15:22           ` [PATCH v5 " ville.syrjala
2013-11-28 11:29             ` Chris Wilson
2013-11-20 23:53   ` [PATCH v3 " Rodrigo Vivi
2013-11-06 21:02 ` [PATCH v2 07/10] drm/i915: Kill sandybridge_blit_fbc_update() ville.syrjala
2013-11-20 22:56   ` Rodrigo Vivi
2013-11-06 21:02 ` [PATCH v2 08/10] drm/i915: Don't write ILK/IVB_FBC_RT_BASE directly ville.syrjala
2013-11-20 22:57   ` Rodrigo Vivi
2013-11-27 15:24     ` [PATCH v3 08/10] drm/i915: Don't write IVB_FBC_RT_BASE ville.syrjala
2013-11-28 11:30       ` Chris Wilson
2013-11-06 21:02 ` [PATCH 09/10] drm/i915: Set has_fbc=true for all SNB+, except VLV ville.syrjala
2013-11-20 23:00   ` Rodrigo Vivi
2013-11-06 21:02 ` [PATCH 10/10] drm/i915: Use plane_name() in gen7_enable_fbc() ville.syrjala
2013-11-20 23:01   ` Rodrigo Vivi
2013-11-21  8:08     ` Daniel Vetter
2013-11-21  9:57       ` Chris Wilson
2013-11-21 10:55       ` Ville Syrjälä
2013-11-21  9:03 ` [PATCH 00/10] drm/i915: FBC fixes v2 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=1385032095-12030-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