drm/i915: Use extended power domain bitmask

Submitted by Daniel Stone on Nov. 5, 2015, 4:55 p.m.

Details

Message ID 1446742527-26611-1-git-send-email-daniels@collabora.com
State New
Headers show
Series "Skylake DMC/DC-state fixes and redesign" ( rev: 2 ) in Intel GFX

Not browsing as part of any series.

Commit Message

Daniel Stone Nov. 5, 2015, 4:55 p.m.
c4111f0ac6 extended the size of the power-domain enum to 64 bits wide,
but there are still a few 'unsigned long' users inside intel_display.c.

Make these unsigned long long so we can also capture DRIVER_MODESET,
and use this to simplify the modeset power domain handling a little.

[daniels: New; only required when working against Patrik/Imre's tree.]

Signed-off-by: Daniel Stone <daniels@collabora.com>
---
 drivers/gpu/drm/i915/intel_display.c | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index dc31f33..9c3aa68 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5240,12 +5240,12 @@  static unsigned long get_crtc_power_domains(struct drm_crtc *crtc)
 	return mask;
 }
 
-static unsigned long modeset_get_crtc_power_domains(struct drm_crtc *crtc)
+static unsigned long long modeset_get_crtc_power_domains(struct drm_crtc *crtc)
 {
 	struct drm_i915_private *dev_priv = crtc->dev->dev_private;
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	enum intel_display_power_domain domain;
-	unsigned long domains, new_domains, old_domains;
+	unsigned long long domains, new_domains, old_domains;
 
 	old_domains = intel_crtc->enabled_power_domains;
 	intel_crtc->enabled_power_domains = new_domains = get_crtc_power_domains(crtc);
@@ -5259,7 +5259,7 @@  static unsigned long modeset_get_crtc_power_domains(struct drm_crtc *crtc)
 }
 
 static void modeset_put_power_domains(struct drm_i915_private *dev_priv,
-				      unsigned long domains)
+				      unsigned long long domains)
 {
 	enum intel_display_power_domain domain;
 
@@ -5271,7 +5271,7 @@  static void modeset_update_crtc_power_domains(struct drm_atomic_state *state)
 {
 	struct drm_device *dev = state->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	unsigned long put_domains[I915_MAX_PIPES] = {};
+	unsigned long long put_domains[I915_MAX_PIPES] = {};
 	struct drm_crtc_state *crtc_state;
 	struct drm_crtc *crtc;
 	int i;
@@ -6250,7 +6250,7 @@  static void intel_crtc_disable_noatomic(struct drm_crtc *crtc)
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	struct drm_i915_private *dev_priv = to_i915(crtc->dev);
 	enum intel_display_power_domain domain;
-	unsigned long domains;
+	unsigned long long domains;
 
 	if (!intel_crtc->active)
 		return;
@@ -13318,10 +13318,12 @@  static int intel_atomic_commit(struct drm_device *dev,
 		bool modeset = needs_modeset(crtc->state);
 		bool update_pipe = !modeset &&
 			to_intel_crtc_state(crtc->state)->update_pipe;
-		unsigned long put_domains = 0;
+		unsigned long long put_domains = 0;
 
-		if (modeset)
+		if (modeset) {
 			intel_display_power_get(dev_priv, POWER_DOMAIN_MODESET);
+			put_domains |= POWER_DOMAIN_MODESET;
+		}
 
 		if (modeset && crtc->state->active) {
 			update_scanline_offset(to_intel_crtc(crtc));
@@ -13329,7 +13331,7 @@  static int intel_atomic_commit(struct drm_device *dev,
 		}
 
 		if (update_pipe) {
-			put_domains = modeset_get_crtc_power_domains(crtc);
+			put_domains |= modeset_get_crtc_power_domains(crtc);
 
 			/* make sure intel_modeset_check_state runs */
 			any_ms = true;
@@ -13342,13 +13344,10 @@  static int intel_atomic_commit(struct drm_device *dev,
 		    (crtc->state->planes_changed || update_pipe))
 			drm_atomic_helper_commit_planes_on_crtc(crtc_state);
 
-		if (put_domains)
-			modeset_put_power_domains(dev_priv, put_domains);
-
 		intel_post_plane_update(intel_crtc);
 
-		if (modeset)
-			intel_display_power_put(dev_priv, POWER_DOMAIN_MODESET);
+		if (put_domains)
+			modeset_put_power_domains(dev_priv, put_domains);
 	}
 
 	/* FIXME: add subpixel order */
@@ -15514,7 +15513,7 @@  intel_modeset_setup_hw_state(struct drm_device *dev)
 		ilk_wm_get_hw_state(dev);
 
 	for_each_intel_crtc(dev, crtc) {
-		unsigned long put_domains;
+		unsigned long long put_domains;
 
 		put_domains = modeset_get_crtc_power_domains(&crtc->base);
 		if (WARN_ON(put_domains))