From: Mario Kleiner <mario.kleiner.de@gmail.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 01/21] drm/core: Add drm_accurate_vblank_count, v5.
Date: Wed, 18 May 2016 15:44:48 +0200 [thread overview]
Message-ID: <573C71D0.1080806@gmail.com> (raw)
In-Reply-To: <1463490484-19540-2-git-send-email-maarten.lankhorst@linux.intel.com>
I'm fine with it. I assume the function will only be used by kms
drivers, whose writers probably know when it is safe to call the
function, ie. what kind of potential quirks the kms drivers timestamping
implementation has.
Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>
On 05/17/2016 03:07 PM, Maarten Lankhorst wrote:
> This function is useful for gen2 intel devices which have no frame
> counter, but need a way to determine the current vblank count without
> racing with the vblank interrupt handler.
>
> intel_pipe_update_start checks if no vblank interrupt will occur
> during vblank evasion, but cannot check whether the vblank handler has
> run to completion. This function uses the timestamps to determine
> when the last vblank has happened, and interpolates from there.
>
> Changes since v1:
> - Take vblank_time_lock and don't use drm_vblank_count_and_time.
> Changes since v2:
> - Don't return time of last vblank.
> Changes since v3:
> - Change pipe to unsigned int. (Ville)
> - Remove unused documentation for tv_ret. (kbuild)
> Changes since v4:
> - Add warning to docs when the function is useful.
> - Add a WARN_ON when get_vblank_timestamp is unavailable.
> - Use drm_vblank_count.
>
> Cc: Mario Kleiner <mario.kleiner.de@gmail.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> #v4
> Acked-by: David Airlie <airlied@linux.ie> #irc, v4
> ---
> drivers/gpu/drm/drm_irq.c | 31 +++++++++++++++++++++++++++++++
> include/drm/drmP.h | 1 +
> 2 files changed, 32 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> index 3c1a6f18e71c..d3124b67f4a5 100644
> --- a/drivers/gpu/drm/drm_irq.c
> +++ b/drivers/gpu/drm/drm_irq.c
> @@ -303,6 +303,37 @@ static void drm_update_vblank_count(struct drm_device *dev, unsigned int pipe,
> store_vblank(dev, pipe, diff, &t_vblank, cur_vblank);
> }
>
> +/**
> + * drm_accurate_vblank_count - retrieve the master vblank counter
> + * @crtc: which counter to retrieve
> + *
> + * This function is similar to @drm_crtc_vblank_count but this
> + * function interpolates to handle a race with vblank irq's.
> + *
> + * This is mostly useful for hardware that can obtain the scanout
> + * position, but doesn't have a frame counter.
> + */
> +u32 drm_accurate_vblank_count(struct drm_crtc *crtc)
> +{
> + struct drm_device *dev = crtc->dev;
> + unsigned int pipe = drm_crtc_index(crtc);
> + u32 vblank;
> + unsigned long flags;
> +
> + WARN(!dev->driver->get_vblank_timestamp,
> + "This function requires support for accurate vblank timestamps.");
> +
> + spin_lock_irqsave(&dev->vblank_time_lock, flags);
> +
> + drm_update_vblank_count(dev, pipe, 0);
> + vblank = drm_vblank_count(dev, pipe);
> +
> + spin_unlock_irqrestore(&dev->vblank_time_lock, flags);
> +
> + return vblank;
> +}
> +EXPORT_SYMBOL(drm_accurate_vblank_count);
> +
> /*
> * Disable vblank irq's on crtc, make sure that last vblank count
> * of hardware and corresponding consistent software vblank counter
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index 360b2a74e1ef..ed890384b938 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -1002,6 +1002,7 @@ extern void drm_crtc_vblank_off(struct drm_crtc *crtc);
> extern void drm_crtc_vblank_reset(struct drm_crtc *crtc);
> extern void drm_crtc_vblank_on(struct drm_crtc *crtc);
> extern void drm_vblank_cleanup(struct drm_device *dev);
> +extern u32 drm_accurate_vblank_count(struct drm_crtc *crtc);
> extern u32 drm_vblank_no_hw_counter(struct drm_device *dev, unsigned int pipe);
>
> extern int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-05-18 13:44 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-17 13:07 [PATCH v2 00/21] Rework page flip, remove cs flips, async unpin and unified pageflip Maarten Lankhorst
2016-05-17 13:07 ` [PATCH v2 01/21] drm/core: Add drm_accurate_vblank_count, v5 Maarten Lankhorst
2016-05-18 13:44 ` Mario Kleiner [this message]
2016-05-17 13:07 ` [PATCH v2 02/21] drm/i915: Remove stallcheck special handling, v3 Maarten Lankhorst
2016-05-18 9:21 ` Patrik Jakobsson
2016-05-17 13:07 ` [PATCH v2 03/21] drm/i915: Remove intel_finish_page_flip_plane Maarten Lankhorst
2016-05-18 9:29 ` Patrik Jakobsson
2016-05-17 13:07 ` [PATCH v2 04/21] drm/i915: Remove intel_prepare_page_flip, v3 Maarten Lankhorst
2016-05-18 11:06 ` Patrik Jakobsson
2016-05-17 13:07 ` [PATCH v2 05/21] drm/i915: Add support for detecting vblanks when hw frame counter is unavailable Maarten Lankhorst
2016-05-18 11:09 ` Patrik Jakobsson
2016-05-17 13:07 ` [PATCH v2 06/21] drm/i915: Unify unpin_work and mmio_work into flip_work, v2 Maarten Lankhorst
2016-05-18 11:50 ` Patrik Jakobsson
2016-05-17 13:07 ` [PATCH v2 07/21] Revert "drm/i915: Avoid stalling on pending flips for legacy cursor updates" Maarten Lankhorst
2016-05-18 11:51 ` Patrik Jakobsson
2016-05-17 13:07 ` [PATCH v2 08/21] drm/i915: Allow mmio updates on all platforms, v2 Maarten Lankhorst
2016-05-18 11:58 ` Patrik Jakobsson
2016-05-17 13:07 ` [PATCH v2 09/21] drm/i915: Convert flip_work to a list Maarten Lankhorst
2016-05-18 13:56 ` Patrik Jakobsson
2016-05-17 13:07 ` [PATCH v2 10/21] drm/i915: Add the exclusive fence to plane_state Maarten Lankhorst
2016-05-18 14:30 ` Patrik Jakobsson
2016-05-17 13:07 ` [PATCH v2 11/21] drm/i915: Rework intel_crtc_page_flip to be almost atomic, v3 Maarten Lankhorst
2016-05-19 11:24 ` Patrik Jakobsson
2016-05-17 13:07 ` [PATCH v2 12/21] drm/i915: Remove cs based page flip support Maarten Lankhorst
2016-05-18 20:31 ` Patrik Jakobsson
2016-05-17 13:07 ` [PATCH v2 13/21] drm/i915: Remove use_mmio_flip kernel parameter Maarten Lankhorst
2016-05-18 20:32 ` Patrik Jakobsson
2016-05-17 13:07 ` [PATCH v2 14/21] drm/i915: Remove queue_flip pointer Maarten Lankhorst
2016-05-18 20:34 ` Patrik Jakobsson
2016-05-17 13:07 ` [PATCH v2 15/21] drm/i915: Remove reset_counter from intel_crtc Maarten Lankhorst
2016-05-18 23:20 ` Patrik Jakobsson
2016-05-17 13:07 ` [PATCH v2 16/21] drm/i915: Pass atomic states to fbc update functions Maarten Lankhorst
2016-05-18 23:29 ` Patrik Jakobsson
2016-05-17 13:08 ` [PATCH v2 17/21] drm/i915: Prepare connectors for nonblocking checks Maarten Lankhorst
2016-05-19 11:26 ` Patrik Jakobsson
2016-05-17 13:08 ` [PATCH v2 18/21] drm/i915: Make unpin async Maarten Lankhorst
2016-05-19 11:55 ` Patrik Jakobsson
2016-05-24 14:00 ` Daniel Vetter
2016-05-25 7:03 ` Maarten Lankhorst
2016-05-17 13:08 ` [PATCH v2 19/21] Reapply "drm/i915: Avoid stalling on pending flips for legacy cursor updates" Maarten Lankhorst
2016-05-18 23:45 ` Patrik Jakobsson
2016-05-17 13:08 ` [PATCH v2 20/21] drm/i915: Check for unpin correctness Maarten Lankhorst
2016-05-19 8:21 ` Patrik Jakobsson
2016-05-17 13:08 ` [PATCH v2 21/21] drm/i915: Allow async update of pageflips Maarten Lankhorst
2016-05-19 12:10 ` Patrik Jakobsson
2016-05-19 15:36 ` Daniel Vetter
2016-05-17 13:49 ` ✗ Ro.CI.BAT: failure for Rework page flip, remove cs flips, async unpin and unified pageflip. (rev5) Patchwork
2016-05-19 12:16 ` [PATCH v2 00/21] Rework page flip, remove cs flips, async unpin and unified pageflip Patrik Jakobsson
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=573C71D0.1080806@gmail.com \
--to=mario.kleiner.de@gmail.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