All of lore.kernel.org
 help / color / mirror / Atom feed
From: jeff.mcgee@intel.com
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 4/5] drm/i915: Add FBC debugfs disabling
Date: Fri, 31 Jan 2014 15:42:51 -0600	[thread overview]
Message-ID: <1391204572-18888-5-git-send-email-jeff.mcgee@intel.com> (raw)
In-Reply-To: <1391204572-18888-1-git-send-email-jeff.mcgee@intel.com>

From: Jeff McGee <jeff.mcgee@intel.com>

i915_fbc_disable:
'0' - FBC enabled normally per device and settings.
'1' - FBC explicitly disabled.

Signed-off-by: Jeff McGee <jeff.mcgee@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 50 +++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_drv.h     |  3 +++
 drivers/gpu/drm/i915/intel_pm.c     |  5 ++++
 3 files changed, 58 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 949c6a4..92f6213 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1386,6 +1386,9 @@ static int i915_fbc_status(struct seq_file *m, void *unused)
 		case FBC_CHIP_DEFAULT:
 			seq_puts(m, "disabled per chip default");
 			break;
+		case FBC_DEBUG_FS:
+			seq_puts(m, "disabled per debugfs");
+			break;
 		default:
 			seq_puts(m, "unknown reason");
 		}
@@ -1394,6 +1397,52 @@ static int i915_fbc_status(struct seq_file *m, void *unused)
 	return 0;
 }
 
+static int i915_fbc_disable_get(void *data, u64 *val)
+{
+	struct drm_device *dev = data;
+	drm_i915_private_t *dev_priv = dev->dev_private;
+
+	if (!HAS_FBC(dev))
+		return -ENODEV;
+
+	*val = dev_priv->fbc.disable;
+
+	return 0;
+}
+
+static int i915_fbc_disable_set(void *data, u64 val)
+{
+	struct drm_device *dev = data;
+	drm_i915_private_t *dev_priv = dev->dev_private;
+	struct drm_crtc *crtc;
+
+	if (!HAS_FBC(dev))
+		return -ENODEV;
+
+	if (dev_priv->fbc.disable == (bool)val)
+		return 0;
+
+	drm_modeset_lock_all(dev);
+
+	DRM_DEBUG_DRIVER("Setting FBC disable %s\n",
+			 val ? "true" : "false");
+
+	dev_priv->fbc.disable = (bool)val;
+
+	/* Reset enabled crtc to force FBC state update */
+	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
+		if (crtc->enabled)
+			intel_crtc_restore_mode(crtc);
+
+	drm_modeset_unlock_all(dev);
+
+	return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(i915_fbc_disable_fops,
+			i915_fbc_disable_get, i915_fbc_disable_set,
+			"%llu\n");
+
 static int i915_ips_status(struct seq_file *m, void *unused)
 {
 	struct drm_info_node *node = (struct drm_info_node *) m->private;
@@ -3703,6 +3752,7 @@ static const struct i915_debugfs_files {
 	{"i915_rps_manual", &i915_rps_manual_fops},
 	{"i915_rc6_disable", &i915_rc6_disable_fops},
 	{"i915_ips_disable", &i915_ips_disable_fops},
+	{"i915_fbc_disable", &i915_fbc_disable_fops},
 	{"i915_cache_sharing", &i915_cache_sharing_fops},
 	{"i915_ring_stop", &i915_ring_stop_fops},
 	{"i915_ring_missed_irq", &i915_ring_missed_irq_fops},
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 93e1547..18b2849 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -763,7 +763,10 @@ struct i915_fbc {
 		FBC_MULTIPLE_PIPES, /* more than one pipe active */
 		FBC_MODULE_PARAM,
 		FBC_CHIP_DEFAULT, /* disabled by default on this chip */
+		FBC_DEBUG_FS, /* user requests disabling through debugfs */
 	} no_fbc_reason;
+
+	bool disable;
 };
 
 struct i915_psr {
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 6478116..a8605fc 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -519,6 +519,11 @@ void intel_update_fbc(struct drm_device *dev)
 			DRM_DEBUG_KMS("fbc disabled per module param\n");
 		goto out_disable;
 	}
+	if (dev_priv->fbc.disable) {
+		if (set_no_fbc_reason(dev_priv, FBC_DEBUG_FS))
+			DRM_DEBUG_KMS("fbc disabled per debugfs\n");
+		goto out_disable;
+	}
 	if ((adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) ||
 	    (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)) {
 		if (set_no_fbc_reason(dev_priv, FBC_UNSUPPORTED_MODE))
-- 
1.8.5.2

  parent reply	other threads:[~2014-01-31 21:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-31 21:42 [PATCH 0/5] Add power feature debugfs disabling jeff.mcgee
2014-01-31 21:42 ` [PATCH 1/5] drm/i915: Add RPS debugfs manual mode jeff.mcgee
2014-02-04 11:31   ` Daniel Vetter
2014-02-04 11:40     ` Chris Wilson
2014-02-04 16:04       ` Jeff McGee
2014-01-31 21:42 ` [PATCH 2/5] drm/i915: Add RC6 debugfs disabling jeff.mcgee
2014-01-31 21:42 ` [PATCH 3/5] drm/i915: Add IPS " jeff.mcgee
2014-01-31 21:42 ` jeff.mcgee [this message]
2014-01-31 21:42 ` [PATCH 5/5] drm/i915: Add CxSR " jeff.mcgee
2014-02-01 17:14 ` [PATCH 0/5] Add power feature " Chris Wilson
2014-02-04 11:33   ` Daniel Vetter
2014-02-04 11:30 ` Daniel Vetter
2014-02-06 15:44   ` Jeff McGee
2014-02-06 16:37     ` Daniel Vetter
2014-02-07 16:43       ` Jeff McGee

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=1391204572-18888-5-git-send-email-jeff.mcgee@intel.com \
    --to=jeff.mcgee@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 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.