On Tue, Mar 03, 2015 at 03:22:00PM +0200, Ander Conselvan de Oliveira wrote: > In the set config modeset path, the atomic state is updated when > changing the staged config in intel_modeset_stage_output_config(). The > load detect code also causes a modeset, but it changes the staged config > before calling intel_set_mode(). A follow up patch will change that > function to also update a drm_atomic_state, and it will need to be able > to pass that to intel_set_mode(). > > Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@xxxxxxxxx> Hm given this patch and the nesting in the previous one maybe we should just add drm_atomic_state scaffolding to all callers of intel_set_mode? Long term we need to switch over the restore_mode function over to atomic anyway (I have ideas for generic helpers already). And the load detect code needs to switch to atomic too anyway. -Daniel > --- > drivers/gpu/drm/i915/intel_display.c | 29 +++++++++++++++++------------ > 1 file changed, 17 insertions(+), 12 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c > index 97d4df5..3c3b5b2 100644 > --- a/drivers/gpu/drm/i915/intel_display.c > +++ b/drivers/gpu/drm/i915/intel_display.c > @@ -83,7 +83,8 @@ static void ironlake_pch_clock_get(struct intel_crtc *crtc, > struct intel_crtc_state *pipe_config); > > static int intel_set_mode(struct drm_crtc *crtc, struct drm_display_mode *mode, > - int x, int y, struct drm_framebuffer *old_fb); > + int x, int y, struct drm_framebuffer *old_fb, > + struct drm_atomic_state *state); > static int intel_framebuffer_init(struct drm_device *dev, > struct intel_framebuffer *ifb, > struct drm_mode_fb_cmd2 *mode_cmd, > @@ -8854,7 +8855,7 @@ retry: > goto fail; > } > > - if (intel_set_mode(crtc, mode, 0, 0, fb)) { > + if (intel_set_mode(crtc, mode, 0, 0, fb, NULL)) { > DRM_DEBUG_KMS("failed to set mode on load-detect pipe\n"); > if (old->release_fb) > old->release_fb->funcs->destroy(old->release_fb); > @@ -8898,7 +8899,7 @@ void intel_release_load_detect_pipe(struct drm_connector *connector, > intel_encoder->new_crtc = NULL; > intel_crtc->new_enabled = false; > intel_crtc->new_config = NULL; > - intel_set_mode(crtc, NULL, 0, 0, NULL); > + intel_set_mode(crtc, NULL, 0, 0, NULL, NULL); > > if (old->release_fb) { > drm_framebuffer_unregister_private(old->release_fb); > @@ -11316,19 +11317,21 @@ static int intel_set_mode_pipes(struct drm_crtc *crtc, > > 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, > + struct drm_atomic_state *state) > { > struct drm_device *dev = crtc->dev; > - struct drm_atomic_state *state; > struct intel_crtc_state *pipe_config; > unsigned modeset_pipes, prepare_pipes, disable_pipes; > int ret = 0; > > - state = drm_atomic_state_alloc(dev); > - if (!state) > - return -ENOMEM; > + if (!state) { > + state = drm_atomic_state_alloc(dev); > + if (!state) > + return -ENOMEM; > > - state->acquire_ctx = dev->mode_config.acquire_ctx; > + state->acquire_ctx = dev->mode_config.acquire_ctx; > + } > > pipe_config = intel_modeset_compute_config(crtc, mode, fb, state, > &modeset_pipes, > @@ -11353,7 +11356,8 @@ out: > > void intel_crtc_restore_mode(struct drm_crtc *crtc) > { > - intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, crtc->primary->fb); > + intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, crtc->primary->fb, > + NULL); > } > > #undef for_each_intel_crtc_masked > @@ -11813,7 +11817,8 @@ fail: > /* Try to restore the config */ > if (config->mode_changed && > intel_set_mode(save_set.crtc, save_set.mode, > - save_set.x, save_set.y, save_set.fb)) > + save_set.x, save_set.y, save_set.fb, > + NULL)) > DRM_ERROR("failed to restore config after modeset failure\n"); > } > > @@ -13857,7 +13862,7 @@ void intel_modeset_setup_hw_state(struct drm_device *dev, > dev_priv->pipe_to_crtc_mapping[pipe]; > > intel_set_mode(crtc, &crtc->mode, crtc->x, crtc->y, > - crtc->primary->fb); > + crtc->primary->fb, NULL); > } > } else { > intel_modeset_update_staged_output_state(dev); > -- > 2.1.0 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@xxxxxxxxxxxxxxxxxxxxx > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx