From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 3/3] drm/i915: track sprite coverage and disable primary plane if possible
Date: Wed, 7 Dec 2011 12:29:23 -0800 [thread overview]
Message-ID: <1323289763-1963-4-git-send-email-jbarnes@virtuousgeek.org> (raw)
In-Reply-To: <1323289763-1963-1-git-send-email-jbarnes@virtuousgeek.org>
To save power when the sprite is full screen, we can disable the primary
plane on the same pipe. Track the sprite status and enable/disable the
primary opportunistically.
v2: remove primary plane enable/disable hooks; they're identical
Signed-off-by: Jesse Barnes
---
drivers/gpu/drm/i915/intel_drv.h | 1 +
drivers/gpu/drm/i915/intel_sprite.c | 41 +++++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index e0407cd..0340b4c 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -180,6 +180,7 @@ struct intel_plane {
struct drm_plane base;
enum pipe pipe;
struct drm_i915_gem_object *obj;
+ bool primary_disabled;
int max_downscale;
u32 lut_r[1024], lut_g[1024], lut_b[1024];
void (*update_plane)(struct drm_plane *plane,
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index a51edc9..976eee3 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -329,6 +329,28 @@ snb_get_destkey(struct drm_plane *plane)
return value;
}
+static void
+intel_enable_primary(struct drm_crtc *crtc)
+{
+ struct drm_device *dev = crtc->dev;
+ struct drm_i915_private *dev_priv = dev->dev_private;
+ struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+ int reg = DSPCNTR(intel_crtc->plane);
+
+ I915_WRITE(reg, I915_READ(reg) | DISPLAY_PLANE_ENABLE);
+}
+
+static void
+intel_disable_primary(struct drm_crtc *crtc)
+{
+ struct drm_device *dev = crtc->dev;
+ struct drm_i915_private *dev_priv = dev->dev_private;
+ struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+ int reg = DSPCNTR(intel_crtc->plane);
+
+ I915_WRITE(reg, I915_READ(reg) & ~DISPLAY_PLANE_ENABLE);
+}
+
static int
intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
struct drm_framebuffer *fb, int crtc_x, int crtc_y,
@@ -415,9 +437,23 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
intel_plane->obj = obj;
+ /*
+ * Be sure to re-enable the primary before the sprite is no longer
+ * covering it fully.
+ */
+ if (!disable_primary && intel_plane->primary_disabled) {
+ intel_enable_primary(crtc);
+ intel_plane->primary_disabled = false;
+ }
+
intel_plane->update_plane(plane, fb, obj, crtc_x, crtc_y,
crtc_w, crtc_h, x, y, src_w, src_h);
+ if (disable_primary) {
+ intel_disable_primary(crtc);
+ intel_plane->primary_disabled = true;
+ }
+
/* Unpin old obj after new one is active to avoid ugliness */
if (old_obj) {
/*
@@ -447,6 +483,11 @@ intel_disable_plane(struct drm_plane *plane)
struct intel_plane *intel_plane = to_intel_plane(plane);
int ret = 0;
+ if (intel_plane->primary_disabled) {
+ intel_enable_primary(plane->crtc);
+ intel_plane->primary_disabled = false;
+ }
+
intel_plane->disable_plane(plane);
if (!intel_plane->obj)
--
1.7.4.1
next prev parent reply other threads:[~2011-12-07 20:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-07 20:29 Plane support for SNB and IVB Jesse Barnes
2011-12-07 20:29 ` [PATCH 1/3] drm/i915: add SNB and IVB video sprite support v5 Jesse Barnes
2011-12-12 21:56 ` Daniel Vetter
2011-12-13 19:46 ` Jesse Barnes
2011-12-13 21:11 ` Jesse Barnes
2011-12-07 20:29 ` [PATCH 2/3] drm/i915: add destination color key support Jesse Barnes
2011-12-12 22:14 ` Daniel Vetter
2011-12-07 20:29 ` Jesse Barnes [this message]
2011-12-12 22:17 ` [PATCH 3/3] drm/i915: track sprite coverage and disable primary plane if possible Daniel Vetter
2011-12-08 2:58 ` Plane support for SNB and IVB Hai Lan
2011-12-12 21:21 ` Daniel Vetter
-- strict thread matches above, loose matches on Subject: below --
2011-11-14 20:22 [PATCH 1/3] drm/i915: add SNB and IVB video sprite support v2 Jesse Barnes
2011-11-14 20:22 ` [PATCH 3/3] drm/i915: track sprite coverage and disable primary plane if possible Jesse Barnes
2011-11-16 16:05 ` Daniel Vetter
2011-11-16 16:46 ` Jesse Barnes
2011-11-14 19:47 [PATCH 1/3] drm/i915: add SNB and IVB video sprite support v2 Jesse Barnes
2011-11-14 19:47 ` [PATCH 3/3] drm/i915: track sprite coverage and disable primary plane if possible Jesse Barnes
2011-11-08 21:19 [PATCH 1/3] drm/i915: add SNB and IVB video sprite support Jesse Barnes
2011-11-08 21:19 ` [PATCH 3/3] drm/i915: track sprite coverage and disable primary plane if possible Jesse Barnes
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=1323289763-1963-4-git-send-email-jbarnes@virtuousgeek.org \
--to=jbarnes@virtuousgeek.org \
--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