public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Alexandra Yates <alexandra.yates@linux.intel.com>
To: intel-gfx@lists.freedesktop.org, rodrigo.vivi@intel.com,
	joe.konno@intel.com, nivedita.swaminathan@intel.com
Subject: [PATCH V2 2/3] FBC status on sysfs interface
Date: Thu, 14 Apr 2016 15:27:58 -0700	[thread overview]
Message-ID: <1460672879-4875-3-git-send-email-alexandra.yates@linux.intel.com> (raw)
In-Reply-To: <1460672879-4875-1-git-send-email-alexandra.yates@linux.intel.com>

This interface allows viewing the status of the FBC.

Exposing this feature on sysfs interface would allow tools such as
powertop to provide status of the Graphics subsystem and aid
debugging RPM

Signed-off-by: Alexandra Yates <alexandra.yates@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_sysfs.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
index 36f4aff..a25bdd7 100644
--- a/drivers/gpu/drm/i915/i915_sysfs.c
+++ b/drivers/gpu/drm/i915/i915_sysfs.c
@@ -121,6 +121,20 @@ show_psr(struct device *kdev, struct device_attribute *attr, char *buf)
 	return ret;
 }
 
+static ssize_t
+show_fbc(struct device *kdev, struct device_attribute *attr, char *buf)
+{
+	struct drm_minor *dminor = dev_to_drm_minor(kdev);
+	struct drm_device *dev = dminor->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	ssize_t ret;
+
+	mutex_lock(&dev_priv->fbc.lock);
+	ret = snprintf(buf, PAGE_SIZE, "%s\n", dev_priv->fbc.enabled ?
+			"enabled":"disabled");
+	mutex_unlock(&dev_priv->fbc.lock);
+	return ret;
+}
 
 static DEVICE_ATTR(rc6_enable, S_IRUGO, show_rc6_mask, NULL);
 static DEVICE_ATTR(rc6_residency_ms, S_IRUGO, show_rc6_ms, NULL);
@@ -128,6 +142,7 @@ static DEVICE_ATTR(rc6p_residency_ms, S_IRUGO, show_rc6p_ms, NULL);
 static DEVICE_ATTR(rc6pp_residency_ms, S_IRUGO, show_rc6pp_ms, NULL);
 static DEVICE_ATTR(media_rc6_residency_ms, S_IRUGO, show_media_rc6_ms, NULL);
 static DEVICE_ATTR(psr_enable, S_IRUGO, show_psr, NULL);
+static DEVICE_ATTR(fbc_enable, S_IRUGO, show_fbc, NULL);
 
 static struct attribute *rc6_attrs[] = {
 	&dev_attr_rc6_enable.attr,
@@ -171,6 +186,16 @@ static struct attribute_group psr_attr_group = {
 	.attrs = psr_attrs
 };
 
+static struct attribute *fbc_attrs[] = {
+	&dev_attr_fbc_enable.attr,
+	NULL
+};
+
+static struct attribute_group fbc_attr_group = {
+	.name = power_group_name,
+	.attrs = fbc_attrs
+};
+
 #endif
 
 static int l3_access_valid(struct drm_device *dev, loff_t offset)
@@ -648,6 +673,12 @@ void i915_setup_sysfs(struct drm_device *dev)
 		if (ret)
 			DRM_ERROR("PSR sysfs setup failed\n");
 	}
+	if (HAS_FBC(dev)) {
+		ret = sysfs_merge_group(&dev->primary->kdev->kobj,
+					&fbc_attr_group);
+		if (ret)
+			DRM_ERROR("FBC sysfs setup failed\n");
+	}
 #endif
 	if (HAS_L3_DPF(dev)) {
 		ret = device_create_bin_file(dev->primary->kdev, &dpf_attrs);
@@ -689,5 +720,6 @@ void i915_teardown_sysfs(struct drm_device *dev)
 	sysfs_unmerge_group(&dev->primary->kdev->kobj, &rc6_attr_group);
 	sysfs_unmerge_group(&dev->primary->kdev->kobj, &rc6p_attr_group);
 	sysfs_unmerge_group(&dev->primary->kdev->kobj, &psr_attr_group);
+	sysfs_unmerge_group(&dev->primary->kdev->kobj, &fbc_attr_group);
 #endif
 }
-- 
2.5.0

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

  parent reply	other threads:[~2016-04-14 22:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <RPM Graphics Features>
2016-04-14 22:27 ` [PATCH V2 0/3] RPM Graphics Features Alexandra Yates
2016-04-14 22:27   ` [PATCH V2 1/3] PSR status on sysfs interface Alexandra Yates
2016-04-14 22:27   ` Alexandra Yates [this message]
2016-04-14 22:27   ` [PATCH V2 3/3] DRRS " Alexandra Yates

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=1460672879-4875-3-git-send-email-alexandra.yates@linux.intel.com \
    --to=alexandra.yates@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=joe.konno@intel.com \
    --cc=nivedita.swaminathan@intel.com \
    --cc=rodrigo.vivi@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