Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/exynos: call drm_vblank_put for each queued flip event

It's guaranteed that for each event on pageflip_event_list we have
called drm_vblank_get() - see exynos_drm_crtc_page_flip() - so checking
for this is redundant.

Also we need to call drm_vblank_put() for each event on the list, not
only once, otherwise we'd leak vblank references if there are multiple
events on the list.

Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>

authored by

Imre Deak and committed by
Inki Dae
e1f48ee5 85473328

+3 -24
+1 -7
drivers/gpu/drm/exynos/exynos_drm_fimd.c
··· 642 642 643 643 list_move_tail(&e->base.link, &e->base.file_priv->event_list); 644 644 wake_up_interruptible(&e->base.file_priv->event_wait); 645 + drm_vblank_put(drm_dev, crtc); 645 646 } 646 647 647 648 if (is_checked) { 648 - /* 649 - * call drm_vblank_put only in case that drm_vblank_get was 650 - * called. 651 - */ 652 - if (atomic_read(&drm_dev->vblank_refcount[crtc]) > 0) 653 - drm_vblank_put(drm_dev, crtc); 654 - 655 649 /* 656 650 * don't off vblank if vblank_disable_allowed is 1, 657 651 * because vblank would be off by timer handler.
+1 -7
drivers/gpu/drm/exynos/exynos_drm_vidi.c
··· 401 401 402 402 list_move_tail(&e->base.link, &e->base.file_priv->event_list); 403 403 wake_up_interruptible(&e->base.file_priv->event_wait); 404 + drm_vblank_put(drm_dev, crtc); 404 405 } 405 406 406 407 if (is_checked) { 407 - /* 408 - * call drm_vblank_put only in case that drm_vblank_get was 409 - * called. 410 - */ 411 - if (atomic_read(&drm_dev->vblank_refcount[crtc]) > 0) 412 - drm_vblank_put(drm_dev, crtc); 413 - 414 408 /* 415 409 * don't off vblank if vblank_disable_allowed is 1, 416 410 * because vblank would be off by timer handler.
+1 -10
drivers/gpu/drm/exynos/exynos_mixer.c
··· 884 884 struct drm_pending_vblank_event *e, *t; 885 885 struct timeval now; 886 886 unsigned long flags; 887 - bool is_checked = false; 888 887 889 888 spin_lock_irqsave(&drm_dev->event_lock, flags); 890 889 ··· 893 894 if (crtc != e->pipe) 894 895 continue; 895 896 896 - is_checked = true; 897 897 do_gettimeofday(&now); 898 898 e->event.sequence = 0; 899 899 e->event.tv_sec = now.tv_sec; ··· 900 902 901 903 list_move_tail(&e->base.link, &e->base.file_priv->event_list); 902 904 wake_up_interruptible(&e->base.file_priv->event_wait); 905 + drm_vblank_put(drm_dev, crtc); 903 906 } 904 - 905 - if (is_checked) 906 - /* 907 - * call drm_vblank_put only in case that drm_vblank_get was 908 - * called. 909 - */ 910 - if (atomic_read(&drm_dev->vblank_refcount[crtc]) > 0) 911 - drm_vblank_put(drm_dev, crtc); 912 907 913 908 spin_unlock_irqrestore(&drm_dev->event_lock, flags); 914 909 }