intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Vandita Kulkarni <vandita.kulkarni@intel.com>
Cc: jani.nikula@intel.com, intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [V14 5/5] drm/i915/dsi: Enable software vblank counter
Date: Fri, 2 Oct 2020 14:13:09 +0300	[thread overview]
Message-ID: <20201002111309.GC6112@intel.com> (raw)
In-Reply-To: <20200924124209.17916-6-vandita.kulkarni@intel.com>

On Thu, Sep 24, 2020 at 06:12:09PM +0530, Vandita Kulkarni wrote:
> In case of DSI cmd mode, we get hw vblank counter
> updated after the TE comes in, if we try to read
> the hw vblank counter in te handler we wouldnt have
> the udpated vblank counter yet.
> This will lead to a state where we would send the
> vblank event to the user space in the next te,
> though the frame update would have completed in
> the first TE duration itself.
> Hence switch to using software timestamp based
> vblank counter.
> 
> v2: Use mode_flags from crtc_state (Ville)
> 
> Signed-off-by: Vandita Kulkarni <vandita.kulkarni@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 11 +++++++++++
>  drivers/gpu/drm/i915/i915_irq.c              |  4 ++++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 5a9d933e425a..bb495947ccd5 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -1808,6 +1808,17 @@ enum pipe intel_crtc_pch_transcoder(struct intel_crtc *crtc)
>  static u32 intel_crtc_max_vblank_count(const struct intel_crtc_state *crtc_state)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
> +	struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
> +	u32 mode_flags = crtc->mode_flags;

That is still not crtc_state despite what the changelog says.

> +
> +	/*
> +	 * From Gen 11, In case of dsi cmd mode, frame counter wouldnt
> +	 * have updated at the beginning of TE, if we want to use
> +	 * the hw counter, then we would find it updated in only
> +	 * the next TE, hence switching to sw counter.
> +	 */
> +	if (mode_flags & (I915_MODE_FLAG_DSI_USE_TE0 | I915_MODE_FLAG_DSI_USE_TE1))
> +		return 0;
>  
>  	/*
>  	 * On i965gm the hardware frame counter reads
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index c2e4b227bdf3..634c60befe7e 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -682,8 +682,12 @@ u32 i915_get_vblank_counter(struct drm_crtc *crtc)
>  u32 g4x_get_vblank_counter(struct drm_crtc *crtc)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(crtc->dev);
> +	struct drm_vblank_crtc *vblank = &dev_priv->drm.vblank[drm_crtc_index(crtc)];
>  	enum pipe pipe = to_intel_crtc(crtc)->pipe;
>  
> +	if (!vblank->max_vblank_count)
> +		return 0;
> +
>  	return I915_READ(PIPE_FRMCOUNT_G4X(pipe));
>  }
>  
> -- 
> 2.21.0.5.gaeb582a

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2020-10-02 11:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-24 12:42 [Intel-gfx] [V14 0/5] Add support for mipi dsi cmd mode Vandita Kulkarni
2020-09-24 12:42 ` [Intel-gfx] [V14 1/5] drm/i915/dsi: Add details about TE in get_config Vandita Kulkarni
2020-09-24 12:42 ` [Intel-gfx] [V14 2/5] i915/dsi: Configure TE interrupt for cmd mode Vandita Kulkarni
2020-09-24 12:42 ` [Intel-gfx] [V14 3/5] drm/i915/dsi: Add TE handler for dsi " Vandita Kulkarni
2020-09-24 12:42 ` [Intel-gfx] [V14 4/5] drm/i915/dsi: Initiate frame request in " Vandita Kulkarni
2020-09-28 10:17   ` Ville Syrjälä
2020-09-28 10:19     ` Kulkarni, Vandita
2020-09-28 11:08   ` [Intel-gfx] [15 " Vandita Kulkarni
2020-09-24 12:42 ` [Intel-gfx] [V14 5/5] drm/i915/dsi: Enable software vblank counter Vandita Kulkarni
2020-10-02 11:13   ` Ville Syrjälä [this message]
2020-09-24 14:36 ` [Intel-gfx] ✓ Fi.CI.BAT: success for Add support for mipi dsi cmd mode (rev14) Patchwork
2020-09-24 19:35 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2020-09-28 11:47 ` [Intel-gfx] ✓ Fi.CI.BAT: success for Add support for mipi dsi cmd mode (rev15) Patchwork
2020-09-28 15:26 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2020-09-28 15:42   ` Kulkarni, Vandita
2020-09-28 16:01     ` Vudum, Lakshminarayana
2020-09-28 15:54 ` [Intel-gfx] ✓ Fi.CI.IGT: success " Patchwork
2020-09-28 17:07 ` [Intel-gfx] [V14 0/5] Add support for mipi dsi cmd mode Jani Nikula

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=20201002111309.GC6112@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=vandita.kulkarni@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;
as well as URLs for NNTP newsgroup(s).