[Intel-gfx] [PATCH 2/5] drm/i915: factor compute_config out of __intel_mode_set

Jesse Barnes jbarnes at virtuousgeek.org
Thu Oct 23 18:59:13 CEST 2014


This allows us to calculate the full pipe config before we do any mode
setting work.

Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>
---
 drivers/gpu/drm/i915/intel_display.c | 40 ++++++++++++++++++++++++++----------
 1 file changed, 29 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index a9c1c32..6aec3ae 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -10976,21 +10976,18 @@ out:
 
 static int __intel_set_mode(struct drm_crtc *crtc,
 			    struct drm_display_mode *mode,
-			    int x, int y, struct drm_framebuffer *fb)
+			    int x, int y, struct drm_framebuffer *fb,
+			    unsigned disable_pipes,
+			    unsigned prepare_pipes,
+			    unsigned modeset_pipes)
 {
 	struct drm_device *dev = crtc->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct drm_display_mode *saved_mode;
 	struct intel_crtc_config *pipe_config = NULL;
 	struct intel_crtc *intel_crtc;
-	unsigned disable_pipes, prepare_pipes, modeset_pipes;
 	int ret = 0;
 
-	ret = intel_modeset_compute_config(crtc, mode, fb, &modeset_pipes,
-					   &prepare_pipes, &disable_pipes);
-	if (ret)
-		return ret;
-
 	saved_mode = kmalloc(sizeof(*saved_mode), GFP_KERNEL);
 	if (!saved_mode)
 		return -ENOMEM;
@@ -11095,13 +11092,17 @@ done:
 	return ret;
 }
 
-static int intel_set_mode(struct drm_crtc *crtc,
-			  struct drm_display_mode *mode,
-			  int x, int y, struct drm_framebuffer *fb)
+static int intel_set_mode_pipes(struct drm_crtc *crtc,
+				struct drm_display_mode *mode,
+				int x, int y, struct drm_framebuffer *fb,
+				unsigned modeset_pipes,
+				unsigned prepare_pipes,
+				unsigned disable_pipes)
 {
 	int ret;
 
-	ret = __intel_set_mode(crtc, mode, x, y, fb);
+	ret = __intel_set_mode(crtc, mode, x, y, fb, modeset_pipes,
+			       prepare_pipes, disable_pipes);
 
 	if (ret == 0)
 		intel_modeset_check_state(crtc->dev);
@@ -11109,6 +11110,23 @@ static int intel_set_mode(struct drm_crtc *crtc,
 	return ret;
 }
 
+static int intel_set_mode(struct drm_crtc *crtc,
+			  struct drm_display_mode *mode,
+			  int x, int y, struct drm_framebuffer *fb)
+{
+	unsigned modeset_pipes, prepare_pipes, disable_pipes;
+	int ret;
+
+	ret = intel_modeset_compute_config(crtc, mode, fb,
+					   &modeset_pipes, &prepare_pipes,
+					   &disable_pipes);
+	if (ret)
+		return ret;
+
+	return intel_set_mode_pipes(crtc, mode, x, y, fb, modeset_pipes,
+				    prepare_pipes, disable_pipes);
+}
+
 void intel_crtc_restore_mode(struct drm_crtc *crtc)
 {
 	intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, crtc->primary->fb);
-- 
1.9.1




More information about the Intel-gfx mailing list