All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/10] drm/vblank: Data type fixes for 64-bit vblank sequences.
@ 2018-02-03  5:12 Dhinakaran Pandiyan
  2018-02-03  5:12 ` [PATCH 02/10] drm/i915/vblank: Make the vblank counter u64 -> u32 typecast explicit Dhinakaran Pandiyan
                   ` (13 more replies)
  0 siblings, 14 replies; 31+ messages in thread
From: Dhinakaran Pandiyan @ 2018-02-03  5:12 UTC (permalink / raw)
  To: intel-gfx
  Cc: Keith Packard, Michel Dänzer, dri-devel, Pandiyan,
	Dhinakaran, Rodrigo Vivi

From: "Pandiyan, Dhinakaran" <dhinakaran.pandiyan@intel.com>

drm_vblank_count() has an u32 type returning what is a 64-bit vblank count.
The effect of this is when drm_wait_vblank_ioctl() tries to widen the user
space requested vblank sequence using this clipped 32-bit count(when the
value is >= 2^32) as reference, the requested sequence remains a 32-bit
value and gets queued like that. However, the code that checks if the
requested sequence has passed compares this against the 64-bit vblank
count.

With drm_vblank_count() returning all bits of the vblank count, update
drm_crtc_accurate_vblank_count() so that drm_crtc_arm_vblank_event() queues
the correct sequence. Otherwise, this leads to prolonged waits for a vblank
sequence when the current count is >=2^32.

Finally, fix drm_wait_one_vblank() too.

v2: Commit message fix (Keith)
    Squash commits (Rodrigo)

Fixes: 570e86963a51 ("drm: Widen vblank count to 64-bits [v3]")
Cc: Keith Packard <keithp@keithp.com>
Cc: Michel Dänzer <michel@daenzer.net>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_vblank.c | 8 ++++----
 include/drm/drm_vblank.h     | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 32d9bcf5be7f..f0d3ed5f2528 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -271,7 +271,7 @@ static void drm_update_vblank_count(struct drm_device *dev, unsigned int pipe,
 	store_vblank(dev, pipe, diff, t_vblank, cur_vblank);
 }
 
-static u32 drm_vblank_count(struct drm_device *dev, unsigned int pipe)
+static u64 drm_vblank_count(struct drm_device *dev, unsigned int pipe)
 {
 	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
 
@@ -292,11 +292,11 @@ static u32 drm_vblank_count(struct drm_device *dev, unsigned int pipe)
  * This is mostly useful for hardware that can obtain the scanout position, but
  * doesn't have a hardware frame counter.
  */
-u32 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
+u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
 {
 	struct drm_device *dev = crtc->dev;
 	unsigned int pipe = drm_crtc_index(crtc);
-	u32 vblank;
+	u64 vblank;
 	unsigned long flags;
 
 	WARN_ONCE(drm_debug & DRM_UT_VBL && !dev->driver->get_vblank_timestamp,
@@ -1055,7 +1055,7 @@ void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe)
 {
 	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
 	int ret;
-	u32 last;
+	u64 last;
 
 	if (WARN_ON(pipe >= dev->num_crtcs))
 		return;
diff --git a/include/drm/drm_vblank.h b/include/drm/drm_vblank.h
index 848b463a0af5..a4c3b0a0a197 100644
--- a/include/drm/drm_vblank.h
+++ b/include/drm/drm_vblank.h
@@ -179,7 +179,7 @@ void drm_crtc_wait_one_vblank(struct drm_crtc *crtc);
 void drm_crtc_vblank_off(struct drm_crtc *crtc);
 void drm_crtc_vblank_reset(struct drm_crtc *crtc);
 void drm_crtc_vblank_on(struct drm_crtc *crtc);
-u32 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc);
+u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc);
 
 bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 					   unsigned int pipe, int *max_error,
-- 
2.14.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2018-02-19 22:39 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-03  5:12 [PATCH 01/10] drm/vblank: Data type fixes for 64-bit vblank sequences Dhinakaran Pandiyan
2018-02-03  5:12 ` [PATCH 02/10] drm/i915/vblank: Make the vblank counter u64 -> u32 typecast explicit Dhinakaran Pandiyan
2018-02-03  5:12 ` [PATCH 03/10] drm/i915: Handle 64-bit return from drm_crtc_vblank_count() Dhinakaran Pandiyan
2018-02-03  5:12 ` [PATCH 04/10] drm/amdgpu: " Dhinakaran Pandiyan
2018-02-05 15:20   ` Harry Wentland
2018-02-05 18:11   ` Alex Deucher
2018-02-03  5:12 ` [PATCH 05/10] drm/radeon: " Dhinakaran Pandiyan
2018-02-03  5:12 ` [PATCH 06/10] drm/tegra: " Dhinakaran Pandiyan
2018-02-07  1:41   ` Pandiyan, Dhinakaran
2018-02-07  9:41     ` Thierry Reding
2018-02-07 21:32       ` Pandiyan, Dhinakaran
2018-02-13  7:55         ` Rodrigo Vivi
2018-02-14 18:41           ` [Intel-gfx] " Rodrigo Vivi
2018-02-15 12:17     ` Thierry Reding
2018-02-03  5:12 ` [PATCH 07/10] drm/atomic: " Dhinakaran Pandiyan
2018-02-03  5:13 ` [PATCH 08/10] drm/vblank: Do not update vblank count if interrupts are already disabled Dhinakaran Pandiyan
2018-02-03  5:13 ` [PATCH 09/10] drm/vblank: Restoring vblank counts after device PM events Dhinakaran Pandiyan
2018-02-19 22:39   ` Daniel Vetter
2018-02-03  5:13 ` [PATCH 10/10] drm/i915: Estimate and update missed vblanks Dhinakaran Pandiyan
2018-02-03  6:16 ` ✓ Fi.CI.BAT: success for series starting with [01/10] drm/vblank: Data type fixes for 64-bit vblank sequences Patchwork
2018-02-03  8:14 ` [PATCH 01/10] " Keith Packard
2018-02-05 20:32   ` Rodrigo Vivi
2018-02-05 20:37     ` Dave Airlie
2018-02-05 20:49       ` Rodrigo Vivi
2018-02-05 21:11         ` [Intel-gfx] " Pandiyan, Dhinakaran
2018-02-05 23:41         ` Keith Packard
2018-02-15 19:55       ` Rodrigo Vivi
2018-02-16 18:49         ` [Intel-gfx] " Pandiyan, Dhinakaran
2018-02-03  9:58 ` ✗ Fi.CI.IGT: failure for series starting with [01/10] " Patchwork
2018-02-06 18:38 ` ✓ Fi.CI.BAT: success " Patchwork
2018-02-07  7:20 ` ✗ Fi.CI.BAT: warning " Patchwork

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.