intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 3/5] drm/i915: Add a powersave framebuffer parameter
Date: Thu, 20 Jun 2013 18:18:30 +0100	[thread overview]
Message-ID: <1371748712-26072-4-git-send-email-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <1371748712-26072-1-git-send-email-chris@chris-wilson.co.uk>

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_debugfs.c  | 3 +++
 drivers/gpu/drm/i915/i915_drv.h      | 1 +
 drivers/gpu/drm/i915/intel_display.c | 7 +++++++
 drivers/gpu/drm/i915/intel_drv.h     | 1 +
 drivers/gpu/drm/i915/intel_pm.c      | 6 ++++++
 include/uapi/drm/i915_drm.h          | 1 +
 6 files changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index d4e78b6..d8deb3b 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1469,6 +1469,9 @@ static int i915_fbc_status(struct seq_file *m, void *unused)
 		case FBC_MODULE_PARAM:
 			seq_printf(m, "disabled per module param (default off)");
 			break;
+		case FBC_USER:
+			seq_printf(m, "disabled by userspace request");
+			break;
 		default:
 			seq_printf(m, "unknown reason");
 		}
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 837e166..01901b5 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -544,6 +544,7 @@ enum no_fbc_reason {
 	FBC_NOT_TILED, /* buffer not tiled */
 	FBC_MULTIPLE_PIPES, /* more than one pipe active */
 	FBC_MODULE_PARAM,
+	FBC_USER,
 };
 
 enum intel_pch {
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 7bb8851..821a52d 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -9173,6 +9173,7 @@ int intel_framebuffer_init(struct drm_device *dev,
 
 	drm_helper_mode_fill_fb_struct(&intel_fb->base, mode_cmd);
 	intel_fb->obj = obj;
+	intel_fb->powersave = true;
 
 	ret = drm_framebuffer_init(dev, &intel_fb->base, &intel_fb_funcs);
 	if (ret) {
@@ -9203,6 +9204,9 @@ __intel_user_framebuffer_getparam(struct intel_framebuffer *fb,
 				  u32 param, u64 *value)
 {
 	switch (param) {
+	case INTEL_FRAMEBUFFER_PARAM_POWERSAVE:
+		*value = fb->powersave;
+		return 0;
 	default:
 		return -EINVAL;
 	}
@@ -9236,6 +9240,9 @@ __intel_user_framebuffer_setparam(struct intel_framebuffer *fb,
 				  u32 param, u64 value)
 {
 	switch (param) {
+	case INTEL_FRAMEBUFFER_PARAM_POWERSAVE:
+		fb->powersave = value;
+		return 0;
 	default:
 		return -EINVAL;
 	}
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index b679adfb..4cddefb 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -102,6 +102,7 @@
 struct intel_framebuffer {
 	struct drm_framebuffer base;
 	struct drm_i915_gem_object *obj;
+	unsigned powersave:1;
 };
 
 struct intel_fbdev {
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 9f7531f..2f6150b 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -488,6 +488,12 @@ void intel_update_fbc(struct drm_device *dev)
 	intel_fb = to_intel_framebuffer(fb);
 	obj = intel_fb->obj;
 
+	if (!intel_fb->powersave) {
+		DRM_DEBUG_KMS("powersaving on this framebuffer disabled\n");
+		dev_priv->no_fbc_reason = FBC_USER;
+		goto out_disable;
+	}
+
 	enable_fbc = i915_enable_fbc;
 	if (enable_fbc < 0) {
 		DRM_DEBUG_KMS("fbc set to per-chip default\n");
diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
index 38a9b52..74c34c2 100644
--- a/include/uapi/drm/i915_drm.h
+++ b/include/uapi/drm/i915_drm.h
@@ -1005,6 +1005,7 @@ struct drm_i915_gem_userptr {
 struct intel_framebuffer_param {
 	__u32 fb_id;
 	__u32 param;
+#define INTEL_FRAMEBUFFER_PARAM_POWERSAVE 1
 	__u64 value;
 };
 
-- 
1.8.3.1

  parent reply	other threads:[~2013-06-20 17:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-20 17:18 RFC frontbuffer write tracking Chris Wilson
2013-06-20 17:18 ` [PATCH 1/5] drm/i915: Amalgamate the parameters to ring flush Chris Wilson
2013-06-20 17:18 ` [PATCH 2/5] drm/i915: Expose framebuffer parameters Chris Wilson
2013-06-20 17:18 ` Chris Wilson [this message]
2013-06-20 17:18 ` [PATCH 4/5] drm/i915: Track modifications to the frontbuffer Chris Wilson
2013-06-20 17:18 ` [PATCH 5/5] drm/i915: Defer the FBC w/a invalidation Chris Wilson
2013-07-18  7:40 ` RFC frontbuffer write tracking 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=1371748712-26072-4-git-send-email-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --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;
as well as URLs for NNTP newsgroup(s).