Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [RFC PATCH 2/7] drm/i915: Read hw state into an atomic state struct, try 2.
Date: Tue, 23 Jun 2015 13:40:39 +0200	[thread overview]
Message-ID: <20150623114039.GV25769@phenom.ffwll.local> (raw)
In-Reply-To: <5589399C.7060400@linux.intel.com>

On Tue, Jun 23, 2015 at 12:49:00PM +0200, Maarten Lankhorst wrote:
> Op 22-06-15 om 17:31 schreef Daniel Vetter:
> > On Fri, Jun 19, 2015 at 10:02:25AM +0200, Maarten Lankhorst wrote:
> >>  /* Scan out the current hw modeset state, sanitizes it and maps it into the drm
> >> @@ -15491,37 +15569,61 @@ void intel_modeset_setup_hw_state(struct drm_device *dev,
> >>  				  bool force_restore)
> >>  {
> >>  	struct drm_i915_private *dev_priv = dev->dev_private;
> >> -	enum pipe pipe;
> >> -	struct intel_crtc *crtc;
> >> +	struct drm_crtc *crtc;
> >> +	struct drm_crtc_state *crtc_state;
> >>  	struct intel_encoder *encoder;
> >> +	struct drm_atomic_state *state;
> >> +	struct intel_shared_dpll_config shared_dplls[I915_NUM_PLLS];
> >>  	int i;
> >>  
> >> -	intel_modeset_readout_hw_state(dev);
> >> -
> >> -	/*
> >> -	 * Now that we have the config, copy it to each CRTC struct
> >> -	 * Note that this could go away if we move to using crtc_config
> >> -	 * checking everywhere.
> >> -	 */
> >> -	for_each_intel_crtc(dev, crtc) {
> >> -		if (crtc->active && i915.fastboot) {
> >> -			intel_mode_from_pipe_config(&crtc->base.mode,
> >> -						    crtc->config);
> >> -			DRM_DEBUG_KMS("[CRTC:%d] found active mode: ",
> >> -				      crtc->base.base.id);
> >> -			drm_mode_debug_printmodeline(&crtc->base.mode);
> >> -		}
> >> +	state = intel_modeset_readout_hw_state(dev);
> >> +	if (IS_ERR(state)) {
> >> +		DRM_ERROR("Failed to read out hw state\n");
> >> +		return;
> >>  	}
> >>  
> >> +	drm_atomic_helper_swap_state(dev, state);
> >> +
> >> +	/* swap sw/hw dpll state */
> >> +	intel_atomic_duplicate_dpll_state(dev_priv, shared_dplls);
> >> +	intel_shared_dpll_commit(state);
> >> +	memcpy(to_intel_atomic_state(state)->shared_dpll,
> >> +	       shared_dplls, sizeof(*shared_dplls) * dev_priv->num_shared_dpll);
> > This is imo way too much open-coding of stuff that's already there. What I
> > had in mind for force_restore was a generic helper to duplicate all the
> > state objects into a drm_atomic_state, without calling any of the
> > ->atomic_check functions or anything. Then the sequence for restoring
> > state would be.
> >
> > 1. saved_state = drm_atomic_helper_duplicate_state()
> > 2. intel_readout_hw_sate() <- this would just update ->state and sanitize
> > it.
> > 3. drm_atomic_commit(saved_state) wrapped in a WARN_ON to make sure it
> > always works.
> Well, for !force_restore we want to do an initial sanitizing modeset too, but with the full disabled state as reference point.
> I'm not sure dupe state followed by a swap, is different from save old state, and read out to current state.

You also dupe internal state like dplls, that's what a helper-level
duplicat state would avoid. And imo that's cleaner. ->atomic_check should
then grab all the internal states needed, if any are necessary. The goal
really is to avoid another special case with too much knowledge of i915
internals, which atomic really should allow us to do.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-06-23 11:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-19  8:02 [RFC PATCH 0/7] Convert to atomic, part 4 Maarten Lankhorst
2015-06-19  8:02 ` [RFC PATCH 1/7] drm/i915: Do not update pfit state when toggling crtc enabled Maarten Lankhorst
2015-06-19  8:02 ` [RFC PATCH 2/7] drm/i915: Read hw state into an atomic state struct, try 2 Maarten Lankhorst
2015-06-19  9:38   ` Daniel Stone
2015-06-22 15:31   ` Daniel Vetter
2015-06-23 10:49     ` Maarten Lankhorst
2015-06-23 11:40       ` Daniel Vetter [this message]
2015-06-19  8:02 ` [RFC PATCH 3/7] All changes from try2 Maarten Lankhorst
2015-06-19  8:02 ` [RFC PATCH 4/7] drm/i915: enable fastboot for everyone Maarten Lankhorst
2015-06-22 15:21   ` Daniel Vetter
2015-06-23 10:38     ` Maarten Lankhorst
2015-06-23 11:50       ` Daniel Vetter
2015-06-19  8:02 ` [RFC PATCH 5/7] drm/i915: Update power domains only on affected crtc's Maarten Lankhorst
2015-06-19  8:02 ` [RFC PATCH 6/7] drm/i915: Always reset in intel_crtc_restore_mode Maarten Lankhorst
2015-06-22 15:25   ` Daniel Vetter
2015-06-19  8:02 ` [RFC PATCH 7/7] drm/i915: Make intel_display_suspend atomic, try 2 Maarten Lankhorst
2015-06-22 14:54 ` [RFC PATCH 0/7] Convert to atomic, part 4 Daniel Vetter

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=20150623114039.GV25769@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.intel.com \
    /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