From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 01/10] drm/i915: Remove crtc->config dereference from drrs_ctl
Date: Tue, 16 Oct 2018 23:13:29 +0300 [thread overview]
Message-ID: <20181016201329.GQ9144@intel.com> (raw)
In-Reply-To: <20181011100457.8776-2-maarten.lankhorst@linux.intel.com>
On Thu, Oct 11, 2018 at 12:04:48PM +0200, Maarten Lankhorst wrote:
> Wait for idle, and iterate over connectors instead of encoders.
> With this information we know crtc->state is the actual state,
> and we can enable/disable drrs safely.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Looks sensible
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> drivers/gpu/drm/i915/i915_debugfs.c | 54 ++++++++++++++++++++++-------
> 1 file changed, 42 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index f42e93b71e67..b04d5ade5a15 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -4661,20 +4661,45 @@ static int i915_drrs_ctl_set(void *data, u64 val)
> {
> struct drm_i915_private *dev_priv = data;
> struct drm_device *dev = &dev_priv->drm;
> - struct intel_crtc *intel_crtc;
> - struct intel_encoder *encoder;
> - struct intel_dp *intel_dp;
> + struct intel_crtc *crtc;
>
> if (INTEL_GEN(dev_priv) < 7)
> return -ENODEV;
>
> - drm_modeset_lock_all(dev);
> - for_each_intel_crtc(dev, intel_crtc) {
> - if (!intel_crtc->base.state->active ||
> - !intel_crtc->config->has_drrs)
> - continue;
> + for_each_intel_crtc(dev, crtc) {
> + struct drm_connector_list_iter conn_iter;
> + struct intel_crtc_state *crtc_state;
> + struct drm_connector *connector;
> + struct drm_crtc_commit *commit;
> + int ret;
> +
> + ret = drm_modeset_lock_single_interruptible(&crtc->base.mutex);
> + if (ret)
> + return ret;
> +
> + crtc_state = to_intel_crtc_state(crtc->base.state);
> +
> + if (!crtc_state->base.active ||
> + !crtc_state->has_drrs)
> + goto out;
>
> - for_each_encoder_on_crtc(dev, &intel_crtc->base, encoder) {
> + commit = crtc_state->base.commit;
> + if (commit) {
> + ret = wait_for_completion_interruptible(&commit->hw_done);
> + if (ret)
> + goto out;
> + }
> +
> + drm_connector_list_iter_begin(dev, &conn_iter);
> + drm_for_each_connector_iter(connector, &conn_iter) {
> + struct intel_encoder *encoder;
> + struct intel_dp *intel_dp;
> +
> + if (!(crtc_state->base.connector_mask &
> + drm_connector_mask(connector)))
> + continue;
> +
> + encoder = intel_attached_encoder(connector);
> if (encoder->type != INTEL_OUTPUT_EDP)
> continue;
>
> @@ -4684,13 +4709,18 @@ static int i915_drrs_ctl_set(void *data, u64 val)
> intel_dp = enc_to_intel_dp(&encoder->base);
> if (val)
> intel_edp_drrs_enable(intel_dp,
> - intel_crtc->config);
> + crtc_state);
> else
> intel_edp_drrs_disable(intel_dp,
> - intel_crtc->config);
> + crtc_state);
> }
> + drm_connector_list_iter_end(&conn_iter);
> +
> +out:
> + drm_modeset_unlock(&crtc->base.mutex);
> + if (ret)
> + return ret;
> }
> - drm_modeset_unlock_all(dev);
>
> return 0;
> }
> --
> 2.19.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2018-10-16 20:13 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-11 10:04 [PATCH 00/10] drm/i915: Remove low hanging crtc->config fruit, part 2 Maarten Lankhorst
2018-10-11 10:04 ` [PATCH 01/10] drm/i915: Remove crtc->config dereference from drrs_ctl Maarten Lankhorst
2018-10-16 20:13 ` Ville Syrjälä [this message]
2018-10-17 13:00 ` Maarten Lankhorst
2018-10-11 10:04 ` [PATCH 02/10] drm/i915: Make intel_dp_set_m_n take crtc_state Maarten Lankhorst
2018-10-11 11:39 ` Ville Syrjälä
2018-10-11 10:04 ` [PATCH 03/10] drm/i915: Remove crtc->config references in vlv_prepare_pll Maarten Lankhorst
2018-10-11 11:40 ` Ville Syrjälä
2018-10-11 10:04 ` [PATCH 04/10] drm/i915: Always read out M2_N2 in intel_cpu_transcoder_get_m_n Maarten Lankhorst
2018-10-11 11:56 ` Ville Syrjälä
2018-10-11 18:17 ` Maarten Lankhorst
2018-10-11 19:09 ` Ville Syrjälä
2018-10-15 9:40 ` [PATCH] drm/i915: Always read out M2_N2 in intel_cpu_transcoder_get_m_n, v2 Maarten Lankhorst
2018-10-15 19:12 ` Ville Syrjälä
2018-10-11 10:04 ` [PATCH 05/10] drm/i915: Pass crtc_state to update_scanline_offset Maarten Lankhorst
2018-10-11 11:56 ` Ville Syrjälä
2018-10-11 10:04 ` [PATCH 06/10] drm/i915: Remove crtc->config dereferences in intel_sanitize_crtc Maarten Lankhorst
2018-10-11 11:57 ` Ville Syrjälä
2018-10-11 10:04 ` [PATCH 07/10] drm/i915: Remove crtc->config dereferences in intel_modeset_setup_hw_state Maarten Lankhorst
2018-10-11 11:59 ` Ville Syrjälä
2018-10-16 13:57 ` Maarten Lankhorst
2018-10-11 10:04 ` [PATCH 08/10] drm/i915: Pass crtc_state to lpt_program_iclkip Maarten Lankhorst
2018-10-11 12:00 ` Ville Syrjälä
2018-10-11 10:04 ` [PATCH 09/10] drm/i915: Pass crtc_state to ivybridge_update_fdi_bc_bifurcation Maarten Lankhorst
2018-10-11 12:00 ` Ville Syrjälä
2018-10-11 10:04 ` [PATCH 10/10] drm/i915: Remove crtc->active from crtc_enable callbacks Maarten Lankhorst
2018-10-11 12:06 ` Ville Syrjälä
2018-10-11 11:02 ` ✗ Fi.CI.BAT: failure for drm/i915: Remove low hanging crtc->config fruit, part 2 Patchwork
2018-10-15 10:14 ` ✓ Fi.CI.BAT: success for drm/i915: Remove low hanging crtc->config fruit, part 2. (rev2) Patchwork
2018-10-15 11:16 ` ✓ Fi.CI.IGT: " Patchwork
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=20181016201329.GQ9144@intel.com \
--to=ville.syrjala@linux.intel.com \
--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