dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Inki Dae <inki.dae@samsung.com>, Rob Clark <rob.clark@linaro.org>,
	Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: [PATCH v2 2/4] drm/exynos: call drm_vblank_put for each queued flip event
Date: Fri,  2 Nov 2012 13:30:48 +0200	[thread overview]
Message-ID: <1351855850-6577-3-git-send-email-imre.deak@intel.com> (raw)
In-Reply-To: <1351855850-6577-1-git-send-email-imre.deak@intel.com>
In-Reply-To: <1351721019-8040-1-git-send-email-imre.deak@intel.com>

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>
---
 drivers/gpu/drm/exynos/exynos_drm_fimd.c |    8 +-------
 drivers/gpu/drm/exynos/exynos_drm_vidi.c |    8 +-------
 drivers/gpu/drm/exynos/exynos_mixer.c    |   11 +----------
 3 files changed, 3 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
index 130a2b5..e69b7c4 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c
@@ -642,17 +642,11 @@ static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc)
 
 		list_move_tail(&e->base.link, &e->base.file_priv->event_list);
 		wake_up_interruptible(&e->base.file_priv->event_wait);
+		drm_vblank_put(drm_dev, crtc);
 	}
 
 	if (is_checked) {
 		/*
-		 * call drm_vblank_put only in case that drm_vblank_get was
-		 * called.
-		 */
-		if (atomic_read(&drm_dev->vblank_refcount[crtc]) > 0)
-			drm_vblank_put(drm_dev, crtc);
-
-		/*
 		 * don't off vblank if vblank_disable_allowed is 1,
 		 * because vblank would be off by timer handler.
 		 */
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
index e4b8a8f..e26d455 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c
@@ -401,17 +401,11 @@ static void vidi_finish_pageflip(struct drm_device *drm_dev, int crtc)
 
 		list_move_tail(&e->base.link, &e->base.file_priv->event_list);
 		wake_up_interruptible(&e->base.file_priv->event_wait);
+		drm_vblank_put(drm_dev, crtc);
 	}
 
 	if (is_checked) {
 		/*
-		 * call drm_vblank_put only in case that drm_vblank_get was
-		 * called.
-		 */
-		if (atomic_read(&drm_dev->vblank_refcount[crtc]) > 0)
-			drm_vblank_put(drm_dev, crtc);
-
-		/*
 		 * don't off vblank if vblank_disable_allowed is 1,
 		 * because vblank would be off by timer handler.
 		 */
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index 614b2e9..5720e82 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -884,7 +884,6 @@ static void mixer_finish_pageflip(struct drm_device *drm_dev, int crtc)
 	struct drm_pending_vblank_event *e, *t;
 	struct timeval now;
 	unsigned long flags;
-	bool is_checked = false;
 
 	spin_lock_irqsave(&drm_dev->event_lock, flags);
 
@@ -894,7 +893,6 @@ static void mixer_finish_pageflip(struct drm_device *drm_dev, int crtc)
 		if (crtc != e->pipe)
 			continue;
 
-		is_checked = true;
 		do_gettimeofday(&now);
 		e->event.sequence = 0;
 		e->event.tv_sec = now.tv_sec;
@@ -902,16 +900,9 @@ static void mixer_finish_pageflip(struct drm_device *drm_dev, int crtc)
 
 		list_move_tail(&e->base.link, &e->base.file_priv->event_list);
 		wake_up_interruptible(&e->base.file_priv->event_wait);
+		drm_vblank_put(drm_dev, crtc);
 	}
 
-	if (is_checked)
-		/*
-		 * call drm_vblank_put only in case that drm_vblank_get was
-		 * called.
-		 */
-		if (atomic_read(&drm_dev->vblank_refcount[crtc]) > 0)
-			drm_vblank_put(drm_dev, crtc);
-
 	spin_unlock_irqrestore(&drm_dev->event_lock, flags);
 }
 
-- 
1.7.9.5

  parent reply	other threads:[~2012-11-02 11:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-31 22:03 [PATCH 1/2] drm: fix order of event_lock wrt. vblank_time_clock Imre Deak
2012-10-31 22:03 ` [PATCH 2/2] drm/i915: lock event_lock for drm_vblank_off() Imre Deak
2012-10-31 22:46   ` Daniel Vetter
2012-11-01  9:34     ` Imre Deak
2012-11-01  9:22 ` [PATCH 1/2] drm: fix order of event_lock wrt. vblank_time_clock Imre Deak
2012-11-02 11:30 ` [PATCH v2 0/4] drm/exynos, intel: fix locking for flip/vbl event list Imre Deak
2012-11-07  9:31   ` Inki Dae
2012-11-07 10:43     ` [PATCH v2 0/4] drm/exynos,intel: " Imre Deak
2012-11-07 16:25       ` [PATCH v2 0/4] drm/exynos, intel: " Inki Dae
2012-11-07 16:28         ` Rob Clark
2012-11-07 16:42           ` Inki Dae
2012-11-02 11:30 ` [PATCH v2 1/4] drm/exynos: hold event_lock while accessing pageflip_event_list Imre Deak
2012-11-02 11:30 ` Imre Deak [this message]
2012-11-02 11:30 ` [PATCH v2 3/4] drm/exynos: fix lockdep for event_lock wrt. vbl_time_lock Imre Deak
2012-11-02 11:30 ` [PATCH v2 4/4] drm: hold event_lock while accessing vblank_event_list Imre Deak

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=1351855850-6577-3-git-send-email-imre.deak@intel.com \
    --to=imre.deak@intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=inki.dae@samsung.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=rob.clark@linaro.org \
    /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;
as well as URLs for NNTP newsgroup(s).