Skip to contentSkip to conversation

drm: stm: implement get_scanout_position function

PATCH New Benjamin Gaignard 1 participant 1 message Sep 3, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: stm: implement get_scanout_position function

Hardware allow to read the position in scanout buffer so we can use this information to make wait of vblank more accurate.

Active area bounds (start, end, total height) have already been computed and written in ltdc registers, read them and get the current line position to compute vpos value.

---
 drivers/gpu/drm/stm/drv.c  |  2 ++
 drivers/gpu/drm/stm/ltdc.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/stm/ltdc.h |  5 +++++
 3 files changed, 52 insertions(+)
drivers/gpu/drm/stm/drv.c +2 -0
index 8698e08313e1..ac53383350e3 100644
@@ -72,6 +72,8 @@ static struct drm_driver drv_driver = {
 	.gem_prime_vmap = drm_gem_cma_prime_vmap,
 	.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
 	.gem_prime_mmap = drm_gem_cma_prime_mmap,
+	.get_scanout_position = ltdc_crtc_scanoutpos,
+	.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
 };
 
 static int drv_load(struct drm_device *ddev)
drivers/gpu/drm/stm/ltdc.c +45 -0

57 lines not on this page · raw message

drivers/gpu/drm/stm/ltdc.h +5 -0
index 1e16d6afb0d2..b8c5cc41e17a 100644
@@ -37,6 +37,11 @@ struct ltdc_device {
 	struct fps_info plane_fpsi[LTDC_MAX_LAYER];
 };
 
+bool ltdc_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
+			  bool in_vblank_irq, int *vpos, int *hpos,
+			  ktime_t *stime, ktime_t *etime,
+			  const struct drm_display_mode *mode);
+
 int ltdc_load(struct drm_device *ddev);
 void ltdc_unload(struct drm_device *ddev);
 
Signature · 1 line
2.15.0