stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] DRM: VBLANK: provide valid timestamp for EVENT_FLIP
@ 2018-09-26 14:25 Eugeniy Paltsev
  2018-09-26 16:37 ` Ville Syrjälä
  0 siblings, 1 reply; 2+ messages in thread
From: Eugeniy Paltsev @ 2018-09-26 14:25 UTC (permalink / raw)
  To: dri-devel
  Cc: linux-snps-arc, linux-kernel, Gustavo Padovan, Maarten Lankhorst,
	Sean Paul, David Airlie, Alexey Brodkin, stable, Eugeniy Paltsev

If driver/HW doesn't support vblank functionality (for example
UDL driver, ARCPGU driver, ...) we always have vblank->time == 0.
In result we always provide zero timestamp for
DRM_EVENT_FLIP_COMPLETE. This breaks userspace apps (for example
weston) which relies on timestamp value.

Setup time to provide valid timestamp for DRM_EVENT_FLIP_COMPLETE
event.

Cc: stable@vger.kernel.org
Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
---
 drivers/gpu/drm/drm_vblank.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 28cdcf76b6f9..0d19aca48782 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -911,6 +911,15 @@ void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
 
 	if (dev->num_crtcs > 0) {
 		seq = drm_vblank_count_and_time(dev, pipe, &now);
+
+		/*
+		 * If driver/HW doesn't support vblank functionality we
+		 * always have vblank->time == 0. Setup time to provide valid
+		 * timestamp for DRM_EVENT_FLIP_COMPLETE event.
+		 */
+		if (!now && e->event.base.type == DRM_EVENT_FLIP_COMPLETE)
+			now = ktime_get();
+
 	} else {
 		seq = 0;
 
-- 
2.14.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] DRM: VBLANK: provide valid timestamp for EVENT_FLIP
  2018-09-26 14:25 [PATCH] DRM: VBLANK: provide valid timestamp for EVENT_FLIP Eugeniy Paltsev
@ 2018-09-26 16:37 ` Ville Syrjälä
  0 siblings, 0 replies; 2+ messages in thread
From: Ville Syrjälä @ 2018-09-26 16:37 UTC (permalink / raw)
  To: Eugeniy Paltsev
  Cc: dri-devel, David Airlie, Alexey Brodkin, linux-kernel, stable,
	linux-snps-arc, Sean Paul

On Wed, Sep 26, 2018 at 05:25:35PM +0300, Eugeniy Paltsev wrote:
> If driver/HW doesn't support vblank functionality (for example
> UDL driver, ARCPGU driver, ...) we always have vblank->time == 0.
> In result we always provide zero timestamp for
> DRM_EVENT_FLIP_COMPLETE. This breaks userspace apps (for example
> weston) which relies on timestamp value.
> 
> Setup time to provide valid timestamp for DRM_EVENT_FLIP_COMPLETE
> event.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
> ---
>  drivers/gpu/drm/drm_vblank.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 28cdcf76b6f9..0d19aca48782 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -911,6 +911,15 @@ void drm_crtc_send_vblank_event(struct drm_crtc *crtc,
>  
>  	if (dev->num_crtcs > 0) {

If those drivers don't support vblank stuff why are they calling
drm_vblank_init() w/ num_crtcs > 0? If they didn't they'd take the
else branch which already does what you want.

>  		seq = drm_vblank_count_and_time(dev, pipe, &now);
> +
> +		/*
> +		 * If driver/HW doesn't support vblank functionality we
> +		 * always have vblank->time == 0. Setup time to provide valid
> +		 * timestamp for DRM_EVENT_FLIP_COMPLETE event.
> +		 */
> +		if (!now && e->event.base.type == DRM_EVENT_FLIP_COMPLETE)
> +			now = ktime_get();
> +
>  	} else {
>  		seq = 0;
>  
> -- 
> 2.14.4
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrj�l�
Intel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-09-26 16:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-26 14:25 [PATCH] DRM: VBLANK: provide valid timestamp for EVENT_FLIP Eugeniy Paltsev
2018-09-26 16:37 ` Ville Syrjälä

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).