summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>2015-04-21 14:13:06 (GMT)
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-05-08 11:04:02 (GMT)
commit054518ddff87565022bf1eb1578fcb00e42cc847 (patch)
treead6c34caa4c0531195a03bf64cd07b49f0913eba /drivers/gpu/drm/i915
parente13be6651743b6cebdd29d4049dcd52b3ece4274 (diff)
downloadlinux-054518ddff87565022bf1eb1578fcb00e42cc847.tar.xz
drm/i915: Move compute part of __intel_set_mode() to separate function
The first function calls done in that function can still cause changes to the atomic state and may fail. This should eventually be part of our atomic check function, while the rest of the code in __intel_set_mode() is the commit hook. So this makes the legacy mode set more atomic-y. Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com> Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c47
1 files changed, 30 insertions, 17 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index e47dddf..9655f1f 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12232,6 +12232,32 @@ done:
return ret;
}
+/* Code that should eventually be part of atomic_check() */
+static int __intel_set_mode_checks(struct drm_atomic_state *state)
+{
+ struct drm_device *dev = state->dev;
+ int ret;
+
+ /*
+ * See if the config requires any additional preparation, e.g.
+ * to adjust global state with pipes off. We need to do this
+ * here so we can get the modeset_pipe updated config for the new
+ * mode set on this crtc. For other crtcs we need to use the
+ * adjusted_mode bits in the crtc directly.
+ */
+ if (IS_VALLEYVIEW(dev) || IS_BROXTON(dev)) {
+ ret = valleyview_modeset_global_pipes(state);
+ if (ret)
+ return ret;
+ }
+
+ ret = __intel_set_mode_setup_plls(state);
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
static int __intel_set_mode(struct drm_crtc *modeset_crtc,
struct drm_display_mode *mode,
int x, int y, struct drm_framebuffer *fb,
@@ -12247,29 +12273,16 @@ static int __intel_set_mode(struct drm_crtc *modeset_crtc,
int ret = 0;
int i;
+ ret = __intel_set_mode_checks(state);
+ if (ret < 0)
+ return ret;
+
crtc_state_copy = kmalloc(sizeof(*crtc_state_copy), GFP_KERNEL);
if (!crtc_state_copy) {
ret = -ENOMEM;
goto done;
}
- /*
- * See if the config requires any additional preparation, e.g.
- * to adjust global state with pipes off. We need to do this
- * here so we can get the modeset_pipe updated config for the new
- * mode set on this crtc. For other crtcs we need to use the
- * adjusted_mode bits in the crtc directly.
- */
- if (IS_VALLEYVIEW(dev) || IS_BROXTON(dev)) {
- ret = valleyview_modeset_global_pipes(state);
- if (ret)
- goto done;
- }
-
- ret = __intel_set_mode_setup_plls(state);
- if (ret)
- goto done;
-
for_each_crtc_in_state(state, crtc, crtc_state, i) {
if (!needs_modeset(crtc_state))
continue;