All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <przanoni@gmail.com>
To: Rodrigo Vivi <rodrigo.vivi@gmail.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Add functions to force psr exit
Date: Mon, 8 Jul 2013 10:03:59 -0300	[thread overview]
Message-ID: <CA+gsUGS48KDBVkRQxQ479_o3AhX4iuvTmPz=2pwdE9kYXHMq_A@mail.gmail.com> (raw)
In-Reply-To: <1372441930-18280-1-git-send-email-rodrigo.vivi@gmail.com>

2013/6/28 Rodrigo Vivi <rodrigo.vivi@gmail.com>:
> PSR tracking engine in HSW doesn't detect automagically some directly copy area
> operations through scanout so we will have to kick it manually and
> reschedule it to come back to normal operation as soon as possible.
>
> v2: Before PSR Hook. Don't force it when busy yet.
> v3/v4: Solved small conflict.
>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
> ---
>  drivers/gpu/drm/i915/i915_reg.h  |  1 +
>  drivers/gpu/drm/i915/intel_dp.c  | 59 ++++++++++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/i915/intel_drv.h |  4 +++
>  3 files changed, 64 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 833cc97..a19245b 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -1838,6 +1838,7 @@
>  #define   EDP_PSR_PERF_CNT_MASK                0xffffff
>
>  #define EDP_PSR_DEBUG_CTL              0x64860
> +#define   EDP_PSR_DEBUG_FORCE_EXIT     (3<<30)

Can you please explain why we're using the debug register here?
Usually the debug register is only used for debugging, not as part of
the normal operation. Why can't we do normal/full PSR exit/enter here
using SRD_CTL bit 31 and the enable/disable sequences? What is
different?


>  #define   EDP_PSR_DEBUG_MASK_LPSP      (1<<27)
>  #define   EDP_PSR_DEBUG_MASK_MEMUP     (1<<26)
>  #define   EDP_PSR_DEBUG_MASK_HPD       (1<<25)
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 68c81ab..5001fd9 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -1366,6 +1366,48 @@ bool intel_edp_is_psr_enabled(struct drm_device *dev)
>         return I915_READ(EDP_PSR_CTL) & EDP_PSR_ENABLE;
>  }
>
> +static void intel_edp_psr_delayed_normal_work(struct work_struct *__work)
> +{
> +       struct intel_dp *intel_dp = container_of(to_delayed_work(__work),
> +                                                struct intel_dp,
> +                                                edp_psr_delayed_normal_work);
> +       struct drm_device *dev = intel_dp_to_dev(intel_dp);
> +       struct drm_i915_private *dev_priv = dev->dev_private;
> +
> +       mutex_lock(&intel_dp->psr_exit_mutex);
> +       I915_WRITE(EDP_PSR_DEBUG_CTL, I915_READ(EDP_PSR_DEBUG_CTL) &
> +                  ~EDP_PSR_DEBUG_FORCE_EXIT);
> +       mutex_unlock(&intel_dp->psr_exit_mutex);
> +}
> +
> +void intel_edp_psr_force_exit(struct drm_device *dev)
> +{
> +       struct drm_i915_private *dev_priv = dev->dev_private;
> +       struct intel_encoder *encoder;
> +       struct intel_dp *intel_dp = NULL;
> +
> +       if (!intel_edp_is_psr_enabled(dev))
> +               return;
> +
> +       list_for_each_entry(encoder, &dev->mode_config.encoder_list, base.head)
> +               if (encoder->type == INTEL_OUTPUT_EDP)
> +                       intel_dp = enc_to_intel_dp(&encoder->base);
> +
> +       if (!intel_dp)
> +               return;
> +
> +       if (WARN_ON(!intel_dp->psr_setup_done))
> +               return;
> +
> +       mutex_lock(&intel_dp->psr_exit_mutex);
> +       I915_WRITE(EDP_PSR_DEBUG_CTL, I915_READ(EDP_PSR_DEBUG_CTL) |
> +                  EDP_PSR_DEBUG_FORCE_EXIT);
> +       mutex_unlock(&intel_dp->psr_exit_mutex);
> +
> +       schedule_delayed_work(&intel_dp->edp_psr_delayed_normal_work,
> +                             msecs_to_jiffies(100));

Why 100ms?


> +}
> +
>  void intel_edp_psr_write_vsc(struct intel_dp *intel_dp,
>                              struct edp_vsc_psr *vsc_psr)
>  {
> @@ -1400,6 +1442,18 @@ void intel_edp_psr_write_vsc(struct intel_dp *intel_dp,
>         POSTING_READ(ctl_reg);
>  }
>
> +static void intel_edp_psr_setup(struct intel_dp *intel_dp)
> +{
> +       if (intel_dp->psr_setup_done)
> +               return;
> +
> +       INIT_DELAYED_WORK(&intel_dp->edp_psr_delayed_normal_work,
> +                         intel_edp_psr_delayed_normal_work);
> +       mutex_init(&intel_dp->psr_exit_mutex);
> +
> +       intel_dp->psr_setup_done = true;
> +}
> +
>  static void intel_edp_psr_enable_sink(struct intel_dp *intel_dp)
>  {
>         struct drm_device *dev = intel_dp_to_dev(intel_dp);
> @@ -1544,6 +1598,9 @@ static bool intel_edp_psr_match_conditions(struct intel_dp *intel_dp)
>
>  void intel_edp_psr_do_enable(struct intel_dp *intel_dp)
>  {
> +       /* Setup PSR once */
> +       intel_edp_psr_setup(intel_dp);
> +
>         /* Enable PSR on the panel */
>         intel_edp_psr_enable_sink(intel_dp);
>
> @@ -3413,6 +3470,8 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
>         WARN(error, "intel_dp_i2c_init failed with error %d for port %c\n",
>              error, port_name(port));
>
> +       intel_dp->psr_setup_done = false;
> +
>         if (!intel_edp_init_connector(intel_dp, intel_connector)) {
>                 i2c_del_adapter(&intel_dp->adapter);
>                 if (is_edp(intel_dp)) {
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 65f5001..3b2ccaa 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -497,6 +497,9 @@ struct intel_dp {
>         int backlight_on_delay;
>         int backlight_off_delay;
>         struct delayed_work panel_vdd_work;
> +       struct delayed_work edp_psr_delayed_normal_work;
> +       struct mutex psr_exit_mutex;
> +       bool psr_setup_done;
>         bool want_panel_vdd;
>         struct intel_connector *attached_connector;
>  };
> @@ -844,5 +847,6 @@ extern void intel_edp_psr_enable(struct intel_dp *intel_dp);
>  extern void intel_edp_psr_disable(struct intel_dp *intel_dp);
>  extern void intel_edp_psr_update(struct drm_device *dev);
>  extern bool intel_edp_is_psr_enabled(struct drm_device *dev);
> +extern void intel_edp_psr_force_exit(struct drm_device *dev);
>
>  #endif /* __INTEL_DRV_H__ */
> --
> 1.8.1.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Paulo Zanoni

  parent reply	other threads:[~2013-07-08 13:04 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-26 21:55 [PATCH 01/11] drm: Added SDP and VSC structures for handling PSR for eDP Rodrigo Vivi
2013-06-26 21:55 ` [PATCH 02/11] drm/i915: Read the EDP DPCD and PSR Capability Rodrigo Vivi
2013-06-28 16:57   ` [PATCH] " Rodrigo Vivi
2013-06-26 21:55 ` [PATCH 03/11] drm/i915: split aux_clock_divider logic in a separated function for reuse Rodrigo Vivi
2013-06-26 21:55 ` [PATCH 04/11] drm/i915: Enable/Disable PSR Rodrigo Vivi
2013-06-28 17:16   ` [PATCH] " Rodrigo Vivi
2013-06-28 19:31     ` Paulo Zanoni
2013-07-01 20:40       ` Rodrigo Vivi
2013-07-05 21:58         ` Paulo Zanoni
2013-07-05 22:14           ` Daniel Vetter
2013-07-08 22:09           ` Rodrigo Vivi
2013-07-02  0:29       ` Rodrigo Vivi
2013-07-05 22:20         ` Paulo Zanoni
2013-06-26 21:55 ` [PATCH 05/11] drm/i915: Added debugfs support for PSR Status Rodrigo Vivi
2013-06-28 17:29   ` [PATCH] " Rodrigo Vivi
2013-06-28 20:08     ` Paulo Zanoni
2013-06-28 20:14       ` Paulo Zanoni
2013-07-02  0:46         ` Rodrigo Vivi
2013-06-26 21:55 ` [PATCH 06/11] drm/i915: Match all PSR mode entry conditions before enabling it Rodrigo Vivi
2013-06-28 17:36   ` [PATCH] " Rodrigo Vivi
2013-06-28 20:46     ` Paulo Zanoni
2013-07-01 20:47       ` Rodrigo Vivi
2013-07-05 20:32         ` Daniel Vetter
2013-07-08 22:25           ` Rodrigo Vivi
2013-07-11 18:09             ` Rodrigo Vivi
2013-07-02  0:50       ` Rodrigo Vivi
2013-06-26 21:55 ` [PATCH 07/11] drm/i915: add update function to disable/enable-back PSR Rodrigo Vivi
2013-06-28 17:44   ` [PATCH] " Rodrigo Vivi
2013-07-05 22:48     ` Paulo Zanoni
2013-07-08 21:52       ` Rodrigo Vivi
2013-06-26 21:55 ` [PATCH 08/11] drm/intel: add enable_psr module option Rodrigo Vivi
2013-06-28 17:47   ` [PATCH] " Rodrigo Vivi
2013-07-08 12:45     ` Paulo Zanoni
2013-06-26 21:55 ` [PATCH 09/11] drm/i915: Adding global I915_PARAM for PSR ACTIVE Rodrigo Vivi
2013-06-26 22:18   ` Chris Wilson
2013-06-26 23:23     ` [PATCH] drm/i915: Adding global I915_PARAM for PSR ENABLED Rodrigo Vivi
2013-06-27 12:51       ` Rodrigo Vivi
2013-06-26 21:55 ` [PATCH 10/11] drm/i915: Add functions to force psr exit Rodrigo Vivi
2013-06-27 13:03   ` [PATCH] " Rodrigo Vivi
2013-06-28 17:52     ` Rodrigo Vivi
2013-06-28 17:57       ` Chris Wilson
2013-06-28 18:05         ` Rodrigo Vivi
2013-07-08 13:03       ` Paulo Zanoni [this message]
2013-07-08 21:48         ` Rodrigo Vivi
2013-06-26 21:55 ` [PATCH 11/11] drm/i915: Hook PSR functionality Rodrigo Vivi
2013-06-28 21:00   ` Paulo Zanoni
2013-07-02  0:52     ` [PATCH] " Rodrigo Vivi
2013-07-08 13:13       ` Paulo Zanoni
2013-07-08 19:46         ` Daniel Vetter
2013-07-08 21:40           ` Rodrigo Vivi
2013-07-15 13:55 [PATCH 10/11] drm/i915: Add functions to force psr exit Chris Wilson
2013-07-15 20:29 ` [PATCH] " Rodrigo Vivi
2013-07-18  8:33   ` Daniel Vetter
2013-07-18 16:27     ` Rodrigo Vivi

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='CA+gsUGS48KDBVkRQxQ479_o3AhX4iuvTmPz=2pwdE9kYXHMq_A@mail.gmail.com' \
    --to=przanoni@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=rodrigo.vivi@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.